aboutsummaryrefslogtreecommitdiffstats
path: root/src/vppinfra
diff options
context:
space:
mode:
authorSergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>2017-12-08 11:25:13 +0000
committerDamjan Marion <dmarion.lists@gmail.com>2017-12-08 15:18:09 +0000
commit20ec7165007bd38359ea516fe5389e9e828a9d62 (patch)
tree740807f77695c480fe3da5eca00c52650a9b12ac /src/vppinfra
parentb716308ca558e8fcc1297903bf78c1673af44154 (diff)
vppinfra: fix issues depending on compiler
It looks like different compiler versions produce different results for expressions like "(cast) ptr + inc". Use parenthesis to avoid such issues. Change-Id: I93a9883bf5fc05ae462df5b004817775f0739405 Signed-off-by: Sergio Gonzalez Monroy <sergio.gonzalez.monroy@intel.com>
Diffstat (limited to 'src/vppinfra')
-rw-r--r--src/vppinfra/string.h68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/vppinfra/string.h b/src/vppinfra/string.h
index 4d2ff7875a2..0e0627d088d 100644
--- a/src/vppinfra/string.h
+++ b/src/vppinfra/string.h
@@ -95,46 +95,46 @@ clib_memcpy64_x4 (void *d0, void *d1, void *d2, void *d3, void *s)
_mm512_storeu_si512 (d3, r0);
#elif defined (__AVX2__)
- __m256i r0 = _mm256_loadu_si256 ((__m256i *) s + 0 * 32);
- __m256i r1 = _mm256_loadu_si256 ((__m256i *) s + 1 * 32);
+ __m256i r0 = _mm256_loadu_si256 ((__m256i *) (s + 0 * 32));
+ __m256i r1 = _mm256_loadu_si256 ((__m256i *) (s + 1 * 32));
- _mm256_storeu_si256 ((__m256i *) d0 + 0 * 32, r0);
- _mm256_storeu_si256 ((__m256i *) d0 + 1 * 32, r1);
+ _mm256_storeu_si256 ((__m256i *) (d0 + 0 * 32), r0);
+ _mm256_storeu_si256 ((__m256i *) (d0 + 1 * 32), r1);
- _mm256_storeu_si256 ((__m256i *) d1 + 0 * 32, r0);
- _mm256_storeu_si256 ((__m256i *) d1 + 1 * 32, r1);
+ _mm256_storeu_si256 ((__m256i *) (d1 + 0 * 32), r0);
+ _mm256_storeu_si256 ((__m256i *) (d1 + 1 * 32), r1);
- _mm256_storeu_si256 ((__m256i *) d2 + 0 * 32, r0);
- _mm256_storeu_si256 ((__m256i *) d2 + 1 * 32, r1);
+ _mm256_storeu_si256 ((__m256i *) (d2 + 0 * 32), r0);
+ _mm256_storeu_si256 ((__m256i *) (d2 + 1 * 32), r1);
- _mm256_storeu_si256 ((__m256i *) d3 + 0 * 32, r0);
- _mm256_storeu_si256 ((__m256i *) d3 + 1 * 32, r1);
+ _mm256_storeu_si256 ((__m256i *) (d3 + 0 * 32), r0);
+ _mm256_storeu_si256 ((__m256i *) (d3 + 1 * 32), r1);
#elif defined (__SSSE3__)
- __m128i r0 = _mm_loadu_si128 ((__m128i *) s + 0 * 16);
- __m128i r1 = _mm_loadu_si128 ((__m128i *) s + 1 * 16);
- __m128i r2 = _mm_loadu_si128 ((__m128i *) s + 2 * 16);
- __m128i r3 = _mm_loadu_si128 ((__m128i *) s + 3 * 16);
-
- _mm_storeu_si128 ((__m128i *) d0 + 0 * 16, r0);
- _mm_storeu_si128 ((__m128i *) d0 + 1 * 16, r1);
- _mm_storeu_si128 ((__m128i *) d0 + 2 * 16, r2);
- _mm_storeu_si128 ((__m128i *) d0 + 3 * 16, r3);
-
- _mm_storeu_si128 ((__m128i *) d1 + 0 * 16, r0);
- _mm_storeu_si128 ((__m128i *) d1 + 1 * 16, r1);
- _mm_storeu_si128 ((__m128i *) d1 + 2 * 16, r2);
- _mm_storeu_si128 ((__m128i *) d1 + 3 * 16, r3);
-
- _mm_storeu_si128 ((__m128i *) d2 + 0 * 16, r0);
- _mm_storeu_si128 ((__m128i *) d2 + 1 * 16, r1);
- _mm_storeu_si128 ((__m128i *) d2 + 2 * 16, r2);
- _mm_storeu_si128 ((__m128i *) d2 + 3 * 16, r3);
-
- _mm_storeu_si128 ((__m128i *) d3 + 0 * 16, r0);
- _mm_storeu_si128 ((__m128i *) d3 + 1 * 16, r1);
- _mm_storeu_si128 ((__m128i *) d3 + 2 * 16, r2);
- _mm_storeu_si128 ((__m128i *) d3 + 3 * 16, r3);
+ __m128i r0 = _mm_loadu_si128 ((__m128i *) (s + 0 * 16));
+ __m128i r1 = _mm_loadu_si128 ((__m128i *) (s + 1 * 16));
+ __m128i r2 = _mm_loadu_si128 ((__m128i *) (s + 2 * 16));
+ __m128i r3 = _mm_loadu_si128 ((__m128i *) (s + 3 * 16));
+
+ _mm_storeu_si128 ((__m128i *) (d0 + 0 * 16), r0);
+ _mm_storeu_si128 ((__m128i *) (d0 + 1 * 16), r1);
+ _mm_storeu_si128 ((__m128i *) (d0 + 2 * 16), r2);
+ _mm_storeu_si128 ((__m128i *) (d0 + 3 * 16), r3);
+
+ _mm_storeu_si128 ((__m128i *) (d1 + 0 * 16), r0);
+ _mm_storeu_si128 ((__m128i *) (d1 + 1 * 16), r1);
+ _mm_storeu_si128 ((__m128i *) (d1 + 2 * 16), r2);
+ _mm_storeu_si128 ((__m128i *) (d1 + 3 * 16), r3);
+
+ _mm_storeu_si128 ((__m128i *) (d2 + 0 * 16), r0);
+ _mm_storeu_si128 ((__m128i *) (d2 + 1 * 16), r1);
+ _mm_storeu_si128 ((__m128i *) (d2 + 2 * 16), r2);
+ _mm_storeu_si128 ((__m128i *) (d2 + 3 * 16), r3);
+
+ _mm_storeu_si128 ((__m128i *) (d3 + 0 * 16), r0);
+ _mm_storeu_si128 ((__m128i *) (d3 + 1 * 16), r1);
+ _mm_storeu_si128 ((__m128i *) (d3 + 2 * 16), r2);
+ _mm_storeu_si128 ((__m128i *) (d3 + 3 * 16), r3);
#else
clib_memcpy (d0, s, 64);