diff mbox

[i386] : Use __builtin_ia32_pause some more

Message ID CAFULd4adkWJe_K8ALV+7OriFNGnSDMxxhGw1CDtNjhBwaHL9_A@mail.gmail.com
State New
Headers show

Commit Message

Uros Bizjak July 1, 2012, 1:10 p.m. UTC
Hello!

gcc/

2012-07-01  Uros Bizjak  <ubizjak@gmail.com>

	* config/i386/xmmintrin.h (_mm_sfence): Use __builtin_ia32_pause.

libgomp/

2012-07-01  Uros Bizjak  <ubizjak@gmail.com>

	* config/linux/x86/futex.h (cpu_relax): Use __builtin_ia32_pause.
	* testsuite/libgomp.c/sort-1.c (busy_wait): Ditto.

libitm/

2012-07-01  Uros Bizjak  <ubizjak@gmail.com>

	* config/x86/target.h (cpu_relax): Use __builtin_ia32_pause.

Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.

OK for mainline? The patch needs approval from libgomp and libitm maintainers.

Uros.

Comments

Uros Bizjak July 3, 2012, 7:26 a.m. UTC | #1
On Sun, Jul 1, 2012 at 3:10 PM, Uros Bizjak <ubizjak@gmail.com> wrote:

> gcc/
>
> 2012-07-01  Uros Bizjak  <ubizjak@gmail.com>
>
>         * config/i386/xmmintrin.h (_mm_sfence): Use __builtin_ia32_pause.
>
> libgomp/
>
> 2012-07-01  Uros Bizjak  <ubizjak@gmail.com>
>
>         * config/linux/x86/futex.h (cpu_relax): Use __builtin_ia32_pause.
>         * testsuite/libgomp.c/sort-1.c (busy_wait): Ditto.
>
> libitm/
>
> 2012-07-01  Uros Bizjak  <ubizjak@gmail.com>
>
>         * config/x86/target.h (cpu_relax): Use __builtin_ia32_pause.
>
> Bootstrapped and regression tested on x86_64-pc-linux-gnu {,-m32}.
>
> OK for mainline? The patch needs approval from libgomp and libitm maintainers.

I have committed the patch to mainline SVN under assumption that there
were no objections from maintainers (and the patch is strictly
target-dependant).

Uros.
diff mbox

Patch

Index: libitm/config/x86/target.h
===================================================================
--- libitm/config/x86/target.h	(revision 189100)
+++ libitm/config/x86/target.h	(working copy)
@@ -63,7 +63,7 @@  typedef struct gtm_jmpbuf
 static inline void
 cpu_relax (void)
 {
-  __asm volatile ("rep; nop" : : : "memory");
+  __builtin_ia32_pause ();
 }
 
 } // namespace GTM
Index: gcc/config/i386/xmmintrin.h
===================================================================
--- gcc/config/i386/xmmintrin.h	(revision 189100)
+++ gcc/config/i386/xmmintrin.h	(working copy)
@@ -1225,7 +1225,7 @@  _mm_sfence (void)
 extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__))
 _mm_pause (void)
 {
-  __asm__ __volatile__ ("rep; nop" : : );
+  __builtin_ia32_pause ();
 }
 
 /* Transpose the 4x4 matrix composed of row[0-3].  */
Index: libgomp/config/linux/x86/futex.h
===================================================================
--- libgomp/config/linux/x86/futex.h	(revision 189100)
+++ libgomp/config/linux/x86/futex.h	(working copy)
@@ -143,5 +143,5 @@  futex_wake (int *addr, int count)
 static inline void
 cpu_relax (void)
 {
-  __asm volatile ("rep; nop" : : : "memory");
+  __builtin_ia32_pause ();
 }
Index: libgomp/testsuite/libgomp.c/sort-1.c
===================================================================
--- libgomp/testsuite/libgomp.c/sort-1.c	(revision 189100)
+++ libgomp/testsuite/libgomp.c/sort-1.c	(working copy)
@@ -100,7 +100,7 @@  static inline void
 busy_wait (void)
 {
 #if defined __i386__ || defined __x86_64__
-  __asm volatile ("rep; nop" : : : "memory");
+  __builtin_ia32_pause ();
 #elif defined __ia64__
   __asm volatile ("hint @pause" : : : "memory");
 #elif defined __sparc__ && (defined __arch64__ || defined __sparc_v9__)