3 # This is a template specification for the Firm-Backend
5 # the cpu architecture (ia32, ia64, mips, sparc, ppc32, ...)
9 $comment_string = "/*";
11 # The node description is done as a perl hash initializer with the
12 # following structure:
17 # "op_flags" => "N|L|C|X|I|F|Y|H|c|K",
18 # "irn_flags" => "R|N|I"
19 # "arity" => "0|1|2|3 ... |variable|dynamic|any",
20 # "state" => "floats|pinned|mem_pinned|exc_pinned",
22 # { "type" => "type 1", "name" => "name 1" },
23 # { "type" => "type 2", "name" => "name 2" },
26 # "comment" => "any comment for constructor",
27 # "reg_req" => { "in" => [ "reg_class|register" ], "out" => [ "reg_class|register|in_rX" ] },
28 # "cmp_attr" => "c source code for comparing node attributes",
29 # "emit" => "emit code with templates",
30 # "rd_constructor" => "c source code which constructs an ir_node"
33 # ... # (all nodes you need to describe)
35 # ); # close the %nodes initializer
37 # op_flags: flags for the operation, OPTIONAL (default is "N")
38 # the op_flags correspond to the firm irop_flags:
41 # C irop_flag_commutative
42 # X irop_flag_cfopcode
43 # I irop_flag_ip_cfopcode
46 # H irop_flag_highlevel
47 # c irop_flag_constlike
50 # irn_flags: special node flags, OPTIONAL (default is 0)
51 # following irn_flags are supported:
54 # I ignore for register allocation
56 # state: state of the operation, OPTIONAL (default is "floats")
58 # arity: arity of the operation, MUST NOT BE OMITTED
60 # args: the OPTIONAL arguments of the node constructor (debug, irg and block
61 # are always the first 3 arguments and are always autmatically
63 # If this key is missing the following arguments will be created:
64 # for i = 1 .. arity: ir_node *op_i
67 # outs: if a node defines more than one output, the names of the projections
68 # nodes having outs having automatically the mode mode_T
70 # comment: OPTIONAL comment for the node constructor
72 # rd_constructor: for every operation there will be a
73 # new_rd_<arch>_<op-name> function with the arguments from above
74 # which creates the ir_node corresponding to the defined operation
75 # you can either put the complete source code of this function here
77 # This key is OPTIONAL. If omitted, the following constructor will
79 # if (!op_<arch>_<op-name>) assert(0);
83 # res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
86 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
90 # 1 - caller save (register must be saved by the caller of a function)
91 # 2 - callee save (register must be saved by the called function)
92 # 4 - ignore (do not assign this register)
93 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
96 { "name" => "r0", "type" => 1 },
97 { "name" => "r2", "type" => 1 },
98 { "name" => "r3", "type" => 1 },
99 { "name" => "r4", "type" => 1 },
100 { "name" => "r5", "type" => 1 },
101 { "name" => "r6", "type" => 1 },
102 { "name" => "r7", "type" => 1 },
103 { "name" => "r8", "type" => 1 },
104 { "name" => "r9", "type" => 1 },
105 { "name" => "r10", "type" => 1 },
106 # { "name" => "r11", "type" => 1 },
107 # { "name" => "r12", "type" => 1 },
108 { "name" => "r13", "type" => 2 },
109 { "name" => "r14", "type" => 2 },
110 { "name" => "r15", "type" => 2 },
111 # { "name" => "r16", "type" => 2 },
112 # { "name" => "r17", "type" => 2 },
113 # { "name" => "r18", "type" => 2 },
114 # { "name" => "r19", "type" => 2 },
115 # { "name" => "r20", "type" => 2 },
116 # { "name" => "r21", "type" => 2 },
117 # { "name" => "r22", "type" => 2 },
118 # { "name" => "r23", "type" => 2 },
119 # { "name" => "r24", "type" => 2 },
120 # { "name" => "r25", "type" => 2 },
121 # { "name" => "r26", "type" => 2 },
122 # { "name" => "r27", "type" => 2 },
123 # { "name" => "r28", "type" => 2 },
124 # { "name" => "r29", "type" => 2 },
125 # { "name" => "r30", "type" => 2 },
126 { "name" => "r31", "type" => 2 },
127 { "name" => "r1", "type" => 6 }, # this is our stackpointer
128 { "mode" => "mode_P" }
131 # { "name" => "f0", "type" => 1 }, # => reserved for FP Perm
132 { "name" => "f1", "type" => 1 },
133 { "name" => "f2", "type" => 1 },
134 { "name" => "f3", "type" => 1 },
135 { "name" => "f4", "type" => 1 },
136 { "name" => "f5", "type" => 1 },
137 { "name" => "f6", "type" => 1 },
138 { "name" => "f7", "type" => 1 },
139 { "name" => "f8", "type" => 1 },
140 { "name" => "f9", "type" => 1 },
141 { "name" => "f10", "type" => 1 },
142 { "name" => "f11", "type" => 1 },
143 { "name" => "f12", "type" => 1 },
144 { "name" => "f13", "type" => 1 },
145 { "name" => "f14", "type" => 2 },
146 { "name" => "f15", "type" => 2 },
147 { "name" => "f16", "type" => 2 },
148 # { "name" => "f17", "type" => 2 },
149 # { "name" => "f18", "type" => 2 },
150 # { "name" => "f19", "type" => 2 },
151 # { "name" => "f20", "type" => 2 },
152 # { "name" => "f21", "type" => 2 },
153 # { "name" => "f22", "type" => 2 },
154 # { "name" => "f23", "type" => 2 },
155 # { "name" => "f24", "type" => 2 },
156 # { "name" => "f25", "type" => 2 },
157 # { "name" => "f26", "type" => 2 },
158 # { "name" => "f27", "type" => 2 },
159 # { "name" => "f28", "type" => 2 },
160 # { "name" => "f29", "type" => 2 },
161 # { "name" => "f30", "type" => 2 },
162 # { "name" => "f31", "type" => 2 },
163 { "mode" => "mode_D" }
166 { "name" => "cr0", "type" => 1 },
167 { "name" => "cr1", "type" => 1 },
168 { "name" => "cr2", "type" => 2 },
169 { "name" => "cr3", "type" => 2 },
170 { "name" => "cr4", "type" => 2 },
171 { "name" => "cr5", "type" => 1 },
172 { "name" => "cr6", "type" => 1 },
173 # { "name" => "cr7", "type" => 1 }, # => reserved for Condition Perm
174 { "mode" => "mode_P" } # real mode is 4 bit, but doesn't matter ...
177 { "name" => "lr", "type" => 4 }, # 3
178 { "mode" => "mode_P" }
181 { "name" => "ctr", "type" => 1 },
182 { "mode" => "mode_P" }
186 #--------------------------------------------------#
189 # _ __ _____ __ _ _ __ ___ _ __ ___ #
190 # | '_ \ / _ \ \ /\ / / | | '__| / _ \| '_ \/ __| #
191 # | | | | __/\ V V / | | | | (_) | |_) \__ \ #
192 # |_| |_|\___| \_/\_/ |_|_| \___/| .__/|___/ #
195 #--------------------------------------------------#
199 #-----------------------------------------------------------------#
202 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
203 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
204 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
205 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
208 #-----------------------------------------------------------------#
210 # commutative operations
215 "comment" => "construct Add: Add(a, b) = Add(b, a) = a + b",
216 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
217 "emit" => '. add %D1, %S1, %S2 /* Add(%S1, %S2) -> %D1, (%A1, %A2) */',
223 "comment" => "construct Add: Addi(a, const) = Addi(const, a) = a + const",
224 "reg_req" => { "in" => [ "!r0" ], "out" => [ "gp" ] },
225 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
226 "emit" => '. addi %D1, %S1, %C /* Addi(%S1, %C) -> %D1, (%A1, const) */',
229 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
237 "comment" => "construct Mul: Mullw(a, b) = Mullw(b, a) = lo32(a * b)",
238 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
239 "emit" => '. mullw %D1, %S1, %S2 /* Mullw(%S1, %S2) -> %D1, (%A1, %A2) */',
245 "comment" => "construct Mul: Mulhw(a, b) = Mulhw(b, a) = hi32(a * b)",
246 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
247 "emit" => '. mulhw %D1, %S1, %S2 /* Mulhw(%S1, %S2) -> %D1, (%A1, %A2) */',
253 "comment" => "construct Mul: Mulhwu(a, b) = Mulhwu(b, a) = hi32(a * b)",
254 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
255 "emit" => '. mulhwu %D1, %S1, %S2 /* Mulhwu(%S1, %S2) -> %D1, (%A1, %A2) */',
259 # "irn_flags" => "R",
260 # "comment" => "construct Mul: Mul(a, const) = Mul(const, a) = a * const",
261 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
262 # "emit" => '. mul %S1, %C, %D1 /* signed Mul(%C, %S1) -> %D1, (%A1, const) */',
268 "comment" => "construct And: And(a, b) = And(b, a) = a AND b",
269 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
270 "emit" => '. and %D1, %S1, %S2 /* And(%S1, %S2) -> %D1, (%A1, %A2) */',
274 # "irn_flags" => "R",
275 # "comment" => "construct And: And(a, const) = And(const, a) = a AND const",
276 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
277 # "emit" => '. and %S1, %C, %D1 /* And(%C, %S1) -> %D1, (%A1, const) */',
283 "comment" => "construct Or: Or(a, b) = Or(b, a) = a OR b",
284 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
285 "emit" => '. or %D1, %S1, %S2 /* Or(%S1, %S2) -> %D1, (%A1, %A2) */',
290 # "irn_flags" => "R",
291 # "comment" => "construct Or: Or(a, const) = Or(const, a) = a OR const",
292 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
293 # "emit" => '. or %S1, %C, %D1 /* Or(%C, %S1) -> %D1, (%A1, const) */',
299 "comment" => "construct Xor: Xor(a, b) = Xor(b, a) = a XOR b",
300 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
301 "emit" => '. xor %D1, %S1, %S2 /* Xor(%S1, %S2) -> %D1, (%A1, %A2) */',
305 # "irn_flags" => "R",
306 # "comment" => "construct Xor: Xor(a, const) = Xor(const, a) = a EOR const",
307 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
308 # "emit" => '. xor %S1, %C, %D1 /* Xor(%C, %S1) -> %D1, (%A1, const) */',
311 # not commutative operations
315 "comment" => "construct Sub: Sub(a, b) = a - b",
316 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
317 "emit" => '. sub %D1, %S1, %S2 /* Sub(%S1, %S2) -> %D1, (%A1, %A2) */',
321 # "irn_flags" => "R",
322 # "comment" => "construct Sub: Sub(a, const) = a - const",
323 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
324 # "emit" => '. subl %S1, %C, %D1 /* Sub(%S1, %C) -> %D1, (%A1, const) */',
329 "comment" => "construct Shl: Shl(a, b) = a << b",
330 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
331 "emit" => '. slw %D1, %S1, %S2 /* Shl(%S1, %S2) -> %D1, (%A1, %A2) */',
335 # "irn_flags" => "R",
336 # "comment" => "construct Shl: Shl(a, const) = a << const",
337 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
338 # "emit" => '. shl %S1, %C, %D1 /* Shl(%S1, %C) -> %D1, (%A1, const) */',
343 "comment" => "construct Shr: Srw(a, b): c = a >> b",
344 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
345 "emit" => '. srw %D1, %S1, %S2 /* Srw(%S1, %S2) -> %D1, (%A1, %A2) */',
349 # "irn_flags" => "R",
350 # "comment" => "construct Shr: Shr(a, const) = a >> const",
351 # "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
352 # "emit" => '. shr %S1, %C, %D1 /* Shr(%S1, %C) -> %D1, (%A1, const) */',
357 "comment" => "construct Shrs: Sraw(a, b): c = a >> b",
358 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
359 "emit" => '. sraw %D1, %S1, %S2 /* Sraw(%S1, %S2) -> %D1, (%A1, %A2) */',
364 "comment" => "construct Shrs: Srawi(a, const): c = a >> const",
365 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
366 "emit" => '. sraw %D1, %S1, %C /* Sraw(%S1, %C) -> %D1, (%A1, const) */',
369 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
376 "comment" => "construct ???: Rlwnm(a, b): c = a ROTL b",
377 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
378 "emit" => '. rlwnm %D1, %S1, %S2 /* Rlwnm(%S1, %S2) -> %D1, (%A1, %A2) */',
383 "comment" => "construct ???: Rlwinm(a, b_const, c_const, d_const): (m = MASK(c, d)) e = (a ROTL b) & m",
384 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
385 "emit" => '. rlwinm %D1, %S1, %ppc32_rlwimi_emit_helper /* Rlwinm(%S1, %ppc32_rlwimi_emit_helper) -> %D1, (%A1) */',
388 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
395 "comment" => "construct Minus: Neg(a) = -a",
396 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
397 "emit" => '. neg %D1, %S1 /* Neg(%S1) -> %D1, (%A1) */',
402 "comment" => "construct Not: Not(a) = !a",
403 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
404 "emit" => '. nor %D1, %S1, %S1 /* Not(%S1) -> %D1, (%A1) */',
409 "comment" => "construct Sign extension of byte: Extsb(char a) = (int) a",
410 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
411 "emit" => '. extsb %D1, %S1 /* Extsb(%S1) -> %D1, (%A1) */',
416 "comment" => "construct Sign extension of halfword: Extsh(char a) = (short) a",
417 "reg_req" => { "in" => [ "gp" ], "out" => [ "gp" ] },
418 "emit" => '. extsh %D1, %S1 /* Extsh(%S1) -> %D1, (%A1) */',
423 "comment" => "construct Div (signed): Div(a, b) = a div b",
424 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
425 "emit" => '. divw %D1, %S1, %S2 /* Div(%S1, %S2) -> %D1, (%A1, %A2) */',
430 "comment" => "construct Div (unsigned): Div(a, b) = a div b",
431 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "gp" ] },
432 "emit" => '. divwu %D1, %S1, %S2 /* Div(%S1, %S2) -> %D1, (%A1, %A2) */',
437 "comment" => "construct Mtctr: Ctr = a",
438 "reg_req" => { "in" => [ "gp" ], "out" => [ "count" ] },
439 "emit" => '. mtctr %S1 /* Mtctr(%S1) -> %D1, (%A1) */',
448 "comment" => "Const (high-level node)",
449 "reg_req" => { "out" => [ "gp" ] },
452 return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
459 "comment" => "float Const (high-level node)",
460 "reg_req" => { "out" => [ "fp" ] },
463 return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
470 "comment" => "SymConst (high-level node)",
471 "reg_req" => { "out" => [ "gp" ] },
474 return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
481 "comment" => "construct unknown register",
482 "reg_req" => { "out" => [ "gp" ] },
483 "emit" => '. \t\t /* use %D1 as uninitialized value */',
493 "comment" => "construct unknown float register",
494 "reg_req" => { "out" => [ "fp" ] },
495 "emit" => '. \t\t /* use %D1 as uninitialized value */',
505 "comment" => "construct unknown condition register",
506 "reg_req" => { "out" => [ "condition" ] },
507 "emit" => '. \t\t /* use %D1 as uninitialized value */',
517 "comment" => "load constant (16bit with sign extension)",
518 "reg_req" => { "out" => [ "gp" ] },
519 "emit" => '. addi %D1, 0, %C /* lower 16 bit of %C (sign extended) -> %D1 */',
522 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
527 "op_flags" => "L|X|Y",
528 "comment" => "branch somewhere",
529 "reg_req" => { "in" => [ "condition" ], "out" => [ "none", "none" ] },
532 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
538 "comment" => "construct LoopCopy(src, dest, count, mem): Copy count words from src to dest",
539 "reg_req" => { "in" => [ "gp", "gp", "count", "none" ], "out" => [ "none", "in_r1", "in_r2", "in_r3", "gp" ] },
543 "op_flags" => "L|X|Y",
544 "comment" => "construct Switch(selector): Jump to whatever",
545 "reg_req" => { "in" => [ "gp", "gp", "condition" ], "out" => [ "none" ] },
548 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
555 "comment" => "load the constant to higher 16 bit of register",
556 "reg_req" => { "out" => [ "gp" ] },
557 "emit" => '. addis %D1, 0, %C /* %C << 16 -> %D1 */',
558 "attr" => "ppc32_attr_offset_mode om, tarval *tv, ident *id",
561 attr->offset_mode = om;
563 attr->content_type = ppc32_ac_Const;
564 attr->data.constant_tarval = tv;
567 attr->content_type = ppc32_ac_SymConst;
568 attr->data.symconst_ident = id;
573 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
580 "comment" => "ors constant with register",
581 "reg_req" => { "in" => [ "gp"], "out" => [ "gp" ] },
582 "emit" => '. ori %D1, %S1, %C /* Ori(%S1,%C) -> %D1 */',
585 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
592 "comment" => "ands constant with register with cr0 update",
593 "reg_req" => { "in" => [ "gp"], "out" => [ "gp", "cr0" ] },
594 "emit" => '. andi. %D1, %S1,%C /* Andi(%S1,%C) -> %D1 (%D2 changed) */',
597 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
603 "comment" => "construct Cmp: Cmp(a, b) = Flags in crX",
604 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "condition" ] },
605 "emit" => '. cmp %D1, 0, %S1, %S2 /* Cmp(%S1, %S2) -> %D1, (%A1, %A2) */',
610 "comment" => "construct Cmp immediate: Cmpi(a, const) = Flags in crX",
611 "reg_req" => { "in" => [ "gp" ], "out" => [ "condition" ] },
612 "emit" => '. cmpi %D1, 0, %S1, %C /* Cmpi(%S1, %C) -> %D1, (%A1) */',
615 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
622 "comment" => "construct Cmp logical: Cmpl(a, b) = Flags in crX",
623 "reg_req" => { "in" => [ "gp", "gp" ], "out" => [ "condition" ] },
624 "emit" => '. cmpl %D1, 0, %S1, %S2 /* Cmpl(%S1, %S2) -> %D1, (%A1, %A2) */',
629 "comment" => "construct Cmp logical immediate: Cmpli(a, const) = Flags in crX",
630 "reg_req" => { "in" => [ "gp" ], "out" => [ "condition" ] },
631 "emit" => '. cmpli %D1, 0, %S1, %C /* Cmpli(%S1, %C) -> %D1, (%A1) */',
634 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
644 "state" => "exc_pinned",
645 "comment" => "construct Load (byte unsigned): Load(ptr, mem) = LD ptr -> reg",
646 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "none" ] },
647 "emit" => '. lbz %D1, %O(%S1) /* Load(%O(%S1)) -> %D1, (%A1) */',
650 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
652 "outs" => [ "res", "M" ],
658 "state" => "exc_pinned",
659 "comment" => "construct Load (halfword unsigned): Load(ptr, mem) = LD ptr -> reg",
660 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "none" ] },
661 "emit" => '. lhz %D1, %O(%S1) /* Load(%O(%S1)) -> %D1, (%A1) */',
664 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
666 "outs" => [ "res", "M" ],
672 "state" => "exc_pinned",
673 "comment" => "construct Load (halfword signed): Load(ptr, mem) = LD ptr -> reg",
674 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "none" ] },
675 "emit" => '. lha %D1, %O(%S1) /* Load(%O(%S1)) -> %D1, (%A1) */',
678 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
680 "outs" => [ "res", "M" ],
686 "state" => "exc_pinned",
687 "comment" => "construct Load (word): Load(ptr, mem) = LD ptr -> reg",
688 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "none" ] },
689 "emit" => '. lwz %D1, %O(%S1) /* Load(%O(%S1)) -> %D1, (%A1) */',
692 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
694 "outs" => [ "res", "M" ],
700 "state" => "exc_pinned",
701 "comment" => "construct Load with update (word): Load(ptr, mem) = LD ptr -> reg",
702 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "gp", "in_r1", "none"] },
703 "emit" => '. lwzu %D1, %O(%S1) /* Load(%O(%S1)) -> %D1, %S1 += %O, (%A1) */',
706 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
708 "outs" => [ "res", "ptr", "M" ],
713 "state" => "exc_pinned",
714 "comment" => "construct Store: Store (byte) (ptr, val, mem) = ST ptr,val",
715 "reg_req" => { "in" => [ "!r0", "gp", "none" ] },
716 "emit" => '. stb %S2, %O(%S1) /* Store(%S2) -> (%S1), (%A1, %A2) */',
719 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
726 "state" => "exc_pinned",
727 "comment" => "construct Store: Store (halfword) (ptr, val, mem) = ST ptr,val",
728 "reg_req" => { "in" => [ "!r0", "gp", "none" ] },
729 "emit" => '. sth %S2, %O(%S1) /* Store(%S2) -> (%S1), (%A1, %A2) */',
732 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
739 "state" => "exc_pinned",
740 "comment" => "construct Store: Store (word) (ptr, val, mem) = ST ptr,val",
741 "reg_req" => { "in" => [ "!r0", "gp", "none" ] },
742 "emit" => '. stw %S2, %O(%S1) /* Store(%S2) -> (%S1), (%A1, %A2) */',
745 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
750 #--------------------------------------------------------#
753 # | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
754 # | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
755 # | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
756 # |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
757 #--------------------------------------------------------#
759 # commutative operations
764 "comment" => "construct FP Add: Add(a, b) = Add(b, a) = a + b",
765 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
766 "emit" => '. fadd %D1, %S1, %S2 /* FP Add(%S1, %S2) -> %D1 */',
772 "comment" => "construct FP Add (single): Add(a, b) = Add(b, a) = a + b",
773 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
774 "emit" => '. fadds %D1, %S1, %S2 /* FP Add(%S1, %S2) -> %D1 */',
779 "comment" => "construct FP Mul: Mul(a, b) = Mul(b, a) = a * b",
780 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
781 "emit" => '. fmul %D1, %S1, %S2 /* FP Mul(%S1, %S2) -> %D1 */',
786 "comment" => "construct FP Mul (single): Mul(a, b) = Mul(b, a) = a * b",
787 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
788 "emit" => '. fmuls %D1, %S1, %S2 /* FP Mul(%S1, %S2) -> %D1 */',
792 "comment" => "construct FP Negation: fNeg(a) = -a",
793 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
794 "emit" => '. fneg %D1, %S1 /* FP fNeg(%S1) -> %D1 */',
801 "comment" => "construct FP Max: Max(a, b) = Max(b, a) = a > b ? a : b",
802 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
803 "emit" => '. fmax %S1, %S2, %D1 /* FP Max(%S1, %S2) -> %D1 */',
809 "comment" => "construct FP Min: Min(a, b) = Min(b, a) = a < b ? a : b",
810 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
811 "emit" => '. fmin %S1, %S2, %D1 /* FP Min(%S1, %S2) -> %D1 */',
814 # not commutative operations
818 "comment" => "construct FP Sub: Sub(a, b) = a - b",
819 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
820 "emit" => '. fsub %D1, %S1, %S2 /* FP Sub(%S1, %S2) -> %D1 */',
825 "comment" => "construct FP Sub (single): Sub(a, b) = a - b",
826 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
827 "emit" => '. fsub %D1, %S1, %S2 /* FP Sub(%S1, %S2) -> %D1 */',
831 "comment" => "construct FP Div: Div(a, b) = a / b",
832 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
833 "emit" => '. fdiv %D1, %S1, %S2 /* FP Div(%S1, %S2) -> %D1 */',
837 "comment" => "construct FP Div (single): Div(a, b) = a / b",
838 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "fp" ] },
839 "emit" => '. fdivs %D1, %S1, %S2 /* FP Div(%S1, %S2) -> %D1 */',
844 "comment" => "construct FP Minus: fMinus(a) = -a",
845 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
846 "emit" => '. fneg %D1, %S1 /* FP fMinus(%S1) -> %D1 */',
851 "comment" => "construct FP Convert to integer word: fCtiw(a) = (int) a",
852 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
853 "emit" => '. fctiw %D1, %S1 /* FP fCtiw(%S1) -> %D1 */',
858 "comment" => "construct FP Round to single: fRsp(a) = (float) a",
859 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
860 "emit" => '. frsp %D1, %S1 /* FP fRsp(%S1) -> %D1 */',
865 "comment" => "construct FP Abs: fAbs(a) = |a|",
866 "reg_req" => { "in" => [ "fp" ], "out" => [ "fp" ] },
867 "emit" => '. fabs %D1, %S1 /* FP fAbs(%S1) -> %D1 */',
872 "comment" => "construct FP Cmp unordered: fCmpu(a, b) = a ? b",
873 "reg_req" => { "in" => [ "fp", "fp" ], "out" => [ "condition" ] },
874 "emit" => '. fcmpu %D1, %S1, %S2 /* FP fCmpu(%S1, %S2) -> %D1 */',
881 # "irn_flags" => "R",
882 # "comment" => "represents a FP constant",
883 # "reg_req" => { "out" => [ "fp" ] },
884 # "emit" => '. fmov %C, %D1 /* Mov fConst into register */',
887 # /* TODO: compare fConst attributes */
895 "comment" => "construct unknown floating point register",
896 "reg_req" => { "out" => [ "fp" ] },
897 "emit" => '. \t\t /* use %D1 as uninitialized value */',
909 "state" => "exc_pinned",
910 "comment" => "construct FP Load (double): Load(ptr, mem) = LD ptr",
911 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "fp", "none" ] },
912 "emit" => '. lfd %D1, %O(%S1) /* Load(%O(%S1)) -> %D1 */',
915 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
917 "outs" => [ "res", "M" ],
923 "state" => "exc_pinned",
924 "comment" => "construct FP Load (single): Load(ptr, mem) = LD ptr",
925 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "fp","none" ] },
926 "emit" => '. lfs %D1, %O(%S1) /* Load(%O(%S1)) -> %D1 */',
929 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
931 "outs" => [ "res", "M" ],
936 "state" => "exc_pinned",
937 "comment" => "construct Store (double): Store(ptr, val, mem) = ST ptr,val",
938 "reg_req" => { "in" => [ "!r0", "fp", "none" ] },
939 "emit" => '. stfd %S2, %O(%S1) /* Store(%S2) -> (%S1), (%A1, %A2) */',
942 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
949 "state" => "exc_pinned",
950 "comment" => "construct Store (single): Store(ptr, val, mem) = ST ptr,val",
951 "reg_req" => { "in" => [ "!r0", "fp", "none" ] },
952 "emit" => '. stfs %S2, %O(%S1) /* Store(%S2) -> (%S1), (%A1, %A2) */',
955 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);