diff options
author | Andrius Štikonas <andrius@stikonas.eu> | 2024-01-12 21:06:46 +0000 |
---|---|---|
committer | Andrius Štikonas <andrius@stikonas.eu> | 2024-01-12 21:09:21 +0000 |
commit | 04365dd4c91f78361c7cf3169fe5fab3ccb9bfbf (patch) | |
tree | 62bec4b6dc19bb5871937c32ddefb4ac09131fca | |
parent | 6120656cbf6d772fd30a18d5ba950d39c99ba226 (diff) |
riscv64-asm.c: fix assembly instruction with negative immediate offsets.
This fixes expressions like ld a0, s0, -24 that regressed in
d87801bd50abb04be894628338164537d88654dc
-rw-r--r-- | riscv64-asm.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/riscv64-asm.c b/riscv64-asm.c index 7020f63..7f61d4c 100644 --- a/riscv64-asm.c +++ b/riscv64-asm.c @@ -189,7 +189,7 @@ static void parse_operand(TCCState *s1, Operand *op) op->e = e; /* compare against unsigned 12-bit maximum */ if (!op->e.sym) { - if (op->e.v < 0x1000) + if ((int) op->e.v >= -0x1000 && (int) op->e.v < 0x1000) op->type = OP_IM12S; } else if (op->e.sym->type.t & (VT_EXTERN | VT_STATIC)) { label.type.t = VT_VOID | VT_STATIC; |