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,binary") {
257 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_binary);";
258 } elsif($am eq "dest,unary") {
259 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_unary);";
260 } elsif($am eq "dest,binary") {
261 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_binary);";
262 } elsif($am eq "dest,ternary") {
263 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_ternary);";
264 } elsif($am eq "source,ternary") {
265 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_ternary);";
266 } elsif($am eq "none") {
269 die("Invalid address mode '$am' specified on op $name");
274 $custom_init_attr_func = \&ia32_custom_init_attr;
277 ia32_attr_t => "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);",
279 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
280 "\tinit_ia32_x87_attributes(res);",
282 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
283 "\tinit_ia32_x87_attributes(res);".
284 "\tinit_ia32_asm_attributes(res);",
285 ia32_immediate_attr_t =>
286 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
287 "\tinit_ia32_immediate_attributes(res, symconst, symconst_sign, offset);"
291 ia32_attr_t => "ia32_compare_nodes_attr",
292 ia32_x87_attr_t => "ia32_compare_x87_attr",
293 ia32_asm_attr_t => "ia32_compare_asm_attr",
294 ia32_immediate_attr_t => "ia32_compare_immediate_attr",
300 $mode_xmm = "mode_E";
301 $mode_gp = "mode_Iu";
302 $mode_flags = "mode_Iu";
303 $mode_fpcw = "mode_fpcw";
304 $status_flags = [ "CF", "PF", "AF", "ZF", "SF", "OF" ];
305 $fpcw_flags = [ "FP_IM", "FP_DM", "FP_ZM", "FP_OM", "FP_UM", "FP_PM",
306 "FP_PC0", "FP_PC1", "FP_RC0", "FP_RC1", "FP_X" ];
314 reg_req => { out => [ "gp_NOREG" ] },
315 attr => "ir_entity *symconst, int symconst_sign, long offset",
316 attr_type => "ia32_immediate_attr_t",
324 out_arity => "variable",
325 attr_type => "ia32_asm_attr_t",
332 reg_req => { out => [ "gp" ] },
337 cmp_attr => "return 1;",
340 #-----------------------------------------------------------------#
343 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
344 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
345 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
346 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
349 #-----------------------------------------------------------------#
351 # commutative operations
355 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5", "none", "flags" ] },
356 ins => [ "base", "index", "mem", "left", "right" ],
357 emit => '. add%M %binop',
361 modified_flags => $status_flags
366 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
367 ins => [ "base", "index", "mem", "val" ],
368 emit => ". add%M %SI3, %AM",
371 modified_flags => $status_flags
376 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
377 ins => [ "base", "index", "mem", "val" ],
378 emit => ". add%M %SB3, %AM",
381 modified_flags => $status_flags
385 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 in_r5" ] },
386 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
387 emit => '. adc%M %binop',
391 modified_flags => $status_flags
396 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
397 ins => [ "left", "right" ],
401 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
402 ins => [ "left", "right", "eflags" ],
406 # we should not rematrialize this node. It produces 2 results and has
407 # very strict constrains
408 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
409 ins => [ "base", "index", "mem", "val_high", "val_low" ],
410 emit => '. mul%M %unop4',
411 outs => [ "EAX", "EDX", "M" ],
412 am => "source,binary",
415 modified_flags => $status_flags
419 # we should not rematrialize this node. It produces 2 results and has
420 # very strict constrains
422 cmp_attr => "return 1;",
423 outs => [ "EAX", "EDX", "M" ],
429 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
430 ins => [ "base", "index", "mem", "left", "right" ],
431 emit => '. imul%M %binop',
432 am => "source,binary",
436 modified_flags => $status_flags
441 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
442 ins => [ "base", "index", "mem", "val_high", "val_low" ],
443 emit => '. imul%M %unop4',
444 outs => [ "EAX", "EDX", "M" ],
445 am => "source,binary",
448 modified_flags => $status_flags
452 # we should not rematrialize this node. It produces 2 results and has
453 # very strict constrains
455 cmp_attr => "return 1;",
456 outs => [ "EAX", "EDX", "M" ],
462 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
463 ins => [ "base", "index", "mem", "left", "right" ],
465 emit => '. and%M %binop',
468 modified_flags => $status_flags
473 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
474 ins => [ "base", "index", "mem", "val" ],
475 emit => '. and%M %SI3, %AM',
478 modified_flags => $status_flags
483 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
484 ins => [ "base", "index", "mem", "val" ],
485 emit => '. and%M %SB3, %AM',
488 modified_flags => $status_flags
493 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
494 ins => [ "base", "index", "mem", "left", "right" ],
496 emit => '. or%M %binop',
499 modified_flags => $status_flags
504 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
505 ins => [ "base", "index", "mem", "val" ],
506 emit => '. or%M %SI3, %AM',
509 modified_flags => $status_flags
514 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
515 ins => [ "base", "index", "mem", "val" ],
516 emit => '. or%M %SB3, %AM',
519 modified_flags => $status_flags
524 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
525 ins => [ "base", "index", "mem", "left", "right" ],
527 emit => '. xor%M %binop',
530 modified_flags => $status_flags
535 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
536 ins => [ "base", "index", "mem", "val" ],
537 emit => '. xor%M %SI3, %AM',
540 modified_flags => $status_flags
545 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
546 ins => [ "base", "index", "mem", "val" ],
547 emit => '. xor%M %SB3, %AM',
550 modified_flags => $status_flags
553 # not commutative operations
557 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4", "none", "flags" ] },
558 ins => [ "base", "index", "mem", "left", "right" ],
560 emit => '. sub%M %binop',
563 modified_flags => $status_flags
568 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
569 ins => [ "base", "index", "mem", "val" ],
570 emit => '. sub%M %SI3, %AM',
573 modified_flags => $status_flags
578 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
579 ins => [ "base", "index", "mem", "val" ],
580 emit => '. sub%M %SB3, %AM',
583 modified_flags => $status_flags
587 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 !in_r5" ] },
588 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
590 emit => '. sbb%M %binop',
593 modified_flags => $status_flags
597 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
598 ins => [ "left", "right" ],
602 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
603 ins => [ "left", "right", "eflags" ],
608 state => "exc_pinned",
609 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
610 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
611 outs => [ "div_res", "mod_res", "M" ],
612 attr => "ia32_op_flavour_t dm_flav",
613 am => "source,ternary",
614 init_attr => "attr->data.op_flav = dm_flav;",
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 attr => "ia32_op_flavour_t dm_flav",
628 am => "source,ternary",
629 init_attr => "attr->data.op_flav = dm_flav;",
630 emit => ". div%M %unop5",
633 modified_flags => $status_flags
638 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
639 ins => [ "left", "right" ],
641 emit => '. shl %SB1, %S0',
644 modified_flags => $status_flags
649 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
650 ins => [ "base", "index", "mem", "count" ],
651 emit => '. shl%M %SB3, %AM',
654 modified_flags => $status_flags
658 cmp_attr => "return 1;",
659 # value, cnt, dependency
664 # FIXME: WHY? the right requirement is in_r3 !in_r5, especially this is the same as in Shl
666 # Out requirements is: different from all in
667 # This is because, out must be different from LowPart and ShiftCount.
668 # We could say "!ecx !in_r4" but it can occur, that all values live through
669 # this Shift and the only value dying is the ShiftCount. Then there would be a
670 # register missing, as result must not be ecx and all other registers are
671 # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
672 # (and probably never will). So we create artificial interferences of the result
673 # with all inputs, so the spiller can always assure a free register.
674 # reg_req => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
677 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "in_r1 !in_r3" ] },
678 ins => [ "left_high", "left_low", "right" ],
679 am => "dest,ternary",
680 emit => '. shld%M %SB2, %S1, %S0',
684 modified_flags => $status_flags
688 cmp_attr => "return 1;",
694 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
695 ins => [ "val", "count" ],
697 emit => '. shr %SB1, %S0',
700 modified_flags => $status_flags
705 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
706 ins => [ "base", "index", "mem", "count" ],
707 emit => '. shr%M %SB3, %AM',
710 modified_flags => $status_flags
714 cmp_attr => "return 1;",
715 # value, cnt, dependency
720 # FIXME: WHY? the right requirement is in_r3 !in_r5, especially this is the same as in Shr
722 # Out requirements is: different from all in
723 # This is because, out must be different from LowPart and ShiftCount.
724 # We could say "!ecx !in_r4" but it can occur, that all values live through
725 # this Shift and the only value dying is the ShiftCount. Then there would be a
726 # register missing, as result must not be ecx and all other registers are
727 # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
728 # (and probably never will). So we create artificial interferences of the result
729 # with all inputs, so the spiller can always assure a free register.
730 # reg_req => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
733 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "in_r1 !in_r3" ] },
734 ins => [ "left_high", "left_low", "right" ],
735 am => "dest,ternary",
736 emit => '. shrd%M %SB2, %S1, %S0',
740 modified_flags => $status_flags
744 cmp_attr => "return 1;",
750 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
751 ins => [ "val", "count" ],
753 emit => '. sar %SB1, %S0',
756 modified_flags => $status_flags
761 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
762 ins => [ "base", "index", "mem", "count" ],
763 emit => '. sar%M %SB3, %AM',
766 modified_flags => $status_flags
770 cmp_attr => "return 1;",
776 cmp_attr => "return 1;",
777 # value, cnt, dependency
783 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
784 ins => [ "val", "count" ],
786 emit => '. ror %SB1, %S0',
789 modified_flags => $status_flags
794 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
795 ins => [ "base", "index", "mem", "count" ],
796 emit => '. ror%M %SB3, %AM',
799 modified_flags => $status_flags
804 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
805 ins => [ "val", "count" ],
807 emit => '. rol %SB1, %S0',
810 modified_flags => $status_flags
815 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
816 ins => [ "base", "index", "mem", "count" ],
817 emit => '. rol%M %SB3, %AM',
820 modified_flags => $status_flags
827 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
833 modified_flags => $status_flags
838 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
839 ins => [ "base", "index", "mem" ],
840 emit => '. neg%M %AM',
843 modified_flags => $status_flags
848 reg_req => { in => [ "gp", "gp" ], out => [ "in_r1", "gp" ] },
849 outs => [ "low_res", "high_res" ],
851 modified_flags => $status_flags
856 cmp_attr => "return 1;",
862 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
867 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
872 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
873 ins => [ "base", "index", "mem" ],
874 emit => '. inc%M %AM',
877 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
882 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
887 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
892 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
893 ins => [ "base", "index", "mem" ],
894 emit => '. dec%M %AM',
897 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
902 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
912 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
913 ins => [ "base", "index", "mem" ],
914 emit => '. not%M %AM',
923 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
924 ins => [ "base", "index", "mem", "left", "right" ],
925 outs => [ "eflags" ],
926 am => "source,binary",
927 emit => '. cmp%M %binop',
928 attr => "int flipped, int cmp_unsigned",
929 init_attr => "attr->data.cmp_flipped = flipped;\n".
930 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
934 modified_flags => $status_flags
939 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
940 ins => [ "base", "index", "mem", "left", "right" ],
941 outs => [ "eflags" ],
942 am => "source,binary",
943 emit => '. cmpb %binop',
944 attr => "int flipped, int cmp_unsigned",
945 init_attr => "attr->data.cmp_flipped = flipped;\n".
946 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
950 modified_flags => $status_flags
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 => '. test%M %binop',
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 => '. testb %binop',
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 => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
990 attr => "pn_Cmp pnc",
991 init_attr => "attr->pn_code = pnc;\nset_ia32_ls_mode(res, mode_Bu);\n",
992 emit => '. set%CMP0 %DB0',
1000 # (note: leave the false,true order intact to make it compatible with other
1002 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4" ] },
1003 ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
1004 am => "source,binary",
1005 attr => "pn_Cmp pn_code",
1006 init_attr => "attr->pn_code = pn_code;",
1014 op_flags => "L|X|Y",
1015 reg_req => { in => [ "eflags" ], out => [ "none", "none" ] },
1016 ins => [ "eflags" ],
1017 outs => [ "false", "true" ],
1018 attr => "pn_Cmp pnc",
1019 init_attr => "attr->pn_code = pnc;",
1021 units => [ "BRANCH" ],
1026 op_flags => "L|X|Y",
1027 reg_req => { in => [ "gp" ], out => [ "none" ] },
1029 units => [ "BRANCH" ],
1031 modified_flags => $status_flags
1037 reg_req => { in => [ "gp" ] },
1038 emit => '. jmp *%S0',
1039 units => [ "BRANCH" ],
1046 reg_req => { out => [ "gp" ] },
1048 attr => "ir_entity *symconst, int symconst_sign, long offset",
1049 attr_type => "ia32_immediate_attr_t",
1051 # depends on the const and is set in ia32_transform
1052 # modified_flags => $status_flags
1059 reg_req => { out => [ "gp_UKNWN" ] },
1069 reg_req => { out => [ "vfp_UKNWN" ] },
1073 attr_type => "ia32_x87_attr_t",
1080 reg_req => { out => [ "xmm_UKNWN" ] },
1090 reg_req => { out => [ "gp_NOREG" ] },
1100 reg_req => { out => [ "vfp_NOREG" ] },
1104 attr_type => "ia32_x87_attr_t",
1111 reg_req => { out => [ "xmm_NOREG" ] },
1121 reg_req => { out => [ "fp_cw" ] },
1125 modified_flags => $fpcw_flags
1131 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1132 ins => [ "base", "index", "mem" ],
1134 emit => ". fldcw %AM",
1137 modified_flags => $fpcw_flags
1143 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1144 ins => [ "base", "index", "mem", "fpcw" ],
1146 emit => ". fnstcw %AM",
1152 # we should not rematrialize this node. It has very strict constraints.
1153 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1154 ins => [ "val", "globbered" ],
1162 # Note that we add additional latency values depending on address mode, so a
1163 # lateny of 0 for load is correct
1167 state => "exc_pinned",
1168 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1169 ins => [ "base", "index", "mem" ],
1170 outs => [ "res", "M" ],
1172 emit => ". mov%SE%ME%.l %AM, %D0",
1178 cmp_attr => "return 1;",
1179 outs => [ "res", "M" ],
1185 cmp_attr => "return 1;",
1186 state => "exc_pinned",
1193 state => "exc_pinned",
1194 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1195 ins => [ "base", "index", "mem", "val" ],
1196 emit => '. mov%M %SI3, %AM',
1204 state => "exc_pinned",
1205 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1206 ins => [ "base", "index", "mem", "val" ],
1207 emit => '. mov%M %SB3, %AM',
1215 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1216 ins => [ "base", "index" ],
1217 emit => '. leal %AM, %D0',
1221 # well this isn't true for Lea, but we often transform Lea back to Add, Inc
1222 # or Dec, so we set the flag
1223 modified_flags => 1,
1227 reg_req => { in => [ "gp", "gp", "none", "gp", "esp" ], out => [ "esp", "none" ] },
1228 ins => [ "base", "index", "mem", "val", "stack" ],
1229 emit => '. push%M %unop3',
1230 outs => [ "stack:I|S", "M" ],
1231 am => "source,binary",
1237 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1238 emit => '. pop%M %DAM1',
1239 outs => [ "stack:I|S", "res", "M" ],
1240 ins => [ "base", "index", "mem", "stack" ],
1242 latency => 3, # Pop is more expensive than Push on Athlon
1247 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1249 outs => [ "frame:I", "stack:I|S", "M" ],
1255 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1257 outs => [ "frame:I", "stack:I|S" ],
1265 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1266 ins => [ "base", "index", "mem", "stack", "size" ],
1267 am => "source,binary",
1268 emit => '. addl %binop',
1269 outs => [ "stack:S", "M" ],
1271 modified_flags => $status_flags
1277 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1278 ins => [ "base", "index", "mem", "stack", "size" ],
1279 am => "source,binary",
1280 emit => ". subl %binop\n".
1281 ". movl %%esp, %D1",
1282 outs => [ "stack:I|S", "addr", "M" ],
1284 modified_flags => $status_flags
1289 reg_req => { out => [ "gp" ] },
1293 # the int instruction
1295 reg_req => { in => [ "gp" ], out => [ "none" ] },
1297 emit => '. int %SI0',
1299 cmp_attr => "return 1;",
1303 #-----------------------------------------------------------------------------#
1304 # _____ _____ ______ __ _ _ _ #
1305 # / ____/ ____| ____| / _| | | | | | #
1306 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1307 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1308 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1309 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1310 #-----------------------------------------------------------------------------#
1314 reg_req => { out => [ "xmm" ] },
1315 emit => '. xorp%XSD %D0, %D0',
1321 # commutative operations
1325 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1326 ins => [ "base", "index", "mem", "left", "right" ],
1327 emit => '. add%XXM %binop',
1335 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1336 ins => [ "base", "index", "mem", "left", "right" ],
1337 emit => '. mul%XXM %binop',
1345 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1346 ins => [ "base", "index", "mem", "left", "right" ],
1347 emit => '. max%XXM %binop',
1355 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1356 ins => [ "base", "index", "mem", "left", "right" ],
1357 emit => '. min%XXM %binop',
1365 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1366 ins => [ "base", "index", "mem", "left", "right" ],
1367 emit => '. andp%XSD %binop',
1375 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1376 ins => [ "base", "index", "mem", "left", "right" ],
1377 emit => '. orp%XSD %binop',
1384 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1385 ins => [ "base", "index", "mem", "left", "right" ],
1386 emit => '. xorp%XSD %binop',
1392 # not commutative operations
1396 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1397 ins => [ "base", "index", "mem", "left", "right" ],
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 emit => '. sub%XXM %binop',
1416 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1417 ins => [ "base", "index", "mem", "left", "right" ],
1418 outs => [ "res", "M" ],
1419 emit => '. div%XXM %binop',
1428 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1429 ins => [ "base", "index", "mem", "left", "right" ],
1430 outs => [ "flags" ],
1431 am => "source,binary",
1432 attr => "int flipped",
1433 init_attr => "attr->data.cmp_flipped = flipped;",
1434 emit => ' .ucomi%XXM %binop',
1437 mode => $mode_flags,
1438 modified_flags => 1,
1445 state => "exc_pinned",
1446 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1447 ins => [ "base", "index", "mem" ],
1448 emit => '. mov%XXM %AM, %D0',
1449 attr => "ir_mode *load_mode",
1450 init_attr => "attr->ls_mode = load_mode;",
1451 outs => [ "res", "M" ],
1458 state => "exc_pinned",
1459 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1460 ins => [ "base", "index", "mem", "val" ],
1461 emit => '. mov%XXM %S3, %AM',
1469 state => "exc_pinned",
1470 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1471 ins => [ "base", "index", "mem", "val" ],
1472 emit => '. mov%XXM %S3, %AM',
1480 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1481 ins => [ "base", "index", "mem", "val" ],
1482 emit => '. cvtsi2ss %unop3, %D0',
1490 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1491 ins => [ "base", "index", "mem", "val" ],
1492 emit => '. cvtsi2sd %unop3, %D0',
1501 cmp_attr => "return 1;",
1507 cmp_attr => "return 1;",
1516 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1517 outs => [ "DST", "SRC", "CNT", "M" ],
1519 # we don't care about this flag, so no need to mark this node
1520 # modified_flags => [ "DF" ]
1526 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1527 outs => [ "DST", "SRC", "M" ],
1529 # we don't care about this flag, so no need to mark this node
1530 # modified_flags => [ "DF" ]
1536 state => "exc_pinned",
1537 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1538 ins => [ "base", "index", "mem", "val" ],
1540 attr => "ir_mode *smaller_mode",
1541 init_attr => "attr->ls_mode = smaller_mode;",
1546 state => "exc_pinned",
1547 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1548 ins => [ "base", "index", "mem", "val" ],
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" ],
1564 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1565 ins => [ "base", "index", "mem", "val" ],
1572 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1573 ins => [ "base", "index", "mem", "val" ],
1579 #----------------------------------------------------------#
1581 # (_) | | | | / _| | | | #
1582 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1583 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1584 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1585 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1587 # _ __ ___ __| | ___ ___ #
1588 # | '_ \ / _ \ / _` |/ _ \/ __| #
1589 # | | | | (_) | (_| | __/\__ \ #
1590 # |_| |_|\___/ \__,_|\___||___/ #
1591 #----------------------------------------------------------#
1593 # spilling disabled for all float nodes for now, because the fpcw handler
1594 # runs before spilling and we might end up with wrong fpcw then
1598 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1599 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1603 attr_type => "ia32_x87_attr_t",
1608 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1609 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1613 attr_type => "ia32_x87_attr_t",
1618 cmp_attr => "return 1;",
1624 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1625 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1629 attr_type => "ia32_x87_attr_t",
1633 cmp_attr => "return 1;",
1638 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1639 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1640 outs => [ "res", "M" ],
1643 attr_type => "ia32_x87_attr_t",
1647 cmp_attr => "return 1;",
1648 outs => [ "res", "M" ],
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;",
1668 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1673 attr_type => "ia32_x87_attr_t",
1678 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1683 attr_type => "ia32_x87_attr_t",
1686 # virtual Load and Store
1690 state => "exc_pinned",
1691 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1692 ins => [ "base", "index", "mem" ],
1693 outs => [ "res", "M" ],
1694 attr => "ir_mode *load_mode",
1695 init_attr => "attr->attr.ls_mode = load_mode;",
1698 attr_type => "ia32_x87_attr_t",
1703 state => "exc_pinned",
1704 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1705 ins => [ "base", "index", "mem", "val" ],
1706 attr => "ir_mode *store_mode",
1707 init_attr => "attr->attr.ls_mode = store_mode;",
1711 attr_type => "ia32_x87_attr_t",
1717 state => "exc_pinned",
1718 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1719 outs => [ "res", "M" ],
1720 ins => [ "base", "index", "mem" ],
1723 attr_type => "ia32_x87_attr_t",
1727 cmp_attr => "return 1;",
1728 outs => [ "res", "M" ],
1733 state => "exc_pinned",
1734 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1735 ins => [ "base", "index", "mem", "val", "fpcw" ],
1739 attr_type => "ia32_x87_attr_t",
1743 cmp_attr => "return 1;",
1744 state => "exc_pinned",
1754 reg_req => { out => [ "vfp" ] },
1758 attr_type => "ia32_x87_attr_t",
1763 reg_req => { out => [ "vfp" ] },
1767 attr_type => "ia32_x87_attr_t",
1772 reg_req => { out => [ "vfp" ] },
1776 attr_type => "ia32_x87_attr_t",
1781 reg_req => { out => [ "vfp" ] },
1785 attr_type => "ia32_x87_attr_t",
1790 reg_req => { out => [ "vfp" ] },
1794 attr_type => "ia32_x87_attr_t",
1799 reg_req => { out => [ "vfp" ] },
1803 attr_type => "ia32_x87_attr_t",
1808 reg_req => { out => [ "vfp" ] },
1812 attr_type => "ia32_x87_attr_t",
1818 # we can't allow to rematerialize this node so we don't have
1819 # accidently produce Phi(Fucom, Fucom(flipped))
1821 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1822 ins => [ "left", "right" ],
1823 outs => [ "flags" ],
1824 attr => "int flipped",
1825 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1828 attr_type => "ia32_x87_attr_t",
1834 reg_req => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
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" ], out => [ "eax" ] },
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 => [ "eax" ], out => [ "eflags" ] },
1862 outs => [ "flags" ],
1865 mode => $mode_flags,
1868 #------------------------------------------------------------------------#
1869 # ___ _____ __ _ _ _ #
1870 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1871 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1872 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1873 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1874 #------------------------------------------------------------------------#
1876 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1877 # are swapped, we work this around in the emitter...
1881 rd_constructor => "NONE",
1883 emit => '. fadd%XM %x87_binop',
1884 attr_type => "ia32_x87_attr_t",
1889 rd_constructor => "NONE",
1891 emit => '. faddp%XM %x87_binop',
1892 attr_type => "ia32_x87_attr_t",
1897 rd_constructor => "NONE",
1899 emit => '. fmul%XM %x87_binop',
1900 attr_type => "ia32_x87_attr_t",
1905 rd_constructor => "NONE",
1907 emit => '. fmulp%XM %x87_binop',,
1908 attr_type => "ia32_x87_attr_t",
1913 rd_constructor => "NONE",
1915 emit => '. fsub%XM %x87_binop',
1916 attr_type => "ia32_x87_attr_t",
1921 rd_constructor => "NONE",
1923 # see note about gas bugs
1924 emit => '. fsubrp%XM %x87_binop',
1925 attr_type => "ia32_x87_attr_t",
1930 rd_constructor => "NONE",
1933 emit => '. fsubr%XM %x87_binop',
1934 attr_type => "ia32_x87_attr_t",
1939 rd_constructor => "NONE",
1942 # see note about gas bugs
1943 emit => '. fsubp%XM %x87_binop',
1944 attr_type => "ia32_x87_attr_t",
1949 rd_constructor => "NONE",
1952 attr_type => "ia32_x87_attr_t",
1955 # this node is just here, to keep the simulator running
1956 # we can omit this when a fprem simulation function exists
1959 rd_constructor => "NONE",
1962 attr_type => "ia32_x87_attr_t",
1967 rd_constructor => "NONE",
1969 emit => '. fdiv%XM %x87_binop',
1970 attr_type => "ia32_x87_attr_t",
1975 rd_constructor => "NONE",
1977 # see note about gas bugs
1978 emit => '. fdivrp%XM %x87_binop',
1979 attr_type => "ia32_x87_attr_t",
1984 rd_constructor => "NONE",
1986 emit => '. fdivr%XM %x87_binop',
1987 attr_type => "ia32_x87_attr_t",
1992 rd_constructor => "NONE",
1994 # see note about gas bugs
1995 emit => '. fdivp%XM %x87_binop',
1996 attr_type => "ia32_x87_attr_t",
2001 rd_constructor => "NONE",
2004 attr_type => "ia32_x87_attr_t",
2009 rd_constructor => "NONE",
2012 attr_type => "ia32_x87_attr_t",
2015 # x87 Load and Store
2018 rd_constructor => "NONE",
2019 op_flags => "R|L|F",
2020 state => "exc_pinned",
2022 emit => '. fld%XM %AM',
2023 attr_type => "ia32_x87_attr_t",
2027 rd_constructor => "NONE",
2028 op_flags => "R|L|F",
2029 state => "exc_pinned",
2031 emit => '. fst%XM %AM',
2033 attr_type => "ia32_x87_attr_t",
2037 rd_constructor => "NONE",
2038 op_flags => "R|L|F",
2039 state => "exc_pinned",
2041 emit => '. fstp%XM %AM',
2043 attr_type => "ia32_x87_attr_t",
2050 rd_constructor => "NONE",
2052 emit => '. fild%M %AM',
2053 attr_type => "ia32_x87_attr_t",
2058 state => "exc_pinned",
2059 rd_constructor => "NONE",
2061 emit => '. fist%M %AM',
2063 attr_type => "ia32_x87_attr_t",
2068 state => "exc_pinned",
2069 rd_constructor => "NONE",
2071 emit => '. fistp%M %AM',
2073 attr_type => "ia32_x87_attr_t",
2079 op_flags => "R|c|K",
2081 reg_req => { out => [ "vfp" ] },
2083 attr_type => "ia32_x87_attr_t",
2087 op_flags => "R|c|K",
2089 reg_req => { out => [ "vfp" ] },
2091 attr_type => "ia32_x87_attr_t",
2095 op_flags => "R|c|K",
2097 reg_req => { out => [ "vfp" ] },
2099 attr_type => "ia32_x87_attr_t",
2103 op_flags => "R|c|K",
2105 reg_req => { out => [ "vfp" ] },
2107 attr_type => "ia32_x87_attr_t",
2111 op_flags => "R|c|K",
2113 reg_req => { out => [ "vfp" ] },
2115 attr_type => "ia32_x87_attr_t",
2119 op_flags => "R|c|K",
2121 reg_req => { out => [ "vfp" ] },
2122 emit => '. fldll2t',
2123 attr_type => "ia32_x87_attr_t",
2127 op_flags => "R|c|K",
2129 reg_req => { out => [ "vfp" ] },
2131 attr_type => "ia32_x87_attr_t",
2135 # Note that it is NEVER allowed to do CSE on these nodes
2136 # Moreover, note the virtual register requierements!
2141 cmp_attr => "return 1;",
2142 emit => '. fxch %X0',
2143 attr_type => "ia32_x87_attr_t",
2150 cmp_attr => "return 1;",
2151 emit => '. fld %X0',
2152 attr_type => "ia32_x87_attr_t",
2158 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2159 cmp_attr => "return 1;",
2160 emit => '. fld %X0',
2161 attr_type => "ia32_x87_attr_t",
2167 cmp_attr => "return 1;",
2168 emit => '. fstp %X0',
2169 attr_type => "ia32_x87_attr_t",
2176 cmp_attr => "return 1;",
2177 emit => '. ffreep %X0',
2178 attr_type => "ia32_x87_attr_t",
2185 cmp_attr => "return 1;",
2187 attr_type => "ia32_x87_attr_t",
2194 cmp_attr => "return 1;",
2196 attr_type => "ia32_x87_attr_t",
2204 emit => ". fucom %X1\n".
2206 attr_type => "ia32_x87_attr_t",
2211 emit => ". fucomp %X1\n".
2213 attr_type => "ia32_x87_attr_t",
2218 emit => ". fucompp\n".
2220 attr_type => "ia32_x87_attr_t",
2225 emit => '. fucomi %X1',
2226 attr_type => "ia32_x87_attr_t",
2231 emit => '. fucompi %X1',
2232 attr_type => "ia32_x87_attr_t",
2239 attr_type => "ia32_x87_attr_t",
2243 # -------------------------------------------------------------------------------- #
2244 # ____ ____ _____ _ _ #
2245 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2246 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2247 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2248 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2250 # -------------------------------------------------------------------------------- #
2253 # Spilling and reloading of SSE registers, hardcoded, not generated #
2257 state => "exc_pinned",
2258 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2259 emit => '. movdqu %D0, %AM',
2260 outs => [ "res", "M" ],
2266 state => "exc_pinned",
2267 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2268 ins => [ "base", "index", "mem", "val" ],
2269 emit => '. movdqu %binop',
2276 # Include the generated SIMD node specification written by the SIMD optimization
2277 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2278 unless ($return = do $my_script_name) {
2279 warn "couldn't parse $my_script_name: $@" if $@;
2280 warn "couldn't do $my_script_name: $!" unless defined $return;
2281 warn "couldn't run $my_script_name" unless $return;