Skip to content
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

[libc][arm] add more math.h entrypoints #77839

Merged
merged 5 commits into from
Jan 18, 2024

Conversation

nickdesaulniers
Copy link
Member

In particular, we have internal customers that would like to use nanf and
scalbnf.

The differences between various entrypoint files can be checked via:

$ comm -3 <(grep libc\.src path/to/entrypoints.txt | sort) \
   <(grep libc\.src path/to/other/entrypoints.txt | sort)

In particular, we have internal customers that would like to use nanf and
scalbnf.

The differences between various entrypoint files can be checked via:

    $ comm -3 <(grep libc\.src path/to/entrypoints.txt | sort) \
       <(grep libc\.src path/to/other/entrypoints.txt | sort)
@llvmbot
Copy link
Collaborator

llvmbot commented Jan 11, 2024

@llvm/pr-subscribers-libc

Author: Nick Desaulniers (nickdesaulniers)

Changes

In particular, we have internal customers that would like to use nanf and
scalbnf.

The differences between various entrypoint files can be checked via:

$ comm -3 &lt;(grep libc\.src path/to/entrypoints.txt | sort) \
   &lt;(grep libc\.src path/to/other/entrypoints.txt | sort)

Full diff: https://github.com/llvm/llvm-project/pull/77839.diff

1 Files Affected:

  • (modified) libc/config/linux/arm/entrypoints.txt (+109)
diff --git a/libc/config/linux/arm/entrypoints.txt b/libc/config/linux/arm/entrypoints.txt
index 274d5aa5a0057d..f6365a116fca62 100644
--- a/libc/config/linux/arm/entrypoints.txt
+++ b/libc/config/linux/arm/entrypoints.txt
@@ -115,18 +115,127 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.fenv.feupdateenv
 
     # math.h entrypoints
+    libc.src.math.acosf
+    libc.src.math.acoshf
+    libc.src.math.asinf
+    libc.src.math.asinhf
+    libc.src.math.atanf
+    libc.src.math.atanhf
+    libc.src.math.ceil
+    libc.src.math.ceilf
+    libc.src.math.ceill
+    libc.src.math.copysign
+    libc.src.math.copysignf
+    libc.src.math.copysignl
+    libc.src.math.cos
+    libc.src.math.cosf
+    libc.src.math.coshf
+    libc.src.math.erff
+    libc.src.math.exp
+    libc.src.math.exp10
+    libc.src.math.exp10f
+    libc.src.math.exp2
+    libc.src.math.exp2f
+    libc.src.math.expf
+    libc.src.math.expm1
+    libc.src.math.expm1f
     libc.src.math.fabs
     libc.src.math.fabsf
     libc.src.math.fabsl
     libc.src.math.fdim
     libc.src.math.fdimf
     libc.src.math.fdiml
+    libc.src.math.floor
+    libc.src.math.floorf
+    libc.src.math.floorl
+    libc.src.math.fma
+    libc.src.math.fmaf
     libc.src.math.fmax
     libc.src.math.fmaxf
     libc.src.math.fmaxl
     libc.src.math.fmin
     libc.src.math.fminf
     libc.src.math.fminl
+    libc.src.math.fmod
+    libc.src.math.fmodf
+    libc.src.math.frexp
+    libc.src.math.frexpf
+    libc.src.math.frexpl
+    libc.src.math.hypot
+    libc.src.math.hypotf
+    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.llrint
+    libc.src.math.llrintf
+    libc.src.math.llrintl
+    libc.src.math.llround
+    libc.src.math.llroundf
+    libc.src.math.llroundl
+    libc.src.math.log
+    libc.src.math.log10
+    libc.src.math.log10f
+    libc.src.math.log1p
+    libc.src.math.log1pf
+    libc.src.math.log2
+    libc.src.math.log2f
+    libc.src.math.logb
+    libc.src.math.logbf
+    libc.src.math.logbl
+    libc.src.math.logf
+    libc.src.math.lrint
+    libc.src.math.lrintf
+    libc.src.math.lrintl
+    libc.src.math.lround
+    libc.src.math.lroundf
+    libc.src.math.lroundl
+    libc.src.math.modf
+    libc.src.math.modff
+    libc.src.math.modfl
+    libc.src.math.nan
+    libc.src.math.nanf
+    libc.src.math.nanl
+    libc.src.math.nearbyint
+    libc.src.math.nearbyintf
+    libc.src.math.nearbyintl
+    libc.src.math.nextafter
+    libc.src.math.nextafterf
+    libc.src.math.nextafterl
+    libc.src.math.nexttoward
+    libc.src.math.nexttowardf
+    libc.src.math.nexttowardl
+    libc.src.math.powf
+    libc.src.math.remainder
+    libc.src.math.remainderf
+    libc.src.math.remainderl
+    libc.src.math.remquo
+    libc.src.math.remquof
+    libc.src.math.remquol
+    libc.src.math.rint
+    libc.src.math.rintf
+    libc.src.math.rintl
+    libc.src.math.round
+    libc.src.math.roundf
+    libc.src.math.roundl
+    libc.src.math.scalbn
+    libc.src.math.scalbnf
+    libc.src.math.scalbnl
+    libc.src.math.sin
+    libc.src.math.sincosf
+    libc.src.math.sinf
+    libc.src.math.sinhf
+    libc.src.math.sqrt
+    libc.src.math.sqrtf
+    libc.src.math.sqrtl
+    libc.src.math.tan
+    libc.src.math.tanf
+    libc.src.math.tanhf
+    libc.src.math.trunc
+    libc.src.math.truncf
+    libc.src.math.truncl
 )
 
 set(TARGET_LLVMLIBC_ENTRYPOINTS

@nickdesaulniers
Copy link
Member Author

oh, I should probably add these to the baremetal targets as well?

Copy link
Contributor

@lntue lntue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also update the availability in the math status page at https://github.com/llvm/llvm-project/blob/main/libc/docs/math/index.rst#L111 ?

Thanks,

@nickdesaulniers
Copy link
Member Author

Testing this on the buildbot itself, I observe the following error during cmake configuration. Any idea what I'm missing?

CMake Error at /llvm/ndesaulniers/llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake:672 (add_library):
  Cannot find source file:

    dummy_srcs
Call Stack (most recent call first):
  /llvm/ndesaulniers/llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake:802 (create_entrypoint_object)
  /llvm/ndesaulniers/llvm-project/libc/cmake/modules/LLVMLibCObjectRules.cmake:880 (expand_flags_for_entrypoint_object)
  /llvm/ndesaulniers/llvm-project/libc/src/math/CMakeLists.txt:48 (add_entrypoint_object)
  /llvm/ndesaulniers/llvm-project/libc/src/math/CMakeLists.txt:85 (add_math_entrypoint_object)


CMake Error: CMake can not determine linker language for target: libc.src.math.cos.__internal__
CMake Error: CMake can not determine linker language for target: libc.src.math.cos
CMake Error: CMake can not determine linker language for target: libc.src.math.sin.__internal__
CMake Error: CMake can not determine linker language for target: libc.src.math.sin
CMake Error: CMake can not determine linker language for target: libc.src.math.tan.__internal__
CMake Error: CMake can not determine linker language for target: libc.src.math.tan
...

@nickdesaulniers
Copy link
Member Author

nickdesaulniers commented Jan 17, 2024

ah, looks like we don't have implementations in libc/src/math/generic/ for cos, sin, and tan. I can comment these out for now, and work on implementations.

@nickdesaulniers
Copy link
Member Author

ah, looks like we don't have implementations in libc/src/math/generic/ for cos, sin, and tan. I can comment these out for now, and work on implementations.

With those commented out, the ninja target libc-math-unittests passes on the 32b arm build bot.

@nickdesaulniers
Copy link
Member Author

Can you also update the availability in the math status page at https://github.com/llvm/llvm-project/blob/main/libc/docs/math/index.rst#L111 ?

done in c1fd723 PTAL

oh, I should probably add these to the baremetal targets as well?

TODO

@nickdesaulniers nickdesaulniers marked this pull request as draft January 17, 2024 22:30
@nickdesaulniers nickdesaulniers marked this pull request as ready for review January 17, 2024 22:54
@nickdesaulniers nickdesaulniers merged commit 3044d75 into llvm:main Jan 18, 2024
5 checks passed
@petrhosek
Copy link
Member

Shall we include these entrypoints in the RISC-V build as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants