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