Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 11 Apr 2014 06:17:44 +0000 (UTC)
From:      Justin Hibbits <jhibbits@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r264338 - in head/sys/powerpc: include powerpc
Message-ID:  <201404110617.s3B6HiD3068954@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jhibbits
Date: Fri Apr 11 06:17:44 2014
New Revision: 264338
URL: http://svnweb.freebsd.org/changeset/base/264338

Log:
  Small performance optimization.  Clobber only cr0, rather than the entire CR.
  
  Discussed with:	rdivacky,nwhitehorn
  MFC after:	3 weeks

Modified:
  head/sys/powerpc/include/atomic.h
  head/sys/powerpc/include/counter.h
  head/sys/powerpc/powerpc/copyinout.c

Modified: head/sys/powerpc/include/atomic.h
==============================================================================
--- head/sys/powerpc/include/atomic.h	Fri Apr 11 06:15:58 2014	(r264337)
+++ head/sys/powerpc/include/atomic.h	Fri Apr 11 06:17:44 2014	(r264338)
@@ -74,7 +74,7 @@
 	"	bne-	1b\n"					\
 	: "=&r" (t), "=m" (*p)					\
 	: "r" (p), "r" (v), "m" (*p)				\
-	: "cc", "memory")					\
+	: "cr0", "memory")					\
     /* __atomic_add_int */
 
 #ifdef __powerpc64__
@@ -86,7 +86,7 @@
 	"	bne-	1b\n"					\
 	: "=&r" (t), "=m" (*p)					\
 	: "r" (p), "r" (v), "m" (*p)				\
-	: "cc", "memory")					\
+	: "cr0", "memory")					\
     /* __atomic_add_long */
 #else
 #define	__atomic_add_long(p, v, t)				\
@@ -97,7 +97,7 @@
 	"	bne-	1b\n"					\
 	: "=&r" (t), "=m" (*p)					\
 	: "r" (p), "r" (v), "m" (*p)				\
-	: "cc", "memory")					\
+	: "cr0", "memory")					\
     /* __atomic_add_long */
 #endif
 
@@ -160,7 +160,7 @@ _ATOMIC_ADD(long)
 	"	bne-	1b\n"					\
 	: "=&r" (t), "=m" (*p)					\
 	: "r" (p), "r" (v), "m" (*p)				\
-	: "cc", "memory")					\
+	: "cr0", "memory")					\
     /* __atomic_clear_int */
 
 #ifdef __powerpc64__
@@ -172,7 +172,7 @@ _ATOMIC_ADD(long)
 	"	bne-	1b\n"					\
 	: "=&r" (t), "=m" (*p)					\
 	: "r" (p), "r" (v), "m" (*p)				\
-	: "cc", "memory")					\
+	: "cr0", "memory")					\
     /* __atomic_clear_long */
 #else
 #define	__atomic_clear_long(p, v, t)				\
@@ -183,7 +183,7 @@ _ATOMIC_ADD(long)
 	"	bne-	1b\n"					\
 	: "=&r" (t), "=m" (*p)					\
 	: "r" (p), "r" (v), "m" (*p)				\
-	: "cc", "memory")					\
+	: "cr0", "memory")					\
     /* __atomic_clear_long */
 #endif
 
@@ -262,7 +262,7 @@ _ATOMIC_CLEAR(long)
 	"	bne-	1b\n"					\
 	: "=&r" (t), "=m" (*p)					\
 	: "r" (p), "r" (v), "m" (*p)				\
-	: "cc", "memory")					\
+	: "cr0", "memory")					\
     /* __atomic_set_int */
 
 #ifdef __powerpc64__
@@ -274,7 +274,7 @@ _ATOMIC_CLEAR(long)
 	"	bne-	1b\n"					\
 	: "=&r" (t), "=m" (*p)					\
 	: "r" (p), "r" (v), "m" (*p)				\
-	: "cc", "memory")					\
+	: "cr0", "memory")					\
     /* __atomic_set_long */
 #else
 #define	__atomic_set_long(p, v, t)				\
@@ -285,7 +285,7 @@ _ATOMIC_CLEAR(long)
 	"	bne-	1b\n"					\
 	: "=&r" (t), "=m" (*p)					\
 	: "r" (p), "r" (v), "m" (*p)				\
-	: "cc", "memory")					\
+	: "cr0", "memory")					\
     /* __atomic_set_long */
 #endif
 
@@ -348,7 +348,7 @@ _ATOMIC_SET(long)
 	"	bne-	1b\n"					\
 	: "=&r" (t), "=m" (*p)					\
 	: "r" (p), "r" (v), "m" (*p)				\
-	: "cc", "memory")					\
+	: "cr0", "memory")					\
     /* __atomic_subtract_int */
 
 #ifdef __powerpc64__
@@ -360,7 +360,7 @@ _ATOMIC_SET(long)
 	"	bne-	1b\n"					\
 	: "=&r" (t), "=m" (*p)					\
 	: "r" (p), "r" (v), "m" (*p)				\
-	: "cc", "memory")					\
+	: "cr0", "memory")					\
     /* __atomic_subtract_long */
 #else
 #define	__atomic_subtract_long(p, v, t)				\
@@ -371,7 +371,7 @@ _ATOMIC_SET(long)
 	"	bne-	1b\n"					\
 	: "=&r" (t), "=m" (*p)					\
 	: "r" (p), "r" (v), "m" (*p)				\
-	: "cc", "memory")					\
+	: "cr0", "memory")					\
     /* __atomic_subtract_long */
 #endif
 
@@ -444,7 +444,7 @@ atomic_readandclear_int(volatile u_int *
 		"bne- 1b\n\t"			/* spin if failed */
 		: "=&r"(result), "=&r"(temp), "=m" (*addr)
 		: "r" (addr), "m" (*addr)
-		: "cc", "memory");
+		: "cr0", "memory");
 #endif
 
 	return (result);
@@ -465,7 +465,7 @@ atomic_readandclear_long(volatile u_long
 		"bne- 1b\n\t"			/* spin if failed */
 		: "=&r"(result), "=&r"(temp), "=m" (*addr)
 		: "r" (addr), "m" (*addr)
-		: "cc", "memory");
+		: "cr0", "memory");
 #endif
 
 	return (result);
@@ -568,7 +568,7 @@ atomic_cmpset_int(volatile u_int* p, u_i
 		"3:\n\t"
 		: "=&r" (ret), "=m" (*p)
 		: "r" (p), "r" (cmpval), "r" (newval), "m" (*p)
-		: "cc", "memory");
+		: "cr0", "memory");
 #endif
 
 	return (ret);
@@ -604,7 +604,7 @@ atomic_cmpset_long(volatile u_long* p, u
 		"3:\n\t"
 		: "=&r" (ret), "=m" (*p)
 		: "r" (p), "r" (cmpval), "r" (newval), "m" (*p)
-		: "cc", "memory");
+		: "cr0", "memory");
 #endif
 
 	return (ret);
@@ -695,7 +695,7 @@ atomic_swap_32(volatile u_int *p, u_int 
 	"	bne-	1b\n"
 	: "=&r" (prev), "+m" (*(volatile u_int *)p)
 	: "r" (p), "r" (v)
-	: "cc", "memory");
+	: "cr0", "memory");
 
 	return (prev);
 }
@@ -712,7 +712,7 @@ atomic_swap_64(volatile u_long *p, u_lon
 	"	bne-	1b\n"
 	: "=&r" (prev), "+m" (*(volatile u_long *)p)
 	: "r" (p), "r" (v)
-	: "cc", "memory");
+	: "cr0", "memory");
 
 	return (prev);
 }

Modified: head/sys/powerpc/include/counter.h
==============================================================================
--- head/sys/powerpc/include/counter.h	Fri Apr 11 06:15:58 2014	(r264337)
+++ head/sys/powerpc/include/counter.h	Fri Apr 11 06:17:44 2014	(r264338)
@@ -95,7 +95,7 @@ counter_u64_add(counter_u64_t c, int64_t
 	    "bne-	1b"
 	    : "=&b" (ccpu), "=&r" (old)
 	    : "r" ((char *)c - (char *)&__pcpu[0]), "r" (inc)
-	    : "cc", "memory");
+	    : "cr0", "memory");
 }
 
 #else	/* !64bit */

Modified: head/sys/powerpc/powerpc/copyinout.c
==============================================================================
--- head/sys/powerpc/powerpc/copyinout.c	Fri Apr 11 06:15:58 2014	(r264337)
+++ head/sys/powerpc/powerpc/copyinout.c	Fri Apr 11 06:17:44 2014	(r264338)
@@ -503,7 +503,7 @@ casuword32(volatile uint32_t *addr, uint
 		"3:\n\t"
 		: "=&r" (val), "=m" (*p)
 		: "r" (p), "r" (old), "r" (new), "m" (*p)
-		: "cc", "memory");
+		: "cr0", "memory");
 
 	td->td_pcb->pcb_onfault = NULL;
 
@@ -551,7 +551,7 @@ casuword(volatile u_long *addr, u_long o
 		"3:\n\t"
 		: "=&r" (val), "=m" (*p)
 		: "r" (p), "r" (old), "r" (new), "m" (*p)
-		: "cc", "memory");
+		: "cr0", "memory");
 
 	td->td_pcb->pcb_onfault = NULL;
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201404110617.s3B6HiD3068954>