[libc-commits] [libc] 7547ad3 - [libc][math] Skip checking for exceptional values in expm1f when LIBC_MATH_SKIP_ACCURATE_PASS is set. (#130968)

via libc-commits libc-commits at lists.llvm.org
Tue Apr 22 22:04:25 PDT 2025


Author: lntue
Date: 2025-04-23T12:04:21+07:00
New Revision: 7547ad3a7bc1e249c240512438eb39581f58c8ef

URL: https://github.com/llvm/llvm-project/commit/7547ad3a7bc1e249c240512438eb39581f58c8ef
DIFF: https://github.com/llvm/llvm-project/commit/7547ad3a7bc1e249c240512438eb39581f58c8ef.diff

LOG: [libc][math] Skip checking for exceptional values in expm1f when LIBC_MATH_SKIP_ACCURATE_PASS is set. (#130968)

Added: 
    

Modified: 
    libc/src/math/generic/expm1f.cpp

Removed: 
    


################################################################################
diff  --git a/libc/src/math/generic/expm1f.cpp b/libc/src/math/generic/expm1f.cpp
index 1e44e943d9258..b2967e2516197 100644
--- a/libc/src/math/generic/expm1f.cpp
+++ b/libc/src/math/generic/expm1f.cpp
@@ -30,6 +30,7 @@ LLVM_LIBC_FUNCTION(float, expm1f, (float x)) {
   uint32_t x_u = xbits.uintval();
   uint32_t x_abs = x_u & 0x7fff'ffffU;
 
+#ifndef LIBC_MATH_HAS_SKIP_ACCURATE_PASS
   // Exceptional value
   if (LIBC_UNLIKELY(x_u == 0x3e35'bec5U)) { // x = 0x1.6b7d8ap-3f
     int round_mode = fputil::quick_get_round();
@@ -37,7 +38,6 @@ LLVM_LIBC_FUNCTION(float, expm1f, (float x)) {
       return 0x1.8dbe64p-3f;
     return 0x1.8dbe62p-3f;
   }
-
 #if !defined(LIBC_TARGET_CPU_HAS_FMA_DOUBLE)
   if (LIBC_UNLIKELY(x_u == 0xbdc1'c6cbU)) { // x = -0x1.838d96p-4f
     int round_mode = fputil::quick_get_round();
@@ -46,6 +46,7 @@ LLVM_LIBC_FUNCTION(float, expm1f, (float x)) {
     return -0x1.71c882p-4f;
   }
 #endif // LIBC_TARGET_CPU_HAS_FMA_DOUBLE
+#endif // !LIBC_MATH_HAS_SKIP_ACCURATE_PASS
 
   // When |x| > 25*log(2), or nan
   if (LIBC_UNLIKELY(x_abs >= 0x418a'a123U)) {


        


More information about the libc-commits mailing list