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