Merge reload-branch up to revision 101000
[official-gcc.git] / gcc / testsuite / gcc.dg / i386-sse-9.c
blob1fe7adac5421015a6cc0c2d6e3fbbb1cdd8eb307
1 /* { dg-do run { target i?86-*-* x86_64-*-* } } */
2 /* { dg-options "-O2 -msse" } */
3 #include <xmmintrin.h>
4 #include <stdlib.h>
5 #include <stddef.h>
6 #include <string.h>
8 int
9 main()
11 int alignment, n;
12 void *ptr;
13 int errors = 0;
14 const char test [] = "This is a test.";
16 for (alignment = 1; alignment <= (1 << 20); alignment += alignment)
18 ptr = _mm_malloc (alignment, alignment);
19 if (((ptrdiff_t) ptr) & (alignment - 1))
20 abort ();
21 if (ptr)
23 n = alignment > sizeof test ? sizeof test : alignment;
24 memcpy (ptr, test, n);
25 if (memcmp (ptr, test, n) != 0)
26 errors++;
27 _mm_free (ptr);
29 else
30 errors++;
33 if (errors != 0)
34 abort ();
35 exit (0);