powerpc: Avoid an unnecessary test and branch in longjmp()
authorChristophe Leroy <christophe.leroy@c-s.fr>
Tue, 17 Apr 2018 17:08:16 +0000 (19:08 +0200)
committerMichael Ellerman <mpe@ellerman.id.au>
Thu, 17 May 2018 14:09:05 +0000 (00:09 +1000)
Doing the test at exit of the function avoids an unnecessary
test and branch inside longjmp().

Semantics are unchanged.

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
Reviewed-by: Michael Ellerman <mpe@ellerman.id.au>
Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
arch/powerpc/kernel/misc.S

index 384357c..c60b70d 100644 (file)
@@ -85,10 +85,7 @@ _GLOBAL(setjmp)
        blr
 
 _GLOBAL(longjmp)
-       PPC_LCMPI r4,0
-       bne     1f
-       li      r4,1
-1:     PPC_LL  r13,4*SZL(r3)
+       PPC_LL  r13,4*SZL(r3)
        PPC_LL  r14,5*SZL(r3)
        PPC_LL  r15,6*SZL(r3)
        PPC_LL  r16,7*SZL(r3)
@@ -113,7 +110,9 @@ _GLOBAL(longjmp)
        PPC_LL  r1,SZL(r3)
        PPC_LL  r2,2*SZL(r3)
        mtlr    r0
-       mr      r3,r4
+       mr.     r3, r4
+       bnelr
+       li      r3, 1
        blr
 
 _GLOBAL(current_stack_pointer)