Boost logo

Boost-Commit :

From: pdimov_at_[hidden]
Date: 2008-04-05 11:23:28


Author: pdimov
Date: 2008-04-05 11:23:28 EDT (Sat, 05 Apr 2008)
New Revision: 44056
URL: http://svn.boost.org/trac/boost/changeset/44056

Log:
BOOST_SMT_PAUSE factored out.
Text files modified:
   trunk/boost/detail/yield_k.hpp | 30 +++++++++++++++++++++---------
   1 files changed, 21 insertions(+), 9 deletions(-)

Modified: trunk/boost/detail/yield_k.hpp
==============================================================================
--- trunk/boost/detail/yield_k.hpp (original)
+++ trunk/boost/detail/yield_k.hpp 2008-04-05 11:23:28 EDT (Sat, 05 Apr 2008)
@@ -25,17 +25,29 @@
 
 #include <boost/config.hpp>
 
+// BOOST_SMT_PAUSE
+
+#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) )
+
+extern "C" void _mm_pause();
+#pragma intrinsic( _mm_pause )
+
+#define BOOST_SMT_PAUSE _mm_pause();
+
+#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
+
+#define BOOST_SMT_PAUSE __asm__ __volatile__( "rep; nop" ::: "memory" );
+
+#endif
+
+//
+
 #if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
 
 #if defined( BOOST_USE_WINDOWS_H )
 # include <windows.h>
 #endif
 
-#if defined(_MSC_VER) && _MSC_VER >= 1310
- extern "C" void _mm_pause();
-# pragma intrinsic( _mm_pause )
-#endif
-
 namespace boost
 {
 
@@ -51,10 +63,10 @@
     if( k < 4 )
     {
     }
-#if defined(_MSC_VER) && _MSC_VER >= 1310
+#if defined( BOOST_SMT_PAUSE )
     else if( k < 16 )
     {
- _mm_pause();
+ BOOST_SMT_PAUSE
     }
 #endif
     else if( k < 32 )
@@ -87,10 +99,10 @@
     if( k < 4 )
     {
     }
-#if defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
+#if defined( BOOST_SMT_PAUSE )
     else if( k < 16 )
     {
- __asm__ __volatile__( "rep; nop" ::: "memory" );
+ BOOST_SMT_PAUSE
     }
 #endif
     else if( k < 32 || k & 1 )


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk