diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt index 50ddfc3930cd..b0e7aac6f8f3 100644 --- a/libclc/CMakeLists.txt +++ b/libclc/CMakeLists.txt @@ -20,7 +20,6 @@ include( GNUInstallDirs ) set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS amdgcn-amdhsa/lib/SOURCES; amdgcn/lib/SOURCES; - amdgpu/lib/SOURCES; clspv/lib/SOURCES; generic/lib/SOURCES; ptx-nvidiacl/lib/SOURCES; diff --git a/libclc/amdgpu/lib/SOURCES b/libclc/amdgpu/lib/SOURCES deleted file mode 100644 index ab5da40711aa..000000000000 --- a/libclc/amdgpu/lib/SOURCES +++ /dev/null @@ -1,9 +0,0 @@ -math/half_exp.cl -math/half_exp10.cl -math/half_exp2.cl -math/half_log.cl -math/half_log10.cl -math/half_log2.cl -math/half_recip.cl -math/half_rsqrt.cl -math/half_sqrt.cl diff --git a/libclc/clc/include/clc/math/clc_half_cos.h b/libclc/clc/include/clc/math/clc_half_cos.h new file mode 100644 index 000000000000..d0efc45793af --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_cos.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_COS_H__ +#define __CLC_MATH_CLC_HALF_COS_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_cos +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_COS_H__ diff --git a/libclc/clc/include/clc/math/clc_half_divide.h b/libclc/clc/include/clc/math/clc_half_divide.h new file mode 100644 index 000000000000..5d1e7b9e33e3 --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_divide.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_DIVIDE_H__ +#define __CLC_MATH_CLC_HALF_DIVIDE_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_divide +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_DIVIDE_H__ diff --git a/libclc/clc/include/clc/math/clc_half_exp.h b/libclc/clc/include/clc/math/clc_half_exp.h new file mode 100644 index 000000000000..e95f3d42085c --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_exp.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_EXP_H__ +#define __CLC_MATH_CLC_HALF_EXP_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_exp +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_EXP_H__ diff --git a/libclc/clc/include/clc/math/clc_half_exp10.h b/libclc/clc/include/clc/math/clc_half_exp10.h new file mode 100644 index 000000000000..e4cce6e63bf7 --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_exp10.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_EXP10_H__ +#define __CLC_MATH_CLC_HALF_EXP10_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_exp10 +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_EXP10_H__ diff --git a/libclc/clc/include/clc/math/clc_half_exp2.h b/libclc/clc/include/clc/math/clc_half_exp2.h new file mode 100644 index 000000000000..6fc99735f092 --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_exp2.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_EXP2_H__ +#define __CLC_MATH_CLC_HALF_EXP2_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_exp2 +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_EXP2_H__ diff --git a/libclc/clc/include/clc/math/clc_half_log.h b/libclc/clc/include/clc/math/clc_half_log.h new file mode 100644 index 000000000000..e44e68649966 --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_log.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_LOG_H__ +#define __CLC_MATH_CLC_HALF_LOG_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_log +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_LOG_H__ diff --git a/libclc/clc/include/clc/math/clc_half_log10.h b/libclc/clc/include/clc/math/clc_half_log10.h new file mode 100644 index 000000000000..23e0ba116c72 --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_log10.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_LOG10_H__ +#define __CLC_MATH_CLC_HALF_LOG10_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_log10 +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_LOG10_H__ diff --git a/libclc/clc/include/clc/math/clc_half_log2.h b/libclc/clc/include/clc/math/clc_half_log2.h new file mode 100644 index 000000000000..8ea2439eb3db --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_log2.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_LOG2_H__ +#define __CLC_MATH_CLC_HALF_LOG2_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_log2 +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_LOG2_H__ diff --git a/libclc/clc/include/clc/math/clc_half_powr.h b/libclc/clc/include/clc/math/clc_half_powr.h new file mode 100644 index 000000000000..252bfcd78504 --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_powr.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_POWR_H__ +#define __CLC_MATH_CLC_HALF_POWR_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_powr +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_POWR_H__ diff --git a/libclc/clc/include/clc/math/clc_half_recip.h b/libclc/clc/include/clc/math/clc_half_recip.h new file mode 100644 index 000000000000..1adb0bbe249c --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_recip.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_RECIP_H__ +#define __CLC_MATH_CLC_HALF_RECIP_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_recip +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_RECIP_H__ diff --git a/libclc/clc/include/clc/math/clc_half_rsqrt.h b/libclc/clc/include/clc/math/clc_half_rsqrt.h new file mode 100644 index 000000000000..6342739ed6f2 --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_rsqrt.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_RSQRT_H__ +#define __CLC_MATH_CLC_HALF_RSQRT_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_rsqrt +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_RSQRT_H__ diff --git a/libclc/clc/include/clc/math/clc_half_sin.h b/libclc/clc/include/clc/math/clc_half_sin.h new file mode 100644 index 000000000000..31378d290fec --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_sin.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_SIN_H__ +#define __CLC_MATH_CLC_HALF_SIN_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_sin +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_SIN_H__ diff --git a/libclc/clc/include/clc/math/clc_half_sqrt.h b/libclc/clc/include/clc/math/clc_half_sqrt.h new file mode 100644 index 000000000000..0e765fb3e773 --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_sqrt.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_SQRT_H__ +#define __CLC_MATH_CLC_HALF_SQRT_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_sqrt +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_SQRT_H__ diff --git a/libclc/clc/include/clc/math/clc_half_tan.h b/libclc/clc/include/clc/math/clc_half_tan.h new file mode 100644 index 000000000000..6c890a952522 --- /dev/null +++ b/libclc/clc/include/clc/math/clc_half_tan.h @@ -0,0 +1,21 @@ +//===----------------------------------------------------------------------===// +// +// 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 __CLC_MATH_CLC_HALF_TAN_H__ +#define __CLC_MATH_CLC_HALF_TAN_H__ + +#define __FLOAT_ONLY +#define __CLC_FUNCTION __clc_half_tan +#define __CLC_BODY + +#include + +#undef __CLC_FUNCTION +#undef __FLOAT_ONLY + +#endif // __CLC_MATH_CLC_HALF_TAN_H__ diff --git a/libclc/clc/lib/amdgpu/SOURCES b/libclc/clc/lib/amdgpu/SOURCES index 31e07b608c4c..83b13bad9a4f 100644 --- a/libclc/clc/lib/amdgpu/SOURCES +++ b/libclc/clc/lib/amdgpu/SOURCES @@ -1,3 +1,12 @@ +math/clc_half_exp10.cl +math/clc_half_exp2.cl +math/clc_half_exp.cl +math/clc_half_log10.cl +math/clc_half_log2.cl +math/clc_half_log.cl +math/clc_half_recip.cl +math/clc_half_rsqrt.cl +math/clc_half_sqrt.cl math/clc_native_exp2.cl math/clc_native_exp.cl math/clc_native_log10.cl diff --git a/libclc/amdgpu/lib/math/half_exp.cl b/libclc/clc/lib/amdgpu/math/clc_half_exp.cl similarity index 83% rename from libclc/amdgpu/lib/math/half_exp.cl rename to libclc/clc/lib/amdgpu/math/clc_half_exp.cl index 4cc2b36bb132..5fa9d0b9a9de 100644 --- a/libclc/amdgpu/lib/math/half_exp.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_exp.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include - +#include + #define __CLC_FUNC exp #define __FLOAT_ONLY -#define __CLC_BODY +#define __CLC_BODY #include diff --git a/libclc/amdgpu/lib/math/half_exp10.cl b/libclc/clc/lib/amdgpu/math/clc_half_exp10.cl similarity index 83% rename from libclc/amdgpu/lib/math/half_exp10.cl rename to libclc/clc/lib/amdgpu/math/clc_half_exp10.cl index 3bcdd2455ef3..5c119eb5a535 100644 --- a/libclc/amdgpu/lib/math/half_exp10.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_exp10.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include - +#include + #define __CLC_FUNC exp10 #define __FLOAT_ONLY -#define __CLC_BODY +#define __CLC_BODY #include diff --git a/libclc/clc/lib/amdgpu/math/clc_half_exp2.cl b/libclc/clc/lib/amdgpu/math/clc_half_exp2.cl new file mode 100644 index 000000000000..9750d5008986 --- /dev/null +++ b/libclc/clc/lib/amdgpu/math/clc_half_exp2.cl @@ -0,0 +1,15 @@ +//===----------------------------------------------------------------------===// +// +// 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 +#include + +#define __CLC_FUNC exp2 +#define __FLOAT_ONLY +#define __CLC_BODY +#include diff --git a/libclc/amdgpu/lib/math/half_log.cl b/libclc/clc/lib/amdgpu/math/clc_half_log.cl similarity index 83% rename from libclc/amdgpu/lib/math/half_log.cl rename to libclc/clc/lib/amdgpu/math/clc_half_log.cl index d0e924ca9720..ea19bd5a4c7a 100644 --- a/libclc/amdgpu/lib/math/half_log.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_log.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include - +#include + #define __CLC_FUNC log #define __FLOAT_ONLY -#define __CLC_BODY +#define __CLC_BODY #include diff --git a/libclc/amdgpu/lib/math/half_log10.cl b/libclc/clc/lib/amdgpu/math/clc_half_log10.cl similarity index 83% rename from libclc/amdgpu/lib/math/half_log10.cl rename to libclc/clc/lib/amdgpu/math/clc_half_log10.cl index 2f3b26e1084a..af3a2695396d 100644 --- a/libclc/amdgpu/lib/math/half_log10.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_log10.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include - +#include + #define __CLC_FUNC log10 #define __FLOAT_ONLY -#define __CLC_BODY +#define __CLC_BODY #include diff --git a/libclc/amdgpu/lib/math/half_log2.cl b/libclc/clc/lib/amdgpu/math/clc_half_log2.cl similarity index 83% rename from libclc/amdgpu/lib/math/half_log2.cl rename to libclc/clc/lib/amdgpu/math/clc_half_log2.cl index 9b417fb474ae..81795f012c77 100644 --- a/libclc/amdgpu/lib/math/half_log2.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_log2.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include - +#include + #define __CLC_FUNC log2 #define __FLOAT_ONLY -#define __CLC_BODY +#define __CLC_BODY #include diff --git a/libclc/amdgpu/lib/math/half_native_unary.inc b/libclc/clc/lib/amdgpu/math/clc_half_native_unary.inc similarity index 64% rename from libclc/amdgpu/lib/math/half_native_unary.inc rename to libclc/clc/lib/amdgpu/math/clc_half_native_unary.inc index 6ecad7eb483c..d62343400f2c 100644 --- a/libclc/amdgpu/lib/math/half_native_unary.inc +++ b/libclc/clc/lib/amdgpu/math/clc_half_native_unary.inc @@ -8,11 +8,12 @@ #include -#define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x) -#define __CLC_NATIVE_FUNC(x) __CLC_CONCAT(native_, x) +#define __CLC_HALF_FUNC(x) __CLC_CONCAT(__clc_half_, x) +#define __CLC_NATIVE_FUNC(x) __CLC_CONCAT(__clc_native_, x) -_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_HALF_FUNC(__CLC_FUNC)(__CLC_GENTYPE val) { - return __CLC_NATIVE_FUNC(__CLC_FUNC)(val); +_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE +__CLC_HALF_FUNC(__CLC_FUNC)(__CLC_GENTYPE val) { + return __CLC_NATIVE_FUNC(__CLC_FUNC)(val); } #undef __CLC_NATIVE_FUNC diff --git a/libclc/amdgpu/lib/math/half_recip.cl b/libclc/clc/lib/amdgpu/math/clc_half_recip.cl similarity index 83% rename from libclc/amdgpu/lib/math/half_recip.cl rename to libclc/clc/lib/amdgpu/math/clc_half_recip.cl index 87d56c8fbafc..edbec07e4484 100644 --- a/libclc/amdgpu/lib/math/half_recip.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_recip.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include - +#include + #define __CLC_FUNC recip #define __FLOAT_ONLY -#define __CLC_BODY +#define __CLC_BODY #include diff --git a/libclc/amdgpu/lib/math/half_rsqrt.cl b/libclc/clc/lib/amdgpu/math/clc_half_rsqrt.cl similarity index 83% rename from libclc/amdgpu/lib/math/half_rsqrt.cl rename to libclc/clc/lib/amdgpu/math/clc_half_rsqrt.cl index 099363a91307..c0a5489ec8fc 100644 --- a/libclc/amdgpu/lib/math/half_rsqrt.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_rsqrt.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include - +#include + #define __CLC_FUNC rsqrt #define __FLOAT_ONLY -#define __CLC_BODY +#define __CLC_BODY #include diff --git a/libclc/amdgpu/lib/math/half_sqrt.cl b/libclc/clc/lib/amdgpu/math/clc_half_sqrt.cl similarity index 83% rename from libclc/amdgpu/lib/math/half_sqrt.cl rename to libclc/clc/lib/amdgpu/math/clc_half_sqrt.cl index f7ae5b4d589e..4dc6fa31f21a 100644 --- a/libclc/amdgpu/lib/math/half_sqrt.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_sqrt.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include - +#include + #define __CLC_FUNC sqrt #define __FLOAT_ONLY -#define __CLC_BODY +#define __CLC_BODY #include diff --git a/libclc/clc/lib/generic/SOURCES b/libclc/clc/lib/generic/SOURCES index 0a839e885e39..2fffc5bbe7af 100644 --- a/libclc/clc/lib/generic/SOURCES +++ b/libclc/clc/lib/generic/SOURCES @@ -50,6 +50,20 @@ math/clc_floor.cl math/clc_fmod.cl math/clc_fract.cl math/clc_frexp.cl +math/clc_half_cos.cl +math/clc_half_divide.cl +math/clc_half_exp.cl +math/clc_half_exp10.cl +math/clc_half_exp2.cl +math/clc_half_log.cl +math/clc_half_log10.cl +math/clc_half_log2.cl +math/clc_half_powr.cl +math/clc_half_rsqrt.cl +math/clc_half_recip.cl +math/clc_half_sin.cl +math/clc_half_sqrt.cl +math/clc_half_tan.cl math/clc_hypot.cl math/clc_ldexp.cl math/clc_lgamma.cl diff --git a/libclc/clc/lib/generic/math/clc_half_cos.cl b/libclc/clc/lib/generic/math/clc_half_cos.cl new file mode 100644 index 000000000000..c2064a00232f --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_cos.cl @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_cos +#define __CLC_FUNCTION(x) __clc_cos +#define __CLC_BODY + +#include diff --git a/libclc/amdgpu/lib/math/half_exp2.cl b/libclc/clc/lib/generic/math/clc_half_divide.cl similarity index 82% rename from libclc/amdgpu/lib/math/half_exp2.cl rename to libclc/clc/lib/generic/math/clc_half_divide.cl index d9efb27a7c57..88676a4ac785 100644 --- a/libclc/amdgpu/lib/math/half_exp2.cl +++ b/libclc/clc/lib/generic/math/clc_half_divide.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include - -#define __CLC_FUNC exp2 +#include + #define __FLOAT_ONLY -#define __CLC_BODY +#define __CLC_BODY + #include diff --git a/libclc/clc/lib/generic/math/clc_half_divide.inc b/libclc/clc/lib/generic/math/clc_half_divide.inc new file mode 100644 index 000000000000..27fdb183dded --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_divide.inc @@ -0,0 +1,12 @@ +//===----------------------------------------------------------------------===// +// +// 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 __clc_half_divide(__CLC_GENTYPE x, + __CLC_GENTYPE y) { + return x / y; +} diff --git a/libclc/clc/lib/generic/math/clc_half_exp.cl b/libclc/clc/lib/generic/math/clc_half_exp.cl new file mode 100644 index 000000000000..88336f9df011 --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_exp.cl @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_exp +#define __CLC_FUNCTION(x) __clc_exp +#define __CLC_BODY + +#include diff --git a/libclc/clc/lib/generic/math/clc_half_exp10.cl b/libclc/clc/lib/generic/math/clc_half_exp10.cl new file mode 100644 index 000000000000..b3c0001a8527 --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_exp10.cl @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_exp10 +#define __CLC_FUNCTION(x) __clc_exp10 +#define __CLC_BODY + +#include diff --git a/libclc/clc/lib/generic/math/clc_half_exp2.cl b/libclc/clc/lib/generic/math/clc_half_exp2.cl new file mode 100644 index 000000000000..f3ffcc6876b9 --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_exp2.cl @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_exp2 +#define __CLC_FUNCTION(x) __clc_exp2 +#define __CLC_BODY + +#include diff --git a/libclc/clc/lib/generic/math/clc_half_log.cl b/libclc/clc/lib/generic/math/clc_half_log.cl new file mode 100644 index 000000000000..7371344ab2d1 --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_log.cl @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_log +#define __CLC_FUNCTION(x) __clc_log +#define __CLC_BODY + +#include diff --git a/libclc/clc/lib/generic/math/clc_half_log10.cl b/libclc/clc/lib/generic/math/clc_half_log10.cl new file mode 100644 index 000000000000..e9becad210ea --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_log10.cl @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_log10 +#define __CLC_FUNCTION(x) __clc_log10 +#define __CLC_BODY + +#include diff --git a/libclc/clc/lib/generic/math/clc_half_log2.cl b/libclc/clc/lib/generic/math/clc_half_log2.cl new file mode 100644 index 000000000000..aa8d838afad7 --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_log2.cl @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_log2 +#define __CLC_FUNCTION(x) __clc_log2 +#define __CLC_BODY + +#include diff --git a/libclc/clc/lib/generic/math/clc_half_powr.cl b/libclc/clc/lib/generic/math/clc_half_powr.cl new file mode 100644 index 000000000000..ade6731db143 --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_powr.cl @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_powr +#define __CLC_FUNCTION(x) __clc_powr +#define __CLC_BODY + +#include diff --git a/libclc/clc/lib/generic/math/clc_half_recip.cl b/libclc/clc/lib/generic/math/clc_half_recip.cl new file mode 100644 index 000000000000..0ae1e922d489 --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_recip.cl @@ -0,0 +1,12 @@ +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +#define __FLOAT_ONLY +#define __CLC_BODY + +#include diff --git a/libclc/clc/lib/generic/math/clc_half_recip.inc b/libclc/clc/lib/generic/math/clc_half_recip.inc new file mode 100644 index 000000000000..24ededc8e5c7 --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_recip.inc @@ -0,0 +1,11 @@ +//===----------------------------------------------------------------------===// +// +// 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 __clc_half_recip(__CLC_GENTYPE val) { + return 1.0f / val; +} diff --git a/libclc/clc/lib/generic/math/clc_half_rsqrt.cl b/libclc/clc/lib/generic/math/clc_half_rsqrt.cl new file mode 100644 index 000000000000..07daf7fc3623 --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_rsqrt.cl @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_rsqrt +#define __CLC_FUNCTION(x) __clc_rsqrt +#define __CLC_BODY + +#include diff --git a/libclc/clc/lib/generic/math/clc_half_sin.cl b/libclc/clc/lib/generic/math/clc_half_sin.cl new file mode 100644 index 000000000000..c0af5e7bf471 --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_sin.cl @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_sin +#define __CLC_FUNCTION(x) __clc_sin +#define __CLC_BODY + +#include diff --git a/libclc/clc/lib/generic/math/clc_half_sqrt.cl b/libclc/clc/lib/generic/math/clc_half_sqrt.cl new file mode 100644 index 000000000000..b6b5097e965c --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_sqrt.cl @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_sqrt +#define __CLC_FUNCTION(x) __clc_sqrt +#define __CLC_BODY + +#include diff --git a/libclc/clc/lib/generic/math/clc_half_tan.cl b/libclc/clc/lib/generic/math/clc_half_tan.cl new file mode 100644 index 000000000000..ca27f3c662aa --- /dev/null +++ b/libclc/clc/lib/generic/math/clc_half_tan.cl @@ -0,0 +1,16 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_tan +#define __CLC_FUNCTION(x) __clc_tan +#define __CLC_BODY + +#include diff --git a/libclc/generic/lib/math/half_binary.inc b/libclc/generic/lib/math/half_binary.inc deleted file mode 100644 index adb97f3ad2a2..000000000000 --- a/libclc/generic/lib/math/half_binary.inc +++ /dev/null @@ -1,17 +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 -// -//===----------------------------------------------------------------------===// - -#include - -#define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x) - -_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_HALF_FUNC(__CLC_FUNC)(__CLC_GENTYPE x, __CLC_GENTYPE y) { - return __CLC_FUNC(x, y); -} - -#undef __CLC_HALF_FUNC diff --git a/libclc/generic/lib/math/half_cos.cl b/libclc/generic/lib/math/half_cos.cl index 2120aa0f4585..1e49ebe8ce73 100644 --- a/libclc/generic/lib/math/half_cos.cl +++ b/libclc/generic/lib/math/half_cos.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define __CLC_FUNC cos -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_cos +#define __CLC_BODY + #include diff --git a/libclc/generic/lib/math/half_divide.cl b/libclc/generic/lib/math/half_divide.cl index 945e2120995f..29b5679f428e 100644 --- a/libclc/generic/lib/math/half_divide.cl +++ b/libclc/generic/lib/math/half_divide.cl @@ -7,11 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define divide(x,y) (x/y) - -#define __CLC_FUNC divide -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_divide +#define __CLC_BODY + #include -#undef divide diff --git a/libclc/generic/lib/math/half_exp.cl b/libclc/generic/lib/math/half_exp.cl index 1f5b0b32f497..219b26219010 100644 --- a/libclc/generic/lib/math/half_exp.cl +++ b/libclc/generic/lib/math/half_exp.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define __CLC_FUNC exp -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_exp +#define __CLC_BODY + #include diff --git a/libclc/generic/lib/math/half_exp10.cl b/libclc/generic/lib/math/half_exp10.cl index 83e4535be98a..64132c0f9398 100644 --- a/libclc/generic/lib/math/half_exp10.cl +++ b/libclc/generic/lib/math/half_exp10.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define __CLC_FUNC exp10 -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_exp10 +#define __CLC_BODY + #include diff --git a/libclc/generic/lib/math/half_exp2.cl b/libclc/generic/lib/math/half_exp2.cl index 229b007d0419..9fddc5eb096e 100644 --- a/libclc/generic/lib/math/half_exp2.cl +++ b/libclc/generic/lib/math/half_exp2.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define __CLC_FUNC exp2 -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_exp2 +#define __CLC_BODY + #include diff --git a/libclc/generic/lib/math/half_log.cl b/libclc/generic/lib/math/half_log.cl index 3df6173daf93..b3d2c2711776 100644 --- a/libclc/generic/lib/math/half_log.cl +++ b/libclc/generic/lib/math/half_log.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define __CLC_FUNC log -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_log +#define __CLC_BODY + #include diff --git a/libclc/generic/lib/math/half_log10.cl b/libclc/generic/lib/math/half_log10.cl index 84d46facb7dc..8ef6d463b3f9 100644 --- a/libclc/generic/lib/math/half_log10.cl +++ b/libclc/generic/lib/math/half_log10.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define __CLC_FUNC log10 -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_log10 +#define __CLC_BODY + #include diff --git a/libclc/generic/lib/math/half_log2.cl b/libclc/generic/lib/math/half_log2.cl index a46d25821899..a343dbae36d7 100644 --- a/libclc/generic/lib/math/half_log2.cl +++ b/libclc/generic/lib/math/half_log2.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define __CLC_FUNC log2 -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_log2 +#define __CLC_BODY + #include diff --git a/libclc/generic/lib/math/half_powr.cl b/libclc/generic/lib/math/half_powr.cl index 765dd584c045..03c4ca7a0177 100644 --- a/libclc/generic/lib/math/half_powr.cl +++ b/libclc/generic/lib/math/half_powr.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define __CLC_FUNC powr -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_powr +#define __CLC_BODY + #include diff --git a/libclc/generic/lib/math/half_recip.cl b/libclc/generic/lib/math/half_recip.cl index 31273806180f..70f7625c43f5 100644 --- a/libclc/generic/lib/math/half_recip.cl +++ b/libclc/generic/lib/math/half_recip.cl @@ -7,12 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define recip(x) (1.0f/x) - -#define __CLC_FUNC recip -#define __CLC_BODY #define __FLOAT_ONLY -#include +#define FUNCTION half_recip +#define __CLC_BODY -#undef recip +#include diff --git a/libclc/generic/lib/math/half_rsqrt.cl b/libclc/generic/lib/math/half_rsqrt.cl index 71b20888e82b..3fc788d80906 100644 --- a/libclc/generic/lib/math/half_rsqrt.cl +++ b/libclc/generic/lib/math/half_rsqrt.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define __CLC_FUNC rsqrt -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_rsqrt +#define __CLC_BODY + #include diff --git a/libclc/generic/lib/math/half_sin.cl b/libclc/generic/lib/math/half_sin.cl index 257abcd9a157..6fab611610fb 100644 --- a/libclc/generic/lib/math/half_sin.cl +++ b/libclc/generic/lib/math/half_sin.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define __CLC_FUNC sin -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_sin +#define __CLC_BODY + #include diff --git a/libclc/generic/lib/math/half_sqrt.cl b/libclc/generic/lib/math/half_sqrt.cl index 70ad80c76c84..e96e127a89b3 100644 --- a/libclc/generic/lib/math/half_sqrt.cl +++ b/libclc/generic/lib/math/half_sqrt.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define __CLC_FUNC sqrt -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_sqrt +#define __CLC_BODY + #include diff --git a/libclc/generic/lib/math/half_tan.cl b/libclc/generic/lib/math/half_tan.cl index 12bf779c5965..ddfcfae4ff99 100644 --- a/libclc/generic/lib/math/half_tan.cl +++ b/libclc/generic/lib/math/half_tan.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include +#include -#define __CLC_FUNC tan -#define __CLC_BODY #define __FLOAT_ONLY +#define FUNCTION half_tan +#define __CLC_BODY + #include diff --git a/libclc/generic/lib/math/half_unary.inc b/libclc/generic/lib/math/half_unary.inc deleted file mode 100644 index 5fddb3c2acec..000000000000 --- a/libclc/generic/lib/math/half_unary.inc +++ /dev/null @@ -1,17 +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 -// -//===----------------------------------------------------------------------===// - -#include - -#define __CLC_HALF_FUNC(x) __CLC_CONCAT(half_, x) - -_CLC_OVERLOAD _CLC_DEF __CLC_GENTYPE __CLC_HALF_FUNC(__CLC_FUNC)(__CLC_GENTYPE val) { - return __CLC_FUNC(val); -} - -#undef __CLC_HALF_FUNC