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