6435544b7aa8d8e11e9469f1e4af33fe996df387
[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         latency   => 0,
340         mode      => $mode_gp,
341 },
342
343 Asm => {
344         mode      => "mode_T",
345         arity     => "variable",
346         out_arity => "variable",
347         attr_type => "ia32_asm_attr_t",
348         latency   => 100,
349 },
350
351 ProduceVal => {
352         op_flags  => "c",
353         irn_flags => "R",
354         reg_req   => { out => [ "gp" ] },
355         emit      => "",
356         units     => [ ],
357         latency   => 0,
358         mode      => $mode_gp,
359         cmp_attr  => "return 1;",
360 },
361
362 #-----------------------------------------------------------------#
363 #  _       _                                         _            #
364 # (_)     | |                                       | |           #
365 #  _ _ __ | |_ ___  __ _  ___ _ __   _ __   ___   __| | ___  ___  #
366 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
367 # | | | | | ||  __/ (_| |  __/ |    | | | | (_) | (_| |  __/\__ \ #
368 # |_|_| |_|\__\___|\__, |\___|_|    |_| |_|\___/ \__,_|\___||___/ #
369 #                   __/ |                                         #
370 #                  |___/                                          #
371 #-----------------------------------------------------------------#
372
373 # commutative operations
374
375 # NOTE:
376 # All nodes supporting Addressmode have 5 INs:
377 # 1 - base    r1 == NoReg in case of no AM or no base
378 # 2 - index   r2 == NoReg in case of no AM or no index
379 # 3 - op1     r3 == always present
380 # 4 - op2     r4 == NoReg in case of immediate operation
381 # 5 - mem     NoMem in case of no AM otherwise it takes the mem from the Load
382
383 Add => {
384         irn_flags => "R",
385         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
386         ins       => [ "base", "index", "left", "right", "mem" ],
387         emit      => '. add%M %binop',
388         units     => [ "GP" ],
389         mode      => $mode_gp,
390         modified_flags => $status_flags
391 },
392
393 Adc => {
394         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
395         emit      => '. adc%M %binop',
396         units     => [ "GP" ],
397         mode      => $mode_gp,
398         modified_flags => $status_flags
399 },
400
401 Add64Bit => {
402         irn_flags => "R",
403         arity     => 4,
404         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
405         emit      => '
406 . movl %S0, %D0
407 . movl %S1, %D1
408 . addl %S2, %D0
409 . adcl %S3, %D1
410 ',
411         outs      => [ "low_res", "high_res" ],
412         units     => [ "GP" ],
413         modified_flags => $status_flags
414 },
415
416 l_Add => {
417         op_flags  => "C",
418         irn_flags => "R",
419         cmp_attr  => "return 1;",
420         arity     => 2,
421 },
422
423 l_Adc => {
424         op_flags  => "C",
425         cmp_attr  => "return 1;",
426         arity     => 2,
427 },
428
429 Mul => {
430         # we should not rematrialize this node. It produces 2 results and has
431         # very strict constrains
432         reg_req   => { in => [ "gp", "gp", "eax", "gp", "none" ], out => [ "eax", "edx", "none" ] },
433         emit      => '. mul%M %unop3',
434         outs      => [ "EAX", "EDX", "M" ],
435         ins       => [ "base", "index", "val_high", "val_low", "mem" ],
436         latency   => 10,
437         units     => [ "GP" ],
438         modified_flags => $status_flags
439 },
440
441 l_Mul => {
442         # we should not rematrialize this node. It produces 2 results and has
443         # very strict constrains
444         op_flags  => "C",
445         cmp_attr  => "return 1;",
446         outs      => [ "EAX", "EDX", "M" ],
447         arity     => 2
448 },
449
450 IMul => {
451         irn_flags => "R",
452         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
453         emit      => '. imul%M %binop',
454         latency   => 5,
455         units     => [ "GP" ],
456         mode      => $mode_gp,
457         modified_flags => $status_flags
458 },
459
460 IMul1OP => {
461         irn_flags => "R",
462         reg_req   => { in => [ "gp", "gp", "eax", "gp", "none" ], out => [ "eax", "edx", "none" ] },
463         emit      => '. imul%M %unop3',
464         outs      => [ "EAX", "EDX", "M" ],
465         ins       => [ "base", "index", "val_high", "val_low", "mem" ],
466         latency   => 5,
467         units     => [ "GP" ],
468         modified_flags => $status_flags
469 },
470
471 l_IMul => {
472         op_flags  => "C",
473         cmp_attr  => "return 1;",
474         arity     => 2
475 },
476
477 And => {
478         irn_flags => "R",
479         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
480         emit      => '. and%M %binop',
481         units     => [ "GP" ],
482         mode      => $mode_gp,
483         modified_flags => $status_flags
484 },
485
486 Or => {
487         irn_flags => "R",
488         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
489         emit      => '. or%M %binop',
490         units     => [ "GP" ],
491         mode      => $mode_gp,
492         modified_flags => $status_flags
493 },
494
495 Xor => {
496         irn_flags => "R",
497         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
498         emit      => '. xor%M %binop',
499         units     => [ "GP" ],
500         mode      => $mode_gp,
501         modified_flags => $status_flags
502 },
503
504 l_Xor => {
505         op_flags  => "C",
506         cmp_attr  => "return 1;",
507         arity     => 2,
508         modified_flags => $status_flags
509 },
510
511 # not commutative operations
512
513 Sub => {
514         irn_flags => "R",
515         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
516         emit      => '. sub%M %binop',
517         units     => [ "GP" ],
518         mode      => $mode_gp,
519         modified_flags => $status_flags
520 },
521
522 Sbb => {
523         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "in_r3 !in_r4" ] },
524         emit      => '. sbb%M %binop',
525         units     => [ "GP" ],
526         mode      => $mode_gp,
527         modified_flags => $status_flags
528 },
529
530 Sub64Bit => {
531         irn_flags => "R",
532         arity     => 4,
533         reg_req   => { in => [ "gp", "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
534         emit      => '
535 . movl %S0, %D0
536 . movl %S1, %D1
537 . subl %S2, %D0
538 . sbbl %S3, %D1
539 ',
540         outs      => [ "low_res", "high_res" ],
541         units     => [ "GP" ],
542         modified_flags => $status_flags
543 },
544
545 l_Sub => {
546         irn_flags => "R",
547         cmp_attr  => "return 1;",
548         arity     => 2,
549 },
550
551 l_Sbb => {
552         cmp_attr  => "return 1;",
553         arity     => 2,
554 },
555
556 IDiv => {
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      => ". idiv%M %unop4",
563         outs      => [ "div_res", "mod_res", "M" ],
564         latency   => 25,
565         units     => [ "GP" ],
566         modified_flags => $status_flags
567 },
568
569 Div => {
570         op_flags  => "F|L",
571         state     => "exc_pinned",
572         reg_req   => { in => [ "gp", "gp", "eax", "edx", "gp", "none" ], out => [ "eax", "edx", "none" ] },
573         attr      => "ia32_op_flavour_t dm_flav",
574         init_attr => "attr->data.op_flav = dm_flav;",
575         emit      => ". div%M %unop4",
576         outs      => [ "div_res", "mod_res", "M" ],
577         latency   => 25,
578         units     => [ "GP" ],
579         modified_flags => $status_flags
580 },
581
582 Shl => {
583         irn_flags => "R",
584         # "in_r3" would be enough as out requirement, but the register allocator
585         # does strange things then and doesn't respect the constraint for in4
586         # if the same value is attached to in3 and in4 (if you have "i << i" in C)
587         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
588         ins       => [ "base", "index", "left", "right", "mem" ],
589         emit      => '. shl%M %binop',
590         units     => [ "GP" ],
591         mode      => $mode_gp,
592         modified_flags => $status_flags
593 },
594
595 l_Shl => {
596         cmp_attr  => "return 1;",
597         arity     => 2
598 },
599
600 ShlD => {
601         irn_flags => "R",
602         # Out requirements is: different from all in
603         # This is because, out must be different from LowPart and ShiftCount.
604         # We could say "!ecx !in_r4" but it can occur, that all values live through
605         # this Shift and the only value dying is the ShiftCount. Then there would be
606         # a register missing, as result must not be ecx and all other registers are
607         # occupied. What we should write is "!in_r4 !in_r5", but this is not
608         # supported (and probably never will). So we create artificial interferences
609         # of the result with all inputs, so the spiller can always assure a free
610         # register.
611         reg_req   => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
612         emit      =>
613 '
614 if (get_ia32_immop_type(node) == ia32_ImmNone) {
615         if (get_ia32_op_type(node) == ia32_AddrModeD) {
616                 . shld%M %%cl, %S3, %AM
617         } else {
618                 . shld%M %%cl, %S3, %S2
619         }
620 } else {
621         if (get_ia32_op_type(node) == ia32_AddrModeD) {
622                 . shld%M %C, %S3, %AM
623         } else {
624                 . shld%M %C, %S3, %S2
625         }
626 }
627 ',
628         latency   => 6,
629         units     => [ "GP" ],
630         mode      => $mode_gp,
631         modified_flags => $status_flags
632 },
633
634 l_ShlD => {
635         cmp_attr  => "return 1;",
636         arity     => 3,
637 },
638
639 Shr => {
640         irn_flags => "R",
641         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
642         emit      => '. shr%M %binop',
643         units     => [ "GP" ],
644         mode      => $mode_gp,
645         modified_flags => $status_flags
646 },
647
648 l_Shr => {
649         cmp_attr  => "return 1;",
650         arity     => 2
651 },
652
653 ShrD => {
654         irn_flags => "R",
655         # Out requirements is: different from all in
656         # This is because, out must be different from LowPart and ShiftCount.
657         # We could say "!ecx !in_r4" but it can occur, that all values live through
658         # this Shift and the only value dying is the ShiftCount. Then there would be a
659         # register missing, as result must not be ecx and all other registers are
660         # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
661         # (and probably never will). So we create artificial interferences of the result
662         # with all inputs, so the spiller can always assure a free register.
663         reg_req   => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
664         emit      => '
665 if (get_ia32_immop_type(node) == ia32_ImmNone) {
666         if (get_ia32_op_type(node) == ia32_AddrModeD) {
667                 . shrd%M %%cl, %S3, %AM
668         } else {
669                 . shrd%M %%cl, %S3, %S2
670         }
671 } else {
672         if (get_ia32_op_type(node) == ia32_AddrModeD) {
673                 . shrd%M %C, %S3, %AM
674         } else {
675                 . shrd%M %C, %S3, %S2
676         }
677 }
678 ',
679         latency   => 6,
680         units     => [ "GP" ],
681         mode      => $mode_gp,
682         modified_flags => $status_flags
683 },
684
685 l_ShrD => {
686         cmp_attr  => "return 1;",
687         arity     => 3
688 },
689
690 Sar => {
691         irn_flags => "R",
692         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
693         emit      => '. sar%M %binop',
694         units     => [ "GP" ],
695         mode      => $mode_gp,
696         modified_flags => $status_flags
697 },
698
699 l_Sar => {
700         cmp_attr  => "return 1;",
701         arity     => 2
702 },
703
704 Ror => {
705         irn_flags => "R",
706         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
707         emit      => '. ror%M %binop',
708         units     => [ "GP" ],
709         mode      => $mode_gp,
710         modified_flags => $status_flags
711 },
712
713 Rol => {
714         irn_flags => "R",
715         reg_req   => { in => [ "gp", "gp", "gp", "ecx", "none" ], out => [ "in_r3 !in_r4" ] },
716         emit      => '. rol%M %binop',
717         units     => [ "GP" ],
718         mode      => $mode_gp,
719         modified_flags => $status_flags
720 },
721
722 # unary operations
723
724 Neg => {
725         irn_flags => "R",
726         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
727         emit      => '. neg%M %unop2',
728         ins       => [ "base", "index", "val", "mem" ],
729         units     => [ "GP" ],
730         mode      => $mode_gp,
731         modified_flags => $status_flags
732 },
733
734 Minus64Bit => {
735         irn_flags => "R",
736         reg_req   => { in => [ "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
737         emit      => '
738 . movl %S0, %D0
739 . movl %S0, %D1
740 . subl %S1, %D0
741 . sbbl %S2, %D1
742 ',
743         outs      => [ "low_res", "high_res" ],
744         units     => [ "GP" ],
745         modified_flags => $status_flags
746 },
747
748
749 l_Neg => {
750         cmp_attr  => "return 1;",
751         arity     => 1,
752 },
753
754 Inc => {
755         irn_flags => "R",
756         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
757         emit      => '. inc%M %unop2',
758         units     => [ "GP" ],
759         mode      => $mode_gp,
760         modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
761 },
762
763 Dec => {
764         irn_flags => "R",
765         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
766         emit      => '. dec%M %unop2',
767         units     => [ "GP" ],
768         mode      => $mode_gp,
769         modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
770 },
771
772 Not => {
773         irn_flags => "R",
774         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3" ] },
775         ins       => [ "base", "index", "val", "mem" ],
776         emit      => '. not%M %unop2',
777         units     => [ "GP" ],
778         mode      => $mode_gp,
779         modified_flags => []
780 },
781
782 # other operations
783
784 CondJmp => {
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 TestJmp => {
798         state     => "pinned",
799         op_flags  => "L|X|Y",
800         reg_req   => { in  => [ "gp", "gp", "gp", "gp", "none" ],
801                        out => [ "none", "none" ] },
802         ins       => [ "base", "index", "left", "right", "mem" ],
803         outs      => [ "false", "true" ],
804         attr      => "long pnc",
805         init_attr => "attr->pn_code = pnc;",
806         latency   => 3,
807         units     => [ "BRANCH" ],
808 },
809
810 SwitchJmp => {
811         state     => "pinned",
812         op_flags  => "L|X|Y",
813         reg_req   => { in => [ "gp" ], out => [ "none" ] },
814         latency   => 3,
815         units     => [ "BRANCH" ],
816         mode      => "mode_T",
817 },
818
819 Const => {
820         op_flags  => "c",
821         irn_flags => "R",
822         reg_req   => { out => [ "gp" ] },
823         units     => [ "GP" ],
824         mode      => $mode_gp,
825 },
826
827 Unknown_GP => {
828         state     => "pinned",
829         op_flags  => "c",
830         irn_flags => "I",
831         reg_req   => { out => [ "gp_UKNWN" ] },
832         units     => [],
833         emit      => "",
834         mode      => $mode_gp
835 },
836
837 Unknown_VFP => {
838         state     => "pinned",
839         op_flags  => "c",
840         irn_flags => "I",
841         reg_req   => { out => [ "vfp_UKNWN" ] },
842         units     => [],
843         emit      => "",
844         mode      => "mode_E",
845         attr_type => "ia32_x87_attr_t",
846 },
847
848 Unknown_XMM => {
849         state     => "pinned",
850         op_flags  => "c",
851         irn_flags => "I",
852         reg_req   => { out => [ "xmm_UKNWN" ] },
853         units     => [],
854         emit      => "",
855         mode      => "mode_E"
856 },
857
858 NoReg_GP => {
859         state     => "pinned",
860         op_flags  => "c",
861         irn_flags => "I",
862         reg_req   => { out => [ "gp_NOREG" ] },
863         units     => [],
864         emit      => "",
865         mode      => $mode_gp
866 },
867
868 NoReg_VFP => {
869         state     => "pinned",
870         op_flags  => "c",
871         irn_flags => "I",
872         reg_req   => { out => [ "vfp_NOREG" ] },
873         units     => [],
874         emit      => "",
875         mode      => "mode_E",
876         attr_type => "ia32_x87_attr_t",
877 },
878
879 NoReg_XMM => {
880         state     => "pinned",
881         op_flags  => "c",
882         irn_flags => "I",
883         reg_req   => { out => [ "xmm_NOREG" ] },
884         units     => [],
885         emit      => "",
886         mode      => "mode_E"
887 },
888
889 ChangeCW => {
890         state     => "pinned",
891         op_flags  => "c",
892         irn_flags => "I",
893         reg_req   => { out => [ "fp_cw" ] },
894         mode      => $mode_fpcw,
895         latency   => 3,
896         units     => [ "GP" ],
897         modified_flags => $fpcw_flags
898 },
899
900 FldCW => {
901         op_flags  => "L|F",
902         state     => "pinned",
903         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
904         latency   => 5,
905         emit      => ". fldcw %AM",
906         mode      => $mode_fpcw,
907         units     => [ "GP" ],
908         modified_flags => $fpcw_flags
909 },
910
911 FnstCW => {
912         op_flags  => "L|F",
913         state     => "pinned",
914         reg_req   => { in => [ "gp", "gp", "fp_cw", "none" ], out => [ "none" ] },
915         latency   => 5,
916         emit      => ". fnstcw %AM",
917         mode      => "mode_M",
918         units     => [ "GP" ],
919 },
920
921 Cltd => {
922         # we should not rematrialize this node. It produces 2 results and has
923         # very strict constrains
924         reg_req   => { in => [ "eax", "edx" ], out => [ "edx" ] },
925         ins       => [ "val", "globbered" ],
926         emit      => '. cltd',
927         mode      => $mode_gp,
928         units     => [ "GP" ],
929 },
930
931 # Load / Store
932 #
933 # Note that we add additional latency values depending on address mode, so a
934 # lateny of 0 for load is correct
935
936 Load => {
937         op_flags  => "L|F",
938         state     => "exc_pinned",
939         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
940         ins       => [ "base", "index", "mem" ],
941         outs      => [ "res", "M" ],
942         latency   => 0,
943         emit      => ". mov%SE%ME%.l %AM, %D0",
944         units     => [ "GP" ],
945 },
946
947 l_Load => {
948         op_flags  => "L|F",
949         cmp_attr  => "return 1;",
950         outs      => [ "res", "M" ],
951         arity     => 2,
952 },
953
954 l_Store => {
955         op_flags  => "L|F",
956         cmp_attr  => "return 1;",
957         state     => "exc_pinned",
958         arity     => 3,
959         mode      => "mode_M",
960 },
961
962 Store => {
963         op_flags  => "L|F",
964         state     => "exc_pinned",
965         reg_req   => { in => [ "gp", "gp", "gp", "none" ], out => [ "none" ] },
966         ins       => [ "base", "index", "val", "mem" ],
967         emit      => '. mov%M %binop',
968         latency   => 2,
969         units     => [ "GP" ],
970         mode      => "mode_M",
971 },
972
973 Store8Bit => {
974         op_flags  => "L|F",
975         state     => "exc_pinned",
976         reg_req   => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => ["none" ] },
977         emit      => '. mov%M %binop',
978         latency   => 2,
979         units     => [ "GP" ],
980         mode      => "mode_M",
981 },
982
983 Lea => {
984         irn_flags => "R",
985         reg_req   => { in => [ "gp", "gp" ], out => [ "gp" ] },
986         emit      => '. leal %AM, %D0',
987         latency   => 2,
988         units     => [ "GP" ],
989         mode      => $mode_gp,
990         modified_flags => [],
991 },
992
993 Push => {
994         reg_req   => { in => [ "gp", "gp", "gp", "esp", "none" ], out => [ "esp", "none" ] },
995         emit      => '. push%M %unop2',
996         ins       => [ "base", "index", "val", "stack", "mem" ],
997         outs      => [ "stack:I|S", "M" ],
998         latency   => 2,
999         units     => [ "GP" ],
1000         modified_flags => [],
1001 },
1002
1003 Pop => {
1004         reg_req   => { in => [ "gp", "gp", "esp", "none" ], out => [ "esp", "gp", "none" ] },
1005         emit      => '. pop%M %DAM1',
1006         outs      => [ "stack:I|S", "res", "M" ],
1007         ins       => [ "base", "index", "stack", "mem" ],
1008         latency   => 3, # Pop is more expensive than Push on Athlon
1009         units     => [ "GP" ],
1010         modified_flags => [],
1011 },
1012
1013 Enter => {
1014         reg_req   => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1015         emit      => '. enter',
1016         outs      => [ "frame:I", "stack:I|S", "M" ],
1017         latency   => 15,
1018         units     => [ "GP" ],
1019 },
1020
1021 Leave => {
1022         reg_req   => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1023         emit      => '. leave',
1024         outs      => [ "frame:I", "stack:I|S" ],
1025         latency   => 3,
1026         units     => [ "GP" ],
1027 },
1028
1029 AddSP => {
1030         irn_flags => "I",
1031         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "none" ] },
1032         emit      => '. addl %binop',
1033         outs      => [ "stack:S", "M" ],
1034         units     => [ "GP" ],
1035         modified_flags => $status_flags
1036 },
1037
1038 SubSP => {
1039 #irn_flags => "I",
1040         reg_req   => { in => [ "gp", "gp", "esp", "gp", "none" ], out => [ "in_r3", "gp", "none" ] },
1041         emit      => ". subl %binop\n".
1042                      ". movl %%esp, %D1",
1043         outs      => [ "stack:I|S", "addr", "M" ],
1044         units     => [ "GP" ],
1045         modified_flags => $status_flags
1046 },
1047
1048 LdTls => {
1049         irn_flags => "R",
1050         reg_req   => { out => [ "gp" ] },
1051         units     => [ "GP" ],
1052 },
1053
1054 # the int instruction
1055 int => {
1056         reg_req   => { in => [ "none" ], out => [ "none" ] },
1057         mode      => "mode_M",
1058         attr      => "tarval *tv",
1059         init_attr => "\tset_ia32_Immop_tarval(res, tv);",
1060         emit      => '. int %C',
1061         units     => [ "GP" ],
1062         cmp_attr  => "return 1;",
1063 },
1064
1065
1066 #-----------------------------------------------------------------------------#
1067 #   _____ _____ ______    __ _             _                     _            #
1068 #  / ____/ ____|  ____|  / _| |           | |                   | |           #
1069 # | (___| (___ | |__    | |_| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1070 #  \___ \\___ \|  __|   |  _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1071 #  ____) |___) | |____  | | | | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1072 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1073 #-----------------------------------------------------------------------------#
1074
1075 # commutative operations
1076
1077 xAdd => {
1078         irn_flags => "R",
1079         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1080         emit      => '. add%XXM %binop',
1081         latency   => 4,
1082         units     => [ "SSE" ],
1083         mode      => "mode_E",
1084 },
1085
1086 xMul => {
1087         irn_flags => "R",
1088         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1089         emit      => '. mul%XXM %binop',
1090         latency   => 4,
1091         units     => [ "SSE" ],
1092         mode      => "mode_E",
1093 },
1094
1095 xMax => {
1096         irn_flags => "R",
1097         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1098         emit      => '. max%XXM %binop',
1099         latency   => 2,
1100         units     => [ "SSE" ],
1101         mode      => "mode_E",
1102 },
1103
1104 xMin => {
1105         irn_flags => "R",
1106         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1107         emit      => '. min%XXM %binop',
1108         latency   => 2,
1109         units     => [ "SSE" ],
1110         mode      => "mode_E",
1111 },
1112
1113 xAnd => {
1114         irn_flags => "R",
1115         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1116         emit      => '. andp%XSD %binop',
1117         latency   => 3,
1118         units     => [ "SSE" ],
1119         mode      => "mode_E",
1120 },
1121
1122 xOr => {
1123         irn_flags => "R",
1124         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1125         emit      => '. orp%XSD %binop',
1126         units     => [ "SSE" ],
1127         mode      => "mode_E",
1128 },
1129
1130 xXor => {
1131         irn_flags => "R",
1132         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1133         emit      => '. xorp%XSD %binop',
1134         latency   => 3,
1135         units     => [ "SSE" ],
1136         mode      => "mode_E",
1137 },
1138
1139 # not commutative operations
1140
1141 xAndNot => {
1142         irn_flags => "R",
1143         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1144         emit      => '. andnp%XSD %binop',
1145         latency   => 3,
1146         units     => [ "SSE" ],
1147         mode      => "mode_E",
1148 },
1149
1150 xSub => {
1151         irn_flags => "R",
1152         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3" ] },
1153         emit      => '. sub%XXM %binop',
1154         latency   => 4,
1155         units     => [ "SSE" ],
1156         mode      => "mode_E",
1157 },
1158
1159 xDiv => {
1160         irn_flags => "R",
1161         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4", "none" ] },
1162         outs      => [ "res", "M" ],
1163         emit      => '. div%XXM %binop',
1164         latency   => 16,
1165         units     => [ "SSE" ],
1166 },
1167
1168 # other operations
1169
1170 xCmp => {
1171         irn_flags => "R",
1172         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "in_r3 !in_r4" ] },
1173         latency   => 3,
1174         units     => [ "SSE" ],
1175         mode      => "mode_E",
1176 },
1177
1178 xCondJmp => {
1179         state     => "pinned",
1180         op_flags  => "L|X|Y",
1181         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "none", "none" ] },
1182         ins       => [ "base", "index", "left", "right", "mem" ],
1183         outs      => [ "false", "true" ],
1184         attr      => "long pnc",
1185         init_attr => "attr->pn_code = pnc;",
1186         latency   => 5,
1187         units     => [ "SSE" ],
1188 },
1189
1190 xConst => {
1191         op_flags  => "c",
1192         irn_flags => "R",
1193         reg_req   => { out => [ "xmm" ] },
1194         emit      => '. mov%XXM %C, %D0',
1195         latency   => 2,
1196         units     => [ "SSE" ],
1197         mode      => "mode_E",
1198 },
1199
1200 # Load / Store
1201
1202 xLoad => {
1203         op_flags  => "L|F",
1204         state     => "exc_pinned",
1205         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1206         emit      => '. mov%XXM %AM, %D0',
1207         outs      => [ "res", "M" ],
1208         latency   => 2,
1209         units     => [ "SSE" ],
1210 },
1211
1212 xStore => {
1213         op_flags => "L|F",
1214         state    => "exc_pinned",
1215         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1216         emit     => '. mov%XXM %binop',
1217         latency  => 2,
1218         units    => [ "SSE" ],
1219         mode     => "mode_M",
1220 },
1221
1222 xStoreSimple => {
1223         op_flags => "L|F",
1224         state    => "exc_pinned",
1225         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
1226         ins      => [ "base", "index", "val", "mem" ],
1227         emit     => '. mov%XXM %S2, %AM',
1228         latency  => 2,
1229         units    => [ "SSE" ],
1230         mode     => "mode_M",
1231 },
1232
1233 CvtSI2SS => {
1234         op_flags => "L|F",
1235         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm" ] },
1236         emit     => '. cvtsi2ss %D0, %AM',
1237         latency  => 2,
1238         units    => [ "SSE" ],
1239         mode     => $mode_xmm
1240 },
1241
1242 CvtSI2SD => {
1243         op_flags => "L|F",
1244         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm" ] },
1245         emit     => '. cvtsi2sd %unop2',
1246         latency  => 2,
1247         units    => [ "SSE" ],
1248         mode     => $mode_xmm
1249 },
1250
1251
1252 l_X87toSSE => {
1253         op_flags => "L|F",
1254         cmp_attr => "return 1;",
1255         arity    => 3,
1256 },
1257
1258 l_SSEtoX87 => {
1259         op_flags => "L|F",
1260         cmp_attr => "return 1;",
1261         arity    => 3,
1262 },
1263
1264 # CopyB
1265
1266 CopyB => {
1267         op_flags => "F|H",
1268         state    => "pinned",
1269         reg_req  => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1270         outs     => [ "DST", "SRC", "CNT", "M" ],
1271         units    => [ "GP" ],
1272         modified_flags => [ "DF" ]
1273 },
1274
1275 CopyB_i => {
1276         op_flags => "F|H",
1277         state    => "pinned",
1278         reg_req  => { in => [ "edi", "esi", "none" ], out => [  "edi", "esi", "none" ] },
1279         outs     => [ "DST", "SRC", "M" ],
1280         units    => [ "GP" ],
1281         modified_flags => [ "DF" ]
1282 },
1283
1284 # Conversions
1285
1286 Conv_I2I => {
1287         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "in_r3", "none" ] },
1288         units    => [ "GP" ],
1289         ins      => [ "base", "index", "val", "mem" ],
1290         mode     => $mode_gp,
1291         modified_flags => $status_flags
1292 },
1293
1294 Conv_I2I8Bit => {
1295         reg_req  => { in => [ "gp", "gp", "eax ebx ecx edx", "none" ], out => [ "in_r3", "none" ] },
1296         ins      => [ "base", "index", "val", "mem" ],
1297         units    => [ "GP" ],
1298         mode     => $mode_gp,
1299         modified_flags => $status_flags
1300 },
1301
1302 Conv_I2FP => {
1303         reg_req  => { in => [ "gp", "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1304         latency  => 10,
1305         units    => [ "SSE" ],
1306         mode     => "mode_E",
1307 },
1308
1309 Conv_FP2I => {
1310         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "gp", "none" ] },
1311         latency  => 10,
1312         units    => [ "SSE" ],
1313         mode     => $mode_gp,
1314 },
1315
1316 Conv_FP2FP => {
1317         reg_req  => { in => [ "gp", "gp", "xmm", "none" ], out => [ "xmm", "none" ] },
1318         latency  => 8,
1319         units    => [ "SSE" ],
1320         mode     => "mode_E",
1321 },
1322
1323 CmpCMov => {
1324         irn_flags => "R",
1325         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none", "gp", "gp" ], out => [ "in_r7" ] },
1326         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem", "val_true", "val_false" ],
1327         attr      => "pn_Cmp pn_code",
1328         init_attr => "attr->pn_code = pn_code;",
1329         latency   => 2,
1330         units     => [ "GP" ],
1331         mode      => $mode_gp,
1332 },
1333
1334 TestCMov => {
1335         irn_flags => "R",
1336         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none", "gp", "gp" ], out => [ "in_r7" ] },
1337         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem", "val_true", "val_false" ],
1338         attr      => "pn_Cmp pn_code",
1339         init_attr => "attr->pn_code = pn_code;",
1340         latency   => 2,
1341         units     => [ "GP" ],
1342         mode      => $mode_gp,
1343 },
1344
1345 xCmpCMov => {
1346         irn_flags => "R",
1347         reg_req   => { in => [ "xmm", "xmm", "gp", "gp" ], out => [ "in_r4" ] },
1348         latency   => 5,
1349         units     => [ "SSE" ],
1350         mode      => $mode_gp,
1351 },
1352
1353 vfCmpCMov => {
1354         irn_flags => "R",
1355         reg_req   => { in => [ "vfp", "vfp", "gp", "gp" ], out => [ "in_r4" ] },
1356         latency   => 10,
1357         units     => [ "VFP" ],
1358         mode      => $mode_gp,
1359         attr_type => "ia32_x87_attr_t",
1360 },
1361
1362 CmpSet => {
1363         irn_flags => "R",
1364         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1365         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1366         attr      => "pn_Cmp pn_code",
1367         init_attr => "attr->pn_code = pn_code;",
1368         latency   => 2,
1369         units     => [ "GP" ],
1370         mode      => $mode_gp,
1371 },
1372
1373 TestSet => {
1374         irn_flags => "R",
1375         reg_req   => { in => [ "gp", "gp", "gp", "gp", "none" ], out => [ "eax ebx ecx edx" ] },
1376         ins       => [ "base", "index", "cmp_left", "cmp_right", "mem" ],
1377         attr      => "pn_Cmp pn_code",
1378         init_attr => "attr->pn_code = pn_code;",
1379         latency   => 2,
1380         units     => [ "GP" ],
1381         mode      => $mode_gp,
1382 },
1383
1384 xCmpSet => {
1385         irn_flags => "R",
1386         reg_req   => { in => [ "gp", "gp", "xmm", "xmm", "none" ], out => [ "eax ebx ecx edx" ] },
1387         latency   => 5,
1388         units     => [ "SSE" ],
1389         mode      => $mode_gp,
1390 },
1391
1392 vfCmpSet => {
1393         irn_flags => "R",
1394         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none" ], out => [ "eax ebx ecx edx" ] },
1395         latency   => 10,
1396         units     => [ "VFP" ],
1397         mode      => $mode_gp,
1398         attr_type => "ia32_x87_attr_t",
1399 },
1400
1401 vfCMov => {
1402         irn_flags => "R",
1403         reg_req   => { in => [ "vfp", "vfp", "vfp", "vfp" ], out => [ "vfp" ] },
1404         latency   => 10,
1405         units     => [ "VFP" ],
1406         mode      => "mode_E",
1407         attr_type => "ia32_x87_attr_t",
1408 },
1409
1410 #----------------------------------------------------------#
1411 #        _      _               _    __ _             _    #
1412 #       (_)    | |             | |  / _| |           | |   #
1413 # __   ___ _ __| |_ _   _  __ _| | | |_| | ___   __ _| |_  #
1414 # \ \ / / | '__| __| | | |/ _` | | |  _| |/ _ \ / _` | __| #
1415 #  \ V /| | |  | |_| |_| | (_| | | | | | | (_) | (_| | |_  #
1416 #   \_/ |_|_|   \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1417 #                 | |                                      #
1418 #  _ __   ___   __| | ___  ___                             #
1419 # | '_ \ / _ \ / _` |/ _ \/ __|                            #
1420 # | | | | (_) | (_| |  __/\__ \                            #
1421 # |_| |_|\___/ \__,_|\___||___/                            #
1422 #----------------------------------------------------------#
1423
1424 vfadd => {
1425         irn_flags => "R",
1426         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1427         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1428         latency   => 4,
1429         units     => [ "VFP" ],
1430         mode      => "mode_E",
1431         attr_type => "ia32_x87_attr_t",
1432 },
1433
1434 vfmul => {
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 l_vfmul => {
1445         op_flags  => "C",
1446         cmp_attr  => "return 1;",
1447         arity     => 2,
1448 },
1449
1450 vfsub => {
1451         irn_flags => "R",
1452         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1453         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1454         latency   => 4,
1455         units     => [ "VFP" ],
1456         mode      => "mode_E",
1457         attr_type => "ia32_x87_attr_t",
1458 },
1459
1460 l_vfsub => {
1461         cmp_attr  => "return 1;",
1462         arity     => 2,
1463 },
1464
1465 vfdiv => {
1466         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp", "none" ] },
1467         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1468         outs      => [ "res", "M" ],
1469         latency   => 20,
1470         units     => [ "VFP" ],
1471         attr_type => "ia32_x87_attr_t",
1472 },
1473
1474 l_vfdiv => {
1475         cmp_attr  => "return 1;",
1476         outs      => [ "res", "M" ],
1477         arity     => 2,
1478 },
1479
1480 vfprem => {
1481         reg_req   => { in => [ "gp", "gp", "vfp", "vfp", "none", "fpcw" ], out => [ "vfp" ] },
1482         ins       => [ "base", "index", "left", "right", "mem", "fpcw" ],
1483         latency   => 20,
1484         units     => [ "VFP" ],
1485         mode      => "mode_E",
1486         attr_type => "ia32_x87_attr_t",
1487 },
1488
1489 l_vfprem => {
1490         cmp_attr  => "return 1;",
1491         arity     => 2,
1492 },
1493
1494 vfabs => {
1495         irn_flags => "R",
1496         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1497         ins       => [ "value" ],
1498         latency   => 2,
1499         units     => [ "VFP" ],
1500         mode      => "mode_E",
1501         attr_type => "ia32_x87_attr_t",
1502 },
1503
1504 vfchs => {
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 # virtual Load and Store
1515
1516 vfld => {
1517         op_flags  => "L|F",
1518         state     => "exc_pinned",
1519         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1520         ins       => [ "base", "index", "mem" ],
1521         outs      => [ "res", "M" ],
1522         attr      => "ir_mode *store_mode",
1523         init_attr => "attr->attr.ls_mode = store_mode;",
1524         latency   => 2,
1525         units     => [ "VFP" ],
1526         attr_type => "ia32_x87_attr_t",
1527 },
1528
1529 vfst => {
1530         op_flags  => "L|F",
1531         state     => "exc_pinned",
1532         reg_req   => { in => [ "gp", "gp", "vfp", "none" ] },
1533         ins       => [ "base", "index", "val", "mem" ],
1534         attr      => "ir_mode *store_mode",
1535         init_attr => "attr->attr.ls_mode = store_mode;",
1536         latency   => 2,
1537         units     => [ "VFP" ],
1538         mode      => "mode_M",
1539         attr_type => "ia32_x87_attr_t",
1540 },
1541
1542 # Conversions
1543
1544 vfild => {
1545         state     => "exc_pinned",
1546         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1547         outs      => [ "res", "M" ],
1548         ins       => [ "base", "index", "mem" ],
1549         latency   => 4,
1550         units     => [ "VFP" ],
1551         attr_type => "ia32_x87_attr_t",
1552 },
1553
1554 l_vfild => {
1555         cmp_attr  => "return 1;",
1556         outs      => [ "res", "M" ],
1557         arity     => 2,
1558 },
1559
1560 vfist => {
1561         state     => "exc_pinned",
1562         reg_req   => { in => [ "gp", "gp", "vfp", "fpcw", "none" ] },
1563         ins       => [ "base", "index", "val", "fpcw", "mem" ],
1564         latency   => 4,
1565         units     => [ "VFP" ],
1566         mode      => "mode_M",
1567         attr_type => "ia32_x87_attr_t",
1568 },
1569
1570 l_vfist => {
1571         cmp_attr  => "return 1;",
1572         state     => "exc_pinned",
1573         arity     => 3,
1574         mode      => "mode_M",
1575 },
1576
1577
1578 # constants
1579
1580 vfldz => {
1581         irn_flags => "R",
1582         reg_req   => { out => [ "vfp" ] },
1583         latency   => 4,
1584         units     => [ "VFP" ],
1585         mode      => "mode_E",
1586         attr_type => "ia32_x87_attr_t",
1587 },
1588
1589 vfld1 => {
1590         irn_flags => "R",
1591         reg_req   => { out => [ "vfp" ] },
1592         latency   => 4,
1593         units     => [ "VFP" ],
1594         mode      => "mode_E",
1595         attr_type => "ia32_x87_attr_t",
1596 },
1597
1598 vfldpi => {
1599         irn_flags => "R",
1600         reg_req   => { out => [ "vfp" ] },
1601         latency   => 4,
1602         units     => [ "VFP" ],
1603         mode      => "mode_E",
1604         attr_type => "ia32_x87_attr_t",
1605 },
1606
1607 vfldln2 => {
1608         irn_flags => "R",
1609         reg_req   => { out => [ "vfp" ] },
1610         latency   => 4,
1611         units     => [ "VFP" ],
1612         mode      => "mode_E",
1613         attr_type => "ia32_x87_attr_t",
1614 },
1615
1616 vfldlg2 => {
1617         irn_flags => "R",
1618         reg_req   => { out => [ "vfp" ] },
1619         latency   => 4,
1620         units     => [ "VFP" ],
1621         mode      => "mode_E",
1622         attr_type => "ia32_x87_attr_t",
1623 },
1624
1625 vfldl2t => {
1626         irn_flags => "R",
1627         reg_req   => { out => [ "vfp" ] },
1628         latency   => 4,
1629         units     => [ "VFP" ],
1630         mode      => "mode_E",
1631         attr_type => "ia32_x87_attr_t",
1632 },
1633
1634 vfldl2e => {
1635         irn_flags => "R",
1636         reg_req   => { out => [ "vfp" ] },
1637         latency   => 4,
1638         units     => [ "VFP" ],
1639         mode      => "mode_E",
1640         attr_type => "ia32_x87_attr_t",
1641 },
1642
1643 vfConst => {
1644         op_flags  => "c",
1645         irn_flags => "R",
1646         reg_req   => { out => [ "vfp" ] },
1647         latency   => 3,
1648         units     => [ "VFP" ],
1649         mode      => "mode_E",
1650         attr_type => "ia32_x87_attr_t",
1651 },
1652
1653 # other
1654
1655 vfCondJmp => {
1656         state     => "pinned",
1657         op_flags  => "L|X|Y",
1658         reg_req   => { in => [ "vfp", "vfp" ], out => [ "none", "none", "eax" ] },
1659         ins       => [ "left", "right" ],
1660         outs      => [ "false", "true", "temp_reg_eax" ],
1661         attr      => "long pnc",
1662         init_attr => "attr->attr.pn_code = pnc;",
1663         latency   => 10,
1664         units     => [ "VFP" ],
1665         attr_type => "ia32_x87_attr_t",
1666 },
1667
1668 #------------------------------------------------------------------------#
1669 #       ___ _____    __ _             _                     _            #
1670 # __  _( _ )___  |  / _| | ___   __ _| |_   _ __   ___   __| | ___  ___  #
1671 # \ \/ / _ \  / /  | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1672 #  >  < (_) |/ /   |  _| | (_) | (_| | |_  | | | | (_) | (_| |  __/\__ \ #
1673 # /_/\_\___//_/    |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1674 #------------------------------------------------------------------------#
1675
1676 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1677 #       are swapped, we work this around in the emitter...
1678
1679 fadd => {
1680         op_flags  => "R",
1681         rd_constructor => "NONE",
1682         reg_req   => { },
1683         emit      => '. fadd%XM %x87_binop',
1684         attr_type => "ia32_x87_attr_t",
1685 },
1686
1687 faddp => {
1688         op_flags  => "R",
1689         rd_constructor => "NONE",
1690         reg_req   => { },
1691         emit      => '. faddp%XM %x87_binop',
1692         attr_type => "ia32_x87_attr_t",
1693 },
1694
1695 fmul => {
1696         op_flags  => "R",
1697         rd_constructor => "NONE",
1698         reg_req   => { },
1699         emit      => '. fmul%XM %x87_binop',
1700         attr_type => "ia32_x87_attr_t",
1701 },
1702
1703 fmulp => {
1704         op_flags  => "R",
1705         rd_constructor => "NONE",
1706         reg_req   => { },
1707         emit      => '. fmulp%XM %x87_binop',,
1708         attr_type => "ia32_x87_attr_t",
1709 },
1710
1711 fsub => {
1712         op_flags  => "R",
1713         rd_constructor => "NONE",
1714         reg_req   => { },
1715         emit      => '. fsub%XM %x87_binop',
1716         attr_type => "ia32_x87_attr_t",
1717 },
1718
1719 fsubp => {
1720         op_flags  => "R",
1721         rd_constructor => "NONE",
1722         reg_req   => { },
1723 # see note about gas bugs
1724         emit      => '. fsubrp%XM %x87_binop',
1725         attr_type => "ia32_x87_attr_t",
1726 },
1727
1728 fsubr => {
1729         op_flags  => "R",
1730         rd_constructor => "NONE",
1731         irn_flags => "R",
1732         reg_req   => { },
1733         emit      => '. fsubr%XM %x87_binop',
1734         attr_type => "ia32_x87_attr_t",
1735 },
1736
1737 fsubrp => {
1738         op_flags  => "R",
1739         rd_constructor => "NONE",
1740         irn_flags => "R",
1741         reg_req   => { },
1742 # see note about gas bugs
1743         emit      => '. fsubp%XM %x87_binop',
1744         attr_type => "ia32_x87_attr_t",
1745 },
1746
1747 fprem => {
1748         op_flags  => "R",
1749         rd_constructor => "NONE",
1750         reg_req   => { },
1751         emit      => '. fprem1',
1752         attr_type => "ia32_x87_attr_t",
1753 },
1754
1755 # this node is just here, to keep the simulator running
1756 # we can omit this when a fprem simulation function exists
1757 fpremp => {
1758         op_flags  => "R",
1759         rd_constructor => "NONE",
1760         reg_req   => { },
1761         emit      => '. fprem1',
1762         attr_type => "ia32_x87_attr_t",
1763 },
1764
1765 fdiv => {
1766         op_flags  => "R",
1767         rd_constructor => "NONE",
1768         reg_req   => { },
1769         emit      => '. fdiv%XM %x87_binop',
1770         attr_type => "ia32_x87_attr_t",
1771 },
1772
1773 fdivp => {
1774         op_flags  => "R",
1775         rd_constructor => "NONE",
1776         reg_req   => { },
1777 # see note about gas bugs
1778         emit      => '. fdivrp%XM %x87_binop',
1779         attr_type => "ia32_x87_attr_t",
1780 },
1781
1782 fdivr => {
1783         op_flags  => "R",
1784         rd_constructor => "NONE",
1785         reg_req   => { },
1786         emit      => '. fdivr%XM %x87_binop',
1787         attr_type => "ia32_x87_attr_t",
1788 },
1789
1790 fdivrp => {
1791         op_flags  => "R",
1792         rd_constructor => "NONE",
1793         reg_req   => { },
1794 # see note about gas bugs
1795         emit      => '. fdivp%XM %x87_binop',
1796         attr_type => "ia32_x87_attr_t",
1797 },
1798
1799 fabs => {
1800         op_flags  => "R",
1801         rd_constructor => "NONE",
1802         reg_req   => { },
1803         emit      => '. fabs',
1804         attr_type => "ia32_x87_attr_t",
1805 },
1806
1807 fchs => {
1808         op_flags  => "R|K",
1809         rd_constructor => "NONE",
1810         reg_req   => { },
1811         emit      => '. fchs',
1812         attr_type => "ia32_x87_attr_t",
1813 },
1814
1815 # x87 Load and Store
1816
1817 fld => {
1818         rd_constructor => "NONE",
1819         op_flags  => "R|L|F",
1820         state     => "exc_pinned",
1821         reg_req   => { },
1822         emit      => '. fld%XM %AM',
1823         attr_type => "ia32_x87_attr_t",
1824 },
1825
1826 fst => {
1827         rd_constructor => "NONE",
1828         op_flags  => "R|L|F",
1829         state     => "exc_pinned",
1830         reg_req   => { },
1831         emit      => '. fst%XM %AM',
1832         mode      => "mode_M",
1833         attr_type => "ia32_x87_attr_t",
1834 },
1835
1836 fstp => {
1837         rd_constructor => "NONE",
1838         op_flags  => "R|L|F",
1839         state     => "exc_pinned",
1840         reg_req   => { },
1841         emit      => '. fstp%XM %AM',
1842         mode      => "mode_M",
1843         attr_type => "ia32_x87_attr_t",
1844 },
1845
1846 # Conversions
1847
1848 fild => {
1849         op_flags  => "R",
1850         rd_constructor => "NONE",
1851         reg_req   => { },
1852         emit      => '. fild%XM %AM',
1853         attr_type => "ia32_x87_attr_t",
1854 },
1855
1856 fist => {
1857         op_flags  => "R",
1858         state     => "exc_pinned",
1859         rd_constructor => "NONE",
1860         reg_req   => { },
1861         emit      => '. fist%XM %AM',
1862         mode      => "mode_M",
1863         attr_type => "ia32_x87_attr_t",
1864 },
1865
1866 fistp => {
1867         op_flags  => "R",
1868         state     => "exc_pinned",
1869         rd_constructor => "NONE",
1870         reg_req   => { },
1871         emit      => '. fistp%XM %AM',
1872         mode      => "mode_M",
1873         attr_type => "ia32_x87_attr_t",
1874 },
1875
1876 # constants
1877
1878 fldz => {
1879         op_flags  => "R|c|K",
1880         irn_flags  => "R",
1881         reg_req   => { },
1882         emit      => '. fldz',
1883         attr_type => "ia32_x87_attr_t",
1884 },
1885
1886 fld1 => {
1887         op_flags  => "R|c|K",
1888         irn_flags  => "R",
1889         reg_req   => { },
1890         emit      => '. fld1',
1891         attr_type => "ia32_x87_attr_t",
1892 },
1893
1894 fldpi => {
1895         op_flags  => "R|c|K",
1896         irn_flags  => "R",
1897         reg_req   => { },
1898         emit      => '. fldpi',
1899         attr_type => "ia32_x87_attr_t",
1900 },
1901
1902 fldln2 => {
1903         op_flags  => "R|c|K",
1904         irn_flags  => "R",
1905         reg_req   => { },
1906         emit      => '. fldln2',
1907         attr_type => "ia32_x87_attr_t",
1908 },
1909
1910 fldlg2 => {
1911         op_flags  => "R|c|K",
1912         irn_flags  => "R",
1913         reg_req   => { },
1914         emit      => '. fldlg2',
1915         attr_type => "ia32_x87_attr_t",
1916 },
1917
1918 fldl2t => {
1919         op_flags  => "R|c|K",
1920         irn_flags  => "R",
1921         reg_req   => { },
1922         emit      => '. fldll2t',
1923         attr_type => "ia32_x87_attr_t",
1924 },
1925
1926 fldl2e => {
1927         op_flags  => "R|c|K",
1928         irn_flags  => "R",
1929         reg_req   => { },
1930         emit      => '. fldl2e',
1931         attr_type => "ia32_x87_attr_t",
1932 },
1933
1934 # fxch, fpush, fpop
1935 # Note that it is NEVER allowed to do CSE on these nodes
1936 # Moreover, note the virtual register requierements!
1937
1938 fxch => {
1939         op_flags  => "R|K",
1940         reg_req   => { },
1941         cmp_attr  => "return 1;",
1942         emit      => '. fxch %X0',
1943         attr_type => "ia32_x87_attr_t",
1944 },
1945
1946 fpush => {
1947         op_flags  => "R|K",
1948         reg_req   => {},
1949         cmp_attr  => "return 1;",
1950         emit      => '. fld %X0',
1951         attr_type => "ia32_x87_attr_t",
1952 },
1953
1954 fpushCopy => {
1955         op_flags  => "R",
1956         reg_req   => { in => [ "vfp"], out => [ "vfp" ] },
1957         cmp_attr  => "return 1;",
1958         emit      => '. fld %X0',
1959         attr_type => "ia32_x87_attr_t",
1960 },
1961
1962 fpop => {
1963         op_flags  => "R|K",
1964         reg_req   => { },
1965         cmp_attr  => "return 1;",
1966         emit      => '. fstp %X0',
1967         attr_type => "ia32_x87_attr_t",
1968 },
1969
1970 # compare
1971
1972 fcomJmp => {
1973         op_flags  => "L|X|Y",
1974         reg_req   => { },
1975         attr_type => "ia32_x87_attr_t",
1976 },
1977
1978 fcompJmp => {
1979         op_flags  => "L|X|Y",
1980         reg_req   => { },
1981         attr_type => "ia32_x87_attr_t",
1982 },
1983
1984 fcomppJmp => {
1985         op_flags  => "L|X|Y",
1986         reg_req   => { },
1987         attr_type => "ia32_x87_attr_t",
1988 },
1989
1990 fcomrJmp => {
1991         op_flags  => "L|X|Y",
1992         reg_req   => { },
1993         attr_type => "ia32_x87_attr_t",
1994 },
1995
1996 fcomrpJmp => {
1997         op_flags  => "L|X|Y",
1998         reg_req   => { },
1999         attr_type => "ia32_x87_attr_t",
2000 },
2001
2002 fcomrppJmp => {
2003         op_flags  => "L|X|Y",
2004         reg_req   => { },
2005         attr_type => "ia32_x87_attr_t",
2006 },
2007
2008
2009 # -------------------------------------------------------------------------------- #
2010 #  ____ ____  _____                  _                               _             #
2011 # / ___/ ___|| ____| __   _____  ___| |_ ___  _ __   _ __   ___   __| | ___  ___   #
2012 # \___ \___ \|  _|   \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __|  #
2013 #  ___) |__) | |___   \ V /  __/ (__| || (_) | |    | | | | (_) | (_| |  __/\__ \  #
2014 # |____/____/|_____|   \_/ \___|\___|\__\___/|_|    |_| |_|\___/ \__,_|\___||___/  #
2015 #                                                                                  #
2016 # -------------------------------------------------------------------------------- #
2017
2018
2019 # Spilling and reloading of SSE registers, hardcoded, not generated #
2020
2021 xxLoad => {
2022         op_flags  => "L|F",
2023         state     => "exc_pinned",
2024         reg_req   => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2025         emit      => '. movdqu %D0, %AM',
2026         outs      => [ "res", "M" ],
2027         units     => [ "SSE" ],
2028 },
2029
2030 xxStore => {
2031         op_flags => "L|F",
2032         state    => "exc_pinned",
2033         reg_req  => { in => [ "gp", "gp", "xmm", "none" ] },
2034         emit     => '. movdqu %binop',
2035         units    => [ "SSE" ],
2036         mode     => "mode_M",
2037 },
2038
2039 ); # end of %nodes
2040
2041 # Include the generated SIMD node specification written by the SIMD optimization
2042 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2043 unless ($return = do $my_script_name) {
2044         warn "couldn't parse $my_script_name: $@" if $@;
2045         warn "couldn't do $my_script_name: $!"    unless defined $return;
2046         warn "couldn't run $my_script_name"       unless $return;
2047 }