Fix to build SharedMutexTest on aarch64
[folly.git] / folly / RWSpinLock.h
index 94f48028289ca496d6d29059ff3d2be0814643ab..2f177ed001bdc71142fe4b76218ab9819892f1f4 100644 (file)
@@ -143,6 +143,8 @@ pthread_rwlock_t Read        728698     24us       101ns     7.28ms     194us
 #include <x86intrin.h>
 #elif defined(_MSC_VER) && defined(FOLLY_X64)
 #define RW_SPINLOCK_USE_X86_INTRINSIC_
 #include <x86intrin.h>
 #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
 #else
 #undef RW_SPINLOCK_USE_X86_INTRINSIC_
 #endif
@@ -690,9 +692,9 @@ class RWTicketSpinLockT {
   void unlock() {
     RWTicket t;
     t.whole = load_acquire(&ticket.whole);
   void unlock() {
     RWTicket t;
     t.whole = load_acquire(&ticket.whole);
-    FullInt old = t.whole;
 
 #ifdef RW_SPINLOCK_USE_SSE_INSTRUCTIONS_
 
 #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);
     // 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);