Debian Codegraph @

gcc/testsuite/gcc.dg/vect/slp-reduc-9.c

raw
1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_int_mult } */
3
4 int
5 bar (int *x, int a, int b, int n)
6 {
7 x = __builtin_assume_aligned (x, __BIGGEST_ALIGNMENT__);
8 int sum1 = 0;
9 int sum2 = 0;
10 for (int i = 0; i < n; ++i)
11 {
12 /* Reduction chain vectorization fails here because of the
13 different operations but we can still vectorize both
14 reductions as SLP reductions, saving IVs. */
15 sum1 += x[2*i] - a;
16 sum1 += x[2*i+1] * b;
17 sum2 += x[2*i] - b;
18 sum2 += x[2*i+1] * a;
19 }
20 return sum1 + sum2;
21 }
22
23 /* { dg-final { scan-tree-dump "Loop contains only SLP stmts" "vect" } } */
24 /* { dg-final { scan-tree-dump "vectorizing stmts using SLP" "vect" } } */
25 /* { dg-final { scan-tree-dump "vectorized 1 loops" "vect" } } */