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