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