Imported Upstream version 4.7.3
[platform/upstream/gcc48.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-3.c
1 /* { dg-require-effective-target vect_int } */
2
3 #include <stdarg.h>
4 #include "tree-vect.h"
5
6 #define N 16
7
8 unsigned int ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
9 unsigned int uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
10
11 /* Test vectorization of reduction of unsigned-int in the presence
12    of unknown-loop-bound.  */
13
14 __attribute__ ((noinline))
15 int main1 (int n, int res)
16 {
17   int i;
18   unsigned int udiff;
19
20   udiff = 0;
21   for (i = 0; i < n; i++) {
22     udiff += (ub[i] - uc[i]);
23   }
24
25   /* check results:  */
26   if (udiff != res)
27     abort ();
28
29   return 0;
30 }
31
32 int main (void)
33
34   check_vect ();
35   
36   main1 (N, 240);
37   main1 (N-1, 210);
38   return 0;
39 }
40
41 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_add } } } */
42 /* { dg-final { cleanup-tree-dump "vect" } } */