(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
pr59501-5.c
       1  /* PR target/59501 */
       2  /* { dg-do run } */
       3  /* { dg-options "-O2 -mavx -mno-accumulate-outgoing-args" } */
       4  /* { dg-require-effective-target avx } */
       5  
       6  #define CHECK_H "avx-check.h"
       7  #define TEST avx_test
       8  
       9  #include CHECK_H
      10  
      11  typedef double V __attribute__ ((vector_size (32)));
      12  
      13  __attribute__((noinline, noclone)) void
      14  bar (char *p)
      15  {
      16    p[0] = 1;
      17    p[37] = 2;
      18    asm volatile ("" : : "r" (p) : "memory");
      19  }
      20  
      21  __attribute__((noinline, noclone)) V
      22  foo (double *x, int a, int b, int c, int d, int e, int f, unsigned *y)
      23  {
      24    bar (__builtin_alloca (a + b + c + d + e + f));
      25    V r = { x[y[0]], x[y[1]], x[y[2]], x[y[3]] };
      26    return r;
      27  }
      28  
      29  static void
      30  TEST (void)
      31  {
      32    double a[16];
      33    unsigned b[4] = { 5, 0, 15, 7 };
      34    int i;
      35    for (i = 0; i < 16; i++)
      36      a[i] = 0.5 + i;
      37    V v = foo (a, 0, 30, 0, 0, 8, 0, b);
      38    if (v[0] != 5.5 || v[1] != 0.5 || v[2] != 15.5 || v[3] != 7.5)  
      39      __builtin_abort ();
      40  }