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