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