OSDN Git Service

bd116befd93897ea4605b27ea79a77609e7bd3aa
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-1short.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 int main1 (unsigned short x, unsigned short max_result)
10 {
11   int i;
12   unsigned short ub[N] = {0,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
13   unsigned short uc[N] = {0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
14   unsigned short  udiff = 2;
15   unsigned short umax = x;
16   unsigned short umin = 10;
17
18   for (i = 0; i < N; i++) {
19     udiff += (unsigned short)(ub[i] - uc[i]);
20   }
21
22   for (i = 0; i < N; i++) {
23     umax = umax < uc[i] ? uc[i] : umax;
24   }
25
26   for (i = 0; i < N; i++) {
27     umin = umin > uc[i] ? uc[i] : umin;
28   }
29
30   /* check results:  */
31   if (udiff != DIFF)
32     abort ();
33   if (umax != max_result)
34     abort ();
35   if (umin != 0)
36     abort ();
37
38   return 0;
39 }
40
41 int main (void)
42
43   check_vect ();
44   
45   main1 (100, 100);
46   main1 (0, 15);
47   return 0;
48 }
49
50 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail i?86-*-* x86_64-*-* } } } */
51 /* { dg-final { cleanup-tree-dump "vect" } } */