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

[clang] builtin __cxx_atomic_fetch_add should support all floating point types #68602

Open
huixie90 opened this issue Oct 9, 2023 · 1 comment
Labels
bug Indicates an unexpected problem or unintended behavior clang:headers Headers provided by Clang, e.g. for intrinsics

Comments

@huixie90
Copy link
Contributor

huixie90 commented Oct 9, 2023

This issues came up in implementing P0020R6 Floating Point Atomic for libc++
#67799

Basically we are trying to use __cxx_atomic_fetch_add for implementing atomic RMW operations. However, this function would error on some platforms for long double if the representation is x87 fp80 format. On the library (libc++) side, there is no way for us to tell if the function __cxx_atomic_fetch_add is going to error on the current platform or not.

The builtin should handle this properly: generates FADD IR for platforms that support it, and fallback to the compare-exchange loop on the platforms that don't

@huixie90 huixie90 added bug Indicates an unexpected problem or unintended behavior clang Clang issues not falling into any other category labels Oct 9, 2023
@llvmbot
Copy link
Collaborator

llvmbot commented Oct 9, 2023

@llvm/issue-subscribers-bug

This issues came up in implementing P0020R6 Floating Point Atomic for libc++ https://github.com//pull/67799

Basically we are trying to use __cxx_atomic_fetch_add for implementing atomic RMW operations. However, this function would error on some platforms for long double if the representation is x87 fp80 format. On the library (libc++) side, there is no way for us to tell if the function __cxx_atomic_fetch_add is going to error on the current platform or not.

The builtin should handle this properly: generates FADD IR for platforms that support it, and fallback to the compare-exchange loop on the platforms that don't

@EugeneZelenko EugeneZelenko added clang:headers Headers provided by Clang, e.g. for intrinsics and removed clang Clang issues not falling into any other category labels Oct 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior clang:headers Headers provided by Clang, e.g. for intrinsics
Projects
None yet
Development

No branches or pull requests

3 participants