From fca1f51bf8209a41f8d7cd13ff09f113ac0d87b6 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Thu, 21 Sep 2023 02:38:29 +0200 Subject: [PATCH] ARM64: Fuse negative 32 bit constants into arithmetic ops again. Thanks to Peter Cawley. #1065 --- src/lj_asm_arm64.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/lj_asm_arm64.h b/src/lj_asm_arm64.h index c2b17737..8673f7df 100644 --- a/src/lj_asm_arm64.h +++ b/src/lj_asm_arm64.h @@ -222,7 +222,8 @@ static uint32_t asm_fuseopm(ASMState *as, A64Ins ai, IRRef ref, RegSet allow) return A64F_M(ir->r); } else if (irref_isk(ref)) { int64_t k = get_k64val(as, ref); - uint32_t m = logical ? emit_isk13(k, irt_is64(ir->t)) : emit_isk12(k); + uint32_t m = logical ? emit_isk13(k, irt_is64(ir->t)) : + emit_isk12(irt_is64(ir->t) ? k : (int32_t)k); if (m) return m; } else if (mayfuse(as, ref)) {