0196a9f95e7a6397c845d7fcd3f3c9d1b1bb91aa
[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 my $myname = $0;
8
9 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
10 $arch = "ia32";
11
12 # The node description is done as a perl hash initializer with the
13 # following structure:
14 #
15 # %nodes = (
16 #
17 # <op-name> => {
18 #   op_flags  => "N|L|C|X|I|F|Y|H|c|K|n",
19 #   irn_flags => "R|N"
20 #   arity     => "0|1|2|3 ... |variable|dynamic|any",
21 #   state     => "floats|pinned|mem_pinned|exc_pinned",
22 #   args      => [
23 #                    { type => "type 1", name => "name 1" },
24 #                    { type => "type 2", name => "name 2" },
25 #                    ...
26 #                  ],
27 #   comment   => "any comment for constructor",
28 #   reg_req   => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
29 #   cmp_attr  => "c source code for comparing node attributes",
30 #   outs      => { "out1", "out2" } # optional, creates pn_op_out1, ... consts
31 #   ins       => { "in1", "in2" }   # optional, creates n_op_in1, ... consts
32 #   mode      => "mode_Iu"          # optional, predefines the mode
33 #   emit      => "emit code with templates",
34 #   attr      => "additional attribute arguments for constructor",
35 #   init_attr => "emit attribute initialization template",
36 #   hash_func => "name of the hash function for this operation",
37 #   latency   => "latency of this operation (can be float)"
38 #   attr_type => "name of the attribute struct",
39 #   modified_flags =>  [ "CF", ... ] # optional, list of modified flags
40 # },
41 #
42 # ... # (all nodes you need to describe)
43 #
44 # ); # close the %nodes initializer
45
46 # op_flags: flags for the operation, OPTIONAL (default is "N")
47 # the op_flags correspond to the firm irop_flags:
48 #   N   irop_flag_none
49 #   L   irop_flag_labeled
50 #   C   irop_flag_commutative
51 #   X   irop_flag_cfopcode
52 #   I   irop_flag_ip_cfopcode
53 #   F   irop_flag_fragile
54 #   Y   irop_flag_forking
55 #   H   irop_flag_highlevel
56 #   c   irop_flag_constlike
57 #   K   irop_flag_keep
58 #   NB  irop_flag_dump_noblock
59 #   NI  irop_flag_dump_noinput
60 #
61 # irn_flags: special node flags, OPTIONAL (default is 0)
62 # following irn_flags are supported:
63 #   R   rematerializeable
64 #   N   not spillable
65 #
66 # state: state of the operation, OPTIONAL (default is "floats")
67 #
68 # arity: arity of the operation, MUST NOT BE OMITTED
69 #
70 # args:  the OPTIONAL arguments of the node constructor (debug, irg and block
71 #        are always the first 3 arguments and are always autmatically
72 #        created)
73 #        If this key is missing the following arguments will be created:
74 #        for i = 1 .. arity: ir_node *op_i
75 #        ir_mode *mode
76 #
77 # outs:  if a node defines more than one output, the names of the projections
78 #        nodes having outs having automatically the mode mode_T
79 #        example: [ "frame", "stack", "M" ]
80 #
81 # comment: OPTIONAL comment for the node constructor
82 #
83 # rd_constructor: for every operation there will be a
84 #      new_rd_<arch>_<op-name> function with the arguments from above
85 #      which creates the ir_node corresponding to the defined operation
86 #      you can either put the complete source code of this function here
87 #
88 #      This key is OPTIONAL. If omitted, the following constructor will
89 #      be created:
90 #      if (!op_<arch>_<op-name>) assert(0);
91 #      for i = 1 to arity
92 #         set in[i] = op_i
93 #      done
94 #      res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
95 #      return res
96 #
97 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
98 #
99
100 # register types:
101 #   0 - no special type
102 #   1 - caller save (register must be saved by the caller of a function)
103 #   2 - callee save (register must be saved by the called function)
104 #   4 - ignore (do not automatically assign this register)
105 #   8 - emitter can choose an arbitrary register of this class
106 #  16 - the register is a virtual one
107 #  32 - register represents a state
108 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
109 %reg_classes = (
110         gp => [
111                 { name => "edx", type => 1 },
112                 { name => "ecx", type => 1 },
113                 { name => "eax", type => 1 },
114                 { name => "ebx", type => 2 },
115                 { name => "esi", type => 2 },
116                 { name => "edi", type => 2 },
117                 { name => "ebp", type => 2 },
118                 { name => "esp", type => 4 },
119                 { name => "gp_NOREG", type => 4 | 8 | 16 }, # we need a dummy register for NoReg nodes
120                 { name => "gp_UKNWN", type => 4 | 8 | 16 },  # we need a dummy register for Unknown nodes
121                 { mode => "mode_Iu" }
122         ],
123         mmx => [
124                 { name => "mm0", type => 4 },
125                 { name => "mm1", type => 4 },
126                 { name => "mm2", type => 4 },
127                 { name => "mm3", type => 4 },
128                 { name => "mm4", type => 4 },
129                 { name => "mm5", type => 4 },
130                 { name => "mm6", type => 4 },
131                 { name => "mm7", type => 4 },
132                 { mode => "mode_E", flags => "manual_ra" }
133         ],
134         xmm => [
135                 { name => "xmm0", type => 1 },
136                 { name => "xmm1", type => 1 },
137                 { name => "xmm2", type => 1 },
138                 { name => "xmm3", type => 1 },
139                 { name => "xmm4", type => 1 },
140                 { name => "xmm5", type => 1 },
141                 { name => "xmm6", type => 1 },
142                 { name => "xmm7", type => 1 },
143                 { name => "xmm_NOREG", type => 4 | 16 },     # we need a dummy register for NoReg nodes
144                 { name => "xmm_UKNWN", type => 4 | 8 | 16},  # we need a dummy register for Unknown nodes
145                 { mode => "mode_E" }
146         ],
147         vfp => [
148                 { name => "vf0", type => 1 },
149                 { name => "vf1", type => 1 },
150                 { name => "vf2", type => 1 },
151                 { name => "vf3", type => 1 },
152                 { name => "vf4", type => 1 },
153                 { name => "vf5", type => 1 },
154                 { name => "vf6", type => 1 },
155                 { name => "vf7", type => 1 },
156                 { name => "vfp_NOREG", type => 4 | 8 | 16 }, # we need a dummy register for NoReg nodes
157                 { name => "vfp_UKNWN", type => 4 | 8 | 16 },  # we need a dummy register for Unknown nodes
158                 { mode => "mode_E" }
159         ],
160         st => [
161                 { name => "st0", realname => "st",    type => 4 },
162                 { name => "st1", realname => "st(1)", type => 4 },
163                 { name => "st2", realname => "st(2)", type => 4 },
164                 { name => "st3", realname => "st(3)", type => 4 },
165                 { name => "st4", realname => "st(4)", type => 4 },
166                 { name => "st5", realname => "st(5)", type => 4 },
167                 { name => "st6", realname => "st(6)", type => 4 },
168                 { name => "st7", realname => "st(7)", type => 4 },
169                 { mode => "mode_E", flags => "manual_ra" }
170         ],
171         fp_cw => [      # the floating point control word
172                 { name => "fpcw", type => 4|32 },
173                 { mode => "mode_fpcw", flags => "manual_ra|state" }
174         ],
175         flags => [
176                 { name => "eflags", type => 0 },
177                 { mode => "mode_Iu", flags => "manual_ra" }
178         ],
179 ); # %reg_classes
180
181 %cpu = (
182         GP     => [ 1, "GP_EAX", "GP_EBX", "GP_ECX", "GP_EDX", "GP_ESI", "GP_EDI", "GP_EBP" ],
183         SSE    => [ 1, "SSE_XMM0", "SSE_XMM1", "SSE_XMM2", "SSE_XMM3", "SSE_XMM4", "SSE_XMM5", "SSE_XMM6", "SSE_XMM7" ],
184         VFP    => [ 1, "VFP_VF0", "VFP_VF1", "VFP_VF2", "VFP_VF3", "VFP_VF4", "VFP_VF5", "VFP_VF6", "VFP_VF7" ],
185         BRANCH => [ 1, "BRANCH1", "BRANCH2" ],
186 ); # %cpu
187
188 %vliw = (
189         bundle_size       => 1,
190         bundels_per_cycle => 1
191 ); # vliw
192
193 %emit_templates = (
194         S0 => "${arch}_emit_source_register(node, 0);",
195         S1 => "${arch}_emit_source_register(node, 1);",
196         S2 => "${arch}_emit_source_register(node, 2);",
197         S3 => "${arch}_emit_source_register(node, 3);",
198         SB0 => "${arch}_emit_8bit_source_register_or_immediate(node, 0);",
199         SB1 => "${arch}_emit_8bit_source_register_or_immediate(node, 1);",
200         SB2 => "${arch}_emit_8bit_source_register_or_immediate(node, 2);",
201         SB3 => "${arch}_emit_8bit_source_register_or_immediate(node, 3);",
202         SH0 => "${arch}_emit_8bit_high_source_register(node, 0);",
203         SS0 => "${arch}_emit_16bit_source_register_or_immediate(node, 0);",
204         SI0 => "${arch}_emit_source_register_or_immediate(node, 0);",
205         SI1 => "${arch}_emit_source_register_or_immediate(node, 1);",
206         SI3 => "${arch}_emit_source_register_or_immediate(node, 3);",
207         D0 => "${arch}_emit_dest_register(node, 0);",
208         D1 => "${arch}_emit_dest_register(node, 1);",
209         DS0 => "${arch}_emit_dest_register_size(node, 0);",
210         DB0 => "${arch}_emit_8bit_dest_register(node, 0);",
211         X0 => "${arch}_emit_x87_register(node, 0);",
212         X1 => "${arch}_emit_x87_register(node, 1);",
213         EX => "${arch}_emit_extend_suffix(node);",
214         M  => "${arch}_emit_mode_suffix(node);",
215         XM => "${arch}_emit_x87_mode_suffix(node);",
216         XXM => "${arch}_emit_xmm_mode_suffix(node);",
217         XSD => "${arch}_emit_xmm_mode_suffix_s(node);",
218         AM => "${arch}_emit_am(node);",
219         unop3 => "${arch}_emit_unop(node, n_ia32_unary_op);",
220         unop4 => "${arch}_emit_unop(node, n_ia32_binary_right);",
221         binop => "${arch}_emit_binop(node);",
222         x87_binop => "${arch}_emit_x87_binop(node);",
223         CMP0  => "${arch}_emit_cmp_suffix_node(node, 0);",
224         CMP3  => "${arch}_emit_cmp_suffix_node(node, 3);",
225 );
226
227
228
229
230 $default_op_attr_type = "ia32_op_attr_t";
231 $default_attr_type    = "ia32_attr_t";
232 $default_copy_attr    = "ia32_copy_attr";
233
234 sub ia32_custom_init_attr {
235         my $constr = shift;
236         my $node   = shift;
237         my $name   = shift;
238         my $res    = "";
239
240         if(defined($node->{modified_flags})) {
241                 $res .= "\tarch_irn_add_flags(res, arch_irn_flags_modify_flags);\n";
242         }
243         if(defined($node->{am})) {
244                 my $am = $node->{am};
245                 if($am eq "source,unary") {
246                         $res .= "\tset_ia32_am_support(res, ia32_am_unary);";
247                 } elsif($am eq "source,binary") {
248                         $res .= "\tset_ia32_am_support(res, ia32_am_binary);";
249                 } elsif($am eq "none") {
250                         # nothing to do
251                 } else {
252                         die("Invalid address mode '$am' specified on op $name");
253                 }
254                 if($am ne "none") {
255                         if($node->{state} ne "exc_pinned"
256                                         and $node->{state} ne "pinned") {
257                                 die("AM nodes must have pinned or AM pinned state ($name)");
258                         }
259                 }
260         }
261         return $res;
262 }
263 $custom_init_attr_func = \&ia32_custom_init_attr;
264
265 %init_attr = (
266         ia32_asm_attr_t =>
267                 "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
268                 "\tinit_ia32_x87_attributes(res);".
269                 "\tinit_ia32_asm_attributes(res);",
270         ia32_attr_t     =>
271                 "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);",
272         ia32_call_attr_t =>
273                 "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
274                 "\tinit_ia32_call_attributes(res, pop, call_tp);",
275         ia32_condcode_attr_t =>
276                 "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
277                 "\tinit_ia32_condcode_attributes(res, pnc);",
278         ia32_copyb_attr_t =>
279                 "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
280                 "\tinit_ia32_copyb_attributes(res, size);",
281         ia32_immediate_attr_t =>
282                 "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
283                 "\tinit_ia32_immediate_attributes(res, symconst, symconst_sign, no_pic_adjust, offset);",
284         ia32_x87_attr_t =>
285                 "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
286                 "\tinit_ia32_x87_attributes(res);",
287         ia32_climbframe_attr_t =>
288                 "\tinit_ia32_attributes(res, flags, in_reqs, exec_units, n_res);\n".
289                 "\tinit_ia32_climbframe_attributes(res, count);",
290 );
291
292 %compare_attr = (
293         ia32_asm_attr_t       => "ia32_compare_asm_attr",
294         ia32_attr_t            => "ia32_compare_nodes_attr",
295         ia32_call_attr_t       => "ia32_compare_call_attr",
296         ia32_condcode_attr_t   => "ia32_compare_condcode_attr",
297         ia32_copyb_attr_t      => "ia32_compare_copyb_attr",
298         ia32_immediate_attr_t  => "ia32_compare_immediate_attr",
299         ia32_x87_attr_t        => "ia32_compare_x87_attr",
300         ia32_climbframe_attr_t => "ia32_compare_climbframe_attr",
301 );
302
303 %operands = (
304 );
305
306 $mode_xmm           = "mode_E";
307 $mode_gp            = "mode_Iu";
308 $mode_flags         = "mode_Iu";
309 $mode_fpcw          = "mode_fpcw";
310 $status_flags       = [ "CF", "PF", "AF", "ZF", "SF", "OF" ];
311 $status_flags_wo_cf = [       "PF", "AF", "ZF", "SF", "OF" ];
312 $fpcw_flags         = [ "FP_IM", "FP_DM", "FP_ZM", "FP_OM", "FP_UM", "FP_PM",
313                         "FP_PC0", "FP_PC1", "FP_RC0", "FP_RC1", "FP_X" ];
314
315 %nodes = (
316
317 Immediate => {
318         state     => "pinned",
319         op_flags  => "c",
320         reg_req   => { out => [ "gp_NOREG:I" ] },
321         attr      => "ir_entity *symconst, int symconst_sign, int no_pic_adjust, long offset",
322         attr_type => "ia32_immediate_attr_t",
323         hash_func => "ia32_hash_Immediate",
324         latency   => 0,
325         mode      => $mode_gp,
326 },
327
328 Asm => {
329         mode      => "mode_T",
330         arity     => "variable",
331         out_arity => "variable",
332         attr_type => "ia32_asm_attr_t",
333         attr      => "ident *asm_text, const ia32_asm_reg_t *register_map",
334         init_attr => "attr->asm_text = asm_text;\n".
335                      "\tattr->register_map = register_map;\n",
336         latency   => 10,
337         modified_flags => $status_flags,
338 },
339
340 # "allocates" a free register
341 ProduceVal => {
342         op_flags  => "c|n",
343         irn_flags => "R",
344         reg_req   => { out => [ "gp" ] },
345         emit      => "",
346         units     => [ ],
347         latency   => 0,
348         mode      => $mode_gp,
349         cmp_attr  => "return 1;",
350 },
351
352 Add => {
353         irn_flags => "R",
354         state     => "exc_pinned",
355         reg_req   => { in  => [ "gp", "gp", "none", "gp", "gp" ],
356                        out => [ "in_r4 in_r5", "flags", "none" ] },
357         ins       => [ "base", "index", "mem", "left", "right" ],
358         outs      => [ "res", "flags", "M" ],
359         emit      => '. add%M %binop',
360         am        => "source,binary",
361         units     => [ "GP" ],
362         latency   => 1,
363         mode      => $mode_gp,
364         modified_flags => $status_flags
365 },
366
367 AddMem => {
368         irn_flags => "R",
369         state     => "exc_pinned",
370         reg_req   => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
371         ins       => [ "base", "index", "mem", "val" ],
372         emit      => ". add%M %SI3, %AM",
373         units     => [ "GP" ],
374         latency   => 1,
375         mode      => "mode_M",
376         modified_flags => $status_flags
377 },
378
379 AddMem8Bit => {
380         irn_flags => "R",
381         state     => "exc_pinned",
382         reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
383         ins       => [ "base", "index", "mem", "val" ],
384         emit      => ". add%M %SB3, %AM",
385         units     => [ "GP" ],
386         latency   => 1,
387         mode      => "mode_M",
388         modified_flags => $status_flags
389 },
390
391 Adc => {
392         state     => "exc_pinned",
393         reg_req   => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ],
394                        out => [ "in_r4 in_r5", "flags", "none" ] },
395         ins       => [ "base", "index", "mem", "left", "right", "eflags" ],
396         outs      => [ "res", "flags", "M" ],
397         emit      => '. adc%M %binop',
398         am        => "source,binary",
399         units     => [ "GP" ],
400         latency   => 1,
401         mode      => $mode_gp,
402         modified_flags => $status_flags
403 },
404
405 l_Add => {
406         op_flags  => "C",
407         reg_req   => { in => [ "none", "none" ], out => [ "none" ] },
408         ins       => [ "left", "right" ],
409 },
410
411 l_Adc => {
412         reg_req   => { in => [ "none", "none", "none" ], out => [ "none" ] },
413         ins       => [ "left", "right", "eflags" ],
414 },
415
416 Mul => {
417         # we should not rematrialize this node. It produces 2 results and has
418         # very strict constraints
419         state     => "exc_pinned",
420         reg_req   => { in => [ "gp", "gp", "none", "eax", "gp" ],
421                        out => [ "eax", "flags", "none", "edx" ] },
422         ins       => [ "base", "index", "mem", "left", "right" ],
423         emit      => '. mul%M %unop4',
424         outs      => [ "res_low", "flags", "M", "res_high" ],
425         am        => "source,binary",
426         latency   => 10,
427         units     => [ "GP" ],
428         modified_flags => $status_flags
429 },
430
431 l_Mul => {
432         # we should not rematrialize this node. It produces 2 results and has
433         # very strict constraints
434         op_flags  => "C",
435         cmp_attr  => "return 1;",
436         reg_req   => { in => [ "none", "none" ],
437                        out => [ "none", "none", "none", "none" ] },
438         ins       => [ "left", "right" ],
439         outs      => [ "res_low", "flags", "M", "res_high" ],
440 },
441
442 IMul => {
443         irn_flags => "R",
444         state     => "exc_pinned",
445         # TODO: adjust out requirements for the 3 operand form
446         # (no need for should_be_same then)
447         reg_req   => { in => [ "gp", "gp", "none", "gp", "gp" ],
448                            out => [ "in_r4 in_r5", "flags", "none" ] },
449         ins       => [ "base", "index", "mem", "left", "right" ],
450         outs      => [ "res", "flags", "M" ],
451         am        => "source,binary",
452         latency   => 5,
453         units     => [ "GP" ],
454         mode      => $mode_gp,
455         modified_flags => $status_flags
456 },
457
458 IMul1OP => {
459         irn_flags => "R",
460         state     => "exc_pinned",
461         reg_req   => { in => [ "gp", "gp", "none", "eax", "gp" ],
462                        out => [ "eax", "flags", "none", "edx" ] },
463         ins       => [ "base", "index", "mem", "left", "right" ],
464         emit      => '. imul%M %unop4',
465         outs      => [ "res_low", "flags", "M", "res_high" ],
466         am        => "source,binary",
467         latency   => 5,
468         units     => [ "GP" ],
469         modified_flags => $status_flags
470 },
471
472 l_IMul => {
473         op_flags  => "C",
474         cmp_attr  => "return 1;",
475         reg_req   => { in => [ "none", "none" ],
476                        out => [ "none", "none", "none", "none" ] },
477         ins       => [ "left", "right" ],
478         outs      => [ "res_low", "flags", "M", "res_high" ],
479 },
480
481 And => {
482         irn_flags => "R",
483         state     => "exc_pinned",
484         reg_req   => { in => [ "gp", "gp", "none", "gp", "gp" ],
485                            out => [ "in_r4 in_r5", "flags", "none" ] },
486         ins       => [ "base", "index", "mem", "left", "right" ],
487         outs      => [ "res", "flags", "M" ],
488         am        => "source,binary",
489         emit      => '. and%M %binop',
490         units     => [ "GP" ],
491         latency   => 1,
492         mode      => $mode_gp,
493         modified_flags => $status_flags
494 },
495
496 AndMem => {
497         irn_flags => "R",
498         state     => "exc_pinned",
499         reg_req   => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
500         ins       => [ "base", "index", "mem", "val" ],
501         emit      => '. and%M %SI3, %AM',
502         units     => [ "GP" ],
503         latency   => 1,
504         mode      => "mode_M",
505         modified_flags => $status_flags
506 },
507
508 AndMem8Bit => {
509         irn_flags => "R",
510         state     => "exc_pinned",
511         reg_req   => { in => [ "gp", "gp", "none",  "eax ebx ecx edx" ], out => [ "none" ] },
512         ins       => [ "base", "index", "mem", "val" ],
513         emit      => '. and%M %SB3, %AM',
514         units     => [ "GP" ],
515         latency   => 1,
516         mode      => "mode_M",
517         modified_flags => $status_flags
518 },
519
520 Or => {
521         irn_flags => "R",
522         state     => "exc_pinned",
523         reg_req   => { in => [ "gp", "gp", "none", "gp", "gp" ],
524                        out => [ "in_r4 in_r5", "flags", "none" ] },
525         ins       => [ "base", "index", "mem", "left", "right" ],
526         outs      => [ "res", "flags", "M" ],
527         am        => "source,binary",
528         emit      => '. or%M %binop',
529         units     => [ "GP" ],
530         latency   => 1,
531         mode      => $mode_gp,
532         modified_flags => $status_flags
533 },
534
535 OrMem => {
536         irn_flags => "R",
537         state     => "exc_pinned",
538         reg_req   => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
539         ins       => [ "base", "index", "mem", "val" ],
540         emit      => '. or%M %SI3, %AM',
541         units     => [ "GP" ],
542         latency   => 1,
543         mode      => "mode_M",
544         modified_flags => $status_flags
545 },
546
547 OrMem8Bit => {
548         irn_flags => "R",
549         state     => "exc_pinned",
550         reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
551         ins       => [ "base", "index", "mem", "val" ],
552         emit      => '. or%M %SB3, %AM',
553         units     => [ "GP" ],
554         latency   => 1,
555         mode      => "mode_M",
556         modified_flags => $status_flags
557 },
558
559 Xor => {
560         irn_flags => "R",
561         state     => "exc_pinned",
562         reg_req   => { in => [ "gp", "gp", "none", "gp", "gp" ],
563                        out => [ "in_r4 in_r5", "flags", "none" ] },
564         ins       => [ "base", "index", "mem", "left", "right" ],
565         outs      => [ "res", "flags", "M" ],
566         am        => "source,binary",
567         emit      => '. xor%M %binop',
568         units     => [ "GP" ],
569         latency   => 1,
570         mode      => $mode_gp,
571         modified_flags => $status_flags
572 },
573
574 Xor0 => {
575         op_flags  => "c",
576         irn_flags => "R",
577         reg_req   => { out => [ "gp", "flags" ] },
578         outs      => [ "res", "flags" ],
579         emit      => ". xor%M %D0, %D0",
580         units     => [ "GP" ],
581         latency   => 1,
582         mode      => $mode_gp,
583         modified_flags => $status_flags
584 },
585
586 XorMem => {
587         irn_flags => "R",
588         state     => "exc_pinned",
589         reg_req   => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
590         ins       => [ "base", "index", "mem", "val" ],
591         emit      => '. xor%M %SI3, %AM',
592         units     => [ "GP" ],
593         latency   => 1,
594         mode      => "mode_M",
595         modified_flags => $status_flags
596 },
597
598 XorMem8Bit => {
599         irn_flags => "R",
600         state     => "exc_pinned",
601         reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
602         ins       => [ "base", "index", "mem", "val" ],
603         emit      => '. xor%M %SB3, %AM',
604         units     => [ "GP" ],
605         latency   => 1,
606         mode      => "mode_M",
607         modified_flags => $status_flags
608 },
609
610 Sub => {
611         irn_flags => "R",
612         state     => "exc_pinned",
613         reg_req   => { in => [ "gp", "gp", "none", "gp", "gp" ],
614                        out => [ "in_r4", "flags", "none" ] },
615         ins       => [ "base", "index", "mem", "minuend", "subtrahend" ],
616         outs      => [ "res", "flags", "M" ],
617         am        => "source,binary",
618         emit      => '. sub%M %binop',
619         units     => [ "GP" ],
620         latency   => 1,
621         mode      => $mode_gp,
622         modified_flags => $status_flags
623 },
624
625 SubMem => {
626         irn_flags => "R",
627         state     => "exc_pinned",
628         reg_req   => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
629         ins       => [ "base", "index", "mem", "subtrahend" ],
630         emit      => '. sub%M %SI3, %AM',
631         units     => [ "GP" ],
632         latency   => 1,
633         mode      => 'mode_M',
634         modified_flags => $status_flags
635 },
636
637 SubMem8Bit => {
638         irn_flags => "R",
639         state     => "exc_pinned",
640         reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
641         ins       => [ "base", "index", "mem", "subtrahend" ],
642         emit      => '. sub%M %SB3, %AM',
643         units     => [ "GP" ],
644         latency   => 1,
645         mode      => 'mode_M',
646         modified_flags => $status_flags
647 },
648
649 Sbb => {
650         state     => "exc_pinned",
651         reg_req   => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ],
652                        out => [ "in_r4 !in_r5", "flags", "none" ] },
653         ins       => [ "base", "index", "mem", "minuend", "subtrahend", "eflags" ],
654         outs      => [ "res", "flags", "M" ],
655         am        => "source,binary",
656         emit      => '. sbb%M %binop',
657         units     => [ "GP" ],
658         latency   => 1,
659         mode      => $mode_gp,
660         modified_flags => $status_flags
661 },
662
663 Sbb0 => {
664         irn_flags => "R",
665         reg_req   => { in => [ "flags" ], out => [ "gp", "flags" ] },
666         outs      => [ "res", "flags" ],
667         emit      => ". sbb%M %D0, %D0",
668         units     => [ "GP" ],
669         latency   => 1,
670         mode      => $mode_gp,
671         modified_flags => $status_flags
672 },
673
674 l_Sub => {
675         reg_req   => { in => [ "none", "none" ], out => [ "none" ] },
676         ins       => [ "minuend", "subtrahend" ],
677 },
678
679 l_Sbb => {
680         reg_req   => { in => [ "none", "none", "none" ], out => [ "none" ] },
681         ins       => [ "minuend", "subtrahend", "eflags" ],
682 },
683
684 IDiv => {
685         op_flags  => "F|L",
686         state     => "exc_pinned",
687         reg_req   => { in => [ "gp", "gp", "none", "gp", "eax", "edx" ],
688                        out => [ "eax", "flags", "none", "edx", "none" ] },
689         ins       => [ "base", "index", "mem", "divisor", "dividend_low", "dividend_high" ],
690         outs      => [ "div_res", "flags", "M", "mod_res", "X_exc" ],
691         am        => "source,unary",
692         emit      => ". idiv%M %unop3",
693         latency   => 25,
694         units     => [ "GP" ],
695         modified_flags => $status_flags
696 },
697
698 Div => {
699         op_flags  => "F|L",
700         state     => "exc_pinned",
701         reg_req   => { in => [ "gp", "gp", "none", "gp", "eax", "edx" ],
702                        out => [ "eax", "flags", "none", "edx", "none" ] },
703         ins       => [ "base", "index", "mem", "divisor", "dividend_low", "dividend_high" ],
704         outs      => [ "div_res", "flags", "M", "mod_res", "X_exc" ],
705         am        => "source,unary",
706         emit      => ". div%M %unop3",
707         latency   => 25,
708         units     => [ "GP" ],
709         modified_flags => $status_flags
710 },
711
712 Shl => {
713         irn_flags => "R",
714         reg_req   => { in => [ "gp", "ecx" ],
715                        out => [ "in_r1 !in_r2", "flags" ] },
716         ins       => [ "val", "count" ],
717         outs      => [ "res", "flags" ],
718         emit      => '. shl%M %SB1, %S0',
719         units     => [ "GP" ],
720         latency   => 1,
721         mode      => $mode_gp,
722         modified_flags => $status_flags
723 },
724
725 ShlMem => {
726         irn_flags => "R",
727         state     => "exc_pinned",
728         reg_req   => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
729         ins       => [ "base", "index", "mem", "count" ],
730         emit      => '. shl%M %SB3, %AM',
731         units     => [ "GP" ],
732         latency   => 1,
733         mode      => "mode_M",
734         modified_flags => $status_flags
735 },
736
737 l_ShlDep => {
738         cmp_attr => "return 1;",
739         reg_req  => { in => [ "none", "none", "none" ], out => [ "none" ] },
740         ins      => [ "val", "count", "dep" ],
741 },
742
743 ShlD => {
744         irn_flags => "R",
745         reg_req   => { in => [ "gp", "gp", "ecx" ],
746                        out => [ "in_r1 !in_r2 !in_r3", "flags" ] },
747         ins       => [ "val_high", "val_low", "count" ],
748         outs      => [ "res", "flags" ],
749         emit      => ". shld%M %SB2, %S1, %D0",
750         latency   => 6,
751         units     => [ "GP" ],
752         mode      => $mode_gp,
753         modified_flags => $status_flags
754 },
755
756 l_ShlD => {
757         cmp_attr  => "return 1;",
758         reg_req  => { in => [ "none", "none", "none" ], out => [ "none" ] },
759         ins       => [ "val_high", "val_low", "count" ],
760 },
761
762 Shr => {
763         irn_flags => "R",
764         reg_req   => { in => [ "gp", "ecx" ],
765                        out => [ "in_r1 !in_r2", "flags" ] },
766         ins       => [ "val", "count" ],
767         outs      => [ "res", "flags" ],
768         emit      => '. shr%M %SB1, %S0',
769         units     => [ "GP" ],
770         mode      => $mode_gp,
771         latency   => 1,
772         modified_flags => $status_flags
773 },
774
775 ShrMem => {
776         irn_flags => "R",
777         state     => "exc_pinned",
778         reg_req   => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
779         ins       => [ "base", "index", "mem", "count" ],
780         emit      => '. shr%M %SB3, %AM',
781         units     => [ "GP" ],
782         mode      => "mode_M",
783         latency   => 1,
784         modified_flags => $status_flags
785 },
786
787 l_ShrDep => {
788         cmp_attr  => "return 1;",
789         reg_req   => { in => [ "none", "none", "none" ], out => [ "none" ] },
790         ins       => [ "val", "count", "dep" ],
791 },
792
793 ShrD => {
794         irn_flags => "R",
795         reg_req   => { in => [ "gp", "gp", "ecx" ],
796                        out => [ "in_r1 !in_r2 !in_r3", "flags" ] },
797         ins       => [ "val_high", "val_low", "count" ],
798         outs      => [ "res", "flags" ],
799         emit      => ". shrd%M %SB2, %S1, %D0",
800         latency   => 6,
801         units     => [ "GP" ],
802         mode      => $mode_gp,
803         modified_flags => $status_flags
804 },
805
806 l_ShrD => {
807         cmp_attr  => "return 1;",
808         reg_req   => { in => [ "none", "none", "none" ], out => [ "none" ] },
809         ins       => [ "val_high", "val_low", "count" ],
810 },
811
812 Sar => {
813         irn_flags => "R",
814         reg_req   => { in => [ "gp", "ecx" ],
815                        out => [ "in_r1 !in_r2", "flags" ] },
816         ins       => [ "val", "count" ],
817         outs      => [ "res", "flags" ],
818         emit      => '. sar%M %SB1, %S0',
819         units     => [ "GP" ],
820         latency   => 1,
821         mode      => $mode_gp,
822         modified_flags => $status_flags
823 },
824
825 SarMem => {
826         irn_flags => "R",
827         state     => "exc_pinned",
828         reg_req   => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
829         ins       => [ "base", "index", "mem", "count" ],
830         emit      => '. sar%M %SB3, %AM',
831         units     => [ "GP" ],
832         latency   => 1,
833         mode      => "mode_M",
834         modified_flags => $status_flags
835 },
836
837 l_SarDep => {
838         cmp_attr  => "return 1;",
839         ins       => [ "val", "count", "dep" ],
840         reg_req   => { in => [ "none", "none", "none" ], out => [ "none" ] },
841 },
842
843 Ror => {
844         irn_flags => "R",
845         reg_req   => { in => [ "gp", "ecx" ],
846                        out => [ "in_r1 !in_r2", "flags" ] },
847         ins       => [ "val", "count" ],
848         outs      => [ "res", "flags" ],
849         emit      => '. ror%M %SB1, %S0',
850         units     => [ "GP" ],
851         latency   => 1,
852         mode      => $mode_gp,
853         modified_flags => $status_flags
854 },
855
856 RorMem => {
857         irn_flags => "R",
858         state     => "exc_pinned",
859         reg_req   => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
860         ins       => [ "base", "index", "mem", "count" ],
861         emit      => '. ror%M %SB3, %AM',
862         units     => [ "GP" ],
863         latency   => 1,
864         mode      => "mode_M",
865         modified_flags => $status_flags
866 },
867
868 Rol => {
869         irn_flags => "R",
870         reg_req   => { in => [ "gp", "ecx" ],
871                        out => [ "in_r1 !in_r2", "flags" ] },
872         ins       => [ "val", "count" ],
873         outs      => [ "res", "flags" ],
874         emit      => '. rol%M %SB1, %S0',
875         units     => [ "GP" ],
876         latency   => 1,
877         mode      => $mode_gp,
878         modified_flags => $status_flags
879 },
880
881 RolMem => {
882         irn_flags => "R",
883         state     => "exc_pinned",
884         reg_req   => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
885         ins       => [ "base", "index", "mem", "count" ],
886         emit      => '. rol%M %SB3, %AM',
887         units     => [ "GP" ],
888         latency   => 1,
889         mode      => "mode_M",
890         modified_flags => $status_flags
891 },
892
893 Neg => {
894         irn_flags => "R",
895         reg_req   => { in => [ "gp" ],
896                        out => [ "in_r1", "flags" ] },
897         emit      => '. neg%M %S0',
898         ins       => [ "val" ],
899         outs      => [ "res", "flags" ],
900         units     => [ "GP" ],
901         latency   => 1,
902         mode      => $mode_gp,
903         modified_flags => $status_flags
904 },
905
906 NegMem => {
907         irn_flags => "R",
908         state     => "exc_pinned",
909         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
910         ins       => [ "base", "index", "mem" ],
911         emit      => '. neg%M %AM',
912         units     => [ "GP" ],
913         latency   => 1,
914         mode      => "mode_M",
915         modified_flags => $status_flags
916 },
917
918 Minus64Bit => {
919         irn_flags => "R",
920         reg_req   => { in => [ "gp", "gp" ], out => [ "in_r1", "in_r2" ] },
921         outs      => [ "low_res", "high_res" ],
922         units     => [ "GP" ],
923         latency   => 3,
924         modified_flags => $status_flags
925 },
926
927
928 Inc => {
929         irn_flags => "R",
930         reg_req   => { in => [ "gp" ],
931                        out => [ "in_r1", "flags" ] },
932         ins       => [ "val" ],
933         outs      => [ "res", "flags" ],
934         emit      => '. inc%M %S0',
935         units     => [ "GP" ],
936         mode      => $mode_gp,
937         latency   => 1,
938         modified_flags => $status_flags_wo_cf
939 },
940
941 IncMem => {
942         irn_flags => "R",
943         state     => "exc_pinned",
944         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
945         ins       => [ "base", "index", "mem" ],
946         emit      => '. inc%M %AM',
947         units     => [ "GP" ],
948         mode      => "mode_M",
949         latency   => 1,
950         modified_flags => $status_flags_wo_cf
951 },
952
953 Dec => {
954         irn_flags => "R",
955         reg_req   => { in => [ "gp" ],
956                        out => [ "in_r1", "flags" ] },
957         ins       => [ "val" ],
958         outs      => [ "res", "flags" ],
959         emit      => '. dec%M %S0',
960         units     => [ "GP" ],
961         mode      => $mode_gp,
962         latency   => 1,
963         modified_flags => $status_flags_wo_cf
964 },
965
966 DecMem => {
967         irn_flags => "R",
968         state     => "exc_pinned",
969         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
970         ins       => [ "base", "index", "mem" ],
971         emit      => '. dec%M %AM',
972         units     => [ "GP" ],
973         mode      => "mode_M",
974         latency   => 1,
975         modified_flags => $status_flags_wo_cf
976 },
977
978 Not => {
979         irn_flags => "R",
980         reg_req   => { in => [ "gp" ],
981                        out => [ "in_r1", "flags" ] },
982         ins       => [ "val" ],
983         outs      => [ "res", "flags" ],
984         emit      => '. not%M %S0',
985         units     => [ "GP" ],
986         latency   => 1,
987         mode      => $mode_gp,
988         # no flags modified
989 },
990
991 NotMem => {
992         irn_flags => "R",
993         state     => "exc_pinned",
994         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
995         ins       => [ "base", "index", "mem" ],
996         emit      => '. not%M %AM',
997         units     => [ "GP" ],
998         latency   => 1,
999         mode      => "mode_M",
1000         # no flags modified
1001 },
1002
1003 Cmc => {
1004         reg_req   => { in => [ "flags" ], out => [ "flags" ] },
1005         emit      => '.cmc',
1006         units     => [ "GP" ],
1007         latency   => 1,
1008         mode      => $mode_flags,
1009         modified_flags => $status_flags
1010 },
1011
1012 Stc => {
1013         reg_req   => { out => [ "flags" ] },
1014         emit      => '.stc',
1015         units     => [ "GP" ],
1016         latency   => 1,
1017         mode      => $mode_flags,
1018         modified_flags => $status_flags
1019 },
1020
1021 Cmp => {
1022         irn_flags => "R",
1023         state     => "exc_pinned",
1024         reg_req   => { in  => [ "gp", "gp", "none", "gp", "gp" ],
1025                        out => [ "flags", "none", "none" ] },
1026         ins       => [ "base", "index", "mem", "left", "right" ],
1027         outs      => [ "eflags", "unused", "M" ],
1028         am        => "source,binary",
1029         emit      => '. cmp%M %binop',
1030         attr      => "int ins_permuted, int cmp_unsigned",
1031         init_attr => "attr->data.ins_permuted   = ins_permuted;\n".
1032                      "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
1033         latency   => 1,
1034         units     => [ "GP" ],
1035         mode      => $mode_flags,
1036         modified_flags => $status_flags
1037 },
1038
1039 Cmp8Bit => {
1040         irn_flags => "R",
1041         state     => "exc_pinned",
1042         reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] ,
1043                        out => [ "flags", "none", "none" ] },
1044         ins       => [ "base", "index", "mem", "left", "right" ],
1045         outs      => [ "eflags", "unused", "M" ],
1046         am        => "source,binary",
1047         emit      => '. cmpb %binop',
1048         attr      => "int ins_permuted, int cmp_unsigned",
1049         init_attr => "attr->data.ins_permuted   = ins_permuted;\n".
1050                      "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
1051         latency   => 1,
1052         units     => [ "GP" ],
1053         mode      => $mode_flags,
1054         modified_flags => $status_flags
1055 },
1056
1057 Test => {
1058         irn_flags => "R",
1059         state     => "exc_pinned",
1060         reg_req   => { in => [ "gp", "gp", "none", "gp", "gp" ] ,
1061                        out => [ "flags", "none", "none" ] },
1062         ins       => [ "base", "index", "mem", "left", "right" ],
1063         outs      => [ "eflags", "unused", "M" ],
1064         am        => "source,binary",
1065         emit      => '. test%M %binop',
1066         attr      => "int ins_permuted, int cmp_unsigned",
1067         init_attr => "attr->data.ins_permuted = ins_permuted;\n".
1068                      "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
1069         latency   => 1,
1070         units     => [ "GP" ],
1071         mode      => $mode_flags,
1072         modified_flags => $status_flags
1073 },
1074
1075 Test8Bit => {
1076         irn_flags => "R",
1077         state     => "exc_pinned",
1078         reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] ,
1079                        out => [ "flags", "none", "none" ] },
1080         ins       => [ "base", "index", "mem", "left", "right" ],
1081         outs      => [ "eflags", "unused", "M" ],
1082         am        => "source,binary",
1083         emit      => '. testb %binop',
1084         attr      => "int ins_permuted, int cmp_unsigned",
1085         init_attr => "attr->data.ins_permuted = ins_permuted;\n".
1086                      "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
1087         latency   => 1,
1088         units     => [ "GP" ],
1089         mode      => $mode_flags,
1090         modified_flags => $status_flags
1091 },
1092
1093 Setcc => {
1094         #irn_flags => "R",
1095         reg_req   => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
1096         ins       => [ "eflags" ],
1097         outs      => [ "res" ],
1098         attr_type => "ia32_condcode_attr_t",
1099         attr      => "pn_Cmp pnc, int ins_permuted",
1100         init_attr => "attr->attr.data.ins_permuted = ins_permuted;\n".
1101                      "\tset_ia32_ls_mode(res, mode_Bu);\n",
1102         latency   => 1,
1103         units     => [ "GP" ],
1104         mode      => $mode_gp,
1105 },
1106
1107 SetccMem => {
1108         #irn_flags => "R",
1109         state     => "exc_pinned",
1110         reg_req   => { in => [ "gp", "gp", "none", "eflags" ], out => [ "none" ] },
1111         ins       => [ "base", "index", "mem","eflags" ],
1112         attr_type => "ia32_condcode_attr_t",
1113         attr      => "pn_Cmp pnc, int ins_permuted",
1114         init_attr => "attr->attr.data.ins_permuted = ins_permuted;\n".
1115                      "\tset_ia32_ls_mode(res, mode_Bu);\n",
1116         emit      => '. set%CMP3 %AM',
1117         latency   => 1,
1118         units     => [ "GP" ],
1119         mode      => 'mode_M',
1120 },
1121
1122 CMovcc => {
1123         #irn_flags => "R",
1124         # (note: leave the false,true order intact to make it compatible with other
1125         #  ia32_binary ops)
1126         state     => "exc_pinned",
1127         reg_req   => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ],
1128                        out => [ "in_r4 in_r5", "flags", "none" ] },
1129         ins       => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
1130         outs      => [ "res", "flags", "M" ],
1131         am        => "source,binary",
1132         attr_type => "ia32_condcode_attr_t",
1133         attr      => "int ins_permuted, pn_Cmp pnc",
1134         init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1135         latency   => 1,
1136         units     => [ "GP" ],
1137         mode      => $mode_gp,
1138 },
1139
1140 Jcc => {
1141         state     => "pinned",
1142         op_flags  => "L|X|Y",
1143         reg_req   => { in  => [ "eflags" ], out => [ "none", "none" ] },
1144         ins       => [ "eflags" ],
1145         outs      => [ "false", "true" ],
1146         attr_type => "ia32_condcode_attr_t",
1147         attr      => "pn_Cmp pnc",
1148         latency   => 2,
1149         units     => [ "BRANCH" ],
1150 },
1151
1152 SwitchJmp => {
1153         state     => "pinned",
1154         op_flags  => "L|X|Y",
1155         reg_req   => { in => [ "gp" ] },
1156         mode      => "mode_T",
1157         attr_type => "ia32_condcode_attr_t",
1158         attr      => "long pnc",
1159         latency   => 3,
1160         units     => [ "BRANCH" ],
1161         modified_flags => $status_flags,
1162         init_attr => "info->out_infos = NULL;", # XXX ugly hack for out requirements
1163 },
1164
1165 Jmp => {
1166         state     => "pinned",
1167         irn_flags => "J",
1168         op_flags  => "X",
1169         reg_req   => { out => [ "none" ] },
1170         latency   => 1,
1171         units     => [ "BRANCH" ],
1172         mode      => "mode_X",
1173 },
1174
1175 IJmp => {
1176         state     => "pinned",
1177         op_flags  => "X",
1178         reg_req   => { in => [ "gp", "gp", "none", "gp" ] },
1179         ins       => [ "base", "index", "mem", "target" ],
1180         am        => "source,unary",
1181         emit      => '. jmp *%unop3',
1182         latency   => 1,
1183         units     => [ "BRANCH" ],
1184         mode      => "mode_X",
1185         init_attr => "info->out_infos = NULL;", # XXX ugly hack for out requirements
1186 },
1187
1188 Const => {
1189         op_flags  => "c",
1190         irn_flags => "R",
1191         reg_req   => { out => [ "gp" ] },
1192         units     => [ "GP" ],
1193         attr      => "ir_entity *symconst, int symconst_sign, int no_pic_adjust, long offset",
1194         attr_type => "ia32_immediate_attr_t",
1195         latency   => 1,
1196         mode      => $mode_gp,
1197 },
1198
1199 GetEIP => {
1200         op_flags => "c",
1201         reg_req  => { out => [ "gp" ] },
1202         units    => [ "GP" ],
1203         latency  => 5,
1204         mode     => $mode_gp,
1205         modified_flags => $status_flags,
1206 },
1207
1208 Unknown_GP => {
1209         state     => "pinned",
1210         op_flags  => "c|NB",
1211         reg_req   => { out => [ "gp_UKNWN:I" ] },
1212         units     => [],
1213         emit      => "",
1214         latency   => 0,
1215         mode      => $mode_gp
1216 },
1217
1218 Unknown_VFP => {
1219         state     => "pinned",
1220         op_flags  => "c|NB",
1221         reg_req   => { out => [ "vfp_UKNWN:I" ] },
1222         units     => [],
1223         emit      => "",
1224         mode      => "mode_E",
1225         latency   => 0,
1226         attr_type => "ia32_x87_attr_t",
1227 },
1228
1229 Unknown_XMM => {
1230         state     => "pinned",
1231         op_flags  => "c|NB",
1232         reg_req   => { out => [ "xmm_UKNWN:I" ] },
1233         units     => [],
1234         emit      => "",
1235         latency   => 0,
1236         mode      => $mode_xmm
1237 },
1238
1239 NoReg_GP => {
1240         state     => "pinned",
1241         op_flags  => "c|NB|NI",
1242         reg_req   => { out => [ "gp_NOREG:I" ] },
1243         units     => [],
1244         emit      => "",
1245         latency   => 0,
1246         mode      => $mode_gp
1247 },
1248
1249 NoReg_VFP => {
1250         state     => "pinned",
1251         op_flags  => "c|NB|NI",
1252         reg_req   => { out => [ "vfp_NOREG:I" ] },
1253         units     => [],
1254         emit      => "",
1255         mode      => "mode_E",
1256         latency   => 0,
1257         attr_type => "ia32_x87_attr_t",
1258 },
1259
1260 NoReg_XMM => {
1261         state     => "pinned",
1262         op_flags  => "c|NB|NI",
1263         reg_req   => { out => [ "xmm_NOREG:I" ] },
1264         units     => [],
1265         emit      => "",
1266         latency   => 0,
1267         mode      => "mode_E"
1268 },
1269
1270 ChangeCW => {
1271         state     => "pinned",
1272         op_flags  => "c",
1273         reg_req   => { out => [ "fpcw:I" ] },
1274         mode      => $mode_fpcw,
1275         latency   => 3,
1276         units     => [ "GP" ],
1277         modified_flags => $fpcw_flags
1278 },
1279
1280 FldCW => {
1281         op_flags  => "L|F",
1282         state     => "pinned",
1283         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "fpcw:I" ] },
1284         ins       => [ "base", "index", "mem" ],
1285         latency   => 5,
1286         emit      => ". fldcw %AM",
1287         mode      => $mode_fpcw,
1288         units     => [ "GP" ],
1289         modified_flags => $fpcw_flags
1290 },
1291
1292 FnstCW => {
1293         op_flags  => "L|F",
1294         state     => "pinned",
1295         reg_req   => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1296         ins       => [ "base", "index", "mem", "fpcw" ],
1297         latency   => 5,
1298         emit      => ". fnstcw %AM",
1299         mode      => "mode_M",
1300         units     => [ "GP" ],
1301 },
1302
1303 FnstCWNOP => {
1304         op_flags  => "L|F",
1305         state     => "pinned",
1306         reg_req   => { in => [ "fp_cw" ], out => [ "none" ] },
1307         ins       => [ "fpcw" ],
1308         latency   => 0,
1309         emit      => "",
1310         mode      => "mode_M",
1311 },
1312
1313 Cltd => {
1314         # we should not rematrialize this node. It has very strict constraints.
1315         reg_req   => { in => [ "eax", "edx" ], out => [ "edx" ] },
1316         ins       => [ "val", "clobbered" ],
1317         emit      => '. cltd',
1318         latency   => 1,
1319         mode      => $mode_gp,
1320         units     => [ "GP" ],
1321 },
1322
1323 # Load / Store
1324 #
1325 # Note that we add additional latency values depending on address mode, so a
1326 # lateny of 0 for load is correct
1327
1328 Load => {
1329         op_flags  => "L|F",
1330         state     => "exc_pinned",
1331         reg_req   => { in => [ "gp", "gp", "none" ],
1332                        out => [ "gp", "none", "none", "none" ] },
1333         ins       => [ "base", "index", "mem" ],
1334         outs      => [ "res", "unused", "M", "X_exc" ],
1335         latency   => 0,
1336         emit      => ". mov%EX%.l %AM, %D0",
1337         units     => [ "GP" ],
1338 },
1339
1340 Store => {
1341         op_flags  => "L|F",
1342         state     => "exc_pinned",
1343         reg_req   => { in => [ "gp", "gp", "none", "gp" ], out => [ "none", "none" ] },
1344         ins       => [ "base", "index", "mem", "val" ],
1345         outs      => [ "M", "X_exc" ],
1346         emit      => '. mov%M %SI3, %AM',
1347         latency   => 2,
1348         units     => [ "GP" ],
1349         mode      => "mode_M",
1350 },
1351
1352 Store8Bit => {
1353         op_flags  => "L|F",
1354         state     => "exc_pinned",
1355         reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none", "none" ] },
1356         ins       => [ "base", "index", "mem", "val" ],
1357         outs      => [ "M", "X_exc" ],
1358         emit      => '. mov%M %SB3, %AM',
1359         latency   => 2,
1360         units     => [ "GP" ],
1361         mode      => "mode_M",
1362 },
1363
1364 Lea => {
1365         irn_flags => "R",
1366         reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
1367         ins       => [ "base", "index" ],
1368         emit      => '. leal %AM, %D0',
1369         latency   => 2,
1370         units     => [ "GP" ],
1371         mode      => $mode_gp,
1372 # lea doesn't modify the flags, but setting this seems advantageous since it
1373 # increases chances that the Lea is transformed back to an Add
1374         modified_flags => 1,
1375 },
1376
1377 Push => {
1378         state     => "exc_pinned",
1379         reg_req   => { in => [ "gp", "gp", "none", "gp", "esp" ], out => [ "esp:I|S", "none" ] },
1380         ins       => [ "base", "index", "mem", "val", "stack" ],
1381         emit      => '. push%M %unop3',
1382         outs      => [ "stack", "M" ],
1383         am        => "source,unary",
1384         latency   => 2,
1385         units     => [ "GP" ],
1386 },
1387
1388 Pop => {
1389         state     => "exc_pinned",
1390         reg_req   => { in => [ "none", "esp" ], out => [ "gp", "none", "none", "esp:I|S" ] },
1391         ins       => [ "mem", "stack" ],
1392         outs      => [ "res", "M", "unused", "stack" ],
1393         emit      => '. pop%M %D0',
1394         latency   => 3, # Pop is more expensive than Push on Athlon
1395         units     => [ "GP" ],
1396 },
1397
1398 PopEbp => {
1399         state     => "exc_pinned",
1400         reg_req   => { in => [ "none", "esp" ], out => [ "ebp:I", "none", "none", "esp:I|S" ] },
1401         ins       => [ "mem", "stack" ],
1402         outs      => [ "res", "M", "unused", "stack" ],
1403         emit      => '. pop%M %D0',
1404         latency   => 3, # Pop is more expensive than Push on Athlon
1405         units     => [ "GP" ],
1406 },
1407
1408 PopMem => {
1409         state     => "exc_pinned",
1410         reg_req   => { in => [ "gp", "gp", "none", "esp" ], out => [ "none", "none", "none", "esp:I|S" ] },
1411         ins       => [ "base", "index", "mem", "stack" ],
1412         outs      => [ "unused0", "M", "unused1", "stack" ],
1413         emit      => '. pop%M %AM',
1414         latency   => 3, # Pop is more expensive than Push on Athlon
1415         units     => [ "GP" ],
1416 },
1417
1418 Enter => {
1419         reg_req   => { in => [ "esp" ], out => [ "ebp", "esp:I|S", "none" ] },
1420         emit      => '. enter',
1421         outs      => [ "frame", "stack", "M" ],
1422         latency   => 15,
1423         units     => [ "GP" ],
1424 },
1425
1426 Leave => {
1427         reg_req   => { in => [ "ebp" ], out => [ "ebp:I", "esp:I|S" ] },
1428         emit      => '. leave',
1429         outs      => [ "frame", "stack" ],
1430         latency   => 3,
1431         units     => [ "GP" ],
1432 },
1433
1434 AddSP => {
1435         state     => "pinned",
1436         reg_req   => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "esp:I|S", "none" ] },
1437         ins       => [ "base", "index", "mem", "stack", "size" ],
1438         am        => "source,binary",
1439         emit      => '. addl %binop',
1440         latency   => 1,
1441         outs      => [ "stack", "M" ],
1442         units     => [ "GP" ],
1443         modified_flags => $status_flags
1444 },
1445
1446 SubSP => {
1447         state     => "pinned",
1448         reg_req   => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "esp:I|S", "gp", "none" ] },
1449         ins       => [ "base", "index", "mem", "stack", "size" ],
1450         am        => "source,binary",
1451         emit      => ". subl %binop\n".
1452                      ". movl %%esp, %D1",
1453         latency   => 2,
1454         outs      => [ "stack", "addr", "M" ],
1455         units     => [ "GP" ],
1456         modified_flags => $status_flags
1457 },
1458
1459 RepPrefix => {
1460         op_flags  => "K",
1461         state     => "pinned",
1462         mode      => "mode_M",
1463         emit      => ". rep",
1464         latency   => 0,
1465 },
1466
1467 LdTls => {
1468         irn_flags => "R",
1469         reg_req   => { out => [ "gp" ] },
1470         units     => [ "GP" ],
1471         latency   => 1,
1472 },
1473
1474 #
1475 # BT supports source address mode, but this is unused yet
1476 #
1477 Bt => {
1478         irn_flags => "R",
1479         state     => "exc_pinned",
1480         reg_req   => { in => [ "gp", "gp" ], out => [ "flags" ] },
1481         ins       => [ "left", "right" ],
1482         emit      => '. bt%M %S1, %S0',
1483         units     => [ "GP" ],
1484         latency   => 1,
1485         mode      => $mode_flags,
1486         modified_flags => $status_flags  # only CF is set, but the other flags are undefined
1487 },
1488
1489 Bsf => {
1490         irn_flags => "R",
1491         state     => "exc_pinned",
1492         reg_req   => { in => [ "gp", "gp", "none", "gp" ],
1493                        out => [ "gp", "flags", "none" ] },
1494         ins       => [ "base", "index", "mem", "operand" ],
1495         outs      => [ "res", "flags", "M" ],
1496         am        => "source,binary",
1497         emit      => '. bsf%M %unop3, %D0',
1498         units     => [ "GP" ],
1499         latency   => 1,
1500         mode      => $mode_gp,
1501         modified_flags => $status_flags
1502 },
1503
1504 Bsr => {
1505         irn_flags => "R",
1506         state     => "exc_pinned",
1507         reg_req   => { in => [ "gp", "gp", "none", "gp" ],
1508                        out => [ "gp", "flags", "none" ] },
1509         ins       => [ "base", "index", "mem", "operand" ],
1510         outs      => [ "res", "flags", "M" ],
1511         am        => "source,binary",
1512         emit      => '. bsr%M %unop3, %D0',
1513         units     => [ "GP" ],
1514         latency   => 1,
1515         mode      => $mode_gp,
1516         modified_flags => $status_flags
1517 },
1518
1519 #
1520 # SSE4.2 or SSE4a popcnt instruction
1521 #
1522 Popcnt => {
1523         irn_flags => "R",
1524         state     => "exc_pinned",
1525         reg_req   => { in => [ "gp", "gp", "none", "gp" ],
1526                        out => [ "gp", "flags", "none" ] },
1527         ins       => [ "base", "index", "mem", "operand" ],
1528         outs      => [ "res", "flags", "M" ],
1529         am        => "source,binary",
1530         emit      => '. popcnt%M %unop3, %D0',
1531         units     => [ "GP" ],
1532         latency   => 1,
1533         mode      => $mode_gp,
1534         modified_flags => $status_flags
1535 },
1536
1537 Call => {
1538         state     => "exc_pinned",
1539         reg_req   => {
1540                 in  => [ "gp", "gp", "none", "gp", "esp", "fpcw", "eax", "ecx", "edx" ],
1541                 out => [ "esp:I|S", "fpcw:I", "none", "eax", "ecx", "edx", "vf0", "vf1", "vf2", "vf3", "vf4", "vf5", "vf6", "vf7", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" ]
1542         },
1543         ins       => [ "base", "index", "mem", "addr", "stack", "fpcw", "eax", "ecx", "edx" ],
1544         outs      => [ "stack", "fpcw", "M", "eax", "ecx", "edx", "vf0", "vf1", "vf2", "vf3", "vf4", "vf5", "vf6", "vf7", "xmm0", "xmm1", "xmm2", "xmm3", "xmm4", "xmm5", "xmm6", "xmm7" ],
1545         attr_type => "ia32_call_attr_t",
1546         attr      => "unsigned pop, ir_type *call_tp",
1547         am        => "source,unary",
1548         units     => [ "BRANCH" ],
1549         latency   => 4, # random number
1550         modified_flags => $status_flags
1551 },
1552
1553 #
1554 # a Helper node for frame-climbing, needed for __builtin_(frame|return)_address
1555 #
1556 # PS: try gcc __builtin_frame_address(100000) :-)
1557 #
1558 ClimbFrame => {
1559         reg_req   => { in => [ "gp", "gp", "gp"], out => [ "in_r3" ] },
1560         ins       => [ "frame", "cnt", "tmp" ],
1561         outs      => [ "res" ],
1562         latency   => 4, # random number
1563         attr_type => "ia32_climbframe_attr_t",
1564         attr      => "unsigned count",
1565         units     => [ "GP" ],
1566         mode      => $mode_gp
1567 },
1568
1569 #
1570 # bswap
1571 #
1572 Bswap => {
1573         irn_flags => "R",
1574         reg_req   => { in => [ "gp" ],
1575                        out => [ "in_r1" ] },
1576         emit      => '. bswap%M %S0',
1577         ins       => [ "val" ],
1578         units     => [ "GP" ],
1579         latency   => 1,
1580         mode      => $mode_gp,
1581 },
1582
1583 #
1584 # bswap16, use xchg here
1585 #
1586 Bswap16 => {
1587         irn_flags => "R",
1588         reg_req   => { in => [ "eax ebx ecx edx" ],
1589                        out => [ "in_r1" ] },
1590         emit      => '. xchg %SB0, %SH0',
1591         ins       => [ "val" ],
1592         units     => [ "GP" ],
1593         latency   => 1,
1594         mode      => $mode_gp,
1595 },
1596
1597 #
1598 # BreakPoint
1599 #
1600 Breakpoint => {
1601         state     => "pinned",
1602         reg_req   => { in => [ "none" ], out => [ "none" ] },
1603         ins       => [ "mem" ],
1604         latency   => 0,
1605         emit      => ". int3",
1606         units     => [ "GP" ],
1607         mode      => mode_M,
1608 },
1609
1610 #
1611 # Undefined Instruction on ALL x86 CPU's
1612 #
1613 UD2 => {
1614         state     => "pinned",
1615         reg_req   => { in => [ "none" ], out => [ "none" ] },
1616         ins       => [ "mem" ],
1617         latency   => 0,
1618         emit      => ". .value  0x0b0f",
1619         units     => [ "GP" ],
1620         mode      => mode_M,
1621 },
1622
1623 #
1624 # outport
1625 #
1626 Outport => {
1627         irn_flags => "R",
1628         state     => "pinned",
1629         reg_req   => { in => [ "edx", "eax", "none" ], out => [ "none" ] },
1630         ins       => [ "port", "value", "mem" ],
1631         emit      => '. out%M %SS0, %SI1',
1632         units     => [ "GP" ],
1633         latency   => 1,
1634         mode      => mode_M,
1635         modified_flags => $status_flags
1636 },
1637
1638 #
1639 # inport
1640 #
1641 Inport => {
1642         irn_flags => "R",
1643         state     => "pinned",
1644         reg_req   => { in => [ "edx", "none" ], out => [ "eax", "none" ] },
1645         ins       => [ "port", "mem" ],
1646         outs      => [ "res", "M" ],
1647         emit      => '. in%M %DS0, %SS0',
1648         units     => [ "GP" ],
1649         latency   => 1,
1650         mode      => mode_T,
1651         modified_flags => $status_flags
1652 },
1653
1654 #
1655 # Intel style prefetching
1656 #
1657 Prefetch0 => {
1658         op_flags  => "L|F",
1659         state     => "exc_pinned",
1660         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
1661         ins       => [ "base", "index", "mem" ],
1662         outs      => [ "M" ],
1663         latency   => 0,
1664         emit      => ". prefetcht0 %AM",
1665         units     => [ "GP" ],
1666 },
1667
1668 Prefetch1 => {
1669         op_flags  => "L|F",
1670         state     => "exc_pinned",
1671         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
1672         ins       => [ "base", "index", "mem" ],
1673         outs      => [ "M" ],
1674         latency   => 0,
1675         emit      => ". prefetcht1 %AM",
1676         units     => [ "GP" ],
1677 },
1678
1679 Prefetch2 => {
1680         op_flags  => "L|F",
1681         state     => "exc_pinned",
1682         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
1683         ins       => [ "base", "index", "mem" ],
1684         outs      => [ "M" ],
1685         latency   => 0,
1686         emit      => ". prefetcht2 %AM",
1687         units     => [ "GP" ],
1688 },
1689
1690 PrefetchNTA => {
1691         op_flags  => "L|F",
1692         state     => "exc_pinned",
1693         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
1694         ins       => [ "base", "index", "mem" ],
1695         outs      => [ "M" ],
1696         latency   => 0,
1697         emit      => ". prefetchnta %AM",
1698         units     => [ "GP" ],
1699 },
1700
1701 #
1702 # 3DNow! prefetch instructions
1703 #
1704 Prefetch => {
1705         op_flags  => "L|F",
1706         state     => "exc_pinned",
1707         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
1708         ins       => [ "base", "index", "mem" ],
1709         outs      => [ "M" ],
1710         latency   => 0,
1711         emit      => ". prefetch %AM",
1712         units     => [ "GP" ],
1713 },
1714
1715 PrefetchW => {
1716         op_flags  => "L|F",
1717         state     => "exc_pinned",
1718         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
1719         ins       => [ "base", "index", "mem" ],
1720         outs      => [ "M" ],
1721         latency   => 0,
1722         emit      => ". prefetchw %AM",
1723         units     => [ "GP" ],
1724 },
1725
1726 # produces a 0/+0.0
1727 xZero => {
1728         irn_flags => "R",
1729         reg_req   => { out => [ "xmm" ] },
1730         emit      => '. xorp%XSD %D0, %D0',
1731         latency   => 3,
1732         units     => [ "SSE" ],
1733         mode      => $mode_xmm
1734 },
1735
1736 xPzero => {
1737         irn_flags => "R",
1738         reg_req   => { out => [ "xmm" ] },
1739         emit      => '. pxor %D0, %D0',
1740         latency   => 3,
1741         units     => [ "SSE" ],
1742         mode      => $mode_xmm
1743 },
1744
1745 # produces all 1 bits
1746 xAllOnes => {
1747         irn_flags => "R",
1748         reg_req   => { out => [ "xmm" ] },
1749         emit      => '. pcmpeqb %D0, %D0',
1750         latency   => 3,
1751         units     => [ "SSE" ],
1752         mode      => $mode_xmm
1753 },
1754
1755 # integer shift left, dword
1756 xPslld => {
1757         irn_flags => "R",
1758         reg_req   => { in => [ "xmm", "xmm" ], out => [ "in_r1 !in_r2" ] },
1759         emit      => '. pslld %SI1, %D0',
1760         latency   => 3,
1761         units     => [ "SSE" ],
1762         mode      => $mode_xmm
1763 },
1764
1765 # integer shift left, qword
1766 xPsllq => {
1767         irn_flags => "R",
1768         reg_req   => { in => [ "xmm", "xmm" ], out => [ "in_r1 !in_r2" ] },
1769         emit      => '. psllq %SI1, %D0',
1770         latency   => 3,
1771         units     => [ "SSE" ],
1772         mode      => $mode_xmm
1773 },
1774
1775 # integer shift right, dword
1776 xPsrld => {
1777         irn_flags => "R",
1778         reg_req   => { in => [ "xmm", "xmm" ], out => [ "in_r1 !in_r2" ] },
1779         emit      => '. psrld %SI1, %D0',
1780         latency   => 1,
1781         units     => [ "SSE" ],
1782         mode      => $mode_xmm
1783 },
1784
1785 # mov from integer to SSE register
1786 xMovd  => {
1787         irn_flags => "R",
1788         reg_req   => { in => [ "gp" ], out => [ "xmm" ] },
1789         emit      => '. movd %S0, %D0',
1790         latency   => 1,
1791         units     => [ "SSE" ],
1792         mode      => $mode_xmm
1793 },
1794
1795 xAdd => {
1796         irn_flags => "R",
1797         state     => "exc_pinned",
1798         reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
1799                        out => [ "in_r4 in_r5", "flags", "none" ] },
1800         ins       => [ "base", "index", "mem", "left", "right" ],
1801         outs      => [ "res", "flags", "M" ],
1802         am        => "source,binary",
1803         emit      => '. add%XXM %binop',
1804         latency   => 4,
1805         units     => [ "SSE" ],
1806         mode      => $mode_xmm
1807 },
1808
1809 xMul => {
1810         irn_flags => "R",
1811         state     => "exc_pinned",
1812         reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
1813                        out => [ "in_r4 in_r5", "flags", "none" ] },
1814         ins       => [ "base", "index", "mem", "left", "right" ],
1815         outs      => [ "res", "flags", "M" ],
1816         am        => "source,binary",
1817         emit      => '. mul%XXM %binop',
1818         latency   => 4,
1819         units     => [ "SSE" ],
1820         mode      => $mode_xmm
1821 },
1822
1823 xMax => {
1824         irn_flags => "R",
1825         state     => "exc_pinned",
1826         reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
1827                        out => [ "in_r4 in_r5", "flags", "none" ] },
1828         ins       => [ "base", "index", "mem", "left", "right" ],
1829         outs      => [ "res", "flags", "M" ],
1830         am        => "source,binary",
1831         emit      => '. max%XXM %binop',
1832         latency   => 2,
1833         units     => [ "SSE" ],
1834         mode      => $mode_xmm
1835 },
1836
1837 xMin => {
1838         irn_flags => "R",
1839         state     => "exc_pinned",
1840         reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
1841                        out => [ "in_r4 in_r5", "flags", "none" ] },
1842         ins       => [ "base", "index", "mem", "left", "right" ],
1843         outs      => [ "res", "flags", "M" ],
1844         am        => "source,binary",
1845         emit      => '. min%XXM %binop',
1846         latency   => 2,
1847         units     => [ "SSE" ],
1848         mode      => $mode_xmm
1849 },
1850
1851 xAnd => {
1852         irn_flags => "R",
1853         state     => "exc_pinned",
1854         reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
1855                        out => [ "in_r4 in_r5", "flags", "none" ] },
1856         ins       => [ "base", "index", "mem", "left", "right" ],
1857         outs      => [ "res", "flags", "M" ],
1858         am        => "source,binary",
1859         emit      => '. andp%XSD %binop',
1860         latency   => 3,
1861         units     => [ "SSE" ],
1862         mode      => $mode_xmm
1863 },
1864
1865 xOr => {
1866         irn_flags => "R",
1867         state     => "exc_pinned",
1868         reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
1869                        out => [ "in_r4 in_r5", "flags", "none" ] },
1870         ins       => [ "base", "index", "mem", "left", "right" ],
1871         outs      => [ "res", "flags", "M" ],
1872         am        => "source,binary",
1873         emit      => '. orp%XSD %binop',
1874         latency   => 3,
1875         units     => [ "SSE" ],
1876         mode      => $mode_xmm
1877 },
1878
1879 xXor => {
1880         irn_flags => "R",
1881         state     => "exc_pinned",
1882         reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
1883                        out => [ "in_r4 in_r5", "flags", "none" ] },
1884         ins       => [ "base", "index", "mem", "left", "right" ],
1885         outs      => [ "res", "flags", "M" ],
1886         am        => "source,binary",
1887         emit      => '. xorp%XSD %binop',
1888         latency   => 3,
1889         units     => [ "SSE" ],
1890         mode      => $mode_xmm
1891 },
1892
1893 xAndNot => {
1894         irn_flags => "R",
1895         state     => "exc_pinned",
1896         reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
1897                        out => [ "in_r4 !in_r5", "flags", "none" ] },
1898         ins       => [ "base", "index", "mem", "left", "right" ],
1899         outs      => [ "res", "flags", "M" ],
1900         am        => "source,binary",
1901         emit      => '. andnp%XSD %binop',
1902         latency   => 3,
1903         units     => [ "SSE" ],
1904         mode      => $mode_xmm
1905 },
1906
1907 xSub => {
1908         irn_flags => "R",
1909         state     => "exc_pinned",
1910         reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
1911                        out => [ "in_r4", "flags", "none" ] },
1912         ins       => [ "base", "index", "mem", "minuend", "subtrahend" ],
1913         outs      => [ "res", "flags", "M" ],
1914         am        => "source,binary",
1915         emit      => '. sub%XXM %binop',
1916         latency   => 4,
1917         units     => [ "SSE" ],
1918         mode      => $mode_xmm
1919 },
1920
1921 xDiv => {
1922         irn_flags => "R",
1923         state     => "exc_pinned",
1924         reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
1925                        out => [ "in_r4 !in_r5", "flags", "none" ] },
1926         ins       => [ "base", "index", "mem", "dividend", "divisor" ],
1927         outs      => [ "res", "flags", "M" ],
1928         am        => "source,binary",
1929         emit      => '. div%XXM %binop',
1930         latency   => 16,
1931         units     => [ "SSE" ],
1932 },
1933
1934 Ucomi => {
1935         irn_flags => "R",
1936         state     => "exc_pinned",
1937         reg_req   => { in => [ "gp", "gp", "none", "xmm", "xmm" ],
1938                        out => [ "eflags" ] },
1939         ins       => [ "base", "index", "mem", "left", "right" ],
1940         outs      => [ "flags" ],
1941         am        => "source,binary",
1942         attr      => "int ins_permuted",
1943         init_attr => "attr->data.ins_permuted = ins_permuted;",
1944         emit      => ' .ucomi%XXM %binop',
1945         latency   => 3,
1946         units     => [ "SSE" ],
1947         mode      => $mode_flags,
1948         modified_flags => 1,
1949 },
1950
1951 xLoad => {
1952         op_flags  => "L|F",
1953         state     => "exc_pinned",
1954         reg_req   => { in => [ "gp", "gp", "none" ],
1955                        out => [ "xmm", "none", "none", "none" ] },
1956         ins       => [ "base", "index", "mem" ],
1957         outs      => [ "res", "unused", "M", "X_exc" ],
1958         emit      => '. mov%XXM %AM, %D0',
1959         attr      => "ir_mode *load_mode",
1960         init_attr => "attr->ls_mode = load_mode;",
1961         latency   => 0,
1962         units     => [ "SSE" ],
1963 },
1964
1965 xStore => {
1966         op_flags => "L|F",
1967         state    => "exc_pinned",
1968         reg_req  => { in => [ "gp", "gp", "none", "xmm" ], out => [ "none", "none" ] },
1969         ins       => [ "base", "index", "mem", "val" ],
1970         outs      => [ "M", "X_exc" ],
1971         emit     => '. mov%XXM %S3, %AM',
1972         latency  => 0,
1973         units    => [ "SSE" ],
1974         mode     => "mode_M",
1975 },
1976
1977 xStoreSimple => {
1978         op_flags => "L|F",
1979         state    => "exc_pinned",
1980         reg_req  => { in => [ "gp", "gp", "none", "xmm" ], out => [ "none" ] },
1981         ins      => [ "base", "index", "mem", "val" ],
1982         outs     => [ "M" ],
1983         emit     => '. mov%XXM %S3, %AM',
1984         latency  => 0,
1985         units    => [ "SSE" ],
1986         mode     => "mode_M",
1987 },
1988
1989 CvtSI2SS => {
1990         op_flags => "L|F",
1991         state     => "exc_pinned",
1992         reg_req  => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1993         ins      => [ "base", "index", "mem", "val" ],
1994         am       => "source,unary",
1995         emit     => '. cvtsi2ss %unop3, %D0',
1996         latency  => 2,
1997         units    => [ "SSE" ],
1998         mode     => $mode_xmm
1999 },
2000
2001 CvtSI2SD => {
2002         op_flags => "L|F",
2003         state     => "exc_pinned",
2004         reg_req  => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
2005         ins      => [ "base", "index", "mem", "val" ],
2006         am       => "source,unary",
2007         emit     => '. cvtsi2sd %unop3, %D0',
2008         latency  => 2,
2009         units    => [ "SSE" ],
2010         mode     => $mode_xmm
2011 },
2012
2013
2014 l_LLtoFloat => {
2015         op_flags => "L|F",
2016         cmp_attr => "return 1;",
2017         ins      => [ "val_high", "val_low" ],
2018         reg_req  => { in => [ "none", "none" ], out => [ "none" ] }
2019 },
2020
2021 l_FloattoLL => {
2022         op_flags => "L|F",
2023         cmp_attr => "return 1;",
2024         ins      => [ "val" ],
2025         outs     => [ "res_high", "res_low" ],
2026         reg_req  => { in => [ "none" ], out => [ "none", "none" ] }
2027 },
2028
2029 CopyB => {
2030         op_flags  => "F|H",
2031         state     => "pinned",
2032         reg_req   => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
2033         outs      => [ "DST", "SRC", "CNT", "M" ],
2034         attr_type => "ia32_copyb_attr_t",
2035         attr      => "unsigned size",
2036         units     => [ "GP" ],
2037         latency  => 3,
2038 # we don't care about this flag, so no need to mark this node
2039 #       modified_flags => [ "DF" ]
2040 },
2041
2042 CopyB_i => {
2043         op_flags  => "F|H",
2044         state     => "pinned",
2045         reg_req   => { in => [ "edi", "esi", "none" ], out => [  "edi", "esi", "none" ] },
2046         outs      => [ "DST", "SRC", "M" ],
2047         attr_type => "ia32_copyb_attr_t",
2048         attr      => "unsigned size",
2049         units     => [ "GP" ],
2050         latency  => 3,
2051 # we don't care about this flag, so no need to mark this node
2052 #       modified_flags => [ "DF" ]
2053 },
2054
2055 Cwtl => {
2056         state     => "exc_pinned",
2057         reg_req   => { in => [ "eax" ], out => [ "eax" ] },
2058         ins       => [ "val" ],
2059         outs      => [ "res" ],
2060         emit      => '. cwtl',
2061         units     => [ "GP" ],
2062         latency   => 1,
2063         mode      => $mode_gp,
2064 },
2065
2066 Conv_I2I => {
2067         state     => "exc_pinned",
2068         reg_req   => { in => [ "gp", "gp", "none", "gp" ],
2069                        out => [ "gp", "none", "none" ] },
2070         ins       => [ "base", "index", "mem", "val" ],
2071         outs      => [ "res", "flags", "M" ],
2072         am        => "source,unary",
2073         units     => [ "GP" ],
2074         latency   => 1,
2075         attr      => "ir_mode *smaller_mode",
2076         init_attr => "attr->ls_mode = smaller_mode;",
2077         mode      => $mode_gp,
2078 },
2079
2080 Conv_I2I8Bit => {
2081         state     => "exc_pinned",
2082         reg_req   => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ],
2083                        out => [ "gp", "none", "none" ] },
2084         ins       => [ "base", "index", "mem", "val" ],
2085         outs      => [ "res", "flags", "M" ],
2086         am        => "source,unary",
2087         units     => [ "GP" ],
2088         latency   => 1,
2089         attr      => "ir_mode *smaller_mode",
2090         init_attr => "attr->ls_mode = smaller_mode;",
2091         mode      => $mode_gp,
2092 },
2093
2094 Conv_I2FP => {
2095         state     => "exc_pinned",
2096         reg_req   => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
2097         ins       => [ "base", "index", "mem", "val" ],
2098         am        => "source,unary",
2099         latency   => 10,
2100         units     => [ "SSE" ],
2101         mode      => $mode_xmm,
2102 },
2103
2104 Conv_FP2I => {
2105         state     => "exc_pinned",
2106         reg_req   => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
2107         ins       => [ "base", "index", "mem", "val" ],
2108         am        => "source,unary",
2109         latency   => 10,
2110         units     => [ "SSE" ],
2111         mode      => $mode_gp,
2112 },
2113
2114 Conv_FP2FP => {
2115         state     => "exc_pinned",
2116         reg_req   => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
2117         ins       => [ "base", "index", "mem", "val" ],
2118         am        => "source,unary",
2119         latency   => 8,
2120         units     => [ "SSE" ],
2121         mode      => $mode_xmm,
2122 },
2123
2124 # rematerialisation disabled for all float nodes for now, because the fpcw
2125 # handler runs before spilling and we might end up with wrong fpcw then
2126
2127 vfadd => {
2128 #       irn_flags => "R",
2129         state     => "exc_pinned",
2130         reg_req   => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ],
2131                        out => [ "vfp", "none", "none" ] },
2132         ins       => [ "base", "index", "mem", "left", "right", "fpcw" ],
2133         outs      => [ "res", "dummy", "M" ],
2134         am        => "source,binary",
2135         latency   => 4,
2136         units     => [ "VFP" ],
2137         mode      => "mode_E",
2138         attr_type => "ia32_x87_attr_t",
2139 },
2140
2141 vfmul => {
2142 #       irn_flags => "R",
2143         state     => "exc_pinned",
2144         reg_req   => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ],
2145                        out => [ "vfp", "none", "none" ] },
2146         ins       => [ "base", "index", "mem", "left", "right", "fpcw" ],
2147         outs      => [ "res", "dummy", "M" ],
2148         am        => "source,binary",
2149         latency   => 4,
2150         units     => [ "VFP" ],
2151         mode      => "mode_E",
2152         attr_type => "ia32_x87_attr_t",
2153 },
2154
2155 vfsub => {
2156 #       irn_flags => "R",
2157         state     => "exc_pinned",
2158         reg_req   => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ],
2159                        out => [ "vfp", "none", "none" ] },
2160         ins       => [ "base", "index", "mem", "minuend", "subtrahend", "fpcw" ],
2161         outs      => [ "res", "dummy", "M" ],
2162         am        => "source,binary",
2163         latency   => 4,
2164         units     => [ "VFP" ],
2165         mode      => "mode_E",
2166         attr_type => "ia32_x87_attr_t",
2167 },
2168
2169 vfdiv => {
2170         state     => "exc_pinned",
2171         reg_req   => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ],
2172                        out => [ "vfp", "none", "none" ] },
2173         ins       => [ "base", "index", "mem", "dividend", "divisor", "fpcw" ],
2174         outs      => [ "res", "dummy", "M" ],
2175         am        => "source,binary",
2176         latency   => 20,
2177         units     => [ "VFP" ],
2178         attr_type => "ia32_x87_attr_t",
2179 },
2180
2181 vfprem => {
2182         reg_req   => { in => [ "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
2183         ins       => [ "left", "right", "fpcw" ],
2184         latency   => 20,
2185         units     => [ "VFP" ],
2186         mode      => "mode_E",
2187         attr_type => "ia32_x87_attr_t",
2188 },
2189
2190 vfabs => {
2191         irn_flags => "R",
2192         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
2193         ins       => [ "value" ],
2194         latency   => 2,
2195         units     => [ "VFP" ],
2196         mode      => "mode_E",
2197         attr_type => "ia32_x87_attr_t",
2198 },
2199
2200 vfchs => {
2201         irn_flags => "R",
2202         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
2203         ins       => [ "value" ],
2204         latency   => 2,
2205         units     => [ "VFP" ],
2206         mode      => "mode_E",
2207         attr_type => "ia32_x87_attr_t",
2208 },
2209
2210 vfld => {
2211         irn_flags => "R",
2212         op_flags  => "L|F",
2213         state     => "exc_pinned",
2214         reg_req   => { in => [ "gp", "gp", "none" ],
2215                        out => [ "vfp", "none", "none", "none" ] },
2216         ins       => [ "base", "index", "mem" ],
2217         outs      => [ "res", "unused", "M", "X_exc" ],
2218         attr      => "ir_mode *load_mode",
2219         init_attr => "attr->attr.ls_mode = load_mode;",
2220         latency   => 2,
2221         units     => [ "VFP" ],
2222         attr_type => "ia32_x87_attr_t",
2223 },
2224
2225 vfst => {
2226         irn_flags => "R",
2227         op_flags  => "L|F",
2228         state     => "exc_pinned",
2229         reg_req   => { in => [ "gp", "gp", "none", "vfp" ],
2230                        out => [ "none", "none" ] },
2231         ins       => [ "base", "index", "mem", "val" ],
2232         outs      => [ "M", "X_exc" ],
2233         attr      => "ir_mode *store_mode",
2234         init_attr => "attr->attr.ls_mode = store_mode;",
2235         latency   => 2,
2236         units     => [ "VFP" ],
2237         mode      => "mode_M",
2238         attr_type => "ia32_x87_attr_t",
2239 },
2240
2241 vfild => {
2242         state     => "exc_pinned",
2243         reg_req   => { in => [ "gp", "gp", "none" ],
2244                        out => [ "vfp", "none", "none" ] },
2245         outs      => [ "res", "unused", "M" ],
2246         ins       => [ "base", "index", "mem" ],
2247         latency   => 4,
2248         units     => [ "VFP" ],
2249         attr_type => "ia32_x87_attr_t",
2250 },
2251
2252 vfist => {
2253         state     => "exc_pinned",
2254         reg_req   => { in => [ "gp", "gp", "none", "vfp", "fpcw" ], out => [ "none" ] },
2255         ins       => [ "base", "index", "mem", "val", "fpcw" ],
2256         outs      => [ "M" ],
2257         latency   => 4,
2258         units     => [ "VFP" ],
2259         mode      => "mode_M",
2260         attr_type => "ia32_x87_attr_t",
2261 },
2262
2263 # SSE3 fisttp instruction
2264 vfisttp => {
2265         state     => "exc_pinned",
2266         reg_req   => { in => [ "gp", "gp", "none", "vfp" ], out => [ "in_r4", "none" ]},
2267         ins       => [ "base", "index", "mem", "val" ],
2268         outs      => [ "res", "M" ],
2269         latency   => 4,
2270         units     => [ "VFP" ],
2271         attr_type => "ia32_x87_attr_t",
2272 },
2273
2274 vfldz => {
2275         irn_flags => "R",
2276         reg_req   => { out => [ "vfp" ] },
2277         outs      => [ "res" ],
2278         latency   => 4,
2279         units     => [ "VFP" ],
2280         mode      => "mode_E",
2281         attr_type => "ia32_x87_attr_t",
2282 },
2283
2284 vfld1 => {
2285         irn_flags => "R",
2286         reg_req   => { out => [ "vfp" ] },
2287         outs      => [ "res" ],
2288         latency   => 4,
2289         units     => [ "VFP" ],
2290         mode      => "mode_E",
2291         attr_type => "ia32_x87_attr_t",
2292 },
2293
2294 vfldpi => {
2295         irn_flags => "R",
2296         reg_req   => { out => [ "vfp" ] },
2297         outs      => [ "res" ],
2298         latency   => 4,
2299         units     => [ "VFP" ],
2300         mode      => "mode_E",
2301         attr_type => "ia32_x87_attr_t",
2302 },
2303
2304 vfldln2 => {
2305         irn_flags => "R",
2306         reg_req   => { out => [ "vfp" ] },
2307         outs      => [ "res" ],
2308         latency   => 4,
2309         units     => [ "VFP" ],
2310         mode      => "mode_E",
2311         attr_type => "ia32_x87_attr_t",
2312 },
2313
2314 vfldlg2 => {
2315         irn_flags => "R",
2316         reg_req   => { out => [ "vfp" ] },
2317         outs      => [ "res" ],
2318         latency   => 4,
2319         units     => [ "VFP" ],
2320         mode      => "mode_E",
2321         attr_type => "ia32_x87_attr_t",
2322 },
2323
2324 vfldl2t => {
2325         irn_flags => "R",
2326         reg_req   => { out => [ "vfp" ] },
2327         outs      => [ "res" ],
2328         latency   => 4,
2329         units     => [ "VFP" ],
2330         mode      => "mode_E",
2331         attr_type => "ia32_x87_attr_t",
2332 },
2333
2334 vfldl2e => {
2335         irn_flags => "R",
2336         reg_req   => { out => [ "vfp" ] },
2337         outs      => [ "res" ],
2338         latency   => 4,
2339         units     => [ "VFP" ],
2340         mode      => "mode_E",
2341         attr_type => "ia32_x87_attr_t",
2342 },
2343
2344 vFucomFnstsw => {
2345 # we can't allow to rematerialize this node so we don't
2346 #  accidently produce Phi(Fucom, Fucom(ins_permuted))
2347 #       irn_flags => "R",
2348         reg_req   => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
2349         ins       => [ "left", "right" ],
2350         outs      => [ "flags" ],
2351         attr      => "int ins_permuted",
2352         init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
2353         latency   => 3,
2354         units     => [ "VFP" ],
2355         attr_type => "ia32_x87_attr_t",
2356         mode      => $mode_gp
2357 },
2358
2359 vFucomi => {
2360         irn_flags => "R",
2361         reg_req   => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
2362         ins       => [ "left", "right" ],
2363         outs      => [ "flags" ],
2364         attr      => "int ins_permuted",
2365         init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
2366         latency   => 3,
2367         units     => [ "VFP" ],
2368         attr_type => "ia32_x87_attr_t",
2369         mode      => $mode_gp
2370 },
2371
2372 vFtstFnstsw => {
2373 #       irn_flags => "R",
2374         reg_req   => { in => [ "vfp" ], out => [ "eax" ] },
2375         ins       => [ "left" ],
2376         outs      => [ "flags" ],
2377         attr      => "int ins_permuted",
2378         init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
2379         latency   => 3,
2380         units     => [ "VFP" ],
2381         attr_type => "ia32_x87_attr_t",
2382         mode      => $mode_gp
2383 },
2384
2385 Sahf => {
2386         irn_flags => "R",
2387         reg_req   => { in => [ "eax" ], out => [ "eflags" ] },
2388         ins       => [ "val" ],
2389         outs      => [ "flags" ],
2390         emit      => '. sahf',
2391         latency   => 1,
2392         units     => [ "GP" ],
2393         mode      => $mode_flags,
2394 },
2395
2396 fadd => {
2397         state     => "exc_pinned",
2398         emit      => '. fadd%XM %x87_binop',
2399         latency   => 4,
2400         attr_type => "ia32_x87_attr_t",
2401         constructors => {},
2402 },
2403
2404 faddp => {
2405         state     => "exc_pinned",
2406         emit      => '. faddp%XM %x87_binop',
2407         latency   => 4,
2408         attr_type => "ia32_x87_attr_t",
2409         constructors => {},
2410 },
2411
2412 fmul => {
2413         state     => "exc_pinned",
2414         emit      => '. fmul%XM %x87_binop',
2415         latency   => 4,
2416         attr_type => "ia32_x87_attr_t",
2417         constructors => {},
2418 },
2419
2420 fmulp => {
2421         state     => "exc_pinned",
2422         emit      => '. fmulp%XM %x87_binop',,
2423         latency   => 4,
2424         attr_type => "ia32_x87_attr_t",
2425         constructors => {},
2426 },
2427
2428 fsub => {
2429         state     => "exc_pinned",
2430         emit      => '. fsub%XM %x87_binop',
2431         latency   => 4,
2432         attr_type => "ia32_x87_attr_t",
2433         constructors => {},
2434 },
2435
2436 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
2437 #       are swapped, we work this around in the emitter...
2438
2439 fsubp => {
2440         state     => "exc_pinned",
2441 # see note about gas bugs
2442         emit      => '. fsubrp%XM %x87_binop',
2443         latency   => 4,
2444         attr_type => "ia32_x87_attr_t",
2445         constructors => {},
2446 },
2447
2448 fsubr => {
2449         state     => "exc_pinned",
2450         irn_flags => "R",
2451         emit      => '. fsubr%XM %x87_binop',
2452         latency   => 4,
2453         attr_type => "ia32_x87_attr_t",
2454         constructors => {},
2455 },
2456
2457 fsubrp => {
2458         state     => "exc_pinned",
2459         irn_flags => "R",
2460 # see note about gas bugs before fsubp
2461         emit      => '. fsubp%XM %x87_binop',
2462         latency   => 4,
2463         attr_type => "ia32_x87_attr_t",
2464         constructors => {},
2465 },
2466
2467 fprem => {
2468         emit      => '. fprem1',
2469         latency   => 20,
2470         attr_type => "ia32_x87_attr_t",
2471         constructors => {},
2472 },
2473
2474 # this node is just here, to keep the simulator running
2475 # we can omit this when a fprem simulation function exists
2476 fpremp => {
2477         emit      => '. fprem1\n'.
2478                      '. fstp %X0',
2479         latency   => 20,
2480         attr_type => "ia32_x87_attr_t",
2481         constructors => {},
2482 },
2483
2484 fdiv => {
2485         state     => "exc_pinned",
2486         emit      => '. fdiv%XM %x87_binop',
2487         latency   => 20,
2488         attr_type => "ia32_x87_attr_t",
2489         constructors => {},
2490 },
2491
2492 fdivp => {
2493         state     => "exc_pinned",
2494 # see note about gas bugs before fsubp
2495         emit      => '. fdivrp%XM %x87_binop',
2496         latency   => 20,
2497         attr_type => "ia32_x87_attr_t",
2498         constructors => {},
2499 },
2500
2501 fdivr => {
2502         state     => "exc_pinned",
2503         emit      => '. fdivr%XM %x87_binop',
2504         latency   => 20,
2505         attr_type => "ia32_x87_attr_t",
2506         constructors => {},
2507 },
2508
2509 fdivrp => {
2510         state     => "exc_pinned",
2511 # see note about gas bugs before fsubp
2512         emit      => '. fdivp%XM %x87_binop',
2513         latency   => 20,
2514         attr_type => "ia32_x87_attr_t",
2515         constructors => {},
2516 },
2517
2518 fabs => {
2519         emit      => '. fabs',
2520         latency   => 4,
2521         attr_type => "ia32_x87_attr_t",
2522         constructors => {},
2523 },
2524
2525 fchs => {
2526         op_flags  => "R|K",
2527         emit      => '. fchs',
2528         latency   => 4,
2529         attr_type => "ia32_x87_attr_t",
2530         constructors => {},
2531 },
2532
2533 fld => {
2534         op_flags  => "R|L|F",
2535         state     => "exc_pinned",
2536         emit      => '. fld%XM %AM',
2537         attr_type => "ia32_x87_attr_t",
2538         latency   => 2,
2539         constructors => {},
2540 },
2541
2542 fst => {
2543         op_flags  => "R|L|F",
2544         state     => "exc_pinned",
2545         emit      => '. fst%XM %AM',
2546         mode      => "mode_M",
2547         attr_type => "ia32_x87_attr_t",
2548         latency   => 2,
2549         constructors => {},
2550 },
2551
2552 fstp => {
2553         op_flags  => "R|L|F",
2554         state     => "exc_pinned",
2555         emit      => '. fstp%XM %AM',
2556         mode      => "mode_M",
2557         attr_type => "ia32_x87_attr_t",
2558         latency   => 2,
2559         constructors => {},
2560 },
2561
2562 fild => {
2563         state     => "exc_pinned",
2564         emit      => '. fild%XM %AM',
2565         attr_type => "ia32_x87_attr_t",
2566         latency   => 2,
2567         constructors => {},
2568 },
2569
2570 fist => {
2571         state     => "exc_pinned",
2572         emit      => '. fist%XM %AM',
2573         mode      => "mode_M",
2574         attr_type => "ia32_x87_attr_t",
2575         latency   => 2,
2576         constructors => {},
2577 },
2578
2579 fistp => {
2580         state     => "exc_pinned",
2581         emit      => '. fistp%XM %AM',
2582         mode      => "mode_M",
2583         attr_type => "ia32_x87_attr_t",
2584         latency   => 2,
2585         constructors => {},
2586 },
2587
2588 # SSE3 fisttp instruction
2589 fisttp => {
2590         state     => "exc_pinned",
2591         emit      => '. fisttp%XM %AM',
2592         mode      => "mode_M",
2593         attr_type => "ia32_x87_attr_t",
2594         latency   => 2,
2595         constructors => {},
2596 },
2597
2598 fldz => {
2599         op_flags  => "R|c|K",
2600         irn_flags => "R",
2601         reg_req   => { out => [ "vfp" ] },
2602         emit      => '. fldz',
2603         attr_type => "ia32_x87_attr_t",
2604         latency   => 2,
2605 },
2606
2607 fld1 => {
2608         op_flags  => "R|c|K",
2609         irn_flags => "R",
2610         reg_req   => { out => [ "vfp" ] },
2611         emit      => '. fld1',
2612         attr_type => "ia32_x87_attr_t",
2613         latency   => 2,
2614 },
2615
2616 fldpi => {
2617         op_flags  => "R|c|K",
2618         irn_flags => "R",
2619         reg_req   => { out => [ "vfp" ] },
2620         emit      => '. fldpi',
2621         attr_type => "ia32_x87_attr_t",
2622         latency   => 2,
2623 },
2624
2625 fldln2 => {
2626         op_flags  => "R|c|K",
2627         irn_flags => "R",
2628         reg_req   => { out => [ "vfp" ] },
2629         emit      => '. fldln2',
2630         attr_type => "ia32_x87_attr_t",
2631         latency   => 2,
2632 },
2633
2634 fldlg2 => {
2635         op_flags  => "R|c|K",
2636         irn_flags => "R",
2637         reg_req   => { out => [ "vfp" ] },
2638         emit      => '. fldlg2',
2639         attr_type => "ia32_x87_attr_t",
2640         latency   => 2,
2641 },
2642
2643 fldl2t => {
2644         op_flags  => "R|c|K",
2645         irn_flags => "R",
2646         reg_req   => { out => [ "vfp" ] },
2647         emit      => '. fldll2t',
2648         attr_type => "ia32_x87_attr_t",
2649         latency   => 2,
2650 },
2651
2652 fldl2e => {
2653         op_flags  => "R|c|K",
2654         irn_flags => "R",
2655         reg_req   => { out => [ "vfp" ] },
2656         emit      => '. fldl2e',
2657         attr_type => "ia32_x87_attr_t",
2658         latency   => 2,
2659 },
2660
2661 # fxch, fpush, fpop
2662 # Note that it is NEVER allowed to do CSE on these nodes
2663 # Moreover, note the virtual register requierements!
2664
2665 fxch => {
2666         op_flags  => "R|K",
2667         reg_req   => { out => [ "none" ] },
2668         cmp_attr  => "return 1;",
2669         emit      => '. fxch %X0',
2670         attr_type => "ia32_x87_attr_t",
2671         mode      => "mode_ANY",
2672         latency   => 1,
2673 },
2674
2675 fpush => {
2676         op_flags  => "R|K",
2677         reg_req   => { out => [ "none" ] },
2678         cmp_attr  => "return 1;",
2679         emit      => '. fld %X0',
2680         attr_type => "ia32_x87_attr_t",
2681         mode      => "mode_ANY",
2682         latency   => 1,
2683 },
2684
2685 fpushCopy => {
2686         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
2687         cmp_attr  => "return 1;",
2688         emit      => '. fld %X0',
2689         attr_type => "ia32_x87_attr_t",
2690         latency   => 1,
2691 },
2692
2693 fpop => {
2694         op_flags  => "K",
2695         reg_req   => { out => [ "none" ] },
2696         cmp_attr  => "return 1;",
2697         emit      => '. fstp %X0',
2698         attr_type => "ia32_x87_attr_t",
2699         mode      => "mode_ANY",
2700         latency   => 1,
2701 },
2702
2703 ffreep => {
2704         op_flags  => "K",
2705         reg_req   => { out => [ "none" ] },
2706         cmp_attr  => "return 1;",
2707         emit      => '. ffreep %X0',
2708         attr_type => "ia32_x87_attr_t",
2709         mode      => "mode_ANY",
2710         latency   => 1,
2711 },
2712
2713 emms => {
2714         op_flags  => "K",
2715         reg_req   => { out => [ "none" ] },
2716         cmp_attr  => "return 1;",
2717         emit      => '. emms',
2718         attr_type => "ia32_x87_attr_t",
2719         mode      => "mode_ANY",
2720         latency   => 3,
2721 },
2722
2723 femms => {
2724         op_flags  => "K",
2725         reg_req   => { out => [ "none" ] },
2726         cmp_attr  => "return 1;",
2727         emit      => '. femms',
2728         attr_type => "ia32_x87_attr_t",
2729         mode      => "mode_ANY",
2730         latency   => 3,
2731 },
2732
2733 FucomFnstsw => {
2734         reg_req   => { },
2735         emit      => ". fucom %X1\n".
2736                      ". fnstsw %%ax",
2737         attr_type => "ia32_x87_attr_t",
2738         latency   => 2,
2739 },
2740
2741 FucompFnstsw => {
2742         reg_req   => { },
2743         emit      => ". fucomp %X1\n".
2744                      ". fnstsw %%ax",
2745         attr_type => "ia32_x87_attr_t",
2746         latency   => 2,
2747 },
2748
2749 FucomppFnstsw => {
2750         reg_req   => { },
2751         emit      => ". fucompp\n".
2752                      ". fnstsw %%ax",
2753         attr_type => "ia32_x87_attr_t",
2754         latency   => 2,
2755 },
2756
2757 Fucomi => {
2758         reg_req   => { },
2759         emit      => '. fucomi %X1',
2760         attr_type => "ia32_x87_attr_t",
2761         latency   => 1,
2762 },
2763
2764 Fucompi => {
2765         reg_req   => { },
2766         emit      => '. fucompi %X1',
2767         attr_type => "ia32_x87_attr_t",
2768         latency   => 1,
2769 },
2770
2771 FtstFnstsw => {
2772         reg_req   => { },
2773         emit      => ". ftst\n".
2774                      ". fnstsw %%ax",
2775         attr_type => "ia32_x87_attr_t",
2776         latency   => 2,
2777 },
2778
2779 # Spilling and reloading of SSE registers, hardcoded, not generated #
2780
2781 xxLoad => {
2782         op_flags  => "L|F",
2783         state     => "exc_pinned",
2784         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2785         emit      => '. movdqu %D0, %AM',
2786         outs      => [ "res", "M" ],
2787         units     => [ "SSE" ],
2788         latency   => 1,
2789 },
2790
2791 xxStore => {
2792         op_flags => "L|F",
2793         state    => "exc_pinned",
2794         reg_req  => { in => [ "gp", "gp", "none", "xmm" ] },
2795         ins      => [ "base", "index", "mem", "val" ],
2796         emit     => '. movdqu %binop',
2797         units    => [ "SSE" ],
2798         latency   => 1,
2799         mode     => "mode_M",
2800 },
2801
2802 ); # end of %nodes
2803
2804 # Transform some attributes
2805 foreach my $op (keys(%nodes)) {
2806         my $node         = $nodes{$op};
2807         my $op_attr_init = $node->{op_attr_init};
2808
2809         if(defined($op_attr_init)) {
2810                 $op_attr_init .= "\n\t";
2811         } else {
2812                 $op_attr_init = "";
2813         }
2814
2815         if(!defined($node->{latency})) {
2816                 if($op =~ m/^l_/) {
2817                         $node->{latency} = 0;
2818                 } else {
2819                         die("Latency missing for op $op");
2820                 }
2821         }
2822         $op_attr_init .= "attr->latency = ".$node->{latency} . ";";
2823
2824         $node->{op_attr_init} = $op_attr_init;
2825 }
2826
2827 print "";