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;",
767 cmp_attr => "return 1;",
768 # value, cnt, dependency
774 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
775 ins => [ "val", "count" ],
777 emit => '. ror %SB1, %S0',
780 modified_flags => $status_flags
785 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
786 ins => [ "base", "index", "mem", "count" ],
787 emit => '. ror%M %SB3, %AM',
790 modified_flags => $status_flags
795 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
796 ins => [ "val", "count" ],
798 emit => '. rol %SB1, %S0',
801 modified_flags => $status_flags
806 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
807 ins => [ "base", "index", "mem", "count" ],
808 emit => '. rol%M %SB3, %AM',
811 modified_flags => $status_flags
818 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
824 modified_flags => $status_flags
829 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
830 ins => [ "base", "index", "mem" ],
831 emit => '. neg%M %AM',
834 modified_flags => $status_flags
839 reg_req => { in => [ "gp", "gp" ], out => [ "in_r1", "gp" ] },
840 outs => [ "low_res", "high_res" ],
842 modified_flags => $status_flags
847 cmp_attr => "return 1;",
853 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
858 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
863 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
864 ins => [ "base", "index", "mem" ],
865 emit => '. inc%M %AM',
868 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
873 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
878 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
883 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
884 ins => [ "base", "index", "mem" ],
885 emit => '. dec%M %AM',
888 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
893 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
903 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
904 ins => [ "base", "index", "mem" ],
905 emit => '. not%M %AM',
914 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
915 ins => [ "base", "index", "mem", "left", "right" ],
916 outs => [ "eflags" ],
917 am => "source,binary",
918 emit => '. cmp%M %binop',
919 attr => "int flipped, int cmp_unsigned",
920 init_attr => "attr->data.cmp_flipped = flipped;\n".
921 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
925 modified_flags => $status_flags
930 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
931 ins => [ "base", "index", "mem", "left", "right" ],
932 outs => [ "eflags" ],
933 am => "source,binary",
934 emit => '. cmpb %binop',
935 attr => "int flipped, int cmp_unsigned",
936 init_attr => "attr->data.cmp_flipped = flipped;\n".
937 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
941 modified_flags => $status_flags
946 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
947 ins => [ "base", "index", "mem", "left", "right" ],
948 outs => [ "eflags" ],
949 am => "source,binary",
950 emit => '. test%M %binop',
951 attr => "int flipped, int cmp_unsigned",
952 init_attr => "attr->data.cmp_flipped = flipped;\n".
953 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
957 modified_flags => $status_flags
962 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
963 ins => [ "base", "index", "mem", "left", "right" ],
964 outs => [ "eflags" ],
965 am => "source,binary",
966 emit => '. testb %binop',
967 attr => "int flipped, int cmp_unsigned",
968 init_attr => "attr->data.cmp_flipped = flipped;\n".
969 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
973 modified_flags => $status_flags
978 reg_req => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
981 attr => "pn_Cmp pnc",
982 init_attr => "attr->pn_code = pnc;\nset_ia32_ls_mode(res, mode_Bu);\n",
983 emit => '. set%CMP0 %DB0',
991 # (note: leave the false,true order intact to make it compatible with other
993 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4 in_r5" ] },
994 ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
995 am => "source,binary",
996 attr => "int flipped, pn_Cmp pn_code",
997 init_attr => "attr->pn_code = pn_code;\n".
998 "attr->data.cmp_flipped = flipped;",
1006 op_flags => "L|X|Y",
1007 reg_req => { in => [ "eflags" ], out => [ "none", "none" ] },
1008 ins => [ "eflags" ],
1009 outs => [ "false", "true" ],
1010 attr => "pn_Cmp pnc",
1011 init_attr => "attr->pn_code = pnc;",
1013 units => [ "BRANCH" ],
1018 op_flags => "L|X|Y",
1019 reg_req => { in => [ "gp" ], out => [ "none" ] },
1021 units => [ "BRANCH" ],
1023 modified_flags => $status_flags
1029 reg_req => { in => [ "gp" ] },
1030 emit => '. jmp *%S0',
1031 units => [ "BRANCH" ],
1038 reg_req => { out => [ "gp" ] },
1040 attr => "ir_entity *symconst, int symconst_sign, long offset",
1041 attr_type => "ia32_immediate_attr_t",
1043 # depends on the const and is set in ia32_transform
1044 # modified_flags => $status_flags
1051 reg_req => { out => [ "gp_UKNWN" ] },
1061 reg_req => { out => [ "vfp_UKNWN" ] },
1065 attr_type => "ia32_x87_attr_t",
1072 reg_req => { out => [ "xmm_UKNWN" ] },
1082 reg_req => { out => [ "gp_NOREG" ] },
1092 reg_req => { out => [ "vfp_NOREG" ] },
1096 attr_type => "ia32_x87_attr_t",
1103 reg_req => { out => [ "xmm_NOREG" ] },
1113 reg_req => { out => [ "fp_cw" ] },
1117 modified_flags => $fpcw_flags
1123 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1124 ins => [ "base", "index", "mem" ],
1126 emit => ". fldcw %AM",
1129 modified_flags => $fpcw_flags
1135 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1136 ins => [ "base", "index", "mem", "fpcw" ],
1138 emit => ". fnstcw %AM",
1144 # we should not rematrialize this node. It has very strict constraints.
1145 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1146 ins => [ "val", "globbered" ],
1154 # Note that we add additional latency values depending on address mode, so a
1155 # lateny of 0 for load is correct
1159 state => "exc_pinned",
1160 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1161 ins => [ "base", "index", "mem" ],
1162 outs => [ "res", "M" ],
1164 emit => ". mov%SE%ME%.l %AM, %D0",
1170 cmp_attr => "return 1;",
1171 outs => [ "res", "M" ],
1177 cmp_attr => "return 1;",
1178 state => "exc_pinned",
1185 state => "exc_pinned",
1186 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1187 ins => [ "base", "index", "mem", "val" ],
1188 emit => '. mov%M %SI3, %AM',
1196 state => "exc_pinned",
1197 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1198 ins => [ "base", "index", "mem", "val" ],
1199 emit => '. mov%M %SB3, %AM',
1207 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1208 ins => [ "base", "index" ],
1209 emit => '. leal %AM, %D0',
1213 # well this isn't true for Lea, but we often transform Lea back to Add, Inc
1214 # or Dec, so we set the flag
1215 modified_flags => 1,
1219 reg_req => { in => [ "gp", "gp", "none", "gp", "esp" ], out => [ "esp", "none" ] },
1220 ins => [ "base", "index", "mem", "val", "stack" ],
1221 emit => '. push%M %unop3',
1222 outs => [ "stack:I|S", "M" ],
1223 am => "source,binary",
1229 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1230 emit => '. pop%M %DAM1',
1231 outs => [ "stack:I|S", "res", "M" ],
1232 ins => [ "base", "index", "mem", "stack" ],
1234 latency => 3, # Pop is more expensive than Push on Athlon
1239 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1241 outs => [ "frame:I", "stack:I|S", "M" ],
1247 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1249 outs => [ "frame:I", "stack:I|S" ],
1257 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1258 ins => [ "base", "index", "mem", "stack", "size" ],
1259 am => "source,binary",
1260 emit => '. addl %binop',
1261 outs => [ "stack:S", "M" ],
1263 modified_flags => $status_flags
1269 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1270 ins => [ "base", "index", "mem", "stack", "size" ],
1271 am => "source,binary",
1272 emit => ". subl %binop\n".
1273 ". movl %%esp, %D1",
1274 outs => [ "stack:I|S", "addr", "M" ],
1276 modified_flags => $status_flags
1281 reg_req => { out => [ "gp" ] },
1285 # the int instruction
1287 reg_req => { in => [ "gp" ], out => [ "none" ] },
1289 emit => '. int %SI0',
1291 cmp_attr => "return 1;",
1295 #-----------------------------------------------------------------------------#
1296 # _____ _____ ______ __ _ _ _ #
1297 # / ____/ ____| ____| / _| | | | | | #
1298 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1299 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1300 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1301 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1302 #-----------------------------------------------------------------------------#
1306 reg_req => { out => [ "xmm" ] },
1307 emit => '. xorp%XSD %D0, %D0',
1313 # commutative operations
1317 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1318 ins => [ "base", "index", "mem", "left", "right" ],
1319 am => "source,binary",
1320 emit => '. add%XXM %binop',
1328 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1329 ins => [ "base", "index", "mem", "left", "right" ],
1330 am => "source,binary",
1331 emit => '. mul%XXM %binop',
1339 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1340 ins => [ "base", "index", "mem", "left", "right" ],
1341 am => "source,binary",
1342 emit => '. max%XXM %binop',
1350 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1351 ins => [ "base", "index", "mem", "left", "right" ],
1352 am => "source,binary",
1353 emit => '. min%XXM %binop',
1361 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1362 ins => [ "base", "index", "mem", "left", "right" ],
1363 am => "source,binary",
1364 emit => '. andp%XSD %binop',
1372 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1373 ins => [ "base", "index", "mem", "left", "right" ],
1374 am => "source,binary",
1375 emit => '. orp%XSD %binop',
1382 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1383 ins => [ "base", "index", "mem", "left", "right" ],
1384 am => "source,binary",
1385 emit => '. xorp%XSD %binop',
1391 # not commutative operations
1395 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1396 ins => [ "base", "index", "mem", "left", "right" ],
1397 am => "source,binary",
1398 emit => '. andnp%XSD %binop',
1406 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1407 ins => [ "base", "index", "mem", "left", "right" ],
1408 am => "source,binary",
1409 emit => '. sub%XXM %binop',
1417 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1418 ins => [ "base", "index", "mem", "left", "right" ],
1419 am => "source,binary",
1420 outs => [ "res", "M" ],
1421 emit => '. div%XXM %binop',
1430 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1431 ins => [ "base", "index", "mem", "left", "right" ],
1432 outs => [ "flags" ],
1433 am => "source,binary",
1434 attr => "int flipped",
1435 init_attr => "attr->data.cmp_flipped = flipped;",
1436 emit => ' .ucomi%XXM %binop',
1439 mode => $mode_flags,
1440 modified_flags => 1,
1447 state => "exc_pinned",
1448 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1449 ins => [ "base", "index", "mem" ],
1450 emit => '. mov%XXM %AM, %D0',
1451 attr => "ir_mode *load_mode",
1452 init_attr => "attr->ls_mode = load_mode;",
1453 outs => [ "res", "M" ],
1460 state => "exc_pinned",
1461 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1462 ins => [ "base", "index", "mem", "val" ],
1463 emit => '. mov%XXM %S3, %AM',
1471 state => "exc_pinned",
1472 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1473 ins => [ "base", "index", "mem", "val" ],
1474 emit => '. mov%XXM %S3, %AM',
1482 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1483 ins => [ "base", "index", "mem", "val" ],
1484 am => "source,unary",
1485 emit => '. cvtsi2ss %unop3, %D0',
1493 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1494 ins => [ "base", "index", "mem", "val" ],
1495 am => "source,unary",
1496 emit => '. cvtsi2sd %unop3, %D0',
1505 cmp_attr => "return 1;",
1511 cmp_attr => "return 1;",
1520 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1521 outs => [ "DST", "SRC", "CNT", "M" ],
1523 # we don't care about this flag, so no need to mark this node
1524 # modified_flags => [ "DF" ]
1530 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1531 outs => [ "DST", "SRC", "M" ],
1533 # we don't care about this flag, so no need to mark this node
1534 # modified_flags => [ "DF" ]
1540 state => "exc_pinned",
1541 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1542 ins => [ "base", "index", "mem", "val" ],
1543 am => "source,unary",
1545 attr => "ir_mode *smaller_mode",
1546 init_attr => "attr->ls_mode = smaller_mode;",
1551 state => "exc_pinned",
1552 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1553 ins => [ "base", "index", "mem", "val" ],
1554 am => "source,unary",
1556 attr => "ir_mode *smaller_mode",
1557 init_attr => "attr->ls_mode = smaller_mode;",
1562 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
1563 ins => [ "base", "index", "mem", "val" ],
1564 am => "source,unary",
1571 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1572 ins => [ "base", "index", "mem", "val" ],
1573 am => "source,unary",
1580 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1581 ins => [ "base", "index", "mem", "val" ],
1582 am => "source,unary",
1588 #----------------------------------------------------------#
1590 # (_) | | | | / _| | | | #
1591 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1592 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1593 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1594 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1596 # _ __ ___ __| | ___ ___ #
1597 # | '_ \ / _ \ / _` |/ _ \/ __| #
1598 # | | | | (_) | (_| | __/\__ \ #
1599 # |_| |_|\___/ \__,_|\___||___/ #
1600 #----------------------------------------------------------#
1602 # spilling disabled for all float nodes for now, because the fpcw handler
1603 # runs before spilling and we might end up with wrong fpcw then
1607 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1608 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1609 am => "source,binary",
1613 attr_type => "ia32_x87_attr_t",
1618 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1619 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1620 am => "source,binary",
1624 attr_type => "ia32_x87_attr_t",
1629 cmp_attr => "return 1;",
1635 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1636 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1637 am => "source,binary",
1641 attr_type => "ia32_x87_attr_t",
1645 cmp_attr => "return 1;",
1650 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1651 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1652 am => "source,binary",
1653 outs => [ "res", "M" ],
1656 attr_type => "ia32_x87_attr_t",
1660 cmp_attr => "return 1;",
1661 outs => [ "res", "M" ],
1666 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1667 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1671 attr_type => "ia32_x87_attr_t",
1675 cmp_attr => "return 1;",
1681 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1686 attr_type => "ia32_x87_attr_t",
1691 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1696 attr_type => "ia32_x87_attr_t",
1699 # virtual Load and Store
1703 state => "exc_pinned",
1704 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1705 ins => [ "base", "index", "mem" ],
1706 outs => [ "res", "M" ],
1707 attr => "ir_mode *load_mode",
1708 init_attr => "attr->attr.ls_mode = load_mode;",
1711 attr_type => "ia32_x87_attr_t",
1716 state => "exc_pinned",
1717 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1718 ins => [ "base", "index", "mem", "val" ],
1719 attr => "ir_mode *store_mode",
1720 init_attr => "attr->attr.ls_mode = store_mode;",
1724 attr_type => "ia32_x87_attr_t",
1730 state => "exc_pinned",
1731 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1732 outs => [ "res", "M" ],
1733 ins => [ "base", "index", "mem" ],
1736 attr_type => "ia32_x87_attr_t",
1740 cmp_attr => "return 1;",
1741 outs => [ "res", "M" ],
1746 state => "exc_pinned",
1747 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1748 ins => [ "base", "index", "mem", "val", "fpcw" ],
1752 attr_type => "ia32_x87_attr_t",
1756 cmp_attr => "return 1;",
1757 state => "exc_pinned",
1767 reg_req => { out => [ "vfp" ] },
1771 attr_type => "ia32_x87_attr_t",
1776 reg_req => { out => [ "vfp" ] },
1780 attr_type => "ia32_x87_attr_t",
1785 reg_req => { out => [ "vfp" ] },
1789 attr_type => "ia32_x87_attr_t",
1794 reg_req => { out => [ "vfp" ] },
1798 attr_type => "ia32_x87_attr_t",
1803 reg_req => { out => [ "vfp" ] },
1807 attr_type => "ia32_x87_attr_t",
1812 reg_req => { out => [ "vfp" ] },
1816 attr_type => "ia32_x87_attr_t",
1821 reg_req => { out => [ "vfp" ] },
1825 attr_type => "ia32_x87_attr_t",
1831 # we can't allow to rematerialize this node so we don't have
1832 # accidently produce Phi(Fucom, Fucom(flipped))
1834 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1835 ins => [ "left", "right" ],
1836 outs => [ "flags" ],
1837 attr => "int flipped",
1838 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1841 attr_type => "ia32_x87_attr_t",
1847 reg_req => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
1848 ins => [ "left", "right" ],
1849 outs => [ "flags" ],
1850 attr => "int flipped",
1851 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1854 attr_type => "ia32_x87_attr_t",
1860 reg_req => { in => [ "vfp" ], out => [ "eax" ] },
1862 outs => [ "flags" ],
1863 attr => "int flipped",
1864 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1867 attr_type => "ia32_x87_attr_t",
1873 reg_req => { in => [ "eax" ], out => [ "eflags" ] },
1875 outs => [ "flags" ],
1878 mode => $mode_flags,
1881 #------------------------------------------------------------------------#
1882 # ___ _____ __ _ _ _ #
1883 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1884 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1885 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1886 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1887 #------------------------------------------------------------------------#
1889 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1890 # are swapped, we work this around in the emitter...
1894 rd_constructor => "NONE",
1896 emit => '. fadd%XM %x87_binop',
1897 attr_type => "ia32_x87_attr_t",
1902 rd_constructor => "NONE",
1904 emit => '. faddp%XM %x87_binop',
1905 attr_type => "ia32_x87_attr_t",
1910 rd_constructor => "NONE",
1912 emit => '. fmul%XM %x87_binop',
1913 attr_type => "ia32_x87_attr_t",
1918 rd_constructor => "NONE",
1920 emit => '. fmulp%XM %x87_binop',,
1921 attr_type => "ia32_x87_attr_t",
1926 rd_constructor => "NONE",
1928 emit => '. fsub%XM %x87_binop',
1929 attr_type => "ia32_x87_attr_t",
1934 rd_constructor => "NONE",
1936 # see note about gas bugs
1937 emit => '. fsubrp%XM %x87_binop',
1938 attr_type => "ia32_x87_attr_t",
1943 rd_constructor => "NONE",
1946 emit => '. fsubr%XM %x87_binop',
1947 attr_type => "ia32_x87_attr_t",
1952 rd_constructor => "NONE",
1955 # see note about gas bugs
1956 emit => '. fsubp%XM %x87_binop',
1957 attr_type => "ia32_x87_attr_t",
1962 rd_constructor => "NONE",
1965 attr_type => "ia32_x87_attr_t",
1968 # this node is just here, to keep the simulator running
1969 # we can omit this when a fprem simulation function exists
1972 rd_constructor => "NONE",
1975 attr_type => "ia32_x87_attr_t",
1980 rd_constructor => "NONE",
1982 emit => '. fdiv%XM %x87_binop',
1983 attr_type => "ia32_x87_attr_t",
1988 rd_constructor => "NONE",
1990 # see note about gas bugs
1991 emit => '. fdivrp%XM %x87_binop',
1992 attr_type => "ia32_x87_attr_t",
1997 rd_constructor => "NONE",
1999 emit => '. fdivr%XM %x87_binop',
2000 attr_type => "ia32_x87_attr_t",
2005 rd_constructor => "NONE",
2007 # see note about gas bugs
2008 emit => '. fdivp%XM %x87_binop',
2009 attr_type => "ia32_x87_attr_t",
2014 rd_constructor => "NONE",
2017 attr_type => "ia32_x87_attr_t",
2022 rd_constructor => "NONE",
2025 attr_type => "ia32_x87_attr_t",
2028 # x87 Load and Store
2031 rd_constructor => "NONE",
2032 op_flags => "R|L|F",
2033 state => "exc_pinned",
2035 emit => '. fld%XM %AM',
2036 attr_type => "ia32_x87_attr_t",
2040 rd_constructor => "NONE",
2041 op_flags => "R|L|F",
2042 state => "exc_pinned",
2044 emit => '. fst%XM %AM',
2046 attr_type => "ia32_x87_attr_t",
2050 rd_constructor => "NONE",
2051 op_flags => "R|L|F",
2052 state => "exc_pinned",
2054 emit => '. fstp%XM %AM',
2056 attr_type => "ia32_x87_attr_t",
2063 rd_constructor => "NONE",
2065 emit => '. fild%M %AM',
2066 attr_type => "ia32_x87_attr_t",
2071 state => "exc_pinned",
2072 rd_constructor => "NONE",
2074 emit => '. fist%M %AM',
2076 attr_type => "ia32_x87_attr_t",
2081 state => "exc_pinned",
2082 rd_constructor => "NONE",
2084 emit => '. fistp%M %AM',
2086 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 op_flags => "R|c|K",
2102 reg_req => { out => [ "vfp" ] },
2104 attr_type => "ia32_x87_attr_t",
2108 op_flags => "R|c|K",
2110 reg_req => { out => [ "vfp" ] },
2112 attr_type => "ia32_x87_attr_t",
2116 op_flags => "R|c|K",
2118 reg_req => { out => [ "vfp" ] },
2120 attr_type => "ia32_x87_attr_t",
2124 op_flags => "R|c|K",
2126 reg_req => { out => [ "vfp" ] },
2128 attr_type => "ia32_x87_attr_t",
2132 op_flags => "R|c|K",
2134 reg_req => { out => [ "vfp" ] },
2135 emit => '. fldll2t',
2136 attr_type => "ia32_x87_attr_t",
2140 op_flags => "R|c|K",
2142 reg_req => { out => [ "vfp" ] },
2144 attr_type => "ia32_x87_attr_t",
2148 # Note that it is NEVER allowed to do CSE on these nodes
2149 # Moreover, note the virtual register requierements!
2154 cmp_attr => "return 1;",
2155 emit => '. fxch %X0',
2156 attr_type => "ia32_x87_attr_t",
2163 cmp_attr => "return 1;",
2164 emit => '. fld %X0',
2165 attr_type => "ia32_x87_attr_t",
2171 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2172 cmp_attr => "return 1;",
2173 emit => '. fld %X0',
2174 attr_type => "ia32_x87_attr_t",
2180 cmp_attr => "return 1;",
2181 emit => '. fstp %X0',
2182 attr_type => "ia32_x87_attr_t",
2189 cmp_attr => "return 1;",
2190 emit => '. ffreep %X0',
2191 attr_type => "ia32_x87_attr_t",
2198 cmp_attr => "return 1;",
2200 attr_type => "ia32_x87_attr_t",
2207 cmp_attr => "return 1;",
2209 attr_type => "ia32_x87_attr_t",
2217 emit => ". fucom %X1\n".
2219 attr_type => "ia32_x87_attr_t",
2224 emit => ". fucomp %X1\n".
2226 attr_type => "ia32_x87_attr_t",
2231 emit => ". fucompp\n".
2233 attr_type => "ia32_x87_attr_t",
2238 emit => '. fucomi %X1',
2239 attr_type => "ia32_x87_attr_t",
2244 emit => '. fucompi %X1',
2245 attr_type => "ia32_x87_attr_t",
2252 attr_type => "ia32_x87_attr_t",
2256 # -------------------------------------------------------------------------------- #
2257 # ____ ____ _____ _ _ #
2258 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2259 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2260 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2261 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2263 # -------------------------------------------------------------------------------- #
2266 # Spilling and reloading of SSE registers, hardcoded, not generated #
2270 state => "exc_pinned",
2271 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2272 emit => '. movdqu %D0, %AM',
2273 outs => [ "res", "M" ],
2279 state => "exc_pinned",
2280 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2281 ins => [ "base", "index", "mem", "val" ],
2282 emit => '. movdqu %binop',
2289 # Include the generated SIMD node specification written by the SIMD optimization
2290 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2291 unless ($return = do $my_script_name) {
2292 warn "couldn't parse $my_script_name: $@" if $@;
2293 warn "couldn't do $my_script_name: $!" unless defined $return;
2294 warn "couldn't run $my_script_name" unless $return;