remove debug printfs
[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         state     => "exc_pinned",
1301         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3", "none" ] },
1302         units     => [ "GP" ],
1303         ins       => [ "base", "index", "val", "mem" ],
1304         attr      => "ir_mode *smaller_mode",
1305         init_attr => "attr->ls_mode = smaller_mode;",
1306         mode      => $mode_gp,
1307         modified_flags => $status_flags
1308 },
1309
1310 Conv_I2I8Bit => {
1311         state     => "exc_pinned",
1312         reg_req   => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => [ "in_r3", "none" ] },
1313         ins       => [ "base", "index", "val", "mem" ],
1314         units     => [ "GP" ],
1315         attr      => "ir_mode *smaller_mode",
1316         init_attr => "attr->ls_mode = smaller_mode;",
1317         mode      => $mode_gp,
1318         modified_flags => $status_flags
1319 },
1320
1321 Conv_I2FP => {
1322         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1323         latency  => 10,
1324         units    => [ "SSE" ],
1325         mode     => "mode_E",
1326 },
1327
1328 Conv_FP2I => {
1329         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "gp", "none" ] },
1330         latency  => 10,
1331         units    => [ "SSE" ],
1332         mode     => $mode_gp,
1333 },
1334
1335 Conv_FP2FP => {
1336         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "xmm", "none" ] },
1337         latency  => 8,
1338         units    => [ "SSE" ],
1339         mode     => "mode_E",
1340 },
1341
1342 CmpCMov => {
1343         irn_flags => "R",
1344         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none", "gp", "gp" ], out => [ "in_r7" ] },
1345         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem", "val_true", "val_false" ],
1346         attr      => "pn_Cmp pn_code",
1347         init_attr => "attr->pn_code = pn_code;",
1348         latency   => 2,
1349         units     => [ "GP" ],
1350         mode      => $mode_gp,
1351 },
1352
1353 TestCMov => {
1354         irn_flags => "R",
1355         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none", "gp", "gp" ], out => [ "in_r7" ] },
1356         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem", "val_true", "val_false" ],
1357         attr      => "pn_Cmp pn_code",
1358         init_attr => "attr->pn_code = pn_code;",
1359         latency   => 2,
1360         units     => [ "GP" ],
1361         mode      => $mode_gp,
1362 },
1363
1364 xCmpCMov => {
1365         irn_flags => "R",
1366         reg_req   => { in => [ "xmm", "xmm", "gp", "gp" ], out => [ "in_r4" ] },
1367         latency   => 5,
1368         units     => [ "SSE" ],
1369         mode      => $mode_gp,
1370 },
1371
1372 vfCmpCMov => {
1373         irn_flags => "R",
1374         reg_req   => { in => [ "vfp", "vfp", "gp", "gp" ], out => [ "in_r4" ] },
1375         latency   => 10,
1376         units     => [ "VFP" ],
1377         mode      => $mode_gp,
1378         attr_type => "ia32_x87_attr_t",
1379 },
1380
1381 CmpSet => {
1382         irn_flags => "R",
1383         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1384         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1385         attr      => "pn_Cmp pn_code",
1386         init_attr => "attr->pn_code = pn_code;",
1387         latency   => 2,
1388         units     => [ "GP" ],
1389         mode      => $mode_gp,
1390 },
1391
1392 TestSet => {
1393         irn_flags => "R",
1394         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1395         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1396         attr      => "pn_Cmp pn_code",
1397         init_attr => "attr->pn_code = pn_code;",
1398         latency   => 2,
1399         units     => [ "GP" ],
1400         mode      => $mode_gp,
1401 },
1402
1403 xCmpSet => {
1404         irn_flags => "R",
1405         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "eax ebx ecx edx" ] },
1406         latency   => 5,
1407         units     => [ "SSE" ],
1408         mode      => $mode_gp,
1409 },
1410
1411 vfCmpSet => {
1412         irn_flags => "R",
1413         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "eax ebx ecx edx" ] },
1414         latency   => 10,
1415         units     => [ "VFP" ],
1416         mode      => $mode_gp,
1417         attr_type => "ia32_x87_attr_t",
1418 },
1419
1420 vfCMov => {
1421         irn_flags => "R",
1422         reg_req   => { in => [ "vfp", "vfp", "vfp", "vfp" ], out => [ "vfp" ] },
1423         latency   => 10,
1424         units     => [ "VFP" ],
1425         mode      => "mode_E",
1426         attr_type => "ia32_x87_attr_t",
1427 },
1428
1429 #----------------------------------------------------------#
1430 #        _      _               _    __ _             _    #
1431 #       (_)    | |             | |  / _| |           | |   #
1432 # __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
1433 # \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
1434 #  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
1435 #   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1436 #                 | |                                      #
1437 #  _ __   ___   __| | ___  ___                             #
1438 # | '_ \ / _ \ / _` |/ _ \/ __|                            #
1439 # | | | | (_) | (_| |  __/\__ \                            #
1440 # |_| |_|\___/ \__,_|\___||___/                            #
1441 #----------------------------------------------------------#
1442
1443 vfadd => {
1444         irn_flags => "R",
1445         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1446         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1447         latency   => 4,
1448         units     => [ "VFP" ],
1449         mode      => "mode_E",
1450         attr_type => "ia32_x87_attr_t",
1451 },
1452
1453 vfmul => {
1454         irn_flags => "R",
1455         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1456         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1457         latency   => 4,
1458         units     => [ "VFP" ],
1459         mode      => "mode_E",
1460         attr_type => "ia32_x87_attr_t",
1461 },
1462
1463 l_vfmul => {
1464         op_flags  => "C",
1465         cmp_attr  => "return 1;",
1466         arity     => 2,
1467 },
1468
1469 vfsub => {
1470         irn_flags => "R",
1471         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1472         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1473         latency   => 4,
1474         units     => [ "VFP" ],
1475         mode      => "mode_E",
1476         attr_type => "ia32_x87_attr_t",
1477 },
1478
1479 l_vfsub => {
1480         cmp_attr  => "return 1;",
1481         arity     => 2,
1482 },
1483
1484 vfdiv => {
1485         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp", "none" ] },
1486         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1487         outs      => [ "res", "M" ],
1488         latency   => 20,
1489         units     => [ "VFP" ],
1490         attr_type => "ia32_x87_attr_t",
1491 },
1492
1493 l_vfdiv => {
1494         cmp_attr  => "return 1;",
1495         outs      => [ "res", "M" ],
1496         arity     => 2,
1497 },
1498
1499 vfprem => {
1500         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1501         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1502         latency   => 20,
1503         units     => [ "VFP" ],
1504         mode      => "mode_E",
1505         attr_type => "ia32_x87_attr_t",
1506 },
1507
1508 l_vfprem => {
1509         cmp_attr  => "return 1;",
1510         arity     => 2,
1511 },
1512
1513 vfabs => {
1514         irn_flags => "R",
1515         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1516         ins       => [ "value" ],
1517         latency   => 2,
1518         units     => [ "VFP" ],
1519         mode      => "mode_E",
1520         attr_type => "ia32_x87_attr_t",
1521 },
1522
1523 vfchs => {
1524         irn_flags => "R",
1525         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1526         ins       => [ "value" ],
1527         latency   => 2,
1528         units     => [ "VFP" ],
1529         mode      => "mode_E",
1530         attr_type => "ia32_x87_attr_t",
1531 },
1532
1533 # virtual Load and Store
1534
1535 vfld => {
1536         op_flags  => "L|F",
1537         state     => "exc_pinned",
1538         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1539         ins       => [ "base", "index", "mem" ],
1540         outs      => [ "res", "M" ],
1541         attr      => "ir_mode *store_mode",
1542         init_attr => "attr->attr.ls_mode = store_mode;",
1543         latency   => 2,
1544         units     => [ "VFP" ],
1545         attr_type => "ia32_x87_attr_t",
1546 },
1547
1548 vfst => {
1549         op_flags  => "L|F",
1550         state     => "exc_pinned",
1551         reg_req   => { in => [ "gp", "gp", "vfp", "none" ] },
1552         ins       => [ "base", "index", "val", "mem" ],
1553         attr      => "ir_mode *store_mode",
1554         init_attr => "attr->attr.ls_mode = store_mode;",
1555         latency   => 2,
1556         units     => [ "VFP" ],
1557         mode      => "mode_M",
1558         attr_type => "ia32_x87_attr_t",
1559 },
1560
1561 # Conversions
1562
1563 vfild => {
1564         state     => "exc_pinned",
1565         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1566         outs      => [ "res", "M" ],
1567         ins       => [ "base", "index", "mem" ],
1568         latency   => 4,
1569         units     => [ "VFP" ],
1570         attr_type => "ia32_x87_attr_t",
1571 },
1572
1573 l_vfild => {
1574         cmp_attr  => "return 1;",
1575         outs      => [ "res", "M" ],
1576         arity     => 2,
1577 },
1578
1579 vfist => {
1580         state     => "exc_pinned",
1581         reg_req   => { in => [ "gp", "gp", "vfp", "fpcw", "none" ] },
1582         ins       => [ "base", "index", "val", "fpcw", "mem" ],
1583         latency   => 4,
1584         units     => [ "VFP" ],
1585         mode      => "mode_M",
1586         attr_type => "ia32_x87_attr_t",
1587 },
1588
1589 l_vfist => {
1590         cmp_attr  => "return 1;",
1591         state     => "exc_pinned",
1592         arity     => 3,
1593         mode      => "mode_M",
1594 },
1595
1596
1597 # constants
1598
1599 vfldz => {
1600         irn_flags => "R",
1601         reg_req   => { out => [ "vfp" ] },
1602         latency   => 4,
1603         units     => [ "VFP" ],
1604         mode      => "mode_E",
1605         attr_type => "ia32_x87_attr_t",
1606 },
1607
1608 vfld1 => {
1609         irn_flags => "R",
1610         reg_req   => { out => [ "vfp" ] },
1611         latency   => 4,
1612         units     => [ "VFP" ],
1613         mode      => "mode_E",
1614         attr_type => "ia32_x87_attr_t",
1615 },
1616
1617 vfldpi => {
1618         irn_flags => "R",
1619         reg_req   => { out => [ "vfp" ] },
1620         latency   => 4,
1621         units     => [ "VFP" ],
1622         mode      => "mode_E",
1623         attr_type => "ia32_x87_attr_t",
1624 },
1625
1626 vfldln2 => {
1627         irn_flags => "R",
1628         reg_req   => { out => [ "vfp" ] },
1629         latency   => 4,
1630         units     => [ "VFP" ],
1631         mode      => "mode_E",
1632         attr_type => "ia32_x87_attr_t",
1633 },
1634
1635 vfldlg2 => {
1636         irn_flags => "R",
1637         reg_req   => { out => [ "vfp" ] },
1638         latency   => 4,
1639         units     => [ "VFP" ],
1640         mode      => "mode_E",
1641         attr_type => "ia32_x87_attr_t",
1642 },
1643
1644 vfldl2t => {
1645         irn_flags => "R",
1646         reg_req   => { out => [ "vfp" ] },
1647         latency   => 4,
1648         units     => [ "VFP" ],
1649         mode      => "mode_E",
1650         attr_type => "ia32_x87_attr_t",
1651 },
1652
1653 vfldl2e => {
1654         irn_flags => "R",
1655         reg_req   => { out => [ "vfp" ] },
1656         latency   => 4,
1657         units     => [ "VFP" ],
1658         mode      => "mode_E",
1659         attr_type => "ia32_x87_attr_t",
1660 },
1661
1662 vfConst => {
1663         op_flags  => "c",
1664         irn_flags => "R",
1665         reg_req   => { out => [ "vfp" ] },
1666         latency   => 3,
1667         units     => [ "VFP" ],
1668         mode      => "mode_E",
1669         attr_type => "ia32_x87_attr_t",
1670 },
1671
1672 # other
1673
1674 vfCondJmp => {
1675         state     => "pinned",
1676         op_flags  => "L|X|Y",
1677         reg_req   => { in => [ "vfp", "vfp" ], out => [ "none", "none", "eax" ] },
1678         ins       => [ "left", "right" ],
1679         outs      => [ "false", "true", "temp_reg_eax" ],
1680         attr      => "long pnc",
1681         init_attr => "attr->attr.pn_code = pnc;",
1682         latency   => 10,
1683         units     => [ "VFP" ],
1684         attr_type => "ia32_x87_attr_t",
1685 },
1686
1687 #------------------------------------------------------------------------#
1688 #       ___ _____    __ _             _                     _            #
1689 # __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1690 # \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1691 #  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1692 # /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1693 #------------------------------------------------------------------------#
1694
1695 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1696 #       are swapped, we work this around in the emitter...
1697
1698 fadd => {
1699         op_flags  => "R",
1700         rd_constructor => "NONE",
1701         reg_req   => { },
1702         emit      => '. fadd%XM %x87_binop',
1703         attr_type => "ia32_x87_attr_t",
1704 },
1705
1706 faddp => {
1707         op_flags  => "R",
1708         rd_constructor => "NONE",
1709         reg_req   => { },
1710         emit      => '. faddp%XM %x87_binop',
1711         attr_type => "ia32_x87_attr_t",
1712 },
1713
1714 fmul => {
1715         op_flags  => "R",
1716         rd_constructor => "NONE",
1717         reg_req   => { },
1718         emit      => '. fmul%XM %x87_binop',
1719         attr_type => "ia32_x87_attr_t",
1720 },
1721
1722 fmulp => {
1723         op_flags  => "R",
1724         rd_constructor => "NONE",
1725         reg_req   => { },
1726         emit      => '. fmulp%XM %x87_binop',,
1727         attr_type => "ia32_x87_attr_t",
1728 },
1729
1730 fsub => {
1731         op_flags  => "R",
1732         rd_constructor => "NONE",
1733         reg_req   => { },
1734         emit      => '. fsub%XM %x87_binop',
1735         attr_type => "ia32_x87_attr_t",
1736 },
1737
1738 fsubp => {
1739         op_flags  => "R",
1740         rd_constructor => "NONE",
1741         reg_req   => { },
1742 # see note about gas bugs
1743         emit      => '. fsubrp%XM %x87_binop',
1744         attr_type => "ia32_x87_attr_t",
1745 },
1746
1747 fsubr => {
1748         op_flags  => "R",
1749         rd_constructor => "NONE",
1750         irn_flags => "R",
1751         reg_req   => { },
1752         emit      => '. fsubr%XM %x87_binop',
1753         attr_type => "ia32_x87_attr_t",
1754 },
1755
1756 fsubrp => {
1757         op_flags  => "R",
1758         rd_constructor => "NONE",
1759         irn_flags => "R",
1760         reg_req   => { },
1761 # see note about gas bugs
1762         emit      => '. fsubp%XM %x87_binop',
1763         attr_type => "ia32_x87_attr_t",
1764 },
1765
1766 fprem => {
1767         op_flags  => "R",
1768         rd_constructor => "NONE",
1769         reg_req   => { },
1770         emit      => '. fprem1',
1771         attr_type => "ia32_x87_attr_t",
1772 },
1773
1774 # this node is just here, to keep the simulator running
1775 # we can omit this when a fprem simulation function exists
1776 fpremp => {
1777         op_flags  => "R",
1778         rd_constructor => "NONE",
1779         reg_req   => { },
1780         emit      => '. fprem1',
1781         attr_type => "ia32_x87_attr_t",
1782 },
1783
1784 fdiv => {
1785         op_flags  => "R",
1786         rd_constructor => "NONE",
1787         reg_req   => { },
1788         emit      => '. fdiv%XM %x87_binop',
1789         attr_type => "ia32_x87_attr_t",
1790 },
1791
1792 fdivp => {
1793         op_flags  => "R",
1794         rd_constructor => "NONE",
1795         reg_req   => { },
1796 # see note about gas bugs
1797         emit      => '. fdivrp%XM %x87_binop',
1798         attr_type => "ia32_x87_attr_t",
1799 },
1800
1801 fdivr => {
1802         op_flags  => "R",
1803         rd_constructor => "NONE",
1804         reg_req   => { },
1805         emit      => '. fdivr%XM %x87_binop',
1806         attr_type => "ia32_x87_attr_t",
1807 },
1808
1809 fdivrp => {
1810         op_flags  => "R",
1811         rd_constructor => "NONE",
1812         reg_req   => { },
1813 # see note about gas bugs
1814         emit      => '. fdivp%XM %x87_binop',
1815         attr_type => "ia32_x87_attr_t",
1816 },
1817
1818 fabs => {
1819         op_flags  => "R",
1820         rd_constructor => "NONE",
1821         reg_req   => { },
1822         emit      => '. fabs',
1823         attr_type => "ia32_x87_attr_t",
1824 },
1825
1826 fchs => {
1827         op_flags  => "R|K",
1828         rd_constructor => "NONE",
1829         reg_req   => { },
1830         emit      => '. fchs',
1831         attr_type => "ia32_x87_attr_t",
1832 },
1833
1834 # x87 Load and Store
1835
1836 fld => {
1837         rd_constructor => "NONE",
1838         op_flags  => "R|L|F",
1839         state     => "exc_pinned",
1840         reg_req   => { },
1841         emit      => '. fld%XM %AM',
1842         attr_type => "ia32_x87_attr_t",
1843 },
1844
1845 fst => {
1846         rd_constructor => "NONE",
1847         op_flags  => "R|L|F",
1848         state     => "exc_pinned",
1849         reg_req   => { },
1850         emit      => '. fst%XM %AM',
1851         mode      => "mode_M",
1852         attr_type => "ia32_x87_attr_t",
1853 },
1854
1855 fstp => {
1856         rd_constructor => "NONE",
1857         op_flags  => "R|L|F",
1858         state     => "exc_pinned",
1859         reg_req   => { },
1860         emit      => '. fstp%XM %AM',
1861         mode      => "mode_M",
1862         attr_type => "ia32_x87_attr_t",
1863 },
1864
1865 # Conversions
1866
1867 fild => {
1868         op_flags  => "R",
1869         rd_constructor => "NONE",
1870         reg_req   => { },
1871         emit      => '. fild%XM %AM',
1872         attr_type => "ia32_x87_attr_t",
1873 },
1874
1875 fist => {
1876         op_flags  => "R",
1877         state     => "exc_pinned",
1878         rd_constructor => "NONE",
1879         reg_req   => { },
1880         emit      => '. fist%XM %AM',
1881         mode      => "mode_M",
1882         attr_type => "ia32_x87_attr_t",
1883 },
1884
1885 fistp => {
1886         op_flags  => "R",
1887         state     => "exc_pinned",
1888         rd_constructor => "NONE",
1889         reg_req   => { },
1890         emit      => '. fistp%XM %AM',
1891         mode      => "mode_M",
1892         attr_type => "ia32_x87_attr_t",
1893 },
1894
1895 # constants
1896
1897 fldz => {
1898         op_flags  => "R|c|K",
1899         irn_flags  => "R",
1900         reg_req   => { },
1901         emit      => '. fldz',
1902         attr_type => "ia32_x87_attr_t",
1903 },
1904
1905 fld1 => {
1906         op_flags  => "R|c|K",
1907         irn_flags  => "R",
1908         reg_req   => { },
1909         emit      => '. fld1',
1910         attr_type => "ia32_x87_attr_t",
1911 },
1912
1913 fldpi => {
1914         op_flags  => "R|c|K",
1915         irn_flags  => "R",
1916         reg_req   => { },
1917         emit      => '. fldpi',
1918         attr_type => "ia32_x87_attr_t",
1919 },
1920
1921 fldln2 => {
1922         op_flags  => "R|c|K",
1923         irn_flags  => "R",
1924         reg_req   => { },
1925         emit      => '. fldln2',
1926         attr_type => "ia32_x87_attr_t",
1927 },
1928
1929 fldlg2 => {
1930         op_flags  => "R|c|K",
1931         irn_flags  => "R",
1932         reg_req   => { },
1933         emit      => '. fldlg2',
1934         attr_type => "ia32_x87_attr_t",
1935 },
1936
1937 fldl2t => {
1938         op_flags  => "R|c|K",
1939         irn_flags  => "R",
1940         reg_req   => { },
1941         emit      => '. fldll2t',
1942         attr_type => "ia32_x87_attr_t",
1943 },
1944
1945 fldl2e => {
1946         op_flags  => "R|c|K",
1947         irn_flags  => "R",
1948         reg_req   => { },
1949         emit      => '. fldl2e',
1950         attr_type => "ia32_x87_attr_t",
1951 },
1952
1953 # fxch, fpush, fpop
1954 # Note that it is NEVER allowed to do CSE on these nodes
1955 # Moreover, note the virtual register requierements!
1956
1957 fxch => {
1958         op_flags  => "R|K",
1959         reg_req   => { },
1960         cmp_attr  => "return 1;",
1961         emit      => '. fxch %X0',
1962         attr_type => "ia32_x87_attr_t",
1963 },
1964
1965 fpush => {
1966         op_flags  => "R|K",
1967         reg_req   => {},
1968         cmp_attr  => "return 1;",
1969         emit      => '. fld %X0',
1970         attr_type => "ia32_x87_attr_t",
1971 },
1972
1973 fpushCopy => {
1974         op_flags  => "R",
1975         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1976         cmp_attr  => "return 1;",
1977         emit      => '. fld %X0',
1978         attr_type => "ia32_x87_attr_t",
1979 },
1980
1981 fpop => {
1982         op_flags  => "R|K",
1983         reg_req   => { },
1984         cmp_attr  => "return 1;",
1985         emit      => '. fstp %X0',
1986         attr_type => "ia32_x87_attr_t",
1987 },
1988
1989 # compare
1990
1991 fcomJmp => {
1992         op_flags  => "L|X|Y",
1993         reg_req   => { },
1994         attr_type => "ia32_x87_attr_t",
1995 },
1996
1997 fcompJmp => {
1998         op_flags  => "L|X|Y",
1999         reg_req   => { },
2000         attr_type => "ia32_x87_attr_t",
2001 },
2002
2003 fcomppJmp => {
2004         op_flags  => "L|X|Y",
2005         reg_req   => { },
2006         attr_type => "ia32_x87_attr_t",
2007 },
2008
2009 fcomrJmp => {
2010         op_flags  => "L|X|Y",
2011         reg_req   => { },
2012         attr_type => "ia32_x87_attr_t",
2013 },
2014
2015 fcomrpJmp => {
2016         op_flags  => "L|X|Y",
2017         reg_req   => { },
2018         attr_type => "ia32_x87_attr_t",
2019 },
2020
2021 fcomrppJmp => {
2022         op_flags  => "L|X|Y",
2023         reg_req   => { },
2024         attr_type => "ia32_x87_attr_t",
2025 },
2026
2027
2028 # -------------------------------------------------------------------------------- #
2029 #  ____ ____  _____                  _                               _             #
2030 # / ___/ ___|| ____| __   _____  ___| |_ ___  _ __   _ __   ___   __| | ___  ___   #
2031 # \___ \___ \|  _|   \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __|  #
2032 #  ___) |__) | |___   \ V /  __/ (__| || (_) | |    | | | | (_) | (_| |  __/\__ \  #
2033 # |____/____/|_____|   \_/ \___|\___|\__\___/|_|    |_| |_|\___/ \__,_|\___||___/  #
2034 #                                                                                  #
2035 # -------------------------------------------------------------------------------- #
2036
2037
2038 # Spilling and reloading of SSE registers, hardcoded, not generated #
2039
2040 xxLoad => {
2041         op_flags  => "L|F",
2042         state     => "exc_pinned",
2043         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2044         emit      => '. movdqu %D0, %AM',
2045         outs      => [ "res", "M" ],
2046         units     => [ "SSE" ],
2047 },
2048
2049 xxStore => {
2050         op_flags => "L|F",
2051         state    => "exc_pinned",
2052         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
2053         emit     => '. movdqu %binop',
2054         units    => [ "SSE" ],
2055         mode     => "mode_M",
2056 },
2057
2058 ); # end of %nodes
2059
2060 # Include the generated SIMD node specification written by the SIMD optimization
2061 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2062 unless ($return = do $my_script_name) {
2063         warn "couldn't parse $my_script_name: $@" if $@;
2064         warn "couldn't do $my_script_name: $!"    unless defined $return;
2065         warn "couldn't run $my_script_name"       unless $return;
2066 }