-
Notifications
You must be signed in to change notification settings - Fork 13.7k
[libc++] Floating Point Atomic #67799
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
Merged
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
8d780a8
[libc++][In progress] Floating Point Atomic
huixie90 d67e085
more tests
huixie90 523ce08
address feedback and rebase
huixie90 703df84
more tests
huixie90 64064ef
more tests
huixie90 a8b6621
shadow
huixie90 b260f7b
CI
huixie90 3fb8e40
add linker flag
huixie90 7c42f0c
CI
huixie90 1000d3e
volatile
huixie90 069cf2a
gcc
huixie90 7c8b0fc
clang format
huixie90 839532b
gcc warning
huixie90 0c3c9a1
relax floating point comparison
huixie90 b0bac87
test which test hangs in CI
huixie90 dfbd52f
try to figure out which one
huixie90 d80b44c
using compare_exchange_strong for long double
huixie90 dac3b3f
try again
huixie90 ef9a9d4
more try
huixie90 a5ff0b4
address feedback
huixie90 4c90193
latomic
huixie90 44ce10e
another try
huixie90 e75e2be
try again
huixie90 ef76292
fix clang tidy
huixie90 0e51ee3
another try
huixie90 b84119b
format
huixie90 02c08cc
another try
huixie90 fa3a632
fix gcc
huixie90 5f41f1f
remove stdio
huixie90 9cad749
clean up
huixie90 00cf684
refactor
huixie90 28b3ca2
gcc
huixie90 76f6b19
gcc
huixie90 f0a0a7e
CI
huixie90 89cf41a
no thread
huixie90 33de815
rebase + xfail some tests
huixie90 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
libcxx/test/libcxx/atomics/atomics.types.generic/atomics.types.float/lockfree.pass.cpp
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
//===----------------------------------------------------------------------===// | ||
// | ||
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. | ||
// See https://llvm.org/LICENSE.txt for license information. | ||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception | ||
// | ||
//===----------------------------------------------------------------------===// | ||
// UNSUPPORTED: c++03, c++11, c++14, c++17 | ||
// UNSUPPORTED: target={{.+}}-windows-gnu | ||
// ADDITIONAL_COMPILE_FLAGS(has-latomic): -latomic | ||
|
||
// static constexpr bool is_always_lock_free = implementation-defined; | ||
// bool is_lock_free() const volatile noexcept; | ||
// bool is_lock_free() const noexcept; | ||
|
||
#include <atomic> | ||
#include <cassert> | ||
#include <concepts> | ||
|
||
#include "test_macros.h" | ||
|
||
template <class T> | ||
void test() { | ||
// static constexpr bool is_always_lock_free = implementation-defined; | ||
{ | ||
bool r = std::atomic<T>::is_always_lock_free; | ||
assert(r == __atomic_always_lock_free(sizeof(std::__cxx_atomic_impl<T>), 0)); | ||
} | ||
|
||
// bool is_lock_free() const volatile noexcept; | ||
{ | ||
const volatile std::atomic<T> a; | ||
bool r = a.is_lock_free(); | ||
assert(r == __cxx_atomic_is_lock_free(sizeof(std::__cxx_atomic_impl<T>))); | ||
} | ||
|
||
// bool is_lock_free() const noexcept; | ||
{ | ||
const std::atomic<T> a; | ||
bool r = a.is_lock_free(); | ||
assert(r == __cxx_atomic_is_lock_free(sizeof(std::__cxx_atomic_impl<T>))); | ||
} | ||
} | ||
|
||
int main(int, char**) { | ||
test<float>(); | ||
test<double>(); | ||
test<long double>(); | ||
|
||
return 0; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.