llvm-project
c96a176d - [tsan] Enable __TSAN_HAS_INT128 on s390x and mips64 (#197319)

Commit
5 days ago
[tsan] Enable __TSAN_HAS_INT128 on s390x and mips64 (#197319) The s390x exclusion was added in https://github.com/llvm/llvm-project/commit/b17673816d7f65e07015489993b22049e36b04db (https://reviews.llvm.org/D105629) citing lack of hardware 128-bit atomics. s390x does have the CDSG instruction, but `alignof(__int128) == 8` on the s390x psABI while CDSG requires 16-byte alignment, so Clang does not define `__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16` for this target. The mips64 exclusion has been present since `__TSAN_HAS_INT128` was introduced in https://github.com/llvm/llvm-project/commit/06bbca9ec4bbc5a103c94c4973797ea4ddf944b5 (https://reviews.llvm.org/D18543) with no documented rationale. Clang similarly does not define `__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16` for mips64. Both exclusions are unnecessary. When `__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16` is not defined, all a128 operations use the SpinMutex-based emulation path, which serializes 128-bit accesses under a global lock without requiring any hardware CAS16 support. Verified with Clang (targets: s390x-linux-gnu, mips64-linux-gnuabi64, mips64el-linux-gnuabi64): all three produce the full set of 12 `__tsan_atomic128_*` symbols with zero `__sync_*_16 / __atomic_*_16` libcall references. Runtime testing has not been performed as I lack access to these architectures. Relates https://github.com/llvm/llvm-project/pull/196833 For https://github.com/golang/go/issues/61236
Author
Parents
Loading