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