merge with trunk @ 139506
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / wrapv-vect-reduc-2short.c
blob0468b1966b9b16e3b9e4747bbfb1087cc6392a1a
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 short b[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
10 short c[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
12 __attribute__ ((noinline))
13 void main1 (short x, short max_result, short min_result)
15 int i;
16 short diff = 2;
17 short max = x;
18 short min = x;
20 for (i = 0; i < N; i++) {
21 diff += (short)(b[i] - c[i]);
23 for (i = 0; i < N; i++) {
24 max = max < c[i] ? c[i] : max;
27 for (i = 0; i < N; i++) {
28 min = min > c[i] ? c[i] : min;
31 /* check results: */
32 if (diff != DIFF)
33 abort ();
34 if (max != max_result)
35 abort ();
36 if (min != min_result)
37 abort ();
40 int main (void)
42 check_vect ();
44 main1 (100, 100, 1);
45 main1 (0, 15, 0);
46 return 0;
49 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail vect_no_int_max } } } */
50 /* { dg-final { cleanup-tree-dump "vect" } } */