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