diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/detail/simd_view_impl.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/detail/simd_view_impl.hpp index edd116d037e52..b7af652d5235d 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/detail/simd_view_impl.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/detail/simd_view_impl.hpp @@ -289,7 +289,6 @@ template class simd_view_impl { auto V = UNARY_OP(read().data()); \ return simd(V); \ } - DEF_UNARY_OP(!) DEF_UNARY_OP(~) DEF_UNARY_OP(+) DEF_UNARY_OP(-) diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/simd.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/simd.hpp index afac5a586ea2d..26abc25916ae0 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/simd.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/simd.hpp @@ -352,13 +352,15 @@ template class simd { auto V = UNARY_OP(data()); \ return simd(V); \ } - DEF_UNARY_OP(!) DEF_UNARY_OP(~) DEF_UNARY_OP(+) DEF_UNARY_OP(-) #undef DEF_UNARY_OP + // negation operator + auto operator!() { return *this == 0; } + /// \name Replicate /// Replicate simd instance given a region. /// @{ diff --git a/sycl/include/sycl/ext/intel/experimental/esimd/simd_view.hpp b/sycl/include/sycl/ext/intel/experimental/esimd/simd_view.hpp index 4f531a8c8f5b1..4de2551789c50 100644 --- a/sycl/include/sycl/ext/intel/experimental/esimd/simd_view.hpp +++ b/sycl/include/sycl/ext/intel/experimental/esimd/simd_view.hpp @@ -90,6 +90,9 @@ class simd_view : public detail::simd_view_impl { DEF_RELOP(!=) #undef DEF_RELOP + + // negation operator + auto operator!() { return *this == 0; } }; /// This is a specialization of simd_view class with a single element. @@ -142,6 +145,9 @@ class simd_view> DEF_RELOP(!=) #undef DEF_RELOP + + // negation operator + auto operator!() { return *this == 0; } }; } // namespace esimd diff --git a/sycl/test/esimd/simd_view.cpp b/sycl/test/esimd/simd_view.cpp index 735c0abfedc42..06a55693e688d 100644 --- a/sycl/test/esimd/simd_view.cpp +++ b/sycl/test/esimd/simd_view.cpp @@ -31,7 +31,7 @@ SYCL_ESIMD_FUNCTION bool test_simd_view_unary_ops() { ref0 <<= ref1; ref1 = -ref0; ref0 = ~ref1; - ref1 = !ref0; + auto mask = !ref0; return v1[0] == 1; }