OSDN Git Service

* tree-complex.c (expand_complex_div_wide): Don't create CONDs that
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-1.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 DIFF 242
8
9 /* Test vectorization of reduction of unsigned-int.  */
10
11 __attribute__ ((noinline))
12 void main1 (unsigned int x, unsigned int max_result, unsigned int min_result)
13 {
14   int i;
15   unsigned int ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
16   unsigned int uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
17   unsigned int udiff = 2;
18   unsigned int umax = x;
19   unsigned int umin = x;
20
21   /* Summation.  */
22   for (i = 0; i < N; i++) {
23     udiff += (ub[i] - uc[i]);
24   }
25
26   /* Maximum.  */
27   for (i = 0; i < N; i++) {
28     umax = umax < uc[i] ? uc[i] : umax;
29   }
30
31   /* Minimum.  */
32   for (i = 0; i < N; i++) {
33     umin = umin > uc[i] ? uc[i] : umin;
34   }
35
36   /* check results:  */
37   if (udiff != DIFF)
38     abort ();
39   if (umax != max_result)
40     abort ();
41   if (umin != min_result)
42     abort ();
43 }
44
45 int main (void)
46
47   check_vect ();
48   
49   main1 (100, 100, 1);
50   main1 (0, 15, 0);
51   return 0;
52 }
53
54 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail { vect_no_int_add || vect_no_int_max } } } } */
55 /* { dg-final { cleanup-tree-dump "vect" } } */