Merge from mainline (165734:167278).
[official-gcc/graphite-test-results.git] / gcc / testsuite / gcc.dg / vect / slp-reduc-4.c
blob5df53f919bc569d35e3d4ad486dbcb260c123d85
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 128
8 unsigned int uc[N];
10 /* Vectorization of reduction using loop-aware SLP. */
12 __attribute__ ((noinline))
13 int main1 (int n, int res0, int res1, int res2, int res3, int res4, int res5, int res6, int res7)
15 int i;
16 unsigned int max0 = 5, max1 = 10, max2 = 20, max3 = 30, max4 = 2, max5 = 13, max6 = 7, max7 = 313;
18 for (i = 0; i < n; i++) {
19 max2 = max2 < uc[8*i+2] ? uc[8*i+2] : max2;
20 max3 = max3 < uc[8*i+3] ? uc[8*i+3] : max3;
21 max1 = max1 < uc[8*i+1] ? uc[8*i+1] : max1;
22 max7 = max7 < uc[8*i+7] ? uc[8*i+7] : max7;
23 max6 = max6 < uc[8*i+6] ? uc[8*i+6] : max6;
24 max0 = max0 < uc[8*i] ? uc[8*i] : max0;
25 max4 = max4 < uc[8*i+4] ? uc[8*i+4] : max4;
26 max5 = max5 < uc[8*i+5] ? uc[8*i+5] : max5;
29 /* Check results: */
30 if (max0 != res0
31 || max1 != res1
32 || max2 != res2
33 || max3 != res3
34 || max4 != res4
35 || max5 != res5
36 || max6 != res6
37 || max7 != res7)
38 abort ();
40 return 0;
43 int main (void)
45 int i;
47 check_vect ();
49 for (i = 0; i < N; i++)
51 uc[i] = i+3;
52 __asm__ volatile ("");
55 main1 (N/8, 123, 124, 125, 126, 127, 128, 129, 313);
56 return 0;
59 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_max } } } */
60 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_no_int_max } } } */
61 /* { dg-final { cleanup-tree-dump "vect" } } */