mirror of
https://github.com/riscv-software-src/opensbi.git
synced 2026-11-20 10:32:19 +00:00
lib: Use proper add opcode on RV32 with Zalrsc
The addw opcode is only defined in RV64, which produces 32-bit results.
On RV32, the default add opcode already produces 32-bit results.
Fixes: 995f226f3f ("lib: Emit lr and sc instructions based on -march flags")
Signed-off-by: Marti Alonso <martialonso11@gmail.com>
Reviewed-by: Anup Patel <anup@brainfault.org>
Link: https://lore.kernel.org/r/20260301205421.2074835-1-martialonso11@gmail.com
Signed-off-by: Anup Patel <anup@brainfault.org>
This commit is contained in:
1 parent
ef1ee40e7d
commit
b5348006e9
3 files changed
+7
-2
No files matched your search
@@ -57,7 +57,11 @@ void spin_lock(spinlock_t *lock)
|
||||
" amoadd.w.aqrl %0, %4, %3\n"
|
||||
#elif defined(__riscv_zalrsc)
|
||||
"3: lr.w.aqrl %0, %3\n"
|
||||
#if __riscv_xlen == 64
|
||||
" addw %1, %0, %4\n"
|
||||
#elif __riscv_xlen == 32
|
||||
" add %1, %0, %4\n"
|
||||
#endif
|
||||
" sc.w.aqrl %1, %1, %3\n"
|
||||
" bnez %1, 3b\n"
|
||||
#else
|
||||
|
||||
Reference in new issue
Block a user