SLP reductions with variable-length vectors
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / slp-reduc-5.c
blobfc689e46ba16683b1d384207c148edb9ff938742
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 128
8 int c[N];
10 /* Vectorization of reduction using loop-aware SLP. */
12 __attribute__ ((noinline))
13 int main1 (int n, int res0, int res1)
15 int i;
16 int max0 = -100, max1 = -313;
18 for (i = 0; i < n; i++) {
19 max1 = max1 < c[2*i+1] ? c[2*i+1] : max1;
20 max0 = max0 < c[2*i] ? c[2*i] : max0;
23 /* Check results: */
24 if (max0 != res0
25 || max1 != res1)
26 abort ();
28 return 0;
31 int main (void)
33 int i;
35 check_vect ();
37 for (i = 0; i < N; i++)
38 c[i] = (i+3) * -1;
40 c[0] = c[1] = -100;
41 main1 (N/2, -5, -6);
42 return 0;
45 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 2 "vect" { xfail vect_no_int_min_max } } } */
46 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_no_int_min_max } } } */