Skip to content

[libc] Make GPU libm use generic implementations #98014

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 8, 2024

Conversation

jhuber6
Copy link
Contributor

@jhuber6 jhuber6 commented Jul 8, 2024

Summary:
This patch moves a lot of the old vendor implementations to the new
generic math functions. Previously a lot of these were done through the
vendor functions, but the long term goal is to completely phase these
out. In order to make the tests pass I had to disable exceptions so they
only perform functional tests.

Summary:
This patch moves a lot of the old vendor implementations to the new
generic math functions. Previously a lot of these were done through the
vendor functions, but the long term goal is to completely phase these
out. In order to make the tests pass I had to disable exceptions so they
only perform functional tests.
@llvmbot
Copy link
Member

llvmbot commented Jul 8, 2024

@llvm/pr-subscribers-backend-amdgpu

Author: Joseph Huber (jhuber6)

Changes

Summary:
This patch moves a lot of the old vendor implementations to the new
generic math functions. Previously a lot of these were done through the
vendor functions, but the long term goal is to completely phase these
out. In order to make the tests pass I had to disable exceptions so they
only perform functional tests.


Patch is 21.47 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/98014.diff

6 Files Affected:

  • (modified) libc/include/llvm-libc-macros/math-macros.h (+1-3)
  • (modified) libc/src/math/amdgpu/CMakeLists.txt (+41-594)
  • (modified) libc/src/math/nvptx/CMakeLists.txt (-601)
  • (modified) libc/src/math/nvptx/llrint.cpp (+3-1)
  • (modified) libc/src/math/nvptx/llrintf.cpp (+3-1)
  • (modified) libc/src/math/nvptx/lrint.cpp (+3-1)
diff --git a/libc/include/llvm-libc-macros/math-macros.h b/libc/include/llvm-libc-macros/math-macros.h
index 47838969d59ae..efecdf16962a8 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 93735a556a31b..bc81f7b20a71d 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 581e1c6a3044b..a09668ca10678 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...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Jul 8, 2024

@llvm/pr-subscribers-libc

Author: Joseph Huber (jhuber6)

Changes

Summary:
This patch moves a lot of the old vendor implementations to the new
generic math functions. Previously a lot of these were done through the
vendor functions, but the long term goal is to completely phase these
out. In order to make the tests pass I had to disable exceptions so they
only perform functional tests.


Patch is 21.47 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/98014.diff

6 Files Affected:

  • (modified) libc/include/llvm-libc-macros/math-macros.h (+1-3)
  • (modified) libc/src/math/amdgpu/CMakeLists.txt (+41-594)
  • (modified) libc/src/math/nvptx/CMakeLists.txt (-601)
  • (modified) libc/src/math/nvptx/llrint.cpp (+3-1)
  • (modified) libc/src/math/nvptx/llrintf.cpp (+3-1)
  • (modified) libc/src/math/nvptx/lrint.cpp (+3-1)
diff --git a/libc/include/llvm-libc-macros/math-macros.h b/libc/include/llvm-libc-macros/math-macros.h
index 47838969d59ae..efecdf16962a8 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 93735a556a31b..bc81f7b20a71d 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 581e1c6a3044b..a09668ca10678 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...
[truncated]

@jhuber6
Copy link
Contributor Author

jhuber6 commented Jul 8, 2024

With this patch, the math functions still not implemented by either LLVM's libm or a builtin are the following:

acos.cpp
acosh.cpp
asin.cpp
asinh.cpp
atan2.cpp
atan.cpp
atanh.cpp
cosh.cpp
erf.cpp
pow.cpp
sinh.cpp
tanh.cpp
tgamma.cpp
tgammaf.cpp

@jhuber6 jhuber6 merged commit 5c40e56 into llvm:main Jul 8, 2024
9 checks passed
@llvm-ci
Copy link
Collaborator

llvm-ci commented Jul 8, 2024

LLVM Buildbot has detected a new failure on builder premerge-monolithic-linux running on premerge-linux-1 while building libc at step 6 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/153/builds/2248

Here is the relevant piece of the build log for the reference:

Step 6 (build-unified-tree) failure: build (failure)
...
7.354 [462/58/867] Building CXX object compiler-rt/lib/interception/CMakeFiles/RTInterception.x86_64.dir/interception_win.cpp.o
7.354 [461/58/868] Building CXX object compiler-rt/lib/interception/CMakeFiles/RTInterception.x86_64.dir/interception_mac.cpp.o
7.355 [460/58/869] Building CXX object compiler-rt/lib/interception/CMakeFiles/RTInterception.x86_64.dir/interception_linux.cpp.o
7.355 [459/58/870] Building CXX object compiler-rt/lib/stats/CMakeFiles/clang_rt.stats_client-x86_64.dir/stats_client.cpp.o
7.356 [458/58/871] Building CXX object compiler-rt/lib/lsan/CMakeFiles/RTLSanCommon.x86_64.dir/lsan_common_fuchsia.cpp.o
7.356 [457/58/872] Building CXX object compiler-rt/lib/lsan/CMakeFiles/clang_rt.lsan-x86_64.dir/lsan_fuchsia.cpp.o
7.357 [456/58/873] Linking CXX static library compiler-rt/lib/sanitizer_common/tests/libRTSanitizerCommon.test.nolibc.x86_64.a
7.357 [455/58/874] Building CXX object compiler-rt/lib/lsan/CMakeFiles/clang_rt.lsan-x86_64.dir/lsan_mac.cpp.o
7.359 [454/58/875] Building CXX object compiler-rt/lib/lsan/CMakeFiles/clang_rt.lsan-x86_64.dir/lsan_malloc_mac.cpp.o
7.363 [453/58/876] Building CXX object libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o
FAILED: libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o 
/build/buildbot/premerge-monolithic-linux/build/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -I/build/buildbot/premerge-monolithic-linux/llvm-project/libc -isystem /build/buildbot/premerge-monolithic-linux/build/runtimes/runtimes-bins/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -UNDEBUG -fpie -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -std=gnu++17 -MD -MT libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o -MF libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o.d -o libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o -c /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/stdio/printf_core/converter.cpp
clang++: /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/ADT/APInt.h:1503: uint64_t llvm::APInt::getZExtValue() const: Assertion `getActiveBits() <= 64 && "Too many bits for uint64_t"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0.	Program arguments: /build/buildbot/premerge-monolithic-linux/build/./bin/clang++ --target=x86_64-unknown-linux-gnu -DLIBC_NAMESPACE=__llvm_libc_19_0_0_git -I/build/buildbot/premerge-monolithic-linux/llvm-project/libc -isystem /build/buildbot/premerge-monolithic-linux/build/runtimes/runtimes-bins/libc/include -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -O3 -DNDEBUG -UNDEBUG -fpie -ffixed-point -fno-builtin -fno-exceptions -fno-lax-vector-conversions -fno-unwind-tables -fno-asynchronous-unwind-tables -fno-rtti -ftrivial-auto-var-init=pattern -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -Wall -Wextra -Werror -Wconversion -Wno-sign-conversion -Wimplicit-fallthrough -Wwrite-strings -Wextra-semi -Wnewline-eof -Wnonportable-system-include-path -Wstrict-prototypes -Wthread-safety -Wglobal-constructors -std=gnu++17 -MD -MT libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o -MF libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o.d -o libc/src/stdio/printf_core/CMakeFiles/libc.src.stdio.printf_core.converter.dir/converter.cpp.o -c /build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/stdio/printf_core/converter.cpp
1.	<eof> parser at end of file
2.	Optimizer
3.	Running pass "require<globals-aa>,function(invalidate<aa>),require<profile-summary>,cgscc(devirt<4>(inline,function-attrs<skip-non-recursive-function-attrs>,argpromotion,openmp-opt-cgscc,function<eager-inv;no-rerun>(sroa<modify-cfg>,early-cse<memssa>,speculative-execution<only-if-divergent-target>,jump-threading,correlated-propagation,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,aggressive-instcombine,libcalls-shrinkwrap,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,reassociate,constraint-elimination,loop-mssa(loop-instsimplify,loop-simplifycfg,licm<no-allowspeculation>,loop-rotate<header-duplication;no-prepare-for-lto>,licm<allowspeculation>,simple-loop-unswitch<nontrivial;trivial>),simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,loop(loop-idiom,indvars,simple-loop-unswitch<nontrivial;trivial>,loop-deletion,loop-unroll-full),sroa<modify-cfg>,vector-combine,mldst-motion<no-split-footer-bb>,gvn<>,sccp,bdce,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,jump-threading,correlated-propagation,adce,memcpyopt,dse,move-auto-init,loop-mssa(licm<allowspeculation>),coro-elide,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>),function-attrs,function(require<should-not-run-function-passes>),coro-split)),function(invalidate<should-not-run-function-passes>),cgscc(devirt<4>())" on module "/build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/stdio/printf_core/converter.cpp"
4.	Running pass "cgscc(devirt<4>(inline,function-attrs<skip-non-recursive-function-attrs>,argpromotion,openmp-opt-cgscc,function<eager-inv;no-rerun>(sroa<modify-cfg>,early-cse<memssa>,speculative-execution<only-if-divergent-target>,jump-threading,correlated-propagation,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,aggressive-instcombine,libcalls-shrinkwrap,tailcallelim,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,reassociate,constraint-elimination,loop-mssa(loop-instsimplify,loop-simplifycfg,licm<no-allowspeculation>,loop-rotate<header-duplication;no-prepare-for-lto>,licm<allowspeculation>,simple-loop-unswitch<nontrivial;trivial>),simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;no-hoist-common-insts;no-sink-common-insts;speculate-blocks;simplify-cond-branch>,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,loop(loop-idiom,indvars,simple-loop-unswitch<nontrivial;trivial>,loop-deletion,loop-unroll-full),sroa<modify-cfg>,vector-combine,mldst-motion<no-split-footer-bb>,gvn<>,sccp,bdce,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>,jump-threading,correlated-propagation,adce,memcpyopt,dse,move-auto-init,loop-mssa(licm<allowspeculation>),coro-elide,simplifycfg<bonus-inst-threshold=1;no-forward-switch-cond;switch-range-to-icmp;no-switch-to-lookup;keep-loops;hoist-common-insts;sink-common-insts;speculate-blocks;simplify-cond-branch>,instcombine<max-iterations=1;no-use-loop-info;no-verify-fixpoint>),function-attrs,function(require<should-not-run-function-passes>),coro-split))" on module "/build/buildbot/premerge-monolithic-linux/llvm-project/libc/src/stdio/printf_core/converter.cpp"
5.	Running pass "loop(loop-idiom,indvars,simple-loop-unswitch<nontrivial;trivial>,loop-deletion,loop-unroll-full)" on function "_ZN22__llvm_libc_19_0_0_git13FloatToStringIeLi0EE12init_convertEv"
 #0 0x000055afec120138 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/lib/Support/Unix/Signals.inc:723:13
 #1 0x000055afec11dc6e llvm::sys::RunSignalHandlers() /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/lib/Support/Signals.cpp:106:18
 #2 0x000055afec088c16 HandleCrash /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:73:5
 #3 0x000055afec088c16 CrashRecoverySignalHandler(int) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/lib/Support/CrashRecoveryContext.cpp:390:51
 #4 0x00007849586e1520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #5 0x00007849587359fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #6 0x00007849586e1476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #7 0x00007849586c77f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #8 0x00007849586c771b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #9 0x00007849586d8e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#10 0x000055afedbc07dd (/build/buildbot/premerge-monolithic-linux/build/./bin/clang+++0x98557dd)
#11 0x000055afedbb1157 detectShiftUntilLessThanIdiom /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1607:14
#12 0x000055afedbb1157 recognizeShiftUntilLessThan /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:2016:8
#13 0x000055afedbb1157 (anonymous namespace)::LoopIdiomRecognize::runOnNoncountableLoop() /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1493:10
#14 0x000055afedbaf9ce llvm::LoopIdiomRecognizePass::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/lib/Transforms/Scalar/LoopIdiomRecognize.cpp:270:7
#15 0x000055afed7744dd llvm::detail::PassModel<llvm::Loop, llvm::LoopIdiomRecognizePass, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:5
#16 0x000055afebf7bb73 skipCurrentLoop /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h:237:41
#17 0x000055afebf7bb73 std::optional<llvm::PreservedAnalyses> llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::runSinglePass<llvm::Loop, std::unique_ptr<llvm::detail::PassConcept<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>, std::default_delete<llvm::detail::PassConcept<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>>>>(llvm::Loop&, std::unique_ptr<llvm::detail::PassConcept<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>, std::default_delete<llvm::detail::PassConcept<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>>>&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&, llvm::PassInstrumentation&) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h:378:9
#18 0x000055afebf7b7d2 llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::runWithoutLoopNestPasses(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/lib/Transforms/Scalar/LoopPassManager.cpp:161:9
#19 0x000055afebf7ae72 llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/lib/Transforms/Scalar/LoopPassManager.cpp:0:32
#20 0x000055afed65fe0d llvm::detail::PassModel<llvm::Loop, llvm::PassManager<llvm::Loop, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&>::run(llvm::Loop&, llvm::AnalysisManager<llvm::Loop, llvm::LoopStandardAnalysisResults&>&, llvm::LoopStandardAnalysisResults&, llvm::LPMUpdater&) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:5
#21 0x000055afebf7cbf1 skipCurrentLoop /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/Transforms/Scalar/LoopPassManager.h:237:41
#22 0x000055afebf7cbf1 llvm::FunctionToLoopPassAdaptor::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/lib/Transforms/Scalar/LoopPassManager.cpp:309:17
#23 0x000055afe9defa4d llvm::detail::PassModel<llvm::Function, llvm::FunctionToLoopPassAdaptor, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:5
#24 0x000055afebb6722a llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/IR/PassManagerImpl.h:85:8
#25 0x000055afe9de9b9d llvm::detail::PassModel<llvm::Function, llvm::PassManager<llvm::Function, llvm::AnalysisManager<llvm::Function>>, llvm::AnalysisManager<llvm::Function>>::run(llvm::Function&, llvm::AnalysisManager<llvm::Function>&) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:5
#26 0x000055afeb18ac72 llvm::CGSCCToFunctionPassAdaptor::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/lib/Analysis/CGSCCPassManager.cpp:0:38
#27 0x000055afe9e0c67d llvm::detail::PassModel<llvm::LazyCallGraph::SCC, llvm::CGSCCToFunctionPassAdaptor, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&>::run(llvm::LazyCallGraph::SCC&, llvm::AnalysisManager<llvm::LazyCallGraph::SCC, llvm::LazyCallGraph&>&, llvm::LazyCallGraph&, llvm::CGSCCUpdateResult&) /build/buildbot/premerge-monolithic-linux/llvm-project/llvm/include/llvm/IR/PassManagerInternal.h:90:5

joker-eph added a commit that referenced this pull request Jul 8, 2024
joker-eph added a commit that referenced this pull request Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants