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