Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sse-9.c
blob0106cb52f63fbc9c45b79f251d561833de20b44e
1 /* { dg-do run } */
2 /* { dg-options "-O2 -msse" } */
4 #include "sse-check.h"
6 #include <xmmintrin.h>
7 #include <stddef.h>
8 #include <string.h>
10 static void
11 sse_test (void)
13 int alignment, n;
14 void *ptr;
15 int errors = 0;
16 const char test [] = "This is a test.";
18 for (alignment = 1; alignment <= (1 << 20); alignment += alignment)
20 ptr = _mm_malloc (alignment, alignment);
21 if (((ptrdiff_t) ptr) & (alignment - 1))
22 abort ();
23 if (ptr)
25 n = alignment > sizeof test ? sizeof test : alignment;
26 memcpy (ptr, test, n);
27 if (memcmp (ptr, test, n) != 0)
28 errors++;
29 _mm_free (ptr);
31 else
32 errors++;
35 if (errors != 0)
36 abort ();