[libc-commits] [libc] [libc] Enable new float math functions on the GPU (PR #151841)

via libc-commits libc-commits at lists.llvm.org
Sat Aug 2 18:35:56 PDT 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libc

Author: Leandro Lacerda (leandrolcampos)

<details>
<summary>Changes</summary>

This patch adds the `exp10m1f` and `tanpif` math functions to the GPU build. These should all pass except `exp10m1f` on NVPTX for some reason. We need to investigate that later.

It also adds the `cospif` and `sinpif` math functions to the `math.h` header.

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


3 Files Affected:

- (modified) libc/config/gpu/amdgpu/entrypoints.txt (+2) 
- (modified) libc/config/gpu/nvptx/entrypoints.txt (+2) 
- (modified) libc/include/math.yaml (+12) 


``````````diff
diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index e39819dd85b72..2f909e2e38026 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -314,6 +314,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.exp
     libc.src.math.exp10
     libc.src.math.exp10f
+    libc.src.math.exp10m1f
     libc.src.math.exp2
     libc.src.math.exp2f
     libc.src.math.exp2m1f
@@ -489,6 +490,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.tan
     libc.src.math.tanf
     libc.src.math.tanhf
+    libc.src.math.tanpif
     libc.src.math.tgamma
     libc.src.math.tgammaf
     libc.src.math.totalorder
diff --git a/libc/config/gpu/nvptx/entrypoints.txt b/libc/config/gpu/nvptx/entrypoints.txt
index 26e3b1547c98a..9d0200eb6dbe2 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -314,6 +314,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.exp
     libc.src.math.exp10
     libc.src.math.exp10f
+    # libc.src.math.exp10m1f
     libc.src.math.exp2
     libc.src.math.exp2f
     libc.src.math.exp2m1f
@@ -490,6 +491,7 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.tan
     libc.src.math.tanf
     libc.src.math.tanhf
+    libc.src.math.tanpif
     libc.src.math.tgamma
     libc.src.math.tgammaf
     libc.src.math.totalorder
diff --git a/libc/include/math.yaml b/libc/include/math.yaml
index 007be235f4380..e8ac7ee5033db 100644
--- a/libc/include/math.yaml
+++ b/libc/include/math.yaml
@@ -283,6 +283,12 @@ functions:
     return_type: float
     arguments:
       - type: float
+  - name: cospif
+    standards:
+      - stdc
+    return_type: float
+    arguments:
+      - type: float
   - name: cospif16
     standards:
       - stdc
@@ -2453,6 +2459,12 @@ functions:
     arguments:
       - type: _Float16
     guard: LIBC_TYPES_HAS_FLOAT16
+  - name: sinpif
+    standards:
+      - stdc
+    return_type: float
+    arguments:
+      - type: float
   - name: sinpif16
     standards:
       - stdc

``````````

</details>


https://github.com/llvm/llvm-project/pull/151841


More information about the libc-commits mailing list