]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Cleanup code in vectorization 3799/head
authorMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sat, 14 Jan 2017 17:56:03 +0000 (18:56 +0100)
committerMartin Kronbichler <kronbichler@lnm.mw.tum.de>
Sat, 14 Jan 2017 17:56:03 +0000 (18:56 +0100)
include/deal.II/base/vectorization.h

index 0cd6093c772e958f0ef5e8572eec5c12a1a5dbfa..2224b61fa87b9cfe1b42d91998c96c7f75ecc2c1 100644 (file)
@@ -2020,13 +2020,12 @@ vectorized_transpose_and_store(const bool                    add_into,
           _mm_storeu_ps(out+4*i+offsets[7], res7);
         }
     }
-  const unsigned int shift = n_chunks * 4;
   if (add_into)
-    for (unsigned int i=shift; i<n_entries; ++i)
+    for (unsigned int i=4*n_chunks; i<n_entries; ++i)
       for (unsigned int v=0; v<8; ++v)
         out[offsets[v]+i] += in[i][v];
   else
-    for (unsigned int i=shift; i<n_entries; ++i)
+    for (unsigned int i=4*n_chunks; i<n_entries; ++i)
       for (unsigned int v=0; v<8; ++v)
         out[offsets[v]+i] = in[i][v];
 }
@@ -2640,10 +2639,9 @@ void vectorized_load_and_transpose(const unsigned int      n_entries,
       out[4*i+2].data = _mm_shuffle_ps (v1, v3, 0x88);
       out[4*i+3].data = _mm_shuffle_ps (v1, v3, 0xdd);
     }
-  if (n_entries % 4 > 0)
-    for (unsigned int i=4*n_chunks; i<n_entries; ++i)
-      for (unsigned int v=0; v<4; ++v)
-        out[i][v] = in[offsets[v]+i];
+  for (unsigned int i=4*n_chunks; i<n_entries; ++i)
+    for (unsigned int v=0; v<4; ++v)
+      out[i][v] = in[offsets[v]+i];
 }
 
 
@@ -2698,13 +2696,12 @@ vectorized_transpose_and_store(const bool                    add_into,
           _mm_storeu_ps(out+4*i+offsets[3], u3);
         }
     }
-  const unsigned int shift = n_chunks * 4;
   if (add_into)
-    for (unsigned int i=shift; i<n_entries; ++i)
+    for (unsigned int i=4*n_chunks; i<n_entries; ++i)
       for (unsigned int v=0; v<4; ++v)
         out[offsets[v]+i] += in[i][v];
   else
-    for (unsigned int i=shift; i<n_entries; ++i)
+    for (unsigned int i=4*n_chunks; i<n_entries; ++i)
       for (unsigned int v=0; v<4; ++v)
         out[offsets[v]+i] = in[i][v];
 }

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.