1 /* { dg-do run } */ 2 /* { dg-options "-std=gnu99 -msse2 -mpreferred-stack-boundary=4" } */ 3 /* { dg-require-effective-target sse2 } */ 4 5 #include "sse2-check.h" 6 7 #include <emmintrin.h> 8 9 #ifdef __x86_64__ 10 # define PUSH "pushq %rsi" 11 # define POP "popq %rsi" 12 #else 13 # define PUSH "pushl %esi" 14 # define POP "popl %esi" 15 #endif 16 17 __m128i __attribute__ ((__noinline__)) vector_using_function()18vector_using_function () 19 { 20 volatile __m128i vx; /* We want to force a vector-aligned store into the stack. */ 21 vx = _mm_xor_si128 (vx, vx); 22 return vx; 23 } 24 int __attribute__ ((__noinline__, __force_align_arg_pointer__)) self_aligning_function(int x,int y)25self_aligning_function (int x, int y) 26 { 27 __m128i ignored = vector_using_function (); 28 return (x + y); 29 } 30 int g_1 = 20; 31 int g_2 = 22; 32 33 static void sse2_test(void)34sse2_test (void) 35 { 36 int result; 37 asm (PUSH); /* Misalign runtime stack. */ 38 result = self_aligning_function (g_1, g_2); 39 if (result != 42) 40 abort (); 41 asm (POP); 42 } 43