[libcxx-commits] [libcxx] 39328a6 - [libcxx] Switch __cxx_contention_t to int32_t on 32 bit AIX

Martin Storsjö via libcxx-commits libcxx-commits at lists.llvm.org
Thu May 12 09:01:08 PDT 2022


Author: Martin Storsjö
Date: 2022-05-12T19:00:42+03:00
New Revision: 39328a658181d7dcd1d54428bece7998ff6acdd3

URL: https://github.com/llvm/llvm-project/commit/39328a658181d7dcd1d54428bece7998ff6acdd3
DIFF: https://github.com/llvm/llvm-project/commit/39328a658181d7dcd1d54428bece7998ff6acdd3.diff

LOG: [libcxx] Switch __cxx_contention_t to int32_t on 32 bit AIX

I guess this is an ABI break for the 32 bit AIX configuration, but I'm
not sure if that one is meant to be ABI stable yet or not.

Previously, this used int32_t for this type on linux, but int64_t
on all other platforms. This was added in D68480 /
54fa9ecd3088508b05b0c5b5cb52da8a3c188655, but I don't really see
any discussion around this detail there.

Switching this to 32 bit on 32 bit AIX silences these libcxx build
warnings:

```
In file included from /scratch/powerllvm/cpap8006/llvm-project/libcxx-ci/libcxx/src/atomic.cpp:12:
/scratch/powerllvm/cpap8006/llvm-project/libcxx-ci/build/aix/include/c++/v1/atomic:1005:12: warning: large atomic operation may incur significant performance penalty; the access size (8 bytes) exceeds the max lock-free size (4  bytes) [-Watomic-alignment]
    return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
           ^
/scratch/powerllvm/cpap8006/llvm-project/libcxx-ci/build/aix/include/c++/v1/atomic:948:12: warning: large atomic operation may incur significant performance penalty; the access size (8 bytes) exceeds the max lock-free size (4  bytes) [-Watomic-alignment]
    return __c11_atomic_load(const_cast<__ptr_type>(&__a->__a_value), static_cast<__memory_order_underlying_t>(__order));
           ^
/scratch/powerllvm/cpap8006/llvm-project/libcxx-ci/build/aix/include/c++/v1/atomic:1000:12: warning: large atomic operation may incur significant performance penalty; the access size (8 bytes) exceeds the max lock-free size (4  bytes) [-Watomic-alignment]
    return __c11_atomic_fetch_add(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
           ^
/scratch/powerllvm/cpap8006/llvm-project/libcxx-ci/build/aix/include/c++/v1/atomic:1022:12: warning: large atomic operation may incur significant performance penalty; the access size (8 bytes) exceeds the max lock-free size (4  bytes) [-Watomic-alignment]
    return __c11_atomic_fetch_sub(&__a->__a_value, __delta, static_cast<__memory_order_underlying_t>(__order));
           ^
4 warnings generated.
```

Differential Revision: https://reviews.llvm.org/D124519

Added: 
    

Modified: 
    libcxx/include/atomic

Removed: 
    


################################################################################
diff  --git a/libcxx/include/atomic b/libcxx/include/atomic
index 1d83e37734f3..3ccc8bc94436 100644
--- a/libcxx/include/atomic
+++ b/libcxx/include/atomic
@@ -1451,11 +1451,11 @@ struct __cxx_atomic_impl : public _Base {
     : _Base(value) {}
 };
 
-#ifdef __linux__
+#if defined(__linux__) || (defined(_AIX) && !defined(__64BIT__))
     using __cxx_contention_t = int32_t;
 #else
     using __cxx_contention_t = int64_t;
-#endif //__linux__
+#endif // __linux__ || (_AIX && !__64BIT__)
 
 using __cxx_atomic_contention_t = __cxx_atomic_impl<__cxx_contention_t>;
 


        


More information about the libcxx-commits mailing list