(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
pr90018.c
       1  /* { dg-require-effective-target vect_double } */
       2  
       3  #include "tree-vect.h"
       4  
       5  void __attribute__((noinline,noclone))
       6  foo (double *a4, int n)
       7  {
       8    for (int i = 0; i < n; ++i)
       9      {
      10        /* We may not apply interleaving to the group (a), (b) because of (c).
      11           Instead group (d) and (b).  */
      12        double tem1 = a4[i*4] + a4[i*4+n*4] /* (a) */;
      13        double tem2 = a4[i*4+2*n*4+1];
      14        a4[i*4+n*4+1] = tem1; /* (c) */
      15        a4[i*4+1] = tem2;
      16        double tem3 = a4[i*4] - tem2;
      17        double tem4 = tem3 + a4[i*4+n*4] /* (d) */;
      18        a4[i*4+n*4+1] = tem4 + a4[i*4+n*4+1] /* (b) */;
      19      }
      20  }
      21  int main(int argc, char **argv)
      22  {
      23    int n = 11;
      24    double a4[4 * n * 3];
      25    double a42[4 * n * 3];
      26    check_vect ();
      27    for (int i = 0; i < 4 * n * 3; ++i)
      28      {
      29        a4[i] = a42[i] = i;
      30        __asm__ volatile ("": : : "memory");
      31      }
      32    foo (a4, n);
      33    for (int i = 0; i < n; ++i)
      34      {
      35        double tem1 = a42[i*4] + a42[i*4+n*4];
      36        double tem2 = a42[i*4+2*n*4+1];
      37        a42[i*4+n*4+1] = tem1;
      38        a42[i*4+1] = tem2;
      39        double tem3 = a42[i*4] - tem2;
      40        double tem4 = tem3 + a42[i*4+n*4];
      41        a42[i*4+n*4+1] = tem4 + a42[i*4+n*4+1];
      42        __asm__ volatile ("": : : "memory");
      43      }
      44    for (int i = 0; i < 4 * n * 3; ++i)
      45      if (a4[i] != a42[i])
      46        __builtin_abort ();
      47    return 0;
      48  }
      49  
      50  /* For v2df we try to use SLP and fail miserably.  */
      51  /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target vect_sizes_32B_16B } } } */