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