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