Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / gcc / testsuite / gcc.dg / vect / vect-reduc-1.c
blob660c2df9529c524fe541cbd600689e71be046b24
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 16
7 #define DIFF 242
9 /* Test vectorization of reduction of unsigned-int. */
11 void main1 (unsigned int x, unsigned int max_result, unsigned int min_result)
13 int i;
14 unsigned int ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
15 unsigned int uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
16 unsigned int udiff = 2;
17 unsigned int umax = x;
18 unsigned int umin = x;
20 /* Summation. */
21 for (i = 0; i < N; i++) {
22 udiff += (ub[i] - uc[i]);
25 /* Maximum. */
26 for (i = 0; i < N; i++) {
27 umax = umax < uc[i] ? uc[i] : umax;
30 /* Minimum. */
31 for (i = 0; i < N; i++) {
32 umin = umin > uc[i] ? uc[i] : umin;
35 /* check results: */
36 if (udiff != DIFF)
37 abort ();
38 if (umax != max_result)
39 abort ();
40 if (umin != min_result)
41 abort ();
44 int main (void)
46 check_vect ();
48 main1 (100, 100, 1);
49 main1 (0, 15, 0);
50 return 0;
53 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail { vect_no_int_add || vect_no_int_max } } } } */
54 /* { dg-final { cleanup-tree-dump "vect" } } */