[libc-commits] [libc] Enable LLVM libc math functions for SPIRV64 target (PR #199495)
via libc-commits
libc-commits at lists.llvm.org
Mon May 25 00:40:19 PDT 2026
https://github.com/jinge90 created https://github.com/llvm/llvm-project/pull/199495
None
>From a055b4096b2e7ea6ed61f5617fb18f5f73c4182c Mon Sep 17 00:00:00 2001
From: jinge90 <ge.jin at intel.com>
Date: Mon, 25 May 2026 15:38:34 +0800
Subject: [PATCH] Enable LLVM libc math functions for SPIRV64 target
Signed-off-by: jinge90 <ge.jin at intel.com>
---
libc/config/gpu/spirv/entrypoints.txt | 80 +++++
libc/config/gpu/spirv/headers.txt | 1 +
libc/src/math/spirv/CMakeLists.txt | 479 ++++++++++++++++++++++++++
libc/src/math/spirv/acos.cpp | 16 +
libc/src/math/spirv/acosf.cpp | 16 +
libc/src/math/spirv/asin.cpp | 16 +
libc/src/math/spirv/asinf.cpp | 16 +
libc/src/math/spirv/atan.cpp | 16 +
libc/src/math/spirv/atan2.cpp | 18 +
libc/src/math/spirv/atan2f.cpp | 18 +
libc/src/math/spirv/atanf.cpp | 16 +
libc/src/math/spirv/ceil.cpp | 17 +
libc/src/math/spirv/ceilf.cpp | 17 +
libc/src/math/spirv/copysign.cpp | 19 +
libc/src/math/spirv/copysignf.cpp | 19 +
libc/src/math/spirv/cos.cpp | 17 +
libc/src/math/spirv/cosf.cpp | 17 +
libc/src/math/spirv/coshf.cpp | 16 +
libc/src/math/spirv/exp.cpp | 17 +
libc/src/math/spirv/exp10.cpp | 17 +
libc/src/math/spirv/exp10f.cpp | 17 +
libc/src/math/spirv/exp2.cpp | 17 +
libc/src/math/spirv/exp2f.cpp | 17 +
libc/src/math/spirv/expf.cpp | 17 +
libc/src/math/spirv/fabs.cpp | 17 +
libc/src/math/spirv/fabsf.cpp | 17 +
libc/src/math/spirv/floor.cpp | 17 +
libc/src/math/spirv/floorf.cpp | 17 +
libc/src/math/spirv/fma.cpp | 19 +
libc/src/math/spirv/fmaf.cpp | 19 +
libc/src/math/spirv/fmax.cpp | 20 ++
libc/src/math/spirv/fmaxf.cpp | 20 ++
libc/src/math/spirv/fmin.cpp | 20 ++
libc/src/math/spirv/fminf.cpp | 20 ++
libc/src/math/spirv/frexp.cpp | 20 ++
libc/src/math/spirv/frexpf.cpp | 20 ++
libc/src/math/spirv/ldexp.cpp | 20 ++
libc/src/math/spirv/ldexpf.cpp | 20 ++
libc/src/math/spirv/log.cpp | 17 +
libc/src/math/spirv/log10.cpp | 17 +
libc/src/math/spirv/log10f.cpp | 17 +
libc/src/math/spirv/log2.cpp | 17 +
libc/src/math/spirv/log2f.cpp | 17 +
libc/src/math/spirv/logf.cpp | 17 +
libc/src/math/spirv/pow.cpp | 18 +
libc/src/math/spirv/powf.cpp | 18 +
libc/src/math/spirv/rint.cpp | 17 +
libc/src/math/spirv/rintf.cpp | 17 +
libc/src/math/spirv/round.cpp | 17 +
libc/src/math/spirv/roundf.cpp | 17 +
libc/src/math/spirv/scalbn.cpp | 20 ++
libc/src/math/spirv/scalbnf.cpp | 20 ++
libc/src/math/spirv/sin.cpp | 16 +
libc/src/math/spirv/sinf.cpp | 16 +
libc/src/math/spirv/sinhf.cpp | 17 +
libc/src/math/spirv/sqrt.cpp | 17 +
libc/src/math/spirv/sqrtf.cpp | 17 +
libc/src/math/spirv/tan.cpp | 17 +
libc/src/math/spirv/tanf.cpp | 17 +
libc/src/math/spirv/tanh.cpp | 17 +
libc/src/math/spirv/tanhf.cpp | 17 +
libc/src/math/spirv/trunc.cpp | 17 +
libc/src/math/spirv/truncf.cpp | 17 +
63 files changed, 1613 insertions(+)
create mode 100644 libc/src/math/spirv/CMakeLists.txt
create mode 100644 libc/src/math/spirv/acos.cpp
create mode 100644 libc/src/math/spirv/acosf.cpp
create mode 100644 libc/src/math/spirv/asin.cpp
create mode 100644 libc/src/math/spirv/asinf.cpp
create mode 100644 libc/src/math/spirv/atan.cpp
create mode 100644 libc/src/math/spirv/atan2.cpp
create mode 100644 libc/src/math/spirv/atan2f.cpp
create mode 100644 libc/src/math/spirv/atanf.cpp
create mode 100644 libc/src/math/spirv/ceil.cpp
create mode 100644 libc/src/math/spirv/ceilf.cpp
create mode 100644 libc/src/math/spirv/copysign.cpp
create mode 100644 libc/src/math/spirv/copysignf.cpp
create mode 100644 libc/src/math/spirv/cos.cpp
create mode 100644 libc/src/math/spirv/cosf.cpp
create mode 100644 libc/src/math/spirv/coshf.cpp
create mode 100644 libc/src/math/spirv/exp.cpp
create mode 100644 libc/src/math/spirv/exp10.cpp
create mode 100644 libc/src/math/spirv/exp10f.cpp
create mode 100644 libc/src/math/spirv/exp2.cpp
create mode 100644 libc/src/math/spirv/exp2f.cpp
create mode 100644 libc/src/math/spirv/expf.cpp
create mode 100644 libc/src/math/spirv/fabs.cpp
create mode 100644 libc/src/math/spirv/fabsf.cpp
create mode 100644 libc/src/math/spirv/floor.cpp
create mode 100644 libc/src/math/spirv/floorf.cpp
create mode 100644 libc/src/math/spirv/fma.cpp
create mode 100644 libc/src/math/spirv/fmaf.cpp
create mode 100644 libc/src/math/spirv/fmax.cpp
create mode 100644 libc/src/math/spirv/fmaxf.cpp
create mode 100644 libc/src/math/spirv/fmin.cpp
create mode 100644 libc/src/math/spirv/fminf.cpp
create mode 100644 libc/src/math/spirv/frexp.cpp
create mode 100644 libc/src/math/spirv/frexpf.cpp
create mode 100644 libc/src/math/spirv/ldexp.cpp
create mode 100644 libc/src/math/spirv/ldexpf.cpp
create mode 100644 libc/src/math/spirv/log.cpp
create mode 100644 libc/src/math/spirv/log10.cpp
create mode 100644 libc/src/math/spirv/log10f.cpp
create mode 100644 libc/src/math/spirv/log2.cpp
create mode 100644 libc/src/math/spirv/log2f.cpp
create mode 100644 libc/src/math/spirv/logf.cpp
create mode 100644 libc/src/math/spirv/pow.cpp
create mode 100644 libc/src/math/spirv/powf.cpp
create mode 100644 libc/src/math/spirv/rint.cpp
create mode 100644 libc/src/math/spirv/rintf.cpp
create mode 100644 libc/src/math/spirv/round.cpp
create mode 100644 libc/src/math/spirv/roundf.cpp
create mode 100644 libc/src/math/spirv/scalbn.cpp
create mode 100644 libc/src/math/spirv/scalbnf.cpp
create mode 100644 libc/src/math/spirv/sin.cpp
create mode 100644 libc/src/math/spirv/sinf.cpp
create mode 100644 libc/src/math/spirv/sinhf.cpp
create mode 100644 libc/src/math/spirv/sqrt.cpp
create mode 100644 libc/src/math/spirv/sqrtf.cpp
create mode 100644 libc/src/math/spirv/tan.cpp
create mode 100644 libc/src/math/spirv/tanf.cpp
create mode 100644 libc/src/math/spirv/tanh.cpp
create mode 100644 libc/src/math/spirv/tanhf.cpp
create mode 100644 libc/src/math/spirv/trunc.cpp
create mode 100644 libc/src/math/spirv/truncf.cpp
diff --git a/libc/config/gpu/spirv/entrypoints.txt b/libc/config/gpu/spirv/entrypoints.txt
index 36c98339582cd..6487941c32921 100644
--- a/libc/config/gpu/spirv/entrypoints.txt
+++ b/libc/config/gpu/spirv/entrypoints.txt
@@ -88,6 +88,86 @@ set(TARGET_LIBC_ENTRYPOINTS
)
set(TARGET_LIBM_ENTRYPOINTS
+ # math.h entrypoints
+ libc.src.math.acos
+ libc.src.math.acosf
+ libc.src.math.asin
+ libc.src.math.asinf
+ libc.src.math.atan2
+ libc.src.math.atan2f
+ libc.src.math.atan
+ libc.src.math.atanf
+ libc.src.math.cbrt
+ libc.src.math.ceil
+ libc.src.math.ceilf
+ libc.src.math.copysign
+ libc.src.math.copysignf
+ libc.src.math.cos
+ libc.src.math.cosf
+ libc.src.math.coshf
+ libc.src.math.cospif
+ libc.src.math.exp10
+ libc.src.math.exp10f
+ libc.src.math.exp2
+ libc.src.math.exp2f
+ libc.src.math.exp
+ libc.src.math.expf
+ libc.src.math.fabs
+ libc.src.math.fabsf
+ libc.src.math.fdim
+ libc.src.math.fdimf
+ libc.src.math.floor
+ libc.src.math.floorf
+ libc.src.math.fma
+ libc.src.math.fmaf
+ libc.src.math.fmax
+ libc.src.math.fmaxf
+ libc.src.math.fmin
+ libc.src.math.fminf
+ libc.src.math.fmod
+ libc.src.math.frexp
+ libc.src.math.frexpf
+ libc.src.math.ilogb
+ libc.src.math.ilogbf
+ libc.src.math.ldexp
+ libc.src.math.ldexpf
+ libc.src.math.log
+ libc.src.math.logf
+ libc.src.math.log10
+ libc.src.math.log10f
+ libc.src.math.log2
+ libc.src.math.log2f
+ libc.src.math.logb
+ libc.src.math.logbf
+ libc.src.math.modf
+ libc.src.math.modff
+ libc.src.math.nextafter
+ libc.src.math.nextafterf
+ libc.src.math.pow
+ libc.src.math.powf
+ 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.rsqrtf
+ libc.src.math.scalbn
+ libc.src.math.scalbnf
+ libc.src.math.sin
+ libc.src.math.sinf
+ libc.src.math.sinhf
+ libc.src.math.sinpif
+ 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
)
if(LIBC_TYPES_HAS_FLOAT16)
diff --git a/libc/config/gpu/spirv/headers.txt b/libc/config/gpu/spirv/headers.txt
index ae5e0de66c7a2..6c89d5d5578b0 100644
--- a/libc/config/gpu/spirv/headers.txt
+++ b/libc/config/gpu/spirv/headers.txt
@@ -2,4 +2,5 @@ set(TARGET_PUBLIC_HEADERS
libc.include.ctype
libc.include.string
libc.include.strings
+ libc.include.math
)
diff --git a/libc/src/math/spirv/CMakeLists.txt b/libc/src/math/spirv/CMakeLists.txt
new file mode 100644
index 0000000000000..ae44cd1ed92c7
--- /dev/null
+++ b/libc/src/math/spirv/CMakeLists.txt
@@ -0,0 +1,479 @@
+add_entrypoint_object(
+ acos
+ SRCS
+ acos.cpp
+ HDRS
+ ../acos.h
+)
+
+add_entrypoint_object(
+ acosf
+ SRCS
+ acosf.cpp
+ HDRS
+ ../acosf.h
+)
+
+add_entrypoint_object(
+ asin
+ SRCS
+ asin.cpp
+ HDRS
+ ../asin.h
+)
+
+add_entrypoint_object(
+ asinf
+ SRCS
+ asinf.cpp
+ HDRS
+ ../asinf.h
+)
+
+add_entrypoint_object(
+ atan2
+ SRCS
+ atan2.cpp
+ HDRS
+ ../atan2.h
+)
+
+add_entrypoint_object(
+ atan2f
+ SRCS
+ atan2f.cpp
+ HDRS
+ ../atan2f.h
+)
+
+add_entrypoint_object(
+ atan
+ SRCS
+ atan.cpp
+ HDRS
+ ../atan.h
+)
+
+add_entrypoint_object(
+ atanf
+ SRCS
+ atanf.cpp
+ HDRS
+ ../atanf.h
+)
+
+add_entrypoint_object(
+ ceil
+ SRCS
+ ceil.cpp
+ HDRS
+ ../ceil.h
+)
+
+add_entrypoint_object(
+ ceilf
+ SRCS
+ ceilf.cpp
+ HDRS
+ ../ceilf.h
+)
+
+add_entrypoint_object(
+ copysign
+ SRCS
+ copysign.cpp
+ HDRS
+ ../copysign.h
+)
+
+add_entrypoint_object(
+ copysignf
+ SRCS
+ copysignf.cpp
+ HDRS
+ ../copysignf.h
+)
+
+add_entrypoint_object(
+ cos
+ SRCS
+ cos.cpp
+ HDRS
+ ../cos.h
+)
+
+add_entrypoint_object(
+ cosf
+ SRCS
+ cosf.cpp
+ HDRS
+ ../cosf.h
+)
+
+add_entrypoint_object(
+ coshf
+ SRCS
+ coshf.cpp
+ HDRS
+ ../coshf.h
+)
+
+add_entrypoint_object(
+ exp10
+ SRCS
+ exp10.cpp
+ HDRS
+ ../exp10.h
+)
+
+add_entrypoint_object(
+ exp10f
+ SRCS
+ exp10f.cpp
+ HDRS
+ ../exp10f.h
+)
+
+add_entrypoint_object(
+ exp2
+ SRCS
+ exp2.cpp
+ HDRS
+ ../exp2.h
+)
+
+add_entrypoint_object(
+ exp2f
+ SRCS
+ exp2f.cpp
+ HDRS
+ ../exp2f.h
+)
+
+add_entrypoint_object(
+ exp
+ SRCS
+ exp.cpp
+ HDRS
+ ../exp.h
+)
+
+add_entrypoint_object(
+ expf
+ SRCS
+ expf.cpp
+ HDRS
+ ../expf.h
+)
+
+add_entrypoint_object(
+ fabs
+ SRCS
+ fabs.cpp
+ HDRS
+ ../fabs.h
+)
+
+add_entrypoint_object(
+ fabsf
+ SRCS
+ fabsf.cpp
+ HDRS
+ ../fabsf.h
+)
+
+add_entrypoint_object(
+ floor
+ SRCS
+ floor.cpp
+ HDRS
+ ../floor.h
+)
+
+add_entrypoint_object(
+ floorf
+ SRCS
+ floorf.cpp
+ HDRS
+ ../floorf.h
+)
+
+add_entrypoint_object(
+ fma
+ SRCS
+ fma.cpp
+ HDRS
+ ../fma.h
+)
+
+add_entrypoint_object(
+ fmaf
+ SRCS
+ fmaf.cpp
+ HDRS
+ ../fmaf.h
+)
+
+add_entrypoint_object(
+ fmax
+ SRCS
+ fmax.cpp
+ HDRS
+ ../fmax.h
+)
+
+add_entrypoint_object(
+ fmaxf
+ SRCS
+ fmaxf.cpp
+ HDRS
+ ../fmaxf.h
+)
+
+add_entrypoint_object(
+ fmin
+ SRCS
+ fmin.cpp
+ HDRS
+ ../fmin.h
+)
+
+add_entrypoint_object(
+ fminf
+ SRCS
+ fminf.cpp
+ HDRS
+ ../fminf.h
+)
+
+add_entrypoint_object(
+ frexp
+ SRCS
+ frexp.cpp
+ HDRS
+ ../frexp.h
+)
+
+add_entrypoint_object(
+ frexpf
+ SRCS
+ frexpf.cpp
+ HDRS
+ ../frexpf.h
+)
+
+add_entrypoint_object(
+ ldexp
+ SRCS
+ ldexp.cpp
+ HDRS
+ ../ldexp.h
+)
+
+add_entrypoint_object(
+ ldexpf
+ SRCS
+ ldexpf.cpp
+ HDRS
+ ../ldexpf.h
+)
+
+add_entrypoint_object(
+ log10
+ SRCS
+ log10.cpp
+ HDRS
+ ../log10.h
+)
+
+add_entrypoint_object(
+ log10f
+ SRCS
+ log10f.cpp
+ HDRS
+ ../log10f.h
+)
+
+add_entrypoint_object(
+ log2
+ SRCS
+ log2.cpp
+ HDRS
+ ../log2.h
+)
+
+add_entrypoint_object(
+ log2f
+ SRCS
+ log2f.cpp
+ HDRS
+ ../log2f.h
+)
+
+add_entrypoint_object(
+ log
+ SRCS
+ log.cpp
+ HDRS
+ ../log.h
+)
+
+add_entrypoint_object(
+ logf
+ SRCS
+ logf.cpp
+ HDRS
+ ../logf.h
+)
+
+add_entrypoint_object(
+ pow
+ SRCS
+ pow.cpp
+ HDRS
+ ../pow.h
+)
+
+add_entrypoint_object(
+ powf
+ SRCS
+ powf.cpp
+ HDRS
+ ../powf.h
+)
+
+add_entrypoint_object(
+ rint
+ SRCS
+ rint.cpp
+ HDRS
+ ../rint.h
+)
+
+add_entrypoint_object(
+ rintf
+ SRCS
+ rintf.cpp
+ HDRS
+ ../rintf.h
+)
+
+add_entrypoint_object(
+ round
+ SRCS
+ round.cpp
+ HDRS
+ ../round.h
+)
+
+add_entrypoint_object(
+ roundf
+ SRCS
+ roundf.cpp
+ HDRS
+ ../roundf.h
+)
+
+add_entrypoint_object(
+ scalbn
+ SRCS
+ scalbn.cpp
+ HDRS
+ ../scalbn.h
+)
+
+add_entrypoint_object(
+ scalbnf
+ SRCS
+ scalbnf.cpp
+ HDRS
+ ../scalbnf.h
+)
+
+add_entrypoint_object(
+ sin
+ SRCS
+ sin.cpp
+ HDRS
+ ../sin.h
+)
+
+add_entrypoint_object(
+ sinf
+ SRCS
+ sinf.cpp
+ HDRS
+ ../sinf.h
+)
+
+add_entrypoint_object(
+ sinhf
+ SRCS
+ sinhf.cpp
+ HDRS
+ ../sinhf.h
+)
+
+add_entrypoint_object(
+ sqrt
+ SRCS
+ sqrt.cpp
+ HDRS
+ ../sqrt.h
+)
+
+add_entrypoint_object(
+ sqrtf
+ SRCS
+ sqrtf.cpp
+ HDRS
+ ../sqrtf.h
+)
+
+add_entrypoint_object(
+ tan
+ SRCS
+ tan.cpp
+ HDRS
+ ../tan.h
+)
+
+add_entrypoint_object(
+ tanf
+ SRCS
+ tanf.cpp
+ HDRS
+ ../tanf.h
+)
+
+add_entrypoint_object(
+ tanh
+ SRCS
+ tanh.cpp
+ HDRS
+ ../tanh.h
+)
+
+add_entrypoint_object(
+ tanhf
+ SRCS
+ tanhf.cpp
+ HDRS
+ ../tanhf.h
+)
+
+add_entrypoint_object(
+ trunc
+ SRCS
+ trunc.cpp
+ HDRS
+ ../trunc.h
+)
+
+add_entrypoint_object(
+ truncf
+ SRCS
+ truncf.cpp
+ HDRS
+ ../truncf.h
+)
diff --git a/libc/src/math/spirv/acos.cpp b/libc/src/math/spirv/acos.cpp
new file mode 100644
index 0000000000000..2c5cdd1428319
--- /dev/null
+++ b/libc/src/math/spirv/acos.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU acos 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/acos.h"
+#include "src/__support/math/acos.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, acos, (double x)) { return __builtin_acos(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/acosf.cpp b/libc/src/math/spirv/acosf.cpp
new file mode 100644
index 0000000000000..de34130101c17
--- /dev/null
+++ b/libc/src/math/spirv/acosf.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU acosf 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/acosf.h"
+#include "src/__support/math/acosf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, acosf, (float x)) { return __builtin_acosf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/asin.cpp b/libc/src/math/spirv/asin.cpp
new file mode 100644
index 0000000000000..7e533b81a4681
--- /dev/null
+++ b/libc/src/math/spirv/asin.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU asin 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/asin.h"
+#include "src/__support/math/asin.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, asin, (double x)) { return __builtin_asin(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/asinf.cpp b/libc/src/math/spirv/asinf.cpp
new file mode 100644
index 0000000000000..8e5d4396107aa
--- /dev/null
+++ b/libc/src/math/spirv/asinf.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU asinf 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/asinf.h"
+#include "src/__support/math/asinf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, asinf, (float x)) { return __builtin_asinf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/atan.cpp b/libc/src/math/spirv/atan.cpp
new file mode 100644
index 0000000000000..c01c89c7d0e0b
--- /dev/null
+++ b/libc/src/math/spirv/atan.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU atan 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/atan.h"
+#include "src/__support/math/atan.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, atan, (double x)) { return __builtin_atan(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/atan2.cpp b/libc/src/math/spirv/atan2.cpp
new file mode 100644
index 0000000000000..e8620f9f8f438
--- /dev/null
+++ b/libc/src/math/spirv/atan2.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU atan2 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/atan2.h"
+#include "src/__support/math/atan2.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, atan2, (double y, double x)) {
+ return __builtin_atan2(y, x);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/atan2f.cpp b/libc/src/math/spirv/atan2f.cpp
new file mode 100644
index 0000000000000..ff4183c5eb05a
--- /dev/null
+++ b/libc/src/math/spirv/atan2f.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU atan2f 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/atan2f.h"
+#include "src/__support/math/atan2f.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, atan2f, (float y, float x)) {
+ return __builtin_atan2f(y, x);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/atanf.cpp b/libc/src/math/spirv/atanf.cpp
new file mode 100644
index 0000000000000..e16dc05e4ca2a
--- /dev/null
+++ b/libc/src/math/spirv/atanf.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU atanf 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/atanf.h"
+#include "src/__support/math/atanf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, atanf, (float x)) { return __builtin_atanf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/ceil.cpp b/libc/src/math/spirv/ceil.cpp
new file mode 100644
index 0000000000000..8834c7b560a1b
--- /dev/null
+++ b/libc/src/math/spirv/ceil.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the ceil 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/ceil.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, ceil, (double x)) { return __builtin_ceil(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/ceilf.cpp b/libc/src/math/spirv/ceilf.cpp
new file mode 100644
index 0000000000000..5d26a30c849cd
--- /dev/null
+++ b/libc/src/math/spirv/ceilf.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the ceilf 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/ceilf.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, ceilf, (float x)) { return __builtin_ceilf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/copysign.cpp b/libc/src/math/spirv/copysign.cpp
new file mode 100644
index 0000000000000..06ef36fb3595f
--- /dev/null
+++ b/libc/src/math/spirv/copysign.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of the copysign 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/copysign.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, copysign, (double x, double y)) {
+ return __builtin_copysign(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/copysignf.cpp b/libc/src/math/spirv/copysignf.cpp
new file mode 100644
index 0000000000000..aea94f3577d8f
--- /dev/null
+++ b/libc/src/math/spirv/copysignf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of the copysignf 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/copysignf.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, copysignf, (float x, float y)) {
+ return __builtin_copysignf(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/cos.cpp b/libc/src/math/spirv/cos.cpp
new file mode 100644
index 0000000000000..46e68cdc2d953
--- /dev/null
+++ b/libc/src/math/spirv/cos.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU cos 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/cos.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, cos, (double x)) { return __builtin_cos(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/cosf.cpp b/libc/src/math/spirv/cosf.cpp
new file mode 100644
index 0000000000000..56d8ddd138a6c
--- /dev/null
+++ b/libc/src/math/spirv/cosf.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU cosf 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/cosf.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, cosf, (float x)) { return __builtin_cosf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/coshf.cpp b/libc/src/math/spirv/coshf.cpp
new file mode 100644
index 0000000000000..5e881c2f59d54
--- /dev/null
+++ b/libc/src/math/spirv/coshf.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU coshf 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/coshf.h"
+#include "src/__support/math/coshf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, coshf, (float x)) { return __builtin_coshf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/exp.cpp b/libc/src/math/spirv/exp.cpp
new file mode 100644
index 0000000000000..cc3a6906fe980
--- /dev/null
+++ b/libc/src/math/spirv/exp.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU exp 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/exp.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, exp, (double x)) { return __builtin_exp(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/exp10.cpp b/libc/src/math/spirv/exp10.cpp
new file mode 100644
index 0000000000000..57455f15a36cc
--- /dev/null
+++ b/libc/src/math/spirv/exp10.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU exp10 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/exp10.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, exp10, (double x)) { return __builtin_exp10(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/exp10f.cpp b/libc/src/math/spirv/exp10f.cpp
new file mode 100644
index 0000000000000..9aabd49ff77ab
--- /dev/null
+++ b/libc/src/math/spirv/exp10f.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU exp10f 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/exp10f.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, exp10f, (float x)) { return __builtin_exp10f(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/exp2.cpp b/libc/src/math/spirv/exp2.cpp
new file mode 100644
index 0000000000000..c2b6f677e7c19
--- /dev/null
+++ b/libc/src/math/spirv/exp2.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU exp2 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/exp2.h"
+#include "src/__support/common.h" // for LLVM_LIBC_FUNCTION
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, exp2, (double x)) { return __builtin_exp2(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/exp2f.cpp b/libc/src/math/spirv/exp2f.cpp
new file mode 100644
index 0000000000000..eb90ca19999ab
--- /dev/null
+++ b/libc/src/math/spirv/exp2f.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU exp2f 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/exp2f.h"
+#include "src/__support/common.h" // for LLVM_LIBC_FUNCTION
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, exp2f, (float x)) { return __builtin_exp2f(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/expf.cpp b/libc/src/math/spirv/expf.cpp
new file mode 100644
index 0000000000000..ed608407640a4
--- /dev/null
+++ b/libc/src/math/spirv/expf.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU expf 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/expf.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, expf, (float x)) { return __builtin_expf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/fabs.cpp b/libc/src/math/spirv/fabs.cpp
new file mode 100644
index 0000000000000..bb37596b9d563
--- /dev/null
+++ b/libc/src/math/spirv/fabs.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the fabs 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/fabs.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, fabs, (double x)) { return __builtin_fabs(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/fabsf.cpp b/libc/src/math/spirv/fabsf.cpp
new file mode 100644
index 0000000000000..2698618f3f1e1
--- /dev/null
+++ b/libc/src/math/spirv/fabsf.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the fabsf 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/fabsf.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, fabsf, (float x)) { return __builtin_fabsf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/floor.cpp b/libc/src/math/spirv/floor.cpp
new file mode 100644
index 0000000000000..564efa9a7da38
--- /dev/null
+++ b/libc/src/math/spirv/floor.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the floor 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/floor.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, floor, (double x)) { return __builtin_floor(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/floorf.cpp b/libc/src/math/spirv/floorf.cpp
new file mode 100644
index 0000000000000..6717c8f60c992
--- /dev/null
+++ b/libc/src/math/spirv/floorf.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the floorf 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/floorf.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, floorf, (float x)) { return __builtin_floorf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/fma.cpp b/libc/src/math/spirv/fma.cpp
new file mode 100644
index 0000000000000..c4a117e42a3aa
--- /dev/null
+++ b/libc/src/math/spirv/fma.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of the fma 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/fma.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, fma, (double x, double y, double z)) {
+ return __builtin_fma(x, y, z);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/fmaf.cpp b/libc/src/math/spirv/fmaf.cpp
new file mode 100644
index 0000000000000..c088bd5b30fea
--- /dev/null
+++ b/libc/src/math/spirv/fmaf.cpp
@@ -0,0 +1,19 @@
+//===-- Implementation of the fmaf 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/fmaf.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, fmaf, (float x, float y, float z)) {
+ return __builtin_fmaf(x, y, z);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/fmax.cpp b/libc/src/math/spirv/fmax.cpp
new file mode 100644
index 0000000000000..a2496fecb01c4
--- /dev/null
+++ b/libc/src/math/spirv/fmax.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of the fmax 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/fmax.h"
+
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, fmax, (double x, double y)) {
+ return __builtin_fmax(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/fmaxf.cpp b/libc/src/math/spirv/fmaxf.cpp
new file mode 100644
index 0000000000000..59ee8259c025a
--- /dev/null
+++ b/libc/src/math/spirv/fmaxf.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of the fmaxf 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/fmaxf.h"
+
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, fmaxf, (float x, float y)) {
+ return __builtin_fmaxf(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/fmin.cpp b/libc/src/math/spirv/fmin.cpp
new file mode 100644
index 0000000000000..694eb664b599b
--- /dev/null
+++ b/libc/src/math/spirv/fmin.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of the fmin 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/fmin.h"
+
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, fmin, (double x, double y)) {
+ return __builtin_fmin(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/fminf.cpp b/libc/src/math/spirv/fminf.cpp
new file mode 100644
index 0000000000000..2060b71b0841f
--- /dev/null
+++ b/libc/src/math/spirv/fminf.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of the fminf 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/fminf.h"
+
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, fminf, (float x, float y)) {
+ return __builtin_fminf(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/frexp.cpp b/libc/src/math/spirv/frexp.cpp
new file mode 100644
index 0000000000000..4ae2b00198ec3
--- /dev/null
+++ b/libc/src/math/spirv/frexp.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of the frexp 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/frexp.h"
+#include "src/__support/common.h"
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, frexp, (double x, int *p)) {
+ return __builtin_frexp(x, p);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/frexpf.cpp b/libc/src/math/spirv/frexpf.cpp
new file mode 100644
index 0000000000000..fd53f65701f59
--- /dev/null
+++ b/libc/src/math/spirv/frexpf.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of the frexpf 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/frexpf.h"
+#include "src/__support/common.h"
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, frexpf, (float x, int *p)) {
+ return __builtin_frexpf(x, p);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/ldexp.cpp b/libc/src/math/spirv/ldexp.cpp
new file mode 100644
index 0000000000000..5b786a9b21e70
--- /dev/null
+++ b/libc/src/math/spirv/ldexp.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of the ldexp 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/ldexp.h"
+#include "src/__support/common.h"
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, ldexp, (double x, int y)) {
+ return __builtin_ldexp(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/ldexpf.cpp b/libc/src/math/spirv/ldexpf.cpp
new file mode 100644
index 0000000000000..d3aa77fe592cb
--- /dev/null
+++ b/libc/src/math/spirv/ldexpf.cpp
@@ -0,0 +1,20 @@
+//===-- Implementation of the ldexpf 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/ldexpf.h"
+#include "src/__support/common.h"
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, ldexpf, (float x, int y)) {
+ return __builtin_ldexpf(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/log.cpp b/libc/src/math/spirv/log.cpp
new file mode 100644
index 0000000000000..cb69349c3a796
--- /dev/null
+++ b/libc/src/math/spirv/log.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU log 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/log.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, log, (double x)) { return __builtin_log(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/log10.cpp b/libc/src/math/spirv/log10.cpp
new file mode 100644
index 0000000000000..5a1c52de93ac1
--- /dev/null
+++ b/libc/src/math/spirv/log10.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU log10 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/log10.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, log10, (double x)) { return __builtin_log10(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/log10f.cpp b/libc/src/math/spirv/log10f.cpp
new file mode 100644
index 0000000000000..15a7a8c605c8e
--- /dev/null
+++ b/libc/src/math/spirv/log10f.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU log10f 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/log10f.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, log10f, (float x)) { return __builtin_log10f(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/log2.cpp b/libc/src/math/spirv/log2.cpp
new file mode 100644
index 0000000000000..0888f590bfb7f
--- /dev/null
+++ b/libc/src/math/spirv/log2.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU log2 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/log2.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, log2, (double x)) { return __builtin_log2(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/log2f.cpp b/libc/src/math/spirv/log2f.cpp
new file mode 100644
index 0000000000000..08c8ee28ceea5
--- /dev/null
+++ b/libc/src/math/spirv/log2f.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU log2f 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/log2f.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, log2f, (float x)) { return __builtin_log2f(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/logf.cpp b/libc/src/math/spirv/logf.cpp
new file mode 100644
index 0000000000000..6068e2fc839d8
--- /dev/null
+++ b/libc/src/math/spirv/logf.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU logf 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/logf.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, logf, (float x)) { return __builtin_logf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/pow.cpp b/libc/src/math/spirv/pow.cpp
new file mode 100644
index 0000000000000..d9655290d83c9
--- /dev/null
+++ b/libc/src/math/spirv/pow.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU pow 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/pow.h"
+#include "src/__support/math/pow.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, pow, (double x, double y)) {
+ return __builtin_pow(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/powf.cpp b/libc/src/math/spirv/powf.cpp
new file mode 100644
index 0000000000000..5e314cba7d486
--- /dev/null
+++ b/libc/src/math/spirv/powf.cpp
@@ -0,0 +1,18 @@
+//===-- Implementation of the GPU powf 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/powf.h"
+#include "src/__support/math/powf.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, powf, (float x, float y)) {
+ return __builtin_powf(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/rint.cpp b/libc/src/math/spirv/rint.cpp
new file mode 100644
index 0000000000000..ac6837a4abc37
--- /dev/null
+++ b/libc/src/math/spirv/rint.cpp
@@ -0,0 +1,17 @@
+//===-- 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"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, rint, (double x)) { return __builtin_rint(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/rintf.cpp b/libc/src/math/spirv/rintf.cpp
new file mode 100644
index 0000000000000..94093471a8d92
--- /dev/null
+++ b/libc/src/math/spirv/rintf.cpp
@@ -0,0 +1,17 @@
+//===-- 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"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, rintf, (float x)) { return __builtin_rintf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/round.cpp b/libc/src/math/spirv/round.cpp
new file mode 100644
index 0000000000000..0d2765f2e959f
--- /dev/null
+++ b/libc/src/math/spirv/round.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU round 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/round.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, round, (double x)) { return __builtin_round(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/roundf.cpp b/libc/src/math/spirv/roundf.cpp
new file mode 100644
index 0000000000000..86e8ba3ac83d6
--- /dev/null
+++ b/libc/src/math/spirv/roundf.cpp
@@ -0,0 +1,17 @@
+//===-- Implementation of the GPU roundf 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/roundf.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, roundf, (float x)) { return __builtin_roundf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/scalbn.cpp b/libc/src/math/spirv/scalbn.cpp
new file mode 100644
index 0000000000000..fd3d0435369d6
--- /dev/null
+++ b/libc/src/math/spirv/scalbn.cpp
@@ -0,0 +1,20 @@
+//===-- 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"
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, scalbn, (double x, int y)) {
+ return __builtin_ldexp(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/scalbnf.cpp b/libc/src/math/spirv/scalbnf.cpp
new file mode 100644
index 0000000000000..b5cb06f7bda0a
--- /dev/null
+++ b/libc/src/math/spirv/scalbnf.cpp
@@ -0,0 +1,20 @@
+//===-- 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"
+
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, scalbnf, (float x, int y)) {
+ return __builtin_ldexpf(x, y);
+}
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/sin.cpp b/libc/src/math/spirv/sin.cpp
new file mode 100644
index 0000000000000..133f206300145
--- /dev/null
+++ b/libc/src/math/spirv/sin.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU sin 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/sin.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, sin, (double x)) { return __builtin_sin(x); }
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/sinf.cpp b/libc/src/math/spirv/sinf.cpp
new file mode 100644
index 0000000000000..79113e18e5cdb
--- /dev/null
+++ b/libc/src/math/spirv/sinf.cpp
@@ -0,0 +1,16 @@
+//===-- Implementation of the GPU sinf 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/sinf.h"
+#include "src/__support/common.h"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, sinf, (float x)) { return __builtin_sinf(x); }
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/sinhf.cpp b/libc/src/math/spirv/sinhf.cpp
new file mode 100644
index 0000000000000..d1b17e09db216
--- /dev/null
+++ b/libc/src/math/spirv/sinhf.cpp
@@ -0,0 +1,17 @@
+//===-- 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"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, sinhf, (float x)) { return __builtin_sinhf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/sqrt.cpp b/libc/src/math/spirv/sqrt.cpp
new file mode 100644
index 0000000000000..ed83b6e5c6cae
--- /dev/null
+++ b/libc/src/math/spirv/sqrt.cpp
@@ -0,0 +1,17 @@
+//===-- 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"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, sqrt, (double x)) { return __builtin_sqrt(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/sqrtf.cpp b/libc/src/math/spirv/sqrtf.cpp
new file mode 100644
index 0000000000000..851922c316452
--- /dev/null
+++ b/libc/src/math/spirv/sqrtf.cpp
@@ -0,0 +1,17 @@
+//===-- 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"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, sqrtf, (float x)) { return __builtin_sqrtf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/tan.cpp b/libc/src/math/spirv/tan.cpp
new file mode 100644
index 0000000000000..aee67b23a94d6
--- /dev/null
+++ b/libc/src/math/spirv/tan.cpp
@@ -0,0 +1,17 @@
+//===-- 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"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, tan, (double x)) { return __builtin_tan(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/tanf.cpp b/libc/src/math/spirv/tanf.cpp
new file mode 100644
index 0000000000000..4c7250f43dae2
--- /dev/null
+++ b/libc/src/math/spirv/tanf.cpp
@@ -0,0 +1,17 @@
+//===-- 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"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, tanf, (float x)) { return __builtin_tanf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/tanh.cpp b/libc/src/math/spirv/tanh.cpp
new file mode 100644
index 0000000000000..08a91c73af235
--- /dev/null
+++ b/libc/src/math/spirv/tanh.cpp
@@ -0,0 +1,17 @@
+//===-- 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"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, tanh, (double x)) { return __builtin_tanh(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/tanhf.cpp b/libc/src/math/spirv/tanhf.cpp
new file mode 100644
index 0000000000000..8ca99c7131736
--- /dev/null
+++ b/libc/src/math/spirv/tanhf.cpp
@@ -0,0 +1,17 @@
+//===-- 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"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, tanhf, (float x)) { return __builtin_tanhf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/trunc.cpp b/libc/src/math/spirv/trunc.cpp
new file mode 100644
index 0000000000000..f60caa2a71d78
--- /dev/null
+++ b/libc/src/math/spirv/trunc.cpp
@@ -0,0 +1,17 @@
+//===-- 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"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(double, trunc, (double x)) { return __builtin_trunc(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
diff --git a/libc/src/math/spirv/truncf.cpp b/libc/src/math/spirv/truncf.cpp
new file mode 100644
index 0000000000000..a6c9b8f188f02
--- /dev/null
+++ b/libc/src/math/spirv/truncf.cpp
@@ -0,0 +1,17 @@
+//===-- 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"
+#include "src/__support/macros/config.h"
+
+namespace LIBC_NAMESPACE_DECL {
+
+LLVM_LIBC_FUNCTION(float, truncf, (float x)) { return __builtin_truncf(x); }
+
+} // namespace LIBC_NAMESPACE_DECL
More information about the libc-commits
mailing list