PR tree-optimization/84740
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-reduc-6.c
blob88591c5bdcbab0d066349b74503c3eb0a0a4cc8d
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 128
8 int a[N], b[N] __attribute__ ((__aligned__(__BIGGEST_ALIGNMENT__)));
10 /* Vectorization of reduction. Loop-aware SLP is not possible, because of
11 different arrays. */
13 __attribute__ ((noinline))
14 int main1 (int n, int res0, int res1)
16 int i;
17 int sum0 = 0, sum1 = 0;
19 for (i = 0; i < n; i++) {
20 sum1 += a[2*i];
21 sum0 += b[2*i];
24 /* Check results: */
25 if (sum0 != res0
26 || sum1 != res1)
27 abort ();
29 return 0;
32 int main (void)
34 int i;
36 check_vect ();
38 for (i = 0; i < N; i++)
39 a[i] = b[i] = i;
41 main1 (N/2, 4032, 4032);
42 return 0;
45 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail { vect_no_int_add || { ! { vect_unpack || vect_strided2 } } } } } } */
46 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 0 "vect" } } */
47 /* { dg-final { scan-tree-dump-times "different interleaving chains in one node" 1 "vect" { target { ! vect_no_int_add } } } } */