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