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