Skip to content
This repository was archived by the owner on Sep 6, 2023. It is now read-only.

Commit d4a799f

Browse files
committed
py: Make asm_arm_less_op take destination register as first arg.
This gets ARM native emitter working againg and addresses issue #858.
1 parent b92cbe6 commit d4a799f

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

py/asmarm.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -287,10 +287,10 @@ void asm_arm_cmp_reg_reg(asm_arm_t *as, uint rd, uint rn) {
287287
emit_al(as, 0x1500000 | (rd << 16) | rn);
288288
}
289289

290-
void asm_arm_less_op(asm_arm_t *as, uint rd, uint rn) {
291-
asm_arm_cmp_reg_reg(as, rd, rn); // cmp rd, rn
292-
emit(as, asm_arm_op_mov_imm(REG_RET, 1) | ARM_CC_LT); // movlt REG_RET, #1
293-
emit(as, asm_arm_op_mov_imm(REG_RET, 0) | ARM_CC_GE); // movge REG_RET, #0
290+
void asm_arm_less_op(asm_arm_t *as, uint rd, uint rn, uint rm) {
291+
asm_arm_cmp_reg_reg(as, rn, rm); // cmp rn, rm
292+
emit(as, asm_arm_op_mov_imm(rd, 1) | ARM_CC_LT); // movlt rd, #1
293+
emit(as, asm_arm_op_mov_imm(rd, 0) | ARM_CC_GE); // movge rd, #0
294294
}
295295

296296
void asm_arm_add_reg(asm_arm_t *as, uint rd, uint rn, uint rm) {

py/asmarm.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ void asm_arm_mov_reg_local(asm_arm_t *as, uint rd, int local_num);
8888

8989
void asm_arm_cmp_reg_i8(asm_arm_t *as, uint rd, int imm);
9090
void asm_arm_cmp_reg_reg(asm_arm_t *as, uint rd, uint rn);
91-
void asm_arm_less_op(asm_arm_t *as, uint rd, uint rn);
91+
void asm_arm_less_op(asm_arm_t *as, uint rd, uint rn, uint rm);
9292
void asm_arm_add_reg(asm_arm_t *as, uint rd, uint rn, uint rm);
9393
void asm_arm_mov_reg_local_addr(asm_arm_t *as, uint rd, int local_num);
9494

py/emitnative.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1514,7 +1514,7 @@ STATIC void emit_native_binary_op(emit_t *emit, mp_binary_op_t op) {
15141514
asm_thumb_mov_rlo_i8(emit->as, REG_RET, 0); // if r0 >= r1
15151515
asm_thumb_mov_rlo_i8(emit->as, REG_RET, 1); // if r0 < r1
15161516
#elif N_ARM
1517-
asm_arm_less_op(emit->as, REG_ARG_2, REG_ARG_3);
1517+
asm_arm_less_op(emit->as, REG_RET, REG_ARG_2, REG_ARG_3);
15181518
#else
15191519
#error not implemented
15201520
#endif

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy