linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 1/2] powerpc: avoid an unnecessary test and branch in longjmp()
@ 2018-04-17 17:08 Christophe Leroy
  2018-04-17 17:08 ` [PATCH v2 2/2] powerpc/32be: use stmw/lmw for registers save/restore in asm Christophe Leroy
  2018-05-21 10:01 ` [v2,1/2] powerpc: avoid an unnecessary test and branch in longjmp() Michael Ellerman
  0 siblings, 2 replies; 8+ messages in thread
From: Christophe Leroy @ 2018-04-17 17:08 UTC (permalink / raw)
  To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman
  Cc: linux-kernel, linuxppc-dev

Doing the test at exit of the function avoids an unnecessary
test and branch inside longjmp()

Signed-off-by: Christophe Leroy <christophe.leroy@c-s.fr>
---
 v2: Swapped both patches in the serie to reduce number of impacted lines

 arch/powerpc/kernel/misc.S | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/arch/powerpc/kernel/misc.S b/arch/powerpc/kernel/misc.S
index e1f3a5d054c4..746ee0320ad4 100644
--- a/arch/powerpc/kernel/misc.S
+++ b/arch/powerpc/kernel/misc.S
@@ -74,10 +74,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)
@@ -102,7 +99,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)
-- 
2.13.3

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-05-21 10:04 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-04-17 17:08 [PATCH v2 1/2] powerpc: avoid an unnecessary test and branch in longjmp() Christophe Leroy
2018-04-17 17:08 ` [PATCH v2 2/2] powerpc/32be: use stmw/lmw for registers save/restore in asm Christophe Leroy
2018-05-17 12:10   ` Michael Ellerman
2018-05-17 13:15     ` Segher Boessenkool
2018-05-17 13:27       ` Christophe LEROY
2018-05-17 14:27         ` Segher Boessenkool
2018-05-17 13:39     ` Benjamin Herrenschmidt
2018-05-21 10:01 ` [v2,1/2] powerpc: avoid an unnecessary test and branch in longjmp() Michael Ellerman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).