[libc-commits] [libc] 53f5bfd - [libc][libm][GPU] Populating 'libmgpu.a' for math on the GPU

via libc-commits libc-commits at lists.llvm.org
Tue Aug 1 13:38:17 PDT 2023


Author: Anton Rydahl
Date: 2023-08-01T13:34:43-07:00
New Revision: 53f5bfdb58f18951a185c7c7efe41c3827da112f

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

LOG: [libc][libm][GPU] Populating 'libmgpu.a' for math on the GPU

This commit populates `libmgpu.a` with wrappers for the following built-ins
- modf, modff
- nearbyint, nearbyintf
- remainder, remainderf
- remquo, remquof
- rint, rintf
- scalbn, scalbnf
- sqrt, sqrtf
- tan, tanf
- tanh, tanhf
- trunc, truncf
and wrappers the following vendor implementations
- nextafter, nextafterf
- sincos, sincosf
- sinh, sinhf
- sinf
- tan, tanf
- tanh, tanhf

Reviewed By: jhuber6

Differential Revision: https://reviews.llvm.org/D153395

Added: 
    libc/src/math/gpu/modf.cpp
    libc/src/math/gpu/modff.cpp
    libc/src/math/gpu/nearbyint.cpp
    libc/src/math/gpu/nearbyintf.cpp
    libc/src/math/gpu/remainder.cpp
    libc/src/math/gpu/remainderf.cpp
    libc/src/math/gpu/remquo.cpp
    libc/src/math/gpu/remquof.cpp
    libc/src/math/gpu/rint.cpp
    libc/src/math/gpu/rintf.cpp
    libc/src/math/gpu/scalbn.cpp
    libc/src/math/gpu/scalbnf.cpp
    libc/src/math/gpu/sinh.cpp
    libc/src/math/gpu/sinhf.cpp
    libc/src/math/gpu/sqrt.cpp
    libc/src/math/gpu/sqrtf.cpp
    libc/src/math/gpu/tan.cpp
    libc/src/math/gpu/tanf.cpp
    libc/src/math/gpu/tanh.cpp
    libc/src/math/gpu/tanhf.cpp
    libc/src/math/gpu/trunc.cpp
    libc/src/math/gpu/truncf.cpp
    libc/src/math/gpu/vendor/nextafter.cpp
    libc/src/math/gpu/vendor/nextafterf.cpp
    libc/src/math/gpu/vendor/sincos.cpp
    libc/src/math/gpu/vendor/sincosf.cpp
    libc/src/math/gpu/vendor/sinf.cpp
    libc/src/math/gpu/vendor/sinh.cpp
    libc/src/math/gpu/vendor/sinhf.cpp
    libc/src/math/gpu/vendor/tan.cpp
    libc/src/math/gpu/vendor/tanf.cpp
    libc/src/math/gpu/vendor/tanh.cpp
    libc/src/math/gpu/vendor/tanhf.cpp
    libc/src/math/sinh.h
    libc/src/math/tanh.h

Modified: 
    libc/config/gpu/entrypoints.txt
    libc/src/math/CMakeLists.txt
    libc/src/math/gpu/CMakeLists.txt
    libc/src/math/gpu/vendor/CMakeLists.txt
    libc/src/math/gpu/vendor/amdgpu/amdgpu.h
    libc/src/math/gpu/vendor/amdgpu/declarations.h
    libc/src/math/gpu/vendor/nvptx/declarations.h
    libc/src/math/gpu/vendor/nvptx/nvptx.h

Removed: 
    libc/src/math/gpu/roundl.cpp


################################################################################
diff  --git a/libc/config/gpu/entrypoints.txt b/libc/config/gpu/entrypoints.txt
index 41ed2337e140c8..f7a9f43dae9e71 100644
--- a/libc/config/gpu/entrypoints.txt
+++ b/libc/config/gpu/entrypoints.txt
@@ -150,9 +150,32 @@ set(TARGET_LIBM_ENTRYPOINTS
     libc.src.math.pow
     libc.src.math.powf
     libc.src.math.sin
+    libc.src.math.modf
+    libc.src.math.modff
+    libc.src.math.nearbyint
+    libc.src.math.nearbyintf
+    libc.src.math.nextafter
+    libc.src.math.nextafterf
+    libc.src.math.remainder
+    libc.src.math.remainderf
+    libc.src.math.remquo
+    libc.src.math.remquof
+    libc.src.math.rint
+    libc.src.math.rintf
     libc.src.math.round
     libc.src.math.roundf
-    libc.src.math.roundl
+    libc.src.math.scalbn
+    libc.src.math.scalbnf
+    libc.src.math.sinh
+    libc.src.math.sinhf
+    libc.src.math.sqrt
+    libc.src.math.sqrtf
+    libc.src.math.tan
+    libc.src.math.tanf
+    libc.src.math.tanh
+    libc.src.math.tanhf
+    libc.src.math.trunc
+    libc.src.math.truncf
 )
 
 set(TARGET_LLVMLIBC_ENTRYPOINTS

diff  --git a/libc/src/math/CMakeLists.txt b/libc/src/math/CMakeLists.txt
index 1de511e9155fd6..5054fd76bcb838 100644
--- a/libc/src/math/CMakeLists.txt
+++ b/libc/src/math/CMakeLists.txt
@@ -198,6 +198,8 @@ add_math_entrypoint_object(sincosf)
 
 add_math_entrypoint_object(sin)
 add_math_entrypoint_object(sinf)
+
+add_math_entrypoint_object(sinh)
 add_math_entrypoint_object(sinhf)
 
 add_math_entrypoint_object(sqrt)
@@ -206,6 +208,8 @@ add_math_entrypoint_object(sqrtl)
 
 add_math_entrypoint_object(tan)
 add_math_entrypoint_object(tanf)
+
+add_math_entrypoint_object(tanh)
 add_math_entrypoint_object(tanhf)
 
 add_math_entrypoint_object(trunc)

diff  --git a/libc/src/math/gpu/CMakeLists.txt b/libc/src/math/gpu/CMakeLists.txt
index 58b0f01f22a6d6..37e9329eb5ac16 100644
--- a/libc/src/math/gpu/CMakeLists.txt
+++ b/libc/src/math/gpu/CMakeLists.txt
@@ -203,6 +203,106 @@ add_math_entrypoint_gpu_object(
     -O2
 )
 
+add_math_entrypoint_gpu_object(
+  modf
+  SRCS
+    modf.cpp
+  HDRS
+    ../modf.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  modff
+  SRCS
+    modff.cpp
+  HDRS
+    ../modff.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  nearbyint
+  SRCS
+    nearbyint.cpp
+  HDRS
+    ../nearbyint.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  nearbyintf
+  SRCS
+    nearbyintf.cpp
+  HDRS
+    ../nearbyintf.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  remainder
+  SRCS
+    remainder.cpp
+  HDRS
+    ../remainder.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  remainderf
+  SRCS
+    remainderf.cpp
+  HDRS
+    ../remainderf.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  remquo
+  SRCS
+    remquo.cpp
+  HDRS
+    ../remquo.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  remquof
+  SRCS
+    remquof.cpp
+  HDRS
+    ../remquof.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  rint
+  SRCS
+    rint.cpp
+  HDRS
+    ../rint.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  rintf
+  SRCS
+    rintf.cpp
+  HDRS
+    ../rintf.h
+  COMPILE_OPTIONS
+    -O2
+)
+
 add_math_entrypoint_gpu_object(
   round
   SRCS
@@ -212,3 +312,123 @@ add_math_entrypoint_gpu_object(
   COMPILE_OPTIONS
     -O2
 )
+
+add_math_entrypoint_gpu_object(
+  scalbn
+  SRCS
+    scalbn.cpp
+  HDRS
+    ../scalbn.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  scalbnf
+  SRCS
+    scalbnf.cpp
+  HDRS
+    ../scalbnf.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  sinh
+  SRCS
+    sinh.cpp
+  HDRS
+    ../sinh.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  sinhf
+  SRCS
+    sinhf.cpp
+  HDRS
+    ../sinhf.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  sqrt
+  SRCS
+    sqrt.cpp
+  HDRS
+    ../sqrt.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  sqrtf
+  SRCS
+    sqrtf.cpp
+  HDRS
+    ../sqrtf.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  tan
+  SRCS
+    tan.cpp
+  HDRS
+    ../tan.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  tanf
+  SRCS
+    tanf.cpp
+  HDRS
+    ../tanf.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  tanh
+  SRCS
+    tanh.cpp
+  HDRS
+    ../tanh.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  tanhf
+  SRCS
+    tanhf.cpp
+  HDRS
+    ../tanhf.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  trunc
+  SRCS
+    trunc.cpp
+  HDRS
+    ../trunc.h
+  COMPILE_OPTIONS
+    -O2
+)
+
+add_math_entrypoint_gpu_object(
+  truncf
+  SRCS
+    truncf.cpp
+  HDRS
+    ../truncf.h
+  COMPILE_OPTIONS
+    -O2
+)
\ No newline at end of file

diff  --git a/libc/src/math/gpu/modf.cpp b/libc/src/math/gpu/modf.cpp
new file mode 100644
index 00000000000000..b6b06da2dac0bb
--- /dev/null
+++ b/libc/src/math/gpu/modf.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU modf function ---------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/modf.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, modf, (double x, double *iptr)) {
+  return __builtin_modf(x, iptr);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/modff.cpp b/libc/src/math/gpu/modff.cpp
new file mode 100644
index 00000000000000..b89c9c3b1c7d44
--- /dev/null
+++ b/libc/src/math/gpu/modff.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU modff function --------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/modff.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, modff, (float x, float *iptr)) {
+  return __builtin_modff(x, iptr);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/nearbyint.cpp b/libc/src/math/gpu/nearbyint.cpp
new file mode 100644
index 00000000000000..35a4a8d5d7e988
--- /dev/null
+++ b/libc/src/math/gpu/nearbyint.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU nearbyint function ----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/nearbyint.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, nearbyint, (double x)) {
+  return __builtin_nearbyint(x);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/nearbyintf.cpp b/libc/src/math/gpu/nearbyintf.cpp
new file mode 100644
index 00000000000000..e732b7c198f224
--- /dev/null
+++ b/libc/src/math/gpu/nearbyintf.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU nearbyintf function ---------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/nearbyintf.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, nearbyintf, (float x)) {
+  return __builtin_nearbyintf(x);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/remainder.cpp b/libc/src/math/gpu/remainder.cpp
new file mode 100644
index 00000000000000..af06432d3b911b
--- /dev/null
+++ b/libc/src/math/gpu/remainder.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU remainder function ----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/remainder.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, remainder, (double x, double y)) {
+  return __builtin_remainder(x, y);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/remainderf.cpp b/libc/src/math/gpu/remainderf.cpp
new file mode 100644
index 00000000000000..b0f9c8f8841637
--- /dev/null
+++ b/libc/src/math/gpu/remainderf.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU remainderf function ---------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/remainderf.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, remainderf, (float x, float y)) {
+  return __builtin_remainderf(x, y);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/remquo.cpp b/libc/src/math/gpu/remquo.cpp
new file mode 100644
index 00000000000000..e8f55231950ad3
--- /dev/null
+++ b/libc/src/math/gpu/remquo.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU remquo function -------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/remquo.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, remquo, (double x, double y, int *quo)) {
+  return __builtin_remquo(x, y, quo);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/remquof.cpp b/libc/src/math/gpu/remquof.cpp
new file mode 100644
index 00000000000000..310734756abf83
--- /dev/null
+++ b/libc/src/math/gpu/remquof.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU remquof function ------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/remquof.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, remquof, (float x, float y, int *quo)) {
+  return __builtin_remquof(x, y, quo);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/rint.cpp b/libc/src/math/gpu/rint.cpp
new file mode 100644
index 00000000000000..e21b469c4ee2b6
--- /dev/null
+++ b/libc/src/math/gpu/rint.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU rint function ---------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/rint.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, rint, (double x)) { return __builtin_rint(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/rintf.cpp b/libc/src/math/gpu/rintf.cpp
new file mode 100644
index 00000000000000..5e828372a50361
--- /dev/null
+++ b/libc/src/math/gpu/rintf.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU rintf function --------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/rintf.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, rintf, (float x)) { return __builtin_rintf(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/scalbn.cpp b/libc/src/math/gpu/scalbn.cpp
new file mode 100644
index 00000000000000..99f67a9bfe513b
--- /dev/null
+++ b/libc/src/math/gpu/scalbn.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU scalbn function -------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/scalbn.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, scalbn, (double x, int y)) {
+  return __builtin_scalbn(x, y);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/scalbnf.cpp b/libc/src/math/gpu/scalbnf.cpp
new file mode 100644
index 00000000000000..6e6915b51bbda9
--- /dev/null
+++ b/libc/src/math/gpu/scalbnf.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU scalbnf function ------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/scalbnf.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, scalbnf, (float x, int y)) {
+  return __builtin_scalbnf(x, y);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/sinh.cpp b/libc/src/math/gpu/sinh.cpp
new file mode 100644
index 00000000000000..2946e4781ae6c7
--- /dev/null
+++ b/libc/src/math/gpu/sinh.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU sinh function ---------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/sinh.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, sinh, (double x)) { return __builtin_sinh(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/sinhf.cpp b/libc/src/math/gpu/sinhf.cpp
new file mode 100644
index 00000000000000..729f3bb49d3fcc
--- /dev/null
+++ b/libc/src/math/gpu/sinhf.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU sinhf function --------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/sinhf.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, sinhf, (float x)) { return __builtin_sinhf(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/sqrt.cpp b/libc/src/math/gpu/sqrt.cpp
new file mode 100644
index 00000000000000..fe814c764b878c
--- /dev/null
+++ b/libc/src/math/gpu/sqrt.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU sqrt function ---------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/sqrt.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, sqrt, (double x)) { return __builtin_sqrt(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/sqrtf.cpp b/libc/src/math/gpu/sqrtf.cpp
new file mode 100644
index 00000000000000..a712e455443471
--- /dev/null
+++ b/libc/src/math/gpu/sqrtf.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU sqrtf function --------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/sqrtf.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, sqrtf, (float x)) { return __builtin_sqrtf(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/tan.cpp b/libc/src/math/gpu/tan.cpp
new file mode 100644
index 00000000000000..81f04a2b857b62
--- /dev/null
+++ b/libc/src/math/gpu/tan.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU tan function ----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/tan.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, tan, (double x)) { return __builtin_tan(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/tanf.cpp b/libc/src/math/gpu/tanf.cpp
new file mode 100644
index 00000000000000..32af444959a06f
--- /dev/null
+++ b/libc/src/math/gpu/tanf.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU tanf function ---------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/tanf.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, tanf, (float x)) { return __builtin_tanf(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/tanh.cpp b/libc/src/math/gpu/tanh.cpp
new file mode 100644
index 00000000000000..c5872580988621
--- /dev/null
+++ b/libc/src/math/gpu/tanh.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU tanh function ---------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/tanh.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, tanh, (double x)) { return __builtin_tanh(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/tanhf.cpp b/libc/src/math/gpu/tanhf.cpp
new file mode 100644
index 00000000000000..dd97af97213328
--- /dev/null
+++ b/libc/src/math/gpu/tanhf.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU tanhf function --------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/tanhf.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, tanhf, (float x)) { return __builtin_tanhf(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/trunc.cpp b/libc/src/math/gpu/trunc.cpp
new file mode 100644
index 00000000000000..b4708245d49597
--- /dev/null
+++ b/libc/src/math/gpu/trunc.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU trunc function --------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/trunc.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, trunc, (double x)) { return __builtin_trunc(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/truncf.cpp b/libc/src/math/gpu/truncf.cpp
new file mode 100644
index 00000000000000..352733d50a7099
--- /dev/null
+++ b/libc/src/math/gpu/truncf.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU truncf function -------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/truncf.h"
+#include "src/__support/common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, truncf, (float x)) { return __builtin_truncf(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/CMakeLists.txt b/libc/src/math/gpu/vendor/CMakeLists.txt
index f04e533390977c..9a9d538d3dde04 100644
--- a/libc/src/math/gpu/vendor/CMakeLists.txt
+++ b/libc/src/math/gpu/vendor/CMakeLists.txt
@@ -315,6 +315,28 @@ add_entrypoint_object(
     -O2
 )
 
+add_entrypoint_object(
+  nextafter
+  SRCS
+    nextafter.cpp
+  HDRS
+    ../../nextafter.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  nextafterf
+  SRCS
+    nextafterf.cpp
+  HDRS
+    ../../nextafterf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
 add_entrypoint_object(
   pow
   SRCS
@@ -347,3 +369,102 @@ add_entrypoint_object(
     ${bitcode_link_flags}
     -O2
 )
+
+add_entrypoint_object(
+  sinf
+  SRCS
+    sinf.cpp
+  HDRS
+    ../../sinf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  sincos
+  SRCS
+    sincos.cpp
+  HDRS
+    ../../sincos.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  sincosf
+  SRCS
+    sincosf.cpp
+  HDRS
+    ../../sincosf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  sinh
+  SRCS
+    sinh.cpp
+  HDRS
+    ../../sinh.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  sinhf
+  SRCS
+    sinhf.cpp
+  HDRS
+    ../../sinhf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  tan
+  SRCS
+    tan.cpp
+  HDRS
+    ../../tan.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  tanf
+  SRCS
+    tanf.cpp
+  HDRS
+    ../../tanf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  tanh
+  SRCS
+    tanh.cpp
+  HDRS
+    ../../tanh.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
+
+add_entrypoint_object(
+  tanhf
+  SRCS
+    tanhf.cpp
+  HDRS
+    ../../tanhf.h
+  COMPILE_OPTIONS
+    ${bitcode_link_flags}
+    -O2
+)
\ No newline at end of file

diff  --git a/libc/src/math/gpu/vendor/amdgpu/amdgpu.h b/libc/src/math/gpu/vendor/amdgpu/amdgpu.h
index 659f47c6face2c..6635ea51cd6168 100644
--- a/libc/src/math/gpu/vendor/amdgpu/amdgpu.h
+++ b/libc/src/math/gpu/vendor/amdgpu/amdgpu.h
@@ -42,9 +42,28 @@ LIBC_INLINE long long llrint(double x) { return __builtin_rint(x); }
 LIBC_INLINE long long llrintf(float x) { return __builtin_rintf(x); }
 LIBC_INLINE long long llround(double x) { return __builtin_round(x); }
 LIBC_INLINE long long llroundf(float x) { return __builtin_roundf(x); }
+LIBC_INLINE double nextafter(double x, double y) {
+  return __ocml_nextafter_f64(x, y);
+}
+LIBC_INLINE float nextafterf(float x, float y) {
+  return __ocml_nextafter_f32(x, y);
+}
 LIBC_INLINE double pow(double x, double y) { return __ocml_pow_f64(x, y); }
 LIBC_INLINE float powf(float x, float y) { return __ocml_pow_f32(x, y); }
 LIBC_INLINE double sin(double x) { return __ocml_sin_f64(x); }
+LIBC_INLINE float sinf(float x) { return __ocml_sin_f32(x); }
+LIBC_INLINE void sincos(double x, double *sinptr, double *cosptr) {
+  *sinptr = __ocml_sincos_f64(x, cosptr);
+}
+LIBC_INLINE void sincosf(float x, float *sinptr, float *cosptr) {
+  *sinptr = __ocml_sincos_f32(x, cosptr);
+}
+LIBC_INLINE double sinh(double x) { return __ocml_sinh_f64(x); }
+LIBC_INLINE float sinhf(float x) { return __ocml_sinh_f32(x); }
+LIBC_INLINE double tan(double x) { return __ocml_tan_f64(x); }
+LIBC_INLINE float tanf(float x) { return __ocml_tan_f32(x); }
+LIBC_INLINE double tanh(double x) { return __ocml_tanh_f64(x); }
+LIBC_INLINE float tanhf(float x) { return __ocml_tanh_f32(x); }
 
 } // namespace internal
 } // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/amdgpu/declarations.h b/libc/src/math/gpu/vendor/amdgpu/declarations.h
index 76c0e0f032051f..cb910b03b8b261 100644
--- a/libc/src/math/gpu/vendor/amdgpu/declarations.h
+++ b/libc/src/math/gpu/vendor/amdgpu/declarations.h
@@ -34,13 +34,24 @@ int __ocml_ilogb_f64(double);
 int __ocml_ilogb_f32(float);
 float __ocml_ldexp_f32(float, int);
 double __ocml_ldexp_f64(double, int);
+float __ocml_nextafter_f32(float, float);
+double __ocml_nextafter_f64(double, double);
 float __ocml_pow_f32(float, float);
 double __ocml_pow_f64(double, double);
 double __ocml_rint_f64(double);
 float __ocml_rint_f32(float);
 double __ocml_round_f64(double);
 float __ocml_round_f32(float);
+float __ocml_sin_f32(float);
 double __ocml_sin_f64(double);
+float __ocml_sincos_f32(float, float *);
+double __ocml_sincos_f64(double, double *);
+float __ocml_sinh_f32(float);
+double __ocml_sinh_f64(double);
+float __ocml_tan_f32(float);
+double __ocml_tan_f64(double);
+float __ocml_tanh_f32(float);
+double __ocml_tanh_f64(double);
 }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/roundl.cpp b/libc/src/math/gpu/vendor/nextafter.cpp
similarity index 55%
rename from libc/src/math/gpu/roundl.cpp
rename to libc/src/math/gpu/vendor/nextafter.cpp
index 6a7699ae8e3838..9e8e57e8a26f37 100644
--- a/libc/src/math/gpu/roundl.cpp
+++ b/libc/src/math/gpu/vendor/nextafter.cpp
@@ -1,4 +1,4 @@
-//===-- Implementation of the GPU roundl function -------------------------===//
+//===-- Implementation of the nextafter function for GPU ------------------===//
 //
 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
 // See https://llvm.org/LICENSE.txt for license information.
@@ -6,18 +6,15 @@
 //
 //===----------------------------------------------------------------------===//
 
-#include "src/math/roundl.h"
-#include "src/__support/FPUtil/PlatformDefs.h"
+#include "src/math/nextafter.h"
 #include "src/__support/common.h"
 
-namespace __llvm_libc {
+#include "common.h"
 
-#ifndef LONG_DOUBLE_IS_DOUBLE
-#error "GPU targets do not support long doubles"
-#endif
+namespace __llvm_libc {
 
-LLVM_LIBC_FUNCTION(long double, roundl, (long double x)) {
-  return __builtin_round(x);
+LLVM_LIBC_FUNCTION(double, nextafter, (double x, double y)) {
+  return internal::nextafter(x, y);
 }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/nextafterf.cpp b/libc/src/math/gpu/vendor/nextafterf.cpp
new file mode 100644
index 00000000000000..9780471e071c6b
--- /dev/null
+++ b/libc/src/math/gpu/vendor/nextafterf.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of the nextafterf function for GPU -----------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/nextafterf.h"
+#include "src/__support/common.h"
+
+#include "common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, nextafterf, (float x, float y)) {
+  return internal::nextafterf(x, y);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/nvptx/declarations.h b/libc/src/math/gpu/vendor/nvptx/declarations.h
index 13b87699989673..24711d53f75099 100644
--- a/libc/src/math/gpu/vendor/nvptx/declarations.h
+++ b/libc/src/math/gpu/vendor/nvptx/declarations.h
@@ -38,9 +38,20 @@ long long __nv_llrint(double);
 long long __nv_llrintf(float);
 long long __nv_llround(double);
 long long __nv_llroundf(float);
+double __nv_nextafter(double, double);
+float __nv_nextafterf(float, float);
 double __nv_pow(double, double);
 float __nv_powf(float, float);
 double __nv_sin(double);
+float __nv_sinf(float);
+void __nv_sincos(double, double *, double *);
+void __nv_sincosf(float, float *, float *);
+double __nv_sinh(double);
+float __nv_sinhf(float);
+double __nv_tan(double);
+float __nv_tanf(float);
+double __nv_tanh(double);
+float __nv_tanhf(float);
 }
 
 } // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/nvptx/nvptx.h b/libc/src/math/gpu/vendor/nvptx/nvptx.h
index 4da0dd0d204af4..3310d2406c9d54 100644
--- a/libc/src/math/gpu/vendor/nvptx/nvptx.h
+++ b/libc/src/math/gpu/vendor/nvptx/nvptx.h
@@ -41,9 +41,26 @@ LIBC_INLINE long long llrint(double x) { return __nv_llrint(x); }
 LIBC_INLINE long long llrintf(float x) { return __nv_llrintf(x); }
 LIBC_INLINE long long llround(double x) { return __nv_llround(x); }
 LIBC_INLINE long long llroundf(float x) { return __nv_llroundf(x); }
+LIBC_INLINE double nextafter(double x, double y) {
+  return __nv_nextafter(x, y);
+}
+LIBC_INLINE float nextafterf(float x, float y) { return __nv_nextafterf(x, y); }
 LIBC_INLINE double pow(double x, double y) { return __nv_pow(x, y); }
 LIBC_INLINE float powf(float x, float y) { return __nv_powf(x, y); }
 LIBC_INLINE double sin(double x) { return __nv_sin(x); }
+LIBC_INLINE float sinf(float x) { return __nv_sinf(x); }
+LIBC_INLINE void sincos(double x, double *sinptr, double *cosptr) {
+  return __nv_sincos(x, sinptr, cosptr);
+}
+LIBC_INLINE void sincosf(float x, float *sinptr, float *cosptr) {
+  return __nv_sincosf(x, sinptr, cosptr);
+}
+LIBC_INLINE double sinh(double x) { return __nv_sinh(x); }
+LIBC_INLINE float sinhf(float x) { return __nv_sinhf(x); }
+LIBC_INLINE double tan(double x) { return __nv_tan(x); }
+LIBC_INLINE float tanf(float x) { return __nv_tanf(x); }
+LIBC_INLINE double tanh(double x) { return __nv_tanh(x); }
+LIBC_INLINE float tanhf(float x) { return __nv_tanhf(x); }
 
 } // namespace internal
 } // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/sincos.cpp b/libc/src/math/gpu/vendor/sincos.cpp
new file mode 100644
index 00000000000000..589d65fdc61d26
--- /dev/null
+++ b/libc/src/math/gpu/vendor/sincos.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of the sincos function for GPU ---------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/sincos.h"
+#include "src/__support/common.h"
+
+#include "common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(void, sincos, (double x, double *sinptr, double *cosptr)) {
+  return internal::sincos(x, sinptr, cosptr);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/sincosf.cpp b/libc/src/math/gpu/vendor/sincosf.cpp
new file mode 100644
index 00000000000000..bf3593bef7e501
--- /dev/null
+++ b/libc/src/math/gpu/vendor/sincosf.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of the sincosf function for GPU --------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/sincosf.h"
+#include "src/__support/common.h"
+
+#include "common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(void, sincosf, (float x, float *sinptr, float *cosptr)) {
+  return internal::sincosf(x, sinptr, cosptr);
+}
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/sinf.cpp b/libc/src/math/gpu/vendor/sinf.cpp
new file mode 100644
index 00000000000000..4be642cbd0bc4e
--- /dev/null
+++ b/libc/src/math/gpu/vendor/sinf.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the sinf function for GPU -----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/sinf.h"
+#include "src/__support/common.h"
+
+#include "common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, sinf, (float x)) { return internal::sinf(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/sinh.cpp b/libc/src/math/gpu/vendor/sinh.cpp
new file mode 100644
index 00000000000000..c65cb5536f125a
--- /dev/null
+++ b/libc/src/math/gpu/vendor/sinh.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the sinh function for GPU -----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/sinh.h"
+#include "src/__support/common.h"
+
+#include "common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, sinh, (double x)) { return internal::sinh(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/sinhf.cpp b/libc/src/math/gpu/vendor/sinhf.cpp
new file mode 100644
index 00000000000000..4d1fcbb530a903
--- /dev/null
+++ b/libc/src/math/gpu/vendor/sinhf.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the sinhf function for GPU ----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/sinhf.h"
+#include "src/__support/common.h"
+
+#include "common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, sinhf, (float x)) { return internal::sinhf(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/tan.cpp b/libc/src/math/gpu/vendor/tan.cpp
new file mode 100644
index 00000000000000..16587dc26c0c0c
--- /dev/null
+++ b/libc/src/math/gpu/vendor/tan.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the tan function for GPU ------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/tan.h"
+#include "src/__support/common.h"
+
+#include "common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, tan, (double x)) { return internal::tan(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/tanf.cpp b/libc/src/math/gpu/vendor/tanf.cpp
new file mode 100644
index 00000000000000..99b33639029303
--- /dev/null
+++ b/libc/src/math/gpu/vendor/tanf.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the tanf function for GPU -----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/tanf.h"
+#include "src/__support/common.h"
+
+#include "common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, tanf, (float x)) { return internal::tanf(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/tanh.cpp b/libc/src/math/gpu/vendor/tanh.cpp
new file mode 100644
index 00000000000000..de38d158492393
--- /dev/null
+++ b/libc/src/math/gpu/vendor/tanh.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the tanh function for GPU -----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/tanh.h"
+#include "src/__support/common.h"
+
+#include "common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(double, tanh, (double x)) { return internal::tanh(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/gpu/vendor/tanhf.cpp b/libc/src/math/gpu/vendor/tanhf.cpp
new file mode 100644
index 00000000000000..a673a49de52864
--- /dev/null
+++ b/libc/src/math/gpu/vendor/tanhf.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the tanhf function for GPU ----------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "src/math/tanhf.h"
+#include "src/__support/common.h"
+
+#include "common.h"
+
+namespace __llvm_libc {
+
+LLVM_LIBC_FUNCTION(float, tanhf, (float x)) { return internal::tanhf(x); }
+
+} // namespace __llvm_libc

diff  --git a/libc/src/math/sinh.h b/libc/src/math/sinh.h
new file mode 100644
index 00000000000000..2784ca261e4aa1
--- /dev/null
+++ b/libc/src/math/sinh.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for sinh --------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_MATH_SINH_H
+#define LLVM_LIBC_SRC_MATH_SINH_H
+
+namespace __llvm_libc {
+
+double sinh(double x);
+
+} // namespace __llvm_libc
+
+#endif // LLVM_LIBC_SRC_MATH_SINH_H

diff  --git a/libc/src/math/tanh.h b/libc/src/math/tanh.h
new file mode 100644
index 00000000000000..5400c3d2328ebb
--- /dev/null
+++ b/libc/src/math/tanh.h
@@ -0,0 +1,18 @@
+//===-- Implementation header for tanh --------------------------*- C++ -*-===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_LIBC_SRC_MATH_TANH_H
+#define LLVM_LIBC_SRC_MATH_TANH_H
+
+namespace __llvm_libc {
+
+double tanh(double x);
+
+} // namespace __llvm_libc
+
+#endif // LLVM_LIBC_SRC_MATH_TANH_H


        


More information about the libc-commits mailing list