(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
vect/
vect-reduc-in-order-4.c
       1  /* { dg-xfail-run-if "" { { i?86-*-* x86_64-*-* } && ia32 } } */
       2  /* { dg-require-effective-target vect_double } */
       3  /* { dg-add-options ieee } */
       4  /* { dg-additional-options "-fno-fast-math" } */
       5  
       6  #include "tree-vect.h"
       7  
       8  #define N (VECTOR_BITS * 17)
       9  
      10  double __attribute__ ((noinline, noclone))
      11  reduc_plus_double (double *a)
      12  {
      13    double r1 = 0;
      14    double r2 = 0;
      15    double r3 = 0;
      16    double r4 = 0;
      17    for (int i = 0; i < N; i += 4)
      18      {
      19        r1 += a[i];
      20        r2 += a[i + 1];
      21        r3 += a[i + 2];
      22        r4 += a[i + 3];
      23      }
      24    return r1 * r2 * r3 * r4;
      25  }
      26  
      27  int __attribute__ ((optimize (1)))
      28  main ()
      29  {
      30    double a[N];
      31    double r[4] = {};
      32    for (int i = 0; i < N; i++)
      33      {
      34        a[i] = (i * 0.1) * (i & 1 ? 1 : -1);
      35        r[i % 4] += a[i];
      36        asm volatile ("" ::: "memory");
      37      }
      38    double res = reduc_plus_double (a);
      39    if (res != r[0] * r[1] * r[2] * r[3])
      40      __builtin_abort ();
      41    return 0;
      42  }
      43  
      44  /* { dg-final { scan-tree-dump-times "VECT_PERM_EXPR" 0 "vect" } } */