3 # This is the specification for the ia32 assembler Firm-operations
10 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
13 # The node description is done as a perl hash initializer with the
14 # following structure:
19 # op_flags => "N|L|C|X|I|F|Y|H|c|K",
20 # irn_flags => "R|N|I|S"
21 # arity => "0|1|2|3 ... |variable|dynamic|any",
22 # state => "floats|pinned|mem_pinned|exc_pinned",
24 # { type => "type 1", name => "name 1" },
25 # { type => "type 2", name => "name 2" },
28 # comment => "any comment for constructor",
29 # reg_req => { in => [ "reg_class|register" ], out => [ "reg_class|register|in_rX" ] },
30 # cmp_attr => "c source code for comparing node attributes",
31 # emit => "emit code with templates",
32 # attr => "attitional attribute arguments for constructor"
33 # init_attr => "emit attribute initialization template"
34 # rd_constructor => "c source code which constructs an ir_node"
35 # latency => "latency of this operation (can be float)"
36 # attr_type => "name of the attribute struct",
39 # ... # (all nodes you need to describe)
41 # ); # close the %nodes initializer
43 # op_flags: flags for the operation, OPTIONAL (default is "N")
44 # the op_flags correspond to the firm irop_flags:
47 # C irop_flag_commutative
48 # X irop_flag_cfopcode
49 # I irop_flag_ip_cfopcode
52 # H irop_flag_highlevel
53 # c irop_flag_constlike
56 # irn_flags: special node flags, OPTIONAL (default is 0)
57 # following irn_flags are supported:
60 # I ignore for register allocation
61 # S modifies stack pointer
63 # state: state of the operation, OPTIONAL (default is "floats")
65 # arity: arity of the operation, MUST NOT BE OMITTED
67 # args: the OPTIONAL arguments of the node constructor (debug, irg and block
68 # are always the first 3 arguments and are always autmatically
70 # If this key is missing the following arguments will be created:
71 # for i = 1 .. arity: ir_node *op_i
74 # outs: if a node defines more than one output, the names of the projections
75 # nodes having outs having automatically the mode mode_T
76 # One can also annotate some flags for each out, additional to irn_flags.
77 # They are separated from name with a colon ':', and concatenated by pipe '|'
78 # Only I and S are available at the moment (same meaning as in irn_flags).
79 # example: [ "frame:I", "stack:I|S", "M" ]
81 # comment: OPTIONAL comment for the node constructor
83 # rd_constructor: for every operation there will be a
84 # new_rd_<arch>_<op-name> function with the arguments from above
85 # which creates the ir_node corresponding to the defined operation
86 # you can either put the complete source code of this function here
88 # This key is OPTIONAL. If omitted, the following constructor will
90 # if (!op_<arch>_<op-name>) assert(0);
94 # res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
97 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
99 # latency: the latency of the operation, default is 1
103 # 0 - no special type
104 # 1 - caller save (register must be saved by the caller of a function)
105 # 2 - callee save (register must be saved by the called function)
106 # 4 - ignore (do not assign this register)
107 # 8 - emitter can choose an arbitrary register of this class
108 # 16 - the register is a virtual one
109 # 32 - register represents a state
110 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
113 { name => "edx", type => 1 },
114 { name => "ecx", type => 1 },
115 { name => "eax", type => 1 },
116 { name => "ebx", type => 2 },
117 { name => "esi", type => 2 },
118 { name => "edi", type => 2 },
119 { name => "ebp", type => 2 },
120 { name => "esp", type => 4 },
121 { name => "gp_NOREG", type => 4 | 8 | 16 }, # we need a dummy register for NoReg nodes
122 { name => "gp_UKNWN", type => 4 | 8 | 16 }, # we need a dummy register for Unknown nodes
123 { mode => "mode_Iu" }
126 { name => "mm0", type => 4 },
127 { name => "mm1", type => 4 },
128 { name => "mm2", type => 4 },
129 { name => "mm3", type => 4 },
130 { name => "mm4", type => 4 },
131 { name => "mm5", type => 4 },
132 { name => "mm6", type => 4 },
133 { name => "mm7", type => 4 },
134 { mode => "mode_E", flags => "manual_ra" }
137 { name => "xmm0", type => 1 },
138 { name => "xmm1", type => 1 },
139 { name => "xmm2", type => 1 },
140 { name => "xmm3", type => 1 },
141 { name => "xmm4", type => 1 },
142 { name => "xmm5", type => 1 },
143 { name => "xmm6", type => 1 },
144 { name => "xmm7", type => 1 },
145 { name => "xmm_NOREG", type => 4 | 16 }, # we need a dummy register for NoReg nodes
146 { name => "xmm_UKNWN", type => 4 | 8 | 16}, # we need a dummy register for Unknown nodes
150 { name => "vf0", type => 1 | 16 },
151 { name => "vf1", type => 1 | 16 },
152 { name => "vf2", type => 1 | 16 },
153 { name => "vf3", type => 1 | 16 },
154 { name => "vf4", type => 1 | 16 },
155 { name => "vf5", type => 1 | 16 },
156 { name => "vf6", type => 1 | 16 },
157 { name => "vf7", type => 1 | 16 },
158 { name => "vfp_NOREG", type => 4 | 8 | 16 }, # we need a dummy register for NoReg nodes
159 { name => "vfp_UKNWN", type => 4 | 8 | 16 }, # we need a dummy register for Unknown nodes
163 { name => "st0", realname => "st", type => 4 },
164 { name => "st1", realname => "st(1)", type => 4 },
165 { name => "st2", realname => "st(2)", type => 4 },
166 { name => "st3", realname => "st(3)", type => 4 },
167 { name => "st4", realname => "st(4)", type => 4 },
168 { name => "st5", realname => "st(5)", type => 4 },
169 { name => "st6", realname => "st(6)", type => 4 },
170 { name => "st7", realname => "st(7)", type => 4 },
171 { mode => "mode_E", flags => "manual_ra" }
173 fp_cw => [ # the floating point control word
174 { name => "fpcw", type => 4|32 },
175 { mode => "mode_fpcw", flags => "manual_ra|state" }
178 { name => "eflags", type => 0 },
179 { mode => "mode_Iu", flags => "manual_ra" }
184 GP => [ 1, "GP_EAX", "GP_EBX", "GP_ECX", "GP_EDX", "GP_ESI", "GP_EDI", "GP_EBP" ],
185 SSE => [ 1, "SSE_XMM0", "SSE_XMM1", "SSE_XMM2", "SSE_XMM3", "SSE_XMM4", "SSE_XMM5", "SSE_XMM6", "SSE_XMM7" ],
186 VFP => [ 1, "VFP_VF0", "VFP_VF1", "VFP_VF2", "VFP_VF3", "VFP_VF4", "VFP_VF5", "VFP_VF6", "VFP_VF7" ],
187 BRANCH => [ 1, "BRANCH1", "BRANCH2" ],
192 bundels_per_cycle => 1
196 S0 => "${arch}_emit_source_register(node, 0);",
197 S1 => "${arch}_emit_source_register(node, 1);",
198 S2 => "${arch}_emit_source_register(node, 2);",
199 S3 => "${arch}_emit_source_register(node, 3);",
200 SB1 => "${arch}_emit_8bit_source_register_or_immediate(node, 1);",
201 SB2 => "${arch}_emit_8bit_source_register_or_immediate(node, 2);",
202 SB3 => "${arch}_emit_8bit_source_register_or_immediate(node, 3);",
203 SI0 => "${arch}_emit_source_register_or_immediate(node, 0);",
204 SI1 => "${arch}_emit_source_register_or_immediate(node, 1);",
205 SI2 => "${arch}_emit_source_register_or_immediate(node, 2);",
206 SI3 => "${arch}_emit_source_register_or_immediate(node, 3);",
207 D0 => "${arch}_emit_dest_register(node, 0);",
208 D1 => "${arch}_emit_dest_register(node, 1);",
209 DB0 => "${arch}_emit_8bit_dest_register(node, 0);",
210 X0 => "${arch}_emit_x87_register(node, 0);",
211 X1 => "${arch}_emit_x87_register(node, 1);",
212 X2 => "${arch}_emit_x87_register(node, 2);",
213 SE => "${arch}_emit_extend_suffix(get_ia32_ls_mode(node));",
214 ME => "if(get_mode_size_bits(get_ia32_ls_mode(node)) != 32)\n
215 ia32_emit_mode_suffix(node);",
216 M => "${arch}_emit_mode_suffix(node);",
217 XM => "${arch}_emit_x87_mode_suffix(node);",
218 XXM => "${arch}_emit_xmm_mode_suffix(node);",
219 XSD => "${arch}_emit_xmm_mode_suffix_s(node);",
220 AM => "${arch}_emit_am(node);",
221 unop3 => "${arch}_emit_unop(node, 3);",
222 unop4 => "${arch}_emit_unop(node, 4);",
223 unop5 => "${arch}_emit_unop(node, 5);",
224 DAM1 => "${arch}_emit_am_or_dest_register(node, 1);",
225 binop => "${arch}_emit_binop(node);",
226 x87_binop => "${arch}_emit_x87_binop(node);",
227 CMP0 => "${arch}_emit_cmp_suffix_node(node, 0);",
230 #--------------------------------------------------#
233 # _ __ _____ __ _ _ __ ___ _ __ ___ #
234 # | '_ \ / _ \ \ /\ / / | | '__| / _ \| '_ \/ __| #
235 # | | | | __/\ V V / | | | | (_) | |_) \__ \ #
236 # |_| |_|\___| \_/\_/ |_|_| \___/| .__/|___/ #
239 #--------------------------------------------------#
241 $default_attr_type = "ia32_attr_t";
242 $default_copy_attr = "ia32_copy_attr";
244 sub ia32_custom_init_attr {
248 if(defined($node->{modified_flags})) {
249 $res .= "\tset_ia32_flags(res, get_ia32_flags(res) | arch_irn_flags_modify_flags);\n";
251 if(defined($node->{am})) {
252 my $am = $node->{am};
253 if($am eq "full,binary") {
254 $res .= "\tset_ia32_am_support(res, ia32_am_Full, ia32_am_binary);";
255 } elsif($am eq "full,unary") {
256 $res .= "\tset_ia32_am_support(res, ia32_am_Full, ia32_am_unary);";
257 } elsif($am eq "source,binary") {
258 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_binary);";
259 } elsif($am eq "dest,unary") {
260 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_unary);";
261 } elsif($am eq "dest,binary") {
262 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_binary);";
263 } elsif($am eq "dest,ternary") {
264 $res .= "\tset_ia32_am_support(res, ia32_am_Dest, ia32_am_ternary);";
265 } elsif($am eq "source,ternary") {
266 $res .= "\tset_ia32_am_support(res, ia32_am_Source, ia32_am_ternary);";
267 } elsif($am eq "none") {
270 die("Invalid address mode '$am' specified on op $name");
275 $custom_init_attr_func = \&ia32_custom_init_attr;
278 ia32_attr_t => "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);",
280 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
281 "\tinit_ia32_x87_attributes(res);",
283 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
284 "\tinit_ia32_x87_attributes(res);".
285 "\tinit_ia32_asm_attributes(res);",
286 ia32_immediate_attr_t =>
287 "\tinit_ia32_attributes(res, flags, in_reqs, out_reqs, exec_units, n_res, latency);\n".
288 "\tinit_ia32_immediate_attributes(res, symconst, symconst_sign, offset);"
292 ia32_attr_t => "ia32_compare_nodes_attr",
293 ia32_x87_attr_t => "ia32_compare_x87_attr",
294 ia32_asm_attr_t => "ia32_compare_asm_attr",
295 ia32_immediate_attr_t => "ia32_compare_immediate_attr",
301 $mode_xmm = "mode_E";
302 $mode_gp = "mode_Iu";
303 $mode_flags = "mode_Iu";
304 $mode_fpcw = "mode_fpcw";
305 $status_flags = [ "CF", "PF", "AF", "ZF", "SF", "OF" ];
306 $fpcw_flags = [ "FP_IM", "FP_DM", "FP_ZM", "FP_OM", "FP_UM", "FP_PM",
307 "FP_PC0", "FP_PC1", "FP_RC0", "FP_RC1", "FP_X" ];
315 reg_req => { out => [ "gp_NOREG" ] },
316 attr => "ir_entity *symconst, int symconst_sign, long offset",
317 attr_type => "ia32_immediate_attr_t",
325 out_arity => "variable",
326 attr_type => "ia32_asm_attr_t",
333 reg_req => { out => [ "gp" ] },
338 cmp_attr => "return 1;",
341 #-----------------------------------------------------------------#
344 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
345 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
346 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
347 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
350 #-----------------------------------------------------------------#
352 # commutative operations
356 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5", "none", "flags" ] },
357 ins => [ "base", "index", "mem", "left", "right" ],
358 emit => '. add%M %binop',
362 modified_flags => $status_flags
367 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
368 ins => [ "base", "index", "mem", "val" ],
369 emit => ". add%M %SI3, %AM",
372 modified_flags => $status_flags
377 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
378 ins => [ "base", "index", "mem", "val" ],
379 emit => ". add%M %SB3, %AM",
382 modified_flags => $status_flags
386 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 in_r5" ] },
387 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
388 emit => '. adc%M %binop',
392 modified_flags => $status_flags
397 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
398 ins => [ "left", "right" ],
402 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
403 ins => [ "left", "right", "eflags" ],
407 # we should not rematrialize this node. It produces 2 results and has
408 # very strict constrains
409 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
410 ins => [ "base", "index", "mem", "val_high", "val_low" ],
411 emit => '. mul%M %unop4',
412 outs => [ "EAX", "EDX", "M" ],
413 am => "source,binary",
416 modified_flags => $status_flags
420 # we should not rematrialize this node. It produces 2 results and has
421 # very strict constrains
423 cmp_attr => "return 1;",
424 outs => [ "EAX", "EDX", "M" ],
430 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
431 ins => [ "base", "index", "mem", "left", "right" ],
432 emit => '. imul%M %binop',
433 am => "source,binary",
437 modified_flags => $status_flags
442 reg_req => { in => [ "gp", "gp", "none", "eax", "gp" ], out => [ "eax", "edx", "none" ] },
443 ins => [ "base", "index", "mem", "val_high", "val_low" ],
444 emit => '. imul%M %unop4',
445 outs => [ "EAX", "EDX", "M" ],
446 am => "source,binary",
449 modified_flags => $status_flags
453 # we should not rematrialize this node. It produces 2 results and has
454 # very strict constrains
456 cmp_attr => "return 1;",
457 outs => [ "EAX", "EDX", "M" ],
463 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
464 ins => [ "base", "index", "mem", "left", "right" ],
466 emit => '. and%M %binop',
469 modified_flags => $status_flags
474 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
475 ins => [ "base", "index", "mem", "val" ],
476 emit => '. and%M %SI3, %AM',
479 modified_flags => $status_flags
484 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
485 ins => [ "base", "index", "mem", "val" ],
486 emit => '. and%M %SB3, %AM',
489 modified_flags => $status_flags
494 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
495 ins => [ "base", "index", "mem", "left", "right" ],
497 emit => '. or%M %binop',
500 modified_flags => $status_flags
505 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
506 ins => [ "base", "index", "mem", "val" ],
507 emit => '. or%M %SI3, %AM',
510 modified_flags => $status_flags
515 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
516 ins => [ "base", "index", "mem", "val" ],
517 emit => '. or%M %SB3, %AM',
520 modified_flags => $status_flags
525 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4 in_r5" ] },
526 ins => [ "base", "index", "mem", "left", "right" ],
528 emit => '. xor%M %binop',
531 modified_flags => $status_flags
536 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
537 ins => [ "base", "index", "mem", "val" ],
538 emit => '. xor%M %SI3, %AM',
541 modified_flags => $status_flags
546 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
547 ins => [ "base", "index", "mem", "val" ],
548 emit => '. xor%M %SB3, %AM',
551 modified_flags => $status_flags
554 # not commutative operations
558 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ], out => [ "in_r4", "none", "flags" ] },
559 ins => [ "base", "index", "mem", "left", "right" ],
561 emit => '. sub%M %binop',
564 modified_flags => $status_flags
569 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
570 ins => [ "base", "index", "mem", "val" ],
571 emit => '. sub%M %SI3, %AM',
574 modified_flags => $status_flags
579 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "none" ] },
580 ins => [ "base", "index", "mem", "val" ],
581 emit => '. sub%M %SB3, %AM',
584 modified_flags => $status_flags
588 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "flags" ], out => [ "in_r4 !in_r5" ] },
589 ins => [ "base", "index", "mem", "left", "right", "eflags" ],
591 emit => '. sbb%M %binop',
594 modified_flags => $status_flags
598 reg_req => { in => [ "none", "none" ], out => [ "none" ] },
599 ins => [ "left", "right" ],
603 reg_req => { in => [ "none", "none", "none" ], out => [ "none" ] },
604 ins => [ "left", "right", "eflags" ],
609 state => "exc_pinned",
610 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
611 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
612 outs => [ "div_res", "mod_res", "M" ],
613 attr => "ia32_op_flavour_t dm_flav",
614 am => "source,ternary",
615 init_attr => "attr->data.op_flav = dm_flav;",
616 emit => ". idiv%M %unop5",
619 modified_flags => $status_flags
624 state => "exc_pinned",
625 reg_req => { in => [ "gp", "gp", "none", "eax", "edx", "gp" ], out => [ "eax", "edx", "none" ] },
626 ins => [ "base", "index", "mem", "left_low", "left_high", "right" ],
627 outs => [ "div_res", "mod_res", "M" ],
628 attr => "ia32_op_flavour_t dm_flav",
629 am => "source,ternary",
630 init_attr => "attr->data.op_flav = dm_flav;",
631 emit => ". div%M %unop5",
634 modified_flags => $status_flags
639 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
640 ins => [ "left", "right" ],
642 emit => '. shl %SB1, %S0',
645 modified_flags => $status_flags
650 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
651 ins => [ "base", "index", "mem", "count" ],
652 emit => '. shl%M %SB3, %AM',
655 modified_flags => $status_flags
659 cmp_attr => "return 1;",
660 # value, cnt, dependency
665 # FIXME: WHY? the right requirement is in_r3 !in_r5, especially this is the same as in Shl
667 # Out requirements is: different from all in
668 # This is because, out must be different from LowPart and ShiftCount.
669 # We could say "!ecx !in_r4" but it can occur, that all values live through
670 # this Shift and the only value dying is the ShiftCount. Then there would be a
671 # register missing, as result must not be ecx and all other registers are
672 # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
673 # (and probably never will). So we create artificial interferences of the result
674 # with all inputs, so the spiller can always assure a free register.
675 # reg_req => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
678 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "in_r1 !in_r3" ] },
679 ins => [ "left_high", "left_low", "right" ],
680 am => "dest,ternary",
681 emit => '. shld%M %SB2, %S1, %S0',
685 modified_flags => $status_flags
689 cmp_attr => "return 1;",
695 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
696 ins => [ "val", "count" ],
698 emit => '. shr %SB1, %S0',
701 modified_flags => $status_flags
706 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
707 ins => [ "base", "index", "mem", "count" ],
708 emit => '. shr%M %SB3, %AM',
711 modified_flags => $status_flags
715 cmp_attr => "return 1;",
716 # value, cnt, dependency
721 # FIXME: WHY? the right requirement is in_r3 !in_r5, especially this is the same as in Shr
723 # Out requirements is: different from all in
724 # This is because, out must be different from LowPart and ShiftCount.
725 # We could say "!ecx !in_r4" but it can occur, that all values live through
726 # this Shift and the only value dying is the ShiftCount. Then there would be a
727 # register missing, as result must not be ecx and all other registers are
728 # occupied. What we should write is "!in_r4 !in_r5", but this is not supported
729 # (and probably never will). So we create artificial interferences of the result
730 # with all inputs, so the spiller can always assure a free register.
731 # reg_req => { in => [ "gp", "gp", "gp", "gp", "ecx", "none" ], out => [ "!in" ] },
734 reg_req => { in => [ "gp", "gp", "ecx" ], out => [ "in_r1 !in_r3" ] },
735 ins => [ "left_high", "left_low", "right" ],
736 am => "dest,ternary",
737 emit => '. shrd%M %SB2, %S1, %S0',
741 modified_flags => $status_flags
745 cmp_attr => "return 1;",
751 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
752 ins => [ "val", "count" ],
754 emit => '. sar %SB1, %S0',
757 modified_flags => $status_flags
762 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
763 ins => [ "base", "index", "mem", "count" ],
764 emit => '. sar%M %SB3, %AM',
767 modified_flags => $status_flags
771 cmp_attr => "return 1;",
777 cmp_attr => "return 1;",
778 # value, cnt, dependency
784 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
785 ins => [ "val", "count" ],
787 emit => '. ror %SB1, %S0',
790 modified_flags => $status_flags
795 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
796 ins => [ "base", "index", "mem", "count" ],
797 emit => '. ror%M %SB3, %AM',
800 modified_flags => $status_flags
805 reg_req => { in => [ "gp", "ecx" ], out => [ "in_r1 !in_r2" ] },
806 ins => [ "val", "count" ],
808 emit => '. rol %SB1, %S0',
811 modified_flags => $status_flags
816 reg_req => { in => [ "gp", "gp", "none", "ecx" ], out => [ "none" ] },
817 ins => [ "base", "index", "mem", "count" ],
818 emit => '. rol%M %SB3, %AM',
821 modified_flags => $status_flags
828 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
834 modified_flags => $status_flags
839 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
840 ins => [ "base", "index", "mem" ],
841 emit => '. neg%M %AM',
844 modified_flags => $status_flags
849 reg_req => { in => [ "gp", "gp" ], out => [ "in_r1", "gp" ] },
850 outs => [ "low_res", "high_res" ],
852 modified_flags => $status_flags
857 cmp_attr => "return 1;",
863 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
868 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
873 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
874 ins => [ "base", "index", "mem" ],
875 emit => '. inc%M %AM',
878 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
883 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
888 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
893 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
894 ins => [ "base", "index", "mem" ],
895 emit => '. dec%M %AM',
898 modified_flags => [ "OF", "SF", "ZF", "AF", "PF" ]
903 reg_req => { in => [ "gp" ], out => [ "in_r1" ] },
913 reg_req => { in => [ "gp", "gp", "none" ], out => [ "none" ] },
914 ins => [ "base", "index", "mem" ],
915 emit => '. not%M %AM',
924 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
925 ins => [ "base", "index", "mem", "left", "right" ],
926 outs => [ "eflags" ],
927 am => "source,binary",
928 emit => '. cmp%M %binop',
929 attr => "int flipped, int cmp_unsigned",
930 init_attr => "attr->data.cmp_flipped = flipped;\n".
931 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
935 modified_flags => $status_flags
940 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
941 ins => [ "base", "index", "mem", "left", "right" ],
942 outs => [ "eflags" ],
943 am => "source,binary",
944 emit => '. cmpb %binop',
945 attr => "int flipped, int cmp_unsigned",
946 init_attr => "attr->data.cmp_flipped = flipped;\n".
947 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
951 modified_flags => $status_flags
956 reg_req => { in => [ "gp", "gp", "none", "gp", "gp" ] , out => [ "flags" ] },
957 ins => [ "base", "index", "mem", "left", "right" ],
958 outs => [ "eflags" ],
959 am => "source,binary",
960 emit => '. test%M %binop',
961 attr => "int flipped, int cmp_unsigned",
962 init_attr => "attr->data.cmp_flipped = flipped;\n".
963 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
967 modified_flags => $status_flags
972 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx", "eax ebx ecx edx" ] , out => [ "flags" ] },
973 ins => [ "base", "index", "mem", "left", "right" ],
974 outs => [ "eflags" ],
975 am => "source,binary",
976 emit => '. testb %binop',
977 attr => "int flipped, int cmp_unsigned",
978 init_attr => "attr->data.cmp_flipped = flipped;\n".
979 "\tattr->data.cmp_unsigned = cmp_unsigned;\n",
983 modified_flags => $status_flags
988 reg_req => { in => [ "eflags" ], out => [ "eax ebx ecx edx" ] },
991 attr => "pn_Cmp pnc",
992 init_attr => "attr->pn_code = pnc;\nset_ia32_ls_mode(res, mode_Bu);\n",
993 emit => '. set%CMP0 %DB0',
1001 # (note: leave the false,true order intact to make it compatible with other
1003 reg_req => { in => [ "gp", "gp", "none", "gp", "gp", "eflags" ], out => [ "in_r4" ] },
1004 ins => [ "base", "index", "mem", "val_false", "val_true", "eflags" ],
1005 am => "source,binary",
1006 attr => "pn_Cmp pn_code",
1007 init_attr => "attr->pn_code = pn_code;",
1015 op_flags => "L|X|Y",
1016 reg_req => { in => [ "eflags" ], out => [ "none", "none" ] },
1017 ins => [ "eflags" ],
1018 outs => [ "false", "true" ],
1019 attr => "pn_Cmp pnc",
1020 init_attr => "attr->pn_code = pnc;",
1022 units => [ "BRANCH" ],
1027 op_flags => "L|X|Y",
1028 reg_req => { in => [ "gp" ], out => [ "none" ] },
1030 units => [ "BRANCH" ],
1032 modified_flags => $status_flags
1038 reg_req => { in => [ "gp" ] },
1039 emit => '. jmp *%S0',
1040 units => [ "BRANCH" ],
1047 reg_req => { out => [ "gp" ] },
1049 attr => "ir_entity *symconst, int symconst_sign, long offset",
1050 attr_type => "ia32_immediate_attr_t",
1052 # depends on the const and is set in ia32_transform
1053 # modified_flags => $status_flags
1060 reg_req => { out => [ "gp_UKNWN" ] },
1070 reg_req => { out => [ "vfp_UKNWN" ] },
1074 attr_type => "ia32_x87_attr_t",
1081 reg_req => { out => [ "xmm_UKNWN" ] },
1091 reg_req => { out => [ "gp_NOREG" ] },
1101 reg_req => { out => [ "vfp_NOREG" ] },
1105 attr_type => "ia32_x87_attr_t",
1112 reg_req => { out => [ "xmm_NOREG" ] },
1122 reg_req => { out => [ "fp_cw" ] },
1126 modified_flags => $fpcw_flags
1132 reg_req => { in => [ "gp", "gp", "none" ], out => [ "fp_cw" ] },
1133 ins => [ "base", "index", "mem" ],
1135 emit => ". fldcw %AM",
1138 modified_flags => $fpcw_flags
1144 reg_req => { in => [ "gp", "gp", "none", "fp_cw" ], out => [ "none" ] },
1145 ins => [ "base", "index", "mem", "fpcw" ],
1147 emit => ". fnstcw %AM",
1153 # we should not rematrialize this node. It has very strict constraints.
1154 reg_req => { in => [ "eax", "edx" ], out => [ "edx" ] },
1155 ins => [ "val", "globbered" ],
1163 # Note that we add additional latency values depending on address mode, so a
1164 # lateny of 0 for load is correct
1168 state => "exc_pinned",
1169 reg_req => { in => [ "gp", "gp", "none" ], out => [ "gp", "none" ] },
1170 ins => [ "base", "index", "mem" ],
1171 outs => [ "res", "M" ],
1173 emit => ". mov%SE%ME%.l %AM, %D0",
1179 cmp_attr => "return 1;",
1180 outs => [ "res", "M" ],
1186 cmp_attr => "return 1;",
1187 state => "exc_pinned",
1194 state => "exc_pinned",
1195 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "none" ] },
1196 ins => [ "base", "index", "mem", "val" ],
1197 emit => '. mov%M %SI3, %AM',
1205 state => "exc_pinned",
1206 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => ["none" ] },
1207 ins => [ "base", "index", "mem", "val" ],
1208 emit => '. mov%M %SB3, %AM',
1216 reg_req => { in => [ "gp", "gp" ], out => [ "gp" ] },
1217 ins => [ "base", "index" ],
1218 emit => '. leal %AM, %D0',
1222 # well this isn't true for Lea, but we often transform Lea back to Add, Inc
1223 # or Dec, so we set the flag
1224 modified_flags => 1,
1228 reg_req => { in => [ "gp", "gp", "none", "gp", "esp" ], out => [ "esp", "none" ] },
1229 ins => [ "base", "index", "mem", "val", "stack" ],
1230 emit => '. push%M %unop3',
1231 outs => [ "stack:I|S", "M" ],
1232 am => "source,binary",
1238 reg_req => { in => [ "gp", "gp", "none", "esp" ], out => [ "esp", "gp", "none" ] },
1239 emit => '. pop%M %DAM1',
1240 outs => [ "stack:I|S", "res", "M" ],
1241 ins => [ "base", "index", "mem", "stack" ],
1243 latency => 3, # Pop is more expensive than Push on Athlon
1248 reg_req => { in => [ "esp" ], out => [ "ebp", "esp", "none" ] },
1250 outs => [ "frame:I", "stack:I|S", "M" ],
1256 reg_req => { in => [ "esp", "ebp" ], out => [ "ebp", "esp" ] },
1258 outs => [ "frame:I", "stack:I|S" ],
1266 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "none" ] },
1267 ins => [ "base", "index", "mem", "stack", "size" ],
1268 am => "source,binary",
1269 emit => '. addl %binop',
1270 outs => [ "stack:S", "M" ],
1272 modified_flags => $status_flags
1278 reg_req => { in => [ "gp", "gp", "none", "esp", "gp" ], out => [ "in_r4", "gp", "none" ] },
1279 ins => [ "base", "index", "mem", "stack", "size" ],
1280 am => "source,binary",
1281 emit => ". subl %binop\n".
1282 ". movl %%esp, %D1",
1283 outs => [ "stack:I|S", "addr", "M" ],
1285 modified_flags => $status_flags
1290 reg_req => { out => [ "gp" ] },
1294 # the int instruction
1296 reg_req => { in => [ "gp" ], out => [ "none" ] },
1298 emit => '. int %SI0',
1300 cmp_attr => "return 1;",
1304 #-----------------------------------------------------------------------------#
1305 # _____ _____ ______ __ _ _ _ #
1306 # / ____/ ____| ____| / _| | | | | | #
1307 # | (___| (___ | |__ | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1308 # \___ \\___ \| __| | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1309 # ____) |___) | |____ | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1310 # |_____/_____/|______| |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1311 #-----------------------------------------------------------------------------#
1315 reg_req => { out => [ "xmm" ] },
1316 emit => '. xorp%XSD %D0, %D0',
1322 # commutative operations
1326 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1327 ins => [ "base", "index", "mem", "left", "right" ],
1328 emit => '. add%XXM %binop',
1336 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1337 ins => [ "base", "index", "mem", "left", "right" ],
1338 emit => '. mul%XXM %binop',
1346 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1347 ins => [ "base", "index", "mem", "left", "right" ],
1348 emit => '. max%XXM %binop',
1356 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1357 ins => [ "base", "index", "mem", "left", "right" ],
1358 emit => '. min%XXM %binop',
1366 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1367 ins => [ "base", "index", "mem", "left", "right" ],
1368 emit => '. andp%XSD %binop',
1376 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1377 ins => [ "base", "index", "mem", "left", "right" ],
1378 emit => '. orp%XSD %binop',
1385 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 in_r5" ] },
1386 ins => [ "base", "index", "mem", "left", "right" ],
1387 emit => '. xorp%XSD %binop',
1393 # not commutative operations
1397 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5" ] },
1398 ins => [ "base", "index", "mem", "left", "right" ],
1399 emit => '. andnp%XSD %binop',
1407 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4" ] },
1408 ins => [ "base", "index", "mem", "left", "right" ],
1409 emit => '. sub%XXM %binop',
1417 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "in_r4 !in_r5", "none" ] },
1418 ins => [ "base", "index", "mem", "left", "right" ],
1419 outs => [ "res", "M" ],
1420 emit => '. div%XXM %binop',
1429 reg_req => { in => [ "gp", "gp", "none", "xmm", "xmm" ], out => [ "eflags" ] },
1430 ins => [ "base", "index", "mem", "left", "right" ],
1431 outs => [ "flags" ],
1432 am => "source,binary",
1433 attr => "int flipped",
1434 init_attr => "attr->data.cmp_flipped = flipped;",
1435 emit => ' .ucomi%XXM %binop',
1438 mode => $mode_flags,
1439 modified_flags => 1,
1446 state => "exc_pinned",
1447 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
1448 ins => [ "base", "index", "mem" ],
1449 emit => '. mov%XXM %AM, %D0',
1450 attr => "ir_mode *load_mode",
1451 init_attr => "attr->ls_mode = load_mode;",
1452 outs => [ "res", "M" ],
1459 state => "exc_pinned",
1460 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1461 ins => [ "base", "index", "mem", "val" ],
1462 emit => '. mov%XXM %S3, %AM',
1470 state => "exc_pinned",
1471 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
1472 ins => [ "base", "index", "mem", "val" ],
1473 emit => '. mov%XXM %S3, %AM',
1481 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1482 ins => [ "base", "index", "mem", "val" ],
1483 emit => '. cvtsi2ss %D0, %AM',
1491 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm" ] },
1492 ins => [ "base", "index", "mem", "val" ],
1493 emit => '. cvtsi2sd %unop3',
1502 cmp_attr => "return 1;",
1508 cmp_attr => "return 1;",
1517 reg_req => { in => [ "edi", "esi", "ecx", "none" ], out => [ "edi", "esi", "ecx", "none" ] },
1518 outs => [ "DST", "SRC", "CNT", "M" ],
1520 # we don't care about this flag, so no need to mark this node
1521 # modified_flags => [ "DF" ]
1527 reg_req => { in => [ "edi", "esi", "none" ], out => [ "edi", "esi", "none" ] },
1528 outs => [ "DST", "SRC", "M" ],
1530 # we don't care about this flag, so no need to mark this node
1531 # modified_flags => [ "DF" ]
1537 state => "exc_pinned",
1538 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "gp", "none" ] },
1539 ins => [ "base", "index", "mem", "val" ],
1541 attr => "ir_mode *smaller_mode",
1542 init_attr => "attr->ls_mode = smaller_mode;",
1547 state => "exc_pinned",
1548 reg_req => { in => [ "gp", "gp", "none", "eax ebx ecx edx" ], out => [ "gp", "none" ] },
1549 ins => [ "base", "index", "mem", "val" ],
1551 attr => "ir_mode *smaller_mode",
1552 init_attr => "attr->ls_mode = smaller_mode;",
1557 reg_req => { in => [ "gp", "gp", "none", "gp" ], out => [ "xmm", "none" ] },
1558 ins => [ "base", "index", "mem", "val" ],
1565 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "gp", "none" ] },
1566 ins => [ "base", "index", "mem", "val" ],
1573 reg_req => { in => [ "gp", "gp", "none", "xmm" ], out => [ "xmm", "none" ] },
1574 ins => [ "base", "index", "mem", "val" ],
1580 #----------------------------------------------------------#
1582 # (_) | | | | / _| | | | #
1583 # __ ___ _ __| |_ _ _ __ _| | | |_| | ___ __ _| |_ #
1584 # \ \ / / | '__| __| | | |/ _` | | | _| |/ _ \ / _` | __| #
1585 # \ V /| | | | |_| |_| | (_| | | | | | | (_) | (_| | |_ #
1586 # \_/ |_|_| \__|\__,_|\__,_|_| |_| |_|\___/ \__,_|\__| #
1588 # _ __ ___ __| | ___ ___ #
1589 # | '_ \ / _ \ / _` |/ _ \/ __| #
1590 # | | | | (_) | (_| | __/\__ \ #
1591 # |_| |_|\___/ \__,_|\___||___/ #
1592 #----------------------------------------------------------#
1596 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1597 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1601 attr_type => "ia32_x87_attr_t",
1606 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1607 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1611 attr_type => "ia32_x87_attr_t",
1616 cmp_attr => "return 1;",
1622 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1623 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1627 attr_type => "ia32_x87_attr_t",
1631 cmp_attr => "return 1;",
1636 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp", "none" ] },
1637 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1638 outs => [ "res", "M" ],
1641 attr_type => "ia32_x87_attr_t",
1645 cmp_attr => "return 1;",
1646 outs => [ "res", "M" ],
1651 reg_req => { in => [ "gp", "gp", "none", "vfp", "vfp", "fpcw" ], out => [ "vfp" ] },
1652 ins => [ "base", "index", "mem", "left", "right", "fpcw" ],
1656 attr_type => "ia32_x87_attr_t",
1660 cmp_attr => "return 1;",
1666 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1671 attr_type => "ia32_x87_attr_t",
1676 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
1681 attr_type => "ia32_x87_attr_t",
1684 # virtual Load and Store
1688 state => "exc_pinned",
1689 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1690 ins => [ "base", "index", "mem" ],
1691 outs => [ "res", "M" ],
1692 attr => "ir_mode *load_mode",
1693 init_attr => "attr->attr.ls_mode = load_mode;",
1696 attr_type => "ia32_x87_attr_t",
1701 state => "exc_pinned",
1702 reg_req => { in => [ "gp", "gp", "none", "vfp" ] },
1703 ins => [ "base", "index", "mem", "val" ],
1704 attr => "ir_mode *store_mode",
1705 init_attr => "attr->attr.ls_mode = store_mode;",
1709 attr_type => "ia32_x87_attr_t",
1715 state => "exc_pinned",
1716 reg_req => { in => [ "gp", "gp", "none" ], out => [ "vfp", "none" ] },
1717 outs => [ "res", "M" ],
1718 ins => [ "base", "index", "mem" ],
1721 attr_type => "ia32_x87_attr_t",
1725 cmp_attr => "return 1;",
1726 outs => [ "res", "M" ],
1731 state => "exc_pinned",
1732 reg_req => { in => [ "gp", "gp", "none", "vfp", "fpcw" ] },
1733 ins => [ "base", "index", "mem", "val", "fpcw" ],
1737 attr_type => "ia32_x87_attr_t",
1741 cmp_attr => "return 1;",
1742 state => "exc_pinned",
1752 reg_req => { out => [ "vfp" ] },
1756 attr_type => "ia32_x87_attr_t",
1761 reg_req => { out => [ "vfp" ] },
1765 attr_type => "ia32_x87_attr_t",
1770 reg_req => { out => [ "vfp" ] },
1774 attr_type => "ia32_x87_attr_t",
1779 reg_req => { out => [ "vfp" ] },
1783 attr_type => "ia32_x87_attr_t",
1788 reg_req => { out => [ "vfp" ] },
1792 attr_type => "ia32_x87_attr_t",
1797 reg_req => { out => [ "vfp" ] },
1801 attr_type => "ia32_x87_attr_t",
1806 reg_req => { out => [ "vfp" ] },
1810 attr_type => "ia32_x87_attr_t",
1816 # we can't allow to rematerialize this node so we don't have
1817 # accidently produce Phi(Fucom, Fucom(flipped))
1819 reg_req => { in => [ "vfp", "vfp" ], out => [ "eax" ] },
1820 ins => [ "left", "right" ],
1821 outs => [ "flags" ],
1822 am => "source,binary",
1823 attr => "int flipped",
1824 init_attr => "attr->attr.data.cmp_flipped = flipped;",
1827 attr_type => "ia32_x87_attr_t",
1833 reg_req => { in => [ "eax" ], out => [ "eflags" ] },
1835 outs => [ "flags" ],
1838 mode => $mode_flags,
1841 #------------------------------------------------------------------------#
1842 # ___ _____ __ _ _ _ #
1843 # __ _( _ )___ | / _| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
1844 # \ \/ / _ \ / / | |_| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
1845 # > < (_) |/ / | _| | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
1846 # /_/\_\___//_/ |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
1847 #------------------------------------------------------------------------#
1849 # Note: gas is strangely buggy: fdivrp and fdivp as well as fsubrp and fsubp
1850 # are swapped, we work this around in the emitter...
1854 rd_constructor => "NONE",
1856 emit => '. fadd%XM %x87_binop',
1857 attr_type => "ia32_x87_attr_t",
1862 rd_constructor => "NONE",
1864 emit => '. faddp%XM %x87_binop',
1865 attr_type => "ia32_x87_attr_t",
1870 rd_constructor => "NONE",
1872 emit => '. fmul%XM %x87_binop',
1873 attr_type => "ia32_x87_attr_t",
1878 rd_constructor => "NONE",
1880 emit => '. fmulp%XM %x87_binop',,
1881 attr_type => "ia32_x87_attr_t",
1886 rd_constructor => "NONE",
1888 emit => '. fsub%XM %x87_binop',
1889 attr_type => "ia32_x87_attr_t",
1894 rd_constructor => "NONE",
1896 # see note about gas bugs
1897 emit => '. fsubrp%XM %x87_binop',
1898 attr_type => "ia32_x87_attr_t",
1903 rd_constructor => "NONE",
1906 emit => '. fsubr%XM %x87_binop',
1907 attr_type => "ia32_x87_attr_t",
1912 rd_constructor => "NONE",
1915 # see note about gas bugs
1916 emit => '. fsubp%XM %x87_binop',
1917 attr_type => "ia32_x87_attr_t",
1922 rd_constructor => "NONE",
1925 attr_type => "ia32_x87_attr_t",
1928 # this node is just here, to keep the simulator running
1929 # we can omit this when a fprem simulation function exists
1932 rd_constructor => "NONE",
1935 attr_type => "ia32_x87_attr_t",
1940 rd_constructor => "NONE",
1942 emit => '. fdiv%XM %x87_binop',
1943 attr_type => "ia32_x87_attr_t",
1948 rd_constructor => "NONE",
1950 # see note about gas bugs
1951 emit => '. fdivrp%XM %x87_binop',
1952 attr_type => "ia32_x87_attr_t",
1957 rd_constructor => "NONE",
1959 emit => '. fdivr%XM %x87_binop',
1960 attr_type => "ia32_x87_attr_t",
1965 rd_constructor => "NONE",
1967 # see note about gas bugs
1968 emit => '. fdivp%XM %x87_binop',
1969 attr_type => "ia32_x87_attr_t",
1974 rd_constructor => "NONE",
1977 attr_type => "ia32_x87_attr_t",
1982 rd_constructor => "NONE",
1985 attr_type => "ia32_x87_attr_t",
1988 # x87 Load and Store
1991 rd_constructor => "NONE",
1992 op_flags => "R|L|F",
1993 state => "exc_pinned",
1995 emit => '. fld%XM %AM',
1996 attr_type => "ia32_x87_attr_t",
2000 rd_constructor => "NONE",
2001 op_flags => "R|L|F",
2002 state => "exc_pinned",
2004 emit => '. fst%XM %AM',
2006 attr_type => "ia32_x87_attr_t",
2010 rd_constructor => "NONE",
2011 op_flags => "R|L|F",
2012 state => "exc_pinned",
2014 emit => '. fstp%XM %AM',
2016 attr_type => "ia32_x87_attr_t",
2023 rd_constructor => "NONE",
2025 emit => '. fild%M %AM',
2026 attr_type => "ia32_x87_attr_t",
2031 state => "exc_pinned",
2032 rd_constructor => "NONE",
2034 emit => '. fist%M %AM',
2036 attr_type => "ia32_x87_attr_t",
2041 state => "exc_pinned",
2042 rd_constructor => "NONE",
2044 emit => '. fistp%M %AM',
2046 attr_type => "ia32_x87_attr_t",
2052 op_flags => "R|c|K",
2056 attr_type => "ia32_x87_attr_t",
2060 op_flags => "R|c|K",
2064 attr_type => "ia32_x87_attr_t",
2068 op_flags => "R|c|K",
2072 attr_type => "ia32_x87_attr_t",
2076 op_flags => "R|c|K",
2080 attr_type => "ia32_x87_attr_t",
2084 op_flags => "R|c|K",
2088 attr_type => "ia32_x87_attr_t",
2092 op_flags => "R|c|K",
2095 emit => '. fldll2t',
2096 attr_type => "ia32_x87_attr_t",
2100 op_flags => "R|c|K",
2104 attr_type => "ia32_x87_attr_t",
2108 # Note that it is NEVER allowed to do CSE on these nodes
2109 # Moreover, note the virtual register requierements!
2114 cmp_attr => "return 1;",
2115 emit => '. fxch %X0',
2116 attr_type => "ia32_x87_attr_t",
2122 cmp_attr => "return 1;",
2123 emit => '. fld %X0',
2124 attr_type => "ia32_x87_attr_t",
2129 reg_req => { in => [ "vfp"], out => [ "vfp" ] },
2130 cmp_attr => "return 1;",
2131 emit => '. fld %X0',
2132 attr_type => "ia32_x87_attr_t",
2138 cmp_attr => "return 1;",
2139 emit => '. fstp %X0',
2140 attr_type => "ia32_x87_attr_t",
2146 cmp_attr => "return 1;",
2147 emit => '. ffreep %X0',
2148 attr_type => "ia32_x87_attr_t",
2154 cmp_attr => "return 1;",
2156 attr_type => "ia32_x87_attr_t",
2162 cmp_attr => "return 1;",
2164 attr_type => "ia32_x87_attr_t",
2172 emit => ". fucom %X1\n".
2174 attr_type => "ia32_x87_attr_t",
2180 emit => ". fucomp %X1\n".
2182 attr_type => "ia32_x87_attr_t",
2188 emit => ". fucompp\n".
2190 attr_type => "ia32_x87_attr_t",
2194 # -------------------------------------------------------------------------------- #
2195 # ____ ____ _____ _ _ #
2196 # / ___/ ___|| ____| __ _____ ___| |_ ___ _ __ _ __ ___ __| | ___ ___ #
2197 # \___ \___ \| _| \ \ / / _ \/ __| __/ _ \| '__| | '_ \ / _ \ / _` |/ _ \/ __| #
2198 # ___) |__) | |___ \ V / __/ (__| || (_) | | | | | | (_) | (_| | __/\__ \ #
2199 # |____/____/|_____| \_/ \___|\___|\__\___/|_| |_| |_|\___/ \__,_|\___||___/ #
2201 # -------------------------------------------------------------------------------- #
2204 # Spilling and reloading of SSE registers, hardcoded, not generated #
2208 state => "exc_pinned",
2209 reg_req => { in => [ "gp", "gp", "none" ], out => [ "xmm", "none" ] },
2210 emit => '. movdqu %D0, %AM',
2211 outs => [ "res", "M" ],
2217 state => "exc_pinned",
2218 reg_req => { in => [ "gp", "gp", "none", "xmm" ] },
2219 ins => [ "base", "index", "mem", "val" ],
2220 emit => '. movdqu %binop',
2227 # Include the generated SIMD node specification written by the SIMD optimization
2228 $my_script_name = dirname($myname) . "/../ia32/ia32_simd_spec.pl";
2229 unless ($return = do $my_script_name) {
2230 warn "couldn't parse $my_script_name: $@" if $@;
2231 warn "couldn't do $my_script_name: $!" unless defined $return;
2232 warn "couldn't run $my_script_name" unless $return;