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