[libc] Include nextafter's functions to Windows's entrypoints
authorHedin Garca <hedingarcia@google.com>
Tue, 20 Jul 2021 20:25:24 +0000 (20:25 +0000)
committerHedin García <hedingarcia@google.com>
Wed, 21 Jul 2021 13:28:01 +0000 (13:28 +0000)
Incorporated the varied functions for nextafter and refactored
NextAfterTest.h to correctly define bitWidthOfType for both
Linux and Windows; by letting FloatProperties take care
of the directives' logic based on the platform being used.
This allows to successfully run nextafter's tests.

Reviewed By: sivachandra

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

libc/config/windows/entrypoints.txt
libc/test/src/math/NextAfterTest.h

index e0706b0a82ae25d2e5ff7f9e5340c81b69b48562..9ef14fe77edc053192a7ad05805fd550502e5edc 100644 (file)
@@ -66,6 +66,9 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.modf
     libc.src.math.modff
     libc.src.math.modfl
+    libc.src.math.nextafter
+    libc.src.math.nextafterf
+    libc.src.math.nextafterl
 )
 
 set(TARGET_LLVMLIBC_ENTRYPOINTS
index 4fa135d9cb25993867d23460d0f9cf99c351982e..aea03154c90ae8ec94e5d6f74d6aeb7428c5758d 100644 (file)
@@ -22,12 +22,8 @@ class NextAfterTestTemplate : public __llvm_libc::testing::Test {
   using MantissaWidth = __llvm_libc::fputil::MantissaWidth<T>;
   using UIntType = typename FPBits::UIntType;
 
-#if (defined(__x86_64__) || defined(__i386__))
   static constexpr int bitWidthOfType =
-      __llvm_libc::cpp::IsSame<T, long double>::Value ? 80 : (sizeof(T) * 8);
-#else
-  static constexpr int bitWidthOfType = sizeof(T) * 8;
-#endif
+      __llvm_libc::fputil::FloatProperties<T>::bitWidth;
 
   const T zero = T(FPBits::zero());
   const T negZero = T(FPBits::negZero());