aboutsummaryrefslogtreecommitdiff
path: root/libcxx
diff options
context:
space:
mode:
authorFangrui Song <i@maskray.me>2022-11-22 13:33:34 -0800
committerFangrui Song <i@maskray.me>2022-11-22 13:33:34 -0800
commit23023654be6c3c77a2a90611d19ea76788492704 (patch)
tree76b8ec1bbdd173b53b89e3476f9d8618d20ad544 /libcxx
parentc1d53fe338cb9d977fda5749fc5ad2c4108f26d1 (diff)
downloadllvm-23023654be6c3c77a2a90611d19ea76788492704.zip
llvm-23023654be6c3c77a2a90611d19ea76788492704.tar.gz
llvm-23023654be6c3c77a2a90611d19ea76788492704.tar.bz2
[libc++] Replace __ppc64__ with __powerpc64__ and fix is_iec559 for non-ibm128
The lowercase `__ppc64__` is not defined by non-darwin powerpc64 GCC, therefore it lures users to write code which is not portable to GCC. Migrate to `__powerpc64__` in preparation for undefining `__ppc64__`. `__powerpc64__` is much more common than `__PPC64__`. Update alignment_of.pass.cpp to use 1 unconditionally: on powerpc-unknown-linux-gnu `alignof(bool) = _Alignof(bool) = __alignof(bool) = 1`. The value 4 might be derived from an ancient Clang. Change is_iec559 to true when long double uses uses IEEE 754 quadruple or double precision (i.e. not ibm128). Reviewed By: #libc, thesamesam, ldionne Differential Revision: https://reviews.llvm.org/D137513
Diffstat (limited to 'libcxx')
-rw-r--r--libcxx/include/limits2
-rw-r--r--libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp2
-rw-r--r--libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp7
3 files changed, 2 insertions, 9 deletions
diff --git a/libcxx/include/limits b/libcxx/include/limits
index 3e074185..ee8249f 100644
--- a/libcxx/include/limits
+++ b/libcxx/include/limits
@@ -428,7 +428,7 @@ protected:
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type signaling_NaN() _NOEXCEPT {return __builtin_nansl("");}
_LIBCPP_INLINE_VISIBILITY static _LIBCPP_CONSTEXPR type denorm_min() _NOEXCEPT {return __LDBL_DENORM_MIN__;}
-#if (defined(__ppc__) || defined(__ppc64__))
+#if defined(__powerpc__) && defined(__LONG_DOUBLE_IBM128__)
static _LIBCPP_CONSTEXPR const bool is_iec559 = false;
#else
static _LIBCPP_CONSTEXPR const bool is_iec559 = true;
diff --git a/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp b/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp
index 37f217e..4fb19fe 100644
--- a/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp
+++ b/libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp
@@ -50,7 +50,7 @@ int main(int, char**)
#endif
test<float, true>();
test<double, true>();
-#if (defined(__ppc__) || defined(__ppc64__))
+#if defined(__powerpc__) && defined(__LONG_DOUBLE_IBM128__)
test<long double, false>();
#else
test<long double, true>();
diff --git a/libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp b/libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
index 9f93e1f..a1c24b7 100644
--- a/libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
+++ b/libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
@@ -47,15 +47,8 @@ int main(int, char**)
test_alignment_of<const int*, sizeof(intptr_t)>();
test_alignment_of<char[3], 1>();
test_alignment_of<int, 4>();
- // The test case below is a hack. It's hard to detect what golden value
- // we should expect. In most cases it should be 8. But in i386 builds
- // with Clang >= 8 or GCC >= 8 the value is '4'.
test_alignment_of<double, TEST_ALIGNOF(double)>();
-#if (defined(__ppc__) && !defined(__ppc64__) && !defined(_AIX))
- test_alignment_of<bool, 4>(); // 32-bit PPC has four byte bool, except on AIX.
-#else
test_alignment_of<bool, 1>();
-#endif
test_alignment_of<unsigned, 4>();
return 0;