Imported Upstream version 4.7.3
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / vect / no-scevccp-noreassoc-slp-reduc-7.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7 #define MAX 121
8
9 unsigned int ub[N] = {0,3,6,9,12,15,18,121,24,27,113,33,36,39,42,45};
10
11 /* Vectorization of reduction using loop-aware SLP (with unrolling).  */
12
13 __attribute__ ((noinline))
14 int main1 (int n)
15 {
16   int i;
17   unsigned int max = 50;
18
19   for (i = 0; i < n; i++) {
20     max = max < ub[2*i] ? ub[2*i] : max;
21     max = max < ub[2*i + 1] ? ub[2*i + 1] : max;
22   }
23
24   /* Check results:  */
25   if (max != MAX)
26     abort ();
27
28   return 0;
29 }
30
31 int main (void)
32 {
33   check_vect ();
34
35   main1 (N/2);
36   return 0;
37 }
38
39 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_max } } } */
40 /* { dg-final { scan-tree-dump-times "vectorizing stmts using SLP" 1 "vect" { xfail vect_no_int_max } } } */
41 /* { dg-final { cleanup-tree-dump "vect" } } */
42