From: Martin Kronbichler Date: Mon, 22 Nov 2021 10:38:02 +0000 (+0100) Subject: VectorizedArray: Simplify compare_and_apply_mask by blend instruction X-Git-Tag: v9.4.0-rc1~814^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F12981%2Fhead;p=dealii.git VectorizedArray: Simplify compare_and_apply_mask by blend instruction --- diff --git a/include/deal.II/base/vectorization.h b/include/deal.II/base/vectorization.h index 1b397fec46..93432f5a9e 100644 --- a/include/deal.II/base/vectorization.h +++ b/include/deal.II/base/vectorization.h @@ -5214,8 +5214,7 @@ compare_and_apply_mask(const VectorizedArray &left, _mm256_cmp_ps(left.data, right.data, static_cast(predicate)); VectorizedArray result; - result.data = _mm256_or_ps(_mm256_and_ps(mask, true_values.data), - _mm256_andnot_ps(mask, false_values.data)); + result.data = _mm256_blendv_ps(false_values.data, true_values.data, mask); return result; } @@ -5231,8 +5230,7 @@ compare_and_apply_mask(const VectorizedArray &left, _mm256_cmp_pd(left.data, right.data, static_cast(predicate)); VectorizedArray result; - result.data = _mm256_or_pd(_mm256_and_pd(mask, true_values.data), - _mm256_andnot_pd(mask, false_values.data)); + result.data = _mm256_blendv_pd(false_values.data, true_values.data, mask); return result; }