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