Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Always use cmpxchg16b on x64 for atomic_ref<16 bytes> #4751

Merged
merged 20 commits into from
Jul 5, 2024
Merged
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
be1dabe
Simplify `__std_atomic_has_cmpxchg16b`: cmpxchg16b is always availabl…
StephanTLavavej Jun 16, 2024
b16508d
Simplify `__std_atomic_compare_exchange_128` accordingly.
StephanTLavavej Jun 16, 2024
bad4814
`__std_atomic_compare_exchange_128` and `__std_atomic_has_cmpxchg16b`…
StephanTLavavej Jun 16, 2024
7bf2aa7
Preserve `__std_atomic_compare_exchange_128` for bincompat.
StephanTLavavej Jun 16, 2024
e3a9a91
Replace the `_STD_COMPARE_EXCHANGE_128` macro with `_InterlockedCompa…
StephanTLavavej Jun 16, 2024
60798a3
Allow Clang x64 to use `_InterlockedCompareExchange128`.
StephanTLavavej Jun 16, 2024
c7261ef
Simplify the "future ABI" `atomic<T>::is_lock_free()`.
StephanTLavavej Jun 16, 2024
72349d3
Major style: Add parens when mixing arithmetic and bitwise operators …
StephanTLavavej Jun 16, 2024
6411c97
Minor style: Simplify `atomic<T>::is_lock_free()`.
StephanTLavavej Jun 16, 2024
b855bb9
Enhance the "future ABI" `_Is_always_lock_free` (aka `atomic<T>::is_a…
StephanTLavavej Jun 16, 2024
ea085c5
Centralize `atomic<T>::is_lock_free()` and `_Is_always_lock_free`.
StephanTLavavej Jun 16, 2024
c468e9e
`atomic_ref::is_lock_free()`: Simplify.
StephanTLavavej Jun 16, 2024
3861e48
`atomic_ref::is_lock_free()`: Further simplify.
StephanTLavavej Jun 16, 2024
0e17494
Enhance `atomic_ref::is_always_lock_free`.
StephanTLavavej Jun 16, 2024
fe82b0c
Collapse `atomic_ref` `is_always_lock_free` and `is_lock_free()`.
StephanTLavavej Jun 16, 2024
0c46d60
`_ATOMIC_HAS_DCAS` is now unused.
StephanTLavavej Jun 16, 2024
ba77cd1
Preserve `__std_atomic_has_cmpxchg16b` for bincompat.
StephanTLavavej Jun 16, 2024
96d86e7
Drop `_STD_ATOMIC_ALWAYS_USE_CMPXCHG16B` and simplify test coverage.
StephanTLavavej Jun 16, 2024
537bc95
`_STL_WIN32_WINNT_WINBLUE` is now unused.
StephanTLavavej Jun 25, 2024
e13d679
Silence unreferenced parameter warnings for 32-bit.
StephanTLavavej Jun 28, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Allow Clang x64 to use _InterlockedCompareExchange128.
  • Loading branch information
StephanTLavavej committed Jun 27, 2024
commit 60798a31df0e8fc69846777dd723d8ab8c414ef3
9 changes: 9 additions & 0 deletions stl/inc/atomic
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ extern "C" _NODISCARD char __stdcall __std_atomic_has_cmpxchg16b() noexcept;
#define _ATOMIC_HAS_DCAS 0
#endif // ^^^ We only sometimes have DCAS ^^^

// Allow _InterlockedCompareExchange128 to be used:
#if defined(__clang__) && defined(_M_X64)
#pragma clang attribute _STD_ATOMIC_HEADER.push([[gnu::target("cx16")]], apply_to = function)
#endif // ^^^ defined(__clang__) && defined(_M_X64) ^^^

// Controls whether ARM64 ldar/ldapr/stlr should be used
#ifndef _STD_ATOMIC_USE_ARM64_LDAR_STLR
#if defined(_M_ARM64) || defined(_M_ARM64EC) || defined(_M_HYBRID_X86_ARM64)
Expand Down Expand Up @@ -3053,6 +3058,10 @@ _STD_END

#undef _INVALID_MEMORY_ORDER

#if defined(__clang__) && defined(_M_X64)
#pragma clang attribute _STD_ATOMIC_HEADER.pop
#endif // ^^^ defined(__clang__) && defined(_M_X64) ^^^

#pragma pop_macro("new")
_STL_RESTORE_CLANG_WARNINGS
#pragma warning(pop)
Expand Down