summaryrefslogtreecommitdiff
path: root/py/asmxtensa.c
diff options
context:
space:
mode:
Diffstat (limited to 'py/asmxtensa.c')
-rw-r--r--py/asmxtensa.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/py/asmxtensa.c b/py/asmxtensa.c
index 8da56ffe3..a269e5e7f 100644
--- a/py/asmxtensa.c
+++ b/py/asmxtensa.c
@@ -156,18 +156,24 @@ void asm_xtensa_setcc_reg_reg_reg(asm_xtensa_t *as, uint cond, uint reg_dest, ui
asm_xtensa_op_movi_n(as, reg_dest, 0);
}
-void asm_xtensa_mov_reg_i32(asm_xtensa_t *as, uint reg_dest, uint32_t i32) {
+size_t asm_xtensa_mov_reg_i32(asm_xtensa_t *as, uint reg_dest, uint32_t i32) {
+ // load the constant
+ uint32_t const_table_offset = (uint8_t*)as->const_table - as->base.code_base;
+ size_t loc = const_table_offset + as->cur_const * WORD_SIZE;
+ asm_xtensa_op_l32r(as, reg_dest, as->base.code_offset, loc);
+ // store the constant in the table
+ if (as->const_table != NULL) {
+ as->const_table[as->cur_const] = i32;
+ }
+ ++as->cur_const;
+ return loc;
+}
+
+void asm_xtensa_mov_reg_i32_optimised(asm_xtensa_t *as, uint reg_dest, uint32_t i32) {
if (SIGNED_FIT12(i32)) {
asm_xtensa_op_movi(as, reg_dest, i32);
} else {
- // load the constant
- uint32_t const_table_offset = (uint8_t*)as->const_table - as->base.code_base;
- asm_xtensa_op_l32r(as, reg_dest, as->base.code_offset, const_table_offset + as->cur_const * WORD_SIZE);
- // store the constant in the table
- if (as->const_table != NULL) {
- as->const_table[as->cur_const] = i32;
- }
- ++as->cur_const;
+ asm_xtensa_mov_reg_i32(as, reg_dest, i32);
}
}