3 # This is a template specification for the Firm-Backend
5 # the cpu architecture (ia32, ia64, mips, sparc, ppc, ...)
9 # $comment_string = 'WIRHABENKEINEKOMMENTARE';
10 $comment_string = '/*';
12 # the number of additional opcodes you want to register
13 $additional_opcodes = 0;
15 # The node description is done as a perl hash initializer with the
16 # following structure:
21 # "op_flags" => "N|L|C|X|I|F|Y|H|c|K",
22 # "irn_flags" => "R|N|I"
23 # "arity" => "0|1|2|3 ... |variable|dynamic|any",
24 # "state" => "floats|pinned|mem_pinned|exc_pinned",
26 # { "type" => "type 1", "name" => "name 1" },
27 # { "type" => "type 2", "name" => "name 2" },
30 # "comment" => "any comment for constructor",
31 # "reg_req" => { "in" => [ "reg_class|register" ], "out" => [ "reg_class|register|in_rX" ] },
32 # "cmp_attr" => "c source code for comparing node attributes",
33 # "emit" => "emit code with templates",
34 # "rd_constructor" => "c source code which constructs an ir_node"
37 # ... # (all nodes you need to describe)
39 # ); # close the %nodes initializer
41 # op_flags: flags for the operation, OPTIONAL (default is "N")
42 # the op_flags correspond to the firm irop_flags:
45 # C irop_flag_commutative
46 # X irop_flag_cfopcode
47 # I irop_flag_ip_cfopcode
50 # H irop_flag_highlevel
51 # c irop_flag_constlike
54 # irn_flags: special node flags, OPTIONAL (default is 0)
55 # following irn_flags are supported:
58 # I ignore for register allocation
60 # state: state of the operation, OPTIONAL (default is "floats")
62 # arity: arity of the operation, MUST NOT BE OMITTED
64 # args: the OPTIONAL arguments of the node constructor (debug, irg and block
65 # are always the first 3 arguments and are always autmatically
67 # If this key is missing the following arguments will be created:
68 # for i = 1 .. arity: ir_node *op_i
71 # comment: OPTIONAL comment for the node constructor
73 # rd_constructor: for every operation there will be a
74 # new_rd_<arch>_<op-name> function with the arguments from above
75 # which creates the ir_node corresponding to the defined operation
76 # you can either put the complete source code of this function here
78 # This key is OPTIONAL. If omitted, the following constructor will
80 # if (!op_<arch>_<op-name>) assert(0);
84 # res = new_ir_node(db, irg, block, op_<arch>_<op-name>, mode, arity, in)
87 # NOTE: rd_constructor and args are only optional if and only if arity is 0,1,2 or 3
91 # 1 - caller save (register must be saved by the caller of a function)
92 # 2 - callee save (register must be saved by the called function)
93 # 4 - ignore (do not assign this register)
94 # NOTE: Last entry of each class is the largest Firm-Mode a register can hold
96 "general_purpose" => [
97 { "name" => "r0", "type" => 1 },
98 { "name" => "r1", "type" => 1 },
99 { "name" => "r2", "type" => 1 },
100 { "name" => "r3", "type" => 1 },
101 { "name" => "r4", "type" => 2 },
102 { "name" => "r5", "type" => 2 },
103 { "name" => "r6", "type" => 2 },
104 { "name" => "r7", "type" => 2 },
105 { "name" => "r8", "type" => 2 },
106 { "name" => "r9", "type" => 2 },
107 { "name" => "r10", "type" => 2 },
108 { "name" => "r11", "type" => 2 },
109 { "name" => "r12", "type" => 6 }, # reserved for linker
110 { "name" => "r13", "type" => 6 }, # this is our stack pointer
111 { "name" => "r14", "type" => 3 }, # this is our return address
112 { "name" => "r15", "type" => 6 }, # this is our program counter
113 { "name" => "rxx", "type" => 6 }, # dummy register for no_mem
114 { "name" => "MURX", "type" => 6 }, # this is our workaround-register
115 { "mode" => "mode_P" }
117 "floating_point" => [
118 { "name" => "f0", "type" => 1 },
119 { "name" => "f1", "type" => 1 },
120 { "name" => "f2", "type" => 1 },
121 { "name" => "f3", "type" => 1 },
122 { "name" => "f4", "type" => 2 },
123 { "name" => "f5", "type" => 2 },
124 { "name" => "f6", "type" => 2 },
125 { "name" => "f7", "type" => 2 },
126 { "name" => "fxx", "type" => 6 }, # dummy register for no_mem
127 { "mode" => "mode_D" }
131 #--------------------------------------------------#
134 # _ __ _____ __ _ _ __ ___ _ __ ___ #
135 # | '_ \ / _ \ \ /\ / / | | '__| / _ \| '_ \/ __| #
136 # | | | | __/\ V V / | | | | (_) | |_) \__ \ #
137 # |_| |_|\___| \_/\_/ |_|_| \___/| .__/|___/ #
140 #--------------------------------------------------#
144 #-----------------------------------------------------------------#
147 # _ _ __ | |_ ___ __ _ ___ _ __ _ __ ___ __| | ___ ___ #
148 # | | '_ \| __/ _ \/ _` |/ _ \ '__| | '_ \ / _ \ / _` |/ _ \/ __| #
149 # | | | | | || __/ (_| | __/ | | | | | (_) | (_| | __/\__ \ #
150 # |_|_| |_|\__\___|\__, |\___|_| |_| |_|\___/ \__,_|\___||___/ #
153 #-----------------------------------------------------------------#
155 # commutative operations
160 "comment" => "construct Add: Add(a, b) = Add(b, a) = a + b",
161 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
162 "emit" => '. ADD %D1, %S1, %S2\t\t\t/* Add(%S1, %S2) -> %D1, (%A1, %A2) */'
167 "comment" => "construct Add: Add(a, const) = Add(const, a) = a + const",
168 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
169 "emit" => '. ADD %D1, %S1, %C\t\t\t/* Add(%C, %S1) -> %D1, (%A1, const) */',
171 ' if (attr_a->value == NULL || attr_b->value == NULL)
174 return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
181 "comment" => "construct Mul: Mul(a, b) = Mul(b, a) = a * b",
182 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "!in_r1" ] },
183 "emit" =>'. MUL %D1, %S1, %S2\t\t\t/* Mul(%S1, %S2) -> %D1, (%A1, %A2) */'
189 "comment" => "construct And: And(a, b) = And(b, a) = a AND b",
190 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
191 "emit" => '. AND %D1, %S1, %S2\t\t/* And(%S1, %S2) -> %D1, (%A1, %A2) */'
196 "comment" => "construct And: And(a, const) = And(const, a) = a AND const",
197 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
198 "emit" => '. AND %D1, %S1, %C\t\t\t/* And(%C, %S1) -> %D1, (%A1, const) */',
200 ' if (attr_a->value == NULL || attr_b->value == NULL)
203 return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
210 "comment" => "construct Or: Or(a, b) = Or(b, a) = a OR b",
211 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
212 "emit" => '. ORR %D1, %S1, %S2\t\t/* Or(%S1, %S2) -> %D1, (%A1, %A2) */'
217 "comment" => "construct Or: Or(a, const) = Or(const, a) = a OR const",
218 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
219 "emit" => '. ORR %D1, %S1, %C\t\t\t/* Or(%C, %S1) -> %D1, (%A1, const) */',
221 ' if (attr_a->value == NULL || attr_b->value == NULL)
224 return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
230 "comment" => "construct Or with immediate shifter operand",
231 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
232 "emit" => '. ORR %D1, %S1, %S2 LSL %C\t\t\t/* Or_Shl_i(%S1, %S2 << %C) -> %D1, (%A1, const) */',
234 ' if (attr_a->value == NULL || attr_b->value == NULL)
237 return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
244 "comment" => "construct Eor: Eor(a, b) = Eor(b, a) = a EOR b",
245 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
246 "emit" => '. EOR %D1, %S1, %S2\t\t\t/* Xor(%S1, %S2) -> %D1, (%A1, %A2) */'
251 "comment" => "construct Eor: Eor(a, const) = Eor(const, a) = a EOR const",
252 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
253 "emit" => '. EOR %D1, %S1, %C\t\t\t/* Xor(%C, %S1) -> %D1, (%A1, const) */',
255 ' if (attr_a->value == NULL || attr_b->value == NULL)
258 return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
262 # not commutative operations
266 "comment" => "construct Sub: Sub(a, b) = a - b",
267 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
268 "emit" => '. SUB %D1, %S1, %S2\t\t\t/* Sub(%S1, %S2) -> %D1, (%A1, %A2) */'
273 "comment" => "construct Sub: Sub(a, const) = a - const",
274 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
275 "emit" => '. SUB %D1, %S1, %C\t\t\t/* Sub(%S1, %C) -> %D1, (%A1, const) */',
277 ' if (attr_a->value == NULL || attr_b->value == NULL)
280 return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
286 "comment" => "construct Shl: Shl(a, b) = a << b",
287 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
288 "emit" => '. MOV %D1, %S1, LSL %S2\t/* Shl(%S1, %S2) -> %D1, (%A1, %A2) */'
293 "comment" => "construct Shl: Shl(a, const) = a << const",
294 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
295 "emit" => '. MOV %D1, %S1, LSL %C\t\t\t/* Shl(%S1, %C) -> %D1, (%A1, const) */',
297 ' if (attr_a->value == NULL || attr_b->value == NULL)
300 return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
306 "comment" => "construct Shr: Shr(a, b) = a >> b",
307 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "in_r1" ] },
308 "emit" => '. MOV %D1, %S1, LSR %S2\t\t\t/* Shr(%S1, %S2) -> %D1, (%A1, %A2) */'
313 "comment" => "construct Shr: Shr(a, const) = a >> const",
314 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
315 "emit" => '. MOV %D1, %S1, LSR %C\t\t\t/* Shr(%S1, %C) -> %D1, (%A1, const) */',
317 ' if (attr_a->value == NULL || attr_b->value == NULL)
320 return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
326 "comment" => "construct Shrs: Shrs(a, b) = a >> b",
327 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "in_r1" ] },
328 "emit" => '. MOV %D1, %S1, ASR %S2\t\t\t\t\t/* Shrs(%S1, %S2) -> %D1, (%A1, %A2) */'
333 "comment" => "construct Shrs: Shrs(a, const) = a >> const",
334 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
335 "emit" => '. MOV %D1, %S1, ASR %C\t\t\t/* Shrs(%S1, %C) -> %D1, (%A1, const) */',
337 ' if (attr_a->value == NULL || attr_b->value == NULL)
340 return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
345 # "irn_flags" => "R",
346 # "comment" => "construct Div: Div(a, b) = a / b",
347 # "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
348 # "emit" =>'. div %S1, %S2, %D1\t\t\t/* div(%S1, %S2) -> %D1, (%A1, %A2) */'
352 # "irn_flags" => "R",
353 # "comment" => "construct Div: Div(a, const) = a / const",
354 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
355 # "emit" => '. div %S1, %C, %D1\t\t\t/* signed div(%C, %S1) -> %D1, (%A1, const) */'
359 # "irn_flags" => "R",
360 # "comment" => "construct Mod: Mod(a, b) = a % b",
361 # "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
362 # "emit" =>'. mod %S1, %S2, %D1\t\t\t/* mod(%S1, %S2) -> %D1, (%A1, %A2) */'
366 # "irn_flags" => "R",
367 # "comment" => "construct mod: Mod(a, const) = a % const",
368 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
369 # "emit" => '. mod %S1, %C, %D1\t\t\t/* mod(%C, %S1) -> %D1, (%A1, const) */'
373 # "irn_flags" => "R",
374 # "comment" => "construct DivMod: DivMod(a, b) = a / b",
375 # "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
376 # "emit" =>'. div %S1, %S2, %D1\t\t\t/* div(%S1, %S2) -> %D1, (%A1, %A2) */'
380 # "irn_flags" => "R",
381 # "comment" => "construct DivMod: DivMod(a, const) = a / const",
382 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
383 # "emit" => '. div %S1, %C, %D1\t\t\t/* signed div(%C, %S1) -> %D1, (%A1, const) */'
387 # "irn_flags" => "R",
388 # "comment" => "construct RotR: RotR(a, b) = a ROTR b",
389 # "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
390 # "emit" => '. MOV %D1, %S1, ROR %S2\t\t\t/* RotR(%S1, %S2) -> %D1, (%A1, %A2) */'
391 ## "emit" => '. ror %S1, %S2, %D1\t\t\t/* RotR(%S1, %S2) -> %D1, (%A1, %A2) */'
395 # "irn_flags" => "R",
396 # "comment" => "construct RotL: RotL(a, b) = a ROTL b",
397 # "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "general_purpose" ] },
398 # "emit" => '. rol %S1, %S2, %D1\t\t\t/* RotL(%S1, %S2) -> %D1, (%A1, %A2) */'
402 # "irn_flags" => "R",
403 # "comment" => "construct RotL: RotL(a, const) = a ROTL const",
404 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
405 # "emit" => '. rol %S1, %C, %D1\t\t\t/* RotL(%S1, %C) -> %D1, (%A1, const) */'
410 "comment" => "construct Minus: Minus(a) = -a",
411 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
412 "emit" => '. RSB %D1, %S1, #0\t\t\t/* Neg(%S1) -> %D1, (%A1) */'
416 # "irn_flags" => "R",
417 # "comment" => "construct Increment: Inc(a) = a++",
418 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
419 # "emit" => '. inc %S1, %D1\t\t\t/* Inc(%S1) -> %D1, (%A1) */'
423 # "irn_flags" => "R",
424 # "comment" => "construct Decrement: Dec(a) = a--",
425 # "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
426 # "emit" => '. dec %S1, %D1\t\t\t/* Dec(%S1) -> %D1, (%A1) */'
433 "comment" => "construct Not: Not(a) = !a",
434 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
435 "emit" => '. MVN %D1, %S1\t\t\t/* Not(%S1) -> %D1, (%A1) */'
440 "comment" => "construct Abs: Abs(a) = |a|",
441 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
443 '. MOVS %S1, %S1, #0\t\t\t/* set condition flag */\n
444 . RSBMI %D1, %S1, #0\t\t\t/* Neg(%S1) -> %D1, (%A1) */'
452 "comment" => "just to get an emptz register for calculations",
453 "reg_req" => { "out" => [ "general_purpose" ] },
454 "emit" => '. /* %D1 now available for calculations */',
455 "cmp_attr" => 'return 1;'
459 "comment" => "implements a register copy",
460 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "general_purpose" ] },
466 "comment" => "implements a memcopy: CopyB(dst, src, size, mem) == memcpy(dst, src, size)",
467 "reg_req" => { "in" => [ "!r13", "!r13", "general_purpose", "general_purpose", "general_purpose", "none" ], "out" => [ "none" ] },
472 "comment" => "represents an integer constant",
473 "reg_req" => { "out" => [ "general_purpose" ] },
474 "emit" => '. MOV %D1, %C \t\t\t/* Mov Const into register */',
476 ' if (attr_a->value == NULL || attr_b->value == NULL)
479 return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
485 "comment" => "represents a negated integer constant",
486 "reg_req" => { "out" => [ "general_purpose" ] },
487 "emit" => '. MVN %D1, %C \t\t\t/* Mov negated Const into register */',
489 ' if (attr_a->value == NULL || attr_b->value == NULL)
492 return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
499 "comment" => "represents a symbolic constant",
500 "reg_req" => { "out" => [ "general_purpose" ] },
501 # "emit" => '. LDR %D1, %C\t\t\t/* Mov Const into register */',
503 ' if (attr_a->value == NULL || attr_b->value == NULL)
506 return get_tarval_long(attr_a->value) != get_tarval_long(attr_b->value);
511 "op_flags" => "L|X|Y",
512 "comment" => "construct conditional jump: CMP A, B && JMPxx LABEL",
513 "cmp_attr" => " return arm_comp_condJmp(attr_a, attr_b);\n",
514 "reg_req" => { "in" => [ "general_purpose", "general_purpose" ], "out" => [ "none", "none"] },
518 "op_flags" => "L|X|Y",
519 "comment" => "construct switch",
520 "reg_req" => { "in" => [ "general_purpose" ], "out" => [ "none" ] },
521 "cmp_attr" => " return 0;\n",
529 "state" => "exc_pinned",
530 "comment" => "construct Load: Load(ptr, mem) = LD ptr -> reg",
531 "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "general_purpose" ] },
532 "emit" => '. LDR %D1, [%S1, #0]\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
533 # "emit" => '. LDR %D1, %S1, %O\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
539 "state" => "exc_pinned",
540 "comment" => "construct Load: Load(ptr, mem) = LD ptr -> reg",
541 "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "general_purpose" ] },
542 "emit" => '. LDRB %D1, [%S1, #0]\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
543 # "emit" => '. LDRB %D1, %S1, %O\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
549 "state" => "exc_pinned",
550 "comment" => "construct Load: Load(ptr, mem) = LD ptr -> reg",
551 "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "general_purpose" ] },
552 "emit" => '. LDRSB %D1, [%S1, #0]\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
553 # "emit" => '. LDRSB %D1, %S1, %O\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
559 "state" => "exc_pinned",
560 "comment" => "construct Load: Load(ptr, mem) = LD ptr -> reg",
561 "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "general_purpose" ] },
562 "emit" => '. LDRH %D1, [%S1, #0]\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
563 # "emit" => '. LDRH %D1, %S1, %O\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
569 "state" => "exc_pinned",
570 "comment" => "construct Load: Load(ptr, mem) = LD ptr -> reg",
571 "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "general_purpose" ] },
572 "emit" => '. LDRSH %D1, [%S1, #0]\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
573 # "emit" => '. LDRSH %D1, %S1, %O\t\t\t/* Load((%S1)) -> %D1, (%A1) */'
579 "state" => "exc_pinned",
580 "comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
581 "reg_req" => { "in" => [ "general_purpose", "general_purpose", "none" ] },
582 "emit" => '. STRB %S2, [%S1, #0]\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
583 # "emit" => '. movl %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
589 "state" => "exc_pinned",
590 "comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
591 "reg_req" => { "in" => [ "general_purpose", "general_purpose", "none" ] },
592 "emit" => '. STRSB %S2, [%S1, #0]\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
593 # "emit" => '. movl %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
599 "state" => "exc_pinned",
600 "comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
601 "reg_req" => { "in" => [ "general_purpose", "general_purpose", "none" ] },
602 "emit" => '. STRH %S2, [%S1, #0]\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
603 # "emit" => '. movl %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
609 "state" => "exc_pinned",
610 "comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
611 "reg_req" => { "in" => [ "general_purpose", "general_purpose", "none" ] },
612 "emit" => '. STRSH%S2, [%S1, #0]\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
613 # "emit" => '. movl %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
619 "state" => "exc_pinned",
620 "comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
621 "reg_req" => { "in" => [ "general_purpose", "general_purpose", "none" ] },
622 "emit" => '. STR %S2, [%S1, #0]\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
623 # "emit" => '. movl %S2, %O(%S1)\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
626 "StoreStackM4Inc" => {
629 "state" => "exc_pinned",
630 "comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
631 "reg_req" => { "in" => [ "r13", "general_purpose", "general_purpose", "general_purpose", "general_purpose", "none" ], "out" => [ "general_purpose", "none" ] },
632 "emit" => '. STMFD %S1!, {%S2, %S3, %S4, %S5}\t\t\t/* Store multiple on Stack*/'
638 "state" => "exc_pinned",
639 "comment" => "construct Load: Load(ptr, mem) = LD ptr -> reg",
640 "reg_req" => { "in" => [ "r13", "none" ], "out" => [ "general_purpose", "general_purpose", "general_purpose", "none" ] },
641 "emit" => '. LDMFD %S1, {%D1, %D2, %D3}\t\t\t/* Load multiple from Stack */'
651 #--------------------------------------------------------#
654 # | |_| | ___ __ _| |_ _ __ ___ __| | ___ ___ #
655 # | _| |/ _ \ / _` | __| | '_ \ / _ \ / _` |/ _ \/ __| #
656 # | | | | (_) | (_| | |_ | | | | (_) | (_| | __/\__ \ #
657 # |_| |_|\___/ \__,_|\__| |_| |_|\___/ \__,_|\___||___/ #
658 #--------------------------------------------------------#
660 # commutative operations
665 "comment" => "construct DP FP Add: Add(a, b) = Add(b, a) = a + b",
666 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
667 "emit" => '. FADDD %D1, %S1, %S2\t\t\t/* FP Add(%S1, %S2) -> %D1 */'
673 "comment" => "construct SP FP Add: Add(a, b) = Add(b, a) = a + b",
674 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
675 "emit" => '. FADDS %D1, %S1, %S2\t\t\t/* FP Add(%S1, %S2) -> %D1 */'
680 "comment" => "construct FP Mul: Mul(a, b) = Mul(b, a) = a * b",
681 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
682 "emit" =>'. FMULS %D1, %S1, %S2\t\t\t/* FP Mul(%S1, %S2) -> %D1 */'
687 "comment" => "construct FP Mul: Mul(a, b) = Mul(b, a) = a * b",
688 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
689 "emit" =>'. FMULD %D1, %S1, %S2\t\t\t/* FP Mul(%S1, %S2) -> %D1 */'
693 "comment" => "construct FP Div: Div(a, b) = a / b",
694 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
695 "emit" =>'. FDIVS %D1, %S1, %S2\t\t\t/* FP Div(%S1, %S2) -> %D1 */'
699 "comment" => "construct FP Div: Div(a, b) = a / b",
700 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
701 "emit" =>'. FDIVD %D1, %S1, %S2\t\t\t/* FP Div(%S1, %S2) -> %D1 */'
705 "comment" => "construct FP Div: Div(a, b) = a / b",
706 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
707 "emit" =>'. FDIV %D1, %S1, %S2\t\t\t/* FP Div(%S1, %S2) -> %D1 */'
713 "comment" => "construct FP Max: Max(a, b) = Max(b, a) = a > b ? a : b",
714 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
715 "emit" =>'. fmax %S1, %S2, %D1\t\t\t/* FP Max(%S1, %S2) -> %D1 */'
721 "comment" => "construct FP Min: Min(a, b) = Min(b, a) = a < b ? a : b",
722 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
723 "emit" =>'. fmin %S1, %S2, %D1\t\t\t/* FP Min(%S1, %S2) -> %D1 */'
726 # not commutative operations
730 "comment" => "construct FP Sub: Sub(a, b) = a - b",
731 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
732 "emit" => '. FSUBS %D1, %S1, %S2\t\t\t/* FP Sub(%S1, %S2) -> %D1 */'
737 "comment" => "construct FP Sub: Sub(a, b) = a - b",
738 "reg_req" => { "in" => [ "floating_point", "floating_point" ], "out" => [ "floating_point" ] },
739 "emit" => '. FSUBD %D1, %S1, %S2\t\t\t/* FP Sub(%S1, %S2) -> %D1 */'
744 "comment" => "construct FP Minus: Minus(a) = -a",
745 "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
746 "emit" => '. fneg %S1, %D1\t\t\t/* FP Minus(%S1) -> %D1 */'
751 "comment" => "construct FP Absolute value: fAbss(a) = |a|",
752 "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
753 "emit" => '. FABSS %D1, %S1\t\t\t/* FP Abss(%S1) -> %D1 */'
758 "comment" => "construct FP Absolute value: fAbsd(a) = |a|",
759 "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
760 "emit" => '. FABSD %D1, %S1\t\t\t/* FP Absd(%S1) -> %D1 */'
768 "comment" => "represents a FP constant",
769 "reg_req" => { "out" => [ "floating_point" ] },
770 "emit" => '. FMOV %D1, %C\t\t\t/* Mov fConst into register */',
772 ' if (attr_a->value == NULL || attr_b->value == NULL)
775 return get_tarval_double(attr_a->value) != get_tarval_double(attr_b->value);'
780 "comment" => "convert double to single",
781 "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
782 "emit" => '. FCVTSD %D1, %S1\t\t\t/* Convert double to single */',
787 "comment" => "convert single to double",
788 "reg_req" => { "in" => [ "floating_point" ], "out" => [ "floating_point" ] },
789 "emit" => '. FCVTDS %D1, %S1\t\t\t/* Convert single to double */',
798 "state" => "exc_pinned",
799 "comment" => "construct FP Load: Load(ptr, mem) = LD ptr",
800 "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "floating_point" ] },
801 "emit" => '. FLDS %D1, %S1\t\t\t/* Load((%S1)) -> %D1 */'
802 # "emit" => '. fmov %O(%S1), %D1\t\t\t/* Load((%S1)) -> %D1 */'
808 "state" => "exc_pinned",
809 "comment" => "construct FP Load: Load(ptr, mem) = LD ptr",
810 "reg_req" => { "in" => [ "general_purpose", "none" ], "out" => [ "floating_point" ] },
811 "emit" => '. FLDD %D1, %S1\t\t\t/* Load((%S1)) -> %D1 */'
812 # "emit" => '. fmov %O(%S1), %D1\t\t\t/* Load((%S1)) -> %D1 */'
818 "state" => "exc_pinned",
819 "comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
820 "reg_req" => { "in" => [ "general_purpose", "floating_point", "none" ] },
821 "emit" => '. FSTS %S2, %S1\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'
827 "state" => "exc_pinned",
828 "comment" => "construct Store: Store(ptr, val, mem) = ST ptr,val",
829 "reg_req" => { "in" => [ "general_purpose", "floating_point", "none" ] },
830 "emit" => '. FSTD %S2, %S1\t\t\t/* Store(%S2) -> (%S1), (%A1, %A2) */'