]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use intrinsics for vertical addition
authorMaximilian Bergbauer <maximilian.bergbauer@tum.de>
Mon, 22 May 2023 13:28:41 +0000 (15:28 +0200)
committerMaximilian Bergbauer <maximilian.bergbauer@tum.de>
Mon, 22 May 2023 13:28:41 +0000 (15:28 +0200)
include/deal.II/base/vectorization.h

index 06a29e0d9690ecbb402c15829b50e814408a6941..e81ab787e74b08b3c72bcb142b9d8926aa982fd0 100644 (file)
@@ -4971,7 +4971,7 @@ inline double
 VectorizedArray<double, 4>::horizontal_add()
 {
   VectorizedArray<double, 2> t1;
-  t1.data = this->get_low() + this->get_high();
+  t1.data = _mm_add_pd(this->get_low(), this->get_high());
   return t1.horizontal_add();
 }
 
@@ -4981,7 +4981,7 @@ inline float
 VectorizedArray<float, 8>::horizontal_add()
 {
   VectorizedArray<float, 4> t1;
-  t1.data = this->get_low() + this->get_high();
+  t1.data = _mm_add_ps(this->get_low(), this->get_high());
   return t1.horizontal_add();
 }
 #endif
@@ -4993,7 +4993,7 @@ inline double
 VectorizedArray<double, 8>::horizontal_add()
 {
   VectorizedArray<double, 4> t1;
-  t1.data = this->get_low() + this->get_high();
+  t1.data = _mm256_add_pd(this->get_low(), this->get_high());
   return t1.horizontal_add();
 }
 
@@ -5003,7 +5003,7 @@ inline float
 VectorizedArray<float, 16>::horizontal_add()
 {
   VectorizedArray<float, 8> t1;
-  t1.data = this->get_low() + this->get_high();
+  t1.data = _mm256_add_ps(this->get_low(), this->get_high());
   return t1.horizontal_add();
 }
 #endif

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.