Commit bcde3631 authored by Jö Fahlke's avatar Jö Fahlke

[!13] Implement binary min()/max().

Merge branch 'simd-check-binary-minmax' into 'master'

ref:extensions/dune-vectorclass See: [core/dune-common!620]

See merge request [!13]

  [core/dune-common!620]: gitlab.dune-project.org/core/dune-common/merge_requests/620
  [!13]: gitlab.dune-project.org/extensions/dune-vectorclass/merge_requests/13
parents 79eabaf7 7c0c6139
Pipeline #16506 failed with stage
in 4 minutes and 3 seconds
......@@ -273,6 +273,36 @@ namespace Dune {
return (mask & ifTrue) | ((!mask) & ifFalse);
}
template<class Vec>
auto max(ADLTag<5, VectorclassImpl::IsVector<Vec>::value &&
!VectorclassImpl::IsMask<Vec>::value>,
Vec v1, Vec v2)
{
return Simd::cond(v1 < v2, v2, v1);
}
template<class Vec>
auto max(ADLTag<5, VectorclassImpl::IsMask<Vec>::value>,
Vec v1, Vec v2)
{
return v1 | v2;
}
template<class Vec>
auto min(ADLTag<5, VectorclassImpl::IsVector<Vec>::value &&
!VectorclassImpl::IsMask<Vec>::value>,
Vec v1, Vec v2)
{
return Simd::cond(v1 < v2, v1, v2);
}
template<class Vec>
auto min(ADLTag<5, VectorclassImpl::IsMask<Vec>::value>,
Vec v1, Vec v2)
{
return v1 & v2;
}
template<class M, typename = std::enable_if_t<VectorclassImpl::IsMask<M>::value>>
bool anyTrue(ADLTag<5>, M mask) {
return horizontal_or(mask);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment