diff --git a/libc/config/windows/entrypoints.txt b/libc/config/windows/entrypoints.txt --- a/libc/config/windows/entrypoints.txt +++ b/libc/config/windows/entrypoints.txt @@ -39,6 +39,39 @@ libc.src.string.strtok libc.src.string.strtok_r ) + +set(TARGET_LIBM_ENTRYPOINTS + # math.h entrypoints + libc.src.math.copysign + libc.src.math.copysignf + libc.src.math.copysignl + libc.src.math.fdimf + libc.src.math.fdim + libc.src.math.fdiml + libc.src.math.fmin + libc.src.math.fminf + libc.src.math.fminl + libc.src.math.fmax + libc.src.math.fmaxf + libc.src.math.fmaxl + libc.src.math.ilogb + libc.src.math.ilogbf + libc.src.math.ilogbl + libc.src.math.ldexp + libc.src.math.ldexpf + libc.src.math.ldexpl + libc.src.math.logb + libc.src.math.logbf + libc.src.math.logbl + 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 ${TARGET_LIBC_ENTRYPOINTS} + ${TARGET_LIBM_ENTRYPOINTS} ) diff --git a/libc/test/src/math/NextAfterTest.h b/libc/test/src/math/NextAfterTest.h --- a/libc/test/src/math/NextAfterTest.h +++ b/libc/test/src/math/NextAfterTest.h @@ -22,12 +22,8 @@ using MantissaWidth = __llvm_libc::fputil::MantissaWidth; using UIntType = typename FPBits::UIntType; -#if (defined(__x86_64__) || defined(__i386__)) static constexpr int bitWidthOfType = - __llvm_libc::cpp::IsSame::Value ? 80 : (sizeof(T) * 8); -#else - static constexpr int bitWidthOfType = sizeof(T) * 8; -#endif + __llvm_libc::fputil::FloatProperties::bitWidth; const T zero = T(FPBits::zero()); const T negZero = T(FPBits::negZero()); diff --git a/libc/utils/FPUtil/x86_64/FEnv.h b/libc/utils/FPUtil/x86_64/FEnv.h --- a/libc/utils/FPUtil/x86_64/FEnv.h +++ b/libc/utils/FPUtil/x86_64/FEnv.h @@ -91,12 +91,16 @@ uint16_t StatusWord; uint16_t Unused2; // TODO: Elaborate the remaining 20 bytes as required. +#if !(defined(_WIN32) || defined(_WIN64)) uint32_t _[5]; +#endif }; struct FPState { X87StateDescriptor X87Status; +#if !(defined(_WIN32) || defined(_WIN64)) uint32_t MXCSR; +#endif }; static_assert( @@ -349,7 +353,9 @@ static inline int getEnv(fenv_t *envp) { internal::FPState *state = reinterpret_cast(envp); internal::getX87StateDescriptor(state->X87Status); +#if !(defined(_WIN32) || defined(_WIN64)) state->MXCSR = internal::getMXCSR(); +#endif return 0; } @@ -357,7 +363,9 @@ const internal::FPState *state = reinterpret_cast(envp); internal::writeX87StateDescriptor(state->X87Status); +#if !(defined(_WIN32) || defined(_WIN64)) internal::writeMXCSR(state->MXCSR); +#endif return 0; }