1  /* { dg-additional-options "-Ofast -fno-common" } */
       2  /* { dg-additional-options "-Ofast -fno-common -mavx" { target avx_runtime } } */
       3  
       4  #include "tree-vect.h"
       5  
       6  __attribute__((noinline, noclone)) void
       7  foo (double *x, double *y)
       8  {
       9    double *p = __builtin_assume_aligned (x, 16);
      10    double *q = __builtin_assume_aligned (y, 16);
      11    double z, h;
      12    int i;
      13    for (i = 0; i < 1024; i++)
      14      {
      15        if (p[i] < 0.0)
      16  	z = q[i], h = q[i] * 7.0 + 3.0;
      17        else
      18  	z = p[i] + 6.0, h = p[1024 + i];
      19        p[i] = z + 2.0 * h;
      20      }
      21  }
      22  
      23  double a[2048] __attribute__((aligned (16)));
      24  double b[1024] __attribute__((aligned (16)));
      25  
      26  int
      27  main ()
      28  {
      29    int i;
      30    check_vect ();
      31    for (i = 0; i < 1024; i++)
      32      {
      33        a[i] = (i & 1) ? -i : 2 * i;
      34        a[i + 1024] = i;
      35        b[i] = 7 * i;
      36        asm ("");
      37      }
      38    foo (a, b);
      39    for (i = 0; i < 1024; i++)
      40      if (a[i] != ((i & 1)
      41  		 ? 7 * i + 2.0 * (7 * i * 7.0 + 3.0)
      42  		 : 2 * i + 6.0 + 2.0 * i)
      43  	|| b[i] != 7 * i
      44  	|| a[i + 1024] != i)
      45        abort ();
      46    return 0;
      47  }
      48  
      49  /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { target avx_runtime } } } */