diff --git a/libclc/clc/include/clc/math/unary_def_via_fp32.inc b/libclc/clc/include/clc/math/unary_def_via_fp32.inc deleted file mode 100644 index f109e8ec4a111..0000000000000 --- a/libclc/clc/include/clc/math/unary_def_via_fp32.inc +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// 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 -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE FUNCTION(__CLC_GENTYPE x) { - return __CLC_CONVERT_GENTYPE(FUNCTION(__CLC_CONVERT_FLOATN(x))); -} diff --git a/libclc/clc/lib/generic/math/clc_erf.cl b/libclc/clc/lib/generic/math/clc_erf.cl index 17fee3e8d11f8..bea392445c93c 100644 --- a/libclc/clc/lib/generic/math/clc_erf.cl +++ b/libclc/clc/lib/generic/math/clc_erf.cl @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include #include #include #include @@ -211,12 +210,6 @@ _CLC_OVERLOAD _CLC_DEF float __clc_erf(float x) { return ret; } -#define __FLOAT_ONLY -#define FUNCTION __clc_erf -#define __CLC_BODY -#include -#undef FUNCTION - #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable @@ -500,24 +493,19 @@ _CLC_OVERLOAD _CLC_DEF double __clc_erf(double y) { return y < 0.0 ? -ret : ret; } -#define __DOUBLE_ONLY -#define FUNCTION __clc_erf -#define __CLC_BODY -#include -#undef FUNCTION - #endif #ifdef cl_khr_fp16 -#include - #pragma OPENCL EXTENSION cl_khr_fp16 : enable // Forward the half version of this builtin onto the float one -#define __HALF_ONLY -#define FUNCTION __clc_erf -#define __CLC_BODY -#include +_CLC_OVERLOAD _CLC_DEF half __clc_erf(half x) { + return (half)__clc_erf((float)x); +} #endif + +#define FUNCTION __clc_erf +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/generic/math/clc_erfc.cl b/libclc/clc/lib/generic/math/clc_erfc.cl index 77f8959831d27..fab6960046028 100644 --- a/libclc/clc/lib/generic/math/clc_erfc.cl +++ b/libclc/clc/lib/generic/math/clc_erfc.cl @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include #include #include #include @@ -211,12 +210,6 @@ _CLC_OVERLOAD _CLC_DEF float __clc_erfc(float x) { return ret; } -#define __FLOAT_ONLY -#define FUNCTION __clc_erfc -#define __CLC_BODY -#include -#undef FUNCTION - #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable @@ -509,12 +502,6 @@ _CLC_OVERLOAD _CLC_DEF double __clc_erfc(double x) { return ret; } -#define __DOUBLE_ONLY -#define FUNCTION __clc_erfc -#define __CLC_BODY -#include -#undef FUNCTION - #endif #ifdef cl_khr_fp16 @@ -524,9 +511,12 @@ _CLC_OVERLOAD _CLC_DEF double __clc_erfc(double x) { #pragma OPENCL EXTENSION cl_khr_fp16 : enable // Forward the half version of this builtin onto the float one -#define __HALF_ONLY -#define FUNCTION __clc_erfc -#define __CLC_BODY -#include +_CLC_OVERLOAD _CLC_DEF half __clc_erfc(half x) { + return (half)__clc_erfc((float)x); +} #endif + +#define FUNCTION __clc_erfc +#define __CLC_BODY +#include diff --git a/libclc/clc/lib/generic/math/clc_tgamma.cl b/libclc/clc/lib/generic/math/clc_tgamma.cl index e0fed98026ca5..83b09cc33ecc2 100644 --- a/libclc/clc/lib/generic/math/clc_tgamma.cl +++ b/libclc/clc/lib/generic/math/clc_tgamma.cl @@ -6,7 +6,6 @@ // //===----------------------------------------------------------------------===// -#include #include #include #include @@ -32,12 +31,6 @@ _CLC_OVERLOAD _CLC_DEF float __clc_tgamma(float x) { return g; } -#define __FLOAT_ONLY -#define FUNCTION __clc_tgamma -#define __CLC_BODY -#include -#undef FUNCTION - #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable @@ -59,24 +52,19 @@ _CLC_OVERLOAD _CLC_DEF double __clc_tgamma(double x) { return g; } -#define __DOUBLE_ONLY -#define FUNCTION __clc_tgamma -#define __CLC_BODY -#include -#undef FUNCTION - #endif #ifdef cl_khr_fp16 -#include - #pragma OPENCL EXTENSION cl_khr_fp16 : enable // Forward the half version of this builtin onto the float one -#define __HALF_ONLY -#define FUNCTION __clc_tgamma -#define __CLC_BODY -#include +_CLC_OVERLOAD _CLC_DEF half __clc_tgamma(half x) { + return (half)__clc_tgamma((float)x); +} #endif + +#define FUNCTION __clc_tgamma +#define __CLC_BODY +#include