diff --git a/libclc/CMakeLists.txt b/libclc/CMakeLists.txt index 745e2dda554df..b1f73e0896cb9 100644 --- a/libclc/CMakeLists.txt +++ b/libclc/CMakeLists.txt @@ -164,9 +164,9 @@ install( DIRECTORY generic/include/clc DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) if( ENABLE_RUNTIME_SUBNORMAL ) add_library( subnormal_use_default STATIC - generic/lib/subnormal_use_default.ll ) + generic/libspirv/subnormal_use_default.ll ) add_library( subnormal_disable STATIC - generic/lib/subnormal_disable.ll ) + generic/libspirv/subnormal_disable.ll ) install( TARGETS subnormal_use_default subnormal_disable ARCHIVE DESTINATION ${CMAKE_INSTALL_DATADIR}/clc ) endif() diff --git a/libclc/generic/include/clc/geometric/floatn.inc b/libclc/generic/include/clc/geometric/floatn.inc index 49c797f9f1845..2c90a7a33b9d5 100644 --- a/libclc/generic/include/clc/geometric/floatn.inc +++ b/libclc/generic/include/clc/geometric/floatn.inc @@ -1,3 +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 +// +//===----------------------------------------------------------------------===// + #define __CLC_FLOAT float #define __CLC_FPSIZE 32 diff --git a/libclc/generic/include/spirv/common/mix.h b/libclc/generic/include/spirv/common/mix.h deleted file mode 100644 index 27d55afbb2989..0000000000000 --- a/libclc/generic/include/spirv/common/mix.h +++ /dev/null @@ -1,10 +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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#include diff --git a/libclc/generic/include/spirv/common/mix.inc b/libclc/generic/include/spirv/common/mix.inc deleted file mode 100644 index b6623aa8e347b..0000000000000 --- a/libclc/generic/include/spirv/common/mix.inc +++ /dev/null @@ -1,13 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL __SPIRV_GENTYPE __spirv_ocl_mix(__SPIRV_GENTYPE a, __SPIRV_GENTYPE b, __SPIRV_GENTYPE c); - -#ifndef __SPIRV_SCALAR -_CLC_OVERLOAD _CLC_DECL __SPIRV_GENTYPE __spirv_ocl_mix(__SPIRV_GENTYPE a, __SPIRV_GENTYPE b, __SPIRV_SCALAR_GENTYPE c); -#endif diff --git a/libclc/generic/include/spirv/common/radians.h b/libclc/generic/include/spirv/common/radians.h deleted file mode 100644 index afb1a84af5cba..0000000000000 --- a/libclc/generic/include/spirv/common/radians.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#include -#undef __SPIRV_BODY diff --git a/libclc/generic/include/spirv/common/sign.h b/libclc/generic/include/spirv/common/sign.h deleted file mode 100644 index 2f7e7acf60d65..0000000000000 --- a/libclc/generic/include/spirv/common/sign.h +++ /dev/null @@ -1,13 +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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_FUNCTION __spirv_ocl_sign -#define __SPIRV_BODY -#include -#undef __SPIRV_FUNCTION -#undef __SPIRV_BODY diff --git a/libclc/generic/include/spirv/common/smoothstep.h b/libclc/generic/include/spirv/common/smoothstep.h deleted file mode 100644 index c02178b050b79..0000000000000 --- a/libclc/generic/include/spirv/common/smoothstep.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#include -#undef __SPIRV_BODY diff --git a/libclc/generic/include/spirv/common/smoothstep.inc b/libclc/generic/include/spirv/common/smoothstep.inc deleted file mode 100644 index bda0e18fefc39..0000000000000 --- a/libclc/generic/include/spirv/common/smoothstep.inc +++ /dev/null @@ -1,14 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL __SPIRV_GENTYPE __spirv_ocl_smoothstep(__SPIRV_GENTYPE edge0, __SPIRV_GENTYPE edge1, __SPIRV_GENTYPE x); -_CLC_OVERLOAD _CLC_DECL __SPIRV_GENTYPE __spirv_ocl_smoothstep(float edge0, float edge1, __SPIRV_GENTYPE x); - -#ifdef cl_khr_fp64 -_CLC_OVERLOAD _CLC_DECL __SPIRV_GENTYPE __spirv_ocl_smoothstep(double edge0, double edge1, __SPIRV_GENTYPE x); -#endif diff --git a/libclc/generic/include/spirv/common/step.h b/libclc/generic/include/spirv/common/step.h deleted file mode 100644 index 47b683b22adfc..0000000000000 --- a/libclc/generic/include/spirv/common/step.h +++ /dev/null @@ -1,11 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#include -#undef __SPIRV_BODY diff --git a/libclc/generic/include/spirv/common/step.inc b/libclc/generic/include/spirv/common/step.inc deleted file mode 100644 index dbbf85814ca87..0000000000000 --- a/libclc/generic/include/spirv/common/step.inc +++ /dev/null @@ -1,14 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL __SPIRV_GENTYPE __spirv_ocl_step(__SPIRV_GENTYPE edge, __SPIRV_GENTYPE x); -_CLC_OVERLOAD _CLC_DECL __SPIRV_GENTYPE __spirv_ocl_step(float edge, __SPIRV_GENTYPE x); - -#ifdef cl_khr_fp64 -_CLC_OVERLOAD _CLC_DECL __SPIRV_GENTYPE __spirv_ocl_step(double edge, __SPIRV_GENTYPE x); -#endif diff --git a/libclc/generic/include/spirv/geometric/cross.h b/libclc/generic/include/spirv/geometric/cross.h deleted file mode 100644 index 6a677f7dee3c3..0000000000000 --- a/libclc/generic/include/spirv/geometric/cross.h +++ /dev/null @@ -1,15 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL float3 __spirv_ocl_cross(float3 p0, float3 p1); -_CLC_OVERLOAD _CLC_DECL float4 __spirv_ocl_cross(float4 p0, float4 p1); - -#ifdef cl_khr_fp64 -_CLC_OVERLOAD _CLC_DECL double3 __spirv_ocl_cross(double3 p0, double3 p1); -_CLC_OVERLOAD _CLC_DECL double4 __spirv_ocl_cross(double4 p0, double4 p1); -#endif diff --git a/libclc/generic/include/spirv/geometric/distance.h b/libclc/generic/include/spirv/geometric/distance.h deleted file mode 100644 index de81e46b5ffc4..0000000000000 --- a/libclc/generic/include/spirv/geometric/distance.h +++ /dev/null @@ -1,10 +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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#include diff --git a/libclc/generic/include/spirv/geometric/dot.h b/libclc/generic/include/spirv/geometric/dot.h deleted file mode 100644 index e15915da1c354..0000000000000 --- a/libclc/generic/include/spirv/geometric/dot.h +++ /dev/null @@ -1,10 +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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#include diff --git a/libclc/generic/include/spirv/geometric/dot.inc b/libclc/generic/include/spirv/geometric/dot.inc deleted file mode 100644 index 86bfdfc19b7f6..0000000000000 --- a/libclc/generic/include/spirv/geometric/dot.inc +++ /dev/null @@ -1,9 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL __SPIRV_FLOAT __spirv_Dot(__SPIRV_FLOATN p0, __SPIRV_FLOATN p1); diff --git a/libclc/generic/include/spirv/geometric/fast_length.h b/libclc/generic/include/spirv/geometric/fast_length.h deleted file mode 100644 index 3ce79890f7e3a..0000000000000 --- a/libclc/generic/include/spirv/geometric/fast_length.h +++ /dev/null @@ -1,12 +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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#define __FLOAT_ONLY -#include -#undef __FLOAT_ONLY diff --git a/libclc/generic/include/spirv/geometric/fast_length.inc b/libclc/generic/include/spirv/geometric/fast_length.inc deleted file mode 100644 index 83dfa1dc18e1f..0000000000000 --- a/libclc/generic/include/spirv/geometric/fast_length.inc +++ /dev/null @@ -1,9 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL __SPIRV_FLOAT __spirv_ocl_fast_length(__SPIRV_FLOATN p0); diff --git a/libclc/generic/include/spirv/geometric/fast_normalize.h b/libclc/generic/include/spirv/geometric/fast_normalize.h deleted file mode 100644 index b6194a663f5a3..0000000000000 --- a/libclc/generic/include/spirv/geometric/fast_normalize.h +++ /dev/null @@ -1,12 +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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#define __FLOAT_ONLY -#include -#undef __FLOAT_ONLY diff --git a/libclc/generic/include/spirv/geometric/fast_normalize.inc b/libclc/generic/include/spirv/geometric/fast_normalize.inc deleted file mode 100644 index b226fce367aad..0000000000000 --- a/libclc/generic/include/spirv/geometric/fast_normalize.inc +++ /dev/null @@ -1,9 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL __SPIRV_FLOATN __spirv_ocl_fast_normalize(__SPIRV_FLOATN p); diff --git a/libclc/generic/include/spirv/geometric/floatn.inc b/libclc/generic/include/spirv/geometric/floatn.inc deleted file mode 100644 index b0c024c656ddd..0000000000000 --- a/libclc/generic/include/spirv/geometric/floatn.inc +++ /dev/null @@ -1,95 +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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_FLOAT float -#define __SPIRV_FPSIZE 32 - -#define __SPIRV_FLOATN float -#define __SPIRV_SCALAR -#include __SPIRV_BODY -#undef __SPIRV_FLOATN -#undef __SPIRV_SCALAR - -#define __SPIRV_FLOATN float2 -#include __SPIRV_BODY -#undef __SPIRV_FLOATN - -#define __SPIRV_FLOATN float3 -#include __SPIRV_BODY -#undef __SPIRV_FLOATN - -#define __SPIRV_FLOATN float4 -#include __SPIRV_BODY -#undef __SPIRV_FLOATN - -#undef __SPIRV_FLOAT -#undef __SPIRV_FPSIZE - -#ifndef __FLOAT_ONLY -#ifdef cl_khr_fp64 -#pragma OPENCL EXTENSION cl_khr_fp64 : enable - -#define __SPIRV_FLOAT double -#define __SPIRV_FPSIZE 64 - -#define __SPIRV_FLOATN double -#define __SPIRV_SCALAR -#include __SPIRV_BODY -#undef __SPIRV_FLOATN -#undef __SPIRV_SCALAR - -#define __SPIRV_FLOATN double2 -#include __SPIRV_BODY -#undef __SPIRV_FLOATN - -#define __SPIRV_FLOATN double3 -#include __SPIRV_BODY -#undef __SPIRV_FLOATN - -#define __SPIRV_FLOATN double4 -#include __SPIRV_BODY -#undef __SPIRV_FLOATN - -#undef __SPIRV_FLOAT -#undef __SPIRV_FPSIZE - -#endif -#endif - -#ifndef __FLOAT_ONLY -#ifdef cl_khr_fp16 -#pragma OPENCL EXTENSION cl_khr_fp16 : enable - -#define __SPIRV_FLOAT half -#define __SPIRV_FPSIZE 16 - -#define __SPIRV_FLOATN half -#define __SPIRV_SCALAR -#include __SPIRV_BODY -#undef __SPIRV_FLOATN -#undef __SPIRV_SCALAR - -#define __SPIRV_FLOATN half2 -#include __SPIRV_BODY -#undef __SPIRV_FLOATN - -#define __SPIRV_FLOATN half3 -#include __SPIRV_BODY -#undef __SPIRV_FLOATN - -#define __SPIRV_FLOATN half4 -#include __SPIRV_BODY -#undef __SPIRV_FLOATN - -#undef __SPIRV_FLOAT -#undef __SPIRV_FPSIZE - -#endif -#endif - -#undef __SPIRV_BODY diff --git a/libclc/generic/include/spirv/geometric/length.h b/libclc/generic/include/spirv/geometric/length.h deleted file mode 100644 index 054ab502dc7c3..0000000000000 --- a/libclc/generic/include/spirv/geometric/length.h +++ /dev/null @@ -1,10 +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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#include diff --git a/libclc/generic/include/spirv/geometric/length.inc b/libclc/generic/include/spirv/geometric/length.inc deleted file mode 100644 index 7b4323db2759c..0000000000000 --- a/libclc/generic/include/spirv/geometric/length.inc +++ /dev/null @@ -1,9 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL __SPIRV_FLOAT __spirv_ocl_length(__SPIRV_FLOATN p0); diff --git a/libclc/generic/include/spirv/geometric/normalize.h b/libclc/generic/include/spirv/geometric/normalize.h deleted file mode 100644 index 453f65c9640b4..0000000000000 --- a/libclc/generic/include/spirv/geometric/normalize.h +++ /dev/null @@ -1,10 +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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#include diff --git a/libclc/generic/include/spirv/geometric/normalize.inc b/libclc/generic/include/spirv/geometric/normalize.inc deleted file mode 100644 index 83aa330213c05..0000000000000 --- a/libclc/generic/include/spirv/geometric/normalize.inc +++ /dev/null @@ -1,9 +0,0 @@ -//===----------------------------------------------------------------------===// -// -// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. -// See https://llvm.org/LICENSE.txt for license information. -// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -// -//===----------------------------------------------------------------------===// - -_CLC_OVERLOAD _CLC_DECL __SPIRV_FLOATN __spirv_ocl_normalize(__SPIRV_FLOATN p); diff --git a/libclc/generic/include/spirv/math/copysign.h b/libclc/generic/include/spirv/math/copysign.h deleted file mode 100644 index b17cea40415b6..0000000000000 --- a/libclc/generic/include/spirv/math/copysign.h +++ /dev/null @@ -1,15 +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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_FUNCTION __spirv_ocl_copysign -#define __SPIRV_BODY - -#include - -#undef __SPIRV_BODY -#undef __SPIRV_FUNCTION diff --git a/libclc/generic/include/spirv/math/half_rsqrt.h b/libclc/generic/include/spirv/math/half_rsqrt.h deleted file mode 100644 index 9365f18730f5a..0000000000000 --- a/libclc/generic/include/spirv/math/half_rsqrt.h +++ /dev/null @@ -1,15 +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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#define __SPIRV_FUNCTION __spirv_ocl_half_rsqrt -#define __FLOAT_ONLY -#include -#undef __FLOAT_ONLY -#undef __SPIRV_BODY -#undef __SPIRV_FUNCTION diff --git a/libclc/generic/include/spirv/math/half_sqrt.h b/libclc/generic/include/spirv/math/half_sqrt.h deleted file mode 100644 index 69e1d01dfb28d..0000000000000 --- a/libclc/generic/include/spirv/math/half_sqrt.h +++ /dev/null @@ -1,15 +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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#define __SPIRV_FUNCTION __spirv_ocl_half_sqrt -#define __FLOAT_ONLY -#include -#undef __FLOAT_ONLY -#undef __SPIRV_BODY -#undef __SPIRV_FUNCTION diff --git a/libclc/generic/include/spirv/math/native_sqrt.h b/libclc/generic/include/spirv/math/native_sqrt.h deleted file mode 100644 index 44f4095bbce28..0000000000000 --- a/libclc/generic/include/spirv/math/native_sqrt.h +++ /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 -// -//===----------------------------------------------------------------------===// - -#define __SPIRV_BODY -#define __SPIRV_FUNCTION __spirv_ocl_native_sqrt -#define __FLOAT_ONLY - -#include - -#undef __FLOAT_ONLY -#undef __SPIRV_BODY -#undef __SPIRV_FUNCTION diff --git a/libclc/generic/include/spirv/math/rsqrt.h b/libclc/generic/include/spirv/math/rsqrt.h deleted file mode 100644 index 7ee5f3ab8f2bc..0000000000000 --- a/libclc/generic/include/spirv/math/rsqrt.h +++ /dev/null @@ -1,9 +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 -// -//===----------------------------------------------------------------------===// - -#define __spirv_ocl_rsqrt(x) (1.f/__spirv_ocl_sqrt(x)) diff --git a/libclc/generic/include/spirv/spirv.h b/libclc/generic/include/spirv/spirv.h index 6b966a00e0d4a..4f110280be140 100644 --- a/libclc/generic/include/spirv/spirv.h +++ b/libclc/generic/include/spirv/spirv.h @@ -59,17 +59,16 @@ #include #include #include -#include +#include #include #include #include -#include #include #include #include -#include #include #include +#include #include #include #include @@ -89,9 +88,7 @@ #include #include #include -#include #include -#include #include #include #include @@ -108,6 +105,18 @@ #include #include #include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -121,27 +130,11 @@ #include #include #include -#include #include #include #include #include #include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include /* 6.11.2.1 Floating-point macros */ #include @@ -149,24 +142,6 @@ /* 6.11.3 Integer Definitions */ #include -/* 6.11.4 Common Functions */ -#include -#include -#include -#include -#include -#include - -/* 6.11.5 Geometric Functions */ -#include -#include -#include -#include -#include -#include -#include -#include - /* 6.11.11 Atomic Functions */ #include #include diff --git a/libclc/generic/include/spirv/spirv_builtins.h b/libclc/generic/include/spirv/spirv_builtins.h index e7919cf9a9d30..7700ee4f05132 100644 --- a/libclc/generic/include/spirv/spirv_builtins.h +++ b/libclc/generic/include/spirv/spirv_builtins.h @@ -6,6 +6,10 @@ // //===----------------------------------------------------------------------===// +// +// Automatically generated file, do not edit! +// + #include #include @@ -8266,6 +8270,43 @@ _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t __spirv_ConvertUToF_Rhalf_rtz(__clc_uint64_t); #endif +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_Dot(__clc_vec2_fp32_t, __clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_Dot(__clc_vec3_fp32_t, __clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_Dot(__clc_vec4_fp32_t, __clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_Dot(__clc_vec8_fp32_t, __clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_Dot(__clc_vec16_fp32_t, __clc_vec16_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t + __spirv_Dot(__clc_vec2_fp64_t, __clc_vec2_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t + __spirv_Dot(__clc_vec3_fp64_t, __clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t + __spirv_Dot(__clc_vec4_fp64_t, __clc_vec4_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t + __spirv_Dot(__clc_vec8_fp64_t, __clc_vec8_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t + __spirv_Dot(__clc_vec16_fp64_t, __clc_vec16_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t + __spirv_Dot(__clc_vec2_fp16_t, __clc_vec2_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t + __spirv_Dot(__clc_vec3_fp16_t, __clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t + __spirv_Dot(__clc_vec4_fp16_t, __clc_vec4_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t + __spirv_Dot(__clc_vec8_fp16_t, __clc_vec8_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t + __spirv_Dot(__clc_vec16_fp16_t, __clc_vec16_fp16_t); +#endif + #ifdef cl_khr_fp64 _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t __spirv_FConvert_Rdouble(__clc_fp32_t); @@ -12643,6 +12684,68 @@ _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_uint64_t _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_uint64_t __spirv_ocl_clz(__clc_vec16_uint64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_copysign(__clc_fp32_t, __clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_copysign(__clc_vec2_fp32_t, __clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_copysign(__clc_vec3_fp32_t, __clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_copysign(__clc_vec4_fp32_t, __clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t + __spirv_ocl_copysign(__clc_vec8_fp32_t, __clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t + __spirv_ocl_copysign(__clc_vec16_fp32_t, __clc_vec16_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t + __spirv_ocl_copysign(__clc_fp64_t, __clc_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp64_t + __spirv_ocl_copysign(__clc_vec2_fp64_t, __clc_vec2_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp64_t + __spirv_ocl_copysign(__clc_vec3_fp64_t, __clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp64_t + __spirv_ocl_copysign(__clc_vec4_fp64_t, __clc_vec4_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp64_t + __spirv_ocl_copysign(__clc_vec8_fp64_t, __clc_vec8_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp64_t + __spirv_ocl_copysign(__clc_vec16_fp64_t, __clc_vec16_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t + __spirv_ocl_copysign(__clc_fp16_t, __clc_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp16_t + __spirv_ocl_copysign(__clc_vec2_fp16_t, __clc_vec2_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp16_t + __spirv_ocl_copysign(__clc_vec3_fp16_t, __clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp16_t + __spirv_ocl_copysign(__clc_vec4_fp16_t, __clc_vec4_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp16_t + __spirv_ocl_copysign(__clc_vec8_fp16_t, __clc_vec8_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp16_t + __spirv_ocl_copysign(__clc_vec16_fp16_t, __clc_vec16_fp16_t); +#endif + +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_cross(__clc_vec3_fp32_t, __clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_cross(__clc_vec4_fp32_t, __clc_vec4_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp64_t + __spirv_ocl_cross(__clc_vec3_fp64_t, __clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp64_t + __spirv_ocl_cross(__clc_vec4_fp64_t, __clc_vec4_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp16_t + __spirv_ocl_cross(__clc_vec3_fp16_t, __clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp16_t + __spirv_ocl_cross(__clc_vec4_fp16_t, __clc_vec4_fp16_t); +#endif + _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_char_t __spirv_ocl_ctz(__clc_char_t); _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_char_t __spirv_ocl_ctz(__clc_vec2_char_t); @@ -12750,6 +12853,107 @@ _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_uint64_t _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_uint64_t __spirv_ocl_ctz(__clc_vec16_uint64_t); +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_degrees(__clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_degrees(__clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_degrees(__clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_degrees(__clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t + __spirv_ocl_degrees(__clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t + __spirv_ocl_degrees(__clc_vec16_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp64_t __spirv_ocl_degrees(__clc_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp64_t + __spirv_ocl_degrees(__clc_vec2_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp64_t + __spirv_ocl_degrees(__clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp64_t + __spirv_ocl_degrees(__clc_vec4_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp64_t + __spirv_ocl_degrees(__clc_vec8_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp64_t + __spirv_ocl_degrees(__clc_vec16_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp16_t __spirv_ocl_degrees(__clc_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp16_t + __spirv_ocl_degrees(__clc_vec2_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp16_t + __spirv_ocl_degrees(__clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp16_t + __spirv_ocl_degrees(__clc_vec4_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp16_t + __spirv_ocl_degrees(__clc_vec8_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp16_t + __spirv_ocl_degrees(__clc_vec16_fp16_t); +#endif + +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_distance(__clc_fp32_t, __clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_distance(__clc_vec2_fp32_t, __clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_distance(__clc_vec3_fp32_t, __clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_distance(__clc_vec4_fp32_t, __clc_vec4_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t + __spirv_ocl_distance(__clc_fp64_t, __clc_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t + __spirv_ocl_distance(__clc_vec2_fp64_t, __clc_vec2_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t + __spirv_ocl_distance(__clc_vec3_fp64_t, __clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t + __spirv_ocl_distance(__clc_vec4_fp64_t, __clc_vec4_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t + __spirv_ocl_distance(__clc_fp16_t, __clc_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t + __spirv_ocl_distance(__clc_vec2_fp16_t, __clc_vec2_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t + __spirv_ocl_distance(__clc_vec3_fp16_t, __clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t + __spirv_ocl_distance(__clc_vec4_fp16_t, __clc_vec4_fp16_t); +#endif + +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_fast_distance(__clc_fp32_t, __clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_fast_distance(__clc_vec2_fp32_t, __clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_fast_distance(__clc_vec3_fp32_t, __clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_fast_distance(__clc_vec4_fp32_t, __clc_vec4_fp32_t); + +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_fast_length(__clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_fast_length(__clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_fast_length(__clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_fast_length(__clc_vec4_fp32_t); + +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_fast_normalize(__clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_fast_normalize(__clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_fast_normalize(__clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_fast_normalize(__clc_vec4_fp32_t); + _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_fclamp(__clc_fp32_t, __clc_fp32_t, __clc_fp32_t); _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t @@ -12793,6 +12997,166 @@ _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp16_t __spirv_ocl_fclamp( __clc_vec16_fp16_t, __clc_vec16_fp16_t, __clc_vec16_fp16_t); #endif +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_half_rsqrt(__clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_half_rsqrt(__clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_half_rsqrt(__clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_half_rsqrt(__clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t + __spirv_ocl_half_rsqrt(__clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t + __spirv_ocl_half_rsqrt(__clc_vec16_fp32_t); + +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_half_sqrt(__clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_half_sqrt(__clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_half_sqrt(__clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_half_sqrt(__clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t + __spirv_ocl_half_sqrt(__clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t + __spirv_ocl_half_sqrt(__clc_vec16_fp32_t); + +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_length(__clc_fp32_t); +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_length(__clc_vec2_fp32_t); +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_length(__clc_vec3_fp32_t); +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_length(__clc_vec4_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp64_t __spirv_ocl_length(__clc_fp64_t); +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp64_t __spirv_ocl_length(__clc_vec2_fp64_t); +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp64_t __spirv_ocl_length(__clc_vec3_fp64_t); +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp64_t __spirv_ocl_length(__clc_vec4_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp16_t __spirv_ocl_length(__clc_fp16_t); +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp16_t __spirv_ocl_length(__clc_vec2_fp16_t); +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp16_t __spirv_ocl_length(__clc_vec3_fp16_t); +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp16_t __spirv_ocl_length(__clc_vec4_fp16_t); +#endif + +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_mix(__clc_fp32_t, + __clc_fp32_t, + __clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_mix(__clc_vec2_fp32_t, __clc_vec2_fp32_t, __clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_mix(__clc_vec3_fp32_t, __clc_vec3_fp32_t, __clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_mix(__clc_vec4_fp32_t, __clc_vec4_fp32_t, __clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t + __spirv_ocl_mix(__clc_vec8_fp32_t, __clc_vec8_fp32_t, __clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t + __spirv_ocl_mix(__clc_vec16_fp32_t, __clc_vec16_fp32_t, __clc_vec16_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t __spirv_ocl_mix(__clc_fp64_t, + __clc_fp64_t, + __clc_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp64_t + __spirv_ocl_mix(__clc_vec2_fp64_t, __clc_vec2_fp64_t, __clc_vec2_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp64_t + __spirv_ocl_mix(__clc_vec3_fp64_t, __clc_vec3_fp64_t, __clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp64_t + __spirv_ocl_mix(__clc_vec4_fp64_t, __clc_vec4_fp64_t, __clc_vec4_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp64_t + __spirv_ocl_mix(__clc_vec8_fp64_t, __clc_vec8_fp64_t, __clc_vec8_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp64_t + __spirv_ocl_mix(__clc_vec16_fp64_t, __clc_vec16_fp64_t, __clc_vec16_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t __spirv_ocl_mix(__clc_fp16_t, + __clc_fp16_t, + __clc_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp16_t + __spirv_ocl_mix(__clc_vec2_fp16_t, __clc_vec2_fp16_t, __clc_vec2_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp16_t + __spirv_ocl_mix(__clc_vec3_fp16_t, __clc_vec3_fp16_t, __clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp16_t + __spirv_ocl_mix(__clc_vec4_fp16_t, __clc_vec4_fp16_t, __clc_vec4_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp16_t + __spirv_ocl_mix(__clc_vec8_fp16_t, __clc_vec8_fp16_t, __clc_vec8_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp16_t + __spirv_ocl_mix(__clc_vec16_fp16_t, __clc_vec16_fp16_t, __clc_vec16_fp16_t); +#endif + +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_native_rsqrt(__clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_native_rsqrt(__clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_native_rsqrt(__clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_native_rsqrt(__clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t + __spirv_ocl_native_rsqrt(__clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t + __spirv_ocl_native_rsqrt(__clc_vec16_fp32_t); + +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_native_sqrt(__clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_native_sqrt(__clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_native_sqrt(__clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_native_sqrt(__clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t + __spirv_ocl_native_sqrt(__clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t + __spirv_ocl_native_sqrt(__clc_vec16_fp32_t); + +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_normalize(__clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_normalize(__clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_normalize(__clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_normalize(__clc_vec4_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp64_t __spirv_ocl_normalize(__clc_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp64_t + __spirv_ocl_normalize(__clc_vec2_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp64_t + __spirv_ocl_normalize(__clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp64_t + __spirv_ocl_normalize(__clc_vec4_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp16_t __spirv_ocl_normalize(__clc_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp16_t + __spirv_ocl_normalize(__clc_vec2_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp16_t + __spirv_ocl_normalize(__clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp16_t + __spirv_ocl_normalize(__clc_vec4_fp16_t); +#endif + _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_char_t __spirv_ocl_popcount(__clc_char_t); _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_char_t @@ -13053,6 +13417,49 @@ _CLC_OVERLOAD _CLC_DECL void __spirv_ocl_prefetch(__clc_vec16_fp16_t const __global *, __clc_size_t); #endif +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_radians(__clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_radians(__clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_radians(__clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_radians(__clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t + __spirv_ocl_radians(__clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t + __spirv_ocl_radians(__clc_vec16_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp64_t __spirv_ocl_radians(__clc_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp64_t + __spirv_ocl_radians(__clc_vec2_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp64_t + __spirv_ocl_radians(__clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp64_t + __spirv_ocl_radians(__clc_vec4_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp64_t + __spirv_ocl_radians(__clc_vec8_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp64_t + __spirv_ocl_radians(__clc_vec16_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp16_t __spirv_ocl_radians(__clc_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp16_t + __spirv_ocl_radians(__clc_vec2_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp16_t + __spirv_ocl_radians(__clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp16_t + __spirv_ocl_radians(__clc_vec4_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp16_t + __spirv_ocl_radians(__clc_vec8_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp16_t + __spirv_ocl_radians(__clc_vec16_fp16_t); +#endif + _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_char_t __spirv_ocl_rotate(__clc_char_t, __clc_char_t); _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_char_t @@ -13162,6 +13569,49 @@ _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_uint64_t _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_uint64_t __spirv_ocl_rotate(__clc_vec16_uint64_t, __clc_vec16_uint64_t); +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_rsqrt(__clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_rsqrt(__clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_rsqrt(__clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_rsqrt(__clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t + __spirv_ocl_rsqrt(__clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t + __spirv_ocl_rsqrt(__clc_vec16_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp64_t __spirv_ocl_rsqrt(__clc_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp64_t + __spirv_ocl_rsqrt(__clc_vec2_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp64_t + __spirv_ocl_rsqrt(__clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp64_t + __spirv_ocl_rsqrt(__clc_vec4_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp64_t + __spirv_ocl_rsqrt(__clc_vec8_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp64_t + __spirv_ocl_rsqrt(__clc_vec16_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp16_t __spirv_ocl_rsqrt(__clc_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp16_t + __spirv_ocl_rsqrt(__clc_vec2_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp16_t + __spirv_ocl_rsqrt(__clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp16_t + __spirv_ocl_rsqrt(__clc_vec4_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp16_t + __spirv_ocl_rsqrt(__clc_vec8_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp16_t + __spirv_ocl_rsqrt(__clc_vec16_fp16_t); +#endif + _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_uint8_t __spirv_ocl_s_abs(__clc_int8_t); _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_uint8_t @@ -14120,6 +14570,178 @@ _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp16_t __spirv_ocl_select( __clc_vec16_fp16_t, __clc_vec16_fp16_t, __clc_vec16_uint16_t); #endif +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_sign(__clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_sign(__clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_sign(__clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_sign(__clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t + __spirv_ocl_sign(__clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t + __spirv_ocl_sign(__clc_vec16_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp64_t __spirv_ocl_sign(__clc_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp64_t + __spirv_ocl_sign(__clc_vec2_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp64_t + __spirv_ocl_sign(__clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp64_t + __spirv_ocl_sign(__clc_vec4_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp64_t + __spirv_ocl_sign(__clc_vec8_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp64_t + __spirv_ocl_sign(__clc_vec16_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp16_t __spirv_ocl_sign(__clc_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp16_t + __spirv_ocl_sign(__clc_vec2_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp16_t + __spirv_ocl_sign(__clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp16_t + __spirv_ocl_sign(__clc_vec4_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp16_t + __spirv_ocl_sign(__clc_vec8_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp16_t + __spirv_ocl_sign(__clc_vec16_fp16_t); +#endif + +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_smoothstep(__clc_fp32_t, __clc_fp32_t, __clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t __spirv_ocl_smoothstep( + __clc_vec2_fp32_t, __clc_vec2_fp32_t, __clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t __spirv_ocl_smoothstep( + __clc_vec3_fp32_t, __clc_vec3_fp32_t, __clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t __spirv_ocl_smoothstep( + __clc_vec4_fp32_t, __clc_vec4_fp32_t, __clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t __spirv_ocl_smoothstep( + __clc_vec8_fp32_t, __clc_vec8_fp32_t, __clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t __spirv_ocl_smoothstep( + __clc_vec16_fp32_t, __clc_vec16_fp32_t, __clc_vec16_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t + __spirv_ocl_smoothstep(__clc_fp64_t, __clc_fp64_t, __clc_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp64_t __spirv_ocl_smoothstep( + __clc_vec2_fp64_t, __clc_vec2_fp64_t, __clc_vec2_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp64_t __spirv_ocl_smoothstep( + __clc_vec3_fp64_t, __clc_vec3_fp64_t, __clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp64_t __spirv_ocl_smoothstep( + __clc_vec4_fp64_t, __clc_vec4_fp64_t, __clc_vec4_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp64_t __spirv_ocl_smoothstep( + __clc_vec8_fp64_t, __clc_vec8_fp64_t, __clc_vec8_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp64_t __spirv_ocl_smoothstep( + __clc_vec16_fp64_t, __clc_vec16_fp64_t, __clc_vec16_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t + __spirv_ocl_smoothstep(__clc_fp16_t, __clc_fp16_t, __clc_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp16_t __spirv_ocl_smoothstep( + __clc_vec2_fp16_t, __clc_vec2_fp16_t, __clc_vec2_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp16_t __spirv_ocl_smoothstep( + __clc_vec3_fp16_t, __clc_vec3_fp16_t, __clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp16_t __spirv_ocl_smoothstep( + __clc_vec4_fp16_t, __clc_vec4_fp16_t, __clc_vec4_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp16_t __spirv_ocl_smoothstep( + __clc_vec8_fp16_t, __clc_vec8_fp16_t, __clc_vec8_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp16_t __spirv_ocl_smoothstep( + __clc_vec16_fp16_t, __clc_vec16_fp16_t, __clc_vec16_fp16_t); +#endif + +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp32_t __spirv_ocl_sqrt(__clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_sqrt(__clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_sqrt(__clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_sqrt(__clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t + __spirv_ocl_sqrt(__clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t + __spirv_ocl_sqrt(__clc_vec16_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp64_t __spirv_ocl_sqrt(__clc_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp64_t + __spirv_ocl_sqrt(__clc_vec2_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp64_t + __spirv_ocl_sqrt(__clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp64_t + __spirv_ocl_sqrt(__clc_vec4_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp64_t + __spirv_ocl_sqrt(__clc_vec8_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp64_t + __spirv_ocl_sqrt(__clc_vec16_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD +_CLC_DECL _CLC_CONSTFN __clc_fp16_t __spirv_ocl_sqrt(__clc_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp16_t + __spirv_ocl_sqrt(__clc_vec2_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp16_t + __spirv_ocl_sqrt(__clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp16_t + __spirv_ocl_sqrt(__clc_vec4_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp16_t + __spirv_ocl_sqrt(__clc_vec8_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp16_t + __spirv_ocl_sqrt(__clc_vec16_fp16_t); +#endif + +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp32_t + __spirv_ocl_step(__clc_fp32_t, __clc_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp32_t + __spirv_ocl_step(__clc_vec2_fp32_t, __clc_vec2_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp32_t + __spirv_ocl_step(__clc_vec3_fp32_t, __clc_vec3_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp32_t + __spirv_ocl_step(__clc_vec4_fp32_t, __clc_vec4_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp32_t + __spirv_ocl_step(__clc_vec8_fp32_t, __clc_vec8_fp32_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp32_t + __spirv_ocl_step(__clc_vec16_fp32_t, __clc_vec16_fp32_t); + +#ifdef cl_khr_fp64 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp64_t + __spirv_ocl_step(__clc_fp64_t, __clc_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp64_t + __spirv_ocl_step(__clc_vec2_fp64_t, __clc_vec2_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp64_t + __spirv_ocl_step(__clc_vec3_fp64_t, __clc_vec3_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp64_t + __spirv_ocl_step(__clc_vec4_fp64_t, __clc_vec4_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp64_t + __spirv_ocl_step(__clc_vec8_fp64_t, __clc_vec8_fp64_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp64_t + __spirv_ocl_step(__clc_vec16_fp64_t, __clc_vec16_fp64_t); +#endif + +#ifdef cl_khr_fp16 +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_fp16_t + __spirv_ocl_step(__clc_fp16_t, __clc_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_fp16_t + __spirv_ocl_step(__clc_vec2_fp16_t, __clc_vec2_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec3_fp16_t + __spirv_ocl_step(__clc_vec3_fp16_t, __clc_vec3_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec4_fp16_t + __spirv_ocl_step(__clc_vec4_fp16_t, __clc_vec4_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec8_fp16_t + __spirv_ocl_step(__clc_vec8_fp16_t, __clc_vec8_fp16_t); +_CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec16_fp16_t + __spirv_ocl_step(__clc_vec16_fp16_t, __clc_vec16_fp16_t); +#endif + _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_uint8_t __spirv_ocl_u_abs(__clc_uint8_t); _CLC_OVERLOAD _CLC_DECL _CLC_CONSTFN __clc_vec2_uint8_t diff --git a/libclc/generic/lib/SOURCES b/libclc/generic/lib/SOURCES index cc2b512b08258..42fbb1dcbc69e 100644 --- a/libclc/generic/lib/SOURCES +++ b/libclc/generic/lib/SOURCES @@ -1,5 +1,3 @@ -subnormal_config.cl -subnormal_helper_func.ll async/async_work_group_copy.cl async/async_work_group_strided_copy.cl async/prefetch.cl diff --git a/libclc/generic/lib/common/smoothstep.cl b/libclc/generic/lib/common/smoothstep.cl index 242af891e9e4e..a26f914f43f74 100644 --- a/libclc/generic/lib/common/smoothstep.cl +++ b/libclc/generic/lib/common/smoothstep.cl @@ -25,25 +25,29 @@ #include -_CLC_OVERLOAD _CLC_DEF float smoothstep(float edge0, float edge1, float x) { - return __spirv_ocl_smoothstep(edge0, edge1, x); -} +#define SMOOTH_STEP_DEF(edge_type, x_type, impl) \ + _CLC_OVERLOAD _CLC_DEF x_type smoothstep(edge_type edge0, edge_type edge1, \ + x_type x) { \ + return __spirv_ocl_smoothstep((x_type)edge0, (x_type)edge1, x); \ + } -_CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, smoothstep, float, float, float); +SMOOTH_STEP_DEF(float, float, SMOOTH_STEP_IMPL_D); -_CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, smoothstep, float, float, float); +_CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, smoothstep, float, float, + float); + +_CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, smoothstep, float, float, + float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable -#define SMOOTH_STEP_DEF(edge_type, x_type, impl) \ - _CLC_OVERLOAD _CLC_DEF x_type smoothstep(edge_type edge0, edge_type edge1, x_type x) { \ - return __spirv_ocl_smoothstep(edge0, edge1, x); \ - } - SMOOTH_STEP_DEF(double, double, SMOOTH_STEP_IMPL_D); -_CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, smoothstep, double, double, double); +_CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, smoothstep, double, + double, double); +_CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, smoothstep, double, + double, double); SMOOTH_STEP_DEF(float, double, SMOOTH_STEP_IMPL_D); SMOOTH_STEP_DEF(double, float, SMOOTH_STEP_IMPL_D); diff --git a/libclc/generic/lib/common/step.cl b/libclc/generic/lib/common/step.cl index 3488b5150f1c2..6620a1929f923 100644 --- a/libclc/generic/lib/common/step.cl +++ b/libclc/generic/lib/common/step.cl @@ -25,9 +25,12 @@ #include -_CLC_OVERLOAD _CLC_DEF float step(float edge, float x) { - return __spirv_ocl_step(edge, x); -} +#define STEP_DEF(edge_type, x_type) \ + _CLC_OVERLOAD _CLC_DEF x_type step(edge_type edge, x_type x) { \ + return __spirv_ocl_step((x_type)edge, x); \ + } + +STEP_DEF(float, float); _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, step, float, float); @@ -36,11 +39,6 @@ _CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, step, float, float); #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable -#define STEP_DEF(edge_type, x_type) \ - _CLC_OVERLOAD _CLC_DEF x_type step(edge_type edge, x_type x) { \ - return __spirv_ocl_step(edge, x); \ - } - STEP_DEF(double, double); _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, step, double, double); diff --git a/libclc/generic/libspirv/SOURCES b/libclc/generic/libspirv/SOURCES index 6676ff1fa5f59..bdbe46a64e291 100644 --- a/libclc/generic/libspirv/SOURCES +++ b/libclc/generic/libspirv/SOURCES @@ -1,3 +1,5 @@ +subnormal_config.cl +subnormal_helper_func.ll async/async_work_group_strided_copy.cl async/prefetch.cl async/wait_group_events.cl @@ -35,6 +37,18 @@ core/integer/clc_upsample.cl core/shared/clc_clamp.cl core/shared/clc_max.cl core/shared/clc_min.cl +geometric/cross.cl +geometric/distance.cl +geometric/distance.inc +geometric/dot.cl +geometric/fast_distance.cl +geometric/fast_distance.inc +geometric/fast_length.cl +geometric/fast_normalize.cl +geometric/fast_normalize.inc +geometric/length.cl +geometric/normalize.cl +geometric/scale.cl integer/abs.cl integer/abs_diff.cl integer/add_sat.cl @@ -60,6 +74,7 @@ math/clc_pow.cl math/clc_sqrt.cl math/clc_tan.cl math/clc_tanpi.cl +math/copysign.cl math/cos.cl math/cospi.cl math/exp.cl @@ -74,6 +89,8 @@ math/fmax.cl math/fmin.cl math/fmod.cl math/fract.cl +math/half_rsqrt.cl +math/half_sqrt.cl math/ldexp.cl math/log.cl math/log10.cl @@ -102,6 +119,7 @@ math/sincos.cl math/sincos_helpers.cl math/sinpi.cl math/sqrt.cl +math/rsqrt.cl math/tables.cl math/trunc.cl relational/all.cl diff --git a/libclc/generic/libspirv/common/degrees.cl b/libclc/generic/libspirv/common/degrees.cl index 895aa20aa06af..1c42a41a3fc23 100644 --- a/libclc/generic/libspirv/common/degrees.cl +++ b/libclc/generic/libspirv/common/degrees.cl @@ -26,6 +26,18 @@ _CLC_OVERLOAD _CLC_DEF double __spirv_ocl_degrees(double radians) { return 0x1.ca5dc1a63c1f8p+5 * radians; } -_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_degrees, double); +_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_degrees, + double); + +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +_CLC_OVERLOAD _CLC_DEF half __spirv_ocl_degrees(half radians) { + return __spirv_ocl_degrees((float)radians); +} + +_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, half, __spirv_ocl_degrees, half); #endif diff --git a/libclc/generic/libspirv/common/radians.cl b/libclc/generic/libspirv/common/radians.cl index 9c7ae1dd836a9..0b106157eb11b 100644 --- a/libclc/generic/libspirv/common/radians.cl +++ b/libclc/generic/libspirv/common/radians.cl @@ -26,6 +26,19 @@ _CLC_OVERLOAD _CLC_DEF double __spirv_ocl_radians(double degrees) { return 0x1.1df46a2529d39p-6 * degrees; } -_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_radians, double); +_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_radians, + double); + +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +_CLC_OVERLOAD _CLC_DEF half __spirv_ocl_radians(half degrees) { + // pi/180 = ~0.01745329251994329577 or 0x1.1df46a2529d39p-6 or 0x1.1df46ap-6F + return M_PI_OVER_180_H * degrees; +} + +_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, half, __spirv_ocl_radians, half); #endif diff --git a/libclc/generic/libspirv/common/sign.cl b/libclc/generic/libspirv/common/sign.cl index 641539ca6661c..c48ac4e6a7518 100644 --- a/libclc/generic/libspirv/common/sign.cl +++ b/libclc/generic/libspirv/common/sign.cl @@ -6,22 +6,22 @@ // //===----------------------------------------------------------------------===// -#include #include "../../lib/clcmacro.h" +#include -#define SIGN(TYPE, F) \ -_CLC_DEF _CLC_OVERLOAD TYPE __spirv_ocl_sign(TYPE x) { \ - if (__spirv_IsNan(x)) { \ - return 0.0F; \ - } \ - if (x > 0.0F) { \ - return 1.0F; \ - } \ - if (x < 0.0F) { \ - return -1.0F; \ - } \ - return x; /* -0.0 or +0.0 */ \ -} +#define SIGN(TYPE, F) \ + _CLC_DEF _CLC_OVERLOAD TYPE __spirv_ocl_sign(TYPE x) { \ + if (__spirv_IsNan(x)) { \ + return 0.0F; \ + } \ + if (x > 0.0F) { \ + return 1.0F; \ + } \ + if (x < 0.0F) { \ + return -1.0F; \ + } \ + return x; /* -0.0 or +0.0 */ \ + } SIGN(float, f) _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, __spirv_ocl_sign, float) @@ -34,3 +34,12 @@ SIGN(double, ) _CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_sign, double) #endif + +#ifdef cl_khr_fp16 + +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +SIGN(half, h) +_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, half, __spirv_ocl_sign, half) + +#endif diff --git a/libclc/generic/libspirv/common/smoothstep.cl b/libclc/generic/libspirv/common/smoothstep.cl index 9147878d13019..9af50d6043b5b 100644 --- a/libclc/generic/libspirv/common/smoothstep.cl +++ b/libclc/generic/libspirv/common/smoothstep.cl @@ -16,28 +16,33 @@ _CLC_OVERLOAD _CLC_DEF float __spirv_ocl_smoothstep(float edge0, float edge1, return t * t * (3.0f - 2.0f * t); } -_CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, __spirv_ocl_smoothstep, float, float, float); - -_CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, __spirv_ocl_smoothstep, float, float, float); +_CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, __spirv_ocl_smoothstep, + float, float, float) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable -#define SMOOTH_STEP_DEF(edge_type, x_type, impl) \ - _CLC_OVERLOAD _CLC_DEF x_type __spirv_ocl_smoothstep( \ - edge_type edge0, edge_type edge1, x_type x) { \ - double t = __spirv_ocl_fclamp((x - edge0) / (edge1 - edge0), 0.0, 1.0); \ - return t * t * (3.0 - 2.0 * t); \ - } +_CLC_OVERLOAD _CLC_DEF double __spirv_ocl_smoothstep(double edge0, double edge1, + double x) { + double t = __spirv_ocl_fclamp((x - edge0) / (edge1 - edge0), 0.0, 1.0); + return t * t * (3.0 - 2.0 * t); +} -SMOOTH_STEP_DEF(double, double, SMOOTH_STEP_IMPL_D); +_CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_smoothstep, + double, double, double) -_CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_smoothstep, double, double, double); +#endif -SMOOTH_STEP_DEF(float, double, SMOOTH_STEP_IMPL_D); -SMOOTH_STEP_DEF(double, float, SMOOTH_STEP_IMPL_D); +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +_CLC_OVERLOAD _CLC_DEF half __spirv_ocl_smoothstep(half edge0, half edge1, + half x) { + half t = __spirv_ocl_fclamp((x - edge0) / (edge1 - edge0), 0.0h, 1.0h); + return t * t * (3.0h - 2.0h * t); +} -_CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_smoothstep, float, float, double); -_CLC_V_S_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, __spirv_ocl_smoothstep, double, double, float); +_CLC_TERNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, half, __spirv_ocl_smoothstep, + half, half, half); #endif diff --git a/libclc/generic/libspirv/common/step.cl b/libclc/generic/libspirv/common/step.cl index 2e7cdb31ff975..bec9b4e0bf735 100644 --- a/libclc/generic/libspirv/common/step.cl +++ b/libclc/generic/libspirv/common/step.cl @@ -10,31 +10,25 @@ #include "../../lib/clcmacro.h" -_CLC_OVERLOAD _CLC_DEF float __spirv_ocl_step(float edge, float x) { - return x < edge ? 0.0f : 1.0f; -} +#define STEP_DEF(TYPE, TYPOSTFIX) \ + _CLC_OVERLOAD _CLC_DEF TYPE __spirv_ocl_step(TYPE edge, TYPE x) { \ + return x < edge ? 0.0##TYPOSTFIX : 1.0##TYPOSTFIX; \ + } \ + _CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, TYPE, __spirv_ocl_step, TYPE, \ + TYPE) -_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, __spirv_ocl_step, float, float); - -_CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, __spirv_ocl_step, float, float); +STEP_DEF(float, f) #ifdef cl_khr_fp64 #pragma OPENCL EXTENSION cl_khr_fp64 : enable -#define STEP_DEF(edge_type, x_type) \ - _CLC_OVERLOAD _CLC_DEF x_type __spirv_ocl_step(edge_type edge, x_type x) { \ - return x < edge ? 0.0 : 1.0; \ - } - -STEP_DEF(double, double); +STEP_DEF(double, ) -_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_step, double, double); -_CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_step, double, double); +#endif -STEP_DEF(float, double); -STEP_DEF(double, float); +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable -_CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_step, float, double); -_CLC_V_S_V_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, __spirv_ocl_step, double, float); +STEP_DEF(half, h) #endif diff --git a/libclc/generic/libspirv/geometric/cross.cl b/libclc/generic/libspirv/geometric/cross.cl new file mode 100644 index 0000000000000..edd61952f67cb --- /dev/null +++ b/libclc/generic/libspirv/geometric/cross.cl @@ -0,0 +1,47 @@ +//===----------------------------------------------------------------------===// +// +// 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_OVERLOAD _CLC_DEF float3 __spirv_ocl_cross(float3 p0, float3 p1) { + return (float3)(p0.y * p1.z - p0.z * p1.y, p0.z * p1.x - p0.x * p1.z, + p0.x * p1.y - p0.y * p1.x); +} + +_CLC_OVERLOAD _CLC_DEF float4 __spirv_ocl_cross(float4 p0, float4 p1) { + return (float4)(p0.y * p1.z - p0.z * p1.y, p0.z * p1.x - p0.x * p1.z, + p0.x * p1.y - p0.y * p1.x, 0.f); +} + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +_CLC_OVERLOAD _CLC_DEF double3 __spirv_ocl_cross(double3 p0, double3 p1) { + return (double3)(p0.y * p1.z - p0.z * p1.y, p0.z * p1.x - p0.x * p1.z, + p0.x * p1.y - p0.y * p1.x); +} + +_CLC_OVERLOAD _CLC_DEF double4 __spirv_ocl_cross(double4 p0, double4 p1) { + return (double4)(p0.y * p1.z - p0.z * p1.y, p0.z * p1.x - p0.x * p1.z, + p0.x * p1.y - p0.y * p1.x, 0.f); +} +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +_CLC_OVERLOAD _CLC_DEF half3 __spirv_ocl_cross(half3 p0, half3 p1) { + return (half3)(p0.y * p1.z - p0.z * p1.y, p0.z * p1.x - p0.x * p1.z, + p0.x * p1.y - p0.y * p1.x); +} + +_CLC_OVERLOAD _CLC_DEF half4 __spirv_ocl_cross(half4 p0, half4 p1) { + return (half4)(p0.y * p1.z - p0.z * p1.y, p0.z * p1.x - p0.x * p1.z, + p0.x * p1.y - p0.y * p1.x, 0.f); +} +#endif diff --git a/libclc/generic/include/spirv/common/radians.inc b/libclc/generic/libspirv/geometric/distance.cl similarity index 79% rename from libclc/generic/include/spirv/common/radians.inc rename to libclc/generic/libspirv/geometric/distance.cl index a26f93fc96f80..674fa54aaccfe 100644 --- a/libclc/generic/include/spirv/common/radians.inc +++ b/libclc/generic/libspirv/geometric/distance.cl @@ -6,4 +6,7 @@ // //===----------------------------------------------------------------------===// -_CLC_OVERLOAD _CLC_DECL __SPIRV_GENTYPE __spirv_ocl_radians(__SPIRV_GENTYPE x); +#include + +#define __CLC_BODY +#include diff --git a/libclc/generic/include/spirv/geometric/distance.inc b/libclc/generic/libspirv/geometric/distance.inc similarity index 66% rename from libclc/generic/include/spirv/geometric/distance.inc rename to libclc/generic/libspirv/geometric/distance.inc index bfe14f47fccdb..347b2a4f04209 100644 --- a/libclc/generic/include/spirv/geometric/distance.inc +++ b/libclc/generic/libspirv/geometric/distance.inc @@ -6,4 +6,7 @@ // //===----------------------------------------------------------------------===// -_CLC_OVERLOAD _CLC_DECL __SPIRV_FLOAT __spirv_ocl_distance(__SPIRV_FLOATN p0, __SPIRV_FLOATN p1); +_CLC_OVERLOAD _CLC_DEF __CLC_FLOAT __spirv_ocl_distance(__CLC_FLOATN p0, + __CLC_FLOATN p1) { + return __spirv_ocl_length(p0 - p1); +} diff --git a/libclc/generic/libspirv/geometric/dot.cl b/libclc/generic/libspirv/geometric/dot.cl new file mode 100644 index 0000000000000..a1252d2259f3d --- /dev/null +++ b/libclc/generic/libspirv/geometric/dot.cl @@ -0,0 +1,51 @@ +//===----------------------------------------------------------------------===// +// +// 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_GEN_DOT(DECLSPEC, TYPE) \ + DECLSPEC TYPE __spirv_Dot(TYPE x, TYPE y) { return x * y; } \ + DECLSPEC TYPE __spirv_Dot(TYPE##2 x, TYPE##2 y) { \ + return __spirv_Dot(x.x, y.x) + __spirv_Dot(x.y, y.y); \ + } \ + \ + DECLSPEC TYPE __spirv_Dot(TYPE##3 x, TYPE##3 y) { \ + return __spirv_Dot(x.x, y.x) + __spirv_Dot(x.y, y.y) + \ + __spirv_Dot(x.z, y.z); \ + } \ + \ + DECLSPEC TYPE __spirv_Dot(TYPE##4 x, TYPE##4 y) { \ + return __spirv_Dot(x.lo, y.lo) + __spirv_Dot(x.hi, y.hi); \ + } \ + \ + DECLSPEC TYPE __spirv_Dot(TYPE##8 x, TYPE##8 y) { \ + return __spirv_Dot(x.lo, y.lo) + __spirv_Dot(x.hi, y.hi); \ + } \ + \ + DECLSPEC TYPE __spirv_Dot(TYPE##16 x, TYPE##16 y) { \ + return __spirv_Dot(x.lo, y.lo) + __spirv_Dot(x.hi, y.hi); \ + } + +_CLC_GEN_DOT(_CLC_OVERLOAD _CLC_DEF, float) + +#ifdef cl_khr_fp64 + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +_CLC_GEN_DOT(_CLC_OVERLOAD _CLC_DEF, double) + +#endif + +#ifdef cl_khr_fp16 + +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +_CLC_GEN_DOT(_CLC_OVERLOAD _CLC_DEF, half) + +#endif diff --git a/libclc/generic/include/spirv/geometric/fast_distance.h b/libclc/generic/libspirv/geometric/fast_distance.cl similarity index 80% rename from libclc/generic/include/spirv/geometric/fast_distance.h rename to libclc/generic/libspirv/geometric/fast_distance.cl index 3d118351f6694..7ee802bdeb05e 100644 --- a/libclc/generic/include/spirv/geometric/fast_distance.h +++ b/libclc/generic/libspirv/geometric/fast_distance.cl @@ -6,7 +6,9 @@ // //===----------------------------------------------------------------------===// -#define __SPIRV_BODY +#include + +#define __CLC_BODY #define __FLOAT_ONLY -#include +#include #undef __FLOAT_ONLY diff --git a/libclc/generic/include/spirv/geometric/fast_distance.inc b/libclc/generic/libspirv/geometric/fast_distance.inc similarity index 64% rename from libclc/generic/include/spirv/geometric/fast_distance.inc rename to libclc/generic/libspirv/geometric/fast_distance.inc index 99bc653aab21c..7db639a7a0724 100644 --- a/libclc/generic/include/spirv/geometric/fast_distance.inc +++ b/libclc/generic/libspirv/geometric/fast_distance.inc @@ -6,4 +6,7 @@ // //===----------------------------------------------------------------------===// -_CLC_OVERLOAD _CLC_DECL __SPIRV_FLOAT __spirv_ocl_fast_distance(__SPIRV_FLOATN p0, __SPIRV_FLOATN p1); +_CLC_OVERLOAD _CLC_DEF __CLC_FLOAT __spirv_ocl_fast_distance(__CLC_FLOATN p0, + __CLC_FLOATN p1) { + return __spirv_ocl_fast_length(p0 - p1); +} diff --git a/libclc/generic/libspirv/geometric/fast_length.cl b/libclc/generic/libspirv/geometric/fast_length.cl new file mode 100644 index 0000000000000..6d65211fe405b --- /dev/null +++ b/libclc/generic/libspirv/geometric/fast_length.cl @@ -0,0 +1,25 @@ +//===----------------------------------------------------------------------===// +// +// 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_OVERLOAD _CLC_DEF float __spirv_ocl_fast_length(float p) { + return __spirv_ocl_fabs(p); +} + +_CLC_OVERLOAD _CLC_DEF float __spirv_ocl_fast_length(float2 p) { + return __spirv_ocl_half_sqrt(__spirv_Dot(p, p)); +} + +_CLC_OVERLOAD _CLC_DEF float __spirv_ocl_fast_length(float3 p) { + return __spirv_ocl_half_sqrt(__spirv_Dot(p, p)); +} + +_CLC_OVERLOAD _CLC_DEF float __spirv_ocl_fast_length(float4 p) { + return __spirv_ocl_half_sqrt(__spirv_Dot(p, p)); +} diff --git a/libclc/generic/include/spirv/math/native_rsqrt.h b/libclc/generic/libspirv/geometric/fast_normalize.cl similarity index 66% rename from libclc/generic/include/spirv/math/native_rsqrt.h rename to libclc/generic/libspirv/geometric/fast_normalize.cl index 1b697bb2f8672..4dc5e6f9474fb 100644 --- a/libclc/generic/include/spirv/math/native_rsqrt.h +++ b/libclc/generic/libspirv/geometric/fast_normalize.cl @@ -6,12 +6,13 @@ // //===----------------------------------------------------------------------===// -#define __SPIRV_BODY -#define __SPIRV_FUNCTION __spirv_ocl_native_rsqrt -#define __FLOAT_ONLY +#include -#include +_CLC_OVERLOAD _CLC_DEF float __spirv_ocl_fast_normalize(float p) { + return __spirv_ocl_normalize(p); +} +#define __CLC_BODY +#define __FLOAT_ONLY +#include #undef __FLOAT_ONLY -#undef __SPIRV_BODY -#undef __SPIRV_FUNCTION diff --git a/libclc/generic/include/spirv/math/sqrt.h b/libclc/generic/libspirv/geometric/fast_normalize.inc similarity index 60% rename from libclc/generic/include/spirv/math/sqrt.h rename to libclc/generic/libspirv/geometric/fast_normalize.inc index ff8cf90a2d717..9ee1c064ac212 100644 --- a/libclc/generic/include/spirv/math/sqrt.h +++ b/libclc/generic/libspirv/geometric/fast_normalize.inc @@ -6,10 +6,12 @@ // //===----------------------------------------------------------------------===// -#define __SPIRV_BODY -#define __SPIRV_FUNCTION __spirv_ocl_sqrt +#ifndef __CLC_SCALAR -#include +// Only handle vector implementations +_CLC_OVERLOAD _CLC_DEF __CLC_FLOATN __spirv_ocl_fast_normalize(__CLC_FLOATN p) { + __CLC_FLOAT l2 = __spirv_Dot(p, p); + return l2 == 0.0f ? p : p * __spirv_ocl_half_rsqrt(l2); +} -#undef __SPIRV_BODY -#undef __SPIRV_FUNCTION +#endif diff --git a/libclc/generic/libspirv/geometric/length.cl b/libclc/generic/libspirv/geometric/length.cl new file mode 100644 index 0000000000000..75a8c108290ff --- /dev/null +++ b/libclc/generic/libspirv/geometric/length.cl @@ -0,0 +1,93 @@ +//===----------------------------------------------------------------------===// +// +// 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_OVERLOAD _CLC_DEF float __spirv_ocl_length(float p) { + return __spirv_ocl_fabs(p); +} + +#define V_FLENGTH(p) \ + float l2 = __spirv_Dot(p, p); \ + \ + if (l2 < FLT_MIN) { \ + p *= 0x1.0p+86F; \ + return __spirv_ocl_sqrt(__spirv_Dot(p, p)) * 0x1.0p-86F; \ + } else if (l2 == INFINITY) { \ + p *= 0x1.0p-65F; \ + return __spirv_ocl_sqrt(__spirv_Dot(p, p)) * 0x1.0p+65F; \ + } \ + \ + return __spirv_ocl_sqrt(l2); + +_CLC_OVERLOAD _CLC_DEF float __spirv_ocl_length(float2 p) { V_FLENGTH(p); } + +_CLC_OVERLOAD _CLC_DEF float __spirv_ocl_length(float3 p) { V_FLENGTH(p); } + +_CLC_OVERLOAD _CLC_DEF float __spirv_ocl_length(float4 p) { V_FLENGTH(p); } + +#ifdef cl_khr_fp64 +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +_CLC_OVERLOAD _CLC_DEF double __spirv_ocl_length(double p) { + return __spirv_ocl_fabs(p); +} + +#define V_DLENGTH(p) \ + double l2 = __spirv_Dot(p, p); \ + \ + if (l2 < DBL_MIN) { \ + p *= 0x1.0p+563; \ + return __spirv_ocl_sqrt(__spirv_Dot(p, p)) * 0x1.0p-563; \ + } else if (l2 == INFINITY) { \ + p *= 0x1.0p-513; \ + return __spirv_ocl_sqrt(__spirv_Dot(p, p)) * 0x1.0p+513; \ + } \ + \ + return __spirv_ocl_sqrt(l2); + +_CLC_OVERLOAD _CLC_DEF double __spirv_ocl_length(double2 p) { V_DLENGTH(p); } + +_CLC_OVERLOAD _CLC_DEF double __spirv_ocl_length(double3 p) { V_DLENGTH(p); } + +_CLC_OVERLOAD _CLC_DEF double __spirv_ocl_length(double4 p) { V_DLENGTH(p); } + +#endif + +#ifdef cl_khr_fp16 +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +_CLC_OVERLOAD _CLC_DEF half __spirv_ocl_length(half p) { + return __spirv_ocl_fabs(p); +} + +// Only available in CLC1.2 +#ifndef HALF_MIN +#define HALF_MIN 0x1.0p-14h +#endif + +#define V_HLENGTH(p) \ + half l2 = __spirv_Dot(p, p); \ + \ + if (l2 < HALF_MIN) { \ + p *= 0x1.0p+12h; \ + return __spirv_ocl_sqrt(__spirv_Dot(p, p)) * 0x1.0p-12h; \ + } else if (l2 == INFINITY) { \ + p *= 0x1.0p-7h; \ + return __spirv_ocl_sqrt(__spirv_Dot(p, p)) * 0x1.0p+7h; \ + } \ + \ + return __spirv_ocl_sqrt(l2); + +_CLC_OVERLOAD _CLC_DEF half __spirv_ocl_length(half2 p) { V_HLENGTH(p); } + +_CLC_OVERLOAD _CLC_DEF half __spirv_ocl_length(half3 p) { V_HLENGTH(p); } + +_CLC_OVERLOAD _CLC_DEF half __spirv_ocl_length(half4 p) { V_HLENGTH(p); } + +#endif diff --git a/libclc/generic/libspirv/geometric/normalize.cl b/libclc/generic/libspirv/geometric/normalize.cl new file mode 100644 index 0000000000000..c2cd88a9e7ba7 --- /dev/null +++ b/libclc/generic/libspirv/geometric/normalize.cl @@ -0,0 +1,87 @@ +//===----------------------------------------------------------------------===// +// +// 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_SPIRV_NORMALIZE_IMPL(FP_TYPE, FLOAT_MARK, INT_TYPE, VLEN, \ + MAX_SQRT, MIN_SQRT) \ + _CLC_OVERLOAD _CLC_DEF FP_TYPE##VLEN __spirv_ocl_normalize( \ + FP_TYPE##VLEN p) { \ + if (__spirv_All(__spirv_SConvert_Rchar##VLEN( \ + p == (FP_TYPE##VLEN)0.0##FLOAT_MARK))) \ + return p; \ + FP_TYPE l2 = __spirv_Dot(p, p); \ + if (l2 < FLT_MIN) { \ + p *= MAX_SQRT; \ + l2 = __spirv_Dot(p, p); \ + } else if (l2 == INFINITY) { \ + p *= MIN_SQRT; \ + l2 = __spirv_Dot(p, p); \ + if (l2 == INFINITY) { \ + p = __spirv_ocl_copysign( \ + __spirv_ocl_select( \ + (FP_TYPE##VLEN)0.0##FLOAT_MARK, \ + (FP_TYPE##VLEN)1.0##FLOAT_MARK, \ + __spirv_SConvert_R##INT_TYPE##VLEN(__spirv_IsInf(p))), \ + p); \ + l2 = __spirv_Dot(p, p); \ + } \ + } \ + return p * __spirv_ocl_rsqrt(l2); \ + } + +#define _CLC_SPIRV_NORMALIZE(VLEN) \ + _CLC_SPIRV_NORMALIZE_IMPL(float, f, int, VLEN, 0x1.0p+86F, 0x1.0p-65f) + +_CLC_OVERLOAD _CLC_DEF float __spirv_ocl_normalize(float p) { + return __spirv_ocl_sign(p); +} + +_CLC_SPIRV_NORMALIZE(2) +_CLC_SPIRV_NORMALIZE(3) +_CLC_SPIRV_NORMALIZE(4) + +#undef _CLC_SPIRV_NORMALIZE + +#ifdef cl_khr_fp64 + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +#define _CLC_SPIRV_NORMALIZE(VLEN) \ + _CLC_SPIRV_NORMALIZE_IMPL(double, , long, VLEN, 0x1.0p+563, 0x1.0p-513) + +_CLC_OVERLOAD _CLC_DEF double __spirv_ocl_normalize(double p) { + return __spirv_ocl_sign(p); +} + +_CLC_SPIRV_NORMALIZE(2) +_CLC_SPIRV_NORMALIZE(3) +_CLC_SPIRV_NORMALIZE(4) + +#undef _CLC_SPIRV_NORMALIZE + +#endif + +#ifdef cl_khr_fp16 + +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +#define _CLC_SPIRV_NORMALIZE(VLEN) \ + _CLC_SPIRV_NORMALIZE_IMPL(half, h, short, VLEN, HALF_MAX_SQRT, HALF_MIN_SQRT) + +_CLC_OVERLOAD _CLC_DEF half __spirv_ocl_normalize(half p) { + return __spirv_ocl_sign(p); +} + +_CLC_SPIRV_NORMALIZE(2) +_CLC_SPIRV_NORMALIZE(3) +_CLC_SPIRV_NORMALIZE(4) + +#undef _CLC_SPIRV_NORMALIZE + +#endif diff --git a/libclc/generic/libspirv/geometric/scale.cl b/libclc/generic/libspirv/geometric/scale.cl new file mode 100644 index 0000000000000..493912d24364c --- /dev/null +++ b/libclc/generic/libspirv/geometric/scale.cl @@ -0,0 +1,40 @@ +//===----------------------------------------------------------------------===// +// +// 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_GEN_VECTORTIMESSCALAR_IMPL(DECLSPEC, TYPE, VECLEN) \ + DECLSPEC TYPE##VECLEN __spirv_VectorTimesScalar(TYPE##VECLEN x, TYPE y) { \ + return x * (TYPE##VECLEN)y; \ + } + +#define _CLC_GEN_VECTORTIMESSCALAR(DECLSPEC, TYPE) \ + _CLC_GEN_VECTORTIMESSCALAR_IMPL(DECLSPEC, TYPE, 2) \ + _CLC_GEN_VECTORTIMESSCALAR_IMPL(DECLSPEC, TYPE, 3) \ + _CLC_GEN_VECTORTIMESSCALAR_IMPL(DECLSPEC, TYPE, 4) \ + _CLC_GEN_VECTORTIMESSCALAR_IMPL(DECLSPEC, TYPE, 8) \ + _CLC_GEN_VECTORTIMESSCALAR_IMPL(DECLSPEC, TYPE, 16) + +_CLC_GEN_VECTORTIMESSCALAR(_CLC_OVERLOAD _CLC_DEF, float) + +#ifdef cl_khr_fp64 + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +_CLC_GEN_VECTORTIMESSCALAR(_CLC_OVERLOAD _CLC_DEF, double) + +#endif + +#ifdef cl_khr_fp16 + +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +_CLC_GEN_VECTORTIMESSCALAR(_CLC_OVERLOAD _CLC_DEF, half) + +#endif diff --git a/libclc/generic/libspirv/integer/upsample.cl b/libclc/generic/libspirv/integer/upsample.cl index bc62fa5835502..b7a80748081af 100644 --- a/libclc/generic/libspirv/integer/upsample.cl +++ b/libclc/generic/libspirv/integer/upsample.cl @@ -6,8 +6,8 @@ // //===----------------------------------------------------------------------===// -#include #include +#include #define __CLC_UPSAMPLE_IMPL(PREFIX, BGENTYPE, GENTYPE, UGENTYPE) \ _CLC_OVERLOAD _CLC_DEF BGENTYPE __spirv_ocl_##PREFIX##_upsample( \ diff --git a/libclc/generic/libspirv/math/copysign.cl b/libclc/generic/libspirv/math/copysign.cl new file mode 100644 index 0000000000000..d839f9f7e88b3 --- /dev/null +++ b/libclc/generic/libspirv/math/copysign.cl @@ -0,0 +1,37 @@ +//===----------------------------------------------------------------------===// +// +// 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 + +_CLC_DEFINE_BINARY_BUILTIN(float, __spirv_ocl_copysign, __builtin_copysignf, + float, float) + +#ifdef cl_khr_fp64 + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +_CLC_DEFINE_BINARY_BUILTIN(double, __spirv_ocl_copysign, __builtin_copysign, + double, double) + +#endif + +#ifdef cl_khr_fp16 + +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +_CLC_DEF _CLC_OVERLOAD half __spirv_ocl_copysign(half x, half y) { + ushort sign_x = as_ushort(x) & 0x8000u; + ushort unsigned_y = as_ushort(y) & 0x7ffffu; + + return as_half((ushort)(sign_x | unsigned_y)); +} +_CLC_BINARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, half, __spirv_ocl_copysign, half, + half) + +#endif diff --git a/libclc/generic/include/spirv/common/degrees.inc b/libclc/generic/libspirv/math/half_rsqrt.cl similarity index 72% rename from libclc/generic/include/spirv/common/degrees.inc rename to libclc/generic/libspirv/math/half_rsqrt.cl index b951e62481255..26e00018ec8d4 100644 --- a/libclc/generic/include/spirv/common/degrees.inc +++ b/libclc/generic/libspirv/math/half_rsqrt.cl @@ -6,4 +6,8 @@ // //===----------------------------------------------------------------------===// -_CLC_OVERLOAD _CLC_DECL __SPIRV_GENTYPE __spirv_ocl_degrees(__SPIRV_GENTYPE x); +#include + +#define __CLC_BUILTIN __spirv_ocl_rsqrt +#define __CLC_FUNCTION __spirv_ocl_half_rsqrt +#include "unary_builtin.inc" diff --git a/libclc/generic/include/spirv/common/degrees.h b/libclc/generic/libspirv/math/half_sqrt.cl similarity index 72% rename from libclc/generic/include/spirv/common/degrees.h rename to libclc/generic/libspirv/math/half_sqrt.cl index b045bfe42ab9b..6ac8093447d48 100644 --- a/libclc/generic/include/spirv/common/degrees.h +++ b/libclc/generic/libspirv/math/half_sqrt.cl @@ -6,6 +6,8 @@ // //===----------------------------------------------------------------------===// -#define __SPIRV_BODY -#include -#undef __SPIRV_BODY +#include + +#define __CLC_BUILTIN __spirv_ocl_sqrt +#define __CLC_FUNCTION __spirv_ocl_half_sqrt +#include "unary_builtin.inc" diff --git a/libclc/generic/libspirv/math/rsqrt.cl b/libclc/generic/libspirv/math/rsqrt.cl new file mode 100644 index 0000000000000..728b78c38454c --- /dev/null +++ b/libclc/generic/libspirv/math/rsqrt.cl @@ -0,0 +1,41 @@ +//===----------------------------------------------------------------------===// +// +// 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 "clcmacro.h" + +_CLC_OVERLOAD _CLC_DEF float __spirv_ocl_rsqrt(float x) { + return 1.0f / __spirv_ocl_sqrt(x); +} + +_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, float, __spirv_ocl_rsqrt, float); + +#ifdef cl_khr_fp64 + +#pragma OPENCL EXTENSION cl_khr_fp64 : enable + +_CLC_OVERLOAD _CLC_DEF double __spirv_ocl_rsqrt(double x) { + return 1.0 / __spirv_ocl_sqrt(x); +} + +_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, double, __spirv_ocl_rsqrt, double); + +#endif + +#ifdef cl_khr_fp16 + +#pragma OPENCL EXTENSION cl_khr_fp16 : enable + +_CLC_OVERLOAD _CLC_DEF half __spirv_ocl_rsqrt(half x) { + return 1.0f / __spirv_ocl_sqrt((float)x); +} + +_CLC_UNARY_VECTORIZE(_CLC_OVERLOAD _CLC_DEF, half, __spirv_ocl_rsqrt, half); + +#endif diff --git a/libclc/generic/libspirv/math/sqrt.cl b/libclc/generic/libspirv/math/sqrt.cl index d12bb1178dc62..bb6fb598ac39d 100644 --- a/libclc/generic/libspirv/math/sqrt.cl +++ b/libclc/generic/libspirv/math/sqrt.cl @@ -6,8 +6,9 @@ // //===----------------------------------------------------------------------===// -#include -#include "math/clc_sqrt.h" +#include + +#include #define __CLC_BUILTIN __clc_sqrt #define __CLC_FUNCTION __spirv_ocl_sqrt diff --git a/libclc/generic/lib/subnormal_config.cl b/libclc/generic/libspirv/subnormal_config.cl similarity index 89% rename from libclc/generic/lib/subnormal_config.cl rename to libclc/generic/libspirv/subnormal_config.cl index 4bcecfd82e18a..9d8f9a57d55fe 100644 --- a/libclc/generic/lib/subnormal_config.cl +++ b/libclc/generic/libspirv/subnormal_config.cl @@ -21,16 +21,11 @@ */ #include +#include -#include "config.h" +_CLC_DEF bool __clc_fp16_subnormals_supported() { return false; } -_CLC_DEF bool __clc_fp16_subnormals_supported() { - return false; -} - -_CLC_DEF bool __clc_fp32_subnormals_supported() { - return false; -} +_CLC_DEF bool __clc_fp32_subnormals_supported() { return false; } _CLC_DEF bool __clc_fp64_subnormals_supported() { return !__clc_subnormals_disabled(); diff --git a/libclc/generic/lib/subnormal_disable.ll b/libclc/generic/libspirv/subnormal_disable.ll similarity index 100% rename from libclc/generic/lib/subnormal_disable.ll rename to libclc/generic/libspirv/subnormal_disable.ll diff --git a/libclc/generic/lib/subnormal_helper_func.ll b/libclc/generic/libspirv/subnormal_helper_func.ll similarity index 100% rename from libclc/generic/lib/subnormal_helper_func.ll rename to libclc/generic/libspirv/subnormal_helper_func.ll diff --git a/libclc/generic/lib/subnormal_use_default.ll b/libclc/generic/libspirv/subnormal_use_default.ll similarity index 100% rename from libclc/generic/lib/subnormal_use_default.ll rename to libclc/generic/libspirv/subnormal_use_default.ll diff --git a/libclc/test/binding/core/Dot.cl b/libclc/test/binding/core/Dot.cl new file mode 100644 index 0000000000000..36226676d9b3a --- /dev/null +++ b/libclc/test/binding/core/Dot.cl @@ -0,0 +1,112 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_Dot(__clc_vec2_fp32_t args_0, __clc_vec2_fp32_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_Dot(__clc_vec3_fp32_t args_0, __clc_vec3_fp32_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_Dot(__clc_vec4_fp32_t args_0, __clc_vec4_fp32_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_Dot(__clc_vec8_fp32_t args_0, __clc_vec8_fp32_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_Dot(__clc_vec16_fp32_t args_0, __clc_vec16_fp32_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_Dot(__clc_vec2_fp64_t args_0, __clc_vec2_fp64_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_Dot(__clc_vec3_fp64_t args_0, __clc_vec3_fp64_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_Dot(__clc_vec4_fp64_t args_0, __clc_vec4_fp64_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_Dot(__clc_vec8_fp64_t args_0, __clc_vec8_fp64_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_Dot(__clc_vec16_fp64_t args_0, __clc_vec16_fp64_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_Dot(__clc_vec2_fp16_t args_0, __clc_vec2_fp16_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_Dot(__clc_vec3_fp16_t args_0, __clc_vec3_fp16_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_Dot(__clc_vec4_fp16_t args_0, __clc_vec4_fp16_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_Dot(__clc_vec8_fp16_t args_0, __clc_vec8_fp16_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_Dot(__clc_vec16_fp16_t args_0, __clc_vec16_fp16_t args_1) { + return __spirv_Dot(args_0, args_1); +} + +#endif diff --git a/libclc/test/binding/ocl/copysign.cl b/libclc/test/binding/ocl/copysign.cl new file mode 100644 index 0000000000000..90582a525cdc6 --- /dev/null +++ b/libclc/test/binding/ocl/copysign.cl @@ -0,0 +1,134 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_copysign(__clc_fp32_t args_0, __clc_fp32_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_copysign(__clc_vec2_fp32_t args_0, __clc_vec2_fp32_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_copysign(__clc_vec3_fp32_t args_0, __clc_vec3_fp32_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_copysign(__clc_vec4_fp32_t args_0, __clc_vec4_fp32_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_copysign(__clc_vec8_fp32_t args_0, __clc_vec8_fp32_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_copysign(__clc_vec16_fp32_t args_0, + __clc_vec16_fp32_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_copysign(__clc_fp64_t args_0, __clc_fp64_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec2_fp64_t +test___spirv_ocl_copysign(__clc_vec2_fp64_t args_0, __clc_vec2_fp64_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec3_fp64_t +test___spirv_ocl_copysign(__clc_vec3_fp64_t args_0, __clc_vec3_fp64_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec4_fp64_t +test___spirv_ocl_copysign(__clc_vec4_fp64_t args_0, __clc_vec4_fp64_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec8_fp64_t +test___spirv_ocl_copysign(__clc_vec8_fp64_t args_0, __clc_vec8_fp64_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec16_fp64_t +test___spirv_ocl_copysign(__clc_vec16_fp64_t args_0, + __clc_vec16_fp64_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_copysign(__clc_fp16_t args_0, __clc_fp16_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec2_fp16_t +test___spirv_ocl_copysign(__clc_vec2_fp16_t args_0, __clc_vec2_fp16_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec3_fp16_t +test___spirv_ocl_copysign(__clc_vec3_fp16_t args_0, __clc_vec3_fp16_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec4_fp16_t +test___spirv_ocl_copysign(__clc_vec4_fp16_t args_0, __clc_vec4_fp16_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec8_fp16_t +test___spirv_ocl_copysign(__clc_vec8_fp16_t args_0, __clc_vec8_fp16_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec16_fp16_t +test___spirv_ocl_copysign(__clc_vec16_fp16_t args_0, + __clc_vec16_fp16_t args_1) { + return __spirv_ocl_copysign(args_0, args_1); +} + +#endif diff --git a/libclc/test/binding/ocl/cross.cl b/libclc/test/binding/ocl/cross.cl new file mode 100644 index 0000000000000..a72a9645312f9 --- /dev/null +++ b/libclc/test/binding/ocl/cross.cl @@ -0,0 +1,55 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_cross(__clc_vec3_fp32_t args_0, __clc_vec3_fp32_t args_1) { + return __spirv_ocl_cross(args_0, args_1); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec3_fp64_t +test___spirv_ocl_cross(__clc_vec3_fp64_t args_0, __clc_vec3_fp64_t args_1) { + return __spirv_ocl_cross(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec3_fp16_t +test___spirv_ocl_cross(__clc_vec3_fp16_t args_0, __clc_vec3_fp16_t args_1) { + return __spirv_ocl_cross(args_0, args_1); +} + +#endif +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_cross(__clc_vec4_fp32_t args_0, __clc_vec4_fp32_t args_1) { + return __spirv_ocl_cross(args_0, args_1); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec4_fp64_t +test___spirv_ocl_cross(__clc_vec4_fp64_t args_0, __clc_vec4_fp64_t args_1) { + return __spirv_ocl_cross(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec4_fp16_t +test___spirv_ocl_cross(__clc_vec4_fp16_t args_0, __clc_vec4_fp16_t args_1) { + return __spirv_ocl_cross(args_0, args_1); +} + +#endif diff --git a/libclc/test/binding/ocl/degrees.cl b/libclc/test/binding/ocl/degrees.cl new file mode 100644 index 0000000000000..818831bebebf9 --- /dev/null +++ b/libclc/test/binding/ocl/degrees.cl @@ -0,0 +1,131 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_degrees(__clc_fp32_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_degrees(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_degrees(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_degrees(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_degrees(__clc_vec8_fp32_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_degrees(__clc_vec16_fp32_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_degrees(__clc_fp64_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec2_fp64_t +test___spirv_ocl_degrees(__clc_vec2_fp64_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec3_fp64_t +test___spirv_ocl_degrees(__clc_vec3_fp64_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec4_fp64_t +test___spirv_ocl_degrees(__clc_vec4_fp64_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec8_fp64_t +test___spirv_ocl_degrees(__clc_vec8_fp64_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec16_fp64_t +test___spirv_ocl_degrees(__clc_vec16_fp64_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_degrees(__clc_fp16_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec2_fp16_t +test___spirv_ocl_degrees(__clc_vec2_fp16_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec3_fp16_t +test___spirv_ocl_degrees(__clc_vec3_fp16_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec4_fp16_t +test___spirv_ocl_degrees(__clc_vec4_fp16_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec8_fp16_t +test___spirv_ocl_degrees(__clc_vec8_fp16_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec16_fp16_t +test___spirv_ocl_degrees(__clc_vec16_fp16_t args_0) { + return __spirv_ocl_degrees(args_0); +} + +#endif diff --git a/libclc/test/binding/ocl/distance.cl b/libclc/test/binding/ocl/distance.cl new file mode 100644 index 0000000000000..c9cd958582b17 --- /dev/null +++ b/libclc/test/binding/ocl/distance.cl @@ -0,0 +1,93 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_distance(__clc_fp32_t args_0, __clc_fp32_t args_1) { + return __spirv_ocl_distance(args_0, args_1); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_distance(__clc_vec2_fp32_t args_0, __clc_vec2_fp32_t args_1) { + return __spirv_ocl_distance(args_0, args_1); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_distance(__clc_vec3_fp32_t args_0, __clc_vec3_fp32_t args_1) { + return __spirv_ocl_distance(args_0, args_1); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_distance(__clc_vec4_fp32_t args_0, __clc_vec4_fp32_t args_1) { + return __spirv_ocl_distance(args_0, args_1); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_distance(__clc_fp64_t args_0, __clc_fp64_t args_1) { + return __spirv_ocl_distance(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_distance(__clc_vec2_fp64_t args_0, __clc_vec2_fp64_t args_1) { + return __spirv_ocl_distance(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_distance(__clc_vec3_fp64_t args_0, __clc_vec3_fp64_t args_1) { + return __spirv_ocl_distance(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_distance(__clc_vec4_fp64_t args_0, __clc_vec4_fp64_t args_1) { + return __spirv_ocl_distance(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_distance(__clc_fp16_t args_0, __clc_fp16_t args_1) { + return __spirv_ocl_distance(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_distance(__clc_vec2_fp16_t args_0, __clc_vec2_fp16_t args_1) { + return __spirv_ocl_distance(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_distance(__clc_vec3_fp16_t args_0, __clc_vec3_fp16_t args_1) { + return __spirv_ocl_distance(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_distance(__clc_vec4_fp16_t args_0, __clc_vec4_fp16_t args_1) { + return __spirv_ocl_distance(args_0, args_1); +} + +#endif diff --git a/libclc/test/binding/ocl/fast_distance.cl b/libclc/test/binding/ocl/fast_distance.cl new file mode 100644 index 0000000000000..eff7867b8d224 --- /dev/null +++ b/libclc/test/binding/ocl/fast_distance.cl @@ -0,0 +1,39 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_fast_distance(__clc_fp32_t args_0, __clc_fp32_t args_1) { + return __spirv_ocl_fast_distance(args_0, args_1); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_fast_distance(__clc_vec2_fp32_t args_0, + __clc_vec2_fp32_t args_1) { + return __spirv_ocl_fast_distance(args_0, args_1); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_fast_distance(__clc_vec3_fp32_t args_0, + __clc_vec3_fp32_t args_1) { + return __spirv_ocl_fast_distance(args_0, args_1); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_fast_distance(__clc_vec4_fp32_t args_0, + __clc_vec4_fp32_t args_1) { + return __spirv_ocl_fast_distance(args_0, args_1); +} diff --git a/libclc/test/binding/ocl/fast_length.cl b/libclc/test/binding/ocl/fast_length.cl new file mode 100644 index 0000000000000..a632736dd463f --- /dev/null +++ b/libclc/test/binding/ocl/fast_length.cl @@ -0,0 +1,36 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_fast_length(__clc_fp32_t args_0) { + return __spirv_ocl_fast_length(args_0); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_fast_length(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_fast_length(args_0); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_fast_length(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_fast_length(args_0); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_fast_length(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_fast_length(args_0); +} diff --git a/libclc/test/binding/ocl/fast_normalize.cl b/libclc/test/binding/ocl/fast_normalize.cl new file mode 100644 index 0000000000000..b277f72126a2d --- /dev/null +++ b/libclc/test/binding/ocl/fast_normalize.cl @@ -0,0 +1,36 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_fast_normalize(__clc_fp32_t args_0) { + return __spirv_ocl_fast_normalize(args_0); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_fast_normalize(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_fast_normalize(args_0); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_fast_normalize(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_fast_normalize(args_0); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_fast_normalize(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_fast_normalize(args_0); +} diff --git a/libclc/test/binding/ocl/half_rsqrt.cl b/libclc/test/binding/ocl/half_rsqrt.cl new file mode 100644 index 0000000000000..2b1235ffe172c --- /dev/null +++ b/libclc/test/binding/ocl/half_rsqrt.cl @@ -0,0 +1,46 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_half_rsqrt(__clc_fp32_t args_0) { + return __spirv_ocl_half_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_half_rsqrt(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_half_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_half_rsqrt(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_half_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_half_rsqrt(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_half_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_half_rsqrt(__clc_vec8_fp32_t args_0) { + return __spirv_ocl_half_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_half_rsqrt(__clc_vec16_fp32_t args_0) { + return __spirv_ocl_half_rsqrt(args_0); +} diff --git a/libclc/test/binding/ocl/half_sqrt.cl b/libclc/test/binding/ocl/half_sqrt.cl new file mode 100644 index 0000000000000..11f43d77272f8 --- /dev/null +++ b/libclc/test/binding/ocl/half_sqrt.cl @@ -0,0 +1,46 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_half_sqrt(__clc_fp32_t args_0) { + return __spirv_ocl_half_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_half_sqrt(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_half_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_half_sqrt(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_half_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_half_sqrt(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_half_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_half_sqrt(__clc_vec8_fp32_t args_0) { + return __spirv_ocl_half_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_half_sqrt(__clc_vec16_fp32_t args_0) { + return __spirv_ocl_half_sqrt(args_0); +} diff --git a/libclc/test/binding/ocl/length.cl b/libclc/test/binding/ocl/length.cl new file mode 100644 index 0000000000000..615dd07a4cf7a --- /dev/null +++ b/libclc/test/binding/ocl/length.cl @@ -0,0 +1,93 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_length(__clc_fp32_t args_0) { + return __spirv_ocl_length(args_0); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_length(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_length(args_0); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_length(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_length(args_0); +} + +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_length(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_length(args_0); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_length(__clc_fp64_t args_0) { + return __spirv_ocl_length(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_length(__clc_vec2_fp64_t args_0) { + return __spirv_ocl_length(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_length(__clc_vec3_fp64_t args_0) { + return __spirv_ocl_length(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_length(__clc_vec4_fp64_t args_0) { + return __spirv_ocl_length(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_length(__clc_fp16_t args_0) { + return __spirv_ocl_length(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_length(__clc_vec2_fp16_t args_0) { + return __spirv_ocl_length(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_length(__clc_vec3_fp16_t args_0) { + return __spirv_ocl_length(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_length(__clc_vec4_fp16_t args_0) { + return __spirv_ocl_length(args_0); +} + +#endif diff --git a/libclc/test/binding/ocl/mix.cl b/libclc/test/binding/ocl/mix.cl new file mode 100644 index 0000000000000..50de1ea353534 --- /dev/null +++ b/libclc/test/binding/ocl/mix.cl @@ -0,0 +1,149 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_mix(__clc_fp32_t args_0, __clc_fp32_t args_1, + __clc_fp32_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_mix(__clc_vec2_fp32_t args_0, __clc_vec2_fp32_t args_1, + __clc_vec2_fp32_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_mix(__clc_vec3_fp32_t args_0, __clc_vec3_fp32_t args_1, + __clc_vec3_fp32_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_mix(__clc_vec4_fp32_t args_0, __clc_vec4_fp32_t args_1, + __clc_vec4_fp32_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_mix(__clc_vec8_fp32_t args_0, __clc_vec8_fp32_t args_1, + __clc_vec8_fp32_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_mix(__clc_vec16_fp32_t args_0, __clc_vec16_fp32_t args_1, + __clc_vec16_fp32_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_mix(__clc_fp64_t args_0, __clc_fp64_t args_1, + __clc_fp64_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec2_fp64_t +test___spirv_ocl_mix(__clc_vec2_fp64_t args_0, __clc_vec2_fp64_t args_1, + __clc_vec2_fp64_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec3_fp64_t +test___spirv_ocl_mix(__clc_vec3_fp64_t args_0, __clc_vec3_fp64_t args_1, + __clc_vec3_fp64_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec4_fp64_t +test___spirv_ocl_mix(__clc_vec4_fp64_t args_0, __clc_vec4_fp64_t args_1, + __clc_vec4_fp64_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec8_fp64_t +test___spirv_ocl_mix(__clc_vec8_fp64_t args_0, __clc_vec8_fp64_t args_1, + __clc_vec8_fp64_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec16_fp64_t +test___spirv_ocl_mix(__clc_vec16_fp64_t args_0, __clc_vec16_fp64_t args_1, + __clc_vec16_fp64_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_mix(__clc_fp16_t args_0, __clc_fp16_t args_1, + __clc_fp16_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec2_fp16_t +test___spirv_ocl_mix(__clc_vec2_fp16_t args_0, __clc_vec2_fp16_t args_1, + __clc_vec2_fp16_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec3_fp16_t +test___spirv_ocl_mix(__clc_vec3_fp16_t args_0, __clc_vec3_fp16_t args_1, + __clc_vec3_fp16_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec4_fp16_t +test___spirv_ocl_mix(__clc_vec4_fp16_t args_0, __clc_vec4_fp16_t args_1, + __clc_vec4_fp16_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec8_fp16_t +test___spirv_ocl_mix(__clc_vec8_fp16_t args_0, __clc_vec8_fp16_t args_1, + __clc_vec8_fp16_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec16_fp16_t +test___spirv_ocl_mix(__clc_vec16_fp16_t args_0, __clc_vec16_fp16_t args_1, + __clc_vec16_fp16_t args_2) { + return __spirv_ocl_mix(args_0, args_1, args_2); +} + +#endif diff --git a/libclc/test/binding/ocl/native_rsqrt.cl b/libclc/test/binding/ocl/native_rsqrt.cl new file mode 100644 index 0000000000000..6ab45b8532211 --- /dev/null +++ b/libclc/test/binding/ocl/native_rsqrt.cl @@ -0,0 +1,46 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_native_rsqrt(__clc_fp32_t args_0) { + return __spirv_ocl_native_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_native_rsqrt(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_native_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_native_rsqrt(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_native_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_native_rsqrt(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_native_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_native_rsqrt(__clc_vec8_fp32_t args_0) { + return __spirv_ocl_native_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_native_rsqrt(__clc_vec16_fp32_t args_0) { + return __spirv_ocl_native_rsqrt(args_0); +} diff --git a/libclc/test/binding/ocl/native_sqrt.cl b/libclc/test/binding/ocl/native_sqrt.cl new file mode 100644 index 0000000000000..f0e0cac9c94a5 --- /dev/null +++ b/libclc/test/binding/ocl/native_sqrt.cl @@ -0,0 +1,46 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_native_sqrt(__clc_fp32_t args_0) { + return __spirv_ocl_native_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_native_sqrt(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_native_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_native_sqrt(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_native_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_native_sqrt(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_native_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_native_sqrt(__clc_vec8_fp32_t args_0) { + return __spirv_ocl_native_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_native_sqrt(__clc_vec16_fp32_t args_0) { + return __spirv_ocl_native_sqrt(args_0); +} diff --git a/libclc/test/binding/ocl/normalize.cl b/libclc/test/binding/ocl/normalize.cl new file mode 100644 index 0000000000000..e69b35e63b395 --- /dev/null +++ b/libclc/test/binding/ocl/normalize.cl @@ -0,0 +1,93 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_normalize(__clc_fp32_t args_0) { + return __spirv_ocl_normalize(args_0); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_normalize(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_normalize(args_0); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_normalize(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_normalize(args_0); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_normalize(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_normalize(args_0); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_normalize(__clc_fp64_t args_0) { + return __spirv_ocl_normalize(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec2_fp64_t +test___spirv_ocl_normalize(__clc_vec2_fp64_t args_0) { + return __spirv_ocl_normalize(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec3_fp64_t +test___spirv_ocl_normalize(__clc_vec3_fp64_t args_0) { + return __spirv_ocl_normalize(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec4_fp64_t +test___spirv_ocl_normalize(__clc_vec4_fp64_t args_0) { + return __spirv_ocl_normalize(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_normalize(__clc_fp16_t args_0) { + return __spirv_ocl_normalize(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec2_fp16_t +test___spirv_ocl_normalize(__clc_vec2_fp16_t args_0) { + return __spirv_ocl_normalize(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec3_fp16_t +test___spirv_ocl_normalize(__clc_vec3_fp16_t args_0) { + return __spirv_ocl_normalize(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec4_fp16_t +test___spirv_ocl_normalize(__clc_vec4_fp16_t args_0) { + return __spirv_ocl_normalize(args_0); +} + +#endif diff --git a/libclc/test/binding/ocl/radians.cl b/libclc/test/binding/ocl/radians.cl new file mode 100644 index 0000000000000..3c7685966e70e --- /dev/null +++ b/libclc/test/binding/ocl/radians.cl @@ -0,0 +1,131 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_radians(__clc_fp32_t args_0) { + return __spirv_ocl_radians(args_0); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_radians(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_radians(args_0); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_radians(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_radians(args_0); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_radians(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_radians(args_0); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_radians(__clc_vec8_fp32_t args_0) { + return __spirv_ocl_radians(args_0); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_radians(__clc_vec16_fp32_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_radians(__clc_fp64_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec2_fp64_t +test___spirv_ocl_radians(__clc_vec2_fp64_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec3_fp64_t +test___spirv_ocl_radians(__clc_vec3_fp64_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec4_fp64_t +test___spirv_ocl_radians(__clc_vec4_fp64_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec8_fp64_t +test___spirv_ocl_radians(__clc_vec8_fp64_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec16_fp64_t +test___spirv_ocl_radians(__clc_vec16_fp64_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_radians(__clc_fp16_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec2_fp16_t +test___spirv_ocl_radians(__clc_vec2_fp16_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec3_fp16_t +test___spirv_ocl_radians(__clc_vec3_fp16_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec4_fp16_t +test___spirv_ocl_radians(__clc_vec4_fp16_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec8_fp16_t +test___spirv_ocl_radians(__clc_vec8_fp16_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec16_fp16_t +test___spirv_ocl_radians(__clc_vec16_fp16_t args_0) { + return __spirv_ocl_radians(args_0); +} + +#endif diff --git a/libclc/test/binding/ocl/rsqrt.cl b/libclc/test/binding/ocl/rsqrt.cl new file mode 100644 index 0000000000000..3c5472721af35 --- /dev/null +++ b/libclc/test/binding/ocl/rsqrt.cl @@ -0,0 +1,131 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_rsqrt(__clc_fp32_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_rsqrt(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_rsqrt(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_rsqrt(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_rsqrt(__clc_vec8_fp32_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_rsqrt(__clc_vec16_fp32_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_rsqrt(__clc_fp64_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec2_fp64_t +test___spirv_ocl_rsqrt(__clc_vec2_fp64_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec3_fp64_t +test___spirv_ocl_rsqrt(__clc_vec3_fp64_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec4_fp64_t +test___spirv_ocl_rsqrt(__clc_vec4_fp64_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec8_fp64_t +test___spirv_ocl_rsqrt(__clc_vec8_fp64_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec16_fp64_t +test___spirv_ocl_rsqrt(__clc_vec16_fp64_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_rsqrt(__clc_fp16_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec2_fp16_t +test___spirv_ocl_rsqrt(__clc_vec2_fp16_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec3_fp16_t +test___spirv_ocl_rsqrt(__clc_vec3_fp16_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec4_fp16_t +test___spirv_ocl_rsqrt(__clc_vec4_fp16_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec8_fp16_t +test___spirv_ocl_rsqrt(__clc_vec8_fp16_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec16_fp16_t +test___spirv_ocl_rsqrt(__clc_vec16_fp16_t args_0) { + return __spirv_ocl_rsqrt(args_0); +} + +#endif diff --git a/libclc/test/binding/ocl/sign.cl b/libclc/test/binding/ocl/sign.cl new file mode 100644 index 0000000000000..fae9be7aa86c3 --- /dev/null +++ b/libclc/test/binding/ocl/sign.cl @@ -0,0 +1,131 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_sign(__clc_fp32_t args_0) { + return __spirv_ocl_sign(args_0); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_sign(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_sign(args_0); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_sign(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_sign(args_0); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_sign(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_sign(args_0); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_sign(__clc_vec8_fp32_t args_0) { + return __spirv_ocl_sign(args_0); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_sign(__clc_vec16_fp32_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_sign(__clc_fp64_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec2_fp64_t +test___spirv_ocl_sign(__clc_vec2_fp64_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec3_fp64_t +test___spirv_ocl_sign(__clc_vec3_fp64_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec4_fp64_t +test___spirv_ocl_sign(__clc_vec4_fp64_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec8_fp64_t +test___spirv_ocl_sign(__clc_vec8_fp64_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec16_fp64_t +test___spirv_ocl_sign(__clc_vec16_fp64_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_sign(__clc_fp16_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec2_fp16_t +test___spirv_ocl_sign(__clc_vec2_fp16_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec3_fp16_t +test___spirv_ocl_sign(__clc_vec3_fp16_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec4_fp16_t +test___spirv_ocl_sign(__clc_vec4_fp16_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec8_fp16_t +test___spirv_ocl_sign(__clc_vec8_fp16_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec16_fp16_t +test___spirv_ocl_sign(__clc_vec16_fp16_t args_0) { + return __spirv_ocl_sign(args_0); +} + +#endif diff --git a/libclc/test/binding/ocl/smoothstep.cl b/libclc/test/binding/ocl/smoothstep.cl new file mode 100644 index 0000000000000..6b27fdf26820f --- /dev/null +++ b/libclc/test/binding/ocl/smoothstep.cl @@ -0,0 +1,152 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_smoothstep(__clc_fp32_t args_0, __clc_fp32_t args_1, + __clc_fp32_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_smoothstep(__clc_vec2_fp32_t args_0, __clc_vec2_fp32_t args_1, + __clc_vec2_fp32_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_smoothstep(__clc_vec3_fp32_t args_0, __clc_vec3_fp32_t args_1, + __clc_vec3_fp32_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_smoothstep(__clc_vec4_fp32_t args_0, __clc_vec4_fp32_t args_1, + __clc_vec4_fp32_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_smoothstep(__clc_vec8_fp32_t args_0, __clc_vec8_fp32_t args_1, + __clc_vec8_fp32_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_smoothstep(__clc_vec16_fp32_t args_0, + __clc_vec16_fp32_t args_1, + __clc_vec16_fp32_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_smoothstep(__clc_fp64_t args_0, __clc_fp64_t args_1, + __clc_fp64_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec2_fp64_t +test___spirv_ocl_smoothstep(__clc_vec2_fp64_t args_0, __clc_vec2_fp64_t args_1, + __clc_vec2_fp64_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec3_fp64_t +test___spirv_ocl_smoothstep(__clc_vec3_fp64_t args_0, __clc_vec3_fp64_t args_1, + __clc_vec3_fp64_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec4_fp64_t +test___spirv_ocl_smoothstep(__clc_vec4_fp64_t args_0, __clc_vec4_fp64_t args_1, + __clc_vec4_fp64_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec8_fp64_t +test___spirv_ocl_smoothstep(__clc_vec8_fp64_t args_0, __clc_vec8_fp64_t args_1, + __clc_vec8_fp64_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec16_fp64_t +test___spirv_ocl_smoothstep(__clc_vec16_fp64_t args_0, + __clc_vec16_fp64_t args_1, + __clc_vec16_fp64_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_smoothstep(__clc_fp16_t args_0, __clc_fp16_t args_1, + __clc_fp16_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec2_fp16_t +test___spirv_ocl_smoothstep(__clc_vec2_fp16_t args_0, __clc_vec2_fp16_t args_1, + __clc_vec2_fp16_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec3_fp16_t +test___spirv_ocl_smoothstep(__clc_vec3_fp16_t args_0, __clc_vec3_fp16_t args_1, + __clc_vec3_fp16_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec4_fp16_t +test___spirv_ocl_smoothstep(__clc_vec4_fp16_t args_0, __clc_vec4_fp16_t args_1, + __clc_vec4_fp16_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec8_fp16_t +test___spirv_ocl_smoothstep(__clc_vec8_fp16_t args_0, __clc_vec8_fp16_t args_1, + __clc_vec8_fp16_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec16_fp16_t +test___spirv_ocl_smoothstep(__clc_vec16_fp16_t args_0, + __clc_vec16_fp16_t args_1, + __clc_vec16_fp16_t args_2) { + return __spirv_ocl_smoothstep(args_0, args_1, args_2); +} + +#endif diff --git a/libclc/test/binding/ocl/sqrt.cl b/libclc/test/binding/ocl/sqrt.cl new file mode 100644 index 0000000000000..4e7b061e57f3c --- /dev/null +++ b/libclc/test/binding/ocl/sqrt.cl @@ -0,0 +1,131 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_sqrt(__clc_fp32_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_sqrt(__clc_vec2_fp32_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_sqrt(__clc_vec3_fp32_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_sqrt(__clc_vec4_fp32_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_sqrt(__clc_vec8_fp32_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_sqrt(__clc_vec16_fp32_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_sqrt(__clc_fp64_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec2_fp64_t +test___spirv_ocl_sqrt(__clc_vec2_fp64_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec3_fp64_t +test___spirv_ocl_sqrt(__clc_vec3_fp64_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec4_fp64_t +test___spirv_ocl_sqrt(__clc_vec4_fp64_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec8_fp64_t +test___spirv_ocl_sqrt(__clc_vec8_fp64_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec16_fp64_t +test___spirv_ocl_sqrt(__clc_vec16_fp64_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_sqrt(__clc_fp16_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec2_fp16_t +test___spirv_ocl_sqrt(__clc_vec2_fp16_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec3_fp16_t +test___spirv_ocl_sqrt(__clc_vec3_fp16_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec4_fp16_t +test___spirv_ocl_sqrt(__clc_vec4_fp16_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec8_fp16_t +test___spirv_ocl_sqrt(__clc_vec8_fp16_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec16_fp16_t +test___spirv_ocl_sqrt(__clc_vec16_fp16_t args_0) { + return __spirv_ocl_sqrt(args_0); +} + +#endif diff --git a/libclc/test/binding/ocl/step.cl b/libclc/test/binding/ocl/step.cl new file mode 100644 index 0000000000000..f4ca5f691ab18 --- /dev/null +++ b/libclc/test/binding/ocl/step.cl @@ -0,0 +1,131 @@ + +//===----------------------------------------------------------------------===// +// +// 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 +// +//===----------------------------------------------------------------------===// + +// Autogenerated by gen-libclc-test.py + +// RUN: %clang -emit-llvm -S -o - %s | FileCheck %s + +#include + +// CHECK-NOT: declare {{.*}} @_Z +// CHECK-NOT: call {{[^ ]*}} bitcast +__attribute__((overloadable)) __clc_fp32_t +test___spirv_ocl_step(__clc_fp32_t args_0, __clc_fp32_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +__attribute__((overloadable)) __clc_vec2_fp32_t +test___spirv_ocl_step(__clc_vec2_fp32_t args_0, __clc_vec2_fp32_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +__attribute__((overloadable)) __clc_vec3_fp32_t +test___spirv_ocl_step(__clc_vec3_fp32_t args_0, __clc_vec3_fp32_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +__attribute__((overloadable)) __clc_vec4_fp32_t +test___spirv_ocl_step(__clc_vec4_fp32_t args_0, __clc_vec4_fp32_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +__attribute__((overloadable)) __clc_vec8_fp32_t +test___spirv_ocl_step(__clc_vec8_fp32_t args_0, __clc_vec8_fp32_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +__attribute__((overloadable)) __clc_vec16_fp32_t +test___spirv_ocl_step(__clc_vec16_fp32_t args_0, __clc_vec16_fp32_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_fp64_t +test___spirv_ocl_step(__clc_fp64_t args_0, __clc_fp64_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec2_fp64_t +test___spirv_ocl_step(__clc_vec2_fp64_t args_0, __clc_vec2_fp64_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec3_fp64_t +test___spirv_ocl_step(__clc_vec3_fp64_t args_0, __clc_vec3_fp64_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec4_fp64_t +test___spirv_ocl_step(__clc_vec4_fp64_t args_0, __clc_vec4_fp64_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec8_fp64_t +test___spirv_ocl_step(__clc_vec8_fp64_t args_0, __clc_vec8_fp64_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp64 +__attribute__((overloadable)) __clc_vec16_fp64_t +test___spirv_ocl_step(__clc_vec16_fp64_t args_0, __clc_vec16_fp64_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_fp16_t +test___spirv_ocl_step(__clc_fp16_t args_0, __clc_fp16_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec2_fp16_t +test___spirv_ocl_step(__clc_vec2_fp16_t args_0, __clc_vec2_fp16_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec3_fp16_t +test___spirv_ocl_step(__clc_vec3_fp16_t args_0, __clc_vec3_fp16_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec4_fp16_t +test___spirv_ocl_step(__clc_vec4_fp16_t args_0, __clc_vec4_fp16_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec8_fp16_t +test___spirv_ocl_step(__clc_vec8_fp16_t args_0, __clc_vec8_fp16_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#endif +#ifdef cl_khr_fp16 +__attribute__((overloadable)) __clc_vec16_fp16_t +test___spirv_ocl_step(__clc_vec16_fp16_t args_0, __clc_vec16_fp16_t args_1) { + return __spirv_ocl_step(args_0, args_1); +} + +#endif diff --git a/libclc/utils/gen-libclc-test.py b/libclc/utils/gen-libclc-test.py index bfbfe1525c797..6d9b8e73326eb 100755 --- a/libclc/utils/gen-libclc-test.py +++ b/libclc/utils/gen-libclc-test.py @@ -15,6 +15,7 @@ def ignore_function(fun): whitelist = [ "_All", "_Any", + "_step", "abs", "abs_diff", "add_sat", @@ -22,17 +23,23 @@ def ignore_function(fun): "bitselect", "clz", "ControlBarrier", + "cross", "ctz", + "degrees", + "distance", + "Dot", "Equal", "GreaterThan", "GreaterThanEqual", "GroupAsyncCopy", "GroupWaitEvents", "hadd", + "hadd", "IsFinite", "IsInf", "IsNan", "IsNormal", + "length", "LessOrGreater", "LessThan", "LessThanEqual", @@ -40,16 +47,22 @@ def ignore_function(fun): "mad_hi", "mad_sat", "MemoryBarrier", + "mix", "mul24", "mul_hi", + "normalize", "NotEqual", "Ordered", "popcount", "prefetch", + "radians", "rhadd", "rotate", "select", + "sign", "SignBitSet", + "smoothstep", + "sqrt", "sub_sat", "Unordered", "upsample", diff --git a/sycl/test/built-ins/scalar_geometric.cpp b/sycl/test/built-ins/scalar_geometric.cpp index 075ab638d06c4..b2298e49768f0 100644 --- a/sycl/test/built-ins/scalar_geometric.cpp +++ b/sycl/test/built-ins/scalar_geometric.cpp @@ -4,9 +4,6 @@ // RUN: %GPU_RUN_PLACEHOLDER %t.out // RUN: %ACC_RUN_PLACEHOLDER %t.out -// TODO: ptxas fatal : Unresolved extern function '_Z12__spirv_FMulff' -// XFAIL: cuda - #include #include diff --git a/sycl/test/built-ins/vector_geometric.cpp b/sycl/test/built-ins/vector_geometric.cpp index 55d6b371d79b2..0779af52a8e46 100644 --- a/sycl/test/built-ins/vector_geometric.cpp +++ b/sycl/test/built-ins/vector_geometric.cpp @@ -4,9 +4,6 @@ // RUN: %GPU_RUN_PLACEHOLDER %t.out // RUN: %ACC_RUN_PLACEHOLDER %t.out -// TODO: ptxas fatal : Unresolved extern function '_Z11__spirv_DotDv2_fS_' -// XFAIL: cuda - #include #include