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 SI3 => "${arch}_emit_source_register_or_immediate(node, 3);",
204 D0 => "${arch}_emit_dest_register(node, 0);",
205 D1 => "${arch}_emit_dest_register(node, 1);",
206 DB0 => "${arch}_emit_8bit_dest_register(node, 0);",
207 X0 => "${arch}_emit_x87_register(node, 0);",
208 X1 => "${arch}_emit_x87_register(node, 1);",
209 SE => "${arch}_emit_extend_suffix(get_ia32_ls_mode(node));",
210 ME => "if(get_mode_size_bits(get_ia32_ls_mode(node)) != 32)\n
211 ia32_emit_mode_suffix(node);",
212 M => "${arch}_emit_mode_suffix(node);",
213 XM => "${arch}_emit_x87_mode_suffix(node);",
214 XXM => "${arch}_emit_xmm_mode_suffix(node);",
215 XSD => "${arch}_emit_xmm_mode_suffix_s(node);",
216 AM => "${arch}_emit_am(node);",
217 unop3 => "${arch}_emit_unop(node, 3);",
218 unop4 => "${arch}_emit_unop(node, 4);",
219 unop5 => "${arch}_emit_unop(node, 5);",
220 DAM1 => "${arch}_emit_am_or_dest_register(node, 1);",
221 binop => "${arch}_emit_binop(node);",
222 x87_binop => "${arch}_emit_x87_binop(node);",
223 CMP0 => "${arch}_emit_cmp_suffix_node(node, 0);",
226 #--------------------------------------------------#
229 # _ __ _____ __ _ _ __ ___ _ __ ___ #
230 # | '_ \ / _ \ \ /\ / / | | '__| / _ \| '_ \/ __| #
231 # | | | | __/\ V V / | | | | (_) | |_) \__ \ #
232 # |_| |_|\___| \_/\_/ |_|_| \___/| .__/|___/ #
235 #--------------------------------------------------#
237 $default_attr_type = "ia32_attr_t";
238 $default_copy_attr = "ia32_copy_attr";
240 sub ia32_custom_init_attr {
244 if(defined($node->{modified_flags})) {
245 $res .= "\tset_ia32_flags(res, get_ia32_flags(res) | arch_irn_flags_modify_flags);\n";
247 if(defined($node->{am})) {
248 my $am = $node->{am};
249 if($am eq "full,binary") {
250 $res .= "\tset_ia32_am_support(res, ia32_am_Full, ia32_am_binary);";
251 } elsif($am eq "full,unary") {
252 $res .= "\tset_ia32_am_support(res, ia32_am_Full, ia32_am_unary);";
253 } elsif($am eq "source,unary") {
254 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_unary);";
255 } elsif($am eq "source,binary") {
256 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_binary);";
257 } elsif($am eq "dest,unary") {
258 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_unary);";
259 } elsif($am eq "dest,binary") {
260 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_binary);";
261 } elsif($am eq "dest,ternary") {
262 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_ternary);";
263 } elsif($am eq "source,ternary") {
264 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_ternary);";
265 } elsif($am eq "none") {
268 die("Invalid address mode '$am' specified on op $name");
271 if($node->{state} ne "exc_pinned"
272 and $node->{state} ne "pinned") {
273 die("AM nodes must have pinned or AM pinned state ($name)");
279 $custom_init_attr_func = \&ia32_custom_init_attr;
282 ia32_attr_t => "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);",
284 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
285 "\tinit_ia32_x87_attributes(res);",
287 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
288 "\tinit_ia32_x87_attributes(res);".
289 "\tinit_ia32_asm_attributes(res);",
290 ia32_immediate_attr_t =>
291 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
292 "\tinit_ia32_immediate_attributes(res, symconst, symconst_sign, offset);"
296 ia32_attr_t => "ia32_compare_nodes_attr",
297 ia32_x87_attr_t => "ia32_compare_x87_attr",
298 ia32_asm_attr_t => "ia32_compare_asm_attr",
299 ia32_immediate_attr_t => "ia32_compare_immediate_attr",
305 $mode_xmm = "mode_E";
306 $mode_gp = "mode_Iu";
307 $mode_flags = "mode_Iu";
308 $mode_fpcw = "mode_fpcw";
309 $status_flags = [ "CF", "PF", "AF", "ZF", "SF", "OF" ];
310 $fpcw_flags = [ "FP_IM", "FP_DM", "FP_ZM", "FP_OM", "FP_UM", "FP_PM",
311 "FP_PC0", "FP_PC1", "FP_RC0", "FP_RC1", "FP_X" ];
319 reg_req => { out => [ "gp_NOREG" ] },
320 attr => "ir_entity *symconst, int symconst_sign, long offset",
321 attr_type => "ia32_immediate_attr_t",
329 out_arity => "variable",
330 attr_type => "ia32_asm_attr_t",
331 attr => "ident *asm_text, const ia32_asm_reg_t *register_map",
332 init_attr => "attr->asm_text = asm_text;\n".
333 "\tattr->register_map = register_map;\n",
341 reg_req => { out => [ "gp" ] },
346 cmp_attr => "return 1;",
349 #-----------------------------------------------------------------#
352 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
353 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
354 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
355 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
358 #-----------------------------------------------------------------#
360 # commutative operations
364 state => "exc_pinned",
365 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5", "none", "flags" ] },
366 ins => [ "base", "index", "mem", "left", "right" ],
367 emit => '. add%M %binop',
371 modified_flags => $status_flags
376 state => "exc_pinned",
377 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
378 ins => [ "base", "index", "mem", "val" ],
379 emit => ". add%M %SI3, %AM",
382 modified_flags => $status_flags
387 state => "exc_pinned",
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 state => "exc_pinned",
398 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 in_r5" ] },
399 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
400 emit => '. adc%M %binop',
404 modified_flags => $status_flags
409 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
410 ins => [ "left", "right" ],
414 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
415 ins => [ "left", "right", "eflags" ],
419 # we should not rematrialize this node. It produces 2 results and has
420 # very strict constrains
421 state => "exc_pinned",
422 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
423 ins => [ "base", "index", "mem", "val_high", "val_low" ],
424 emit => '. mul%M %unop4',
425 outs => [ "EAX", "EDX", "M" ],
426 am => "source,binary",
429 modified_flags => $status_flags
433 # we should not rematrialize this node. It produces 2 results and has
434 # very strict constrains
436 cmp_attr => "return 1;",
437 outs => [ "EAX", "EDX", "M" ],
443 state => "exc_pinned",
444 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
445 ins => [ "base", "index", "mem", "left", "right" ],
446 emit => '. imul%M %binop',
447 am => "source,binary",
451 modified_flags => $status_flags
456 state => "exc_pinned",
457 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
458 ins => [ "base", "index", "mem", "val_high", "val_low" ],
459 emit => '. imul%M %unop4',
460 outs => [ "EAX", "EDX", "M" ],
461 am => "source,binary",
464 modified_flags => $status_flags
468 # we should not rematrialize this node. It produces 2 results and has
469 # very strict constrains
471 cmp_attr => "return 1;",
472 outs => [ "EAX", "EDX", "M" ],
478 state => "exc_pinned",
479 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
480 ins => [ "base", "index", "mem", "left", "right" ],
482 emit => '. and%M %binop',
485 modified_flags => $status_flags
490 state => "exc_pinned",
491 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
492 ins => [ "base", "index", "mem", "val" ],
493 emit => '. and%M %SI3, %AM',
496 modified_flags => $status_flags
501 state => "exc_pinned",
502 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
503 ins => [ "base", "index", "mem", "val" ],
504 emit => '. and%M %SB3, %AM',
507 modified_flags => $status_flags
512 state => "exc_pinned",
513 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
514 ins => [ "base", "index", "mem", "left", "right" ],
516 emit => '. or%M %binop',
519 modified_flags => $status_flags
524 state => "exc_pinned",
525 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
526 ins => [ "base", "index", "mem", "val" ],
527 emit => '. or%M %SI3, %AM',
530 modified_flags => $status_flags
535 state => "exc_pinned",
536 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
537 ins => [ "base", "index", "mem", "val" ],
538 emit => '. or%M %SB3, %AM',
541 modified_flags => $status_flags
546 state => "exc_pinned",
547 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
548 ins => [ "base", "index", "mem", "left", "right" ],
550 emit => '. xor%M %binop',
553 modified_flags => $status_flags
558 state => "exc_pinned",
559 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
560 ins => [ "base", "index", "mem", "val" ],
561 emit => '. xor%M %SI3, %AM',
564 modified_flags => $status_flags
569 state => "exc_pinned",
570 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
571 ins => [ "base", "index", "mem", "val" ],
572 emit => '. xor%M %SB3, %AM',
575 modified_flags => $status_flags
578 # not commutative operations
582 state => "exc_pinned",
583 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4", "none", "flags" ] },
584 ins => [ "base", "index", "mem", "left", "right" ],
586 emit => '. sub%M %binop',
589 modified_flags => $status_flags
594 state => "exc_pinned",
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 state => "exc_pinned",
606 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
607 ins => [ "base", "index", "mem", "val" ],
608 emit => '. sub%M %SB3, %AM',
611 modified_flags => $status_flags
615 state => "exc_pinned",
616 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 !in_r5" ] },
617 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
619 emit => '. sbb%M %binop',
622 modified_flags => $status_flags
626 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
627 ins => [ "left", "right" ],
631 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
632 ins => [ "left", "right", "eflags" ],
637 state => "exc_pinned",
638 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
639 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
640 outs => [ "div_res", "mod_res", "M" ],
641 am => "source,ternary",
642 emit => ". idiv%M %unop5",
645 modified_flags => $status_flags
650 state => "exc_pinned",
651 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
652 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
653 outs => [ "div_res", "mod_res", "M" ],
654 am => "source,ternary",
655 emit => ". div%M %unop5",
658 modified_flags => $status_flags
663 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
664 ins => [ "left", "right" ],
665 emit => '. shl %SB1, %S0',
668 modified_flags => $status_flags
673 state => "exc_pinned",
674 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
675 ins => [ "base", "index", "mem", "count" ],
676 emit => '. shl%M %SB3, %AM',
679 modified_flags => $status_flags
683 cmp_attr => "return 1;",
684 # value, cnt, dependency
690 # see ShrD about the strange out constraint
691 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
692 ins => [ "left_high", "left_low", "right" ],
693 emit => ". shld%M %SB2, %S1, %S0\n".
698 modified_flags => $status_flags
702 cmp_attr => "return 1;",
708 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
709 ins => [ "val", "count" ],
710 emit => '. shr %SB1, %S0',
713 modified_flags => $status_flags
718 state => "exc_pinned",
719 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
720 ins => [ "base", "index", "mem", "count" ],
721 emit => '. shr%M %SB3, %AM',
724 modified_flags => $status_flags
728 cmp_attr => "return 1;",
729 # value, cnt, dependency
734 # What's going on with the out constraint here? We would like to write
735 # "in_r2" and be done. However in firm we only support should_be_same
736 # constraints at the moment. Which means they could be non-fullfilled in
737 # some cases. Now when all values happen to live through the node, out
738 # is ecx and in_r2 not ecx, then we're screwed. Because in this case we
739 # need a 4th Register.
741 # The best solution for this is extending the register allocator to support
742 # must_be_same constraints which create a copy when the in_r2 value
743 # lives through (this ensures that we have the 4th register in the cases
744 # when we need it and can always fix the situation).
746 # For now I'm doing this ultra ugly !in hack which allocates 4 registers
747 # and creates an extra mov
749 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "!in" ] },
750 ins => [ "left_high", "left_low", "right" ],
751 emit => ". shrd%M %SB2, %S1, %S0\n".
756 modified_flags => $status_flags
760 cmp_attr => "return 1;",
766 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
767 ins => [ "val", "count" ],
768 emit => '. sar %SB1, %S0',
771 modified_flags => $status_flags
776 state => "exc_pinned",
777 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
778 ins => [ "base", "index", "mem", "count" ],
779 emit => '. sar%M %SB3, %AM',
782 modified_flags => $status_flags
786 cmp_attr => "return 1;",
787 # value, cnt, dependency
793 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
794 ins => [ "val", "count" ],
795 emit => '. ror %SB1, %S0',
798 modified_flags => $status_flags
803 state => "exc_pinned",
804 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
805 ins => [ "base", "index", "mem", "count" ],
806 emit => '. ror%M %SB3, %AM',
809 modified_flags => $status_flags
814 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
815 ins => [ "val", "count" ],
816 emit => '. rol %SB1, %S0',
819 modified_flags => $status_flags
824 state => "exc_pinned",
825 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
826 ins => [ "base", "index", "mem", "count" ],
827 emit => '. rol%M %SB3, %AM',
830 modified_flags => $status_flags
837 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
842 modified_flags => $status_flags
847 state => "exc_pinned",
848 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
849 ins => [ "base", "index", "mem" ],
850 emit => '. neg%M %AM',
853 modified_flags => $status_flags
858 reg_req => { in => [ "gp", "gp" ], out => [ "in_r1", "gp" ] },
859 outs => [ "low_res", "high_res" ],
861 modified_flags => $status_flags
866 cmp_attr => "return 1;",
872 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
876 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
881 state => "exc_pinned",
882 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
883 ins => [ "base", "index", "mem" ],
884 emit => '. inc%M %AM',
887 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
892 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
896 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
901 state => "exc_pinned",
902 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
903 ins => [ "base", "index", "mem" ],
904 emit => '. dec%M %AM',
907 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
912 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
921 state => "exc_pinned",
922 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
923 ins => [ "base", "index", "mem" ],
924 emit => '. not%M %AM',
933 state => "exc_pinned",
934 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
935 ins => [ "base", "index", "mem", "left", "right" ],
936 outs => [ "eflags" ],
937 am => "source,binary",
938 emit => '. cmp%M %binop',
939 attr => "int ins_permuted, int cmp_unsigned",
940 init_attr => "attr->data.ins_permuted = ins_permuted;\n".
941 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
945 modified_flags => $status_flags
950 state => "exc_pinned",
951 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
952 ins => [ "base", "index", "mem", "left", "right" ],
953 outs => [ "eflags" ],
954 am => "source,binary",
955 emit => '. cmpb %binop',
956 attr => "int ins_permuted, int cmp_unsigned",
957 init_attr => "attr->data.ins_permuted = ins_permuted;\n".
958 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
962 modified_flags => $status_flags
967 state => "exc_pinned",
968 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
969 ins => [ "base", "index", "mem", "left", "right" ],
970 outs => [ "eflags" ],
971 am => "source,binary",
972 emit => '. test%M %binop',
973 attr => "int ins_permuted, int cmp_unsigned",
974 init_attr => "attr->data.ins_permuted = ins_permuted;\n".
975 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
979 modified_flags => $status_flags
984 state => "exc_pinned",
985 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
986 ins => [ "base", "index", "mem", "left", "right" ],
987 outs => [ "eflags" ],
988 am => "source,binary",
989 emit => '. testb %binop',
990 attr => "int ins_permuted, int cmp_unsigned",
991 init_attr => "attr->data.ins_permuted = ins_permuted;\n".
992 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
996 modified_flags => $status_flags
1001 reg_req => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
1002 ins => [ "eflags" ],
1003 attr => "pn_Cmp pnc, int ins_permuted",
1004 init_attr => "attr->pn_code = pnc;\n".
1005 "attr->data.ins_permuted = ins_permuted;\n".
1006 "\tset_ia32_ls_mode(res, mode_Bu);\n",
1007 emit => '. set%CMP0 %DB0',
1015 # (note: leave the false,true order intact to make it compatible with other
1017 state => "exc_pinned",
1018 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4 in_r5" ] },
1019 ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
1020 am => "source,binary",
1021 attr => "int ins_permuted, pn_Cmp pn_code",
1022 init_attr => "attr->pn_code = pn_code;\n".
1023 "attr->data.ins_permuted = ins_permuted;",
1031 op_flags => "L|X|Y",
1032 reg_req => { in => [ "eflags" ], out => [ "none", "none" ] },
1033 ins => [ "eflags" ],
1034 outs => [ "false", "true" ],
1035 attr => "pn_Cmp pnc",
1036 init_attr => "attr->pn_code = pnc;",
1038 units => [ "BRANCH" ],
1043 op_flags => "L|X|Y",
1044 reg_req => { in => [ "gp" ], out => [ "none" ] },
1046 units => [ "BRANCH" ],
1048 modified_flags => $status_flags
1054 reg_req => { in => [ "gp", "gp", "none", "gp" ] },
1055 ins => [ "base", "index", "mem", "target" ],
1056 am => "source,unary",
1057 emit => '. jmp *%unop3',
1058 units => [ "BRANCH" ],
1065 reg_req => { out => [ "gp" ] },
1067 attr => "ir_entity *symconst, int symconst_sign, long offset",
1068 attr_type => "ia32_immediate_attr_t",
1070 # depends on the const and is set in ia32_transform
1071 # modified_flags => $status_flags
1078 reg_req => { out => [ "gp_UKNWN" ] },
1088 reg_req => { out => [ "vfp_UKNWN" ] },
1092 attr_type => "ia32_x87_attr_t",
1099 reg_req => { out => [ "xmm_UKNWN" ] },
1109 reg_req => { out => [ "gp_NOREG" ] },
1119 reg_req => { out => [ "vfp_NOREG" ] },
1123 attr_type => "ia32_x87_attr_t",
1130 reg_req => { out => [ "xmm_NOREG" ] },
1140 reg_req => { out => [ "fp_cw" ] },
1144 modified_flags => $fpcw_flags
1150 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1151 ins => [ "base", "index", "mem" ],
1153 emit => ". fldcw %AM",
1156 modified_flags => $fpcw_flags
1162 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1163 ins => [ "base", "index", "mem", "fpcw" ],
1165 emit => ". fnstcw %AM",
1171 # we should not rematrialize this node. It has very strict constraints.
1172 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1173 ins => [ "val", "globbered" ],
1181 # Note that we add additional latency values depending on address mode, so a
1182 # lateny of 0 for load is correct
1186 state => "exc_pinned",
1187 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1188 ins => [ "base", "index", "mem" ],
1189 outs => [ "res", "M" ],
1191 emit => ". mov%SE%ME%.l %AM, %D0",
1197 cmp_attr => "return 1;",
1198 outs => [ "res", "M" ],
1204 cmp_attr => "return 1;",
1205 state => "exc_pinned",
1212 state => "exc_pinned",
1213 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1214 ins => [ "base", "index", "mem", "val" ],
1215 emit => '. mov%M %SI3, %AM',
1223 state => "exc_pinned",
1224 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1225 ins => [ "base", "index", "mem", "val" ],
1226 emit => '. mov%M %SB3, %AM',
1234 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1235 ins => [ "base", "index" ],
1236 emit => '. leal %AM, %D0',
1240 # lea doesn't modify the flags, but setting this seems advantageous since it
1241 # increases chances that the Lea is transformed back to an Add
1242 modified_flags => 1,
1246 state => "exc_pinned",
1247 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "esp", "none" ] },
1248 ins => [ "base", "index", "mem", "val", "stack" ],
1249 emit => '. push%M %unop4',
1250 outs => [ "stack:I|S", "M" ],
1251 am => "source,binary",
1257 state => "exc_pinned",
1258 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1259 emit => '. pop%M %DAM1',
1260 outs => [ "stack:I|S", "res", "M" ],
1261 ins => [ "base", "index", "mem", "stack" ],
1263 latency => 3, # Pop is more expensive than Push on Athlon
1268 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1270 outs => [ "frame:I", "stack:I|S", "M" ],
1276 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1278 outs => [ "frame:I", "stack:I|S" ],
1286 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1287 ins => [ "base", "index", "mem", "stack", "size" ],
1288 am => "source,binary",
1289 emit => '. addl %binop',
1290 outs => [ "stack:S", "M" ],
1292 modified_flags => $status_flags
1298 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1299 ins => [ "base", "index", "mem", "stack", "size" ],
1300 am => "source,binary",
1301 emit => ". subl %binop\n".
1302 ". movl %%esp, %D1",
1303 outs => [ "stack:I|S", "addr", "M" ],
1305 modified_flags => $status_flags
1310 reg_req => { out => [ "gp" ] },
1315 #-----------------------------------------------------------------------------#
1316 # _____ _____ ______ __ _ _ _ #
1317 # / ____/ ____| ____| / _| | | | | | #
1318 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1319 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1320 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1321 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1322 #-----------------------------------------------------------------------------#
1326 reg_req => { out => [ "xmm" ] },
1327 emit => '. xorp%XSD %D0, %D0',
1333 # commutative operations
1337 state => "exc_pinned",
1338 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1339 ins => [ "base", "index", "mem", "left", "right" ],
1340 am => "source,binary",
1341 emit => '. add%XXM %binop',
1349 state => "exc_pinned",
1350 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1351 ins => [ "base", "index", "mem", "left", "right" ],
1352 am => "source,binary",
1353 emit => '. mul%XXM %binop',
1361 state => "exc_pinned",
1362 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1363 ins => [ "base", "index", "mem", "left", "right" ],
1364 am => "source,binary",
1365 emit => '. max%XXM %binop',
1373 state => "exc_pinned",
1374 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1375 ins => [ "base", "index", "mem", "left", "right" ],
1376 am => "source,binary",
1377 emit => '. min%XXM %binop',
1385 state => "exc_pinned",
1386 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1387 ins => [ "base", "index", "mem", "left", "right" ],
1388 am => "source,binary",
1389 emit => '. andp%XSD %binop',
1397 state => "exc_pinned",
1398 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1399 ins => [ "base", "index", "mem", "left", "right" ],
1400 am => "source,binary",
1401 emit => '. orp%XSD %binop',
1408 state => "exc_pinned",
1409 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1410 ins => [ "base", "index", "mem", "left", "right" ],
1411 am => "source,binary",
1412 emit => '. xorp%XSD %binop',
1418 # not commutative operations
1422 state => "exc_pinned",
1423 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1424 ins => [ "base", "index", "mem", "left", "right" ],
1425 am => "source,binary",
1426 emit => '. andnp%XSD %binop',
1434 state => "exc_pinned",
1435 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1436 ins => [ "base", "index", "mem", "left", "right" ],
1437 am => "source,binary",
1438 emit => '. sub%XXM %binop',
1446 state => "exc_pinned",
1447 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1448 ins => [ "base", "index", "mem", "left", "right" ],
1449 am => "source,binary",
1450 outs => [ "res", "M" ],
1451 emit => '. div%XXM %binop',
1460 state => "exc_pinned",
1461 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1462 ins => [ "base", "index", "mem", "left", "right" ],
1463 outs => [ "flags" ],
1464 am => "source,binary",
1465 attr => "int ins_permuted",
1466 init_attr => "attr->data.ins_permuted = ins_permuted;",
1467 emit => ' .ucomi%XXM %binop',
1470 mode => $mode_flags,
1471 modified_flags => 1,
1478 state => "exc_pinned",
1479 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1480 ins => [ "base", "index", "mem" ],
1481 emit => '. mov%XXM %AM, %D0',
1482 attr => "ir_mode *load_mode",
1483 init_attr => "attr->ls_mode = load_mode;",
1484 outs => [ "res", "M" ],
1491 state => "exc_pinned",
1492 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1493 ins => [ "base", "index", "mem", "val" ],
1494 emit => '. mov%XXM %S3, %AM',
1502 state => "exc_pinned",
1503 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1504 ins => [ "base", "index", "mem", "val" ],
1505 emit => '. mov%XXM %S3, %AM',
1513 state => "exc_pinned",
1514 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1515 ins => [ "base", "index", "mem", "val" ],
1516 am => "source,unary",
1517 emit => '. cvtsi2ss %unop3, %D0',
1525 state => "exc_pinned",
1526 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1527 ins => [ "base", "index", "mem", "val" ],
1528 am => "source,unary",
1529 emit => '. cvtsi2sd %unop3, %D0',
1538 cmp_attr => "return 1;",
1544 cmp_attr => "return 1;",
1553 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1554 outs => [ "DST", "SRC", "CNT", "M" ],
1556 # we don't care about this flag, so no need to mark this node
1557 # modified_flags => [ "DF" ]
1563 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1564 outs => [ "DST", "SRC", "M" ],
1566 # we don't care about this flag, so no need to mark this node
1567 # modified_flags => [ "DF" ]
1573 state => "exc_pinned",
1574 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1575 ins => [ "base", "index", "mem", "val" ],
1576 am => "source,unary",
1578 attr => "ir_mode *smaller_mode",
1579 init_attr => "attr->ls_mode = smaller_mode;",
1584 state => "exc_pinned",
1585 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1586 ins => [ "base", "index", "mem", "val" ],
1587 am => "source,unary",
1589 attr => "ir_mode *smaller_mode",
1590 init_attr => "attr->ls_mode = smaller_mode;",
1595 state => "exc_pinned",
1596 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
1597 ins => [ "base", "index", "mem", "val" ],
1598 am => "source,unary",
1605 state => "exc_pinned",
1606 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1607 ins => [ "base", "index", "mem", "val" ],
1608 am => "source,unary",
1615 state => "exc_pinned",
1616 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1617 ins => [ "base", "index", "mem", "val" ],
1618 am => "source,unary",
1624 #----------------------------------------------------------#
1626 # (_) | | | | / _| | | | #
1627 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1628 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1629 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1630 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1632 # _ __ ___ __| | ___ ___ #
1633 # | '_ \ / _ \ / _` |/ _ \/ __| #
1634 # | | | | (_) | (_| | __/\__ \ #
1635 # |_| |_|\___/ \__,_|\___||___/ #
1636 #----------------------------------------------------------#
1638 # rematerialisation disabled for all float nodes for now, because the fpcw
1639 # handler runs before spilling and we might end up with wrong fpcw then
1643 state => "exc_pinned",
1644 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1645 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1646 am => "source,binary",
1650 attr_type => "ia32_x87_attr_t",
1655 state => "exc_pinned",
1656 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1657 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1658 am => "source,binary",
1662 attr_type => "ia32_x87_attr_t",
1667 state => "exc_pinned",
1668 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1669 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1670 am => "source,binary",
1674 attr_type => "ia32_x87_attr_t",
1678 state => "exc_pinned",
1679 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1680 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1681 am => "source,binary",
1682 outs => [ "res", "M" ],
1685 attr_type => "ia32_x87_attr_t",
1689 reg_req => { in => [ "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1690 ins => [ "left", "right", "fpcw" ],
1694 attr_type => "ia32_x87_attr_t",
1699 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1704 attr_type => "ia32_x87_attr_t",
1709 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1714 attr_type => "ia32_x87_attr_t",
1717 # virtual Load and Store
1722 state => "exc_pinned",
1723 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1724 ins => [ "base", "index", "mem" ],
1725 outs => [ "res", "M" ],
1726 attr => "ir_mode *load_mode",
1727 init_attr => "attr->attr.ls_mode = load_mode;",
1730 attr_type => "ia32_x87_attr_t",
1736 state => "exc_pinned",
1737 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1738 ins => [ "base", "index", "mem", "val" ],
1739 attr => "ir_mode *store_mode",
1740 init_attr => "attr->attr.ls_mode = store_mode;",
1744 attr_type => "ia32_x87_attr_t",
1750 state => "exc_pinned",
1751 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1752 outs => [ "res", "M" ],
1753 ins => [ "base", "index", "mem" ],
1756 attr_type => "ia32_x87_attr_t",
1760 cmp_attr => "return 1;",
1761 outs => [ "res", "M" ],
1766 state => "exc_pinned",
1767 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1768 ins => [ "base", "index", "mem", "val", "fpcw" ],
1772 attr_type => "ia32_x87_attr_t",
1776 cmp_attr => "return 1;",
1777 state => "exc_pinned",
1787 reg_req => { out => [ "vfp" ] },
1791 attr_type => "ia32_x87_attr_t",
1796 reg_req => { out => [ "vfp" ] },
1800 attr_type => "ia32_x87_attr_t",
1805 reg_req => { out => [ "vfp" ] },
1809 attr_type => "ia32_x87_attr_t",
1814 reg_req => { out => [ "vfp" ] },
1818 attr_type => "ia32_x87_attr_t",
1823 reg_req => { out => [ "vfp" ] },
1827 attr_type => "ia32_x87_attr_t",
1832 reg_req => { out => [ "vfp" ] },
1836 attr_type => "ia32_x87_attr_t",
1841 reg_req => { out => [ "vfp" ] },
1845 attr_type => "ia32_x87_attr_t",
1851 # we can't allow to rematerialize this node so we don't have
1852 # accidently produce Phi(Fucom, Fucom(ins_permuted))
1854 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1855 ins => [ "left", "right" ],
1856 outs => [ "flags" ],
1857 attr => "int ins_permuted",
1858 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1861 attr_type => "ia32_x87_attr_t",
1867 reg_req => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
1868 ins => [ "left", "right" ],
1869 outs => [ "flags" ],
1870 attr => "int ins_permuted",
1871 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1874 attr_type => "ia32_x87_attr_t",
1880 reg_req => { in => [ "vfp" ], out => [ "eax" ] },
1882 outs => [ "flags" ],
1883 attr => "int ins_permuted",
1884 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1887 attr_type => "ia32_x87_attr_t",
1893 reg_req => { in => [ "eax" ], out => [ "eflags" ] },
1895 outs => [ "flags" ],
1898 mode => $mode_flags,
1901 #------------------------------------------------------------------------#
1902 # ___ _____ __ _ _ _ #
1903 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1904 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1905 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1906 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1907 #------------------------------------------------------------------------#
1909 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1910 # are swapped, we work this around in the emitter...
1913 state => "exc_pinned",
1914 rd_constructor => "NONE",
1916 emit => '. fadd%XM %x87_binop',
1917 attr_type => "ia32_x87_attr_t",
1921 state => "exc_pinned",
1922 rd_constructor => "NONE",
1924 emit => '. faddp%XM %x87_binop',
1925 attr_type => "ia32_x87_attr_t",
1929 state => "exc_pinned",
1930 rd_constructor => "NONE",
1932 emit => '. fmul%XM %x87_binop',
1933 attr_type => "ia32_x87_attr_t",
1937 state => "exc_pinned",
1938 rd_constructor => "NONE",
1940 emit => '. fmulp%XM %x87_binop',,
1941 attr_type => "ia32_x87_attr_t",
1945 state => "exc_pinned",
1946 rd_constructor => "NONE",
1948 emit => '. fsub%XM %x87_binop',
1949 attr_type => "ia32_x87_attr_t",
1953 state => "exc_pinned",
1954 rd_constructor => "NONE",
1956 # see note about gas bugs
1957 emit => '. fsubrp%XM %x87_binop',
1958 attr_type => "ia32_x87_attr_t",
1962 state => "exc_pinned",
1963 rd_constructor => "NONE",
1966 emit => '. fsubr%XM %x87_binop',
1967 attr_type => "ia32_x87_attr_t",
1971 state => "exc_pinned",
1972 rd_constructor => "NONE",
1975 # see note about gas bugs
1976 emit => '. fsubp%XM %x87_binop',
1977 attr_type => "ia32_x87_attr_t",
1981 rd_constructor => "NONE",
1984 attr_type => "ia32_x87_attr_t",
1987 # this node is just here, to keep the simulator running
1988 # we can omit this when a fprem simulation function exists
1990 rd_constructor => "NONE",
1993 attr_type => "ia32_x87_attr_t",
1997 state => "exc_pinned",
1998 rd_constructor => "NONE",
2000 emit => '. fdiv%XM %x87_binop',
2001 attr_type => "ia32_x87_attr_t",
2005 state => "exc_pinned",
2006 rd_constructor => "NONE",
2008 # see note about gas bugs
2009 emit => '. fdivrp%XM %x87_binop',
2010 attr_type => "ia32_x87_attr_t",
2014 state => "exc_pinned",
2015 rd_constructor => "NONE",
2017 emit => '. fdivr%XM %x87_binop',
2018 attr_type => "ia32_x87_attr_t",
2022 state => "exc_pinned",
2023 rd_constructor => "NONE",
2025 # see note about gas bugs
2026 emit => '. fdivp%XM %x87_binop',
2027 attr_type => "ia32_x87_attr_t",
2031 rd_constructor => "NONE",
2034 attr_type => "ia32_x87_attr_t",
2039 rd_constructor => "NONE",
2042 attr_type => "ia32_x87_attr_t",
2045 # x87 Load and Store
2048 rd_constructor => "NONE",
2049 op_flags => "R|L|F",
2050 state => "exc_pinned",
2052 emit => '. fld%XM %AM',
2053 attr_type => "ia32_x87_attr_t",
2057 rd_constructor => "NONE",
2058 op_flags => "R|L|F",
2059 state => "exc_pinned",
2061 emit => '. fst%XM %AM',
2063 attr_type => "ia32_x87_attr_t",
2067 rd_constructor => "NONE",
2068 op_flags => "R|L|F",
2069 state => "exc_pinned",
2071 emit => '. fstp%XM %AM',
2073 attr_type => "ia32_x87_attr_t",
2079 state => "exc_pinned",
2080 rd_constructor => "NONE",
2082 emit => '. fild%M %AM',
2083 attr_type => "ia32_x87_attr_t",
2087 state => "exc_pinned",
2088 rd_constructor => "NONE",
2090 emit => '. fist%M %AM',
2092 attr_type => "ia32_x87_attr_t",
2096 state => "exc_pinned",
2097 rd_constructor => "NONE",
2099 emit => '. fistp%M %AM',
2101 attr_type => "ia32_x87_attr_t",
2107 op_flags => "R|c|K",
2109 reg_req => { out => [ "vfp" ] },
2111 attr_type => "ia32_x87_attr_t",
2115 op_flags => "R|c|K",
2117 reg_req => { out => [ "vfp" ] },
2119 attr_type => "ia32_x87_attr_t",
2123 op_flags => "R|c|K",
2125 reg_req => { out => [ "vfp" ] },
2127 attr_type => "ia32_x87_attr_t",
2131 op_flags => "R|c|K",
2133 reg_req => { out => [ "vfp" ] },
2135 attr_type => "ia32_x87_attr_t",
2139 op_flags => "R|c|K",
2141 reg_req => { out => [ "vfp" ] },
2143 attr_type => "ia32_x87_attr_t",
2147 op_flags => "R|c|K",
2149 reg_req => { out => [ "vfp" ] },
2150 emit => '. fldll2t',
2151 attr_type => "ia32_x87_attr_t",
2155 op_flags => "R|c|K",
2157 reg_req => { out => [ "vfp" ] },
2159 attr_type => "ia32_x87_attr_t",
2163 # Note that it is NEVER allowed to do CSE on these nodes
2164 # Moreover, note the virtual register requierements!
2169 cmp_attr => "return 1;",
2170 emit => '. fxch %X0',
2171 attr_type => "ia32_x87_attr_t",
2178 cmp_attr => "return 1;",
2179 emit => '. fld %X0',
2180 attr_type => "ia32_x87_attr_t",
2185 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2186 cmp_attr => "return 1;",
2187 emit => '. fld %X0',
2188 attr_type => "ia32_x87_attr_t",
2194 cmp_attr => "return 1;",
2195 emit => '. fstp %X0',
2196 attr_type => "ia32_x87_attr_t",
2203 cmp_attr => "return 1;",
2204 emit => '. ffreep %X0',
2205 attr_type => "ia32_x87_attr_t",
2212 cmp_attr => "return 1;",
2214 attr_type => "ia32_x87_attr_t",
2221 cmp_attr => "return 1;",
2223 attr_type => "ia32_x87_attr_t",
2231 emit => ". fucom %X1\n".
2233 attr_type => "ia32_x87_attr_t",
2238 emit => ". fucomp %X1\n".
2240 attr_type => "ia32_x87_attr_t",
2245 emit => ". fucompp\n".
2247 attr_type => "ia32_x87_attr_t",
2252 emit => '. fucomi %X1',
2253 attr_type => "ia32_x87_attr_t",
2258 emit => '. fucompi %X1',
2259 attr_type => "ia32_x87_attr_t",
2266 attr_type => "ia32_x87_attr_t",
2270 # -------------------------------------------------------------------------------- #
2271 # ____ ____ _____ _ _ #
2272 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2273 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2274 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2275 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2277 # -------------------------------------------------------------------------------- #
2280 # Spilling and reloading of SSE registers, hardcoded, not generated #
2284 state => "exc_pinned",
2285 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2286 emit => '. movdqu %D0, %AM',
2287 outs => [ "res", "M" ],
2293 state => "exc_pinned",
2294 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2295 ins => [ "base", "index", "mem", "val" ],
2296 emit => '. movdqu %binop',
2303 # Include the generated SIMD node specification written by the SIMD optimization
2304 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2305 unless ($return = do $my_script_name) {
2306 warn "couldn't parse $my_script_name: $@" if $@;
2307 warn "couldn't do $my_script_name: $!" unless defined $return;
2308 warn "couldn't run $my_script_name" unless $return;