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 S4 => "${arch}_emit_source_register(node, 4);",
201 S5 => "${arch}_emit_source_register(node, 5);",
202 SB1 => "${arch}_emit_8bit_source_register_or_immediate(node, 1);",
203 SB2 => "${arch}_emit_8bit_source_register_or_immediate(node, 2);",
204 SB3 => "${arch}_emit_8bit_source_register_or_immediate(node, 3);",
205 SI0 => "${arch}_emit_source_register_or_immediate(node, 0);",
206 SI1 => "${arch}_emit_source_register_or_immediate(node, 1);",
207 SI2 => "${arch}_emit_source_register_or_immediate(node, 2);",
208 SI3 => "${arch}_emit_source_register_or_immediate(node, 3);",
209 D0 => "${arch}_emit_dest_register(node, 0);",
210 D1 => "${arch}_emit_dest_register(node, 1);",
211 D2 => "${arch}_emit_dest_register(node, 2);",
212 D3 => "${arch}_emit_dest_register(node, 3);",
213 D4 => "${arch}_emit_dest_register(node, 4);",
214 D5 => "${arch}_emit_dest_register(node, 5);",
215 DB0 => "${arch}_emit_8bit_dest_register(node, 0);",
216 X0 => "${arch}_emit_x87_register(node, 0);",
217 X1 => "${arch}_emit_x87_register(node, 1);",
218 X2 => "${arch}_emit_x87_register(node, 2);",
219 SE => "${arch}_emit_extend_suffix(get_ia32_ls_mode(node));",
220 ME => "if(get_mode_size_bits(get_ia32_ls_mode(node)) != 32)\n
221 ia32_emit_mode_suffix(node);",
222 M => "${arch}_emit_mode_suffix(node);",
223 XM => "${arch}_emit_x87_mode_suffix(node);",
224 XXM => "${arch}_emit_xmm_mode_suffix(node);",
225 XSD => "${arch}_emit_xmm_mode_suffix_s(node);",
226 AM => "${arch}_emit_am(node);",
227 unop0 => "${arch}_emit_unop(node, 0);",
228 unop1 => "${arch}_emit_unop(node, 1);",
229 unop2 => "${arch}_emit_unop(node, 2);",
230 unop3 => "${arch}_emit_unop(node, 3);",
231 unop4 => "${arch}_emit_unop(node, 4);",
232 unop5 => "${arch}_emit_unop(node, 5);",
233 DAM0 => "${arch}_emit_am_or_dest_register(node, 0);",
234 DAM1 => "${arch}_emit_am_or_dest_register(node, 1);",
235 binop => "${arch}_emit_binop(node, 1);",
236 binop_nores => "${arch}_emit_binop(node, 0);",
237 x87_binop => "${arch}_emit_x87_binop(node);",
238 CMP0 => "${arch}_emit_cmp_suffix_node(node, 0);",
241 #--------------------------------------------------#
244 # _ __ _____ __ _ _ __ ___ _ __ ___ #
245 # | '_ \ / _ \ \ /\ / / | | '__| / _ \| '_ \/ __| #
246 # | | | | __/\ V V / | | | | (_) | |_) \__ \ #
247 # |_| |_|\___| \_/\_/ |_|_| \___/| .__/|___/ #
250 #--------------------------------------------------#
252 $default_attr_type = "ia32_attr_t";
253 $default_copy_attr = "ia32_copy_attr";
255 sub ia32_custom_init_attr {
259 if(defined($node->{modified_flags})) {
260 $res .= "\tset_ia32_flags(res, get_ia32_flags(res) | arch_irn_flags_modify_flags);\n";
262 if(defined($node->{am})) {
263 my $am = $node->{am};
264 if($am eq "full,binary") {
265 $res .= "\tset_ia32_am_support(res, ia32_am_Full, ia32_am_binary);";
266 } elsif($am eq "full,unary") {
267 $res .= "\tset_ia32_am_support(res, ia32_am_Full, ia32_am_unary);";
268 } elsif($am eq "source,binary") {
269 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_binary);";
270 } elsif($am eq "dest,unary") {
271 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_unary);";
272 } elsif($am eq "dest,binary") {
273 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_binary);";
274 } elsif($am eq "dest,ternary") {
275 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_ternary);";
276 } elsif($am eq "source,ternary") {
277 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_ternary);";
278 } elsif($am eq "none") {
281 die("Invalid address mode '$am' specified on op $name");
286 $custom_init_attr_func = \&ia32_custom_init_attr;
289 ia32_attr_t => "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);",
291 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
292 "\tinit_ia32_x87_attributes(res);",
294 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
295 "\tinit_ia32_x87_attributes(res);".
296 "\tinit_ia32_asm_attributes(res);",
297 ia32_immediate_attr_t =>
298 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
299 "\tinit_ia32_immediate_attributes(res, symconst, symconst_sign, offset);"
303 ia32_attr_t => "ia32_compare_nodes_attr",
304 ia32_x87_attr_t => "ia32_compare_x87_attr",
305 ia32_asm_attr_t => "ia32_compare_asm_attr",
306 ia32_immediate_attr_t => "ia32_compare_immediate_attr",
312 $mode_xmm = "mode_E";
313 $mode_gp = "mode_Iu";
314 $mode_flags = "mode_Iu";
315 $mode_fpcw = "mode_fpcw";
316 $status_flags = [ "CF", "PF", "AF", "ZF", "SF", "OF" ];
317 $fpcw_flags = [ "FP_IM", "FP_DM", "FP_ZM", "FP_OM", "FP_UM", "FP_PM",
318 "FP_PC0", "FP_PC1", "FP_RC0", "FP_RC1", "FP_X" ];
326 reg_req => { out => [ "gp_NOREG" ] },
327 attr => "ir_entity *symconst, int symconst_sign, long offset",
328 attr_type => "ia32_immediate_attr_t",
336 out_arity => "variable",
337 attr_type => "ia32_asm_attr_t",
344 reg_req => { out => [ "gp" ] },
349 cmp_attr => "return 1;",
352 #-----------------------------------------------------------------#
355 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
356 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
357 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
358 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
361 #-----------------------------------------------------------------#
363 # commutative operations
367 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4", "none", "flags" ] },
368 ins => [ "base", "index", "mem", "left", "right" ],
369 emit => '. add%M %binop',
373 modified_flags => $status_flags
378 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
379 ins => [ "base", "index", "mem", "val" ],
380 emit => ". add%M %SI3, %AM",
383 modified_flags => $status_flags
388 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
389 ins => [ "base", "index", "mem", "val" ],
390 emit => ". add%M %SB3, %AM",
393 modified_flags => $status_flags
397 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4" ] },
398 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
399 emit => '. adc%M %binop',
403 modified_flags => $status_flags
408 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
409 ins => [ "left", "right" ],
413 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
414 ins => [ "left", "right", "eflags" ],
420 reg_req => { in => [ "gp", "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
427 outs => [ "low_res", "high_res" ],
429 modified_flags => $status_flags
433 # we should not rematrialize this node. It produces 2 results and has
434 # very strict constrains
435 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
436 ins => [ "base", "index", "mem", "val_high", "val_low" ],
437 emit => '. mul%M %unop4',
438 outs => [ "EAX", "EDX", "M" ],
439 am => "source,binary",
442 modified_flags => $status_flags
446 # we should not rematrialize this node. It produces 2 results and has
447 # very strict constrains
449 cmp_attr => "return 1;",
450 outs => [ "EAX", "EDX", "M" ],
456 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4" ] },
457 ins => [ "base", "index", "mem", "left", "right" ],
458 emit => '. imul%M %binop',
459 am => "source,binary",
463 modified_flags => $status_flags
468 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
469 ins => [ "base", "index", "mem", "val_high", "val_low" ],
470 emit => '. imul%M %unop4',
471 outs => [ "EAX", "EDX", "M" ],
472 am => "source,binary",
475 modified_flags => $status_flags
479 # we should not rematrialize this node. It produces 2 results and has
480 # very strict constrains
482 cmp_attr => "return 1;",
483 outs => [ "EAX", "EDX", "M" ],
489 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4" ] },
490 ins => [ "base", "index", "mem", "left", "right" ],
492 emit => '. and%M %binop',
495 modified_flags => $status_flags
500 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
501 ins => [ "base", "index", "mem", "val" ],
502 emit => '. and%M %SI3, %AM',
505 modified_flags => $status_flags
510 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
511 ins => [ "base", "index", "mem", "val" ],
512 emit => '. and%M %SB3, %AM',
515 modified_flags => $status_flags
520 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4" ] },
521 ins => [ "base", "index", "mem", "left", "right" ],
523 emit => '. or%M %binop',
526 modified_flags => $status_flags
531 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
532 ins => [ "base", "index", "mem", "val" ],
533 emit => '. or%M %SI3, %AM',
536 modified_flags => $status_flags
541 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
542 ins => [ "base", "index", "mem", "val" ],
543 emit => '. or%M %SB3, %AM',
546 modified_flags => $status_flags
551 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4" ] },
552 ins => [ "base", "index", "mem", "left", "right" ],
554 emit => '. xor%M %binop',
557 modified_flags => $status_flags
562 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
563 ins => [ "base", "index", "mem", "val" ],
564 emit => '. xor%M %SI3, %AM',
567 modified_flags => $status_flags
572 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
573 ins => [ "base", "index", "mem", "val" ],
574 emit => '. xor%M %SB3, %AM',
577 modified_flags => $status_flags
580 # not commutative operations
584 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4" ] },
585 ins => [ "base", "index", "mem", "left", "right" ],
587 emit => '. sub%M %binop',
590 modified_flags => $status_flags
595 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
596 ins => [ "base", "index", "mem", "val" ],
597 emit => '. sub%M %SI3, %AM',
600 modified_flags => $status_flags
605 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
606 ins => [ "base", "index", "mem", "val" ],
607 emit => '. sub%M %SB3, %AM',
610 modified_flags => $status_flags
614 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 !in_r5" ] },
615 ins => [ "base", "index", "mem", "left", "right" ],
617 emit => '. sbb%M %binop',
620 modified_flags => $status_flags
626 reg_req => { in => [ "gp", "gp", "gp", "gp" ], out => [ "!in", "!in" ] },
633 outs => [ "low_res", "high_res" ],
635 modified_flags => $status_flags
640 state => "exc_pinned",
641 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
642 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
643 outs => [ "div_res", "mod_res", "M" ],
644 attr => "ia32_op_flavour_t dm_flav",
645 am => "source,ternary",
646 init_attr => "attr->data.op_flav = dm_flav;",
647 emit => ". idiv%M %unop5",
650 modified_flags => $status_flags
655 state => "exc_pinned",
656 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
657 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
658 outs => [ "div_res", "mod_res", "M" ],
659 attr => "ia32_op_flavour_t dm_flav",
660 am => "source,ternary",
661 init_attr => "attr->data.op_flav = dm_flav;",
662 emit => ". div%M %unop5",
665 modified_flags => $status_flags
670 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
671 ins => [ "left", "right" ],
673 emit => '. shl %SB1, %S0',
676 modified_flags => $status_flags
681 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
682 ins => [ "base", "index", "mem", "count" ],
683 emit => '. shl%M %SB3, %AM',
686 modified_flags => $status_flags
690 cmp_attr => "return 1;",
691 # value, cnt, dependency
696 # FIXME: WHY? the right requirement is in_r3 !in_r5, especially this is the same as in Shl
698 # Out requirements is: different from all in
699 # This is because, out must be different from LowPart and ShiftCount.
700 # We could say "!ecx !in_r4" but it can occur, that all values live through
701 # this Shift and the only value dying is the ShiftCount. Then there would be a
702 # register missing, as result must not be ecx and all other registers are
703 # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
704 # (and probably never will). So we create artificial interferences of the result
705 # with all inputs, so the spiller can always assure a free register.
706 # reg_req => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
709 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "in_r1 !in_r3" ] },
710 ins => [ "left_high", "left_low", "right" ],
711 am => "dest,ternary",
712 emit => '. shld%M %SB2, %S1, %S0',
716 modified_flags => $status_flags
720 cmp_attr => "return 1;",
726 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
727 ins => [ "val", "count" ],
729 emit => '. shr %SB1, %S0',
732 modified_flags => $status_flags
737 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
738 ins => [ "base", "index", "mem", "count" ],
739 emit => '. shr%M %SB3, %AM',
742 modified_flags => $status_flags
746 cmp_attr => "return 1;",
747 # value, cnt, dependency
752 # FIXME: WHY? the right requirement is in_r3 !in_r5, especially this is the same as in Shr
754 # Out requirements is: different from all in
755 # This is because, out must be different from LowPart and ShiftCount.
756 # We could say "!ecx !in_r4" but it can occur, that all values live through
757 # this Shift and the only value dying is the ShiftCount. Then there would be a
758 # register missing, as result must not be ecx and all other registers are
759 # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
760 # (and probably never will). So we create artificial interferences of the result
761 # with all inputs, so the spiller can always assure a free register.
762 # reg_req => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
765 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "in_r1 !in_r3" ] },
766 ins => [ "left_high", "left_low", "right" ],
767 am => "dest,ternary",
768 emit => '. shrd%M %SB2, %S1, %S0',
772 modified_flags => $status_flags
776 cmp_attr => "return 1;",
782 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
783 ins => [ "val", "count" ],
785 emit => '. sar %SB1, %S0',
788 modified_flags => $status_flags
793 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
794 ins => [ "base", "index", "mem", "count" ],
795 emit => '. sar%M %SB3, %AM',
798 modified_flags => $status_flags
802 cmp_attr => "return 1;",
808 cmp_attr => "return 1;",
809 # value, cnt, dependency
815 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
816 ins => [ "val", "count" ],
818 emit => '. ror %SB1, %S0',
821 modified_flags => $status_flags
826 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
827 ins => [ "base", "index", "mem", "count" ],
828 emit => '. ror%M %SB3, %AM',
831 modified_flags => $status_flags
836 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
837 ins => [ "val", "count" ],
839 emit => '. rol %SB1, %S0',
842 modified_flags => $status_flags
847 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
848 ins => [ "base", "index", "mem", "count" ],
849 emit => '. rol%M %SB3, %AM',
852 modified_flags => $status_flags
859 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
865 modified_flags => $status_flags
870 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
871 ins => [ "base", "index", "mem" ],
872 emit => '. neg%M %AM',
875 modified_flags => $status_flags
880 reg_req => { in => [ "gp", "gp" ], out => [ "in_r1", "gp" ] },
881 outs => [ "low_res", "high_res" ],
883 modified_flags => $status_flags
888 cmp_attr => "return 1;",
894 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
899 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
904 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
905 ins => [ "base", "index", "mem" ],
906 emit => '. inc%M %AM',
909 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
914 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
919 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
924 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
925 ins => [ "base", "index", "mem" ],
926 emit => '. dec%M %AM',
929 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
934 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
944 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
945 ins => [ "base", "index", "mem" ],
946 emit => '. not%M %AM',
955 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
956 ins => [ "base", "index", "mem", "left", "right" ],
957 outs => [ "eflags" ],
958 am => "source,binary",
959 emit => '. cmp%M %binop_nores',
960 attr => "int flipped, int cmp_unsigned",
961 init_attr => "attr->data.cmp_flipped = flipped;\n".
962 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
966 modified_flags => $status_flags
971 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
972 ins => [ "base", "index", "mem", "left", "right" ],
973 outs => [ "eflags" ],
974 am => "source,binary",
975 emit => '. cmpb %binop_nores',
976 attr => "int flipped, int cmp_unsigned",
977 init_attr => "attr->data.cmp_flipped = flipped;\n".
978 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
982 modified_flags => $status_flags
987 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
988 ins => [ "base", "index", "mem", "left", "right" ],
989 outs => [ "eflags" ],
990 am => "source,binary",
991 emit => '. test%M %binop_nores',
992 attr => "int flipped, int cmp_unsigned",
993 init_attr => "attr->data.cmp_flipped = flipped;\n".
994 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
998 modified_flags => $status_flags
1003 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
1004 ins => [ "base", "index", "mem", "left", "right" ],
1005 outs => [ "eflags" ],
1006 am => "source,binary",
1007 emit => '. testb %binop_nores',
1008 attr => "int flipped, int cmp_unsigned",
1009 init_attr => "attr->data.cmp_flipped = flipped;\n".
1010 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
1013 mode => $mode_flags,
1014 modified_flags => $status_flags
1019 reg_req => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
1020 ins => [ "eflags" ],
1022 attr => "pn_Cmp pnc",
1023 init_attr => "attr->pn_code = pnc;\nset_ia32_ls_mode(res, mode_Bu);\n",
1024 emit => '. set%CMP0 %DB0',
1032 # (note: leave the false,true order intact to make it compatible with other
1034 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4" ] },
1035 ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
1036 am => "source,binary",
1037 attr => "pn_Cmp pn_code",
1038 init_attr => "attr->pn_code = pn_code;",
1046 op_flags => "L|X|Y",
1047 reg_req => { in => [ "eflags" ], out => [ "none", "none" ] },
1048 ins => [ "eflags" ],
1049 outs => [ "false", "true" ],
1050 attr => "pn_Cmp pnc",
1051 init_attr => "attr->pn_code = pnc;",
1053 units => [ "BRANCH" ],
1058 op_flags => "L|X|Y",
1059 reg_req => { in => [ "gp" ], out => [ "none" ] },
1061 units => [ "BRANCH" ],
1063 modified_flags => $status_flags
1069 reg_req => { in => [ "gp" ] },
1070 emit => '. jmp *%S0',
1071 units => [ "BRANCH" ],
1078 reg_req => { out => [ "gp" ] },
1080 attr => "ir_entity *symconst, int symconst_sign, long offset",
1081 attr_type => "ia32_immediate_attr_t",
1083 # depends on the const and is set in ia32_transform
1084 # modified_flags => $status_flags
1091 reg_req => { out => [ "gp_UKNWN" ] },
1101 reg_req => { out => [ "vfp_UKNWN" ] },
1105 attr_type => "ia32_x87_attr_t",
1112 reg_req => { out => [ "xmm_UKNWN" ] },
1122 reg_req => { out => [ "gp_NOREG" ] },
1132 reg_req => { out => [ "vfp_NOREG" ] },
1136 attr_type => "ia32_x87_attr_t",
1143 reg_req => { out => [ "xmm_NOREG" ] },
1153 reg_req => { out => [ "fp_cw" ] },
1157 modified_flags => $fpcw_flags
1163 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1164 ins => [ "base", "index", "mem" ],
1166 emit => ". fldcw %AM",
1169 modified_flags => $fpcw_flags
1175 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1176 ins => [ "base", "index", "mem", "fpcw" ],
1178 emit => ". fnstcw %AM",
1184 # we should not rematrialize this node. It has very strict constraints.
1185 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1186 ins => [ "val", "globbered" ],
1194 # Note that we add additional latency values depending on address mode, so a
1195 # lateny of 0 for load is correct
1199 state => "exc_pinned",
1200 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1201 ins => [ "base", "index", "mem" ],
1202 outs => [ "res", "M" ],
1204 emit => ". mov%SE%ME%.l %AM, %D0",
1210 cmp_attr => "return 1;",
1211 outs => [ "res", "M" ],
1217 cmp_attr => "return 1;",
1218 state => "exc_pinned",
1225 state => "exc_pinned",
1226 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1227 ins => [ "base", "index", "mem", "val" ],
1228 emit => '. mov%M %SI3, %AM',
1236 state => "exc_pinned",
1237 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1238 ins => [ "base", "index", "mem", "val" ],
1239 emit => '. mov%M %SB3, %AM',
1247 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1248 ins => [ "base", "index" ],
1249 emit => '. leal %AM, %D0',
1253 # well this isn't true for Lea, but we often transform Lea back to Add, Inc
1254 # or Dec, so we set the flag
1255 modified_flags => 1,
1259 reg_req => { in => [ "gp", "gp", "none", "gp", "esp" ], out => [ "esp", "none" ] },
1260 ins => [ "base", "index", "mem", "val", "stack" ],
1261 emit => '. push%M %unop3',
1262 outs => [ "stack:I|S", "M" ],
1263 am => "source,binary",
1269 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1270 emit => '. pop%M %DAM1',
1271 outs => [ "stack:I|S", "res", "M" ],
1272 ins => [ "base", "index", "mem", "stack" ],
1274 latency => 3, # Pop is more expensive than Push on Athlon
1279 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1281 outs => [ "frame:I", "stack:I|S", "M" ],
1287 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1289 outs => [ "frame:I", "stack:I|S" ],
1297 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1298 ins => [ "base", "index", "mem", "stack", "size" ],
1299 am => "source,binary",
1300 emit => '. addl %binop',
1301 outs => [ "stack:S", "M" ],
1303 modified_flags => $status_flags
1309 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1310 ins => [ "base", "index", "mem", "stack", "size" ],
1311 am => "source,binary",
1312 emit => ". subl %binop\n".
1313 ". movl %%esp, %D1",
1314 outs => [ "stack:I|S", "addr", "M" ],
1316 modified_flags => $status_flags
1321 reg_req => { out => [ "gp" ] },
1325 # the int instruction
1327 reg_req => { in => [ "gp" ], out => [ "none" ] },
1329 emit => '. int %SI0',
1331 cmp_attr => "return 1;",
1335 #-----------------------------------------------------------------------------#
1336 # _____ _____ ______ __ _ _ _ #
1337 # / ____/ ____| ____| / _| | | | | | #
1338 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1339 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1340 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1341 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1342 #-----------------------------------------------------------------------------#
1346 reg_req => { out => [ "xmm" ] },
1347 emit => '. xorp%XSD %D1, %D1',
1353 # commutative operations
1357 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1358 ins => [ "base", "index", "mem", "left", "right" ],
1359 emit => '. add%XXM %binop',
1367 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1368 ins => [ "base", "index", "mem", "left", "right" ],
1369 emit => '. mul%XXM %binop',
1377 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1378 ins => [ "base", "index", "mem", "left", "right" ],
1379 emit => '. max%XXM %binop',
1387 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1388 ins => [ "base", "index", "mem", "left", "right" ],
1389 emit => '. min%XXM %binop',
1397 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1398 ins => [ "base", "index", "mem", "left", "right" ],
1399 emit => '. andp%XSD %binop',
1407 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1408 ins => [ "base", "index", "mem", "left", "right" ],
1409 emit => '. orp%XSD %binop',
1416 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1417 ins => [ "base", "index", "mem", "left", "right" ],
1418 emit => '. xorp%XSD %binop',
1424 # not commutative operations
1428 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1429 ins => [ "base", "index", "mem", "left", "right" ],
1430 emit => '. andnp%XSD %binop',
1438 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1439 ins => [ "base", "index", "mem", "left", "right" ],
1440 emit => '. sub%XXM %binop',
1448 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1449 ins => [ "base", "index", "mem", "left", "right" ],
1450 outs => [ "res", "M" ],
1451 emit => '. div%XXM %binop',
1460 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1461 ins => [ "base", "index", "mem", "left", "right" ],
1462 outs => [ "flags" ],
1463 am => "source,binary",
1464 attr => "int flipped",
1465 init_attr => "attr->data.cmp_flipped = flipped;",
1466 emit => ' .ucomi%XXM %binop_nores',
1469 mode => $mode_flags,
1470 modified_flags => 1,
1477 state => "exc_pinned",
1478 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1479 ins => [ "base", "index", "mem" ],
1480 emit => '. mov%XXM %AM, %D0',
1481 attr => "ir_mode *load_mode",
1482 init_attr => "attr->ls_mode = load_mode;",
1483 outs => [ "res", "M" ],
1490 state => "exc_pinned",
1491 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1492 ins => [ "base", "index", "mem", "val" ],
1493 emit => '. mov%XXM %S3, %AM',
1501 state => "exc_pinned",
1502 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1503 ins => [ "base", "index", "mem", "val" ],
1504 emit => '. mov%XXM %S3, %AM',
1512 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1513 ins => [ "base", "index", "mem", "val" ],
1514 emit => '. cvtsi2ss %D0, %AM',
1522 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1523 ins => [ "base", "index", "mem", "val" ],
1524 emit => '. cvtsi2sd %unop3',
1533 cmp_attr => "return 1;",
1539 cmp_attr => "return 1;",
1548 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1549 outs => [ "DST", "SRC", "CNT", "M" ],
1551 # we don't care about this flag, so no need to mark this node
1552 # modified_flags => [ "DF" ]
1558 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1559 outs => [ "DST", "SRC", "M" ],
1561 # we don't care about this flag, so no need to mark this node
1562 # modified_flags => [ "DF" ]
1568 state => "exc_pinned",
1569 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1570 ins => [ "base", "index", "mem", "val" ],
1572 attr => "ir_mode *smaller_mode",
1573 init_attr => "attr->ls_mode = smaller_mode;",
1578 state => "exc_pinned",
1579 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1580 ins => [ "base", "index", "mem", "val" ],
1582 attr => "ir_mode *smaller_mode",
1583 init_attr => "attr->ls_mode = smaller_mode;",
1588 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
1589 ins => [ "base", "index", "mem", "val" ],
1596 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1597 ins => [ "base", "index", "mem", "val" ],
1604 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1605 ins => [ "base", "index", "mem", "val" ],
1611 #----------------------------------------------------------#
1613 # (_) | | | | / _| | | | #
1614 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1615 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1616 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1617 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1619 # _ __ ___ __| | ___ ___ #
1620 # | '_ \ / _ \ / _` |/ _ \/ __| #
1621 # | | | | (_) | (_| | __/\__ \ #
1622 # |_| |_|\___/ \__,_|\___||___/ #
1623 #----------------------------------------------------------#
1627 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1628 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1632 attr_type => "ia32_x87_attr_t",
1637 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1638 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1642 attr_type => "ia32_x87_attr_t",
1647 cmp_attr => "return 1;",
1653 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1654 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1658 attr_type => "ia32_x87_attr_t",
1662 cmp_attr => "return 1;",
1667 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1668 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1669 outs => [ "res", "M" ],
1672 attr_type => "ia32_x87_attr_t",
1676 cmp_attr => "return 1;",
1677 outs => [ "res", "M" ],
1682 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1683 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1687 attr_type => "ia32_x87_attr_t",
1691 cmp_attr => "return 1;",
1697 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1702 attr_type => "ia32_x87_attr_t",
1707 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1712 attr_type => "ia32_x87_attr_t",
1715 # virtual Load and Store
1719 state => "exc_pinned",
1720 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1721 ins => [ "base", "index", "mem" ],
1722 outs => [ "res", "M" ],
1723 attr => "ir_mode *load_mode",
1724 init_attr => "attr->attr.ls_mode = load_mode;",
1727 attr_type => "ia32_x87_attr_t",
1732 state => "exc_pinned",
1733 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1734 ins => [ "base", "index", "mem", "val" ],
1735 attr => "ir_mode *store_mode",
1736 init_attr => "attr->attr.ls_mode = store_mode;",
1740 attr_type => "ia32_x87_attr_t",
1746 state => "exc_pinned",
1747 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1748 outs => [ "res", "M" ],
1749 ins => [ "base", "index", "mem" ],
1752 attr_type => "ia32_x87_attr_t",
1756 cmp_attr => "return 1;",
1757 outs => [ "res", "M" ],
1762 state => "exc_pinned",
1763 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1764 ins => [ "base", "index", "mem", "val", "fpcw" ],
1768 attr_type => "ia32_x87_attr_t",
1772 cmp_attr => "return 1;",
1773 state => "exc_pinned",
1783 reg_req => { out => [ "vfp" ] },
1787 attr_type => "ia32_x87_attr_t",
1792 reg_req => { out => [ "vfp" ] },
1796 attr_type => "ia32_x87_attr_t",
1801 reg_req => { out => [ "vfp" ] },
1805 attr_type => "ia32_x87_attr_t",
1810 reg_req => { out => [ "vfp" ] },
1814 attr_type => "ia32_x87_attr_t",
1819 reg_req => { out => [ "vfp" ] },
1823 attr_type => "ia32_x87_attr_t",
1828 reg_req => { out => [ "vfp" ] },
1832 attr_type => "ia32_x87_attr_t",
1837 reg_req => { out => [ "vfp" ] },
1841 attr_type => "ia32_x87_attr_t",
1847 # we can't allow to rematerialize this node so we don't have
1848 # accidently produce Phi(Fucom, Fucom(flipped))
1850 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1851 ins => [ "left", "right" ],
1852 outs => [ "flags" ],
1853 am => "source,binary",
1854 attr => "int flipped",
1855 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1858 attr_type => "ia32_x87_attr_t",
1864 reg_req => { in => [ "eax" ], out => [ "eflags" ] },
1866 outs => [ "flags" ],
1869 mode => $mode_flags,
1872 #------------------------------------------------------------------------#
1873 # ___ _____ __ _ _ _ #
1874 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1875 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1876 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1877 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1878 #------------------------------------------------------------------------#
1880 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1881 # are swapped, we work this around in the emitter...
1885 rd_constructor => "NONE",
1887 emit => '. fadd%XM %x87_binop',
1888 attr_type => "ia32_x87_attr_t",
1893 rd_constructor => "NONE",
1895 emit => '. faddp%XM %x87_binop',
1896 attr_type => "ia32_x87_attr_t",
1901 rd_constructor => "NONE",
1903 emit => '. fmul%XM %x87_binop',
1904 attr_type => "ia32_x87_attr_t",
1909 rd_constructor => "NONE",
1911 emit => '. fmulp%XM %x87_binop',,
1912 attr_type => "ia32_x87_attr_t",
1917 rd_constructor => "NONE",
1919 emit => '. fsub%XM %x87_binop',
1920 attr_type => "ia32_x87_attr_t",
1925 rd_constructor => "NONE",
1927 # see note about gas bugs
1928 emit => '. fsubrp%XM %x87_binop',
1929 attr_type => "ia32_x87_attr_t",
1934 rd_constructor => "NONE",
1937 emit => '. fsubr%XM %x87_binop',
1938 attr_type => "ia32_x87_attr_t",
1943 rd_constructor => "NONE",
1946 # see note about gas bugs
1947 emit => '. fsubp%XM %x87_binop',
1948 attr_type => "ia32_x87_attr_t",
1953 rd_constructor => "NONE",
1956 attr_type => "ia32_x87_attr_t",
1959 # this node is just here, to keep the simulator running
1960 # we can omit this when a fprem simulation function exists
1963 rd_constructor => "NONE",
1966 attr_type => "ia32_x87_attr_t",
1971 rd_constructor => "NONE",
1973 emit => '. fdiv%XM %x87_binop',
1974 attr_type => "ia32_x87_attr_t",
1979 rd_constructor => "NONE",
1981 # see note about gas bugs
1982 emit => '. fdivrp%XM %x87_binop',
1983 attr_type => "ia32_x87_attr_t",
1988 rd_constructor => "NONE",
1990 emit => '. fdivr%XM %x87_binop',
1991 attr_type => "ia32_x87_attr_t",
1996 rd_constructor => "NONE",
1998 # see note about gas bugs
1999 emit => '. fdivp%XM %x87_binop',
2000 attr_type => "ia32_x87_attr_t",
2005 rd_constructor => "NONE",
2008 attr_type => "ia32_x87_attr_t",
2013 rd_constructor => "NONE",
2016 attr_type => "ia32_x87_attr_t",
2019 # x87 Load and Store
2022 rd_constructor => "NONE",
2023 op_flags => "R|L|F",
2024 state => "exc_pinned",
2026 emit => '. fld%XM %AM',
2027 attr_type => "ia32_x87_attr_t",
2031 rd_constructor => "NONE",
2032 op_flags => "R|L|F",
2033 state => "exc_pinned",
2035 emit => '. fst%XM %AM',
2037 attr_type => "ia32_x87_attr_t",
2041 rd_constructor => "NONE",
2042 op_flags => "R|L|F",
2043 state => "exc_pinned",
2045 emit => '. fstp%XM %AM',
2047 attr_type => "ia32_x87_attr_t",
2054 rd_constructor => "NONE",
2056 emit => '. fild%M %AM',
2057 attr_type => "ia32_x87_attr_t",
2062 state => "exc_pinned",
2063 rd_constructor => "NONE",
2065 emit => '. fist%M %AM',
2067 attr_type => "ia32_x87_attr_t",
2072 state => "exc_pinned",
2073 rd_constructor => "NONE",
2075 emit => '. fistp%M %AM',
2077 attr_type => "ia32_x87_attr_t",
2083 op_flags => "R|c|K",
2087 attr_type => "ia32_x87_attr_t",
2091 op_flags => "R|c|K",
2095 attr_type => "ia32_x87_attr_t",
2099 op_flags => "R|c|K",
2103 attr_type => "ia32_x87_attr_t",
2107 op_flags => "R|c|K",
2111 attr_type => "ia32_x87_attr_t",
2115 op_flags => "R|c|K",
2119 attr_type => "ia32_x87_attr_t",
2123 op_flags => "R|c|K",
2126 emit => '. fldll2t',
2127 attr_type => "ia32_x87_attr_t",
2131 op_flags => "R|c|K",
2135 attr_type => "ia32_x87_attr_t",
2139 # Note that it is NEVER allowed to do CSE on these nodes
2140 # Moreover, note the virtual register requierements!
2145 cmp_attr => "return 1;",
2146 emit => '. fxch %X0',
2147 attr_type => "ia32_x87_attr_t",
2153 cmp_attr => "return 1;",
2154 emit => '. fld %X0',
2155 attr_type => "ia32_x87_attr_t",
2160 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2161 cmp_attr => "return 1;",
2162 emit => '. fld %X0',
2163 attr_type => "ia32_x87_attr_t",
2169 cmp_attr => "return 1;",
2170 emit => '. fstp %X0',
2171 attr_type => "ia32_x87_attr_t",
2177 cmp_attr => "return 1;",
2178 emit => '. ffreep %X0',
2179 attr_type => "ia32_x87_attr_t",
2185 cmp_attr => "return 1;",
2187 attr_type => "ia32_x87_attr_t",
2193 cmp_attr => "return 1;",
2195 attr_type => "ia32_x87_attr_t",
2203 emit => ". fucom %X1\n".
2205 attr_type => "ia32_x87_attr_t",
2211 emit => ". fucomp %X1\n".
2213 attr_type => "ia32_x87_attr_t",
2219 emit => ". fucompp\n".
2221 attr_type => "ia32_x87_attr_t",
2225 # -------------------------------------------------------------------------------- #
2226 # ____ ____ _____ _ _ #
2227 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2228 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2229 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2230 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2232 # -------------------------------------------------------------------------------- #
2235 # Spilling and reloading of SSE registers, hardcoded, not generated #
2239 state => "exc_pinned",
2240 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2241 emit => '. movdqu %D0, %AM',
2242 outs => [ "res", "M" ],
2248 state => "exc_pinned",
2249 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2250 ins => [ "base", "index", "mem", "val" ],
2251 emit => '. movdqu %binop',
2258 # Include the generated SIMD node specification written by the SIMD optimization
2259 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2260 unless ($return = do $my_script_name) {
2261 warn "couldn't parse $my_script_name: $@" if $@;
2262 warn "couldn't do $my_script_name: $!" unless defined $return;
2263 warn "couldn't run $my_script_name" unless $return;