[libc-commits] [libc] 2ac9171 - [libc] Fix test failing on the GPU due to undefined floating point type

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Fri May 19 12:03:50 PDT 2023


Author: Joseph Huber
Date: 2023-05-19T14:03:42-05:00
New Revision: 2ac91712cc7bac84fb08a45b7323e6fc11ff86d8

URL: https://github.com/llvm/llvm-project/commit/2ac91712cc7bac84fb08a45b7323e6fc11ff86d8
DIFF: https://github.com/llvm/llvm-project/commit/2ac91712cc7bac84fb08a45b7323e6fc11ff86d8.diff

LOG: [libc] Fix test failing on the GPU due to undefined floating point type

We got build failures due to the handling here, explicitly set the type.

Reviewed By: sivachandra

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

Added: 
    

Modified: 
    libc/test/src/__support/FPUtil/fpbits_test.cpp

Removed: 
    


################################################################################
diff  --git a/libc/test/src/__support/FPUtil/fpbits_test.cpp b/libc/test/src/__support/FPUtil/fpbits_test.cpp
index ba8aef77b8340..a678c1591f2b5 100644
--- a/libc/test/src/__support/FPUtil/fpbits_test.cpp
+++ b/libc/test/src/__support/FPUtil/fpbits_test.cpp
@@ -197,9 +197,9 @@ TEST(LlvmLibcFPBitsTest, X86LongDoubleType) {
 }
 #else
 TEST(LlvmLibcFPBitsTest, LongDoubleType) {
-  if constexpr (sizeof(long double) == sizeof(double))
-    return; // The tests for the "double" type cover for this case.
-
+#if defined(LONG_DOUBLE_IS_DOUBLE)
+  return; // The tests for the "double" type cover for this case.
+#else
   EXPECT_STREQ(FPBits<long double>::inf().str().c_str(), "(+Infinity)");
   EXPECT_STREQ(FPBits<long double>::neg_inf().str().c_str(), "(-Infinity)");
   EXPECT_STREQ(
@@ -262,5 +262,6 @@ TEST(LlvmLibcFPBitsTest, LongDoubleType) {
   EXPECT_STREQ(negnum.str().c_str(),
                "0xBFFF2000000000000000000000000000 = "
                "(S: 1, E: 0x3FFF, M: 0x00002000000000000000000000000000)");
+#endif
 }
 #endif


        


More information about the libc-commits mailing list