Author: Fraser Cormack Date: 2025-05-12T17:32:05+01:00 New Revision: dd89af7f5525f139fed54cc376cfd2fc64c631ae
URL: https://github.com/llvm/llvm-project/commit/dd89af7f5525f139fed54cc376cfd2fc64c631ae DIFF: https://github.com/llvm/llvm-project/commit/dd89af7f5525f139fed54cc376cfd2fc64c631ae.diff LOG: [libclc] Move 'half' builtins to CLC library (#139563) There are no changes to the generated bytecode. Added: libclc/clc/include/clc/math/clc_half_cos.h libclc/clc/include/clc/math/clc_half_divide.h libclc/clc/include/clc/math/clc_half_exp.h libclc/clc/include/clc/math/clc_half_exp10.h libclc/clc/include/clc/math/clc_half_exp2.h libclc/clc/include/clc/math/clc_half_log.h libclc/clc/include/clc/math/clc_half_log10.h libclc/clc/include/clc/math/clc_half_log2.h libclc/clc/include/clc/math/clc_half_powr.h libclc/clc/include/clc/math/clc_half_recip.h libclc/clc/include/clc/math/clc_half_rsqrt.h libclc/clc/include/clc/math/clc_half_sin.h libclc/clc/include/clc/math/clc_half_sqrt.h libclc/clc/include/clc/math/clc_half_tan.h libclc/clc/lib/amdgpu/math/clc_half_exp.cl libclc/clc/lib/amdgpu/math/clc_half_exp10.cl libclc/clc/lib/amdgpu/math/clc_half_exp2.cl libclc/clc/lib/amdgpu/math/clc_half_log.cl libclc/clc/lib/amdgpu/math/clc_half_log10.cl libclc/clc/lib/amdgpu/math/clc_half_log2.cl libclc/clc/lib/amdgpu/math/clc_half_native_unary.inc libclc/clc/lib/amdgpu/math/clc_half_recip.cl libclc/clc/lib/amdgpu/math/clc_half_rsqrt.cl libclc/clc/lib/amdgpu/math/clc_half_sqrt.cl libclc/clc/lib/generic/math/clc_half_cos.cl libclc/clc/lib/generic/math/clc_half_divide.cl libclc/clc/lib/generic/math/clc_half_divide.inc libclc/clc/lib/generic/math/clc_half_exp.cl libclc/clc/lib/generic/math/clc_half_exp10.cl libclc/clc/lib/generic/math/clc_half_exp2.cl libclc/clc/lib/generic/math/clc_half_log.cl libclc/clc/lib/generic/math/clc_half_log10.cl libclc/clc/lib/generic/math/clc_half_log2.cl libclc/clc/lib/generic/math/clc_half_powr.cl libclc/clc/lib/generic/math/clc_half_recip.cl libclc/clc/lib/generic/math/clc_half_recip.inc libclc/clc/lib/generic/math/clc_half_rsqrt.cl libclc/clc/lib/generic/math/clc_half_sin.cl libclc/clc/lib/generic/math/clc_half_sqrt.cl libclc/clc/lib/generic/math/clc_half_tan.cl Modified: libclc/CMakeLists.txt libclc/clc/lib/amdgpu/SOURCES libclc/clc/lib/generic/SOURCES libclc/generic/lib/math/half_cos.cl libclc/generic/lib/math/half_divide.cl libclc/generic/lib/math/half_exp.cl libclc/generic/lib/math/half_exp10.cl libclc/generic/lib/math/half_exp2.cl libclc/generic/lib/math/half_log.cl libclc/generic/lib/math/half_log10.cl libclc/generic/lib/math/half_log2.cl libclc/generic/lib/math/half_powr.cl libclc/generic/lib/math/half_recip.cl libclc/generic/lib/math/half_rsqrt.cl libclc/generic/lib/math/half_sin.cl libclc/generic/lib/math/half_sqrt.cl libclc/generic/lib/math/half_tan.cl Removed: libclc/amdgpu/lib/SOURCES libclc/amdgpu/lib/math/half_exp.cl libclc/amdgpu/lib/math/half_exp10.cl libclc/amdgpu/lib/math/half_exp2.cl libclc/amdgpu/lib/math/half_log.cl libclc/amdgpu/lib/math/half_log10.cl libclc/amdgpu/lib/math/half_log2.cl libclc/amdgpu/lib/math/half_native_unary.inc libclc/amdgpu/lib/math/half_recip.cl libclc/amdgpu/lib/math/half_rsqrt.cl libclc/amdgpu/lib/math/half_sqrt.cl libclc/generic/lib/math/half_binary.inc libclc/generic/lib/math/half_unary.inc ################################################################################ diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt index 50ddfc3930cd3..b0e7aac6f8f36 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 ab5da40711aa4..0000000000000 --- 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 0000000000000..d0efc45793af9 --- /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 <clc/shared/unary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..5d1e7b9e33e39 --- /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 <clc/shared/binary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..e95f3d42085c8 --- /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 <clc/shared/unary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..e4cce6e63bf7a --- /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 <clc/shared/unary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..6fc99735f0928 --- /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 <clc/shared/unary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..e44e686499663 --- /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 <clc/shared/unary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..23e0ba116c728 --- /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 <clc/shared/unary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..8ea2439eb3db6 --- /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 <clc/shared/unary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..252bfcd785043 --- /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 <clc/shared/binary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..1adb0bbe249cc --- /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 <clc/shared/unary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..6342739ed6f20 --- /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 <clc/shared/unary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..31378d290fecc --- /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 <clc/shared/unary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..0e765fb3e7731 --- /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 <clc/shared/unary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 0000000000000..6c890a952522c --- /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 <clc/shared/unary_decl.inc> + +#include <clc/math/gentype.inc> + +#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 31e07b608c4cc..83b13bad9a4f0 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 4cc2b36bb132f..5fa9d0b9a9dea 100644 --- a/libclc/amdgpu/lib/math/half_exp.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_exp.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include <clc/clc.h> - +#include <clc/math/clc_native_exp.h> + #define __CLC_FUNC exp #define __FLOAT_ONLY -#define __CLC_BODY <half_native_unary.inc> +#define __CLC_BODY <clc_half_native_unary.inc> #include <clc/math/gentype.inc> 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 3bcdd2455ef31..5c119eb5a535c 100644 --- a/libclc/amdgpu/lib/math/half_exp10.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_exp10.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include <clc/clc.h> - +#include <clc/math/clc_native_exp10.h> + #define __CLC_FUNC exp10 #define __FLOAT_ONLY -#define __CLC_BODY <half_native_unary.inc> +#define __CLC_BODY <clc_half_native_unary.inc> #include <clc/math/gentype.inc> 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 0000000000000..9750d5008986b --- /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 <clc/internal/clc.h> +#include <clc/math/clc_native_exp2.h> + +#define __CLC_FUNC exp2 +#define __FLOAT_ONLY +#define __CLC_BODY <clc_half_native_unary.inc> +#include <clc/math/gentype.inc> 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 d0e924ca97207..ea19bd5a4c7a7 100644 --- a/libclc/amdgpu/lib/math/half_log.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_log.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include <clc/clc.h> - +#include <clc/math/clc_native_log.h> + #define __CLC_FUNC log #define __FLOAT_ONLY -#define __CLC_BODY <half_native_unary.inc> +#define __CLC_BODY <clc_half_native_unary.inc> #include <clc/math/gentype.inc> 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 2f3b26e1084ad..af3a2695396db 100644 --- a/libclc/amdgpu/lib/math/half_log10.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_log10.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include <clc/clc.h> - +#include <clc/math/clc_native_log10.h> + #define __CLC_FUNC log10 #define __FLOAT_ONLY -#define __CLC_BODY <half_native_unary.inc> +#define __CLC_BODY <clc_half_native_unary.inc> #include <clc/math/gentype.inc> 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 9b417fb474ae6..81795f012c77d 100644 --- a/libclc/amdgpu/lib/math/half_log2.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_log2.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include <clc/clc.h> - +#include <clc/math/clc_native_log2.h> + #define __CLC_FUNC log2 #define __FLOAT_ONLY -#define __CLC_BODY <half_native_unary.inc> +#define __CLC_BODY <clc_half_native_unary.inc> #include <clc/math/gentype.inc> 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 6ecad7eb483c0..d62343400f2c4 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 <clc/utils.h> -#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 87d56c8fbafcb..edbec07e44841 100644 --- a/libclc/amdgpu/lib/math/half_recip.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_recip.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include <clc/clc.h> - +#include <clc/math/clc_native_recip.h> + #define __CLC_FUNC recip #define __FLOAT_ONLY -#define __CLC_BODY <half_native_unary.inc> +#define __CLC_BODY <clc_half_native_unary.inc> #include <clc/math/gentype.inc> 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 099363a913071..c0a5489ec8fc0 100644 --- a/libclc/amdgpu/lib/math/half_rsqrt.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_rsqrt.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include <clc/clc.h> - +#include <clc/math/clc_native_rsqrt.h> + #define __CLC_FUNC rsqrt #define __FLOAT_ONLY -#define __CLC_BODY <half_native_unary.inc> +#define __CLC_BODY <clc_half_native_unary.inc> #include <clc/math/gentype.inc> 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 f7ae5b4d589e9..4dc6fa31f21a7 100644 --- a/libclc/amdgpu/lib/math/half_sqrt.cl +++ b/libclc/clc/lib/amdgpu/math/clc_half_sqrt.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include <clc/clc.h> - +#include <clc/math/clc_native_sqrt.h> + #define __CLC_FUNC sqrt #define __FLOAT_ONLY -#define __CLC_BODY <half_native_unary.inc> +#define __CLC_BODY <clc_half_native_unary.inc> #include <clc/math/gentype.inc> diff --git a/libclc/clc/lib/generic/SOURCES b/libclc/clc/lib/generic/SOURCES index 0a839e885e391..2fffc5bbe7afd 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 0000000000000..c2064a00232f4 --- /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 <clc/math/clc_cos.h> + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_cos +#define __CLC_FUNCTION(x) __clc_cos +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> 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 d9efb27a7c574..88676a4ac7856 100644 --- a/libclc/amdgpu/lib/math/half_exp2.cl +++ b/libclc/clc/lib/generic/math/clc_half_divide.cl @@ -6,9 +6,9 @@ // //===----------------------------------------------------------------------===// -#include <clc/clc.h> - -#define __CLC_FUNC exp2 +#include <clc/internal/clc.h> + #define __FLOAT_ONLY -#define __CLC_BODY <half_native_unary.inc> +#define __CLC_BODY <clc_half_divide.inc> + #include <clc/math/gentype.inc> 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 0000000000000..27fdb183dded9 --- /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 0000000000000..88336f9df011d --- /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 <clc/math/clc_exp.h> + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_exp +#define __CLC_FUNCTION(x) __clc_exp +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> 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 0000000000000..b3c0001a85278 --- /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 <clc/math/clc_exp10.h> + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_exp10 +#define __CLC_FUNCTION(x) __clc_exp10 +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> 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 0000000000000..f3ffcc6876b94 --- /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 <clc/math/clc_exp2.h> + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_exp2 +#define __CLC_FUNCTION(x) __clc_exp2 +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> 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 0000000000000..7371344ab2d1c --- /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 <clc/math/clc_log.h> + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_log +#define __CLC_FUNCTION(x) __clc_log +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> 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 0000000000000..e9becad210ea9 --- /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 <clc/math/clc_log10.h> + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_log10 +#define __CLC_FUNCTION(x) __clc_log10 +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> 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 0000000000000..aa8d838afad7c --- /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 <clc/math/clc_log2.h> + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_log2 +#define __CLC_FUNCTION(x) __clc_log2 +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> 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 0000000000000..ade6731db1434 --- /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 <clc/math/clc_powr.h> + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_powr +#define __CLC_FUNCTION(x) __clc_powr +#define __CLC_BODY <clc/shared/binary_def.inc> + +#include <clc/math/gentype.inc> 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 0000000000000..0ae1e922d489f --- /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 <clc_half_recip.inc> + +#include <clc/math/gentype.inc> 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 0000000000000..24ededc8e5c7a --- /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 0000000000000..07daf7fc36234 --- /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 <clc/math/clc_rsqrt.h> + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_rsqrt +#define __CLC_FUNCTION(x) __clc_rsqrt +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> 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 0000000000000..c0af5e7bf4717 --- /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 <clc/math/clc_sin.h> + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_sin +#define __CLC_FUNCTION(x) __clc_sin +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> 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 0000000000000..b6b5097e965c5 --- /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 <clc/math/clc_sqrt.h> + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_sqrt +#define __CLC_FUNCTION(x) __clc_sqrt +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> 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 0000000000000..ca27f3c662aad --- /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 <clc/math/clc_tan.h> + +#define __FLOAT_ONLY +#define FUNCTION __clc_half_tan +#define __CLC_FUNCTION(x) __clc_tan +#define __CLC_BODY <clc/shared/unary_def.inc> + +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_binary.inc b/libclc/generic/lib/math/half_binary.inc deleted file mode 100644 index adb97f3ad2a26..0000000000000 --- 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 <clc/utils.h> - -#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 2120aa0f45852..1e49ebe8ce73a 100644 --- a/libclc/generic/lib/math/half_cos.cl +++ b/libclc/generic/lib/math/half_cos.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_cos.h> -#define __CLC_FUNC cos -#define __CLC_BODY <half_unary.inc> #define __FLOAT_ONLY +#define FUNCTION half_cos +#define __CLC_BODY <clc/shared/unary_def.inc> + #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_divide.cl b/libclc/generic/lib/math/half_divide.cl index 945e2120995fa..29b5679f428e0 100644 --- a/libclc/generic/lib/math/half_divide.cl +++ b/libclc/generic/lib/math/half_divide.cl @@ -7,11 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_divide.h> -#define divide(x,y) (x/y) - -#define __CLC_FUNC divide -#define __CLC_BODY <half_binary.inc> #define __FLOAT_ONLY +#define FUNCTION half_divide +#define __CLC_BODY <clc/shared/binary_def.inc> + #include <clc/math/gentype.inc> -#undef divide diff --git a/libclc/generic/lib/math/half_exp.cl b/libclc/generic/lib/math/half_exp.cl index 1f5b0b32f4970..219b262190104 100644 --- a/libclc/generic/lib/math/half_exp.cl +++ b/libclc/generic/lib/math/half_exp.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_exp.h> -#define __CLC_FUNC exp -#define __CLC_BODY <half_unary.inc> #define __FLOAT_ONLY +#define FUNCTION half_exp +#define __CLC_BODY <clc/shared/unary_def.inc> + #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_exp10.cl b/libclc/generic/lib/math/half_exp10.cl index 83e4535be98a2..64132c0f93988 100644 --- a/libclc/generic/lib/math/half_exp10.cl +++ b/libclc/generic/lib/math/half_exp10.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_exp10.h> -#define __CLC_FUNC exp10 -#define __CLC_BODY <half_unary.inc> #define __FLOAT_ONLY +#define FUNCTION half_exp10 +#define __CLC_BODY <clc/shared/unary_def.inc> + #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_exp2.cl b/libclc/generic/lib/math/half_exp2.cl index 229b007d04194..9fddc5eb096eb 100644 --- a/libclc/generic/lib/math/half_exp2.cl +++ b/libclc/generic/lib/math/half_exp2.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_exp2.h> -#define __CLC_FUNC exp2 -#define __CLC_BODY <half_unary.inc> #define __FLOAT_ONLY +#define FUNCTION half_exp2 +#define __CLC_BODY <clc/shared/unary_def.inc> + #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_log.cl b/libclc/generic/lib/math/half_log.cl index 3df6173daf934..b3d2c27117763 100644 --- a/libclc/generic/lib/math/half_log.cl +++ b/libclc/generic/lib/math/half_log.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_log.h> -#define __CLC_FUNC log -#define __CLC_BODY <half_unary.inc> #define __FLOAT_ONLY +#define FUNCTION half_log +#define __CLC_BODY <clc/shared/unary_def.inc> + #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_log10.cl b/libclc/generic/lib/math/half_log10.cl index 84d46facb7dc6..8ef6d463b3f97 100644 --- a/libclc/generic/lib/math/half_log10.cl +++ b/libclc/generic/lib/math/half_log10.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_log10.h> -#define __CLC_FUNC log10 -#define __CLC_BODY <half_unary.inc> #define __FLOAT_ONLY +#define FUNCTION half_log10 +#define __CLC_BODY <clc/shared/unary_def.inc> + #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_log2.cl b/libclc/generic/lib/math/half_log2.cl index a46d25821899a..a343dbae36d7b 100644 --- a/libclc/generic/lib/math/half_log2.cl +++ b/libclc/generic/lib/math/half_log2.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_log2.h> -#define __CLC_FUNC log2 -#define __CLC_BODY <half_unary.inc> #define __FLOAT_ONLY +#define FUNCTION half_log2 +#define __CLC_BODY <clc/shared/unary_def.inc> + #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_powr.cl b/libclc/generic/lib/math/half_powr.cl index 765dd584c0454..03c4ca7a01775 100644 --- a/libclc/generic/lib/math/half_powr.cl +++ b/libclc/generic/lib/math/half_powr.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_powr.h> -#define __CLC_FUNC powr -#define __CLC_BODY <half_binary.inc> #define __FLOAT_ONLY +#define FUNCTION half_powr +#define __CLC_BODY <clc/shared/binary_def.inc> + #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_recip.cl b/libclc/generic/lib/math/half_recip.cl index 31273806180f5..70f7625c43f5c 100644 --- a/libclc/generic/lib/math/half_recip.cl +++ b/libclc/generic/lib/math/half_recip.cl @@ -7,12 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_recip.h> -#define recip(x) (1.0f/x) - -#define __CLC_FUNC recip -#define __CLC_BODY <half_unary.inc> #define __FLOAT_ONLY -#include <clc/math/gentype.inc> +#define FUNCTION half_recip +#define __CLC_BODY <clc/shared/unary_def.inc> -#undef recip +#include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_rsqrt.cl b/libclc/generic/lib/math/half_rsqrt.cl index 71b20888e82ba..3fc788d80906a 100644 --- a/libclc/generic/lib/math/half_rsqrt.cl +++ b/libclc/generic/lib/math/half_rsqrt.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_rsqrt.h> -#define __CLC_FUNC rsqrt -#define __CLC_BODY <half_unary.inc> #define __FLOAT_ONLY +#define FUNCTION half_rsqrt +#define __CLC_BODY <clc/shared/unary_def.inc> + #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_sin.cl b/libclc/generic/lib/math/half_sin.cl index 257abcd9a1573..6fab611610fb0 100644 --- a/libclc/generic/lib/math/half_sin.cl +++ b/libclc/generic/lib/math/half_sin.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_sin.h> -#define __CLC_FUNC sin -#define __CLC_BODY <half_unary.inc> #define __FLOAT_ONLY +#define FUNCTION half_sin +#define __CLC_BODY <clc/shared/unary_def.inc> + #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_sqrt.cl b/libclc/generic/lib/math/half_sqrt.cl index 70ad80c76c847..e96e127a89b3e 100644 --- a/libclc/generic/lib/math/half_sqrt.cl +++ b/libclc/generic/lib/math/half_sqrt.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_sqrt.h> -#define __CLC_FUNC sqrt -#define __CLC_BODY <half_unary.inc> #define __FLOAT_ONLY +#define FUNCTION half_sqrt +#define __CLC_BODY <clc/shared/unary_def.inc> + #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_tan.cl b/libclc/generic/lib/math/half_tan.cl index 12bf779c5965b..ddfcfae4ff994 100644 --- a/libclc/generic/lib/math/half_tan.cl +++ b/libclc/generic/lib/math/half_tan.cl @@ -7,8 +7,10 @@ //===----------------------------------------------------------------------===// #include <clc/clc.h> +#include <clc/math/clc_half_tan.h> -#define __CLC_FUNC tan -#define __CLC_BODY <half_unary.inc> #define __FLOAT_ONLY +#define FUNCTION half_tan +#define __CLC_BODY <clc/shared/unary_def.inc> + #include <clc/math/gentype.inc> diff --git a/libclc/generic/lib/math/half_unary.inc b/libclc/generic/lib/math/half_unary.inc deleted file mode 100644 index 5fddb3c2acec1..0000000000000 --- 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 <clc/utils.h> - -#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 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits