3 # This is the specification for the ia32 assembler Firm-operations
10 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
13 # The node description is done as a perl hash initializer with the
14 # following structure:
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",
24 # { type => "type 1", name => "name 1" },
25 # { type => "type 2", name => "name 2" },
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",
39 # ... # (all nodes you need to describe)
41 # ); # close the %nodes initializer
43 # op_flags: flags for the operation, OPTIONAL (default is "N")
44 # the op_flags correspond to the firm irop_flags:
47 # C irop_flag_commutative
48 # X irop_flag_cfopcode
49 # I irop_flag_ip_cfopcode
52 # H irop_flag_highlevel
53 # c irop_flag_constlike
56 # irn_flags: special node flags, OPTIONAL (default is 0)
57 # following irn_flags are supported:
60 # I ignore for register allocation
61 # S modifies stack pointer
63 # state: state of the operation, OPTIONAL (default is "floats")
65 # arity: arity of the operation, MUST NOT BE OMITTED
67 # args: the OPTIONAL arguments of the node constructor (debug, irg and block
68 # are always the first 3 arguments and are always autmatically
70 # If this key is missing the following arguments will be created:
71 # for i = 1 .. arity: ir_node *op_i
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" ]
81 # comment: OPTIONAL comment for the node constructor
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
88 # This key is OPTIONAL. If omitted, the following constructor will
90 # if (!op_<arch>_<op-name>) assert(0);
94 # res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
97 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
99 # latency: the latency of the operation, default is 1
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
113 { name => "edx", type => 1 },
114 { name => "ecx", type => 1 },
115 { name => "eax", type => 1 },
116 { name => "ebx", type => 2 },
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" }
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", flags => "manual_ra" }
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
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
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", flags => "manual_ra" }
173 fp_cw => [ # the floating point control word
174 { name => "fpcw", type => 4|32 },
175 { mode => "mode_fpcw", flags => "manual_ra|state" }
178 { name => "eflags", type => 0 },
179 { mode => "mode_Iu", flags => "manual_ra" }
184 GP => [ 1, "GP_EAX", "GP_EBX", "GP_ECX", "GP_EDX", "GP_ESI", "GP_EDI", "GP_EBP" ],
185 SSE => [ 1, "SSE_XMM0", "SSE_XMM1", "SSE_XMM2", "SSE_XMM3", "SSE_XMM4", "SSE_XMM5", "SSE_XMM6", "SSE_XMM7" ],
186 VFP => [ 1, "VFP_VF0", "VFP_VF1", "VFP_VF2", "VFP_VF3", "VFP_VF4", "VFP_VF5", "VFP_VF6", "VFP_VF7" ],
187 BRANCH => [ 1, "BRANCH1", "BRANCH2" ],
192 bundels_per_cycle => 1
196 S0 => "${arch}_emit_source_register(node, 0);",
197 S1 => "${arch}_emit_source_register(node, 1);",
198 S2 => "${arch}_emit_source_register(node, 2);",
199 S3 => "${arch}_emit_source_register(node, 3);",
200 SB1 => "${arch}_emit_8bit_source_register_or_immediate(node, 1);",
201 SB2 => "${arch}_emit_8bit_source_register_or_immediate(node, 2);",
202 SB3 => "${arch}_emit_8bit_source_register_or_immediate(node, 3);",
203 SI0 => "${arch}_emit_source_register_or_immediate(node, 0);",
204 SI1 => "${arch}_emit_source_register_or_immediate(node, 1);",
205 SI2 => "${arch}_emit_source_register_or_immediate(node, 2);",
206 SI3 => "${arch}_emit_source_register_or_immediate(node, 3);",
207 D0 => "${arch}_emit_dest_register(node, 0);",
208 D1 => "${arch}_emit_dest_register(node, 1);",
209 DB0 => "${arch}_emit_8bit_dest_register(node, 0);",
210 X0 => "${arch}_emit_x87_register(node, 0);",
211 X1 => "${arch}_emit_x87_register(node, 1);",
212 SE => "${arch}_emit_extend_suffix(get_ia32_ls_mode(node));",
213 ME => "if(get_mode_size_bits(get_ia32_ls_mode(node)) != 32)\n
214 ia32_emit_mode_suffix(node);",
215 M => "${arch}_emit_mode_suffix(node);",
216 XM => "${arch}_emit_x87_mode_suffix(node);",
217 XXM => "${arch}_emit_xmm_mode_suffix(node);",
218 XSD => "${arch}_emit_xmm_mode_suffix_s(node);",
219 AM => "${arch}_emit_am(node);",
220 unop3 => "${arch}_emit_unop(node, 3);",
221 unop4 => "${arch}_emit_unop(node, 4);",
222 unop5 => "${arch}_emit_unop(node, 5);",
223 DAM1 => "${arch}_emit_am_or_dest_register(node, 1);",
224 binop => "${arch}_emit_binop(node);",
225 x87_binop => "${arch}_emit_x87_binop(node);",
226 CMP0 => "${arch}_emit_cmp_suffix_node(node, 0);",
229 #--------------------------------------------------#
232 # _ __ _____ __ _ _ __ ___ _ __ ___ #
233 # | '_ \ / _ \ \ /\ / / | | '__| / _ \| '_ \/ __| #
234 # | | | | __/\ V V / | | | | (_) | |_) \__ \ #
235 # |_| |_|\___| \_/\_/ |_|_| \___/| .__/|___/ #
238 #--------------------------------------------------#
240 $default_attr_type = "ia32_attr_t";
241 $default_copy_attr = "ia32_copy_attr";
243 sub ia32_custom_init_attr {
247 if(defined($node->{modified_flags})) {
248 $res .= "\tset_ia32_flags(res, get_ia32_flags(res) | arch_irn_flags_modify_flags);\n";
250 if(defined($node->{am})) {
251 my $am = $node->{am};
252 if($am eq "full,binary") {
253 $res .= "\tset_ia32_am_support(res, ia32_am_Full, ia32_am_binary);";
254 } elsif($am eq "full,unary") {
255 $res .= "\tset_ia32_am_support(res, ia32_am_Full, ia32_am_unary);";
256 } elsif($am eq "source,binary") {
257 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_binary);";
258 } elsif($am eq "dest,unary") {
259 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_unary);";
260 } elsif($am eq "dest,binary") {
261 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_binary);";
262 } elsif($am eq "dest,ternary") {
263 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_ternary);";
264 } elsif($am eq "source,ternary") {
265 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_ternary);";
266 } elsif($am eq "none") {
269 die("Invalid address mode '$am' specified on op $name");
274 $custom_init_attr_func = \&ia32_custom_init_attr;
277 ia32_attr_t => "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);",
279 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
280 "\tinit_ia32_x87_attributes(res);",
282 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
283 "\tinit_ia32_x87_attributes(res);".
284 "\tinit_ia32_asm_attributes(res);",
285 ia32_immediate_attr_t =>
286 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
287 "\tinit_ia32_immediate_attributes(res, symconst, symconst_sign, offset);"
291 ia32_attr_t => "ia32_compare_nodes_attr",
292 ia32_x87_attr_t => "ia32_compare_x87_attr",
293 ia32_asm_attr_t => "ia32_compare_asm_attr",
294 ia32_immediate_attr_t => "ia32_compare_immediate_attr",
300 $mode_xmm = "mode_E";
301 $mode_gp = "mode_Iu";
302 $mode_flags = "mode_Iu";
303 $mode_fpcw = "mode_fpcw";
304 $status_flags = [ "CF", "PF", "AF", "ZF", "SF", "OF" ];
305 $fpcw_flags = [ "FP_IM", "FP_DM", "FP_ZM", "FP_OM", "FP_UM", "FP_PM",
306 "FP_PC0", "FP_PC1", "FP_RC0", "FP_RC1", "FP_X" ];
314 reg_req => { out => [ "gp_NOREG" ] },
315 attr => "ir_entity *symconst, int symconst_sign, long offset",
316 attr_type => "ia32_immediate_attr_t",
324 out_arity => "variable",
325 attr_type => "ia32_asm_attr_t",
332 reg_req => { out => [ "gp" ] },
337 cmp_attr => "return 1;",
340 #-----------------------------------------------------------------#
343 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
344 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
345 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
346 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
349 #-----------------------------------------------------------------#
351 # commutative operations
355 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5", "none", "flags" ] },
356 ins => [ "base", "index", "mem", "left", "right" ],
357 emit => '. add%M %binop',
361 modified_flags => $status_flags
366 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
367 ins => [ "base", "index", "mem", "val" ],
368 emit => ". add%M %SI3, %AM",
371 modified_flags => $status_flags
376 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
377 ins => [ "base", "index", "mem", "val" ],
378 emit => ". add%M %SB3, %AM",
381 modified_flags => $status_flags
385 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 in_r5" ] },
386 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
387 emit => '. adc%M %binop',
391 modified_flags => $status_flags
396 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
397 ins => [ "left", "right" ],
401 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
402 ins => [ "left", "right", "eflags" ],
406 # we should not rematrialize this node. It produces 2 results and has
407 # very strict constrains
408 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
409 ins => [ "base", "index", "mem", "val_high", "val_low" ],
410 emit => '. mul%M %unop4',
411 outs => [ "EAX", "EDX", "M" ],
412 am => "source,binary",
415 modified_flags => $status_flags
419 # we should not rematrialize this node. It produces 2 results and has
420 # very strict constrains
422 cmp_attr => "return 1;",
423 outs => [ "EAX", "EDX", "M" ],
429 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
430 ins => [ "base", "index", "mem", "left", "right" ],
431 emit => '. imul%M %binop',
432 am => "source,binary",
436 modified_flags => $status_flags
441 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
442 ins => [ "base", "index", "mem", "val_high", "val_low" ],
443 emit => '. imul%M %unop4',
444 outs => [ "EAX", "EDX", "M" ],
445 am => "source,binary",
448 modified_flags => $status_flags
452 # we should not rematrialize this node. It produces 2 results and has
453 # very strict constrains
455 cmp_attr => "return 1;",
456 outs => [ "EAX", "EDX", "M" ],
462 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
463 ins => [ "base", "index", "mem", "left", "right" ],
465 emit => '. and%M %binop',
468 modified_flags => $status_flags
473 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
474 ins => [ "base", "index", "mem", "val" ],
475 emit => '. and%M %SI3, %AM',
478 modified_flags => $status_flags
483 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
484 ins => [ "base", "index", "mem", "val" ],
485 emit => '. and%M %SB3, %AM',
488 modified_flags => $status_flags
493 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
494 ins => [ "base", "index", "mem", "left", "right" ],
496 emit => '. or%M %binop',
499 modified_flags => $status_flags
504 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
505 ins => [ "base", "index", "mem", "val" ],
506 emit => '. or%M %SI3, %AM',
509 modified_flags => $status_flags
514 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
515 ins => [ "base", "index", "mem", "val" ],
516 emit => '. or%M %SB3, %AM',
519 modified_flags => $status_flags
524 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
525 ins => [ "base", "index", "mem", "left", "right" ],
527 emit => '. xor%M %binop',
530 modified_flags => $status_flags
535 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
536 ins => [ "base", "index", "mem", "val" ],
537 emit => '. xor%M %SI3, %AM',
540 modified_flags => $status_flags
545 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
546 ins => [ "base", "index", "mem", "val" ],
547 emit => '. xor%M %SB3, %AM',
550 modified_flags => $status_flags
553 # not commutative operations
557 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4", "none", "flags" ] },
558 ins => [ "base", "index", "mem", "left", "right" ],
560 emit => '. sub%M %binop',
563 modified_flags => $status_flags
568 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
569 ins => [ "base", "index", "mem", "val" ],
570 emit => '. sub%M %SI3, %AM',
573 modified_flags => $status_flags
578 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
579 ins => [ "base", "index", "mem", "val" ],
580 emit => '. sub%M %SB3, %AM',
583 modified_flags => $status_flags
587 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 !in_r5" ] },
588 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
590 emit => '. sbb%M %binop',
593 modified_flags => $status_flags
597 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
598 ins => [ "left", "right" ],
602 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
603 ins => [ "left", "right", "eflags" ],
608 state => "exc_pinned",
609 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
610 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
611 outs => [ "div_res", "mod_res", "M" ],
612 attr => "ia32_op_flavour_t dm_flav",
613 am => "source,ternary",
614 init_attr => "attr->data.op_flav = dm_flav;",
615 emit => ". idiv%M %unop5",
618 modified_flags => $status_flags
623 state => "exc_pinned",
624 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
625 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
626 outs => [ "div_res", "mod_res", "M" ],
627 attr => "ia32_op_flavour_t dm_flav",
628 am => "source,ternary",
629 init_attr => "attr->data.op_flav = dm_flav;",
630 emit => ". div%M %unop5",
633 modified_flags => $status_flags
638 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
639 ins => [ "left", "right" ],
641 emit => '. shl %SB1, %S0',
644 modified_flags => $status_flags
649 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
650 ins => [ "base", "index", "mem", "count" ],
651 emit => '. shl%M %SB3, %AM',
654 modified_flags => $status_flags
658 cmp_attr => "return 1;",
659 # value, cnt, dependency
664 # FIXME: WHY? the right requirement is in_r3 !in_r5, especially this is the same as in Shl
666 # Out requirements is: different from all in
667 # This is because, out must be different from LowPart and ShiftCount.
668 # We could say "!ecx !in_r4" but it can occur, that all values live through
669 # this Shift and the only value dying is the ShiftCount. Then there would be a
670 # register missing, as result must not be ecx and all other registers are
671 # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
672 # (and probably never will). So we create artificial interferences of the result
673 # with all inputs, so the spiller can always assure a free register.
674 # reg_req => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
677 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
678 ins => [ "left_high", "left_low", "right" ],
679 am => "dest,ternary",
680 emit => '. shld%M %SB2, %S1, %S0',
684 modified_flags => $status_flags
688 cmp_attr => "return 1;",
694 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
695 ins => [ "val", "count" ],
697 emit => '. shr %SB1, %S0',
700 modified_flags => $status_flags
705 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
706 ins => [ "base", "index", "mem", "count" ],
707 emit => '. shr%M %SB3, %AM',
710 modified_flags => $status_flags
714 cmp_attr => "return 1;",
715 # value, cnt, dependency
720 # FIXME: WHY? the right requirement is in_r3 !in_r5, especially this is the same as in Shr
722 # Out requirements is: different from all in
723 # This is because, out must be different from LowPart and ShiftCount.
724 # We could say "!ecx !in_r4" but it can occur, that all values live through
725 # this Shift and the only value dying is the ShiftCount. Then there would be a
726 # register missing, as result must not be ecx and all other registers are
727 # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
728 # (and probably never will). So we create artificial interferences of the result
729 # with all inputs, so the spiller can always assure a free register.
730 # reg_req => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
733 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
734 ins => [ "left_high", "left_low", "right" ],
735 am => "dest,ternary",
736 emit => '. shrd%M %SB2, %S1, %S0',
740 modified_flags => $status_flags
744 cmp_attr => "return 1;",
750 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
751 ins => [ "val", "count" ],
753 emit => '. sar %SB1, %S0',
756 modified_flags => $status_flags
761 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
762 ins => [ "base", "index", "mem", "count" ],
763 emit => '. sar%M %SB3, %AM',
766 modified_flags => $status_flags
770 cmp_attr => "return 1;",
776 cmp_attr => "return 1;",
777 # value, cnt, dependency
783 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
784 ins => [ "val", "count" ],
786 emit => '. ror %SB1, %S0',
789 modified_flags => $status_flags
794 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
795 ins => [ "base", "index", "mem", "count" ],
796 emit => '. ror%M %SB3, %AM',
799 modified_flags => $status_flags
804 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
805 ins => [ "val", "count" ],
807 emit => '. rol %SB1, %S0',
810 modified_flags => $status_flags
815 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
816 ins => [ "base", "index", "mem", "count" ],
817 emit => '. rol%M %SB3, %AM',
820 modified_flags => $status_flags
827 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
833 modified_flags => $status_flags
838 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
839 ins => [ "base", "index", "mem" ],
840 emit => '. neg%M %AM',
843 modified_flags => $status_flags
848 reg_req => { in => [ "gp", "gp" ], out => [ "in_r1", "gp" ] },
849 outs => [ "low_res", "high_res" ],
851 modified_flags => $status_flags
856 cmp_attr => "return 1;",
862 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
867 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
872 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
873 ins => [ "base", "index", "mem" ],
874 emit => '. inc%M %AM',
877 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
882 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
887 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
892 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
893 ins => [ "base", "index", "mem" ],
894 emit => '. dec%M %AM',
897 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
902 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
912 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
913 ins => [ "base", "index", "mem" ],
914 emit => '. not%M %AM',
923 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
924 ins => [ "base", "index", "mem", "left", "right" ],
925 outs => [ "eflags" ],
926 am => "source,binary",
927 emit => '. cmp%M %binop',
928 attr => "int flipped, int cmp_unsigned",
929 init_attr => "attr->data.cmp_flipped = flipped;\n".
930 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
934 modified_flags => $status_flags
939 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
940 ins => [ "base", "index", "mem", "left", "right" ],
941 outs => [ "eflags" ],
942 am => "source,binary",
943 emit => '. cmpb %binop',
944 attr => "int flipped, int cmp_unsigned",
945 init_attr => "attr->data.cmp_flipped = flipped;\n".
946 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
950 modified_flags => $status_flags
955 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
956 ins => [ "base", "index", "mem", "left", "right" ],
957 outs => [ "eflags" ],
958 am => "source,binary",
959 emit => '. test%M %binop',
960 attr => "int flipped, int cmp_unsigned",
961 init_attr => "attr->data.cmp_flipped = flipped;\n".
962 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
966 modified_flags => $status_flags
971 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
972 ins => [ "base", "index", "mem", "left", "right" ],
973 outs => [ "eflags" ],
974 am => "source,binary",
975 emit => '. testb %binop',
976 attr => "int flipped, int cmp_unsigned",
977 init_attr => "attr->data.cmp_flipped = flipped;\n".
978 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
982 modified_flags => $status_flags
987 reg_req => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
990 attr => "pn_Cmp pnc",
991 init_attr => "attr->pn_code = pnc;\nset_ia32_ls_mode(res, mode_Bu);\n",
992 emit => '. set%CMP0 %DB0',
1000 # (note: leave the false,true order intact to make it compatible with other
1002 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4" ] },
1003 ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
1004 am => "source,binary",
1005 attr => "int flipped, pn_Cmp pn_code",
1006 init_attr => "attr->pn_code = pn_code;\n".
1007 "attr->data.cmp_flipped = flipped;",
1015 op_flags => "L|X|Y",
1016 reg_req => { in => [ "eflags" ], out => [ "none", "none" ] },
1017 ins => [ "eflags" ],
1018 outs => [ "false", "true" ],
1019 attr => "pn_Cmp pnc",
1020 init_attr => "attr->pn_code = pnc;",
1022 units => [ "BRANCH" ],
1027 op_flags => "L|X|Y",
1028 reg_req => { in => [ "gp" ], out => [ "none" ] },
1030 units => [ "BRANCH" ],
1032 modified_flags => $status_flags
1038 reg_req => { in => [ "gp" ] },
1039 emit => '. jmp *%S0',
1040 units => [ "BRANCH" ],
1047 reg_req => { out => [ "gp" ] },
1049 attr => "ir_entity *symconst, int symconst_sign, long offset",
1050 attr_type => "ia32_immediate_attr_t",
1052 # depends on the const and is set in ia32_transform
1053 # modified_flags => $status_flags
1060 reg_req => { out => [ "gp_UKNWN" ] },
1070 reg_req => { out => [ "vfp_UKNWN" ] },
1074 attr_type => "ia32_x87_attr_t",
1081 reg_req => { out => [ "xmm_UKNWN" ] },
1091 reg_req => { out => [ "gp_NOREG" ] },
1101 reg_req => { out => [ "vfp_NOREG" ] },
1105 attr_type => "ia32_x87_attr_t",
1112 reg_req => { out => [ "xmm_NOREG" ] },
1122 reg_req => { out => [ "fp_cw" ] },
1126 modified_flags => $fpcw_flags
1132 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1133 ins => [ "base", "index", "mem" ],
1135 emit => ". fldcw %AM",
1138 modified_flags => $fpcw_flags
1144 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1145 ins => [ "base", "index", "mem", "fpcw" ],
1147 emit => ". fnstcw %AM",
1153 # we should not rematrialize this node. It has very strict constraints.
1154 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1155 ins => [ "val", "globbered" ],
1163 # Note that we add additional latency values depending on address mode, so a
1164 # lateny of 0 for load is correct
1168 state => "exc_pinned",
1169 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1170 ins => [ "base", "index", "mem" ],
1171 outs => [ "res", "M" ],
1173 emit => ". mov%SE%ME%.l %AM, %D0",
1179 cmp_attr => "return 1;",
1180 outs => [ "res", "M" ],
1186 cmp_attr => "return 1;",
1187 state => "exc_pinned",
1194 state => "exc_pinned",
1195 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1196 ins => [ "base", "index", "mem", "val" ],
1197 emit => '. mov%M %SI3, %AM',
1205 state => "exc_pinned",
1206 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1207 ins => [ "base", "index", "mem", "val" ],
1208 emit => '. mov%M %SB3, %AM',
1216 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1217 ins => [ "base", "index" ],
1218 emit => '. leal %AM, %D0',
1222 # well this isn't true for Lea, but we often transform Lea back to Add, Inc
1223 # or Dec, so we set the flag
1224 modified_flags => 1,
1228 reg_req => { in => [ "gp", "gp", "none", "gp", "esp" ], out => [ "esp", "none" ] },
1229 ins => [ "base", "index", "mem", "val", "stack" ],
1230 emit => '. push%M %unop3',
1231 outs => [ "stack:I|S", "M" ],
1232 am => "source,binary",
1238 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1239 emit => '. pop%M %DAM1',
1240 outs => [ "stack:I|S", "res", "M" ],
1241 ins => [ "base", "index", "mem", "stack" ],
1243 latency => 3, # Pop is more expensive than Push on Athlon
1248 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1250 outs => [ "frame:I", "stack:I|S", "M" ],
1256 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1258 outs => [ "frame:I", "stack:I|S" ],
1266 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1267 ins => [ "base", "index", "mem", "stack", "size" ],
1268 am => "source,binary",
1269 emit => '. addl %binop',
1270 outs => [ "stack:S", "M" ],
1272 modified_flags => $status_flags
1278 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1279 ins => [ "base", "index", "mem", "stack", "size" ],
1280 am => "source,binary",
1281 emit => ". subl %binop\n".
1282 ". movl %%esp, %D1",
1283 outs => [ "stack:I|S", "addr", "M" ],
1285 modified_flags => $status_flags
1290 reg_req => { out => [ "gp" ] },
1294 # the int instruction
1296 reg_req => { in => [ "gp" ], out => [ "none" ] },
1298 emit => '. int %SI0',
1300 cmp_attr => "return 1;",
1304 #-----------------------------------------------------------------------------#
1305 # _____ _____ ______ __ _ _ _ #
1306 # / ____/ ____| ____| / _| | | | | | #
1307 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1308 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1309 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1310 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1311 #-----------------------------------------------------------------------------#
1315 reg_req => { out => [ "xmm" ] },
1316 emit => '. xorp%XSD %D0, %D0',
1322 # commutative operations
1326 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1327 ins => [ "base", "index", "mem", "left", "right" ],
1328 emit => '. add%XXM %binop',
1336 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1337 ins => [ "base", "index", "mem", "left", "right" ],
1338 emit => '. mul%XXM %binop',
1346 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1347 ins => [ "base", "index", "mem", "left", "right" ],
1348 emit => '. max%XXM %binop',
1356 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1357 ins => [ "base", "index", "mem", "left", "right" ],
1358 emit => '. min%XXM %binop',
1366 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1367 ins => [ "base", "index", "mem", "left", "right" ],
1368 emit => '. andp%XSD %binop',
1376 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1377 ins => [ "base", "index", "mem", "left", "right" ],
1378 emit => '. orp%XSD %binop',
1385 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1386 ins => [ "base", "index", "mem", "left", "right" ],
1387 emit => '. xorp%XSD %binop',
1393 # not commutative operations
1397 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1398 ins => [ "base", "index", "mem", "left", "right" ],
1399 emit => '. andnp%XSD %binop',
1407 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1408 ins => [ "base", "index", "mem", "left", "right" ],
1409 emit => '. sub%XXM %binop',
1417 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1418 ins => [ "base", "index", "mem", "left", "right" ],
1419 outs => [ "res", "M" ],
1420 emit => '. div%XXM %binop',
1429 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1430 ins => [ "base", "index", "mem", "left", "right" ],
1431 outs => [ "flags" ],
1432 am => "source,binary",
1433 attr => "int flipped",
1434 init_attr => "attr->data.cmp_flipped = flipped;",
1435 emit => ' .ucomi%XXM %binop',
1438 mode => $mode_flags,
1439 modified_flags => 1,
1446 state => "exc_pinned",
1447 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1448 ins => [ "base", "index", "mem" ],
1449 emit => '. mov%XXM %AM, %D0',
1450 attr => "ir_mode *load_mode",
1451 init_attr => "attr->ls_mode = load_mode;",
1452 outs => [ "res", "M" ],
1459 state => "exc_pinned",
1460 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1461 ins => [ "base", "index", "mem", "val" ],
1462 emit => '. mov%XXM %S3, %AM',
1470 state => "exc_pinned",
1471 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1472 ins => [ "base", "index", "mem", "val" ],
1473 emit => '. mov%XXM %S3, %AM',
1481 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1482 ins => [ "base", "index", "mem", "val" ],
1483 emit => '. cvtsi2ss %unop3, %D0',
1491 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1492 ins => [ "base", "index", "mem", "val" ],
1493 emit => '. cvtsi2sd %unop3, %D0',
1502 cmp_attr => "return 1;",
1508 cmp_attr => "return 1;",
1517 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1518 outs => [ "DST", "SRC", "CNT", "M" ],
1520 # we don't care about this flag, so no need to mark this node
1521 # modified_flags => [ "DF" ]
1527 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1528 outs => [ "DST", "SRC", "M" ],
1530 # we don't care about this flag, so no need to mark this node
1531 # modified_flags => [ "DF" ]
1537 state => "exc_pinned",
1538 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1539 ins => [ "base", "index", "mem", "val" ],
1541 attr => "ir_mode *smaller_mode",
1542 init_attr => "attr->ls_mode = smaller_mode;",
1547 state => "exc_pinned",
1548 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1549 ins => [ "base", "index", "mem", "val" ],
1551 attr => "ir_mode *smaller_mode",
1552 init_attr => "attr->ls_mode = smaller_mode;",
1557 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
1558 ins => [ "base", "index", "mem", "val" ],
1565 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1566 ins => [ "base", "index", "mem", "val" ],
1573 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1574 ins => [ "base", "index", "mem", "val" ],
1580 #----------------------------------------------------------#
1582 # (_) | | | | / _| | | | #
1583 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1584 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1585 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1586 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1588 # _ __ ___ __| | ___ ___ #
1589 # | '_ \ / _ \ / _` |/ _ \/ __| #
1590 # | | | | (_) | (_| | __/\__ \ #
1591 # |_| |_|\___/ \__,_|\___||___/ #
1592 #----------------------------------------------------------#
1594 # spilling disabled for all float nodes for now, because the fpcw handler
1595 # runs before spilling and we might end up with wrong fpcw then
1599 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1600 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1604 attr_type => "ia32_x87_attr_t",
1609 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1610 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1614 attr_type => "ia32_x87_attr_t",
1619 cmp_attr => "return 1;",
1625 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1626 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1630 attr_type => "ia32_x87_attr_t",
1634 cmp_attr => "return 1;",
1639 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1640 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1641 outs => [ "res", "M" ],
1644 attr_type => "ia32_x87_attr_t",
1648 cmp_attr => "return 1;",
1649 outs => [ "res", "M" ],
1654 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1655 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1659 attr_type => "ia32_x87_attr_t",
1663 cmp_attr => "return 1;",
1669 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1674 attr_type => "ia32_x87_attr_t",
1679 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1684 attr_type => "ia32_x87_attr_t",
1687 # virtual Load and Store
1691 state => "exc_pinned",
1692 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1693 ins => [ "base", "index", "mem" ],
1694 outs => [ "res", "M" ],
1695 attr => "ir_mode *load_mode",
1696 init_attr => "attr->attr.ls_mode = load_mode;",
1699 attr_type => "ia32_x87_attr_t",
1704 state => "exc_pinned",
1705 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1706 ins => [ "base", "index", "mem", "val" ],
1707 attr => "ir_mode *store_mode",
1708 init_attr => "attr->attr.ls_mode = store_mode;",
1712 attr_type => "ia32_x87_attr_t",
1718 state => "exc_pinned",
1719 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1720 outs => [ "res", "M" ],
1721 ins => [ "base", "index", "mem" ],
1724 attr_type => "ia32_x87_attr_t",
1728 cmp_attr => "return 1;",
1729 outs => [ "res", "M" ],
1734 state => "exc_pinned",
1735 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1736 ins => [ "base", "index", "mem", "val", "fpcw" ],
1740 attr_type => "ia32_x87_attr_t",
1744 cmp_attr => "return 1;",
1745 state => "exc_pinned",
1755 reg_req => { out => [ "vfp" ] },
1759 attr_type => "ia32_x87_attr_t",
1764 reg_req => { out => [ "vfp" ] },
1768 attr_type => "ia32_x87_attr_t",
1773 reg_req => { out => [ "vfp" ] },
1777 attr_type => "ia32_x87_attr_t",
1782 reg_req => { out => [ "vfp" ] },
1786 attr_type => "ia32_x87_attr_t",
1791 reg_req => { out => [ "vfp" ] },
1795 attr_type => "ia32_x87_attr_t",
1800 reg_req => { out => [ "vfp" ] },
1804 attr_type => "ia32_x87_attr_t",
1809 reg_req => { out => [ "vfp" ] },
1813 attr_type => "ia32_x87_attr_t",
1819 # we can't allow to rematerialize this node so we don't have
1820 # accidently produce Phi(Fucom, Fucom(flipped))
1822 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1823 ins => [ "left", "right" ],
1824 outs => [ "flags" ],
1825 attr => "int flipped",
1826 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1829 attr_type => "ia32_x87_attr_t",
1835 reg_req => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
1836 ins => [ "left", "right" ],
1837 outs => [ "flags" ],
1838 attr => "int flipped",
1839 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1842 attr_type => "ia32_x87_attr_t",
1848 reg_req => { in => [ "vfp" ], out => [ "eax" ] },
1850 outs => [ "flags" ],
1851 attr => "int flipped",
1852 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1855 attr_type => "ia32_x87_attr_t",
1861 reg_req => { in => [ "eax" ], out => [ "eflags" ] },
1863 outs => [ "flags" ],
1866 mode => $mode_flags,
1869 #------------------------------------------------------------------------#
1870 # ___ _____ __ _ _ _ #
1871 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1872 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1873 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1874 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1875 #------------------------------------------------------------------------#
1877 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1878 # are swapped, we work this around in the emitter...
1882 rd_constructor => "NONE",
1884 emit => '. fadd%XM %x87_binop',
1885 attr_type => "ia32_x87_attr_t",
1890 rd_constructor => "NONE",
1892 emit => '. faddp%XM %x87_binop',
1893 attr_type => "ia32_x87_attr_t",
1898 rd_constructor => "NONE",
1900 emit => '. fmul%XM %x87_binop',
1901 attr_type => "ia32_x87_attr_t",
1906 rd_constructor => "NONE",
1908 emit => '. fmulp%XM %x87_binop',,
1909 attr_type => "ia32_x87_attr_t",
1914 rd_constructor => "NONE",
1916 emit => '. fsub%XM %x87_binop',
1917 attr_type => "ia32_x87_attr_t",
1922 rd_constructor => "NONE",
1924 # see note about gas bugs
1925 emit => '. fsubrp%XM %x87_binop',
1926 attr_type => "ia32_x87_attr_t",
1931 rd_constructor => "NONE",
1934 emit => '. fsubr%XM %x87_binop',
1935 attr_type => "ia32_x87_attr_t",
1940 rd_constructor => "NONE",
1943 # see note about gas bugs
1944 emit => '. fsubp%XM %x87_binop',
1945 attr_type => "ia32_x87_attr_t",
1950 rd_constructor => "NONE",
1953 attr_type => "ia32_x87_attr_t",
1956 # this node is just here, to keep the simulator running
1957 # we can omit this when a fprem simulation function exists
1960 rd_constructor => "NONE",
1963 attr_type => "ia32_x87_attr_t",
1968 rd_constructor => "NONE",
1970 emit => '. fdiv%XM %x87_binop',
1971 attr_type => "ia32_x87_attr_t",
1976 rd_constructor => "NONE",
1978 # see note about gas bugs
1979 emit => '. fdivrp%XM %x87_binop',
1980 attr_type => "ia32_x87_attr_t",
1985 rd_constructor => "NONE",
1987 emit => '. fdivr%XM %x87_binop',
1988 attr_type => "ia32_x87_attr_t",
1993 rd_constructor => "NONE",
1995 # see note about gas bugs
1996 emit => '. fdivp%XM %x87_binop',
1997 attr_type => "ia32_x87_attr_t",
2002 rd_constructor => "NONE",
2005 attr_type => "ia32_x87_attr_t",
2010 rd_constructor => "NONE",
2013 attr_type => "ia32_x87_attr_t",
2016 # x87 Load and Store
2019 rd_constructor => "NONE",
2020 op_flags => "R|L|F",
2021 state => "exc_pinned",
2023 emit => '. fld%XM %AM',
2024 attr_type => "ia32_x87_attr_t",
2028 rd_constructor => "NONE",
2029 op_flags => "R|L|F",
2030 state => "exc_pinned",
2032 emit => '. fst%XM %AM',
2034 attr_type => "ia32_x87_attr_t",
2038 rd_constructor => "NONE",
2039 op_flags => "R|L|F",
2040 state => "exc_pinned",
2042 emit => '. fstp%XM %AM',
2044 attr_type => "ia32_x87_attr_t",
2051 rd_constructor => "NONE",
2053 emit => '. fild%M %AM',
2054 attr_type => "ia32_x87_attr_t",
2059 state => "exc_pinned",
2060 rd_constructor => "NONE",
2062 emit => '. fist%M %AM',
2064 attr_type => "ia32_x87_attr_t",
2069 state => "exc_pinned",
2070 rd_constructor => "NONE",
2072 emit => '. fistp%M %AM',
2074 attr_type => "ia32_x87_attr_t",
2080 op_flags => "R|c|K",
2082 reg_req => { out => [ "vfp" ] },
2084 attr_type => "ia32_x87_attr_t",
2088 op_flags => "R|c|K",
2090 reg_req => { out => [ "vfp" ] },
2092 attr_type => "ia32_x87_attr_t",
2096 op_flags => "R|c|K",
2098 reg_req => { out => [ "vfp" ] },
2100 attr_type => "ia32_x87_attr_t",
2104 op_flags => "R|c|K",
2106 reg_req => { out => [ "vfp" ] },
2108 attr_type => "ia32_x87_attr_t",
2112 op_flags => "R|c|K",
2114 reg_req => { out => [ "vfp" ] },
2116 attr_type => "ia32_x87_attr_t",
2120 op_flags => "R|c|K",
2122 reg_req => { out => [ "vfp" ] },
2123 emit => '. fldll2t',
2124 attr_type => "ia32_x87_attr_t",
2128 op_flags => "R|c|K",
2130 reg_req => { out => [ "vfp" ] },
2132 attr_type => "ia32_x87_attr_t",
2136 # Note that it is NEVER allowed to do CSE on these nodes
2137 # Moreover, note the virtual register requierements!
2142 cmp_attr => "return 1;",
2143 emit => '. fxch %X0',
2144 attr_type => "ia32_x87_attr_t",
2151 cmp_attr => "return 1;",
2152 emit => '. fld %X0',
2153 attr_type => "ia32_x87_attr_t",
2159 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2160 cmp_attr => "return 1;",
2161 emit => '. fld %X0',
2162 attr_type => "ia32_x87_attr_t",
2168 cmp_attr => "return 1;",
2169 emit => '. fstp %X0',
2170 attr_type => "ia32_x87_attr_t",
2177 cmp_attr => "return 1;",
2178 emit => '. ffreep %X0',
2179 attr_type => "ia32_x87_attr_t",
2186 cmp_attr => "return 1;",
2188 attr_type => "ia32_x87_attr_t",
2195 cmp_attr => "return 1;",
2197 attr_type => "ia32_x87_attr_t",
2205 emit => ". fucom %X1\n".
2207 attr_type => "ia32_x87_attr_t",
2212 emit => ". fucomp %X1\n".
2214 attr_type => "ia32_x87_attr_t",
2219 emit => ". fucompp\n".
2221 attr_type => "ia32_x87_attr_t",
2226 emit => '. fucomi %X1',
2227 attr_type => "ia32_x87_attr_t",
2232 emit => '. fucompi %X1',
2233 attr_type => "ia32_x87_attr_t",
2240 attr_type => "ia32_x87_attr_t",
2244 # -------------------------------------------------------------------------------- #
2245 # ____ ____ _____ _ _ #
2246 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2247 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2248 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2249 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2251 # -------------------------------------------------------------------------------- #
2254 # Spilling and reloading of SSE registers, hardcoded, not generated #
2258 state => "exc_pinned",
2259 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2260 emit => '. movdqu %D0, %AM',
2261 outs => [ "res", "M" ],
2267 state => "exc_pinned",
2268 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2269 ins => [ "base", "index", "mem", "val" ],
2270 emit => '. movdqu %binop',
2277 # Include the generated SIMD node specification written by the SIMD optimization
2278 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2279 unless ($return = do $my_script_name) {
2280 warn "couldn't parse $my_script_name: $@" if $@;
2281 warn "couldn't do $my_script_name: $!" unless defined $return;
2282 warn "couldn't run $my_script_name" unless $return;