All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/3] powerpc: Don't use local named register variable in current_thread_info
@ 2014-10-31  3:47 Anton Blanchard
  0 siblings, 0 replies; 13+ messages in thread
From: Anton Blanchard @ 2014-10-31  3:47 UTC (permalink / raw)
  To: benh, paulus, mpe, ulrich.weigand; +Cc: linuxppc-dev

LLVM doesn't support local named register variables and is unlikely
to. current_thread_info is using one, fix it by moving it out and
calling it __current_r1().

I gave it a bit of an obscure name because we don't want anyone else
using it - they should use current_stack_pointer(). This specific
case is performance critical and we can't afford to call a function
to get it. Furthermore it isn't important to know exactly where in
the stack we are since we mask the lower bits.

Signed-off-by: Anton Blanchard <anton@samba.org>
---
 arch/powerpc/include/asm/thread_info.h | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/arch/powerpc/include/asm/thread_info.h b/arch/powerpc/include/asm/thread_info.h
index b034ecd..ebc4f16 100644
--- a/arch/powerpc/include/asm/thread_info.h
+++ b/arch/powerpc/include/asm/thread_info.h
@@ -71,13 +71,12 @@ struct thread_info {
 #define THREAD_SIZE_ORDER	(THREAD_SHIFT - PAGE_SHIFT)
 
 /* how to get the thread information struct from C */
+register unsigned long __current_r1 asm("r1");
 static inline struct thread_info *current_thread_info(void)
 {
-	register unsigned long sp asm("r1");
-
 	/* gcc4, at least, is smart enough to turn this into a single
 	 * rlwinm for ppc32 and clrrdi for ppc64 */
-	return (struct thread_info *)(sp & ~(THREAD_SIZE-1));
+	return (struct thread_info *)(__current_r1 & ~(THREAD_SIZE-1));
 }
 
 #endif /* __ASSEMBLY__ */
-- 
1.9.1

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

end of thread, other threads:[~2015-01-08  6:36 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <1414727247-31838-1-git-send-email-anton__19440.5086375356$1414727300$gmane$org@samba.org>
2014-12-17  1:16 ` [PATCH 1/3] powerpc: Don't use local named register variable in current_thread_info Alexander Graf
2014-12-17  3:44   ` Anton Blanchard
2014-12-17  9:27     ` Alexander Graf
2014-12-22  6:49       ` Michael Ellerman
2014-12-18  5:11   ` Michael Ellerman
2014-12-18  6:25     ` Anton Blanchard
2014-12-18 15:02       ` Alexander Graf
2014-12-31 12:24       ` Alan Modra
2015-01-07  5:12         ` Anton Blanchard
2015-01-07 17:59           ` Scott Wood
2015-01-08  6:36           ` Alan Modra
2014-12-18 14:56     ` Alexander Graf
2014-10-31  3:47 Anton Blanchard

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.