[PATCH] D72579: Evaluate __{c11_,}atomic_is_lock_free to 0 (avoid libcall) if larger than MaxAtomicPromoteWidth

2020-02-21 Thread James Y Knight via Phabricator via cfe-commits
jyknight requested changes to this revision. jyknight added a comment. This revision now requires changes to proceed. This isn't correct. The atomic interface is designed to be forward-compatible with new CPUs that have wider atomic instructions. That clang has a MaxAtomicPromoteWidth value

[PATCH] D72579: Evaluate __{c11_,}atomic_is_lock_free to 0 (avoid libcall) if larger than MaxAtomicPromoteWidth

2020-02-11 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay added a comment. From https://gcc.gnu.org/ml/gcc/2020-02/msg00116.html > We discussed this on IRC in #gcc. There was no motivation to change GCC. The > platform that wants to avoid the libatomic dependency doesn't use GCC anyway. > Relying on not getting the libatomic dependency seems

[PATCH] D72579: Evaluate __{c11_,}atomic_is_lock_free to 0 (avoid libcall) if larger than MaxAtomicPromoteWidth

2020-01-13 Thread Eli Friedman via Phabricator via cfe-commits
efriedma added a comment. Eagerly evaluating based on MaxAtomicPromoteWidth seems fine... assuming we're actually setting MaxAtomicPromoteWidth to something appropriate. The value on PowerPC looks wrong. If we're worried about constant-evaluating it in contexts where gcc doesn't, we can

[PATCH] D72579: Evaluate __{c11_,}atomic_is_lock_free to 0 (avoid libcall) if larger than MaxAtomicPromoteWidth

2020-01-13 Thread JF Bastien via Phabricator via cfe-commits
jfb added a subscriber: jwakely. jfb added a comment. This changes the expression to a constant expression as well, right? You should point this out in the commit message. The divergence with GCC is unfortunate, @jwakely do you think you'd be able to get GCC to match this behavior as well?

[PATCH] D72579: Evaluate __{c11_,}atomic_is_lock_free to 0 (avoid libcall) if larger than MaxAtomicPromoteWidth

2020-01-13 Thread Nemanja Ivanovic via Phabricator via cfe-commits
nemanjai added a comment. If I understand this correctly, this just evaluates the query for lock free atomics at compile time if the size is larger than the maximum possible size for an atomic on the target. If that's the case, this looks fine to me. But of course, some of the other target

[PATCH] D72579: Evaluate __{c11_,}atomic_is_lock_free to 0 (avoid libcall) if larger than MaxAtomicPromoteWidth

2020-01-12 Thread pre-merge checks [bot] via Phabricator via cfe-commits
merge_guards_bot added a comment. {icon check-circle color=green} Unit tests: pass. 61771 tests passed, 0 failed and 780 were skipped. {icon times-circle color=red} clang-tidy: fail. Please fix clang-tidy findings

[PATCH] D72579: Evaluate __{c11_,}atomic_is_lock_free to 0 (avoid libcall) if larger than MaxAtomicPromoteWidth

2020-01-12 Thread Fangrui Song via Phabricator via cfe-commits
MaskRay created this revision. MaskRay added reviewers: adalava, dim, nemanjai, jfb, rsmith. Herald added subscribers: cfe-commits, steven.zhang, dexonsmith, krytarowski, arichardson, emaste. Herald added a project: clang. MaxAtomicPromoteWidth is defined as "the maximum width lock-free atomic