OSDN Git Service

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