[Pixman] [PATCH] test: Workaround unaligned MOVDQA bug (http://gcc.gnu.org/PR55614)

Siarhei Siamashka siarhei.siamashka at gmail.com
Sat Dec 8 05:29:53 PST 2012


Just use SSE2 intrinsics to do unaligned memory accesses as
a workaround for this gcc bug related to vector extensions.
---
 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 */
-- 
1.7.8.6



More information about the Pixman mailing list