aboutsummaryrefslogtreecommitdiffhomepage
path: root/aarch64/emit.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2026-02-28 09:12:18 +0100
committerlemon <lsof@mailbox.org>2026-02-28 09:12:18 +0100
commitc0db7d92c14b242daf008f7e3731a5d080e23fa1 (patch)
tree67dd8011f4e5d2a5dda5df559b7617b9e8e4dd96 /aarch64/emit.c
parent441dad512b47a4ff3998f4f1c81068d40d32dc75 (diff)
regalloc: fix defn of spilled var with immediate
With `i64 %a = copy 0xabcdef12345`, if `%a` was spilled, this would turn into a `storei64` instruction with an unencondable immediate operand (larger than 32 bits in x86, non-zero in aarch64).
Diffstat (limited to 'aarch64/emit.c')
-rw-r--r--aarch64/emit.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/aarch64/emit.c b/aarch64/emit.c
index 3fd3278..fdcb866 100644
--- a/aarch64/emit.c
+++ b/aarch64/emit.c
@@ -831,7 +831,8 @@ emitinstr(uchar **pcode, struct function *fn, struct block *blk, int curi, struc
case Ostorei32: cls = KI32; X2 = Xstr; goto Store;
case Ostorei64: cls = KI64; X2 = Xstr;
Store:
- X2(pcode, cls, ref2oper(ins->r), mkmemoper(1<<(ins->op-Ostorei8), ins->l));
+ X2(pcode, cls, ins->r.bits == ZEROREF.bits ? REGZR : ref2oper(ins->r),
+ mkmemoper(1<<(ins->op-Ostorei8), ins->l));
break;
case Ostoref32: case Ostoref64:
Xfstr(pcode, KF32 + ins->op-Ostoref32, ref2oper(ins->r), mkmemoper(ins->op == Oloadf32 ? 4 : 8, ins->l));