]> https://gitweb.dealii.org/ - dealii.git/commitdiff
VectorizedArray: Simplify compare_and_apply_mask by blend instruction 12981/head
authorMartin Kronbichler <martin.kronbichler@it.uu.se>
Mon, 22 Nov 2021 10:38:02 +0000 (11:38 +0100)
committerMartin Kronbichler <martin.kronbichler@it.uu.se>
Mon, 22 Nov 2021 10:38:02 +0000 (11:38 +0100)
include/deal.II/base/vectorization.h

index 1b397fec46d6e14653534ad84dff1ce858b6dd9e..93432f5a9e1a883941be33a7629c5add80971935 100644 (file)
@@ -5214,8 +5214,7 @@ compare_and_apply_mask(const VectorizedArray<float, 8> &left,
     _mm256_cmp_ps(left.data, right.data, static_cast<int>(predicate));
 
   VectorizedArray<float, 8> 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<double, 4> &left,
     _mm256_cmp_pd(left.data, right.data, static_cast<int>(predicate));
 
   VectorizedArray<double, 4> 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;
 }
 

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.