1/* PR middle-end/37010 */
2/* { dg-do run { target { { i?86-*-* x86_64-*-* } && ilp32 } } } */
3/* { dg-options "-msse2 -mpreferred-stack-boundary=2" } */
4/* { dg-require-effective-target sse2 } */
5/* { dg-require-effective-target sse2_runtime } */
6
7#include <emmintrin.h>
8
9typedef __PTRDIFF_TYPE__ ptrdiff_t;
10typedef float __m128 __attribute__ ((__vector_size__ (16), __may_alias__));
11typedef int aligned __attribute__((aligned(16)));
12
13extern void abort (void);
14
15__m128 r;
16
17int
18__attribute__ ((noinline))
19check_int (int *i, int align)
20{
21  *i = 20;
22  if ((((ptrdiff_t) i) & (align - 1)) != 0)
23    {
24      abort ();
25    }
26  return *i;
27}
28
29void
30__attribute__ ((noinline))
31foo (__m128 x, __m128 y ,__m128 z ,__m128 a, int size)
32{
33  aligned i;
34
35  if (size != 5 || check_int (&i, __alignof__(i)) != i)
36    abort ();
37
38  r = a;
39}
40
41int
42main (void)
43{
44  __m128 x = { 1.0 };
45
46  foo (x, x, x, x, 5);
47
48  if (__builtin_memcmp (&r, &x, sizeof (r)))
49    abort ();
50
51  return 0;
52}
53