Skip to content

Commit 24c7858

Browse files
chleroympe
authored andcommitted
powerpc: Avoid an unnecessary test and branch in longjmp()
Doing the test at exit of the function avoids an unnecessary test and branch inside longjmp(). Semantics are unchanged. Signed-off-by: Christophe Leroy <[email protected]> Reviewed-by: Michael Ellerman <[email protected]> Signed-off-by: Michael Ellerman <[email protected]>
1 parent 96f391c commit 24c7858

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

arch/powerpc/kernel/misc.S

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ _GLOBAL(setjmp)
8585
blr
8686

8787
_GLOBAL(longjmp)
88-
PPC_LCMPI r4,0
89-
bne 1f
90-
li r4,1
91-
1: PPC_LL r13,4*SZL(r3)
88+
PPC_LL r13,4*SZL(r3)
9289
PPC_LL r14,5*SZL(r3)
9390
PPC_LL r15,6*SZL(r3)
9491
PPC_LL r16,7*SZL(r3)
@@ -113,7 +110,9 @@ _GLOBAL(longjmp)
113110
PPC_LL r1,SZL(r3)
114111
PPC_LL r2,2*SZL(r3)
115112
mtlr r0
116-
mr r3,r4
113+
mr. r3, r4
114+
bnelr
115+
li r3, 1
117116
blr
118117

119118
_GLOBAL(current_stack_pointer)

0 commit comments

Comments
 (0)