==================================================================
|
|
|
158 | 158 | } |
159 | 159 | else |
160 | 160 | { |
| 161 | #if defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS) |
161 | 162 | #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 |
163 | 164 | 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__) |
165 | 166 | uint32_t value_bits[2]; |
166 | 167 | // We don't care for comparison result here; the previous value will be stored into value anyway. |
167 | 168 | // Also we don't care for ebx and ecx values, they just have to be equal to eax and edx before cmpxchg8b. |
… |
… |
|
175 | 176 | : BOOST_ATOMIC_DETAIL_ASM_CLOBBER_CC_COMMA "memory" |
176 | 177 | ); |
177 | 178 | BOOST_ATOMIC_DETAIL_MEMCPY(&value, value_bits, sizeof(value)); |
| 179 | #endif // defined(__clang__) |
178 | 180 | #else // defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS) |
179 | 181 | // We don't care for comparison result here; the previous value will be stored into value anyway. |
180 | 182 | // Also we don't care for ebx and ecx values, they just have to be equal to eax and edx before cmpxchg8b. |
… |
… |
|
196 | 198 | static BOOST_FORCEINLINE bool compare_exchange_strong( |
197 | 199 | storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT |
198 | 200 | { |
199 | | #if defined(__clang__) |
| 201 | #if defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS) && defined(__clang__) |
200 | 202 | |
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 |
202 | 204 | storage_type old_expected = expected; |
203 | 205 | expected = __sync_val_compare_and_swap(&storage, old_expected, desired); |
204 | 206 | return expected == old_expected; |
… |
… |
|
401 | 403 | |
402 | 404 | static BOOST_FORCEINLINE storage_type load(storage_type const volatile& storage, memory_order) BOOST_NOEXCEPT |
403 | 405 | { |
| 406 | #if defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS) |
| 407 | |
404 | 408 | #if defined(__clang__) |
405 | 409 | |
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 |
407 | 411 | storage_type value = storage_type(); |
408 | 412 | return __sync_val_compare_and_swap(&storage, value, value); |
409 | 413 | |
410 | | #elif defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS) |
| 414 | #else // defined(__clang__) |
411 | 415 | |
412 | 416 | // Some compilers can't allocate rax:rdx register pair either and also don't support 128-bit __sync_val_compare_and_swap |
413 | 417 | uint64_t value_bits[2]; |
… |
… |
|
428 | 432 | BOOST_ATOMIC_DETAIL_MEMCPY(&value, value_bits, sizeof(value)); |
429 | 433 | return value; |
430 | 434 | |
| 435 | #endif // defined(__clang__) |
| 436 | |
431 | 437 | #else // defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS) |
432 | 438 | |
433 | 439 | storage_type value; |
… |
… |
|
452 | 458 | static BOOST_FORCEINLINE bool compare_exchange_strong( |
453 | 459 | storage_type volatile& storage, storage_type& expected, storage_type desired, memory_order, memory_order) BOOST_NOEXCEPT |
454 | 460 | { |
| 461 | #if defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS) |
| 462 | |
455 | 463 | #if defined(__clang__) |
456 | 464 | |
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 |
458 | 466 | storage_type old_expected = expected; |
459 | 467 | expected = __sync_val_compare_and_swap(&storage, old_expected, desired); |
460 | 468 | return expected == old_expected; |
461 | 469 | |
462 | | #elif defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS) |
| 470 | #else // defined(__clang__) |
463 | 471 | |
464 | 472 | // Some compilers can't allocate rax:rdx register pair either but also don't support 128-bit __sync_val_compare_and_swap |
465 | 473 | bool success; |
… |
… |
|
474 | 482 | |
475 | 483 | return success; |
476 | 484 | |
| 485 | #endif // defined(__clang__) |
| 486 | |
477 | 487 | #else // defined(BOOST_ATOMIC_DETAIL_X86_NO_ASM_AX_DX_PAIRS) |
478 | 488 | |
479 | 489 | bool success; |