mirror of
https://github.com/KhronosGroup/OpenCL-CTS.git
synced 2026-03-19 22:19:02 +00:00
Initial open source release of OpenCL 2.2 CTS.
This commit is contained in:
142
test_conformance/clcpp/integer_funcs/24bit_funcs.hpp
Normal file
142
test_conformance/clcpp/integer_funcs/24bit_funcs.hpp
Normal file
@@ -0,0 +1,142 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef TEST_CONFORMANCE_CLCPP_INTEGER_FUNCS_24BIT_HPP
|
||||
#define TEST_CONFORMANCE_CLCPP_INTEGER_FUNCS_24BIT_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include <type_traits>
|
||||
|
||||
template<class IN1, class IN2, class IN3, class OUT1>
|
||||
struct int_func_mad24 : public ternary_func<IN1, IN2, IN3, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "mad24";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y, const IN3& z)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, IN2>::value
|
||||
&& std::is_same<IN2, IN3>::value
|
||||
&& std::is_same<IN3, OUT1>::value,
|
||||
"All types must be the same"
|
||||
);
|
||||
static_assert(
|
||||
std::is_same<cl_uint, IN1>::value || std::is_same<cl_int, IN1>::value,
|
||||
"Function takes only signed/unsigned integers."
|
||||
);
|
||||
return (x * y) + z;
|
||||
}
|
||||
|
||||
IN1 min1()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
IN1 max1()
|
||||
{
|
||||
return (std::numeric_limits<IN1>::max)() & IN1(0x00FFFF);
|
||||
}
|
||||
|
||||
IN2 min2()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
IN2 max2()
|
||||
{
|
||||
return (std::numeric_limits<IN2>::max)() & IN2(0x00FFFF);
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1>
|
||||
struct int_func_mul24 : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "mul24";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, IN2>::value
|
||||
&& std::is_same<IN2, OUT1>::value,
|
||||
"All types must be the same"
|
||||
);
|
||||
static_assert(
|
||||
std::is_same<cl_uint, IN1>::value || std::is_same<cl_int, IN1>::value,
|
||||
"Function takes only signed/unsigned integers."
|
||||
);
|
||||
return x * y;
|
||||
}
|
||||
|
||||
IN1 min1()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
IN1 max1()
|
||||
{
|
||||
return (std::numeric_limits<IN1>::max)() & IN1(0x00FFFF);
|
||||
}
|
||||
|
||||
IN2 min2()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
IN2 max2()
|
||||
{
|
||||
return (std::numeric_limits<IN2>::max)() & IN2(0x00FFFF);
|
||||
}
|
||||
};
|
||||
|
||||
AUTO_TEST_CASE(test_int_24bit_funcs)
|
||||
(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems)
|
||||
{
|
||||
int error = CL_SUCCESS;
|
||||
int last_error = CL_SUCCESS;
|
||||
|
||||
// intn mad24(intn x, intn y, intn z);
|
||||
// uintn mad24(uintn x, uintn y, uintn z);
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_mad24<cl_int, cl_int, cl_int, cl_int>()))
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_mad24<cl_uint, cl_uint, cl_uint, cl_uint>()))
|
||||
|
||||
// intn mul24(intn x, intn y);
|
||||
// uintn mul24(uintn x, uintn y);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_mul24<cl_int, cl_int, cl_int>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_mul24<cl_uint, cl_uint, cl_uint>()))
|
||||
|
||||
if(error != CL_SUCCESS)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
#endif // TEST_CONFORMANCE_CLCPP_INTEGER_FUNCS_24BIT_HPP
|
||||
12
test_conformance/clcpp/integer_funcs/CMakeLists.txt
Normal file
12
test_conformance/clcpp/integer_funcs/CMakeLists.txt
Normal file
@@ -0,0 +1,12 @@
|
||||
set(MODULE_NAME CPP_INTEGER_FUNCS)
|
||||
|
||||
set(${MODULE_NAME}_SOURCES
|
||||
main.cpp
|
||||
../../../test_common/harness/errorHelpers.c
|
||||
../../../test_common/harness/testHarness.c
|
||||
../../../test_common/harness/kernelHelpers.c
|
||||
../../../test_common/harness/msvc9.c
|
||||
../../../test_common/harness/parseParameters.cpp
|
||||
)
|
||||
|
||||
include(../../CMakeCommon.txt)
|
||||
232
test_conformance/clcpp/integer_funcs/bitwise_funcs.hpp
Normal file
232
test_conformance/clcpp/integer_funcs/bitwise_funcs.hpp
Normal file
@@ -0,0 +1,232 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef TEST_CONFORMANCE_CLCPP_INTEGER_FUNCS_BITWISE_HPP
|
||||
#define TEST_CONFORMANCE_CLCPP_INTEGER_FUNCS_BITWISE_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include <type_traits>
|
||||
|
||||
template<class IN1, class OUT1>
|
||||
struct int_func_popcount : public unary_func<IN1, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "popcount";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(IN1 x)
|
||||
{
|
||||
OUT1 count = 0;
|
||||
for (count = 0; x != 0; count++)
|
||||
{
|
||||
x &= x - 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class OUT1>
|
||||
struct int_func_clz : public unary_func<IN1, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "clz";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(IN1 x)
|
||||
{
|
||||
OUT1 count = 0;
|
||||
if(std::is_unsigned<IN1>::value)
|
||||
{
|
||||
cl_ulong value = x;
|
||||
value <<= 8 * sizeof(value) - (8 * sizeof(x));
|
||||
for(count = 0; 0 == (value & (CL_LONG_MIN)); count++)
|
||||
{
|
||||
value <<= 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
cl_long value = x;
|
||||
value <<= 8 * sizeof(value) - (8 * sizeof(x));
|
||||
for(count = 0; 0 == (value & (CL_LONG_MIN)); count++)
|
||||
{
|
||||
value <<= 1;
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class OUT1>
|
||||
struct int_func_ctz : public unary_func<IN1, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "ctz";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(IN1 x)
|
||||
{
|
||||
if(x == 0)
|
||||
return sizeof(x);
|
||||
|
||||
OUT1 count = 0;
|
||||
IN1 value = x;
|
||||
for(count = 0; 0 == (value & 0x1); count++)
|
||||
{
|
||||
value >>= 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1>
|
||||
struct int_func_rotate : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "rotate";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(IN1 value, IN2 shift)
|
||||
{
|
||||
static_assert(
|
||||
std::is_unsigned<IN1>::value,
|
||||
"Only unsigned integers are supported"
|
||||
);
|
||||
if ((shift &= sizeof(value)*8 - 1) == 0)
|
||||
return value;
|
||||
return (value << shift) | (value >> (sizeof(value)*8 - shift));
|
||||
}
|
||||
|
||||
IN2 min2()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
IN2 max2()
|
||||
{
|
||||
return sizeof(IN1) * 8;
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1>
|
||||
struct int_func_upsample : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "upsample";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(IN1 hi, IN2 lo)
|
||||
{
|
||||
static_assert(
|
||||
sizeof(IN1) == sizeof(IN2),
|
||||
"sizeof(IN1) != sizeof(IN2)"
|
||||
);
|
||||
static_assert(
|
||||
sizeof(OUT1) == 2 * sizeof(IN1),
|
||||
"sizeof(OUT1) != 2 * sizeof(IN1)"
|
||||
);
|
||||
static_assert(
|
||||
std::is_unsigned<IN2>::value,
|
||||
"IN2 type must be unsigned"
|
||||
);
|
||||
return (static_cast<OUT1>(hi) << (8*sizeof(IN1))) | lo;
|
||||
}
|
||||
|
||||
IN2 min2()
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
IN2 max2()
|
||||
{
|
||||
return sizeof(IN1) * 8;
|
||||
}
|
||||
};
|
||||
|
||||
AUTO_TEST_CASE(test_int_bitwise_funcs)
|
||||
(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems)
|
||||
{
|
||||
int error = CL_SUCCESS;
|
||||
int last_error = CL_SUCCESS;
|
||||
|
||||
TEST_UNARY_FUNC_MACRO((int_func_popcount<cl_int, cl_int>()))
|
||||
TEST_UNARY_FUNC_MACRO((int_func_popcount<cl_uint, cl_uint>()))
|
||||
TEST_UNARY_FUNC_MACRO((int_func_popcount<cl_long, cl_long>()))
|
||||
TEST_UNARY_FUNC_MACRO((int_func_popcount<cl_ulong, cl_ulong>()))
|
||||
|
||||
TEST_UNARY_FUNC_MACRO((int_func_clz<cl_int, cl_int>()))
|
||||
TEST_UNARY_FUNC_MACRO((int_func_clz<cl_uint, cl_uint>()))
|
||||
TEST_UNARY_FUNC_MACRO((int_func_clz<cl_long, cl_long>()))
|
||||
TEST_UNARY_FUNC_MACRO((int_func_clz<cl_ulong, cl_ulong>()))
|
||||
|
||||
TEST_UNARY_FUNC_MACRO((int_func_ctz<cl_int, cl_int>()))
|
||||
TEST_UNARY_FUNC_MACRO((int_func_ctz<cl_uint, cl_uint>()))
|
||||
TEST_UNARY_FUNC_MACRO((int_func_ctz<cl_long, cl_long>()))
|
||||
TEST_UNARY_FUNC_MACRO((int_func_ctz<cl_ulong, cl_ulong>()))
|
||||
|
||||
TEST_BINARY_FUNC_MACRO((int_func_rotate<cl_uint, cl_uint, cl_uint>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_rotate<cl_ulong, cl_ulong, cl_ulong>()))
|
||||
|
||||
// shortn upsample(charn hi, ucharn lo);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_upsample<cl_char, cl_uchar, cl_short>()))
|
||||
// ushortn upsample(ucharn hi, ucharn lo);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_upsample<cl_uchar, cl_uchar, cl_ushort>()))
|
||||
// intn upsample(shortn hi, ushortn lo);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_upsample<cl_short, cl_ushort, cl_int>()))
|
||||
// uintn upsample(ushortn hi, ushortn lo);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_upsample<cl_ushort, cl_ushort, cl_uint>()))
|
||||
// longn upsample(intn hi, uintn lo);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_upsample<cl_int, cl_uint, cl_long>()))
|
||||
// ulongn upsample(uintn hi, uintn lo);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_upsample<cl_uint, cl_uint, cl_ulong>()))
|
||||
|
||||
if(error != CL_SUCCESS)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
#endif // TEST_CONFORMANCE_CLCPP_INTEGER_FUNCS_BITWISE_HPP
|
||||
26
test_conformance/clcpp/integer_funcs/common.hpp
Normal file
26
test_conformance/clcpp/integer_funcs/common.hpp
Normal file
@@ -0,0 +1,26 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef TEST_CONFORMANCE_CLCPP_INTEGER_FUNCS_COMMON_HPP
|
||||
#define TEST_CONFORMANCE_CLCPP_INTEGER_FUNCS_COMMON_HPP
|
||||
|
||||
#include <random>
|
||||
#include <limits>
|
||||
#include <algorithm>
|
||||
|
||||
#include "../common.hpp"
|
||||
#include "../funcs_test_utils.hpp"
|
||||
|
||||
#endif // TEST_CONFORMANCE_CLCPP_INTEGER_FUNCS_COMMON_HPP
|
||||
31
test_conformance/clcpp/integer_funcs/main.cpp
Normal file
31
test_conformance/clcpp/integer_funcs/main.cpp
Normal file
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#include "../common.hpp"
|
||||
|
||||
#include "bitwise_funcs.hpp"
|
||||
#include "numeric_funcs.hpp"
|
||||
#include "24bit_funcs.hpp"
|
||||
|
||||
int main(int argc, const char *argv[])
|
||||
{
|
||||
// Get list to all test functions
|
||||
std::vector<basefn> testfn_list = autotest::test_suite::get_test_functions();
|
||||
// Get names of all test functions
|
||||
std::vector<std::string> testfn_names = autotest::test_suite::get_test_names();
|
||||
// Create a vector of pointers to the names test functions
|
||||
std::vector<const char *> testfn_names_c_str = autotest::get_strings_ptrs(testfn_names);
|
||||
return runTestHarness(argc, argv, testfn_list.size(), testfn_list.data(), testfn_names_c_str.data(), false, false, 0);
|
||||
}
|
||||
703
test_conformance/clcpp/integer_funcs/numeric_funcs.hpp
Normal file
703
test_conformance/clcpp/integer_funcs/numeric_funcs.hpp
Normal file
@@ -0,0 +1,703 @@
|
||||
//
|
||||
// Copyright (c) 2017 The Khronos Group Inc.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
#ifndef TEST_CONFORMANCE_CLCPP_INTEGER_FUNCS_NUMERIC_HPP
|
||||
#define TEST_CONFORMANCE_CLCPP_INTEGER_FUNCS_NUMERIC_HPP
|
||||
|
||||
#include "common.hpp"
|
||||
#include <type_traits>
|
||||
|
||||
template<class IN1, class OUT1>
|
||||
struct int_func_abs : public unary_func<IN1, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "abs";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x)
|
||||
{
|
||||
static_assert(
|
||||
std::is_unsigned<OUT1>::value,
|
||||
"OUT1 type must be unsigned"
|
||||
);
|
||||
if(x < IN1(0))
|
||||
return static_cast<OUT1>(-x);
|
||||
return static_cast<OUT1>(x);
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1>
|
||||
struct int_func_abs_diff : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "abs_diff";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, IN2>::value,
|
||||
"IN1 must be IN2"
|
||||
);
|
||||
static_assert(
|
||||
std::is_unsigned<OUT1>::value,
|
||||
"OUT1 type must be unsigned"
|
||||
);
|
||||
if(x < y)
|
||||
return static_cast<OUT1>(y-x);
|
||||
return static_cast<OUT1>(x-y);
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1>
|
||||
struct int_func_add_sat : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "add_sat";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, IN2>::value,
|
||||
"IN1 must be IN2"
|
||||
);
|
||||
static_assert(
|
||||
std::is_same<OUT1, IN2>::value,
|
||||
"OUT1 must be IN2"
|
||||
);
|
||||
// sat unsigned integers
|
||||
if(std::is_unsigned<OUT1>::value)
|
||||
{
|
||||
OUT1 z = x + y;
|
||||
if(z < x || z < y)
|
||||
return (std::numeric_limits<OUT1>::max)();
|
||||
return z;
|
||||
}
|
||||
// sat signed integers
|
||||
OUT1 z = x + y;
|
||||
if(y > 0)
|
||||
{
|
||||
if(z < x)
|
||||
return (std::numeric_limits<OUT1>::max)();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(z > x)
|
||||
return (std::numeric_limits<OUT1>::min)();
|
||||
}
|
||||
return z;
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1>
|
||||
struct int_func_hadd : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "hadd";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, IN2>::value,
|
||||
"IN1 must be IN2"
|
||||
);
|
||||
static_assert(
|
||||
std::is_same<OUT1, IN2>::value,
|
||||
"OUT1 must be IN2"
|
||||
);
|
||||
return (x >> OUT1(1)) + (y >> OUT1(1)) + (x & y & OUT1(1));
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1>
|
||||
struct int_func_rhadd : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "rhadd";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, IN2>::value,
|
||||
"IN1 must be IN2"
|
||||
);
|
||||
static_assert(
|
||||
std::is_same<OUT1, IN2>::value,
|
||||
"OUT1 must be IN2"
|
||||
);
|
||||
return (x >> OUT1(1)) + (y >> OUT1(1)) + ((x | y) & OUT1(1));
|
||||
}
|
||||
};
|
||||
|
||||
// clamp for scalars
|
||||
template<class IN1, class IN2, class IN3, class OUT1, class Enable = void>
|
||||
struct int_func_clamp : public ternary_func<IN1, IN2, IN3, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "clamp";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& minval, const IN3& maxval)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN2, IN3>::value,
|
||||
"IN3 must be IN2"
|
||||
);
|
||||
static_assert(
|
||||
std::is_same<OUT1, IN1>::value,
|
||||
"OUT1 must be IN1"
|
||||
);
|
||||
return (std::min)((std::max)(x, minval), maxval);
|
||||
}
|
||||
|
||||
IN2 min2()
|
||||
{
|
||||
return (std::numeric_limits<IN2>::min)();
|
||||
}
|
||||
|
||||
IN2 max2()
|
||||
{
|
||||
return (std::numeric_limits<IN2>::max)() / IN2(2);
|
||||
}
|
||||
|
||||
IN3 min3()
|
||||
{
|
||||
return IN3(1) + ((std::numeric_limits<IN3>::max)() / IN3(2));
|
||||
}
|
||||
|
||||
IN3 max3()
|
||||
{
|
||||
return (std::numeric_limits<IN3>::max)();
|
||||
}
|
||||
};
|
||||
|
||||
// gentype clamp(gentype x, scalar minval, scalar maxval);
|
||||
template<class IN1, class IN2, class IN3, class OUT1>
|
||||
struct int_func_clamp<IN1, IN2, IN3, OUT1, typename std::enable_if<is_vector_type<OUT1>::value>::type> : public ternary_func<IN1, IN2, IN3, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "clamp";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& minval, const IN3& maxval)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN2, IN3>::value,
|
||||
"IN3 must be IN2"
|
||||
);
|
||||
static_assert(
|
||||
!is_vector_type<IN2>::value && !is_vector_type<IN3>::value,
|
||||
"IN3 and IN2 must be scalar"
|
||||
);
|
||||
static_assert(
|
||||
std::is_same<OUT1, IN1>::value,
|
||||
"OUT1 must be IN1"
|
||||
);
|
||||
OUT1 result;
|
||||
for(size_t i = 0; i < vector_size<OUT1>::value; i++)
|
||||
{
|
||||
result.s[i] = (std::min)((std::max)(x.s[i], minval), maxval);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
IN1 min1()
|
||||
{
|
||||
typedef typename scalar_type<IN1>::type SCALAR1;
|
||||
IN1 min1;
|
||||
for(size_t i = 0; i < vector_size<IN1>::value; i++)
|
||||
{
|
||||
min1.s[i] = (std::numeric_limits<SCALAR1>::min)();
|
||||
}
|
||||
return min1;
|
||||
}
|
||||
|
||||
IN1 max1()
|
||||
{
|
||||
typedef typename scalar_type<IN1>::type SCALAR1;
|
||||
IN1 max1;
|
||||
for(size_t i = 0; i < vector_size<IN1>::value; i++)
|
||||
{
|
||||
max1.s[i] = (std::numeric_limits<SCALAR1>::max)();
|
||||
}
|
||||
return max1;
|
||||
}
|
||||
|
||||
IN2 min2()
|
||||
{
|
||||
return (std::numeric_limits<IN2>::min)();
|
||||
}
|
||||
|
||||
IN2 max2()
|
||||
{
|
||||
return (std::numeric_limits<IN2>::max)() / IN2(2);
|
||||
}
|
||||
|
||||
IN3 min3()
|
||||
{
|
||||
return IN3(1) + ((std::numeric_limits<IN3>::max)() / IN3(2));
|
||||
}
|
||||
|
||||
IN3 max3()
|
||||
{
|
||||
return (std::numeric_limits<IN3>::max)();
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1>
|
||||
struct int_func_mul_hi : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "mul_hi";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, IN2>::value
|
||||
&& std::is_same<IN2, OUT1>::value,
|
||||
"Types must be the same"
|
||||
);
|
||||
static_assert(
|
||||
!std::is_same<IN1, cl_long>::value && !std::is_same<IN1, cl_ulong>::value,
|
||||
"Operation unimplemented for 64-bit scalars"
|
||||
);
|
||||
cl_long xl = static_cast<cl_long>(x);
|
||||
cl_long yl = static_cast<cl_long>(y);
|
||||
return static_cast<OUT1>((xl * yl) >> (8 * sizeof(OUT1)));
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class IN3, class OUT1>
|
||||
struct int_func_mad_hi : public ternary_func<IN1, IN2, IN3, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "mad_hi";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y, const IN3& z)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, IN2>::value
|
||||
&& std::is_same<IN2, IN3>::value
|
||||
&& std::is_same<IN3, OUT1>::value,
|
||||
"Types must be the same"
|
||||
);
|
||||
return int_func_mul_hi<IN1, IN2, OUT1>()(x, y) + z;
|
||||
}
|
||||
};
|
||||
|
||||
// This test is implemented only for unsigned integers
|
||||
template<class IN1, class IN2, class IN3, class OUT1>
|
||||
struct int_func_mad_sat : public ternary_func<IN1, IN2, IN3, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "mad_sat";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y, const IN3& z)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, IN2>::value
|
||||
&& std::is_same<IN2, IN3>::value
|
||||
&& std::is_same<IN3, OUT1>::value,
|
||||
"Types must be the same"
|
||||
);
|
||||
static_assert(
|
||||
std::is_unsigned<OUT1>::value,
|
||||
"Test operation is not implemented for signed integers"
|
||||
);
|
||||
// mad_sat unsigned integers
|
||||
OUT1 w1 = (x * y);
|
||||
if (x != 0 && w1 / x != y)
|
||||
return (std::numeric_limits<OUT1>::max)();
|
||||
OUT1 w2 = w1 + z;
|
||||
if(w2 < w1)
|
||||
return (std::numeric_limits<OUT1>::max)();
|
||||
return w2;
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1>
|
||||
struct int_func_sub_sat : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "sub_sat";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, IN2>::value && std::is_same<IN2, OUT1>::value,
|
||||
"IN1, IN2 and OUT1 must be the same types"
|
||||
);
|
||||
// sat unsigned integers
|
||||
if(std::is_unsigned<OUT1>::value)
|
||||
{
|
||||
OUT1 z = x - y;
|
||||
if(x < y)
|
||||
return (std::numeric_limits<OUT1>::min)();
|
||||
return z;
|
||||
}
|
||||
// sat signed integers
|
||||
OUT1 z = x - y;
|
||||
if(y < 0)
|
||||
{
|
||||
if(z < x)
|
||||
return (std::numeric_limits<OUT1>::max)();
|
||||
}
|
||||
else
|
||||
{
|
||||
if(z > x)
|
||||
return (std::numeric_limits<OUT1>::min)();
|
||||
}
|
||||
return z;
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1, class Enable = void>
|
||||
struct int_func_max : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "max";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, IN2>::value && std::is_same<IN2, OUT1>::value,
|
||||
"IN1, IN2 and OUT1 must be the same types"
|
||||
);
|
||||
return (std::max)(x, y);
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1>
|
||||
struct int_func_max<IN1, IN2, OUT1, typename std::enable_if<is_vector_type<OUT1>::value>::type> : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "max";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
IN1 min1()
|
||||
{
|
||||
typedef typename scalar_type<IN1>::type SCALAR1;
|
||||
IN1 min1;
|
||||
for(size_t i = 0; i < vector_size<IN1>::value; i++)
|
||||
{
|
||||
min1.s[i] = (std::numeric_limits<SCALAR1>::min)();
|
||||
}
|
||||
return min1;
|
||||
}
|
||||
|
||||
IN1 max1()
|
||||
{
|
||||
typedef typename scalar_type<IN1>::type SCALAR1;
|
||||
IN1 max1;
|
||||
for(size_t i = 0; i < vector_size<IN1>::value; i++)
|
||||
{
|
||||
max1.s[i] = (std::numeric_limits<SCALAR1>::max)();
|
||||
}
|
||||
return max1;
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, OUT1>::value,
|
||||
"IN1 and OUT1 must be the same types"
|
||||
);
|
||||
static_assert(
|
||||
!is_vector_type<IN2>::value,
|
||||
"IN2 must be scalar"
|
||||
);
|
||||
static_assert(
|
||||
std::is_same<typename scalar_type<OUT1>::type, IN2>::value,
|
||||
"IN2 must match with OUT1 and IN1"
|
||||
);
|
||||
IN1 result = x;
|
||||
for(size_t i = 0; i < vector_size<IN1>::value; i++)
|
||||
{
|
||||
result.s[i] = (std::max)(x.s[i], y);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1, class Enable = void>
|
||||
struct int_func_min : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "min";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, IN2>::value && std::is_same<IN2, OUT1>::value,
|
||||
"IN1, IN2 and OUT1 must be the same types"
|
||||
);
|
||||
return (std::min)(x, y);
|
||||
}
|
||||
};
|
||||
|
||||
template<class IN1, class IN2, class OUT1>
|
||||
struct int_func_min<IN1, IN2, OUT1, typename std::enable_if<is_vector_type<OUT1>::value>::type> : public binary_func<IN1, IN2, OUT1>
|
||||
{
|
||||
std::string str()
|
||||
{
|
||||
return "min";
|
||||
}
|
||||
|
||||
std::string headers()
|
||||
{
|
||||
return "#include <opencl_integer>\n";
|
||||
}
|
||||
|
||||
IN1 min1()
|
||||
{
|
||||
typedef typename scalar_type<IN1>::type SCALAR1;
|
||||
IN1 min1;
|
||||
for(size_t i = 0; i < vector_size<IN1>::value; i++)
|
||||
{
|
||||
min1.s[i] = (std::numeric_limits<SCALAR1>::min)();
|
||||
}
|
||||
return min1;
|
||||
}
|
||||
|
||||
IN1 max1()
|
||||
{
|
||||
typedef typename scalar_type<IN1>::type SCALAR1;
|
||||
IN1 max1;
|
||||
for(size_t i = 0; i < vector_size<IN1>::value; i++)
|
||||
{
|
||||
max1.s[i] = (std::numeric_limits<SCALAR1>::max)();
|
||||
}
|
||||
return max1;
|
||||
}
|
||||
|
||||
OUT1 operator()(const IN1& x, const IN2& y)
|
||||
{
|
||||
static_assert(
|
||||
std::is_same<IN1, OUT1>::value,
|
||||
"IN1 and OUT1 must be the same types"
|
||||
);
|
||||
static_assert(
|
||||
!is_vector_type<IN2>::value,
|
||||
"IN2 must be scalar"
|
||||
);
|
||||
static_assert(
|
||||
std::is_same<typename scalar_type<OUT1>::type, IN2>::value,
|
||||
"IN2 must match with OUT1 and IN1"
|
||||
);
|
||||
IN1 result = x;
|
||||
for(size_t i = 0; i < vector_size<IN1>::value; i++)
|
||||
{
|
||||
result.s[i] = (std::min)(x.s[i], y);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
};
|
||||
|
||||
AUTO_TEST_CASE(test_int_numeric_funcs)
|
||||
(cl_device_id device, cl_context context, cl_command_queue queue, int n_elems)
|
||||
{
|
||||
int error = CL_SUCCESS;
|
||||
int last_error = CL_SUCCESS;
|
||||
|
||||
// ugentype abs(gentype x);
|
||||
TEST_UNARY_FUNC_MACRO((int_func_abs<cl_int, cl_uint>()))
|
||||
TEST_UNARY_FUNC_MACRO((int_func_abs<cl_uint, cl_uint>()))
|
||||
TEST_UNARY_FUNC_MACRO((int_func_abs<cl_long, cl_ulong>()))
|
||||
TEST_UNARY_FUNC_MACRO((int_func_abs<cl_ulong, cl_ulong>()))
|
||||
|
||||
// ugentype abs_diff(gentype x, gentype y);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_abs_diff<cl_int, cl_int, cl_uint>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_abs_diff<cl_uint, cl_uint, cl_uint>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_abs_diff<cl_long, cl_long, cl_ulong>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_abs_diff<cl_ulong, cl_ulong, cl_ulong>()))
|
||||
|
||||
// gentype add_sat(gentype x, gentype y);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_add_sat<cl_int, cl_int, cl_int>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_add_sat<cl_uint, cl_uint, cl_uint>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_add_sat<cl_long, cl_long, cl_long>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_add_sat<cl_ulong, cl_ulong, cl_ulong>()))
|
||||
|
||||
// gentype hadd(gentype x, gentype y);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_hadd<cl_int, cl_int, cl_int>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_hadd<cl_uint, cl_uint, cl_uint>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_hadd<cl_long, cl_long, cl_long>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_hadd<cl_ulong, cl_ulong, cl_ulong>()))
|
||||
|
||||
// gentype rhadd(gentype x, gentype y);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_rhadd<cl_int, cl_int, cl_int>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_rhadd<cl_uint, cl_uint, cl_uint>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_rhadd<cl_long, cl_long, cl_long>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_rhadd<cl_ulong, cl_ulong, cl_ulong>()))
|
||||
|
||||
// gentype clamp(gentype x, gentype minval, gentype maxval);
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_clamp<cl_int, cl_int, cl_int, cl_int>()))
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_clamp<cl_uint, cl_uint, cl_uint, cl_uint>()))
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_clamp<cl_long, cl_long, cl_long, cl_long>()))
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_clamp<cl_ulong, cl_ulong, cl_ulong, cl_ulong>()))
|
||||
|
||||
// gentype clamp(gentype x, scalar minval, scalar maxval);
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_clamp<cl_int2, cl_int, cl_int, cl_int2>()))
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_clamp<cl_uint4, cl_uint, cl_uint, cl_uint4>()))
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_clamp<cl_long8, cl_long, cl_long, cl_long8>()))
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_clamp<cl_ulong16, cl_ulong, cl_ulong, cl_ulong16>()))
|
||||
|
||||
// gentype mad_hi(gentype a, gentype b, gentype c);
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_mad_hi<cl_short, cl_short, cl_short, cl_short>()))
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_mad_hi<cl_ushort, cl_ushort, cl_ushort, cl_ushort>()))
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_mad_hi<cl_int, cl_int, cl_int, cl_int>()))
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_mad_hi<cl_uint, cl_uint, cl_uint, cl_uint>()))
|
||||
|
||||
// gentype mad_sat(gentype a, gentype b, gentype c);
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_mad_sat<cl_ushort, cl_ushort, cl_ushort, cl_ushort>()))
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_mad_sat<cl_uint, cl_uint, cl_uint, cl_uint>()))
|
||||
TEST_TERNARY_FUNC_MACRO((int_func_mad_sat<cl_ulong, cl_ulong, cl_ulong, cl_ulong>()))
|
||||
|
||||
// gentype max(gentype x, gentype y);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_max<cl_int, cl_int, cl_int>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_max<cl_uint, cl_uint, cl_uint>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_max<cl_long, cl_long, cl_long>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_max<cl_ulong, cl_ulong, cl_ulong>()))
|
||||
|
||||
// gentype max(gentype x, scalar y);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_max<cl_int2, cl_int, cl_int2>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_max<cl_uint4, cl_uint, cl_uint4>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_max<cl_long8, cl_long, cl_long8>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_max<cl_ulong16, cl_ulong, cl_ulong16>()))
|
||||
|
||||
// gentype min(gentype x, gentype y);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_min<cl_int, cl_int, cl_int>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_min<cl_uint, cl_uint, cl_uint>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_min<cl_long, cl_long, cl_long>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_min<cl_ulong, cl_ulong, cl_ulong>()))
|
||||
|
||||
// gentype min(gentype x, scalar y);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_min<cl_int2, cl_int, cl_int2>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_min<cl_uint4, cl_uint, cl_uint4>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_min<cl_long8, cl_long, cl_long8>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_min<cl_ulong16, cl_ulong, cl_ulong16>()))
|
||||
|
||||
// gentype mul_hi(gentype x, gentype y);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_mul_hi<cl_short, cl_short, cl_short>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_mul_hi<cl_ushort, cl_ushort, cl_ushort>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_mul_hi<cl_int, cl_int, cl_int>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_mul_hi<cl_uint, cl_uint, cl_uint>()))
|
||||
|
||||
// gentype sub_sat(gentype x, gentype y);
|
||||
TEST_BINARY_FUNC_MACRO((int_func_sub_sat<cl_int, cl_int, cl_int>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_sub_sat<cl_uint, cl_uint, cl_uint>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_sub_sat<cl_long, cl_long, cl_long>()))
|
||||
TEST_BINARY_FUNC_MACRO((int_func_sub_sat<cl_ulong, cl_ulong, cl_ulong>()))
|
||||
|
||||
if(error != CL_SUCCESS)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
#endif // TEST_CONFORMANCE_CLCPP_INTEGER_FUNCS_NUMERIC_HPP
|
||||
Reference in New Issue
Block a user