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 # comment: OPTIONAL comment for the node constructor
69 # rd_constructor: for every operation there will be a
70 # new_rd_<arch>_<op-name> function with the arguments from above
71 # which creates the ir_node corresponding to the defined operation
72 # you can either put the complete source code of this function here
74 # This key is OPTIONAL. If omitted, the following constructor will
76 # if (!op_<arch>_<op-name>) assert(0);
80 # res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
83 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
87 # 1 - caller save (register must be saved by the caller of a function)
88 # 2 - callee save (register must be saved by the called function)
89 # 4 - ignore (do not assign this register)
90 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
92 "general_purpose" => [
93 { "name" => "r0", "type" => 1 },
94 { "name" => "r2", "type" => 1 },
95 { "name" => "r3", "type" => 1 },
96 { "name" => "r4", "type" => 1 },
97 { "name" => "r5", "type" => 1 },
98 { "name" => "r6", "type" => 1 },
99 { "name" => "r7", "type" => 1 },
100 { "name" => "r8", "type" => 1 },
101 { "name" => "r9", "type" => 1 },
102 { "name" => "r10", "type" => 1 },
103 # { "name" => "r11", "type" => 1 },
104 # { "name" => "r12", "type" => 1 },
105 { "name" => "r13", "type" => 2 },
106 { "name" => "r14", "type" => 2 },
107 { "name" => "r15", "type" => 2 },
108 # { "name" => "r16", "type" => 2 },
109 # { "name" => "r17", "type" => 2 },
110 # { "name" => "r18", "type" => 2 },
111 # { "name" => "r19", "type" => 2 },
112 # { "name" => "r20", "type" => 2 },
113 # { "name" => "r21", "type" => 2 },
114 # { "name" => "r22", "type" => 2 },
115 # { "name" => "r23", "type" => 2 },
116 # { "name" => "r24", "type" => 2 },
117 # { "name" => "r25", "type" => 2 },
118 # { "name" => "r26", "type" => 2 },
119 # { "name" => "r27", "type" => 2 },
120 # { "name" => "r28", "type" => 2 },
121 # { "name" => "r29", "type" => 2 },
122 # { "name" => "r30", "type" => 2 },
123 { "name" => "r31", "type" => 2 },
124 { "name" => "r1", "type" => 6 }, # this is our stackpointer
125 { "mode" => "mode_P" }
127 "floating_point" => [
128 # { "name" => "f0", "type" => 1 }, # => reserved for FP Perm
129 { "name" => "f1", "type" => 1 },
130 { "name" => "f2", "type" => 1 },
131 { "name" => "f3", "type" => 1 },
132 { "name" => "f4", "type" => 1 },
133 { "name" => "f5", "type" => 1 },
134 { "name" => "f6", "type" => 1 },
135 { "name" => "f7", "type" => 1 },
136 { "name" => "f8", "type" => 1 },
137 { "name" => "f9", "type" => 1 },
138 { "name" => "f10", "type" => 1 },
139 { "name" => "f11", "type" => 1 },
140 { "name" => "f12", "type" => 1 },
141 { "name" => "f13", "type" => 1 },
142 { "name" => "f14", "type" => 2 },
143 { "name" => "f15", "type" => 2 },
144 { "name" => "f16", "type" => 2 },
145 # { "name" => "f17", "type" => 2 },
146 # { "name" => "f18", "type" => 2 },
147 # { "name" => "f19", "type" => 2 },
148 # { "name" => "f20", "type" => 2 },
149 # { "name" => "f21", "type" => 2 },
150 # { "name" => "f22", "type" => 2 },
151 # { "name" => "f23", "type" => 2 },
152 # { "name" => "f24", "type" => 2 },
153 # { "name" => "f25", "type" => 2 },
154 # { "name" => "f26", "type" => 2 },
155 # { "name" => "f27", "type" => 2 },
156 # { "name" => "f28", "type" => 2 },
157 # { "name" => "f29", "type" => 2 },
158 # { "name" => "f30", "type" => 2 },
159 # { "name" => "f31", "type" => 2 },
160 { "mode" => "mode_D" }
163 { "name" => "cr0", "type" => 1 },
164 { "name" => "cr1", "type" => 1 },
165 { "name" => "cr2", "type" => 2 },
166 { "name" => "cr3", "type" => 2 },
167 { "name" => "cr4", "type" => 2 },
168 { "name" => "cr5", "type" => 1 },
169 { "name" => "cr6", "type" => 1 },
170 # { "name" => "cr7", "type" => 1 }, # => reserved for Condition Perm
171 { "mode" => "mode_P" } # real mode is 4 bit, but doesn't matter ...
174 { "name" => "lr", "type" => 4 }, # 3
175 { "mode" => "mode_P" }
178 { "name" => "ctr", "type" => 1 },
179 { "mode" => "mode_P" }
183 #--------------------------------------------------#
186 # _ __ _____ __ _ _ __ ___ _ __ ___ #
187 # | '_ \ / _ \ \ /\ / / | | '__| / _ \| '_ \/ __| #
188 # | | | | __/\ V V / | | | | (_) | |_) \__ \ #
189 # |_| |_|\___| \_/\_/ |_|_| \___/| .__/|___/ #
192 #--------------------------------------------------#
196 #-----------------------------------------------------------------#
199 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
200 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
201 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
202 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
205 #-----------------------------------------------------------------#
207 # commutative operations
212 "comment" => "construct Add: Add(a, b) = Add(b, a) = a + b",
213 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
214 "emit" => '. add %D1, %S1, %S2 /* Add(%S1, %S2) -> %D1, (%A1, %A2) */'
220 "comment" => "construct Add: Addi(a, const) = Addi(const, a) = a + const",
221 "reg_req" => { "in" => [ "!r0" ], "out" => [ "general_purpose" ] },
222 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
223 "emit" => '. addi %D1, %S1, %C /* Addi(%S1, %C) -> %D1, (%A1, const) */',
226 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
234 "comment" => "construct Mul: Mullw(a, b) = Mullw(b, a) = lo32(a * b)",
235 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
236 "emit" => '. mullw %D1, %S1, %S2 /* Mullw(%S1, %S2) -> %D1, (%A1, %A2) */'
242 "comment" => "construct Mul: Mulhw(a, b) = Mulhw(b, a) = hi32(a * b)",
243 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
244 "emit" => '. mulhw %D1, %S1, %S2 /* Mulhw(%S1, %S2) -> %D1, (%A1, %A2) */'
250 "comment" => "construct Mul: Mulhwu(a, b) = Mulhwu(b, a) = hi32(a * b)",
251 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
252 "emit" => '. mulhwu %D1, %S1, %S2 /* Mulhwu(%S1, %S2) -> %D1, (%A1, %A2) */'
256 # "irn_flags" => "R",
257 # "comment" => "construct Mul: Mul(a, const) = Mul(const, a) = a * const",
258 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
259 # "emit" => '. mul %S1, %C, %D1 /* signed Mul(%C, %S1) -> %D1, (%A1, const) */'
265 "comment" => "construct And: And(a, b) = And(b, a) = a AND b",
266 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
267 "emit" => '. and %D1, %S1, %S2 /* And(%S1, %S2) -> %D1, (%A1, %A2) */'
271 # "irn_flags" => "R",
272 # "comment" => "construct And: And(a, const) = And(const, a) = a AND const",
273 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
274 # "emit" => '. and %S1, %C, %D1 /* And(%C, %S1) -> %D1, (%A1, const) */'
280 "comment" => "construct Or: Or(a, b) = Or(b, a) = a OR b",
281 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
282 "emit" => '. or %D1, %S1, %S2 /* Or(%S1, %S2) -> %D1, (%A1, %A2) */'
287 # "irn_flags" => "R",
288 # "comment" => "construct Or: Or(a, const) = Or(const, a) = a OR const",
289 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
290 # "emit" => '. or %S1, %C, %D1 /* Or(%C, %S1) -> %D1, (%A1, const) */'
296 "comment" => "construct Xor: Xor(a, b) = Xor(b, a) = a XOR b",
297 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
298 "emit" => '. xor %D1, %S1, %S2 /* Xor(%S1, %S2) -> %D1, (%A1, %A2) */'
302 # "irn_flags" => "R",
303 # "comment" => "construct Xor: Xor(a, const) = Xor(const, a) = a EOR const",
304 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
305 # "emit" => '. xor %S1, %C, %D1 /* Xor(%C, %S1) -> %D1, (%A1, const) */'
308 # not commutative operations
312 "comment" => "construct Sub: Sub(a, b) = a - b",
313 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
314 "emit" => '. sub %D1, %S1, %S2 /* Sub(%S1, %S2) -> %D1, (%A1, %A2) */'
318 # "irn_flags" => "R",
319 # "comment" => "construct Sub: Sub(a, const) = a - const",
320 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
321 # "emit" => '. subl %S1, %C, %D1 /* Sub(%S1, %C) -> %D1, (%A1, const) */'
326 "comment" => "construct Shl: Shl(a, b) = a << b",
327 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
328 "emit" => '. slw %D1, %S1, %S2 /* Shl(%S1, %S2) -> %D1, (%A1, %A2) */'
332 # "irn_flags" => "R",
333 # "comment" => "construct Shl: Shl(a, const) = a << const",
334 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
335 # "emit" => '. shl %S1, %C, %D1 /* Shl(%S1, %C) -> %D1, (%A1, const) */'
340 "comment" => "construct Shr: Srw(a, b): c = a >> b",
341 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
342 "emit" => '. srw %D1, %S1, %S2 /* Srw(%S1, %S2) -> %D1, (%A1, %A2) */'
346 # "irn_flags" => "R",
347 # "comment" => "construct Shr: Shr(a, const) = a >> const",
348 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
349 # "emit" => '. shr %S1, %C, %D1 /* Shr(%S1, %C) -> %D1, (%A1, const) */'
354 "comment" => "construct Shrs: Sraw(a, b): c = a >> b",
355 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
356 "emit" => '. sraw %D1, %S1, %S2 /* Sraw(%S1, %S2) -> %D1, (%A1, %A2) */'
361 "comment" => "construct Shrs: Srawi(a, const): c = a >> const",
362 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
363 "emit" => '. sraw %D1, %S1, %C /* Sraw(%S1, %C) -> %D1, (%A1, const) */',
366 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
373 "comment" => "construct ???: Rlwnm(a, b): c = a ROTL b",
374 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
375 "emit" => '. rlwnm %D1, %S1, %S2 /* Rlwnm(%S1, %S2) -> %D1, (%A1, %A2) */'
380 "comment" => "construct ???: Rlwinm(a, b_const, c_const, d_const): (m = MASK(c, d)) e = (a ROTL b) & m",
381 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
382 "emit" => '. rlwinm %D1, %S1, %ppc32_rlwimi_emit_helper /* Rlwinm(%S1, %ppc32_rlwimi_emit_helper) -> %D1, (%A1) */',
385 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
392 "comment" => "construct Minus: Neg(a) = -a",
393 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
394 "emit" => '. neg %D1, %S1 /* Neg(%S1) -> %D1, (%A1) */'
399 "comment" => "construct Not: Not(a) = !a",
400 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
401 "emit" => '. nor %D1, %S1, %S1 /* Not(%S1) -> %D1, (%A1) */'
406 "comment" => "construct Sign extension of byte: Extsb(char a) = (int) a",
407 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
408 "emit" => '. extsb %D1, %S1 /* Extsb(%S1) -> %D1, (%A1) */'
413 "comment" => "construct Sign extension of halfword: Extsh(char a) = (short) a",
414 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
415 "emit" => '. extsh %D1, %S1 /* Extsh(%S1) -> %D1, (%A1) */'
420 "comment" => "construct Div (signed): Div(a, b) = a div b",
421 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
422 "emit" => '. divw %D1, %S1, %S2 /* Div(%S1, %S2) -> %D1, (%A1, %A2) */'
427 "comment" => "construct Div (unsigned): Div(a, b) = a div b",
428 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
429 "emit" => '. divwu %D1, %S1, %S2 /* Div(%S1, %S2) -> %D1, (%A1, %A2) */'
434 "comment" => "construct Mtctr: Ctr = a",
435 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "count" ] },
436 "emit" => '. mtctr %S1 /* Mtctr(%S1) -> %D1, (%A1) */'
445 "comment" => "Const (high-level node)",
446 "reg_req" => { "out" => [ "general_purpose" ] },
449 return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
456 "comment" => "float Const (high-level node)",
457 "reg_req" => { "out" => [ "floating_point" ] },
460 return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
467 "comment" => "SymConst (high-level node)",
468 "reg_req" => { "out" => [ "general_purpose" ] },
471 return attr_a->data.constant_tarval != attr_b->data.constant_tarval;
478 "comment" => "construct unknown register",
479 "reg_req" => { "out" => [ "general_purpose" ] },
480 "emit" => '. \t\t /* use %D1 as uninitialized value */',
490 "comment" => "construct unknown float register",
491 "reg_req" => { "out" => [ "floating_point" ] },
492 "emit" => '. \t\t /* use %D1 as uninitialized value */',
502 "comment" => "construct unknown condition register",
503 "reg_req" => { "out" => [ "condition" ] },
504 "emit" => '. \t\t /* use %D1 as uninitialized value */',
514 "comment" => "load constant (16bit with sign extension)",
515 "reg_req" => { "out" => [ "general_purpose" ] },
516 "emit" => '. addi %D1, 0, %C /* lower 16 bit of %C (sign extended) -> %D1 */',
519 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
524 "op_flags" => "L|X|Y",
525 "comment" => "branch somewhere",
526 "reg_req" => { "in" => [ "condition" ], "out" => [ "none", "none" ] },
529 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
535 "comment" => "construct LoopCopy(src, dest, count, mem): Copy count words from src to dest",
536 "reg_req" => { "in" => [ "general_purpose", "general_purpose", "count", "none" ], "out" => [ "none", "in_r1", "in_r2", "in_r3", "general_purpose" ] },
540 "op_flags" => "L|X|Y",
541 "comment" => "construct Switch(selector): Jump to whatever",
542 "reg_req" => { "in" => [ "general_purpose", "general_purpose", "condition" ], "out" => [ "none" ] },
545 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
552 "comment" => "load the constant to higher 16 bit of register",
553 "reg_req" => { "out" => [ "general_purpose" ] },
554 "emit" => '. addis %D1, 0, %C /* %C << 16 -> %D1 */',
555 "attr" => "ppc32_attr_offset_mode om, tarval *tv, ident *id",
558 attr->offset_mode = om;
560 attr->content_type = ppc32_ac_Const;
561 attr->data.constant_tarval = tv;
564 attr->content_type = ppc32_ac_SymConst;
565 attr->data.symconst_ident = id;
570 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
577 "comment" => "ors constant with register",
578 "reg_req" => { "in" => [ "general_purpose"], "out" => [ "general_purpose" ] },
579 "emit" => '. ori %D1, %S1, %C /* Ori(%S1,%C) -> %D1 */',
582 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
589 "comment" => "ands constant with register with cr0 update",
590 "reg_req" => { "in" => [ "general_purpose"], "out" => [ "general_purpose", "cr0" ] },
591 "emit" => '. andi. %D1, %S1,%C /* Andi(%S1,%C) -> %D1 (%D2 changed) */',
594 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
600 "comment" => "construct Cmp: Cmp(a, b) = Flags in crX",
601 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "condition" ] },
602 "emit" => '. cmp %D1, 0, %S1, %S2 /* Cmp(%S1, %S2) -> %D1, (%A1, %A2) */'
607 "comment" => "construct Cmp immediate: Cmpi(a, const) = Flags in crX",
608 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "condition" ] },
609 "emit" => '. cmpi %D1, 0, %S1, %C /* Cmpi(%S1, %C) -> %D1, (%A1) */',
612 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
619 "comment" => "construct Cmp logical: Cmpl(a, b) = Flags in crX",
620 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "condition" ] },
621 "emit" => '. cmpl %D1, 0, %S1, %S2 /* Cmpl(%S1, %S2) -> %D1, (%A1, %A2) */'
626 "comment" => "construct Cmp logical immediate: Cmpli(a, const) = Flags in crX",
627 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "condition" ] },
628 "emit" => '. cmpli %D1, 0, %S1, %C /* Cmpli(%S1, %C) -> %D1, (%A1) */',
631 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
641 "state" => "exc_pinned",
642 "comment" => "construct Load (byte unsigned): Load(ptr, mem) = LD ptr -> reg",
643 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "general_purpose" ] },
644 "emit" => '. lbz %D1, %O(%S1) /* Load(%O(%S1)) -> %D1, (%A1) */',
647 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
654 "state" => "exc_pinned",
655 "comment" => "construct Load (halfword unsigned): Load(ptr, mem) = LD ptr -> reg",
656 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "general_purpose" ] },
657 "emit" => '. lhz %D1, %O(%S1) /* Load(%O(%S1)) -> %D1, (%A1) */',
660 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
667 "state" => "exc_pinned",
668 "comment" => "construct Load (halfword signed): Load(ptr, mem) = LD ptr -> reg",
669 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "general_purpose" ] },
670 "emit" => '. lha %D1, %O(%S1) /* Load(%O(%S1)) -> %D1, (%A1) */',
673 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
680 "state" => "exc_pinned",
681 "comment" => "construct Load (word): Load(ptr, mem) = LD ptr -> reg",
682 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "general_purpose" ] },
683 "emit" => '. lwz %D1, %O(%S1) /* Load(%O(%S1)) -> %D1, (%A1) */',
686 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
693 "state" => "exc_pinned",
694 "comment" => "construct Load with update (word): Load(ptr, mem) = LD ptr -> reg",
695 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "general_purpose", "in_r1"] },
696 "emit" => '. lwzu %D1, %O(%S1) /* Load(%O(%S1)) -> %D1, %S1 += %O, (%A1) */',
699 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
705 "state" => "exc_pinned",
706 "comment" => "construct Store: Store (byte) (ptr, val, mem) = ST ptr,val",
707 "reg_req" => { "in" => [ "!r0", "general_purpose", "none" ] },
708 "emit" => '. stb %S2, %O(%S1) /* Store(%S2) -> (%S1), (%A1, %A2) */',
711 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
717 "state" => "exc_pinned",
718 "comment" => "construct Store: Store (halfword) (ptr, val, mem) = ST ptr,val",
719 "reg_req" => { "in" => [ "!r0", "general_purpose", "none" ] },
720 "emit" => '. sth %S2, %O(%S1) /* Store(%S2) -> (%S1), (%A1, %A2) */',
723 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
729 "state" => "exc_pinned",
730 "comment" => "construct Store: Store (word) (ptr, val, mem) = ST ptr,val",
731 "reg_req" => { "in" => [ "!r0", "general_purpose", "none" ] },
732 "emit" => '. stw %S2, %O(%S1) /* Store(%S2) -> (%S1), (%A1, %A2) */',
735 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
739 #--------------------------------------------------------#
742 # | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
743 # | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
744 # | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
745 # |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
746 #--------------------------------------------------------#
748 # commutative operations
753 "comment" => "construct FP Add: Add(a, b) = Add(b, a) = a + b",
754 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
755 "emit" => '. fadd %D1, %S1, %S2 /* FP Add(%S1, %S2) -> %D1 */'
761 "comment" => "construct FP Add (single): Add(a, b) = Add(b, a) = a + b",
762 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
763 "emit" => '. fadds %D1, %S1, %S2 /* FP Add(%S1, %S2) -> %D1 */'
768 "comment" => "construct FP Mul: Mul(a, b) = Mul(b, a) = a * b",
769 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
770 "emit" => '. fmul %D1, %S1, %S2 /* FP Mul(%S1, %S2) -> %D1 */'
775 "comment" => "construct FP Mul (single): Mul(a, b) = Mul(b, a) = a * b",
776 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
777 "emit" => '. fmuls %D1, %S1, %S2 /* FP Mul(%S1, %S2) -> %D1 */'
781 "comment" => "construct FP Negation: fNeg(a) = -a",
782 "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
783 "emit" => '. fneg %D1, %S1 /* FP fNeg(%S1) -> %D1 */'
790 "comment" => "construct FP Max: Max(a, b) = Max(b, a) = a > b ? a : b",
791 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
792 "emit" => '. fmax %S1, %S2, %D1 /* FP Max(%S1, %S2) -> %D1 */'
798 "comment" => "construct FP Min: Min(a, b) = Min(b, a) = a < b ? a : b",
799 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
800 "emit" => '. fmin %S1, %S2, %D1 /* FP Min(%S1, %S2) -> %D1 */'
803 # not commutative operations
807 "comment" => "construct FP Sub: Sub(a, b) = a - b",
808 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
809 "emit" => '. fsub %D1, %S1, %S2 /* FP Sub(%S1, %S2) -> %D1 */'
814 "comment" => "construct FP Sub (single): Sub(a, b) = a - b",
815 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
816 "emit" => '. fsub %D1, %S1, %S2 /* FP Sub(%S1, %S2) -> %D1 */'
820 "comment" => "construct FP Div: Div(a, b) = a / b",
821 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
822 "emit" => '. fdiv %D1, %S1, %S2 /* FP Div(%S1, %S2) -> %D1 */'
826 "comment" => "construct FP Div (single): Div(a, b) = a / b",
827 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
828 "emit" => '. fdivs %D1, %S1, %S2 /* FP Div(%S1, %S2) -> %D1 */'
833 "comment" => "construct FP Minus: fMinus(a) = -a",
834 "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
835 "emit" => '. fneg %D1, %S1 /* FP fMinus(%S1) -> %D1 */'
840 "comment" => "construct FP Convert to integer word: fCtiw(a) = (int) a",
841 "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
842 "emit" => '. fctiw %D1, %S1 /* FP fCtiw(%S1) -> %D1 */'
847 "comment" => "construct FP Round to single: fRsp(a) = (float) a",
848 "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
849 "emit" => '. frsp %D1, %S1 /* FP fRsp(%S1) -> %D1 */'
854 "comment" => "construct FP Abs: fAbs(a) = |a|",
855 "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
856 "emit" => '. fabs %D1, %S1 /* FP fAbs(%S1) -> %D1 */'
861 "comment" => "construct FP Cmp unordered: fCmpu(a, b) = a ? b",
862 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "condition" ] },
863 "emit" => '. fcmpu %D1, %S1, %S2 /* FP fCmpu(%S1, %S2) -> %D1 */'
870 # "irn_flags" => "R",
871 # "comment" => "represents a FP constant",
872 # "reg_req" => { "out" => [ "floating_point" ] },
873 # "emit" => '. fmov %C, %D1 /* Mov fConst into register */',
876 # /* TODO: compare fConst attributes */
884 "comment" => "construct unknown floating point register",
885 "reg_req" => { "out" => [ "floating_point" ] },
886 "emit" => '. \t\t /* use %D1 as uninitialized value */',
898 "state" => "exc_pinned",
899 "comment" => "construct FP Load (double): Load(ptr, mem) = LD ptr",
900 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "floating_point" ] },
901 "emit" => '. lfd %D1, %O(%S1) /* Load(%O(%S1)) -> %D1 */',
904 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
911 "state" => "exc_pinned",
912 "comment" => "construct FP Load (single): Load(ptr, mem) = LD ptr",
913 "reg_req" => { "in" => [ "!r0", "none" ], "out" => [ "floating_point" ] },
914 "emit" => '. lfs %D1, %O(%S1) /* Load(%O(%S1)) -> %D1 */',
917 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
923 "state" => "exc_pinned",
924 "comment" => "construct Store (double): Store(ptr, val, mem) = ST ptr,val",
925 "reg_req" => { "in" => [ "!r0", "floating_point", "none" ] },
926 "emit" => '. stfd %S2, %O(%S1) /* Store(%S2) -> (%S1), (%A1, %A2) */',
929 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);
935 "state" => "exc_pinned",
936 "comment" => "construct Store (single): Store(ptr, val, mem) = ST ptr,val",
937 "reg_req" => { "in" => [ "!r0", "floating_point", "none" ] },
938 "emit" => '. stfs %S2, %O(%S1) /* Store(%S2) -> (%S1), (%A1, %A2) */',
941 return (attr_a->data.constant_tarval != attr_b->data.constant_tarval);