|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r84914 - trunk/libs/log/src
From: andrey.semashev_at_[hidden]
Date: 2013-06-29 13:22:22
Author: andysem
Date: 2013-06-29 13:22:22 EDT (Sat, 29 Jun 2013)
New Revision: 84914
URL: http://svn.boost.org/trac/boost/changeset/84914
Log:
Fixed atomic loads and stores on 32 bit targets.
Text files modified:
trunk/libs/log/src/timestamp.cpp | 23 +++++++++++++++--------
1 files changed, 15 insertions(+), 8 deletions(-)
Modified: trunk/libs/log/src/timestamp.cpp
==============================================================================
--- trunk/libs/log/src/timestamp.cpp Fri Jun 28 14:47:30 2013 (r84913)
+++ trunk/libs/log/src/timestamp.cpp 2013-06-29 13:22:22 EDT (Sat, 29 Jun 2013) (r84914)
@@ -20,12 +20,6 @@
#include <boost/detail/interlocked.hpp>
#include "windows_version.hpp"
#include <windows.h>
-#if (defined(_MSC_VER) && defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2) || (defined(__GNUC__) && defined(__i386__) && defined(__SSE2__))
-#include <emmintrin.h>
-#if defined(_MSC_VER)
-#include <intrin.h>
-#endif
-#endif
#else
#include <unistd.h> // for config macros
#if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)
@@ -65,7 +59,13 @@
//! Atomically loads and stores the 64-bit value through SSE2 instructions
BOOST_LOG_FORCEINLINE void move64(const uint64_t* from, uint64_t* to)
{
- _mm_storel_epi64(reinterpret_cast< __m128i* >(to), _mm_loadl_epi64(reinterpret_cast< const __m128i* >(from)));
+ __asm
+ {
+ mov eax, from
+ mov edx, to
+ movq xmm4, qword ptr [eax]
+ movq qword ptr [edx], xmm4
+ };
}
# else // defined(_M_IX86_FP) && _M_IX86_FP >= 2
//! Atomically loads and stores the 64-bit value through FPU instructions
@@ -97,7 +97,14 @@
//! Atomically loads and stores the 64-bit value through SSE2 instructions
BOOST_LOG_FORCEINLINE void move64(const uint64_t* from, uint64_t* to)
{
- _mm_storel_epi64(reinterpret_cast< __m128i* >(to), _mm_loadl_epi64(reinterpret_cast< const __m128i* >(from)));
+ __asm__ __volatile__
+ (
+ "movq %1, %%xmm4\n\t"
+ "movq %%xmm4, %0\n\t"
+ : "=m" (*to)
+ : "m" (*from)
+ : "memory", "xmm4"
+ );
}
# else // defined(__SSE2__)
//! Atomically loads and stores the 64-bit value through FPU instructions
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