Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r84804 - trunk/libs/atomic/test
From: andrey.semashev_at_[hidden]
Date: 2013-06-16 10:01:05


Author: andysem
Date: 2013-06-16 10:01:04 EDT (Sun, 16 Jun 2013)
New Revision: 84804
URL: http://svn.boost.org/trac/boost/changeset/84804

Log:
Added tests for int128 atomicity.

Text files modified:
   trunk/libs/atomic/test/lockfree.cpp | 18 ++++++++++++++++++
   1 files changed, 18 insertions(+), 0 deletions(-)

Modified: trunk/libs/atomic/test/lockfree.cpp
==============================================================================
--- trunk/libs/atomic/test/lockfree.cpp Sun Jun 16 09:55:00 2013 (r84803)
+++ trunk/libs/atomic/test/lockfree.cpp 2013-06-16 10:01:04 EDT (Sun, 16 Jun 2013) (r84804)
@@ -11,6 +11,7 @@
 
 #include <iostream>
 
+#include <boost/config.hpp>
 #include <boost/atomic.hpp>
 #include <boost/test/minimal.hpp>
 
@@ -48,6 +49,7 @@
 #else
 #define EXPECT_LLONG_LOCK_FREE 0
 #endif
+#define EXPECT_INT128_LOCK_FREE 0
 #define EXPECT_POINTER_LOCK_FREE 2
 #define EXPECT_BOOL_LOCK_FREE 2
 
@@ -58,6 +60,11 @@
 #define EXPECT_INT_LOCK_FREE 2
 #define EXPECT_LONG_LOCK_FREE 2
 #define EXPECT_LLONG_LOCK_FREE 2
+#if defined(BOOST_ATOMIC_X86_HAS_CMPXCHG16B) && defined(BOOST_HAS_INT128)
+#define EXPECT_INT128_LOCK_FREE 2
+#else
+#define EXPECT_INT128_LOCK_FREE 0
+#endif
 #define EXPECT_POINTER_LOCK_FREE 2
 #define EXPECT_BOOL_LOCK_FREE 2
 
@@ -75,6 +82,7 @@
 #else
 #define EXPECT_LLONG_LOCK_FREE 0
 #endif
+#define EXPECT_INT128_LOCK_FREE 0
 #define EXPECT_POINTER_LOCK_FREE 2
 #define EXPECT_BOOL_LOCK_FREE 2
 
@@ -88,6 +96,7 @@
 #define EXPECT_INT_LOCK_FREE 2
 #define EXPECT_LONG_LOCK_FREE 2
 #define EXPECT_LLONG_LOCK_FREE 2
+#define EXPECT_INT128_LOCK_FREE 0
 #define EXPECT_POINTER_LOCK_FREE 2
 #define EXPECT_BOOL_LOCK_FREE 2
 
@@ -100,6 +109,7 @@
 #define EXPECT_INT_LOCK_FREE 2
 #define EXPECT_LONG_LOCK_FREE 2
 #define EXPECT_LLONG_LOCK_FREE 0
+#define EXPECT_INT128_LOCK_FREE 0
 #define EXPECT_POINTER_LOCK_FREE 2
 #define EXPECT_BOOL_LOCK_FREE 2
 
@@ -110,6 +120,7 @@
 #define EXPECT_INT_LOCK_FREE 2
 #define EXPECT_LONG_LOCK_FREE 2
 #define EXPECT_LLONG_LOCK_FREE 0
+#define EXPECT_INT128_LOCK_FREE 0
 #define EXPECT_POINTER_LOCK_FREE 2
 #define EXPECT_BOOL_LOCK_FREE 2
 
@@ -120,6 +131,7 @@
 #define EXPECT_INT_LOCK_FREE 2
 #define EXPECT_LONG_LOCK_FREE 2
 #define EXPECT_LLONG_LOCK_FREE 0
+#define EXPECT_INT128_LOCK_FREE 0
 #define EXPECT_POINTER_LOCK_FREE 2
 #define EXPECT_BOOL_LOCK_FREE 2
 
@@ -134,6 +146,7 @@
 #else
 #define EXPECT_LLONG_LOCK_FREE 0
 #endif
+#define EXPECT_INT128_LOCK_FREE 0
 #define EXPECT_POINTER_LOCK_FREE 2
 #define EXPECT_BOOL_LOCK_FREE 2
 
@@ -144,6 +157,7 @@
 #define EXPECT_INT_LOCK_FREE 2
 #define EXPECT_LONG_LOCK_FREE (sizeof(long) <= 4 ? 2 : 0)
 #define EXPECT_LLONG_LOCK_FREE (sizeof(long long) <= 4 ? 2 : 0)
+#define EXPECT_INT128_LOCK_FREE 0
 #define EXPECT_POINTER_LOCK_FREE (sizeof(void *) <= 4 ? 2 : 0)
 #define EXPECT_BOOL_LOCK_FREE 2
 
@@ -154,6 +168,7 @@
 #define EXPECT_INT_LOCK_FREE 0
 #define EXPECT_LONG_LOCK_FREE 0
 #define EXPECT_LLONG_LOCK_FREE 0
+#define EXPECT_INT128_LOCK_FREE 0
 #define EXPECT_POINTER_LOCK_FREE 0
 #define EXPECT_BOOL_LOCK_FREE 0
 
@@ -168,6 +183,9 @@
 #ifdef BOOST_HAS_LONG_LONG
     verify_lock_free<long long>("long long", BOOST_ATOMIC_LLONG_LOCK_FREE, EXPECT_LLONG_LOCK_FREE);
 #endif
+#ifdef BOOST_HAS_INT128
+ verify_lock_free<boost::int128_type>("int128", BOOST_ATOMIC_INT128_LOCK_FREE, EXPECT_INT128_LOCK_FREE);
+#endif
     verify_lock_free<void *>("void *", BOOST_ATOMIC_POINTER_LOCK_FREE, EXPECT_SHORT_LOCK_FREE);
     verify_lock_free<bool>("bool", BOOST_ATOMIC_BOOL_LOCK_FREE, EXPECT_BOOL_LOCK_FREE);
 


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