3 # This is a template specification for the Firm-Backend
5 # the cpu architecture (ia32, ia64, mips, sparc, ppc32, ...)
10 # this strings mark the beginning and the end of a comment in emit
11 $comment_string = "/*";
12 $comment_string_end = "*/";
14 # The node description is done as a perl hash initializer with the
15 # following structure:
20 # "op_flags" => "N|L|C|X|I|F|Y|H|c|K",
21 # "irn_flags" => "R|N|I"
22 # "arity" => "0|1|2|3 ... |variable|dynamic|any",
23 # "state" => "floats|pinned|mem_pinned|exc_pinned",
25 # { "type" => "type 1", "name" => "name 1" },
26 # { "type" => "type 2", "name" => "name 2" },
29 # "comment" => "any comment for constructor",
30 # "reg_req" => { "in" => [ "reg_class|register" ], "out" => [ "reg_class|register|in_rX" ] },
31 # "cmp_attr" => "c source code for comparing node attributes",
32 # "emit" => "emit code with templates",
33 # "rd_constructor" => "c source code which constructs an ir_node"
36 # ... # (all nodes you need to describe)
38 # ); # close the %nodes initializer
40 # op_flags: flags for the operation, OPTIONAL (default is "N")
41 # the op_flags correspond to the firm irop_flags:
44 # C irop_flag_commutative
45 # X irop_flag_cfopcode
46 # I irop_flag_ip_cfopcode
49 # H irop_flag_highlevel
50 # c irop_flag_constlike
53 # irn_flags: special node flags, OPTIONAL (default is 0)
54 # following irn_flags are supported:
57 # I ignore for register allocation
59 # state: state of the operation, OPTIONAL (default is "floats")
61 # arity: arity of the operation, MUST NOT BE OMITTED
63 # args: the OPTIONAL arguments of the node constructor (debug, irg and block
64 # are always the first 3 arguments and are always autmatically
66 # If this key is missing the following arguments will be created:
67 # for i = 1 .. arity: ir_node *op_i
70 # outs: if a node defines more than one output, the names of the projections
71 # nodes having outs having automatically the mode mode_T
73 # comment: OPTIONAL comment for the node constructor
75 # rd_constructor: for every operation there will be a
76 # new_rd_<arch>_<op-name> function with the arguments from above
77 # which creates the ir_node corresponding to the defined operation
78 # you can either put the complete source code of this function here
80 # This key is OPTIONAL. If omitted, the following constructor will
82 # if (!op_<arch>_<op-name>) assert(0);
86 # res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
89 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
93 # 1 - caller save (register must be saved by the caller of a function)
94 # 2 - callee save (register must be saved by the called function)
95 # 4 - ignore (do not assign this register)
96 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
99 { "name" => "r0", "type" => 1 },
100 { "name" => "r2", "type" => 1 },
101 { "name" => "r3", "type" => 1 },
102 { "name" => "r4", "type" => 1 },
103 { "name" => "r5", "type" => 1 },
104 { "name" => "r6", "type" => 1 },
105 { "name" => "r7", "type" => 1 },
106 { "name" => "r8", "type" => 1 },
107 { "name" => "r9", "type" => 1 },
108 { "name" => "r10", "type" => 1 },
109 # { "name" => "r11", "type" => 1 },
110 # { "name" => "r12", "type" => 1 },
111 { "name" => "r13", "type" => 2 },
112 { "name" => "r14", "type" => 2 },
113 { "name" => "r15", "type" => 2 },
114 # { "name" => "r16", "type" => 2 },
115 # { "name" => "r17", "type" => 2 },
116 # { "name" => "r18", "type" => 2 },
117 # { "name" => "r19", "type" => 2 },
118 # { "name" => "r20", "type" => 2 },
119 # { "name" => "r21", "type" => 2 },
120 # { "name" => "r22", "type" => 2 },
121 # { "name" => "r23", "type" => 2 },
122 # { "name" => "r24", "type" => 2 },
123 # { "name" => "r25", "type" => 2 },
124 # { "name" => "r26", "type" => 2 },
125 # { "name" => "r27", "type" => 2 },
126 # { "name" => "r28", "type" => 2 },
127 # { "name" => "r29", "type" => 2 },
128 # { "name" => "r30", "type" => 2 },
129 { "name" => "r31", "type" => 2 },
130 { "name" => "r1", "type" => 6 }, # this is our stackpointer
131 { "mode" => "mode_P" }
134 # { "name" => "f0", "type" => 1 }, # => reserved for FP Perm
135 { "name" => "f1", "type" => 1 },
136 { "name" => "f2", "type" => 1 },
137 { "name" => "f3", "type" => 1 },
138 { "name" => "f4", "type" => 1 },
139 { "name" => "f5", "type" => 1 },
140 { "name" => "f6", "type" => 1 },
141 { "name" => "f7", "type" => 1 },
142 { "name" => "f8", "type" => 1 },
143 { "name" => "f9", "type" => 1 },
144 { "name" => "f10", "type" => 1 },
145 { "name" => "f11", "type" => 1 },
146 { "name" => "f12", "type" => 1 },
147 { "name" => "f13", "type" => 1 },
148 { "name" => "f14", "type" => 2 },
149 { "name" => "f15", "type" => 2 },
150 { "name" => "f16", "type" => 2 },
151 # { "name" => "f17", "type" => 2 },
152 # { "name" => "f18", "type" => 2 },
153 # { "name" => "f19", "type" => 2 },
154 # { "name" => "f20", "type" => 2 },
155 # { "name" => "f21", "type" => 2 },
156 # { "name" => "f22", "type" => 2 },
157 # { "name" => "f23", "type" => 2 },
158 # { "name" => "f24", "type" => 2 },
159 # { "name" => "f25", "type" => 2 },
160 # { "name" => "f26", "type" => 2 },
161 # { "name" => "f27", "type" => 2 },
162 # { "name" => "f28", "type" => 2 },
163 # { "name" => "f29", "type" => 2 },
164 # { "name" => "f30", "type" => 2 },
165 # { "name" => "f31", "type" => 2 },
166 { "mode" => "mode_D" }
169 { "name" => "cr0", "type" => 1 },
170 { "name" => "cr1", "type" => 1 },
171 { "name" => "cr2", "type" => 2 },
172 { "name" => "cr3", "type" => 2 },
173 { "name" => "cr4", "type" => 2 },
174 { "name" => "cr5", "type" => 1 },
175 { "name" => "cr6", "type" => 1 },
176 # { "name" => "cr7", "type" => 1 }, # => reserved for Condition Perm
177 { "mode" => "mode_P" } # real mode is 4 bit, but doesn't matter ...
180 { "name" => "lr", "type" => 4 }, # 3
181 { "mode" => "mode_P" }
184 { "name" => "ctr", "type" => 1 },
185 { "mode" => "mode_P" }
190 S0 => "${arch}_emit_source_register(env, node, 0);",
191 S1 => "${arch}_emit_source_register(env, node, 1);",
192 S2 => "${arch}_emit_source_register(env, node, 2);",
193 D0 => "${arch}_emit_dest_register(env, node, 0);",
194 D1 => "${arch}_emit_dest_register(env, node, 1);",
195 D2 => "${arch}_emit_dest_register(env, node, 2);",
196 O => "${arch}_emit_offset(env, node);",
197 C => "${arch}_emit_immediate(env, node);",
198 RLWIMI => "${arch}_emit_rlwimi_helper(env, node);",
201 #--------------------------------------------------#
204 # _ __ _____ __ _ _ __ ___ _ __ ___ #
205 # | '_ \ / _ \ \ /\ / / | | '__| / _ \| '_ \/ __| #
206 # | | | | __/\ V V / | | | | (_) | |_) \__ \ #
207 # |_| |_|\___| \_/\_/ |_|_| \___/| .__/|___/ #
210 #--------------------------------------------------#
214 #-----------------------------------------------------------------#
217 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
218 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
219 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
220 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
223 #-----------------------------------------------------------------#
225 # commutative operations
230 "comment" => "construct Add: Add(a, b) = Add(b, a) = a + b",
231 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
232 "emit" => '. add %D0, %S0, %S1',
238 "comment" => "construct Add: Addi(a, const) = Addi(const, a) = a + const",
239 "reg_req" => { "in" => [ "!r0" ], "out" => [ "gp" ] },
240 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
241 "emit" => '. addi %D0, %S0, %C',
244 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
252 "comment" => "construct Mul: Mullw(a, b) = Mullw(b, a) = lo32(a * b)",
253 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
254 "emit" => '. mullw %D0, %S0, %S1',
260 "comment" => "construct Mul: Mulhw(a, b) = Mulhw(b, a) = hi32(a * b)",
261 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
262 "emit" => '. mulhw %D0, %S0, %S1',
268 "comment" => "construct Mul: Mulhwu(a, b) = Mulhwu(b, a) = hi32(a * b)",
269 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
270 "emit" => '. mulhwu %D0, %S0, %S1',
274 # "irn_flags" => "R",
275 # "comment" => "construct Mul: Mul(a, const) = Mul(const, a) = a * const",
276 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
277 # "emit" => '. mul %S0, %C, %D0',
283 "comment" => "construct And: And(a, b) = And(b, a) = a AND b",
284 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
285 "emit" => '. and %D0, %S0, %S1',
289 # "irn_flags" => "R",
290 # "comment" => "construct And: And(a, const) = And(const, a) = a AND const",
291 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
292 # "emit" => '. and %S0, %C, %D0',
298 "comment" => "construct Or: Or(a, b) = Or(b, a) = a OR b",
299 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
300 "emit" => '. or %D0, %S0, %S1',
305 # "irn_flags" => "R",
306 # "comment" => "construct Or: Or(a, const) = Or(const, a) = a OR const",
307 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
308 # "emit" => '. or %S0, %C, %D0',
314 "comment" => "construct Xor: Xor(a, b) = Xor(b, a) = a XOR b",
315 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
316 "emit" => '. xor %D0, %S0, %S1',
320 # "irn_flags" => "R",
321 # "comment" => "construct Xor: Xor(a, const) = Xor(const, a) = a EOR const",
322 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
323 # "emit" => '. xor %S0, %C, %D0',
326 # not commutative operations
330 "comment" => "construct Sub: Sub(a, b) = a - b",
331 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
332 "emit" => '. sub %D0, %S0, %S1',
336 # "irn_flags" => "R",
337 # "comment" => "construct Sub: Sub(a, const) = a - const",
338 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
339 # "emit" => '. subl %S0, %C, %D0',
344 "comment" => "construct Shl: Shl(a, b) = a << b",
345 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
346 "emit" => '. slw %D0, %S0, %S1',
350 # "irn_flags" => "R",
351 # "comment" => "construct Shl: Shl(a, const) = a << const",
352 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
353 # "emit" => '. shl %S0, %C, %D0',
358 "comment" => "construct Shr: Srw(a, b): c = a >> b",
359 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
360 "emit" => '. srw %D0, %S0, %S1',
364 # "irn_flags" => "R",
365 # "comment" => "construct Shr: Shr(a, const) = a >> const",
366 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
367 # "emit" => '. shr %S0, %C, %D0',
372 "comment" => "construct Shrs: Sraw(a, b): c = a >> b",
373 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
374 "emit" => '. sraw %D0, %S0, %S1',
379 "comment" => "construct Shrs: Srawi(a, const): c = a >> const",
380 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
381 "emit" => '. sraw %D0, %S0, %C',
384 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
391 "comment" => "construct ???: Rlwnm(a, b): c = a ROTL b",
392 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
393 "emit" => '. rlwnm %D0, %S0, %S1',
398 "comment" => "construct ???: Rlwinm(a, b_const, c_const, d_const): (m = MASK(c, d)) e = (a ROTL b) & m",
399 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
400 "emit" => '. rlwinm %D0, %S0, %RLWIMI',
403 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
410 "comment" => "construct Minus: Neg(a) = -a",
411 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
412 "emit" => '. neg %D0, %S0',
417 "comment" => "construct Not: Not(a) = !a",
418 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
419 "emit" => '. nor %D0, %S0, %S0',
424 "comment" => "construct Sign extension of byte: Extsb(char a) = (int) a",
425 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
426 "emit" => '. extsb %D0, %S0',
431 "comment" => "construct Sign extension of halfword: Extsh(char a) = (short) a",
432 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
433 "emit" => '. extsh %D0, %S0',
438 "comment" => "construct Div (signed): Div(a, b) = a div b",
439 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
440 "emit" => '. divw %D0, %S0, %S1',
445 "comment" => "construct Div (unsigned): Div(a, b) = a div b",
446 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
447 "emit" => '. divwu %D0, %S0, %S1',
452 "comment" => "construct Mtctr: Ctr = a",
453 "reg_req" => { "in" => [ "gp" ], "out" => [ "count" ] },
454 "emit" => '. mtctr %S0',
463 "comment" => "Const (high-level node)",
464 "reg_req" => { "out" => [ "gp" ] },
467 return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
474 "comment" => "float Const (high-level node)",
475 "reg_req" => { "out" => [ "fp" ] },
478 return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
485 "comment" => "SymConst (high-level node)",
486 "reg_req" => { "out" => [ "gp" ] },
489 return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
496 "comment" => "construct unknown register",
497 "reg_req" => { "out" => [ "gp" ] },
498 "emit" => '. \t\t /* use %D0 as uninitialized value */',
508 "comment" => "construct unknown float register",
509 "reg_req" => { "out" => [ "fp" ] },
510 "emit" => '. \t\t /* use %D0 as uninitialized value */',
520 "comment" => "construct unknown condition register",
521 "reg_req" => { "out" => [ "condition" ] },
522 "emit" => '. \t\t /* use %D0 as uninitialized value */',
532 "comment" => "load constant (16bit with sign extension)",
533 "reg_req" => { "out" => [ "gp" ] },
534 "emit" => '. addi %D0, 0, %C',
537 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
542 "op_flags" => "L|X|Y",
543 "comment" => "branch somewhere",
544 "reg_req" => { "in" => [ "condition" ], "out" => [ "none", "none" ] },
547 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
553 "comment" => "construct LoopCopy(src, dest, count, mem): Copy count words from src to dest",
554 "reg_req" => { "in" => [ "gp", "gp", "count", "none" ], "out" => [ "none", "in_r1", "in_r2", "in_r3", "gp" ] },
558 "op_flags" => "L|X|Y",
559 "comment" => "construct Switch(selector): Jump to whatever",
560 "reg_req" => { "in" => [ "gp", "gp", "condition" ], "out" => [ "none" ] },
563 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
570 "comment" => "load the constant to higher 16 bit of register",
571 "reg_req" => { "out" => [ "gp" ] },
572 "emit" => '. addis %D0, 0, %C',
573 "attr" => "ppc32_attr_offset_mode om, tarval *tv, ident *id",
576 attr->offset_mode = om;
578 attr->content_type = ppc32_ac_Const;
579 attr->data.constant_tarval = tv;
582 attr->content_type = ppc32_ac_SymConst;
583 attr->data.symconst_ident = id;
588 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
595 "comment" => "ors constant with register",
596 "reg_req" => { "in" => [ "gp"], "out" => [ "gp" ] },
597 "emit" => '. ori %D0, %S0, %C',
600 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
607 "comment" => "ands constant with register with cr0 update",
608 "reg_req" => { "in" => [ "gp"], "out" => [ "gp", "cr0" ] },
609 "emit" => '. andi. %D0, %S0,%C',
612 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
618 "comment" => "construct Cmp: Cmp(a, b) = Flags in crX",
619 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "condition" ] },
620 "emit" => '. cmp %D0, 0, %S0, %S1',
625 "comment" => "construct Cmp immediate: Cmpi(a, const) = Flags in crX",
626 "reg_req" => { "in" => [ "gp" ], "out" => [ "condition" ] },
627 "emit" => '. cmpi %D0, 0, %S0, %C',
630 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
637 "comment" => "construct Cmp logical: Cmpl(a, b) = Flags in crX",
638 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "condition" ] },
639 "emit" => '. cmpl %D0, 0, %S0, %S1',
644 "comment" => "construct Cmp logical immediate: Cmpli(a, const) = Flags in crX",
645 "reg_req" => { "in" => [ "gp" ], "out" => [ "condition" ] },
646 "emit" => '. cmpli %D0, 0, %S0, %C',
649 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
659 "state" => "exc_pinned",
660 "comment" => "construct Load (byte unsigned): Load(ptr, mem) = LD ptr -> reg",
661 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "none" ] },
662 "emit" => '. lbz %D0, %O(%S0)',
665 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
667 "outs" => [ "res", "M" ],
673 "state" => "exc_pinned",
674 "comment" => "construct Load (halfword unsigned): Load(ptr, mem) = LD ptr -> reg",
675 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "none" ] },
676 "emit" => '. lhz %D0, %O(%S0)',
679 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
681 "outs" => [ "res", "M" ],
687 "state" => "exc_pinned",
688 "comment" => "construct Load (halfword signed): Load(ptr, mem) = LD ptr -> reg",
689 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "none" ] },
690 "emit" => '. lha %D0, %O(%S0)',
693 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
695 "outs" => [ "res", "M" ],
701 "state" => "exc_pinned",
702 "comment" => "construct Load (word): Load(ptr, mem) = LD ptr -> reg",
703 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "none" ] },
704 "emit" => '. lwz %D0, %O(%S0)',
707 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
709 "outs" => [ "res", "M" ],
715 "state" => "exc_pinned",
716 "comment" => "construct Load with update (word): Load(ptr, mem) = LD ptr -> reg",
717 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "in_r1", "none"] },
718 "emit" => '. lwzu %D0, %O(%S0)',
721 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
723 "outs" => [ "res", "ptr", "M" ],
728 "state" => "exc_pinned",
729 "comment" => "construct Store: Store (byte) (ptr, val, mem) = ST ptr,val",
730 "reg_req" => { "in" => [ "!r0", "gp", "none" ] },
731 "emit" => '. stb %S1, %O(%S0)',
734 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
741 "state" => "exc_pinned",
742 "comment" => "construct Store: Store (halfword) (ptr, val, mem) = ST ptr,val",
743 "reg_req" => { "in" => [ "!r0", "gp", "none" ] },
744 "emit" => '. sth %S1, %O(%S0)',
747 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
754 "state" => "exc_pinned",
755 "comment" => "construct Store: Store (word) (ptr, val, mem) = ST ptr,val",
756 "reg_req" => { "in" => [ "!r0", "gp", "none" ] },
757 "emit" => '. stw %S1, %O(%S0)',
760 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
765 #--------------------------------------------------------#
768 # | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
769 # | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
770 # | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
771 # |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
772 #--------------------------------------------------------#
774 # commutative operations
779 "comment" => "construct FP Add: Add(a, b) = Add(b, a) = a + b",
780 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
781 "emit" => '. fadd %D0, %S0, %S1',
787 "comment" => "construct FP Add (single): Add(a, b) = Add(b, a) = a + b",
788 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
789 "emit" => '. fadds %D0, %S0, %S1',
794 "comment" => "construct FP Mul: Mul(a, b) = Mul(b, a) = a * b",
795 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
796 "emit" => '. fmul %D0, %S0, %S1',
801 "comment" => "construct FP Mul (single): Mul(a, b) = Mul(b, a) = a * b",
802 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
803 "emit" => '. fmuls %D0, %S0, %S1',
807 "comment" => "construct FP Negation: fNeg(a) = -a",
808 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
809 "emit" => '. fneg %D0, %S0',
816 "comment" => "construct FP Max: Max(a, b) = Max(b, a) = a > b ? a : b",
817 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
818 "emit" => '. fmax %S0, %S1, %D0',
824 "comment" => "construct FP Min: Min(a, b) = Min(b, a) = a < b ? a : b",
825 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
826 "emit" => '. fmin %S0, %S1, %D0',
829 # not commutative operations
833 "comment" => "construct FP Sub: Sub(a, b) = a - b",
834 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
835 "emit" => '. fsub %D0, %S0, %S1',
840 "comment" => "construct FP Sub (single): Sub(a, b) = a - b",
841 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
842 "emit" => '. fsubs %D0, %S0, %S1',
846 "comment" => "construct FP Div: Div(a, b) = a / b",
847 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
848 "emit" => '. fdiv %D0, %S0, %S1',
852 "comment" => "construct FP Div (single): Div(a, b) = a / b",
853 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
854 "emit" => '. fdivs %D0, %S0, %S1',
859 "comment" => "construct FP Minus: fMinus(a) = -a",
860 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
861 "emit" => '. fneg %D0, %S0',
866 "comment" => "construct FP Convert to integer word: fCtiw(a) = (int) a",
867 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
868 "emit" => '. fctiw %D0, %S0',
873 "comment" => "construct FP Round to single: fRsp(a) = (float) a",
874 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
875 "emit" => '. frsp %D0, %S0',
880 "comment" => "construct FP Abs: fAbs(a) = |a|",
881 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
882 "emit" => '. fabs %D0, %S0',
887 "comment" => "construct FP Cmp unordered: fCmpu(a, b) = a ? b",
888 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "condition" ] },
889 "emit" => '. fcmpu %D0, %S0, %S1',
896 # "irn_flags" => "R",
897 # "comment" => "represents a FP constant",
898 # "reg_req" => { "out" => [ "fp" ] },
899 # "emit" => '. fmov %C, %D0',
902 # /* TODO: compare fConst attributes */
910 "comment" => "construct unknown floating point register",
911 "reg_req" => { "out" => [ "fp" ] },
912 "emit" => '. \t\t /* use %D0 as uninitialized value */',
924 "state" => "exc_pinned",
925 "comment" => "construct FP Load (double): Load(ptr, mem) = LD ptr",
926 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "fp", "none" ] },
927 "emit" => '. lfd %D0, %O(%S0)',
930 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
932 "outs" => [ "res", "M" ],
938 "state" => "exc_pinned",
939 "comment" => "construct FP Load (single): Load(ptr, mem) = LD ptr",
940 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "fp","none" ] },
941 "emit" => '. lfs %D0, %O(%S0)',
944 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
946 "outs" => [ "res", "M" ],
951 "state" => "exc_pinned",
952 "comment" => "construct Store (double): Store(ptr, val, mem) = ST ptr,val",
953 "reg_req" => { "in" => [ "!r0", "fp", "none" ] },
954 "emit" => '. stfd %S1, %O(%S0)',
957 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
964 "state" => "exc_pinned",
965 "comment" => "construct Store (single): Store(ptr, val, mem) = ST ptr,val",
966 "reg_req" => { "in" => [ "!r0", "fp", "none" ] },
967 "emit" => '. stfs %S1, %O(%S0)',
970 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);