From f9a8f6d9cbcffff7d591c18c1e8d9155365db2c8 Mon Sep 17 00:00:00 2001 From: Ian Lance Taylor Date: Fri, 30 May 2014 13:11:05 +0000 Subject: [PATCH] xmmintrin.h (_mm_pause): Move out of scope of pragma target("sse"). gcc/: * config/i386/xmmintrin.h (_mm_pause): Move out of scope of pragma target("sse"). testsuite/: * gcc.target/i386/pause-2.c: New test. From-SVN: r211079 --- gcc/ChangeLog | 5 +++++ gcc/config/i386/xmmintrin.h | 20 +++++++++++--------- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/gcc.target/i386/pause-2.c | 12 ++++++++++++ 4 files changed, 32 insertions(+), 9 deletions(-) create mode 100644 gcc/testsuite/gcc.target/i386/pause-2.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index c7b2af3afc7..4eb43645229 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2014-05-30 Ian Lance Taylor + + * config/i386/xmmintrin.h (_mm_pause): Move out of scope of pragma + target("sse"). + 2014-05-30 Tom de Vries * config/i386/i386.c (TARGET_CALL_FUSAGE_CONTAINS_NON_CALLEE_CLOBBERS): diff --git a/gcc/config/i386/xmmintrin.h b/gcc/config/i386/xmmintrin.h index a3824e73fc2..ec572348c38 100644 --- a/gcc/config/i386/xmmintrin.h +++ b/gcc/config/i386/xmmintrin.h @@ -1231,15 +1231,6 @@ _mm_sfence (void) __builtin_ia32_sfence (); } -/* The execution of the next instruction is delayed by an implementation - specific amount of time. The instruction does not modify the - architectural state. */ -extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) -_mm_pause (void) -{ - __builtin_ia32_pause (); -} - /* Transpose the 4x4 matrix composed of row[0-3]. */ #define _MM_TRANSPOSE4_PS(row0, row1, row2, row3) \ do { \ @@ -1262,4 +1253,15 @@ do { \ #pragma GCC pop_options #endif /* __DISABLE_SSE__ */ +/* The execution of the next instruction is delayed by an implementation + specific amount of time. The instruction does not modify the + architectural state. This is after the pop_options pragma because + it does not require SSE support in the processor--the encoding is a + nop on processors that do not support it. */ +extern __inline void __attribute__((__gnu_inline__, __always_inline__, __artificial__)) +_mm_pause (void) +{ + __builtin_ia32_pause (); +} + #endif /* _XMMINTRIN_H_INCLUDED */ diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 1d846dca8e9..7990eb4a1ea 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2014-05-30 Ian Lance Taylor + + * gcc.target/i386/pause-2.c: New test. + 2014-05-30 Tom de Vries * gcc.target/i386/fuse-caller-save.c: New test. diff --git a/gcc/testsuite/gcc.target/i386/pause-2.c b/gcc/testsuite/gcc.target/i386/pause-2.c new file mode 100644 index 00000000000..d8b25195801 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pause-2.c @@ -0,0 +1,12 @@ +/* Test that pause instruction works even when SSE is not enabled. */ +/* { dg-do compile } */ +/* { dg-options "-O2 -dp" } */ +/* { dg-final { scan-assembler-times "\\*pause" 1 } } */ + +#include + +void +foo (void) +{ + _mm_pause (); +} -- 2.30.2