diff --git a/sycl/include/sycl/detail/vector_arith.hpp b/sycl/include/sycl/detail/vector_arith.hpp index 380691c0b1906..55a2e6f66bbb7 100644 --- a/sycl/include/sycl/detail/vector_arith.hpp +++ b/sycl/include/sycl/detail/vector_arith.hpp @@ -674,7 +674,10 @@ template class vec_arith : public VecOperators>::template CombineImpl< std::bit_or, std::bit_and, std::bit_xor, - std::bit_not> { + std::bit_not, std::equal_to, std::not_equal_to, + std::less, std::greater, std::less_equal, + std::greater_equal, OpAssign>, + OpAssign>, OpAssign>> { protected: // NumElements can never be zero. Still using the redundant check to avoid // incomplete type errors. diff --git a/sycl/include/sycl/vector.hpp b/sycl/include/sycl/vector.hpp index cf923d1a9f821..3dd2f0078e169 100644 --- a/sycl/include/sycl/vector.hpp +++ b/sycl/include/sycl/vector.hpp @@ -131,9 +131,10 @@ template class ScalarConversionOperatorsMixIn { }; template -inline constexpr bool is_fundamental_or_half_or_bfloat16 = +inline constexpr bool is_supported_vector_elem_type = std::is_fundamental_v || std::is_same_v, half> || - std::is_same_v, ext::oneapi::bfloat16>; + std::is_same_v, ext::oneapi::bfloat16> || + std::is_same_v, std::byte>; // Per SYCL specification sycl::vec has different ctors available based on the // number of elements. Without C++20's concepts we'd have to use partial @@ -585,7 +586,7 @@ class __SYCL_EBO vec : // when NumElements == 1. The template prevents implicit conversion from // vec<_, 1> to DataT. template - typename std::enable_if_t, + typename std::enable_if_t, vec &> operator=(const DataT &Rhs) { *this = vec{Rhs}; @@ -918,12 +919,12 @@ class SwizzleOp : public detail::NamedSwizzlesMixinBoth< template using EnableIfScalarType = typename std::enable_if_t && - detail::is_fundamental_or_half_or_bfloat16>; + detail::is_supported_vector_elem_type>; template using EnableIfNoScalarType = typename std::enable_if_t || - !detail::is_fundamental_or_half_or_bfloat16>; + !detail::is_supported_vector_elem_type>; template using Swizzle = @@ -1143,12 +1144,12 @@ class SwizzleOp : public detail::NamedSwizzlesMixinBoth< return Tmp RELLOGOP Rhs; \ } - __SYCL_RELLOGOP(==, (!detail::is_byte_v)) - __SYCL_RELLOGOP(!=, (!detail::is_byte_v)) - __SYCL_RELLOGOP(>, (!detail::is_byte_v)) - __SYCL_RELLOGOP(<, (!detail::is_byte_v)) - __SYCL_RELLOGOP(>=, (!detail::is_byte_v)) - __SYCL_RELLOGOP(<=, (!detail::is_byte_v)) + __SYCL_RELLOGOP(==, true) + __SYCL_RELLOGOP(!=, true) + __SYCL_RELLOGOP(>, true) + __SYCL_RELLOGOP(<, true) + __SYCL_RELLOGOP(>=, true) + __SYCL_RELLOGOP(<=, true) __SYCL_RELLOGOP(&&, (!detail::is_byte_v && !detail::is_vgenfloat_v)) __SYCL_RELLOGOP(||, (!detail::is_byte_v && !detail::is_vgenfloat_v)) #undef __SYCL_RELLOGOP @@ -1527,8 +1528,8 @@ class SwizzleOp : public detail::NamedSwizzlesMixinBoth< m_RightOperation(std::move(Rhs.m_RightOperation)) {} // Either performing CurrentOperation on results of left and right operands - // or reading values from actual vector. Perform implicit type conversion when - // the number of elements == 1 + // or reading values from actual vector. Always perform explicit type conversion + // because std::byte operators are strongly typed. template CommonDataT getValue(EnableIfOneIndex Index) const { @@ -1537,8 +1538,8 @@ class SwizzleOp : public detail::NamedSwizzlesMixinBoth< return (*m_Vector)[Idxs[Index]]; } auto Op = OperationCurrentT(); - return Op(m_LeftOperation.getValue(Index), - m_RightOperation.getValue(Index)); + return Op(static_cast(m_LeftOperation.getValue(Index)), + static_cast(m_RightOperation.getValue(Index))); } template @@ -1548,8 +1549,8 @@ class SwizzleOp : public detail::NamedSwizzlesMixinBoth< return (*m_Vector)[Idxs[Index]]; } auto Op = OperationCurrentT(); - return Op(m_LeftOperation.getValue(Index), - m_RightOperation.getValue(Index)); + return Op(static_cast(m_LeftOperation.getValue(Index)), + static_cast(m_RightOperation.getValue(Index))); } template