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