--- a/cmake/modules/CheckCxxAtomic.cmake 2020-03-02 12:49:20.000000000 -0500 +++ b/cmake/modules/CheckCxxAtomic.cmake 2020-01-29 12:53:56.952149798 -0500 @@ -10,18 +10,29 @@ check_cxx_source_compiles(" #include #include + +#if __s390x__ +// Boost needs 16-byte atomics for tagged pointers. +// These are implemented via inline instructions on the platform +// if 16-byte alignment can be proven, and are delegated to libatomic +// library routines otherwise. Whether or not alignment is provably +// OK for a std::atomic unfortunately depends on compiler version and +// optimization levels, and also on the details of the expression. +// We specifically test access via an otherwise unknown pointer here +// to ensure we get the most complex case. If this access can be +// done without libatomic, then all accesses can be done. +bool atomic16(std::atomic *ptr) +{ + return *ptr != 0; +} +#endif + int main() { std::atomic w1; std::atomic w2; std::atomic w4; std::atomic w8; -#ifdef __s390x__ - // Boost needs 16-byte atomics for tagged pointers. - std::atomic w16; -#else - #define w16 0 -#endif - return w1 + w2 + w4 + w8 + w16; + return w1 + w2 + w4 + w8; } " ${var}) endfunction(check_cxx_atomics)