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>
This commit is contained in:

committed by
Leo Yu-Chi Liang

parent
ae2d9506a3
commit
a718e2aed5
@@ -54,12 +54,8 @@ ENTRY(longjmp)
|
|||||||
LOAD_IDX(sp, 13)
|
LOAD_IDX(sp, 13)
|
||||||
|
|
||||||
/* Move the return value in place, but return 1 if passed 0. */
|
/* Move the return value in place, but return 1 if passed 0. */
|
||||||
beq a1, zero, longjmp_1
|
seqz a0, a1
|
||||||
mv a0, a1
|
add a0, a0, a1
|
||||||
ret
|
|
||||||
|
|
||||||
longjmp_1:
|
|
||||||
li a0, 1
|
|
||||||
ret
|
ret
|
||||||
ENDPROC(longjmp)
|
ENDPROC(longjmp)
|
||||||
.popsection
|
.popsection
|
||||||
|
Reference in New Issue
Block a user