3446d3f0547b9f3123220e3105a0dd238b020fa7
[libfirm] / ir / be / ia32 / ia32_spec.pl
1 # Creation: 2005/10/19
2 # $Id$
3 # This is the specification for the ia32 assembler Firm-operations
4
5 use File::Basename;
6
7 $new_emit_syntax = 1;
8 my $myname = $0;
9
10 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
11 $arch = "ia32";
12
13 # The node description is done as a perl hash initializer with the
14 # following structure:
15 #
16 # %nodes = (
17 #
18 # <op-name> => {
19 #   op_flags  => "N|L|C|X|I|F|Y|H|c|K",
20 #   irn_flags => "R|N|I|S"
21 #   arity     => "0|1|2|3 ... |variable|dynamic|any",
22 #   state     => "floats|pinned|mem_pinned|exc_pinned",
23 #   args      => [
24 #                    { type => "type 1", name => "name 1" },
25 #                    { type => "type 2", name => "name 2" },
26 #                    ...
27 #                  ],
28 #   comment   => "any comment for constructor",
29 #   reg_req   => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
30 #   cmp_attr  => "c source code for comparing node attributes",
31 #   emit      => "emit code with templates",
32 #   attr      => "attitional attribute arguments for constructor"
33 #   init_attr => "emit attribute initialization template"
34 #   rd_constructor => "c source code which constructs an ir_node"
35 #   latency   => "latency of this operation (can be float)"
36 # },
37 #
38 # ... # (all nodes you need to describe)
39 #
40 # ); # close the %nodes initializer
41
42 # op_flags: flags for the operation, OPTIONAL (default is "N")
43 # the op_flags correspond to the firm irop_flags:
44 #   N   irop_flag_none
45 #   L   irop_flag_labeled
46 #   C   irop_flag_commutative
47 #   X   irop_flag_cfopcode
48 #   I   irop_flag_ip_cfopcode
49 #   F   irop_flag_fragile
50 #   Y   irop_flag_forking
51 #   H   irop_flag_highlevel
52 #   c   irop_flag_constlike
53 #   K   irop_flag_keep
54 #
55 # irn_flags: special node flags, OPTIONAL (default is 0)
56 # following irn_flags are supported:
57 #   R   rematerializeable
58 #   N   not spillable
59 #   I   ignore for register allocation
60 #   S   modifies stack pointer
61 #
62 # state: state of the operation, OPTIONAL (default is "floats")
63 #
64 # arity: arity of the operation, MUST NOT BE OMITTED
65 #
66 # args:  the OPTIONAL arguments of the node constructor (debug, irg and block
67 #        are always the first 3 arguments and are always autmatically
68 #        created)
69 #        If this key is missing the following arguments will be created:
70 #        for i = 1 .. arity: ir_node *op_i
71 #        ir_mode *mode
72 #
73 # outs:  if a node defines more than one output, the names of the projections
74 #        nodes having outs having automatically the mode mode_T
75 #        One can also annotate some flags for each out, additional to irn_flags.
76 #        They are separated from name with a colon ':', and concatenated by pipe '|'
77 #        Only I and S are available at the moment (same meaning as in irn_flags).
78 #        example: [ "frame:I", "stack:I|S", "M" ]
79 #
80 # comment: OPTIONAL comment for the node constructor
81 #
82 # rd_constructor: for every operation there will be a
83 #      new_rd_<arch>_<op-name> function with the arguments from above
84 #      which creates the ir_node corresponding to the defined operation
85 #      you can either put the complete source code of this function here
86 #
87 #      This key is OPTIONAL. If omitted, the following constructor will
88 #      be created:
89 #      if (!op_<arch>_<op-name>) assert(0);
90 #      for i = 1 to arity
91 #         set in[i] = op_i
92 #      done
93 #      res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
94 #      return res
95 #
96 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
97 #
98 # latency: the latency of the operation, default is 1
99 #
100
101 # register types:
102 #   0 - no special type
103 #   1 - caller save (register must be saved by the caller of a function)
104 #   2 - callee save (register must be saved by the called function)
105 #   4 - ignore (do not assign this register)
106 #   8 - emitter can choose an arbitrary register of this class
107 #  16 - the register is a virtual one
108 #  32 - register represents a state
109 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
110 %reg_classes = (
111         gp => [
112                 { name => "eax", type => 1 },
113                 { name => "edx", type => 1 },
114                 { name => "ebx", type => 2 },
115                 { name => "ecx", type => 1 },
116                 { name => "esi", type => 2 },
117                 { name => "edi", type => 2 },
118                 { name => "ebp", type => 2 },
119                 { name => "esp", type => 4 },
120                 { name => "gp_NOREG", type => 4 | 8 | 16 }, # we need a dummy register for NoReg nodes
121                 { name => "gp_UKNWN", type => 4 | 8 | 16 },  # we need a dummy register for Unknown nodes
122                 { mode => "mode_Iu" }
123         ],
124         xmm => [
125                 { name => "xmm0", type => 1 },
126                 { name => "xmm1", type => 1 },
127                 { name => "xmm2", type => 1 },
128                 { name => "xmm3", type => 1 },
129                 { name => "xmm4", type => 1 },
130                 { name => "xmm5", type => 1 },
131                 { name => "xmm6", type => 1 },
132                 { name => "xmm7", type => 1 },
133                 { name => "xmm_NOREG", type => 4 | 16 },     # we need a dummy register for NoReg nodes
134                 { name => "xmm_UKNWN", type => 4 | 8 | 16},  # we need a dummy register for Unknown nodes
135                 { mode => "mode_E" }
136         ],
137         vfp => [
138                 { name => "vf0", type => 1 | 16 },
139                 { name => "vf1", type => 1 | 16 },
140                 { name => "vf2", type => 1 | 16 },
141                 { name => "vf3", type => 1 | 16 },
142                 { name => "vf4", type => 1 | 16 },
143                 { name => "vf5", type => 1 | 16 },
144                 { name => "vf6", type => 1 | 16 },
145                 { name => "vf7", type => 1 | 16 },
146                 { name => "vfp_NOREG", type => 4 | 8 | 16 }, # we need a dummy register for NoReg nodes
147                 { name => "vfp_UKNWN", type => 4 | 8 | 16 },  # we need a dummy register for Unknown nodes
148                 { mode => "mode_E" }
149         ],
150         st => [
151                 { name => "st0", type => 4 },
152                 { name => "st1", type => 4 },
153                 { name => "st2", type => 4 },
154                 { name => "st3", type => 4 },
155                 { name => "st4", type => 4 },
156                 { name => "st5", type => 4 },
157                 { name => "st6", type => 4 },
158                 { name => "st7", type => 4 },
159                 { mode => "mode_E" }
160         ],
161         fp_cw => [      # the floating point control word
162                 { name => "fpcw", type => 4 | 32},
163                 { mode => "mode_Hu" }
164         ],
165 ); # %reg_classes
166
167 %cpu = (
168         GP     => [ 1, "GP_EAX", "GP_EBX", "GP_ECX", "GP_EDX", "GP_ESI", "GP_EDI", "GP_EBP" ],
169         SSE    => [ 1, "SSE_XMM0", "SSE_XMM1", "SSE_XMM2", "SSE_XMM3", "SSE_XMM4", "SSE_XMM5", "SSE_XMM6", "SSE_XMM7" ],
170         VFP    => [ 1, "VFP_VF0", "VFP_VF1", "VFP_VF2", "VFP_VF3", "VFP_VF4", "VFP_VF5", "VFP_VF6", "VFP_VF7" ],
171         BRANCH => [ 1, "BRANCH1", "BRANCH2" ],
172 ); # %cpu
173
174 %vliw = (
175         bundle_size       => 1,
176         bundels_per_cycle => 1
177 ); # vliw
178
179 %emit_templates = (
180         S1 => "${arch}_emit_source_register(env, node, 0);",
181         S2 => "${arch}_emit_source_register(env, node, 1);",
182         S3 => "${arch}_emit_source_register(env, node, 2);",
183         S4 => "${arch}_emit_source_register(env, node, 3);",
184         S5 => "${arch}_emit_source_register(env, node, 4);",
185         S6 => "${arch}_emit_source_register(env, node, 5);",
186         D1 => "${arch}_emit_dest_register(env, node, 0);",
187         D2 => "${arch}_emit_dest_register(env, node, 1);",
188         D3 => "${arch}_emit_dest_register(env, node, 2);",
189         D4 => "${arch}_emit_dest_register(env, node, 3);",
190         D5 => "${arch}_emit_dest_register(env, node, 4);",
191         D6 => "${arch}_emit_dest_register(env, node, 5);",
192         A1 => "${arch}_emit_in_node_name(env, node, 0);",
193         A2 => "${arch}_emit_in_node_name(env, node, 1);",
194         A3 => "${arch}_emit_in_node_name(env, node, 2);",
195         A4 => "${arch}_emit_in_node_name(env, node, 3);",
196         A5 => "${arch}_emit_in_node_name(env, node, 4);",
197         A6 => "${arch}_emit_in_node_name(env, node, 5);",
198         X1 => "${arch}_emit_x87_name(env, node, 0);",
199         X2 => "${arch}_emit_x87_name(env, node, 1);",
200         X3 => "${arch}_emit_x87_name(env, node, 2);",
201         C  => "${arch}_emit_immediate(env, node);",
202         SE => "${arch}_emit_extend_suffix(env, get_ia32_ls_mode(node));",
203         ME => "if(get_mode_size_bits(get_ia32_ls_mode(node)) != 32)\n
204         ia32_emit_mode_suffix(env, get_ia32_ls_mode(node));",
205         M  => "${arch}_emit_mode_suffix(env, get_ia32_ls_mode(node));",
206         XM => "${arch}_emit_x87_mode_suffix(env, node);",
207         XXM => "${arch}_emit_xmm_mode_suffix(env, node);",
208         XSD => "${arch}_emit_xmm_mode_suffix_s(env, node);",
209         AM => "${arch}_emit_am(env, node);",
210         unop => "${arch}_emit_unop(env, node);",
211         binop => "${arch}_emit_binop(env, node);",
212         x87_binop => "${arch}_emit_x87_binop(env, node);",
213 );
214
215 #--------------------------------------------------#
216 #                        _                         #
217 #                       (_)                        #
218 #  _ __   _____      __  _ _ __    ___  _ __  ___  #
219 # | '_ \ / _ \ \ /\ / / | | '__|  / _ \| '_ \/ __| #
220 # | | | |  __/\ V  V /  | | |    | (_) | |_) \__ \ #
221 # |_| |_|\___| \_/\_/   |_|_|     \___/| .__/|___/ #
222 #                                      | |         #
223 #                                      |_|         #
224 #--------------------------------------------------#
225
226 $default_cmp_attr = "return ia32_compare_attr(attr_a, attr_b);";
227
228 %operands = (
229 );
230
231 %nodes = (
232
233 #-----------------------------------------------------------------#
234 #  _       _                                         _            #
235 # (_)     | |                                       | |           #
236 #  _ _ __ | |_ ___  __ _  ___ _ __   _ __   ___   __| | ___  ___  #
237 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
238 # | | | | | ||  __/ (_| |  __/ |    | | | | (_) | (_| |  __/\__ \ #
239 # |_|_| |_|\__\___|\__, |\___|_|    |_| |_|\___/ \__,_|\___||___/ #
240 #                   __/ |                                         #
241 #                  |___/                                          #
242 #-----------------------------------------------------------------#
243
244 # commutative operations
245
246 # NOTE:
247 # All nodes supporting Addressmode have 5 INs:
248 # 1 - base    r1 == NoReg in case of no AM or no base
249 # 2 - index   r2 == NoReg in case of no AM or no index
250 # 3 - op1     r3 == always present
251 # 4 - op2     r4 == NoReg in case of immediate operation
252 # 5 - mem     NoMem in case of no AM otherwise it takes the mem from the Load
253
254 Add => {
255         irn_flags => "R",
256         comment   => "construct Add: Add(a, b) = Add(b, a) = a + b",
257         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
258         emit      => '. addl %binop',
259         units     => [ "GP" ],
260         mode      => "mode_Iu",
261 },
262
263 Adc => {
264         comment   => "construct Add with Carry: Adc(a, b) = Add(b, a) = a + b + carry",
265         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
266         emit      => '. adcl %binop',
267         units     => [ "GP" ],
268         mode      => "mode_Iu",
269 },
270
271 Add64Bit => {
272         irn_flags => "R",
273         comment   => "construct 64Bit Add: Add(a_l, a_h, b_l, b_h) = a_l + b_l; a_h + b_h + carry",
274         arity     => 4,
275         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
276         emit      => '
277 . movl %S1, %D1
278 . movl %S2, %D2
279 . addl %S3, %D1
280 . adcl %S4, %D2
281 ',
282         outs      => [ "low_res", "high_res" ],
283         units     => [ "GP" ],
284 },
285
286 l_Add => {
287         op_flags  => "C",
288         irn_flags => "R",
289         cmp_attr  => "return 1;",
290         comment   => "construct lowered Add: Add(a, b) = Add(b, a) = a + b",
291         arity     => 2,
292 },
293
294 l_Adc => {
295         op_flags  => "C",
296         cmp_attr  => "return 1;",
297         comment   => "construct lowered Add with Carry: Adc(a, b) = Adc(b, a) = a + b + carry",
298         arity     => 2,
299 },
300
301 Mul => {
302         # we should not rematrialize this node. It produces 2 results and has
303         # very strict constrains
304         comment   => "construct MulS: MulS(a, b) = MulS(b, a) = a * b",
305         reg_req   => { in => [ "gp", "gp", "eax", "gp", "none" ], out => [ "eax", "edx", "none" ] },
306         emit      => '. mull %unop',
307         outs      => [ "EAX", "EDX", "M" ],
308         latency   => 10,
309         units     => [ "GP" ],
310 },
311
312 l_Mul => {
313         # we should not rematrialize this node. It produces 2 results and has
314         # very strict constrains
315         op_flags  => "C",
316         cmp_attr  => "return 1;",
317         comment   => "construct lowered MulS: Mul(a, b) = Mul(b, a) = a * b",
318         outs      => [ "EAX", "EDX", "M" ],
319         arity     => 2
320 },
321
322 IMul => {
323         irn_flags => "R",
324         comment   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
325         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
326         emit      => '. imull %binop',
327         latency   => 5,
328         units     => [ "GP" ],
329         mode      => "mode_Iu",
330 },
331
332 IMul1OP => {
333         irn_flags => "R",
334         comment   => "construct Mul (1 operand format): Mul(a, b) = Mul(b, a) = a * b",
335         reg_req   => { in => [ "gp", "gp", "eax", "gp", "none" ], out => [ "eax", "edx", "none" ] },
336         emit      => '. imull %unop',
337         outs      => [ "EAX", "EDX", "M" ],
338         latency   => 5,
339         units     => [ "GP" ],
340 },
341
342 l_IMul => {
343         op_flags  => "C",
344         cmp_attr  => "return 1;",
345         comment   => "construct lowered IMul: IMul(a, b) = IMul(b, a) = a * b",
346         arity     => 2
347 },
348
349 And => {
350         irn_flags => "R",
351         comment   => "construct And: And(a, b) = And(b, a) = a AND b",
352         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
353         emit      => '. andl %binop',
354         units     => [ "GP" ],
355         mode      => "mode_Iu",
356 },
357
358 Or => {
359         irn_flags => "R",
360         comment   => "construct Or: Or(a, b) = Or(b, a) = a OR b",
361         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
362         emit      => '. orl %binop',
363         units     => [ "GP" ],
364         mode      => "mode_Iu",
365 },
366
367 Xor => {
368         irn_flags => "R",
369         comment   => "construct Xor: Xor(a, b) = Xor(b, a) = a EOR b",
370         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
371         emit      => '. xorl %binop',
372         units     => [ "GP" ],
373         mode      => "mode_Iu",
374 },
375
376 l_Xor => {
377         op_flags  => "C",
378         cmp_attr  => "return 1;",
379         comment   => "construct lowered Xor: Xor(a, b) = Xor(b, a) = a XOR b",
380         arity     => 2
381 },
382
383 # not commutative operations
384
385 Sub => {
386         irn_flags => "R",
387         comment   => "construct Sub: Sub(a, b) = a - b",
388         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
389         emit      => '. subl %binop',
390         units     => [ "GP" ],
391         mode      => "mode_Iu",
392 },
393
394 Sbb => {
395         comment   => "construct Sub with Carry: SubC(a, b) = a - b - carry",
396         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3 !in_r4" ] },
397         emit      => '. sbbl %binop',
398         units     => [ "GP" ],
399         mode      => "mode_Iu",
400 },
401
402 Sub64Bit => {
403         irn_flags => "R",
404         comment   => "construct 64Bit Sub: Sub(a_l, a_h, b_l, b_h) = a_l - b_l; a_h - b_h - borrow",
405         arity     => 4,
406         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
407         emit      => '
408 . movl %S1, %D1
409 . movl %S2, %D2
410 . subl %S3, %D1
411 . sbbl %S4, %D2
412 ',
413         outs      => [ "low_res", "high_res" ],
414         units     => [ "GP" ],
415 },
416
417 l_Sub => {
418         irn_flags => "R",
419         cmp_attr  => "return 1;",
420         comment   => "construct lowered Sub: Sub(a, b) = a - b",
421         arity     => 2,
422 },
423
424 l_Sbb => {
425         cmp_attr  => "return 1;",
426         comment   => "construct lowered Sub with Carry: SubC(a, b) = a - b - carry",
427         arity     => 2,
428 },
429
430 IDiv => {
431         op_flags  => "F|L",
432         state     => "exc_pinned",
433         reg_req   => { in => [ "gp", "gp", "eax", "edx", "gp", "none" ], out => [ "eax", "edx", "none" ] },
434         attr      => "ia32_op_flavour_t dm_flav",
435         init_attr => "attr->data.op_flav = dm_flav;",
436         emit      => ". idivl %unop",
437         outs      => [ "div_res", "mod_res", "M" ],
438         latency   => 25,
439         units     => [ "GP" ],
440 },
441
442 Div => {
443         op_flags  => "F|L",
444         state     => "exc_pinned",
445         reg_req   => { in => [ "gp", "gp", "eax", "edx", "gp", "none" ], out => [ "eax", "edx", "none" ] },
446         attr      => "ia32_op_flavour_t dm_flav",
447         init_attr => "attr->data.op_flav = dm_flav;",
448         emit      => ". divl %unop",
449         outs      => [ "div_res", "mod_res", "M" ],
450         latency   => 25,
451         units     => [ "GP" ],
452 },
453
454 Shl => {
455         irn_flags => "R",
456         comment   => "construct Shl: Shl(a, b) = a << b",
457         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
458         emit      => '. shll %binop',
459         units     => [ "GP" ],
460         mode      => "mode_Iu",
461 },
462
463 l_Shl => {
464         cmp_attr  => "return 1;",
465         comment   => "construct lowered Shl: Shl(a, b) = a << b",
466         arity     => 2
467 },
468
469 ShlD => {
470         irn_flags => "R",
471         comment   => "construct ShlD: ShlD(a, b, c) = a, b << count (shift left count bits from b into a)",
472         # Out requirements is: different from all in
473         # This is because, out must be different from LowPart and ShiftCount.
474         # We could say "!ecx !in_r4" but it can occur, that all values live through
475         # this Shift and the only value dying is the ShiftCount. Then there would be a
476         # register missing, as result must not be ecx and all other registers are
477         # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
478         # (and probably never will). So we create artificial interferences of the result
479         # with all inputs, so the spiller can always assure a free register.
480         reg_req   => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
481         emit      =>
482 '
483 if (get_ia32_immop_type(node) == ia32_ImmNone) {
484         if (get_ia32_op_type(node) == ia32_AddrModeD) {
485                 . shldl %%cl, %S4, %AM
486         } else {
487                 . shldl %%cl, %S4, %S3
488         }
489 } else {
490         if (get_ia32_op_type(node) == ia32_AddrModeD) {
491                 . shldl $%C, %S4, %AM
492         } else {
493                 . shldl $%C, %S4, %S3
494         }
495 }
496 ',
497         latency   => 6,
498         units     => [ "GP" ],
499         mode      => "mode_Iu",
500 },
501
502 l_ShlD => {
503         cmp_attr  => "return 1;",
504         comment   => "construct lowered ShlD: ShlD(a, b, c) = a, b << count (shift left count bits from b into a)",
505         arity     => 3,
506 },
507
508 Shr => {
509         irn_flags => "R",
510         comment   => "construct Shr: Shr(a, b) = a >> b",
511         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
512         emit      => '. shrl %binop',
513         units     => [ "GP" ],
514         mode      => "mode_Iu",
515 },
516
517 l_Shr => {
518         cmp_attr  => "return 1;",
519         comment   => "construct lowered Shr: Shr(a, b) = a << b",
520         arity     => 2
521 },
522
523 ShrD => {
524         irn_flags => "R",
525         comment   => "construct ShrD: ShrD(a, b, c) = a, b >> count (shift rigth count bits from a into b)",
526         # Out requirements is: different from all in
527         # This is because, out must be different from LowPart and ShiftCount.
528         # We could say "!ecx !in_r4" but it can occur, that all values live through
529         # this Shift and the only value dying is the ShiftCount. Then there would be a
530         # register missing, as result must not be ecx and all other registers are
531         # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
532         # (and probably never will). So we create artificial interferences of the result
533         # with all inputs, so the spiller can always assure a free register.
534         reg_req   => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
535         emit      => '
536 if (get_ia32_immop_type(node) == ia32_ImmNone) {
537         if (get_ia32_op_type(node) == ia32_AddrModeD) {
538                 . shrdl %%cl, %S4, %AM
539         } else {
540                 . shrdl %%cl, %S4, %S3
541         }
542 } else {
543         if (get_ia32_op_type(node) == ia32_AddrModeD) {
544                 . shrdl $%C, %S4, %AM
545         } else {
546                 . shrdl $%C, %S4, %S3
547         }
548 }
549 ',
550         latency   => 6,
551         units     => [ "GP" ],
552         mode      => "mode_Iu",
553 },
554
555 l_ShrD => {
556         cmp_attr  => "return 1;",
557         comment   => "construct lowered ShrD: ShrD(a, b, c) = a, b >> count (shift rigth count bits from a into b)",
558         arity     => 3
559 },
560
561 Sar => {
562         irn_flags => "R",
563         comment   => "construct Shrs: Shrs(a, b) = a >> b",
564         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
565         emit      => '. sarl %binop',
566         units     => [ "GP" ],
567         mode      => "mode_Iu",
568 },
569
570 l_Sar => {
571         cmp_attr  => "return 1;",
572         comment   => "construct lowered Sar: Sar(a, b) = a << b",
573         arity     => 2
574 },
575
576 Ror => {
577         irn_flags => "R",
578         comment   => "construct Ror: Ror(a, b) = a ROR b",
579         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
580         emit      => '. rorl %binop',
581         units     => [ "GP" ],
582         mode      => "mode_Iu",
583 },
584
585 Rol => {
586         irn_flags => "R",
587         comment   => "construct Rol: Rol(a, b) = a ROL b",
588         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
589         emit      => '. roll %binop',
590         units     => [ "GP" ],
591         mode      => "mode_Iu",
592 },
593
594 # unary operations
595
596 Neg => {
597         irn_flags => "R",
598         comment   => "construct Minus: Minus(a) = -a",
599         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
600         emit      => '. negl %unop',
601         units     => [ "GP" ],
602         mode      => "mode_Iu",
603 },
604
605 Minus64Bit => {
606         irn_flags => "R",
607         comment   => "construct 64Bit Minus: Minus(a_l, a_h, 0) = 0 - a_l; 0 - a_h - borrow",
608         arity     => 4,
609         reg_req   => { in => [ "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
610         emit      => '
611 . movl %S1, %D1
612 . movl %S1, %D2
613 . subl %S2, %D1
614 . sbbl %S3, %D2
615 ',
616         outs      => [ "low_res", "high_res" ],
617         units     => [ "GP" ],
618 },
619
620
621 l_Neg => {
622         cmp_attr  => "return 1;",
623         comment   => "construct lowered Minus: Minus(a) = -a",
624         arity     => 1,
625 },
626
627 Inc => {
628         irn_flags => "R",
629         comment   => "construct Increment: Inc(a) = a++",
630         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
631         emit      => '. incl %unop',
632         units     => [ "GP" ],
633         mode      => "mode_Iu",
634 },
635
636 Dec => {
637         irn_flags => "R",
638         comment   => "construct Decrement: Dec(a) = a--",
639         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
640         emit      => '. decl %unop',
641         units     => [ "GP" ],
642         mode      => "mode_Iu",
643 },
644
645 Not => {
646         irn_flags => "R",
647         comment   => "construct Not: Not(a) = !a",
648         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
649         emit      => '. notl %unop',
650         units     => [ "GP" ],
651         mode      => "mode_Iu",
652 },
653
654 # other operations
655
656 CondJmp => {
657         state     => "pinned",
658         op_flags  => "L|X|Y",
659         comment   => "construct conditional jump: CMP A, B && JMPxx LABEL",
660         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ] },
661         outs      => [ "false", "true" ],
662         latency   => 3,
663         units     => [ "BRANCH" ],
664 },
665
666 TestJmp => {
667         state     => "pinned",
668         op_flags  => "L|X|Y",
669         comment   => "construct conditional jump: TEST A, B && JMPxx LABEL",
670         reg_req  => { in => [ "gp", "gp" ] },
671         outs      => [ "false", "true" ],
672         latency   => 3,
673         units     => [ "BRANCH" ],
674 },
675
676 CJmpAM => {
677         state     => "pinned",
678         op_flags  => "L|X|Y",
679         comment   => "construct conditional jump without CMP (replaces CondJmp): JMPxx LABEL",
680         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "none", "none" ] },
681         outs      => [ "false", "true" ],
682         units     => [ "BRANCH" ],
683 },
684
685 CJmp => {
686         state     => "pinned",
687         op_flags  => "L|X|Y",
688         comment   => "construct conditional jump without CMP (replaces TestJmp): JMPxx LABEL",
689         reg_req   => { in => [ "gp", "gp" ] },
690         units     => [ "BRANCH" ],
691 },
692
693 SwitchJmp => {
694         state     => "pinned",
695         op_flags  => "L|X|Y",
696         comment   => "construct switch",
697         reg_req   => { in => [ "gp" ], out => [ "none" ] },
698         latency   => 3,
699         units     => [ "BRANCH" ],
700 },
701
702 Const => {
703         op_flags  => "c",
704         irn_flags => "R",
705         comment   => "represents an integer constant",
706         reg_req   => { out => [ "gp" ] },
707         units     => [ "GP" ],
708         mode      => "mode_Iu",
709 },
710
711 Unknown_GP => {
712         state     => "pinned",
713         op_flags  => "c",
714         irn_flags => "I",
715         comment   => "unknown value",
716         reg_req   => { out => [ "gp_UKNWN" ] },
717         units     => [],
718         emit      => "",
719         mode      => "mode_Iu"
720 },
721
722 Unknown_VFP => {
723         state     => "pinned",
724         op_flags  => "c",
725         irn_flags => "I",
726         comment   => "unknown value",
727         reg_req   => { out => [ "vfp_UKNWN" ] },
728         units     => [],
729         emit      => "",
730         mode      => "mode_E"
731 },
732
733 Unknown_XMM => {
734         state     => "pinned",
735         op_flags  => "c",
736         irn_flags => "I",
737         comment   => "unknown value",
738         reg_req   => { out => [ "xmm_UKNWN" ] },
739         units     => [],
740         emit      => "",
741         mode      => "mode_E"
742 },
743
744 NoReg_GP => {
745         state     => "pinned",
746         op_flags  => "c",
747         irn_flags => "I",
748         comment   => "noreg GP value",
749         reg_req   => { out => [ "gp_NOREG" ] },
750         units     => [],
751         emit      => "",
752         mode      => "mode_Iu"
753 },
754
755 NoReg_VFP => {
756         state     => "pinned",
757         op_flags  => "c",
758         irn_flags => "I",
759         comment   => "noreg VFP value",
760         reg_req   => { out => [ "vfp_NOREG" ] },
761         units     => [],
762         emit      => "",
763         mode      => "mode_E"
764 },
765
766 NoReg_XMM => {
767         state     => "pinned",
768         op_flags  => "c",
769         irn_flags => "I",
770         comment   => "noreg XMM value",
771         reg_req   => { out => [ "xmm_NOREG" ] },
772         units     => [],
773         emit      => "",
774         mode      => "mode_E"
775 },
776
777 ChangeCW => {
778         state     => "pinned",
779         op_flags  => "c",
780         irn_flags => "I",
781         comment   => "change floating point control word",
782         reg_req   => { out => [ "fp_cw" ] },
783         mode      => "mode_Hu",
784         latency   => 3,
785         units     => [ "GP" ],
786 },
787
788 FldCW => {
789         op_flags  => "L|F",
790         state     => "exc_pinned",
791         comment   => "load floating point control word FldCW(ptr, mem) = LD ptr -> reg",
792         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
793         latency   => 5,
794         emit      => ". fldcw %AM",
795         mode      => "mode_Hu",
796         units     => [ "GP" ],
797 },
798
799 FnstCW => {
800         op_flags  => "L|F",
801         state     => "exc_pinned",
802         comment   => "store floating point control word: FstCW(ptr, mem) = ST ptr -> reg",
803         reg_req   => { in => [ "gp", "gp", "fp_cw", "none" ], out => [ "none" ] },
804         latency   => 5,
805         emit      => ". fnstcw %AM",
806         mode      => "mode_M",
807         units     => [ "GP" ],
808 },
809
810 Cltd => {
811         # we should not rematrialize this node. It produces 2 results and has
812         # very strict constrains
813         comment   => "construct CDQ: sign extend EAX -> EDX:EAX",
814         reg_req   => { in => [ "gp" ], out => [ "eax in_r1", "edx" ] },
815         emit      => '. cltd',
816         outs      => [ "EAX", "EDX" ],
817         units     => [ "GP" ],
818 },
819
820 # Load / Store
821
822 Load => {
823         op_flags  => "L|F",
824         state     => "exc_pinned",
825         comment   => "construct Load: Load(ptr, mem) = LD ptr -> reg",
826         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
827         latency   => 3,
828         emit      => ". mov%SE%ME%.l %AM, %D1",
829         outs      => [ "res", "M" ],
830         units     => [ "GP" ],
831 },
832
833 l_Load => {
834         op_flags  => "L|F",
835         cmp_attr  => "return 1;",
836         comment   => "construct lowered Load: Load(ptr, mem) = LD ptr -> reg",
837         outs      => [ "res", "M" ],
838         arity     => 2,
839 },
840
841 l_Store => {
842         op_flags  => "L|F",
843         cmp_attr  => "return 1;",
844         state     => "exc_pinned",
845         comment   => "construct lowered Store: Store(ptr, val, mem) = ST ptr,val",
846         arity     => 3,
847         mode      => "mode_M",
848 },
849
850 Store => {
851         op_flags  => "L|F",
852         state     => "exc_pinned",
853         comment   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
854         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "none" ] },
855         emit      => '. mov%M %binop',
856         latency   => 3,
857         units     => [ "GP" ],
858         mode      => "mode_M",
859 },
860
861 Store8Bit => {
862         op_flags  => "L|F",
863         state     => "exc_pinned",
864         comment   => "construct 8Bit Store: Store(ptr, val, mem) = ST ptr,val",
865         reg_req   => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => ["none" ] },
866         emit      => '. mov%M %binop',
867         latency   => 3,
868         units     => [ "GP" ],
869         mode      => "mode_M",
870 },
871
872 Lea => {
873         irn_flags => "R",
874         comment   => "construct Lea: Lea(a,b) = lea [a+b*const+offs] | res = a + b * const + offs with const = 0,1,2,4,8",
875         reg_req   => { in => [ "gp", "gp" ], out => [ "in_r1" ] },
876         emit      => '. leal %AM, %D1',
877         latency   => 2,
878         units     => [ "GP" ],
879         mode      => "mode_Iu",
880 },
881
882 Push => {
883         comment   => "push on the stack",
884         reg_req   => { in => [ "gp", "gp", "gp", "esp", "none" ], out => [ "esp", "none" ] },
885         emit      => '. pushl %unop',
886         outs      => [ "stack:I|S", "M" ],
887         latency   => 3,
888         units     => [ "GP" ],
889 },
890
891 Pop => {
892         comment   => "pop a gp register from the stack",
893         reg_req   => { in => [ "gp", "gp", "esp", "none" ], out => [ "esp", "gp", "none" ] },
894         emit      => '. popl %unop',
895         outs      => [ "stack:I|S", "res", "M" ],
896         latency   => 4,
897         units     => [ "GP" ],
898 },
899
900 Enter => {
901         comment   => "create stack frame",
902         reg_req   => { in => [ "esp" ], out => [ "ebp", "esp" ] },
903         emit      => '. enter',
904         outs      => [ "frame:I", "stack:I|S", "M" ],
905         latency   => 15,
906         units     => [ "GP" ],
907 },
908
909 Leave => {
910         comment   => "destroy stack frame",
911         reg_req   => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
912         emit      => '. leave',
913         outs      => [ "frame:I", "stack:I|S" ],
914         latency   => 3,
915         units     => [ "GP" ],
916 },
917
918 AddSP => {
919         irn_flags => "I",
920         comment   => "allocate space on stack",
921         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "none" ] },
922         emit      => '. addl %binop',
923         outs      => [ "stack:S", "M" ],
924         units     => [ "GP" ],
925 },
926
927 SubSP => {
928         irn_flags => "I",
929         comment   => "free space on stack",
930         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "none" ] },
931         emit      => '. subl %binop',
932         outs      => [ "stack:S", "M" ],
933         units     => [ "GP" ],
934 },
935
936 LdTls => {
937         irn_flags => "R",
938         comment   => "get the TLS base address",
939         reg_req   => { out => [ "gp" ] },
940         units     => [ "GP" ],
941 },
942
943
944
945 #-----------------------------------------------------------------------------#
946 #   _____ _____ ______    __ _             _                     _            #
947 #  / ____/ ____|  ____|  / _| |           | |                   | |           #
948 # | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
949 #  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
950 #  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
951 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
952 #-----------------------------------------------------------------------------#
953
954 # commutative operations
955
956 xAdd => {
957         irn_flags => "R",
958         comment   => "construct SSE Add: Add(a, b) = Add(b, a) = a + b",
959         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
960         emit      => '. add%XXM %binop',
961         latency   => 4,
962         units     => [ "SSE" ],
963         mode      => "mode_E",
964 },
965
966 xMul => {
967         irn_flags => "R",
968         comment   => "construct SSE Mul: Mul(a, b) = Mul(b, a) = a * b",
969         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
970         emit      => '. mul%XXM %binop',
971         latency   => 4,
972         units     => [ "SSE" ],
973         mode      => "mode_E",
974 },
975
976 xMax => {
977         irn_flags => "R",
978         comment   => "construct SSE Max: Max(a, b) = Max(b, a) = a > b ? a : b",
979         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
980         emit      => '. max%XXM %binop',
981         latency   => 2,
982         units     => [ "SSE" ],
983         mode      => "mode_E",
984 },
985
986 xMin => {
987         irn_flags => "R",
988         comment   => "construct SSE Min: Min(a, b) = Min(b, a) = a < b ? a : b",
989         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
990         emit      => '. min%XXM %binop',
991         latency   => 2,
992         units     => [ "SSE" ],
993         mode      => "mode_E",
994 },
995
996 xAnd => {
997         irn_flags => "R",
998         comment   => "construct SSE And: And(a, b) = a AND b",
999         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1000         emit      => '. andp%XSD %binop',
1001         latency   => 3,
1002         units     => [ "SSE" ],
1003         mode      => "mode_E",
1004 },
1005
1006 xOr => {
1007         irn_flags => "R",
1008         comment   => "construct SSE Or: Or(a, b) = a OR b",
1009         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1010         emit      => '. orp%XSD %binop',
1011         units     => [ "SSE" ],
1012         mode      => "mode_E",
1013 },
1014
1015 xXor => {
1016         irn_flags => "R",
1017         comment   => "construct SSE Xor: Xor(a, b) = a XOR b",
1018         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1019         emit      => '. xorp%XSD %binop',
1020         latency   => 3,
1021         units     => [ "SSE" ],
1022         mode      => "mode_E",
1023 },
1024
1025 # not commutative operations
1026
1027 xAndNot => {
1028         irn_flags => "R",
1029         comment   => "construct SSE AndNot: AndNot(a, b) = a AND NOT b",
1030         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1031         emit      => '. andnp%XSD %binop',
1032         latency   => 3,
1033         units     => [ "SSE" ],
1034         mode      => "mode_E",
1035 },
1036
1037 xSub => {
1038         irn_flags => "R",
1039         comment   => "construct SSE Sub: Sub(a, b) = a - b",
1040         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1041         emit      => '. sub%XXM %binop',
1042         latency   => 4,
1043         units     => [ "SSE" ],
1044         mode      => "mode_E",
1045 },
1046
1047 xDiv => {
1048         irn_flags => "R",
1049         comment   => "construct SSE Div: Div(a, b) = a / b",
1050         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1051         outs      => [ "res", "M" ],
1052         emit      => '. div%XXM %binop',
1053         latency   => 16,
1054         units     => [ "SSE" ],
1055 },
1056
1057 # other operations
1058
1059 xCmp => {
1060         irn_flags => "R",
1061         comment   => "construct SSE Compare: Cmp(a, b) == a = a cmp b",
1062         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1063         latency   => 3,
1064         units     => [ "SSE" ],
1065         mode      => "mode_E",
1066 },
1067
1068 xCondJmp => {
1069         state     => "pinned",
1070         op_flags  => "L|X|Y",
1071         comment   => "construct conditional jump: UCOMIS A, B && JMPxx LABEL",
1072         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "none", "none" ] },
1073         outs      => [ "false", "true" ],
1074         latency   => 5,
1075         units     => [ "SSE" ],
1076 },
1077
1078 xConst => {
1079         op_flags  => "c",
1080         irn_flags => "R",
1081         comment   => "represents a SSE constant",
1082         reg_req   => { out => [ "xmm" ] },
1083         emit      => '. mov%XXM $%C, %D1',
1084         latency   => 2,
1085         units     => [ "SSE" ],
1086         mode      => "mode_E",
1087 },
1088
1089 # Load / Store
1090
1091 xLoad => {
1092         op_flags  => "L|F",
1093         state     => "exc_pinned",
1094         comment   => "construct SSE Load: Load(ptr, mem) = LD ptr",
1095         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1096         emit      => '. mov%XXM %AM, %D1',
1097         outs      => [ "res", "M" ],
1098         latency   => 2,
1099         units     => [ "SSE" ],
1100 },
1101
1102 xStore => {
1103         op_flags => "L|F",
1104         state    => "exc_pinned",
1105         comment  => "construct Store: Store(ptr, val, mem) = ST ptr,val",
1106         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1107         emit     => '. mov%XXM %binop',
1108         latency  => 2,
1109         units    => [ "SSE" ],
1110         mode     => "mode_M",
1111 },
1112
1113 xStoreSimple => {
1114         op_flags => "L|F",
1115         state    => "exc_pinned",
1116         comment  => "construct Store without index: Store(ptr, val, mem) = ST ptr,val",
1117         reg_req  => { in => [ "gp", "xmm", "none" ] },
1118         emit     => '. mov%XXM %S2, %AM',
1119         latency  => 2,
1120         units    => [ "SSE" ],
1121         mode     => "mode_M",
1122 },
1123
1124 l_X87toSSE => {
1125         op_flags => "L|F",
1126         comment  => "construct: transfer a value from x87 FPU into a SSE register",
1127         cmp_attr => "return 1;",
1128         arity    => 3,
1129 },
1130
1131 l_SSEtoX87 => {
1132         op_flags => "L|F",
1133         comment  => "construct: transfer a value from SSE register to x87 FPU",
1134         cmp_attr => "return 1;",
1135         arity    => 3,
1136 },
1137
1138 GetST0 => {
1139         op_flags => "L|F",
1140         irn_flags => "I",
1141         state    => "exc_pinned",
1142         comment  => "store ST0 onto stack",
1143         reg_req  => { in => [ "gp", "gp", "none" ] },
1144         emit     => '. fstp%XM %AM',
1145         latency  => 4,
1146         units    => [ "SSE" ],
1147         mode     => "mode_M",
1148 },
1149
1150 SetST0 => {
1151         op_flags => "L|F",
1152         irn_flags => "I",
1153         state    => "exc_pinned",
1154         comment  => "load ST0 from stack",
1155         reg_req  => { in => [ "gp", "none" ], out => [ "vf0", "none" ] },
1156         emit     => '. fld%M %AM',
1157         outs     => [ "res", "M" ],
1158         latency  => 2,
1159         units     => [ "SSE" ],
1160 },
1161
1162 # CopyB
1163
1164 CopyB => {
1165         op_flags => "F|H",
1166         state    => "pinned",
1167         comment  => "implements a memcopy: CopyB(dst, src, size, mem) == memcpy(dst, src, size)",
1168         reg_req  => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1169         outs     => [ "DST", "SRC", "CNT", "M" ],
1170         units     => [ "GP" ],
1171 },
1172
1173 CopyB_i => {
1174         op_flags => "F|H",
1175         state    => "pinned",
1176         comment  => "implements a memcopy: CopyB(dst, src, mem) == memcpy(dst, src, attr(size))",
1177         reg_req  => { in => [ "edi", "esi", "none" ], out => [  "edi", "esi", "none" ] },
1178         outs     => [ "DST", "SRC", "M" ],
1179         units     => [ "GP" ],
1180 },
1181
1182 # Conversions
1183
1184 Conv_I2I => {
1185         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3", "none" ] },
1186         comment  => "construct Conv Int -> Int",
1187         units     => [ "GP" ],
1188         mode     => "mode_Iu",
1189 },
1190
1191 Conv_I2I8Bit => {
1192         reg_req  => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => [ "in_r3", "none" ] },
1193         comment  => "construct Conv Int -> Int",
1194         units     => [ "GP" ],
1195         mode     => "mode_Iu",
1196 },
1197
1198 Conv_I2FP => {
1199         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1200         comment  => "construct Conv Int -> Floating Point",
1201         latency  => 10,
1202         units    => [ "SSE" ],
1203         mode     => "mode_E",
1204 },
1205
1206 Conv_FP2I => {
1207         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "gp", "none" ] },
1208         comment  => "construct Conv Floating Point -> Int",
1209         latency  => 10,
1210         units    => [ "SSE" ],
1211         mode     => "mode_Iu",
1212 },
1213
1214 Conv_FP2FP => {
1215         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "xmm", "none" ] },
1216         comment  => "construct Conv Floating Point -> Floating Point",
1217         latency  => 8,
1218         units    => [ "SSE" ],
1219         mode     => "mode_E",
1220 },
1221
1222 CmpCMov => {
1223         irn_flags => "R",
1224         comment   => "construct Conditional Move: CMov(sel, a, b) == sel ? a : b",
1225         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "in_r4" ] },
1226         latency   => 2,
1227         units     => [ "GP" ],
1228         mode      => "mode_Iu",
1229 },
1230
1231 PsiCondCMov => {
1232         irn_flags => "R",
1233         comment   => "check if Psi condition tree evaluates to true and move result accordingly",
1234         reg_req   => { in => [ "gp", "gp", "gp" ], out => [ "in_r3" ] },
1235         latency   => 2,
1236         units     => [ "GP" ],
1237         mode      => "mode_Iu",
1238 },
1239
1240 xCmpCMov => {
1241         irn_flags => "R",
1242         comment   => "construct Conditional Move: SSE Compare + int CMov ",
1243         reg_req   => { in => [ "xmm", "xmm", "gp", "gp" ], out => [ "in_r4" ] },
1244         latency   => 5,
1245         units     => [ "SSE" ],
1246         mode      => "mode_Iu",
1247 },
1248
1249 vfCmpCMov => {
1250         irn_flags => "R",
1251         comment   => "construct Conditional Move: x87 Compare + int CMov",
1252         reg_req   => { in => [ "vfp", "vfp", "gp", "gp" ], out => [ "in_r4" ] },
1253         latency   => 10,
1254         units     => [ "VFP" ],
1255         mode      => "mode_Iu",
1256 },
1257
1258 CmpSet => {
1259         irn_flags => "R",
1260         comment   => "construct Set: Set(sel) == sel ? 1 : 0",
1261         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1262         latency   => 2,
1263         units     => [ "GP" ],
1264         mode      => "mode_Iu",
1265 },
1266
1267 PsiCondSet => {
1268         irn_flags => "R",
1269         comment   => "check if Psi condition tree evaluates to true and set result accordingly",
1270         reg_req   => { in => [ "gp" ], out => [ "eax ebx ecx edx" ] },
1271         latency   => 2,
1272         units     => [ "GP" ],
1273         mode      => "mode_Iu",
1274 },
1275
1276 xCmpSet => {
1277         irn_flags => "R",
1278         comment   => "construct Set: SSE Compare + int Set",
1279         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "eax ebx ecx edx" ] },
1280         latency   => 5,
1281         units     => [ "SSE" ],
1282         mode      => "mode_Iu",
1283 },
1284
1285 vfCmpSet => {
1286         irn_flags => "R",
1287         comment   => "construct Set: x87 Compare + int Set",
1288         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "eax ebx ecx edx" ] },
1289         latency   => 10,
1290         units     => [ "VFP" ],
1291         mode      => "mode_Iu",
1292 },
1293
1294 vfCMov => {
1295         irn_flags => "R",
1296         comment   => "construct x87 Conditional Move: vfCMov(sel, a, b) = sel ? a : b",
1297         reg_req   => { in => [ "vfp", "vfp", "vfp", "vfp" ], out => [ "vfp" ] },
1298         latency   => 10,
1299         units     => [ "VFP" ],
1300         mode      => "mode_E",
1301 },
1302
1303 #----------------------------------------------------------#
1304 #        _      _               _    __ _             _    #
1305 #       (_)    | |             | |  / _| |           | |   #
1306 # __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
1307 # \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
1308 #  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
1309 #   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1310 #                 | |                                      #
1311 #  _ __   ___   __| | ___  ___                             #
1312 # | '_ \ / _ \ / _` |/ _ \/ __|                            #
1313 # | | | | (_) | (_| |  __/\__ \                            #
1314 # |_| |_|\___/ \__,_|\___||___/                            #
1315 #----------------------------------------------------------#
1316
1317 vfadd => {
1318         irn_flags => "R",
1319         comment   => "virtual fp Add: Add(a, b) = Add(b, a) = a + b",
1320         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1321         latency   => 4,
1322         units     => [ "VFP" ],
1323         mode      => "mode_E",
1324 },
1325
1326 vfmul => {
1327         irn_flags => "R",
1328         comment   => "virtual fp Mul: Mul(a, b) = Mul(b, a) = a * b",
1329         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1330         latency   => 4,
1331         units     => [ "VFP" ],
1332         mode      => "mode_E",
1333 },
1334
1335 l_vfmul => {
1336         op_flags  => "C",
1337         cmp_attr  => "return 1;",
1338         comment   => "lowered virtual fp Mul: Mul(a, b) = Mul(b, a) = a * b",
1339         arity     => 2,
1340 },
1341
1342 vfsub => {
1343         irn_flags => "R",
1344         comment   => "virtual fp Sub: Sub(a, b) = a - b",
1345         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1346         latency   => 4,
1347         units     => [ "VFP" ],
1348         mode      => "mode_E",
1349 },
1350
1351 l_vfsub => {
1352         cmp_attr  => "return 1;",
1353         comment   => "lowered virtual fp Sub: Sub(a, b) = a - b",
1354         arity     => 2,
1355 },
1356
1357 vfdiv => {
1358         comment   => "virtual fp Div: Div(a, b) = a / b",
1359         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1360         outs      => [ "res", "M" ],
1361         latency   => 20,
1362         units     => [ "VFP" ],
1363 },
1364
1365 l_vfdiv => {
1366         cmp_attr  => "return 1;",
1367         comment   => "lowered virtual fp Div: Div(a, b) = a / b",
1368         outs      => [ "res", "M" ],
1369         arity     => 2,
1370 },
1371
1372 vfprem => {
1373         comment   => "virtual fp Rem: Rem(a, b) = a - Q * b (Q is integer)",
1374         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1375         latency   => 20,
1376         units     => [ "VFP" ],
1377         mode      => "mode_E",
1378 },
1379
1380 l_vfprem => {
1381         cmp_attr  => "return 1;",
1382         comment   => "lowered virtual fp Rem: Rem(a, b) = a - Q * b (Q is integer)",
1383         arity     => 2,
1384 },
1385
1386 vfabs => {
1387         irn_flags => "R",
1388         comment   => "virtual fp Abs: Abs(a) = |a|",
1389         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1390         latency   => 2,
1391         units     => [ "VFP" ],
1392         mode      => "mode_E",
1393 },
1394
1395 vfchs => {
1396         irn_flags => "R",
1397         comment   => "virtual fp Chs: Chs(a) = -a",
1398         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1399         latency   => 2,
1400         units     => [ "VFP" ],
1401         mode      => "mode_E",
1402 },
1403
1404 vfsin => {
1405         irn_flags => "R",
1406         comment   => "virtual fp Sin: Sin(a) = sin(a)",
1407         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1408         latency   => 150,
1409         units     => [ "VFP" ],
1410         mode      => "mode_E",
1411 },
1412
1413 vfcos => {
1414         irn_flags => "R",
1415         comment   => "virtual fp Cos: Cos(a) = cos(a)",
1416         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1417         latency   => 150,
1418         units     => [ "VFP" ],
1419         mode      => "mode_E",
1420 },
1421
1422 vfsqrt => {
1423         irn_flags => "R",
1424         comment   => "virtual fp Sqrt: Sqrt(a) = a ^ 0.5",
1425         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1426         latency   => 30,
1427         units     => [ "VFP" ],
1428         mode      => "mode_E",
1429 },
1430
1431 # virtual Load and Store
1432
1433 vfld => {
1434         op_flags  => "L|F",
1435         state     => "exc_pinned",
1436         comment   => "virtual fp Load: Load(ptr, mem) = LD ptr -> reg",
1437         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1438         outs      => [ "res", "M" ],
1439         latency   => 2,
1440         units     => [ "VFP" ],
1441 },
1442
1443 vfst => {
1444         op_flags  => "L|F",
1445         state     => "exc_pinned",
1446         comment   => "virtual fp Store: Store(ptr, val, mem) = ST ptr,val",
1447         reg_req   => { in => [ "gp", "gp", "vfp", "none" ] },
1448         latency   => 2,
1449         units     => [ "VFP" ],
1450         mode      => "mode_M",
1451 },
1452
1453 # Conversions
1454
1455 vfild => {
1456         comment   => "virtual fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1457         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1458         outs      => [ "res", "M" ],
1459         latency   => 4,
1460         units     => [ "VFP" ],
1461 },
1462
1463 l_vfild => {
1464         cmp_attr  => "return 1;",
1465         comment   => "lowered virtual fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1466         outs      => [ "res", "M" ],
1467         arity     => 2,
1468 },
1469
1470 vfist => {
1471         comment   => "virtual fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1472         reg_req   => { in => [ "gp", "gp", "vfp", "fpcw", "none" ] },
1473         latency   => 4,
1474         units     => [ "VFP" ],
1475         mode      => "mode_M",
1476 },
1477
1478 l_vfist => {
1479         cmp_attr  => "return 1;",
1480         comment   => "lowered virtual fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1481         arity     => 3,
1482         mode      => "mode_M",
1483 },
1484
1485
1486 # constants
1487
1488 vfldz => {
1489         irn_flags => "R",
1490         comment   => "virtual fp Load 0.0: Ld 0.0 -> reg",
1491         reg_req   => { out => [ "vfp" ] },
1492         latency   => 4,
1493         units     => [ "VFP" ],
1494         mode      => "mode_E",
1495 },
1496
1497 vfld1 => {
1498         irn_flags => "R",
1499         comment   => "virtual fp Load 1.0: Ld 1.0 -> reg",
1500         reg_req   => { out => [ "vfp" ] },
1501         latency   => 4,
1502         units     => [ "VFP" ],
1503         mode      => "mode_E",
1504 },
1505
1506 vfldpi => {
1507         irn_flags => "R",
1508         comment   => "virtual fp Load pi: Ld pi -> reg",
1509         reg_req   => { out => [ "vfp" ] },
1510         latency   => 4,
1511         units     => [ "VFP" ],
1512         mode      => "mode_E",
1513 },
1514
1515 vfldln2 => {
1516         irn_flags => "R",
1517         comment   => "virtual fp Load ln 2: Ld ln 2 -> reg",
1518         reg_req   => { out => [ "vfp" ] },
1519         latency   => 4,
1520         units     => [ "VFP" ],
1521         mode      => "mode_E",
1522 },
1523
1524 vfldlg2 => {
1525         irn_flags => "R",
1526         comment   => "virtual fp Load lg 2: Ld lg 2 -> reg",
1527         reg_req   => { out => [ "vfp" ] },
1528         latency   => 4,
1529         units     => [ "VFP" ],
1530         mode      => "mode_E",
1531 },
1532
1533 vfldl2t => {
1534         irn_flags => "R",
1535         comment   => "virtual fp Load ld 10: Ld ld 10 -> reg",
1536         reg_req   => { out => [ "vfp" ] },
1537         latency   => 4,
1538         units     => [ "VFP" ],
1539         mode      => "mode_E",
1540 },
1541
1542 vfldl2e => {
1543         irn_flags => "R",
1544         comment   => "virtual fp Load ld e: Ld ld e -> reg",
1545         reg_req   => { out => [ "vfp" ] },
1546         latency   => 4,
1547         units     => [ "VFP" ],
1548         mode      => "mode_E",
1549 },
1550
1551 vfConst => {
1552         op_flags  => "c",
1553         irn_flags => "R",
1554 #  init_attr => "  set_ia32_ls_mode(res, mode);",
1555         comment   => "represents a virtual floating point constant",
1556         reg_req   => { out => [ "vfp" ] },
1557         latency   => 3,
1558         units     => [ "VFP" ],
1559         mode      => "mode_E",
1560 },
1561
1562 # other
1563
1564 vfCondJmp => {
1565         state     => "pinned",
1566         op_flags  => "L|X|Y",
1567         comment   => "represents a virtual floating point compare",
1568         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "none", "none", "eax" ] },
1569         outs      => [ "false", "true", "temp_reg_eax" ],
1570         latency   => 10,
1571         units     => [ "VFP" ],
1572 },
1573
1574 #------------------------------------------------------------------------#
1575 #       ___ _____    __ _             _                     _            #
1576 # __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1577 # \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1578 #  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1579 # /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1580 #------------------------------------------------------------------------#
1581
1582 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1583 #       are swapped, we work this around in the emitter...
1584
1585 fadd => {
1586         op_flags  => "R",
1587         rd_constructor => "NONE",
1588         comment   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
1589         reg_req   => { },
1590         emit      => '. fadd%XM %x87_binop',
1591 },
1592
1593 faddp => {
1594         op_flags  => "R",
1595         rd_constructor => "NONE",
1596         comment   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
1597         reg_req   => { },
1598         emit      => '. faddp %x87_binop',
1599 },
1600
1601 fmul => {
1602         op_flags  => "R",
1603         rd_constructor => "NONE",
1604         comment   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
1605         reg_req   => { },
1606         emit      => '. fmul%XM %x87_binop',
1607 },
1608
1609 fmulp => {
1610         op_flags  => "R",
1611         rd_constructor => "NONE",
1612         comment   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
1613         reg_req   => { },
1614         emit      => '. fmulp %x87_binop',,
1615 },
1616
1617 fsub => {
1618         op_flags  => "R",
1619         rd_constructor => "NONE",
1620         comment   => "x87 fp Sub: Sub(a, b) = a - b",
1621         reg_req   => { },
1622         emit      => '. fsub%XM %x87_binop',
1623 },
1624
1625 fsubp => {
1626         op_flags  => "R",
1627         rd_constructor => "NONE",
1628         comment   => "x87 fp Sub: Sub(a, b) = a - b",
1629         reg_req   => { },
1630 # see note about gas bugs
1631         emit      => '. fsubrp %x87_binop',
1632 },
1633
1634 fsubr => {
1635         op_flags  => "R",
1636         rd_constructor => "NONE",
1637         irn_flags => "R",
1638         comment   => "x87 fp SubR: SubR(a, b) = b - a",
1639         reg_req   => { },
1640         emit      => '. fsubr%XM %x87_binop',
1641 },
1642
1643 fsubrp => {
1644         op_flags  => "R",
1645         rd_constructor => "NONE",
1646         irn_flags => "R",
1647         comment   => "x87 fp SubR: SubR(a, b) = b - a",
1648         reg_req   => { },
1649 # see note about gas bugs
1650         emit      => '. fsubp %x87_binop',
1651 },
1652
1653 fprem => {
1654         op_flags  => "R",
1655         rd_constructor => "NONE",
1656         comment   => "x87 fp Rem: Rem(a, b) = a - Q * b (Q is integer)",
1657         reg_req   => { },
1658         emit      => '. fprem1',
1659 },
1660
1661 # this node is just here, to keep the simulator running
1662 # we can omit this when a fprem simulation function exists
1663 fpremp => {
1664         op_flags  => "R",
1665         rd_constructor => "NONE",
1666         comment   => "x87 fp Rem: Rem(a, b) = a - Q * b (Q is integer)",
1667         reg_req   => { },
1668         emit      => '. fprem1',
1669 },
1670
1671 fdiv => {
1672         op_flags  => "R",
1673         rd_constructor => "NONE",
1674         comment   => "x87 fp Div: Div(a, b) = a / b",
1675         reg_req   => { },
1676         emit      => '. fdiv%XM %x87_binop',
1677 },
1678
1679 fdivp => {
1680         op_flags  => "R",
1681         rd_constructor => "NONE",
1682         comment   => "x87 fp Div: Div(a, b) = a / b",
1683         reg_req   => { },
1684 # see note about gas bugs
1685         emit      => '. fdivrp %x87_binop',
1686 },
1687
1688 fdivr => {
1689         op_flags  => "R",
1690         rd_constructor => "NONE",
1691         comment   => "x87 fp DivR: DivR(a, b) = b / a",
1692         reg_req   => { },
1693         emit      => '. fdivr%XM %x87_binop',
1694 },
1695
1696 fdivrp => {
1697         op_flags  => "R",
1698         rd_constructor => "NONE",
1699         comment   => "x87 fp DivR: DivR(a, b) = b / a",
1700         reg_req   => { },
1701 # see note about gas bugs
1702         emit      => '. fdivp %x87_binop',
1703 },
1704
1705 fabs => {
1706         op_flags  => "R",
1707         rd_constructor => "NONE",
1708         comment   => "x87 fp Abs: Abs(a) = |a|",
1709         reg_req   => { },
1710         emit      => '. fabs',
1711 },
1712
1713 fchs => {
1714         op_flags  => "R",
1715         rd_constructor => "NONE",
1716         comment   => "x87 fp Chs: Chs(a) = -a",
1717         reg_req   => { },
1718         emit      => '. fchs',
1719 },
1720
1721 fsin => {
1722         op_flags  => "R",
1723         rd_constructor => "NONE",
1724         comment   => "x87 fp Sin: Sin(a) = sin(a)",
1725         reg_req   => { },
1726         emit      => '. fsin',
1727 },
1728
1729 fcos => {
1730         op_flags  => "R",
1731         rd_constructor => "NONE",
1732         comment   => "x87 fp Cos: Cos(a) = cos(a)",
1733         reg_req   => { },
1734         emit      => '. fcos',
1735 },
1736
1737 fsqrt => {
1738         op_flags  => "R",
1739         rd_constructor => "NONE",
1740         comment   => "x87 fp Sqrt: Sqrt(a) = a ^ 0.5",
1741         reg_req   => { },
1742         emit      => '. fsqrt $',
1743 },
1744
1745 # x87 Load and Store
1746
1747 fld => {
1748         rd_constructor => "NONE",
1749         op_flags  => "R|L|F",
1750         state     => "exc_pinned",
1751         comment   => "x87 fp Load: Load(ptr, mem) = LD ptr -> reg",
1752         reg_req   => { },
1753         emit      => '. fld%XM %AM',
1754 },
1755
1756 fst => {
1757         rd_constructor => "NONE",
1758         op_flags  => "R|L|F",
1759         state     => "exc_pinned",
1760         comment   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
1761         reg_req   => { },
1762         emit      => '. fst%XM %AM',
1763         mode      => "mode_M",
1764 },
1765
1766 fstp => {
1767         rd_constructor => "NONE",
1768         op_flags  => "R|L|F",
1769         state     => "exc_pinned",
1770         comment   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
1771         reg_req   => { },
1772         emit      => '. fstp%XM %AM',
1773         mode      => "mode_M",
1774 },
1775
1776 # Conversions
1777
1778 fild => {
1779         op_flags  => "R",
1780         rd_constructor => "NONE",
1781         comment   => "x87 fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1782         reg_req   => { },
1783         emit      => '. fild%XM %AM',
1784 },
1785
1786 fist => {
1787         op_flags  => "R",
1788         rd_constructor => "NONE",
1789         comment   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1790         reg_req   => { },
1791         emit      => '. fist%M %AM',
1792         mode      => "mode_M",
1793 },
1794
1795 fistp => {
1796         op_flags  => "R",
1797         rd_constructor => "NONE",
1798         comment   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1799         reg_req   => { },
1800         emit      => '. fistp%M %AM',
1801         mode      => "mode_M",
1802 },
1803
1804 # constants
1805
1806 fldz => {
1807         op_flags  => "R|c",
1808         irn_flags  => "R",
1809         comment   => "x87 fp Load 0.0: Ld 0.0 -> reg",
1810         reg_req   => { },
1811         emit      => '. fldz',
1812 },
1813
1814 fld1 => {
1815         op_flags  => "R|c",
1816         irn_flags  => "R",
1817         comment   => "x87 fp Load 1.0: Ld 1.0 -> reg",
1818         reg_req   => { },
1819         emit      => '. fld1',
1820 },
1821
1822 fldpi => {
1823         op_flags  => "R|c",
1824         irn_flags  => "R",
1825         comment   => "x87 fp Load pi: Ld pi -> reg",
1826         reg_req   => { },
1827         emit      => '. fldpi',
1828 },
1829
1830 fldln2 => {
1831         op_flags  => "R|c",
1832         irn_flags  => "R",
1833         comment   => "x87 fp Load ln 2: Ld ln 2 -> reg",
1834         reg_req   => { },
1835         emit      => '. fldln2',
1836 },
1837
1838 fldlg2 => {
1839         op_flags  => "R|c",
1840         irn_flags  => "R",
1841         comment   => "x87 fp Load lg 2: Ld lg 2 -> reg",
1842         reg_req   => { },
1843         emit      => '. fldlg2',
1844 },
1845
1846 fldl2t => {
1847         op_flags  => "R|c",
1848         irn_flags  => "R",
1849         comment   => "x87 fp Load ld 10: Ld ld 10 -> reg",
1850         reg_req   => { },
1851         emit      => '. fldll2t',
1852 },
1853
1854 fldl2e => {
1855         op_flags  => "R|c",
1856         irn_flags  => "R",
1857         comment   => "x87 fp Load ld e: Ld ld e -> reg",
1858         reg_req   => { },
1859         emit      => '. fldl2e',
1860 },
1861
1862 # fxch, fpush, fpop
1863 # Note that it is NEVER allowed to do CSE on these nodes
1864 # Moreover, note the virtual register requierements!
1865
1866 fxch => {
1867         op_flags  => "R|K",
1868         comment   => "x87 stack exchange",
1869         reg_req   => { },
1870         cmp_attr  => "return 1;",
1871         emit      => '. fxch %X1',
1872 },
1873
1874 fpush => {
1875         op_flags  => "R|K",
1876         comment   => "x87 stack push",
1877         reg_req   => {},
1878         cmp_attr  => "return 1;",
1879         emit      => '. fld %X1',
1880 },
1881
1882 fpushCopy => {
1883         op_flags  => "R",
1884         comment   => "x87 stack push",
1885         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1886         cmp_attr  => "return 1;",
1887         emit      => '. fld %X1',
1888 },
1889
1890 fpop => {
1891         op_flags  => "R|K",
1892         comment   => "x87 stack pop",
1893         reg_req   => { },
1894         cmp_attr  => "return 1;",
1895         emit      => '. fstp %X1',
1896 },
1897
1898 # compare
1899
1900 fcomJmp => {
1901         op_flags  => "L|X|Y",
1902         comment   => "floating point compare",
1903         reg_req   => { },
1904 },
1905
1906 fcompJmp => {
1907         op_flags  => "L|X|Y",
1908         comment   => "floating point compare and pop",
1909         reg_req   => { },
1910 },
1911
1912 fcomppJmp => {
1913         op_flags  => "L|X|Y",
1914         comment   => "floating point compare and pop twice",
1915         reg_req   => { },
1916 },
1917
1918 fcomrJmp => {
1919         op_flags  => "L|X|Y",
1920         comment   => "floating point compare reverse",
1921         reg_req   => { },
1922 },
1923
1924 fcomrpJmp => {
1925         op_flags  => "L|X|Y",
1926         comment   => "floating point compare reverse and pop",
1927         reg_req   => { },
1928 },
1929
1930 fcomrppJmp => {
1931         op_flags  => "L|X|Y",
1932         comment   => "floating point compare reverse and pop twice",
1933         reg_req   => { },
1934 },
1935
1936
1937 # -------------------------------------------------------------------------------- #
1938 #  ____ ____  _____                  _                               _             #
1939 # / ___/ ___|| ____| __   _____  ___| |_ ___  _ __   _ __   ___   __| | ___  ___   #
1940 # \___ \___ \|  _|   \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __|  #
1941 #  ___) |__) | |___   \ V /  __/ (__| || (_) | |    | | | | (_) | (_| |  __/\__ \  #
1942 # |____/____/|_____|   \_/ \___|\___|\__\___/|_|    |_| |_|\___/ \__,_|\___||___/  #
1943 #                                                                                  #
1944 # -------------------------------------------------------------------------------- #
1945
1946
1947 # Spilling and reloading of SSE registers, hardcoded, not generated #
1948
1949 xxLoad => {
1950         op_flags  => "L|F",
1951         state     => "exc_pinned",
1952         comment   => "construct SSE Load: Load(ptr, mem) = LD ptr",
1953         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1954         emit      => '. movdqu %D1, %AM',
1955         outs      => [ "res", "M" ],
1956         units     => [ "SSE" ],
1957 },
1958
1959 xxStore => {
1960         op_flags => "L|F",
1961         state    => "exc_pinned",
1962         comment  => "construct Store: Store(ptr, val, mem) = ST ptr,val",
1963         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1964         emit     => '. movdqu %binop',
1965         units    => [ "SSE" ],
1966         mode     => "mode_M",
1967 },
1968
1969 ); # end of %nodes
1970
1971 # Include the generated SIMD node specification written by the SIMD optimization
1972 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
1973 unless ($return = do $my_script_name) {
1974         warn "couldn't parse $my_script_name: $@" if $@;
1975         warn "couldn't do $my_script_name: $!"    unless defined $return;
1976         warn "couldn't run $my_script_name"       unless $return;
1977 }