[AArch64/arm] PR testsuite/85326 Avoid C++ tests when C++ compiler not present
[official-gcc.git] / gcc / testsuite / gcc.target / i386 / sse-9.c
blobe1a0a2270cb00533587bed20b416df018a15c4a5
1 /* { dg-do run } */
2 /* { dg-options "-O2 -msse" } */
3 /* { dg-require-effective-target sse } */
5 #include "sse-check.h"
7 #include <xmmintrin.h>
8 #include <stddef.h>
9 #include <string.h>
11 static void
12 sse_test (void)
14 int alignment, n;
15 void *ptr;
16 int errors = 0;
17 const char test [] = "This is a test.";
19 for (alignment = 1; alignment <= (1 << 20); alignment += alignment)
21 ptr = _mm_malloc (alignment, alignment);
22 if (((ptrdiff_t) ptr) & (alignment - 1))
23 abort ();
24 if (ptr)
26 n = alignment > sizeof test ? sizeof test : alignment;
27 memcpy (ptr, test, n);
28 if (memcmp (ptr, test, n) != 0)
29 errors++;
30 _mm_free (ptr);
32 else
33 errors++;
36 if (errors != 0)
37 abort ();