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",
965 init_attr => "attr->pn_code = pnc;\nset_ia32_ls_mode(res, mode_Bu);\n",
966 emit => '. set%CMP0 %DB0',
974 # (note: leave the false,true order intact to make it compatible with other
976 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4 in_r5" ] },
977 ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
978 am => "source,binary",
979 attr => "int ins_permuted, pn_Cmp pn_code",
980 init_attr => "attr->pn_code = pn_code;\n".
981 "attr->data.ins_permuted = ins_permuted;",
990 reg_req => { in => [ "eflags" ], out => [ "none", "none" ] },
992 outs => [ "false", "true" ],
993 attr => "pn_Cmp pnc",
994 init_attr => "attr->pn_code = pnc;",
996 units => [ "BRANCH" ],
1001 op_flags => "L|X|Y",
1002 reg_req => { in => [ "gp" ], out => [ "none" ] },
1004 units => [ "BRANCH" ],
1006 modified_flags => $status_flags
1012 reg_req => { in => [ "gp" ] },
1013 emit => '. jmp *%S0',
1014 units => [ "BRANCH" ],
1021 reg_req => { out => [ "gp" ] },
1023 attr => "ir_entity *symconst, int symconst_sign, long offset",
1024 attr_type => "ia32_immediate_attr_t",
1026 # depends on the const and is set in ia32_transform
1027 # modified_flags => $status_flags
1034 reg_req => { out => [ "gp_UKNWN" ] },
1044 reg_req => { out => [ "vfp_UKNWN" ] },
1048 attr_type => "ia32_x87_attr_t",
1055 reg_req => { out => [ "xmm_UKNWN" ] },
1065 reg_req => { out => [ "gp_NOREG" ] },
1075 reg_req => { out => [ "vfp_NOREG" ] },
1079 attr_type => "ia32_x87_attr_t",
1086 reg_req => { out => [ "xmm_NOREG" ] },
1096 reg_req => { out => [ "fp_cw" ] },
1100 modified_flags => $fpcw_flags
1106 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1107 ins => [ "base", "index", "mem" ],
1109 emit => ". fldcw %AM",
1112 modified_flags => $fpcw_flags
1118 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1119 ins => [ "base", "index", "mem", "fpcw" ],
1121 emit => ". fnstcw %AM",
1127 # we should not rematrialize this node. It has very strict constraints.
1128 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1129 ins => [ "val", "globbered" ],
1137 # Note that we add additional latency values depending on address mode, so a
1138 # lateny of 0 for load is correct
1142 state => "exc_pinned",
1143 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1144 ins => [ "base", "index", "mem" ],
1145 outs => [ "res", "M" ],
1147 emit => ". mov%SE%ME%.l %AM, %D0",
1153 cmp_attr => "return 1;",
1154 outs => [ "res", "M" ],
1160 cmp_attr => "return 1;",
1161 state => "exc_pinned",
1168 state => "exc_pinned",
1169 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1170 ins => [ "base", "index", "mem", "val" ],
1171 emit => '. mov%M %SI3, %AM',
1179 state => "exc_pinned",
1180 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1181 ins => [ "base", "index", "mem", "val" ],
1182 emit => '. mov%M %SB3, %AM',
1190 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1191 ins => [ "base", "index" ],
1192 emit => '. leal %AM, %D0',
1196 # well this isn't true for Lea, but we often transform Lea back to Add, Inc
1197 # or Dec, so we set the flag
1198 modified_flags => 1,
1202 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "esp", "none" ] },
1203 ins => [ "base", "index", "mem", "val", "stack" ],
1204 emit => '. push%M %unop4',
1205 outs => [ "stack:I|S", "M" ],
1206 am => "source,binary",
1212 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1213 emit => '. pop%M %DAM1',
1214 outs => [ "stack:I|S", "res", "M" ],
1215 ins => [ "base", "index", "mem", "stack" ],
1217 latency => 3, # Pop is more expensive than Push on Athlon
1222 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1224 outs => [ "frame:I", "stack:I|S", "M" ],
1230 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1232 outs => [ "frame:I", "stack:I|S" ],
1240 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1241 ins => [ "base", "index", "mem", "stack", "size" ],
1242 am => "source,binary",
1243 emit => '. addl %binop',
1244 outs => [ "stack:S", "M" ],
1246 modified_flags => $status_flags
1252 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1253 ins => [ "base", "index", "mem", "stack", "size" ],
1254 am => "source,binary",
1255 emit => ". subl %binop\n".
1256 ". movl %%esp, %D1",
1257 outs => [ "stack:I|S", "addr", "M" ],
1259 modified_flags => $status_flags
1264 reg_req => { out => [ "gp" ] },
1269 #-----------------------------------------------------------------------------#
1270 # _____ _____ ______ __ _ _ _ #
1271 # / ____/ ____| ____| / _| | | | | | #
1272 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1273 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1274 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1275 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1276 #-----------------------------------------------------------------------------#
1280 reg_req => { out => [ "xmm" ] },
1281 emit => '. xorp%XSD %D0, %D0',
1287 # commutative operations
1291 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1292 ins => [ "base", "index", "mem", "left", "right" ],
1293 am => "source,binary",
1294 emit => '. add%XXM %binop',
1302 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1303 ins => [ "base", "index", "mem", "left", "right" ],
1304 am => "source,binary",
1305 emit => '. mul%XXM %binop',
1313 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1314 ins => [ "base", "index", "mem", "left", "right" ],
1315 am => "source,binary",
1316 emit => '. max%XXM %binop',
1324 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1325 ins => [ "base", "index", "mem", "left", "right" ],
1326 am => "source,binary",
1327 emit => '. min%XXM %binop',
1335 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1336 ins => [ "base", "index", "mem", "left", "right" ],
1337 am => "source,binary",
1338 emit => '. andp%XSD %binop',
1346 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1347 ins => [ "base", "index", "mem", "left", "right" ],
1348 am => "source,binary",
1349 emit => '. orp%XSD %binop',
1356 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1357 ins => [ "base", "index", "mem", "left", "right" ],
1358 am => "source,binary",
1359 emit => '. xorp%XSD %binop',
1365 # not commutative operations
1369 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1370 ins => [ "base", "index", "mem", "left", "right" ],
1371 am => "source,binary",
1372 emit => '. andnp%XSD %binop',
1380 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1381 ins => [ "base", "index", "mem", "left", "right" ],
1382 am => "source,binary",
1383 emit => '. sub%XXM %binop',
1391 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1392 ins => [ "base", "index", "mem", "left", "right" ],
1393 am => "source,binary",
1394 outs => [ "res", "M" ],
1395 emit => '. div%XXM %binop',
1404 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1405 ins => [ "base", "index", "mem", "left", "right" ],
1406 outs => [ "flags" ],
1407 am => "source,binary",
1408 attr => "int ins_permuted",
1409 init_attr => "attr->data.ins_permuted = ins_permuted;",
1410 emit => ' .ucomi%XXM %binop',
1413 mode => $mode_flags,
1414 modified_flags => 1,
1421 state => "exc_pinned",
1422 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1423 ins => [ "base", "index", "mem" ],
1424 emit => '. mov%XXM %AM, %D0',
1425 attr => "ir_mode *load_mode",
1426 init_attr => "attr->ls_mode = load_mode;",
1427 outs => [ "res", "M" ],
1434 state => "exc_pinned",
1435 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1436 ins => [ "base", "index", "mem", "val" ],
1437 emit => '. mov%XXM %S3, %AM',
1445 state => "exc_pinned",
1446 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1447 ins => [ "base", "index", "mem", "val" ],
1448 emit => '. mov%XXM %S3, %AM',
1456 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1457 ins => [ "base", "index", "mem", "val" ],
1458 am => "source,unary",
1459 emit => '. cvtsi2ss %unop3, %D0',
1467 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1468 ins => [ "base", "index", "mem", "val" ],
1469 am => "source,unary",
1470 emit => '. cvtsi2sd %unop3, %D0',
1479 cmp_attr => "return 1;",
1485 cmp_attr => "return 1;",
1494 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1495 outs => [ "DST", "SRC", "CNT", "M" ],
1497 # we don't care about this flag, so no need to mark this node
1498 # modified_flags => [ "DF" ]
1504 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1505 outs => [ "DST", "SRC", "M" ],
1507 # we don't care about this flag, so no need to mark this node
1508 # modified_flags => [ "DF" ]
1514 state => "exc_pinned",
1515 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1516 ins => [ "base", "index", "mem", "val" ],
1517 am => "source,unary",
1519 attr => "ir_mode *smaller_mode",
1520 init_attr => "attr->ls_mode = smaller_mode;",
1525 state => "exc_pinned",
1526 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1527 ins => [ "base", "index", "mem", "val" ],
1528 am => "source,unary",
1530 attr => "ir_mode *smaller_mode",
1531 init_attr => "attr->ls_mode = smaller_mode;",
1536 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
1537 ins => [ "base", "index", "mem", "val" ],
1538 am => "source,unary",
1545 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1546 ins => [ "base", "index", "mem", "val" ],
1547 am => "source,unary",
1554 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1555 ins => [ "base", "index", "mem", "val" ],
1556 am => "source,unary",
1562 #----------------------------------------------------------#
1564 # (_) | | | | / _| | | | #
1565 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1566 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1567 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1568 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1570 # _ __ ___ __| | ___ ___ #
1571 # | '_ \ / _ \ / _` |/ _ \/ __| #
1572 # | | | | (_) | (_| | __/\__ \ #
1573 # |_| |_|\___/ \__,_|\___||___/ #
1574 #----------------------------------------------------------#
1576 # spilling disabled for all float nodes for now, because the fpcw handler
1577 # runs before spilling and we might end up with wrong fpcw then
1581 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1582 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1583 am => "source,binary",
1587 attr_type => "ia32_x87_attr_t",
1592 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1593 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1594 am => "source,binary",
1598 attr_type => "ia32_x87_attr_t",
1603 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1604 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1605 am => "source,binary",
1609 attr_type => "ia32_x87_attr_t",
1613 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1614 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1615 am => "source,binary",
1616 outs => [ "res", "M" ],
1619 attr_type => "ia32_x87_attr_t",
1623 reg_req => { in => [ "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1624 ins => [ "left", "right", "fpcw" ],
1628 attr_type => "ia32_x87_attr_t",
1633 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1638 attr_type => "ia32_x87_attr_t",
1643 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1648 attr_type => "ia32_x87_attr_t",
1651 # virtual Load and Store
1655 state => "exc_pinned",
1656 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1657 ins => [ "base", "index", "mem" ],
1658 outs => [ "res", "M" ],
1659 attr => "ir_mode *load_mode",
1660 init_attr => "attr->attr.ls_mode = load_mode;",
1663 attr_type => "ia32_x87_attr_t",
1668 state => "exc_pinned",
1669 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1670 ins => [ "base", "index", "mem", "val" ],
1671 attr => "ir_mode *store_mode",
1672 init_attr => "attr->attr.ls_mode = store_mode;",
1676 attr_type => "ia32_x87_attr_t",
1682 state => "exc_pinned",
1683 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1684 outs => [ "res", "M" ],
1685 ins => [ "base", "index", "mem" ],
1688 attr_type => "ia32_x87_attr_t",
1692 cmp_attr => "return 1;",
1693 outs => [ "res", "M" ],
1698 state => "exc_pinned",
1699 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1700 ins => [ "base", "index", "mem", "val", "fpcw" ],
1704 attr_type => "ia32_x87_attr_t",
1708 cmp_attr => "return 1;",
1709 state => "exc_pinned",
1719 reg_req => { out => [ "vfp" ] },
1723 attr_type => "ia32_x87_attr_t",
1728 reg_req => { out => [ "vfp" ] },
1732 attr_type => "ia32_x87_attr_t",
1737 reg_req => { out => [ "vfp" ] },
1741 attr_type => "ia32_x87_attr_t",
1746 reg_req => { out => [ "vfp" ] },
1750 attr_type => "ia32_x87_attr_t",
1755 reg_req => { out => [ "vfp" ] },
1759 attr_type => "ia32_x87_attr_t",
1764 reg_req => { out => [ "vfp" ] },
1768 attr_type => "ia32_x87_attr_t",
1773 reg_req => { out => [ "vfp" ] },
1777 attr_type => "ia32_x87_attr_t",
1783 # we can't allow to rematerialize this node so we don't have
1784 # accidently produce Phi(Fucom, Fucom(ins_permuted))
1786 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1787 ins => [ "left", "right" ],
1788 outs => [ "flags" ],
1789 attr => "int ins_permuted",
1790 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1793 attr_type => "ia32_x87_attr_t",
1799 reg_req => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
1800 ins => [ "left", "right" ],
1801 outs => [ "flags" ],
1802 attr => "int ins_permuted",
1803 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1806 attr_type => "ia32_x87_attr_t",
1812 reg_req => { in => [ "vfp" ], out => [ "eax" ] },
1814 outs => [ "flags" ],
1815 attr => "int ins_permuted",
1816 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1819 attr_type => "ia32_x87_attr_t",
1825 reg_req => { in => [ "eax" ], out => [ "eflags" ] },
1827 outs => [ "flags" ],
1830 mode => $mode_flags,
1833 #------------------------------------------------------------------------#
1834 # ___ _____ __ _ _ _ #
1835 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1836 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1837 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1838 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1839 #------------------------------------------------------------------------#
1841 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1842 # are swapped, we work this around in the emitter...
1846 rd_constructor => "NONE",
1848 emit => '. fadd%XM %x87_binop',
1849 attr_type => "ia32_x87_attr_t",
1854 rd_constructor => "NONE",
1856 emit => '. faddp%XM %x87_binop',
1857 attr_type => "ia32_x87_attr_t",
1862 rd_constructor => "NONE",
1864 emit => '. fmul%XM %x87_binop',
1865 attr_type => "ia32_x87_attr_t",
1870 rd_constructor => "NONE",
1872 emit => '. fmulp%XM %x87_binop',,
1873 attr_type => "ia32_x87_attr_t",
1878 rd_constructor => "NONE",
1880 emit => '. fsub%XM %x87_binop',
1881 attr_type => "ia32_x87_attr_t",
1886 rd_constructor => "NONE",
1888 # see note about gas bugs
1889 emit => '. fsubrp%XM %x87_binop',
1890 attr_type => "ia32_x87_attr_t",
1895 rd_constructor => "NONE",
1898 emit => '. fsubr%XM %x87_binop',
1899 attr_type => "ia32_x87_attr_t",
1904 rd_constructor => "NONE",
1907 # see note about gas bugs
1908 emit => '. fsubp%XM %x87_binop',
1909 attr_type => "ia32_x87_attr_t",
1914 rd_constructor => "NONE",
1917 attr_type => "ia32_x87_attr_t",
1920 # this node is just here, to keep the simulator running
1921 # we can omit this when a fprem simulation function exists
1924 rd_constructor => "NONE",
1927 attr_type => "ia32_x87_attr_t",
1932 rd_constructor => "NONE",
1934 emit => '. fdiv%XM %x87_binop',
1935 attr_type => "ia32_x87_attr_t",
1940 rd_constructor => "NONE",
1942 # see note about gas bugs
1943 emit => '. fdivrp%XM %x87_binop',
1944 attr_type => "ia32_x87_attr_t",
1949 rd_constructor => "NONE",
1951 emit => '. fdivr%XM %x87_binop',
1952 attr_type => "ia32_x87_attr_t",
1957 rd_constructor => "NONE",
1959 # see note about gas bugs
1960 emit => '. fdivp%XM %x87_binop',
1961 attr_type => "ia32_x87_attr_t",
1966 rd_constructor => "NONE",
1969 attr_type => "ia32_x87_attr_t",
1974 rd_constructor => "NONE",
1977 attr_type => "ia32_x87_attr_t",
1980 # x87 Load and Store
1983 rd_constructor => "NONE",
1984 op_flags => "R|L|F",
1985 state => "exc_pinned",
1987 emit => '. fld%XM %AM',
1988 attr_type => "ia32_x87_attr_t",
1992 rd_constructor => "NONE",
1993 op_flags => "R|L|F",
1994 state => "exc_pinned",
1996 emit => '. fst%XM %AM',
1998 attr_type => "ia32_x87_attr_t",
2002 rd_constructor => "NONE",
2003 op_flags => "R|L|F",
2004 state => "exc_pinned",
2006 emit => '. fstp%XM %AM',
2008 attr_type => "ia32_x87_attr_t",
2015 rd_constructor => "NONE",
2017 emit => '. fild%M %AM',
2018 attr_type => "ia32_x87_attr_t",
2023 state => "exc_pinned",
2024 rd_constructor => "NONE",
2026 emit => '. fist%M %AM',
2028 attr_type => "ia32_x87_attr_t",
2033 state => "exc_pinned",
2034 rd_constructor => "NONE",
2036 emit => '. fistp%M %AM',
2038 attr_type => "ia32_x87_attr_t",
2044 op_flags => "R|c|K",
2046 reg_req => { out => [ "vfp" ] },
2048 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" ] },
2087 emit => '. fldll2t',
2088 attr_type => "ia32_x87_attr_t",
2092 op_flags => "R|c|K",
2094 reg_req => { out => [ "vfp" ] },
2096 attr_type => "ia32_x87_attr_t",
2100 # Note that it is NEVER allowed to do CSE on these nodes
2101 # Moreover, note the virtual register requierements!
2106 cmp_attr => "return 1;",
2107 emit => '. fxch %X0',
2108 attr_type => "ia32_x87_attr_t",
2115 cmp_attr => "return 1;",
2116 emit => '. fld %X0',
2117 attr_type => "ia32_x87_attr_t",
2123 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2124 cmp_attr => "return 1;",
2125 emit => '. fld %X0',
2126 attr_type => "ia32_x87_attr_t",
2132 cmp_attr => "return 1;",
2133 emit => '. fstp %X0',
2134 attr_type => "ia32_x87_attr_t",
2141 cmp_attr => "return 1;",
2142 emit => '. ffreep %X0',
2143 attr_type => "ia32_x87_attr_t",
2150 cmp_attr => "return 1;",
2152 attr_type => "ia32_x87_attr_t",
2159 cmp_attr => "return 1;",
2161 attr_type => "ia32_x87_attr_t",
2169 emit => ". fucom %X1\n".
2171 attr_type => "ia32_x87_attr_t",
2176 emit => ". fucomp %X1\n".
2178 attr_type => "ia32_x87_attr_t",
2183 emit => ". fucompp\n".
2185 attr_type => "ia32_x87_attr_t",
2190 emit => '. fucomi %X1',
2191 attr_type => "ia32_x87_attr_t",
2196 emit => '. fucompi %X1',
2197 attr_type => "ia32_x87_attr_t",
2204 attr_type => "ia32_x87_attr_t",
2208 # -------------------------------------------------------------------------------- #
2209 # ____ ____ _____ _ _ #
2210 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2211 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2212 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2213 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2215 # -------------------------------------------------------------------------------- #
2218 # Spilling and reloading of SSE registers, hardcoded, not generated #
2222 state => "exc_pinned",
2223 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2224 emit => '. movdqu %D0, %AM',
2225 outs => [ "res", "M" ],
2231 state => "exc_pinned",
2232 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2233 ins => [ "base", "index", "mem", "val" ],
2234 emit => '. movdqu %binop',
2241 # Include the generated SIMD node specification written by the SIMD optimization
2242 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2243 unless ($return = do $my_script_name) {
2244 warn "couldn't parse $my_script_name: $@" if $@;
2245 warn "couldn't do $my_script_name: $!" unless defined $return;
2246 warn "couldn't run $my_script_name" unless $return;