add Zex8/Zex16 instructions
[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 Zex8 => {
785         irn_flags => "R",
786         reg_req   => { in => [ "eax ebx ecx edx" ], out => [ "gp" ] },
787         emit      => '. movzbl %SB0, %D0',
788         units     => [ "GP" ],
789         mode      => $mode_gp,
790         modified_flags => []
791 },
792
793 Zex16 => {
794         irn_flags => "R",
795         reg_req   => { in => [ "gp" ], out => [ "gp" ] },
796         emit      => '. movzwl %SW0, %D0',
797         units     => [ "GP" ],
798         mode      => $mode_gp,
799         modified_flags => []
800 },
801
802
803 # other operations
804
805 CondJmp => {
806         state     => "pinned",
807         op_flags  => "L|X|Y",
808         reg_req   => { in  => [ "gp", "gp", "gp", "gp", "none" ],
809                        out => [ "none", "none"] },
810         ins       => [ "base", "index", "left", "right", "mem" ],
811         outs      => [ "false", "true" ],
812         attr      => "long pnc",
813         init_attr => "attr->pn_code = pnc;",
814         latency   => 3,
815         units     => [ "BRANCH" ],
816 },
817
818 TestJmp => {
819         state     => "pinned",
820         op_flags  => "L|X|Y",
821         reg_req   => { in  => [ "gp", "gp", "gp", "gp", "none" ],
822                        out => [ "none", "none" ] },
823         ins       => [ "base", "index", "left", "right", "mem" ],
824         outs      => [ "false", "true" ],
825         attr      => "long pnc",
826         init_attr => "attr->pn_code = pnc;",
827         latency   => 3,
828         units     => [ "BRANCH" ],
829 },
830
831 SwitchJmp => {
832         state     => "pinned",
833         op_flags  => "L|X|Y",
834         reg_req   => { in => [ "gp" ], out => [ "none" ] },
835         latency   => 3,
836         units     => [ "BRANCH" ],
837         mode      => "mode_T",
838 },
839
840 IJmp => {
841         state     => "pinned",
842         op_flags  => "X",
843         reg_req   => { in => [ "gp", "gp", "gp", "none" ] },
844         ins       => [ "base", "index", "val", "mem" ],
845         emit      => '. jmp *%unop2',
846         units     => [ "BRANCH" ],
847         mode      => "mode_X",
848         modified_flags => []
849 },
850
851 Const => {
852         op_flags  => "c",
853         irn_flags => "R",
854         reg_req   => { out => [ "gp" ] },
855         units     => [ "GP" ],
856         mode      => $mode_gp,
857 },
858
859 Unknown_GP => {
860         state     => "pinned",
861         op_flags  => "c",
862         irn_flags => "I",
863         reg_req   => { out => [ "gp_UKNWN" ] },
864         units     => [],
865         emit      => "",
866         mode      => $mode_gp
867 },
868
869 Unknown_VFP => {
870         state     => "pinned",
871         op_flags  => "c",
872         irn_flags => "I",
873         reg_req   => { out => [ "vfp_UKNWN" ] },
874         units     => [],
875         emit      => "",
876         mode      => "mode_E",
877         attr_type => "ia32_x87_attr_t",
878 },
879
880 Unknown_XMM => {
881         state     => "pinned",
882         op_flags  => "c",
883         irn_flags => "I",
884         reg_req   => { out => [ "xmm_UKNWN" ] },
885         units     => [],
886         emit      => "",
887         mode      => "mode_E"
888 },
889
890 NoReg_GP => {
891         state     => "pinned",
892         op_flags  => "c",
893         irn_flags => "I",
894         reg_req   => { out => [ "gp_NOREG" ] },
895         units     => [],
896         emit      => "",
897         mode      => $mode_gp
898 },
899
900 NoReg_VFP => {
901         state     => "pinned",
902         op_flags  => "c",
903         irn_flags => "I",
904         reg_req   => { out => [ "vfp_NOREG" ] },
905         units     => [],
906         emit      => "",
907         mode      => "mode_E",
908         attr_type => "ia32_x87_attr_t",
909 },
910
911 NoReg_XMM => {
912         state     => "pinned",
913         op_flags  => "c",
914         irn_flags => "I",
915         reg_req   => { out => [ "xmm_NOREG" ] },
916         units     => [],
917         emit      => "",
918         mode      => "mode_E"
919 },
920
921 ChangeCW => {
922         state     => "pinned",
923         op_flags  => "c",
924         irn_flags => "I",
925         reg_req   => { out => [ "fp_cw" ] },
926         mode      => $mode_fpcw,
927         latency   => 3,
928         units     => [ "GP" ],
929         modified_flags => $fpcw_flags
930 },
931
932 FldCW => {
933         op_flags  => "L|F",
934         state     => "pinned",
935         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
936         latency   => 5,
937         emit      => ". fldcw %AM",
938         mode      => $mode_fpcw,
939         units     => [ "GP" ],
940         modified_flags => $fpcw_flags
941 },
942
943 FnstCW => {
944         op_flags  => "L|F",
945         state     => "pinned",
946         reg_req   => { in => [ "gp", "gp", "fp_cw", "none" ], out => [ "none" ] },
947         latency   => 5,
948         emit      => ". fnstcw %AM",
949         mode      => "mode_M",
950         units     => [ "GP" ],
951 },
952
953 Cltd => {
954         # we should not rematrialize this node. It produces 2 results and has
955         # very strict constrains
956         reg_req   => { in => [ "eax", "edx" ], out => [ "edx" ] },
957         ins       => [ "val", "globbered" ],
958         emit      => '. cltd',
959         mode      => $mode_gp,
960         units     => [ "GP" ],
961 },
962
963 # Load / Store
964 #
965 # Note that we add additional latency values depending on address mode, so a
966 # lateny of 0 for load is correct
967
968 Load => {
969         op_flags  => "L|F",
970         state     => "exc_pinned",
971         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
972         ins       => [ "base", "index", "mem" ],
973         outs      => [ "res", "M" ],
974         latency   => 0,
975         emit      => ". mov%SE%ME%.l %AM, %D0",
976         units     => [ "GP" ],
977 },
978
979 l_Load => {
980         op_flags  => "L|F",
981         cmp_attr  => "return 1;",
982         outs      => [ "res", "M" ],
983         arity     => 2,
984 },
985
986 l_Store => {
987         op_flags  => "L|F",
988         cmp_attr  => "return 1;",
989         state     => "exc_pinned",
990         arity     => 3,
991         mode      => "mode_M",
992 },
993
994 Store => {
995         op_flags  => "L|F",
996         state     => "exc_pinned",
997         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "none" ] },
998         ins       => [ "base", "index", "val", "mem" ],
999         emit      => '. mov%M %binop',
1000         latency   => 2,
1001         units     => [ "GP" ],
1002         mode      => "mode_M",
1003 },
1004
1005 Store8Bit => {
1006         op_flags  => "L|F",
1007         state     => "exc_pinned",
1008         reg_req   => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => ["none" ] },
1009         emit      => '. mov%M %binop',
1010         latency   => 2,
1011         units     => [ "GP" ],
1012         mode      => "mode_M",
1013 },
1014
1015 Lea => {
1016         irn_flags => "R",
1017         reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
1018         emit      => '. leal %AM, %D0',
1019         latency   => 2,
1020         units     => [ "GP" ],
1021         mode      => $mode_gp,
1022         modified_flags => [],
1023 },
1024
1025 Push => {
1026         reg_req   => { in => [ "gp", "gp", "gp", "esp", "none" ], out => [ "esp", "none" ] },
1027         emit      => '. push%M %unop2',
1028         ins       => [ "base", "index", "val", "stack", "mem" ],
1029         outs      => [ "stack:I|S", "M" ],
1030         latency   => 2,
1031         units     => [ "GP" ],
1032         modified_flags => [],
1033 },
1034
1035 Pop => {
1036         reg_req   => { in => [ "gp", "gp", "esp", "none" ], out => [ "esp", "gp", "none" ] },
1037         emit      => '. pop%M %DAM1',
1038         outs      => [ "stack:I|S", "res", "M" ],
1039         ins       => [ "base", "index", "stack", "mem" ],
1040         latency   => 3, # Pop is more expensive than Push on Athlon
1041         units     => [ "GP" ],
1042         modified_flags => [],
1043 },
1044
1045 Enter => {
1046         reg_req   => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1047         emit      => '. enter',
1048         outs      => [ "frame:I", "stack:I|S", "M" ],
1049         latency   => 15,
1050         units     => [ "GP" ],
1051 },
1052
1053 Leave => {
1054         reg_req   => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1055         emit      => '. leave',
1056         outs      => [ "frame:I", "stack:I|S" ],
1057         latency   => 3,
1058         units     => [ "GP" ],
1059 },
1060
1061 AddSP => {
1062         irn_flags => "I",
1063         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "none" ] },
1064         emit      => '. addl %binop',
1065         outs      => [ "stack:S", "M" ],
1066         units     => [ "GP" ],
1067         modified_flags => $status_flags
1068 },
1069
1070 SubSP => {
1071 #irn_flags => "I",
1072         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "gp", "none" ] },
1073         emit      => ". subl %binop\n".
1074                      ". movl %%esp, %D1",
1075         outs      => [ "stack:I|S", "addr", "M" ],
1076         units     => [ "GP" ],
1077         modified_flags => $status_flags
1078 },
1079
1080 LdTls => {
1081         irn_flags => "R",
1082         reg_req   => { out => [ "gp" ] },
1083         units     => [ "GP" ],
1084 },
1085
1086 # the int instruction
1087 int => {
1088         reg_req   => { in => [ "none" ], out => [ "none" ] },
1089         mode      => "mode_M",
1090         attr      => "tarval *tv",
1091         init_attr => "\tset_ia32_Immop_tarval(res, tv);",
1092         emit      => '. int %C',
1093         units     => [ "GP" ],
1094         cmp_attr  => "return 1;",
1095 },
1096
1097
1098 #-----------------------------------------------------------------------------#
1099 #   _____ _____ ______    __ _             _                     _            #
1100 #  / ____/ ____|  ____|  / _| |           | |                   | |           #
1101 # | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1102 #  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1103 #  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1104 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1105 #-----------------------------------------------------------------------------#
1106
1107 # commutative operations
1108
1109 xAdd => {
1110         irn_flags => "R",
1111         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1112         emit      => '. add%XXM %binop',
1113         latency   => 4,
1114         units     => [ "SSE" ],
1115         mode      => "mode_E",
1116 },
1117
1118 xMul => {
1119         irn_flags => "R",
1120         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1121         emit      => '. mul%XXM %binop',
1122         latency   => 4,
1123         units     => [ "SSE" ],
1124         mode      => "mode_E",
1125 },
1126
1127 xMax => {
1128         irn_flags => "R",
1129         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1130         emit      => '. max%XXM %binop',
1131         latency   => 2,
1132         units     => [ "SSE" ],
1133         mode      => "mode_E",
1134 },
1135
1136 xMin => {
1137         irn_flags => "R",
1138         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1139         emit      => '. min%XXM %binop',
1140         latency   => 2,
1141         units     => [ "SSE" ],
1142         mode      => "mode_E",
1143 },
1144
1145 xAnd => {
1146         irn_flags => "R",
1147         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1148         emit      => '. andp%XSD %binop',
1149         latency   => 3,
1150         units     => [ "SSE" ],
1151         mode      => "mode_E",
1152 },
1153
1154 xOr => {
1155         irn_flags => "R",
1156         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1157         emit      => '. orp%XSD %binop',
1158         units     => [ "SSE" ],
1159         mode      => "mode_E",
1160 },
1161
1162 xXor => {
1163         irn_flags => "R",
1164         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1165         emit      => '. xorp%XSD %binop',
1166         latency   => 3,
1167         units     => [ "SSE" ],
1168         mode      => "mode_E",
1169 },
1170
1171 # not commutative operations
1172
1173 xAndNot => {
1174         irn_flags => "R",
1175         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1176         emit      => '. andnp%XSD %binop',
1177         latency   => 3,
1178         units     => [ "SSE" ],
1179         mode      => "mode_E",
1180 },
1181
1182 xSub => {
1183         irn_flags => "R",
1184         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1185         emit      => '. sub%XXM %binop',
1186         latency   => 4,
1187         units     => [ "SSE" ],
1188         mode      => "mode_E",
1189 },
1190
1191 xDiv => {
1192         irn_flags => "R",
1193         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4", "none" ] },
1194         outs      => [ "res", "M" ],
1195         emit      => '. div%XXM %binop',
1196         latency   => 16,
1197         units     => [ "SSE" ],
1198 },
1199
1200 # other operations
1201
1202 xCmp => {
1203         irn_flags => "R",
1204         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1205         latency   => 3,
1206         units     => [ "SSE" ],
1207         mode      => "mode_E",
1208 },
1209
1210 xCondJmp => {
1211         state     => "pinned",
1212         op_flags  => "L|X|Y",
1213         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "none", "none" ] },
1214         ins       => [ "base", "index", "left", "right", "mem" ],
1215         outs      => [ "false", "true" ],
1216         attr      => "long pnc",
1217         init_attr => "attr->pn_code = pnc;",
1218         latency   => 5,
1219         units     => [ "SSE" ],
1220 },
1221
1222 xConst => {
1223         op_flags  => "c",
1224         irn_flags => "R",
1225         reg_req   => { out => [ "xmm" ] },
1226         emit      => '. mov%XXM %C, %D0',
1227         latency   => 2,
1228         units     => [ "SSE" ],
1229         mode      => "mode_E",
1230 },
1231
1232 # Load / Store
1233
1234 xLoad => {
1235         op_flags  => "L|F",
1236         state     => "exc_pinned",
1237         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1238         emit      => '. mov%XXM %AM, %D0',
1239         outs      => [ "res", "M" ],
1240         latency   => 2,
1241         units     => [ "SSE" ],
1242 },
1243
1244 xStore => {
1245         op_flags => "L|F",
1246         state    => "exc_pinned",
1247         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1248         emit     => '. mov%XXM %binop',
1249         latency  => 2,
1250         units    => [ "SSE" ],
1251         mode     => "mode_M",
1252 },
1253
1254 xStoreSimple => {
1255         op_flags => "L|F",
1256         state    => "exc_pinned",
1257         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1258         ins      => [ "base", "index", "val", "mem" ],
1259         emit     => '. mov%XXM %S2, %AM',
1260         latency  => 2,
1261         units    => [ "SSE" ],
1262         mode     => "mode_M",
1263 },
1264
1265 CvtSI2SS => {
1266         op_flags => "L|F",
1267         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm" ] },
1268         emit     => '. cvtsi2ss %D0, %AM',
1269         latency  => 2,
1270         units    => [ "SSE" ],
1271         mode     => $mode_xmm
1272 },
1273
1274 CvtSI2SD => {
1275         op_flags => "L|F",
1276         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm" ] },
1277         emit     => '. cvtsi2sd %unop2',
1278         latency  => 2,
1279         units    => [ "SSE" ],
1280         mode     => $mode_xmm
1281 },
1282
1283
1284 l_X87toSSE => {
1285         op_flags => "L|F",
1286         cmp_attr => "return 1;",
1287         arity    => 3,
1288 },
1289
1290 l_SSEtoX87 => {
1291         op_flags => "L|F",
1292         cmp_attr => "return 1;",
1293         arity    => 3,
1294 },
1295
1296 # CopyB
1297
1298 CopyB => {
1299         op_flags => "F|H",
1300         state    => "pinned",
1301         reg_req  => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1302         outs     => [ "DST", "SRC", "CNT", "M" ],
1303         units    => [ "GP" ],
1304         modified_flags => [ "DF" ]
1305 },
1306
1307 CopyB_i => {
1308         op_flags => "F|H",
1309         state    => "pinned",
1310         reg_req  => { in => [ "edi", "esi", "none" ], out => [  "edi", "esi", "none" ] },
1311         outs     => [ "DST", "SRC", "M" ],
1312         units    => [ "GP" ],
1313         modified_flags => [ "DF" ]
1314 },
1315
1316 # Conversions
1317
1318 Conv_I2I => {
1319         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3", "none" ] },
1320         units    => [ "GP" ],
1321         ins      => [ "base", "index", "val", "mem" ],
1322         mode     => $mode_gp,
1323         modified_flags => $status_flags
1324 },
1325
1326 Conv_I2I8Bit => {
1327         reg_req  => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => [ "in_r3", "none" ] },
1328         ins      => [ "base", "index", "val", "mem" ],
1329         units    => [ "GP" ],
1330         mode     => $mode_gp,
1331         modified_flags => $status_flags
1332 },
1333
1334 Conv_I2FP => {
1335         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1336         latency  => 10,
1337         units    => [ "SSE" ],
1338         mode     => "mode_E",
1339 },
1340
1341 Conv_FP2I => {
1342         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "gp", "none" ] },
1343         latency  => 10,
1344         units    => [ "SSE" ],
1345         mode     => $mode_gp,
1346 },
1347
1348 Conv_FP2FP => {
1349         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "xmm", "none" ] },
1350         latency  => 8,
1351         units    => [ "SSE" ],
1352         mode     => "mode_E",
1353 },
1354
1355 CmpCMov => {
1356         irn_flags => "R",
1357         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none", "gp", "gp" ], out => [ "in_r7" ] },
1358         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem", "val_true", "val_false" ],
1359         attr      => "pn_Cmp pn_code",
1360         init_attr => "attr->pn_code = pn_code;",
1361         latency   => 2,
1362         units     => [ "GP" ],
1363         mode      => $mode_gp,
1364 },
1365
1366 TestCMov => {
1367         irn_flags => "R",
1368         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none", "gp", "gp" ], out => [ "in_r7" ] },
1369         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem", "val_true", "val_false" ],
1370         attr      => "pn_Cmp pn_code",
1371         init_attr => "attr->pn_code = pn_code;",
1372         latency   => 2,
1373         units     => [ "GP" ],
1374         mode      => $mode_gp,
1375 },
1376
1377 xCmpCMov => {
1378         irn_flags => "R",
1379         reg_req   => { in => [ "xmm", "xmm", "gp", "gp" ], out => [ "in_r4" ] },
1380         latency   => 5,
1381         units     => [ "SSE" ],
1382         mode      => $mode_gp,
1383 },
1384
1385 vfCmpCMov => {
1386         irn_flags => "R",
1387         reg_req   => { in => [ "vfp", "vfp", "gp", "gp" ], out => [ "in_r4" ] },
1388         latency   => 10,
1389         units     => [ "VFP" ],
1390         mode      => $mode_gp,
1391         attr_type => "ia32_x87_attr_t",
1392 },
1393
1394 CmpSet => {
1395         irn_flags => "R",
1396         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1397         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1398         attr      => "pn_Cmp pn_code",
1399         init_attr => "attr->pn_code = pn_code;",
1400         latency   => 2,
1401         units     => [ "GP" ],
1402         mode      => $mode_gp,
1403 },
1404
1405 TestSet => {
1406         irn_flags => "R",
1407         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1408         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1409         attr      => "pn_Cmp pn_code",
1410         init_attr => "attr->pn_code = pn_code;",
1411         latency   => 2,
1412         units     => [ "GP" ],
1413         mode      => $mode_gp,
1414 },
1415
1416 xCmpSet => {
1417         irn_flags => "R",
1418         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "eax ebx ecx edx" ] },
1419         latency   => 5,
1420         units     => [ "SSE" ],
1421         mode      => $mode_gp,
1422 },
1423
1424 vfCmpSet => {
1425         irn_flags => "R",
1426         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "eax ebx ecx edx" ] },
1427         latency   => 10,
1428         units     => [ "VFP" ],
1429         mode      => $mode_gp,
1430         attr_type => "ia32_x87_attr_t",
1431 },
1432
1433 vfCMov => {
1434         irn_flags => "R",
1435         reg_req   => { in => [ "vfp", "vfp", "vfp", "vfp" ], out => [ "vfp" ] },
1436         latency   => 10,
1437         units     => [ "VFP" ],
1438         mode      => "mode_E",
1439         attr_type => "ia32_x87_attr_t",
1440 },
1441
1442 #----------------------------------------------------------#
1443 #        _      _               _    __ _             _    #
1444 #       (_)    | |             | |  / _| |           | |   #
1445 # __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
1446 # \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
1447 #  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
1448 #   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1449 #                 | |                                      #
1450 #  _ __   ___   __| | ___  ___                             #
1451 # | '_ \ / _ \ / _` |/ _ \/ __|                            #
1452 # | | | | (_) | (_| |  __/\__ \                            #
1453 # |_| |_|\___/ \__,_|\___||___/                            #
1454 #----------------------------------------------------------#
1455
1456 vfadd => {
1457         irn_flags => "R",
1458         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1459         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1460         latency   => 4,
1461         units     => [ "VFP" ],
1462         mode      => "mode_E",
1463         attr_type => "ia32_x87_attr_t",
1464 },
1465
1466 vfmul => {
1467         irn_flags => "R",
1468         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1469         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1470         latency   => 4,
1471         units     => [ "VFP" ],
1472         mode      => "mode_E",
1473         attr_type => "ia32_x87_attr_t",
1474 },
1475
1476 l_vfmul => {
1477         op_flags  => "C",
1478         cmp_attr  => "return 1;",
1479         arity     => 2,
1480 },
1481
1482 vfsub => {
1483         irn_flags => "R",
1484         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1485         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1486         latency   => 4,
1487         units     => [ "VFP" ],
1488         mode      => "mode_E",
1489         attr_type => "ia32_x87_attr_t",
1490 },
1491
1492 l_vfsub => {
1493         cmp_attr  => "return 1;",
1494         arity     => 2,
1495 },
1496
1497 vfdiv => {
1498         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp", "none" ] },
1499         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1500         outs      => [ "res", "M" ],
1501         latency   => 20,
1502         units     => [ "VFP" ],
1503         attr_type => "ia32_x87_attr_t",
1504 },
1505
1506 l_vfdiv => {
1507         cmp_attr  => "return 1;",
1508         outs      => [ "res", "M" ],
1509         arity     => 2,
1510 },
1511
1512 vfprem => {
1513         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1514         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1515         latency   => 20,
1516         units     => [ "VFP" ],
1517         mode      => "mode_E",
1518         attr_type => "ia32_x87_attr_t",
1519 },
1520
1521 l_vfprem => {
1522         cmp_attr  => "return 1;",
1523         arity     => 2,
1524 },
1525
1526 vfabs => {
1527         irn_flags => "R",
1528         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1529         ins       => [ "value" ],
1530         latency   => 2,
1531         units     => [ "VFP" ],
1532         mode      => "mode_E",
1533         attr_type => "ia32_x87_attr_t",
1534 },
1535
1536 vfchs => {
1537         irn_flags => "R",
1538         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1539         ins       => [ "value" ],
1540         latency   => 2,
1541         units     => [ "VFP" ],
1542         mode      => "mode_E",
1543         attr_type => "ia32_x87_attr_t",
1544 },
1545
1546 # virtual Load and Store
1547
1548 vfld => {
1549         op_flags  => "L|F",
1550         state     => "exc_pinned",
1551         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1552         ins       => [ "base", "index", "mem" ],
1553         outs      => [ "res", "M" ],
1554         attr      => "ir_mode *store_mode",
1555         init_attr => "attr->attr.ls_mode = store_mode;",
1556         latency   => 2,
1557         units     => [ "VFP" ],
1558         attr_type => "ia32_x87_attr_t",
1559 },
1560
1561 vfst => {
1562         op_flags  => "L|F",
1563         state     => "exc_pinned",
1564         reg_req   => { in => [ "gp", "gp", "vfp", "none" ] },
1565         ins       => [ "base", "index", "val", "mem" ],
1566         attr      => "ir_mode *store_mode",
1567         init_attr => "attr->attr.ls_mode = store_mode;",
1568         latency   => 2,
1569         units     => [ "VFP" ],
1570         mode      => "mode_M",
1571         attr_type => "ia32_x87_attr_t",
1572 },
1573
1574 # Conversions
1575
1576 vfild => {
1577         state     => "exc_pinned",
1578         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1579         outs      => [ "res", "M" ],
1580         ins       => [ "base", "index", "mem" ],
1581         latency   => 4,
1582         units     => [ "VFP" ],
1583         attr_type => "ia32_x87_attr_t",
1584 },
1585
1586 l_vfild => {
1587         cmp_attr  => "return 1;",
1588         outs      => [ "res", "M" ],
1589         arity     => 2,
1590 },
1591
1592 vfist => {
1593         state     => "exc_pinned",
1594         reg_req   => { in => [ "gp", "gp", "vfp", "fpcw", "none" ] },
1595         ins       => [ "base", "index", "val", "fpcw", "mem" ],
1596         latency   => 4,
1597         units     => [ "VFP" ],
1598         mode      => "mode_M",
1599         attr_type => "ia32_x87_attr_t",
1600 },
1601
1602 l_vfist => {
1603         cmp_attr  => "return 1;",
1604         state     => "exc_pinned",
1605         arity     => 3,
1606         mode      => "mode_M",
1607 },
1608
1609
1610 # constants
1611
1612 vfldz => {
1613         irn_flags => "R",
1614         reg_req   => { out => [ "vfp" ] },
1615         latency   => 4,
1616         units     => [ "VFP" ],
1617         mode      => "mode_E",
1618         attr_type => "ia32_x87_attr_t",
1619 },
1620
1621 vfld1 => {
1622         irn_flags => "R",
1623         reg_req   => { out => [ "vfp" ] },
1624         latency   => 4,
1625         units     => [ "VFP" ],
1626         mode      => "mode_E",
1627         attr_type => "ia32_x87_attr_t",
1628 },
1629
1630 vfldpi => {
1631         irn_flags => "R",
1632         reg_req   => { out => [ "vfp" ] },
1633         latency   => 4,
1634         units     => [ "VFP" ],
1635         mode      => "mode_E",
1636         attr_type => "ia32_x87_attr_t",
1637 },
1638
1639 vfldln2 => {
1640         irn_flags => "R",
1641         reg_req   => { out => [ "vfp" ] },
1642         latency   => 4,
1643         units     => [ "VFP" ],
1644         mode      => "mode_E",
1645         attr_type => "ia32_x87_attr_t",
1646 },
1647
1648 vfldlg2 => {
1649         irn_flags => "R",
1650         reg_req   => { out => [ "vfp" ] },
1651         latency   => 4,
1652         units     => [ "VFP" ],
1653         mode      => "mode_E",
1654         attr_type => "ia32_x87_attr_t",
1655 },
1656
1657 vfldl2t => {
1658         irn_flags => "R",
1659         reg_req   => { out => [ "vfp" ] },
1660         latency   => 4,
1661         units     => [ "VFP" ],
1662         mode      => "mode_E",
1663         attr_type => "ia32_x87_attr_t",
1664 },
1665
1666 vfldl2e => {
1667         irn_flags => "R",
1668         reg_req   => { out => [ "vfp" ] },
1669         latency   => 4,
1670         units     => [ "VFP" ],
1671         mode      => "mode_E",
1672         attr_type => "ia32_x87_attr_t",
1673 },
1674
1675 vfConst => {
1676         op_flags  => "c",
1677         irn_flags => "R",
1678         reg_req   => { out => [ "vfp" ] },
1679         latency   => 3,
1680         units     => [ "VFP" ],
1681         mode      => "mode_E",
1682         attr_type => "ia32_x87_attr_t",
1683 },
1684
1685 # other
1686
1687 vfCondJmp => {
1688         state     => "pinned",
1689         op_flags  => "L|X|Y",
1690         reg_req   => { in => [ "vfp", "vfp" ], out => [ "none", "none", "eax" ] },
1691         ins       => [ "left", "right" ],
1692         outs      => [ "false", "true", "temp_reg_eax" ],
1693         attr      => "long pnc",
1694         init_attr => "attr->attr.pn_code = pnc;",
1695         latency   => 10,
1696         units     => [ "VFP" ],
1697         attr_type => "ia32_x87_attr_t",
1698 },
1699
1700 #------------------------------------------------------------------------#
1701 #       ___ _____    __ _             _                     _            #
1702 # __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1703 # \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1704 #  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1705 # /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1706 #------------------------------------------------------------------------#
1707
1708 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1709 #       are swapped, we work this around in the emitter...
1710
1711 fadd => {
1712         op_flags  => "R",
1713         rd_constructor => "NONE",
1714         reg_req   => { },
1715         emit      => '. fadd%XM %x87_binop',
1716         attr_type => "ia32_x87_attr_t",
1717 },
1718
1719 faddp => {
1720         op_flags  => "R",
1721         rd_constructor => "NONE",
1722         reg_req   => { },
1723         emit      => '. faddp%XM %x87_binop',
1724         attr_type => "ia32_x87_attr_t",
1725 },
1726
1727 fmul => {
1728         op_flags  => "R",
1729         rd_constructor => "NONE",
1730         reg_req   => { },
1731         emit      => '. fmul%XM %x87_binop',
1732         attr_type => "ia32_x87_attr_t",
1733 },
1734
1735 fmulp => {
1736         op_flags  => "R",
1737         rd_constructor => "NONE",
1738         reg_req   => { },
1739         emit      => '. fmulp%XM %x87_binop',,
1740         attr_type => "ia32_x87_attr_t",
1741 },
1742
1743 fsub => {
1744         op_flags  => "R",
1745         rd_constructor => "NONE",
1746         reg_req   => { },
1747         emit      => '. fsub%XM %x87_binop',
1748         attr_type => "ia32_x87_attr_t",
1749 },
1750
1751 fsubp => {
1752         op_flags  => "R",
1753         rd_constructor => "NONE",
1754         reg_req   => { },
1755 # see note about gas bugs
1756         emit      => '. fsubrp%XM %x87_binop',
1757         attr_type => "ia32_x87_attr_t",
1758 },
1759
1760 fsubr => {
1761         op_flags  => "R",
1762         rd_constructor => "NONE",
1763         irn_flags => "R",
1764         reg_req   => { },
1765         emit      => '. fsubr%XM %x87_binop',
1766         attr_type => "ia32_x87_attr_t",
1767 },
1768
1769 fsubrp => {
1770         op_flags  => "R",
1771         rd_constructor => "NONE",
1772         irn_flags => "R",
1773         reg_req   => { },
1774 # see note about gas bugs
1775         emit      => '. fsubp%XM %x87_binop',
1776         attr_type => "ia32_x87_attr_t",
1777 },
1778
1779 fprem => {
1780         op_flags  => "R",
1781         rd_constructor => "NONE",
1782         reg_req   => { },
1783         emit      => '. fprem1',
1784         attr_type => "ia32_x87_attr_t",
1785 },
1786
1787 # this node is just here, to keep the simulator running
1788 # we can omit this when a fprem simulation function exists
1789 fpremp => {
1790         op_flags  => "R",
1791         rd_constructor => "NONE",
1792         reg_req   => { },
1793         emit      => '. fprem1',
1794         attr_type => "ia32_x87_attr_t",
1795 },
1796
1797 fdiv => {
1798         op_flags  => "R",
1799         rd_constructor => "NONE",
1800         reg_req   => { },
1801         emit      => '. fdiv%XM %x87_binop',
1802         attr_type => "ia32_x87_attr_t",
1803 },
1804
1805 fdivp => {
1806         op_flags  => "R",
1807         rd_constructor => "NONE",
1808         reg_req   => { },
1809 # see note about gas bugs
1810         emit      => '. fdivrp%XM %x87_binop',
1811         attr_type => "ia32_x87_attr_t",
1812 },
1813
1814 fdivr => {
1815         op_flags  => "R",
1816         rd_constructor => "NONE",
1817         reg_req   => { },
1818         emit      => '. fdivr%XM %x87_binop',
1819         attr_type => "ia32_x87_attr_t",
1820 },
1821
1822 fdivrp => {
1823         op_flags  => "R",
1824         rd_constructor => "NONE",
1825         reg_req   => { },
1826 # see note about gas bugs
1827         emit      => '. fdivp%XM %x87_binop',
1828         attr_type => "ia32_x87_attr_t",
1829 },
1830
1831 fabs => {
1832         op_flags  => "R",
1833         rd_constructor => "NONE",
1834         reg_req   => { },
1835         emit      => '. fabs',
1836         attr_type => "ia32_x87_attr_t",
1837 },
1838
1839 fchs => {
1840         op_flags  => "R|K",
1841         rd_constructor => "NONE",
1842         reg_req   => { },
1843         emit      => '. fchs',
1844         attr_type => "ia32_x87_attr_t",
1845 },
1846
1847 # x87 Load and Store
1848
1849 fld => {
1850         rd_constructor => "NONE",
1851         op_flags  => "R|L|F",
1852         state     => "exc_pinned",
1853         reg_req   => { },
1854         emit      => '. fld%XM %AM',
1855         attr_type => "ia32_x87_attr_t",
1856 },
1857
1858 fst => {
1859         rd_constructor => "NONE",
1860         op_flags  => "R|L|F",
1861         state     => "exc_pinned",
1862         reg_req   => { },
1863         emit      => '. fst%XM %AM',
1864         mode      => "mode_M",
1865         attr_type => "ia32_x87_attr_t",
1866 },
1867
1868 fstp => {
1869         rd_constructor => "NONE",
1870         op_flags  => "R|L|F",
1871         state     => "exc_pinned",
1872         reg_req   => { },
1873         emit      => '. fstp%XM %AM',
1874         mode      => "mode_M",
1875         attr_type => "ia32_x87_attr_t",
1876 },
1877
1878 # Conversions
1879
1880 fild => {
1881         op_flags  => "R",
1882         rd_constructor => "NONE",
1883         reg_req   => { },
1884         emit      => '. fild%XM %AM',
1885         attr_type => "ia32_x87_attr_t",
1886 },
1887
1888 fist => {
1889         op_flags  => "R",
1890         state     => "exc_pinned",
1891         rd_constructor => "NONE",
1892         reg_req   => { },
1893         emit      => '. fist%XM %AM',
1894         mode      => "mode_M",
1895         attr_type => "ia32_x87_attr_t",
1896 },
1897
1898 fistp => {
1899         op_flags  => "R",
1900         state     => "exc_pinned",
1901         rd_constructor => "NONE",
1902         reg_req   => { },
1903         emit      => '. fistp%XM %AM',
1904         mode      => "mode_M",
1905         attr_type => "ia32_x87_attr_t",
1906 },
1907
1908 # constants
1909
1910 fldz => {
1911         op_flags  => "R|c|K",
1912         irn_flags  => "R",
1913         reg_req   => { },
1914         emit      => '. fldz',
1915         attr_type => "ia32_x87_attr_t",
1916 },
1917
1918 fld1 => {
1919         op_flags  => "R|c|K",
1920         irn_flags  => "R",
1921         reg_req   => { },
1922         emit      => '. fld1',
1923         attr_type => "ia32_x87_attr_t",
1924 },
1925
1926 fldpi => {
1927         op_flags  => "R|c|K",
1928         irn_flags  => "R",
1929         reg_req   => { },
1930         emit      => '. fldpi',
1931         attr_type => "ia32_x87_attr_t",
1932 },
1933
1934 fldln2 => {
1935         op_flags  => "R|c|K",
1936         irn_flags  => "R",
1937         reg_req   => { },
1938         emit      => '. fldln2',
1939         attr_type => "ia32_x87_attr_t",
1940 },
1941
1942 fldlg2 => {
1943         op_flags  => "R|c|K",
1944         irn_flags  => "R",
1945         reg_req   => { },
1946         emit      => '. fldlg2',
1947         attr_type => "ia32_x87_attr_t",
1948 },
1949
1950 fldl2t => {
1951         op_flags  => "R|c|K",
1952         irn_flags  => "R",
1953         reg_req   => { },
1954         emit      => '. fldll2t',
1955         attr_type => "ia32_x87_attr_t",
1956 },
1957
1958 fldl2e => {
1959         op_flags  => "R|c|K",
1960         irn_flags  => "R",
1961         reg_req   => { },
1962         emit      => '. fldl2e',
1963         attr_type => "ia32_x87_attr_t",
1964 },
1965
1966 # fxch, fpush, fpop
1967 # Note that it is NEVER allowed to do CSE on these nodes
1968 # Moreover, note the virtual register requierements!
1969
1970 fxch => {
1971         op_flags  => "R|K",
1972         reg_req   => { },
1973         cmp_attr  => "return 1;",
1974         emit      => '. fxch %X0',
1975         attr_type => "ia32_x87_attr_t",
1976 },
1977
1978 fpush => {
1979         op_flags  => "R|K",
1980         reg_req   => {},
1981         cmp_attr  => "return 1;",
1982         emit      => '. fld %X0',
1983         attr_type => "ia32_x87_attr_t",
1984 },
1985
1986 fpushCopy => {
1987         op_flags  => "R",
1988         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1989         cmp_attr  => "return 1;",
1990         emit      => '. fld %X0',
1991         attr_type => "ia32_x87_attr_t",
1992 },
1993
1994 fpop => {
1995         op_flags  => "R|K",
1996         reg_req   => { },
1997         cmp_attr  => "return 1;",
1998         emit      => '. fstp %X0',
1999         attr_type => "ia32_x87_attr_t",
2000 },
2001
2002 # compare
2003
2004 fcomJmp => {
2005         op_flags  => "L|X|Y",
2006         reg_req   => { },
2007         attr_type => "ia32_x87_attr_t",
2008 },
2009
2010 fcompJmp => {
2011         op_flags  => "L|X|Y",
2012         reg_req   => { },
2013         attr_type => "ia32_x87_attr_t",
2014 },
2015
2016 fcomppJmp => {
2017         op_flags  => "L|X|Y",
2018         reg_req   => { },
2019         attr_type => "ia32_x87_attr_t",
2020 },
2021
2022 fcomrJmp => {
2023         op_flags  => "L|X|Y",
2024         reg_req   => { },
2025         attr_type => "ia32_x87_attr_t",
2026 },
2027
2028 fcomrpJmp => {
2029         op_flags  => "L|X|Y",
2030         reg_req   => { },
2031         attr_type => "ia32_x87_attr_t",
2032 },
2033
2034 fcomrppJmp => {
2035         op_flags  => "L|X|Y",
2036         reg_req   => { },
2037         attr_type => "ia32_x87_attr_t",
2038 },
2039
2040
2041 # -------------------------------------------------------------------------------- #
2042 #  ____ ____  _____                  _                               _             #
2043 # / ___/ ___|| ____| __   _____  ___| |_ ___  _ __   _ __   ___   __| | ___  ___   #
2044 # \___ \___ \|  _|   \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __|  #
2045 #  ___) |__) | |___   \ V /  __/ (__| || (_) | |    | | | | (_) | (_| |  __/\__ \  #
2046 # |____/____/|_____|   \_/ \___|\___|\__\___/|_|    |_| |_|\___/ \__,_|\___||___/  #
2047 #                                                                                  #
2048 # -------------------------------------------------------------------------------- #
2049
2050
2051 # Spilling and reloading of SSE registers, hardcoded, not generated #
2052
2053 xxLoad => {
2054         op_flags  => "L|F",
2055         state     => "exc_pinned",
2056         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2057         emit      => '. movdqu %D0, %AM',
2058         outs      => [ "res", "M" ],
2059         units     => [ "SSE" ],
2060 },
2061
2062 xxStore => {
2063         op_flags => "L|F",
2064         state    => "exc_pinned",
2065         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
2066         emit     => '. movdqu %binop',
2067         units    => [ "SSE" ],
2068         mode     => "mode_M",
2069 },
2070
2071 ); # end of %nodes
2072
2073 # Include the generated SIMD node specification written by the SIMD optimization
2074 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2075 unless ($return = do $my_script_name) {
2076         warn "couldn't parse $my_script_name: $@" if $@;
2077         warn "couldn't do $my_script_name: $!"    unless defined $return;
2078         warn "couldn't run $my_script_name"       unless $return;
2079 }