diff options
author | Siarhei Siamashka <siarhei.siamashka@gmail.com> | 2012-12-08 15:16:51 +0200 |
---|---|---|
committer | Siarhei Siamashka <siarhei.siamashka@gmail.com> | 2012-12-10 20:05:15 +0200 |
commit | fdab3c1b6cd9c5e197ec3f6bc0a03da32880e317 (patch) | |
tree | ce7a4f7b31abc770b7a60db30ab989808e45d1aa | |
parent | 2bc59006d7fe91abf68a2061ad86c06e1b2964ab (diff) |
test: Workaround unaligned MOVDQA bug (http://gcc.gnu.org/PR55614)
Just use SSE2 intrinsics to do unaligned memory accesses as
a workaround for this gcc bug related to vector extensions.
-rw-r--r-- | test/utils-prng.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/utils-prng.c b/test/utils-prng.c index 7c2dd6a..967b898 100644 --- a/test/utils-prng.c +++ b/test/utils-prng.c @@ -27,6 +27,10 @@ #include "utils.h" #include "utils-prng.h" +#if defined(GCC_VECTOR_EXTENSIONS_SUPPORTED) && defined(__SSE2__) +#include <xmmintrin.h> +#endif + void smallprng_srand_r (smallprng_t *x, uint32_t seed) { uint32_t i; @@ -77,6 +81,14 @@ store_rand_128_data (void *addr, prng_rand_128_data_t *d, int aligned) *(uint8x16 *)addr = d->vb; return; } + else + { +#ifdef __SSE2__ + /* workaround for http://gcc.gnu.org/PR55614 */ + _mm_storeu_si128 (addr, _mm_loadu_si128 ((__m128i *)d)); + return; +#endif + } #endif /* we could try something better for unaligned writes (packed attribute), * but GCC is not very reliable: http://gcc.gnu.org/PR55454 */ |