| 1 |
/* { dg-do run } */ |
| 2 |
/* { dg-require-effective-target ia32 } */ |
| 3 |
/* { dg-require-effective-target sse2 } */ |
| 4 |
/* { dg-options "-std=gnu99 -msse2 -mstackrealign -mpreferred-stack-boundary=4" } */ |
| 5 |
|
| 6 |
#include "sse2-check.h" |
| 7 |
|
| 8 |
#include <emmintrin.h> |
| 9 |
|
| 10 |
__m128i __attribute__ ((__noinline__)) |
| 11 |
vector_using_function () |
| 12 |
{ |
| 13 |
volatile __m128i vx; /* We want to force a vector-aligned store into the stack. */ |
| 14 |
vx = _mm_xor_si128 (vx, vx); |
| 15 |
return vx; |
| 16 |
} |
| 17 |
int __attribute__ ((__noinline__)) |
| 18 |
self_aligning_function (int x, int y) |
| 19 |
{ |
| 20 |
__m128i ignored = vector_using_function (); |
| 21 |
return (x + y); |
| 22 |
} |
| 23 |
int g_1 = 20; |
| 24 |
int g_2 = 22; |
| 25 |
|
| 26 |
static void __attribute__ ((__optimize__ ("-fno-omit-frame-pointer"))) |
| 27 |
sse2_test (void) |
| 28 |
{ |
| 29 |
int result; |
| 30 |
register int reg asm ("ecx"); |
| 31 |
asm ("pushl\t%0": : "r" (reg) : "memory"); /* Disalign runtime stack. */ |
| 32 |
result = self_aligning_function (g_1, g_2); |
| 33 |
if (result != 42) |
| 34 |
abort (); |
| 35 |
asm ("popl\t%0" : "=r" (reg)); |
| 36 |
} |