1 #ifndef DUNE_COMMON_SIMD_INTERFACE_HH
2 #define DUNE_COMMON_SIMD_INTERFACE_HH
17 #include <type_traits>
249 template<
class S,
class V>
322 decltype(
auto)
lane(std::
size_t l, V &&v)
324 assert(l < lanes<V>());
342 template<
class V,
class U>
346 "Scalar types must match exactly in implCast");
347 static_assert(lanes<V>() == lanes<U>(),
348 "Number of lanes must match in implCast");
363 template<
class V,
class S>
383 template<
class M,
class V>
384 V
cond(M &&
mask,
const V &ifTrue,
const V &ifFalse)
387 implCast<Mask<V> >(std::forward<M>(
mask)), ifTrue, ifFalse);
397 V
cond(
bool mask,
const V &ifTrue,
const V &ifFalse)
399 return mask ? ifTrue : ifFalse;
407 auto max(
const V &v1,
const V &v2)
417 auto min(
const V &v1,
const V &v2)
496 template<
class V1,
class V2>
506 template<
class V1,
class V2>
Basic definitions for SIMD Implementations.
bool anyTrue(const Mask &mask)
Whether any entry is true
Definition: simd/interface.hh:427
auto maskOr(const V1 &v1, const V2 &v2)
Logic or of masks.
Definition: simd/interface.hh:497
V cond(M &&mask, const V &ifTrue, const V &ifFalse)
Like the ?: operator.
Definition: simd/interface.hh:384
auto mask(const V &v)
Convert to mask, analogue of bool(s) for scalars.
Definition: simd/interface.hh:487
bool allTrue(const Mask &mask)
Whether all entries are true
Definition: simd/interface.hh:437
typename Overloads::RebindType< std::decay_t< S >, std::decay_t< V > >::type Rebind
Construct SIMD type with different scalar type.
Definition: simd/interface.hh:251
constexpr V broadcast(S s)
Broadcast a scalar to a vector explicitly.
Definition: simd/interface.hh:364
auto max(const V &v1, const V &v2)
The binary maximum value over two simd objects.
Definition: simd/interface.hh:407
bool anyFalse(const Mask &mask)
Whether any entry is false
Definition: simd/interface.hh:447
constexpr V implCast(U &&u)
Cast an expression from one implementation to another.
Definition: simd/interface.hh:343
constexpr std::size_t lanes()
Number of lanes in a SIMD type.
Definition: simd/interface.hh:303
decltype(auto) lane(std::size_t l, V &&v)
Extract an element of a SIMD type.
Definition: simd/interface.hh:322
Rebind< bool, V > Mask
Mask type type of some SIMD type.
Definition: simd/interface.hh:287
bool allFalse(const Mask &mask)
Whether all entries are false
Definition: simd/interface.hh:457
auto maskAnd(const V1 &v1, const V2 &v2)
Logic and of masks.
Definition: simd/interface.hh:507
typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
Element type of some SIMD type.
Definition: simd/interface.hh:233
auto min(const V &v1, const V &v2)
The binary minimum value over two simd objects.
Definition: simd/interface.hh:417
Dune namespace.
Definition: alignedallocator.hh:14
Tag used to force late-binding lookup in Dune::Simd::Overloads.
Definition: base.hh:180
should have a member type type
Definition: standard.hh:58
should have a member type type
Definition: standard.hh:65
should be derived from a Dune::index_constant
Definition: standard.hh:72
A type that refers to another type.
Definition: typelist.hh:33