2016-09-25 20:17:14 +00:00
|
|
|
REGISTERS
|
|
|
|
|
2016-10-09 12:45:13 +00:00
|
|
|
/* Registers are allocated top down; the order here is odd in order to make
|
2016-10-12 20:58:46 +00:00
|
|
|
* sure that non-volatile registers get allocated from r31 (or f31) down.
|
|
|
|
*
|
|
|
|
* Attributes ending in an exclamation mark must match exactly when copying
|
|
|
|
* a register into another register (e.g. for eviction).
|
|
|
|
*/
|
|
|
|
|
|
|
|
r12 bytes4! int! volatile;
|
|
|
|
r11 bytes4! int! volatile;
|
|
|
|
r10 bytes4! int! volatile;
|
|
|
|
r9 bytes4! int! volatile;
|
|
|
|
r8 bytes4! int! volatile;
|
|
|
|
r7 bytes4! int! volatile;
|
|
|
|
r6 bytes4! int! volatile;
|
|
|
|
r5 bytes4! int! volatile;
|
|
|
|
r4 bytes4! int! volatile;
|
|
|
|
r3 bytes4! int! ret volatile;
|
|
|
|
|
|
|
|
r31 bytes4! int!;
|
|
|
|
r30 bytes4! int!;
|
|
|
|
r29 bytes4! int!;
|
|
|
|
r28 bytes4! int!;
|
|
|
|
r27 bytes4! int!;
|
|
|
|
r26 bytes4! int!;
|
|
|
|
r25 bytes4! int!;
|
|
|
|
r24 bytes4! int!;
|
|
|
|
r23 bytes4! int!;
|
|
|
|
r22 bytes4! int!;
|
|
|
|
r21 bytes4! int!;
|
|
|
|
r20 bytes4! int!;
|
|
|
|
r19 bytes4! int!;
|
|
|
|
r18 bytes4! int!;
|
|
|
|
r17 bytes4! int!;
|
|
|
|
r16 bytes4! int!;
|
|
|
|
r15 bytes4! int!;
|
|
|
|
r14 bytes4! int!;
|
|
|
|
|
|
|
|
f14 bytes4! float! volatile;
|
|
|
|
f13 bytes4! float! volatile;
|
|
|
|
f12 bytes4! float! volatile;
|
|
|
|
f11 bytes4! float! volatile;
|
|
|
|
f10 bytes4! float! volatile;
|
|
|
|
f9 bytes4! float! volatile;
|
|
|
|
f8 bytes4! float! volatile;
|
|
|
|
f7 bytes4! float! volatile;
|
|
|
|
f6 bytes4! float! volatile;
|
|
|
|
f5 bytes4! float! volatile;
|
|
|
|
f4 bytes4! float! volatile;
|
|
|
|
f3 bytes4! float! volatile;
|
|
|
|
f2 bytes4! float! volatile;
|
|
|
|
f1 bytes4! float! volatile;
|
|
|
|
f0 bytes4! float! volatile;
|
|
|
|
|
|
|
|
f31 bytes4! float!;
|
|
|
|
f30 bytes4! float!;
|
|
|
|
f29 bytes4! float!;
|
|
|
|
f28 bytes4! float!;
|
|
|
|
f27 bytes4! float!;
|
|
|
|
f26 bytes4! float!;
|
|
|
|
f25 bytes4! float!;
|
|
|
|
f24 bytes4! float!;
|
|
|
|
f23 bytes4! float!;
|
|
|
|
f22 bytes4! float!;
|
|
|
|
f21 bytes4! float!;
|
|
|
|
f20 bytes4! float!;
|
|
|
|
f19 bytes4! float!;
|
|
|
|
f18 bytes4! float!;
|
|
|
|
f17 bytes4! float!;
|
|
|
|
f16 bytes4! float!;
|
|
|
|
f15 bytes4! float!;
|
|
|
|
|
|
|
|
cr0 cr!;
|
2016-10-01 10:17:14 +00:00
|
|
|
|
2016-09-25 20:17:14 +00:00
|
|
|
|
|
|
|
DECLARATIONS
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
cr;
|
2016-10-14 21:19:02 +00:00
|
|
|
ubyteX; /* bottom 8 bits valid, the rest undefined */
|
|
|
|
ubyte0; /* bottom 8 bits valid, the rest 0 */
|
|
|
|
ushortX; /* bottom 16 bits valid, the rest undefined */
|
|
|
|
ushort0; /* bottom 16 bits valid, the rest 0 */
|
2016-10-02 19:51:25 +00:00
|
|
|
|
2016-10-12 20:58:46 +00:00
|
|
|
address fragment;
|
2016-10-01 10:17:14 +00:00
|
|
|
|
2016-09-25 20:17:14 +00:00
|
|
|
|
2016-09-24 17:03:55 +00:00
|
|
|
PATTERNS
|
2016-09-24 15:20:40 +00:00
|
|
|
|
2016-09-24 20:46:08 +00:00
|
|
|
/* Special */
|
|
|
|
|
|
|
|
PAIR(BLOCK4, BLOCK4);
|
|
|
|
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
|
2016-09-24 20:46:08 +00:00
|
|
|
/* Miscellaneous special things */
|
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
PUSH4(in:(int)reg)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "stwu %in, -4(sp)"
|
2016-09-24 20:46:08 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
out:(int)reg = POP4
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "lwz %out, 0(sp)"
|
|
|
|
emit "addi sp, sp, 4"
|
|
|
|
cost 8;
|
2016-09-24 20:46:08 +00:00
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
out:(float)reg = POPF4
|
|
|
|
emit "lfs %out, 0(sp)"
|
|
|
|
emit "addi sp, sp, 4"
|
|
|
|
cost 8;
|
|
|
|
|
2016-09-24 20:46:08 +00:00
|
|
|
RET
|
|
|
|
emit "ret"
|
|
|
|
cost 4;
|
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
SETRET4(in:(ret)reg)
|
2016-10-12 20:58:46 +00:00
|
|
|
emit "! setret4"
|
2016-09-24 20:46:08 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
(ret)reg = GETRET4
|
2016-10-12 20:58:46 +00:00
|
|
|
emit "! getret4"
|
2016-10-08 09:35:33 +00:00
|
|
|
cost 1;
|
|
|
|
|
|
|
|
STACKADJUST4(delta:CONST4)
|
2016-10-09 10:32:36 +00:00
|
|
|
when signed_constant(%delta, 16)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "addi sp, sp, $delta"
|
2016-10-01 21:41:45 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-09-25 20:17:14 +00:00
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
|
2016-09-24 20:46:08 +00:00
|
|
|
/* Memory operations */
|
|
|
|
|
2016-10-12 21:12:53 +00:00
|
|
|
/* Stores */
|
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
STORE4(addr:address, value:(int)reg)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "stw %value, %addr"
|
|
|
|
cost 4;
|
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
STORE2(addr:address, value:(int)ushortX)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "sth %value, %addr"
|
2016-09-24 15:20:40 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
STORE2(ADD4(left:(int)reg, right:(int)reg), value:(int)ushortX)
|
2016-10-12 21:12:53 +00:00
|
|
|
emit "sthx %value, %left, %right"
|
|
|
|
cost 4;
|
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
STORE1(addr:address, value:(int)ubyteX)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "stb %value, %addr"
|
2016-10-01 21:41:45 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
STORE1(ADD4(left:(int)reg, right:(int)reg), value:(int)ubyteX)
|
2016-10-10 22:23:35 +00:00
|
|
|
emit "stbx %value, %left, %right"
|
|
|
|
cost 4;
|
|
|
|
|
2016-10-12 21:12:53 +00:00
|
|
|
/* Loads */
|
2016-10-10 22:23:35 +00:00
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
out:(int)reg = LOAD4(addr:address)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "lwz %out, %addr"
|
|
|
|
cost 4;
|
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
out:(int)ushort0 = LOAD2(addr:address)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "lhz %out, %addr"
|
2016-09-24 20:46:08 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
out:(int)ubyte0 = LOAD1(addr:address)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "lbz %out, %addr"
|
2016-09-24 20:46:08 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
/* ubyte intrinsics */
|
2016-10-12 21:12:53 +00:00
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
out:(int)ubyteX = in:(int)ubyte0
|
2016-10-14 20:17:02 +00:00
|
|
|
with %out == %in
|
2016-10-14 21:19:02 +00:00
|
|
|
emit "! ubyte0 -> ubyteX"
|
2016-10-12 21:12:53 +00:00
|
|
|
cost 1;
|
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
out:(int)ubyte0 = in:(int)ubyteX
|
|
|
|
emit "andi %out, %in, 0xff ! ubyteX -> ubyte0"
|
|
|
|
cost 4;
|
2016-10-12 21:12:53 +00:00
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
out:(int)reg = in:(int)ubyte0
|
|
|
|
with %out == %in
|
|
|
|
emit "! ubyte0 -> reg"
|
|
|
|
cost 4;
|
2016-10-12 21:12:53 +00:00
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
out:(int)ubyteX = in:(int)reg
|
2016-10-14 20:17:02 +00:00
|
|
|
with %out == %in
|
2016-10-14 21:19:02 +00:00
|
|
|
emit "! reg -> ubyteX"
|
2016-10-12 21:12:53 +00:00
|
|
|
cost 1;
|
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
/* ushort intrinsics */
|
|
|
|
|
|
|
|
out:(int)ushortX = in:(int)ushort0
|
|
|
|
with %out == %in
|
|
|
|
emit "! ushort0 -> ushortX"
|
2016-10-12 21:12:53 +00:00
|
|
|
cost 1;
|
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
out:(int)ushort0 = in:(int)ushortX
|
|
|
|
emit "andi %out, %in, 0xff ! ushortX -> ushort0"
|
|
|
|
cost 4;
|
|
|
|
|
|
|
|
out:(int)reg = in:(int)ushort0
|
|
|
|
with %out == %in
|
|
|
|
emit "! ushort0 -> reg"
|
|
|
|
cost 4;
|
|
|
|
|
|
|
|
out:(int)ushortX = in:(int)reg
|
|
|
|
with %out == %in
|
|
|
|
emit "! reg -> ushortX"
|
2016-10-12 21:12:53 +00:00
|
|
|
cost 1;
|
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
/* byte conversions */
|
2016-10-12 21:12:53 +00:00
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
out:(int)ubyte0 = CIU14(in:(int)ubyte0)
|
|
|
|
with %out == %in
|
|
|
|
emit "! CIU14(ubyte0) -> ubyte0"
|
|
|
|
cost 1;
|
|
|
|
|
|
|
|
out:(int)ubyte0 = CIU41(in:(int)ubyte0)
|
|
|
|
with %out == %in
|
|
|
|
emit "! CIU41(ubyte0) -> ubyte0"
|
|
|
|
cost 1;
|
|
|
|
|
|
|
|
out:(int)ubyteX = CIU41(in:(int)ubyteX)
|
|
|
|
with %out == %in
|
|
|
|
emit "! CIU41(ubyteX) -> ubyteX"
|
|
|
|
cost 1;
|
|
|
|
|
|
|
|
out:(int)reg = CII14(in:(int)ubyte0)
|
2016-10-14 20:17:02 +00:00
|
|
|
with %out == %in
|
2016-10-14 21:19:02 +00:00
|
|
|
emit "! CII14(ubyte0) -> reg"
|
|
|
|
cost 4;
|
|
|
|
|
|
|
|
out:(int)reg = CII14(in:(int)ubyteX)
|
|
|
|
emit "extsb %out, %in ! CII14(ubyteX) -> reg"
|
2016-10-12 21:12:53 +00:00
|
|
|
cost 4;
|
2016-10-08 09:35:33 +00:00
|
|
|
|
2016-10-14 21:19:02 +00:00
|
|
|
/* short conversions */
|
|
|
|
|
|
|
|
out:(int)ushort0 = CIU24(in:(int)ushort0)
|
|
|
|
with %out == %in
|
|
|
|
emit "! CIU24(ushort0) -> ushort0"
|
|
|
|
cost 1;
|
|
|
|
|
|
|
|
out:(int)ushort0 = CIU42(in:(int)ushort0)
|
|
|
|
with %out == %in
|
|
|
|
emit "! CIU42(ushort0) -> ushort0"
|
|
|
|
cost 1;
|
|
|
|
|
|
|
|
out:(int)ushortX = CIU42(in:(int)ushortX)
|
|
|
|
with %out == %in
|
|
|
|
emit "! CIU42(ushortX) -> ushortX"
|
|
|
|
cost 1;
|
|
|
|
|
|
|
|
out:(int)reg = CII24(in:(int)ushort0)
|
|
|
|
with %out == %in
|
|
|
|
emit "! CII24(ushort0) -> reg"
|
|
|
|
cost 4;
|
|
|
|
|
|
|
|
out:(int)reg = CII24(in:(int)ushortX)
|
|
|
|
emit "extsh %out, %in"
|
|
|
|
cost 4;
|
2016-09-24 20:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Locals */
|
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
out:(int)reg = in:LOCAL4
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "addi %out, fp, #$in"
|
2016-09-24 15:20:40 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-09-24 20:46:08 +00:00
|
|
|
address = in:LOCAL4
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "$in(fp)";
|
|
|
|
|
2016-09-24 20:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Memory addressing modes */
|
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
address = ADD4(addr:(int)reg, offset:CONST4)
|
2016-10-09 10:32:36 +00:00
|
|
|
when signed_constant(%offset, 16)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "$offset(%addr)";
|
2016-10-01 21:41:45 +00:00
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
address = addr:(int)reg
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "0(%addr)";
|
2016-09-24 15:20:40 +00:00
|
|
|
|
2016-09-24 20:46:08 +00:00
|
|
|
|
2016-10-01 21:41:45 +00:00
|
|
|
|
2016-09-24 20:46:08 +00:00
|
|
|
/* Branches */
|
|
|
|
|
|
|
|
JUMP(addr:BLOCK4)
|
2016-09-25 15:14:54 +00:00
|
|
|
emit "b $addr"
|
2016-09-24 20:46:08 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
CJUMPEQ(value:(cr)cr, PAIR(true:BLOCK4, false:BLOCK4))
|
|
|
|
emit "bc IFTRUE, EQ, $true"
|
2016-09-27 21:38:47 +00:00
|
|
|
emit "b $false"
|
|
|
|
cost 8;
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
CJUMPLE(value:(cr)cr, PAIR(true:BLOCK4, false:BLOCK4))
|
|
|
|
emit "bc IFTRUE, LE, $true"
|
|
|
|
emit "b $false"
|
2016-10-01 21:41:45 +00:00
|
|
|
cost 8;
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
CJUMPLT(value:(cr)cr, PAIR(true:BLOCK4, false:BLOCK4))
|
|
|
|
emit "bc IFTRUE, LT, $true"
|
|
|
|
emit "b $false"
|
2016-10-02 15:50:34 +00:00
|
|
|
cost 8;
|
|
|
|
|
2016-10-01 21:41:45 +00:00
|
|
|
CALL(dest:LABEL4)
|
|
|
|
emit "bl $dest"
|
|
|
|
cost 4;
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
CALL(dest:(int)reg)
|
|
|
|
emit "mtspr ctr, %dest"
|
|
|
|
emit "bcctrl ALWAYS, 0, 0"
|
|
|
|
cost 8;
|
|
|
|
|
|
|
|
JUMP(dest:LABEL4)
|
|
|
|
emit "b $dest"
|
|
|
|
cost 4;
|
|
|
|
|
|
|
|
|
2016-09-24 20:46:08 +00:00
|
|
|
|
|
|
|
/* Comparisons */
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
cr:(cr)cr = COMPARES4(left:(int)reg, right:(int)reg)
|
|
|
|
emit "cmp %cr, 0, %left, %right"
|
2016-09-24 20:46:08 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
cr:(cr)cr = COMPARES4(left:(int)reg, right:CONST4)
|
2016-10-09 10:32:36 +00:00
|
|
|
when signed_constant(%right, 16)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "cmpi %cr, 0, %left, $right"
|
2016-09-27 21:38:47 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
cr:(cr)cr = COMPAREU4(left:(int)reg, right:(int)reg)
|
|
|
|
emit "cmpl %cr, 0, %left, %right"
|
|
|
|
cost 4;
|
|
|
|
|
|
|
|
cr:(cr)cr = COMPAREU4(left:(int)reg, right:CONST4)
|
2016-10-09 10:32:36 +00:00
|
|
|
when signed_constant(%right, 16)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "cmpli %cr, 0, %left, $right"
|
|
|
|
cost 4;
|
|
|
|
|
|
|
|
cr:(cr)cr = COMPARES4(COMPARES4(left:(int)reg, right:(int)reg), result:CONST4)
|
2016-10-09 10:32:36 +00:00
|
|
|
when specific_constant(%result, 0)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "cmp %cr, 0, %left, %right"
|
|
|
|
cost 4;
|
|
|
|
|
|
|
|
cr:(cr)cr = COMPARES4(COMPARES4(left:(int)reg, right:CONST4), result:CONST4)
|
2016-10-09 10:32:36 +00:00
|
|
|
when specific_constant(%result, 0)
|
|
|
|
when signed_constant(%right, 16)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "cmpi %cr, 0, %left, $right"
|
|
|
|
cost 4;
|
|
|
|
|
|
|
|
cr:(cr)cr = COMPARES4(COMPAREU4(left:(int)reg, right:(int)reg), result:CONST4)
|
2016-10-09 10:32:36 +00:00
|
|
|
when specific_constant(%result, 0)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "cmpl %cr, 0, %left, %right"
|
|
|
|
cost 4;
|
|
|
|
|
2016-09-24 20:46:08 +00:00
|
|
|
|
|
|
|
|
|
|
|
/* Conversions */
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
out:(int)reg = CIU44(in:(int)reg)
|
2016-10-12 20:58:46 +00:00
|
|
|
emit "mr %out, %in ! ciu44"
|
2016-10-08 09:35:33 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-12 20:58:46 +00:00
|
|
|
out:(int)reg = CUI44(in:(int)reg)
|
|
|
|
emit "mr %out, %in ! cui44"
|
|
|
|
cost 4;
|
2016-10-08 09:35:33 +00:00
|
|
|
|
2016-09-24 20:46:08 +00:00
|
|
|
|
|
|
|
/* ALU operations */
|
2016-09-24 15:20:40 +00:00
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
out:(int)reg = ADD4(left:(int)reg, right:(int)reg)
|
2016-10-05 20:56:25 +00:00
|
|
|
emit "add %out, %left, %right"
|
2016-09-24 15:20:40 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
out:(int)reg = ADD4(left:(int)reg, right:CONST4)
|
2016-10-09 10:32:36 +00:00
|
|
|
when signed_constant(%right, 16)
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "addi %out, %left, $right"
|
2016-09-24 15:20:40 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
out:(int)reg = SUB4(left:(int)reg, right:(int)reg)
|
2016-10-10 22:29:18 +00:00
|
|
|
emit "subf %out, %left, %right"
|
|
|
|
cost 4;
|
|
|
|
|
|
|
|
out:(int)reg = SUB4(left:(int)reg, right:CONST4)
|
|
|
|
emit "addi %out, %left, -($right)"
|
2016-10-08 09:35:33 +00:00
|
|
|
cost 4;
|
2016-10-01 21:41:45 +00:00
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
out:(int)reg = MUL4(left:(int)reg, right:(int)reg)
|
|
|
|
emit "mullw %out, %right, %left"
|
2016-10-01 21:41:45 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
out:(int)reg = MOD4(left:(int)reg, right:(int)reg)
|
|
|
|
emit "divw %out, %left, %right"
|
|
|
|
emit "mullw %out, %out, %right"
|
|
|
|
emit "subf %out, %out, %left"
|
|
|
|
cost 12;
|
|
|
|
|
|
|
|
out:(int)reg = DIV4(left:(int)reg, right:(int)reg)
|
|
|
|
emit "divw %out, %left, %right"
|
|
|
|
cost 4;
|
2016-09-24 15:20:40 +00:00
|
|
|
|
2016-10-09 12:45:13 +00:00
|
|
|
out:(int)reg = ASL4(left:(int)reg, right:(int)reg)
|
|
|
|
emit "slw %out, %left, %right"
|
|
|
|
cost 4;
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
out:(int)reg = NEG4(left:(int)reg)
|
|
|
|
emit "neg %out, %left"
|
|
|
|
cost 4;
|
2016-09-24 15:20:40 +00:00
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
out:(int)reg = EOR4(left:(int)reg, right:(int)reg)
|
|
|
|
emit "xor %out, %right, %left"
|
2016-09-24 15:20:40 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
out:(int)reg = value:LABEL4
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "la %out, $value"
|
2016-09-24 20:46:08 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
out:(int)reg = value:BLOCK4
|
2016-10-08 09:35:33 +00:00
|
|
|
emit "la %out, $value"
|
2016-09-24 15:20:40 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
out:(int)reg = value:CONST4
|
2016-10-10 22:23:35 +00:00
|
|
|
emit "li %out, $value"
|
2016-10-01 11:56:52 +00:00
|
|
|
cost 8;
|
|
|
|
|
2016-10-08 09:35:33 +00:00
|
|
|
|
2016-09-29 20:06:04 +00:00
|
|
|
/* FPU operations */
|
|
|
|
|
2016-10-09 13:08:03 +00:00
|
|
|
out:(float)reg = value:CONSTF4
|
|
|
|
emit "lfs %out, address-containing-$value"
|
|
|
|
cost 8;
|
|
|
|
|
2016-10-05 20:56:25 +00:00
|
|
|
out:(float)reg = ADDF4(left:(float)reg, right:(float)reg)
|
|
|
|
emit "fadds %out, %left, %right"
|
2016-09-29 20:06:04 +00:00
|
|
|
cost 4;
|
|
|
|
|
2016-10-09 13:08:03 +00:00
|
|
|
out:(float)reg = SUBF4(left:(float)reg, right:(float)reg)
|
|
|
|
emit "fsubs %out, %left, %right"
|
|
|
|
cost 4;
|
|
|
|
|
|
|
|
|
2016-10-05 19:07:29 +00:00
|
|
|
/* vim: set sw=4 ts=4 expandtab : */
|
|
|
|
|