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 SI3 => "${arch}_emit_source_register_or_immediate(node, 3);",
204 D0 => "${arch}_emit_dest_register(node, 0);",
205 D1 => "${arch}_emit_dest_register(node, 1);",
206 DB0 => "${arch}_emit_8bit_dest_register(node, 0);",
207 X0 => "${arch}_emit_x87_register(node, 0);",
208 X1 => "${arch}_emit_x87_register(node, 1);",
209 SE => "${arch}_emit_extend_suffix(get_ia32_ls_mode(node));",
210 ME => "if(get_mode_size_bits(get_ia32_ls_mode(node)) != 32)\n
211 ia32_emit_mode_suffix(node);",
212 M => "${arch}_emit_mode_suffix(node);",
213 XM => "${arch}_emit_x87_mode_suffix(node);",
214 XXM => "${arch}_emit_xmm_mode_suffix(node);",
215 XSD => "${arch}_emit_xmm_mode_suffix_s(node);",
216 AM => "${arch}_emit_am(node);",
217 unop3 => "${arch}_emit_unop(node, 3);",
218 unop4 => "${arch}_emit_unop(node, 4);",
219 unop5 => "${arch}_emit_unop(node, 5);",
220 DAM1 => "${arch}_emit_am_or_dest_register(node, 1);",
221 binop => "${arch}_emit_binop(node);",
222 x87_binop => "${arch}_emit_x87_binop(node);",
223 CMP0 => "${arch}_emit_cmp_suffix_node(node, 0);",
226 #--------------------------------------------------#
229 # _ __ _____ __ _ _ __ ___ _ __ ___ #
230 # | '_ \ / _ \ \ /\ / / | | '__| / _ \| '_ \/ __| #
231 # | | | | __/\ V V / | | | | (_) | |_) \__ \ #
232 # |_| |_|\___| \_/\_/ |_|_| \___/| .__/|___/ #
235 #--------------------------------------------------#
237 $default_attr_type = "ia32_attr_t";
238 $default_copy_attr = "ia32_copy_attr";
240 sub ia32_custom_init_attr {
244 if(defined($node->{modified_flags})) {
245 $res .= "\tset_ia32_flags(res, get_ia32_flags(res) | arch_irn_flags_modify_flags);\n";
247 if(defined($node->{am})) {
248 my $am = $node->{am};
249 if($am eq "full,binary") {
250 $res .= "\tset_ia32_am_support(res, ia32_am_Full, ia32_am_binary);";
251 } elsif($am eq "full,unary") {
252 $res .= "\tset_ia32_am_support(res, ia32_am_Full, ia32_am_unary);";
253 } elsif($am eq "source,unary") {
254 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_unary);";
255 } elsif($am eq "source,binary") {
256 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_binary);";
257 } elsif($am eq "dest,unary") {
258 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_unary);";
259 } elsif($am eq "dest,binary") {
260 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_binary);";
261 } elsif($am eq "dest,ternary") {
262 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_ternary);";
263 } elsif($am eq "source,ternary") {
264 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_ternary);";
265 } elsif($am eq "none") {
268 die("Invalid address mode '$am' specified on op $name");
273 $custom_init_attr_func = \&ia32_custom_init_attr;
276 ia32_attr_t => "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);",
278 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
279 "\tinit_ia32_x87_attributes(res);",
281 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
282 "\tinit_ia32_x87_attributes(res);".
283 "\tinit_ia32_asm_attributes(res);",
284 ia32_immediate_attr_t =>
285 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
286 "\tinit_ia32_immediate_attributes(res, symconst, symconst_sign, offset);"
290 ia32_attr_t => "ia32_compare_nodes_attr",
291 ia32_x87_attr_t => "ia32_compare_x87_attr",
292 ia32_asm_attr_t => "ia32_compare_asm_attr",
293 ia32_immediate_attr_t => "ia32_compare_immediate_attr",
299 $mode_xmm = "mode_E";
300 $mode_gp = "mode_Iu";
301 $mode_flags = "mode_Iu";
302 $mode_fpcw = "mode_fpcw";
303 $status_flags = [ "CF", "PF", "AF", "ZF", "SF", "OF" ];
304 $fpcw_flags = [ "FP_IM", "FP_DM", "FP_ZM", "FP_OM", "FP_UM", "FP_PM",
305 "FP_PC0", "FP_PC1", "FP_RC0", "FP_RC1", "FP_X" ];
313 reg_req => { out => [ "gp_NOREG" ] },
314 attr => "ir_entity *symconst, int symconst_sign, long offset",
315 attr_type => "ia32_immediate_attr_t",
323 out_arity => "variable",
324 attr_type => "ia32_asm_attr_t",
331 reg_req => { out => [ "gp" ] },
336 cmp_attr => "return 1;",
339 #-----------------------------------------------------------------#
342 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
343 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
344 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
345 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
348 #-----------------------------------------------------------------#
350 # commutative operations
354 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5", "none", "flags" ] },
355 ins => [ "base", "index", "mem", "left", "right" ],
356 emit => '. add%M %binop',
360 modified_flags => $status_flags
365 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
366 ins => [ "base", "index", "mem", "val" ],
367 emit => ". add%M %SI3, %AM",
370 modified_flags => $status_flags
375 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
376 ins => [ "base", "index", "mem", "val" ],
377 emit => ". add%M %SB3, %AM",
380 modified_flags => $status_flags
384 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 in_r5" ] },
385 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
386 emit => '. adc%M %binop',
390 modified_flags => $status_flags
395 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
396 ins => [ "left", "right" ],
400 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
401 ins => [ "left", "right", "eflags" ],
405 # we should not rematrialize this node. It produces 2 results and has
406 # very strict constrains
407 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
408 ins => [ "base", "index", "mem", "val_high", "val_low" ],
409 emit => '. mul%M %unop4',
410 outs => [ "EAX", "EDX", "M" ],
411 am => "source,binary",
414 modified_flags => $status_flags
418 # we should not rematrialize this node. It produces 2 results and has
419 # very strict constrains
421 cmp_attr => "return 1;",
422 outs => [ "EAX", "EDX", "M" ],
428 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
429 ins => [ "base", "index", "mem", "left", "right" ],
430 emit => '. imul%M %binop',
431 am => "source,binary",
435 modified_flags => $status_flags
440 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
441 ins => [ "base", "index", "mem", "val_high", "val_low" ],
442 emit => '. imul%M %unop4',
443 outs => [ "EAX", "EDX", "M" ],
444 am => "source,binary",
447 modified_flags => $status_flags
451 # we should not rematrialize this node. It produces 2 results and has
452 # very strict constrains
454 cmp_attr => "return 1;",
455 outs => [ "EAX", "EDX", "M" ],
461 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
462 ins => [ "base", "index", "mem", "left", "right" ],
464 emit => '. and%M %binop',
467 modified_flags => $status_flags
472 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
473 ins => [ "base", "index", "mem", "val" ],
474 emit => '. and%M %SI3, %AM',
477 modified_flags => $status_flags
482 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
483 ins => [ "base", "index", "mem", "val" ],
484 emit => '. and%M %SB3, %AM',
487 modified_flags => $status_flags
492 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
493 ins => [ "base", "index", "mem", "left", "right" ],
495 emit => '. or%M %binop',
498 modified_flags => $status_flags
503 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
504 ins => [ "base", "index", "mem", "val" ],
505 emit => '. or%M %SI3, %AM',
508 modified_flags => $status_flags
513 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
514 ins => [ "base", "index", "mem", "val" ],
515 emit => '. or%M %SB3, %AM',
518 modified_flags => $status_flags
523 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
524 ins => [ "base", "index", "mem", "left", "right" ],
526 emit => '. xor%M %binop',
529 modified_flags => $status_flags
534 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
535 ins => [ "base", "index", "mem", "val" ],
536 emit => '. xor%M %SI3, %AM',
539 modified_flags => $status_flags
544 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
545 ins => [ "base", "index", "mem", "val" ],
546 emit => '. xor%M %SB3, %AM',
549 modified_flags => $status_flags
552 # not commutative operations
556 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4", "none", "flags" ] },
557 ins => [ "base", "index", "mem", "left", "right" ],
559 emit => '. sub%M %binop',
562 modified_flags => $status_flags
567 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
568 ins => [ "base", "index", "mem", "val" ],
569 emit => '. sub%M %SI3, %AM',
572 modified_flags => $status_flags
577 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
578 ins => [ "base", "index", "mem", "val" ],
579 emit => '. sub%M %SB3, %AM',
582 modified_flags => $status_flags
586 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 !in_r5" ] },
587 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
589 emit => '. sbb%M %binop',
592 modified_flags => $status_flags
596 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
597 ins => [ "left", "right" ],
601 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
602 ins => [ "left", "right", "eflags" ],
607 state => "exc_pinned",
608 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
609 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
610 outs => [ "div_res", "mod_res", "M" ],
611 am => "source,ternary",
612 emit => ". idiv%M %unop5",
615 modified_flags => $status_flags
620 state => "exc_pinned",
621 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
622 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
623 outs => [ "div_res", "mod_res", "M" ],
624 am => "source,ternary",
625 emit => ". div%M %unop5",
628 modified_flags => $status_flags
633 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
634 ins => [ "left", "right" ],
635 emit => '. shl %SB1, %S0',
638 modified_flags => $status_flags
643 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
644 ins => [ "base", "index", "mem", "count" ],
645 emit => '. shl%M %SB3, %AM',
648 modified_flags => $status_flags
652 cmp_attr => "return 1;",
653 # value, cnt, dependency
659 # see ShrD about the strange out constraint
660 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
661 ins => [ "left_high", "left_low", "right" ],
662 emit => ". shld%M %SB2, %S1, %S0\n".
667 modified_flags => $status_flags
671 cmp_attr => "return 1;",
677 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
678 ins => [ "val", "count" ],
679 emit => '. shr %SB1, %S0',
682 modified_flags => $status_flags
687 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
688 ins => [ "base", "index", "mem", "count" ],
689 emit => '. shr%M %SB3, %AM',
692 modified_flags => $status_flags
696 cmp_attr => "return 1;",
697 # value, cnt, dependency
702 # What's going on with the out constraint here? We would like to write
703 # "in_r2" and be done. However in firm we only support should_be_same
704 # constraints at the moment. Which means they could be non-fullfilled in
705 # some cases. Now when all values happen to live through the node, out
706 # is ecx and in_r2 not ecx, then we're screwed. Because in this case we
707 # need a 4th Register.
709 # The best solution for this is extending the register allocator to support
710 # must_be_same constraints which create a copy when the in_r2 value
711 # lives through (this ensures that we have the 4th register in the cases
712 # when we need it and can always fix the situation).
714 # For now I'm doing this ultra ugly !in hack which allocates 4 registers
715 # and creates an extra mov
717 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
718 ins => [ "left_high", "left_low", "right" ],
719 emit => ". shrd%M %SB2, %S1, %S0\n".
724 modified_flags => $status_flags
728 cmp_attr => "return 1;",
734 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
735 ins => [ "val", "count" ],
736 emit => '. sar %SB1, %S0',
739 modified_flags => $status_flags
744 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
745 ins => [ "base", "index", "mem", "count" ],
746 emit => '. sar%M %SB3, %AM',
749 modified_flags => $status_flags
753 cmp_attr => "return 1;",
754 # value, cnt, dependency
760 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
761 ins => [ "val", "count" ],
762 emit => '. ror %SB1, %S0',
765 modified_flags => $status_flags
770 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
771 ins => [ "base", "index", "mem", "count" ],
772 emit => '. ror%M %SB3, %AM',
775 modified_flags => $status_flags
780 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
781 ins => [ "val", "count" ],
782 emit => '. rol %SB1, %S0',
785 modified_flags => $status_flags
790 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
791 ins => [ "base", "index", "mem", "count" ],
792 emit => '. rol%M %SB3, %AM',
795 modified_flags => $status_flags
802 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
807 modified_flags => $status_flags
812 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
813 ins => [ "base", "index", "mem" ],
814 emit => '. neg%M %AM',
817 modified_flags => $status_flags
822 reg_req => { in => [ "gp", "gp" ], out => [ "in_r1", "gp" ] },
823 outs => [ "low_res", "high_res" ],
825 modified_flags => $status_flags
830 cmp_attr => "return 1;",
836 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
840 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
845 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
846 ins => [ "base", "index", "mem" ],
847 emit => '. inc%M %AM',
850 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
855 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
859 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
864 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
865 ins => [ "base", "index", "mem" ],
866 emit => '. dec%M %AM',
869 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
874 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
883 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
884 ins => [ "base", "index", "mem" ],
885 emit => '. not%M %AM',
894 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
895 ins => [ "base", "index", "mem", "left", "right" ],
896 outs => [ "eflags" ],
897 am => "source,binary",
898 emit => '. cmp%M %binop',
899 attr => "int ins_permuted, int cmp_unsigned",
900 init_attr => "attr->data.ins_permuted = ins_permuted;\n".
901 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
905 modified_flags => $status_flags
910 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
911 ins => [ "base", "index", "mem", "left", "right" ],
912 outs => [ "eflags" ],
913 am => "source,binary",
914 emit => '. cmpb %binop',
915 attr => "int ins_permuted, int cmp_unsigned",
916 init_attr => "attr->data.ins_permuted = ins_permuted;\n".
917 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
921 modified_flags => $status_flags
926 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
927 ins => [ "base", "index", "mem", "left", "right" ],
928 outs => [ "eflags" ],
929 am => "source,binary",
930 emit => '. test%M %binop',
931 attr => "int ins_permuted, int cmp_unsigned",
932 init_attr => "attr->data.ins_permuted = ins_permuted;\n".
933 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
937 modified_flags => $status_flags
942 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
943 ins => [ "base", "index", "mem", "left", "right" ],
944 outs => [ "eflags" ],
945 am => "source,binary",
946 emit => '. testb %binop',
947 attr => "int ins_permuted, int cmp_unsigned",
948 init_attr => "attr->data.ins_permuted = ins_permuted;\n".
949 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
953 modified_flags => $status_flags
958 reg_req => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
960 attr => "pn_Cmp pnc",
961 init_attr => "attr->pn_code = pnc;\nset_ia32_ls_mode(res, mode_Bu);\n",
962 emit => '. set%CMP0 %DB0',
970 # (note: leave the false,true order intact to make it compatible with other
972 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4 in_r5" ] },
973 ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
974 am => "source,binary",
975 attr => "int ins_permuted, pn_Cmp pn_code",
976 init_attr => "attr->pn_code = pn_code;\n".
977 "attr->data.ins_permuted = ins_permuted;",
986 reg_req => { in => [ "eflags" ], out => [ "none", "none" ] },
988 outs => [ "false", "true" ],
989 attr => "pn_Cmp pnc",
990 init_attr => "attr->pn_code = pnc;",
992 units => [ "BRANCH" ],
998 reg_req => { in => [ "gp" ], out => [ "none" ] },
1000 units => [ "BRANCH" ],
1002 modified_flags => $status_flags
1008 reg_req => { in => [ "gp" ] },
1009 emit => '. jmp *%S0',
1010 units => [ "BRANCH" ],
1017 reg_req => { out => [ "gp" ] },
1019 attr => "ir_entity *symconst, int symconst_sign, long offset",
1020 attr_type => "ia32_immediate_attr_t",
1022 # depends on the const and is set in ia32_transform
1023 # modified_flags => $status_flags
1030 reg_req => { out => [ "gp_UKNWN" ] },
1040 reg_req => { out => [ "vfp_UKNWN" ] },
1044 attr_type => "ia32_x87_attr_t",
1051 reg_req => { out => [ "xmm_UKNWN" ] },
1061 reg_req => { out => [ "gp_NOREG" ] },
1071 reg_req => { out => [ "vfp_NOREG" ] },
1075 attr_type => "ia32_x87_attr_t",
1082 reg_req => { out => [ "xmm_NOREG" ] },
1092 reg_req => { out => [ "fp_cw" ] },
1096 modified_flags => $fpcw_flags
1102 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1103 ins => [ "base", "index", "mem" ],
1105 emit => ". fldcw %AM",
1108 modified_flags => $fpcw_flags
1114 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1115 ins => [ "base", "index", "mem", "fpcw" ],
1117 emit => ". fnstcw %AM",
1123 # we should not rematrialize this node. It has very strict constraints.
1124 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1125 ins => [ "val", "globbered" ],
1133 # Note that we add additional latency values depending on address mode, so a
1134 # lateny of 0 for load is correct
1138 state => "exc_pinned",
1139 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1140 ins => [ "base", "index", "mem" ],
1141 outs => [ "res", "M" ],
1143 emit => ". mov%SE%ME%.l %AM, %D0",
1149 cmp_attr => "return 1;",
1150 outs => [ "res", "M" ],
1156 cmp_attr => "return 1;",
1157 state => "exc_pinned",
1164 state => "exc_pinned",
1165 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1166 ins => [ "base", "index", "mem", "val" ],
1167 emit => '. mov%M %SI3, %AM',
1175 state => "exc_pinned",
1176 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1177 ins => [ "base", "index", "mem", "val" ],
1178 emit => '. mov%M %SB3, %AM',
1186 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1187 ins => [ "base", "index" ],
1188 emit => '. leal %AM, %D0',
1192 # well this isn't true for Lea, but we often transform Lea back to Add, Inc
1193 # or Dec, so we set the flag
1194 modified_flags => 1,
1198 reg_req => { in => [ "gp", "gp", "none", "gp", "esp" ], out => [ "esp", "none" ] },
1199 ins => [ "base", "index", "mem", "val", "stack" ],
1200 emit => '. push%M %unop3',
1201 outs => [ "stack:I|S", "M" ],
1202 am => "source,binary",
1208 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1209 emit => '. pop%M %DAM1',
1210 outs => [ "stack:I|S", "res", "M" ],
1211 ins => [ "base", "index", "mem", "stack" ],
1213 latency => 3, # Pop is more expensive than Push on Athlon
1218 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1220 outs => [ "frame:I", "stack:I|S", "M" ],
1226 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1228 outs => [ "frame:I", "stack:I|S" ],
1236 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1237 ins => [ "base", "index", "mem", "stack", "size" ],
1238 am => "source,binary",
1239 emit => '. addl %binop',
1240 outs => [ "stack:S", "M" ],
1242 modified_flags => $status_flags
1248 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1249 ins => [ "base", "index", "mem", "stack", "size" ],
1250 am => "source,binary",
1251 emit => ". subl %binop\n".
1252 ". movl %%esp, %D1",
1253 outs => [ "stack:I|S", "addr", "M" ],
1255 modified_flags => $status_flags
1260 reg_req => { out => [ "gp" ] },
1265 #-----------------------------------------------------------------------------#
1266 # _____ _____ ______ __ _ _ _ #
1267 # / ____/ ____| ____| / _| | | | | | #
1268 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1269 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1270 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1271 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1272 #-----------------------------------------------------------------------------#
1276 reg_req => { out => [ "xmm" ] },
1277 emit => '. xorp%XSD %D0, %D0',
1283 # commutative operations
1287 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1288 ins => [ "base", "index", "mem", "left", "right" ],
1289 am => "source,binary",
1290 emit => '. add%XXM %binop',
1298 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1299 ins => [ "base", "index", "mem", "left", "right" ],
1300 am => "source,binary",
1301 emit => '. mul%XXM %binop',
1309 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1310 ins => [ "base", "index", "mem", "left", "right" ],
1311 am => "source,binary",
1312 emit => '. max%XXM %binop',
1320 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1321 ins => [ "base", "index", "mem", "left", "right" ],
1322 am => "source,binary",
1323 emit => '. min%XXM %binop',
1331 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1332 ins => [ "base", "index", "mem", "left", "right" ],
1333 am => "source,binary",
1334 emit => '. andp%XSD %binop',
1342 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1343 ins => [ "base", "index", "mem", "left", "right" ],
1344 am => "source,binary",
1345 emit => '. orp%XSD %binop',
1352 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1353 ins => [ "base", "index", "mem", "left", "right" ],
1354 am => "source,binary",
1355 emit => '. xorp%XSD %binop',
1361 # not commutative operations
1365 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1366 ins => [ "base", "index", "mem", "left", "right" ],
1367 am => "source,binary",
1368 emit => '. andnp%XSD %binop',
1376 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1377 ins => [ "base", "index", "mem", "left", "right" ],
1378 am => "source,binary",
1379 emit => '. sub%XXM %binop',
1387 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1388 ins => [ "base", "index", "mem", "left", "right" ],
1389 am => "source,binary",
1390 outs => [ "res", "M" ],
1391 emit => '. div%XXM %binop',
1400 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1401 ins => [ "base", "index", "mem", "left", "right" ],
1402 outs => [ "flags" ],
1403 am => "source,binary",
1404 attr => "int ins_permuted",
1405 init_attr => "attr->data.ins_permuted = ins_permuted;",
1406 emit => ' .ucomi%XXM %binop',
1409 mode => $mode_flags,
1410 modified_flags => 1,
1417 state => "exc_pinned",
1418 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1419 ins => [ "base", "index", "mem" ],
1420 emit => '. mov%XXM %AM, %D0',
1421 attr => "ir_mode *load_mode",
1422 init_attr => "attr->ls_mode = load_mode;",
1423 outs => [ "res", "M" ],
1430 state => "exc_pinned",
1431 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1432 ins => [ "base", "index", "mem", "val" ],
1433 emit => '. mov%XXM %S3, %AM',
1441 state => "exc_pinned",
1442 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1443 ins => [ "base", "index", "mem", "val" ],
1444 emit => '. mov%XXM %S3, %AM',
1452 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1453 ins => [ "base", "index", "mem", "val" ],
1454 am => "source,unary",
1455 emit => '. cvtsi2ss %unop3, %D0',
1463 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1464 ins => [ "base", "index", "mem", "val" ],
1465 am => "source,unary",
1466 emit => '. cvtsi2sd %unop3, %D0',
1475 cmp_attr => "return 1;",
1481 cmp_attr => "return 1;",
1490 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1491 outs => [ "DST", "SRC", "CNT", "M" ],
1493 # we don't care about this flag, so no need to mark this node
1494 # modified_flags => [ "DF" ]
1500 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1501 outs => [ "DST", "SRC", "M" ],
1503 # we don't care about this flag, so no need to mark this node
1504 # modified_flags => [ "DF" ]
1510 state => "exc_pinned",
1511 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1512 ins => [ "base", "index", "mem", "val" ],
1513 am => "source,unary",
1515 attr => "ir_mode *smaller_mode",
1516 init_attr => "attr->ls_mode = smaller_mode;",
1521 state => "exc_pinned",
1522 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1523 ins => [ "base", "index", "mem", "val" ],
1524 am => "source,unary",
1526 attr => "ir_mode *smaller_mode",
1527 init_attr => "attr->ls_mode = smaller_mode;",
1532 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
1533 ins => [ "base", "index", "mem", "val" ],
1534 am => "source,unary",
1541 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1542 ins => [ "base", "index", "mem", "val" ],
1543 am => "source,unary",
1550 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1551 ins => [ "base", "index", "mem", "val" ],
1552 am => "source,unary",
1558 #----------------------------------------------------------#
1560 # (_) | | | | / _| | | | #
1561 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1562 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1563 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1564 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1566 # _ __ ___ __| | ___ ___ #
1567 # | '_ \ / _ \ / _` |/ _ \/ __| #
1568 # | | | | (_) | (_| | __/\__ \ #
1569 # |_| |_|\___/ \__,_|\___||___/ #
1570 #----------------------------------------------------------#
1572 # spilling disabled for all float nodes for now, because the fpcw handler
1573 # runs before spilling and we might end up with wrong fpcw then
1577 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1578 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1579 am => "source,binary",
1583 attr_type => "ia32_x87_attr_t",
1588 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1589 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1590 am => "source,binary",
1594 attr_type => "ia32_x87_attr_t",
1599 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1600 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1601 am => "source,binary",
1605 attr_type => "ia32_x87_attr_t",
1609 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1610 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1611 am => "source,binary",
1612 outs => [ "res", "M" ],
1615 attr_type => "ia32_x87_attr_t",
1619 reg_req => { in => [ "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1620 ins => [ "left", "right", "fpcw" ],
1624 attr_type => "ia32_x87_attr_t",
1629 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1634 attr_type => "ia32_x87_attr_t",
1639 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1644 attr_type => "ia32_x87_attr_t",
1647 # virtual Load and Store
1651 state => "exc_pinned",
1652 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1653 ins => [ "base", "index", "mem" ],
1654 outs => [ "res", "M" ],
1655 attr => "ir_mode *load_mode",
1656 init_attr => "attr->attr.ls_mode = load_mode;",
1659 attr_type => "ia32_x87_attr_t",
1664 state => "exc_pinned",
1665 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1666 ins => [ "base", "index", "mem", "val" ],
1667 attr => "ir_mode *store_mode",
1668 init_attr => "attr->attr.ls_mode = store_mode;",
1672 attr_type => "ia32_x87_attr_t",
1678 state => "exc_pinned",
1679 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1680 outs => [ "res", "M" ],
1681 ins => [ "base", "index", "mem" ],
1684 attr_type => "ia32_x87_attr_t",
1688 cmp_attr => "return 1;",
1689 outs => [ "res", "M" ],
1694 state => "exc_pinned",
1695 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1696 ins => [ "base", "index", "mem", "val", "fpcw" ],
1700 attr_type => "ia32_x87_attr_t",
1704 cmp_attr => "return 1;",
1705 state => "exc_pinned",
1715 reg_req => { out => [ "vfp" ] },
1719 attr_type => "ia32_x87_attr_t",
1724 reg_req => { out => [ "vfp" ] },
1728 attr_type => "ia32_x87_attr_t",
1733 reg_req => { out => [ "vfp" ] },
1737 attr_type => "ia32_x87_attr_t",
1742 reg_req => { out => [ "vfp" ] },
1746 attr_type => "ia32_x87_attr_t",
1751 reg_req => { out => [ "vfp" ] },
1755 attr_type => "ia32_x87_attr_t",
1760 reg_req => { out => [ "vfp" ] },
1764 attr_type => "ia32_x87_attr_t",
1769 reg_req => { out => [ "vfp" ] },
1773 attr_type => "ia32_x87_attr_t",
1779 # we can't allow to rematerialize this node so we don't have
1780 # accidently produce Phi(Fucom, Fucom(ins_permuted))
1782 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1783 ins => [ "left", "right" ],
1784 outs => [ "flags" ],
1785 attr => "int ins_permuted",
1786 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1789 attr_type => "ia32_x87_attr_t",
1795 reg_req => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
1796 ins => [ "left", "right" ],
1797 outs => [ "flags" ],
1798 attr => "int ins_permuted",
1799 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1802 attr_type => "ia32_x87_attr_t",
1808 reg_req => { in => [ "vfp" ], out => [ "eax" ] },
1810 outs => [ "flags" ],
1811 attr => "int ins_permuted",
1812 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1815 attr_type => "ia32_x87_attr_t",
1821 reg_req => { in => [ "eax" ], out => [ "eflags" ] },
1823 outs => [ "flags" ],
1826 mode => $mode_flags,
1829 #------------------------------------------------------------------------#
1830 # ___ _____ __ _ _ _ #
1831 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1832 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1833 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1834 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1835 #------------------------------------------------------------------------#
1837 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1838 # are swapped, we work this around in the emitter...
1842 rd_constructor => "NONE",
1844 emit => '. fadd%XM %x87_binop',
1845 attr_type => "ia32_x87_attr_t",
1850 rd_constructor => "NONE",
1852 emit => '. faddp%XM %x87_binop',
1853 attr_type => "ia32_x87_attr_t",
1858 rd_constructor => "NONE",
1860 emit => '. fmul%XM %x87_binop',
1861 attr_type => "ia32_x87_attr_t",
1866 rd_constructor => "NONE",
1868 emit => '. fmulp%XM %x87_binop',,
1869 attr_type => "ia32_x87_attr_t",
1874 rd_constructor => "NONE",
1876 emit => '. fsub%XM %x87_binop',
1877 attr_type => "ia32_x87_attr_t",
1882 rd_constructor => "NONE",
1884 # see note about gas bugs
1885 emit => '. fsubrp%XM %x87_binop',
1886 attr_type => "ia32_x87_attr_t",
1891 rd_constructor => "NONE",
1894 emit => '. fsubr%XM %x87_binop',
1895 attr_type => "ia32_x87_attr_t",
1900 rd_constructor => "NONE",
1903 # see note about gas bugs
1904 emit => '. fsubp%XM %x87_binop',
1905 attr_type => "ia32_x87_attr_t",
1910 rd_constructor => "NONE",
1913 attr_type => "ia32_x87_attr_t",
1916 # this node is just here, to keep the simulator running
1917 # we can omit this when a fprem simulation function exists
1920 rd_constructor => "NONE",
1923 attr_type => "ia32_x87_attr_t",
1928 rd_constructor => "NONE",
1930 emit => '. fdiv%XM %x87_binop',
1931 attr_type => "ia32_x87_attr_t",
1936 rd_constructor => "NONE",
1938 # see note about gas bugs
1939 emit => '. fdivrp%XM %x87_binop',
1940 attr_type => "ia32_x87_attr_t",
1945 rd_constructor => "NONE",
1947 emit => '. fdivr%XM %x87_binop',
1948 attr_type => "ia32_x87_attr_t",
1953 rd_constructor => "NONE",
1955 # see note about gas bugs
1956 emit => '. fdivp%XM %x87_binop',
1957 attr_type => "ia32_x87_attr_t",
1962 rd_constructor => "NONE",
1965 attr_type => "ia32_x87_attr_t",
1970 rd_constructor => "NONE",
1973 attr_type => "ia32_x87_attr_t",
1976 # x87 Load and Store
1979 rd_constructor => "NONE",
1980 op_flags => "R|L|F",
1981 state => "exc_pinned",
1983 emit => '. fld%XM %AM',
1984 attr_type => "ia32_x87_attr_t",
1988 rd_constructor => "NONE",
1989 op_flags => "R|L|F",
1990 state => "exc_pinned",
1992 emit => '. fst%XM %AM',
1994 attr_type => "ia32_x87_attr_t",
1998 rd_constructor => "NONE",
1999 op_flags => "R|L|F",
2000 state => "exc_pinned",
2002 emit => '. fstp%XM %AM',
2004 attr_type => "ia32_x87_attr_t",
2011 rd_constructor => "NONE",
2013 emit => '. fild%M %AM',
2014 attr_type => "ia32_x87_attr_t",
2019 state => "exc_pinned",
2020 rd_constructor => "NONE",
2022 emit => '. fist%M %AM',
2024 attr_type => "ia32_x87_attr_t",
2029 state => "exc_pinned",
2030 rd_constructor => "NONE",
2032 emit => '. fistp%M %AM',
2034 attr_type => "ia32_x87_attr_t",
2040 op_flags => "R|c|K",
2042 reg_req => { out => [ "vfp" ] },
2044 attr_type => "ia32_x87_attr_t",
2048 op_flags => "R|c|K",
2050 reg_req => { out => [ "vfp" ] },
2052 attr_type => "ia32_x87_attr_t",
2056 op_flags => "R|c|K",
2058 reg_req => { out => [ "vfp" ] },
2060 attr_type => "ia32_x87_attr_t",
2064 op_flags => "R|c|K",
2066 reg_req => { out => [ "vfp" ] },
2068 attr_type => "ia32_x87_attr_t",
2072 op_flags => "R|c|K",
2074 reg_req => { out => [ "vfp" ] },
2076 attr_type => "ia32_x87_attr_t",
2080 op_flags => "R|c|K",
2082 reg_req => { out => [ "vfp" ] },
2083 emit => '. fldll2t',
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 # Note that it is NEVER allowed to do CSE on these nodes
2097 # Moreover, note the virtual register requierements!
2102 cmp_attr => "return 1;",
2103 emit => '. fxch %X0',
2104 attr_type => "ia32_x87_attr_t",
2111 cmp_attr => "return 1;",
2112 emit => '. fld %X0',
2113 attr_type => "ia32_x87_attr_t",
2119 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2120 cmp_attr => "return 1;",
2121 emit => '. fld %X0',
2122 attr_type => "ia32_x87_attr_t",
2128 cmp_attr => "return 1;",
2129 emit => '. fstp %X0',
2130 attr_type => "ia32_x87_attr_t",
2137 cmp_attr => "return 1;",
2138 emit => '. ffreep %X0',
2139 attr_type => "ia32_x87_attr_t",
2146 cmp_attr => "return 1;",
2148 attr_type => "ia32_x87_attr_t",
2155 cmp_attr => "return 1;",
2157 attr_type => "ia32_x87_attr_t",
2165 emit => ". fucom %X1\n".
2167 attr_type => "ia32_x87_attr_t",
2172 emit => ". fucomp %X1\n".
2174 attr_type => "ia32_x87_attr_t",
2179 emit => ". fucompp\n".
2181 attr_type => "ia32_x87_attr_t",
2186 emit => '. fucomi %X1',
2187 attr_type => "ia32_x87_attr_t",
2192 emit => '. fucompi %X1',
2193 attr_type => "ia32_x87_attr_t",
2200 attr_type => "ia32_x87_attr_t",
2204 # -------------------------------------------------------------------------------- #
2205 # ____ ____ _____ _ _ #
2206 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2207 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2208 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2209 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2211 # -------------------------------------------------------------------------------- #
2214 # Spilling and reloading of SSE registers, hardcoded, not generated #
2218 state => "exc_pinned",
2219 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2220 emit => '. movdqu %D0, %AM',
2221 outs => [ "res", "M" ],
2227 state => "exc_pinned",
2228 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2229 ins => [ "base", "index", "mem", "val" ],
2230 emit => '. movdqu %binop',
2237 # Include the generated SIMD node specification written by the SIMD optimization
2238 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2239 unless ($return = do $my_script_name) {
2240 warn "couldn't parse $my_script_name: $@" if $@;
2241 warn "couldn't do $my_script_name: $!" unless defined $return;
2242 warn "couldn't run $my_script_name" unless $return;