e97d78b1d5e12d1ff3d3aea49d0509d2fe083e50
[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" ],
775                        out => [ "none", "none"] },
776         ins       => [ "base", "index", "left", "right", "mem" ],
777         outs      => [ "false", "true" ],
778         attr      => "long pnc",
779         init_attr => "attr->pn_code = pnc;",
780         latency   => 3,
781         units     => [ "BRANCH" ],
782 },
783
784 TestJmp => {
785         state     => "pinned",
786         op_flags  => "L|X|Y",
787         reg_req   => { in  => [ "gp", "gp", "gp", "gp", "none" ],
788                        out => [ "none", "none" ] },
789         ins       => [ "base", "index", "left", "right", "mem" ],
790         outs      => [ "false", "true" ],
791         attr      => "long pnc",
792         init_attr => "attr->pn_code = pnc;",
793         latency   => 3,
794         units     => [ "BRANCH" ],
795 },
796
797 SwitchJmp => {
798         state     => "pinned",
799         op_flags  => "L|X|Y",
800         reg_req   => { in => [ "gp" ], out => [ "none" ] },
801         latency   => 3,
802         units     => [ "BRANCH" ],
803         mode      => "mode_T",
804 },
805
806 Const => {
807         op_flags  => "c",
808         irn_flags => "R",
809         reg_req   => { out => [ "gp" ] },
810         units     => [ "GP" ],
811         mode      => $mode_gp,
812 },
813
814 Unknown_GP => {
815         state     => "pinned",
816         op_flags  => "c",
817         irn_flags => "I",
818         reg_req   => { out => [ "gp_UKNWN" ] },
819         units     => [],
820         emit      => "",
821         mode      => $mode_gp
822 },
823
824 Unknown_VFP => {
825         state     => "pinned",
826         op_flags  => "c",
827         irn_flags => "I",
828         reg_req   => { out => [ "vfp_UKNWN" ] },
829         units     => [],
830         emit      => "",
831         mode      => "mode_E",
832         attr_type => "ia32_x87_attr_t",
833 },
834
835 Unknown_XMM => {
836         state     => "pinned",
837         op_flags  => "c",
838         irn_flags => "I",
839         reg_req   => { out => [ "xmm_UKNWN" ] },
840         units     => [],
841         emit      => "",
842         mode      => "mode_E"
843 },
844
845 NoReg_GP => {
846         state     => "pinned",
847         op_flags  => "c",
848         irn_flags => "I",
849         reg_req   => { out => [ "gp_NOREG" ] },
850         units     => [],
851         emit      => "",
852         mode      => $mode_gp
853 },
854
855 NoReg_VFP => {
856         state     => "pinned",
857         op_flags  => "c",
858         irn_flags => "I",
859         reg_req   => { out => [ "vfp_NOREG" ] },
860         units     => [],
861         emit      => "",
862         mode      => "mode_E",
863         attr_type => "ia32_x87_attr_t",
864 },
865
866 NoReg_XMM => {
867         state     => "pinned",
868         op_flags  => "c",
869         irn_flags => "I",
870         reg_req   => { out => [ "xmm_NOREG" ] },
871         units     => [],
872         emit      => "",
873         mode      => "mode_E"
874 },
875
876 ChangeCW => {
877         state     => "pinned",
878         op_flags  => "c",
879         irn_flags => "I",
880         reg_req   => { out => [ "fp_cw" ] },
881         mode      => $mode_fpcw,
882         latency   => 3,
883         units     => [ "GP" ],
884         modified_flags => $fpcw_flags
885 },
886
887 FldCW => {
888         op_flags  => "L|F",
889         state     => "pinned",
890         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
891         latency   => 5,
892         emit      => ". fldcw %AM",
893         mode      => $mode_fpcw,
894         units     => [ "GP" ],
895         modified_flags => $fpcw_flags
896 },
897
898 FnstCW => {
899         op_flags  => "L|F",
900         state     => "pinned",
901         reg_req   => { in => [ "gp", "gp", "fp_cw", "none" ], out => [ "none" ] },
902         latency   => 5,
903         emit      => ". fnstcw %AM",
904         mode      => "mode_M",
905         units     => [ "GP" ],
906 },
907
908 Cltd => {
909         # we should not rematrialize this node. It produces 2 results and has
910         # very strict constrains
911         reg_req   => { in => [ "eax" ], out => [ "edx" ] },
912         ins       => [ "val" ],
913         emit      => '. cltd',
914         mode      => $mode_gp,
915         units     => [ "GP" ],
916 },
917
918 # Load / Store
919 #
920 # Note that we add additional latency values depending on address mode, so a
921 # lateny of 0 for load is correct
922
923 Load => {
924         op_flags  => "L|F",
925         state     => "exc_pinned",
926         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
927         ins       => [ "base", "index", "mem" ],
928         outs      => [ "res", "M" ],
929         latency   => 0,
930         emit      => ". mov%SE%ME%.l %AM, %D0",
931         units     => [ "GP" ],
932 },
933
934 l_Load => {
935         op_flags  => "L|F",
936         cmp_attr  => "return 1;",
937         outs      => [ "res", "M" ],
938         arity     => 2,
939 },
940
941 l_Store => {
942         op_flags  => "L|F",
943         cmp_attr  => "return 1;",
944         state     => "exc_pinned",
945         arity     => 3,
946         mode      => "mode_M",
947 },
948
949 Store => {
950         op_flags  => "L|F",
951         state     => "exc_pinned",
952         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "none" ] },
953         ins       => [ "base", "index", "val", "mem" ],
954         emit      => '. mov%M %binop',
955         latency   => 2,
956         units     => [ "GP" ],
957         mode      => "mode_M",
958 },
959
960 Store8Bit => {
961         op_flags  => "L|F",
962         state     => "exc_pinned",
963         reg_req   => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => ["none" ] },
964         emit      => '. mov%M %binop',
965         latency   => 2,
966         units     => [ "GP" ],
967         mode      => "mode_M",
968 },
969
970 Lea => {
971         irn_flags => "R",
972         reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
973         emit      => '. leal %AM, %D0',
974         latency   => 2,
975         units     => [ "GP" ],
976         mode      => $mode_gp,
977         modified_flags => [],
978 },
979
980 Push => {
981         reg_req   => { in => [ "gp", "gp", "gp", "esp", "none" ], out => [ "esp", "none" ] },
982         emit      => '. push%M %unop2',
983         ins       => [ "base", "index", "val", "stack", "mem" ],
984         outs      => [ "stack:I|S", "M" ],
985         latency   => 2,
986         units     => [ "GP" ],
987         modified_flags => [],
988 },
989
990 Pop => {
991         reg_req   => { in => [ "gp", "gp", "esp", "none" ], out => [ "esp", "gp", "none" ] },
992         emit      => '. pop%M %DAM1',
993         outs      => [ "stack:I|S", "res", "M" ],
994         ins       => [ "base", "index", "stack", "mem" ],
995         latency   => 3, # Pop is more expensive than Push on Athlon
996         units     => [ "GP" ],
997         modified_flags => [],
998 },
999
1000 Enter => {
1001         reg_req   => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1002         emit      => '. enter',
1003         outs      => [ "frame:I", "stack:I|S", "M" ],
1004         latency   => 15,
1005         units     => [ "GP" ],
1006 },
1007
1008 Leave => {
1009         reg_req   => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1010         emit      => '. leave',
1011         outs      => [ "frame:I", "stack:I|S" ],
1012         latency   => 3,
1013         units     => [ "GP" ],
1014 },
1015
1016 AddSP => {
1017         irn_flags => "I",
1018         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "none" ] },
1019         emit      => '. addl %binop',
1020         outs      => [ "stack:S", "M" ],
1021         units     => [ "GP" ],
1022         modified_flags => $status_flags
1023 },
1024
1025 SubSP => {
1026 #irn_flags => "I",
1027         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "gp", "none" ] },
1028         emit      => ". subl %binop\n".
1029                      ". movl %%esp, %D1",
1030         outs      => [ "stack:I|S", "addr", "M" ],
1031         units     => [ "GP" ],
1032         modified_flags => $status_flags
1033 },
1034
1035 LdTls => {
1036         irn_flags => "R",
1037         reg_req   => { out => [ "gp" ] },
1038         units     => [ "GP" ],
1039 },
1040
1041 # the int instruction
1042 int => {
1043         reg_req   => { in => [ "none" ], out => [ "none" ] },
1044         mode      => "mode_M",
1045         attr      => "tarval *tv",
1046         init_attr => "\tset_ia32_Immop_tarval(res, tv);",
1047         emit      => '. int %C',
1048         units     => [ "GP" ],
1049         cmp_attr  => "return 1;",
1050 },
1051
1052
1053 #-----------------------------------------------------------------------------#
1054 #   _____ _____ ______    __ _             _                     _            #
1055 #  / ____/ ____|  ____|  / _| |           | |                   | |           #
1056 # | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1057 #  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1058 #  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1059 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1060 #-----------------------------------------------------------------------------#
1061
1062 # commutative operations
1063
1064 xAdd => {
1065         irn_flags => "R",
1066         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1067         emit      => '. add%XXM %binop',
1068         latency   => 4,
1069         units     => [ "SSE" ],
1070         mode      => "mode_E",
1071 },
1072
1073 xMul => {
1074         irn_flags => "R",
1075         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1076         emit      => '. mul%XXM %binop',
1077         latency   => 4,
1078         units     => [ "SSE" ],
1079         mode      => "mode_E",
1080 },
1081
1082 xMax => {
1083         irn_flags => "R",
1084         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1085         emit      => '. max%XXM %binop',
1086         latency   => 2,
1087         units     => [ "SSE" ],
1088         mode      => "mode_E",
1089 },
1090
1091 xMin => {
1092         irn_flags => "R",
1093         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1094         emit      => '. min%XXM %binop',
1095         latency   => 2,
1096         units     => [ "SSE" ],
1097         mode      => "mode_E",
1098 },
1099
1100 xAnd => {
1101         irn_flags => "R",
1102         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1103         emit      => '. andp%XSD %binop',
1104         latency   => 3,
1105         units     => [ "SSE" ],
1106         mode      => "mode_E",
1107 },
1108
1109 xOr => {
1110         irn_flags => "R",
1111         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1112         emit      => '. orp%XSD %binop',
1113         units     => [ "SSE" ],
1114         mode      => "mode_E",
1115 },
1116
1117 xXor => {
1118         irn_flags => "R",
1119         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1120         emit      => '. xorp%XSD %binop',
1121         latency   => 3,
1122         units     => [ "SSE" ],
1123         mode      => "mode_E",
1124 },
1125
1126 # not commutative operations
1127
1128 xAndNot => {
1129         irn_flags => "R",
1130         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1131         emit      => '. andnp%XSD %binop',
1132         latency   => 3,
1133         units     => [ "SSE" ],
1134         mode      => "mode_E",
1135 },
1136
1137 xSub => {
1138         irn_flags => "R",
1139         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1140         emit      => '. sub%XXM %binop',
1141         latency   => 4,
1142         units     => [ "SSE" ],
1143         mode      => "mode_E",
1144 },
1145
1146 xDiv => {
1147         irn_flags => "R",
1148         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4", "none" ] },
1149         outs      => [ "res", "M" ],
1150         emit      => '. div%XXM %binop',
1151         latency   => 16,
1152         units     => [ "SSE" ],
1153 },
1154
1155 # other operations
1156
1157 xCmp => {
1158         irn_flags => "R",
1159         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1160         latency   => 3,
1161         units     => [ "SSE" ],
1162         mode      => "mode_E",
1163 },
1164
1165 xCondJmp => {
1166         state     => "pinned",
1167         op_flags  => "L|X|Y",
1168         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "none", "none" ] },
1169         ins       => [ "base", "index", "left", "right", "mem" ],
1170         outs      => [ "false", "true" ],
1171         attr      => "long pnc",
1172         init_attr => "attr->pn_code = pnc;",
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", "none", "gp", "gp" ], out => [ "in_r7" ] },
1336         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem", "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 TestCMov => {
1345         irn_flags => "R",
1346         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none", "gp", "gp" ], out => [ "in_r7" ] },
1347         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem", "val_true", "val_false" ],
1348         attr      => "pn_Cmp pn_code",
1349         init_attr => "attr->pn_code = pn_code;",
1350         latency   => 2,
1351         units     => [ "GP" ],
1352         mode      => $mode_gp,
1353 },
1354
1355 xCmpCMov => {
1356         irn_flags => "R",
1357         reg_req   => { in => [ "xmm", "xmm", "gp", "gp" ], out => [ "in_r4" ] },
1358         latency   => 5,
1359         units     => [ "SSE" ],
1360         mode      => $mode_gp,
1361 },
1362
1363 vfCmpCMov => {
1364         irn_flags => "R",
1365         reg_req   => { in => [ "vfp", "vfp", "gp", "gp" ], out => [ "in_r4" ] },
1366         latency   => 10,
1367         units     => [ "VFP" ],
1368         mode      => $mode_gp,
1369         attr_type => "ia32_x87_attr_t",
1370 },
1371
1372 CmpSet => {
1373         irn_flags => "R",
1374         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1375         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1376         attr      => "pn_Cmp pn_code",
1377         init_attr => "attr->pn_code = pn_code;",
1378         latency   => 2,
1379         units     => [ "GP" ],
1380         mode      => $mode_gp,
1381 },
1382
1383 TestSet => {
1384         irn_flags => "R",
1385         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1386         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1387         attr      => "pn_Cmp pn_code",
1388         init_attr => "attr->pn_code = pn_code;",
1389         latency   => 2,
1390         units     => [ "GP" ],
1391         mode      => $mode_gp,
1392 },
1393
1394 xCmpSet => {
1395         irn_flags => "R",
1396         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "eax ebx ecx edx" ] },
1397         latency   => 5,
1398         units     => [ "SSE" ],
1399         mode      => $mode_gp,
1400 },
1401
1402 vfCmpSet => {
1403         irn_flags => "R",
1404         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "eax ebx ecx edx" ] },
1405         latency   => 10,
1406         units     => [ "VFP" ],
1407         mode      => $mode_gp,
1408         attr_type => "ia32_x87_attr_t",
1409 },
1410
1411 vfCMov => {
1412         irn_flags => "R",
1413         reg_req   => { in => [ "vfp", "vfp", "vfp", "vfp" ], out => [ "vfp" ] },
1414         latency   => 10,
1415         units     => [ "VFP" ],
1416         mode      => "mode_E",
1417         attr_type => "ia32_x87_attr_t",
1418 },
1419
1420 #----------------------------------------------------------#
1421 #        _      _               _    __ _             _    #
1422 #       (_)    | |             | |  / _| |           | |   #
1423 # __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
1424 # \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
1425 #  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
1426 #   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1427 #                 | |                                      #
1428 #  _ __   ___   __| | ___  ___                             #
1429 # | '_ \ / _ \ / _` |/ _ \/ __|                            #
1430 # | | | | (_) | (_| |  __/\__ \                            #
1431 # |_| |_|\___/ \__,_|\___||___/                            #
1432 #----------------------------------------------------------#
1433
1434 vfadd => {
1435         irn_flags => "R",
1436         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1437         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1438         latency   => 4,
1439         units     => [ "VFP" ],
1440         mode      => "mode_E",
1441         attr_type => "ia32_x87_attr_t",
1442 },
1443
1444 vfmul => {
1445         irn_flags => "R",
1446         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1447         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1448         latency   => 4,
1449         units     => [ "VFP" ],
1450         mode      => "mode_E",
1451         attr_type => "ia32_x87_attr_t",
1452 },
1453
1454 l_vfmul => {
1455         op_flags  => "C",
1456         cmp_attr  => "return 1;",
1457         arity     => 2,
1458 },
1459
1460 vfsub => {
1461         irn_flags => "R",
1462         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1463         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1464         latency   => 4,
1465         units     => [ "VFP" ],
1466         mode      => "mode_E",
1467         attr_type => "ia32_x87_attr_t",
1468 },
1469
1470 l_vfsub => {
1471         cmp_attr  => "return 1;",
1472         arity     => 2,
1473 },
1474
1475 vfdiv => {
1476         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp", "none" ] },
1477         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1478         outs      => [ "res", "M" ],
1479         latency   => 20,
1480         units     => [ "VFP" ],
1481         attr_type => "ia32_x87_attr_t",
1482 },
1483
1484 l_vfdiv => {
1485         cmp_attr  => "return 1;",
1486         outs      => [ "res", "M" ],
1487         arity     => 2,
1488 },
1489
1490 vfprem => {
1491         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1492         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1493         latency   => 20,
1494         units     => [ "VFP" ],
1495         mode      => "mode_E",
1496         attr_type => "ia32_x87_attr_t",
1497 },
1498
1499 l_vfprem => {
1500         cmp_attr  => "return 1;",
1501         arity     => 2,
1502 },
1503
1504 vfabs => {
1505         irn_flags => "R",
1506         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1507         ins       => [ "value" ],
1508         latency   => 2,
1509         units     => [ "VFP" ],
1510         mode      => "mode_E",
1511         attr_type => "ia32_x87_attr_t",
1512 },
1513
1514 vfchs => {
1515         irn_flags => "R",
1516         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1517         ins       => [ "value" ],
1518         latency   => 2,
1519         units     => [ "VFP" ],
1520         mode      => "mode_E",
1521         attr_type => "ia32_x87_attr_t",
1522 },
1523
1524 # virtual Load and Store
1525
1526 vfld => {
1527         op_flags  => "L|F",
1528         state     => "exc_pinned",
1529         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1530         ins       => [ "base", "index", "mem" ],
1531         outs      => [ "res", "M" ],
1532         attr      => "ir_mode *store_mode",
1533         init_attr => "attr->attr.ls_mode = store_mode;",
1534         latency   => 2,
1535         units     => [ "VFP" ],
1536         attr_type => "ia32_x87_attr_t",
1537 },
1538
1539 vfst => {
1540         op_flags  => "L|F",
1541         state     => "exc_pinned",
1542         reg_req   => { in => [ "gp", "gp", "vfp", "none" ] },
1543         ins       => [ "base", "index", "val", "mem" ],
1544         attr      => "ir_mode *store_mode",
1545         init_attr => "attr->attr.ls_mode = store_mode;",
1546         latency   => 2,
1547         units     => [ "VFP" ],
1548         mode      => "mode_M",
1549         attr_type => "ia32_x87_attr_t",
1550 },
1551
1552 # Conversions
1553
1554 vfild => {
1555         state     => "exc_pinned",
1556         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1557         outs      => [ "res", "M" ],
1558         ins       => [ "base", "index", "mem" ],
1559         latency   => 4,
1560         units     => [ "VFP" ],
1561         attr_type => "ia32_x87_attr_t",
1562 },
1563
1564 l_vfild => {
1565         cmp_attr  => "return 1;",
1566         outs      => [ "res", "M" ],
1567         arity     => 2,
1568 },
1569
1570 vfist => {
1571         state     => "exc_pinned",
1572         reg_req   => { in => [ "gp", "gp", "vfp", "fpcw", "none" ] },
1573         ins       => [ "base", "index", "val", "fpcw", "mem" ],
1574         latency   => 4,
1575         units     => [ "VFP" ],
1576         mode      => "mode_M",
1577         attr_type => "ia32_x87_attr_t",
1578 },
1579
1580 l_vfist => {
1581         cmp_attr  => "return 1;",
1582         state     => "exc_pinned",
1583         arity     => 3,
1584         mode      => "mode_M",
1585 },
1586
1587
1588 # constants
1589
1590 vfldz => {
1591         irn_flags => "R",
1592         reg_req   => { out => [ "vfp" ] },
1593         latency   => 4,
1594         units     => [ "VFP" ],
1595         mode      => "mode_E",
1596         attr_type => "ia32_x87_attr_t",
1597 },
1598
1599 vfld1 => {
1600         irn_flags => "R",
1601         reg_req   => { out => [ "vfp" ] },
1602         latency   => 4,
1603         units     => [ "VFP" ],
1604         mode      => "mode_E",
1605         attr_type => "ia32_x87_attr_t",
1606 },
1607
1608 vfldpi => {
1609         irn_flags => "R",
1610         reg_req   => { out => [ "vfp" ] },
1611         latency   => 4,
1612         units     => [ "VFP" ],
1613         mode      => "mode_E",
1614         attr_type => "ia32_x87_attr_t",
1615 },
1616
1617 vfldln2 => {
1618         irn_flags => "R",
1619         reg_req   => { out => [ "vfp" ] },
1620         latency   => 4,
1621         units     => [ "VFP" ],
1622         mode      => "mode_E",
1623         attr_type => "ia32_x87_attr_t",
1624 },
1625
1626 vfldlg2 => {
1627         irn_flags => "R",
1628         reg_req   => { out => [ "vfp" ] },
1629         latency   => 4,
1630         units     => [ "VFP" ],
1631         mode      => "mode_E",
1632         attr_type => "ia32_x87_attr_t",
1633 },
1634
1635 vfldl2t => {
1636         irn_flags => "R",
1637         reg_req   => { out => [ "vfp" ] },
1638         latency   => 4,
1639         units     => [ "VFP" ],
1640         mode      => "mode_E",
1641         attr_type => "ia32_x87_attr_t",
1642 },
1643
1644 vfldl2e => {
1645         irn_flags => "R",
1646         reg_req   => { out => [ "vfp" ] },
1647         latency   => 4,
1648         units     => [ "VFP" ],
1649         mode      => "mode_E",
1650         attr_type => "ia32_x87_attr_t",
1651 },
1652
1653 vfConst => {
1654         op_flags  => "c",
1655         irn_flags => "R",
1656         reg_req   => { out => [ "vfp" ] },
1657         latency   => 3,
1658         units     => [ "VFP" ],
1659         mode      => "mode_E",
1660         attr_type => "ia32_x87_attr_t",
1661 },
1662
1663 # other
1664
1665 vfCondJmp => {
1666         state     => "pinned",
1667         op_flags  => "L|X|Y",
1668         reg_req   => { in => [ "vfp", "vfp" ], out => [ "none", "none", "eax" ] },
1669         ins       => [ "left", "right" ],
1670         outs      => [ "false", "true", "temp_reg_eax" ],
1671         attr      => "long pnc",
1672         init_attr => "attr->attr.pn_code = pnc;",
1673         latency   => 10,
1674         units     => [ "VFP" ],
1675         attr_type => "ia32_x87_attr_t",
1676 },
1677
1678 #------------------------------------------------------------------------#
1679 #       ___ _____    __ _             _                     _            #
1680 # __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1681 # \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1682 #  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1683 # /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1684 #------------------------------------------------------------------------#
1685
1686 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1687 #       are swapped, we work this around in the emitter...
1688
1689 fadd => {
1690         op_flags  => "R",
1691         rd_constructor => "NONE",
1692         reg_req   => { },
1693         emit      => '. fadd%XM %x87_binop',
1694         attr_type => "ia32_x87_attr_t",
1695 },
1696
1697 faddp => {
1698         op_flags  => "R",
1699         rd_constructor => "NONE",
1700         reg_req   => { },
1701         emit      => '. faddp%XM %x87_binop',
1702         attr_type => "ia32_x87_attr_t",
1703 },
1704
1705 fmul => {
1706         op_flags  => "R",
1707         rd_constructor => "NONE",
1708         reg_req   => { },
1709         emit      => '. fmul%XM %x87_binop',
1710         attr_type => "ia32_x87_attr_t",
1711 },
1712
1713 fmulp => {
1714         op_flags  => "R",
1715         rd_constructor => "NONE",
1716         reg_req   => { },
1717         emit      => '. fmulp%XM %x87_binop',,
1718         attr_type => "ia32_x87_attr_t",
1719 },
1720
1721 fsub => {
1722         op_flags  => "R",
1723         rd_constructor => "NONE",
1724         reg_req   => { },
1725         emit      => '. fsub%XM %x87_binop',
1726         attr_type => "ia32_x87_attr_t",
1727 },
1728
1729 fsubp => {
1730         op_flags  => "R",
1731         rd_constructor => "NONE",
1732         reg_req   => { },
1733 # see note about gas bugs
1734         emit      => '. fsubrp%XM %x87_binop',
1735         attr_type => "ia32_x87_attr_t",
1736 },
1737
1738 fsubr => {
1739         op_flags  => "R",
1740         rd_constructor => "NONE",
1741         irn_flags => "R",
1742         reg_req   => { },
1743         emit      => '. fsubr%XM %x87_binop',
1744         attr_type => "ia32_x87_attr_t",
1745 },
1746
1747 fsubrp => {
1748         op_flags  => "R",
1749         rd_constructor => "NONE",
1750         irn_flags => "R",
1751         reg_req   => { },
1752 # see note about gas bugs
1753         emit      => '. fsubp%XM %x87_binop',
1754         attr_type => "ia32_x87_attr_t",
1755 },
1756
1757 fprem => {
1758         op_flags  => "R",
1759         rd_constructor => "NONE",
1760         reg_req   => { },
1761         emit      => '. fprem1',
1762         attr_type => "ia32_x87_attr_t",
1763 },
1764
1765 # this node is just here, to keep the simulator running
1766 # we can omit this when a fprem simulation function exists
1767 fpremp => {
1768         op_flags  => "R",
1769         rd_constructor => "NONE",
1770         reg_req   => { },
1771         emit      => '. fprem1',
1772         attr_type => "ia32_x87_attr_t",
1773 },
1774
1775 fdiv => {
1776         op_flags  => "R",
1777         rd_constructor => "NONE",
1778         reg_req   => { },
1779         emit      => '. fdiv%XM %x87_binop',
1780         attr_type => "ia32_x87_attr_t",
1781 },
1782
1783 fdivp => {
1784         op_flags  => "R",
1785         rd_constructor => "NONE",
1786         reg_req   => { },
1787 # see note about gas bugs
1788         emit      => '. fdivrp%XM %x87_binop',
1789         attr_type => "ia32_x87_attr_t",
1790 },
1791
1792 fdivr => {
1793         op_flags  => "R",
1794         rd_constructor => "NONE",
1795         reg_req   => { },
1796         emit      => '. fdivr%XM %x87_binop',
1797         attr_type => "ia32_x87_attr_t",
1798 },
1799
1800 fdivrp => {
1801         op_flags  => "R",
1802         rd_constructor => "NONE",
1803         reg_req   => { },
1804 # see note about gas bugs
1805         emit      => '. fdivp%XM %x87_binop',
1806         attr_type => "ia32_x87_attr_t",
1807 },
1808
1809 fabs => {
1810         op_flags  => "R",
1811         rd_constructor => "NONE",
1812         reg_req   => { },
1813         emit      => '. fabs',
1814         attr_type => "ia32_x87_attr_t",
1815 },
1816
1817 fchs => {
1818         op_flags  => "R|K",
1819         rd_constructor => "NONE",
1820         reg_req   => { },
1821         emit      => '. fchs',
1822         attr_type => "ia32_x87_attr_t",
1823 },
1824
1825 # x87 Load and Store
1826
1827 fld => {
1828         rd_constructor => "NONE",
1829         op_flags  => "R|L|F",
1830         state     => "exc_pinned",
1831         reg_req   => { },
1832         emit      => '. fld%XM %AM',
1833         attr_type => "ia32_x87_attr_t",
1834 },
1835
1836 fst => {
1837         rd_constructor => "NONE",
1838         op_flags  => "R|L|F",
1839         state     => "exc_pinned",
1840         reg_req   => { },
1841         emit      => '. fst%XM %AM',
1842         mode      => "mode_M",
1843         attr_type => "ia32_x87_attr_t",
1844 },
1845
1846 fstp => {
1847         rd_constructor => "NONE",
1848         op_flags  => "R|L|F",
1849         state     => "exc_pinned",
1850         reg_req   => { },
1851         emit      => '. fstp%XM %AM',
1852         mode      => "mode_M",
1853         attr_type => "ia32_x87_attr_t",
1854 },
1855
1856 # Conversions
1857
1858 fild => {
1859         op_flags  => "R",
1860         rd_constructor => "NONE",
1861         reg_req   => { },
1862         emit      => '. fild%XM %AM',
1863         attr_type => "ia32_x87_attr_t",
1864 },
1865
1866 fist => {
1867         op_flags  => "R",
1868         state     => "exc_pinned",
1869         rd_constructor => "NONE",
1870         reg_req   => { },
1871         emit      => '. fist%XM %AM',
1872         mode      => "mode_M",
1873         attr_type => "ia32_x87_attr_t",
1874 },
1875
1876 fistp => {
1877         op_flags  => "R",
1878         state     => "exc_pinned",
1879         rd_constructor => "NONE",
1880         reg_req   => { },
1881         emit      => '. fistp%XM %AM',
1882         mode      => "mode_M",
1883         attr_type => "ia32_x87_attr_t",
1884 },
1885
1886 # constants
1887
1888 fldz => {
1889         op_flags  => "R|c|K",
1890         irn_flags  => "R",
1891         reg_req   => { },
1892         emit      => '. fldz',
1893         attr_type => "ia32_x87_attr_t",
1894 },
1895
1896 fld1 => {
1897         op_flags  => "R|c|K",
1898         irn_flags  => "R",
1899         reg_req   => { },
1900         emit      => '. fld1',
1901         attr_type => "ia32_x87_attr_t",
1902 },
1903
1904 fldpi => {
1905         op_flags  => "R|c|K",
1906         irn_flags  => "R",
1907         reg_req   => { },
1908         emit      => '. fldpi',
1909         attr_type => "ia32_x87_attr_t",
1910 },
1911
1912 fldln2 => {
1913         op_flags  => "R|c|K",
1914         irn_flags  => "R",
1915         reg_req   => { },
1916         emit      => '. fldln2',
1917         attr_type => "ia32_x87_attr_t",
1918 },
1919
1920 fldlg2 => {
1921         op_flags  => "R|c|K",
1922         irn_flags  => "R",
1923         reg_req   => { },
1924         emit      => '. fldlg2',
1925         attr_type => "ia32_x87_attr_t",
1926 },
1927
1928 fldl2t => {
1929         op_flags  => "R|c|K",
1930         irn_flags  => "R",
1931         reg_req   => { },
1932         emit      => '. fldll2t',
1933         attr_type => "ia32_x87_attr_t",
1934 },
1935
1936 fldl2e => {
1937         op_flags  => "R|c|K",
1938         irn_flags  => "R",
1939         reg_req   => { },
1940         emit      => '. fldl2e',
1941         attr_type => "ia32_x87_attr_t",
1942 },
1943
1944 # fxch, fpush, fpop
1945 # Note that it is NEVER allowed to do CSE on these nodes
1946 # Moreover, note the virtual register requierements!
1947
1948 fxch => {
1949         op_flags  => "R|K",
1950         reg_req   => { },
1951         cmp_attr  => "return 1;",
1952         emit      => '. fxch %X0',
1953         attr_type => "ia32_x87_attr_t",
1954 },
1955
1956 fpush => {
1957         op_flags  => "R|K",
1958         reg_req   => {},
1959         cmp_attr  => "return 1;",
1960         emit      => '. fld %X0',
1961         attr_type => "ia32_x87_attr_t",
1962 },
1963
1964 fpushCopy => {
1965         op_flags  => "R",
1966         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1967         cmp_attr  => "return 1;",
1968         emit      => '. fld %X0',
1969         attr_type => "ia32_x87_attr_t",
1970 },
1971
1972 fpop => {
1973         op_flags  => "R|K",
1974         reg_req   => { },
1975         cmp_attr  => "return 1;",
1976         emit      => '. fstp %X0',
1977         attr_type => "ia32_x87_attr_t",
1978 },
1979
1980 # compare
1981
1982 fcomJmp => {
1983         op_flags  => "L|X|Y",
1984         reg_req   => { },
1985         attr_type => "ia32_x87_attr_t",
1986 },
1987
1988 fcompJmp => {
1989         op_flags  => "L|X|Y",
1990         reg_req   => { },
1991         attr_type => "ia32_x87_attr_t",
1992 },
1993
1994 fcomppJmp => {
1995         op_flags  => "L|X|Y",
1996         reg_req   => { },
1997         attr_type => "ia32_x87_attr_t",
1998 },
1999
2000 fcomrJmp => {
2001         op_flags  => "L|X|Y",
2002         reg_req   => { },
2003         attr_type => "ia32_x87_attr_t",
2004 },
2005
2006 fcomrpJmp => {
2007         op_flags  => "L|X|Y",
2008         reg_req   => { },
2009         attr_type => "ia32_x87_attr_t",
2010 },
2011
2012 fcomrppJmp => {
2013         op_flags  => "L|X|Y",
2014         reg_req   => { },
2015         attr_type => "ia32_x87_attr_t",
2016 },
2017
2018
2019 # -------------------------------------------------------------------------------- #
2020 #  ____ ____  _____                  _                               _             #
2021 # / ___/ ___|| ____| __   _____  ___| |_ ___  _ __   _ __   ___   __| | ___  ___   #
2022 # \___ \___ \|  _|   \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __|  #
2023 #  ___) |__) | |___   \ V /  __/ (__| || (_) | |    | | | | (_) | (_| |  __/\__ \  #
2024 # |____/____/|_____|   \_/ \___|\___|\__\___/|_|    |_| |_|\___/ \__,_|\___||___/  #
2025 #                                                                                  #
2026 # -------------------------------------------------------------------------------- #
2027
2028
2029 # Spilling and reloading of SSE registers, hardcoded, not generated #
2030
2031 xxLoad => {
2032         op_flags  => "L|F",
2033         state     => "exc_pinned",
2034         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2035         emit      => '. movdqu %D0, %AM',
2036         outs      => [ "res", "M" ],
2037         units     => [ "SSE" ],
2038 },
2039
2040 xxStore => {
2041         op_flags => "L|F",
2042         state    => "exc_pinned",
2043         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
2044         emit     => '. movdqu %binop',
2045         units    => [ "SSE" ],
2046         mode     => "mode_M",
2047 },
2048
2049 ); # end of %nodes
2050
2051 # Include the generated SIMD node specification written by the SIMD optimization
2052 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2053 unless ($return = do $my_script_name) {
2054         warn "couldn't parse $my_script_name: $@" if $@;
2055         warn "couldn't do $my_script_name: $!"    unless defined $return;
2056         warn "couldn't run $my_script_name"       unless $return;
2057 }