@@ -95,28 +95,13 @@ template <typename T> auto convert_arg(T &&x) {
95
95
__attribute__ ((ext_vector_type (N)))>;
96
96
// TODO: We should have this bit_cast impl inside vec::convert.
97
97
return bit_cast<result_type>(static_cast <typename no_cv_ref::vector_t >(x));
98
- } else if constexpr (std::is_same_v<no_cv_ref, half>)
99
- return static_cast <half_impl::BIsRepresentationT>(x);
100
- else if constexpr (is_multi_ptr_v<no_cv_ref>) {
101
- return convert_arg (x.get_decorated ());
102
- } else if constexpr (is_scalar_arithmetic_v<no_cv_ref>) {
103
- // E.g. on linux: long long -> int64_t (long), or char -> int8_t (signed
104
- // char) and same for unsigned; Windows has long/long long reversed.
105
- // TODO: Inline this scalar impl.
106
- return static_cast <ConvertToOpenCLType_t<no_cv_ref>>(x);
107
- } else if constexpr (std::is_pointer_v<no_cv_ref>) {
108
- using elem_type = remove_decoration_t <std::remove_pointer_t <no_cv_ref>>;
109
- using converted_elem_type =
110
- decltype (convert_arg (std::declval<elem_type>()));
111
- using result_type =
112
- typename DecoratedType<converted_elem_type,
113
- deduce_AS<no_cv_ref>::value>::type *;
114
- return reinterpret_cast <result_type>(x);
115
98
} else if constexpr (is_swizzle_v<no_cv_ref>) {
116
99
return convert_arg (simplify_if_swizzle_t <no_cv_ref>{x});
117
100
} else {
118
- // TODO: should it be unreachable? What can it be?
119
- return std::forward<T>(x);
101
+ static_assert (is_scalar_arithmetic_v<no_cv_ref> ||
102
+ is_multi_ptr_v<no_cv_ref> || std::is_pointer_v<no_cv_ref> ||
103
+ std::is_same_v<no_cv_ref, half>);
104
+ return convertToOpenCLType (std::forward<T>(x));
120
105
}
121
106
}
122
107
0 commit comments