diff options
author | Heinrich Schuchardt <xypron.glpk@gmx.de> | 2021-03-23 19:11:26 +0100 |
---|---|---|
committer | Leo Yu-Chi Liang <ycliang@andestech.com> | 2021-04-08 15:37:29 +0800 |
commit | a718e2aed52a135f7a6a8745a49e4f5bdff49ecf (patch) | |
tree | d35e20f4c1b298dcfc0b9b1759d20188f1449e9e | |
parent | ae2d9506a36ce2a31b2865c7071e3d20aa633340 (diff) | |
download | u-boot-a718e2aed52a135f7a6a8745a49e4f5bdff49ecf.tar.gz u-boot-a718e2aed52a135f7a6a8745a49e4f5bdff49ecf.tar.xz u-boot-a718e2aed52a135f7a6a8745a49e4f5bdff49ecf.zip |
riscv: simplify longjmp
The value returned by setjmp must be nonzero. If zero is passed as
parameter it must be replaced by 1.
This patch reduces the code size a bit.
Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de>
Reviewed-by: Sean Anderson <seanga2@gmail.com>
Reviewed-by: Leo Yu-Chi Liang <ycliang@andestech.com>
-rw-r--r-- | arch/riscv/lib/setjmp.S | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/arch/riscv/lib/setjmp.S b/arch/riscv/lib/setjmp.S index 72bc9241f6..99d6195827 100644 --- a/arch/riscv/lib/setjmp.S +++ b/arch/riscv/lib/setjmp.S @@ -54,12 +54,8 @@ ENTRY(longjmp) LOAD_IDX(sp, 13) /* Move the return value in place, but return 1 if passed 0. */ - beq a1, zero, longjmp_1 - mv a0, a1 - ret - - longjmp_1: - li a0, 1 + seqz a0, a1 + add a0, a0, a1 ret ENDPROC(longjmp) .popsection |