aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/vect/pr114107.c
blob: 65175d9a680516ddeb0ee664a0d93d2919b177a3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
/* { dg-do compile } */
/* { dg-require-effective-target vect_double } */

void rescale_x4 (double* __restrict data,
		 const double* __restrict factor, int n)
{
  for (int i=0; i<n; i++)
    {
      data[4*i] *= factor[i];
      data[4*i+1] *= factor[i];
      data[4*i+2] *= factor[i];
      data[4*i+3] *= factor[i];
    }
}

void rescale_x4_s (double* __restrict data,
		   const double* __restrict factor, int n, int s)
{
  for (int i=0; i<n; i++)
    {
      data[s*i] *= factor[s*i];
      data[s*i+1] *= factor[s*i];
      data[s*i+2] *= factor[s*i];
      data[s*i+3] *= factor[s*i];
    }
}

/* All targets should be able to compose a vector from scalar elements, but
   depending on vector size different permutes might be necessary.  */
/* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { target vect_perm } } } */
/* { dg-final { scan-tree-dump-not "Data access with gaps requires scalar epilogue loop" "vect" { target vect_perm } } } */