cdb2e5080625464f1a892e278eada1992e3fe985
[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 use File::Basename;
6
7 $new_emit_syntax = 1;
8 my $myname = $0;
9
10 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
11 $arch = "ia32";
12
13 # The node description is done as a perl hash initializer with the
14 # following structure:
15 #
16 # %nodes = (
17 #
18 # <op-name> => {
19 #   op_flags  => "N|L|C|X|I|F|Y|H|c|K",
20 #   irn_flags => "R|N|I|S"
21 #   arity     => "0|1|2|3 ... |variable|dynamic|any",
22 #   state     => "floats|pinned|mem_pinned|exc_pinned",
23 #   args      => [
24 #                    { type => "type 1", name => "name 1" },
25 #                    { type => "type 2", name => "name 2" },
26 #                    ...
27 #                  ],
28 #   comment   => "any comment for constructor",
29 #   reg_req   => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
30 #   cmp_attr  => "c source code for comparing node attributes",
31 #   emit      => "emit code with templates",
32 #   attr      => "attitional attribute arguments for constructor"
33 #   init_attr => "emit attribute initialization template"
34 #   rd_constructor => "c source code which constructs an ir_node"
35 #   latency   => "latency of this operation (can be float)"
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 #   S   modifies stack pointer
61 #
62 # state: state of the operation, OPTIONAL (default is "floats")
63 #
64 # arity: arity of the operation, MUST NOT BE OMITTED
65 #
66 # args:  the OPTIONAL arguments of the node constructor (debug, irg and block
67 #        are always the first 3 arguments and are always autmatically
68 #        created)
69 #        If this key is missing the following arguments will be created:
70 #        for i = 1 .. arity: ir_node *op_i
71 #        ir_mode *mode
72 #
73 # outs:  if a node defines more than one output, the names of the projections
74 #        nodes having outs having automatically the mode mode_T
75 #        One can also annotate some flags for each out, additional to irn_flags.
76 #        They are separated from name with a colon ':', and concatenated by pipe '|'
77 #        Only I and S are available at the moment (same meaning as in irn_flags).
78 #        example: [ "frame:I", "stack:I|S", "M" ]
79 #
80 # comment: OPTIONAL comment for the node constructor
81 #
82 # rd_constructor: for every operation there will be a
83 #      new_rd_<arch>_<op-name> function with the arguments from above
84 #      which creates the ir_node corresponding to the defined operation
85 #      you can either put the complete source code of this function here
86 #
87 #      This key is OPTIONAL. If omitted, the following constructor will
88 #      be created:
89 #      if (!op_<arch>_<op-name>) assert(0);
90 #      for i = 1 to arity
91 #         set in[i] = op_i
92 #      done
93 #      res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
94 #      return res
95 #
96 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
97 #
98 # latency: the latency of the operation, default is 1
99 #
100
101 # register types:
102 #   0 - no special type
103 #   1 - caller save (register must be saved by the caller of a function)
104 #   2 - callee save (register must be saved by the called function)
105 #   4 - ignore (do not assign this register)
106 #   8 - emitter can choose an arbitrary register of this class
107 #  16 - the register is a virtual one
108 #  32 - register represents a state
109 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
110 %reg_classes = (
111         gp => [
112                 { name => "eax", type => 1 },
113                 { name => "edx", type => 1 },
114                 { name => "ebx", type => 2 },
115                 { name => "ecx", type => 1 },
116                 { name => "esi", type => 2 },
117                 { name => "edi", type => 2 },
118                 { name => "ebp", type => 2 },
119                 { name => "esp", type => 4 },
120                 { name => "gp_NOREG", type => 4 | 8 | 16 }, # we need a dummy register for NoReg nodes
121                 { name => "gp_UKNWN", type => 4 | 8 | 16 },  # we need a dummy register for Unknown nodes
122                 { mode => "mode_Iu" }
123         ],
124         xmm => [
125                 { name => "xmm0", type => 1 },
126                 { name => "xmm1", type => 1 },
127                 { name => "xmm2", type => 1 },
128                 { name => "xmm3", type => 1 },
129                 { name => "xmm4", type => 1 },
130                 { name => "xmm5", type => 1 },
131                 { name => "xmm6", type => 1 },
132                 { name => "xmm7", type => 1 },
133                 { name => "xmm_NOREG", type => 4 | 16 },     # we need a dummy register for NoReg nodes
134                 { name => "xmm_UKNWN", type => 4 | 8 | 16},  # we need a dummy register for Unknown nodes
135                 { mode => "mode_E" }
136         ],
137         vfp => [
138                 { name => "vf0", type => 1 | 16 },
139                 { name => "vf1", type => 1 | 16 },
140                 { name => "vf2", type => 1 | 16 },
141                 { name => "vf3", type => 1 | 16 },
142                 { name => "vf4", type => 1 | 16 },
143                 { name => "vf5", type => 1 | 16 },
144                 { name => "vf6", type => 1 | 16 },
145                 { name => "vf7", type => 1 | 16 },
146                 { name => "vfp_NOREG", type => 4 | 8 | 16 }, # we need a dummy register for NoReg nodes
147                 { name => "vfp_UKNWN", type => 4 | 8 | 16 },  # we need a dummy register for Unknown nodes
148                 { mode => "mode_E" }
149         ],
150         st => [
151                 { name => "st0", type => 1 },
152                 { name => "st1", type => 1 },
153                 { name => "st2", type => 1 },
154                 { name => "st3", type => 1 },
155                 { name => "st4", type => 1 },
156                 { name => "st5", type => 1 },
157                 { name => "st6", type => 1 },
158                 { name => "st7", type => 1 },
159                 { mode => "mode_E" }
160         ],
161         fp_cw => [      # the floating point control word
162                 { name => "fpcw", type => 4 | 32},
163                 { mode => "mode_Hu" }
164         ],
165 ); # %reg_classes
166
167 %cpu = (
168         GP     => [ 1, "GP_EAX", "GP_EBX", "GP_ECX", "GP_EDX", "GP_ESI", "GP_EDI", "GP_EBP" ],
169         SSE    => [ 1, "SSE_XMM0", "SSE_XMM1", "SSE_XMM2", "SSE_XMM3", "SSE_XMM4", "SSE_XMM5", "SSE_XMM6", "SSE_XMM7" ],
170         VFP    => [ 1, "VFP_VF0", "VFP_VF1", "VFP_VF2", "VFP_VF3", "VFP_VF4", "VFP_VF5", "VFP_VF6", "VFP_VF7" ],
171         BRANCH => [ 1, "BRANCH1", "BRANCH2" ],
172 ); # %cpu
173
174 %vliw = (
175         bundle_size       => 1,
176         bundels_per_cycle => 1
177 ); # vliw
178
179 %emit_templates = (
180         S1 => "${arch}_emit_source_register(env, node, 0);",
181         S2 => "${arch}_emit_source_register(env, node, 1);",
182         S3 => "${arch}_emit_source_register(env, node, 2);",
183         S4 => "${arch}_emit_source_register(env, node, 3);",
184         S5 => "${arch}_emit_source_register(env, node, 4);",
185         S6 => "${arch}_emit_source_register(env, node, 5);",
186         D1 => "${arch}_emit_dest_register(env, node, 0);",
187         D2 => "${arch}_emit_dest_register(env, node, 1);",
188         D3 => "${arch}_emit_dest_register(env, node, 2);",
189         D4 => "${arch}_emit_dest_register(env, node, 3);",
190         D5 => "${arch}_emit_dest_register(env, node, 4);",
191         D6 => "${arch}_emit_dest_register(env, node, 5);",
192         A1 => "${arch}_emit_in_node_name(env, node, 0);",
193         A2 => "${arch}_emit_in_node_name(env, node, 1);",
194         A3 => "${arch}_emit_in_node_name(env, node, 2);",
195         A4 => "${arch}_emit_in_node_name(env, node, 3);",
196         A5 => "${arch}_emit_in_node_name(env, node, 4);",
197         A6 => "${arch}_emit_in_node_name(env, node, 5);",
198         X1 => "${arch}_emit_x87_name(env, node, 0);",
199         X2 => "${arch}_emit_x87_name(env, node, 1);",
200         X3 => "${arch}_emit_x87_name(env, node, 2);",
201         C  => "${arch}_emit_immediate(env, node);",
202         SE => "${arch}_emit_extend_suffix(env, get_ia32_ls_mode(node));",
203         ME => "if(get_mode_size_bits(get_ia32_ls_mode(node)) != 32)\n
204         ia32_emit_mode_suffix(env, get_ia32_ls_mode(node));",
205         M  => "${arch}_emit_mode_suffix(env, get_ia32_ls_mode(node));",
206         XM => "${arch}_emit_x87_mode_suffix(env, node);",
207         XXM => "${arch}_emit_xmm_mode_suffix(env, node);",
208         XSD => "${arch}_emit_xmm_mode_suffix_s(env, node);",
209         AM => "${arch}_emit_am(env, node);",
210         unop => "${arch}_emit_unop(env, node);",
211         binop => "${arch}_emit_binop(env, node);",
212         x87_binop => "${arch}_emit_x87_binop(env, node);",
213 );
214
215 #--------------------------------------------------#
216 #                        _                         #
217 #                       (_)                        #
218 #  _ __   _____      __  _ _ __    ___  _ __  ___  #
219 # | '_ \ / _ \ \ /\ / / | | '__|  / _ \| '_ \/ __| #
220 # | | | |  __/\ V  V /  | | |    | (_) | |_) \__ \ #
221 # |_| |_|\___| \_/\_/   |_|_|     \___/| .__/|___/ #
222 #                                      | |         #
223 #                                      |_|         #
224 #--------------------------------------------------#
225
226 $default_cmp_attr = "return ia32_compare_attr(attr_a, attr_b);";
227
228 %operands = (
229 );
230
231 %nodes = (
232
233 #-----------------------------------------------------------------#
234 #  _       _                                         _            #
235 # (_)     | |                                       | |           #
236 #  _ _ __ | |_ ___  __ _  ___ _ __   _ __   ___   __| | ___  ___  #
237 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
238 # | | | | | ||  __/ (_| |  __/ |    | | | | (_) | (_| |  __/\__ \ #
239 # |_|_| |_|\__\___|\__, |\___|_|    |_| |_|\___/ \__,_|\___||___/ #
240 #                   __/ |                                         #
241 #                  |___/                                          #
242 #-----------------------------------------------------------------#
243
244 # commutative operations
245
246 # NOTE:
247 # All nodes supporting Addressmode have 5 INs:
248 # 1 - base    r1 == NoReg in case of no AM or no base
249 # 2 - index   r2 == NoReg in case of no AM or no index
250 # 3 - op1     r3 == always present
251 # 4 - op2     r4 == NoReg in case of immediate operation
252 # 5 - mem     NoMem in case of no AM otherwise it takes the mem from the Load
253
254 Add => {
255         irn_flags => "R",
256         comment   => "construct Add: Add(a, b) = Add(b, a) = a + b",
257         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
258         emit      => '. addl %binop',
259         units     => [ "GP" ],
260         mode      => "mode_Iu",
261 },
262
263 Adc => {
264         comment   => "construct Add with Carry: Adc(a, b) = Add(b, a) = a + b + carry",
265         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
266         emit      => '. adcl %binop',
267         units     => [ "GP" ],
268         mode      => "mode_Iu",
269 },
270
271 Add64Bit => {
272         irn_flags => "R",
273         comment   => "construct 64Bit Add: Add(a_l, a_h, b_l, b_h) = a_l + b_l; a_h + b_h + carry",
274         arity     => 4,
275         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
276         emit      => '
277 . movl %S1, %D1
278 . movl %S2, %D2
279 . addl %S3, %D1
280 . adcl %S4, %D2
281 ',
282         outs      => [ "low_res", "high_res" ],
283         units     => [ "GP" ],
284 },
285
286 l_Add => {
287         op_flags  => "C",
288         irn_flags => "R",
289         cmp_attr  => "return 1;",
290         comment   => "construct lowered Add: Add(a, b) = Add(b, a) = a + b",
291         arity     => 2,
292 },
293
294 l_Adc => {
295         op_flags  => "C",
296         cmp_attr  => "return 1;",
297         comment   => "construct lowered Add with Carry: Adc(a, b) = Adc(b, a) = a + b + carry",
298         arity     => 2,
299 },
300
301 Mul => {
302         # we should not rematrialize this node. It produces 2 results and has
303         # very strict constrains
304         comment   => "construct MulS: MulS(a, b) = MulS(b, a) = a * b",
305         reg_req   => { in => [ "gp", "gp", "eax", "gp", "none" ], out => [ "eax", "edx", "none" ] },
306         emit      => '. mull %unop',
307         outs      => [ "EAX", "EDX", "M" ],
308         latency   => 10,
309         units     => [ "GP" ],
310 },
311
312 l_Mul => {
313         # we should not rematrialize this node. It produces 2 results and has
314         # very strict constrains
315         op_flags  => "C",
316         cmp_attr  => "return 1;",
317         comment   => "construct lowered MulS: Mul(a, b) = Mul(b, a) = a * b",
318         outs      => [ "EAX", "EDX", "M" ],
319         arity     => 2
320 },
321
322 IMul => {
323         irn_flags => "R",
324         comment   => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
325         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
326         emit      => '. imull %binop',
327         latency   => 5,
328         units     => [ "GP" ],
329         mode      => "mode_Iu",
330 },
331
332 IMul1OP => {
333         irn_flags => "R",
334         comment   => "construct Mul (1 operand format): Mul(a, b) = Mul(b, a) = a * b",
335         reg_req   => { in => [ "gp", "gp", "eax", "gp", "none" ], out => [ "eax", "edx", "none" ] },
336         emit      => '. imull %unop',
337         outs      => [ "EAX", "EDX", "M" ],
338         latency   => 5,
339         units     => [ "GP" ],
340 },
341
342 l_IMul => {
343         op_flags  => "C",
344         cmp_attr  => "return 1;",
345         comment   => "construct lowered IMul: IMul(a, b) = IMul(b, a) = a * b",
346         arity     => 2
347 },
348
349 And => {
350         irn_flags => "R",
351         comment   => "construct And: And(a, b) = And(b, a) = a AND b",
352         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
353         emit      => '. andl %binop',
354         units     => [ "GP" ],
355         mode      => "mode_Iu",
356 },
357
358 Or => {
359         irn_flags => "R",
360         comment   => "construct Or: Or(a, b) = Or(b, a) = a OR b",
361         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
362         emit      => '. orl %binop',
363         units     => [ "GP" ],
364         mode      => "mode_Iu",
365 },
366
367 Xor => {
368         irn_flags => "R",
369         comment   => "construct Xor: Xor(a, b) = Xor(b, a) = a EOR b",
370         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
371         emit      => '. xorl %binop',
372         units     => [ "GP" ],
373         mode      => "mode_Iu",
374 },
375
376 l_Xor => {
377         op_flags  => "C",
378         cmp_attr  => "return 1;",
379         comment   => "construct lowered Xor: Xor(a, b) = Xor(b, a) = a XOR b",
380         arity     => 2
381 },
382
383 # not commutative operations
384
385 Sub => {
386         irn_flags => "R",
387         comment   => "construct Sub: Sub(a, b) = a - b",
388         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
389         emit      => '. subl %binop',
390         units     => [ "GP" ],
391         mode      => "mode_Iu",
392 },
393
394 Sbb => {
395         comment   => "construct Sub with Carry: SubC(a, b) = a - b - carry",
396         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3 !in_r4" ] },
397         emit      => '. sbbl %binop',
398         units     => [ "GP" ],
399         mode      => "mode_Iu",
400 },
401
402 Sub64Bit => {
403         irn_flags => "R",
404         comment   => "construct 64Bit Sub: Sub(a_l, a_h, b_l, b_h) = a_l - b_l; a_h - b_h - borrow",
405         arity     => 4,
406         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
407         emit      => '
408 . movl %S1, %D1
409 . movl %S2, %D2
410 . subl %S3, %D1
411 . sbbl %S4, %D2
412 ',
413         outs      => [ "low_res", "high_res" ],
414         units     => [ "GP" ],
415 },
416
417 l_Sub => {
418         irn_flags => "R",
419         cmp_attr  => "return 1;",
420         comment   => "construct lowered Sub: Sub(a, b) = a - b",
421         arity     => 2,
422 },
423
424 l_Sbb => {
425         cmp_attr  => "return 1;",
426         comment   => "construct lowered Sub with Carry: SubC(a, b) = a - b - carry",
427         arity     => 2,
428 },
429
430 IDiv => {
431         op_flags  => "F|L",
432         state     => "exc_pinned",
433         reg_req   => { in => [ "gp", "gp", "eax", "edx", "gp", "none" ], out => [ "eax", "edx", "none" ] },
434         attr      => "ia32_op_flavour_t dm_flav",
435         init_attr => "attr->data.op_flav = dm_flav;",
436         emit      => ". idivl %unop",
437         outs      => [ "div_res", "mod_res", "M" ],
438         latency   => 25,
439         units     => [ "GP" ],
440 },
441
442 Div => {
443         op_flags  => "F|L",
444         state     => "exc_pinned",
445         reg_req   => { in => [ "gp", "gp", "eax", "edx", "gp", "none" ], out => [ "eax", "edx", "none" ] },
446         attr      => "ia32_op_flavour_t dm_flav",
447         init_attr => "attr->data.op_flav = dm_flav;",
448         emit      => ". divl %unop",
449         outs      => [ "div_res", "mod_res", "M" ],
450         latency   => 25,
451         units     => [ "GP" ],
452 },
453
454 Shl => {
455         irn_flags => "R",
456         comment   => "construct Shl: Shl(a, b) = a << b",
457         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
458         emit      => '. shll %binop',
459         units     => [ "GP" ],
460         mode      => "mode_Iu",
461 },
462
463 l_Shl => {
464         cmp_attr  => "return 1;",
465         comment   => "construct lowered Shl: Shl(a, b) = a << b",
466         arity     => 2
467 },
468
469 ShlD => {
470         irn_flags => "R",
471         comment   => "construct ShlD: ShlD(a, b, c) = a, b << count (shift left count bits from b into a)",
472         # Out requirements is: different from all in
473         # This is because, out must be different from LowPart and ShiftCount.
474         # We could say "!ecx !in_r4" but it can occur, that all values live through
475         # this Shift and the only value dying is the ShiftCount. Then there would be a
476         # register missing, as result must not be ecx and all other registers are
477         # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
478         # (and probably never will). So we create artificial interferences of the result
479         # with all inputs, so the spiller can always assure a free register.
480         reg_req   => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
481         emit      =>
482 '
483 if (get_ia32_immop_type(node) == ia32_ImmNone) {
484         if (get_ia32_op_type(node) == ia32_AddrModeD) {
485                 . shldl %%cl, %S4, %AM
486         } else {
487                 . shldl %%cl, %S4, %S3
488         }
489 } else {
490         if (get_ia32_op_type(node) == ia32_AddrModeD) {
491                 . shldl $%C, %S4, %AM
492         } else {
493                 . shldl $%C, %S4, %S3
494         }
495 }
496 ',
497         latency   => 6,
498         units     => [ "GP" ],
499         mode      => "mode_Iu",
500 },
501
502 l_ShlD => {
503         cmp_attr  => "return 1;",
504         comment   => "construct lowered ShlD: ShlD(a, b, c) = a, b << count (shift left count bits from b into a)",
505         arity     => 3,
506 },
507
508 Shr => {
509         irn_flags => "R",
510         comment   => "construct Shr: Shr(a, b) = a >> b",
511         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
512         emit      => '. shrl %binop',
513         units     => [ "GP" ],
514         mode      => "mode_Iu",
515 },
516
517 l_Shr => {
518         cmp_attr  => "return 1;",
519         comment   => "construct lowered Shr: Shr(a, b) = a << b",
520         arity     => 2
521 },
522
523 ShrD => {
524         irn_flags => "R",
525         comment   => "construct ShrD: ShrD(a, b, c) = a, b >> count (shift rigth count bits from a into b)",
526         # Out requirements is: different from all in
527         # This is because, out must be different from LowPart and ShiftCount.
528         # We could say "!ecx !in_r4" but it can occur, that all values live through
529         # this Shift and the only value dying is the ShiftCount. Then there would be a
530         # register missing, as result must not be ecx and all other registers are
531         # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
532         # (and probably never will). So we create artificial interferences of the result
533         # with all inputs, so the spiller can always assure a free register.
534         reg_req   => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
535         emit      => '
536 if (get_ia32_immop_type(node) == ia32_ImmNone) {
537         if (get_ia32_op_type(node) == ia32_AddrModeD) {
538                 . shrdl %%cl, %S4, %AM
539         } else {
540                 . shrdl %%cl, %S4, %S3
541         }
542 } else {
543         if (get_ia32_op_type(node) == ia32_AddrModeD) {
544                 . shrdl $%C, %S4, %AM
545         } else {
546                 . shrdl $%C, %S4, %S3
547         }
548 }
549 ',
550         latency   => 6,
551         units     => [ "GP" ],
552         mode      => "mode_Iu",
553 },
554
555 l_ShrD => {
556         cmp_attr  => "return 1;",
557         comment   => "construct lowered ShrD: ShrD(a, b, c) = a, b >> count (shift rigth count bits from a into b)",
558         arity     => 3
559 },
560
561 Sar => {
562         irn_flags => "R",
563         comment   => "construct Shrs: Shrs(a, b) = a >> b",
564         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
565         emit      => '. sarl %binop',
566         units     => [ "GP" ],
567         mode      => "mode_Iu",
568 },
569
570 l_Sar => {
571         cmp_attr  => "return 1;",
572         comment   => "construct lowered Sar: Sar(a, b) = a << b",
573         arity     => 2
574 },
575
576 Ror => {
577         irn_flags => "R",
578         comment   => "construct Ror: Ror(a, b) = a ROR b",
579         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
580         emit      => '. rorl %binop',
581         units     => [ "GP" ],
582         mode      => "mode_Iu",
583 },
584
585 Rol => {
586         irn_flags => "R",
587         comment   => "construct Rol: Rol(a, b) = a ROL b",
588         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
589         emit      => '. roll %binop',
590         units     => [ "GP" ],
591         mode      => "mode_Iu",
592 },
593
594 # unary operations
595
596 Neg => {
597         irn_flags => "R",
598         comment   => "construct Minus: Minus(a) = -a",
599         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
600         emit      => '. negl %unop',
601         units     => [ "GP" ],
602         mode      => "mode_Iu",
603 },
604
605 Minus64Bit => {
606         irn_flags => "R",
607         comment   => "construct 64Bit Minus: Minus(a_l, a_h, 0) = 0 - a_l; 0 - a_h - borrow",
608         arity     => 4,
609         reg_req   => { in => [ "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
610         emit      => '
611 . movl %S1, %D1
612 . movl %S1, %D2
613 . subl %S2, %D1
614 . sbbl %S3, %D2
615 ',
616         outs      => [ "low_res", "high_res" ],
617         units     => [ "GP" ],
618 },
619
620
621 l_Neg => {
622         cmp_attr  => "return 1;",
623         comment   => "construct lowered Minus: Minus(a) = -a",
624         arity     => 1,
625 },
626
627 Inc => {
628         irn_flags => "R",
629         comment   => "construct Increment: Inc(a) = a++",
630         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
631         emit      => '. incl %unop',
632         units     => [ "GP" ],
633         mode      => "mode_Iu",
634 },
635
636 Dec => {
637         irn_flags => "R",
638         comment   => "construct Decrement: Dec(a) = a--",
639         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
640         emit      => '. decl %unop',
641         units     => [ "GP" ],
642         mode      => "mode_Iu",
643 },
644
645 Not => {
646         irn_flags => "R",
647         comment   => "construct Not: Not(a) = !a",
648         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
649         emit      => '. notl %unop',
650         units     => [ "GP" ],
651         mode      => "mode_Iu",
652 },
653
654 # other operations
655
656 CondJmp => {
657         state     => "pinned",
658         op_flags  => "L|X|Y",
659         comment   => "construct conditional jump: CMP A, B && JMPxx LABEL",
660         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ] },
661         outs      => [ "false", "true" ],
662         latency   => 3,
663         units     => [ "BRANCH" ],
664 },
665
666 TestJmp => {
667         state     => "pinned",
668         op_flags  => "L|X|Y",
669         comment   => "construct conditional jump: TEST A, B && JMPxx LABEL",
670         reg_req  => { in => [ "gp", "gp" ] },
671         outs      => [ "false", "true" ],
672         latency   => 3,
673         units     => [ "BRANCH" ],
674 },
675
676 CJmpAM => {
677         state     => "pinned",
678         op_flags  => "L|X|Y",
679         comment   => "construct conditional jump without CMP (replaces CondJmp): JMPxx LABEL",
680         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "none", "none" ] },
681         outs      => [ "false", "true" ],
682         units     => [ "BRANCH" ],
683 },
684
685 CJmp => {
686         state     => "pinned",
687         op_flags  => "L|X|Y",
688         comment   => "construct conditional jump without CMP (replaces TestJmp): JMPxx LABEL",
689         reg_req   => { in => [ "gp", "gp" ] },
690         units     => [ "BRANCH" ],
691 },
692
693 SwitchJmp => {
694         state     => "pinned",
695         op_flags  => "L|X|Y",
696         comment   => "construct switch",
697         reg_req   => { in => [ "gp" ], out => [ "none" ] },
698         latency   => 3,
699         units     => [ "BRANCH" ],
700 },
701
702 Const => {
703         op_flags  => "c",
704         irn_flags => "R",
705         comment   => "represents an integer constant",
706         reg_req   => { out => [ "gp" ] },
707         units     => [ "GP" ],
708         mode      => "mode_Iu",
709 },
710
711 Unknown_GP => {
712         op_flags  => "c",
713         irn_flags => "I",
714         comment   => "unknown value",
715         reg_req   => { out => [ "gp_UKNWN" ] },
716         units     => [],
717         emit      => "",
718         mode      => "mode_Iu"
719 },
720
721 Unknown_VFP => {
722         op_flags  => "c",
723         irn_flags => "I",
724         comment   => "unknown value",
725         reg_req   => { out => [ "vfp_UKNWN" ] },
726         units     => [],
727         emit      => "",
728         mode      => "mode_E"
729 },
730
731 Unknown_XMM => {
732         op_flags  => "c",
733         irn_flags => "I",
734         comment   => "unknown value",
735         reg_req   => { out => [ "xmm_UKNWN" ] },
736         units     => [],
737         emit      => "",
738         mode      => "mode_E"
739 },
740
741 NoReg_GP => {
742         op_flags  => "c",
743         irn_flags => "I",
744         comment   => "unknown GP value",
745         reg_req   => { out => [ "gp_NOREG" ] },
746         units     => [],
747         emit      => "",
748         mode      => "mode_Iu"
749 },
750
751 NoReg_VFP => {
752         op_flags  => "c",
753         irn_flags => "I",
754         comment   => "unknown VFP value",
755         reg_req   => { out => [ "vfp_NOREG" ] },
756         units     => [],
757         emit      => "",
758         mode      => "mode_E"
759 },
760
761 NoReg_XMM => {
762         op_flags  => "c",
763         irn_flags => "I",
764         comment   => "unknown XMM value",
765         reg_req   => { out => [ "xmm_NOREG" ] },
766         units     => [],
767         emit      => "",
768         mode      => "mode_E"
769 },
770
771 ChangeCW => {
772         irn_flags => "R",
773         comment   => "change floating point control word",
774         reg_req   => { out => [ "fp_cw" ] },
775         mode      => "mode_Hu",
776         latency   => 3,
777         units     => [ "GP" ],
778 },
779
780 FldCW => {
781         op_flags  => "L|F",
782         state     => "exc_pinned",
783         comment   => "load floating point control word FldCW(ptr, mem) = LD ptr -> reg",
784         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
785         latency   => 5,
786         emit      => ". fldcw %AM",
787         mode      => "mode_Hu",
788         units     => [ "GP" ],
789 },
790
791 FstCW => {
792         op_flags  => "L|F",
793         state     => "exc_pinned",
794         comment   => "store floating point control word: FstCW(ptr, mem) = ST ptr -> reg",
795         reg_req   => { in => [ "gp", "gp", "fp_cw", "none" ] },
796         latency   => 5,
797         emit      => ". fstcw %AM",
798         mode      => "mode_M",
799         units     => [ "GP" ],
800 },
801
802 Cltd => {
803         # we should not rematrialize this node. It produces 2 results and has
804         # very strict constrains
805         comment   => "construct CDQ: sign extend EAX -> EDX:EAX",
806         reg_req   => { in => [ "gp" ], out => [ "eax in_r1", "edx" ] },
807         emit      => '. cltd',
808         outs      => [ "EAX", "EDX" ],
809         units     => [ "GP" ],
810 },
811
812 # Load / Store
813
814 Load => {
815         op_flags  => "L|F",
816         state     => "exc_pinned",
817         comment   => "construct Load: Load(ptr, mem) = LD ptr -> reg",
818         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
819         latency   => 3,
820         emit      => ". mov%SE%ME%.l %AM, %D1",
821         outs      => [ "res", "M" ],
822         units     => [ "GP" ],
823 },
824
825 l_Load => {
826         op_flags  => "L|F",
827         cmp_attr  => "return 1;",
828         comment   => "construct lowered Load: Load(ptr, mem) = LD ptr -> reg",
829         outs      => [ "res", "M" ],
830         arity     => 2,
831 },
832
833 l_Store => {
834         op_flags  => "L|F",
835         cmp_attr  => "return 1;",
836         state     => "exc_pinned",
837         comment   => "construct lowered Store: Store(ptr, val, mem) = ST ptr,val",
838         arity     => 3,
839         mode      => "mode_M",
840 },
841
842 Store => {
843         op_flags  => "L|F",
844         state     => "exc_pinned",
845         comment   => "construct Store: Store(ptr, val, mem) = ST ptr,val",
846         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "none" ] },
847         emit      => '. mov%M %binop',
848         latency   => 3,
849         units     => [ "GP" ],
850         mode      => "mode_M",
851 },
852
853 Store8Bit => {
854         op_flags  => "L|F",
855         state     => "exc_pinned",
856         comment   => "construct 8Bit Store: Store(ptr, val, mem) = ST ptr,val",
857         reg_req   => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => ["none" ] },
858         emit      => '. mov%M %binop',
859         latency   => 3,
860         units     => [ "GP" ],
861         mode      => "mode_M",
862 },
863
864 Lea => {
865         irn_flags => "R",
866         comment   => "construct Lea: Lea(a,b) = lea [a+b*const+offs] | res = a + b * const + offs with const = 0,1,2,4,8",
867         reg_req   => { in => [ "gp", "gp" ], out => [ "in_r1" ] },
868         emit      => '. leal %AM, %D1',
869         latency   => 2,
870         units     => [ "GP" ],
871         mode      => "mode_Iu",
872 },
873
874 Push => {
875         comment   => "push on the stack",
876         reg_req   => { in => [ "gp", "gp", "gp", "esp", "none" ], out => [ "esp", "none" ] },
877         emit      => '. pushl %unop',
878         outs      => [ "stack:I|S", "M" ],
879         latency   => 3,
880         units     => [ "GP" ],
881 },
882
883 Pop => {
884         comment   => "pop a gp register from the stack",
885         reg_req   => { in => [ "gp", "gp", "esp", "none" ], out => [ "esp", "gp", "none" ] },
886         emit      => '. popl %unop',
887         outs      => [ "stack:I|S", "res", "M" ],
888         latency   => 4,
889         units     => [ "GP" ],
890 },
891
892 Enter => {
893         comment   => "create stack frame",
894         reg_req   => { in => [ "esp" ], out => [ "ebp", "esp" ] },
895         emit      => '. enter',
896         outs      => [ "frame:I", "stack:I|S", "M" ],
897         latency   => 15,
898         units     => [ "GP" ],
899 },
900
901 Leave => {
902         comment   => "destroy stack frame",
903         reg_req   => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
904         emit      => '. leave',
905         outs      => [ "frame:I", "stack:I|S" ],
906         latency   => 3,
907         units     => [ "GP" ],
908 },
909
910 AddSP => {
911         irn_flags => "I",
912         comment   => "allocate space on stack",
913         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "none" ] },
914         emit      => '. addl %binop',
915         outs      => [ "stack:S", "M" ],
916         units     => [ "GP" ],
917 },
918
919 SubSP => {
920         irn_flags => "I",
921         comment   => "free space on stack",
922         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "none" ] },
923         emit      => '. subl %binop',
924         outs      => [ "stack:S", "M" ],
925         units     => [ "GP" ],
926 },
927
928 LdTls => {
929         irn_flags => "R",
930         comment   => "get the TLS base address",
931         reg_req   => { out => [ "gp" ] },
932         units     => [ "GP" ],
933 },
934
935
936
937 #-----------------------------------------------------------------------------#
938 #   _____ _____ ______    __ _             _                     _            #
939 #  / ____/ ____|  ____|  / _| |           | |                   | |           #
940 # | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
941 #  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
942 #  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
943 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
944 #-----------------------------------------------------------------------------#
945
946 # commutative operations
947
948 xAdd => {
949         irn_flags => "R",
950         comment   => "construct SSE Add: Add(a, b) = Add(b, a) = a + b",
951         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
952         emit      => '. add%XXM %binop',
953         latency   => 4,
954         units     => [ "SSE" ],
955         mode      => "mode_E",
956 },
957
958 xMul => {
959         irn_flags => "R",
960         comment   => "construct SSE Mul: Mul(a, b) = Mul(b, a) = a * b",
961         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
962         emit      => '. mul%XXM %binop',
963         latency   => 4,
964         units     => [ "SSE" ],
965         mode      => "mode_E",
966 },
967
968 xMax => {
969         irn_flags => "R",
970         comment   => "construct SSE Max: Max(a, b) = Max(b, a) = a > b ? a : b",
971         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
972         emit      => '. max%XXM %binop',
973         latency   => 2,
974         units     => [ "SSE" ],
975         mode      => "mode_E",
976 },
977
978 xMin => {
979         irn_flags => "R",
980         comment   => "construct SSE Min: Min(a, b) = Min(b, a) = a < b ? a : b",
981         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
982         emit      => '. min%XXM %binop',
983         latency   => 2,
984         units     => [ "SSE" ],
985         mode      => "mode_E",
986 },
987
988 xAnd => {
989         irn_flags => "R",
990         comment   => "construct SSE And: And(a, b) = a AND b",
991         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
992         emit      => '. andp%XSD %binop',
993         latency   => 3,
994         units     => [ "SSE" ],
995         mode      => "mode_E",
996 },
997
998 xOr => {
999         irn_flags => "R",
1000         comment   => "construct SSE Or: Or(a, b) = a OR b",
1001         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1002         emit      => '. orp%XSD %binop',
1003         units     => [ "SSE" ],
1004         mode      => "mode_E",
1005 },
1006
1007 xXor => {
1008         irn_flags => "R",
1009         comment   => "construct SSE Xor: Xor(a, b) = a XOR b",
1010         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1011         emit      => '. xorp%XSD %binop',
1012         latency   => 3,
1013         units     => [ "SSE" ],
1014         mode      => "mode_E",
1015 },
1016
1017 # not commutative operations
1018
1019 xAndNot => {
1020         irn_flags => "R",
1021         comment   => "construct SSE AndNot: AndNot(a, b) = a AND NOT b",
1022         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1023         emit      => '. andnp%XSD %binop',
1024         latency   => 3,
1025         units     => [ "SSE" ],
1026         mode      => "mode_E",
1027 },
1028
1029 xSub => {
1030         irn_flags => "R",
1031         comment   => "construct SSE Sub: Sub(a, b) = a - b",
1032         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1033         emit      => '. sub%XXM %binop',
1034         latency   => 4,
1035         units     => [ "SSE" ],
1036         mode      => "mode_E",
1037 },
1038
1039 xDiv => {
1040         irn_flags => "R",
1041         comment   => "construct SSE Div: Div(a, b) = a / b",
1042         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1043         outs      => [ "res", "M" ],
1044         emit      => '. div%XXM %binop',
1045         latency   => 16,
1046         units     => [ "SSE" ],
1047 },
1048
1049 # other operations
1050
1051 xCmp => {
1052         irn_flags => "R",
1053         comment   => "construct SSE Compare: Cmp(a, b) == a = a cmp b",
1054         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1055         latency   => 3,
1056         units     => [ "SSE" ],
1057         mode      => "mode_E",
1058 },
1059
1060 xCondJmp => {
1061         state     => "pinned",
1062         op_flags  => "L|X|Y",
1063         comment   => "construct conditional jump: UCOMIS A, B && JMPxx LABEL",
1064         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "none", "none" ] },
1065         outs      => [ "false", "true" ],
1066         latency   => 5,
1067         units     => [ "SSE" ],
1068 },
1069
1070 xConst => {
1071         op_flags  => "c",
1072         irn_flags => "R",
1073         comment   => "represents a SSE constant",
1074         reg_req   => { out => [ "xmm" ] },
1075         emit      => '. mov%XXM $%C, %D1',
1076         latency   => 2,
1077         units     => [ "SSE" ],
1078         mode      => "mode_E",
1079 },
1080
1081 # Load / Store
1082
1083 xLoad => {
1084         op_flags  => "L|F",
1085         state     => "exc_pinned",
1086         comment   => "construct SSE Load: Load(ptr, mem) = LD ptr",
1087         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1088         emit      => '. mov%XXM %AM, %D1',
1089         outs      => [ "res", "M" ],
1090         latency   => 2,
1091         units     => [ "SSE" ],
1092 },
1093
1094 xStore => {
1095         op_flags => "L|F",
1096         state    => "exc_pinned",
1097         comment  => "construct Store: Store(ptr, val, mem) = ST ptr,val",
1098         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1099         emit     => '. mov%XXM %binop',
1100         latency  => 2,
1101         units    => [ "SSE" ],
1102         mode     => "mode_M",
1103 },
1104
1105 xStoreSimple => {
1106         op_flags => "L|F",
1107         state    => "exc_pinned",
1108         comment  => "construct Store without index: Store(ptr, val, mem) = ST ptr,val",
1109         reg_req  => { in => [ "gp", "xmm", "none" ] },
1110         emit     => '. mov%XXM %S2, %AM',
1111         latency  => 2,
1112         units    => [ "SSE" ],
1113         mode     => "mode_M",
1114 },
1115
1116 l_X87toSSE => {
1117         op_flags => "L|F",
1118         comment  => "construct: transfer a value from x87 FPU into a SSE register",
1119         cmp_attr => "return 1;",
1120         arity    => 3,
1121 },
1122
1123 l_SSEtoX87 => {
1124         op_flags => "L|F",
1125         comment  => "construct: transfer a value from SSE register to x87 FPU",
1126         cmp_attr => "return 1;",
1127         arity    => 3,
1128 },
1129
1130 GetST0 => {
1131         op_flags => "L|F",
1132         irn_flags => "I",
1133         state    => "exc_pinned",
1134         comment  => "store ST0 onto stack",
1135         reg_req  => { in => [ "gp", "gp", "none" ] },
1136         emit     => '. fstp%XM %AM',
1137         latency  => 4,
1138         units    => [ "SSE" ],
1139         mode     => "mode_M",
1140 },
1141
1142 SetST0 => {
1143         op_flags => "L|F",
1144         irn_flags => "I",
1145         state    => "exc_pinned",
1146         comment  => "load ST0 from stack",
1147         reg_req  => { in => [ "gp", "none" ], out => [ "vf0", "none" ] },
1148         emit     => '. fld%M %AM',
1149         outs     => [ "res", "M" ],
1150         latency  => 2,
1151         units     => [ "SSE" ],
1152 },
1153
1154 # CopyB
1155
1156 CopyB => {
1157         op_flags => "F|H",
1158         state    => "pinned",
1159         comment  => "implements a memcopy: CopyB(dst, src, size, mem) == memcpy(dst, src, size)",
1160         reg_req  => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1161         outs     => [ "DST", "SRC", "CNT", "M" ],
1162         units     => [ "GP" ],
1163 },
1164
1165 CopyB_i => {
1166         op_flags => "F|H",
1167         state    => "pinned",
1168         comment  => "implements a memcopy: CopyB(dst, src, mem) == memcpy(dst, src, attr(size))",
1169         reg_req  => { in => [ "edi", "esi", "none" ], out => [  "edi", "esi", "none" ] },
1170         outs     => [ "DST", "SRC", "M" ],
1171         units     => [ "GP" ],
1172 },
1173
1174 # Conversions
1175
1176 Conv_I2I => {
1177         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3", "none" ] },
1178         comment  => "construct Conv Int -> Int",
1179         units     => [ "GP" ],
1180         mode     => "mode_Iu",
1181 },
1182
1183 Conv_I2I8Bit => {
1184         reg_req  => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => [ "in_r3", "none" ] },
1185         comment  => "construct Conv Int -> Int",
1186         units     => [ "GP" ],
1187         mode     => "mode_Iu",
1188 },
1189
1190 Conv_I2FP => {
1191         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1192         comment  => "construct Conv Int -> Floating Point",
1193         latency  => 10,
1194         units    => [ "SSE" ],
1195         mode     => "mode_E",
1196 },
1197
1198 Conv_FP2I => {
1199         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "gp", "none" ] },
1200         comment  => "construct Conv Floating Point -> Int",
1201         latency  => 10,
1202         units    => [ "SSE" ],
1203         mode     => "mode_Iu",
1204 },
1205
1206 Conv_FP2FP => {
1207         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "xmm", "none" ] },
1208         comment  => "construct Conv Floating Point -> Floating Point",
1209         latency  => 8,
1210         units    => [ "SSE" ],
1211         mode     => "mode_E",
1212 },
1213
1214 CmpCMov => {
1215         irn_flags => "R",
1216         comment   => "construct Conditional Move: CMov(sel, a, b) == sel ? a : b",
1217         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "in_r4" ] },
1218         latency   => 2,
1219         units     => [ "GP" ],
1220         mode      => "mode_Iu",
1221 },
1222
1223 PsiCondCMov => {
1224         irn_flags => "R",
1225         comment   => "check if Psi condition tree evaluates to true and move result accordingly",
1226         reg_req   => { in => [ "gp", "gp", "gp" ], out => [ "in_r3" ] },
1227         latency   => 2,
1228         units     => [ "GP" ],
1229         mode      => "mode_Iu",
1230 },
1231
1232 xCmpCMov => {
1233         irn_flags => "R",
1234         comment   => "construct Conditional Move: SSE Compare + int CMov ",
1235         reg_req   => { in => [ "xmm", "xmm", "gp", "gp" ], out => [ "in_r4" ] },
1236         latency   => 5,
1237         units     => [ "SSE" ],
1238         mode      => "mode_Iu",
1239 },
1240
1241 vfCmpCMov => {
1242         irn_flags => "R",
1243         comment   => "construct Conditional Move: x87 Compare + int CMov",
1244         reg_req   => { in => [ "vfp", "vfp", "gp", "gp" ], out => [ "in_r4" ] },
1245         latency   => 10,
1246         units     => [ "VFP" ],
1247         mode      => "mode_Iu",
1248 },
1249
1250 CmpSet => {
1251         irn_flags => "R",
1252         comment   => "construct Set: Set(sel) == sel ? 1 : 0",
1253         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1254         latency   => 2,
1255         units     => [ "GP" ],
1256         mode      => "mode_Iu",
1257 },
1258
1259 PsiCondSet => {
1260         irn_flags => "R",
1261         comment   => "check if Psi condition tree evaluates to true and set result accordingly",
1262         reg_req   => { in => [ "gp" ], out => [ "eax ebx ecx edx" ] },
1263         latency   => 2,
1264         units     => [ "GP" ],
1265         mode      => "mode_Iu",
1266 },
1267
1268 xCmpSet => {
1269         irn_flags => "R",
1270         comment   => "construct Set: SSE Compare + int Set",
1271         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "eax ebx ecx edx" ] },
1272         latency   => 5,
1273         units     => [ "SSE" ],
1274         mode      => "mode_Iu",
1275 },
1276
1277 vfCmpSet => {
1278         irn_flags => "R",
1279         comment   => "construct Set: x87 Compare + int Set",
1280         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "eax ebx ecx edx" ] },
1281         latency   => 10,
1282         units     => [ "VFP" ],
1283         mode      => "mode_Iu",
1284 },
1285
1286 vfCMov => {
1287         irn_flags => "R",
1288         comment   => "construct x87 Conditional Move: vfCMov(sel, a, b) = sel ? a : b",
1289         reg_req   => { in => [ "vfp", "vfp", "vfp", "vfp" ], out => [ "vfp" ] },
1290         latency   => 10,
1291         units     => [ "VFP" ],
1292         mode      => "mode_E",
1293 },
1294
1295 #----------------------------------------------------------#
1296 #        _      _               _    __ _             _    #
1297 #       (_)    | |             | |  / _| |           | |   #
1298 # __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
1299 # \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
1300 #  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
1301 #   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1302 #                 | |                                      #
1303 #  _ __   ___   __| | ___  ___                             #
1304 # | '_ \ / _ \ / _` |/ _ \/ __|                            #
1305 # | | | | (_) | (_| |  __/\__ \                            #
1306 # |_| |_|\___/ \__,_|\___||___/                            #
1307 #----------------------------------------------------------#
1308
1309 vfadd => {
1310         irn_flags => "R",
1311         comment   => "virtual fp Add: Add(a, b) = Add(b, a) = a + b",
1312         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1313         latency   => 4,
1314         units     => [ "VFP" ],
1315         mode      => "mode_E",
1316 },
1317
1318 vfmul => {
1319         irn_flags => "R",
1320         comment   => "virtual fp Mul: Mul(a, b) = Mul(b, a) = a * b",
1321         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1322         latency   => 4,
1323         units     => [ "VFP" ],
1324         mode      => "mode_E",
1325 },
1326
1327 l_vfmul => {
1328         op_flags  => "C",
1329         cmp_attr  => "return 1;",
1330         comment   => "lowered virtual fp Mul: Mul(a, b) = Mul(b, a) = a * b",
1331         arity     => 2,
1332 },
1333
1334 vfsub => {
1335         irn_flags => "R",
1336         comment   => "virtual fp Sub: Sub(a, b) = a - b",
1337         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1338         latency   => 4,
1339         units     => [ "VFP" ],
1340         mode      => "mode_E",
1341 },
1342
1343 l_vfsub => {
1344         cmp_attr  => "return 1;",
1345         comment   => "lowered virtual fp Sub: Sub(a, b) = a - b",
1346         arity     => 2,
1347 },
1348
1349 vfdiv => {
1350         comment   => "virtual fp Div: Div(a, b) = a / b",
1351         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1352         outs      => [ "res", "M" ],
1353         latency   => 20,
1354         units     => [ "VFP" ],
1355 },
1356
1357 l_vfdiv => {
1358         cmp_attr  => "return 1;",
1359         comment   => "lowered virtual fp Div: Div(a, b) = a / b",
1360         outs      => [ "res", "M" ],
1361         arity     => 2,
1362 },
1363
1364 vfprem => {
1365         comment   => "virtual fp Rem: Rem(a, b) = a - Q * b (Q is integer)",
1366         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "vfp" ] },
1367         latency   => 20,
1368         units     => [ "VFP" ],
1369         mode      => "mode_E",
1370 },
1371
1372 l_vfprem => {
1373         cmp_attr  => "return 1;",
1374         comment   => "lowered virtual fp Rem: Rem(a, b) = a - Q * b (Q is integer)",
1375         arity     => 2,
1376 },
1377
1378 vfabs => {
1379         irn_flags => "R",
1380         comment   => "virtual fp Abs: Abs(a) = |a|",
1381         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1382         latency   => 2,
1383         units     => [ "VFP" ],
1384         mode      => "mode_E",
1385 },
1386
1387 vfchs => {
1388         irn_flags => "R",
1389         comment   => "virtual fp Chs: Chs(a) = -a",
1390         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1391         latency   => 2,
1392         units     => [ "VFP" ],
1393         mode      => "mode_E",
1394 },
1395
1396 vfsin => {
1397         irn_flags => "R",
1398         comment   => "virtual fp Sin: Sin(a) = sin(a)",
1399         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1400         latency   => 150,
1401         units     => [ "VFP" ],
1402         mode      => "mode_E",
1403 },
1404
1405 vfcos => {
1406         irn_flags => "R",
1407         comment   => "virtual fp Cos: Cos(a) = cos(a)",
1408         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1409         latency   => 150,
1410         units     => [ "VFP" ],
1411         mode      => "mode_E",
1412 },
1413
1414 vfsqrt => {
1415         irn_flags => "R",
1416         comment   => "virtual fp Sqrt: Sqrt(a) = a ^ 0.5",
1417         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1418         latency   => 30,
1419         units     => [ "VFP" ],
1420         mode      => "mode_E",
1421 },
1422
1423 # virtual Load and Store
1424
1425 vfld => {
1426         op_flags  => "L|F",
1427         state     => "exc_pinned",
1428         comment   => "virtual fp Load: Load(ptr, mem) = LD ptr -> reg",
1429         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1430         outs      => [ "res", "M" ],
1431         latency   => 2,
1432         units     => [ "VFP" ],
1433 },
1434
1435 vfst => {
1436         op_flags  => "L|F",
1437         state     => "exc_pinned",
1438         comment   => "virtual fp Store: Store(ptr, val, mem) = ST ptr,val",
1439         reg_req   => { in => [ "gp", "gp", "vfp", "none" ] },
1440         latency   => 2,
1441         units     => [ "VFP" ],
1442         mode      => "mode_M",
1443 },
1444
1445 # Conversions
1446
1447 vfild => {
1448         comment   => "virtual fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1449         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1450         outs      => [ "res", "M" ],
1451         latency   => 4,
1452         units     => [ "VFP" ],
1453 },
1454
1455 l_vfild => {
1456         cmp_attr  => "return 1;",
1457         comment   => "lowered virtual fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1458         outs      => [ "res", "M" ],
1459         arity     => 2,
1460 },
1461
1462 vfist => {
1463         comment   => "virtual fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1464         reg_req   => { in => [ "gp", "gp", "vfp", "none" ] },
1465         latency   => 4,
1466         units     => [ "VFP" ],
1467         mode      => "mode_M",
1468 },
1469
1470 l_vfist => {
1471         cmp_attr  => "return 1;",
1472         comment   => "lowered virtual fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1473         arity     => 3,
1474         mode      => "mode_M",
1475 },
1476
1477
1478 # constants
1479
1480 vfldz => {
1481         irn_flags => "R",
1482         comment   => "virtual fp Load 0.0: Ld 0.0 -> reg",
1483         reg_req   => { out => [ "vfp" ] },
1484         latency   => 4,
1485         units     => [ "VFP" ],
1486         mode      => "mode_E",
1487 },
1488
1489 vfld1 => {
1490         irn_flags => "R",
1491         comment   => "virtual fp Load 1.0: Ld 1.0 -> reg",
1492         reg_req   => { out => [ "vfp" ] },
1493         latency   => 4,
1494         units     => [ "VFP" ],
1495         mode      => "mode_E",
1496 },
1497
1498 vfldpi => {
1499         irn_flags => "R",
1500         comment   => "virtual fp Load pi: Ld pi -> reg",
1501         reg_req   => { out => [ "vfp" ] },
1502         latency   => 4,
1503         units     => [ "VFP" ],
1504         mode      => "mode_E",
1505 },
1506
1507 vfldln2 => {
1508         irn_flags => "R",
1509         comment   => "virtual fp Load ln 2: Ld ln 2 -> reg",
1510         reg_req   => { out => [ "vfp" ] },
1511         latency   => 4,
1512         units     => [ "VFP" ],
1513         mode      => "mode_E",
1514 },
1515
1516 vfldlg2 => {
1517         irn_flags => "R",
1518         comment   => "virtual fp Load lg 2: Ld lg 2 -> reg",
1519         reg_req   => { out => [ "vfp" ] },
1520         latency   => 4,
1521         units     => [ "VFP" ],
1522         mode      => "mode_E",
1523 },
1524
1525 vfldl2t => {
1526         irn_flags => "R",
1527         comment   => "virtual fp Load ld 10: Ld ld 10 -> reg",
1528         reg_req   => { out => [ "vfp" ] },
1529         latency   => 4,
1530         units     => [ "VFP" ],
1531         mode      => "mode_E",
1532 },
1533
1534 vfldl2e => {
1535         irn_flags => "R",
1536         comment   => "virtual fp Load ld e: Ld ld e -> reg",
1537         reg_req   => { out => [ "vfp" ] },
1538         latency   => 4,
1539         units     => [ "VFP" ],
1540         mode      => "mode_E",
1541 },
1542
1543 vfConst => {
1544         op_flags  => "c",
1545         irn_flags => "R",
1546 #  init_attr => "  set_ia32_ls_mode(res, mode);",
1547         comment   => "represents a virtual floating point constant",
1548         reg_req   => { out => [ "vfp" ] },
1549         latency   => 3,
1550         units     => [ "VFP" ],
1551         mode      => "mode_E",
1552 },
1553
1554 # other
1555
1556 vfCondJmp => {
1557         state     => "pinned",
1558         op_flags  => "L|X|Y",
1559         comment   => "represents a virtual floating point compare",
1560         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "none", "none", "eax" ] },
1561         outs      => [ "false", "true", "temp_reg_eax" ],
1562         latency   => 10,
1563         units     => [ "VFP" ],
1564 },
1565
1566 #------------------------------------------------------------------------#
1567 #       ___ _____    __ _             _                     _            #
1568 # __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1569 # \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1570 #  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1571 # /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1572 #------------------------------------------------------------------------#
1573
1574 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1575 #       are swapped, we work this around in the emitter...
1576
1577 fadd => {
1578         op_flags  => "R",
1579         rd_constructor => "NONE",
1580         comment   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
1581         reg_req   => { },
1582         emit      => '. fadd%XM %x87_binop',
1583 },
1584
1585 faddp => {
1586         op_flags  => "R",
1587         rd_constructor => "NONE",
1588         comment   => "x87 Add: Add(a, b) = Add(b, a) = a + b",
1589         reg_req   => { },
1590         emit      => '. faddp %x87_binop',
1591 },
1592
1593 fmul => {
1594         op_flags  => "R",
1595         rd_constructor => "NONE",
1596         comment   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
1597         reg_req   => { },
1598         emit      => '. fmul%XM %x87_binop',
1599 },
1600
1601 fmulp => {
1602         op_flags  => "R",
1603         rd_constructor => "NONE",
1604         comment   => "x87 fp Mul: Mul(a, b) = Mul(b, a) = a + b",
1605         reg_req   => { },
1606         emit      => '. fmulp %x87_binop',,
1607 },
1608
1609 fsub => {
1610         op_flags  => "R",
1611         rd_constructor => "NONE",
1612         comment   => "x87 fp Sub: Sub(a, b) = a - b",
1613         reg_req   => { },
1614         emit      => '. fsub%XM %x87_binop',
1615 },
1616
1617 fsubp => {
1618         op_flags  => "R",
1619         rd_constructor => "NONE",
1620         comment   => "x87 fp Sub: Sub(a, b) = a - b",
1621         reg_req   => { },
1622 # see note about gas bugs
1623         emit      => '. fsubrp %x87_binop',
1624 },
1625
1626 fsubr => {
1627         op_flags  => "R",
1628         rd_constructor => "NONE",
1629         irn_flags => "R",
1630         comment   => "x87 fp SubR: SubR(a, b) = b - a",
1631         reg_req   => { },
1632         emit      => '. fsubr%XM %x87_binop',
1633 },
1634
1635 fsubrp => {
1636         op_flags  => "R",
1637         rd_constructor => "NONE",
1638         irn_flags => "R",
1639         comment   => "x87 fp SubR: SubR(a, b) = b - a",
1640         reg_req   => { },
1641 # see note about gas bugs
1642         emit      => '. fsubp %x87_binop',
1643 },
1644
1645 fprem => {
1646         op_flags  => "R",
1647         rd_constructor => "NONE",
1648         comment   => "x87 fp Rem: Rem(a, b) = a - Q * b (Q is integer)",
1649         reg_req   => { },
1650         emit      => '. fprem1',
1651 },
1652
1653 # this node is just here, to keep the simulator running
1654 # we can omit this when a fprem simulation function exists
1655 fpremp => {
1656         op_flags  => "R",
1657         rd_constructor => "NONE",
1658         comment   => "x87 fp Rem: Rem(a, b) = a - Q * b (Q is integer)",
1659         reg_req   => { },
1660         emit      => '. fprem1',
1661 },
1662
1663 fdiv => {
1664         op_flags  => "R",
1665         rd_constructor => "NONE",
1666         comment   => "x87 fp Div: Div(a, b) = a / b",
1667         reg_req   => { },
1668         emit      => '. fdiv%XM %x87_binop',
1669 },
1670
1671 fdivp => {
1672         op_flags  => "R",
1673         rd_constructor => "NONE",
1674         comment   => "x87 fp Div: Div(a, b) = a / b",
1675         reg_req   => { },
1676 # see note about gas bugs
1677         emit      => '. fdivrp %x87_binop',
1678 },
1679
1680 fdivr => {
1681         op_flags  => "R",
1682         rd_constructor => "NONE",
1683         comment   => "x87 fp DivR: DivR(a, b) = b / a",
1684         reg_req   => { },
1685         emit      => '. fdivr%XM %x87_binop',
1686 },
1687
1688 fdivrp => {
1689         op_flags  => "R",
1690         rd_constructor => "NONE",
1691         comment   => "x87 fp DivR: DivR(a, b) = b / a",
1692         reg_req   => { },
1693 # see note about gas bugs
1694         emit      => '. fdivp %x87_binop',
1695 },
1696
1697 fabs => {
1698         op_flags  => "R",
1699         rd_constructor => "NONE",
1700         comment   => "x87 fp Abs: Abs(a) = |a|",
1701         reg_req   => { },
1702         emit      => '. fabs',
1703 },
1704
1705 fchs => {
1706         op_flags  => "R",
1707         rd_constructor => "NONE",
1708         comment   => "x87 fp Chs: Chs(a) = -a",
1709         reg_req   => { },
1710         emit      => '. fchs',
1711 },
1712
1713 fsin => {
1714         op_flags  => "R",
1715         rd_constructor => "NONE",
1716         comment   => "x87 fp Sin: Sin(a) = sin(a)",
1717         reg_req   => { },
1718         emit      => '. fsin',
1719 },
1720
1721 fcos => {
1722         op_flags  => "R",
1723         rd_constructor => "NONE",
1724         comment   => "x87 fp Cos: Cos(a) = cos(a)",
1725         reg_req   => { },
1726         emit      => '. fcos',
1727 },
1728
1729 fsqrt => {
1730         op_flags  => "R",
1731         rd_constructor => "NONE",
1732         comment   => "x87 fp Sqrt: Sqrt(a) = a ^ 0.5",
1733         reg_req   => { },
1734         emit      => '. fsqrt $',
1735 },
1736
1737 # x87 Load and Store
1738
1739 fld => {
1740         rd_constructor => "NONE",
1741         op_flags  => "R|L|F",
1742         state     => "exc_pinned",
1743         comment   => "x87 fp Load: Load(ptr, mem) = LD ptr -> reg",
1744         reg_req   => { },
1745         emit      => '. fld%XM %AM',
1746 },
1747
1748 fst => {
1749         rd_constructor => "NONE",
1750         op_flags  => "R|L|F",
1751         state     => "exc_pinned",
1752         comment   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
1753         reg_req   => { },
1754         emit      => '. fst%XM %AM',
1755         mode      => "mode_M",
1756 },
1757
1758 fstp => {
1759         rd_constructor => "NONE",
1760         op_flags  => "R|L|F",
1761         state     => "exc_pinned",
1762         comment   => "x87 fp Store: Store(ptr, val, mem) = ST ptr,val",
1763         reg_req   => { },
1764         emit      => '. fstp%XM %AM',
1765         mode      => "mode_M",
1766 },
1767
1768 # Conversions
1769
1770 fild => {
1771         op_flags  => "R",
1772         rd_constructor => "NONE",
1773         comment   => "x87 fp integer Load: Load(ptr, mem) = iLD ptr -> reg",
1774         reg_req   => { },
1775         emit      => '. fild%XM %AM',
1776 },
1777
1778 fist => {
1779         op_flags  => "R",
1780         rd_constructor => "NONE",
1781         comment   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1782         reg_req   => { },
1783         emit      => '. fist%M %AM',
1784         mode      => "mode_M",
1785 },
1786
1787 fistp => {
1788         op_flags  => "R",
1789         rd_constructor => "NONE",
1790         comment   => "x87 fp integer Store: Store(ptr, val, mem) = iST ptr,val",
1791         reg_req   => { },
1792         emit      => '. fistp%M %AM',
1793         mode      => "mode_M",
1794 },
1795
1796 # constants
1797
1798 fldz => {
1799         op_flags  => "R|c",
1800         irn_flags  => "R",
1801         comment   => "x87 fp Load 0.0: Ld 0.0 -> reg",
1802         reg_req   => { },
1803         emit      => '. fldz',
1804 },
1805
1806 fld1 => {
1807         op_flags  => "R|c",
1808         irn_flags  => "R",
1809         comment   => "x87 fp Load 1.0: Ld 1.0 -> reg",
1810         reg_req   => { },
1811         emit      => '. fld1',
1812 },
1813
1814 fldpi => {
1815         op_flags  => "R|c",
1816         irn_flags  => "R",
1817         comment   => "x87 fp Load pi: Ld pi -> reg",
1818         reg_req   => { },
1819         emit      => '. fldpi',
1820 },
1821
1822 fldln2 => {
1823         op_flags  => "R|c",
1824         irn_flags  => "R",
1825         comment   => "x87 fp Load ln 2: Ld ln 2 -> reg",
1826         reg_req   => { },
1827         emit      => '. fldln2',
1828 },
1829
1830 fldlg2 => {
1831         op_flags  => "R|c",
1832         irn_flags  => "R",
1833         comment   => "x87 fp Load lg 2: Ld lg 2 -> reg",
1834         reg_req   => { },
1835         emit      => '. fldlg2',
1836 },
1837
1838 fldl2t => {
1839         op_flags  => "R|c",
1840         irn_flags  => "R",
1841         comment   => "x87 fp Load ld 10: Ld ld 10 -> reg",
1842         reg_req   => { },
1843         emit      => '. fldll2t',
1844 },
1845
1846 fldl2e => {
1847         op_flags  => "R|c",
1848         irn_flags  => "R",
1849         comment   => "x87 fp Load ld e: Ld ld e -> reg",
1850         reg_req   => { },
1851         emit      => '. fldl2e',
1852 },
1853
1854 # fxch, fpush, fpop
1855 # Note that it is NEVER allowed to do CSE on these nodes
1856 # Moreover, note the virtual register requierements!
1857
1858 fxch => {
1859         op_flags  => "R|K",
1860         comment   => "x87 stack exchange",
1861         reg_req   => { },
1862         cmp_attr  => "return 1;",
1863         emit      => '. fxch %X1',
1864 },
1865
1866 fpush => {
1867         op_flags  => "R|K",
1868         comment   => "x87 stack push",
1869         reg_req   => {},
1870         cmp_attr  => "return 1;",
1871         emit      => '. fld %X1',
1872 },
1873
1874 fpushCopy => {
1875         op_flags  => "R",
1876         comment   => "x87 stack push",
1877         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1878         cmp_attr  => "return 1;",
1879         emit      => '. fld %X1',
1880 },
1881
1882 fpop => {
1883         op_flags  => "R|K",
1884         comment   => "x87 stack pop",
1885         reg_req   => { },
1886         cmp_attr  => "return 1;",
1887         emit      => '. fstp %X1',
1888 },
1889
1890 # compare
1891
1892 fcomJmp => {
1893         op_flags  => "L|X|Y",
1894         comment   => "floating point compare",
1895         reg_req   => { },
1896 },
1897
1898 fcompJmp => {
1899         op_flags  => "L|X|Y",
1900         comment   => "floating point compare and pop",
1901         reg_req   => { },
1902 },
1903
1904 fcomppJmp => {
1905         op_flags  => "L|X|Y",
1906         comment   => "floating point compare and pop twice",
1907         reg_req   => { },
1908 },
1909
1910 fcomrJmp => {
1911         op_flags  => "L|X|Y",
1912         comment   => "floating point compare reverse",
1913         reg_req   => { },
1914 },
1915
1916 fcomrpJmp => {
1917         op_flags  => "L|X|Y",
1918         comment   => "floating point compare reverse and pop",
1919         reg_req   => { },
1920 },
1921
1922 fcomrppJmp => {
1923         op_flags  => "L|X|Y",
1924         comment   => "floating point compare reverse and pop twice",
1925         reg_req   => { },
1926 },
1927
1928
1929 # -------------------------------------------------------------------------------- #
1930 #  ____ ____  _____                  _                               _             #
1931 # / ___/ ___|| ____| __   _____  ___| |_ ___  _ __   _ __   ___   __| | ___  ___   #
1932 # \___ \___ \|  _|   \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __|  #
1933 #  ___) |__) | |___   \ V /  __/ (__| || (_) | |    | | | | (_) | (_| |  __/\__ \  #
1934 # |____/____/|_____|   \_/ \___|\___|\__\___/|_|    |_| |_|\___/ \__,_|\___||___/  #
1935 #                                                                                  #
1936 # -------------------------------------------------------------------------------- #
1937
1938
1939 # Spilling and reloading of SSE registers, hardcoded, not generated #
1940
1941 xxLoad => {
1942         op_flags  => "L|F",
1943         state     => "exc_pinned",
1944         comment   => "construct SSE Load: Load(ptr, mem) = LD ptr",
1945         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1946         emit      => '. movdqu %D1, %AM',
1947         outs      => [ "res", "M" ],
1948         units     => [ "SSE" ],
1949 },
1950
1951 xxStore => {
1952         op_flags => "L|F",
1953         state    => "exc_pinned",
1954         comment  => "construct Store: Store(ptr, val, mem) = ST ptr,val",
1955         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1956         emit     => '. movdqu %binop',
1957         units    => [ "SSE" ],
1958         mode     => "mode_M",
1959 },
1960
1961 ); # end of %nodes
1962
1963 # Include the generated SIMD node specification written by the SIMD optimization
1964 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
1965 unless ($return = do $my_script_name) {
1966         warn "couldn't parse $my_script_name: $@" if $@;
1967         warn "couldn't do $my_script_name: $!"    unless defined $return;
1968         warn "couldn't run $my_script_name"       unless $return;
1969 }