diff options
author | Damien George <damien.p.george@gmail.com> | 2014-09-15 16:39:24 +0100 |
---|---|---|
committer | Damien George <damien.p.george@gmail.com> | 2014-09-15 16:39:24 +0100 |
commit | d4a799f152a4823fe15003f2db908801fb84533c (patch) | |
tree | 754515e452e9c215dc6de5718be78eafe7ed209c | |
parent | b92cbe612913a7c9d066c34912a3f77fe6392b2b (diff) | |
download | micropython-d4a799f152a4823fe15003f2db908801fb84533c.tar.gz micropython-d4a799f152a4823fe15003f2db908801fb84533c.zip |
py: Make asm_arm_less_op take destination register as first arg.
This gets ARM native emitter working againg and addresses issue #858.
-rw-r--r-- | py/asmarm.c | 8 | ||||
-rw-r--r-- | py/asmarm.h | 2 | ||||
-rw-r--r-- | py/emitnative.c | 2 |
3 files changed, 6 insertions, 6 deletions
diff --git a/py/asmarm.c b/py/asmarm.c index da9f40920f..e1d4d84d9c 100644 --- a/py/asmarm.c +++ b/py/asmarm.c @@ -287,10 +287,10 @@ void asm_arm_cmp_reg_reg(asm_arm_t *as, uint rd, uint rn) { emit_al(as, 0x1500000 | (rd << 16) | rn); } -void asm_arm_less_op(asm_arm_t *as, uint rd, uint rn) { - asm_arm_cmp_reg_reg(as, rd, rn); // cmp rd, rn - emit(as, asm_arm_op_mov_imm(REG_RET, 1) | ARM_CC_LT); // movlt REG_RET, #1 - emit(as, asm_arm_op_mov_imm(REG_RET, 0) | ARM_CC_GE); // movge REG_RET, #0 +void asm_arm_less_op(asm_arm_t *as, uint rd, uint rn, uint rm) { + asm_arm_cmp_reg_reg(as, rn, rm); // cmp rn, rm + emit(as, asm_arm_op_mov_imm(rd, 1) | ARM_CC_LT); // movlt rd, #1 + emit(as, asm_arm_op_mov_imm(rd, 0) | ARM_CC_GE); // movge rd, #0 } void asm_arm_add_reg(asm_arm_t *as, uint rd, uint rn, uint rm) { diff --git a/py/asmarm.h b/py/asmarm.h index 72ce03c54b..7942793a24 100644 --- a/py/asmarm.h +++ b/py/asmarm.h @@ -88,7 +88,7 @@ void asm_arm_mov_reg_local(asm_arm_t *as, uint rd, int local_num); void asm_arm_cmp_reg_i8(asm_arm_t *as, uint rd, int imm); void asm_arm_cmp_reg_reg(asm_arm_t *as, uint rd, uint rn); -void asm_arm_less_op(asm_arm_t *as, uint rd, uint rn); +void asm_arm_less_op(asm_arm_t *as, uint rd, uint rn, uint rm); void asm_arm_add_reg(asm_arm_t *as, uint rd, uint rn, uint rm); void asm_arm_mov_reg_local_addr(asm_arm_t *as, uint rd, int local_num); diff --git a/py/emitnative.c b/py/emitnative.c index 0bddfbabad..9b3793966c 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -1514,7 +1514,7 @@ STATIC void emit_native_binary_op(emit_t *emit, mp_binary_op_t op) { asm_thumb_mov_rlo_i8(emit->as, REG_RET, 0); // if r0 >= r1 asm_thumb_mov_rlo_i8(emit->as, REG_RET, 1); // if r0 < r1 #elif N_ARM - asm_arm_less_op(emit->as, REG_ARG_2, REG_ARG_3); + asm_arm_less_op(emit->as, REG_RET, REG_ARG_2, REG_ARG_3); #else #error not implemented #endif |