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 am => "source,ternary",
613 emit => ". idiv%M %unop5",
616 modified_flags => $status_flags
621 state => "exc_pinned",
622 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
623 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
624 outs => [ "div_res", "mod_res", "M" ],
625 am => "source,ternary",
626 emit => ". div%M %unop5",
629 modified_flags => $status_flags
634 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
635 ins => [ "left", "right" ],
637 emit => '. shl %SB1, %S0',
640 modified_flags => $status_flags
645 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
646 ins => [ "base", "index", "mem", "count" ],
647 emit => '. shl%M %SB3, %AM',
650 modified_flags => $status_flags
654 cmp_attr => "return 1;",
655 # value, cnt, dependency
661 # see ShrD about the strange out constraint
662 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
663 ins => [ "left_high", "left_low", "right" ],
664 am => "dest,ternary",
665 emit => ". shld%M %SB2, %S1, %S0\n".
670 modified_flags => $status_flags
674 cmp_attr => "return 1;",
680 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
681 ins => [ "val", "count" ],
683 emit => '. shr %SB1, %S0',
686 modified_flags => $status_flags
691 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
692 ins => [ "base", "index", "mem", "count" ],
693 emit => '. shr%M %SB3, %AM',
696 modified_flags => $status_flags
700 cmp_attr => "return 1;",
701 # value, cnt, dependency
706 # What's going on with the out constraint here? We would like to write
707 # "in_r2" and be done. However in firm we only support should_be_same
708 # constraints at the moment. Which means they could be non-fullfilled in
709 # some cases. Now when all values happen to live through the node, out
710 # is ecx and in_r2 not ecx, then we're screwed. Because in this case we
711 # need a 4th Register.
713 # The best solution for this is extending the register allocator to support
714 # must_be_same constraints which create a copy when the in_r2 value
715 # lives through (this ensures that we have the 4th register in the cases
716 # when we need it and can always fix the situation).
718 # For now I'm doing this ultra ugly !in hack which allocates 4 registers
719 # and creates an extra mov
721 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
722 ins => [ "left_high", "left_low", "right" ],
723 am => "dest,ternary",
724 emit => ". shrd%M %SB2, %S1, %S0\n".
729 modified_flags => $status_flags
733 cmp_attr => "return 1;",
739 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
740 ins => [ "val", "count" ],
742 emit => '. sar %SB1, %S0',
745 modified_flags => $status_flags
750 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
751 ins => [ "base", "index", "mem", "count" ],
752 emit => '. sar%M %SB3, %AM',
755 modified_flags => $status_flags
759 cmp_attr => "return 1;",
765 cmp_attr => "return 1;",
766 # value, cnt, dependency
772 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
773 ins => [ "val", "count" ],
775 emit => '. ror %SB1, %S0',
778 modified_flags => $status_flags
783 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
784 ins => [ "base", "index", "mem", "count" ],
785 emit => '. ror%M %SB3, %AM',
788 modified_flags => $status_flags
793 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
794 ins => [ "val", "count" ],
796 emit => '. rol %SB1, %S0',
799 modified_flags => $status_flags
804 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
805 ins => [ "base", "index", "mem", "count" ],
806 emit => '. rol%M %SB3, %AM',
809 modified_flags => $status_flags
816 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
822 modified_flags => $status_flags
827 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
828 ins => [ "base", "index", "mem" ],
829 emit => '. neg%M %AM',
832 modified_flags => $status_flags
837 reg_req => { in => [ "gp", "gp" ], out => [ "in_r1", "gp" ] },
838 outs => [ "low_res", "high_res" ],
840 modified_flags => $status_flags
845 cmp_attr => "return 1;",
851 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
856 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
861 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
862 ins => [ "base", "index", "mem" ],
863 emit => '. inc%M %AM',
866 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
871 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
876 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
881 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
882 ins => [ "base", "index", "mem" ],
883 emit => '. dec%M %AM',
886 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
891 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
901 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
902 ins => [ "base", "index", "mem" ],
903 emit => '. not%M %AM',
912 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
913 ins => [ "base", "index", "mem", "left", "right" ],
914 outs => [ "eflags" ],
915 am => "source,binary",
916 emit => '. cmp%M %binop',
917 attr => "int flipped, int cmp_unsigned",
918 init_attr => "attr->data.cmp_flipped = flipped;\n".
919 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
923 modified_flags => $status_flags
928 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
929 ins => [ "base", "index", "mem", "left", "right" ],
930 outs => [ "eflags" ],
931 am => "source,binary",
932 emit => '. cmpb %binop',
933 attr => "int flipped, int cmp_unsigned",
934 init_attr => "attr->data.cmp_flipped = flipped;\n".
935 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
939 modified_flags => $status_flags
944 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
945 ins => [ "base", "index", "mem", "left", "right" ],
946 outs => [ "eflags" ],
947 am => "source,binary",
948 emit => '. test%M %binop',
949 attr => "int flipped, int cmp_unsigned",
950 init_attr => "attr->data.cmp_flipped = flipped;\n".
951 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
955 modified_flags => $status_flags
960 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
961 ins => [ "base", "index", "mem", "left", "right" ],
962 outs => [ "eflags" ],
963 am => "source,binary",
964 emit => '. testb %binop',
965 attr => "int flipped, int cmp_unsigned",
966 init_attr => "attr->data.cmp_flipped = flipped;\n".
967 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
971 modified_flags => $status_flags
976 reg_req => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
979 attr => "pn_Cmp pnc",
980 init_attr => "attr->pn_code = pnc;\nset_ia32_ls_mode(res, mode_Bu);\n",
981 emit => '. set%CMP0 %DB0',
989 # (note: leave the false,true order intact to make it compatible with other
991 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4 in_r5" ] },
992 ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
993 am => "source,binary",
994 attr => "int flipped, pn_Cmp pn_code",
995 init_attr => "attr->pn_code = pn_code;\n".
996 "attr->data.cmp_flipped = flipped;",
1004 op_flags => "L|X|Y",
1005 reg_req => { in => [ "eflags" ], out => [ "none", "none" ] },
1006 ins => [ "eflags" ],
1007 outs => [ "false", "true" ],
1008 attr => "pn_Cmp pnc",
1009 init_attr => "attr->pn_code = pnc;",
1011 units => [ "BRANCH" ],
1016 op_flags => "L|X|Y",
1017 reg_req => { in => [ "gp" ], out => [ "none" ] },
1019 units => [ "BRANCH" ],
1021 modified_flags => $status_flags
1027 reg_req => { in => [ "gp" ] },
1028 emit => '. jmp *%S0',
1029 units => [ "BRANCH" ],
1036 reg_req => { out => [ "gp" ] },
1038 attr => "ir_entity *symconst, int symconst_sign, long offset",
1039 attr_type => "ia32_immediate_attr_t",
1041 # depends on the const and is set in ia32_transform
1042 # modified_flags => $status_flags
1049 reg_req => { out => [ "gp_UKNWN" ] },
1059 reg_req => { out => [ "vfp_UKNWN" ] },
1063 attr_type => "ia32_x87_attr_t",
1070 reg_req => { out => [ "xmm_UKNWN" ] },
1080 reg_req => { out => [ "gp_NOREG" ] },
1090 reg_req => { out => [ "vfp_NOREG" ] },
1094 attr_type => "ia32_x87_attr_t",
1101 reg_req => { out => [ "xmm_NOREG" ] },
1111 reg_req => { out => [ "fp_cw" ] },
1115 modified_flags => $fpcw_flags
1121 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1122 ins => [ "base", "index", "mem" ],
1124 emit => ". fldcw %AM",
1127 modified_flags => $fpcw_flags
1133 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1134 ins => [ "base", "index", "mem", "fpcw" ],
1136 emit => ". fnstcw %AM",
1142 # we should not rematrialize this node. It has very strict constraints.
1143 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1144 ins => [ "val", "globbered" ],
1152 # Note that we add additional latency values depending on address mode, so a
1153 # lateny of 0 for load is correct
1157 state => "exc_pinned",
1158 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1159 ins => [ "base", "index", "mem" ],
1160 outs => [ "res", "M" ],
1162 emit => ". mov%SE%ME%.l %AM, %D0",
1168 cmp_attr => "return 1;",
1169 outs => [ "res", "M" ],
1175 cmp_attr => "return 1;",
1176 state => "exc_pinned",
1183 state => "exc_pinned",
1184 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1185 ins => [ "base", "index", "mem", "val" ],
1186 emit => '. mov%M %SI3, %AM',
1194 state => "exc_pinned",
1195 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1196 ins => [ "base", "index", "mem", "val" ],
1197 emit => '. mov%M %SB3, %AM',
1205 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1206 ins => [ "base", "index" ],
1207 emit => '. leal %AM, %D0',
1211 # well this isn't true for Lea, but we often transform Lea back to Add, Inc
1212 # or Dec, so we set the flag
1213 modified_flags => 1,
1217 reg_req => { in => [ "gp", "gp", "none", "gp", "esp" ], out => [ "esp", "none" ] },
1218 ins => [ "base", "index", "mem", "val", "stack" ],
1219 emit => '. push%M %unop3',
1220 outs => [ "stack:I|S", "M" ],
1221 am => "source,binary",
1227 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1228 emit => '. pop%M %DAM1',
1229 outs => [ "stack:I|S", "res", "M" ],
1230 ins => [ "base", "index", "mem", "stack" ],
1232 latency => 3, # Pop is more expensive than Push on Athlon
1237 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1239 outs => [ "frame:I", "stack:I|S", "M" ],
1245 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1247 outs => [ "frame:I", "stack:I|S" ],
1255 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1256 ins => [ "base", "index", "mem", "stack", "size" ],
1257 am => "source,binary",
1258 emit => '. addl %binop',
1259 outs => [ "stack:S", "M" ],
1261 modified_flags => $status_flags
1267 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1268 ins => [ "base", "index", "mem", "stack", "size" ],
1269 am => "source,binary",
1270 emit => ". subl %binop\n".
1271 ". movl %%esp, %D1",
1272 outs => [ "stack:I|S", "addr", "M" ],
1274 modified_flags => $status_flags
1279 reg_req => { out => [ "gp" ] },
1283 # the int instruction
1285 reg_req => { in => [ "gp" ], out => [ "none" ] },
1287 emit => '. int %SI0',
1289 cmp_attr => "return 1;",
1293 #-----------------------------------------------------------------------------#
1294 # _____ _____ ______ __ _ _ _ #
1295 # / ____/ ____| ____| / _| | | | | | #
1296 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1297 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1298 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1299 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1300 #-----------------------------------------------------------------------------#
1304 reg_req => { out => [ "xmm" ] },
1305 emit => '. xorp%XSD %D0, %D0',
1311 # commutative operations
1315 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1316 ins => [ "base", "index", "mem", "left", "right" ],
1317 emit => '. add%XXM %binop',
1325 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1326 ins => [ "base", "index", "mem", "left", "right" ],
1327 emit => '. mul%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 => '. max%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 => '. min%XXM %binop',
1355 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1356 ins => [ "base", "index", "mem", "left", "right" ],
1357 emit => '. andp%XSD %binop',
1365 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1366 ins => [ "base", "index", "mem", "left", "right" ],
1367 emit => '. orp%XSD %binop',
1374 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1375 ins => [ "base", "index", "mem", "left", "right" ],
1376 emit => '. xorp%XSD %binop',
1382 # not commutative operations
1386 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1387 ins => [ "base", "index", "mem", "left", "right" ],
1388 emit => '. andnp%XSD %binop',
1396 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1397 ins => [ "base", "index", "mem", "left", "right" ],
1398 emit => '. sub%XXM %binop',
1406 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1407 ins => [ "base", "index", "mem", "left", "right" ],
1408 outs => [ "res", "M" ],
1409 emit => '. div%XXM %binop',
1418 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1419 ins => [ "base", "index", "mem", "left", "right" ],
1420 outs => [ "flags" ],
1421 am => "source,binary",
1422 attr => "int flipped",
1423 init_attr => "attr->data.cmp_flipped = flipped;",
1424 emit => ' .ucomi%XXM %binop',
1427 mode => $mode_flags,
1428 modified_flags => 1,
1435 state => "exc_pinned",
1436 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1437 ins => [ "base", "index", "mem" ],
1438 emit => '. mov%XXM %AM, %D0',
1439 attr => "ir_mode *load_mode",
1440 init_attr => "attr->ls_mode = load_mode;",
1441 outs => [ "res", "M" ],
1448 state => "exc_pinned",
1449 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1450 ins => [ "base", "index", "mem", "val" ],
1451 emit => '. mov%XXM %S3, %AM',
1459 state => "exc_pinned",
1460 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1461 ins => [ "base", "index", "mem", "val" ],
1462 emit => '. mov%XXM %S3, %AM',
1470 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1471 ins => [ "base", "index", "mem", "val" ],
1472 emit => '. cvtsi2ss %unop3, %D0',
1480 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1481 ins => [ "base", "index", "mem", "val" ],
1482 emit => '. cvtsi2sd %unop3, %D0',
1491 cmp_attr => "return 1;",
1497 cmp_attr => "return 1;",
1506 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1507 outs => [ "DST", "SRC", "CNT", "M" ],
1509 # we don't care about this flag, so no need to mark this node
1510 # modified_flags => [ "DF" ]
1516 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1517 outs => [ "DST", "SRC", "M" ],
1519 # we don't care about this flag, so no need to mark this node
1520 # modified_flags => [ "DF" ]
1526 state => "exc_pinned",
1527 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1528 ins => [ "base", "index", "mem", "val" ],
1530 attr => "ir_mode *smaller_mode",
1531 init_attr => "attr->ls_mode = smaller_mode;",
1536 state => "exc_pinned",
1537 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1538 ins => [ "base", "index", "mem", "val" ],
1540 attr => "ir_mode *smaller_mode",
1541 init_attr => "attr->ls_mode = smaller_mode;",
1546 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
1547 ins => [ "base", "index", "mem", "val" ],
1554 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1555 ins => [ "base", "index", "mem", "val" ],
1562 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1563 ins => [ "base", "index", "mem", "val" ],
1569 #----------------------------------------------------------#
1571 # (_) | | | | / _| | | | #
1572 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1573 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1574 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1575 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1577 # _ __ ___ __| | ___ ___ #
1578 # | '_ \ / _ \ / _` |/ _ \/ __| #
1579 # | | | | (_) | (_| | __/\__ \ #
1580 # |_| |_|\___/ \__,_|\___||___/ #
1581 #----------------------------------------------------------#
1583 # spilling disabled for all float nodes for now, because the fpcw handler
1584 # runs before spilling and we might end up with wrong fpcw then
1588 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1589 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1593 attr_type => "ia32_x87_attr_t",
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 cmp_attr => "return 1;",
1614 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1615 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1619 attr_type => "ia32_x87_attr_t",
1623 cmp_attr => "return 1;",
1628 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1629 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1630 outs => [ "res", "M" ],
1633 attr_type => "ia32_x87_attr_t",
1637 cmp_attr => "return 1;",
1638 outs => [ "res", "M" ],
1643 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1644 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1648 attr_type => "ia32_x87_attr_t",
1652 cmp_attr => "return 1;",
1658 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1663 attr_type => "ia32_x87_attr_t",
1668 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1673 attr_type => "ia32_x87_attr_t",
1676 # virtual Load and Store
1680 state => "exc_pinned",
1681 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1682 ins => [ "base", "index", "mem" ],
1683 outs => [ "res", "M" ],
1684 attr => "ir_mode *load_mode",
1685 init_attr => "attr->attr.ls_mode = load_mode;",
1688 attr_type => "ia32_x87_attr_t",
1693 state => "exc_pinned",
1694 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1695 ins => [ "base", "index", "mem", "val" ],
1696 attr => "ir_mode *store_mode",
1697 init_attr => "attr->attr.ls_mode = store_mode;",
1701 attr_type => "ia32_x87_attr_t",
1707 state => "exc_pinned",
1708 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1709 outs => [ "res", "M" ],
1710 ins => [ "base", "index", "mem" ],
1713 attr_type => "ia32_x87_attr_t",
1717 cmp_attr => "return 1;",
1718 outs => [ "res", "M" ],
1723 state => "exc_pinned",
1724 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1725 ins => [ "base", "index", "mem", "val", "fpcw" ],
1729 attr_type => "ia32_x87_attr_t",
1733 cmp_attr => "return 1;",
1734 state => "exc_pinned",
1744 reg_req => { out => [ "vfp" ] },
1748 attr_type => "ia32_x87_attr_t",
1753 reg_req => { out => [ "vfp" ] },
1757 attr_type => "ia32_x87_attr_t",
1762 reg_req => { out => [ "vfp" ] },
1766 attr_type => "ia32_x87_attr_t",
1771 reg_req => { out => [ "vfp" ] },
1775 attr_type => "ia32_x87_attr_t",
1780 reg_req => { out => [ "vfp" ] },
1784 attr_type => "ia32_x87_attr_t",
1789 reg_req => { out => [ "vfp" ] },
1793 attr_type => "ia32_x87_attr_t",
1798 reg_req => { out => [ "vfp" ] },
1802 attr_type => "ia32_x87_attr_t",
1808 # we can't allow to rematerialize this node so we don't have
1809 # accidently produce Phi(Fucom, Fucom(flipped))
1811 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1812 ins => [ "left", "right" ],
1813 outs => [ "flags" ],
1814 attr => "int flipped",
1815 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1818 attr_type => "ia32_x87_attr_t",
1824 reg_req => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
1825 ins => [ "left", "right" ],
1826 outs => [ "flags" ],
1827 attr => "int flipped",
1828 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1831 attr_type => "ia32_x87_attr_t",
1837 reg_req => { in => [ "vfp" ], out => [ "eax" ] },
1839 outs => [ "flags" ],
1840 attr => "int flipped",
1841 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1844 attr_type => "ia32_x87_attr_t",
1850 reg_req => { in => [ "eax" ], out => [ "eflags" ] },
1852 outs => [ "flags" ],
1855 mode => $mode_flags,
1858 #------------------------------------------------------------------------#
1859 # ___ _____ __ _ _ _ #
1860 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1861 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1862 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1863 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1864 #------------------------------------------------------------------------#
1866 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1867 # are swapped, we work this around in the emitter...
1871 rd_constructor => "NONE",
1873 emit => '. fadd%XM %x87_binop',
1874 attr_type => "ia32_x87_attr_t",
1879 rd_constructor => "NONE",
1881 emit => '. faddp%XM %x87_binop',
1882 attr_type => "ia32_x87_attr_t",
1887 rd_constructor => "NONE",
1889 emit => '. fmul%XM %x87_binop',
1890 attr_type => "ia32_x87_attr_t",
1895 rd_constructor => "NONE",
1897 emit => '. fmulp%XM %x87_binop',,
1898 attr_type => "ia32_x87_attr_t",
1903 rd_constructor => "NONE",
1905 emit => '. fsub%XM %x87_binop',
1906 attr_type => "ia32_x87_attr_t",
1911 rd_constructor => "NONE",
1913 # see note about gas bugs
1914 emit => '. fsubrp%XM %x87_binop',
1915 attr_type => "ia32_x87_attr_t",
1920 rd_constructor => "NONE",
1923 emit => '. fsubr%XM %x87_binop',
1924 attr_type => "ia32_x87_attr_t",
1929 rd_constructor => "NONE",
1932 # see note about gas bugs
1933 emit => '. fsubp%XM %x87_binop',
1934 attr_type => "ia32_x87_attr_t",
1939 rd_constructor => "NONE",
1942 attr_type => "ia32_x87_attr_t",
1945 # this node is just here, to keep the simulator running
1946 # we can omit this when a fprem simulation function exists
1949 rd_constructor => "NONE",
1952 attr_type => "ia32_x87_attr_t",
1957 rd_constructor => "NONE",
1959 emit => '. fdiv%XM %x87_binop',
1960 attr_type => "ia32_x87_attr_t",
1965 rd_constructor => "NONE",
1967 # see note about gas bugs
1968 emit => '. fdivrp%XM %x87_binop',
1969 attr_type => "ia32_x87_attr_t",
1974 rd_constructor => "NONE",
1976 emit => '. fdivr%XM %x87_binop',
1977 attr_type => "ia32_x87_attr_t",
1982 rd_constructor => "NONE",
1984 # see note about gas bugs
1985 emit => '. fdivp%XM %x87_binop',
1986 attr_type => "ia32_x87_attr_t",
1991 rd_constructor => "NONE",
1994 attr_type => "ia32_x87_attr_t",
1999 rd_constructor => "NONE",
2002 attr_type => "ia32_x87_attr_t",
2005 # x87 Load and Store
2008 rd_constructor => "NONE",
2009 op_flags => "R|L|F",
2010 state => "exc_pinned",
2012 emit => '. fld%XM %AM',
2013 attr_type => "ia32_x87_attr_t",
2017 rd_constructor => "NONE",
2018 op_flags => "R|L|F",
2019 state => "exc_pinned",
2021 emit => '. fst%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 => '. fstp%XM %AM',
2033 attr_type => "ia32_x87_attr_t",
2040 rd_constructor => "NONE",
2042 emit => '. fild%M %AM',
2043 attr_type => "ia32_x87_attr_t",
2048 state => "exc_pinned",
2049 rd_constructor => "NONE",
2051 emit => '. fist%M %AM',
2053 attr_type => "ia32_x87_attr_t",
2058 state => "exc_pinned",
2059 rd_constructor => "NONE",
2061 emit => '. fistp%M %AM',
2063 attr_type => "ia32_x87_attr_t",
2069 op_flags => "R|c|K",
2071 reg_req => { out => [ "vfp" ] },
2073 attr_type => "ia32_x87_attr_t",
2077 op_flags => "R|c|K",
2079 reg_req => { out => [ "vfp" ] },
2081 attr_type => "ia32_x87_attr_t",
2085 op_flags => "R|c|K",
2087 reg_req => { out => [ "vfp" ] },
2089 attr_type => "ia32_x87_attr_t",
2093 op_flags => "R|c|K",
2095 reg_req => { out => [ "vfp" ] },
2097 attr_type => "ia32_x87_attr_t",
2101 op_flags => "R|c|K",
2103 reg_req => { out => [ "vfp" ] },
2105 attr_type => "ia32_x87_attr_t",
2109 op_flags => "R|c|K",
2111 reg_req => { out => [ "vfp" ] },
2112 emit => '. fldll2t',
2113 attr_type => "ia32_x87_attr_t",
2117 op_flags => "R|c|K",
2119 reg_req => { out => [ "vfp" ] },
2121 attr_type => "ia32_x87_attr_t",
2125 # Note that it is NEVER allowed to do CSE on these nodes
2126 # Moreover, note the virtual register requierements!
2131 cmp_attr => "return 1;",
2132 emit => '. fxch %X0',
2133 attr_type => "ia32_x87_attr_t",
2140 cmp_attr => "return 1;",
2141 emit => '. fld %X0',
2142 attr_type => "ia32_x87_attr_t",
2148 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2149 cmp_attr => "return 1;",
2150 emit => '. fld %X0',
2151 attr_type => "ia32_x87_attr_t",
2157 cmp_attr => "return 1;",
2158 emit => '. fstp %X0',
2159 attr_type => "ia32_x87_attr_t",
2166 cmp_attr => "return 1;",
2167 emit => '. ffreep %X0',
2168 attr_type => "ia32_x87_attr_t",
2175 cmp_attr => "return 1;",
2177 attr_type => "ia32_x87_attr_t",
2184 cmp_attr => "return 1;",
2186 attr_type => "ia32_x87_attr_t",
2194 emit => ". fucom %X1\n".
2196 attr_type => "ia32_x87_attr_t",
2201 emit => ". fucomp %X1\n".
2203 attr_type => "ia32_x87_attr_t",
2208 emit => ". fucompp\n".
2210 attr_type => "ia32_x87_attr_t",
2215 emit => '. fucomi %X1',
2216 attr_type => "ia32_x87_attr_t",
2221 emit => '. fucompi %X1',
2222 attr_type => "ia32_x87_attr_t",
2229 attr_type => "ia32_x87_attr_t",
2233 # -------------------------------------------------------------------------------- #
2234 # ____ ____ _____ _ _ #
2235 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2236 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2237 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2238 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2240 # -------------------------------------------------------------------------------- #
2243 # Spilling and reloading of SSE registers, hardcoded, not generated #
2247 state => "exc_pinned",
2248 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2249 emit => '. movdqu %D0, %AM',
2250 outs => [ "res", "M" ],
2256 state => "exc_pinned",
2257 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2258 ins => [ "base", "index", "mem", "val" ],
2259 emit => '. movdqu %binop',
2266 # Include the generated SIMD node specification written by the SIMD optimization
2267 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2268 unless ($return = do $my_script_name) {
2269 warn "couldn't parse $my_script_name: $@" if $@;
2270 warn "couldn't do $my_script_name: $!" unless defined $return;
2271 warn "couldn't run $my_script_name" unless $return;