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" ],
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 am => "dest,ternary",
667 emit => ". shld%M %SB2, %S1, %S0\n".
672 modified_flags => $status_flags
676 cmp_attr => "return 1;",
682 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
683 ins => [ "val", "count" ],
685 emit => '. shr %SB1, %S0',
688 modified_flags => $status_flags
693 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
694 ins => [ "base", "index", "mem", "count" ],
695 emit => '. shr%M %SB3, %AM',
698 modified_flags => $status_flags
702 cmp_attr => "return 1;",
703 # value, cnt, dependency
708 # What's going on with the out constraint here? We would like to write
709 # "in_r2" and be done. However in firm we only support should_be_same
710 # constraints at the moment. Which means they could be non-fullfilled in
711 # some cases. Now when all values happen to live through the node, out
712 # is ecx and in_r2 not ecx, then we're screwed. Because in this case we
713 # need a 4th Register.
715 # The best solution for this is extending the register allocator to support
716 # must_be_same constraints which create a copy when the in_r2 value
717 # lives through (this ensures that we have the 4th register in the cases
718 # when we need it and can always fix the situation).
720 # For now I'm doing this ultra ugly !in hack which allocates 4 registers
721 # and creates an extra mov
723 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
724 ins => [ "left_high", "left_low", "right" ],
725 am => "dest,ternary",
726 emit => ". shrd%M %SB2, %S1, %S0\n".
731 modified_flags => $status_flags
735 cmp_attr => "return 1;",
741 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
742 ins => [ "val", "count" ],
744 emit => '. sar %SB1, %S0',
747 modified_flags => $status_flags
752 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
753 ins => [ "base", "index", "mem", "count" ],
754 emit => '. sar%M %SB3, %AM',
757 modified_flags => $status_flags
761 cmp_attr => "return 1;",
762 # value, cnt, dependency
768 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
769 ins => [ "val", "count" ],
771 emit => '. ror %SB1, %S0',
774 modified_flags => $status_flags
779 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
780 ins => [ "base", "index", "mem", "count" ],
781 emit => '. ror%M %SB3, %AM',
784 modified_flags => $status_flags
789 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
790 ins => [ "val", "count" ],
792 emit => '. rol %SB1, %S0',
795 modified_flags => $status_flags
800 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
801 ins => [ "base", "index", "mem", "count" ],
802 emit => '. rol%M %SB3, %AM',
805 modified_flags => $status_flags
812 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
818 modified_flags => $status_flags
823 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
824 ins => [ "base", "index", "mem" ],
825 emit => '. neg%M %AM',
828 modified_flags => $status_flags
833 reg_req => { in => [ "gp", "gp" ], out => [ "in_r1", "gp" ] },
834 outs => [ "low_res", "high_res" ],
836 modified_flags => $status_flags
841 cmp_attr => "return 1;",
847 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
852 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
857 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
858 ins => [ "base", "index", "mem" ],
859 emit => '. inc%M %AM',
862 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
867 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
872 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
877 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
878 ins => [ "base", "index", "mem" ],
879 emit => '. dec%M %AM',
882 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
887 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
897 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
898 ins => [ "base", "index", "mem" ],
899 emit => '. not%M %AM',
908 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
909 ins => [ "base", "index", "mem", "left", "right" ],
910 outs => [ "eflags" ],
911 am => "source,binary",
912 emit => '. cmp%M %binop',
913 attr => "int flipped, int cmp_unsigned",
914 init_attr => "attr->data.cmp_flipped = flipped;\n".
915 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
919 modified_flags => $status_flags
924 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
925 ins => [ "base", "index", "mem", "left", "right" ],
926 outs => [ "eflags" ],
927 am => "source,binary",
928 emit => '. cmpb %binop',
929 attr => "int flipped, int cmp_unsigned",
930 init_attr => "attr->data.cmp_flipped = flipped;\n".
931 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
935 modified_flags => $status_flags
940 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
941 ins => [ "base", "index", "mem", "left", "right" ],
942 outs => [ "eflags" ],
943 am => "source,binary",
944 emit => '. test%M %binop',
945 attr => "int flipped, int cmp_unsigned",
946 init_attr => "attr->data.cmp_flipped = flipped;\n".
947 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
951 modified_flags => $status_flags
956 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
957 ins => [ "base", "index", "mem", "left", "right" ],
958 outs => [ "eflags" ],
959 am => "source,binary",
960 emit => '. testb %binop',
961 attr => "int flipped, int cmp_unsigned",
962 init_attr => "attr->data.cmp_flipped = flipped;\n".
963 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
967 modified_flags => $status_flags
972 reg_req => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
975 attr => "pn_Cmp pnc",
976 init_attr => "attr->pn_code = pnc;\nset_ia32_ls_mode(res, mode_Bu);\n",
977 emit => '. set%CMP0 %DB0',
985 # (note: leave the false,true order intact to make it compatible with other
987 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4 in_r5" ] },
988 ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
989 am => "source,binary",
990 attr => "int flipped, pn_Cmp pn_code",
991 init_attr => "attr->pn_code = pn_code;\n".
992 "attr->data.cmp_flipped = flipped;",
1000 op_flags => "L|X|Y",
1001 reg_req => { in => [ "eflags" ], out => [ "none", "none" ] },
1002 ins => [ "eflags" ],
1003 outs => [ "false", "true" ],
1004 attr => "pn_Cmp pnc",
1005 init_attr => "attr->pn_code = pnc;",
1007 units => [ "BRANCH" ],
1012 op_flags => "L|X|Y",
1013 reg_req => { in => [ "gp" ], out => [ "none" ] },
1015 units => [ "BRANCH" ],
1017 modified_flags => $status_flags
1023 reg_req => { in => [ "gp" ] },
1024 emit => '. jmp *%S0',
1025 units => [ "BRANCH" ],
1032 reg_req => { out => [ "gp" ] },
1034 attr => "ir_entity *symconst, int symconst_sign, long offset",
1035 attr_type => "ia32_immediate_attr_t",
1037 # depends on the const and is set in ia32_transform
1038 # modified_flags => $status_flags
1045 reg_req => { out => [ "gp_UKNWN" ] },
1055 reg_req => { out => [ "vfp_UKNWN" ] },
1059 attr_type => "ia32_x87_attr_t",
1066 reg_req => { out => [ "xmm_UKNWN" ] },
1076 reg_req => { out => [ "gp_NOREG" ] },
1086 reg_req => { out => [ "vfp_NOREG" ] },
1090 attr_type => "ia32_x87_attr_t",
1097 reg_req => { out => [ "xmm_NOREG" ] },
1107 reg_req => { out => [ "fp_cw" ] },
1111 modified_flags => $fpcw_flags
1117 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1118 ins => [ "base", "index", "mem" ],
1120 emit => ". fldcw %AM",
1123 modified_flags => $fpcw_flags
1129 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1130 ins => [ "base", "index", "mem", "fpcw" ],
1132 emit => ". fnstcw %AM",
1138 # we should not rematrialize this node. It has very strict constraints.
1139 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1140 ins => [ "val", "globbered" ],
1148 # Note that we add additional latency values depending on address mode, so a
1149 # lateny of 0 for load is correct
1153 state => "exc_pinned",
1154 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1155 ins => [ "base", "index", "mem" ],
1156 outs => [ "res", "M" ],
1158 emit => ". mov%SE%ME%.l %AM, %D0",
1164 cmp_attr => "return 1;",
1165 outs => [ "res", "M" ],
1171 cmp_attr => "return 1;",
1172 state => "exc_pinned",
1179 state => "exc_pinned",
1180 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1181 ins => [ "base", "index", "mem", "val" ],
1182 emit => '. mov%M %SI3, %AM',
1190 state => "exc_pinned",
1191 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1192 ins => [ "base", "index", "mem", "val" ],
1193 emit => '. mov%M %SB3, %AM',
1201 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1202 ins => [ "base", "index" ],
1203 emit => '. leal %AM, %D0',
1207 # well this isn't true for Lea, but we often transform Lea back to Add, Inc
1208 # or Dec, so we set the flag
1209 modified_flags => 1,
1213 reg_req => { in => [ "gp", "gp", "none", "gp", "esp" ], out => [ "esp", "none" ] },
1214 ins => [ "base", "index", "mem", "val", "stack" ],
1215 emit => '. push%M %unop3',
1216 outs => [ "stack:I|S", "M" ],
1217 am => "source,binary",
1223 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1224 emit => '. pop%M %DAM1',
1225 outs => [ "stack:I|S", "res", "M" ],
1226 ins => [ "base", "index", "mem", "stack" ],
1228 latency => 3, # Pop is more expensive than Push on Athlon
1233 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1235 outs => [ "frame:I", "stack:I|S", "M" ],
1241 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1243 outs => [ "frame:I", "stack:I|S" ],
1251 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1252 ins => [ "base", "index", "mem", "stack", "size" ],
1253 am => "source,binary",
1254 emit => '. addl %binop',
1255 outs => [ "stack:S", "M" ],
1257 modified_flags => $status_flags
1263 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1264 ins => [ "base", "index", "mem", "stack", "size" ],
1265 am => "source,binary",
1266 emit => ". subl %binop\n".
1267 ". movl %%esp, %D1",
1268 outs => [ "stack:I|S", "addr", "M" ],
1270 modified_flags => $status_flags
1275 reg_req => { out => [ "gp" ] },
1279 # the int instruction
1281 reg_req => { in => [ "gp" ], out => [ "none" ] },
1283 emit => '. int %SI0',
1285 cmp_attr => "return 1;",
1289 #-----------------------------------------------------------------------------#
1290 # _____ _____ ______ __ _ _ _ #
1291 # / ____/ ____| ____| / _| | | | | | #
1292 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1293 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1294 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1295 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1296 #-----------------------------------------------------------------------------#
1300 reg_req => { out => [ "xmm" ] },
1301 emit => '. xorp%XSD %D0, %D0',
1307 # commutative operations
1311 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1312 ins => [ "base", "index", "mem", "left", "right" ],
1313 am => "source,binary",
1314 emit => '. add%XXM %binop',
1322 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1323 ins => [ "base", "index", "mem", "left", "right" ],
1324 am => "source,binary",
1325 emit => '. mul%XXM %binop',
1333 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1334 ins => [ "base", "index", "mem", "left", "right" ],
1335 am => "source,binary",
1336 emit => '. max%XXM %binop',
1344 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1345 ins => [ "base", "index", "mem", "left", "right" ],
1346 am => "source,binary",
1347 emit => '. min%XXM %binop',
1355 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1356 ins => [ "base", "index", "mem", "left", "right" ],
1357 am => "source,binary",
1358 emit => '. andp%XSD %binop',
1366 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1367 ins => [ "base", "index", "mem", "left", "right" ],
1368 am => "source,binary",
1369 emit => '. orp%XSD %binop',
1376 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1377 ins => [ "base", "index", "mem", "left", "right" ],
1378 am => "source,binary",
1379 emit => '. xorp%XSD %binop',
1385 # not commutative operations
1389 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1390 ins => [ "base", "index", "mem", "left", "right" ],
1391 am => "source,binary",
1392 emit => '. andnp%XSD %binop',
1400 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1401 ins => [ "base", "index", "mem", "left", "right" ],
1402 am => "source,binary",
1403 emit => '. sub%XXM %binop',
1411 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1412 ins => [ "base", "index", "mem", "left", "right" ],
1413 am => "source,binary",
1414 outs => [ "res", "M" ],
1415 emit => '. div%XXM %binop',
1424 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1425 ins => [ "base", "index", "mem", "left", "right" ],
1426 outs => [ "flags" ],
1427 am => "source,binary",
1428 attr => "int flipped",
1429 init_attr => "attr->data.cmp_flipped = flipped;",
1430 emit => ' .ucomi%XXM %binop',
1433 mode => $mode_flags,
1434 modified_flags => 1,
1441 state => "exc_pinned",
1442 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1443 ins => [ "base", "index", "mem" ],
1444 emit => '. mov%XXM %AM, %D0',
1445 attr => "ir_mode *load_mode",
1446 init_attr => "attr->ls_mode = load_mode;",
1447 outs => [ "res", "M" ],
1454 state => "exc_pinned",
1455 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1456 ins => [ "base", "index", "mem", "val" ],
1457 emit => '. mov%XXM %S3, %AM',
1465 state => "exc_pinned",
1466 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1467 ins => [ "base", "index", "mem", "val" ],
1468 emit => '. mov%XXM %S3, %AM',
1476 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1477 ins => [ "base", "index", "mem", "val" ],
1478 am => "source,unary",
1479 emit => '. cvtsi2ss %unop3, %D0',
1487 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1488 ins => [ "base", "index", "mem", "val" ],
1489 am => "source,unary",
1490 emit => '. cvtsi2sd %unop3, %D0',
1499 cmp_attr => "return 1;",
1505 cmp_attr => "return 1;",
1514 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1515 outs => [ "DST", "SRC", "CNT", "M" ],
1517 # we don't care about this flag, so no need to mark this node
1518 # modified_flags => [ "DF" ]
1524 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1525 outs => [ "DST", "SRC", "M" ],
1527 # we don't care about this flag, so no need to mark this node
1528 # modified_flags => [ "DF" ]
1534 state => "exc_pinned",
1535 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1536 ins => [ "base", "index", "mem", "val" ],
1537 am => "source,unary",
1539 attr => "ir_mode *smaller_mode",
1540 init_attr => "attr->ls_mode = smaller_mode;",
1545 state => "exc_pinned",
1546 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1547 ins => [ "base", "index", "mem", "val" ],
1548 am => "source,unary",
1550 attr => "ir_mode *smaller_mode",
1551 init_attr => "attr->ls_mode = smaller_mode;",
1556 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
1557 ins => [ "base", "index", "mem", "val" ],
1558 am => "source,unary",
1565 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1566 ins => [ "base", "index", "mem", "val" ],
1567 am => "source,unary",
1574 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1575 ins => [ "base", "index", "mem", "val" ],
1576 am => "source,unary",
1582 #----------------------------------------------------------#
1584 # (_) | | | | / _| | | | #
1585 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1586 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1587 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1588 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1590 # _ __ ___ __| | ___ ___ #
1591 # | '_ \ / _ \ / _` |/ _ \/ __| #
1592 # | | | | (_) | (_| | __/\__ \ #
1593 # |_| |_|\___/ \__,_|\___||___/ #
1594 #----------------------------------------------------------#
1596 # spilling disabled for all float nodes for now, because the fpcw handler
1597 # runs before spilling and we might end up with wrong fpcw then
1601 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1602 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1603 am => "source,binary",
1607 attr_type => "ia32_x87_attr_t",
1612 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1613 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1614 am => "source,binary",
1618 attr_type => "ia32_x87_attr_t",
1623 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1624 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1625 am => "source,binary",
1629 attr_type => "ia32_x87_attr_t",
1633 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1634 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1635 am => "source,binary",
1636 outs => [ "res", "M" ],
1639 attr_type => "ia32_x87_attr_t",
1643 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1644 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1648 attr_type => "ia32_x87_attr_t",
1653 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1658 attr_type => "ia32_x87_attr_t",
1663 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1668 attr_type => "ia32_x87_attr_t",
1671 # virtual Load and Store
1675 state => "exc_pinned",
1676 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1677 ins => [ "base", "index", "mem" ],
1678 outs => [ "res", "M" ],
1679 attr => "ir_mode *load_mode",
1680 init_attr => "attr->attr.ls_mode = load_mode;",
1683 attr_type => "ia32_x87_attr_t",
1688 state => "exc_pinned",
1689 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1690 ins => [ "base", "index", "mem", "val" ],
1691 attr => "ir_mode *store_mode",
1692 init_attr => "attr->attr.ls_mode = store_mode;",
1696 attr_type => "ia32_x87_attr_t",
1702 state => "exc_pinned",
1703 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1704 outs => [ "res", "M" ],
1705 ins => [ "base", "index", "mem" ],
1708 attr_type => "ia32_x87_attr_t",
1712 cmp_attr => "return 1;",
1713 outs => [ "res", "M" ],
1718 state => "exc_pinned",
1719 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1720 ins => [ "base", "index", "mem", "val", "fpcw" ],
1724 attr_type => "ia32_x87_attr_t",
1728 cmp_attr => "return 1;",
1729 state => "exc_pinned",
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",
1784 reg_req => { out => [ "vfp" ] },
1788 attr_type => "ia32_x87_attr_t",
1793 reg_req => { out => [ "vfp" ] },
1797 attr_type => "ia32_x87_attr_t",
1803 # we can't allow to rematerialize this node so we don't have
1804 # accidently produce Phi(Fucom, Fucom(flipped))
1806 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1807 ins => [ "left", "right" ],
1808 outs => [ "flags" ],
1809 attr => "int flipped",
1810 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1813 attr_type => "ia32_x87_attr_t",
1819 reg_req => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
1820 ins => [ "left", "right" ],
1821 outs => [ "flags" ],
1822 attr => "int flipped",
1823 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1826 attr_type => "ia32_x87_attr_t",
1832 reg_req => { in => [ "vfp" ], out => [ "eax" ] },
1834 outs => [ "flags" ],
1835 attr => "int flipped",
1836 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1839 attr_type => "ia32_x87_attr_t",
1845 reg_req => { in => [ "eax" ], out => [ "eflags" ] },
1847 outs => [ "flags" ],
1850 mode => $mode_flags,
1853 #------------------------------------------------------------------------#
1854 # ___ _____ __ _ _ _ #
1855 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1856 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1857 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1858 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1859 #------------------------------------------------------------------------#
1861 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1862 # are swapped, we work this around in the emitter...
1866 rd_constructor => "NONE",
1868 emit => '. fadd%XM %x87_binop',
1869 attr_type => "ia32_x87_attr_t",
1874 rd_constructor => "NONE",
1876 emit => '. faddp%XM %x87_binop',
1877 attr_type => "ia32_x87_attr_t",
1882 rd_constructor => "NONE",
1884 emit => '. fmul%XM %x87_binop',
1885 attr_type => "ia32_x87_attr_t",
1890 rd_constructor => "NONE",
1892 emit => '. fmulp%XM %x87_binop',,
1893 attr_type => "ia32_x87_attr_t",
1898 rd_constructor => "NONE",
1900 emit => '. fsub%XM %x87_binop',
1901 attr_type => "ia32_x87_attr_t",
1906 rd_constructor => "NONE",
1908 # see note about gas bugs
1909 emit => '. fsubrp%XM %x87_binop',
1910 attr_type => "ia32_x87_attr_t",
1915 rd_constructor => "NONE",
1918 emit => '. fsubr%XM %x87_binop',
1919 attr_type => "ia32_x87_attr_t",
1924 rd_constructor => "NONE",
1927 # see note about gas bugs
1928 emit => '. fsubp%XM %x87_binop',
1929 attr_type => "ia32_x87_attr_t",
1934 rd_constructor => "NONE",
1937 attr_type => "ia32_x87_attr_t",
1940 # this node is just here, to keep the simulator running
1941 # we can omit this when a fprem simulation function exists
1944 rd_constructor => "NONE",
1947 attr_type => "ia32_x87_attr_t",
1952 rd_constructor => "NONE",
1954 emit => '. fdiv%XM %x87_binop',
1955 attr_type => "ia32_x87_attr_t",
1960 rd_constructor => "NONE",
1962 # see note about gas bugs
1963 emit => '. fdivrp%XM %x87_binop',
1964 attr_type => "ia32_x87_attr_t",
1969 rd_constructor => "NONE",
1971 emit => '. fdivr%XM %x87_binop',
1972 attr_type => "ia32_x87_attr_t",
1977 rd_constructor => "NONE",
1979 # see note about gas bugs
1980 emit => '. fdivp%XM %x87_binop',
1981 attr_type => "ia32_x87_attr_t",
1986 rd_constructor => "NONE",
1989 attr_type => "ia32_x87_attr_t",
1994 rd_constructor => "NONE",
1997 attr_type => "ia32_x87_attr_t",
2000 # x87 Load and Store
2003 rd_constructor => "NONE",
2004 op_flags => "R|L|F",
2005 state => "exc_pinned",
2007 emit => '. fld%XM %AM',
2008 attr_type => "ia32_x87_attr_t",
2012 rd_constructor => "NONE",
2013 op_flags => "R|L|F",
2014 state => "exc_pinned",
2016 emit => '. fst%XM %AM',
2018 attr_type => "ia32_x87_attr_t",
2022 rd_constructor => "NONE",
2023 op_flags => "R|L|F",
2024 state => "exc_pinned",
2026 emit => '. fstp%XM %AM',
2028 attr_type => "ia32_x87_attr_t",
2035 rd_constructor => "NONE",
2037 emit => '. fild%M %AM',
2038 attr_type => "ia32_x87_attr_t",
2043 state => "exc_pinned",
2044 rd_constructor => "NONE",
2046 emit => '. fist%M %AM',
2048 attr_type => "ia32_x87_attr_t",
2053 state => "exc_pinned",
2054 rd_constructor => "NONE",
2056 emit => '. fistp%M %AM',
2058 attr_type => "ia32_x87_attr_t",
2064 op_flags => "R|c|K",
2066 reg_req => { out => [ "vfp" ] },
2068 attr_type => "ia32_x87_attr_t",
2072 op_flags => "R|c|K",
2074 reg_req => { out => [ "vfp" ] },
2076 attr_type => "ia32_x87_attr_t",
2080 op_flags => "R|c|K",
2082 reg_req => { out => [ "vfp" ] },
2084 attr_type => "ia32_x87_attr_t",
2088 op_flags => "R|c|K",
2090 reg_req => { out => [ "vfp" ] },
2092 attr_type => "ia32_x87_attr_t",
2096 op_flags => "R|c|K",
2098 reg_req => { out => [ "vfp" ] },
2100 attr_type => "ia32_x87_attr_t",
2104 op_flags => "R|c|K",
2106 reg_req => { out => [ "vfp" ] },
2107 emit => '. fldll2t',
2108 attr_type => "ia32_x87_attr_t",
2112 op_flags => "R|c|K",
2114 reg_req => { out => [ "vfp" ] },
2116 attr_type => "ia32_x87_attr_t",
2120 # Note that it is NEVER allowed to do CSE on these nodes
2121 # Moreover, note the virtual register requierements!
2126 cmp_attr => "return 1;",
2127 emit => '. fxch %X0',
2128 attr_type => "ia32_x87_attr_t",
2135 cmp_attr => "return 1;",
2136 emit => '. fld %X0',
2137 attr_type => "ia32_x87_attr_t",
2143 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2144 cmp_attr => "return 1;",
2145 emit => '. fld %X0',
2146 attr_type => "ia32_x87_attr_t",
2152 cmp_attr => "return 1;",
2153 emit => '. fstp %X0',
2154 attr_type => "ia32_x87_attr_t",
2161 cmp_attr => "return 1;",
2162 emit => '. ffreep %X0',
2163 attr_type => "ia32_x87_attr_t",
2170 cmp_attr => "return 1;",
2172 attr_type => "ia32_x87_attr_t",
2179 cmp_attr => "return 1;",
2181 attr_type => "ia32_x87_attr_t",
2189 emit => ". fucom %X1\n".
2191 attr_type => "ia32_x87_attr_t",
2196 emit => ". fucomp %X1\n".
2198 attr_type => "ia32_x87_attr_t",
2203 emit => ". fucompp\n".
2205 attr_type => "ia32_x87_attr_t",
2210 emit => '. fucomi %X1',
2211 attr_type => "ia32_x87_attr_t",
2216 emit => '. fucompi %X1',
2217 attr_type => "ia32_x87_attr_t",
2224 attr_type => "ia32_x87_attr_t",
2228 # -------------------------------------------------------------------------------- #
2229 # ____ ____ _____ _ _ #
2230 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2231 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2232 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2233 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2235 # -------------------------------------------------------------------------------- #
2238 # Spilling and reloading of SSE registers, hardcoded, not generated #
2242 state => "exc_pinned",
2243 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2244 emit => '. movdqu %D0, %AM',
2245 outs => [ "res", "M" ],
2251 state => "exc_pinned",
2252 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2253 ins => [ "base", "index", "mem", "val" ],
2254 emit => '. movdqu %binop',
2261 # Include the generated SIMD node specification written by the SIMD optimization
2262 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2263 unless ($return = do $my_script_name) {
2264 warn "couldn't parse $my_script_name: $@" if $@;
2265 warn "couldn't do $my_script_name: $!" unless defined $return;
2266 warn "couldn't run $my_script_name" unless $return;