[libcxx-commits] [PATCH] D137513: [libc++] Replace __ppc64__ with __powerpc64__ and fix is_iec559 for non-ibm128

Fangrui Song via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 7 10:26:20 PST 2022


MaskRay updated this revision to Diff 473740.
MaskRay retitled this revision from "[libc++] Replace __ppc64__ with __powerpc64__" to "[libc++] Replace __ppc64__ with __powerpc64__ and fix is_iec559 for non-ibm128".
MaskRay edited the summary of this revision.
MaskRay added a comment.

Use `#if defined(__powerpc__) && defined(__LONG_DOUBLE_IBM128__)`.

Technically `__powerpc__` is redundant but the check makes it clear it's powerpc specific.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D137513/new/

https://reviews.llvm.org/D137513

Files:
  libcxx/include/limits
  libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp
  libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp


Index: libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
===================================================================
--- libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
+++ libcxx/test/std/utilities/meta/meta.unary.prop.query/alignment_of.pass.cpp
@@ -47,15 +47,8 @@
     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;
Index: libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp
===================================================================
--- libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp
+++ libcxx/test/std/language.support/support.limits/limits/numeric.limits.members/is_iec559.pass.cpp
@@ -50,7 +50,7 @@
 #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>();
Index: libcxx/include/limits
===================================================================
--- libcxx/include/limits
+++ libcxx/include/limits
@@ -428,7 +428,7 @@
     _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;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137513.473740.patch
Type: text/x-patch
Size: 2239 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221107/62c523eb/attachment.bin>


More information about the libcxx-commits mailing list