merge with trunk @ 139506
[official-gcc.git] / gcc / testsuite / gcc.dg / torture / stackalign / push-1.c
blob7417324e4bb49aa26b4046b441b68d9890d20534
1 /* PR middle-end/37010 */
2 /* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
3 /* { dg-options "-msse2 -mpreferred-stack-boundary=2" } */
5 #include <emmintrin.h>
6 #include "cpuid.h"
8 typedef __PTRDIFF_TYPE__ ptrdiff_t;
9 typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
10 typedef int aligned __attribute__((aligned(16)));
12 extern void abort (void);
14 __m128 r;
16 int
17 __attribute__ ((noinline))
18 check_int (int *i, int align)
20 *i = 20;
21 if ((((ptrdiff_t) i) & (align - 1)) != 0)
23 abort ();
25 return *i;
28 void
29 __attribute__ ((noinline))
30 foo (__m128 x, __m128 y ,__m128 z ,__m128 a, int size)
32 aligned i;
34 if (size != 5 || check_int (&i, __alignof__(i)) != i)
35 abort ();
37 r = a;
40 int
41 main (void)
43 __m128 x = { 1.0 };
44 unsigned int eax, ebx, ecx, edx;
46 if (!__get_cpuid (1, &eax, &ebx, &ecx, &edx))
47 return 0;
49 /* Run SSE2 test only if host has SSE2 support. */
50 if (edx & bit_SSE2)
52 foo (x, x, x, x, 5);
54 if (__builtin_memcmp (&r, &x, sizeof (r)))
55 abort ();
58 return 0;