b3daa20070da3bf0befd358a2a74e8c1a73441c9
[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 # comment: OPTIONAL comment for the node constructor
73 #
74 # rd_constructor: for every operation there will be a
75 #      new_rd_<arch>_<op-name> function with the arguments from above
76 #      which creates the ir_node corresponding to the defined operation
77 #      you can either put the complete source code of this function here
78 #
79 #      This key is OPTIONAL. If omitted, the following constructor will
80 #      be created:
81 #      if (!op_<arch>_<op-name>) assert(0);
82 #      for i = 1 to arity
83 #         set in[i] = op_i
84 #      done
85 #      res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
86 #      return res
87 #
88 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
89
90 # register types:
91 #   0 - no special type
92 #   1 - caller save (register must be saved by the caller of a function)
93 #   2 - callee save (register must be saved by the called function)
94 #   4 - ignore (do not assign this register)
95 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
96 %reg_classes = (
97   "gp" => [
98             { "name" => "eax", "type" => 1 },
99             { "name" => "edx", "type" => 1 },
100             { "name" => "ebx", "type" => 2 },
101             { "name" => "ecx", "type" => 1 },
102             { "name" => "esi", "type" => 2 },
103             { "name" => "edi", "type" => 2 },
104             { "name" => "ebp", "type" => 2 },
105             { "name" => "esp", "type" => 4 },
106             { "name" => "gp_NOREG", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
107                         { "mode" => "mode_P" }
108           ],
109   "xmm" => [
110             { "name" => "xmm0", "type" => 1 },
111             { "name" => "xmm1", "type" => 1 },
112             { "name" => "xmm2", "type" => 1 },
113             { "name" => "xmm3", "type" => 1 },
114             { "name" => "xmm4", "type" => 1 },
115             { "name" => "xmm5", "type" => 1 },
116             { "name" => "xmm6", "type" => 1 },
117             { "name" => "xmm7", "type" => 1 },
118             { "name" => "xmm_NOREG", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
119                         { "mode" => "mode_D" }
120           ],
121   "vfp" => [
122             { "name" => "vf0", "type" => 1 },
123             { "name" => "vf1", "type" => 1 },
124             { "name" => "vf2", "type" => 1 },
125             { "name" => "vf3", "type" => 1 },
126             { "name" => "vf4", "type" => 1 },
127             { "name" => "vf5", "type" => 1 },
128             { "name" => "vf6", "type" => 1 },
129             { "name" => "vf7", "type" => 1 },
130             { "name" => "vfp_NOREG", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
131                         { "mode" => "mode_E" }
132           ],
133   "st" => [
134             { "name" => "st0", "type" => 1 },
135             { "name" => "st1", "type" => 1 },
136             { "name" => "st2", "type" => 1 },
137             { "name" => "st3", "type" => 1 },
138             { "name" => "st4", "type" => 1 },
139             { "name" => "st5", "type" => 1 },
140             { "name" => "st6", "type" => 1 },
141             { "name" => "st7", "type" => 1 },
142             { "name" => "st_NOREG", "type" => 6 },  # we need a dummy register for NoReg and Unknown nodes
143                         { "mode" => "mode_E" }
144           ]
145 ); # %reg_classes
146
147 #--------------------------------------------------#
148 #                        _                         #
149 #                       (_)                        #
150 #  _ __   _____      __  _ _ __    ___  _ __  ___  #
151 # | '_ \ / _ \ \ /\ / / | | '__|  / _ \| '_ \/ __| #
152 # | | | |  __/\ V  V /  | | |    | (_) | |_) \__ \ #
153 # |_| |_|\___| \_/\_/   |_|_|     \___/| .__/|___/ #
154 #                                      | |         #
155 #                                      |_|         #
156 #--------------------------------------------------#
157
158 %nodes = (
159
160 #-----------------------------------------------------------------#
161 #  _       _                                         _            #
162 # (_)     | |                                       | |           #
163 #  _ _ __ | |_ ___  __ _  ___ _ __   _ __   ___   __| | ___  ___  #
164 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
165 # | | | | | ||  __/ (_| |  __/ |    | | | | (_) | (_| |  __/\__ \ #
166 # |_|_| |_|\__\___|\__, |\___|_|    |_| |_|\___/ \__,_|\___||___/ #
167 #                   __/ |                                         #
168 #                  |___/                                          #
169 #-----------------------------------------------------------------#
170
171 # commutative operations
172
173 # NOTE:
174 # All nodes supporting Addressmode have 5 INs:
175 # 1 - base    r1 == NoReg in case of no AM or no base
176 # 2 - index   r2 == NoReg in case of no AM or no index
177 # 3 - op1     r3 == always present
178 # 4 - op2     r4 == NoReg in case of immediate operation
179 # 5 - mem     NoMem in case of no AM otherwise it takes the mem from the Load
180
181 "Add" => {
182   "irn_flags" => "R",
183   "comment"   => "construct Add: Add(a, b) = Add(b, a) = a + b",
184   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
185   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
186   "emit"      => '. add %ia32_emit_binop /* Add(%A1, %A2) -> %D1 */',
187 },
188
189 "Mul" => {
190   "irn_flags" => "A",
191   "comment"   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
192   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
193   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
194   "emit"      => '. imul %ia32_emit_binop /* Mul(%A1, %A2) -> %D1 */'
195 },
196
197 # Mulh is an exception from the 4 INs with AM because the target is always EAX:EDX
198 "Mulh" => {
199   "comment"   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
200   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
201   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "eax in_r3", "edx in_r4" ] },
202   "emit"      => '. imul %ia32_emit_binop /* Mulh(%A1, %A2) -> %D1 */'
203 },
204
205 "And" => {
206   "irn_flags" => "R",
207   "comment"   => "construct And: And(a, b) = And(b, a) = a AND b",
208   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
209   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
210   "emit"      => '. and %ia32_emit_binop /* And(%A1, %A2) -> %D1 */'
211 },
212
213 "Or" => {
214   "irn_flags" => "R",
215   "comment"   => "construct Or: Or(a, b) = Or(b, a) = a OR b",
216   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
217   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
218   "emit"      => '. or %ia32_emit_binop /* Or(%A1, %A2) -> %D1 */'
219 },
220
221 "Eor" => {
222   "irn_flags" => "R",
223   "comment"   => "construct Eor: Eor(a, b) = Eor(b, a) = a EOR b",
224   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
225   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
226   "emit"      => '. xor %ia32_emit_binop /* Xor(%A1, %A2) -> %D1 */'
227 },
228
229 "Max" => {
230   "irn_flags" => "R",
231   "comment"   => "construct Max: Max(a, b) = Max(b, a) = a > b ? a : b",
232   "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
233   "emit"      =>
234 '2. cmp %S1, %S2 /* prepare Max (%S1 - %S2), (%A1, %A2) */
235   if (mode_is_signed(get_irn_mode(n))) {
236 4.  cmovl %D1, %S2 /* %S1 is less %S2 */
237   }
238   else {
239 4.  cmovb %D1, %S2 /* %S1 is below %S2 */
240   }
241 '
242 },
243
244 "Min" => {
245   "irn_flags" => "R",
246   "comment"   => "construct Min: Min(a, b) = Min(b, a) = a < b ? a : b",
247   "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
248   "emit"      =>
249 '2. cmp %S1, %S2 /* prepare Min (%S1 - %S2), (%A1, %A2) */
250   if (mode_is_signed(get_irn_mode(n))) {
251 2.  cmovg %D1, %S2 /* %S1 is greater %S2 */
252   }
253   else {
254 2.  cmova %D1, %S2, %D1 /* %S1 is above %S2 */
255   }
256 '
257 },
258
259 "CMov" => {
260   "irn_flags" => "R",
261   "comment"   => "construct Mux: Mux(sel, a, b) == sel ? a : b",
262   "reg_req"   => { "in" => [ "gp", "gp", "gp" ], "out" => [ "in_r2" ] },
263   "emit"      =>
264 '. cmp %S1, 0 /* compare Sel for CMov (%A2, %A3) */
265 . cmovne %D1, %S3 /* sel == true -> return %S3 */
266 '
267 },
268
269 # not commutative operations
270
271 "Sub" => {
272   "irn_flags" => "R",
273   "comment"   => "construct Sub: Sub(a, b) = a - b",
274   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
275   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
276   "emit"      => '. sub %ia32_emit_binop /* Sub(%A1, %A2) -> %D1 */'
277 },
278
279 "DivMod" => {
280   "op_flags" => "F|L",
281   "state"    => "exc_pinned",
282   "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "eax in_r1", "edx in_r3" ] },
283   "emit"     =>
284 '  if (mode_is_signed(get_irn_mode(n))) {
285 4.  idiv %S2 /* signed DivMod(%S1, %S2) -> %D1, (%A1, %A2, %A3) */
286   }
287   else {
288 4.  div %S2 /* unsigned DivMod(%S1, %S2) -> %D1, (%A1, %A2, %A3) */
289   }
290 '
291 },
292
293 "Shl" => {
294   "irn_flags" => "R",
295   "comment"   => "construct Shl: Shl(a, b) = a << b",
296   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
297   "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
298   "emit"      => '. shl %ia32_emit_binop /* Shl(%A1, %A2) -> %D1 */'
299 },
300
301 "Shr" => {
302   "irn_flags" => "R",
303   "comment"   => "construct Shr: Shr(a, b) = a >> b",
304   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
305   "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
306   "emit"      => '. shr %ia32_emit_binop /* Shr(%A1, %A2) -> %D1 */'
307 },
308
309 "Shrs" => {
310   "irn_flags" => "R",
311   "comment"   => "construct Shrs: Shrs(a, b) = a >> b",
312   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
313   "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
314   "emit"      => '. sar %ia32_emit_binop /* Shrs(%A1, %A2) -> %D1 */'
315 },
316
317 "RotR" => {
318   "irn_flags" => "R",
319   "comment"     => "construct RotR: RotR(a, b) = a ROTR b",
320   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
321   "reg_req"     => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
322   "emit"        => '. ror %ia32_emit_binop /* RotR(%A1, %A2) -> %D1 */'
323 },
324
325 "RotL" => {
326   "irn_flags" => "R",
327   "comment"   => "construct RotL: RotL(a, b) = a ROTL b",
328   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
329   "reg_req"   => { "in" => [ "gp", "gp", "gp", "ecx", "none" ], "out" => [ "in_r3 !in_r4" ] },
330   "emit"      => '. rol %ia32_emit_binop /* RotL(%A1, %A2) -> %D1 */'
331 },
332
333 # unary operations
334
335 "Minus" => {
336   "irn_flags" => "R",
337   "comment"   => "construct Minus: Minus(a) = -a",
338   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
339   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
340   "emit"      => '. neg %ia32_emit_unop /* Neg(%A1) -> %D1, (%A1) */'
341 },
342
343 "Inc" => {
344   "irn_flags" => "R",
345   "comment"   => "construct Increment: Inc(a) = a++",
346   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
347   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
348   "emit"      => '. inc %ia32_emit_unop /* Inc(%S1) -> %D1, (%A1) */'
349 },
350
351 "Dec" => {
352   "irn_flags" => "R",
353   "comment"   => "construct Decrement: Dec(a) = a--",
354   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
355   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
356   "emit"      => '. dec %ia32_emit_unop /* Dec(%S1) -> %D1, (%A1) */'
357 },
358
359 "Not" => {
360   "irn_flags" => "R",
361   "comment"   => "construct Not: Not(a) = !a",
362   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
363   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3" ] },
364   "emit"      => '. not %ia32_emit_unop /* Not(%S1) -> %D1, (%A1) */'
365 },
366
367 # other operations
368
369 "CondJmp" => {
370   "op_flags"  => "L|X|Y",
371   "comment"   => "construct conditional jump: CMP A, B && JMPxx LABEL",
372   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
373   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ] },
374 },
375
376 "TestJmp" => {
377   "op_flags"  => "L|X|Y",
378   "comment"   => "construct conditional jump: TEST A, B && JMPxx LABEL",
379   "reg_req"  => { "in" => [ "gp", "gp" ] },
380   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
381 },
382
383 "CJmpAM" => {
384   "op_flags"  => "L|X|Y",
385   "comment"   => "construct conditional jump without CMP (replaces CondJmp): JMPxx LABEL",
386   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
387   "reg_req"   => { "in" => [ "gp", "gp", "gp", "gp", "none" ], "out" => [ "none", "none" ] },
388 },
389
390 "CJmp" => {
391   "op_flags"  => "L|X|Y",
392   "comment"   => "construct conditional jump without CMP (replaces TestJmp): JMPxx LABEL",
393   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
394   "reg_req"   => { "in" => [ "gp", "gp" ] },
395 },
396
397 "SwitchJmp" => {
398   "op_flags"  => "L|X|Y",
399   "comment"   => "construct switch",
400   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
401   "reg_req"   => { "in" => [ "gp" ], "out" => [ "none" ] },
402 },
403
404 "Const" => {
405   "op_flags"  => "c",
406   "irn_flags" => "R",
407   "comment"   => "represents an integer constant",
408   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
409   "reg_req"   => { "out" => [ "gp" ] },
410   "emit"      =>
411 '  if (get_ia32_Immop_tarval(n) == get_tarval_null(get_irn_mode(n))) {
412 4.   sub %D1, %D1 /* optimized mov 0 to register */
413   }
414   else {
415     if (get_ia32_op_type(n) == ia32_SymConst) {
416 6.    mov %D1, OFFSET FLAT:%C /* Move address of SymConst into register */
417     }
418         else {
419 6.    mov %D1, %C /* Mov Const into register */
420         }
421   }
422 ',
423 },
424
425 "Cdq" => {
426   "irn_flags" => "R",
427   "comment"   => "construct CDQ: sign extend EAX -> EDX:EAX",
428   "reg_req"   => { "in" => [ "gp" ], "out" => [ "eax in_r1", "edx" ] },
429   "emit"      => '. cdq /* sign extend EAX -> EDX:EAX, (%A1) */'
430 },
431
432 # Load / Store
433
434 "Load" => {
435   "op_flags"  => "L|F",
436   "irn_flags" => "R",
437   "state"     => "exc_pinned",
438   "comment"   => "construct Load: Load(ptr, mem) = LD ptr -> reg",
439   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
440   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "gp" ] },
441   "emit"      =>
442 '  if (get_mode_size_bits(get_ia32_ls_mode(n)) < 32) {
443 4.   mov%Mx %D1, %ia32_emit_am /* Load((%A1)) -> %D1 */
444   }
445   else {
446 4.   mov %D1, %ia32_emit_am /* Load((%A1)) -> %D1 */
447   }
448 '
449 },
450
451 "Store" => {
452   "op_flags"  => "L|F",
453   "state"     => "exc_pinned",
454   "comment"   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
455   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
456   "reg_req"   => { "in" => [ "gp", "gp", "gp", "none" ] },
457   "emit"      => '. mov %ia32_emit_binop /* Store(%A3) -> (%A1) */'
458 },
459
460 "Store8Bit" => {
461   "op_flags"  => "L|F",
462   "state"     => "exc_pinned",
463   "comment"   => "construct 8Bit Store: Store(ptr, val, mem) = ST ptr,val",
464   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
465   "reg_req"   => { "in" => [ "gp", "gp", "eax ebx ecx edx", "none" ] },
466   "emit"      => '. mov %ia32_emit_binop /* Store(%A3) -> (%A1) */'
467 },
468
469 "Lea" => {
470   "irn_flags" => "R",
471   "comment"   => "construct Lea: Lea(a,b) = lea [a+b*const+offs] | res = a + b * const + offs with const = 0,1,2,4,8",
472   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
473   "reg_req"   => { "in" => [ "gp", "gp" ], "out" => [ "in_r1" ] },
474   "emit"      => '. lea %D1, %ia32_emit_am /* LEA(%A1, %A2) */'
475 },
476
477 "Push" => {
478   "comment"   => "push a gp register on the stack",
479   "reg_req"   => { "in" => [ "esp", "gp", "none" ], "out" => [ "gp" ] },
480   "emit"      => '. push %S2 /* Push(%A2) */'
481 },
482
483 "Pop" => {
484   "comment"   => "pop a gp register from the stack",
485   "reg_req"   => { "in" => [ "esp", "none" ], "out" => [ "gp", "esp" ] },
486   "emit"      => '. pop %D1 /* Pop -> %D1 */'
487 },
488
489 "Enter" => {
490   "comment"   => "create stack frame",
491   "reg_req"   => { "in" => [ "esp" ], "out" => [ "ebp", "esp" ] },
492   "emit"      => '. enter /* Enter */'
493 },
494
495 "Leave" => {
496   "comment"   => "destroy stack frame",
497   "reg_req"   => { "in" => [ "esp", "ebp" ], "out" => [ "esp" ] },
498   "emit"      => '. leave /* Enter */'
499 },
500
501 #-----------------------------------------------------------------------------#
502 #   _____ _____ ______    __ _             _                     _            #
503 #  / ____/ ____|  ____|  / _| |           | |                   | |           #
504 # | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
505 #  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
506 #  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
507 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
508 #-----------------------------------------------------------------------------#
509
510 # commutative operations
511
512 "fAdd" => {
513   "irn_flags" => "R",
514   "comment"   => "construct SSE Add: Add(a, b) = Add(b, a) = a + b",
515   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
516   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
517   "emit"      => '. adds%M %ia32_emit_binop /* SSE Add(%A3, %A4) -> %D1 */'
518 },
519
520 "fMul" => {
521   "irn_flags" => "R",
522   "comment"   => "construct SSE Mul: Mul(a, b) = Mul(b, a) = a * b",
523   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
524   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
525   "emit"      => '. muls%M %ia32_emit_binop /* SSE Mul(%A3, %A4) -> %D1 */'
526 },
527
528 "fMax" => {
529   "irn_flags" => "R",
530   "comment"   => "construct SSE Max: Max(a, b) = Max(b, a) = a > b ? a : b",
531   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
532   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
533   "emit"      => '. maxs%M %ia32_emit_binop /* SSE Max(%A3, %A4) -> %D1 */'
534 },
535
536 "fMin" => {
537   "irn_flags" => "R",
538   "comment"   => "construct SSE Min: Min(a, b) = Min(b, a) = a < b ? a : b",
539   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
540   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
541   "emit"      => '. mins%M %ia32_emit_binop /* SSE Min(%A3, %A4) -> %D1 */'
542 },
543
544 "fAnd" => {
545   "irn_flags" => "R",
546   "comment"   => "construct SSE And: And(a, b) = a AND b",
547   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
548   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
549   "emit"      => '. andp%M %ia32_emit_binop /* SSE And(%A3, %A4) -> %D1 */'
550 },
551
552 "fOr" => {
553   "irn_flags" => "R",
554   "comment"   => "construct SSE Or: Or(a, b) = a OR b",
555   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
556   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
557   "emit"      => '. orp%M %ia32_emit_binop /* SSE Or(%A3, %A4) -> %D1 */'
558 },
559
560 "fEor" => {
561   "irn_flags" => "R",
562   "comment"   => "construct SSE Eor: Eor(a, b) = a XOR b",
563   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
564   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
565   "emit"      => '. xorp%M %ia32_emit_binop /* SSE Xor(%A3, %A4) -> %D1 */'
566 },
567
568 # not commutative operations
569
570 "fSub" => {
571   "irn_flags" => "R",
572   "comment"   => "construct SSE Sub: Sub(a, b) = a - b",
573   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
574   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3" ] },
575   "emit"      => '. subs%M %ia32_emit_binop /* SSE Sub(%A1, %A2) -> %D1 */'
576 },
577
578 "fDiv" => {
579   "irn_flags" => "R",
580   "comment"   => "construct SSE Div: Div(a, b) = a / b",
581   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
582   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "in_r3 !in_r4" ] },
583   "emit"      => '. divs%M %ia32_emit_binop /* SSE Div(%A1, %A2) -> %D1 */'
584 },
585
586 # other operations
587
588 "fCondJmp" => {
589   "op_flags"  => "L|X|Y",
590   "comment"   => "construct conditional jump: UCOMIS A, B && JMPxx LABEL",
591   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
592   "reg_req"   => { "in" => [ "gp", "gp", "xmm", "xmm", "none" ], "out" => [ "none", "none" ] },
593 },
594
595 "fConst" => {
596   "op_flags"  => "c",
597   "irn_flags" => "R",
598   "comment"   => "represents a SSE constant",
599   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
600   "reg_req"   => { "out" => [ "xmm" ] },
601   "emit"      => '. mov%M %D1, %C /* Load fConst into register */',
602 },
603
604 # Load / Store
605
606 "fLoad" => {
607   "op_flags"  => "L|F",
608   "irn_flags" => "R",
609   "state"     => "exc_pinned",
610   "comment"   => "construct SSE Load: Load(ptr, mem) = LD ptr",
611   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
612   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "xmm" ] },
613   "emit"      => '. movs%M %D1, %ia32_emit_am /* Load((%A1)) -> %D1 */'
614 },
615
616 "fStore" => {
617   "op_flags" => "L|F",
618   "state"    => "exc_pinned",
619   "comment"  => "construct Store: Store(ptr, val, mem) = ST ptr,val",
620   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
621   "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ] },
622   "emit"     => '. movs%M %ia32_emit_binop /* Store(%S3) -> (%A1) */'
623 },
624
625 # CopyB
626
627 "CopyB" => {
628   "op_flags" => "F|H",
629   "state"    => "pinned",
630   "comment"  => "implements a memcopy: CopyB(dst, src, size, mem) == memcpy(dst, src, size)",
631   "reg_req"  => { "in" => [ "edi", "esi", "ecx", "none" ], "out" => [ "none" ] },
632 },
633
634 "CopyB_i" => {
635   "op_flags" => "F|H",
636   "state"    => "pinned",
637   "comment"  => "implements a memcopy: CopyB(dst, src, mem) == memcpy(dst, src, attr(size))",
638   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
639   "reg_req"  => { "in" => [ "edi", "esi", "none" ], "out" => [ "none" ] },
640 },
641
642 # Conversions
643
644 "Conv_I2I" => {
645   "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "in_r3", "none" ] },
646   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
647   "comment"  => "construct Conv Int -> Int"
648 },
649
650 "Conv_I2I8Bit" => {
651   "reg_req"  => { "in" => [ "gp", "gp", "eax ebx ecx edx", "none" ], "out" => [ "in_r3", "none" ] },
652   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
653   "comment"  => "construct Conv Int -> Int"
654 },
655
656 "Conv_I2FP" => {
657   "reg_req"  => { "in" => [ "gp", "gp", "gp", "none" ], "out" => [ "xmm", "none" ] },
658   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
659   "comment"  => "construct Conv Int -> Floating Point"
660 },
661
662 "Conv_FP2I" => {
663   "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ], "out" => [ "gp", "none" ] },
664   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
665   "comment"  => "construct Conv Floating Point -> Int"
666 },
667
668 "Conv_FP2FP" => {
669   "reg_req"  => { "in" => [ "gp", "gp", "xmm", "none" ], "out" => [ "xmm", "none" ] },
670   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
671   "comment"  => "construct Conv Floating Point -> Floating Point",
672 },
673
674 #----------------------------------------------------------#
675 #        _      _               _    __ _             _    #
676 #       (_)    | |             | |  / _| |           | |   #
677 # __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
678 # \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
679 #  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
680 #   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
681 #                 | |                                      #
682 #  _ __   ___   __| | ___  ___                             #
683 # | '_ \ / _ \ / _` |/ _ \/ __|                            #
684 # | | | | (_) | (_| |  __/\__ \                            #
685 # |_| |_|\___/ \__,_|\___||___/                            #
686 #----------------------------------------------------------#
687
688 "vfadd" => {
689   "irn_flags" => "R",
690   "comment"   => "virtual fp Add: Add(a, b) = Add(b, a) = a + b",
691   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
692   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
693 },
694
695 "vfmul" => {
696   "irn_flags" => "R",
697   "comment"   => "virtual fp Mul: Mul(a, b) = Mul(b, a) = a + b",
698   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
699   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
700 },
701
702 "vfsub" => {
703   "irn_flags" => "R",
704   "comment"   => "virtual fp Sub: Sub(a, b) = a - b",
705   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
706   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
707 },
708
709 "vfdiv" => {
710   "comment"   => "virtual fp Div: Div(a, b) = a / b",
711   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
712   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "vfp", "none" ], "out" => [ "vfp" ] },
713 },
714
715 "vfabs" => {
716   "irn_flags" => "R",
717   "comment"   => "virtual fp Abs: Abs(a) = |a|",
718   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
719 },
720
721 "vfchs" => {
722   "irn_flags" => "R",
723   "comment"   => "virtual fp Chs: Chs(a) = -a",
724   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
725 },
726
727 "vfsin" => {
728   "irn_flags" => "R",
729   "comment"   => "virtual fp Sin: Sin(a) = sin(a)",
730   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
731 },
732
733 "vfcos" => {
734   "irn_flags" => "R",
735   "comment"   => "virtual fp Cos: Cos(a) = cos(a)",
736   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
737 },
738
739 "vfsqrt" => {
740   "irn_flags" => "R",
741   "comment"   => "virtual fp Sqrt: Sqrt(a) = a ^ 0.5",
742   "reg_req"   => { "in" => [ "vfp"], "out" => [ "vfp" ] },
743 },
744
745 # virtual Load and Store
746
747 "vfld" => {
748   "op_flags"  => "L|F",
749   "irn_flags" => "R",
750   "state"     => "exc_pinned",
751   "comment"   => "virtual fp Load: Load(ptr, mem) = LD ptr -> reg",
752   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
753   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "vfp" ] },
754 },
755
756 "vfst" => {
757   "op_flags"  => "L|F",
758   "state"     => "exc_pinned",
759   "comment"   => "virtual fp Store: Store(ptr, val, mem) = ST ptr,val",
760   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
761   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "none" ] },
762 },
763
764 # Conversions
765
766 "vfild" => {
767   "irn_flags" => "R",
768   "comment"   => "virtual fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
769   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
770   "reg_req"   => { "in" => [ "gp", "gp", "none" ], "out" => [ "vfp" ] },
771 },
772
773 "vfist" => {
774   "comment"   => "virtual fp integer Store: Store(ptr, val, mem) = iST ptr,val",
775   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
776   "reg_req"   => { "in" => [ "gp", "gp", "vfp", "none" ] },
777 },
778
779 # constants
780
781 "vfldz" => {
782   "irn_flags" => "R",
783   "comment"   => "virtual fp Load 0.0: Ld 0.0 -> reg",
784   "reg_req"   => { "out" => [ "vfp" ] },
785 },
786
787 "vfld1" => {
788   "irn_flags" => "R",
789   "comment"   => "virtual fp Load 1.0: Ld 1.0 -> reg",
790   "reg_req"   => { "out" => [ "vfp" ] },
791 },
792
793 "vfldpi" => {
794   "irn_flags" => "R",
795   "comment"   => "virtual fp Load pi: Ld pi -> reg",
796   "reg_req"   => { "out" => [ "vfp" ] },
797 },
798
799 "vfldln2" => {
800   "irn_flags" => "R",
801   "comment"   => "virtual fp Load ln 2: Ld ln 2 -> reg",
802   "reg_req"   => { "out" => [ "vfp" ] },
803 },
804
805 "vfldlg2" => {
806   "irn_flags" => "R",
807   "comment"   => "virtual fp Load lg 2: Ld lg 2 -> reg",
808   "reg_req"   => { "out" => [ "vfp" ] },
809 },
810
811 "vfldl2t" => {
812   "irn_flags" => "R",
813   "comment"   => "virtual fp Load ld 10: Ld ld 10 -> reg",
814   "reg_req"   => { "out" => [ "vfp" ] },
815 },
816
817 "vfldl2e" => {
818   "irn_flags" => "R",
819   "comment"   => "virtual fp Load ld e: Ld ld e -> reg",
820   "reg_req"   => { "out" => [ "vfp" ] },
821 },
822
823 "vfConst" => {
824   "op_flags"  => "c",
825   "irn_flags" => "R",
826   "comment"   => "represents a virtual floating point constant",
827   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
828   "reg_req"   => { "out" => [ "vfp" ] },
829 },
830
831 #------------------------------------------------------------------------#
832 #       ___ _____    __ _             _                     _            #
833 # __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
834 # \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
835 #  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
836 # /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
837 #------------------------------------------------------------------------#
838
839 "fadd" => {
840   "op_flags"  => "R",
841   "rd_constructor" => "NONE",
842   "comment"   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
843   "reg_req"   => { },
844   "emit"      => '. fadd %ia32_emit_x87_binop /* x87 fadd(%A1, %A2) -> %D1 */'
845 },
846
847 "faddp" => {
848   "op_flags"  => "R",
849   "rd_constructor" => "NONE",
850   "comment"   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
851   "reg_req"   => { },
852   "emit"      => '. faddp %ia32_emit_x87_binop /* x87 fadd(%A1, %A2) -> %D1 */'
853 },
854
855 "fmul" => {
856   "op_flags"  => "R",
857   "rd_constructor" => "NONE",
858   "comment"   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
859   "reg_req"   => { },
860   "emit"      => '. fmul %ia32_emit_x87_binop /* x87 fmul(%A1, %A2) -> %D1 */'
861 },
862
863 "fmulp" => {
864   "op_flags"  => "R",
865   "rd_constructor" => "NONE",
866   "comment"   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
867   "reg_req"   => { },
868   "emit"      => '. fmulp %ia32_emit_x87_binop /* x87 fmul(%A1, %A2) -> %D1 */'
869 },
870
871 "fsub" => {
872   "op_flags"  => "R",
873   "rd_constructor" => "NONE",
874   "comment"   => "x87 fp Sub: Sub(a, b) = a - b",
875   "reg_req"   => { },
876   "emit"      => '. fsub %ia32_emit_x87_binop /* x87 fsub(%A1, %A2) -> %D1 */'
877 },
878
879 "fsubp" => {
880   "op_flags"  => "R",
881   "rd_constructor" => "NONE",
882   "comment"   => "x87 fp Sub: Sub(a, b) = a - b",
883   "reg_req"   => { },
884   "emit"      => '. fsubp %ia32_emit_x87_binop /* x87 fsub(%A1, %A2) -> %D1 */'
885 },
886
887 "fsubr" => {
888   "op_flags"  => "R",
889   "rd_constructor" => "NONE",
890   "irn_flags" => "R",
891   "comment"   => "x87 fp SubR: SubR(a, b) = b - a",
892   "reg_req"   => { },
893   "emit"      => '. fsubr %ia32_emit_x87_binop /* x87 fsubr(%A1, %A2) -> %D1 */'
894 },
895
896 "fsubrp" => {
897   "op_flags"  => "R",
898   "rd_constructor" => "NONE",
899   "irn_flags" => "R",
900   "comment"   => "x87 fp SubR: SubR(a, b) = b - a",
901   "reg_req"   => { },
902   "emit"      => '. fsubrp %ia32_emit_x87_binop /* x87 fsubr(%A1, %A2) -> %D1 */'
903 },
904
905 "fdiv" => {
906   "op_flags"  => "R",
907   "rd_constructor" => "NONE",
908   "comment"   => "x87 fp Div: Div(a, b) = a / b",
909   "reg_req"   => { },
910   "emit"      => '. fdiv %ia32_emit_x87_binop /* x87 fdiv(%A1, %A2) -> %D1 */'
911 },
912
913 "fdivp" => {
914   "op_flags"  => "R",
915   "rd_constructor" => "NONE",
916   "comment"   => "x87 fp Div: Div(a, b) = a / b",
917   "reg_req"   => { },
918   "emit"      => '. fdivp %ia32_emit_x87_binop /* x87 fdiv(%A1, %A2) -> %D1 */'
919 },
920
921 "fdivr" => {
922   "op_flags"  => "R",
923   "rd_constructor" => "NONE",
924   "comment"   => "x87 fp DivR: DivR(a, b) = b / a",
925   "reg_req"   => { },
926   "emit"      => '. fdivr %ia32_emit_x87_binop /* x87 fdivr(%A1, %A2) -> %D1 */'
927 },
928
929 "fdivrp" => {
930   "op_flags"  => "R",
931   "rd_constructor" => "NONE",
932   "comment"   => "x87 fp DivR: DivR(a, b) = b / a",
933   "reg_req"   => { },
934   "emit"      => '. fdivrp %ia32_emit_x87_binop /* x87 fdivr(%A1, %A2) -> %D1 */'
935 },
936
937 "fabs" => {
938   "op_flags"  => "R",
939   "rd_constructor" => "NONE",
940   "comment"   => "x87 fp Abs: Abs(a) = |a|",
941   "reg_req"   => { },
942   "emit"      => '. fabs /* x87 fabs(%S1) -> %D1 */'
943 },
944
945 "fchs" => {
946   "op_flags"  => "R",
947   "rd_constructor" => "NONE",
948   "comment"   => "x87 fp Chs: Chs(a) = -a",
949   "reg_req"   => { },
950   "emit"      => '. fchs /* x87 fchs(%S1) -> %D1 */'
951 },
952
953 "fsin" => {
954   "op_flags"  => "R",
955   "rd_constructor" => "NONE",
956   "comment"   => "x87 fp Sin: Sin(a) = sin(a)",
957   "reg_req"   => { },
958   "emit"      => '. fsin /* x87 sin(%S1) -> %D1 */'
959 },
960
961 "fcos" => {
962   "op_flags"  => "R",
963   "rd_constructor" => "NONE",
964   "comment"   => "x87 fp Cos: Cos(a) = cos(a)",
965   "reg_req"   => { },
966   "emit"      => '. fcos /* x87 cos(%S1) -> %D1 */'
967 },
968
969 "fsqrt" => {
970   "op_flags"  => "R",
971   "rd_constructor" => "NONE",
972   "comment"   => "x87 fp Sqrt: Sqrt(a) = a ^ 0.5",
973   "reg_req"   => { },
974   "emit"      => '. fsqrt $ /* x87 sqrt(%S1) -> %D1 */'
975 },
976
977 # x87 Load and Store
978
979 "fld" => {
980   "rd_constructor" => "NONE",
981   "op_flags"  => "R|L|F",
982   "state"     => "exc_pinned",
983   "comment"   => "x87 fp Load: Load(ptr, mem) = LD ptr -> reg",
984   "reg_req"   => { },
985   "emit"      => '. fld %ia32_emit_am /* Load((%A1)) -> %D1 */'
986 },
987
988 "fst" => {
989   "rd_constructor" => "NONE",
990   "op_flags"  => "R|L|F",
991   "state"     => "exc_pinned",
992   "comment"   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
993   "reg_req"   => { },
994   "emit"      => '. fst %ia32_emit_am /* Store(%A3) -> (%A1) */'
995 },
996
997 "fstp" => {
998   "rd_constructor" => "NONE",
999   "op_flags"  => "R|L|F",
1000   "state"     => "exc_pinned",
1001   "comment"   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
1002   "reg_req"   => { },
1003   "emit"      => '. fstp %ia32_emit_am /* Store(%A3) -> (%A1) and pop */'
1004 },
1005
1006 # Conversions
1007
1008 "fild" => {
1009   "op_flags"  => "R",
1010   "irn_flags" => "R",
1011   "comment"   => "x87 fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1012   "reg_req"   => { },
1013   "emit"      => '. fild %ia32_emit_am /* integer Load((%A1)) -> %D1 */'
1014 },
1015
1016 "fist" => {
1017   "op_flags"  => "R",
1018   "rd_constructor" => "NONE",
1019   "comment"   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1020   "reg_req"   => { },
1021   "emit"      => '. fist %ia32_emit_am /* integer Store(%A3) -> (%A1) */'
1022 },
1023
1024 "fistp" => {
1025   "op_flags"  => "R",
1026   "rd_constructor" => "NONE",
1027   "comment"   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1028   "reg_req"   => { },
1029   "emit"      => '. fistp %ia32_emit_am /* integer Store(%A3) -> (%A1) and pop */'
1030 },
1031
1032 # constants
1033
1034 "fldz" => {
1035   "op_flags"  => "R",
1036   "rd_constructor" => "NONE",
1037   "comment"   => "x87 fp Load 0.0: Ld 0.0 -> reg",
1038   "reg_req"   => { },
1039   "emit"      => '. fldz /* x87 0.0 -> %D1 */'
1040 },
1041
1042 "fld1" => {
1043   "op_flags"  => "R",
1044   "rd_constructor" => "NONE",
1045   "comment"   => "x87 fp Load 1.0: Ld 1.0 -> reg",
1046   "reg_req"   => { },
1047   "emit"      => '. fld1 /* x87 1.0 -> %D1 */'
1048 },
1049
1050 "fldpi" => {
1051   "op_flags"  => "R",
1052   "rd_constructor" => "NONE",
1053   "comment"   => "x87 fp Load pi: Ld pi -> reg",
1054   "reg_req"   => { },
1055   "emit"      => '. fldpi /* x87 pi -> %D1 */'
1056 },
1057
1058 "fldln2" => {
1059   "op_flags"  => "R",
1060   "rd_constructor" => "NONE",
1061   "comment"   => "x87 fp Load ln 2: Ld ln 2 -> reg",
1062   "reg_req"   => { },
1063   "emit"      => '. fldln2 /* x87 ln(2) -> %D1 */'
1064 },
1065
1066 "fldlg2" => {
1067   "op_flags"  => "R",
1068   "rd_constructor" => "NONE",
1069   "comment"   => "x87 fp Load lg 2: Ld lg 2 -> reg",
1070   "reg_req"   => { },
1071   "emit"      => '. fldlg2 /* x87 log(2) -> %D1 */'
1072 },
1073
1074 "fldl2t" => {
1075   "op_flags"  => "R",
1076   "rd_constructor" => "NONE",
1077   "comment"   => "x87 fp Load ld 10: Ld ld 10 -> reg",
1078   "reg_req"   => { },
1079   "emit"      => '. fldll2t /* x87 ld(10) -> %D1 */'
1080 },
1081
1082 "fldl2e" => {
1083   "op_flags"  => "R",
1084   "rd_constructor" => "NONE",
1085   "comment"   => "x87 fp Load ld e: Ld ld e -> reg",
1086   "reg_req"   => { },
1087   "emit"      => '. fldl2e /* x87 ld(e) -> %D1 */'
1088 },
1089
1090 "fldConst" => {
1091   "op_flags"  => "R",
1092   "op_flags"  => "c",
1093   "irn_flags" => "R",
1094   "comment"   => "represents a x87 constant",
1095   "cmp_attr"  => "  return ia32_compare_immop_attr(attr_a, attr_b);\n",
1096   "reg_req"   => { "out" => [ "st" ] },
1097   "emit"      => '. fld%M %C /* Load fConst into register -> %D1 */',
1098 },
1099
1100 # fxch, fpush
1101 # Note that it is NEVER allowed to do CSE on these nodes
1102
1103 "fxch" => {
1104   "op_flags"  => "R|K",
1105   "comment"   => "x87 stack exchange",
1106   "reg_req"   => { "in" => [ "st"], "out" => [ "st" ] },
1107   "cmp_attr"  => "  return 1;\n",
1108   "emit"      => '. fxch %X1 /* x87 swap %X1, %X3 */',
1109 },
1110
1111 "fpush" => {
1112   "op_flags"  => "R",
1113   "comment"   => "x87 stack push",
1114   "reg_req"   => { "in" => [ "st"], "out" => [ "st" ] },
1115   "cmp_attr"  => "  return 1;\n",
1116   "emit"      => '. fld %X1 /* x87 push %X1 */',
1117 },
1118
1119 ); # end of %nodes