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