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