PR target/55146
[official-gcc.git] / gcc / testsuite / gcc.dg / vect / vect-reduc-2char-big-array.c
blob7004e9e4e4403e8fb11d7adf29acb3ac032073c8
1 /* { dg-require-effective-target vect_int } */
3 #include <stdarg.h>
4 #include "tree-vect.h"
6 #define N 256
7 volatile int y = 0;
9 __attribute__ ((noinline))
10 void main1 (signed char x, signed char max_result, signed char min_result)
12 int i;
13 signed char b[N];
14 signed char c[N];
15 signed char check_diff = 2;
16 signed char diff = 2;
17 signed char max = x;
18 signed char min = x;
20 check_diff = 2;
21 for (i = 0; i < N; i++) {
22 b[i] = i;
23 c[i] = i;
24 if (i%16 == 0)
26 c[i] = i + 1;
27 check_diff += 1;
29 if (c[i] > max_result)
30 max_result = c[i];
31 if (c[i] < min_result)
32 min_result = c[i];
33 /* Avoid vectorization. */
34 if (y)
35 abort ();
38 for (i = 0; i < N; i++) {
39 diff += (signed char) (c[i] - b[i]);
42 for (i = 0; i < N; i++) {
43 max = max < c[i] ? c[i] : max;
46 for (i = 0; i < N; i++) {
47 min = min > c[i] ? c[i] : min;
50 /* check results: */
51 if (diff != check_diff)
52 abort ();
53 if (max != max_result)
54 abort ();
55 if (min != min_result)
56 abort ();
59 int main (void)
61 check_vect ();
63 main1 (100, 100, 1);
64 main1 (0, 15, 0);
65 return 0;
68 /* { dg-final { scan-tree-dump-times "vectorized 3 loops" 1 "vect" { xfail *-*-* } } } */
69 /* { dg-final { cleanup-tree-dump "vect" } } */