OSDN Git Service

2008-06-07 Xinliang David Li <davidxl@google.com>
[pf3gnuchains/gcc-fork.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 /* Test vectorization of reduction of unsigned-int in the presence
9    of unknown-loop-bound.  */
10
11 __attribute__ ((noinline))
12 int main1 (int n, int res)
13 {
14   int i;
15   unsigned int ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
16   unsigned int uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
17   unsigned int udiff;
18
19   udiff = 0;
20   for (i = 0; i < n; i++) {
21     udiff += (ub[i] - uc[i]);
22   }
23
24   /* check results:  */
25   if (udiff != res)
26     abort ();
27
28   return 0;
29 }
30
31 int main (void)
32
33   check_vect ();
34   
35   main1 (N, 240);
36   main1 (N-1, 210);
37   return 0;
38 }
39
40 /* { dg-final { scan-tree-dump-times "vectorized 1 loops" 1 "vect" { xfail vect_no_int_add } } } */
41 /* { dg-final { cleanup-tree-dump "vect" } } */