17 inline namespace _V1 {
18 namespace ext::intel::esimd {
34 template <
typename BaseTy,
36 region1d_t<typename BaseTy::element_type, BaseTy::length, 1>>
41 template <
typename,
typename>
friend class simd_view;
42 template <
typename,
int>
friend class simd;
48 using ShapeTy =
typename shape_type<RegionTy>::type;
49 using base_type = BaseTy;
50 template <
typename ElT,
int N>
51 using get_simd_t =
typename BaseClass::template get_simd_t<ElT, N>;
55 static_assert(detail::is_simd_obj_impl_derivative_v<BaseTy>);
57 static constexpr
int length = ShapeTy::Size_x * ShapeTy::Size_y;
71 detail::vector_type_t<detail::__raw_t<element_type>,
length>;
75 simd_view(BaseTy &Base, RegionTy Region) : BaseClass(Base, Region) {}
76 simd_view(BaseTy &&Base, RegionTy Region) : BaseClass(Base, Region) {}
94 using BaseClass::operator--;
95 using BaseClass::operator++;
96 using BaseClass::operator=;
99 #define __ESIMD_DEF_SCALAR_SIMD_VIEW_RELOP(RELOP) \
101 ESIMD_INLINE friend bool operator RELOP(const simd_view &X, \
102 const simd_view &Y) { \
103 return (element_type)X RELOP(element_type) Y; \
107 template <typename T1, \
108 std::enable_if_t<detail::is_valid_simd_elem_type_v<T1>>> \
109 ESIMD_INLINE friend bool operator RELOP(const simd_view &X, T1 Y) { \
110 return (element_type)X RELOP Y; \
114 template <typename T1, \
115 std::enable_if_t<detail::is_valid_simd_elem_type_v<T1>>> \
116 ESIMD_INLINE friend bool operator RELOP(T1 X, const simd_view &Y) { \
117 return X RELOP(element_type) Y; \
131 template <
typename BaseTy,
class ViewedElemT>
140 using ShapeTy =
typename shape_type<RegionTy>::type;
141 static constexpr
int length = ShapeTy::Size_x * ShapeTy::Size_y;
142 static_assert(1 ==
length,
"length of this view is not equal to 1");
143 static_assert(std::is_same_v<typename ShapeTy::element_type, ViewedElemT>);
148 template <
typename ElT,
int N>
155 simd_view(BaseTy &&Base, RegionTy Region) : BaseClass(Base, Region) {}
162 const auto v = BaseClass::read().data();
163 return detail::bitcast_to_wrapper_type<element_type>(std::move(v)[0]);
166 using BaseClass::operator--;
167 using BaseClass::operator++;
168 using BaseClass::operator=;
186 template <typename BaseTy, typename NestedRegion, class ViewedElemT>
187 class
simd_view<BaseTy,
std::pair<region1d_scalar_t<ViewedElemT>, NestedRegion>>
189 BaseTy,
std::pair<region1d_scalar_t<ViewedElemT>, NestedRegion>> {
190 template <
typename,
int>
friend class simd;
194 using RegionTy = std::pair<region1d_scalar_t<ViewedElemT>, NestedRegion>;
196 using ShapeTy =
typename shape_type<RegionTy>::type;
197 static constexpr
int length = ShapeTy::Size_x * ShapeTy::Size_y;
198 static_assert(1 ==
length,
"length of this view is not equal to 1");
199 static_assert(std::is_same_v<typename ShapeTy::element_type, ViewedElemT>);
206 simd_view(BaseTy &&Base, RegionTy Region) : BaseClass(Base, Region) {}
209 using BaseClass::operator=;
212 const auto v = BaseClass::read();
213 return detail::convert_scalar<element_type>(v[0]);
224 #undef __ESIMD_DEF_SCALAR_SIMD_VIEW_RELOP
This class is a simd_obj_impl specialization representing a simd mask, which is basically a simd_obj_...
This is a base class for all ESIMD simd classes with real storage (simd, simd_mask_impl).
Base class for "simd view" types.
simd_view_impl(const simd_view_impl &Other)=default
Default copy constructor.
typename BaseClass::template get_simd_t< ElT, N > get_simd_t
get_simd_t< element_type, length > value_type
The simd type if reading the object.
ViewedElemT element_type
The element type of this class, which could be different from the element type of the base object typ...
typename shape_type< RegionTy >::type ShapeTy
simd_view(BaseTy &Base)
Construct a complete view of a vector.
region1d_scalar_t< ViewedElemT > RegionTy
typename shape_type< RegionTy >::type ShapeTy
ViewedElemT element_type
The element type of this class, which could be different from the element type of the base object typ...
std::pair< region1d_scalar_t< ViewedElemT >, NestedRegion > RegionTy
This class represents a reference to a sub-region of a base simd object.
simd_view & operator=(const simd_view &Other)
Copy assignment operator.
static constexpr int length
typename ShapeTy::element_type element_type
The element type of this class, which could be different from the element type of the base object typ...
get_simd_t< element_type, length > value_type
The simd type if reading the object.
RegionTy region_type
The region type of this class.
detail::vector_type_t< detail::__raw_t< element_type >, length > raw_vector_type
The underlying builtin value type.
simd_view(const simd_view &Other)=default
Default copy and move constructors for simd_view.
simd_view(BaseTy &Base)
Construct a complete view of a vector.
simd_view(simd_view &&Other)=default
The main simd vector class.
#define __ESIMD_DEF_SCALAR_SIMD_VIEW_RELOP(RELOP)
annotated_arg & operator=(annotated_arg &)=default