fix fehler59 (AddSP/SubSP must be pinned)
[libfirm] / ir / be / ia32 / ia32_spec.pl
1 # Creation: 2005/10/19
2 # $Id$
3 # This is the specification for the ia32 assembler Firm-operations
4
5 use File::Basename;
6
7 $new_emit_syntax = 1;
8 my $myname = $0;
9
10 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
11 $arch = "ia32";
12
13 # The node description is done as a perl hash initializer with the
14 # following structure:
15 #
16 # %nodes = (
17 #
18 # <op-name> => {
19 #   op_flags  => "N|L|C|X|I|F|Y|H|c|K",
20 #   irn_flags => "R|N|I|S"
21 #   arity     => "0|1|2|3 ... |variable|dynamic|any",
22 #   state     => "floats|pinned|mem_pinned|exc_pinned",
23 #   args      => [
24 #                    { type => "type 1", name => "name 1" },
25 #                    { type => "type 2", name => "name 2" },
26 #                    ...
27 #                  ],
28 #   comment   => "any comment for constructor",
29 #   reg_req   => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
30 #   cmp_attr  => "c source code for comparing node attributes",
31 #   emit      => "emit code with templates",
32 #   attr      => "attitional attribute arguments for constructor"
33 #   init_attr => "emit attribute initialization template"
34 #   rd_constructor => "c source code which constructs an ir_node"
35 #   latency   => "latency of this operation (can be float)"
36 #   attr_type => "name of the attribute struct",
37 # },
38 #
39 # ... # (all nodes you need to describe)
40 #
41 # ); # close the %nodes initializer
42
43 # op_flags: flags for the operation, OPTIONAL (default is "N")
44 # the op_flags correspond to the firm irop_flags:
45 #   N   irop_flag_none
46 #   L   irop_flag_labeled
47 #   C   irop_flag_commutative
48 #   X   irop_flag_cfopcode
49 #   I   irop_flag_ip_cfopcode
50 #   F   irop_flag_fragile
51 #   Y   irop_flag_forking
52 #   H   irop_flag_highlevel
53 #   c   irop_flag_constlike
54 #   K   irop_flag_keep
55 #
56 # irn_flags: special node flags, OPTIONAL (default is 0)
57 # following irn_flags are supported:
58 #   R   rematerializeable
59 #   N   not spillable
60 #   I   ignore for register allocation
61 #   S   modifies stack pointer
62 #
63 # state: state of the operation, OPTIONAL (default is "floats")
64 #
65 # arity: arity of the operation, MUST NOT BE OMITTED
66 #
67 # args:  the OPTIONAL arguments of the node constructor (debug, irg and block
68 #        are always the first 3 arguments and are always autmatically
69 #        created)
70 #        If this key is missing the following arguments will be created:
71 #        for i = 1 .. arity: ir_node *op_i
72 #        ir_mode *mode
73 #
74 # outs:  if a node defines more than one output, the names of the projections
75 #        nodes having outs having automatically the mode mode_T
76 #        One can also annotate some flags for each out, additional to irn_flags.
77 #        They are separated from name with a colon ':', and concatenated by pipe '|'
78 #        Only I and S are available at the moment (same meaning as in irn_flags).
79 #        example: [ "frame:I", "stack:I|S", "M" ]
80 #
81 # comment: OPTIONAL comment for the node constructor
82 #
83 # rd_constructor: for every operation there will be a
84 #      new_rd_<arch>_<op-name> function with the arguments from above
85 #      which creates the ir_node corresponding to the defined operation
86 #      you can either put the complete source code of this function here
87 #
88 #      This key is OPTIONAL. If omitted, the following constructor will
89 #      be created:
90 #      if (!op_<arch>_<op-name>) assert(0);
91 #      for i = 1 to arity
92 #         set in[i] = op_i
93 #      done
94 #      res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
95 #      return res
96 #
97 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
98 #
99 # latency: the latency of the operation, default is 1
100 #
101
102 # register types:
103 #   0 - no special type
104 #   1 - caller save (register must be saved by the caller of a function)
105 #   2 - callee save (register must be saved by the called function)
106 #   4 - ignore (do not assign this register)
107 #   8 - emitter can choose an arbitrary register of this class
108 #  16 - the register is a virtual one
109 #  32 - register represents a state
110 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
111 %reg_classes = (
112         gp => [
113                 { name => "eax", type => 1 },
114                 { name => "edx", type => 1 },
115                 { name => "ebx", type => 2 },
116                 { name => "ecx", type => 1 },
117                 { name => "esi", type => 2 },
118                 { name => "edi", type => 2 },
119                 { name => "ebp", type => 2 },
120                 { name => "esp", type => 4 },
121                 { name => "gp_NOREG", type => 4 | 8 | 16 }, # we need a dummy register for NoReg nodes
122                 { name => "gp_UKNWN", type => 4 | 8 | 16 },  # we need a dummy register for Unknown nodes
123                 { mode => "mode_Iu" }
124         ],
125         mmx => [
126                 { name => "mm0", type => 4 },
127                 { name => "mm1", type => 4 },
128                 { name => "mm2", type => 4 },
129                 { name => "mm3", type => 4 },
130                 { name => "mm4", type => 4 },
131                 { name => "mm5", type => 4 },
132                 { name => "mm6", type => 4 },
133                 { name => "mm7", type => 4 },
134                 { mode => "mode_E" }
135         ],
136         xmm => [
137                 { name => "xmm0", type => 1 },
138                 { name => "xmm1", type => 1 },
139                 { name => "xmm2", type => 1 },
140                 { name => "xmm3", type => 1 },
141                 { name => "xmm4", type => 1 },
142                 { name => "xmm5", type => 1 },
143                 { name => "xmm6", type => 1 },
144                 { name => "xmm7", type => 1 },
145                 { name => "xmm_NOREG", type => 4 | 16 },     # we need a dummy register for NoReg nodes
146                 { name => "xmm_UKNWN", type => 4 | 8 | 16},  # we need a dummy register for Unknown nodes
147                 { mode => "mode_E" }
148         ],
149         vfp => [
150                 { name => "vf0", type => 1 | 16 },
151                 { name => "vf1", type => 1 | 16 },
152                 { name => "vf2", type => 1 | 16 },
153                 { name => "vf3", type => 1 | 16 },
154                 { name => "vf4", type => 1 | 16 },
155                 { name => "vf5", type => 1 | 16 },
156                 { name => "vf6", type => 1 | 16 },
157                 { name => "vf7", type => 1 | 16 },
158                 { name => "vfp_NOREG", type => 4 | 8 | 16 }, # we need a dummy register for NoReg nodes
159                 { name => "vfp_UKNWN", type => 4 | 8 | 16 },  # we need a dummy register for Unknown nodes
160                 { mode => "mode_E" }
161         ],
162         st => [
163                 { name => "st0", realname => "st",    type => 4 },
164                 { name => "st1", realname => "st(1)", type => 4 },
165                 { name => "st2", realname => "st(2)", type => 4 },
166                 { name => "st3", realname => "st(3)", type => 4 },
167                 { name => "st4", realname => "st(4)", type => 4 },
168                 { name => "st5", realname => "st(5)", type => 4 },
169                 { name => "st6", realname => "st(6)", type => 4 },
170                 { name => "st7", realname => "st(7)", type => 4 },
171                 { mode => "mode_E" }
172         ],
173         fp_cw => [      # the floating point control word
174                 { name => "fpcw", type => 4 | 32},
175                 { mode => "mode_fpcw" }
176         ],
177         flags => [
178                 { name => "eflags", type => 4 },
179                 { mode => "mode_Iu" }
180         ],
181         fp_sw => [
182                 { name => "fpsw", type => 4 },
183                 { mode => "mode_Hu" }
184         ],
185 ); # %reg_classes
186
187 %flags = (
188         CF  => { reg => "eflags", bit => 0 },
189         PF  => { reg => "eflags", bit => 2 },
190         AF  => { reg => "eflags", bit => 4 },
191         ZF  => { reg => "eflags", bit => 6 },
192         SF  => { reg => "eflags", bit => 7 },
193         TF  => { reg => "eflags", bit => 8 },
194         IF  => { reg => "eflags", bit => 9 },
195         DF  => { reg => "eflags", bit => 10 },
196         OF  => { reg => "eflags", bit => 11 },
197         IOPL0 => { reg => "eflags", bit => 12 },
198         IOPL1 => { reg => "eflags", bit => 13 },
199         NT  => { reg => "eflags", bit => 14 },
200         RF  => { reg => "eflags", bit => 16 },
201         VM  => { reg => "eflags", bit => 17 },
202         AC  => { reg => "eflags", bit => 18 },
203         VIF => { reg => "eflags", bit => 19 },
204         VIP => { reg => "eflags", bit => 20 },
205         ID  => { reg => "eflags", bit => 21 },
206
207         FP_IE => { reg => "fpsw", bit => 0 },
208         FP_DE => { reg => "fpsw", bit => 1 },
209         FP_ZE => { reg => "fpsw", bit => 2 },
210         FP_OE => { reg => "fpsw", bit => 3 },
211         FP_UE => { reg => "fpsw", bit => 4 },
212         FP_PE => { reg => "fpsw", bit => 5 },
213         FP_SF => { reg => "fpsw", bit => 6 },
214         FP_ES => { reg => "fpsw", bit => 7 },
215         FP_C0 => { reg => "fpsw", bit => 8 },
216         FP_C1 => { reg => "fpsw", bit => 9 },
217         FP_C2 => { reg => "fpsw", bit => 10 },
218         FP_TOP0 => { reg => "fpsw", bit => 11 },
219         FP_TOP1 => { reg => "fpsw", bit => 12 },
220         FP_TOP2 => { reg => "fpsw", bit => 13 },
221         FP_C3 => { reg => "fpsw", bit => 14 },
222         FP_B  => { reg => "fpsw", bit => 15 },
223
224         FP_IM => { reg => "fpcw", bit => 0 },
225         FP_DM => { reg => "fpcw", bit => 1 },
226         FP_ZM => { reg => "fpcw", bit => 2 },
227         FP_OM => { reg => "fpcw", bit => 3 },
228         FP_UM => { reg => "fpcw", bit => 4 },
229         FP_PM => { reg => "fpcw", bit => 5 },
230         FP_PC0 => { reg => "fpcw", bit => 8 },
231         FP_PC1 => { reg => "fpcw", bit => 9 },
232         FP_RC0 => { reg => "fpcw", bit => 10 },
233         FP_RC1 => { reg => "fpcw", bit => 11 },
234         FP_X  => { reg => "fpcw", bit => 12 }
235 ); # %flags
236
237 %cpu = (
238         GP     => [ 1, "GP_EAX", "GP_EBX", "GP_ECX", "GP_EDX", "GP_ESI", "GP_EDI", "GP_EBP" ],
239         SSE    => [ 1, "SSE_XMM0", "SSE_XMM1", "SSE_XMM2", "SSE_XMM3", "SSE_XMM4", "SSE_XMM5", "SSE_XMM6", "SSE_XMM7" ],
240         VFP    => [ 1, "VFP_VF0", "VFP_VF1", "VFP_VF2", "VFP_VF3", "VFP_VF4", "VFP_VF5", "VFP_VF6", "VFP_VF7" ],
241         BRANCH => [ 1, "BRANCH1", "BRANCH2" ],
242 ); # %cpu
243
244 %vliw = (
245         bundle_size       => 1,
246         bundels_per_cycle => 1
247 ); # vliw
248
249 %emit_templates = (
250         S0 => "${arch}_emit_source_register(env, node, 0);",
251         S1 => "${arch}_emit_source_register(env, node, 1);",
252         S2 => "${arch}_emit_source_register(env, node, 2);",
253         S3 => "${arch}_emit_source_register(env, node, 3);",
254         S4 => "${arch}_emit_source_register(env, node, 4);",
255         S5 => "${arch}_emit_source_register(env, node, 5);",
256         SB0 => "${arch}_emit_8bit_source_register(env, node, 0);",
257         SW0 => "${arch}_emit_16bit_source_register(env, node, 0);",
258         D0 => "${arch}_emit_dest_register(env, node, 0);",
259         D1 => "${arch}_emit_dest_register(env, node, 1);",
260         D2 => "${arch}_emit_dest_register(env, node, 2);",
261         D3 => "${arch}_emit_dest_register(env, node, 3);",
262         D4 => "${arch}_emit_dest_register(env, node, 4);",
263         D5 => "${arch}_emit_dest_register(env, node, 5);",
264         X0 => "${arch}_emit_x87_name(env, node, 0);",
265         X1 => "${arch}_emit_x87_name(env, node, 1);",
266         X2 => "${arch}_emit_x87_name(env, node, 2);",
267         C  => "${arch}_emit_immediate(env, node);",
268         SE => "${arch}_emit_extend_suffix(env, get_ia32_ls_mode(node));",
269         ME => "if(get_mode_size_bits(get_ia32_ls_mode(node)) != 32)\n
270                    ia32_emit_mode_suffix(env, node);",
271         M  => "${arch}_emit_mode_suffix(env, node);",
272         XM => "${arch}_emit_x87_mode_suffix(env, node);",
273         XXM => "${arch}_emit_xmm_mode_suffix(env, node);",
274         XSD => "${arch}_emit_xmm_mode_suffix_s(env, node);",
275         AM => "${arch}_emit_am(env, node);",
276         unop0 => "${arch}_emit_unop(env, node, 0);",
277         unop1 => "${arch}_emit_unop(env, node, 1);",
278         unop2 => "${arch}_emit_unop(env, node, 2);",
279         unop3 => "${arch}_emit_unop(env, node, 3);",
280         unop4 => "${arch}_emit_unop(env, node, 4);",
281         DAM0  => "${arch}_emit_am_or_dest_register(env, node, 0);",
282         DAM1  => "${arch}_emit_am_or_dest_register(env, node, 0);",
283         binop => "${arch}_emit_binop(env, node);",
284         x87_binop => "${arch}_emit_x87_binop(env, node);",
285 );
286
287 #--------------------------------------------------#
288 #                        _                         #
289 #                       (_)                        #
290 #  _ __   _____      __  _ _ __    ___  _ __  ___  #
291 # | '_ \ / _ \ \ /\ / / | | '__|  / _ \| '_ \/ __| #
292 # | | | |  __/\ V  V /  | | |    | (_) | |_) \__ \ #
293 # |_| |_|\___| \_/\_/   |_|_|     \___/| .__/|___/ #
294 #                                      | |         #
295 #                                      |_|         #
296 #--------------------------------------------------#
297
298 $default_attr_type = "ia32_attr_t";
299 $default_copy_attr = "ia32_copy_attr";
300
301 %init_attr = (
302         ia32_attr_t     => "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);",
303         ia32_x87_attr_t =>
304                 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
305                 "\tinit_ia32_x87_attributes(res);",
306         ia32_asm_attr_t =>
307                 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
308                 "\tinit_ia32_x87_attributes(res);".
309                 "\tinit_ia32_asm_attributes(res);",
310         ia32_immediate_attr_t =>
311                 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
312                 "\tinit_ia32_immediate_attributes(res, symconst, symconst_sign, offset);"
313 );
314
315 %compare_attr = (
316         ia32_attr_t           => "ia32_compare_nodes_attr",
317         ia32_x87_attr_t       => "ia32_compare_x87_attr",
318         ia32_asm_attr_t       => "ia32_compare_asm_attr",
319         ia32_immediate_attr_t => "ia32_compare_immediate_attr",
320 );
321
322 %operands = (
323 );
324
325 $mode_xmm     = "mode_E";
326 $mode_gp      = "mode_Iu";
327 $mode_fpcw    = "mode_fpcw";
328 $status_flags = [ "CF", "PF", "AF", "ZF", "SF", "OF" ];
329 $fpcw_flags   = [ "FP_IM", "FP_DM", "FP_ZM", "FP_OM", "FP_UM", "FP_PM",
330                   "FP_PC0", "FP_PC1", "FP_RC0", "FP_RC1", "FP_X" ];
331
332 %nodes = (
333
334 Immediate => {
335         state     => "pinned",
336         op_flags  => "c",
337         irn_flags => "I",
338         reg_req   => { out => [ "gp_NOREG" ] },
339         attr      => "ir_entity *symconst, int symconst_sign, long offset",
340         attr_type => "ia32_immediate_attr_t",
341         latency   => 0,
342         mode      => $mode_gp,
343 },
344
345 Asm => {
346         mode      => "mode_T",
347         arity     => "variable",
348         out_arity => "variable",
349         attr_type => "ia32_asm_attr_t",
350         latency   => 100,
351 },
352
353 ProduceVal => {
354         op_flags  => "c",
355         irn_flags => "R",
356         reg_req   => { out => [ "gp" ] },
357         emit      => "",
358         units     => [ ],
359         latency   => 0,
360         mode      => $mode_gp,
361         cmp_attr  => "return 1;",
362 },
363
364 #-----------------------------------------------------------------#
365 #  _       _                                         _            #
366 # (_)     | |                                       | |           #
367 #  _ _ __ | |_ ___  __ _  ___ _ __   _ __   ___   __| | ___  ___  #
368 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
369 # | | | | | ||  __/ (_| |  __/ |    | | | | (_) | (_| |  __/\__ \ #
370 # |_|_| |_|\__\___|\__, |\___|_|    |_| |_|\___/ \__,_|\___||___/ #
371 #                   __/ |                                         #
372 #                  |___/                                          #
373 #-----------------------------------------------------------------#
374
375 # commutative operations
376
377 # NOTE:
378 # All nodes supporting Addressmode have 5 INs:
379 # 1 - base    r1 == NoReg in case of no AM or no base
380 # 2 - index   r2 == NoReg in case of no AM or no index
381 # 3 - op1     r3 == always present
382 # 4 - op2     r4 == NoReg in case of immediate operation
383 # 5 - mem     NoMem in case of no AM otherwise it takes the mem from the Load
384
385 Add => {
386         irn_flags => "R",
387         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
388         ins       => [ "base", "index", "left", "right", "mem" ],
389         emit      => '. add%M %binop',
390         units     => [ "GP" ],
391         mode      => $mode_gp,
392         modified_flags => $status_flags
393 },
394
395 Adc => {
396         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
397         emit      => '. adc%M %binop',
398         units     => [ "GP" ],
399         mode      => $mode_gp,
400         modified_flags => $status_flags
401 },
402
403 Add64Bit => {
404         irn_flags => "R",
405         arity     => 4,
406         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
407         emit      => '
408 . movl %S0, %D0
409 . movl %S1, %D1
410 . addl %S2, %D0
411 . adcl %S3, %D1
412 ',
413         outs      => [ "low_res", "high_res" ],
414         units     => [ "GP" ],
415         modified_flags => $status_flags
416 },
417
418 l_Add => {
419         op_flags  => "C",
420         irn_flags => "R",
421         cmp_attr  => "return 1;",
422         arity     => 2,
423 },
424
425 l_Adc => {
426         op_flags  => "C",
427         cmp_attr  => "return 1;",
428         arity     => 2,
429 },
430
431 Mul => {
432         # we should not rematrialize this node. It produces 2 results and has
433         # very strict constrains
434         reg_req   => { in => [ "gp", "gp", "eax", "gp", "none" ], out => [ "eax", "edx", "none" ] },
435         emit      => '. mul%M %unop3',
436         outs      => [ "EAX", "EDX", "M" ],
437         ins       => [ "base", "index", "val_high", "val_low", "mem" ],
438         latency   => 10,
439         units     => [ "GP" ],
440         modified_flags => $status_flags
441 },
442
443 l_Mul => {
444         # we should not rematrialize this node. It produces 2 results and has
445         # very strict constrains
446         op_flags  => "C",
447         cmp_attr  => "return 1;",
448         outs      => [ "EAX", "EDX", "M" ],
449         arity     => 2
450 },
451
452 IMul => {
453         irn_flags => "R",
454         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
455         emit      => '. imul%M %binop',
456         latency   => 5,
457         units     => [ "GP" ],
458         mode      => $mode_gp,
459         modified_flags => $status_flags
460 },
461
462 IMul1OP => {
463         irn_flags => "R",
464         reg_req   => { in => [ "gp", "gp", "eax", "gp", "none" ], out => [ "eax", "edx", "none" ] },
465         emit      => '. imul%M %unop3',
466         outs      => [ "EAX", "EDX", "M" ],
467         ins       => [ "base", "index", "val_high", "val_low", "mem" ],
468         latency   => 5,
469         units     => [ "GP" ],
470         modified_flags => $status_flags
471 },
472
473 l_IMul => {
474         op_flags  => "C",
475         cmp_attr  => "return 1;",
476         arity     => 2
477 },
478
479 And => {
480         irn_flags => "R",
481         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
482         emit      => '. and%M %binop',
483         units     => [ "GP" ],
484         mode      => $mode_gp,
485         modified_flags => $status_flags
486 },
487
488 Or => {
489         irn_flags => "R",
490         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
491         emit      => '. or%M %binop',
492         units     => [ "GP" ],
493         mode      => $mode_gp,
494         modified_flags => $status_flags
495 },
496
497 Xor => {
498         irn_flags => "R",
499         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
500         emit      => '. xor%M %binop',
501         units     => [ "GP" ],
502         mode      => $mode_gp,
503         modified_flags => $status_flags
504 },
505
506 l_Xor => {
507         op_flags  => "C",
508         cmp_attr  => "return 1;",
509         arity     => 2,
510         modified_flags => $status_flags
511 },
512
513 # not commutative operations
514
515 Sub => {
516         irn_flags => "R",
517         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
518         emit      => '. sub%M %binop',
519         units     => [ "GP" ],
520         mode      => $mode_gp,
521         modified_flags => $status_flags
522 },
523
524 Sbb => {
525         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3 !in_r4" ] },
526         emit      => '. sbb%M %binop',
527         units     => [ "GP" ],
528         mode      => $mode_gp,
529         modified_flags => $status_flags
530 },
531
532 Sub64Bit => {
533         irn_flags => "R",
534         arity     => 4,
535         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
536         emit      => '
537 . movl %S0, %D0
538 . movl %S1, %D1
539 . subl %S2, %D0
540 . sbbl %S3, %D1
541 ',
542         outs      => [ "low_res", "high_res" ],
543         units     => [ "GP" ],
544         modified_flags => $status_flags
545 },
546
547 l_Sub => {
548         irn_flags => "R",
549         cmp_attr  => "return 1;",
550         arity     => 2,
551 },
552
553 l_Sbb => {
554         cmp_attr  => "return 1;",
555         arity     => 2,
556 },
557
558 IDiv => {
559         op_flags  => "F|L",
560         state     => "exc_pinned",
561         reg_req   => { in => [ "gp", "gp", "eax", "edx", "gp", "none" ], out => [ "eax", "edx", "none" ] },
562         attr      => "ia32_op_flavour_t dm_flav",
563         init_attr => "attr->data.op_flav = dm_flav;",
564         emit      => ". idiv%M %unop4",
565         outs      => [ "div_res", "mod_res", "M" ],
566         latency   => 25,
567         units     => [ "GP" ],
568         modified_flags => $status_flags
569 },
570
571 Div => {
572         op_flags  => "F|L",
573         state     => "exc_pinned",
574         reg_req   => { in => [ "gp", "gp", "eax", "edx", "gp", "none" ], out => [ "eax", "edx", "none" ] },
575         attr      => "ia32_op_flavour_t dm_flav",
576         init_attr => "attr->data.op_flav = dm_flav;",
577         emit      => ". div%M %unop4",
578         outs      => [ "div_res", "mod_res", "M" ],
579         latency   => 25,
580         units     => [ "GP" ],
581         modified_flags => $status_flags
582 },
583
584 Shl => {
585         irn_flags => "R",
586         # "in_r3" would be enough as out requirement, but the register allocator
587         # does strange things then and doesn't respect the constraint for in4
588         # if the same value is attached to in3 and in4 (if you have "i << i" in C)
589         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
590         ins       => [ "base", "index", "left", "right", "mem" ],
591         emit      => '. shl%M %binop',
592         units     => [ "GP" ],
593         mode      => $mode_gp,
594         modified_flags => $status_flags
595 },
596
597 l_Shl => {
598         cmp_attr  => "return 1;",
599         arity     => 2
600 },
601
602 ShlD => {
603         irn_flags => "R",
604         # Out requirements is: different from all in
605         # This is because, out must be different from LowPart and ShiftCount.
606         # We could say "!ecx !in_r4" but it can occur, that all values live through
607         # this Shift and the only value dying is the ShiftCount. Then there would be
608         # a register missing, as result must not be ecx and all other registers are
609         # occupied. What we should write is "!in_r4 !in_r5", but this is not
610         # supported (and probably never will). So we create artificial interferences
611         # of the result with all inputs, so the spiller can always assure a free
612         # register.
613         reg_req   => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
614         emit      =>
615 '
616 if (get_ia32_immop_type(node) == ia32_ImmNone) {
617         if (get_ia32_op_type(node) == ia32_AddrModeD) {
618                 . shld%M %%cl, %S3, %AM
619         } else {
620                 . shld%M %%cl, %S3, %S2
621         }
622 } else {
623         if (get_ia32_op_type(node) == ia32_AddrModeD) {
624                 . shld%M %C, %S3, %AM
625         } else {
626                 . shld%M %C, %S3, %S2
627         }
628 }
629 ',
630         latency   => 6,
631         units     => [ "GP" ],
632         mode      => $mode_gp,
633         modified_flags => $status_flags
634 },
635
636 l_ShlD => {
637         cmp_attr  => "return 1;",
638         arity     => 3,
639 },
640
641 Shr => {
642         irn_flags => "R",
643         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
644         emit      => '. shr%M %binop',
645         units     => [ "GP" ],
646         mode      => $mode_gp,
647         modified_flags => $status_flags
648 },
649
650 l_Shr => {
651         cmp_attr  => "return 1;",
652         arity     => 2
653 },
654
655 ShrD => {
656         irn_flags => "R",
657         # Out requirements is: different from all in
658         # This is because, out must be different from LowPart and ShiftCount.
659         # We could say "!ecx !in_r4" but it can occur, that all values live through
660         # this Shift and the only value dying is the ShiftCount. Then there would be a
661         # register missing, as result must not be ecx and all other registers are
662         # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
663         # (and probably never will). So we create artificial interferences of the result
664         # with all inputs, so the spiller can always assure a free register.
665         reg_req   => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
666         emit      => '
667 if (get_ia32_immop_type(node) == ia32_ImmNone) {
668         if (get_ia32_op_type(node) == ia32_AddrModeD) {
669                 . shrd%M %%cl, %S3, %AM
670         } else {
671                 . shrd%M %%cl, %S3, %S2
672         }
673 } else {
674         if (get_ia32_op_type(node) == ia32_AddrModeD) {
675                 . shrd%M %C, %S3, %AM
676         } else {
677                 . shrd%M %C, %S3, %S2
678         }
679 }
680 ',
681         latency   => 6,
682         units     => [ "GP" ],
683         mode      => $mode_gp,
684         modified_flags => $status_flags
685 },
686
687 l_ShrD => {
688         cmp_attr  => "return 1;",
689         arity     => 3
690 },
691
692 Sar => {
693         irn_flags => "R",
694         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
695         emit      => '. sar%M %binop',
696         units     => [ "GP" ],
697         mode      => $mode_gp,
698         modified_flags => $status_flags
699 },
700
701 l_Sar => {
702         cmp_attr  => "return 1;",
703         arity     => 2
704 },
705
706 Ror => {
707         irn_flags => "R",
708         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
709         emit      => '. ror%M %binop',
710         units     => [ "GP" ],
711         mode      => $mode_gp,
712         modified_flags => $status_flags
713 },
714
715 Rol => {
716         irn_flags => "R",
717         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
718         emit      => '. rol%M %binop',
719         units     => [ "GP" ],
720         mode      => $mode_gp,
721         modified_flags => $status_flags
722 },
723
724 # unary operations
725
726 Neg => {
727         irn_flags => "R",
728         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
729         emit      => '. neg%M %unop2',
730         ins       => [ "base", "index", "val", "mem" ],
731         units     => [ "GP" ],
732         mode      => $mode_gp,
733         modified_flags => $status_flags
734 },
735
736 Minus64Bit => {
737         irn_flags => "R",
738         reg_req   => { in => [ "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
739         emit      => '
740 . movl %S0, %D0
741 . movl %S0, %D1
742 . subl %S1, %D0
743 . sbbl %S2, %D1
744 ',
745         outs      => [ "low_res", "high_res" ],
746         units     => [ "GP" ],
747         modified_flags => $status_flags
748 },
749
750
751 l_Neg => {
752         cmp_attr  => "return 1;",
753         arity     => 1,
754 },
755
756 Inc => {
757         irn_flags => "R",
758         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
759         emit      => '. inc%M %unop2',
760         units     => [ "GP" ],
761         mode      => $mode_gp,
762         modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
763 },
764
765 Dec => {
766         irn_flags => "R",
767         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
768         emit      => '. dec%M %unop2',
769         units     => [ "GP" ],
770         mode      => $mode_gp,
771         modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
772 },
773
774 Not => {
775         irn_flags => "R",
776         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
777         ins       => [ "base", "index", "val", "mem" ],
778         emit      => '. not%M %unop2',
779         units     => [ "GP" ],
780         mode      => $mode_gp,
781         modified_flags => []
782 },
783
784 # other operations
785
786 CondJmp => {
787         state     => "pinned",
788         op_flags  => "L|X|Y",
789         reg_req   => { in  => [ "gp", "gp", "gp", "gp", "none" ],
790                        out => [ "none", "none"] },
791         ins       => [ "base", "index", "left", "right", "mem" ],
792         outs      => [ "false", "true" ],
793         attr      => "long pnc",
794         init_attr => "attr->pn_code = pnc;",
795         latency   => 3,
796         units     => [ "BRANCH" ],
797 },
798
799 TestJmp => {
800         state     => "pinned",
801         op_flags  => "L|X|Y",
802         reg_req   => { in  => [ "gp", "gp", "gp", "gp", "none" ],
803                        out => [ "none", "none" ] },
804         ins       => [ "base", "index", "left", "right", "mem" ],
805         outs      => [ "false", "true" ],
806         attr      => "long pnc",
807         init_attr => "attr->pn_code = pnc;",
808         latency   => 3,
809         units     => [ "BRANCH" ],
810 },
811
812 SwitchJmp => {
813         state     => "pinned",
814         op_flags  => "L|X|Y",
815         reg_req   => { in => [ "gp" ], out => [ "none" ] },
816         latency   => 3,
817         units     => [ "BRANCH" ],
818         mode      => "mode_T",
819 },
820
821 IJmp => {
822         state     => "pinned",
823         op_flags  => "X",
824         reg_req   => { in => [ "gp", "gp", "gp", "none" ] },
825         ins       => [ "base", "index", "val", "mem" ],
826         emit      => '. jmp *%unop2',
827         units     => [ "BRANCH" ],
828         mode      => "mode_X",
829         modified_flags => []
830 },
831
832 Const => {
833         op_flags  => "c",
834         irn_flags => "R",
835         reg_req   => { out => [ "gp" ] },
836         units     => [ "GP" ],
837         mode      => $mode_gp,
838 },
839
840 Unknown_GP => {
841         state     => "pinned",
842         op_flags  => "c",
843         irn_flags => "I",
844         reg_req   => { out => [ "gp_UKNWN" ] },
845         units     => [],
846         emit      => "",
847         mode      => $mode_gp
848 },
849
850 Unknown_VFP => {
851         state     => "pinned",
852         op_flags  => "c",
853         irn_flags => "I",
854         reg_req   => { out => [ "vfp_UKNWN" ] },
855         units     => [],
856         emit      => "",
857         mode      => "mode_E",
858         attr_type => "ia32_x87_attr_t",
859 },
860
861 Unknown_XMM => {
862         state     => "pinned",
863         op_flags  => "c",
864         irn_flags => "I",
865         reg_req   => { out => [ "xmm_UKNWN" ] },
866         units     => [],
867         emit      => "",
868         mode      => "mode_E"
869 },
870
871 NoReg_GP => {
872         state     => "pinned",
873         op_flags  => "c",
874         irn_flags => "I",
875         reg_req   => { out => [ "gp_NOREG" ] },
876         units     => [],
877         emit      => "",
878         mode      => $mode_gp
879 },
880
881 NoReg_VFP => {
882         state     => "pinned",
883         op_flags  => "c",
884         irn_flags => "I",
885         reg_req   => { out => [ "vfp_NOREG" ] },
886         units     => [],
887         emit      => "",
888         mode      => "mode_E",
889         attr_type => "ia32_x87_attr_t",
890 },
891
892 NoReg_XMM => {
893         state     => "pinned",
894         op_flags  => "c",
895         irn_flags => "I",
896         reg_req   => { out => [ "xmm_NOREG" ] },
897         units     => [],
898         emit      => "",
899         mode      => "mode_E"
900 },
901
902 ChangeCW => {
903         state     => "pinned",
904         op_flags  => "c",
905         irn_flags => "I",
906         reg_req   => { out => [ "fp_cw" ] },
907         mode      => $mode_fpcw,
908         latency   => 3,
909         units     => [ "GP" ],
910         modified_flags => $fpcw_flags
911 },
912
913 FldCW => {
914         op_flags  => "L|F",
915         state     => "pinned",
916         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
917         latency   => 5,
918         emit      => ". fldcw %AM",
919         mode      => $mode_fpcw,
920         units     => [ "GP" ],
921         modified_flags => $fpcw_flags
922 },
923
924 FnstCW => {
925         op_flags  => "L|F",
926         state     => "pinned",
927         reg_req   => { in => [ "gp", "gp", "fp_cw", "none" ], out => [ "none" ] },
928         latency   => 5,
929         emit      => ". fnstcw %AM",
930         mode      => "mode_M",
931         units     => [ "GP" ],
932 },
933
934 Cltd => {
935         # we should not rematrialize this node. It produces 2 results and has
936         # very strict constrains
937         reg_req   => { in => [ "eax", "edx" ], out => [ "edx" ] },
938         ins       => [ "val", "globbered" ],
939         emit      => '. cltd',
940         mode      => $mode_gp,
941         units     => [ "GP" ],
942 },
943
944 # Load / Store
945 #
946 # Note that we add additional latency values depending on address mode, so a
947 # lateny of 0 for load is correct
948
949 Load => {
950         op_flags  => "L|F",
951         state     => "exc_pinned",
952         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
953         ins       => [ "base", "index", "mem" ],
954         outs      => [ "res", "M" ],
955         latency   => 0,
956         emit      => ". mov%SE%ME%.l %AM, %D0",
957         units     => [ "GP" ],
958 },
959
960 l_Load => {
961         op_flags  => "L|F",
962         cmp_attr  => "return 1;",
963         outs      => [ "res", "M" ],
964         arity     => 2,
965 },
966
967 l_Store => {
968         op_flags  => "L|F",
969         cmp_attr  => "return 1;",
970         state     => "exc_pinned",
971         arity     => 3,
972         mode      => "mode_M",
973 },
974
975 Store => {
976         op_flags  => "L|F",
977         state     => "exc_pinned",
978         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "none" ] },
979         ins       => [ "base", "index", "val", "mem" ],
980         emit      => '. mov%M %binop',
981         latency   => 2,
982         units     => [ "GP" ],
983         mode      => "mode_M",
984 },
985
986 Store8Bit => {
987         op_flags  => "L|F",
988         state     => "exc_pinned",
989         reg_req   => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => ["none" ] },
990         emit      => '. mov%M %binop',
991         latency   => 2,
992         units     => [ "GP" ],
993         mode      => "mode_M",
994 },
995
996 Lea => {
997         irn_flags => "R",
998         reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
999         emit      => '. leal %AM, %D0',
1000         latency   => 2,
1001         units     => [ "GP" ],
1002         mode      => $mode_gp,
1003         modified_flags => [],
1004 },
1005
1006 Push => {
1007         reg_req   => { in => [ "gp", "gp", "gp", "esp", "none" ], out => [ "esp", "none" ] },
1008         emit      => '. push%M %unop2',
1009         ins       => [ "base", "index", "val", "stack", "mem" ],
1010         outs      => [ "stack:I|S", "M" ],
1011         latency   => 2,
1012         units     => [ "GP" ],
1013         modified_flags => [],
1014 },
1015
1016 Pop => {
1017         reg_req   => { in => [ "gp", "gp", "esp", "none" ], out => [ "esp", "gp", "none" ] },
1018         emit      => '. pop%M %DAM1',
1019         outs      => [ "stack:I|S", "res", "M" ],
1020         ins       => [ "base", "index", "stack", "mem" ],
1021         latency   => 3, # Pop is more expensive than Push on Athlon
1022         units     => [ "GP" ],
1023         modified_flags => [],
1024 },
1025
1026 Enter => {
1027         reg_req   => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1028         emit      => '. enter',
1029         outs      => [ "frame:I", "stack:I|S", "M" ],
1030         latency   => 15,
1031         units     => [ "GP" ],
1032 },
1033
1034 Leave => {
1035         reg_req   => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1036         emit      => '. leave',
1037         outs      => [ "frame:I", "stack:I|S" ],
1038         latency   => 3,
1039         units     => [ "GP" ],
1040 },
1041
1042 AddSP => {
1043         irn_flags => "I",
1044         state     => "pinned",
1045         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "none" ] },
1046         emit      => '. addl %binop',
1047         outs      => [ "stack:S", "M" ],
1048         units     => [ "GP" ],
1049         modified_flags => $status_flags
1050 },
1051
1052 SubSP => {
1053 #irn_flags => "I",
1054         state     => "pinned",
1055         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "gp", "none" ] },
1056         emit      => ". subl %binop\n".
1057                      ". movl %%esp, %D1",
1058         outs      => [ "stack:I|S", "addr", "M" ],
1059         units     => [ "GP" ],
1060         modified_flags => $status_flags
1061 },
1062
1063 LdTls => {
1064         irn_flags => "R",
1065         reg_req   => { out => [ "gp" ] },
1066         units     => [ "GP" ],
1067 },
1068
1069 # the int instruction
1070 int => {
1071         reg_req   => { in => [ "none" ], out => [ "none" ] },
1072         mode      => "mode_M",
1073         attr      => "tarval *tv",
1074         init_attr => "\tset_ia32_Immop_tarval(res, tv);",
1075         emit      => '. int %C',
1076         units     => [ "GP" ],
1077         cmp_attr  => "return 1;",
1078 },
1079
1080
1081 #-----------------------------------------------------------------------------#
1082 #   _____ _____ ______    __ _             _                     _            #
1083 #  / ____/ ____|  ____|  / _| |           | |                   | |           #
1084 # | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1085 #  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1086 #  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1087 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1088 #-----------------------------------------------------------------------------#
1089
1090 # commutative operations
1091
1092 xAdd => {
1093         irn_flags => "R",
1094         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1095         emit      => '. add%XXM %binop',
1096         latency   => 4,
1097         units     => [ "SSE" ],
1098         mode      => "mode_E",
1099 },
1100
1101 xMul => {
1102         irn_flags => "R",
1103         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1104         emit      => '. mul%XXM %binop',
1105         latency   => 4,
1106         units     => [ "SSE" ],
1107         mode      => "mode_E",
1108 },
1109
1110 xMax => {
1111         irn_flags => "R",
1112         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1113         emit      => '. max%XXM %binop',
1114         latency   => 2,
1115         units     => [ "SSE" ],
1116         mode      => "mode_E",
1117 },
1118
1119 xMin => {
1120         irn_flags => "R",
1121         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1122         emit      => '. min%XXM %binop',
1123         latency   => 2,
1124         units     => [ "SSE" ],
1125         mode      => "mode_E",
1126 },
1127
1128 xAnd => {
1129         irn_flags => "R",
1130         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1131         emit      => '. andp%XSD %binop',
1132         latency   => 3,
1133         units     => [ "SSE" ],
1134         mode      => "mode_E",
1135 },
1136
1137 xOr => {
1138         irn_flags => "R",
1139         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1140         emit      => '. orp%XSD %binop',
1141         units     => [ "SSE" ],
1142         mode      => "mode_E",
1143 },
1144
1145 xXor => {
1146         irn_flags => "R",
1147         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1148         emit      => '. xorp%XSD %binop',
1149         latency   => 3,
1150         units     => [ "SSE" ],
1151         mode      => "mode_E",
1152 },
1153
1154 # not commutative operations
1155
1156 xAndNot => {
1157         irn_flags => "R",
1158         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1159         emit      => '. andnp%XSD %binop',
1160         latency   => 3,
1161         units     => [ "SSE" ],
1162         mode      => "mode_E",
1163 },
1164
1165 xSub => {
1166         irn_flags => "R",
1167         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1168         emit      => '. sub%XXM %binop',
1169         latency   => 4,
1170         units     => [ "SSE" ],
1171         mode      => "mode_E",
1172 },
1173
1174 xDiv => {
1175         irn_flags => "R",
1176         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4", "none" ] },
1177         outs      => [ "res", "M" ],
1178         emit      => '. div%XXM %binop',
1179         latency   => 16,
1180         units     => [ "SSE" ],
1181 },
1182
1183 # other operations
1184
1185 xCmp => {
1186         irn_flags => "R",
1187         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1188         latency   => 3,
1189         units     => [ "SSE" ],
1190         mode      => "mode_E",
1191 },
1192
1193 xCondJmp => {
1194         state     => "pinned",
1195         op_flags  => "L|X|Y",
1196         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "none", "none" ] },
1197         ins       => [ "base", "index", "left", "right", "mem" ],
1198         outs      => [ "false", "true" ],
1199         attr      => "long pnc",
1200         init_attr => "attr->pn_code = pnc;",
1201         latency   => 5,
1202         units     => [ "SSE" ],
1203 },
1204
1205 xConst => {
1206         op_flags  => "c",
1207         irn_flags => "R",
1208         reg_req   => { out => [ "xmm" ] },
1209         emit      => '. mov%XXM %C, %D0',
1210         latency   => 2,
1211         units     => [ "SSE" ],
1212         mode      => "mode_E",
1213 },
1214
1215 # Load / Store
1216
1217 xLoad => {
1218         op_flags  => "L|F",
1219         state     => "exc_pinned",
1220         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1221         emit      => '. mov%XXM %AM, %D0',
1222         outs      => [ "res", "M" ],
1223         latency   => 2,
1224         units     => [ "SSE" ],
1225 },
1226
1227 xStore => {
1228         op_flags => "L|F",
1229         state    => "exc_pinned",
1230         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1231         emit     => '. mov%XXM %binop',
1232         latency  => 2,
1233         units    => [ "SSE" ],
1234         mode     => "mode_M",
1235 },
1236
1237 xStoreSimple => {
1238         op_flags => "L|F",
1239         state    => "exc_pinned",
1240         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1241         ins      => [ "base", "index", "val", "mem" ],
1242         emit     => '. mov%XXM %S2, %AM',
1243         latency  => 2,
1244         units    => [ "SSE" ],
1245         mode     => "mode_M",
1246 },
1247
1248 CvtSI2SS => {
1249         op_flags => "L|F",
1250         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm" ] },
1251         emit     => '. cvtsi2ss %D0, %AM',
1252         latency  => 2,
1253         units    => [ "SSE" ],
1254         mode     => $mode_xmm
1255 },
1256
1257 CvtSI2SD => {
1258         op_flags => "L|F",
1259         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm" ] },
1260         emit     => '. cvtsi2sd %unop2',
1261         latency  => 2,
1262         units    => [ "SSE" ],
1263         mode     => $mode_xmm
1264 },
1265
1266
1267 l_X87toSSE => {
1268         op_flags => "L|F",
1269         cmp_attr => "return 1;",
1270         arity    => 3,
1271 },
1272
1273 l_SSEtoX87 => {
1274         op_flags => "L|F",
1275         cmp_attr => "return 1;",
1276         arity    => 3,
1277 },
1278
1279 # CopyB
1280
1281 CopyB => {
1282         op_flags => "F|H",
1283         state    => "pinned",
1284         reg_req  => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1285         outs     => [ "DST", "SRC", "CNT", "M" ],
1286         units    => [ "GP" ],
1287         modified_flags => [ "DF" ]
1288 },
1289
1290 CopyB_i => {
1291         op_flags => "F|H",
1292         state    => "pinned",
1293         reg_req  => { in => [ "edi", "esi", "none" ], out => [  "edi", "esi", "none" ] },
1294         outs     => [ "DST", "SRC", "M" ],
1295         units    => [ "GP" ],
1296         modified_flags => [ "DF" ]
1297 },
1298
1299 # Conversions
1300
1301 Conv_I2I => {
1302         state     => "exc_pinned",
1303         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3", "none" ] },
1304         units     => [ "GP" ],
1305         ins       => [ "base", "index", "val", "mem" ],
1306         attr      => "ir_mode *smaller_mode",
1307         init_attr => "attr->ls_mode = smaller_mode;",
1308         mode      => $mode_gp,
1309         modified_flags => $status_flags
1310 },
1311
1312 Conv_I2I8Bit => {
1313         state     => "exc_pinned",
1314         reg_req   => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => [ "in_r3", "none" ] },
1315         ins       => [ "base", "index", "val", "mem" ],
1316         units     => [ "GP" ],
1317         attr      => "ir_mode *smaller_mode",
1318         init_attr => "attr->ls_mode = smaller_mode;",
1319         mode      => $mode_gp,
1320         modified_flags => $status_flags
1321 },
1322
1323 Conv_I2FP => {
1324         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1325         latency  => 10,
1326         units    => [ "SSE" ],
1327         mode     => "mode_E",
1328 },
1329
1330 Conv_FP2I => {
1331         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "gp", "none" ] },
1332         latency  => 10,
1333         units    => [ "SSE" ],
1334         mode     => $mode_gp,
1335 },
1336
1337 Conv_FP2FP => {
1338         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "xmm", "none" ] },
1339         latency  => 8,
1340         units    => [ "SSE" ],
1341         mode     => "mode_E",
1342 },
1343
1344 CmpCMov => {
1345         irn_flags => "R",
1346         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none", "gp", "gp" ], out => [ "in_r7" ] },
1347         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem", "val_true", "val_false" ],
1348         attr      => "pn_Cmp pn_code",
1349         init_attr => "attr->pn_code = pn_code;",
1350         latency   => 2,
1351         units     => [ "GP" ],
1352         mode      => $mode_gp,
1353 },
1354
1355 TestCMov => {
1356         irn_flags => "R",
1357         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none", "gp", "gp" ], out => [ "in_r7" ] },
1358         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem", "val_true", "val_false" ],
1359         attr      => "pn_Cmp pn_code",
1360         init_attr => "attr->pn_code = pn_code;",
1361         latency   => 2,
1362         units     => [ "GP" ],
1363         mode      => $mode_gp,
1364 },
1365
1366 xCmpCMov => {
1367         irn_flags => "R",
1368         reg_req   => { in => [ "xmm", "xmm", "gp", "gp" ], out => [ "in_r4" ] },
1369         latency   => 5,
1370         units     => [ "SSE" ],
1371         mode      => $mode_gp,
1372 },
1373
1374 vfCmpCMov => {
1375         irn_flags => "R",
1376         reg_req   => { in => [ "vfp", "vfp", "gp", "gp" ], out => [ "in_r4" ] },
1377         latency   => 10,
1378         units     => [ "VFP" ],
1379         mode      => $mode_gp,
1380         attr_type => "ia32_x87_attr_t",
1381 },
1382
1383 CmpSet => {
1384         irn_flags => "R",
1385         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1386         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1387         attr      => "pn_Cmp pn_code",
1388         init_attr => "attr->pn_code = pn_code;",
1389         latency   => 2,
1390         units     => [ "GP" ],
1391         mode      => $mode_gp,
1392 },
1393
1394 TestSet => {
1395         irn_flags => "R",
1396         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1397         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1398         attr      => "pn_Cmp pn_code",
1399         init_attr => "attr->pn_code = pn_code;",
1400         latency   => 2,
1401         units     => [ "GP" ],
1402         mode      => $mode_gp,
1403 },
1404
1405 xCmpSet => {
1406         irn_flags => "R",
1407         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "eax ebx ecx edx" ] },
1408         latency   => 5,
1409         units     => [ "SSE" ],
1410         mode      => $mode_gp,
1411 },
1412
1413 vfCmpSet => {
1414         irn_flags => "R",
1415         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "eax ebx ecx edx" ] },
1416         latency   => 10,
1417         units     => [ "VFP" ],
1418         mode      => $mode_gp,
1419         attr_type => "ia32_x87_attr_t",
1420 },
1421
1422 vfCMov => {
1423         irn_flags => "R",
1424         reg_req   => { in => [ "vfp", "vfp", "vfp", "vfp" ], out => [ "vfp" ] },
1425         latency   => 10,
1426         units     => [ "VFP" ],
1427         mode      => "mode_E",
1428         attr_type => "ia32_x87_attr_t",
1429 },
1430
1431 #----------------------------------------------------------#
1432 #        _      _               _    __ _             _    #
1433 #       (_)    | |             | |  / _| |           | |   #
1434 # __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
1435 # \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
1436 #  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
1437 #   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1438 #                 | |                                      #
1439 #  _ __   ___   __| | ___  ___                             #
1440 # | '_ \ / _ \ / _` |/ _ \/ __|                            #
1441 # | | | | (_) | (_| |  __/\__ \                            #
1442 # |_| |_|\___/ \__,_|\___||___/                            #
1443 #----------------------------------------------------------#
1444
1445 vfadd => {
1446         irn_flags => "R",
1447         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1448         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1449         latency   => 4,
1450         units     => [ "VFP" ],
1451         mode      => "mode_E",
1452         attr_type => "ia32_x87_attr_t",
1453 },
1454
1455 vfmul => {
1456         irn_flags => "R",
1457         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1458         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1459         latency   => 4,
1460         units     => [ "VFP" ],
1461         mode      => "mode_E",
1462         attr_type => "ia32_x87_attr_t",
1463 },
1464
1465 l_vfmul => {
1466         op_flags  => "C",
1467         cmp_attr  => "return 1;",
1468         arity     => 2,
1469 },
1470
1471 vfsub => {
1472         irn_flags => "R",
1473         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1474         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1475         latency   => 4,
1476         units     => [ "VFP" ],
1477         mode      => "mode_E",
1478         attr_type => "ia32_x87_attr_t",
1479 },
1480
1481 l_vfsub => {
1482         cmp_attr  => "return 1;",
1483         arity     => 2,
1484 },
1485
1486 vfdiv => {
1487         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp", "none" ] },
1488         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1489         outs      => [ "res", "M" ],
1490         latency   => 20,
1491         units     => [ "VFP" ],
1492         attr_type => "ia32_x87_attr_t",
1493 },
1494
1495 l_vfdiv => {
1496         cmp_attr  => "return 1;",
1497         outs      => [ "res", "M" ],
1498         arity     => 2,
1499 },
1500
1501 vfprem => {
1502         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1503         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1504         latency   => 20,
1505         units     => [ "VFP" ],
1506         mode      => "mode_E",
1507         attr_type => "ia32_x87_attr_t",
1508 },
1509
1510 l_vfprem => {
1511         cmp_attr  => "return 1;",
1512         arity     => 2,
1513 },
1514
1515 vfabs => {
1516         irn_flags => "R",
1517         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1518         ins       => [ "value" ],
1519         latency   => 2,
1520         units     => [ "VFP" ],
1521         mode      => "mode_E",
1522         attr_type => "ia32_x87_attr_t",
1523 },
1524
1525 vfchs => {
1526         irn_flags => "R",
1527         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1528         ins       => [ "value" ],
1529         latency   => 2,
1530         units     => [ "VFP" ],
1531         mode      => "mode_E",
1532         attr_type => "ia32_x87_attr_t",
1533 },
1534
1535 # virtual Load and Store
1536
1537 vfld => {
1538         op_flags  => "L|F",
1539         state     => "exc_pinned",
1540         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1541         ins       => [ "base", "index", "mem" ],
1542         outs      => [ "res", "M" ],
1543         attr      => "ir_mode *store_mode",
1544         init_attr => "attr->attr.ls_mode = store_mode;",
1545         latency   => 2,
1546         units     => [ "VFP" ],
1547         attr_type => "ia32_x87_attr_t",
1548 },
1549
1550 vfst => {
1551         op_flags  => "L|F",
1552         state     => "exc_pinned",
1553         reg_req   => { in => [ "gp", "gp", "vfp", "none" ] },
1554         ins       => [ "base", "index", "val", "mem" ],
1555         attr      => "ir_mode *store_mode",
1556         init_attr => "attr->attr.ls_mode = store_mode;",
1557         latency   => 2,
1558         units     => [ "VFP" ],
1559         mode      => "mode_M",
1560         attr_type => "ia32_x87_attr_t",
1561 },
1562
1563 # Conversions
1564
1565 vfild => {
1566         state     => "exc_pinned",
1567         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1568         outs      => [ "res", "M" ],
1569         ins       => [ "base", "index", "mem" ],
1570         latency   => 4,
1571         units     => [ "VFP" ],
1572         attr_type => "ia32_x87_attr_t",
1573 },
1574
1575 l_vfild => {
1576         cmp_attr  => "return 1;",
1577         outs      => [ "res", "M" ],
1578         arity     => 2,
1579 },
1580
1581 vfist => {
1582         state     => "exc_pinned",
1583         reg_req   => { in => [ "gp", "gp", "vfp", "fpcw", "none" ] },
1584         ins       => [ "base", "index", "val", "fpcw", "mem" ],
1585         latency   => 4,
1586         units     => [ "VFP" ],
1587         mode      => "mode_M",
1588         attr_type => "ia32_x87_attr_t",
1589 },
1590
1591 l_vfist => {
1592         cmp_attr  => "return 1;",
1593         state     => "exc_pinned",
1594         arity     => 3,
1595         mode      => "mode_M",
1596 },
1597
1598
1599 # constants
1600
1601 vfldz => {
1602         irn_flags => "R",
1603         reg_req   => { out => [ "vfp" ] },
1604         latency   => 4,
1605         units     => [ "VFP" ],
1606         mode      => "mode_E",
1607         attr_type => "ia32_x87_attr_t",
1608 },
1609
1610 vfld1 => {
1611         irn_flags => "R",
1612         reg_req   => { out => [ "vfp" ] },
1613         latency   => 4,
1614         units     => [ "VFP" ],
1615         mode      => "mode_E",
1616         attr_type => "ia32_x87_attr_t",
1617 },
1618
1619 vfldpi => {
1620         irn_flags => "R",
1621         reg_req   => { out => [ "vfp" ] },
1622         latency   => 4,
1623         units     => [ "VFP" ],
1624         mode      => "mode_E",
1625         attr_type => "ia32_x87_attr_t",
1626 },
1627
1628 vfldln2 => {
1629         irn_flags => "R",
1630         reg_req   => { out => [ "vfp" ] },
1631         latency   => 4,
1632         units     => [ "VFP" ],
1633         mode      => "mode_E",
1634         attr_type => "ia32_x87_attr_t",
1635 },
1636
1637 vfldlg2 => {
1638         irn_flags => "R",
1639         reg_req   => { out => [ "vfp" ] },
1640         latency   => 4,
1641         units     => [ "VFP" ],
1642         mode      => "mode_E",
1643         attr_type => "ia32_x87_attr_t",
1644 },
1645
1646 vfldl2t => {
1647         irn_flags => "R",
1648         reg_req   => { out => [ "vfp" ] },
1649         latency   => 4,
1650         units     => [ "VFP" ],
1651         mode      => "mode_E",
1652         attr_type => "ia32_x87_attr_t",
1653 },
1654
1655 vfldl2e => {
1656         irn_flags => "R",
1657         reg_req   => { out => [ "vfp" ] },
1658         latency   => 4,
1659         units     => [ "VFP" ],
1660         mode      => "mode_E",
1661         attr_type => "ia32_x87_attr_t",
1662 },
1663
1664 vfConst => {
1665         op_flags  => "c",
1666         irn_flags => "R",
1667         reg_req   => { out => [ "vfp" ] },
1668         latency   => 3,
1669         units     => [ "VFP" ],
1670         mode      => "mode_E",
1671         attr_type => "ia32_x87_attr_t",
1672 },
1673
1674 # other
1675
1676 vfCondJmp => {
1677         state     => "pinned",
1678         op_flags  => "L|X|Y",
1679         reg_req   => { in => [ "vfp", "vfp" ], out => [ "none", "none", "eax" ] },
1680         ins       => [ "left", "right" ],
1681         outs      => [ "false", "true", "temp_reg_eax" ],
1682         attr      => "long pnc",
1683         init_attr => "attr->attr.pn_code = pnc;",
1684         latency   => 10,
1685         units     => [ "VFP" ],
1686         attr_type => "ia32_x87_attr_t",
1687 },
1688
1689 #------------------------------------------------------------------------#
1690 #       ___ _____    __ _             _                     _            #
1691 # __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1692 # \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1693 #  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1694 # /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1695 #------------------------------------------------------------------------#
1696
1697 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1698 #       are swapped, we work this around in the emitter...
1699
1700 fadd => {
1701         op_flags  => "R",
1702         rd_constructor => "NONE",
1703         reg_req   => { },
1704         emit      => '. fadd%XM %x87_binop',
1705         attr_type => "ia32_x87_attr_t",
1706 },
1707
1708 faddp => {
1709         op_flags  => "R",
1710         rd_constructor => "NONE",
1711         reg_req   => { },
1712         emit      => '. faddp%XM %x87_binop',
1713         attr_type => "ia32_x87_attr_t",
1714 },
1715
1716 fmul => {
1717         op_flags  => "R",
1718         rd_constructor => "NONE",
1719         reg_req   => { },
1720         emit      => '. fmul%XM %x87_binop',
1721         attr_type => "ia32_x87_attr_t",
1722 },
1723
1724 fmulp => {
1725         op_flags  => "R",
1726         rd_constructor => "NONE",
1727         reg_req   => { },
1728         emit      => '. fmulp%XM %x87_binop',,
1729         attr_type => "ia32_x87_attr_t",
1730 },
1731
1732 fsub => {
1733         op_flags  => "R",
1734         rd_constructor => "NONE",
1735         reg_req   => { },
1736         emit      => '. fsub%XM %x87_binop',
1737         attr_type => "ia32_x87_attr_t",
1738 },
1739
1740 fsubp => {
1741         op_flags  => "R",
1742         rd_constructor => "NONE",
1743         reg_req   => { },
1744 # see note about gas bugs
1745         emit      => '. fsubrp%XM %x87_binop',
1746         attr_type => "ia32_x87_attr_t",
1747 },
1748
1749 fsubr => {
1750         op_flags  => "R",
1751         rd_constructor => "NONE",
1752         irn_flags => "R",
1753         reg_req   => { },
1754         emit      => '. fsubr%XM %x87_binop',
1755         attr_type => "ia32_x87_attr_t",
1756 },
1757
1758 fsubrp => {
1759         op_flags  => "R",
1760         rd_constructor => "NONE",
1761         irn_flags => "R",
1762         reg_req   => { },
1763 # see note about gas bugs
1764         emit      => '. fsubp%XM %x87_binop',
1765         attr_type => "ia32_x87_attr_t",
1766 },
1767
1768 fprem => {
1769         op_flags  => "R",
1770         rd_constructor => "NONE",
1771         reg_req   => { },
1772         emit      => '. fprem1',
1773         attr_type => "ia32_x87_attr_t",
1774 },
1775
1776 # this node is just here, to keep the simulator running
1777 # we can omit this when a fprem simulation function exists
1778 fpremp => {
1779         op_flags  => "R",
1780         rd_constructor => "NONE",
1781         reg_req   => { },
1782         emit      => '. fprem1',
1783         attr_type => "ia32_x87_attr_t",
1784 },
1785
1786 fdiv => {
1787         op_flags  => "R",
1788         rd_constructor => "NONE",
1789         reg_req   => { },
1790         emit      => '. fdiv%XM %x87_binop',
1791         attr_type => "ia32_x87_attr_t",
1792 },
1793
1794 fdivp => {
1795         op_flags  => "R",
1796         rd_constructor => "NONE",
1797         reg_req   => { },
1798 # see note about gas bugs
1799         emit      => '. fdivrp%XM %x87_binop',
1800         attr_type => "ia32_x87_attr_t",
1801 },
1802
1803 fdivr => {
1804         op_flags  => "R",
1805         rd_constructor => "NONE",
1806         reg_req   => { },
1807         emit      => '. fdivr%XM %x87_binop',
1808         attr_type => "ia32_x87_attr_t",
1809 },
1810
1811 fdivrp => {
1812         op_flags  => "R",
1813         rd_constructor => "NONE",
1814         reg_req   => { },
1815 # see note about gas bugs
1816         emit      => '. fdivp%XM %x87_binop',
1817         attr_type => "ia32_x87_attr_t",
1818 },
1819
1820 fabs => {
1821         op_flags  => "R",
1822         rd_constructor => "NONE",
1823         reg_req   => { },
1824         emit      => '. fabs',
1825         attr_type => "ia32_x87_attr_t",
1826 },
1827
1828 fchs => {
1829         op_flags  => "R|K",
1830         rd_constructor => "NONE",
1831         reg_req   => { },
1832         emit      => '. fchs',
1833         attr_type => "ia32_x87_attr_t",
1834 },
1835
1836 # x87 Load and Store
1837
1838 fld => {
1839         rd_constructor => "NONE",
1840         op_flags  => "R|L|F",
1841         state     => "exc_pinned",
1842         reg_req   => { },
1843         emit      => '. fld%XM %AM',
1844         attr_type => "ia32_x87_attr_t",
1845 },
1846
1847 fst => {
1848         rd_constructor => "NONE",
1849         op_flags  => "R|L|F",
1850         state     => "exc_pinned",
1851         reg_req   => { },
1852         emit      => '. fst%XM %AM',
1853         mode      => "mode_M",
1854         attr_type => "ia32_x87_attr_t",
1855 },
1856
1857 fstp => {
1858         rd_constructor => "NONE",
1859         op_flags  => "R|L|F",
1860         state     => "exc_pinned",
1861         reg_req   => { },
1862         emit      => '. fstp%XM %AM',
1863         mode      => "mode_M",
1864         attr_type => "ia32_x87_attr_t",
1865 },
1866
1867 # Conversions
1868
1869 fild => {
1870         op_flags  => "R",
1871         rd_constructor => "NONE",
1872         reg_req   => { },
1873         emit      => '. fild%XM %AM',
1874         attr_type => "ia32_x87_attr_t",
1875 },
1876
1877 fist => {
1878         op_flags  => "R",
1879         state     => "exc_pinned",
1880         rd_constructor => "NONE",
1881         reg_req   => { },
1882         emit      => '. fist%XM %AM',
1883         mode      => "mode_M",
1884         attr_type => "ia32_x87_attr_t",
1885 },
1886
1887 fistp => {
1888         op_flags  => "R",
1889         state     => "exc_pinned",
1890         rd_constructor => "NONE",
1891         reg_req   => { },
1892         emit      => '. fistp%XM %AM',
1893         mode      => "mode_M",
1894         attr_type => "ia32_x87_attr_t",
1895 },
1896
1897 # constants
1898
1899 fldz => {
1900         op_flags  => "R|c|K",
1901         irn_flags  => "R",
1902         reg_req   => { },
1903         emit      => '. fldz',
1904         attr_type => "ia32_x87_attr_t",
1905 },
1906
1907 fld1 => {
1908         op_flags  => "R|c|K",
1909         irn_flags  => "R",
1910         reg_req   => { },
1911         emit      => '. fld1',
1912         attr_type => "ia32_x87_attr_t",
1913 },
1914
1915 fldpi => {
1916         op_flags  => "R|c|K",
1917         irn_flags  => "R",
1918         reg_req   => { },
1919         emit      => '. fldpi',
1920         attr_type => "ia32_x87_attr_t",
1921 },
1922
1923 fldln2 => {
1924         op_flags  => "R|c|K",
1925         irn_flags  => "R",
1926         reg_req   => { },
1927         emit      => '. fldln2',
1928         attr_type => "ia32_x87_attr_t",
1929 },
1930
1931 fldlg2 => {
1932         op_flags  => "R|c|K",
1933         irn_flags  => "R",
1934         reg_req   => { },
1935         emit      => '. fldlg2',
1936         attr_type => "ia32_x87_attr_t",
1937 },
1938
1939 fldl2t => {
1940         op_flags  => "R|c|K",
1941         irn_flags  => "R",
1942         reg_req   => { },
1943         emit      => '. fldll2t',
1944         attr_type => "ia32_x87_attr_t",
1945 },
1946
1947 fldl2e => {
1948         op_flags  => "R|c|K",
1949         irn_flags  => "R",
1950         reg_req   => { },
1951         emit      => '. fldl2e',
1952         attr_type => "ia32_x87_attr_t",
1953 },
1954
1955 # fxch, fpush, fpop
1956 # Note that it is NEVER allowed to do CSE on these nodes
1957 # Moreover, note the virtual register requierements!
1958
1959 fxch => {
1960         op_flags  => "R|K",
1961         reg_req   => { },
1962         cmp_attr  => "return 1;",
1963         emit      => '. fxch %X0',
1964         attr_type => "ia32_x87_attr_t",
1965 },
1966
1967 fpush => {
1968         op_flags  => "R|K",
1969         reg_req   => {},
1970         cmp_attr  => "return 1;",
1971         emit      => '. fld %X0',
1972         attr_type => "ia32_x87_attr_t",
1973 },
1974
1975 fpushCopy => {
1976         op_flags  => "R",
1977         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1978         cmp_attr  => "return 1;",
1979         emit      => '. fld %X0',
1980         attr_type => "ia32_x87_attr_t",
1981 },
1982
1983 fpop => {
1984         op_flags  => "R|K",
1985         reg_req   => { },
1986         cmp_attr  => "return 1;",
1987         emit      => '. fstp %X0',
1988         attr_type => "ia32_x87_attr_t",
1989 },
1990
1991 # compare
1992
1993 fcomJmp => {
1994         op_flags  => "L|X|Y",
1995         reg_req   => { },
1996         attr_type => "ia32_x87_attr_t",
1997 },
1998
1999 fcompJmp => {
2000         op_flags  => "L|X|Y",
2001         reg_req   => { },
2002         attr_type => "ia32_x87_attr_t",
2003 },
2004
2005 fcomppJmp => {
2006         op_flags  => "L|X|Y",
2007         reg_req   => { },
2008         attr_type => "ia32_x87_attr_t",
2009 },
2010
2011 fcomrJmp => {
2012         op_flags  => "L|X|Y",
2013         reg_req   => { },
2014         attr_type => "ia32_x87_attr_t",
2015 },
2016
2017 fcomrpJmp => {
2018         op_flags  => "L|X|Y",
2019         reg_req   => { },
2020         attr_type => "ia32_x87_attr_t",
2021 },
2022
2023 fcomrppJmp => {
2024         op_flags  => "L|X|Y",
2025         reg_req   => { },
2026         attr_type => "ia32_x87_attr_t",
2027 },
2028
2029
2030 # -------------------------------------------------------------------------------- #
2031 #  ____ ____  _____                  _                               _             #
2032 # / ___/ ___|| ____| __   _____  ___| |_ ___  _ __   _ __   ___   __| | ___  ___   #
2033 # \___ \___ \|  _|   \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __|  #
2034 #  ___) |__) | |___   \ V /  __/ (__| || (_) | |    | | | | (_) | (_| |  __/\__ \  #
2035 # |____/____/|_____|   \_/ \___|\___|\__\___/|_|    |_| |_|\___/ \__,_|\___||___/  #
2036 #                                                                                  #
2037 # -------------------------------------------------------------------------------- #
2038
2039
2040 # Spilling and reloading of SSE registers, hardcoded, not generated #
2041
2042 xxLoad => {
2043         op_flags  => "L|F",
2044         state     => "exc_pinned",
2045         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2046         emit      => '. movdqu %D0, %AM',
2047         outs      => [ "res", "M" ],
2048         units     => [ "SSE" ],
2049 },
2050
2051 xxStore => {
2052         op_flags => "L|F",
2053         state    => "exc_pinned",
2054         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
2055         emit     => '. movdqu %binop',
2056         units    => [ "SSE" ],
2057         mode     => "mode_M",
2058 },
2059
2060 ); # end of %nodes
2061
2062 # Include the generated SIMD node specification written by the SIMD optimization
2063 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2064 unless ($return = do $my_script_name) {
2065         warn "couldn't parse $my_script_name: $@" if $@;
2066         warn "couldn't do $my_script_name: $!"    unless defined $return;
2067         warn "couldn't run $my_script_name"       unless $return;
2068 }