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" ] },
1055 emit => '. jmp *%S0',
1056 units => [ "BRANCH" ],
1063 reg_req => { out => [ "gp" ] },
1065 attr => "ir_entity *symconst, int symconst_sign, long offset",
1066 attr_type => "ia32_immediate_attr_t",
1068 # depends on the const and is set in ia32_transform
1069 # modified_flags => $status_flags
1076 reg_req => { out => [ "gp_UKNWN" ] },
1086 reg_req => { out => [ "vfp_UKNWN" ] },
1090 attr_type => "ia32_x87_attr_t",
1097 reg_req => { out => [ "xmm_UKNWN" ] },
1107 reg_req => { out => [ "gp_NOREG" ] },
1117 reg_req => { out => [ "vfp_NOREG" ] },
1121 attr_type => "ia32_x87_attr_t",
1128 reg_req => { out => [ "xmm_NOREG" ] },
1138 reg_req => { out => [ "fp_cw" ] },
1142 modified_flags => $fpcw_flags
1148 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1149 ins => [ "base", "index", "mem" ],
1151 emit => ". fldcw %AM",
1154 modified_flags => $fpcw_flags
1160 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1161 ins => [ "base", "index", "mem", "fpcw" ],
1163 emit => ". fnstcw %AM",
1169 # we should not rematrialize this node. It has very strict constraints.
1170 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1171 ins => [ "val", "globbered" ],
1179 # Note that we add additional latency values depending on address mode, so a
1180 # lateny of 0 for load is correct
1184 state => "exc_pinned",
1185 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1186 ins => [ "base", "index", "mem" ],
1187 outs => [ "res", "M" ],
1189 emit => ". mov%SE%ME%.l %AM, %D0",
1195 cmp_attr => "return 1;",
1196 outs => [ "res", "M" ],
1202 cmp_attr => "return 1;",
1203 state => "exc_pinned",
1210 state => "exc_pinned",
1211 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1212 ins => [ "base", "index", "mem", "val" ],
1213 emit => '. mov%M %SI3, %AM',
1221 state => "exc_pinned",
1222 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1223 ins => [ "base", "index", "mem", "val" ],
1224 emit => '. mov%M %SB3, %AM',
1232 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1233 ins => [ "base", "index" ],
1234 emit => '. leal %AM, %D0',
1238 # well this isn't true for Lea, but we often transform Lea back to Add, Inc
1239 # or Dec, so we set the flag
1240 modified_flags => 1,
1244 state => "exc_pinned",
1245 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "esp", "none" ] },
1246 ins => [ "base", "index", "mem", "val", "stack" ],
1247 emit => '. push%M %unop4',
1248 outs => [ "stack:I|S", "M" ],
1249 am => "source,binary",
1255 state => "exc_pinned",
1256 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1257 emit => '. pop%M %DAM1',
1258 outs => [ "stack:I|S", "res", "M" ],
1259 ins => [ "base", "index", "mem", "stack" ],
1261 latency => 3, # Pop is more expensive than Push on Athlon
1266 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1268 outs => [ "frame:I", "stack:I|S", "M" ],
1274 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1276 outs => [ "frame:I", "stack:I|S" ],
1284 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1285 ins => [ "base", "index", "mem", "stack", "size" ],
1286 am => "source,binary",
1287 emit => '. addl %binop',
1288 outs => [ "stack:S", "M" ],
1290 modified_flags => $status_flags
1296 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1297 ins => [ "base", "index", "mem", "stack", "size" ],
1298 am => "source,binary",
1299 emit => ". subl %binop\n".
1300 ". movl %%esp, %D1",
1301 outs => [ "stack:I|S", "addr", "M" ],
1303 modified_flags => $status_flags
1308 reg_req => { out => [ "gp" ] },
1313 #-----------------------------------------------------------------------------#
1314 # _____ _____ ______ __ _ _ _ #
1315 # / ____/ ____| ____| / _| | | | | | #
1316 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1317 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1318 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1319 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1320 #-----------------------------------------------------------------------------#
1324 reg_req => { out => [ "xmm" ] },
1325 emit => '. xorp%XSD %D0, %D0',
1331 # commutative operations
1335 state => "exc_pinned",
1336 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1337 ins => [ "base", "index", "mem", "left", "right" ],
1338 am => "source,binary",
1339 emit => '. add%XXM %binop',
1347 state => "exc_pinned",
1348 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1349 ins => [ "base", "index", "mem", "left", "right" ],
1350 am => "source,binary",
1351 emit => '. mul%XXM %binop',
1359 state => "exc_pinned",
1360 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1361 ins => [ "base", "index", "mem", "left", "right" ],
1362 am => "source,binary",
1363 emit => '. max%XXM %binop',
1371 state => "exc_pinned",
1372 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1373 ins => [ "base", "index", "mem", "left", "right" ],
1374 am => "source,binary",
1375 emit => '. min%XXM %binop',
1383 state => "exc_pinned",
1384 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1385 ins => [ "base", "index", "mem", "left", "right" ],
1386 am => "source,binary",
1387 emit => '. andp%XSD %binop',
1395 state => "exc_pinned",
1396 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1397 ins => [ "base", "index", "mem", "left", "right" ],
1398 am => "source,binary",
1399 emit => '. orp%XSD %binop',
1406 state => "exc_pinned",
1407 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1408 ins => [ "base", "index", "mem", "left", "right" ],
1409 am => "source,binary",
1410 emit => '. xorp%XSD %binop',
1416 # not commutative operations
1420 state => "exc_pinned",
1421 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1422 ins => [ "base", "index", "mem", "left", "right" ],
1423 am => "source,binary",
1424 emit => '. andnp%XSD %binop',
1432 state => "exc_pinned",
1433 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1434 ins => [ "base", "index", "mem", "left", "right" ],
1435 am => "source,binary",
1436 emit => '. sub%XXM %binop',
1444 state => "exc_pinned",
1445 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1446 ins => [ "base", "index", "mem", "left", "right" ],
1447 am => "source,binary",
1448 outs => [ "res", "M" ],
1449 emit => '. div%XXM %binop',
1458 state => "exc_pinned",
1459 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1460 ins => [ "base", "index", "mem", "left", "right" ],
1461 outs => [ "flags" ],
1462 am => "source,binary",
1463 attr => "int ins_permuted",
1464 init_attr => "attr->data.ins_permuted = ins_permuted;",
1465 emit => ' .ucomi%XXM %binop',
1468 mode => $mode_flags,
1469 modified_flags => 1,
1476 state => "exc_pinned",
1477 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1478 ins => [ "base", "index", "mem" ],
1479 emit => '. mov%XXM %AM, %D0',
1480 attr => "ir_mode *load_mode",
1481 init_attr => "attr->ls_mode = load_mode;",
1482 outs => [ "res", "M" ],
1489 state => "exc_pinned",
1490 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1491 ins => [ "base", "index", "mem", "val" ],
1492 emit => '. mov%XXM %S3, %AM',
1500 state => "exc_pinned",
1501 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1502 ins => [ "base", "index", "mem", "val" ],
1503 emit => '. mov%XXM %S3, %AM',
1511 state => "exc_pinned",
1512 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1513 ins => [ "base", "index", "mem", "val" ],
1514 am => "source,unary",
1515 emit => '. cvtsi2ss %unop3, %D0',
1523 state => "exc_pinned",
1524 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1525 ins => [ "base", "index", "mem", "val" ],
1526 am => "source,unary",
1527 emit => '. cvtsi2sd %unop3, %D0',
1536 cmp_attr => "return 1;",
1542 cmp_attr => "return 1;",
1551 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1552 outs => [ "DST", "SRC", "CNT", "M" ],
1554 # we don't care about this flag, so no need to mark this node
1555 # modified_flags => [ "DF" ]
1561 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1562 outs => [ "DST", "SRC", "M" ],
1564 # we don't care about this flag, so no need to mark this node
1565 # modified_flags => [ "DF" ]
1571 state => "exc_pinned",
1572 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1573 ins => [ "base", "index", "mem", "val" ],
1574 am => "source,unary",
1576 attr => "ir_mode *smaller_mode",
1577 init_attr => "attr->ls_mode = smaller_mode;",
1582 state => "exc_pinned",
1583 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1584 ins => [ "base", "index", "mem", "val" ],
1585 am => "source,unary",
1587 attr => "ir_mode *smaller_mode",
1588 init_attr => "attr->ls_mode = smaller_mode;",
1593 state => "exc_pinned",
1594 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
1595 ins => [ "base", "index", "mem", "val" ],
1596 am => "source,unary",
1603 state => "exc_pinned",
1604 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1605 ins => [ "base", "index", "mem", "val" ],
1606 am => "source,unary",
1613 state => "exc_pinned",
1614 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1615 ins => [ "base", "index", "mem", "val" ],
1616 am => "source,unary",
1622 #----------------------------------------------------------#
1624 # (_) | | | | / _| | | | #
1625 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1626 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1627 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1628 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1630 # _ __ ___ __| | ___ ___ #
1631 # | '_ \ / _ \ / _` |/ _ \/ __| #
1632 # | | | | (_) | (_| | __/\__ \ #
1633 # |_| |_|\___/ \__,_|\___||___/ #
1634 #----------------------------------------------------------#
1636 # spilling disabled for all float nodes for now, because the fpcw handler
1637 # runs before spilling and we might end up with wrong fpcw then
1641 state => "exc_pinned",
1642 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1643 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1644 am => "source,binary",
1648 attr_type => "ia32_x87_attr_t",
1653 state => "exc_pinned",
1654 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1655 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1656 am => "source,binary",
1660 attr_type => "ia32_x87_attr_t",
1665 state => "exc_pinned",
1666 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1667 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1668 am => "source,binary",
1672 attr_type => "ia32_x87_attr_t",
1676 state => "exc_pinned",
1677 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1678 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1679 am => "source,binary",
1680 outs => [ "res", "M" ],
1683 attr_type => "ia32_x87_attr_t",
1687 reg_req => { in => [ "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1688 ins => [ "left", "right", "fpcw" ],
1692 attr_type => "ia32_x87_attr_t",
1697 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1702 attr_type => "ia32_x87_attr_t",
1707 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1712 attr_type => "ia32_x87_attr_t",
1715 # virtual Load and Store
1719 state => "exc_pinned",
1720 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1721 ins => [ "base", "index", "mem" ],
1722 outs => [ "res", "M" ],
1723 attr => "ir_mode *load_mode",
1724 init_attr => "attr->attr.ls_mode = load_mode;",
1727 attr_type => "ia32_x87_attr_t",
1732 state => "exc_pinned",
1733 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1734 ins => [ "base", "index", "mem", "val" ],
1735 attr => "ir_mode *store_mode",
1736 init_attr => "attr->attr.ls_mode = store_mode;",
1740 attr_type => "ia32_x87_attr_t",
1746 state => "exc_pinned",
1747 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1748 outs => [ "res", "M" ],
1749 ins => [ "base", "index", "mem" ],
1752 attr_type => "ia32_x87_attr_t",
1756 cmp_attr => "return 1;",
1757 outs => [ "res", "M" ],
1762 state => "exc_pinned",
1763 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1764 ins => [ "base", "index", "mem", "val", "fpcw" ],
1768 attr_type => "ia32_x87_attr_t",
1772 cmp_attr => "return 1;",
1773 state => "exc_pinned",
1783 reg_req => { out => [ "vfp" ] },
1787 attr_type => "ia32_x87_attr_t",
1792 reg_req => { out => [ "vfp" ] },
1796 attr_type => "ia32_x87_attr_t",
1801 reg_req => { out => [ "vfp" ] },
1805 attr_type => "ia32_x87_attr_t",
1810 reg_req => { out => [ "vfp" ] },
1814 attr_type => "ia32_x87_attr_t",
1819 reg_req => { out => [ "vfp" ] },
1823 attr_type => "ia32_x87_attr_t",
1828 reg_req => { out => [ "vfp" ] },
1832 attr_type => "ia32_x87_attr_t",
1837 reg_req => { out => [ "vfp" ] },
1841 attr_type => "ia32_x87_attr_t",
1847 # we can't allow to rematerialize this node so we don't have
1848 # accidently produce Phi(Fucom, Fucom(ins_permuted))
1850 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1851 ins => [ "left", "right" ],
1852 outs => [ "flags" ],
1853 attr => "int ins_permuted",
1854 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1857 attr_type => "ia32_x87_attr_t",
1863 reg_req => { in => [ "vfp", "vfp" ], out => [ "eflags" ] },
1864 ins => [ "left", "right" ],
1865 outs => [ "flags" ],
1866 attr => "int ins_permuted",
1867 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1870 attr_type => "ia32_x87_attr_t",
1876 reg_req => { in => [ "vfp" ], out => [ "eax" ] },
1878 outs => [ "flags" ],
1879 attr => "int ins_permuted",
1880 init_attr => "attr->attr.data.ins_permuted = ins_permuted;",
1883 attr_type => "ia32_x87_attr_t",
1889 reg_req => { in => [ "eax" ], out => [ "eflags" ] },
1891 outs => [ "flags" ],
1894 mode => $mode_flags,
1897 #------------------------------------------------------------------------#
1898 # ___ _____ __ _ _ _ #
1899 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1900 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1901 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1902 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1903 #------------------------------------------------------------------------#
1905 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1906 # are swapped, we work this around in the emitter...
1910 state => "exc_pinned",
1911 rd_constructor => "NONE",
1913 emit => '. fadd%XM %x87_binop',
1914 attr_type => "ia32_x87_attr_t",
1919 state => "exc_pinned",
1920 rd_constructor => "NONE",
1922 emit => '. faddp%XM %x87_binop',
1923 attr_type => "ia32_x87_attr_t",
1928 state => "exc_pinned",
1929 rd_constructor => "NONE",
1931 emit => '. fmul%XM %x87_binop',
1932 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",
1946 state => "exc_pinned",
1947 rd_constructor => "NONE",
1949 emit => '. fsub%XM %x87_binop',
1950 attr_type => "ia32_x87_attr_t",
1955 state => "exc_pinned",
1956 rd_constructor => "NONE",
1958 # see note about gas bugs
1959 emit => '. fsubrp%XM %x87_binop',
1960 attr_type => "ia32_x87_attr_t",
1965 state => "exc_pinned",
1966 rd_constructor => "NONE",
1969 emit => '. fsubr%XM %x87_binop',
1970 attr_type => "ia32_x87_attr_t",
1975 state => "exc_pinned",
1976 rd_constructor => "NONE",
1979 # see note about gas bugs
1980 emit => '. fsubp%XM %x87_binop',
1981 attr_type => "ia32_x87_attr_t",
1986 rd_constructor => "NONE",
1989 attr_type => "ia32_x87_attr_t",
1992 # this node is just here, to keep the simulator running
1993 # we can omit this when a fprem simulation function exists
1996 rd_constructor => "NONE",
1999 attr_type => "ia32_x87_attr_t",
2004 state => "exc_pinned",
2005 rd_constructor => "NONE",
2007 emit => '. fdiv%XM %x87_binop',
2008 attr_type => "ia32_x87_attr_t",
2013 state => "exc_pinned",
2014 rd_constructor => "NONE",
2016 # see note about gas bugs
2017 emit => '. fdivrp%XM %x87_binop',
2018 attr_type => "ia32_x87_attr_t",
2023 state => "exc_pinned",
2024 rd_constructor => "NONE",
2026 emit => '. fdivr%XM %x87_binop',
2027 attr_type => "ia32_x87_attr_t",
2032 state => "exc_pinned",
2033 rd_constructor => "NONE",
2035 # see note about gas bugs
2036 emit => '. fdivp%XM %x87_binop',
2037 attr_type => "ia32_x87_attr_t",
2042 rd_constructor => "NONE",
2045 attr_type => "ia32_x87_attr_t",
2050 rd_constructor => "NONE",
2053 attr_type => "ia32_x87_attr_t",
2056 # x87 Load and Store
2059 rd_constructor => "NONE",
2060 op_flags => "R|L|F",
2061 state => "exc_pinned",
2063 emit => '. fld%XM %AM',
2064 attr_type => "ia32_x87_attr_t",
2068 rd_constructor => "NONE",
2069 op_flags => "R|L|F",
2070 state => "exc_pinned",
2072 emit => '. fst%XM %AM',
2074 attr_type => "ia32_x87_attr_t",
2078 rd_constructor => "NONE",
2079 op_flags => "R|L|F",
2080 state => "exc_pinned",
2082 emit => '. fstp%XM %AM',
2084 attr_type => "ia32_x87_attr_t",
2091 state => "exc_pinned",
2092 rd_constructor => "NONE",
2094 emit => '. fild%M %AM',
2095 attr_type => "ia32_x87_attr_t",
2100 state => "exc_pinned",
2101 rd_constructor => "NONE",
2103 emit => '. fist%M %AM',
2105 attr_type => "ia32_x87_attr_t",
2110 state => "exc_pinned",
2111 rd_constructor => "NONE",
2113 emit => '. fistp%M %AM',
2115 attr_type => "ia32_x87_attr_t",
2121 op_flags => "R|c|K",
2123 reg_req => { out => [ "vfp" ] },
2125 attr_type => "ia32_x87_attr_t",
2129 op_flags => "R|c|K",
2131 reg_req => { out => [ "vfp" ] },
2133 attr_type => "ia32_x87_attr_t",
2137 op_flags => "R|c|K",
2139 reg_req => { out => [ "vfp" ] },
2141 attr_type => "ia32_x87_attr_t",
2145 op_flags => "R|c|K",
2147 reg_req => { out => [ "vfp" ] },
2149 attr_type => "ia32_x87_attr_t",
2153 op_flags => "R|c|K",
2155 reg_req => { out => [ "vfp" ] },
2157 attr_type => "ia32_x87_attr_t",
2161 op_flags => "R|c|K",
2163 reg_req => { out => [ "vfp" ] },
2164 emit => '. fldll2t',
2165 attr_type => "ia32_x87_attr_t",
2169 op_flags => "R|c|K",
2171 reg_req => { out => [ "vfp" ] },
2173 attr_type => "ia32_x87_attr_t",
2177 # Note that it is NEVER allowed to do CSE on these nodes
2178 # Moreover, note the virtual register requierements!
2183 cmp_attr => "return 1;",
2184 emit => '. fxch %X0',
2185 attr_type => "ia32_x87_attr_t",
2192 cmp_attr => "return 1;",
2193 emit => '. fld %X0',
2194 attr_type => "ia32_x87_attr_t",
2200 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2201 cmp_attr => "return 1;",
2202 emit => '. fld %X0',
2203 attr_type => "ia32_x87_attr_t",
2209 cmp_attr => "return 1;",
2210 emit => '. fstp %X0',
2211 attr_type => "ia32_x87_attr_t",
2218 cmp_attr => "return 1;",
2219 emit => '. ffreep %X0',
2220 attr_type => "ia32_x87_attr_t",
2227 cmp_attr => "return 1;",
2229 attr_type => "ia32_x87_attr_t",
2236 cmp_attr => "return 1;",
2238 attr_type => "ia32_x87_attr_t",
2246 emit => ". fucom %X1\n".
2248 attr_type => "ia32_x87_attr_t",
2253 emit => ". fucomp %X1\n".
2255 attr_type => "ia32_x87_attr_t",
2260 emit => ". fucompp\n".
2262 attr_type => "ia32_x87_attr_t",
2267 emit => '. fucomi %X1',
2268 attr_type => "ia32_x87_attr_t",
2273 emit => '. fucompi %X1',
2274 attr_type => "ia32_x87_attr_t",
2281 attr_type => "ia32_x87_attr_t",
2285 # -------------------------------------------------------------------------------- #
2286 # ____ ____ _____ _ _ #
2287 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2288 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2289 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2290 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2292 # -------------------------------------------------------------------------------- #
2295 # Spilling and reloading of SSE registers, hardcoded, not generated #
2299 state => "exc_pinned",
2300 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2301 emit => '. movdqu %D0, %AM',
2302 outs => [ "res", "M" ],
2308 state => "exc_pinned",
2309 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2310 ins => [ "base", "index", "mem", "val" ],
2311 emit => '. movdqu %binop',
2318 # Include the generated SIMD node specification written by the SIMD optimization
2319 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2320 unless ($return = do $my_script_name) {
2321 warn "couldn't parse $my_script_name: $@" if $@;
2322 warn "couldn't do $my_script_name: $!" unless defined $return;
2323 warn "couldn't run $my_script_name" unless $return;