diff --git a/libclc/amdgpu/lib/math/native_exp.cl b/libclc/amdgpu/lib/math/native_exp.cl index 71c9a2ea2fcc..a7ad16240e60 100644 --- a/libclc/amdgpu/lib/math/native_exp.cl +++ b/libclc/amdgpu/lib/math/native_exp.cl @@ -1,5 +1,29 @@ #include -#define __CLC_BODY -#define __FLOAT_ONLY -#include +// #define __CLC_BODY +// #define __FLOAT_ONLY +// #include + +__attribute__((overloadable)) __attribute__((always_inline)) float native_exp(float val) { + return exp(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float2 native_exp(float2 val) { + return exp(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float3 native_exp(float3 val) { + return exp(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float4 native_exp(float4 val) { + return exp(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float8 native_exp(float8 val) { + return exp(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float16 native_exp(float16 val) { + return exp(val); +} diff --git a/libclc/generic/lib/math/modf.inc b/libclc/generic/lib/math/modf.inc index 1ffc6d9e851b..53f2995bdb84 100644 --- a/libclc/generic/lib/math/modf.inc +++ b/libclc/generic/lib/math/modf.inc @@ -43,5 +43,5 @@ _CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE modf(__CLC_GENTYPE x, __CLC_GENTYPE *iptr) MODF_DEF(local); MODF_DEF(global); - +MODF_DEF(private); #undef ZERO diff --git a/libclc/generic/lib/math/native_cos.cl b/libclc/generic/lib/math/native_cos.cl index 3a934272a283..7ced9df41a59 100644 --- a/libclc/generic/lib/math/native_cos.cl +++ b/libclc/generic/lib/math/native_cos.cl @@ -1,7 +1,30 @@ #include -#define __CLC_NATIVE_INTRINSIC cos +// #define __CLC_BODY +// #define __FLOAT_ONLY +// #include + +__attribute__((overloadable)) __attribute__((always_inline)) float native_cos(float val) { + return cos(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float2 native_cos(float2 val) { + return cos(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float3 native_cos(float3 val) { + return cos(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float4 native_cos(float4 val) { + return cos(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float8 native_cos(float8 val) { + return cos(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float16 native_cos(float16 val) { + return cos(val); +} -#define __CLC_BODY -#define __FLOAT_ONLY -#include diff --git a/libclc/generic/lib/math/native_exp.cl b/libclc/generic/lib/math/native_exp.cl index 889bb135c061..1070d61fe088 100644 --- a/libclc/generic/lib/math/native_exp.cl +++ b/libclc/generic/lib/math/native_exp.cl @@ -1,7 +1,31 @@ #include -#define __CLC_NATIVE_INTRINSIC exp +// #define __CLC_NATIVE_INTRINSIC exp -#define __CLC_BODY -#define __FLOAT_ONLY -#include +// #define __CLC_BODY +// #define __FLOAT_ONLY +// #include + +__attribute__((overloadable)) __attribute__((always_inline)) float native_exp(float val) { + return exp(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float2 native_exp(float2 val) { + return exp(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float3 native_exp(float3 val) { + return exp(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float4 native_exp(float4 val) { + return exp(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float8 native_exp(float8 val) { + return exp(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float16 native_exp(float16 val) { + return exp(val); +} \ No newline at end of file diff --git a/libclc/generic/lib/math/native_exp2.cl b/libclc/generic/lib/math/native_exp2.cl index 0312f998ebd8..ba823b02ad03 100644 --- a/libclc/generic/lib/math/native_exp2.cl +++ b/libclc/generic/lib/math/native_exp2.cl @@ -1,7 +1,31 @@ #include -#define __CLC_NATIVE_INTRINSIC exp2 +// #define __CLC_NATIVE_INTRINSIC exp2 -#define __CLC_BODY -#define __FLOAT_ONLY -#include +// #define __CLC_BODY +// #define __FLOAT_ONLY +// #include + +__attribute__((overloadable)) __attribute__((always_inline)) float native_exp2(float val) { + return exp2(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float2 native_exp2(float2 val) { + return exp2(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float3 native_exp2(float3 val) { + return exp2(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float4 native_exp2(float4 val) { + return exp2(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float8 native_exp2(float8 val) { + return exp2(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float16 native_exp2(float16 val) { + return exp2(val); +} diff --git a/libclc/generic/lib/math/native_log.cl b/libclc/generic/lib/math/native_log.cl index 5708249a6707..f342a3580702 100644 --- a/libclc/generic/lib/math/native_log.cl +++ b/libclc/generic/lib/math/native_log.cl @@ -22,8 +22,30 @@ #include -#define __CLC_NATIVE_INTRINSIC log +// #define __CLC_BODY +// #define __FLOAT_ONLY +// #include -#define __CLC_BODY -#define __FLOAT_ONLY -#include +__attribute__((overloadable)) __attribute__((always_inline)) float native_log(float val) { + return log(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float2 native_log(float2 val) { + return log(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float3 native_log(float3 val) { + return log(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float4 native_log(float4 val) { + return log(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float8 native_log(float8 val) { + return log(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float16 native_log(float16 val) { + return log(val); +} diff --git a/libclc/generic/lib/math/native_log10.cl b/libclc/generic/lib/math/native_log10.cl index d69b7b608c3a..0f75afa78431 100644 --- a/libclc/generic/lib/math/native_log10.cl +++ b/libclc/generic/lib/math/native_log10.cl @@ -1,7 +1,31 @@ #include -#define __CLC_NATIVE_INTRINSIC log10 +// #define __CLC_NATIVE_INTRINSIC log10 -#define __CLC_BODY -#define __FLOAT_ONLY -#include +// #define __CLC_BODY +// #define __FLOAT_ONLY +// #include + +__attribute__((overloadable)) __attribute__((always_inline)) float native_log10(float val) { + return log10(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float2 native_log10(float2 val) { + return log10(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float3 native_log10(float3 val) { + return log10(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float4 native_log10(float4 val) { + return log10(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float8 native_log10(float8 val) { + return log10(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float16 native_log10(float16 val) { + return log10(val); +} diff --git a/libclc/generic/lib/math/native_log2.cl b/libclc/generic/lib/math/native_log2.cl index b6104237ab2d..e50583ecad44 100644 --- a/libclc/generic/lib/math/native_log2.cl +++ b/libclc/generic/lib/math/native_log2.cl @@ -22,7 +22,31 @@ #include -#define __CLC_NATIVE_INTRINSIC log2 -#define __CLC_BODY -#define __FLOAT_ONLY -#include +// #define __CLC_NATIVE_INTRINSIC log2 +// #define __CLC_BODY +// #define __FLOAT_ONLY +// #include + +__attribute__((overloadable)) __attribute__((always_inline)) float native_log2(float val) { + return log2(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float2 native_log2(float2 val) { + return log2(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float3 native_log2(float3 val) { + return log2(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float4 native_log2(float4 val) { + return log2(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float8 native_log2(float8 val) { + return log2(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float16 native_log2(float16 val) { + return log2(val); +} diff --git a/libclc/generic/lib/math/native_sin.cl b/libclc/generic/lib/math/native_sin.cl index fd9232f188ef..8aca0449209f 100644 --- a/libclc/generic/lib/math/native_sin.cl +++ b/libclc/generic/lib/math/native_sin.cl @@ -1,7 +1,31 @@ #include -#define __CLC_NATIVE_INTRINSIC sin +// #define __CLC_NATIVE_INTRINSIC sin -#define __CLC_BODY -#define __FLOAT_ONLY -#include +// #define __CLC_BODY +// #define __FLOAT_ONLY +// #include + +__attribute__((overloadable)) __attribute__((always_inline)) float native_sin(float val) { + return sin(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float2 native_sin(float2 val) { + return sin(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float3 native_sin(float3 val) { + return sin(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float4 native_sin(float4 val) { + return sin(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float8 native_sin(float8 val) { + return sin(val); +} + +__attribute__((overloadable)) __attribute__((always_inline)) float16 native_sin(float16 val) { + return sin(val); +}