From eba5e7f2236a0950957a8a247a0e83385149d13c Mon Sep 17 00:00:00 2001 From: Keith Daigle Date: Wed, 3 Jan 2018 06:58:45 -0800 Subject: [PATCH] Fix to build SharedMutexTest on aarch64 Summary: While trying to build folly on aarch64 found that the SharedMutexTest wouldn't build because it uses RWTicketSpinLock which was only available on x86 platforms. Updated to allow build on aarch64 after suggestion by Orvid Reviewed By: yfeldblum Differential Revision: D6611609 fbshipit-source-id: 8ec477cdedac0f0a705608bbac42dd63b3efb919 --- folly/RWSpinLock.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/folly/RWSpinLock.h b/folly/RWSpinLock.h index 94f48028..2f177ed0 100644 --- a/folly/RWSpinLock.h +++ b/folly/RWSpinLock.h @@ -143,6 +143,8 @@ pthread_rwlock_t Read 728698 24us 101ns 7.28ms 194us #include #elif defined(_MSC_VER) && defined(FOLLY_X64) #define RW_SPINLOCK_USE_X86_INTRINSIC_ +#elif FOLLY_AARCH64 +#define RW_SPINLOCK_USE_X86_INTRINSIC_ #else #undef RW_SPINLOCK_USE_X86_INTRINSIC_ #endif @@ -690,9 +692,9 @@ class RWTicketSpinLockT { void unlock() { RWTicket t; t.whole = load_acquire(&ticket.whole); - FullInt old = t.whole; #ifdef RW_SPINLOCK_USE_SSE_INSTRUCTIONS_ + FullInt old = t.whole; // SSE2 can reduce the lock and unlock overhead by 10% static const QuarterInt kDeltaBuf[4] = { 1, 1, 0, 0 }; // write/read/user static const __m128i kDelta = IntTraitType::make128(kDeltaBuf); -- 2.34.1