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