[libclc] Move 'half' builtins to CLC library (#139563)

There are no changes to the generated bytecode.
This commit is contained in:
Fraser Cormack
2025-05-12 17:32:05 +01:00
committed by GitHub
parent 4f0be9414c
commit dd89af7f55
60 changed files with 648 additions and 111 deletions

View File

@@ -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;

View File

@@ -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

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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__

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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;
}

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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;
}

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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

View File

@@ -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>

View File

@@ -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

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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