3#ifndef DUNE_COMMON_SIMD_VC_HH
4#define DUNE_COMMON_SIMD_VC_HH
158 template<
class V,
class SFINAE =
void>
161 template<
typename T,
typename A>
164 template<
typename T, std::
size_t n,
typename V, std::
size_t m>
165 struct IsMask<Vc::SimdMaskArray<T, n, V, m> > : std::true_type {};
168 template<
class V,
class SFINAE =
void>
171 template<
typename T,
typename A>
172 struct IsVector<Vc::Vector<T, A> > : std::true_type {};
174 template<
typename T, std::
size_t n,
typename V, std::
size_t m>
175 struct IsVector<Vc::SimdArray<T, n, V, m> > : std::true_type {};
201 static_assert(std::is_same<V, std::decay_t<V> >::value,
"Class Proxy "
202 "may only be instantiated with unqualified types");
207 static_assert(std::is_arithmetic<value_type>::value,
208 "Only arithmetic types are supported");
214 : vec_(vec), idx_(idx)
224#define DUNE_SIMD_VC_ASSIGNMENT(OP) \
226 class = decltype(std::declval<value_type&>() OP \
227 autoCopy(std::declval<T>()) )> \
228 Proxy operator OP(T &&o) && \
230 vec_[idx_] OP autoCopy(std::forward<T>(o)); \
231 return { idx_, vec_ }; \
244#undef DUNE_SIMD_VC_ASSIGNMENT
248 class = std::enable_if_t<!std::is_same<T, bool>::value> >
251 class = std::enable_if_t<!std::is_same<T, bool>::value> >
256 class = std::enable_if_t<!std::is_same<T, bool>::value> >
259 class = std::enable_if_t<!std::is_same<T, bool>::value> >
269 a.vec_[a.idx_] = std::move(b.vec_[b.idx_]);
270 b.vec_[b.idx_] = std::move(tmp);
276 a = std::move(b.vec_[b.idx_]);
277 b.vec_[b.idx_] = std::move(tmp);
283 a.vec_[a.idx_] = std::move(b);
346#define DUNE_SIMD_VC_BINARY(OP) \
347 template<class T, class Abi> \
348 friend auto operator OP(const Vc::Vector<T, Abi> &l, Proxy&& r) \
349 -> decltype(l OP std::declval<value_type>()) \
351 return l OP value_type(r); \
353 template<class T, class Abi> \
354 auto operator OP(const Vc::Vector<T, Abi> &r) && \
355 -> decltype(std::declval<value_type>() OP r) \
357 return value_type(*this) OP r; \
359 template<class T, std::size_t n, class Vec, std::size_t m> \
361 operator OP(const Vc::SimdArray<T, n, Vec, m> &l, Proxy&& r) \
362 -> decltype(l OP std::declval<value_type>()) \
364 return l OP value_type(r); \
366 template<class T, std::size_t n, class Vec, std::size_t m> \
367 auto operator OP(const Vc::SimdArray<T, n, Vec, m> &r) && \
368 -> decltype(std::declval<value_type>() OP r) \
370 return value_type(*this) OP r; \
389#undef DUNE_SIMD_VC_BINARY
393 template<
class T,
class Abi,
394 class = std::enable_if_t<std::is_convertible<
value_type,
396 operator Vc::Vector<T, Abi>() &&
400 template<
class T, std::size_t n,
class Vec, std::size_t m,
401 class = std::enable_if_t<std::is_convertible<
value_type,
403 operator Vc::SimdArray<T, n, Vec, m>() &&
408#define DUNE_SIMD_VC_ASSIGN(OP) \
409 template<class T, class Abi> \
410 friend auto operator OP(Vc::Vector<T, Abi> &l, Proxy&& r) \
411 -> decltype(l OP std::declval<value_type>()) \
413 return l OP value_type(r); \
431#undef DUNE_SIMD_VC_ASSIGN
436 namespace Overloads {
450 using type =
typename V::value_type;
463 std::enable_if_t<VcImpl::IsVector<V>::value> >
477 !VcImpl::IsMask<V>::value>>
479 using type =
typename V::mask_type;
491 std::enable_if_t<VcImpl::IsMask<M>::value>>
493 using type =
typename M::Vector;
503 template<
class S,
class M>
506 VcImpl::IsMask<M>::value &&
507 VcImpl::IsVectorizable<S>::value &&
508 !std::is_same<S, Scalar<typename M::Vector> >::value
511 using type = Vc::SimdArray<S, Simd::lanes<M>()>;
521 template<
class S,
class V>
523 std::enable_if_t<VcImpl::IsVector<V>::value &&
524 !VcImpl::IsMask<V>::value &&
525 VcImpl::IsVectorizable<S>::value &&
526 !std::is_same<S, Scalar<V> >::value> >
528 using type = Vc::SimdArray<S, Simd::lanes<V>()>;
539 template<
class S,
class V>
541 std::enable_if_t<VcImpl::IsVector<V>::value &&
542 !VcImpl::IsVectorizable<S>::value &&
543 !std::is_same<S, bool>::value &&
544 !std::is_same<S, Scalar<V> >::value> >
569 std::size_t l,
const V &v)
583 class = std::enable_if_t<!std::is_reference<V>::value> >
585 std::size_t l, V &&v)
587 return std::forward<V>(v)[l];
594 const Mask<V> &
mask,
const V &ifTrue,
const V &ifFalse)
596 return Vc::iif(
mask, ifTrue, ifFalse);
605 const V &
mask,
const V &ifTrue,
const V &ifFalse)
607 return (
mask && ifTrue) || (!
mask && ifFalse);
614 const V &v1,
const V &v2)
622 const M &m1,
const M &m2)
631 const V &v1,
const V &v2)
639 const M &m1,
const M &m2)
648 return Vc::any_of(
mask);
655 return Vc::all_of(
mask);
664 return Vc::none_of(
mask);
680 return Vc::any_of(
mask);
696 return !Vc::any_of(!
mask);
700 template<
class S1,
class V2>
703 const S1 &s1,
const V2 &v2)
709 template<
class V1,
class S2>
711 std::is_same<
Mask<S2>,
bool>::value>,
712 const V1 &v1,
const S2 &s2)
718 template<
class S1,
class V2>
721 const S1 &s1,
const V2 &v2)
727 template<
class V1,
class S2>
729 std::is_same<
Mask<S2>,
bool>::value>,
730 const V1 &v1,
const S2 &s2)
745 template <
typename T, std::
size_t N,
class V,
size_t Wt>
747 :
public std::integral_constant<bool, IsNumber<T>::value> {
750 template <
typename T,
typename Abi>
752 :
public std::integral_constant<bool, IsNumber<T>::value> {
Traits for type conversions and type information.
Compatibility header for including <Vc/Vc>
Default implementations for SIMD Implementations.
Basic definitions for SIMD Implementations.
std::integral_constant< std::size_t, i > index_constant
An index constant with value i.
Definition indices.hh:30
V cond(M &&mask, const V &ifTrue, const V &ifFalse)
Like the ?: operator.
Definition simd/interface.hh:386
auto mask(const V &v)
Convert to mask, analogue of bool(s) for scalars.
Definition simd/interface.hh:489
Rebind< bool, V > Mask
Mask type type of some SIMD type.
Definition simd/interface.hh:289
typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
Element type of some SIMD type.
Definition simd/interface.hh:235
Mask< V > mask(ADLTag< 0, std::is_same< V, Mask< V > >::value >, const V &v)
implements Simd::mask()
Definition defaults.hh:153
bool allFalse(ADLTag< 0 >, const Mask &mask)
implements Simd::allFalse()
Definition defaults.hh:124
bool allTrue(ADLTag< 0 >, const Mask &mask)
implements Simd::allTrue()
Definition defaults.hh:104
auto maskAnd(ADLTag< 0 >, const V1 &v1, const V2 &v2)
implements Simd::maskAnd()
Definition defaults.hh:177
auto maskOr(ADLTag< 0 >, const V1 &v1, const V2 &v2)
implements Simd::maskOr()
Definition defaults.hh:170
auto min(ADLTag< 0 >, const V &v1, const V &v2)
implements binary Simd::min()
Definition defaults.hh:89
auto max(ADLTag< 0 >, const V &v1, const V &v2)
implements binary Simd::max()
Definition defaults.hh:81
Dune namespace.
Definition alignedallocator.hh:13
bool anyTrue(ADLTag< 5 >, const AlignedNumber< bool, align > &mask)
Definition debugalign.hh:543
const AlignedNumber< T, align > & cond(ADLTag< 5 >, AlignedNumber< bool, align > mask, const AlignedNumber< T, align > &ifTrue, const AlignedNumber< T, align > &ifFalse)
Definition debugalign.hh:535
T & lane(ADLTag< 5 >, std::size_t l, AlignedNumber< T, align > &v)
Definition debugalign.hh:520
Whether this type acts as a scalar in the context of (hierarchically blocked) containers.
Definition typetraits.hh:194
Tag used to force late-binding lookup in Dune::Simd::Overloads.
Definition base.hh:182
should have a member type type
Definition standard.hh:60
should have a member type type
Definition standard.hh:67
should be derived from a Dune::index_constant
Definition standard.hh:74
specialized to true for Vc mask types
Definition simd/vc.hh:159
specialized to true for Vc vector and mask types
Definition simd/vc.hh:169
Definition simd/vc.hh:177
A reference-like proxy for elements of random-access vectors.
Definition simd/vc.hh:200
DUNE_SIMD_VC_ASSIGNMENT(> >=)
DUNE_SIMD_VC_BINARY * DUNE_SIMD_VC_BINARY(/);DUNE_SIMD_VC_BINARY(%
DUNE_SIMD_VC_ASSIGNMENT(+=)
DUNE_SIMD_VC_ASSIGNMENT(=)
Proxy operator--()
Definition simd/vc.hh:252
DUNE_SIMD_VC_ASSIGN(> >=)
friend void swap(const Proxy &a, value_type &b)
Definition simd/vc.hh:279
value_type operator++(int)
Definition simd/vc.hh:257
DUNE_SIMD_VC_ASSIGNMENT(-=)
DUNE_SIMD_VC_ASSIGN * DUNE_SIMD_VC_ASSIGN(/=);DUNE_SIMD_VC_ASSIGN(%=
friend void swap(value_type &a, const Proxy &b)
Definition simd/vc.hh:272
DUNE_SIMD_VC_BINARY & DUNE_SIMD_VC_BINARY(^);DUNE_SIMD_VC_BINARY(|
value_type operator--(int)
Definition simd/vc.hh:260
Proxy(std::size_t idx, V &vec)
Definition simd/vc.hh:213
friend void swap(const Proxy &a, const Proxy &b)
Definition simd/vc.hh:265
DUNE_SIMD_VC_ASSIGNMENT(<<=)
DUNE_SIMD_VC_ASSIGN & DUNE_SIMD_VC_ASSIGN(^=);DUNE_SIMD_VC_ASSIGN(|=
DUNE_SIMD_VC_ASSIGNMENT & DUNE_SIMD_VC_ASSIGNMENT(^=);DUNE_SIMD_VC_ASSIGNMENT(|=
Proxy(const Proxy &)=delete
DUNE_SIMD_VC_ASSIGNMENT * DUNE_SIMD_VC_ASSIGNMENT(/=);DUNE_SIMD_VC_ASSIGNMENT(%=
typename V::value_type value_type
Definition simd/vc.hh:204
Proxy operator++()
Definition simd/vc.hh:249
typename V::value_type type
Definition simd/vc.hh:450
V type
Definition simd/vc.hh:465
typename V::mask_type type
Definition simd/vc.hh:479
typename M::Vector type
Definition simd/vc.hh:493
Vc::SimdArray< S, Simd::lanes< M >()> type
Definition simd/vc.hh:511
Vc::SimdArray< S, Simd::lanes< V >()> type
Definition simd/vc.hh:528
Type free of internal references that T can be converted to.
Definition typetraits.hh:501
#define DUNE_SIMD_VC_ASSIGN(OP)
Definition simd/vc.hh:408