This is an archive of the discontinued LLVM Phabricator instance.

[CUDA] Ignore __CLANG_ATOMIC_LLONG_LOCK_FREE on i386
ClosedPublic

Authored by rprichard on Jun 9 2022, 6:50 PM.

Details

Summary

The default host CPU for an i386 triple is typically at least an i586,
which has cmpxchg8b (Clang feature, "cx8"). Therefore,
__CLANG_ATOMIC_LLONG_LOCK_FREE is 2 on the host, but the value should
be 1 for the device.

Also, grep for __CLANG_ATOMIC_* instead of __GCC_ATOMIC_*. The CLANG
macros are always emitted, but the GCC macros are omitted for the
*-windows-msvc targets. The __GCC_HAVE_SYNC_COMPARE_AND_SWAP macro
always has GCC in its name, not CLANG, however.

Diff Detail

Event Timeline

rprichard created this revision.Jun 9 2022, 6:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2022, 6:50 PM
Herald added subscribers: mattd, yaxunl. · View Herald Transcript
rprichard requested review of this revision.Jun 9 2022, 6:50 PM
Herald added a project: Restricted Project. · View Herald TranscriptJun 9 2022, 6:50 PM
Herald added a subscriber: cfe-commits. · View Herald Transcript
rprichard added a subscriber: mgorny.

This change is needed to keep the clang/test/Preprocessor/cuda-types.cu test passing after D28213 changes the value of __CLANG_ATOMIC_LLONG_LOCK_FREE from 1 to 2 for i586 and up.

tra accepted this revision.Jul 20 2022, 2:22 PM
This revision is now accepted and ready to land.Jul 20 2022, 2:22 PM
This revision was landed with ongoing or failed builds.Jul 21 2022, 5:24 PM
This revision was automatically updated to reflect the committed changes.