3 # This is a template specification for the Firm-Backend
5 # the cpu architecture (ia32, ia64, mips, sparc, ppc32, ...)
10 # The node description is done as a perl hash initializer with the
11 # following structure:
16 # "op_flags" => "N|L|C|X|I|F|Y|H|c|K",
17 # "irn_flags" => "R|N|I"
18 # "arity" => "0|1|2|3 ... |variable|dynamic|any",
19 # "state" => "floats|pinned|mem_pinned|exc_pinned",
21 # { "type" => "type 1", "name" => "name 1" },
22 # { "type" => "type 2", "name" => "name 2" },
25 # "comment" => "any comment for constructor",
26 # "reg_req" => { "in" => [ "reg_class|register" ], "out" => [ "reg_class|register|in_rX" ] },
27 # "cmp_attr" => "c source code for comparing node attributes",
28 # "emit" => "emit code with templates",
29 # "rd_constructor" => "c source code which constructs an ir_node"
32 # ... # (all nodes you need to describe)
34 # ); # close the %nodes initializer
36 # op_flags: flags for the operation, OPTIONAL (default is "N")
37 # the op_flags correspond to the firm irop_flags:
40 # C irop_flag_commutative
41 # X irop_flag_cfopcode
42 # I irop_flag_ip_cfopcode
45 # H irop_flag_highlevel
46 # c irop_flag_constlike
49 # irn_flags: special node flags, OPTIONAL (default is 0)
50 # following irn_flags are supported:
53 # I ignore for register allocation
55 # state: state of the operation, OPTIONAL (default is "floats")
57 # arity: arity of the operation, MUST NOT BE OMITTED
59 # args: the OPTIONAL arguments of the node constructor (debug, irg and block
60 # are always the first 3 arguments and are always autmatically
62 # If this key is missing the following arguments will be created:
63 # for i = 1 .. arity: ir_node *op_i
66 # outs: if a node defines more than one output, the names of the projections
67 # nodes having outs having automatically the mode mode_T
69 # comment: OPTIONAL comment for the node constructor
71 # rd_constructor: for every operation there will be a
72 # new_rd_<arch>_<op-name> function with the arguments from above
73 # which creates the ir_node corresponding to the defined operation
74 # you can either put the complete source code of this function here
76 # This key is OPTIONAL. If omitted, the following constructor will
78 # if (!op_<arch>_<op-name>) assert(0);
82 # res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
85 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
89 # 1 - caller save (register must be saved by the caller of a function)
90 # 2 - callee save (register must be saved by the called function)
91 # 4 - ignore (do not assign this register)
92 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
95 { "name" => "r0", "type" => 1 },
96 { "name" => "r2", "type" => 1 },
97 { "name" => "r3", "type" => 1 },
98 { "name" => "r4", "type" => 1 },
99 { "name" => "r5", "type" => 1 },
100 { "name" => "r6", "type" => 1 },
101 { "name" => "r7", "type" => 1 },
102 { "name" => "r8", "type" => 1 },
103 { "name" => "r9", "type" => 1 },
104 { "name" => "r10", "type" => 1 },
105 # { "name" => "r11", "type" => 1 },
106 # { "name" => "r12", "type" => 1 },
107 { "name" => "r13", "type" => 2 },
108 { "name" => "r14", "type" => 2 },
109 { "name" => "r15", "type" => 2 },
110 # { "name" => "r16", "type" => 2 },
111 # { "name" => "r17", "type" => 2 },
112 # { "name" => "r18", "type" => 2 },
113 # { "name" => "r19", "type" => 2 },
114 # { "name" => "r20", "type" => 2 },
115 # { "name" => "r21", "type" => 2 },
116 # { "name" => "r22", "type" => 2 },
117 # { "name" => "r23", "type" => 2 },
118 # { "name" => "r24", "type" => 2 },
119 # { "name" => "r25", "type" => 2 },
120 # { "name" => "r26", "type" => 2 },
121 # { "name" => "r27", "type" => 2 },
122 # { "name" => "r28", "type" => 2 },
123 # { "name" => "r29", "type" => 2 },
124 # { "name" => "r30", "type" => 2 },
125 { "name" => "r31", "type" => 2 },
126 { "name" => "r1", "type" => 6 }, # this is our stackpointer
127 { "mode" => "mode_P" }
130 # { "name" => "f0", "type" => 1 }, # => reserved for FP Perm
131 { "name" => "f1", "type" => 1 },
132 { "name" => "f2", "type" => 1 },
133 { "name" => "f3", "type" => 1 },
134 { "name" => "f4", "type" => 1 },
135 { "name" => "f5", "type" => 1 },
136 { "name" => "f6", "type" => 1 },
137 { "name" => "f7", "type" => 1 },
138 { "name" => "f8", "type" => 1 },
139 { "name" => "f9", "type" => 1 },
140 { "name" => "f10", "type" => 1 },
141 { "name" => "f11", "type" => 1 },
142 { "name" => "f12", "type" => 1 },
143 { "name" => "f13", "type" => 1 },
144 { "name" => "f14", "type" => 2 },
145 { "name" => "f15", "type" => 2 },
146 { "name" => "f16", "type" => 2 },
147 # { "name" => "f17", "type" => 2 },
148 # { "name" => "f18", "type" => 2 },
149 # { "name" => "f19", "type" => 2 },
150 # { "name" => "f20", "type" => 2 },
151 # { "name" => "f21", "type" => 2 },
152 # { "name" => "f22", "type" => 2 },
153 # { "name" => "f23", "type" => 2 },
154 # { "name" => "f24", "type" => 2 },
155 # { "name" => "f25", "type" => 2 },
156 # { "name" => "f26", "type" => 2 },
157 # { "name" => "f27", "type" => 2 },
158 # { "name" => "f28", "type" => 2 },
159 # { "name" => "f29", "type" => 2 },
160 # { "name" => "f30", "type" => 2 },
161 # { "name" => "f31", "type" => 2 },
162 { "mode" => "mode_D" }
165 { "name" => "cr0", "type" => 1 },
166 { "name" => "cr1", "type" => 1 },
167 { "name" => "cr2", "type" => 2 },
168 { "name" => "cr3", "type" => 2 },
169 { "name" => "cr4", "type" => 2 },
170 { "name" => "cr5", "type" => 1 },
171 { "name" => "cr6", "type" => 1 },
172 # { "name" => "cr7", "type" => 1 }, # => reserved for Condition Perm
173 { "mode" => "mode_P" } # real mode is 4 bit, but doesn't matter ...
176 { "name" => "lr", "type" => 4 }, # 3
177 { "mode" => "mode_P" }
180 { "name" => "ctr", "type" => 1 },
181 { "mode" => "mode_P" }
186 S0 => "${arch}_emit_source_register(env, node, 0);",
187 S1 => "${arch}_emit_source_register(env, node, 1);",
188 S2 => "${arch}_emit_source_register(env, node, 2);",
189 D0 => "${arch}_emit_dest_register(env, node, 0);",
190 D1 => "${arch}_emit_dest_register(env, node, 1);",
191 D2 => "${arch}_emit_dest_register(env, node, 2);",
192 O => "${arch}_emit_offset(env, node);",
193 C => "${arch}_emit_immediate(env, node);",
194 RLWIMI => "${arch}_emit_rlwimi_helper(env, node);",
197 $default_cmp_attr = "NULL";
199 #--------------------------------------------------#
202 # _ __ _____ __ _ _ __ ___ _ __ ___ #
203 # | '_ \ / _ \ \ /\ / / | | '__| / _ \| '_ \/ __| #
204 # | | | | __/\ V V / | | | | (_) | |_) \__ \ #
205 # |_| |_|\___| \_/\_/ |_|_| \___/| .__/|___/ #
208 #--------------------------------------------------#
212 #-----------------------------------------------------------------#
215 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
216 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
217 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
218 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
221 #-----------------------------------------------------------------#
223 # commutative operations
228 "comment" => "construct Add: Add(a, b) = Add(b, a) = a + b",
229 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
230 "emit" => '. add %D0, %S0, %S1',
236 "comment" => "construct Add: Addi(a, const) = Addi(const, a) = a + const",
237 "reg_req" => { "in" => [ "!r0" ], "out" => [ "gp" ] },
238 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
239 "emit" => '. addi %D0, %S0, %C',
242 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
250 "comment" => "construct Mul: Mullw(a, b) = Mullw(b, a) = lo32(a * b)",
251 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
252 "emit" => '. mullw %D0, %S0, %S1',
258 "comment" => "construct Mul: Mulhw(a, b) = Mulhw(b, a) = hi32(a * b)",
259 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
260 "emit" => '. mulhw %D0, %S0, %S1',
266 "comment" => "construct Mul: Mulhwu(a, b) = Mulhwu(b, a) = hi32(a * b)",
267 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
268 "emit" => '. mulhwu %D0, %S0, %S1',
272 # "irn_flags" => "R",
273 # "comment" => "construct Mul: Mul(a, const) = Mul(const, a) = a * const",
274 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
275 # "emit" => '. mul %S0, %C, %D0',
281 "comment" => "construct And: And(a, b) = And(b, a) = a AND b",
282 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
283 "emit" => '. and %D0, %S0, %S1',
287 # "irn_flags" => "R",
288 # "comment" => "construct And: And(a, const) = And(const, a) = a AND const",
289 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
290 # "emit" => '. and %S0, %C, %D0',
296 "comment" => "construct Or: Or(a, b) = Or(b, a) = a OR b",
297 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
298 "emit" => '. or %D0, %S0, %S1',
303 # "irn_flags" => "R",
304 # "comment" => "construct Or: Or(a, const) = Or(const, a) = a OR const",
305 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
306 # "emit" => '. or %S0, %C, %D0',
312 "comment" => "construct Xor: Xor(a, b) = Xor(b, a) = a XOR b",
313 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
314 "emit" => '. xor %D0, %S0, %S1',
318 # "irn_flags" => "R",
319 # "comment" => "construct Xor: Xor(a, const) = Xor(const, a) = a EOR const",
320 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
321 # "emit" => '. xor %S0, %C, %D0',
324 # not commutative operations
328 "comment" => "construct Sub: Sub(a, b) = a - b",
329 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
330 "emit" => '. sub %D0, %S0, %S1',
334 # "irn_flags" => "R",
335 # "comment" => "construct Sub: Sub(a, const) = a - const",
336 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
337 # "emit" => '. subl %S0, %C, %D0',
342 "comment" => "construct Shl: Shl(a, b) = a << b",
343 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
344 "emit" => '. slw %D0, %S0, %S1',
348 # "irn_flags" => "R",
349 # "comment" => "construct Shl: Shl(a, const) = a << const",
350 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
351 # "emit" => '. shl %S0, %C, %D0',
356 "comment" => "construct Shr: Srw(a, b): c = a >> b",
357 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
358 "emit" => '. srw %D0, %S0, %S1',
362 # "irn_flags" => "R",
363 # "comment" => "construct Shr: Shr(a, const) = a >> const",
364 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
365 # "emit" => '. shr %S0, %C, %D0',
370 "comment" => "construct Shrs: Sraw(a, b): c = a >> b",
371 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
372 "emit" => '. sraw %D0, %S0, %S1',
377 "comment" => "construct Shrs: Srawi(a, const): c = a >> const",
378 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
379 "emit" => '. sraw %D0, %S0, %C',
382 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
389 "comment" => "construct ???: Rlwnm(a, b): c = a ROTL b",
390 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
391 "emit" => '. rlwnm %D0, %S0, %S1',
396 "comment" => "construct ???: Rlwinm(a, b_const, c_const, d_const): (m = MASK(c, d)) e = (a ROTL b) & m",
397 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
398 "emit" => '. rlwinm %D0, %S0, %RLWIMI',
401 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
408 "comment" => "construct Minus: Neg(a) = -a",
409 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
410 "emit" => '. neg %D0, %S0',
415 "comment" => "construct Not: Not(a) = !a",
416 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
417 "emit" => '. nor %D0, %S0, %S0',
422 "comment" => "construct Sign extension of byte: Extsb(char a) = (int) a",
423 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
424 "emit" => '. extsb %D0, %S0',
429 "comment" => "construct Sign extension of halfword: Extsh(char a) = (short) a",
430 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
431 "emit" => '. extsh %D0, %S0',
436 "comment" => "construct Div (signed): Div(a, b) = a div b",
437 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
438 "emit" => '. divw %D0, %S0, %S1',
443 "comment" => "construct Div (unsigned): Div(a, b) = a div b",
444 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
445 "emit" => '. divwu %D0, %S0, %S1',
450 "comment" => "construct Mtctr: Ctr = a",
451 "reg_req" => { "in" => [ "gp" ], "out" => [ "count" ] },
452 "emit" => '. mtctr %S0',
461 "comment" => "Const (high-level node)",
462 "reg_req" => { "out" => [ "gp" ] },
465 return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
472 "comment" => "float Const (high-level node)",
473 "reg_req" => { "out" => [ "fp" ] },
476 return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
483 "comment" => "SymConst (high-level node)",
484 "reg_req" => { "out" => [ "gp" ] },
487 return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
494 "comment" => "construct unknown register",
495 "reg_req" => { "out" => [ "gp" ] },
496 "emit" => '. \t\t /* use %D0 as uninitialized value */',
506 "comment" => "construct unknown float register",
507 "reg_req" => { "out" => [ "fp" ] },
508 "emit" => '. \t\t /* use %D0 as uninitialized value */',
518 "comment" => "construct unknown condition register",
519 "reg_req" => { "out" => [ "condition" ] },
520 "emit" => '. \t\t /* use %D0 as uninitialized value */',
530 "comment" => "load constant (16bit with sign extension)",
531 "reg_req" => { "out" => [ "gp" ] },
532 "emit" => '. addi %D0, 0, %C',
535 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
540 "op_flags" => "L|X|Y",
541 "comment" => "branch somewhere",
542 "reg_req" => { "in" => [ "condition" ], "out" => [ "none", "none" ] },
545 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
551 "comment" => "construct LoopCopy(src, dest, count, mem): Copy count words from src to dest",
552 "reg_req" => { "in" => [ "gp", "gp", "count", "none" ], "out" => [ "none", "in_r1", "in_r2", "in_r3", "gp" ] },
556 "op_flags" => "L|X|Y",
557 "comment" => "construct Switch(selector): Jump to whatever",
558 "reg_req" => { "in" => [ "gp", "gp", "condition" ], "out" => [ "none" ] },
561 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
568 "comment" => "load the constant to higher 16 bit of register",
569 "reg_req" => { "out" => [ "gp" ] },
570 "emit" => '. addis %D0, 0, %C',
571 "attr" => "ppc32_attr_offset_mode om, tarval *tv, ident *id",
574 attr->offset_mode = om;
576 attr->content_type = ppc32_ac_Const;
577 attr->data.constant_tarval = tv;
580 attr->content_type = ppc32_ac_SymConst;
581 attr->data.symconst_ident = id;
586 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
593 "comment" => "ors constant with register",
594 "reg_req" => { "in" => [ "gp"], "out" => [ "gp" ] },
595 "emit" => '. ori %D0, %S0, %C',
598 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
605 "comment" => "ands constant with register with cr0 update",
606 "reg_req" => { "in" => [ "gp"], "out" => [ "gp", "cr0" ] },
607 "emit" => '. andi. %D0, %S0,%C',
610 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
616 "comment" => "construct Cmp: Cmp(a, b) = Flags in crX",
617 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "condition" ] },
618 "emit" => '. cmp %D0, 0, %S0, %S1',
623 "comment" => "construct Cmp immediate: Cmpi(a, const) = Flags in crX",
624 "reg_req" => { "in" => [ "gp" ], "out" => [ "condition" ] },
625 "emit" => '. cmpi %D0, 0, %S0, %C',
628 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
635 "comment" => "construct Cmp logical: Cmpl(a, b) = Flags in crX",
636 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "condition" ] },
637 "emit" => '. cmpl %D0, 0, %S0, %S1',
642 "comment" => "construct Cmp logical immediate: Cmpli(a, const) = Flags in crX",
643 "reg_req" => { "in" => [ "gp" ], "out" => [ "condition" ] },
644 "emit" => '. cmpli %D0, 0, %S0, %C',
647 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
657 "state" => "exc_pinned",
658 "comment" => "construct Load (byte unsigned): Load(ptr, mem) = LD ptr -> reg",
659 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "none" ] },
660 "emit" => '. lbz %D0, %O(%S0)',
663 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
665 "outs" => [ "res", "M" ],
671 "state" => "exc_pinned",
672 "comment" => "construct Load (halfword unsigned): Load(ptr, mem) = LD ptr -> reg",
673 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "none" ] },
674 "emit" => '. lhz %D0, %O(%S0)',
677 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
679 "outs" => [ "res", "M" ],
685 "state" => "exc_pinned",
686 "comment" => "construct Load (halfword signed): Load(ptr, mem) = LD ptr -> reg",
687 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "none" ] },
688 "emit" => '. lha %D0, %O(%S0)',
691 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
693 "outs" => [ "res", "M" ],
699 "state" => "exc_pinned",
700 "comment" => "construct Load (word): Load(ptr, mem) = LD ptr -> reg",
701 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "none" ] },
702 "emit" => '. lwz %D0, %O(%S0)',
705 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
707 "outs" => [ "res", "M" ],
713 "state" => "exc_pinned",
714 "comment" => "construct Load with update (word): Load(ptr, mem) = LD ptr -> reg",
715 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "in_r1", "none"] },
716 "emit" => '. lwzu %D0, %O(%S0)',
719 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
721 "outs" => [ "res", "ptr", "M" ],
726 "state" => "exc_pinned",
727 "comment" => "construct Store: Store (byte) (ptr, val, mem) = ST ptr,val",
728 "reg_req" => { "in" => [ "!r0", "gp", "none" ], "out" => [ "none" ] },
729 "emit" => '. stb %S1, %O(%S0)',
732 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
739 "state" => "exc_pinned",
740 "comment" => "construct Store: Store (halfword) (ptr, val, mem) = ST ptr,val",
741 "reg_req" => { "in" => [ "!r0", "gp", "none" ], "out" => [ "none" ] },
742 "emit" => '. sth %S1, %O(%S0)',
745 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
752 "state" => "exc_pinned",
753 "comment" => "construct Store: Store (word) (ptr, val, mem) = ST ptr,val",
754 "reg_req" => { "in" => [ "!r0", "gp", "none" ], "out" => [ "none" ] },
755 "emit" => '. stw %S1, %O(%S0)',
758 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
763 #--------------------------------------------------------#
766 # | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
767 # | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
768 # | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
769 # |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
770 #--------------------------------------------------------#
772 # commutative operations
777 "comment" => "construct FP Add: Add(a, b) = Add(b, a) = a + b",
778 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
779 "emit" => '. fadd %D0, %S0, %S1',
785 "comment" => "construct FP Add (single): Add(a, b) = Add(b, a) = a + b",
786 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
787 "emit" => '. fadds %D0, %S0, %S1',
792 "comment" => "construct FP Mul: Mul(a, b) = Mul(b, a) = a * b",
793 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
794 "emit" => '. fmul %D0, %S0, %S1',
799 "comment" => "construct FP Mul (single): Mul(a, b) = Mul(b, a) = a * b",
800 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
801 "emit" => '. fmuls %D0, %S0, %S1',
805 "comment" => "construct FP Negation: fNeg(a) = -a",
806 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
807 "emit" => '. fneg %D0, %S0',
814 "comment" => "construct FP Max: Max(a, b) = Max(b, a) = a > b ? a : b",
815 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
816 "emit" => '. fmax %S0, %S1, %D0',
822 "comment" => "construct FP Min: Min(a, b) = Min(b, a) = a < b ? a : b",
823 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
824 "emit" => '. fmin %S0, %S1, %D0',
827 # not commutative operations
831 "comment" => "construct FP Sub: Sub(a, b) = a - b",
832 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
833 "emit" => '. fsub %D0, %S0, %S1',
838 "comment" => "construct FP Sub (single): Sub(a, b) = a - b",
839 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
840 "emit" => '. fsubs %D0, %S0, %S1',
844 "comment" => "construct FP Div: Div(a, b) = a / b",
845 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
846 "emit" => '. fdiv %D0, %S0, %S1',
850 "comment" => "construct FP Div (single): Div(a, b) = a / b",
851 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
852 "emit" => '. fdivs %D0, %S0, %S1',
857 "comment" => "construct FP Minus: fMinus(a) = -a",
858 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
859 "emit" => '. fneg %D0, %S0',
864 "comment" => "construct FP Convert to integer word: fCtiw(a) = (int) a",
865 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
866 "emit" => '. fctiw %D0, %S0',
871 "comment" => "construct FP Round to single: fRsp(a) = (float) a",
872 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
873 "emit" => '. frsp %D0, %S0',
878 "comment" => "construct FP Abs: fAbs(a) = |a|",
879 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
880 "emit" => '. fabs %D0, %S0',
885 "comment" => "construct FP Cmp unordered: fCmpu(a, b) = a ? b",
886 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "condition" ] },
887 "emit" => '. fcmpu %D0, %S0, %S1',
894 # "irn_flags" => "R",
895 # "comment" => "represents a FP constant",
896 # "reg_req" => { "out" => [ "fp" ] },
897 # "emit" => '. fmov %C, %D0',
900 # /* TODO: compare fConst attributes */
908 "comment" => "construct unknown floating point register",
909 "reg_req" => { "out" => [ "fp" ] },
910 "emit" => '. \t\t /* use %D0 as uninitialized value */',
922 "state" => "exc_pinned",
923 "comment" => "construct FP Load (double): Load(ptr, mem) = LD ptr",
924 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "fp", "none" ] },
925 "emit" => '. lfd %D0, %O(%S0)',
928 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
930 "outs" => [ "res", "M" ],
936 "state" => "exc_pinned",
937 "comment" => "construct FP Load (single): Load(ptr, mem) = LD ptr",
938 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "fp","none" ] },
939 "emit" => '. lfs %D0, %O(%S0)',
942 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
944 "outs" => [ "res", "M" ],
949 "state" => "exc_pinned",
950 "comment" => "construct Store (double): Store(ptr, val, mem) = ST ptr,val",
951 "reg_req" => { "in" => [ "!r0", "fp", "none" ], "out" => [ "none" ] },
952 "emit" => '. stfd %S1, %O(%S0)',
955 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
962 "state" => "exc_pinned",
963 "comment" => "construct Store (single): Store(ptr, val, mem) = ST ptr,val",
964 "reg_req" => { "in" => [ "!r0", "fp", "none" ], "out" => [ "none" ] },
965 "emit" => '. stfs %S1, %O(%S0)',
968 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);