3 #ifndef DUNE_COMMON_SIMD_INTERFACE_HH 4 #define DUNE_COMMON_SIMD_INTERFACE_HH 19 #include <type_traits> 251 template<
class S,
class V>
326 assert(l < lanes<V>());
344 template<
class V,
class U>
348 "Scalar types must match exactly in implCast");
349 static_assert(lanes<V>() == lanes<U>(),
350 "Number of lanes must match in implCast");
365 template<
class V,
class S>
385 template<
class M,
class V>
386 V
cond(M &&
mask,
const V &ifTrue,
const V &ifFalse)
389 implCast<Mask<V> >(std::forward<M>(
mask)), ifTrue, ifFalse);
399 V
cond(
bool mask,
const V &ifTrue,
const V &ifFalse)
401 return mask ? ifTrue : ifFalse;
409 auto max(
const V &v1,
const V &v2)
419 auto min(
const V &v1,
const V &v2)
498 template<
class V1,
class V2>
508 template<
class V1,
class V2>
545 #endif // DUNE_COMMON_SIMD_INTERFACE_HH constexpr std::size_t lanes()
Number of lanes in a SIMD type.
Definition: simd/interface.hh:305
auto maskAnd(const V1 &v1, const V2 &v2)
Logic and of masks.
Definition: simd/interface.hh:509
constexpr V broadcast(S s)
Broadcast a scalar to a vector explicitly.
Definition: simd/interface.hh:366
decltype(auto) lane(std::size_t l, V &&v)
Extract an element of a SIMD type.
Definition: simd/interface.hh:324
bool anyFalse(const Mask &mask)
Whether any entry is false
Definition: simd/interface.hh:449
auto maskOr(const V1 &v1, const V2 &v2)
Logic or of masks.
Definition: simd/interface.hh:499
typename Overloads::ScalarType< std::decay_t< V > >::type Scalar
Element type of some SIMD type.
Definition: simd/interface.hh:235
should have a member type type
Definition: base.hh:196
Dune namespace
Definition: alignedallocator.hh:12
typename Overloads::RebindType< std::decay_t< S >, std::decay_t< V > >::type Rebind
Construct SIMD type with different scalar type.
Definition: simd/interface.hh:253
auto max(const V &v1, const V &v2)
The binary maximum value over two simd objects.
Definition: simd/interface.hh:409
Tag used to force late-binding lookup in Dune::Simd::Overloads.
Definition: base.hh:182
bool allTrue(const Mask &mask)
Whether all entries are true
Definition: simd/interface.hh:439
bool allFalse(const Mask &mask)
Whether all entries are false
Definition: simd/interface.hh:459
should be derived from a Dune::index_constant
Definition: base.hh:212
bool anyTrue(const Mask &mask)
Whether any entry is true
Definition: simd/interface.hh:429
Basic definitions for SIMD ImplementationsThis file provides basic definitions and template declarati...
Rebind< bool, V > Mask
Mask type type of some SIMD type.
Definition: simd/interface.hh:289
constexpr V implCast(U &&u)
Cast an expression from one implementation to another.
Definition: simd/interface.hh:345
auto min(const V &v1, const V &v2)
The binary minimum value over two simd objects.
Definition: simd/interface.hh:419
auto mask(const V &v)
Convert to mask, analogue of bool(s) for scalars.
Definition: simd/interface.hh:489
A type that refers to another type.
Definition: typelist.hh:33
should have a member type type
Definition: base.hh:204
V cond(M &&mask, const V &ifTrue, const V &ifFalse)
Like the ?: operator.
Definition: simd/interface.hh:386