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