[libc-commits] [libc] d358151 - Reapply "[libc] Make GPU `libm` use generic implementations" (#98061)

Joseph Huber via libc-commits libc-commits at lists.llvm.org
Mon Jul 8 13:02:22 PDT 2024


Author: Joseph Huber
Date: 2024-07-08T15:02:05-05:00
New Revision: d358151a4fe94c72186d58f8903f044a116d0fa8

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

LOG: Reapply "[libc] Make GPU `libm` use generic implementations" (#98061)

This reverts commit ea3fd020f4879d5b4261eabd9a56c24f30bc47f9.

Added: 
    

Modified: 
    libc/include/llvm-libc-macros/math-macros.h
    libc/src/math/amdgpu/CMakeLists.txt
    libc/src/math/nvptx/CMakeLists.txt
    libc/src/math/nvptx/llrint.cpp
    libc/src/math/nvptx/llrintf.cpp
    libc/src/math/nvptx/lrint.cpp

Removed: 
    


################################################################################
diff  --git a/libc/include/llvm-libc-macros/math-macros.h b/libc/include/llvm-libc-macros/math-macros.h
index 47838969d59aed..efecdf16962a8e 100644
--- a/libc/include/llvm-libc-macros/math-macros.h
+++ b/libc/include/llvm-libc-macros/math-macros.h
@@ -41,12 +41,10 @@
 #define FP_LLOGBNAN LONG_MAX
 #endif
 
-#ifdef __FAST_MATH__
+#if defined(__NVPTX__) || defined(__AMDGPU__) || defined(__FAST_MATH__)
 #define math_errhandling 0
 #elif defined(__NO_MATH_ERRNO__)
 #define math_errhandling (MATH_ERREXCEPT)
-#elif defined(__NVPTX__) || defined(__AMDGPU__)
-#define math_errhandling (MATH_ERRNO)
 #else
 #define math_errhandling (MATH_ERRNO | MATH_ERREXCEPT)
 #endif

diff  --git a/libc/src/math/amdgpu/CMakeLists.txt b/libc/src/math/amdgpu/CMakeLists.txt
index 93735a556a31bf..bc81f7b20a71db 100644
--- a/libc/src/math/amdgpu/CMakeLists.txt
+++ b/libc/src/math/amdgpu/CMakeLists.txt
@@ -286,122 +286,86 @@ add_entrypoint_object(
     -O2
 )
 
-# The following functions currently are not implemented natively and borrow from
-# existing implementations. This will be removed in the future.
-add_entrypoint_object(
-  acos
-  SRCS
-    acos.cpp
-  HDRS
-    ../acos.h
-  VENDOR
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-)
-
 add_entrypoint_object(
-  acosf
+  frexp
   SRCS
-    acosf.cpp
+    frexp.cpp
   HDRS
-    ../acosf.h
+    ../frexp.h
   COMPILE_OPTIONS
-    ${bitcode_link_flags}
     -O2
-  VENDOR
 )
 
 add_entrypoint_object(
-  acosh
+  frexpf
   SRCS
-    acosh.cpp
+    frexpf.cpp
   HDRS
-    ../acosh.h
+    ../frexpf.h
   COMPILE_OPTIONS
-    ${bitcode_link_flags}
     -O2
-  VENDOR
 )
 
 add_entrypoint_object(
-  acoshf
+  scalbn
   SRCS
-    acoshf.cpp
+    scalbn.cpp
   HDRS
-    ../acoshf.h
+    ../scalbn.h
   COMPILE_OPTIONS
-    ${bitcode_link_flags}
     -O2
-  VENDOR
 )
 
 add_entrypoint_object(
-  asin
+  scalbnf
   SRCS
-    asin.cpp
+    scalbnf.cpp
   HDRS
-    ../asin.h
+    ../scalbnf.h
   COMPILE_OPTIONS
-    ${bitcode_link_flags}
     -O2
-  VENDOR
 )
 
 add_entrypoint_object(
-  asinf
+  ldexp
   SRCS
-    asinf.cpp
+    ldexp.cpp
   HDRS
-    ../asinf.h
+    ../ldexp.h
   COMPILE_OPTIONS
-    ${bitcode_link_flags}
     -O2
-  VENDOR
 )
 
 add_entrypoint_object(
-  asinh
+  ldexpf
   SRCS
-    asinh.cpp
+    ldexpf.cpp
   HDRS
-    ../asinh.h
+    ../ldexpf.h
   COMPILE_OPTIONS
-    ${bitcode_link_flags}
     -O2
-  VENDOR
 )
 
+# The following functions currently are not implemented natively and borrow from
+# existing implementations. This will be removed in the future.
 add_entrypoint_object(
-  atan
+  acos
   SRCS
-    atan.cpp
+    acos.cpp
   HDRS
-    ../atan.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
+    ../acos.h
   VENDOR
-)
-
-add_entrypoint_object(
-  atanf
-  SRCS
-    atanf.cpp
-  HDRS
-    ../atanf.h
   COMPILE_OPTIONS
     ${bitcode_link_flags}
     -O2
-  VENDOR
 )
 
 add_entrypoint_object(
-  atan2
+  acosh
   SRCS
-    atan2.cpp
+    acosh.cpp
   HDRS
-    ../atan2.h
+    ../acosh.h
   COMPILE_OPTIONS
     ${bitcode_link_flags}
     -O2
@@ -409,11 +373,11 @@ add_entrypoint_object(
 )
 
 add_entrypoint_object(
-  atan2f
+  asin
   SRCS
-    atan2f.cpp
+    asin.cpp
   HDRS
-    ../atan2f.h
+    ../asin.h
   COMPILE_OPTIONS
     ${bitcode_link_flags}
     -O2
@@ -421,11 +385,11 @@ add_entrypoint_object(
 )
 
 add_entrypoint_object(
-  atanh
+  asinh
   SRCS
-    atanh.cpp
+    asinh.cpp
   HDRS
-    ../atanh.h
+    ../asinh.h
   COMPILE_OPTIONS
     ${bitcode_link_flags}
     -O2
@@ -433,11 +397,11 @@ add_entrypoint_object(
 )
 
 add_entrypoint_object(
-  atanhf
+  atan
   SRCS
-    atanhf.cpp
+    atan.cpp
   HDRS
-    ../atanhf.h
+    ../atan.h
   COMPILE_OPTIONS
     ${bitcode_link_flags}
     -O2
@@ -445,11 +409,11 @@ add_entrypoint_object(
 )
 
 add_entrypoint_object(
-  cos
+  atan2
   SRCS
-    cos.cpp
+    atan2.cpp
   HDRS
-    ../cos.h
+    ../atan2.h
   COMPILE_OPTIONS
     ${bitcode_link_flags}
     -O2
@@ -457,11 +421,11 @@ add_entrypoint_object(
 )
 
 add_entrypoint_object(
-  cosf
+  atanh
   SRCS
-    cosf.cpp
+    atanh.cpp
   HDRS
-    ../cosf.h
+    ../atanh.h
   COMPILE_OPTIONS
     ${bitcode_link_flags}
     -O2
@@ -480,18 +444,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  coshf
-  SRCS
-    coshf.cpp
-  HDRS
-    ../coshf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   erf
   SRCS
@@ -504,258 +456,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  erff
-  SRCS
-    erff.cpp
-  HDRS
-    ../erff.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  exp
-  SRCS
-    exp.cpp
-  HDRS
-    ../exp.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  exp10
-  SRCS
-    exp10.cpp
-  HDRS
-    ../exp10.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  exp10f
-  SRCS
-    exp10f.cpp
-  HDRS
-    ../exp10f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  exp2
-  SRCS
-    exp2.cpp
-  HDRS
-    ../exp2.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  exp2f
-  SRCS
-    exp2f.cpp
-  HDRS
-    ../exp2f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  expf
-  SRCS
-    expf.cpp
-  HDRS
-    ../expf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  expm1
-  SRCS
-    expm1.cpp
-  HDRS
-    ../expm1.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  expm1f
-  SRCS
-    expm1f.cpp
-  HDRS
-    ../expm1f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  fdim
-  SRCS
-    fdim.cpp
-  HDRS
-    ../fdim.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  fdimf
-  SRCS
-    fdimf.cpp
-  HDRS
-    ../fdimf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  hypot
-  SRCS
-    hypot.cpp
-  HDRS
-    ../hypot.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  hypotf
-  SRCS
-    hypotf.cpp
-  HDRS
-    ../hypotf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  ilogb
-  SRCS
-    ilogb.cpp
-  HDRS
-    ../ilogb.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  ilogbf
-  SRCS
-    ilogbf.cpp
-  HDRS
-    ../ilogbf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log10
-  SRCS
-    log10.cpp
-  HDRS
-    ../log10.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log10f
-  SRCS
-    log10f.cpp
-  HDRS
-    ../log10f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log2
-  SRCS
-    log2.cpp
-  HDRS
-    ../log2.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log2f
-  SRCS
-    log2f.cpp
-  HDRS
-    ../log2f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log
-  SRCS
-    log.cpp
-  HDRS
-    ../log.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  logf
-  SRCS
-    logf.cpp
-  HDRS
-    ../logf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   lrint
   SRCS
@@ -780,54 +480,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  ldexp
-  SRCS
-    ldexp.cpp
-  HDRS
-    ../ldexp.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  ldexpf
-  SRCS
-    ldexpf.cpp
-  HDRS
-    ../ldexpf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log1p
-  SRCS
-    log1p.cpp
-  HDRS
-    ../log1p.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log1pf
-  SRCS
-    log1pf.cpp
-  HDRS
-    ../log1pf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   llrint
   SRCS
@@ -852,79 +504,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  remquo
-  SRCS
-    remquo.cpp
-  HDRS
-    ../remquo.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  remquof
-  SRCS
-    remquof.cpp
-  HDRS
-    ../remquof.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  scalbn
-  SRCS
-    scalbn.cpp
-  HDRS
-    ../scalbn.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  scalbnf
-  SRCS
-    scalbnf.cpp
-  HDRS
-    ../scalbnf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-
-add_entrypoint_object(
-  nextafter
-  SRCS
-    nextafter.cpp
-  HDRS
-    ../nextafter.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  nextafterf
-  SRCS
-    nextafterf.cpp
-  HDRS
-    ../nextafterf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   pow
   SRCS
@@ -937,66 +516,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  powf
-  SRCS
-    powf.cpp
-  HDRS
-    ../powf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  sin
-  SRCS
-    sin.cpp
-  HDRS
-    ../sin.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  sinf
-  SRCS
-    sinf.cpp
-  HDRS
-    ../sinf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  sincos
-  SRCS
-    sincos.cpp
-  HDRS
-    ../sincos.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  sincosf
-  SRCS
-    sincosf.cpp
-  HDRS
-    ../sincosf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   sinh
   SRCS
@@ -1009,42 +528,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  sinhf
-  SRCS
-    sinhf.cpp
-  HDRS
-    ../sinhf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  tan
-  SRCS
-    tan.cpp
-  HDRS
-    ../tan.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  tanf
-  SRCS
-    tanf.cpp
-  HDRS
-    ../tanf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   tanh
   SRCS
@@ -1057,18 +540,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  tanhf
-  SRCS
-    tanhf.cpp
-  HDRS
-    ../tanhf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   tgamma
   SRCS
@@ -1092,27 +563,3 @@ add_entrypoint_object(
     -O2
   VENDOR
 )
-
-add_entrypoint_object(
-  frexp
-  SRCS
-    frexp.cpp
-  HDRS
-    ../frexp.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  frexpf
-  SRCS
-    frexpf.cpp
-  HDRS
-    ../frexpf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)

diff  --git a/libc/src/math/nvptx/CMakeLists.txt b/libc/src/math/nvptx/CMakeLists.txt
index 581e1c6a3044b2..a09668ca10678d 100644
--- a/libc/src/math/nvptx/CMakeLists.txt
+++ b/libc/src/math/nvptx/CMakeLists.txt
@@ -301,18 +301,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  acosf
-  SRCS
-    acosf.cpp
-  HDRS
-    ../acosf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   acosh
   SRCS
@@ -325,18 +313,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  acoshf
-  SRCS
-    acoshf.cpp
-  HDRS
-    ../acoshf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   asin
   SRCS
@@ -349,18 +325,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  asinf
-  SRCS
-    asinf.cpp
-  HDRS
-    ../asinf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   asinh
   SRCS
@@ -385,18 +349,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  atanf
-  SRCS
-    atanf.cpp
-  HDRS
-    ../atanf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   atan2
   SRCS
@@ -409,18 +361,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  atan2f
-  SRCS
-    atan2f.cpp
-  HDRS
-    ../atan2f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   atanh
   SRCS
@@ -433,18 +373,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  atanhf
-  SRCS
-    atanhf.cpp
-  HDRS
-    ../atanhf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   cos
   SRCS
@@ -457,18 +385,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  cosf
-  SRCS
-    cosf.cpp
-  HDRS
-    ../cosf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   cosh
   SRCS
@@ -481,18 +397,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  coshf
-  SRCS
-    coshf.cpp
-  HDRS
-    ../coshf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   erf
   SRCS
@@ -505,258 +409,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  erff
-  SRCS
-    erff.cpp
-  HDRS
-    ../erff.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  exp
-  SRCS
-    exp.cpp
-  HDRS
-    ../exp.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  exp10
-  SRCS
-    exp10.cpp
-  HDRS
-    ../exp10.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  exp10f
-  SRCS
-    exp10f.cpp
-  HDRS
-    ../exp10f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  exp2
-  SRCS
-    exp2.cpp
-  HDRS
-    ../exp2.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  exp2f
-  SRCS
-    exp2f.cpp
-  HDRS
-    ../exp2f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  expf
-  SRCS
-    expf.cpp
-  HDRS
-    ../expf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  expm1
-  SRCS
-    expm1.cpp
-  HDRS
-    ../expm1.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  expm1f
-  SRCS
-    expm1f.cpp
-  HDRS
-    ../expm1f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  fdim
-  SRCS
-    fdim.cpp
-  HDRS
-    ../fdim.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  fdimf
-  SRCS
-    fdimf.cpp
-  HDRS
-    ../fdimf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  hypot
-  SRCS
-    hypot.cpp
-  HDRS
-    ../hypot.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  hypotf
-  SRCS
-    hypotf.cpp
-  HDRS
-    ../hypotf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  ilogb
-  SRCS
-    ilogb.cpp
-  HDRS
-    ../ilogb.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  ilogbf
-  SRCS
-    ilogbf.cpp
-  HDRS
-    ../ilogbf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log10
-  SRCS
-    log10.cpp
-  HDRS
-    ../log10.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log10f
-  SRCS
-    log10f.cpp
-  HDRS
-    ../log10f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log2
-  SRCS
-    log2.cpp
-  HDRS
-    ../log2.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log2f
-  SRCS
-    log2f.cpp
-  HDRS
-    ../log2f.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log
-  SRCS
-    log.cpp
-  HDRS
-    ../log.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  logf
-  SRCS
-    logf.cpp
-  HDRS
-    ../logf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   lrint
   SRCS
@@ -781,54 +433,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  ldexp
-  SRCS
-    ldexp.cpp
-  HDRS
-    ../ldexp.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  ldexpf
-  SRCS
-    ldexpf.cpp
-  HDRS
-    ../ldexpf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log1p
-  SRCS
-    log1p.cpp
-  HDRS
-    ../log1p.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  log1pf
-  SRCS
-    log1pf.cpp
-  HDRS
-    ../log1pf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   llrint
   SRCS
@@ -853,79 +457,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  remquo
-  SRCS
-    remquo.cpp
-  HDRS
-    ../remquo.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  remquof
-  SRCS
-    remquof.cpp
-  HDRS
-    ../remquof.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  scalbn
-  SRCS
-    scalbn.cpp
-  HDRS
-    ../scalbn.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  scalbnf
-  SRCS
-    scalbnf.cpp
-  HDRS
-    ../scalbnf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-
-add_entrypoint_object(
-  nextafter
-  SRCS
-    nextafter.cpp
-  HDRS
-    ../nextafter.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  nextafterf
-  SRCS
-    nextafterf.cpp
-  HDRS
-    ../nextafterf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   pow
   SRCS
@@ -938,66 +469,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  powf
-  SRCS
-    powf.cpp
-  HDRS
-    ../powf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  sin
-  SRCS
-    sin.cpp
-  HDRS
-    ../sin.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  sinf
-  SRCS
-    sinf.cpp
-  HDRS
-    ../sinf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  sincos
-  SRCS
-    sincos.cpp
-  HDRS
-    ../sincos.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  sincosf
-  SRCS
-    sincosf.cpp
-  HDRS
-    ../sincosf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   sinh
   SRCS
@@ -1010,42 +481,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  sinhf
-  SRCS
-    sinhf.cpp
-  HDRS
-    ../sinhf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  tan
-  SRCS
-    tan.cpp
-  HDRS
-    ../tan.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  tanf
-  SRCS
-    tanf.cpp
-  HDRS
-    ../tanf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   tanh
   SRCS
@@ -1058,18 +493,6 @@ add_entrypoint_object(
   VENDOR
 )
 
-add_entrypoint_object(
-  tanhf
-  SRCS
-    tanhf.cpp
-  HDRS
-    ../tanhf.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
 add_entrypoint_object(
   tgamma
   SRCS
@@ -1093,27 +516,3 @@ add_entrypoint_object(
     -O2
   VENDOR
 )
-
-add_entrypoint_object(
-  frexp
-  SRCS
-    frexp.cpp
-  HDRS
-    ../frexp.h
-  COMPILE_OPTIONS
-    ${bitcode_link_flags}
-    -O2
-  VENDOR
-)
-
-add_entrypoint_object(
-  frexpf
-  SRCS
-    frexpf.cpp
-  HDRS
-    ../frexpf.h
-  COMPILE_OPTIONS
-    ${itcode_link_flags}
-    -O2
-  VENDOR
-)

diff  --git a/libc/src/math/nvptx/llrint.cpp b/libc/src/math/nvptx/llrint.cpp
index 8f95e75e779b51..307420a9b8b261 100644
--- a/libc/src/math/nvptx/llrint.cpp
+++ b/libc/src/math/nvptx/llrint.cpp
@@ -13,6 +13,8 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(long long, llrint, (double x)) { return __nv_llrint(x); }
+LLVM_LIBC_FUNCTION(long long, llrint, (double x)) {
+  return static_cast<long long>(__builtin_rint(x));
+}
 
 } // namespace LIBC_NAMESPACE

diff  --git a/libc/src/math/nvptx/llrintf.cpp b/libc/src/math/nvptx/llrintf.cpp
index 1432ffbd1bdad3..23404990fb1bdf 100644
--- a/libc/src/math/nvptx/llrintf.cpp
+++ b/libc/src/math/nvptx/llrintf.cpp
@@ -13,6 +13,8 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(long long, llrintf, (float x)) { return __nv_llrintf(x); }
+LLVM_LIBC_FUNCTION(long long, llrintf, (float x)) {
+  return static_cast<long long>(__builtin_rintf(x));
+}
 
 } // namespace LIBC_NAMESPACE

diff  --git a/libc/src/math/nvptx/lrint.cpp b/libc/src/math/nvptx/lrint.cpp
index 8585f4ce53a4d1..b335b4f06393ca 100644
--- a/libc/src/math/nvptx/lrint.cpp
+++ b/libc/src/math/nvptx/lrint.cpp
@@ -13,6 +13,8 @@
 
 namespace LIBC_NAMESPACE {
 
-LLVM_LIBC_FUNCTION(long, lrint, (double x)) { return __nv_lrint(x); }
+LLVM_LIBC_FUNCTION(long, lrint, (double x)) {
+  return static_cast<long>(__builtin_rint(x));
+}
 
 } // namespace LIBC_NAMESPACE


        


More information about the libc-commits mailing list