libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-reduc-9.c
blobbee642ee999a8a2eafdf565fdd056b7a4d34ed37
1 /* { dg-do compile } */
2 /* { dg-require-effective-target vect_int_mult } */
4 int
5 bar (int *x, int a, int b, int n)
7 x = __builtin_assume_aligned (x, __BIGGEST_ALIGNMENT__);
8 int sum1 = 0;
9 int sum2 = 0;
10 for (int i = 0; i < n; ++i)
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;
20 return sum1 + sum2;
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" } } */