9b48148fdc7138e2defe9f7c06bd68896d7069ba
[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   # We don't set class modify_stack here (but we will do this on proj 0)
710   "comment"   => "push a gp register on the stack",
711   "reg_req"   => { "in" => [ "esp", "gp", "none" ], "out" => [ "esp" ] },
712   "emit"      => '
713 if (get_ia32_id_cnst(n)) {
714         if (get_ia32_immop_type(n) == ia32_ImmConst) {
715 4. push %C /* Push const on stack */
716 } else {
717 4. push OFFSET FLAT:%C /* Push symconst on stack */
718         }
719 }
720 else if (get_ia32_op_type(n) == ia32_Normal) {
721 2. push %S2 /* Push(%A2) */
722 }
723 else {
724 2. push %ia32_emit_am /* Push memory to stack */
725 };
726 ',
727   "outs"      => [ "stack", "M" ],
728   "latency"   => 3,
729 },
730
731 "Pop" => {
732   # We don't set class modify stack here (but we will do this on proj 1)
733   "comment"   => "pop a gp register from the stack",
734   "reg_req"   => { "in" => [ "esp", "none" ], "out" => [ "gp", "esp" ] },
735   "emit"      => '
736 if (get_ia32_op_type(n) == ia32_Normal) {
737 2. pop %D1 /* Pop from stack into %D1 */
738 }
739 else {
740 2. pop %ia32_emit_am /* Pop from stack into memory */
741 }
742 ',
743   "outs"      => [ "res", "stack", "M" ],
744   "latency"   => 4,
745 },
746
747 "Enter" => {
748   "comment"   => "create stack frame",
749   "reg_req"   => { "in" => [ "esp" ], "out" => [ "ebp", "esp" ] },
750   "emit"      => '. enter /* Enter */',
751   "outs"      => [ "frame", "stack", "M" ],
752   "latency"   => 15,
753 },
754
755 "Leave" => {
756   "comment"   => "destroy stack frame",
757   "reg_req"   => { "in" => [ "esp", "ebp" ], "out" => [ "ebp", "esp" ] },
758   "emit"      => '. leave /* Leave */',
759   "outs"      => [ "frame", "stack", "M" ],
760   "latency"   => 3,
761 },
762
763 "AddSP" => {
764   "irn_flags" => "S|I",
765   "comment"   => "allocate space on stack",
766   "reg_req"   => { "in" => [ "esp", "gp" ], "out" => [ "esp", "none" ] },
767   "outs"      => [ "stack", "M" ],
768 },
769
770 #-----------------------------------------------------------------------------#
771 #   _____ _____ ______    __ _             _                     _            #
772 #  / ____/ ____|  ____|  / _| |           | |                   | |           #
773 # | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
774 #  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
775 #  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
776 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
777 #-----------------------------------------------------------------------------#
778
779 # commutative operations
780
781 "xAdd" => {
782   "irn_flags" => "R",
783   "comment"   => "construct SSE Add: Add(a, b) = Add(b, a) = a + b",
784   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
785   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
786   "emit"      => '. adds%M %ia32_emit_binop /* SSE Add(%A3, %A4) -> %D1 */',
787   "outs"      => [ "res", "M" ],
788   "latency"   => 4,
789 },
790
791 "xMul" => {
792   "irn_flags" => "R",
793   "comment"   => "construct SSE Mul: Mul(a, b) = Mul(b, a) = a * b",
794   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
795   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
796   "emit"      => '. muls%M %ia32_emit_binop /* SSE Mul(%A3, %A4) -> %D1 */',
797   "outs"      => [ "res", "M" ],
798   "latency"   => 4,
799 },
800
801 "xMax" => {
802   "irn_flags" => "R",
803   "comment"   => "construct SSE Max: Max(a, b) = Max(b, a) = a > b ? a : b",
804   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
805   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
806   "emit"      => '. maxs%M %ia32_emit_binop /* SSE Max(%A3, %A4) -> %D1 */',
807   "outs"      => [ "res", "M" ],
808   "latency"   => 2,
809 },
810
811 "xMin" => {
812   "irn_flags" => "R",
813   "comment"   => "construct SSE Min: Min(a, b) = Min(b, a) = a < b ? a : b",
814   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
815   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
816   "emit"      => '. mins%M %ia32_emit_binop /* SSE Min(%A3, %A4) -> %D1 */',
817   "outs"      => [ "res", "M" ],
818   "latency"   => 2,
819 },
820
821 "xAnd" => {
822   "irn_flags" => "R",
823   "comment"   => "construct SSE And: And(a, b) = a AND b",
824   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
825   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
826   "emit"      => '. andp%M %ia32_emit_binop /* SSE And(%A3, %A4) -> %D1 */',
827   "outs"      => [ "res", "M" ],
828   "latency"   => 3,
829 },
830
831 "xOr" => {
832   "irn_flags" => "R",
833   "comment"   => "construct SSE Or: Or(a, b) = a OR b",
834   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
835   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
836   "emit"      => '. orp%M %ia32_emit_binop /* SSE Or(%A3, %A4) -> %D1 */',
837   "outs"      => [ "res", "M" ],
838 },
839
840 "xEor" => {
841   "irn_flags" => "R",
842   "comment"   => "construct SSE Eor: Eor(a, b) = a XOR b",
843   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
844   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
845   "emit"      => '. xorp%M %ia32_emit_binop /* SSE Xor(%A3, %A4) -> %D1 */',
846   "outs"      => [ "res", "M" ],
847   "latency"   => 3,
848 },
849
850 # not commutative operations
851
852 "xAndNot" => {
853   "irn_flags" => "R",
854   "comment"   => "construct SSE AndNot: AndNot(a, b) = a AND NOT b",
855   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
856   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3 !in_r4" ] },
857   "emit"      => '. andnp%M %ia32_emit_binop /* SSE AndNot(%A3, %A4) -> %D1 */',
858   "outs"      => [ "res", "M" ],
859   "latency"   => 3,
860 },
861
862 "xSub" => {
863   "irn_flags" => "R",
864   "comment"   => "construct SSE Sub: Sub(a, b) = a - b",
865   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
866   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
867   "emit"      => '. subs%M %ia32_emit_binop /* SSE Sub(%A1, %A2) -> %D1 */',
868   "outs"      => [ "res", "M" ],
869   "latency"   => 4,
870 },
871
872 "xDiv" => {
873   "irn_flags" => "R",
874   "comment"   => "construct SSE Div: Div(a, b) = a / b",
875   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
876   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3 !in_r4" ] },
877   "emit"      => '. divs%M %ia32_emit_binop /* SSE Div(%A1, %A2) -> %D1 */',
878   "outs"      => [ "res", "M" ],
879   "latency"   => 16,
880 },
881
882 # other operations
883
884 "xCmp" => {
885   "irn_flags" => "R",
886   "comment"   => "construct SSE Compare: Cmp(a, b) == a = a cmp b",
887   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3 !in_r4" ] },
888   "outs"      => [ "res", "M" ],
889   "latency"   => 3,
890 },
891
892 "xCondJmp" => {
893   "op_flags"  => "L|X|Y",
894   "comment"   => "construct conditional jump: UCOMIS A, B && JMPxx LABEL",
895   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
896   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "none", "none" ] },
897   "outs"      => [ "false", "true" ],
898   "latency"   => 5,
899 },
900
901 "xConst" => {
902   "op_flags"  => "c",
903   "irn_flags" => "R",
904   "comment"   => "represents a SSE constant",
905   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
906   "reg_req"   => { "in" => [ "none" ], "out" => [ "xmm" ] },
907   "emit"      => '. movs%M %D1, %C /* Load fConst into register */',
908   "latency"   => 2,
909 },
910
911 # Load / Store
912
913 "xLoad" => {
914   "op_flags"  => "L|F",
915   "state"     => "exc_pinned",
916   "comment"   => "construct SSE Load: Load(ptr, mem) = LD ptr",
917   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
918   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "xmm" ] },
919   "emit"      => '. movs%M %D1, %ia32_emit_am /* Load((%A1)) -> %D1 */',
920   "outs"      => [ "res", "M" ],
921   "latency"   => 2,
922 },
923
924 "xStore" => {
925   "op_flags" => "L|F",
926   "state"    => "exc_pinned",
927   "comment"  => "construct Store: Store(ptr, val, mem) = ST ptr,val",
928   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
929   "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ] },
930   "emit"     => '. movs%M %ia32_emit_binop /* Store(%S3) -> (%A1) */',
931   "outs"      => [ "M" ],
932   "latency"   => 2,
933 },
934
935 "xStoreSimple" => {
936   "op_flags" => "L|F",
937   "state"    => "exc_pinned",
938   "comment"  => "construct Store without index: Store(ptr, val, mem) = ST ptr,val",
939   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
940   "reg_req"  => { "in" => [ "gp", "xmm", "none" ] },
941   "emit"     => '. movs%M %ia32_emit_am, %S2 /* store XMM0 onto stack */',
942   "outs"      => [ "M" ],
943   "latency"   => 2,
944 },
945
946 "l_X87toSSE" => {
947   "op_flags" => "L|F",
948   "comment"  => "construct: transfer a value from x87 FPU into a SSE register",
949   "cmp_attr" => "  return 1;\n",
950   "arity"    => 3,
951 },
952
953 "l_SSEtoX87" => {
954   "op_flags" => "L|F",
955   "comment"  => "construct: transfer a value from SSE register to x87 FPU",
956   "cmp_attr" => "  return 1;\n",
957   "arity"    => 3,
958 },
959
960 "GetST0" => {
961   "op_flags" => "L|F",
962   "irn_flags" => "I",
963   "state"    => "exc_pinned",
964   "comment"  => "store ST0 onto stack",
965   "cmp_attr" => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
966   "reg_req"  => { "in" => [ "gp", "none" ] },
967   "emit"     => '. fstp %ia32_emit_am /* store ST0 onto stack */',
968   "outs"     => [ "M" ],
969   "latency"  => 4,
970 },
971
972 "SetST0" => {
973   "op_flags" => "L|F",
974   "irn_flags" => "I",
975   "state"    => "exc_pinned",
976   "comment"  => "load ST0 from stack",
977   "cmp_attr" => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
978   "reg_req"  => { "in" => [ "gp", "none" ], "out" => [ "st0", "none" ] },
979   "emit"     => '. fld %ia32_emit_am /* load ST0 from stack */',
980   "outs"     => [ "res", "M" ],
981   "latency"  => 2,
982 },
983
984 # CopyB
985
986 "CopyB" => {
987   "op_flags" => "F|H",
988   "state"    => "pinned",
989   "comment"  => "implements a memcopy: CopyB(dst, src, size, mem) == memcpy(dst, src, size)",
990   "reg_req"  => { "in" => [ "edi", "esi", "ecx", "none" ], "out" => [ "edi", "esi", "ecx", "none" ] },
991   "outs"     => [ "DST", "SRC", "CNT", "M" ],
992 },
993
994 "CopyB_i" => {
995   "op_flags" => "F|H",
996   "state"    => "pinned",
997   "comment"  => "implements a memcopy: CopyB(dst, src, mem) == memcpy(dst, src, attr(size))",
998   "cmp_attr" => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
999   "reg_req"  => { "in" => [ "edi", "esi", "none" ], "out" => [  "edi", "esi", "none" ] },
1000   "outs"     => [ "DST", "SRC", "M" ],
1001 },
1002
1003 # Conversions
1004
1005 "Conv_I2I" => {
1006   "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3", "none" ] },
1007   "cmp_attr" => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
1008   "comment"  => "construct Conv Int -> Int",
1009   "outs"     => [ "res", "M" ],
1010 },
1011
1012 "Conv_I2I8Bit" => {
1013   "reg_req"  => { "in" => [ "gp", "gp", "eax ebx ecx edx", "none" ], "out" => [ "in_r3", "none" ] },
1014   "cmp_attr" => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
1015   "comment"  => "construct Conv Int -> Int",
1016   "outs"     => [ "res", "M" ],
1017 },
1018
1019 "Conv_I2FP" => {
1020   "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "xmm", "none" ] },
1021   "cmp_attr" => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
1022   "comment"  => "construct Conv Int -> Floating Point",
1023   "outs"     => [ "res", "M" ],
1024   "latency"  => 10,
1025 },
1026
1027 "Conv_FP2I" => {
1028   "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ], "out" => [ "gp", "none" ] },
1029   "cmp_attr" => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
1030   "comment"  => "construct Conv Floating Point -> Int",
1031   "outs"     => [ "res", "M" ],
1032   "latency"  => 10,
1033 },
1034
1035 "Conv_FP2FP" => {
1036   "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ], "out" => [ "xmm", "none" ] },
1037   "cmp_attr" => "  return ia32_compare_conv_attr(attr_a, attr_b);\n",
1038   "comment"  => "construct Conv Floating Point -> Floating Point",
1039   "outs"     => [ "res", "M" ],
1040   "latency"  => 8,
1041 },
1042
1043 "CmpCMov" => {
1044   "irn_flags" => "R",
1045   "comment"   => "construct Conditional Move: CMov(sel, a, b) == sel ? a : b",
1046   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp" ], "out" => [ "in_r4" ] },
1047   "latency"   => 2,
1048 },
1049
1050 "PsiCondCMov" => {
1051   "irn_flags" => "R",
1052   "comment"   => "check if Psi condition tree evaluates to true and move result accordingly",
1053   "reg_req"   => { "in" => [ "gp", "gp", "gp" ], "out" => [ "in_r3" ] },
1054   "latency"   => 2,
1055 },
1056
1057 "xCmpCMov" => {
1058   "irn_flags" => "R",
1059   "comment"   => "construct Conditional Move: SSE Compare + int CMov ",
1060   "reg_req"   => { "in" => [ "xmm", "xmm", "gp", "gp" ], "out" => [ "in_r4" ] },
1061   "latency"   => 5,
1062 },
1063
1064 "vfCmpCMov" => {
1065   "irn_flags" => "R",
1066   "comment"   => "construct Conditional Move: x87 Compare + int CMov",
1067   "reg_req"   => { "in" => [ "vfp", "vfp", "gp", "gp" ], "out" => [ "in_r4" ] },
1068   "latency"   => 10,
1069 },
1070
1071 "CmpSet" => {
1072   "irn_flags" => "R",
1073   "comment"   => "construct Set: Set(sel) == sel ? 1 : 0",
1074   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "eax ebx ecx edx", "none" ] },
1075   "outs"      => [ "res", "M" ],
1076   "latency"   => 2,
1077 },
1078
1079 "PsiCondSet" => {
1080   "irn_flags" => "R",
1081   "comment"   => "check if Psi condition tree evaluates to true and set result accordingly",
1082   "reg_req"   => { "in" => [ "gp" ], "out" => [ "eax ebx ecx edx" ] },
1083   "latency"   => 2,
1084 },
1085
1086 "xCmpSet" => {
1087   "irn_flags" => "R",
1088   "comment"   => "construct Set: SSE Compare + int Set",
1089   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "eax ebx ecx edx", "none" ] },
1090   "outs"      => [ "res", "M" ],
1091   "latency"   => 5,
1092 },
1093
1094 "vfCmpSet" => {
1095   "irn_flags" => "R",
1096   "comment"   => "construct Set: x87 Compare + int Set",
1097   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "eax ebx ecx edx", "none" ] },
1098   "outs"      => [ "res", "M" ],
1099   "latency"   => 10,
1100 },
1101
1102 "vfCMov" => {
1103   "irn_flags" => "R",
1104   "comment"   => "construct x87 Conditional Move: vfCMov(sel, a, b) = sel ? a : b",
1105   "reg_req"   => { "in" => [ "vfp", "vfp", "vfp", "vfp" ], "out" => [ "vfp" ] },
1106   "latency"   => 10,
1107 },
1108
1109 #----------------------------------------------------------#
1110 #        _      _               _    __ _             _    #
1111 #       (_)    | |             | |  / _| |           | |   #
1112 # __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
1113 # \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
1114 #  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
1115 #   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1116 #                 | |                                      #
1117 #  _ __   ___   __| | ___  ___                             #
1118 # | '_ \ / _ \ / _` |/ _ \/ __|                            #
1119 # | | | | (_) | (_| |  __/\__ \                            #
1120 # |_| |_|\___/ \__,_|\___||___/                            #
1121 #----------------------------------------------------------#
1122
1123 "vfadd" => {
1124   "irn_flags" => "R",
1125   "comment"   => "virtual fp Add: Add(a, b) = Add(b, a) = a + b",
1126   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1127   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
1128   "outs"      => [ "res", "M" ],
1129   "latency"   => 4,
1130 },
1131
1132 "vfmul" => {
1133   "irn_flags" => "R",
1134   "comment"   => "virtual fp Mul: Mul(a, b) = Mul(b, a) = a * b",
1135   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1136   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
1137   "outs"      => [ "res", "M" ],
1138   "latency"   => 4,
1139 },
1140
1141 "l_vfmul" => {
1142   "op_flags"  => "C",
1143   "cmp_attr"  => "  return 1;\n",
1144   "comment"   => "lowered virtual fp Mul: Mul(a, b) = Mul(b, a) = a * b",
1145   "arity"     => 2,
1146 },
1147
1148 "vfsub" => {
1149   "irn_flags" => "R",
1150   "comment"   => "virtual fp Sub: Sub(a, b) = a - b",
1151   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1152   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
1153   "outs"      => [ "res", "M" ],
1154   "latency"   => 4,
1155 },
1156
1157 "l_vfsub" => {
1158   "cmp_attr"  => "  return 1;\n",
1159   "comment"   => "lowered virtual fp Sub: Sub(a, b) = a - b",
1160   "arity"     => 2,
1161 },
1162
1163 "vfdiv" => {
1164   "comment"   => "virtual fp Div: Div(a, b) = a / b",
1165   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1166   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
1167   "outs"      => [ "res", "M" ],
1168   "latency"   => 20,
1169 },
1170
1171 "l_vfdiv" => {
1172   "cmp_attr"  => "  return 1;\n",
1173   "comment"   => "lowered virtual fp Div: Div(a, b) = a / b",
1174   "arity"     => 2,
1175 },
1176
1177 "vfabs" => {
1178   "irn_flags" => "R",
1179   "comment"   => "virtual fp Abs: Abs(a) = |a|",
1180   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
1181   "latency"   => 2,
1182 },
1183
1184 "vfchs" => {
1185   "irn_flags" => "R",
1186   "comment"   => "virtual fp Chs: Chs(a) = -a",
1187   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
1188   "latency"   => 2,
1189 },
1190
1191 "vfsin" => {
1192   "irn_flags" => "R",
1193   "comment"   => "virtual fp Sin: Sin(a) = sin(a)",
1194   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
1195   "latency"   => 150,
1196 },
1197
1198 "vfcos" => {
1199   "irn_flags" => "R",
1200   "comment"   => "virtual fp Cos: Cos(a) = cos(a)",
1201   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
1202   "latency"   => 150,
1203 },
1204
1205 "vfsqrt" => {
1206   "irn_flags" => "R",
1207   "comment"   => "virtual fp Sqrt: Sqrt(a) = a ^ 0.5",
1208   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
1209   "latency"   => 30,
1210 },
1211
1212 # virtual Load and Store
1213
1214 "vfld" => {
1215   "op_flags"  => "L|F",
1216   "state"     => "exc_pinned",
1217   "comment"   => "virtual fp Load: Load(ptr, mem) = LD ptr -> reg",
1218   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1219   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "vfp", "none" ] },
1220   "outs"      => [ "res", "M" ],
1221   "latency"   => 2,
1222 },
1223
1224 "vfst" => {
1225   "op_flags"  => "L|F",
1226   "state"     => "exc_pinned",
1227   "comment"   => "virtual fp Store: Store(ptr, val, mem) = ST ptr,val",
1228   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1229   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "none" ] },
1230   "outs"      => [ "M" ],
1231   "latency"   => 2,
1232 },
1233
1234 # Conversions
1235
1236 "vfild" => {
1237   "comment"   => "virtual fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1238   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1239   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "vfp", "none" ] },
1240   "outs"      => [ "res", "M" ],
1241   "latency"   => 4,
1242 },
1243
1244 "l_vfild" => {
1245   "cmp_attr"  => "  return 1;\n",
1246   "comment"   => "lowered virtual fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1247   "outs"      => [ "res", "M" ],
1248   "arity"     => 2,
1249 },
1250
1251 "vfist" => {
1252   "comment"   => "virtual fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1253   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1254   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "none" ] },
1255   "outs"      => [ "M" ],
1256   "latency"   => 4,
1257 },
1258
1259 "l_vfist" => {
1260   "cmp_attr"  => "  return 1;\n",
1261   "comment"   => "lowered virtual fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1262   "outs"      => [ "M" ],
1263   "arity"     => 3,
1264 },
1265
1266
1267 # constants
1268
1269 "vfldz" => {
1270   "irn_flags" => "R",
1271   "comment"   => "virtual fp Load 0.0: Ld 0.0 -> reg",
1272   "reg_req"   => { "out" => [ "vfp" ] },
1273   "latency"   => 4,
1274 },
1275
1276 "vfld1" => {
1277   "irn_flags" => "R",
1278   "comment"   => "virtual fp Load 1.0: Ld 1.0 -> reg",
1279   "reg_req"   => { "out" => [ "vfp" ] },
1280   "latency"   => 4,
1281 },
1282
1283 "vfldpi" => {
1284   "irn_flags" => "R",
1285   "comment"   => "virtual fp Load pi: Ld pi -> reg",
1286   "reg_req"   => { "out" => [ "vfp" ] },
1287   "latency"   => 4,
1288 },
1289
1290 "vfldln2" => {
1291   "irn_flags" => "R",
1292   "comment"   => "virtual fp Load ln 2: Ld ln 2 -> reg",
1293   "reg_req"   => { "out" => [ "vfp" ] },
1294   "latency"   => 4,
1295 },
1296
1297 "vfldlg2" => {
1298   "irn_flags" => "R",
1299   "comment"   => "virtual fp Load lg 2: Ld lg 2 -> reg",
1300   "reg_req"   => { "out" => [ "vfp" ] },
1301   "latency"   => 4,
1302 },
1303
1304 "vfldl2t" => {
1305   "irn_flags" => "R",
1306   "comment"   => "virtual fp Load ld 10: Ld ld 10 -> reg",
1307   "reg_req"   => { "out" => [ "vfp" ] },
1308   "latency"   => 4,
1309 },
1310
1311 "vfldl2e" => {
1312   "irn_flags" => "R",
1313   "comment"   => "virtual fp Load ld e: Ld ld e -> reg",
1314   "reg_req"   => { "out" => [ "vfp" ] },
1315   "latency"   => 4,
1316 },
1317
1318 "vfConst" => {
1319   "op_flags"  => "c",
1320   "irn_flags" => "R",
1321   "init_attr" => "  set_ia32_ls_mode(res, mode);",
1322   "comment"   => "represents a virtual floating point constant",
1323   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1324   "reg_req"   => { "in" => [ "none" ], "out" => [ "vfp" ] },
1325   "latency"   => 3,
1326 },
1327
1328 # other
1329
1330 "vfCondJmp" => {
1331   "op_flags"  => "L|X|Y",
1332   "comment"   => "represents a virtual floating point compare",
1333   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1334   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "none", "none", "eax" ] },
1335   "outs"      => [ "false", "true", "temp_reg_eax" ],
1336   "latency"   => 10,
1337 },
1338
1339 #------------------------------------------------------------------------#
1340 #       ___ _____    __ _             _                     _            #
1341 # __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1342 # \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1343 #  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1344 # /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1345 #------------------------------------------------------------------------#
1346
1347 "fadd" => {
1348   "op_flags"  => "R",
1349   "rd_constructor" => "NONE",
1350   "comment"   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
1351   "reg_req"   => { },
1352   "emit"      => '. fadd %ia32_emit_x87_binop /* x87 fadd(%A3, %A4) -> %D1 */',
1353 },
1354
1355 "faddp" => {
1356   "op_flags"  => "R",
1357   "rd_constructor" => "NONE",
1358   "comment"   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
1359   "reg_req"   => { },
1360   "emit"      => '. faddp %ia32_emit_x87_binop /* x87 fadd(%A3, %A4) -> %D1 */',
1361 },
1362
1363 "fmul" => {
1364   "op_flags"  => "R",
1365   "rd_constructor" => "NONE",
1366   "comment"   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
1367   "reg_req"   => { },
1368   "emit"      => '. fmul %ia32_emit_x87_binop /* x87 fmul(%A3, %A4) -> %D1 */',
1369 },
1370
1371 "fmulp" => {
1372   "op_flags"  => "R",
1373   "rd_constructor" => "NONE",
1374   "comment"   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
1375   "reg_req"   => { },
1376   "emit"      => '. fmulp %ia32_emit_x87_binop /* x87 fmul(%A3, %A4) -> %D1 */',,
1377 },
1378
1379 "fsub" => {
1380   "op_flags"  => "R",
1381   "rd_constructor" => "NONE",
1382   "comment"   => "x87 fp Sub: Sub(a, b) = a - b",
1383   "reg_req"   => { },
1384   "emit"      => '. fsub %ia32_emit_x87_binop /* x87 fsub(%A3, %A4) -> %D1 */',
1385 },
1386
1387 "fsubp" => {
1388   "op_flags"  => "R",
1389   "rd_constructor" => "NONE",
1390   "comment"   => "x87 fp Sub: Sub(a, b) = a - b",
1391   "reg_req"   => { },
1392   "emit"      => '. fsubp %ia32_emit_x87_binop /* x87 fsub(%A3, %A4) -> %D1 */',
1393 },
1394
1395 "fsubr" => {
1396   "op_flags"  => "R",
1397   "rd_constructor" => "NONE",
1398   "irn_flags" => "R",
1399   "comment"   => "x87 fp SubR: SubR(a, b) = b - a",
1400   "reg_req"   => { },
1401   "emit"      => '. fsubr %ia32_emit_x87_binop /* x87 fsubr(%A3, %A4) -> %D1 */',
1402 },
1403
1404 "fsubrp" => {
1405   "op_flags"  => "R",
1406   "rd_constructor" => "NONE",
1407   "irn_flags" => "R",
1408   "comment"   => "x87 fp SubR: SubR(a, b) = b - a",
1409   "reg_req"   => { },
1410   "emit"      => '. fsubrp %ia32_emit_x87_binop /* x87 fsubr(%A3, %A4) -> %D1 */',
1411 },
1412
1413 "fdiv" => {
1414   "op_flags"  => "R",
1415   "rd_constructor" => "NONE",
1416   "comment"   => "x87 fp Div: Div(a, b) = a / b",
1417   "reg_req"   => { },
1418   "emit"      => '. fdiv %ia32_emit_x87_binop /* x87 fdiv(%A3, %A4) -> %D1 */',
1419 },
1420
1421 "fdivp" => {
1422   "op_flags"  => "R",
1423   "rd_constructor" => "NONE",
1424   "comment"   => "x87 fp Div: Div(a, b) = a / b",
1425   "reg_req"   => { },
1426   "emit"      => '. fdivp %ia32_emit_x87_binop /* x87 fdiv(%A3, %A4) -> %D1 */',
1427 },
1428
1429 "fdivr" => {
1430   "op_flags"  => "R",
1431   "rd_constructor" => "NONE",
1432   "comment"   => "x87 fp DivR: DivR(a, b) = b / a",
1433   "reg_req"   => { },
1434   "emit"      => '. fdivr %ia32_emit_x87_binop /* x87 fdivr(%A3, %A4) -> %D1 */',
1435 },
1436
1437 "fdivrp" => {
1438   "op_flags"  => "R",
1439   "rd_constructor" => "NONE",
1440   "comment"   => "x87 fp DivR: DivR(a, b) = b / a",
1441   "reg_req"   => { },
1442   "emit"      => '. fdivrp %ia32_emit_x87_binop /* x87 fdivr(%A3, %A4) -> %D1 */',
1443 },
1444
1445 "fabs" => {
1446   "op_flags"  => "R",
1447   "rd_constructor" => "NONE",
1448   "comment"   => "x87 fp Abs: Abs(a) = |a|",
1449   "reg_req"   => { },
1450   "emit"      => '. fabs /* x87 fabs(%A1) -> %D1 */',
1451 },
1452
1453 "fchs" => {
1454   "op_flags"  => "R",
1455   "rd_constructor" => "NONE",
1456   "comment"   => "x87 fp Chs: Chs(a) = -a",
1457   "reg_req"   => { },
1458   "emit"      => '. fchs /* x87 fchs(%A1) -> %D1 */',
1459 },
1460
1461 "fsin" => {
1462   "op_flags"  => "R",
1463   "rd_constructor" => "NONE",
1464   "comment"   => "x87 fp Sin: Sin(a) = sin(a)",
1465   "reg_req"   => { },
1466   "emit"      => '. fsin /* x87 sin(%A1) -> %D1 */',
1467 },
1468
1469 "fcos" => {
1470   "op_flags"  => "R",
1471   "rd_constructor" => "NONE",
1472   "comment"   => "x87 fp Cos: Cos(a) = cos(a)",
1473   "reg_req"   => { },
1474   "emit"      => '. fcos /* x87 cos(%A1) -> %D1 */',
1475 },
1476
1477 "fsqrt" => {
1478   "op_flags"  => "R",
1479   "rd_constructor" => "NONE",
1480   "comment"   => "x87 fp Sqrt: Sqrt(a) = a ^ 0.5",
1481   "reg_req"   => { },
1482   "emit"      => '. fsqrt $ /* x87 sqrt(%A1) -> %D1 */',
1483 },
1484
1485 # x87 Load and Store
1486
1487 "fld" => {
1488   "rd_constructor" => "NONE",
1489   "op_flags"  => "R|L|F",
1490   "state"     => "exc_pinned",
1491   "comment"   => "x87 fp Load: Load(ptr, mem) = LD ptr -> reg",
1492   "reg_req"   => { },
1493   "emit"      => '. fld %ia32_emit_am /* Load((%A1)) -> %D1 */',
1494 },
1495
1496 "fst" => {
1497   "rd_constructor" => "NONE",
1498   "op_flags"  => "R|L|F",
1499   "state"     => "exc_pinned",
1500   "comment"   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
1501   "reg_req"   => { },
1502   "emit"      => '. fst %ia32_emit_am /* Store(%A3) -> (%A1) */',
1503 },
1504
1505 "fstp" => {
1506   "rd_constructor" => "NONE",
1507   "op_flags"  => "R|L|F",
1508   "state"     => "exc_pinned",
1509   "comment"   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
1510   "reg_req"   => { },
1511   "emit"      => '. fstp %ia32_emit_am /* Store(%A3) -> (%A1) and pop */',
1512 },
1513
1514 # Conversions
1515
1516 "fild" => {
1517   "op_flags"  => "R",
1518   "rd_constructor" => "NONE",
1519   "comment"   => "x87 fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1520   "reg_req"   => { },
1521   "emit"      => '. fild %ia32_emit_am /* integer Load((%A1)) -> %D1 */',
1522 },
1523
1524 "fist" => {
1525   "op_flags"  => "R",
1526   "rd_constructor" => "NONE",
1527   "comment"   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1528   "reg_req"   => { },
1529   "emit"      => '. fist %ia32_emit_am /* integer Store(%A3) -> (%A1) */',
1530 },
1531
1532 "fistp" => {
1533   "op_flags"  => "R",
1534   "rd_constructor" => "NONE",
1535   "comment"   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1536   "reg_req"   => { },
1537   "emit"      => '. fistp %ia32_emit_am /* integer Store(%A3) -> (%A1) and pop */',
1538 },
1539
1540 # constants
1541
1542 "fldz" => {
1543   "op_flags"  => "R",
1544   "irn_flags"  => "R",
1545   "rd_constructor" => "NONE",
1546   "comment"   => "x87 fp Load 0.0: Ld 0.0 -> reg",
1547   "reg_req"   => { },
1548   "emit"      => '. fldz /* x87 0.0 -> %D1 */',
1549 },
1550
1551 "fld1" => {
1552   "op_flags"  => "R",
1553   "irn_flags"  => "R",
1554   "rd_constructor" => "NONE",
1555   "comment"   => "x87 fp Load 1.0: Ld 1.0 -> reg",
1556   "reg_req"   => { },
1557   "emit"      => '. fld1 /* x87 1.0 -> %D1 */',
1558 },
1559
1560 "fldpi" => {
1561   "op_flags"  => "R",
1562   "irn_flags"  => "R",
1563   "rd_constructor" => "NONE",
1564   "comment"   => "x87 fp Load pi: Ld pi -> reg",
1565   "reg_req"   => { },
1566   "emit"      => '. fldpi /* x87 pi -> %D1 */',
1567 },
1568
1569 "fldln2" => {
1570   "op_flags"  => "R",
1571   "irn_flags"  => "R",
1572   "rd_constructor" => "NONE",
1573   "comment"   => "x87 fp Load ln 2: Ld ln 2 -> reg",
1574   "reg_req"   => { },
1575   "emit"      => '. fldln2 /* x87 ln(2) -> %D1 */',
1576 },
1577
1578 "fldlg2" => {
1579   "op_flags"  => "R",
1580   "irn_flags"  => "R",
1581   "rd_constructor" => "NONE",
1582   "comment"   => "x87 fp Load lg 2: Ld lg 2 -> reg",
1583   "reg_req"   => { },
1584   "emit"      => '. fldlg2 /* x87 log(2) -> %D1 */',
1585 },
1586
1587 "fldl2t" => {
1588   "op_flags"  => "R",
1589   "irn_flags"  => "R",
1590   "rd_constructor" => "NONE",
1591   "comment"   => "x87 fp Load ld 10: Ld ld 10 -> reg",
1592   "reg_req"   => { },
1593   "emit"      => '. fldll2t /* x87 ld(10) -> %D1 */',
1594 },
1595
1596 "fldl2e" => {
1597   "op_flags"  => "R",
1598   "irn_flags"  => "R",
1599   "rd_constructor" => "NONE",
1600   "comment"   => "x87 fp Load ld e: Ld ld e -> reg",
1601   "reg_req"   => { },
1602   "emit"      => '. fldl2e /* x87 ld(e) -> %D1 */',
1603 },
1604
1605 "fldConst" => {
1606   "op_flags"  => "R|c",
1607   "irn_flags" => "R",
1608   "rd_constructor" => "NONE",
1609   "comment"   => "represents a x87 constant",
1610   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1611   "reg_req"   => { "out" => [ "st" ] },
1612   "emit"      => '. fld %ia32_emit_adr /* Load fConst into register -> %D1 */',
1613 },
1614
1615 # fxch, fpush, fpop
1616 # Note that it is NEVER allowed to do CSE on these nodes
1617
1618 "fxch" => {
1619   "op_flags"  => "R|K",
1620   "comment"   => "x87 stack exchange",
1621   "reg_req"   => { "in" => [ "st"], "out" => [ "st" ] },
1622   "cmp_attr"  => "  return 1;\n",
1623   "emit"      => '. fxch %X1 /* x87 swap %X1, %X3 */',
1624 },
1625
1626 "fpush" => {
1627   "op_flags"  => "R",
1628   "comment"   => "x87 stack push",
1629   "reg_req"   => { "in" => [ "st"], "out" => [ "st" ] },
1630   "cmp_attr"  => "  return 1;\n",
1631   "emit"      => '. fld %X1 /* x87 push %X1 */',
1632 },
1633
1634 "fpop" => {
1635   "op_flags"  => "R|K",
1636   "comment"   => "x87 stack pop",
1637   "reg_req"   => { "out" => [ "st" ] },
1638   "cmp_attr"  => "  return 1;\n",
1639   "emit"      => '. fstp %X1 /* x87 pop %X1 */',
1640 },
1641
1642 # compare
1643
1644 "fcomJmp" => {
1645   "op_flags"  => "L|X|Y",
1646   "comment"   => "floating point compare",
1647   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1648   "reg_req"   => { },
1649 },
1650
1651 "fcompJmp" => {
1652   "op_flags"  => "L|X|Y",
1653   "comment"   => "floating point compare and pop",
1654   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1655   "reg_req"   => { },
1656 },
1657
1658 "fcomppJmp" => {
1659   "op_flags"  => "L|X|Y",
1660   "comment"   => "floating point compare and pop twice",
1661   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1662   "reg_req"   => { },
1663 },
1664
1665 "fcomrJmp" => {
1666   "op_flags"  => "L|X|Y",
1667   "comment"   => "floating point compare reverse",
1668   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1669   "reg_req"   => { },
1670 },
1671
1672 "fcomrpJmp" => {
1673   "op_flags"  => "L|X|Y",
1674   "comment"   => "floating point compare reverse and pop",
1675   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1676   "reg_req"   => { },
1677 },
1678
1679 "fcomrppJmp" => {
1680   "op_flags"  => "L|X|Y",
1681   "comment"   => "floating point compare reverse and pop twice",
1682   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1683   "reg_req"   => { },
1684 },
1685
1686 ); # end of %nodes