diff --git a/sycl/include/sycl/builtins_utils_scalar.hpp b/sycl/include/sycl/builtins_utils_scalar.hpp index 194059fa28b21..ff567bfea2b15 100644 --- a/sycl/include/sycl/builtins_utils_scalar.hpp +++ b/sycl/include/sycl/builtins_utils_scalar.hpp @@ -8,14 +8,14 @@ #pragma once -#include // for address_space, decorated -#include // for half -#include // for __SYCL_ALWAYS_INLINE -#include // for is_svgenfloat, is_sge... -#include // for is_contained, type_list -#include // for make_larger_t, marray... -#include // for half, intel -#include // for address_space_cast +#include +#include +#include +#include +#include +#include +#include +#include #include #include diff --git a/sycl/include/sycl/detail/type_list.hpp b/sycl/include/sycl/detail/type_list.hpp index 24ed568df83be..86d83b296ff93 100644 --- a/sycl/include/sycl/detail/type_list.hpp +++ b/sycl/include/sycl/detail/type_list.hpp @@ -69,10 +69,6 @@ using is_one_of_spaces = template struct is_type_size_equal : std::bool_constant<(sizeof(T1) == sizeof(T2))> {}; -template -struct is_type_size_double_of - : std::bool_constant<(sizeof(T1) == (sizeof(T2) * 2))> {}; - // find required type template class Comp, typename T> @@ -90,10 +86,6 @@ using find_type_t = typename find_type::type; template using find_same_size_type_t = find_type_t; -template -using find_twice_as_large_type_t = - find_type_t; - } // namespace detail } // namespace _V1 } // namespace sycl diff --git a/sycl/include/sycl/detail/type_traits.hpp b/sycl/include/sycl/detail/type_traits.hpp index a76321a47cd6a..56c8571467483 100644 --- a/sycl/include/sycl/detail/type_traits.hpp +++ b/sycl/include/sycl/detail/type_traits.hpp @@ -399,53 +399,6 @@ template struct make_type_impl, TL> { template using make_type_t = typename make_type_impl::type; -// make_larger_t -template struct make_larger_impl; -template -struct make_larger_impl< - T, std::enable_if_t::value, T>> { - using type = find_twice_as_large_type_t; -}; - -template -struct make_larger_impl< - T, std::enable_if_t::value, - T>> { - using type = find_twice_as_large_type_t; -}; - -template -struct make_larger_impl< - T, std::enable_if_t< - is_contained::value, T>> { - using type = find_twice_as_large_type_t; -}; - -template struct make_larger_impl, vec> { - using base_type = vector_element_t>; - using upper_type = typename make_larger_impl::type; - using new_type = vec; - static constexpr bool found = !std::is_same_v; - using type = std::conditional_t; -}; - -template -struct make_larger_impl, marray> { - using base_type = marray_element_t>; - using upper_type = typename make_larger_impl::type; - using new_type = marray; - static constexpr bool found = !std::is_same_v; - using type = std::conditional_t; -}; - -// TODO: this type trait is not used anyweher in SYCL headers and it should -// be moved to the library code -template struct make_larger { - using type = typename make_larger_impl::type; -}; - -template using make_larger_t = typename make_larger::type; - #if defined(RESTRICT_WRITE_ACCESS_TO_CONSTANT_PTR) template using const_if_const_AS = diff --git a/sycl/source/builtins/integer_functions.cpp b/sycl/source/builtins/integer_functions.cpp index 706577a176f12..2c9bcd8124abb 100644 --- a/sycl/source/builtins/integer_functions.cpp +++ b/sycl/source/builtins/integer_functions.cpp @@ -150,7 +150,7 @@ BUILTIN_GENINT_SU( // negative value. return sycl::add_sat(T(a * b), c); } else { - using UPT = sycl::detail::make_larger_t; + using UPT = int64_t; UPT mul = UPT(a) * UPT(b); UPT res = mul + UPT(c); const UPT max = std::numeric_limits::max(); @@ -166,7 +166,7 @@ BUILTIN_GENINT_SU( return std::numeric_limits::max(); return sycl::add_sat(T(a * b), c); } else { - using UPT = sycl::detail::make_larger_t; + using UPT = uint64_t; UPT mul = UPT(a) * UPT(b); const UPT min = std::numeric_limits::min(); const UPT max = std::numeric_limits::max(); @@ -176,6 +176,11 @@ BUILTIN_GENINT_SU( } }) +// Moved outside of macro invocation: +template +using same_signedness_int64_t = + std::conditional_t, int64_t, uint64_t>; + BUILTIN_GENINT_SU(TWO_ARGS, mul_hi, [](auto a, auto b) -> decltype(a) { using T = decltype(a); if constexpr (sizeof(T) == 8) { @@ -184,7 +189,7 @@ BUILTIN_GENINT_SU(TWO_ARGS, mul_hi, [](auto a, auto b) -> decltype(a) { else return __u_long_mul_hi(a, b); } else { - using UPT = sycl::detail::make_larger_t; + using UPT = same_signedness_int64_t; UPT a_s = a; UPT b_s = b; UPT mul = a_s * b_s; diff --git a/sycl/test/basic_tests/generic_type_traits.cpp b/sycl/test/basic_tests/generic_type_traits.cpp index 2d63cc12e082f..853473e3c61f3 100644 --- a/sycl/test/basic_tests/generic_type_traits.cpp +++ b/sycl/test/basic_tests/generic_type_traits.cpp @@ -78,7 +78,6 @@ int main() { float_point_to_sign_integeral make_unsigned - make_larger */ // checks for some type conversions. diff --git a/sycl/test/type_traits/type_list.cpp b/sycl/test/type_traits/type_list.cpp index e82063f43bdf4..90702d4d90858 100644 --- a/sycl/test/type_traits/type_list.cpp +++ b/sycl/test/type_traits/type_list.cpp @@ -75,21 +75,12 @@ int main() { test_predicate(); test_predicate(); - test_predicate(); - test_predicate(); - test_predicate(); // if void is found, the required type is not found test_trait, s::opencl::cl_char, int8_t>(); test_trait, s::opencl::cl_char, void>(); - test_trait, - s::opencl::cl_char, int16_t>(); - test_trait, - s::opencl::cl_char, void>(); return 0; } diff --git a/sycl/test/type_traits/type_traits.cpp b/sycl/test/type_traits/type_traits.cpp index 4f27cdd16b107..be4cb8c9ba670 100644 --- a/sycl/test/type_traits/type_traits.cpp +++ b/sycl/test/type_traits/type_traits.cpp @@ -34,11 +34,6 @@ void test_make_type_t() { ""); } -template -void test_make_larger_t() { - static_assert(is_same, CheckedT>::value == Expected, ""); -} - template void test_change_base_type_t() { static_assert( @@ -116,17 +111,6 @@ int main() { test_make_type_t, d::gtl::scalar_float_list, s::vec>(); - test_make_larger_t(); - test_make_larger_t(); - test_make_larger_t(); - test_make_larger_t(); - test_make_larger_t(); - test_make_larger_t(); - test_make_larger_t(); - test_make_larger_t, s::vec>(); - test_make_larger_t(); - test_make_larger_t, void>(); - test_change_base_type_t(); test_change_base_type_t(); test_change_base_type_t();