Ticket #13569: boost-atomic.patch

File boost-atomic.patch, 5.6 KB (added by Emil Gilliam <egilliam@…>, 4 years ago)

IGNORE OTHER ATTACHMENT - file paths are corrected in this patch.

  • boost/atomic/detail/config.hpp

     
    3636#define BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA
    3737#endif
    3838
    39 #if (defined(__i386__) || defined(__x86_64__)) && (defined(__clang__) || (defined(BOOST_GCC) && (BOOST_GCC+0) < 40500) || defined(__SUNPRO_CC))
    4039// This macro indicates that the compiler does not support allocating eax:edx or rax:rdx register pairs ("A") in asm blocks
     40#if defined(__i386__) || defined(__x86_64__)
     41#if defined(__clang__) && defined(__has_feature)
     42// Clang introduced this feature after it started supporting rax:rdx register pairs, so can use it to make this determination.
     43#if !__has_feature(__attribute_diagnose_if_objc__)
    4144#define BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS
    4245#endif
     46#elif (defined(BOOST_GCC) && (BOOST_GCC+0) < 40500) || defined(__SUNPRO_CC)
     47#define BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS
     48#endif
     49#endif
    4350
    4451#if defined(__i386__) && (defined(__PIC__) || defined(__PIE__)) && !(defined(__clang__) || (defined(BOOST_GCC) && (BOOST_GCC+0) >= 50100))
    4552// This macro indicates that asm blocks should preserve ebx value unchanged. Some compilers are able to maintain ebx themselves
  • boost/atomic/detail/ops_gcc_x86_dcas.hpp

    ==================================================================
     
    158158        }
    159159        else
    160160        {
     161#if defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS)
    161162#if defined(__clang__)
    162             // Clang cannot allocate eax:edx register pairs but it has sync intrinsics
     163            // Older versions of Clang cannot allocate eax:edx register pairs, but they do have sync intrinsics
    163164            value = __sync_val_compare_and_swap(&storage, (storage_type)0, (storage_type)0);
    164 #elif defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS)
     165#else // defined(__clang__)
    165166            uint32_t value_bits[2];
    166167            // We don't care for comparison result here; the previous value will be stored into value anyway.
    167168            // Also we don't care for ebx and ecx values, they just have to be equal to eax and edx before cmpxchg8b.
     
    175176                : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory"
    176177            );
    177178            BOOST_ATOMIC_DETAIL_MEMCPY(&value, value_bits, sizeof(value));
     179#endif // defined(__clang__)
    178180#else // defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS)
    179181            // We don't care for comparison result here; the previous value will be stored into value anyway.
    180182            // Also we don't care for ebx and ecx values, they just have to be equal to eax and edx before cmpxchg8b.
     
    196198    static BOOST_FORCEINLINE bool compare_exchange_strong(
    197199        storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
    198200    {
    199 #if defined(__clang__)
     201#if defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS) && defined(__clang__)
    200202
    201         // Clang cannot allocate eax:edx register pairs but it has sync intrinsics
     203        // Older versions of Clang cannot allocate eax:edx register pairs, but they do have sync intrinsics
    202204        storage_type old_expected = expected;
    203205        expected = __sync_val_compare_and_swap(&storage, old_expected, desired);
    204206        return expected == old_expected;
     
    401403
    402404    static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order) BOOST_NOEXCEPT
    403405    {
     406#if defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS)
     407
    404408#if defined(__clang__)
    405409
    406         // Clang cannot allocate rax:rdx register pairs but it has sync intrinsics
     410        // Older versions of Clang cannot allocate rax:rdx register pairs, but they do have sync intrinsics
    407411        storage_type value = storage_type();
    408412        return __sync_val_compare_and_swap(&storage, value, value);
    409413
    410 #elif defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS)
     414#else // defined(__clang__)
    411415
    412416        // Some compilers can't allocate rax:rdx register pair either and also don't support 128-bit __sync_val_compare_and_swap
    413417        uint64_t value_bits[2];
     
    428432        BOOST_ATOMIC_DETAIL_MEMCPY(&value, value_bits, sizeof(value));
    429433        return value;
    430434
     435#endif // defined(__clang__)
     436
    431437#else // defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS)
    432438
    433439        storage_type value;
     
    452458    static BOOST_FORCEINLINE bool compare_exchange_strong(
    453459        storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT
    454460    {
     461#if defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS)
     462
    455463#if defined(__clang__)
    456464
    457         // Clang cannot allocate rax:rdx register pairs but it has sync intrinsics
     465        // Older versions of Clang cannot allocate rax:rdx register pairs, but they do have sync intrinsics
    458466        storage_type old_expected = expected;
    459467        expected = __sync_val_compare_and_swap(&storage, old_expected, desired);
    460468        return expected == old_expected;
    461469
    462 #elif defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS)
     470#else // defined(__clang__)
    463471
    464472        // Some compilers can't allocate rax:rdx register pair either but also don't support 128-bit __sync_val_compare_and_swap
    465473        bool success;
     
    474482
    475483        return success;
    476484
     485#endif // defined(__clang__)
     486
    477487#else // defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS)
    478488
    479489        bool success;