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

Leandro Lacerda via libc-commits libc-commits at lists.llvm.org
Sat Aug 2 19:38:11 PDT 2025


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

>From 6409d1849f1377c2d843195530897dfa923cb0f4 Mon Sep 17 00:00:00 2001
From: Leandro Augusto Lacerda Campos <leandrolcampos at yahoo.com.br>
Date: Sat, 2 Aug 2025 22:21:46 -0300
Subject: [PATCH] Enable float math functions on the GPU

---
 libc/config/gpu/amdgpu/entrypoints.txt |  1 +
 libc/config/gpu/nvptx/entrypoints.txt  |  1 +
 libc/include/math.yaml                 | 12 ++++++++++++
 3 files changed, 14 insertions(+)

diff --git a/libc/config/gpu/amdgpu/entrypoints.txt b/libc/config/gpu/amdgpu/entrypoints.txt
index e39819dd85b72..291a2d01db5b6 100644
--- a/libc/config/gpu/amdgpu/entrypoints.txt
+++ b/libc/config/gpu/amdgpu/entrypoints.txt
@@ -489,6 +489,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..55b27e69d5571 100644
--- a/libc/config/gpu/nvptx/entrypoints.txt
+++ b/libc/config/gpu/nvptx/entrypoints.txt
@@ -490,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/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



More information about the libc-commits mailing list