builtin-has-attribute-4.c: Skip on 32-bit hppa*-*-hpux*.
[official-gcc.git] / gcc / testsuite / gcc.dg / autopar / reduc-1char.c
blob0d611b96eae74756cc3a909738f893e38de6e6ae
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -ftree-parallelize-loops=4 -fdump-tree-parloops2-details -fdump-tree-optimized" } */
4 #include <stdarg.h>
5 #include <stdlib.h>
7 #define N 1600
8 #define DIFF 242
10 unsigned char ub[N] = {1,3,6,9,12,15,18,21,24,27,30,33,36,39,42,45};
11 unsigned char uc[N] = {1,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15};
13 __attribute__ ((noinline)) void
14 main1 (unsigned char x, unsigned char max_result, unsigned char min_result)
16 int i;
17 unsigned char udiff = 2;
18 unsigned char umax = x;
19 unsigned char umin = x;
21 for (i = 0; i < N; i++) {
22 udiff += (unsigned char)(ub[i] - uc[i]);
25 for (i = 0; i < N; i++) {
26 umax = umax < uc[i] ? uc[i] : umax;
29 for (i = 0; i < N; i++) {
30 umin = umin > uc[i] ? uc[i] : umin;
33 /* check results: */
34 if (udiff != DIFF)
35 abort ();
36 if (umax != max_result)
37 abort ();
38 if (umin != min_result)
39 abort ();
42 __attribute__((noinline))
43 void init_arrays ()
45 int i;
47 for (i=16; i<N; i++)
49 ub[i] = 1;
50 uc[i] = 1;
54 int main (void)
56 init_arrays();
57 main1 (100, 100, 1);
58 main1 (0, 15, 0);
59 return 0;
63 /* { dg-final { scan-tree-dump-times "Detected reduction" 3 "parloops2" } } */
64 /* { dg-final { scan-tree-dump-times "SUCCESS: may be parallelized" 4 "parloops2" } } */