[libc] Fix test failing on the GPU due to undefined floating point type
authorJoseph Huber <jhuber6@vols.utk.edu>
Fri, 19 May 2023 17:46:18 +0000 (12:46 -0500)
committerJoseph Huber <jhuber6@vols.utk.edu>
Fri, 19 May 2023 19:03:42 +0000 (14:03 -0500)
We got build failures due to the handling here, explicitly set the type.

Reviewed By: sivachandra

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

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

index ba8aef7..a678c15 100644 (file)
@@ -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