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,unary") {
257 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_unary);";
258 } elsif($am eq "source,binary") {
259 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_binary);";
260 } elsif($am eq "dest,unary") {
261 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_unary);";
262 } elsif($am eq "dest,binary") {
263 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_binary);";
264 } elsif($am eq "dest,ternary") {
265 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_ternary);";
266 } elsif($am eq "source,ternary") {
267 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_ternary);";
268 } elsif($am eq "none") {
271 die("Invalid address mode '$am' specified on op $name");
276 $custom_init_attr_func = \&ia32_custom_init_attr;
279 ia32_attr_t => "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);",
281 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
282 "\tinit_ia32_x87_attributes(res);",
284 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
285 "\tinit_ia32_x87_attributes(res);".
286 "\tinit_ia32_asm_attributes(res);",
287 ia32_immediate_attr_t =>
288 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
289 "\tinit_ia32_immediate_attributes(res, symconst, symconst_sign, offset);"
293 ia32_attr_t => "ia32_compare_nodes_attr",
294 ia32_x87_attr_t => "ia32_compare_x87_attr",
295 ia32_asm_attr_t => "ia32_compare_asm_attr",
296 ia32_immediate_attr_t => "ia32_compare_immediate_attr",
302 $mode_xmm = "mode_E";
303 $mode_gp = "mode_Iu";
304 $mode_flags = "mode_Iu";
305 $mode_fpcw = "mode_fpcw";
306 $status_flags = [ "CF", "PF", "AF", "ZF", "SF", "OF" ];
307 $fpcw_flags = [ "FP_IM", "FP_DM", "FP_ZM", "FP_OM", "FP_UM", "FP_PM",
308 "FP_PC0", "FP_PC1", "FP_RC0", "FP_RC1", "FP_X" ];
316 reg_req => { out => [ "gp_NOREG" ] },
317 attr => "ir_entity *symconst, int symconst_sign, long offset",
318 attr_type => "ia32_immediate_attr_t",
326 out_arity => "variable",
327 attr_type => "ia32_asm_attr_t",
334 reg_req => { out => [ "gp" ] },
339 cmp_attr => "return 1;",
342 #-----------------------------------------------------------------#
345 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
346 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
347 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
348 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
351 #-----------------------------------------------------------------#
353 # commutative operations
357 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5", "none", "flags" ] },
358 ins => [ "base", "index", "mem", "left", "right" ],
359 emit => '. add%M %binop',
363 modified_flags => $status_flags
368 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
369 ins => [ "base", "index", "mem", "val" ],
370 emit => ". add%M %SI3, %AM",
373 modified_flags => $status_flags
378 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
379 ins => [ "base", "index", "mem", "val" ],
380 emit => ". add%M %SB3, %AM",
383 modified_flags => $status_flags
387 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 in_r5" ] },
388 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
389 emit => '. adc%M %binop',
393 modified_flags => $status_flags
398 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
399 ins => [ "left", "right" ],
403 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
404 ins => [ "left", "right", "eflags" ],
408 # we should not rematrialize this node. It produces 2 results and has
409 # very strict constrains
410 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
411 ins => [ "base", "index", "mem", "val_high", "val_low" ],
412 emit => '. mul%M %unop4',
413 outs => [ "EAX", "EDX", "M" ],
414 am => "source,binary",
417 modified_flags => $status_flags
421 # we should not rematrialize this node. It produces 2 results and has
422 # very strict constrains
424 cmp_attr => "return 1;",
425 outs => [ "EAX", "EDX", "M" ],
431 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
432 ins => [ "base", "index", "mem", "left", "right" ],
433 emit => '. imul%M %binop',
434 am => "source,binary",
438 modified_flags => $status_flags
443 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
444 ins => [ "base", "index", "mem", "val_high", "val_low" ],
445 emit => '. imul%M %unop4',
446 outs => [ "EAX", "EDX", "M" ],
447 am => "source,binary",
450 modified_flags => $status_flags
454 # we should not rematrialize this node. It produces 2 results and has
455 # very strict constrains
457 cmp_attr => "return 1;",
458 outs => [ "EAX", "EDX", "M" ],
464 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
465 ins => [ "base", "index", "mem", "left", "right" ],
467 emit => '. and%M %binop',
470 modified_flags => $status_flags
475 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
476 ins => [ "base", "index", "mem", "val" ],
477 emit => '. and%M %SI3, %AM',
480 modified_flags => $status_flags
485 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
486 ins => [ "base", "index", "mem", "val" ],
487 emit => '. and%M %SB3, %AM',
490 modified_flags => $status_flags
495 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
496 ins => [ "base", "index", "mem", "left", "right" ],
498 emit => '. or%M %binop',
501 modified_flags => $status_flags
506 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
507 ins => [ "base", "index", "mem", "val" ],
508 emit => '. or%M %SI3, %AM',
511 modified_flags => $status_flags
516 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
517 ins => [ "base", "index", "mem", "val" ],
518 emit => '. or%M %SB3, %AM',
521 modified_flags => $status_flags
526 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
527 ins => [ "base", "index", "mem", "left", "right" ],
529 emit => '. xor%M %binop',
532 modified_flags => $status_flags
537 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
538 ins => [ "base", "index", "mem", "val" ],
539 emit => '. xor%M %SI3, %AM',
542 modified_flags => $status_flags
547 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
548 ins => [ "base", "index", "mem", "val" ],
549 emit => '. xor%M %SB3, %AM',
552 modified_flags => $status_flags
555 # not commutative operations
559 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4", "none", "flags" ] },
560 ins => [ "base", "index", "mem", "left", "right" ],
562 emit => '. sub%M %binop',
565 modified_flags => $status_flags
570 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
571 ins => [ "base", "index", "mem", "val" ],
572 emit => '. sub%M %SI3, %AM',
575 modified_flags => $status_flags
580 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
581 ins => [ "base", "index", "mem", "val" ],
582 emit => '. sub%M %SB3, %AM',
585 modified_flags => $status_flags
589 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 !in_r5" ] },
590 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
592 emit => '. sbb%M %binop',
595 modified_flags => $status_flags
599 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
600 ins => [ "left", "right" ],
604 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
605 ins => [ "left", "right", "eflags" ],
610 state => "exc_pinned",
611 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
612 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
613 outs => [ "div_res", "mod_res", "M" ],
614 am => "source,ternary",
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 am => "source,ternary",
628 emit => ". div%M %unop5",
631 modified_flags => $status_flags
636 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
637 ins => [ "left", "right" ],
638 emit => '. shl %SB1, %S0',
641 modified_flags => $status_flags
646 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
647 ins => [ "base", "index", "mem", "count" ],
648 emit => '. shl%M %SB3, %AM',
651 modified_flags => $status_flags
655 cmp_attr => "return 1;",
656 # value, cnt, dependency
662 # see ShrD about the strange out constraint
663 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
664 ins => [ "left_high", "left_low", "right" ],
665 emit => ". shld%M %SB2, %S1, %S0\n".
670 modified_flags => $status_flags
674 cmp_attr => "return 1;",
680 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
681 ins => [ "val", "count" ],
682 emit => '. shr %SB1, %S0',
685 modified_flags => $status_flags
690 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
691 ins => [ "base", "index", "mem", "count" ],
692 emit => '. shr%M %SB3, %AM',
695 modified_flags => $status_flags
699 cmp_attr => "return 1;",
700 # value, cnt, dependency
705 # What's going on with the out constraint here? We would like to write
706 # "in_r2" and be done. However in firm we only support should_be_same
707 # constraints at the moment. Which means they could be non-fullfilled in
708 # some cases. Now when all values happen to live through the node, out
709 # is ecx and in_r2 not ecx, then we're screwed. Because in this case we
710 # need a 4th Register.
712 # The best solution for this is extending the register allocator to support
713 # must_be_same constraints which create a copy when the in_r2 value
714 # lives through (this ensures that we have the 4th register in the cases
715 # when we need it and can always fix the situation).
717 # For now I'm doing this ultra ugly !in hack which allocates 4 registers
718 # and creates an extra mov
720 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
721 ins => [ "left_high", "left_low", "right" ],
722 emit => ". shrd%M %SB2, %S1, %S0\n".
727 modified_flags => $status_flags
731 cmp_attr => "return 1;",
737 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
738 ins => [ "val", "count" ],
739 emit => '. sar %SB1, %S0',
742 modified_flags => $status_flags
747 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
748 ins => [ "base", "index", "mem", "count" ],
749 emit => '. sar%M %SB3, %AM',
752 modified_flags => $status_flags
756 cmp_attr => "return 1;",
757 # value, cnt, dependency
763 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
764 ins => [ "val", "count" ],
765 emit => '. ror %SB1, %S0',
768 modified_flags => $status_flags
773 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
774 ins => [ "base", "index", "mem", "count" ],
775 emit => '. ror%M %SB3, %AM',
778 modified_flags => $status_flags
783 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
784 ins => [ "val", "count" ],
785 emit => '. rol %SB1, %S0',
788 modified_flags => $status_flags
793 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
794 ins => [ "base", "index", "mem", "count" ],
795 emit => '. rol%M %SB3, %AM',
798 modified_flags => $status_flags
805 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
810 modified_flags => $status_flags
815 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
816 ins => [ "base", "index", "mem" ],
817 emit => '. neg%M %AM',
820 modified_flags => $status_flags
825 reg_req => { in => [ "gp", "gp" ], out => [ "in_r1", "gp" ] },
826 outs => [ "low_res", "high_res" ],
828 modified_flags => $status_flags
833 cmp_attr => "return 1;",
839 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
843 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
848 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
849 ins => [ "base", "index", "mem" ],
850 emit => '. inc%M %AM',
853 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
858 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
862 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
867 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
868 ins => [ "base", "index", "mem" ],
869 emit => '. dec%M %AM',
872 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
877 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
886 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
887 ins => [ "base", "index", "mem" ],
888 emit => '. not%M %AM',
897 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
898 ins => [ "base", "index", "mem", "left", "right" ],
899 outs => [ "eflags" ],
900 am => "source,binary",
901 emit => '. cmp%M %binop',
902 attr => "int flipped, int cmp_unsigned",
903 init_attr => "attr->data.cmp_flipped = flipped;\n".
904 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
908 modified_flags => $status_flags
913 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
914 ins => [ "base", "index", "mem", "left", "right" ],
915 outs => [ "eflags" ],
916 am => "source,binary",
917 emit => '. cmpb %binop',
918 attr => "int flipped, int cmp_unsigned",
919 init_attr => "attr->data.cmp_flipped = flipped;\n".
920 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
924 modified_flags => $status_flags
929 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
930 ins => [ "base", "index", "mem", "left", "right" ],
931 outs => [ "eflags" ],
932 am => "source,binary",
933 emit => '. test%M %binop',
934 attr => "int flipped, int cmp_unsigned",
935 init_attr => "attr->data.cmp_flipped = flipped;\n".
936 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
940 modified_flags => $status_flags
945 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
946 ins => [ "base", "index", "mem", "left", "right" ],
947 outs => [ "eflags" ],
948 am => "source,binary",
949 emit => '. testb %binop',
950 attr => "int flipped, int cmp_unsigned",
951 init_attr => "attr->data.cmp_flipped = flipped;\n".
952 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
956 modified_flags => $status_flags
961 reg_req => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
963 attr => "pn_Cmp pnc",
964 init_attr => "attr->pn_code = pnc;\nset_ia32_ls_mode(res, mode_Bu);\n",
965 emit => '. set%CMP0 %DB0',
973 # (note: leave the false,true order intact to make it compatible with other
975 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4 in_r5" ] },
976 ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
977 am => "source,binary",
978 attr => "int flipped, pn_Cmp pn_code",
979 init_attr => "attr->pn_code = pn_code;\n".
980 "attr->data.cmp_flipped = flipped;",
989 reg_req => { in => [ "eflags" ], out => [ "none", "none" ] },
991 outs => [ "false", "true" ],
992 attr => "pn_Cmp pnc",
993 init_attr => "attr->pn_code = pnc;",
995 units => [ "BRANCH" ],
1000 op_flags => "L|X|Y",
1001 reg_req => { in => [ "gp" ], out => [ "none" ] },
1003 units => [ "BRANCH" ],
1005 modified_flags => $status_flags
1011 reg_req => { in => [ "gp" ] },
1012 emit => '. jmp *%S0',
1013 units => [ "BRANCH" ],
1020 reg_req => { out => [ "gp" ] },
1022 attr => "ir_entity *symconst, int symconst_sign, long offset",
1023 attr_type => "ia32_immediate_attr_t",
1025 # depends on the const and is set in ia32_transform
1026 # modified_flags => $status_flags
1033 reg_req => { out => [ "gp_UKNWN" ] },
1043 reg_req => { out => [ "vfp_UKNWN" ] },
1047 attr_type => "ia32_x87_attr_t",
1054 reg_req => { out => [ "xmm_UKNWN" ] },
1064 reg_req => { out => [ "gp_NOREG" ] },
1074 reg_req => { out => [ "vfp_NOREG" ] },
1078 attr_type => "ia32_x87_attr_t",
1085 reg_req => { out => [ "xmm_NOREG" ] },
1095 reg_req => { out => [ "fp_cw" ] },
1099 modified_flags => $fpcw_flags
1105 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1106 ins => [ "base", "index", "mem" ],
1108 emit => ". fldcw %AM",
1111 modified_flags => $fpcw_flags
1117 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1118 ins => [ "base", "index", "mem", "fpcw" ],
1120 emit => ". fnstcw %AM",
1126 # we should not rematrialize this node. It has very strict constraints.
1127 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1128 ins => [ "val", "globbered" ],
1136 # Note that we add additional latency values depending on address mode, so a
1137 # lateny of 0 for load is correct
1141 state => "exc_pinned",
1142 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1143 ins => [ "base", "index", "mem" ],
1144 outs => [ "res", "M" ],
1146 emit => ". mov%SE%ME%.l %AM, %D0",
1152 cmp_attr => "return 1;",
1153 outs => [ "res", "M" ],
1159 cmp_attr => "return 1;",
1160 state => "exc_pinned",
1167 state => "exc_pinned",
1168 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1169 ins => [ "base", "index", "mem", "val" ],
1170 emit => '. mov%M %SI3, %AM',
1178 state => "exc_pinned",
1179 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1180 ins => [ "base", "index", "mem", "val" ],
1181 emit => '. mov%M %SB3, %AM',
1189 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1190 ins => [ "base", "index" ],
1191 emit => '. leal %AM, %D0',
1195 # well this isn't true for Lea, but we often transform Lea back to Add, Inc
1196 # or Dec, so we set the flag
1197 modified_flags => 1,
1201 reg_req => { in => [ "gp", "gp", "none", "gp", "esp" ], out => [ "esp", "none" ] },
1202 ins => [ "base", "index", "mem", "val", "stack" ],
1203 emit => '. push%M %unop3',
1204 outs => [ "stack:I|S", "M" ],
1205 am => "source,binary",
1211 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1212 emit => '. pop%M %DAM1',
1213 outs => [ "stack:I|S", "res", "M" ],
1214 ins => [ "base", "index", "mem", "stack" ],
1216 latency => 3, # Pop is more expensive than Push on Athlon
1221 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1223 outs => [ "frame:I", "stack:I|S", "M" ],
1229 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1231 outs => [ "frame:I", "stack:I|S" ],
1239 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1240 ins => [ "base", "index", "mem", "stack", "size" ],
1241 am => "source,binary",
1242 emit => '. addl %binop',
1243 outs => [ "stack:S", "M" ],
1245 modified_flags => $status_flags
1251 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1252 ins => [ "base", "index", "mem", "stack", "size" ],
1253 am => "source,binary",
1254 emit => ". subl %binop\n".
1255 ". movl %%esp, %D1",
1256 outs => [ "stack:I|S", "addr", "M" ],
1258 modified_flags => $status_flags
1263 reg_req => { out => [ "gp" ] },
1267 # the int instruction
1269 reg_req => { in => [ "gp" ], out => [ "none" ] },
1271 emit => '. int %SI0',
1273 cmp_attr => "return 1;",
1277 #-----------------------------------------------------------------------------#
1278 # _____ _____ ______ __ _ _ _ #
1279 # / ____/ ____| ____| / _| | | | | | #
1280 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1281 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1282 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1283 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1284 #-----------------------------------------------------------------------------#
1288 reg_req => { out => [ "xmm" ] },
1289 emit => '. xorp%XSD %D0, %D0',
1295 # commutative operations
1299 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1300 ins => [ "base", "index", "mem", "left", "right" ],
1301 am => "source,binary",
1302 emit => '. add%XXM %binop',
1310 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1311 ins => [ "base", "index", "mem", "left", "right" ],
1312 am => "source,binary",
1313 emit => '. mul%XXM %binop',
1321 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1322 ins => [ "base", "index", "mem", "left", "right" ],
1323 am => "source,binary",
1324 emit => '. max%XXM %binop',
1332 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1333 ins => [ "base", "index", "mem", "left", "right" ],
1334 am => "source,binary",
1335 emit => '. min%XXM %binop',
1343 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1344 ins => [ "base", "index", "mem", "left", "right" ],
1345 am => "source,binary",
1346 emit => '. andp%XSD %binop',
1354 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1355 ins => [ "base", "index", "mem", "left", "right" ],
1356 am => "source,binary",
1357 emit => '. orp%XSD %binop',
1364 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1365 ins => [ "base", "index", "mem", "left", "right" ],
1366 am => "source,binary",
1367 emit => '. xorp%XSD %binop',
1373 # not commutative operations
1377 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1378 ins => [ "base", "index", "mem", "left", "right" ],
1379 am => "source,binary",
1380 emit => '. andnp%XSD %binop',
1388 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1389 ins => [ "base", "index", "mem", "left", "right" ],
1390 am => "source,binary",
1391 emit => '. sub%XXM %binop',
1399 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1400 ins => [ "base", "index", "mem", "left", "right" ],
1401 am => "source,binary",
1402 outs => [ "res", "M" ],
1403 emit => '. div%XXM %binop',
1412 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1413 ins => [ "base", "index", "mem", "left", "right" ],
1414 outs => [ "flags" ],
1415 am => "source,binary",
1416 attr => "int flipped",
1417 init_attr => "attr->data.cmp_flipped = flipped;",
1418 emit => ' .ucomi%XXM %binop',
1421 mode => $mode_flags,
1422 modified_flags => 1,
1429 state => "exc_pinned",
1430 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1431 ins => [ "base", "index", "mem" ],
1432 emit => '. mov%XXM %AM, %D0',
1433 attr => "ir_mode *load_mode",
1434 init_attr => "attr->ls_mode = load_mode;",
1435 outs => [ "res", "M" ],
1442 state => "exc_pinned",
1443 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1444 ins => [ "base", "index", "mem", "val" ],
1445 emit => '. mov%XXM %S3, %AM',
1453 state => "exc_pinned",
1454 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1455 ins => [ "base", "index", "mem", "val" ],
1456 emit => '. mov%XXM %S3, %AM',
1464 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1465 ins => [ "base", "index", "mem", "val" ],
1466 am => "source,unary",
1467 emit => '. cvtsi2ss %unop3, %D0',
1475 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1476 ins => [ "base", "index", "mem", "val" ],
1477 am => "source,unary",
1478 emit => '. cvtsi2sd %unop3, %D0',
1487 cmp_attr => "return 1;",
1493 cmp_attr => "return 1;",
1502 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1503 outs => [ "DST", "SRC", "CNT", "M" ],
1505 # we don't care about this flag, so no need to mark this node
1506 # modified_flags => [ "DF" ]
1512 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1513 outs => [ "DST", "SRC", "M" ],
1515 # we don't care about this flag, so no need to mark this node
1516 # modified_flags => [ "DF" ]
1522 state => "exc_pinned",
1523 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1524 ins => [ "base", "index", "mem", "val" ],
1525 am => "source,unary",
1527 attr => "ir_mode *smaller_mode",
1528 init_attr => "attr->ls_mode = smaller_mode;",
1533 state => "exc_pinned",
1534 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1535 ins => [ "base", "index", "mem", "val" ],
1536 am => "source,unary",
1538 attr => "ir_mode *smaller_mode",
1539 init_attr => "attr->ls_mode = smaller_mode;",
1544 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
1545 ins => [ "base", "index", "mem", "val" ],
1546 am => "source,unary",
1553 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1554 ins => [ "base", "index", "mem", "val" ],
1555 am => "source,unary",
1562 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1563 ins => [ "base", "index", "mem", "val" ],
1564 am => "source,unary",
1570 #----------------------------------------------------------#
1572 # (_) | | | | / _| | | | #
1573 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1574 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1575 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1576 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1578 # _ __ ___ __| | ___ ___ #
1579 # | '_ \ / _ \ / _` |/ _ \/ __| #
1580 # | | | | (_) | (_| | __/\__ \ #
1581 # |_| |_|\___/ \__,_|\___||___/ #
1582 #----------------------------------------------------------#
1584 # spilling disabled for all float nodes for now, because the fpcw handler
1585 # runs before spilling and we might end up with wrong fpcw then
1589 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1590 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1591 am => "source,binary",
1595 attr_type => "ia32_x87_attr_t",
1600 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1601 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1602 am => "source,binary",
1606 attr_type => "ia32_x87_attr_t",
1611 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1612 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1613 am => "source,binary",
1617 attr_type => "ia32_x87_attr_t",
1621 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1622 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1623 am => "source,binary",
1624 outs => [ "res", "M" ],
1627 attr_type => "ia32_x87_attr_t",
1631 reg_req => { in => [ "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1632 ins => [ "left", "right", "fpcw" ],
1636 attr_type => "ia32_x87_attr_t",
1641 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1646 attr_type => "ia32_x87_attr_t",
1651 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1656 attr_type => "ia32_x87_attr_t",
1659 # virtual Load and Store
1663 state => "exc_pinned",
1664 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1665 ins => [ "base", "index", "mem" ],
1666 outs => [ "res", "M" ],
1667 attr => "ir_mode *load_mode",
1668 init_attr => "attr->attr.ls_mode = load_mode;",
1671 attr_type => "ia32_x87_attr_t",
1676 state => "exc_pinned",
1677 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1678 ins => [ "base", "index", "mem", "val" ],
1679 attr => "ir_mode *store_mode",
1680 init_attr => "attr->attr.ls_mode = store_mode;",
1684 attr_type => "ia32_x87_attr_t",
1690 state => "exc_pinned",
1691 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1692 outs => [ "res", "M" ],
1693 ins => [ "base", "index", "mem" ],
1696 attr_type => "ia32_x87_attr_t",
1700 cmp_attr => "return 1;",
1701 outs => [ "res", "M" ],
1706 state => "exc_pinned",
1707 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1708 ins => [ "base", "index", "mem", "val", "fpcw" ],
1712 attr_type => "ia32_x87_attr_t",
1716 cmp_attr => "return 1;",
1717 state => "exc_pinned",
1727 reg_req => { out => [ "vfp" ] },
1731 attr_type => "ia32_x87_attr_t",
1736 reg_req => { out => [ "vfp" ] },
1740 attr_type => "ia32_x87_attr_t",
1745 reg_req => { out => [ "vfp" ] },
1749 attr_type => "ia32_x87_attr_t",
1754 reg_req => { out => [ "vfp" ] },
1758 attr_type => "ia32_x87_attr_t",
1763 reg_req => { out => [ "vfp" ] },
1767 attr_type => "ia32_x87_attr_t",
1772 reg_req => { out => [ "vfp" ] },
1776 attr_type => "ia32_x87_attr_t",
1781 reg_req => { out => [ "vfp" ] },
1785 attr_type => "ia32_x87_attr_t",
1791 # we can't allow to rematerialize this node so we don't have
1792 # accidently produce Phi(Fucom, Fucom(flipped))
1794 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1795 ins => [ "left", "right" ],
1796 outs => [ "flags" ],
1797 attr => "int flipped",
1798 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1801 attr_type => "ia32_x87_attr_t",
1807 reg_req => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
1808 ins => [ "left", "right" ],
1809 outs => [ "flags" ],
1810 attr => "int flipped",
1811 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1814 attr_type => "ia32_x87_attr_t",
1820 reg_req => { in => [ "vfp" ], out => [ "eax" ] },
1822 outs => [ "flags" ],
1823 attr => "int flipped",
1824 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1827 attr_type => "ia32_x87_attr_t",
1833 reg_req => { in => [ "eax" ], out => [ "eflags" ] },
1835 outs => [ "flags" ],
1838 mode => $mode_flags,
1841 #------------------------------------------------------------------------#
1842 # ___ _____ __ _ _ _ #
1843 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1844 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1845 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1846 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1847 #------------------------------------------------------------------------#
1849 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1850 # are swapped, we work this around in the emitter...
1854 rd_constructor => "NONE",
1856 emit => '. fadd%XM %x87_binop',
1857 attr_type => "ia32_x87_attr_t",
1862 rd_constructor => "NONE",
1864 emit => '. faddp%XM %x87_binop',
1865 attr_type => "ia32_x87_attr_t",
1870 rd_constructor => "NONE",
1872 emit => '. fmul%XM %x87_binop',
1873 attr_type => "ia32_x87_attr_t",
1878 rd_constructor => "NONE",
1880 emit => '. fmulp%XM %x87_binop',,
1881 attr_type => "ia32_x87_attr_t",
1886 rd_constructor => "NONE",
1888 emit => '. fsub%XM %x87_binop',
1889 attr_type => "ia32_x87_attr_t",
1894 rd_constructor => "NONE",
1896 # see note about gas bugs
1897 emit => '. fsubrp%XM %x87_binop',
1898 attr_type => "ia32_x87_attr_t",
1903 rd_constructor => "NONE",
1906 emit => '. fsubr%XM %x87_binop',
1907 attr_type => "ia32_x87_attr_t",
1912 rd_constructor => "NONE",
1915 # see note about gas bugs
1916 emit => '. fsubp%XM %x87_binop',
1917 attr_type => "ia32_x87_attr_t",
1922 rd_constructor => "NONE",
1925 attr_type => "ia32_x87_attr_t",
1928 # this node is just here, to keep the simulator running
1929 # we can omit this when a fprem simulation function exists
1932 rd_constructor => "NONE",
1935 attr_type => "ia32_x87_attr_t",
1940 rd_constructor => "NONE",
1942 emit => '. fdiv%XM %x87_binop',
1943 attr_type => "ia32_x87_attr_t",
1948 rd_constructor => "NONE",
1950 # see note about gas bugs
1951 emit => '. fdivrp%XM %x87_binop',
1952 attr_type => "ia32_x87_attr_t",
1957 rd_constructor => "NONE",
1959 emit => '. fdivr%XM %x87_binop',
1960 attr_type => "ia32_x87_attr_t",
1965 rd_constructor => "NONE",
1967 # see note about gas bugs
1968 emit => '. fdivp%XM %x87_binop',
1969 attr_type => "ia32_x87_attr_t",
1974 rd_constructor => "NONE",
1977 attr_type => "ia32_x87_attr_t",
1982 rd_constructor => "NONE",
1985 attr_type => "ia32_x87_attr_t",
1988 # x87 Load and Store
1991 rd_constructor => "NONE",
1992 op_flags => "R|L|F",
1993 state => "exc_pinned",
1995 emit => '. fld%XM %AM',
1996 attr_type => "ia32_x87_attr_t",
2000 rd_constructor => "NONE",
2001 op_flags => "R|L|F",
2002 state => "exc_pinned",
2004 emit => '. fst%XM %AM',
2006 attr_type => "ia32_x87_attr_t",
2010 rd_constructor => "NONE",
2011 op_flags => "R|L|F",
2012 state => "exc_pinned",
2014 emit => '. fstp%XM %AM',
2016 attr_type => "ia32_x87_attr_t",
2023 rd_constructor => "NONE",
2025 emit => '. fild%M %AM',
2026 attr_type => "ia32_x87_attr_t",
2031 state => "exc_pinned",
2032 rd_constructor => "NONE",
2034 emit => '. fist%M %AM',
2036 attr_type => "ia32_x87_attr_t",
2041 state => "exc_pinned",
2042 rd_constructor => "NONE",
2044 emit => '. fistp%M %AM',
2046 attr_type => "ia32_x87_attr_t",
2052 op_flags => "R|c|K",
2054 reg_req => { out => [ "vfp" ] },
2056 attr_type => "ia32_x87_attr_t",
2060 op_flags => "R|c|K",
2062 reg_req => { out => [ "vfp" ] },
2064 attr_type => "ia32_x87_attr_t",
2068 op_flags => "R|c|K",
2070 reg_req => { out => [ "vfp" ] },
2072 attr_type => "ia32_x87_attr_t",
2076 op_flags => "R|c|K",
2078 reg_req => { out => [ "vfp" ] },
2080 attr_type => "ia32_x87_attr_t",
2084 op_flags => "R|c|K",
2086 reg_req => { out => [ "vfp" ] },
2088 attr_type => "ia32_x87_attr_t",
2092 op_flags => "R|c|K",
2094 reg_req => { out => [ "vfp" ] },
2095 emit => '. fldll2t',
2096 attr_type => "ia32_x87_attr_t",
2100 op_flags => "R|c|K",
2102 reg_req => { out => [ "vfp" ] },
2104 attr_type => "ia32_x87_attr_t",
2108 # Note that it is NEVER allowed to do CSE on these nodes
2109 # Moreover, note the virtual register requierements!
2114 cmp_attr => "return 1;",
2115 emit => '. fxch %X0',
2116 attr_type => "ia32_x87_attr_t",
2123 cmp_attr => "return 1;",
2124 emit => '. fld %X0',
2125 attr_type => "ia32_x87_attr_t",
2131 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2132 cmp_attr => "return 1;",
2133 emit => '. fld %X0',
2134 attr_type => "ia32_x87_attr_t",
2140 cmp_attr => "return 1;",
2141 emit => '. fstp %X0',
2142 attr_type => "ia32_x87_attr_t",
2149 cmp_attr => "return 1;",
2150 emit => '. ffreep %X0',
2151 attr_type => "ia32_x87_attr_t",
2158 cmp_attr => "return 1;",
2160 attr_type => "ia32_x87_attr_t",
2167 cmp_attr => "return 1;",
2169 attr_type => "ia32_x87_attr_t",
2177 emit => ". fucom %X1\n".
2179 attr_type => "ia32_x87_attr_t",
2184 emit => ". fucomp %X1\n".
2186 attr_type => "ia32_x87_attr_t",
2191 emit => ". fucompp\n".
2193 attr_type => "ia32_x87_attr_t",
2198 emit => '. fucomi %X1',
2199 attr_type => "ia32_x87_attr_t",
2204 emit => '. fucompi %X1',
2205 attr_type => "ia32_x87_attr_t",
2212 attr_type => "ia32_x87_attr_t",
2216 # -------------------------------------------------------------------------------- #
2217 # ____ ____ _____ _ _ #
2218 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2219 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2220 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2221 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2223 # -------------------------------------------------------------------------------- #
2226 # Spilling and reloading of SSE registers, hardcoded, not generated #
2230 state => "exc_pinned",
2231 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2232 emit => '. movdqu %D0, %AM',
2233 outs => [ "res", "M" ],
2239 state => "exc_pinned",
2240 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2241 ins => [ "base", "index", "mem", "val" ],
2242 emit => '. movdqu %binop',
2249 # Include the generated SIMD node specification written by the SIMD optimization
2250 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2251 unless ($return = do $my_script_name) {
2252 warn "couldn't parse $my_script_name: $@" if $@;
2253 warn "couldn't do $my_script_name: $!" unless defined $return;
2254 warn "couldn't run $my_script_name" unless $return;