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",
325 attr => "ident *asm_text, const ia32_asm_reg_t *register_map",
326 init_attr => "attr->asm_text = asm_text;\n".
327 "\tattr->register_map = register_map;\n",
335 reg_req => { out => [ "gp" ] },
340 cmp_attr => "return 1;",
343 #-----------------------------------------------------------------#
346 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
347 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
348 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
349 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
352 #-----------------------------------------------------------------#
354 # commutative operations
358 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5", "none", "flags" ] },
359 ins => [ "base", "index", "mem", "left", "right" ],
360 emit => '. add%M %binop',
364 modified_flags => $status_flags
369 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
370 ins => [ "base", "index", "mem", "val" ],
371 emit => ". add%M %SI3, %AM",
374 modified_flags => $status_flags
379 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
380 ins => [ "base", "index", "mem", "val" ],
381 emit => ". add%M %SB3, %AM",
384 modified_flags => $status_flags
388 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 in_r5" ] },
389 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
390 emit => '. adc%M %binop',
394 modified_flags => $status_flags
399 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
400 ins => [ "left", "right" ],
404 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
405 ins => [ "left", "right", "eflags" ],
409 # we should not rematrialize this node. It produces 2 results and has
410 # very strict constrains
411 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
412 ins => [ "base", "index", "mem", "val_high", "val_low" ],
413 emit => '. mul%M %unop4',
414 outs => [ "EAX", "EDX", "M" ],
415 am => "source,binary",
418 modified_flags => $status_flags
422 # we should not rematrialize this node. It produces 2 results and has
423 # very strict constrains
425 cmp_attr => "return 1;",
426 outs => [ "EAX", "EDX", "M" ],
432 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
433 ins => [ "base", "index", "mem", "left", "right" ],
434 emit => '. imul%M %binop',
435 am => "source,binary",
439 modified_flags => $status_flags
444 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
445 ins => [ "base", "index", "mem", "val_high", "val_low" ],
446 emit => '. imul%M %unop4',
447 outs => [ "EAX", "EDX", "M" ],
448 am => "source,binary",
451 modified_flags => $status_flags
455 # we should not rematrialize this node. It produces 2 results and has
456 # very strict constrains
458 cmp_attr => "return 1;",
459 outs => [ "EAX", "EDX", "M" ],
465 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
466 ins => [ "base", "index", "mem", "left", "right" ],
468 emit => '. and%M %binop',
471 modified_flags => $status_flags
476 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
477 ins => [ "base", "index", "mem", "val" ],
478 emit => '. and%M %SI3, %AM',
481 modified_flags => $status_flags
486 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
487 ins => [ "base", "index", "mem", "val" ],
488 emit => '. and%M %SB3, %AM',
491 modified_flags => $status_flags
496 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
497 ins => [ "base", "index", "mem", "left", "right" ],
499 emit => '. or%M %binop',
502 modified_flags => $status_flags
507 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
508 ins => [ "base", "index", "mem", "val" ],
509 emit => '. or%M %SI3, %AM',
512 modified_flags => $status_flags
517 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
518 ins => [ "base", "index", "mem", "val" ],
519 emit => '. or%M %SB3, %AM',
522 modified_flags => $status_flags
527 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
528 ins => [ "base", "index", "mem", "left", "right" ],
530 emit => '. xor%M %binop',
533 modified_flags => $status_flags
538 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
539 ins => [ "base", "index", "mem", "val" ],
540 emit => '. xor%M %SI3, %AM',
543 modified_flags => $status_flags
548 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
549 ins => [ "base", "index", "mem", "val" ],
550 emit => '. xor%M %SB3, %AM',
553 modified_flags => $status_flags
556 # not commutative operations
560 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4", "none", "flags" ] },
561 ins => [ "base", "index", "mem", "left", "right" ],
563 emit => '. sub%M %binop',
566 modified_flags => $status_flags
571 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
572 ins => [ "base", "index", "mem", "val" ],
573 emit => '. sub%M %SI3, %AM',
576 modified_flags => $status_flags
581 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
582 ins => [ "base", "index", "mem", "val" ],
583 emit => '. sub%M %SB3, %AM',
586 modified_flags => $status_flags
590 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 !in_r5" ] },
591 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
593 emit => '. sbb%M %binop',
596 modified_flags => $status_flags
600 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
601 ins => [ "left", "right" ],
605 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
606 ins => [ "left", "right", "eflags" ],
611 state => "exc_pinned",
612 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
613 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
614 outs => [ "div_res", "mod_res", "M" ],
615 am => "source,ternary",
616 emit => ". idiv%M %unop5",
619 modified_flags => $status_flags
624 state => "exc_pinned",
625 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
626 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
627 outs => [ "div_res", "mod_res", "M" ],
628 am => "source,ternary",
629 emit => ". div%M %unop5",
632 modified_flags => $status_flags
637 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
638 ins => [ "left", "right" ],
639 emit => '. shl %SB1, %S0',
642 modified_flags => $status_flags
647 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
648 ins => [ "base", "index", "mem", "count" ],
649 emit => '. shl%M %SB3, %AM',
652 modified_flags => $status_flags
656 cmp_attr => "return 1;",
657 # value, cnt, dependency
663 # see ShrD about the strange out constraint
664 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
665 ins => [ "left_high", "left_low", "right" ],
666 emit => ". shld%M %SB2, %S1, %S0\n".
671 modified_flags => $status_flags
675 cmp_attr => "return 1;",
681 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
682 ins => [ "val", "count" ],
683 emit => '. shr %SB1, %S0',
686 modified_flags => $status_flags
691 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
692 ins => [ "base", "index", "mem", "count" ],
693 emit => '. shr%M %SB3, %AM',
696 modified_flags => $status_flags
700 cmp_attr => "return 1;",
701 # value, cnt, dependency
706 # What's going on with the out constraint here? We would like to write
707 # "in_r2" and be done. However in firm we only support should_be_same
708 # constraints at the moment. Which means they could be non-fullfilled in
709 # some cases. Now when all values happen to live through the node, out
710 # is ecx and in_r2 not ecx, then we're screwed. Because in this case we
711 # need a 4th Register.
713 # The best solution for this is extending the register allocator to support
714 # must_be_same constraints which create a copy when the in_r2 value
715 # lives through (this ensures that we have the 4th register in the cases
716 # when we need it and can always fix the situation).
718 # For now I'm doing this ultra ugly !in hack which allocates 4 registers
719 # and creates an extra mov
721 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
722 ins => [ "left_high", "left_low", "right" ],
723 emit => ". shrd%M %SB2, %S1, %S0\n".
728 modified_flags => $status_flags
732 cmp_attr => "return 1;",
738 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
739 ins => [ "val", "count" ],
740 emit => '. sar %SB1, %S0',
743 modified_flags => $status_flags
748 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
749 ins => [ "base", "index", "mem", "count" ],
750 emit => '. sar%M %SB3, %AM',
753 modified_flags => $status_flags
757 cmp_attr => "return 1;",
758 # value, cnt, dependency
764 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
765 ins => [ "val", "count" ],
766 emit => '. ror %SB1, %S0',
769 modified_flags => $status_flags
774 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
775 ins => [ "base", "index", "mem", "count" ],
776 emit => '. ror%M %SB3, %AM',
779 modified_flags => $status_flags
784 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
785 ins => [ "val", "count" ],
786 emit => '. rol %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 => '. rol%M %SB3, %AM',
799 modified_flags => $status_flags
806 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
811 modified_flags => $status_flags
816 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
817 ins => [ "base", "index", "mem" ],
818 emit => '. neg%M %AM',
821 modified_flags => $status_flags
826 reg_req => { in => [ "gp", "gp" ], out => [ "in_r1", "gp" ] },
827 outs => [ "low_res", "high_res" ],
829 modified_flags => $status_flags
834 cmp_attr => "return 1;",
840 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
844 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
849 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
850 ins => [ "base", "index", "mem" ],
851 emit => '. inc%M %AM',
854 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
859 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
863 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
868 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
869 ins => [ "base", "index", "mem" ],
870 emit => '. dec%M %AM',
873 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
878 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
887 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
888 ins => [ "base", "index", "mem" ],
889 emit => '. not%M %AM',
898 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
899 ins => [ "base", "index", "mem", "left", "right" ],
900 outs => [ "eflags" ],
901 am => "source,binary",
902 emit => '. cmp%M %binop',
903 attr => "int ins_permuted, int cmp_unsigned",
904 init_attr => "attr->data.ins_permuted = ins_permuted;\n".
905 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
909 modified_flags => $status_flags
914 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
915 ins => [ "base", "index", "mem", "left", "right" ],
916 outs => [ "eflags" ],
917 am => "source,binary",
918 emit => '. cmpb %binop',
919 attr => "int ins_permuted, int cmp_unsigned",
920 init_attr => "attr->data.ins_permuted = ins_permuted;\n".
921 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
925 modified_flags => $status_flags
930 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
931 ins => [ "base", "index", "mem", "left", "right" ],
932 outs => [ "eflags" ],
933 am => "source,binary",
934 emit => '. test%M %binop',
935 attr => "int ins_permuted, int cmp_unsigned",
936 init_attr => "attr->data.ins_permuted = ins_permuted;\n".
937 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
941 modified_flags => $status_flags
946 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
947 ins => [ "base", "index", "mem", "left", "right" ],
948 outs => [ "eflags" ],
949 am => "source,binary",
950 emit => '. testb %binop',
951 attr => "int ins_permuted, int cmp_unsigned",
952 init_attr => "attr->data.ins_permuted = ins_permuted;\n".
953 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
957 modified_flags => $status_flags
962 reg_req => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
964 attr => "pn_Cmp pnc, int ins_permuted",
965 init_attr => "attr->pn_code = pnc;\n".
966 "attr->data.ins_permuted = ins_permuted;\n".
967 "\tset_ia32_ls_mode(res, mode_Bu);\n",
968 emit => '. set%CMP0 %DB0',
976 # (note: leave the false,true order intact to make it compatible with other
978 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4 in_r5" ] },
979 ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
980 am => "source,binary",
981 attr => "int ins_permuted, pn_Cmp pn_code",
982 init_attr => "attr->pn_code = pn_code;\n".
983 "attr->data.ins_permuted = ins_permuted;",
992 reg_req => { in => [ "eflags" ], out => [ "none", "none" ] },
994 outs => [ "false", "true" ],
995 attr => "pn_Cmp pnc",
996 init_attr => "attr->pn_code = pnc;",
998 units => [ "BRANCH" ],
1003 op_flags => "L|X|Y",
1004 reg_req => { in => [ "gp" ], out => [ "none" ] },
1006 units => [ "BRANCH" ],
1008 modified_flags => $status_flags
1014 reg_req => { in => [ "gp" ] },
1015 emit => '. jmp *%S0',
1016 units => [ "BRANCH" ],
1023 reg_req => { out => [ "gp" ] },
1025 attr => "ir_entity *symconst, int symconst_sign, long offset",
1026 attr_type => "ia32_immediate_attr_t",
1028 # depends on the const and is set in ia32_transform
1029 # modified_flags => $status_flags
1036 reg_req => { out => [ "gp_UKNWN" ] },
1046 reg_req => { out => [ "vfp_UKNWN" ] },
1050 attr_type => "ia32_x87_attr_t",
1057 reg_req => { out => [ "xmm_UKNWN" ] },
1067 reg_req => { out => [ "gp_NOREG" ] },
1077 reg_req => { out => [ "vfp_NOREG" ] },
1081 attr_type => "ia32_x87_attr_t",
1088 reg_req => { out => [ "xmm_NOREG" ] },
1098 reg_req => { out => [ "fp_cw" ] },
1102 modified_flags => $fpcw_flags
1108 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1109 ins => [ "base", "index", "mem" ],
1111 emit => ". fldcw %AM",
1114 modified_flags => $fpcw_flags
1120 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1121 ins => [ "base", "index", "mem", "fpcw" ],
1123 emit => ". fnstcw %AM",
1129 # we should not rematrialize this node. It has very strict constraints.
1130 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1131 ins => [ "val", "globbered" ],
1139 # Note that we add additional latency values depending on address mode, so a
1140 # lateny of 0 for load is correct
1144 state => "exc_pinned",
1145 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1146 ins => [ "base", "index", "mem" ],
1147 outs => [ "res", "M" ],
1149 emit => ". mov%SE%ME%.l %AM, %D0",
1155 cmp_attr => "return 1;",
1156 outs => [ "res", "M" ],
1162 cmp_attr => "return 1;",
1163 state => "exc_pinned",
1170 state => "exc_pinned",
1171 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1172 ins => [ "base", "index", "mem", "val" ],
1173 emit => '. mov%M %SI3, %AM',
1181 state => "exc_pinned",
1182 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1183 ins => [ "base", "index", "mem", "val" ],
1184 emit => '. mov%M %SB3, %AM',
1192 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1193 ins => [ "base", "index" ],
1194 emit => '. leal %AM, %D0',
1198 # well this isn't true for Lea, but we often transform Lea back to Add, Inc
1199 # or Dec, so we set the flag
1200 modified_flags => 1,
1204 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "esp", "none" ] },
1205 ins => [ "base", "index", "mem", "val", "stack" ],
1206 emit => '. push%M %unop4',
1207 outs => [ "stack:I|S", "M" ],
1208 am => "source,binary",
1214 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1215 emit => '. pop%M %DAM1',
1216 outs => [ "stack:I|S", "res", "M" ],
1217 ins => [ "base", "index", "mem", "stack" ],
1219 latency => 3, # Pop is more expensive than Push on Athlon
1224 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1226 outs => [ "frame:I", "stack:I|S", "M" ],
1232 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1234 outs => [ "frame:I", "stack:I|S" ],
1242 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1243 ins => [ "base", "index", "mem", "stack", "size" ],
1244 am => "source,binary",
1245 emit => '. addl %binop',
1246 outs => [ "stack:S", "M" ],
1248 modified_flags => $status_flags
1254 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1255 ins => [ "base", "index", "mem", "stack", "size" ],
1256 am => "source,binary",
1257 emit => ". subl %binop\n".
1258 ". movl %%esp, %D1",
1259 outs => [ "stack:I|S", "addr", "M" ],
1261 modified_flags => $status_flags
1266 reg_req => { out => [ "gp" ] },
1271 #-----------------------------------------------------------------------------#
1272 # _____ _____ ______ __ _ _ _ #
1273 # / ____/ ____| ____| / _| | | | | | #
1274 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1275 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1276 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1277 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1278 #-----------------------------------------------------------------------------#
1282 reg_req => { out => [ "xmm" ] },
1283 emit => '. xorp%XSD %D0, %D0',
1289 # commutative operations
1293 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1294 ins => [ "base", "index", "mem", "left", "right" ],
1295 am => "source,binary",
1296 emit => '. add%XXM %binop',
1304 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1305 ins => [ "base", "index", "mem", "left", "right" ],
1306 am => "source,binary",
1307 emit => '. mul%XXM %binop',
1315 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1316 ins => [ "base", "index", "mem", "left", "right" ],
1317 am => "source,binary",
1318 emit => '. max%XXM %binop',
1326 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1327 ins => [ "base", "index", "mem", "left", "right" ],
1328 am => "source,binary",
1329 emit => '. min%XXM %binop',
1337 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1338 ins => [ "base", "index", "mem", "left", "right" ],
1339 am => "source,binary",
1340 emit => '. andp%XSD %binop',
1348 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1349 ins => [ "base", "index", "mem", "left", "right" ],
1350 am => "source,binary",
1351 emit => '. orp%XSD %binop',
1358 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1359 ins => [ "base", "index", "mem", "left", "right" ],
1360 am => "source,binary",
1361 emit => '. xorp%XSD %binop',
1367 # not commutative operations
1371 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1372 ins => [ "base", "index", "mem", "left", "right" ],
1373 am => "source,binary",
1374 emit => '. andnp%XSD %binop',
1382 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1383 ins => [ "base", "index", "mem", "left", "right" ],
1384 am => "source,binary",
1385 emit => '. sub%XXM %binop',
1393 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1394 ins => [ "base", "index", "mem", "left", "right" ],
1395 am => "source,binary",
1396 outs => [ "res", "M" ],
1397 emit => '. div%XXM %binop',
1406 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1407 ins => [ "base", "index", "mem", "left", "right" ],
1408 outs => [ "flags" ],
1409 am => "source,binary",
1410 attr => "int ins_permuted",
1411 init_attr => "attr->data.ins_permuted = ins_permuted;",
1412 emit => ' .ucomi%XXM %binop',
1415 mode => $mode_flags,
1416 modified_flags => 1,
1423 state => "exc_pinned",
1424 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1425 ins => [ "base", "index", "mem" ],
1426 emit => '. mov%XXM %AM, %D0',
1427 attr => "ir_mode *load_mode",
1428 init_attr => "attr->ls_mode = load_mode;",
1429 outs => [ "res", "M" ],
1436 state => "exc_pinned",
1437 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1438 ins => [ "base", "index", "mem", "val" ],
1439 emit => '. mov%XXM %S3, %AM',
1447 state => "exc_pinned",
1448 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1449 ins => [ "base", "index", "mem", "val" ],
1450 emit => '. mov%XXM %S3, %AM',
1458 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1459 ins => [ "base", "index", "mem", "val" ],
1460 am => "source,unary",
1461 emit => '. cvtsi2ss %unop3, %D0',
1469 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1470 ins => [ "base", "index", "mem", "val" ],
1471 am => "source,unary",
1472 emit => '. cvtsi2sd %unop3, %D0',
1481 cmp_attr => "return 1;",
1487 cmp_attr => "return 1;",
1496 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1497 outs => [ "DST", "SRC", "CNT", "M" ],
1499 # we don't care about this flag, so no need to mark this node
1500 # modified_flags => [ "DF" ]
1506 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1507 outs => [ "DST", "SRC", "M" ],
1509 # we don't care about this flag, so no need to mark this node
1510 # modified_flags => [ "DF" ]
1516 state => "exc_pinned",
1517 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1518 ins => [ "base", "index", "mem", "val" ],
1519 am => "source,unary",
1521 attr => "ir_mode *smaller_mode",
1522 init_attr => "attr->ls_mode = smaller_mode;",
1527 state => "exc_pinned",
1528 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1529 ins => [ "base", "index", "mem", "val" ],
1530 am => "source,unary",
1532 attr => "ir_mode *smaller_mode",
1533 init_attr => "attr->ls_mode = smaller_mode;",
1538 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
1539 ins => [ "base", "index", "mem", "val" ],
1540 am => "source,unary",
1547 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1548 ins => [ "base", "index", "mem", "val" ],
1549 am => "source,unary",
1556 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1557 ins => [ "base", "index", "mem", "val" ],
1558 am => "source,unary",
1564 #----------------------------------------------------------#
1566 # (_) | | | | / _| | | | #
1567 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1568 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1569 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1570 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1572 # _ __ ___ __| | ___ ___ #
1573 # | '_ \ / _ \ / _` |/ _ \/ __| #
1574 # | | | | (_) | (_| | __/\__ \ #
1575 # |_| |_|\___/ \__,_|\___||___/ #
1576 #----------------------------------------------------------#
1578 # spilling disabled for all float nodes for now, because the fpcw handler
1579 # runs before spilling and we might end up with wrong fpcw then
1583 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1584 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1585 am => "source,binary",
1589 attr_type => "ia32_x87_attr_t",
1594 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1595 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1596 am => "source,binary",
1600 attr_type => "ia32_x87_attr_t",
1605 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1606 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1607 am => "source,binary",
1611 attr_type => "ia32_x87_attr_t",
1615 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1616 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1617 am => "source,binary",
1618 outs => [ "res", "M" ],
1621 attr_type => "ia32_x87_attr_t",
1625 reg_req => { in => [ "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1626 ins => [ "left", "right", "fpcw" ],
1630 attr_type => "ia32_x87_attr_t",
1635 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1640 attr_type => "ia32_x87_attr_t",
1645 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1650 attr_type => "ia32_x87_attr_t",
1653 # virtual Load and Store
1657 state => "exc_pinned",
1658 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1659 ins => [ "base", "index", "mem" ],
1660 outs => [ "res", "M" ],
1661 attr => "ir_mode *load_mode",
1662 init_attr => "attr->attr.ls_mode = load_mode;",
1665 attr_type => "ia32_x87_attr_t",
1670 state => "exc_pinned",
1671 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1672 ins => [ "base", "index", "mem", "val" ],
1673 attr => "ir_mode *store_mode",
1674 init_attr => "attr->attr.ls_mode = store_mode;",
1678 attr_type => "ia32_x87_attr_t",
1684 state => "exc_pinned",
1685 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1686 outs => [ "res", "M" ],
1687 ins => [ "base", "index", "mem" ],
1690 attr_type => "ia32_x87_attr_t",
1694 cmp_attr => "return 1;",
1695 outs => [ "res", "M" ],
1700 state => "exc_pinned",
1701 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1702 ins => [ "base", "index", "mem", "val", "fpcw" ],
1706 attr_type => "ia32_x87_attr_t",
1710 cmp_attr => "return 1;",
1711 state => "exc_pinned",
1721 reg_req => { out => [ "vfp" ] },
1725 attr_type => "ia32_x87_attr_t",
1730 reg_req => { out => [ "vfp" ] },
1734 attr_type => "ia32_x87_attr_t",
1739 reg_req => { out => [ "vfp" ] },
1743 attr_type => "ia32_x87_attr_t",
1748 reg_req => { out => [ "vfp" ] },
1752 attr_type => "ia32_x87_attr_t",
1757 reg_req => { out => [ "vfp" ] },
1761 attr_type => "ia32_x87_attr_t",
1766 reg_req => { out => [ "vfp" ] },
1770 attr_type => "ia32_x87_attr_t",
1775 reg_req => { out => [ "vfp" ] },
1779 attr_type => "ia32_x87_attr_t",
1785 # we can't allow to rematerialize this node so we don't have
1786 # accidently produce Phi(Fucom, Fucom(ins_permuted))
1788 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1789 ins => [ "left", "right" ],
1790 outs => [ "flags" ],
1791 attr => "int ins_permuted",
1792 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1795 attr_type => "ia32_x87_attr_t",
1801 reg_req => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
1802 ins => [ "left", "right" ],
1803 outs => [ "flags" ],
1804 attr => "int ins_permuted",
1805 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1808 attr_type => "ia32_x87_attr_t",
1814 reg_req => { in => [ "vfp" ], out => [ "eax" ] },
1816 outs => [ "flags" ],
1817 attr => "int ins_permuted",
1818 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1821 attr_type => "ia32_x87_attr_t",
1827 reg_req => { in => [ "eax" ], out => [ "eflags" ] },
1829 outs => [ "flags" ],
1832 mode => $mode_flags,
1835 #------------------------------------------------------------------------#
1836 # ___ _____ __ _ _ _ #
1837 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1838 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1839 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1840 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1841 #------------------------------------------------------------------------#
1843 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1844 # are swapped, we work this around in the emitter...
1848 rd_constructor => "NONE",
1850 emit => '. fadd%XM %x87_binop',
1851 attr_type => "ia32_x87_attr_t",
1856 rd_constructor => "NONE",
1858 emit => '. faddp%XM %x87_binop',
1859 attr_type => "ia32_x87_attr_t",
1864 rd_constructor => "NONE",
1866 emit => '. fmul%XM %x87_binop',
1867 attr_type => "ia32_x87_attr_t",
1872 rd_constructor => "NONE",
1874 emit => '. fmulp%XM %x87_binop',,
1875 attr_type => "ia32_x87_attr_t",
1880 rd_constructor => "NONE",
1882 emit => '. fsub%XM %x87_binop',
1883 attr_type => "ia32_x87_attr_t",
1888 rd_constructor => "NONE",
1890 # see note about gas bugs
1891 emit => '. fsubrp%XM %x87_binop',
1892 attr_type => "ia32_x87_attr_t",
1897 rd_constructor => "NONE",
1900 emit => '. fsubr%XM %x87_binop',
1901 attr_type => "ia32_x87_attr_t",
1906 rd_constructor => "NONE",
1909 # see note about gas bugs
1910 emit => '. fsubp%XM %x87_binop',
1911 attr_type => "ia32_x87_attr_t",
1916 rd_constructor => "NONE",
1919 attr_type => "ia32_x87_attr_t",
1922 # this node is just here, to keep the simulator running
1923 # we can omit this when a fprem simulation function exists
1926 rd_constructor => "NONE",
1929 attr_type => "ia32_x87_attr_t",
1934 rd_constructor => "NONE",
1936 emit => '. fdiv%XM %x87_binop',
1937 attr_type => "ia32_x87_attr_t",
1942 rd_constructor => "NONE",
1944 # see note about gas bugs
1945 emit => '. fdivrp%XM %x87_binop',
1946 attr_type => "ia32_x87_attr_t",
1951 rd_constructor => "NONE",
1953 emit => '. fdivr%XM %x87_binop',
1954 attr_type => "ia32_x87_attr_t",
1959 rd_constructor => "NONE",
1961 # see note about gas bugs
1962 emit => '. fdivp%XM %x87_binop',
1963 attr_type => "ia32_x87_attr_t",
1968 rd_constructor => "NONE",
1971 attr_type => "ia32_x87_attr_t",
1976 rd_constructor => "NONE",
1979 attr_type => "ia32_x87_attr_t",
1982 # x87 Load and Store
1985 rd_constructor => "NONE",
1986 op_flags => "R|L|F",
1987 state => "exc_pinned",
1989 emit => '. fld%XM %AM',
1990 attr_type => "ia32_x87_attr_t",
1994 rd_constructor => "NONE",
1995 op_flags => "R|L|F",
1996 state => "exc_pinned",
1998 emit => '. fst%XM %AM',
2000 attr_type => "ia32_x87_attr_t",
2004 rd_constructor => "NONE",
2005 op_flags => "R|L|F",
2006 state => "exc_pinned",
2008 emit => '. fstp%XM %AM',
2010 attr_type => "ia32_x87_attr_t",
2017 rd_constructor => "NONE",
2019 emit => '. fild%M %AM',
2020 attr_type => "ia32_x87_attr_t",
2025 state => "exc_pinned",
2026 rd_constructor => "NONE",
2028 emit => '. fist%M %AM',
2030 attr_type => "ia32_x87_attr_t",
2035 state => "exc_pinned",
2036 rd_constructor => "NONE",
2038 emit => '. fistp%M %AM',
2040 attr_type => "ia32_x87_attr_t",
2046 op_flags => "R|c|K",
2048 reg_req => { out => [ "vfp" ] },
2050 attr_type => "ia32_x87_attr_t",
2054 op_flags => "R|c|K",
2056 reg_req => { out => [ "vfp" ] },
2058 attr_type => "ia32_x87_attr_t",
2062 op_flags => "R|c|K",
2064 reg_req => { out => [ "vfp" ] },
2066 attr_type => "ia32_x87_attr_t",
2070 op_flags => "R|c|K",
2072 reg_req => { out => [ "vfp" ] },
2074 attr_type => "ia32_x87_attr_t",
2078 op_flags => "R|c|K",
2080 reg_req => { out => [ "vfp" ] },
2082 attr_type => "ia32_x87_attr_t",
2086 op_flags => "R|c|K",
2088 reg_req => { out => [ "vfp" ] },
2089 emit => '. fldll2t',
2090 attr_type => "ia32_x87_attr_t",
2094 op_flags => "R|c|K",
2096 reg_req => { out => [ "vfp" ] },
2098 attr_type => "ia32_x87_attr_t",
2102 # Note that it is NEVER allowed to do CSE on these nodes
2103 # Moreover, note the virtual register requierements!
2108 cmp_attr => "return 1;",
2109 emit => '. fxch %X0',
2110 attr_type => "ia32_x87_attr_t",
2117 cmp_attr => "return 1;",
2118 emit => '. fld %X0',
2119 attr_type => "ia32_x87_attr_t",
2125 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2126 cmp_attr => "return 1;",
2127 emit => '. fld %X0',
2128 attr_type => "ia32_x87_attr_t",
2134 cmp_attr => "return 1;",
2135 emit => '. fstp %X0',
2136 attr_type => "ia32_x87_attr_t",
2143 cmp_attr => "return 1;",
2144 emit => '. ffreep %X0',
2145 attr_type => "ia32_x87_attr_t",
2152 cmp_attr => "return 1;",
2154 attr_type => "ia32_x87_attr_t",
2161 cmp_attr => "return 1;",
2163 attr_type => "ia32_x87_attr_t",
2171 emit => ". fucom %X1\n".
2173 attr_type => "ia32_x87_attr_t",
2178 emit => ". fucomp %X1\n".
2180 attr_type => "ia32_x87_attr_t",
2185 emit => ". fucompp\n".
2187 attr_type => "ia32_x87_attr_t",
2192 emit => '. fucomi %X1',
2193 attr_type => "ia32_x87_attr_t",
2198 emit => '. fucompi %X1',
2199 attr_type => "ia32_x87_attr_t",
2206 attr_type => "ia32_x87_attr_t",
2210 # -------------------------------------------------------------------------------- #
2211 # ____ ____ _____ _ _ #
2212 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2213 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2214 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2215 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2217 # -------------------------------------------------------------------------------- #
2220 # Spilling and reloading of SSE registers, hardcoded, not generated #
2224 state => "exc_pinned",
2225 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2226 emit => '. movdqu %D0, %AM',
2227 outs => [ "res", "M" ],
2233 state => "exc_pinned",
2234 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2235 ins => [ "base", "index", "mem", "val" ],
2236 emit => '. movdqu %binop',
2243 # Include the generated SIMD node specification written by the SIMD optimization
2244 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2245 unless ($return = do $my_script_name) {
2246 warn "couldn't parse $my_script_name: $@" if $@;
2247 warn "couldn't do $my_script_name: $!" unless defined $return;
2248 warn "couldn't run $my_script_name" unless $return;