(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.target/
i386/
pr50725.c
       1  /* PR target/50725 */
       2  /* { dg-do run { target avx_runtime } } */
       3  /* { dg-options "-O2 -mavx" } */
       4  
       5  extern void abort (void);
       6  
       7  typedef int __attribute__((vector_size (32))) m256i;
       8  
       9  __attribute__((noinline, noclone)) void
      10  foo (int *x, m256i *y)
      11  {
      12    asm volatile ("" : : "r" (x), "r" (y) : "memory");
      13  }
      14  
      15  __attribute__((noinline, noclone)) int
      16  bar (int x)
      17  {
      18    if (x > 20)
      19      return 24;
      20    m256i i;
      21    foo (__builtin_alloca (x), &i);
      22    return 128;
      23  }
      24  
      25  __attribute__((noinline, noclone)) int
      26  baz (int d0, int d1, int d2, int d3, int d4, int d5, int x)
      27  {
      28    if (x > 20)
      29      return 24;
      30    m256i i;
      31    d0 += d1 + d2 + d3 + d4 + d5; d1 += d0;
      32    foo (__builtin_alloca (x), &i);
      33    return 128;
      34  }
      35  
      36  int
      37  main ()
      38  {
      39    if (bar (22) != 24 || bar (20) != 128)
      40      abort ();
      41  #ifdef __x86_64__
      42    register long long r10 __asm__ ("r10") = 0xdeadbeefdeadbeefULL;
      43    asm volatile ("" : "+r" (r10));
      44  #endif
      45    if (baz (0, 0, 0, 0, 0, 0, 22) != 24 || baz (0, 0, 0, 0, 0, 0, 20) != 128)
      46      abort ();
      47    return 0;
      48  }