Update concepts branch to revision 131834
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-2.c
blobb23dfbaf7ea26ec806ba05de9548e97cbac64832
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 16
7 #define DIFF 240
9 /* Test vectorization of reduction of signed-int. */
11 __attribute__ ((noinline))
12 void main1 (int x, int max_result, int min_result)
14 int i;
15 int b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
16 int c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
17 int diff = 0;
18 int max = x;
19 int min = x;
21 for (i = 0; i < N; i++) {
22 diff += (b[i] - c[i]);
25 for (i = 0; i < N; i++) {
26 max = max < c[i] ? c[i] : max;
29 for (i = 0; i < N; i++) {
30 min = min > c[i] ? c[i] : min;
33 /* check results: */
34 if (diff != DIFF)
35 abort ();
36 if (max != max_result)
37 abort ();
38 if (min != min_result)
39 abort ();
42 int main (void)
44 check_vect ();
46 main1 (100, 100, 1);
47 main1 (0, 15, 0);
48 return 0;
51 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail { vect_no_int_add || vect_no_int_max } } } } */
52 /* { dg-final { cleanup-tree-dump "vect" } } */