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