replace Shrs(Shl) with Conv where possible, fix conv_conv optimisation bug
[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         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "none" ] },
1045         emit      => '. addl %binop',
1046         outs      => [ "stack:S", "M" ],
1047         units     => [ "GP" ],
1048         modified_flags => $status_flags
1049 },
1050
1051 SubSP => {
1052 #irn_flags => "I",
1053         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "gp", "none" ] },
1054         emit      => ". subl %binop\n".
1055                      ". movl %%esp, %D1",
1056         outs      => [ "stack:I|S", "addr", "M" ],
1057         units     => [ "GP" ],
1058         modified_flags => $status_flags
1059 },
1060
1061 LdTls => {
1062         irn_flags => "R",
1063         reg_req   => { out => [ "gp" ] },
1064         units     => [ "GP" ],
1065 },
1066
1067 # the int instruction
1068 int => {
1069         reg_req   => { in => [ "none" ], out => [ "none" ] },
1070         mode      => "mode_M",
1071         attr      => "tarval *tv",
1072         init_attr => "\tset_ia32_Immop_tarval(res, tv);",
1073         emit      => '. int %C',
1074         units     => [ "GP" ],
1075         cmp_attr  => "return 1;",
1076 },
1077
1078
1079 #-----------------------------------------------------------------------------#
1080 #   _____ _____ ______    __ _             _                     _            #
1081 #  / ____/ ____|  ____|  / _| |           | |                   | |           #
1082 # | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1083 #  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1084 #  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1085 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1086 #-----------------------------------------------------------------------------#
1087
1088 # commutative operations
1089
1090 xAdd => {
1091         irn_flags => "R",
1092         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1093         emit      => '. add%XXM %binop',
1094         latency   => 4,
1095         units     => [ "SSE" ],
1096         mode      => "mode_E",
1097 },
1098
1099 xMul => {
1100         irn_flags => "R",
1101         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1102         emit      => '. mul%XXM %binop',
1103         latency   => 4,
1104         units     => [ "SSE" ],
1105         mode      => "mode_E",
1106 },
1107
1108 xMax => {
1109         irn_flags => "R",
1110         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1111         emit      => '. max%XXM %binop',
1112         latency   => 2,
1113         units     => [ "SSE" ],
1114         mode      => "mode_E",
1115 },
1116
1117 xMin => {
1118         irn_flags => "R",
1119         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1120         emit      => '. min%XXM %binop',
1121         latency   => 2,
1122         units     => [ "SSE" ],
1123         mode      => "mode_E",
1124 },
1125
1126 xAnd => {
1127         irn_flags => "R",
1128         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1129         emit      => '. andp%XSD %binop',
1130         latency   => 3,
1131         units     => [ "SSE" ],
1132         mode      => "mode_E",
1133 },
1134
1135 xOr => {
1136         irn_flags => "R",
1137         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1138         emit      => '. orp%XSD %binop',
1139         units     => [ "SSE" ],
1140         mode      => "mode_E",
1141 },
1142
1143 xXor => {
1144         irn_flags => "R",
1145         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1146         emit      => '. xorp%XSD %binop',
1147         latency   => 3,
1148         units     => [ "SSE" ],
1149         mode      => "mode_E",
1150 },
1151
1152 # not commutative operations
1153
1154 xAndNot => {
1155         irn_flags => "R",
1156         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1157         emit      => '. andnp%XSD %binop',
1158         latency   => 3,
1159         units     => [ "SSE" ],
1160         mode      => "mode_E",
1161 },
1162
1163 xSub => {
1164         irn_flags => "R",
1165         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1166         emit      => '. sub%XXM %binop',
1167         latency   => 4,
1168         units     => [ "SSE" ],
1169         mode      => "mode_E",
1170 },
1171
1172 xDiv => {
1173         irn_flags => "R",
1174         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4", "none" ] },
1175         outs      => [ "res", "M" ],
1176         emit      => '. div%XXM %binop',
1177         latency   => 16,
1178         units     => [ "SSE" ],
1179 },
1180
1181 # other operations
1182
1183 xCmp => {
1184         irn_flags => "R",
1185         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1186         latency   => 3,
1187         units     => [ "SSE" ],
1188         mode      => "mode_E",
1189 },
1190
1191 xCondJmp => {
1192         state     => "pinned",
1193         op_flags  => "L|X|Y",
1194         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "none", "none" ] },
1195         ins       => [ "base", "index", "left", "right", "mem" ],
1196         outs      => [ "false", "true" ],
1197         attr      => "long pnc",
1198         init_attr => "attr->pn_code = pnc;",
1199         latency   => 5,
1200         units     => [ "SSE" ],
1201 },
1202
1203 xConst => {
1204         op_flags  => "c",
1205         irn_flags => "R",
1206         reg_req   => { out => [ "xmm" ] },
1207         emit      => '. mov%XXM %C, %D0',
1208         latency   => 2,
1209         units     => [ "SSE" ],
1210         mode      => "mode_E",
1211 },
1212
1213 # Load / Store
1214
1215 xLoad => {
1216         op_flags  => "L|F",
1217         state     => "exc_pinned",
1218         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1219         emit      => '. mov%XXM %AM, %D0',
1220         outs      => [ "res", "M" ],
1221         latency   => 2,
1222         units     => [ "SSE" ],
1223 },
1224
1225 xStore => {
1226         op_flags => "L|F",
1227         state    => "exc_pinned",
1228         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1229         emit     => '. mov%XXM %binop',
1230         latency  => 2,
1231         units    => [ "SSE" ],
1232         mode     => "mode_M",
1233 },
1234
1235 xStoreSimple => {
1236         op_flags => "L|F",
1237         state    => "exc_pinned",
1238         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1239         ins      => [ "base", "index", "val", "mem" ],
1240         emit     => '. mov%XXM %S2, %AM',
1241         latency  => 2,
1242         units    => [ "SSE" ],
1243         mode     => "mode_M",
1244 },
1245
1246 CvtSI2SS => {
1247         op_flags => "L|F",
1248         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm" ] },
1249         emit     => '. cvtsi2ss %D0, %AM',
1250         latency  => 2,
1251         units    => [ "SSE" ],
1252         mode     => $mode_xmm
1253 },
1254
1255 CvtSI2SD => {
1256         op_flags => "L|F",
1257         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm" ] },
1258         emit     => '. cvtsi2sd %unop2',
1259         latency  => 2,
1260         units    => [ "SSE" ],
1261         mode     => $mode_xmm
1262 },
1263
1264
1265 l_X87toSSE => {
1266         op_flags => "L|F",
1267         cmp_attr => "return 1;",
1268         arity    => 3,
1269 },
1270
1271 l_SSEtoX87 => {
1272         op_flags => "L|F",
1273         cmp_attr => "return 1;",
1274         arity    => 3,
1275 },
1276
1277 # CopyB
1278
1279 CopyB => {
1280         op_flags => "F|H",
1281         state    => "pinned",
1282         reg_req  => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1283         outs     => [ "DST", "SRC", "CNT", "M" ],
1284         units    => [ "GP" ],
1285         modified_flags => [ "DF" ]
1286 },
1287
1288 CopyB_i => {
1289         op_flags => "F|H",
1290         state    => "pinned",
1291         reg_req  => { in => [ "edi", "esi", "none" ], out => [  "edi", "esi", "none" ] },
1292         outs     => [ "DST", "SRC", "M" ],
1293         units    => [ "GP" ],
1294         modified_flags => [ "DF" ]
1295 },
1296
1297 # Conversions
1298
1299 Conv_I2I => {
1300         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3", "none" ] },
1301         units     => [ "GP" ],
1302         ins       => [ "base", "index", "val", "mem" ],
1303         attr      => "ir_mode *smaller_mode",
1304         init_attr => "attr->ls_mode = smaller_mode;",
1305         mode      => $mode_gp,
1306         modified_flags => $status_flags
1307 },
1308
1309 Conv_I2I8Bit => {
1310         reg_req   => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => [ "in_r3", "none" ] },
1311         ins       => [ "base", "index", "val", "mem" ],
1312         units     => [ "GP" ],
1313         attr      => "ir_mode *smaller_mode",
1314         init_attr => "attr->ls_mode = smaller_mode;",
1315         mode      => $mode_gp,
1316         modified_flags => $status_flags
1317 },
1318
1319 Conv_I2FP => {
1320         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1321         latency  => 10,
1322         units    => [ "SSE" ],
1323         mode     => "mode_E",
1324 },
1325
1326 Conv_FP2I => {
1327         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "gp", "none" ] },
1328         latency  => 10,
1329         units    => [ "SSE" ],
1330         mode     => $mode_gp,
1331 },
1332
1333 Conv_FP2FP => {
1334         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "xmm", "none" ] },
1335         latency  => 8,
1336         units    => [ "SSE" ],
1337         mode     => "mode_E",
1338 },
1339
1340 CmpCMov => {
1341         irn_flags => "R",
1342         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none", "gp", "gp" ], out => [ "in_r7" ] },
1343         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem", "val_true", "val_false" ],
1344         attr      => "pn_Cmp pn_code",
1345         init_attr => "attr->pn_code = pn_code;",
1346         latency   => 2,
1347         units     => [ "GP" ],
1348         mode      => $mode_gp,
1349 },
1350
1351 TestCMov => {
1352         irn_flags => "R",
1353         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none", "gp", "gp" ], out => [ "in_r7" ] },
1354         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem", "val_true", "val_false" ],
1355         attr      => "pn_Cmp pn_code",
1356         init_attr => "attr->pn_code = pn_code;",
1357         latency   => 2,
1358         units     => [ "GP" ],
1359         mode      => $mode_gp,
1360 },
1361
1362 xCmpCMov => {
1363         irn_flags => "R",
1364         reg_req   => { in => [ "xmm", "xmm", "gp", "gp" ], out => [ "in_r4" ] },
1365         latency   => 5,
1366         units     => [ "SSE" ],
1367         mode      => $mode_gp,
1368 },
1369
1370 vfCmpCMov => {
1371         irn_flags => "R",
1372         reg_req   => { in => [ "vfp", "vfp", "gp", "gp" ], out => [ "in_r4" ] },
1373         latency   => 10,
1374         units     => [ "VFP" ],
1375         mode      => $mode_gp,
1376         attr_type => "ia32_x87_attr_t",
1377 },
1378
1379 CmpSet => {
1380         irn_flags => "R",
1381         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1382         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1383         attr      => "pn_Cmp pn_code",
1384         init_attr => "attr->pn_code = pn_code;",
1385         latency   => 2,
1386         units     => [ "GP" ],
1387         mode      => $mode_gp,
1388 },
1389
1390 TestSet => {
1391         irn_flags => "R",
1392         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1393         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1394         attr      => "pn_Cmp pn_code",
1395         init_attr => "attr->pn_code = pn_code;",
1396         latency   => 2,
1397         units     => [ "GP" ],
1398         mode      => $mode_gp,
1399 },
1400
1401 xCmpSet => {
1402         irn_flags => "R",
1403         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "eax ebx ecx edx" ] },
1404         latency   => 5,
1405         units     => [ "SSE" ],
1406         mode      => $mode_gp,
1407 },
1408
1409 vfCmpSet => {
1410         irn_flags => "R",
1411         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "eax ebx ecx edx" ] },
1412         latency   => 10,
1413         units     => [ "VFP" ],
1414         mode      => $mode_gp,
1415         attr_type => "ia32_x87_attr_t",
1416 },
1417
1418 vfCMov => {
1419         irn_flags => "R",
1420         reg_req   => { in => [ "vfp", "vfp", "vfp", "vfp" ], out => [ "vfp" ] },
1421         latency   => 10,
1422         units     => [ "VFP" ],
1423         mode      => "mode_E",
1424         attr_type => "ia32_x87_attr_t",
1425 },
1426
1427 #----------------------------------------------------------#
1428 #        _      _               _    __ _             _    #
1429 #       (_)    | |             | |  / _| |           | |   #
1430 # __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
1431 # \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
1432 #  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
1433 #   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1434 #                 | |                                      #
1435 #  _ __   ___   __| | ___  ___                             #
1436 # | '_ \ / _ \ / _` |/ _ \/ __|                            #
1437 # | | | | (_) | (_| |  __/\__ \                            #
1438 # |_| |_|\___/ \__,_|\___||___/                            #
1439 #----------------------------------------------------------#
1440
1441 vfadd => {
1442         irn_flags => "R",
1443         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1444         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1445         latency   => 4,
1446         units     => [ "VFP" ],
1447         mode      => "mode_E",
1448         attr_type => "ia32_x87_attr_t",
1449 },
1450
1451 vfmul => {
1452         irn_flags => "R",
1453         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1454         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1455         latency   => 4,
1456         units     => [ "VFP" ],
1457         mode      => "mode_E",
1458         attr_type => "ia32_x87_attr_t",
1459 },
1460
1461 l_vfmul => {
1462         op_flags  => "C",
1463         cmp_attr  => "return 1;",
1464         arity     => 2,
1465 },
1466
1467 vfsub => {
1468         irn_flags => "R",
1469         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1470         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1471         latency   => 4,
1472         units     => [ "VFP" ],
1473         mode      => "mode_E",
1474         attr_type => "ia32_x87_attr_t",
1475 },
1476
1477 l_vfsub => {
1478         cmp_attr  => "return 1;",
1479         arity     => 2,
1480 },
1481
1482 vfdiv => {
1483         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp", "none" ] },
1484         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1485         outs      => [ "res", "M" ],
1486         latency   => 20,
1487         units     => [ "VFP" ],
1488         attr_type => "ia32_x87_attr_t",
1489 },
1490
1491 l_vfdiv => {
1492         cmp_attr  => "return 1;",
1493         outs      => [ "res", "M" ],
1494         arity     => 2,
1495 },
1496
1497 vfprem => {
1498         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1499         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1500         latency   => 20,
1501         units     => [ "VFP" ],
1502         mode      => "mode_E",
1503         attr_type => "ia32_x87_attr_t",
1504 },
1505
1506 l_vfprem => {
1507         cmp_attr  => "return 1;",
1508         arity     => 2,
1509 },
1510
1511 vfabs => {
1512         irn_flags => "R",
1513         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1514         ins       => [ "value" ],
1515         latency   => 2,
1516         units     => [ "VFP" ],
1517         mode      => "mode_E",
1518         attr_type => "ia32_x87_attr_t",
1519 },
1520
1521 vfchs => {
1522         irn_flags => "R",
1523         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1524         ins       => [ "value" ],
1525         latency   => 2,
1526         units     => [ "VFP" ],
1527         mode      => "mode_E",
1528         attr_type => "ia32_x87_attr_t",
1529 },
1530
1531 # virtual Load and Store
1532
1533 vfld => {
1534         op_flags  => "L|F",
1535         state     => "exc_pinned",
1536         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1537         ins       => [ "base", "index", "mem" ],
1538         outs      => [ "res", "M" ],
1539         attr      => "ir_mode *store_mode",
1540         init_attr => "attr->attr.ls_mode = store_mode;",
1541         latency   => 2,
1542         units     => [ "VFP" ],
1543         attr_type => "ia32_x87_attr_t",
1544 },
1545
1546 vfst => {
1547         op_flags  => "L|F",
1548         state     => "exc_pinned",
1549         reg_req   => { in => [ "gp", "gp", "vfp", "none" ] },
1550         ins       => [ "base", "index", "val", "mem" ],
1551         attr      => "ir_mode *store_mode",
1552         init_attr => "attr->attr.ls_mode = store_mode;",
1553         latency   => 2,
1554         units     => [ "VFP" ],
1555         mode      => "mode_M",
1556         attr_type => "ia32_x87_attr_t",
1557 },
1558
1559 # Conversions
1560
1561 vfild => {
1562         state     => "exc_pinned",
1563         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1564         outs      => [ "res", "M" ],
1565         ins       => [ "base", "index", "mem" ],
1566         latency   => 4,
1567         units     => [ "VFP" ],
1568         attr_type => "ia32_x87_attr_t",
1569 },
1570
1571 l_vfild => {
1572         cmp_attr  => "return 1;",
1573         outs      => [ "res", "M" ],
1574         arity     => 2,
1575 },
1576
1577 vfist => {
1578         state     => "exc_pinned",
1579         reg_req   => { in => [ "gp", "gp", "vfp", "fpcw", "none" ] },
1580         ins       => [ "base", "index", "val", "fpcw", "mem" ],
1581         latency   => 4,
1582         units     => [ "VFP" ],
1583         mode      => "mode_M",
1584         attr_type => "ia32_x87_attr_t",
1585 },
1586
1587 l_vfist => {
1588         cmp_attr  => "return 1;",
1589         state     => "exc_pinned",
1590         arity     => 3,
1591         mode      => "mode_M",
1592 },
1593
1594
1595 # constants
1596
1597 vfldz => {
1598         irn_flags => "R",
1599         reg_req   => { out => [ "vfp" ] },
1600         latency   => 4,
1601         units     => [ "VFP" ],
1602         mode      => "mode_E",
1603         attr_type => "ia32_x87_attr_t",
1604 },
1605
1606 vfld1 => {
1607         irn_flags => "R",
1608         reg_req   => { out => [ "vfp" ] },
1609         latency   => 4,
1610         units     => [ "VFP" ],
1611         mode      => "mode_E",
1612         attr_type => "ia32_x87_attr_t",
1613 },
1614
1615 vfldpi => {
1616         irn_flags => "R",
1617         reg_req   => { out => [ "vfp" ] },
1618         latency   => 4,
1619         units     => [ "VFP" ],
1620         mode      => "mode_E",
1621         attr_type => "ia32_x87_attr_t",
1622 },
1623
1624 vfldln2 => {
1625         irn_flags => "R",
1626         reg_req   => { out => [ "vfp" ] },
1627         latency   => 4,
1628         units     => [ "VFP" ],
1629         mode      => "mode_E",
1630         attr_type => "ia32_x87_attr_t",
1631 },
1632
1633 vfldlg2 => {
1634         irn_flags => "R",
1635         reg_req   => { out => [ "vfp" ] },
1636         latency   => 4,
1637         units     => [ "VFP" ],
1638         mode      => "mode_E",
1639         attr_type => "ia32_x87_attr_t",
1640 },
1641
1642 vfldl2t => {
1643         irn_flags => "R",
1644         reg_req   => { out => [ "vfp" ] },
1645         latency   => 4,
1646         units     => [ "VFP" ],
1647         mode      => "mode_E",
1648         attr_type => "ia32_x87_attr_t",
1649 },
1650
1651 vfldl2e => {
1652         irn_flags => "R",
1653         reg_req   => { out => [ "vfp" ] },
1654         latency   => 4,
1655         units     => [ "VFP" ],
1656         mode      => "mode_E",
1657         attr_type => "ia32_x87_attr_t",
1658 },
1659
1660 vfConst => {
1661         op_flags  => "c",
1662         irn_flags => "R",
1663         reg_req   => { out => [ "vfp" ] },
1664         latency   => 3,
1665         units     => [ "VFP" ],
1666         mode      => "mode_E",
1667         attr_type => "ia32_x87_attr_t",
1668 },
1669
1670 # other
1671
1672 vfCondJmp => {
1673         state     => "pinned",
1674         op_flags  => "L|X|Y",
1675         reg_req   => { in => [ "vfp", "vfp" ], out => [ "none", "none", "eax" ] },
1676         ins       => [ "left", "right" ],
1677         outs      => [ "false", "true", "temp_reg_eax" ],
1678         attr      => "long pnc",
1679         init_attr => "attr->attr.pn_code = pnc;",
1680         latency   => 10,
1681         units     => [ "VFP" ],
1682         attr_type => "ia32_x87_attr_t",
1683 },
1684
1685 #------------------------------------------------------------------------#
1686 #       ___ _____    __ _             _                     _            #
1687 # __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1688 # \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1689 #  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1690 # /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1691 #------------------------------------------------------------------------#
1692
1693 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1694 #       are swapped, we work this around in the emitter...
1695
1696 fadd => {
1697         op_flags  => "R",
1698         rd_constructor => "NONE",
1699         reg_req   => { },
1700         emit      => '. fadd%XM %x87_binop',
1701         attr_type => "ia32_x87_attr_t",
1702 },
1703
1704 faddp => {
1705         op_flags  => "R",
1706         rd_constructor => "NONE",
1707         reg_req   => { },
1708         emit      => '. faddp%XM %x87_binop',
1709         attr_type => "ia32_x87_attr_t",
1710 },
1711
1712 fmul => {
1713         op_flags  => "R",
1714         rd_constructor => "NONE",
1715         reg_req   => { },
1716         emit      => '. fmul%XM %x87_binop',
1717         attr_type => "ia32_x87_attr_t",
1718 },
1719
1720 fmulp => {
1721         op_flags  => "R",
1722         rd_constructor => "NONE",
1723         reg_req   => { },
1724         emit      => '. fmulp%XM %x87_binop',,
1725         attr_type => "ia32_x87_attr_t",
1726 },
1727
1728 fsub => {
1729         op_flags  => "R",
1730         rd_constructor => "NONE",
1731         reg_req   => { },
1732         emit      => '. fsub%XM %x87_binop',
1733         attr_type => "ia32_x87_attr_t",
1734 },
1735
1736 fsubp => {
1737         op_flags  => "R",
1738         rd_constructor => "NONE",
1739         reg_req   => { },
1740 # see note about gas bugs
1741         emit      => '. fsubrp%XM %x87_binop',
1742         attr_type => "ia32_x87_attr_t",
1743 },
1744
1745 fsubr => {
1746         op_flags  => "R",
1747         rd_constructor => "NONE",
1748         irn_flags => "R",
1749         reg_req   => { },
1750         emit      => '. fsubr%XM %x87_binop',
1751         attr_type => "ia32_x87_attr_t",
1752 },
1753
1754 fsubrp => {
1755         op_flags  => "R",
1756         rd_constructor => "NONE",
1757         irn_flags => "R",
1758         reg_req   => { },
1759 # see note about gas bugs
1760         emit      => '. fsubp%XM %x87_binop',
1761         attr_type => "ia32_x87_attr_t",
1762 },
1763
1764 fprem => {
1765         op_flags  => "R",
1766         rd_constructor => "NONE",
1767         reg_req   => { },
1768         emit      => '. fprem1',
1769         attr_type => "ia32_x87_attr_t",
1770 },
1771
1772 # this node is just here, to keep the simulator running
1773 # we can omit this when a fprem simulation function exists
1774 fpremp => {
1775         op_flags  => "R",
1776         rd_constructor => "NONE",
1777         reg_req   => { },
1778         emit      => '. fprem1',
1779         attr_type => "ia32_x87_attr_t",
1780 },
1781
1782 fdiv => {
1783         op_flags  => "R",
1784         rd_constructor => "NONE",
1785         reg_req   => { },
1786         emit      => '. fdiv%XM %x87_binop',
1787         attr_type => "ia32_x87_attr_t",
1788 },
1789
1790 fdivp => {
1791         op_flags  => "R",
1792         rd_constructor => "NONE",
1793         reg_req   => { },
1794 # see note about gas bugs
1795         emit      => '. fdivrp%XM %x87_binop',
1796         attr_type => "ia32_x87_attr_t",
1797 },
1798
1799 fdivr => {
1800         op_flags  => "R",
1801         rd_constructor => "NONE",
1802         reg_req   => { },
1803         emit      => '. fdivr%XM %x87_binop',
1804         attr_type => "ia32_x87_attr_t",
1805 },
1806
1807 fdivrp => {
1808         op_flags  => "R",
1809         rd_constructor => "NONE",
1810         reg_req   => { },
1811 # see note about gas bugs
1812         emit      => '. fdivp%XM %x87_binop',
1813         attr_type => "ia32_x87_attr_t",
1814 },
1815
1816 fabs => {
1817         op_flags  => "R",
1818         rd_constructor => "NONE",
1819         reg_req   => { },
1820         emit      => '. fabs',
1821         attr_type => "ia32_x87_attr_t",
1822 },
1823
1824 fchs => {
1825         op_flags  => "R|K",
1826         rd_constructor => "NONE",
1827         reg_req   => { },
1828         emit      => '. fchs',
1829         attr_type => "ia32_x87_attr_t",
1830 },
1831
1832 # x87 Load and Store
1833
1834 fld => {
1835         rd_constructor => "NONE",
1836         op_flags  => "R|L|F",
1837         state     => "exc_pinned",
1838         reg_req   => { },
1839         emit      => '. fld%XM %AM',
1840         attr_type => "ia32_x87_attr_t",
1841 },
1842
1843 fst => {
1844         rd_constructor => "NONE",
1845         op_flags  => "R|L|F",
1846         state     => "exc_pinned",
1847         reg_req   => { },
1848         emit      => '. fst%XM %AM',
1849         mode      => "mode_M",
1850         attr_type => "ia32_x87_attr_t",
1851 },
1852
1853 fstp => {
1854         rd_constructor => "NONE",
1855         op_flags  => "R|L|F",
1856         state     => "exc_pinned",
1857         reg_req   => { },
1858         emit      => '. fstp%XM %AM',
1859         mode      => "mode_M",
1860         attr_type => "ia32_x87_attr_t",
1861 },
1862
1863 # Conversions
1864
1865 fild => {
1866         op_flags  => "R",
1867         rd_constructor => "NONE",
1868         reg_req   => { },
1869         emit      => '. fild%XM %AM',
1870         attr_type => "ia32_x87_attr_t",
1871 },
1872
1873 fist => {
1874         op_flags  => "R",
1875         state     => "exc_pinned",
1876         rd_constructor => "NONE",
1877         reg_req   => { },
1878         emit      => '. fist%XM %AM',
1879         mode      => "mode_M",
1880         attr_type => "ia32_x87_attr_t",
1881 },
1882
1883 fistp => {
1884         op_flags  => "R",
1885         state     => "exc_pinned",
1886         rd_constructor => "NONE",
1887         reg_req   => { },
1888         emit      => '. fistp%XM %AM',
1889         mode      => "mode_M",
1890         attr_type => "ia32_x87_attr_t",
1891 },
1892
1893 # constants
1894
1895 fldz => {
1896         op_flags  => "R|c|K",
1897         irn_flags  => "R",
1898         reg_req   => { },
1899         emit      => '. fldz',
1900         attr_type => "ia32_x87_attr_t",
1901 },
1902
1903 fld1 => {
1904         op_flags  => "R|c|K",
1905         irn_flags  => "R",
1906         reg_req   => { },
1907         emit      => '. fld1',
1908         attr_type => "ia32_x87_attr_t",
1909 },
1910
1911 fldpi => {
1912         op_flags  => "R|c|K",
1913         irn_flags  => "R",
1914         reg_req   => { },
1915         emit      => '. fldpi',
1916         attr_type => "ia32_x87_attr_t",
1917 },
1918
1919 fldln2 => {
1920         op_flags  => "R|c|K",
1921         irn_flags  => "R",
1922         reg_req   => { },
1923         emit      => '. fldln2',
1924         attr_type => "ia32_x87_attr_t",
1925 },
1926
1927 fldlg2 => {
1928         op_flags  => "R|c|K",
1929         irn_flags  => "R",
1930         reg_req   => { },
1931         emit      => '. fldlg2',
1932         attr_type => "ia32_x87_attr_t",
1933 },
1934
1935 fldl2t => {
1936         op_flags  => "R|c|K",
1937         irn_flags  => "R",
1938         reg_req   => { },
1939         emit      => '. fldll2t',
1940         attr_type => "ia32_x87_attr_t",
1941 },
1942
1943 fldl2e => {
1944         op_flags  => "R|c|K",
1945         irn_flags  => "R",
1946         reg_req   => { },
1947         emit      => '. fldl2e',
1948         attr_type => "ia32_x87_attr_t",
1949 },
1950
1951 # fxch, fpush, fpop
1952 # Note that it is NEVER allowed to do CSE on these nodes
1953 # Moreover, note the virtual register requierements!
1954
1955 fxch => {
1956         op_flags  => "R|K",
1957         reg_req   => { },
1958         cmp_attr  => "return 1;",
1959         emit      => '. fxch %X0',
1960         attr_type => "ia32_x87_attr_t",
1961 },
1962
1963 fpush => {
1964         op_flags  => "R|K",
1965         reg_req   => {},
1966         cmp_attr  => "return 1;",
1967         emit      => '. fld %X0',
1968         attr_type => "ia32_x87_attr_t",
1969 },
1970
1971 fpushCopy => {
1972         op_flags  => "R",
1973         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1974         cmp_attr  => "return 1;",
1975         emit      => '. fld %X0',
1976         attr_type => "ia32_x87_attr_t",
1977 },
1978
1979 fpop => {
1980         op_flags  => "R|K",
1981         reg_req   => { },
1982         cmp_attr  => "return 1;",
1983         emit      => '. fstp %X0',
1984         attr_type => "ia32_x87_attr_t",
1985 },
1986
1987 # compare
1988
1989 fcomJmp => {
1990         op_flags  => "L|X|Y",
1991         reg_req   => { },
1992         attr_type => "ia32_x87_attr_t",
1993 },
1994
1995 fcompJmp => {
1996         op_flags  => "L|X|Y",
1997         reg_req   => { },
1998         attr_type => "ia32_x87_attr_t",
1999 },
2000
2001 fcomppJmp => {
2002         op_flags  => "L|X|Y",
2003         reg_req   => { },
2004         attr_type => "ia32_x87_attr_t",
2005 },
2006
2007 fcomrJmp => {
2008         op_flags  => "L|X|Y",
2009         reg_req   => { },
2010         attr_type => "ia32_x87_attr_t",
2011 },
2012
2013 fcomrpJmp => {
2014         op_flags  => "L|X|Y",
2015         reg_req   => { },
2016         attr_type => "ia32_x87_attr_t",
2017 },
2018
2019 fcomrppJmp => {
2020         op_flags  => "L|X|Y",
2021         reg_req   => { },
2022         attr_type => "ia32_x87_attr_t",
2023 },
2024
2025
2026 # -------------------------------------------------------------------------------- #
2027 #  ____ ____  _____                  _                               _             #
2028 # / ___/ ___|| ____| __   _____  ___| |_ ___  _ __   _ __   ___   __| | ___  ___   #
2029 # \___ \___ \|  _|   \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __|  #
2030 #  ___) |__) | |___   \ V /  __/ (__| || (_) | |    | | | | (_) | (_| |  __/\__ \  #
2031 # |____/____/|_____|   \_/ \___|\___|\__\___/|_|    |_| |_|\___/ \__,_|\___||___/  #
2032 #                                                                                  #
2033 # -------------------------------------------------------------------------------- #
2034
2035
2036 # Spilling and reloading of SSE registers, hardcoded, not generated #
2037
2038 xxLoad => {
2039         op_flags  => "L|F",
2040         state     => "exc_pinned",
2041         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2042         emit      => '. movdqu %D0, %AM',
2043         outs      => [ "res", "M" ],
2044         units     => [ "SSE" ],
2045 },
2046
2047 xxStore => {
2048         op_flags => "L|F",
2049         state    => "exc_pinned",
2050         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
2051         emit     => '. movdqu %binop',
2052         units    => [ "SSE" ],
2053         mode     => "mode_M",
2054 },
2055
2056 ); # end of %nodes
2057
2058 # Include the generated SIMD node specification written by the SIMD optimization
2059 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2060 unless ($return = do $my_script_name) {
2061         warn "couldn't parse $my_script_name: $@" if $@;
2062         warn "couldn't do $my_script_name: $!"    unless defined $return;
2063         warn "couldn't run $my_script_name"       unless $return;
2064 }