summaryrefslogtreecommitdiffstatshomepage
path: root/py/asmarm.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2014-09-29 18:45:42 +0100
committerDamien George <damien.p.george@gmail.com>2014-09-29 19:42:06 +0100
commit3112cde9006809a1ffa7f19e96fa8ee28311f411 (patch)
treec888f841266f72afb787069eaf824086ad91d22e /py/asmarm.c
parent6f81348fa25216f03686b342765f337ab57e2e5f (diff)
downloadmicropython-3112cde9006809a1ffa7f19e96fa8ee28311f411.tar.gz
micropython-3112cde9006809a1ffa7f19e96fa8ee28311f411.zip
py: Implement more binary ops for viper emitter.
This included a bit of restructuring of the assembler backends. Note that the ARM backend is missing a few functions and won't compile.
Diffstat (limited to 'py/asmarm.c')
-rw-r--r--py/asmarm.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/py/asmarm.c b/py/asmarm.c
index 0d55686920..8dbd9ad20a 100644
--- a/py/asmarm.c
+++ b/py/asmarm.c
@@ -170,6 +170,11 @@ STATIC uint asm_arm_op_sub_imm(uint rd, uint rn, uint imm) {
return 0x2400000 | (rn << 16) | (rd << 12) | (imm & 0xFF);
}
+STATIC uint asm_arm_op_sub_reg(uint rd, uint rn, uint rm) {
+ // sub rd, rn, rm
+ return 0x0400000 | (rn << 16) | (rd << 12) | rm;
+}
+
void asm_arm_bkpt(asm_arm_t *as) {
// bkpt #0
emit_al(as, 0x1200070);
@@ -298,11 +303,16 @@ void asm_arm_less_op(asm_arm_t *as, uint rd, uint rn, uint rm) {
emit(as, asm_arm_op_mov_imm(rd, 0) | ASM_ARM_CC_GE); // movge rd, #0
}
-void asm_arm_add_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
+void asm_arm_add_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
// add rd, rn, rm
emit_al(as, asm_arm_op_add_reg(rd, rn, rm));
}
+void asm_arm_sub_reg_reg_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {
+ // sub rd, rn, rm
+ emit_al(as, asm_arm_op_sub_reg(rd, rn, rm));
+}
+
void asm_arm_mov_reg_local_addr(asm_arm_t *as, uint rd, int local_num) {
// add rd, sp, #local_num*4
emit_al(as, asm_arm_op_add_imm(rd, ASM_ARM_REG_SP, local_num << 2));