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 REG "rcx"
      11  # define WIDTH "q"
      12  #else
      13  # define REG "ecx"
      14  # define WIDTH "l"
      15  #endif
      16  
      17  __m128i __attribute__ ((__noinline__))
      18  vector_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__))
      25  self_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 __attribute__ ((__optimize__ ("-fno-omit-frame-pointer")))
      34  sse2_test (void)
      35  {
      36    int result;
      37    register int __attribute__ ((__mode__ (__word__))) reg asm (REG);
      38    asm volatile ("push" WIDTH "\t%0"  /* Disalign runtime stack.  */
      39  		: : "r" (reg) : "memory");
      40    result = self_aligning_function (g_1, g_2);
      41    if (result != 42)
      42      abort ();
      43    asm volatile ("pop" WIDTH "\t%0" : "=r" (reg));
      44  }