do not matrialize nodes with two results
[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 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
6 $arch = "ia32";
7
8 # this string marks the beginning of a comment in emit
9 $comment_string = "/*";
10
11 # the number of additional opcodes you want to register
12 #$additional_opcodes = 0;
13
14 # The node description is done as a perl hash initializer with the
15 # following structure:
16 #
17 # %nodes = (
18 #
19 # <op-name> => {
20 #   "op_flags"  => "N|L|C|X|I|F|Y|H|c|K",
21 #   "irn_flags" => "R|N|I|S"
22 #   "arity"     => "0|1|2|3 ... |variable|dynamic|any",
23 #   "state"     => "floats|pinned|mem_pinned|exc_pinned",
24 #   "args"      => [
25 #                    { "type" => "type 1", "name" => "name 1" },
26 #                    { "type" => "type 2", "name" => "name 2" },
27 #                    ...
28 #                  ],
29 #   "comment"   => "any comment for constructor",
30 #   "reg_req"   => { "in" => [ "reg_class|register" ], "out" => [ "reg_class|register|in_rX" ] },
31 #   "cmp_attr"  => "c source code for comparing node attributes",
32 #   "emit"      => "emit code with templates",
33 #   "attr"      => "attitional attribute arguments for constructor"
34 #   "init_attr" => "emit attribute initialization template"
35 #   "rd_constructor" => "c source code which constructs an ir_node"
36 #   "latency"   => "latency of this operation (can be float)"
37 # },
38 #
39 # ... # (all nodes you need to describe)
40 #
41 # ); # close the %nodes initializer
42
43 # op_flags: flags for the operation, OPTIONAL (default is "N")
44 # the op_flags correspond to the firm irop_flags:
45 #   N   irop_flag_none
46 #   L   irop_flag_labeled
47 #   C   irop_flag_commutative
48 #   X   irop_flag_cfopcode
49 #   I   irop_flag_ip_cfopcode
50 #   F   irop_flag_fragile
51 #   Y   irop_flag_forking
52 #   H   irop_flag_highlevel
53 #   c   irop_flag_constlike
54 #   K   irop_flag_keep
55 #
56 # irn_flags: special node flags, OPTIONAL (default is 0)
57 # following irn_flags are supported:
58 #   R   rematerializeable
59 #   N   not spillable
60 #   I   ignore for register allocation
61 #   S   modifies stack pointer
62 #
63 # state: state of the operation, OPTIONAL (default is "floats")
64 #
65 # arity: arity of the operation, MUST NOT BE OMITTED
66 #
67 # args:  the OPTIONAL arguments of the node constructor (debug, irg and block
68 #        are always the first 3 arguments and are always autmatically
69 #        created)
70 #        If this key is missing the following arguments will be created:
71 #        for i = 1 .. arity: ir_node *op_i
72 #        ir_mode *mode
73 #
74 # outs:  if a node defines more than one output, the names of the projections
75 #        nodes having outs having automatically the mode mode_T
76 #
77 # comment: OPTIONAL comment for the node constructor
78 #
79 # rd_constructor: for every operation there will be a
80 #      new_rd_<arch>_<op-name> function with the arguments from above
81 #      which creates the ir_node corresponding to the defined operation
82 #      you can either put the complete source code of this function here
83 #
84 #      This key is OPTIONAL. If omitted, the following constructor will
85 #      be created:
86 #      if (!op_<arch>_<op-name>) assert(0);
87 #      for i = 1 to arity
88 #         set in[i] = op_i
89 #      done
90 #      res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
91 #      return res
92 #
93 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
94 #
95 # latency: the latency of the operation, default is 1
96 #
97
98 # register types:
99 #   0 - no special type
100 #   1 - caller save (register must be saved by the caller of a function)
101 #   2 - callee save (register must be saved by the called function)
102 #   4 - ignore (do not assign this register)
103 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
104 %reg_classes = (
105   "gp" => [
106             { "name" => "eax", "type" => 1 },
107             { "name" => "edx", "type" => 1 },
108             { "name" => "ebx", "type" => 2 },
109             { "name" => "ecx", "type" => 1 },
110             { "name" => "esi", "type" => 2 },
111             { "name" => "edi", "type" => 2 },
112 #            { "name" => "r11", "type" => 1 },
113 #            { "name" => "r12", "type" => 1 },
114 #            { "name" => "r13", "type" => 1 },
115 #            { "name" => "r14", "type" => 1 },
116 #            { "name" => "r15", "type" => 1 },
117 #            { "name" => "r16", "type" => 1 },
118 #            { "name" => "r17", "type" => 1 },
119 #            { "name" => "r18", "type" => 1 },
120 #            { "name" => "r19", "type" => 1 },
121 #            { "name" => "r20", "type" => 1 },
122 #            { "name" => "r21", "type" => 1 },
123 #            { "name" => "r22", "type" => 1 },
124 #            { "name" => "r23", "type" => 1 },
125 #            { "name" => "r24", "type" => 1 },
126 #            { "name" => "r25", "type" => 1 },
127 #            { "name" => "r26", "type" => 1 },
128 #            { "name" => "r27", "type" => 1 },
129 #            { "name" => "r28", "type" => 1 },
130 #            { "name" => "r29", "type" => 1 },
131 #            { "name" => "r30", "type" => 1 },
132 #            { "name" => "r31", "type" => 1 },
133 #            { "name" => "r32", "type" => 1 },
134             { "name" => "ebp", "type" => 2 },
135             { "name" => "esp", "type" => 4 },
136             { "name" => "gp_NOREG", "type" => 6 },  # we need a dummy register for NoReg nodes
137             { "name" => "gp_UKNWN", "type" => 6 },  # we need a dummy register for Unknown nodes
138                         { "mode" => "mode_P" }
139           ],
140   "xmm" => [
141             { "name" => "xmm0", "type" => 1 },
142             { "name" => "xmm1", "type" => 1 },
143             { "name" => "xmm2", "type" => 1 },
144             { "name" => "xmm3", "type" => 1 },
145             { "name" => "xmm4", "type" => 1 },
146             { "name" => "xmm5", "type" => 1 },
147             { "name" => "xmm6", "type" => 1 },
148             { "name" => "xmm7", "type" => 1 },
149             { "name" => "xmm_NOREG", "type" => 6 },  # we need a dummy register for NoReg nodes
150             { "name" => "xmm_UKNWN", "type" => 6 },  # we need a dummy register for Unknown nodes
151                         { "mode" => "mode_D" }
152           ],
153   "vfp" => [
154             { "name" => "vf0", "type" => 1 },
155             { "name" => "vf1", "type" => 1 },
156             { "name" => "vf2", "type" => 1 },
157             { "name" => "vf3", "type" => 1 },
158             { "name" => "vf4", "type" => 1 },
159             { "name" => "vf5", "type" => 1 },
160             { "name" => "vf6", "type" => 1 },
161             { "name" => "vf7", "type" => 1 },
162             { "name" => "vfp_NOREG", "type" => 6 },  # we need a dummy register for NoReg nodes
163             { "name" => "vfp_UKNWN", "type" => 6 },  # we need a dummy register for Unknown nodes
164                         { "mode" => "mode_E" }
165           ],
166   "st" => [
167             { "name" => "st0", "type" => 1 },
168             { "name" => "st1", "type" => 1 },
169             { "name" => "st2", "type" => 1 },
170             { "name" => "st3", "type" => 1 },
171             { "name" => "st4", "type" => 1 },
172             { "name" => "st5", "type" => 1 },
173             { "name" => "st6", "type" => 1 },
174             { "name" => "st7", "type" => 1 },
175                         { "mode" => "mode_E" }
176           ]
177 ); # %reg_classes
178
179 #--------------------------------------------------#
180 #                        _                         #
181 #                       (_)                        #
182 #  _ __   _____      __  _ _ __    ___  _ __  ___  #
183 # | '_ \ / _ \ \ /\ / / | | '__|  / _ \| '_ \/ __| #
184 # | | | |  __/\ V  V /  | | |    | (_) | |_) \__ \ #
185 # |_| |_|\___| \_/\_/   |_|_|     \___/| .__/|___/ #
186 #                                      | |         #
187 #                                      |_|         #
188 #--------------------------------------------------#
189
190 %operands = (
191 );
192
193 %nodes = (
194
195 #-----------------------------------------------------------------#
196 #  _       _                                         _            #
197 # (_)     | |                                       | |           #
198 #  _ _ __ | |_ ___  __ _  ___ _ __   _ __   ___   __| | ___  ___  #
199 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
200 # | | | | | ||  __/ (_| |  __/ |    | | | | (_) | (_| |  __/\__ \ #
201 # |_|_| |_|\__\___|\__, |\___|_|    |_| |_|\___/ \__,_|\___||___/ #
202 #                   __/ |                                         #
203 #                  |___/                                          #
204 #-----------------------------------------------------------------#
205
206 # commutative operations
207
208 # NOTE:
209 # All nodes supporting Addressmode have 5 INs:
210 # 1 - base    r1 == NoReg in case of no AM or no base
211 # 2 - index   r2 == NoReg in case of no AM or no index
212 # 3 - op1     r3 == always present
213 # 4 - op2     r4 == NoReg in case of immediate operation
214 # 5 - mem     NoMem in case of no AM otherwise it takes the mem from the Load
215
216 "Add" => {
217   "irn_flags" => "R",
218   "comment"   => "construct Add: Add(a, b) = Add(b, a) = a + b",
219   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
220   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
221   "emit"      => '. add %ia32_emit_binop /* Add(%A3, %A4) -> %D1 */',
222   "outs"      => [ "res", "M" ],
223 },
224
225 "AddC" => {
226   "comment"   => "construct Add with Carry: AddC(a, b) = Add(b, a) = a + b + carry",
227   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
228   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
229   "emit"      => '. adc %ia32_emit_binop /* AddC(%A3, %A4) -> %D1 */',
230   "outs"      => [ "res", "M" ],
231 },
232
233 "l_Add" => {
234   "op_flags"  => "C",
235   "irn_flags" => "R",
236   "cmp_attr"  => "  return 1;\n",
237   "comment"   => "construct lowered Add: Add(a, b) = Add(b, a) = a + b",
238   "arity"     => 2,
239 },
240
241 "l_AddC" => {
242   "op_flags"  => "C",
243   "cmp_attr"  => "  return 1;\n",
244   "comment"   => "construct lowered Add with Carry: AddC(a, b) = Add(b, a) = a + b + carry",
245   "arity"     => 2,
246 },
247
248 "MulS" => {
249   # we should not rematrialize this node. It produces 2 results and has
250   # very strict constrains
251   "comment"   => "construct MulS: MulS(a, b) = MulS(b, a) = a * b",
252   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
253   "reg_req"   => { "in" => [ "gp", "gp", "eax", "gp", "none" ], "out" => [ "eax", "edx" ] },
254   "emit"      => '. mul %ia32_emit_unop /* Mul(%A1, %A2) -> %D1 */',
255   "outs"      => [ "EAX", "EDX", "M" ],
256   "latency"   => 10,
257 },
258
259 "l_MulS" => {
260   # we should not rematrialize this node. It produces 2 results and has
261   # very strict constrains
262   "op_flags"  => "C",
263   "cmp_attr"  => "  return 1;\n",
264   "comment"   => "construct lowered MulS: MulS(a, b) = MulS(b, a) = a * b",
265   "outs"      => [ "EAX", "EDX", "M" ],
266   "arity"     => 2
267 },
268
269 "Mul" => {
270   "irn_flags" => "R",
271   "comment"   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
272   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
273   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
274   "emit"      => '. imul %ia32_emit_binop /* Mul(%A1, %A2) -> %D1 */',
275   "outs"      => [ "res", "M" ],
276   "latency"   => 5,
277 },
278
279 "l_Mul" => {
280   "op_flags"  => "C",
281   "cmp_attr"  => "  return 1;\n",
282   "comment"   => "construct lowered Mul: Mul(a, b) = Mul(b, a) = a * b",
283   "arity"     => 2
284 },
285
286 # Mulh is an exception from the 4 INs with AM because the target is always EAX:EDX
287 "Mulh" => {
288   # we should not rematrialize this node. It produces 2 results and has
289   # very strict constrains
290   "comment"   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
291   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
292   "reg_req"   => { "in" => [ "gp", "gp", "eax", "gp", "none" ], "out" => [ "eax", "edx" ] },
293   "emit"      => '. imul %ia32_emit_unop /* Mulh(%A1, %A2) -> %D1 */',
294   "outs"      => [ "EAX", "EDX", "M" ],
295   "latency"   => 5,
296 },
297
298 "And" => {
299   "irn_flags" => "R",
300   "comment"   => "construct And: And(a, b) = And(b, a) = a AND b",
301   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
302   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
303   "emit"      => '. and %ia32_emit_binop /* And(%A1, %A2) -> %D1 */',
304   "outs"      => [ "res", "M" ],
305 },
306
307 "Or" => {
308   "irn_flags" => "R",
309   "comment"   => "construct Or: Or(a, b) = Or(b, a) = a OR b",
310   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
311   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
312   "emit"      => '. or %ia32_emit_binop /* Or(%A1, %A2) -> %D1 */',
313   "outs"      => [ "res", "M" ],
314 },
315
316 "Eor" => {
317   "irn_flags" => "R",
318   "comment"   => "construct Eor: Eor(a, b) = Eor(b, a) = a EOR b",
319   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
320   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
321   "emit"      => '. xor %ia32_emit_binop /* Xor(%A1, %A2) -> %D1 */',
322   "outs"      => [ "res", "M" ],
323 },
324
325 "l_Eor" => {
326   "op_flags"  => "C",
327   "cmp_attr"  => "  return 1;\n",
328   "comment"   => "construct lowered Eor: Eor(a, b) = Eor(b, a) = a EOR b",
329   "arity"     => 2
330 },
331
332 "Max" => {
333   "irn_flags" => "R",
334   "comment"   => "construct Max: Max(a, b) = Max(b, a) = a > b ? a : b",
335   "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
336   "emit"      =>
337 '2. cmp %S1, %S2 /* prepare Max (%S1 - %S2), (%A1, %A2) */
338   if (mode_is_signed(get_irn_mode(n))) {
339 4.  cmovl %D1, %S2 /* %S1 is less %S2 */
340   }
341   else {
342 4.  cmovb %D1, %S2 /* %S1 is below %S2 */
343   }
344 ',
345   "latency"   => 2,
346 },
347
348 "Min" => {
349   "irn_flags" => "R",
350   "comment"   => "construct Min: Min(a, b) = Min(b, a) = a < b ? a : b",
351   "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
352   "emit"      =>
353 '2. cmp %S1, %S2 /* prepare Min (%S1 - %S2), (%A1, %A2) */
354   if (mode_is_signed(get_irn_mode(n))) {
355 2.  cmovg %D1, %S2 /* %S1 is greater %S2 */
356   }
357   else {
358 2.  cmova %D1, %S2, %D1 /* %S1 is above %S2 */
359   }
360 ',
361   "latency"   => 2,
362 },
363
364 # not commutative operations
365
366 "Sub" => {
367   "irn_flags" => "R",
368   "comment"   => "construct Sub: Sub(a, b) = a - b",
369   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
370   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
371   "emit"      => '. sub %ia32_emit_binop /* Sub(%A3, %A4) -> %D1 */',
372   "outs"      => [ "res", "M" ],
373 },
374
375 "SubC" => {
376   "comment"   => "construct Sub with Carry: SubC(a, b) = a - b - carry",
377   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
378   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3 !in_r4" ] },
379   "emit"      => '. sbb %ia32_emit_binop /* SubC(%A3, %A4) -> %D1 */',
380   "outs"      => [ "res", "M" ],
381 },
382
383 "l_Sub" => {
384   "irn_flags" => "R",
385   "cmp_attr"  => "  return 1;\n",
386   "comment"   => "construct lowered Sub: Sub(a, b) = a - b",
387   "arity"     => 2,
388 },
389
390 "l_SubC" => {
391   "cmp_attr"  => "  return 1;\n",
392   "comment"   => "construct lowered Sub with Carry: SubC(a, b) = a - b - carry",
393   "arity"     => 2,
394 },
395
396 "DivMod" => {
397   "op_flags"  => "F|L",
398   "state"     => "exc_pinned",
399   "reg_req"   => { "in" => [ "eax", "gp", "edx", "none" ], "out" => [ "eax", "edx" ] },
400   "attr"      => "ia32_op_flavour_t dm_flav",
401   "init_attr" => "  attr->data.op_flav = dm_flav;",
402   "cmp_attr"  => "  return attr_a->data.op_flav != attr_b->data.op_flav;\n",
403   "emit"      =>
404 '  if (mode_is_signed(get_ia32_res_mode(n))) {
405 4.  idiv %S2 /* signed DivMod(%S1, %S2) -> %D1, (%A1, %A2, %A3) */
406   }
407   else {
408 4.  div %S2 /* unsigned DivMod(%S1, %S2) -> %D1, (%A1, %A2, %A3) */
409   }
410 ',
411   "outs"      => [ "div_res", "mod_res", "M" ],
412   "latency"   => 25,
413 },
414
415 "Shl" => {
416   "irn_flags" => "R",
417   "comment"   => "construct Shl: Shl(a, b) = a << b",
418   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
419   "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
420   "emit"      => '. shl %ia32_emit_binop /* Shl(%A1, %A2) -> %D1 */',
421   "outs"      => [ "res", "M" ],
422 },
423
424 "l_Shl" => {
425   "cmp_attr"  => "  return 1;\n",
426   "comment"   => "construct lowered Shl: Shl(a, b) = a << b",
427   "arity"     => 2
428 },
429
430 "ShlD" => {
431   "irn_flags" => "R",
432   "comment"   => "construct ShlD: ShlD(a, b, c) = a, b << count (shift left count bits from b into a)",
433   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
434   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "ecx", "none" ], "out" => [ "!ecx in_r3 !in_r4" ] },
435   "emit"      =>
436 '
437 if (get_ia32_immop_type(n) == ia32_ImmNone) {
438   if (get_ia32_op_type(n) == ia32_AddrModeD) {
439 4. shld %ia32_emit_am, %S4, %%cl /* ShlD(%A3, %A4, %A5) -> %D1 */
440   }
441   else {
442 4. shld %S3, %S4, %%cl /* ShlD(%A3, %A4, %A5) -> %D1 */
443   }
444 }
445 else {
446   if (get_ia32_op_type(n) == ia32_AddrModeD) {
447 4. shld %ia32_emit_am, %S4, %C /* ShlD(%A3, %A4, %A5) -> %D1 */
448   }
449   else {
450 4. shld %S3, %S4, %C /* ShlD(%A3, %A4, %A5) -> %D1 */
451   }
452 }
453 ',
454   "outs"      => [ "res", "M" ],
455   "latency"   => 6,
456 },
457
458 "l_ShlD" => {
459   "cmp_attr"  => "  return 1;\n",
460   "comment"   => "construct lowered ShlD: ShlD(a, b, c) = a, b << count (shift left count bits from b into a)",
461   "arity"     => 3
462 },
463
464 "Shr" => {
465   "irn_flags" => "R",
466   "comment"   => "construct Shr: Shr(a, b) = a >> b",
467   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
468   "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
469   "emit"      => '. shr %ia32_emit_binop /* Shr(%A1, %A2) -> %D1 */',
470   "outs"      => [ "res", "M" ],
471 },
472
473 "l_Shr" => {
474   "cmp_attr"  => "  return 1;\n",
475   "comment"   => "construct lowered Shr: Shr(a, b) = a << b",
476   "arity"     => 2
477 },
478
479 "ShrD" => {
480   "irn_flags" => "R",
481   "comment"   => "construct ShrD: ShrD(a, b, c) = a, b >> count (shift rigth count bits from a into b)",
482   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
483   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "ecx", "none" ], "out" => [ "!ecx in_r3 !in_r4" ] },
484   "emit"      =>
485 '
486 if (get_ia32_immop_type(n) == ia32_ImmNone) {
487   if (get_ia32_op_type(n) == ia32_AddrModeD) {
488 4. shrd %ia32_emit_am, %S4, %%cl /* ShrD(%A3, %A4, %A5) -> %D1 */
489   }
490   else {
491 4. shrd %S3, %S4, %%cl /* ShrD(%A3, %A4, %A5) -> %D1 */
492   }
493 }
494 else {
495   if (get_ia32_op_type(n) == ia32_AddrModeD) {
496 4. shrd %ia32_emit_am, %S4, %C /* ShrD(%A3, %A4, %A5) -> %D1 */
497   }
498   else {
499 4. shrd %S3, %S4, %C /* ShrD(%A3, %A4, %A5) -> %D1 */
500   }
501 }
502 ',
503   "outs"      => [ "res", "M" ],
504   "latency"   => 6,
505 },
506
507 "l_ShrD" => {
508   "cmp_attr"  => "  return 1;\n",
509   "comment"   => "construct lowered ShrD: ShrD(a, b, c) = a, b >> count (shift rigth count bits from a into b)",
510   "arity"     => 3
511 },
512
513 "Shrs" => {
514   "irn_flags" => "R",
515   "comment"   => "construct Shrs: Shrs(a, b) = a >> b",
516   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
517   "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
518   "emit"      => '. sar %ia32_emit_binop /* Shrs(%A1, %A2) -> %D1 */',
519   "outs"      => [ "res", "M" ],
520 },
521
522 "l_Shrs" => {
523   "cmp_attr"  => "  return 1;\n",
524   "comment"   => "construct lowered Shrs: Shrs(a, b) = a << b",
525   "arity"     => 2
526 },
527
528 "RotR" => {
529   "irn_flags" => "R",
530   "comment"     => "construct RotR: RotR(a, b) = a ROTR b",
531   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
532   "reg_req"     => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
533   "emit"        => '. ror %ia32_emit_binop /* RotR(%A1, %A2) -> %D1 */',
534   "outs"      => [ "res", "M" ],
535 },
536
537 "RotL" => {
538   "irn_flags" => "R",
539   "comment"   => "construct RotL: RotL(a, b) = a ROTL b",
540   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
541   "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
542   "emit"      => '. rol %ia32_emit_binop /* RotL(%A1, %A2) -> %D1 */',
543   "outs"      => [ "res", "M" ],
544 },
545
546 # unary operations
547
548 "Minus" => {
549   "irn_flags" => "R",
550   "comment"   => "construct Minus: Minus(a) = -a",
551   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
552   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
553   "emit"      => '. neg %ia32_emit_unop /* Neg(%A1) -> %D1, (%A1) */',
554   "outs"      => [ "res", "M" ],
555 },
556
557 "l_Minus" => {
558   "cmp_attr"  => "  return 1;\n",
559   "comment"   => "construct lowered Minus: Minus(a) = -a",
560   "arity"     => 1,
561 },
562
563 "Inc" => {
564   "irn_flags" => "R",
565   "comment"   => "construct Increment: Inc(a) = a++",
566   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
567   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
568   "emit"      => '. inc %ia32_emit_unop /* Inc(%S1) -> %D1, (%A1) */',
569   "outs"      => [ "res", "M" ],
570 },
571
572 "Dec" => {
573   "irn_flags" => "R",
574   "comment"   => "construct Decrement: Dec(a) = a--",
575   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
576   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
577   "emit"      => '. dec %ia32_emit_unop /* Dec(%S1) -> %D1, (%A1) */',
578   "outs"      => [ "res", "M" ],
579 },
580
581 "Not" => {
582   "irn_flags" => "R",
583   "comment"   => "construct Not: Not(a) = !a",
584   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
585   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
586   "emit"      => '. not %ia32_emit_unop /* Not(%S1) -> %D1, (%A1) */',
587   "outs"      => [ "res", "M" ],
588 },
589
590 # other operations
591
592 "CondJmp" => {
593   "op_flags"  => "L|X|Y",
594   "comment"   => "construct conditional jump: CMP A, B && JMPxx LABEL",
595   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
596   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ] },
597   "outs"      => [ "false", "true" ],
598   "latency"   => 3,
599 },
600
601 "TestJmp" => {
602   "op_flags"  => "L|X|Y",
603   "comment"   => "construct conditional jump: TEST A, B && JMPxx LABEL",
604   "reg_req"  => { "in" => [ "gp", "gp" ] },
605   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
606   "outs"      => [ "false", "true" ],
607   "latency"   => 3,
608 },
609
610 "CJmpAM" => {
611   "op_flags"  => "L|X|Y",
612   "comment"   => "construct conditional jump without CMP (replaces CondJmp): JMPxx LABEL",
613   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
614   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "none", "none" ] },
615   "outs"      => [ "false", "true" ],
616 },
617
618 "CJmp" => {
619   "op_flags"  => "L|X|Y",
620   "comment"   => "construct conditional jump without CMP (replaces TestJmp): JMPxx LABEL",
621   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
622   "reg_req"   => { "in" => [ "gp", "gp" ] },
623 },
624
625 "SwitchJmp" => {
626   "op_flags"  => "L|X|Y",
627   "comment"   => "construct switch",
628   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
629   "reg_req"   => { "in" => [ "gp" ], "out" => [ "none" ] },
630   "latency"   => 3,
631 },
632
633 "Const" => {
634   "op_flags"  => "c",
635   "irn_flags" => "R",
636   "comment"   => "represents an integer constant",
637   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
638   "reg_req"   => { "in" => [ "none" ], "out" => [ "gp" ] },
639 },
640
641 "Cdq" => {
642   # we should not rematrialize this node. It produces 2 results and has
643   # very strict constrains
644   "comment"   => "construct CDQ: sign extend EAX -> EDX:EAX",
645   "reg_req"   => { "in" => [ "gp" ], "out" => [ "eax in_r1", "edx" ] },
646   "emit"      => '. cdq /* sign extend EAX -> EDX:EAX, (%A1) */',
647   "outs"      => [ "EAX", "EDX" ],
648 },
649
650 # Load / Store
651
652 "Load" => {
653   "op_flags"  => "L|F",
654   "state"     => "exc_pinned",
655   "comment"   => "construct Load: Load(ptr, mem) = LD ptr -> reg",
656   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
657   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "gp" ] },
658   "latency"   => 3,
659   "emit"      =>
660 '  if (get_mode_size_bits(get_ia32_ls_mode(n)) < 32) {
661 4.   mov%Mx %D1, %ia32_emit_am /* Load((%A1)) -> %D1 */
662   }
663   else {
664 4.   mov %D1, %ia32_emit_am /* Load((%A1)) -> %D1 */
665   }
666 ',
667   "outs"      => [ "res", "M" ],
668 },
669
670 "l_Load" => {
671   "op_flags"  => "L|F",
672   "cmp_attr"  => "  return 1;\n",
673   "comment"   => "construct lowered Load: Load(ptr, mem) = LD ptr -> reg",
674   "outs"      => [ "res", "M" ],
675   "arity"     => 2,
676 },
677
678 "l_Store" => {
679   "op_flags"  => "L|F",
680   "cmp_attr"  => "  return 1;\n",
681   "state"     => "exc_pinned",
682   "comment"   => "construct lowered Store: Store(ptr, val, mem) = ST ptr,val",
683   "arity"     => 3,
684   "outs"      => [ "M" ],
685 },
686
687 "Store" => {
688   "op_flags"  => "L|F",
689   "state"     => "exc_pinned",
690   "comment"   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
691   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
692   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ] },
693   "emit"      => '. mov %ia32_emit_binop /* Store(%A3) -> (%A1) */',
694   "outs"      => [ "M" ],
695   "latency"   => 3,
696 },
697
698 "Store8Bit" => {
699   "op_flags"  => "L|F",
700   "state"     => "exc_pinned",
701   "comment"   => "construct 8Bit Store: Store(ptr, val, mem) = ST ptr,val",
702   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
703   "reg_req"   => { "in" => [ "gp", "gp", "eax ebx ecx edx", "none" ] },
704   "emit"      => '. mov %ia32_emit_binop /* Store(%A3) -> (%A1) */',
705   "outs"      => [ "M" ],
706   "latency"   => 3,
707 },
708
709 "Lea" => {
710   "irn_flags" => "R",
711   "comment"   => "construct Lea: Lea(a,b) = lea [a+b*const+offs] | res = a + b * const + offs with const = 0,1,2,4,8",
712   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
713   "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
714   "emit"      => '. lea %D1, %ia32_emit_am /* LEA(%A1, %A2) */',
715   "latency"   => 2,
716 },
717
718 "Push" => {
719   # We don't set class modify_stack here (but we will do this on proj 0)
720   "comment"   => "push a gp register on the stack",
721   "reg_req"   => { "in" => [ "esp", "gp", "none" ], "out" => [ "esp" ] },
722   "emit"      => '
723 if (get_ia32_id_cnst(n)) {
724         if (get_ia32_immop_type(n) == ia32_ImmConst) {
725 4. push %C /* Push const on stack */
726 } else {
727 4. push OFFSET FLAT:%C /* Push symconst on stack */
728         }
729 }
730 else if (get_ia32_op_type(n) == ia32_Normal) {
731 2. push %S2 /* Push(%A2) */
732 }
733 else {
734 2. push %ia32_emit_am /* Push memory to stack */
735 };
736 ',
737   "outs"      => [ "stack", "M" ],
738   "latency"   => 3,
739 },
740
741 "Pop" => {
742   # We don't set class modify stack here (but we will do this on proj 1)
743   "comment"   => "pop a gp register from the stack",
744   "reg_req"   => { "in" => [ "esp", "none" ], "out" => [ "gp", "esp" ] },
745   "emit"      => '
746 if (get_ia32_op_type(n) == ia32_Normal) {
747 2. pop %D1 /* Pop from stack into %D1 */
748 }
749 else {
750 2. pop %ia32_emit_am /* Pop from stack into memory */
751 }
752 ',
753   "outs"      => [ "res", "stack", "M" ],
754   "latency"   => 4,
755 },
756
757 "Enter" => {
758   "comment"   => "create stack frame",
759   "reg_req"   => { "in" => [ "esp" ], "out" => [ "ebp", "esp" ] },
760   "emit"      => '. enter /* Enter */',
761   "outs"      => [ "frame", "stack", "M" ],
762   "latency"   => 15,
763 },
764
765 "Leave" => {
766   "comment"   => "destroy stack frame",
767   "reg_req"   => { "in" => [ "esp", "ebp" ], "out" => [ "ebp", "esp" ] },
768   "emit"      => '. leave /* Leave */',
769   "outs"      => [ "frame", "stack", "M" ],
770   "latency"   => 3,
771 },
772
773 "AddSP" => {
774   "irn_flags" => "I",
775   "comment"   => "allocate space on stack",
776   "reg_req"   => { "in" => [ "esp", "gp" ], "out" => [ "esp", "none" ] },
777   "outs"      => [ "stack", "M" ],
778 },
779
780 "SubSP" => {
781   "irn_flags" => "I",
782   "comment"   => "free space on stack",
783   "reg_req"   => { "in" => [ "esp", "gp" ], "out" => [ "esp", "none" ] },
784   "outs"      => [ "stack", "M" ],
785 },
786
787 "LdTls" => {
788   "irn_flags" => "R",
789   "comment"   => "get the TLS base address",
790   "reg_req"   => { "out" => [ "gp" ] },
791 },
792
793
794
795 #-----------------------------------------------------------------------------#
796 #   _____ _____ ______    __ _             _                     _            #
797 #  / ____/ ____|  ____|  / _| |           | |                   | |           #
798 # | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
799 #  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
800 #  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
801 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
802 #-----------------------------------------------------------------------------#
803
804 # commutative operations
805
806 "xAdd" => {
807   "irn_flags" => "R",
808   "comment"   => "construct SSE Add: Add(a, b) = Add(b, a) = a + b",
809   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
810   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
811   "emit"      => '. adds%M %ia32_emit_binop /* SSE Add(%A3, %A4) -> %D1 */',
812   "outs"      => [ "res", "M" ],
813   "latency"   => 4,
814 },
815
816 "xMul" => {
817   "irn_flags" => "R",
818   "comment"   => "construct SSE Mul: Mul(a, b) = Mul(b, a) = a * b",
819   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
820   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
821   "emit"      => '. muls%M %ia32_emit_binop /* SSE Mul(%A3, %A4) -> %D1 */',
822   "outs"      => [ "res", "M" ],
823   "latency"   => 4,
824 },
825
826 "xMax" => {
827   "irn_flags" => "R",
828   "comment"   => "construct SSE Max: Max(a, b) = Max(b, a) = a > b ? a : b",
829   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
830   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
831   "emit"      => '. maxs%M %ia32_emit_binop /* SSE Max(%A3, %A4) -> %D1 */',
832   "outs"      => [ "res", "M" ],
833   "latency"   => 2,
834 },
835
836 "xMin" => {
837   "irn_flags" => "R",
838   "comment"   => "construct SSE Min: Min(a, b) = Min(b, a) = a < b ? a : b",
839   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
840   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
841   "emit"      => '. mins%M %ia32_emit_binop /* SSE Min(%A3, %A4) -> %D1 */',
842   "outs"      => [ "res", "M" ],
843   "latency"   => 2,
844 },
845
846 "xAnd" => {
847   "irn_flags" => "R",
848   "comment"   => "construct SSE And: And(a, b) = a AND b",
849   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
850   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
851   "emit"      => '. andp%M %ia32_emit_binop /* SSE And(%A3, %A4) -> %D1 */',
852   "outs"      => [ "res", "M" ],
853   "latency"   => 3,
854 },
855
856 "xOr" => {
857   "irn_flags" => "R",
858   "comment"   => "construct SSE Or: Or(a, b) = a OR b",
859   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
860   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
861   "emit"      => '. orp%M %ia32_emit_binop /* SSE Or(%A3, %A4) -> %D1 */',
862   "outs"      => [ "res", "M" ],
863 },
864
865 "xEor" => {
866   "irn_flags" => "R",
867   "comment"   => "construct SSE Eor: Eor(a, b) = a XOR b",
868   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
869   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
870   "emit"      => '. xorp%M %ia32_emit_binop /* SSE Xor(%A3, %A4) -> %D1 */',
871   "outs"      => [ "res", "M" ],
872   "latency"   => 3,
873 },
874
875 # not commutative operations
876
877 "xAndNot" => {
878   "irn_flags" => "R",
879   "comment"   => "construct SSE AndNot: AndNot(a, b) = a AND NOT b",
880   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
881   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3 !in_r4" ] },
882   "emit"      => '. andnp%M %ia32_emit_binop /* SSE AndNot(%A3, %A4) -> %D1 */',
883   "outs"      => [ "res", "M" ],
884   "latency"   => 3,
885 },
886
887 "xSub" => {
888   "irn_flags" => "R",
889   "comment"   => "construct SSE Sub: Sub(a, b) = a - b",
890   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
891   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
892   "emit"      => '. subs%M %ia32_emit_binop /* SSE Sub(%A1, %A2) -> %D1 */',
893   "outs"      => [ "res", "M" ],
894   "latency"   => 4,
895 },
896
897 "xDiv" => {
898   "irn_flags" => "R",
899   "comment"   => "construct SSE Div: Div(a, b) = a / b",
900   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
901   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3 !in_r4" ] },
902   "emit"      => '. divs%M %ia32_emit_binop /* SSE Div(%A1, %A2) -> %D1 */',
903   "outs"      => [ "res", "M" ],
904   "latency"   => 16,
905 },
906
907 # other operations
908
909 "xCmp" => {
910   "irn_flags" => "R",
911   "comment"   => "construct SSE Compare: Cmp(a, b) == a = a cmp b",
912   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3 !in_r4" ] },
913   "outs"      => [ "res", "M" ],
914   "latency"   => 3,
915 },
916
917 "xCondJmp" => {
918   "op_flags"  => "L|X|Y",
919   "comment"   => "construct conditional jump: UCOMIS A, B && JMPxx LABEL",
920   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
921   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "none", "none" ] },
922   "outs"      => [ "false", "true" ],
923   "latency"   => 5,
924 },
925
926 "xConst" => {
927   "op_flags"  => "c",
928   "irn_flags" => "R",
929   "comment"   => "represents a SSE constant",
930   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
931   "reg_req"   => { "in" => [ "none" ], "out" => [ "xmm" ] },
932   "emit"      => '. movs%M %D1, %C /* Load fConst into register */',
933   "latency"   => 2,
934 },
935
936 # Load / Store
937
938 "xLoad" => {
939   "op_flags"  => "L|F",
940   "state"     => "exc_pinned",
941   "comment"   => "construct SSE Load: Load(ptr, mem) = LD ptr",
942   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
943   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "xmm" ] },
944   "emit"      => '. movs%M %D1, %ia32_emit_am /* Load((%A1)) -> %D1 */',
945   "outs"      => [ "res", "M" ],
946   "latency"   => 2,
947 },
948
949 "xStore" => {
950   "op_flags" => "L|F",
951   "state"    => "exc_pinned",
952   "comment"  => "construct Store: Store(ptr, val, mem) = ST ptr,val",
953   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
954   "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ] },
955   "emit"     => '. movs%M %ia32_emit_binop /* Store(%S3) -> (%A1) */',
956   "outs"      => [ "M" ],
957   "latency"   => 2,
958 },
959
960 "xStoreSimple" => {
961   "op_flags" => "L|F",
962   "state"    => "exc_pinned",
963   "comment"  => "construct Store without index: Store(ptr, val, mem) = ST ptr,val",
964   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
965   "reg_req"  => { "in" => [ "gp", "xmm", "none" ] },
966   "emit"     => '. movs%M %ia32_emit_am, %S2 /* store XMM0 onto stack */',
967   "outs"      => [ "M" ],
968   "latency"   => 2,
969 },
970
971 "l_X87toSSE" => {
972   "op_flags" => "L|F",
973   "comment"  => "construct: transfer a value from x87 FPU into a SSE register",
974   "cmp_attr" => "  return 1;\n",
975   "arity"    => 3,
976 },
977
978 "l_SSEtoX87" => {
979   "op_flags" => "L|F",
980   "comment"  => "construct: transfer a value from SSE register to x87 FPU",
981   "cmp_attr" => "  return 1;\n",
982   "arity"    => 3,
983 },
984
985 "GetST0" => {
986   "op_flags" => "L|F",
987   "irn_flags" => "I",
988   "state"    => "exc_pinned",
989   "comment"  => "store ST0 onto stack",
990   "cmp_attr" => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
991   "reg_req"  => { "in" => [ "gp", "none" ] },
992   "emit"     => '. fstp %ia32_emit_am /* store ST0 onto stack */',
993   "outs"     => [ "M" ],
994   "latency"  => 4,
995 },
996
997 "SetST0" => {
998   "op_flags" => "L|F",
999   "irn_flags" => "I",
1000   "state"    => "exc_pinned",
1001   "comment"  => "load ST0 from stack",
1002   "cmp_attr" => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1003   "reg_req"  => { "in" => [ "gp", "none" ], "out" => [ "st0", "none" ] },
1004   "emit"     => '. fld %ia32_emit_am /* load ST0 from stack */',
1005   "outs"     => [ "res", "M" ],
1006   "latency"  => 2,
1007 },
1008
1009 # CopyB
1010
1011 "CopyB" => {
1012   "op_flags" => "F|H",
1013   "state"    => "pinned",
1014   "comment"  => "implements a memcopy: CopyB(dst, src, size, mem) == memcpy(dst, src, size)",
1015   "reg_req"  => { "in" => [ "edi", "esi", "ecx", "none" ], "out" => [ "edi", "esi", "ecx", "none" ] },
1016   "outs"     => [ "DST", "SRC", "CNT", "M" ],
1017 },
1018
1019 "CopyB_i" => {
1020   "op_flags" => "F|H",
1021   "state"    => "pinned",
1022   "comment"  => "implements a memcopy: CopyB(dst, src, mem) == memcpy(dst, src, attr(size))",
1023   "cmp_attr" => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1024   "reg_req"  => { "in" => [ "edi", "esi", "none" ], "out" => [  "edi", "esi", "none" ] },
1025   "outs"     => [ "DST", "SRC", "M" ],
1026 },
1027
1028 # Conversions
1029
1030 "Conv_I2I" => {
1031   "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3", "none" ] },
1032   "cmp_attr" => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
1033   "comment"  => "construct Conv Int -> Int",
1034   "outs"     => [ "res", "M" ],
1035 },
1036
1037 "Conv_I2I8Bit" => {
1038   "reg_req"  => { "in" => [ "gp", "gp", "eax ebx ecx edx", "none" ], "out" => [ "in_r3", "none" ] },
1039   "cmp_attr" => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
1040   "comment"  => "construct Conv Int -> Int",
1041   "outs"     => [ "res", "M" ],
1042 },
1043
1044 "Conv_I2FP" => {
1045   "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "xmm", "none" ] },
1046   "cmp_attr" => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
1047   "comment"  => "construct Conv Int -> Floating Point",
1048   "outs"     => [ "res", "M" ],
1049   "latency"  => 10,
1050 },
1051
1052 "Conv_FP2I" => {
1053   "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ], "out" => [ "gp", "none" ] },
1054   "cmp_attr" => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
1055   "comment"  => "construct Conv Floating Point -> Int",
1056   "outs"     => [ "res", "M" ],
1057   "latency"  => 10,
1058 },
1059
1060 "Conv_FP2FP" => {
1061   "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ], "out" => [ "xmm", "none" ] },
1062   "cmp_attr" => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
1063   "comment"  => "construct Conv Floating Point -> Floating Point",
1064   "outs"     => [ "res", "M" ],
1065   "latency"  => 8,
1066 },
1067
1068 "CmpCMov" => {
1069   "irn_flags" => "R",
1070   "comment"   => "construct Conditional Move: CMov(sel, a, b) == sel ? a : b",
1071   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp" ], "out" => [ "in_r4" ] },
1072   "latency"   => 2,
1073 },
1074
1075 "PsiCondCMov" => {
1076   "irn_flags" => "R",
1077   "comment"   => "check if Psi condition tree evaluates to true and move result accordingly",
1078   "reg_req"   => { "in" => [ "gp", "gp", "gp" ], "out" => [ "in_r3" ] },
1079   "latency"   => 2,
1080 },
1081
1082 "xCmpCMov" => {
1083   "irn_flags" => "R",
1084   "comment"   => "construct Conditional Move: SSE Compare + int CMov ",
1085   "reg_req"   => { "in" => [ "xmm", "xmm", "gp", "gp" ], "out" => [ "in_r4" ] },
1086   "latency"   => 5,
1087 },
1088
1089 "vfCmpCMov" => {
1090   "irn_flags" => "R",
1091   "comment"   => "construct Conditional Move: x87 Compare + int CMov",
1092   "reg_req"   => { "in" => [ "vfp", "vfp", "gp", "gp" ], "out" => [ "in_r4" ] },
1093   "latency"   => 10,
1094 },
1095
1096 "CmpSet" => {
1097   "irn_flags" => "R",
1098   "comment"   => "construct Set: Set(sel) == sel ? 1 : 0",
1099   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "eax ebx ecx edx", "none" ] },
1100   "outs"      => [ "res", "M" ],
1101   "latency"   => 2,
1102 },
1103
1104 "PsiCondSet" => {
1105   "irn_flags" => "R",
1106   "comment"   => "check if Psi condition tree evaluates to true and set result accordingly",
1107   "reg_req"   => { "in" => [ "gp" ], "out" => [ "eax ebx ecx edx" ] },
1108   "latency"   => 2,
1109 },
1110
1111 "xCmpSet" => {
1112   "irn_flags" => "R",
1113   "comment"   => "construct Set: SSE Compare + int Set",
1114   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "eax ebx ecx edx", "none" ] },
1115   "outs"      => [ "res", "M" ],
1116   "latency"   => 5,
1117 },
1118
1119 "vfCmpSet" => {
1120   "irn_flags" => "R",
1121   "comment"   => "construct Set: x87 Compare + int Set",
1122   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "eax ebx ecx edx", "none" ] },
1123   "outs"      => [ "res", "M" ],
1124   "latency"   => 10,
1125 },
1126
1127 "vfCMov" => {
1128   "irn_flags" => "R",
1129   "comment"   => "construct x87 Conditional Move: vfCMov(sel, a, b) = sel ? a : b",
1130   "reg_req"   => { "in" => [ "vfp", "vfp", "vfp", "vfp" ], "out" => [ "vfp" ] },
1131   "latency"   => 10,
1132 },
1133
1134 #----------------------------------------------------------#
1135 #        _      _               _    __ _             _    #
1136 #       (_)    | |             | |  / _| |           | |   #
1137 # __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
1138 # \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
1139 #  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
1140 #   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1141 #                 | |                                      #
1142 #  _ __   ___   __| | ___  ___                             #
1143 # | '_ \ / _ \ / _` |/ _ \/ __|                            #
1144 # | | | | (_) | (_| |  __/\__ \                            #
1145 # |_| |_|\___/ \__,_|\___||___/                            #
1146 #----------------------------------------------------------#
1147
1148 "vfadd" => {
1149   "irn_flags" => "R",
1150   "comment"   => "virtual fp Add: Add(a, b) = Add(b, a) = a + b",
1151   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1152   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
1153   "outs"      => [ "res", "M" ],
1154   "latency"   => 4,
1155 },
1156
1157 "vfmul" => {
1158   "irn_flags" => "R",
1159   "comment"   => "virtual fp Mul: Mul(a, b) = Mul(b, a) = a * b",
1160   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1161   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
1162   "outs"      => [ "res", "M" ],
1163   "latency"   => 4,
1164 },
1165
1166 "l_vfmul" => {
1167   "op_flags"  => "C",
1168   "cmp_attr"  => "  return 1;\n",
1169   "comment"   => "lowered virtual fp Mul: Mul(a, b) = Mul(b, a) = a * b",
1170   "arity"     => 2,
1171 },
1172
1173 "vfsub" => {
1174   "irn_flags" => "R",
1175   "comment"   => "virtual fp Sub: Sub(a, b) = a - b",
1176   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1177   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
1178   "outs"      => [ "res", "M" ],
1179   "latency"   => 4,
1180 },
1181
1182 "l_vfsub" => {
1183   "cmp_attr"  => "  return 1;\n",
1184   "comment"   => "lowered virtual fp Sub: Sub(a, b) = a - b",
1185   "arity"     => 2,
1186 },
1187
1188 "vfdiv" => {
1189   "comment"   => "virtual fp Div: Div(a, b) = a / b",
1190   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1191   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
1192   "outs"      => [ "res", "M" ],
1193   "latency"   => 20,
1194 },
1195
1196 "l_vfdiv" => {
1197   "cmp_attr"  => "  return 1;\n",
1198   "comment"   => "lowered virtual fp Div: Div(a, b) = a / b",
1199   "arity"     => 2,
1200 },
1201
1202 "vfabs" => {
1203   "irn_flags" => "R",
1204   "comment"   => "virtual fp Abs: Abs(a) = |a|",
1205   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
1206   "latency"   => 2,
1207 },
1208
1209 "vfchs" => {
1210   "irn_flags" => "R",
1211   "comment"   => "virtual fp Chs: Chs(a) = -a",
1212   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
1213   "latency"   => 2,
1214 },
1215
1216 "vfsin" => {
1217   "irn_flags" => "R",
1218   "comment"   => "virtual fp Sin: Sin(a) = sin(a)",
1219   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
1220   "latency"   => 150,
1221 },
1222
1223 "vfcos" => {
1224   "irn_flags" => "R",
1225   "comment"   => "virtual fp Cos: Cos(a) = cos(a)",
1226   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
1227   "latency"   => 150,
1228 },
1229
1230 "vfsqrt" => {
1231   "irn_flags" => "R",
1232   "comment"   => "virtual fp Sqrt: Sqrt(a) = a ^ 0.5",
1233   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
1234   "latency"   => 30,
1235 },
1236
1237 # virtual Load and Store
1238
1239 "vfld" => {
1240   "op_flags"  => "L|F",
1241   "state"     => "exc_pinned",
1242   "comment"   => "virtual fp Load: Load(ptr, mem) = LD ptr -> reg",
1243   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1244   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "vfp", "none" ] },
1245   "outs"      => [ "res", "M" ],
1246   "latency"   => 2,
1247 },
1248
1249 "vfst" => {
1250   "op_flags"  => "L|F",
1251   "state"     => "exc_pinned",
1252   "comment"   => "virtual fp Store: Store(ptr, val, mem) = ST ptr,val",
1253   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1254   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "none" ] },
1255   "outs"      => [ "M" ],
1256   "latency"   => 2,
1257 },
1258
1259 # Conversions
1260
1261 "vfild" => {
1262   "comment"   => "virtual fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1263   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1264   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "vfp", "none" ] },
1265   "outs"      => [ "res", "M" ],
1266   "latency"   => 4,
1267 },
1268
1269 "l_vfild" => {
1270   "cmp_attr"  => "  return 1;\n",
1271   "comment"   => "lowered virtual fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1272   "outs"      => [ "res", "M" ],
1273   "arity"     => 2,
1274 },
1275
1276 "vfist" => {
1277   "comment"   => "virtual fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1278   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1279   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "none" ] },
1280   "outs"      => [ "M" ],
1281   "latency"   => 4,
1282 },
1283
1284 "l_vfist" => {
1285   "cmp_attr"  => "  return 1;\n",
1286   "comment"   => "lowered virtual fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1287   "outs"      => [ "M" ],
1288   "arity"     => 3,
1289 },
1290
1291
1292 # constants
1293
1294 "vfldz" => {
1295   "irn_flags" => "R",
1296   "comment"   => "virtual fp Load 0.0: Ld 0.0 -> reg",
1297   "reg_req"   => { "out" => [ "vfp" ] },
1298   "latency"   => 4,
1299 },
1300
1301 "vfld1" => {
1302   "irn_flags" => "R",
1303   "comment"   => "virtual fp Load 1.0: Ld 1.0 -> reg",
1304   "reg_req"   => { "out" => [ "vfp" ] },
1305   "latency"   => 4,
1306 },
1307
1308 "vfldpi" => {
1309   "irn_flags" => "R",
1310   "comment"   => "virtual fp Load pi: Ld pi -> reg",
1311   "reg_req"   => { "out" => [ "vfp" ] },
1312   "latency"   => 4,
1313 },
1314
1315 "vfldln2" => {
1316   "irn_flags" => "R",
1317   "comment"   => "virtual fp Load ln 2: Ld ln 2 -> reg",
1318   "reg_req"   => { "out" => [ "vfp" ] },
1319   "latency"   => 4,
1320 },
1321
1322 "vfldlg2" => {
1323   "irn_flags" => "R",
1324   "comment"   => "virtual fp Load lg 2: Ld lg 2 -> reg",
1325   "reg_req"   => { "out" => [ "vfp" ] },
1326   "latency"   => 4,
1327 },
1328
1329 "vfldl2t" => {
1330   "irn_flags" => "R",
1331   "comment"   => "virtual fp Load ld 10: Ld ld 10 -> reg",
1332   "reg_req"   => { "out" => [ "vfp" ] },
1333   "latency"   => 4,
1334 },
1335
1336 "vfldl2e" => {
1337   "irn_flags" => "R",
1338   "comment"   => "virtual fp Load ld e: Ld ld e -> reg",
1339   "reg_req"   => { "out" => [ "vfp" ] },
1340   "latency"   => 4,
1341 },
1342
1343 "vfConst" => {
1344   "op_flags"  => "c",
1345   "irn_flags" => "R",
1346   "init_attr" => "  set_ia32_ls_mode(res, mode);",
1347   "comment"   => "represents a virtual floating point constant",
1348   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1349   "reg_req"   => { "in" => [ "none" ], "out" => [ "vfp" ] },
1350   "latency"   => 3,
1351 },
1352
1353 # other
1354
1355 "vfCondJmp" => {
1356   "op_flags"  => "L|X|Y",
1357   "comment"   => "represents a virtual floating point compare",
1358   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1359   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "none", "none", "eax" ] },
1360   "outs"      => [ "false", "true", "temp_reg_eax" ],
1361   "latency"   => 10,
1362 },
1363
1364 #------------------------------------------------------------------------#
1365 #       ___ _____    __ _             _                     _            #
1366 # __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1367 # \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1368 #  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1369 # /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1370 #------------------------------------------------------------------------#
1371
1372 "fadd" => {
1373   "op_flags"  => "R",
1374   "rd_constructor" => "NONE",
1375   "comment"   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
1376   "reg_req"   => { },
1377   "emit"      => '. fadd %ia32_emit_x87_binop /* x87 fadd(%A3, %A4) -> %D1 */',
1378 },
1379
1380 "faddp" => {
1381   "op_flags"  => "R",
1382   "rd_constructor" => "NONE",
1383   "comment"   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
1384   "reg_req"   => { },
1385   "emit"      => '. faddp %ia32_emit_x87_binop /* x87 fadd(%A3, %A4) -> %D1 */',
1386 },
1387
1388 "fmul" => {
1389   "op_flags"  => "R",
1390   "rd_constructor" => "NONE",
1391   "comment"   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
1392   "reg_req"   => { },
1393   "emit"      => '. fmul %ia32_emit_x87_binop /* x87 fmul(%A3, %A4) -> %D1 */',
1394 },
1395
1396 "fmulp" => {
1397   "op_flags"  => "R",
1398   "rd_constructor" => "NONE",
1399   "comment"   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
1400   "reg_req"   => { },
1401   "emit"      => '. fmulp %ia32_emit_x87_binop /* x87 fmul(%A3, %A4) -> %D1 */',,
1402 },
1403
1404 "fsub" => {
1405   "op_flags"  => "R",
1406   "rd_constructor" => "NONE",
1407   "comment"   => "x87 fp Sub: Sub(a, b) = a - b",
1408   "reg_req"   => { },
1409   "emit"      => '. fsub %ia32_emit_x87_binop /* x87 fsub(%A3, %A4) -> %D1 */',
1410 },
1411
1412 "fsubp" => {
1413   "op_flags"  => "R",
1414   "rd_constructor" => "NONE",
1415   "comment"   => "x87 fp Sub: Sub(a, b) = a - b",
1416   "reg_req"   => { },
1417   "emit"      => '. fsubp %ia32_emit_x87_binop /* x87 fsub(%A3, %A4) -> %D1 */',
1418 },
1419
1420 "fsubr" => {
1421   "op_flags"  => "R",
1422   "rd_constructor" => "NONE",
1423   "irn_flags" => "R",
1424   "comment"   => "x87 fp SubR: SubR(a, b) = b - a",
1425   "reg_req"   => { },
1426   "emit"      => '. fsubr %ia32_emit_x87_binop /* x87 fsubr(%A3, %A4) -> %D1 */',
1427 },
1428
1429 "fsubrp" => {
1430   "op_flags"  => "R",
1431   "rd_constructor" => "NONE",
1432   "irn_flags" => "R",
1433   "comment"   => "x87 fp SubR: SubR(a, b) = b - a",
1434   "reg_req"   => { },
1435   "emit"      => '. fsubrp %ia32_emit_x87_binop /* x87 fsubr(%A3, %A4) -> %D1 */',
1436 },
1437
1438 "fdiv" => {
1439   "op_flags"  => "R",
1440   "rd_constructor" => "NONE",
1441   "comment"   => "x87 fp Div: Div(a, b) = a / b",
1442   "reg_req"   => { },
1443   "emit"      => '. fdiv %ia32_emit_x87_binop /* x87 fdiv(%A3, %A4) -> %D1 */',
1444 },
1445
1446 "fdivp" => {
1447   "op_flags"  => "R",
1448   "rd_constructor" => "NONE",
1449   "comment"   => "x87 fp Div: Div(a, b) = a / b",
1450   "reg_req"   => { },
1451   "emit"      => '. fdivp %ia32_emit_x87_binop /* x87 fdiv(%A3, %A4) -> %D1 */',
1452 },
1453
1454 "fdivr" => {
1455   "op_flags"  => "R",
1456   "rd_constructor" => "NONE",
1457   "comment"   => "x87 fp DivR: DivR(a, b) = b / a",
1458   "reg_req"   => { },
1459   "emit"      => '. fdivr %ia32_emit_x87_binop /* x87 fdivr(%A3, %A4) -> %D1 */',
1460 },
1461
1462 "fdivrp" => {
1463   "op_flags"  => "R",
1464   "rd_constructor" => "NONE",
1465   "comment"   => "x87 fp DivR: DivR(a, b) = b / a",
1466   "reg_req"   => { },
1467   "emit"      => '. fdivrp %ia32_emit_x87_binop /* x87 fdivr(%A3, %A4) -> %D1 */',
1468 },
1469
1470 "fabs" => {
1471   "op_flags"  => "R",
1472   "rd_constructor" => "NONE",
1473   "comment"   => "x87 fp Abs: Abs(a) = |a|",
1474   "reg_req"   => { },
1475   "emit"      => '. fabs /* x87 fabs(%A1) -> %D1 */',
1476 },
1477
1478 "fchs" => {
1479   "op_flags"  => "R",
1480   "rd_constructor" => "NONE",
1481   "comment"   => "x87 fp Chs: Chs(a) = -a",
1482   "reg_req"   => { },
1483   "emit"      => '. fchs /* x87 fchs(%A1) -> %D1 */',
1484 },
1485
1486 "fsin" => {
1487   "op_flags"  => "R",
1488   "rd_constructor" => "NONE",
1489   "comment"   => "x87 fp Sin: Sin(a) = sin(a)",
1490   "reg_req"   => { },
1491   "emit"      => '. fsin /* x87 sin(%A1) -> %D1 */',
1492 },
1493
1494 "fcos" => {
1495   "op_flags"  => "R",
1496   "rd_constructor" => "NONE",
1497   "comment"   => "x87 fp Cos: Cos(a) = cos(a)",
1498   "reg_req"   => { },
1499   "emit"      => '. fcos /* x87 cos(%A1) -> %D1 */',
1500 },
1501
1502 "fsqrt" => {
1503   "op_flags"  => "R",
1504   "rd_constructor" => "NONE",
1505   "comment"   => "x87 fp Sqrt: Sqrt(a) = a ^ 0.5",
1506   "reg_req"   => { },
1507   "emit"      => '. fsqrt $ /* x87 sqrt(%A1) -> %D1 */',
1508 },
1509
1510 # x87 Load and Store
1511
1512 "fld" => {
1513   "rd_constructor" => "NONE",
1514   "op_flags"  => "R|L|F",
1515   "state"     => "exc_pinned",
1516   "comment"   => "x87 fp Load: Load(ptr, mem) = LD ptr -> reg",
1517   "reg_req"   => { },
1518   "emit"      => '. fld %ia32_emit_am /* Load((%A1)) -> %D1 */',
1519 },
1520
1521 "fst" => {
1522   "rd_constructor" => "NONE",
1523   "op_flags"  => "R|L|F",
1524   "state"     => "exc_pinned",
1525   "comment"   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
1526   "reg_req"   => { },
1527   "emit"      => '. fst %ia32_emit_am /* Store(%A3) -> (%A1) */',
1528 },
1529
1530 "fstp" => {
1531   "rd_constructor" => "NONE",
1532   "op_flags"  => "R|L|F",
1533   "state"     => "exc_pinned",
1534   "comment"   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
1535   "reg_req"   => { },
1536   "emit"      => '. fstp %ia32_emit_am /* Store(%A3) -> (%A1) and pop */',
1537 },
1538
1539 # Conversions
1540
1541 "fild" => {
1542   "op_flags"  => "R",
1543   "rd_constructor" => "NONE",
1544   "comment"   => "x87 fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1545   "reg_req"   => { },
1546   "emit"      => '. fild %ia32_emit_am /* integer Load((%A1)) -> %D1 */',
1547 },
1548
1549 "fist" => {
1550   "op_flags"  => "R",
1551   "rd_constructor" => "NONE",
1552   "comment"   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1553   "reg_req"   => { },
1554   "emit"      => '. fist %ia32_emit_am /* integer Store(%A3) -> (%A1) */',
1555 },
1556
1557 "fistp" => {
1558   "op_flags"  => "R",
1559   "rd_constructor" => "NONE",
1560   "comment"   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1561   "reg_req"   => { },
1562   "emit"      => '. fistp %ia32_emit_am /* integer Store(%A3) -> (%A1) and pop */',
1563 },
1564
1565 # constants
1566
1567 "fldz" => {
1568   "op_flags"  => "R|c",
1569   "irn_flags"  => "R",
1570   "comment"   => "x87 fp Load 0.0: Ld 0.0 -> reg",
1571   "reg_req"   => { },
1572   "emit"      => '. fldz /* x87 0.0 -> %D1 */',
1573 },
1574
1575 "fld1" => {
1576   "op_flags"  => "R|c",
1577   "irn_flags"  => "R",
1578   "comment"   => "x87 fp Load 1.0: Ld 1.0 -> reg",
1579   "reg_req"   => { },
1580   "emit"      => '. fld1 /* x87 1.0 -> %D1 */',
1581 },
1582
1583 "fldpi" => {
1584   "op_flags"  => "R|c",
1585   "irn_flags"  => "R",
1586   "comment"   => "x87 fp Load pi: Ld pi -> reg",
1587   "reg_req"   => { },
1588   "emit"      => '. fldpi /* x87 pi -> %D1 */',
1589 },
1590
1591 "fldln2" => {
1592   "op_flags"  => "R|c",
1593   "irn_flags"  => "R",
1594   "comment"   => "x87 fp Load ln 2: Ld ln 2 -> reg",
1595   "reg_req"   => { },
1596   "emit"      => '. fldln2 /* x87 ln(2) -> %D1 */',
1597 },
1598
1599 "fldlg2" => {
1600   "op_flags"  => "R|c",
1601   "irn_flags"  => "R",
1602   "comment"   => "x87 fp Load lg 2: Ld lg 2 -> reg",
1603   "reg_req"   => { },
1604   "emit"      => '. fldlg2 /* x87 log(2) -> %D1 */',
1605 },
1606
1607 "fldl2t" => {
1608   "op_flags"  => "R|c",
1609   "irn_flags"  => "R",
1610   "comment"   => "x87 fp Load ld 10: Ld ld 10 -> reg",
1611   "reg_req"   => { },
1612   "emit"      => '. fldll2t /* x87 ld(10) -> %D1 */',
1613 },
1614
1615 "fldl2e" => {
1616   "op_flags"  => "R|c",
1617   "irn_flags"  => "R",
1618   "comment"   => "x87 fp Load ld e: Ld ld e -> reg",
1619   "reg_req"   => { },
1620   "emit"      => '. fldl2e /* x87 ld(e) -> %D1 */',
1621 },
1622
1623 "fldConst" => {
1624   "op_flags"  => "R|c",
1625   "irn_flags" => "R",
1626   "rd_constructor" => "NONE",
1627   "comment"   => "represents a x87 constant",
1628   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1629   "reg_req"   => { "out" => [ "st" ] },
1630   "emit"      => '. fld %ia32_emit_adr /* Load fConst into register -> %D1 */',
1631 },
1632
1633 # fxch, fpush, fpop
1634 # Note that it is NEVER allowed to do CSE on these nodes
1635
1636 "fxch" => {
1637   "op_flags"  => "R|K",
1638   "comment"   => "x87 stack exchange",
1639   "reg_req"   => { "in" => [ "st"], "out" => [ "st" ] },
1640   "cmp_attr"  => "  return 1;\n",
1641   "emit"      => '. fxch %X1 /* x87 swap %X1, %X3 */',
1642 },
1643
1644 "fpush" => {
1645   "op_flags"  => "R",
1646   "comment"   => "x87 stack push",
1647   "reg_req"   => { "in" => [ "st"], "out" => [ "st" ] },
1648   "cmp_attr"  => "  return 1;\n",
1649   "emit"      => '. fld %X1 /* x87 push %X1 */',
1650 },
1651
1652 "fpop" => {
1653   "op_flags"  => "R|K",
1654   "comment"   => "x87 stack pop",
1655   "reg_req"   => { "out" => [ "st" ] },
1656   "cmp_attr"  => "  return 1;\n",
1657   "emit"      => '. fstp %X1 /* x87 pop %X1 */',
1658 },
1659
1660 # compare
1661
1662 "fcomJmp" => {
1663   "op_flags"  => "L|X|Y",
1664   "comment"   => "floating point compare",
1665   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1666   "reg_req"   => { },
1667 },
1668
1669 "fcompJmp" => {
1670   "op_flags"  => "L|X|Y",
1671   "comment"   => "floating point compare and pop",
1672   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1673   "reg_req"   => { },
1674 },
1675
1676 "fcomppJmp" => {
1677   "op_flags"  => "L|X|Y",
1678   "comment"   => "floating point compare and pop twice",
1679   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1680   "reg_req"   => { },
1681 },
1682
1683 "fcomrJmp" => {
1684   "op_flags"  => "L|X|Y",
1685   "comment"   => "floating point compare reverse",
1686   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1687   "reg_req"   => { },
1688 },
1689
1690 "fcomrpJmp" => {
1691   "op_flags"  => "L|X|Y",
1692   "comment"   => "floating point compare reverse and pop",
1693   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1694   "reg_req"   => { },
1695 },
1696
1697 "fcomrppJmp" => {
1698   "op_flags"  => "L|X|Y",
1699   "comment"   => "floating point compare reverse and pop twice",
1700   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1701   "reg_req"   => { },
1702 },
1703
1704 ); # end of %nodes