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 55ca3fd675
but whilst it was part of the code being tested, it didn't end up in the
commit.

Signed-off-by: Alessandro Gatti <a.gatti@frob.it>
This commit is contained in:
Alessandro Gatti 2025-02-04 00:05:44 +01:00 committed by Damien George
parent e37d498cc0
commit 44a7731669

View file

@ -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);