From 44a7731669f1c8429bb61b790a7e8bf8a86b045d Mon Sep 17 00:00:00 2001 From: Alessandro Gatti Date: Tue, 4 Feb 2025 00:05:44 +0100 Subject: [PATCH] py/emitnative: Load and store words just once for Viper code. This commit fixes two Xtensa sequences in order to terminate early when loading and storing word values via an immediate index. This was meant to be part of 55ca3fd67512555707304c6b68b836eb89f09d1c but whilst it was part of the code being tested, it didn't end up in the commit. Signed-off-by: Alessandro Gatti --- py/emitnative.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/py/emitnative.c b/py/emitnative.c index dd06447932..1aab0a9eb7 100644 --- a/py/emitnative.c +++ b/py/emitnative.c @@ -1609,6 +1609,7 @@ static void emit_native_load_subscr(emit_t *emit) { #elif N_XTENSA || N_XTENSAWIN if (index_value > 0 && index_value < 256) { asm_xtensa_l32i_optimised(emit->as, REG_RET, reg_base, index_value); + break; } #endif need_reg_single(emit, reg_index, 0); @@ -1887,6 +1888,7 @@ static void emit_native_store_subscr(emit_t *emit) { #elif N_XTENSA || N_XTENSAWIN if (index_value > 0 && index_value < 256) { asm_xtensa_s32i_optimised(emit->as, REG_RET, reg_base, index_value); + break; } #elif N_ARM ASM_MOV_REG_IMM(emit->as, reg_index, index_value);