Skip various cmp-mem-const tests on lp64 hppa*-*-*
[official-gcc.git] / libgomp / testsuite / libgomp.c-c++-common / pr106449-2.c
blob7fef7461bcf2422809d5424adba516d69dec62dd
1 /* { dg-do run } */
3 /* Based on pr106449.c - but using 'for' instead of 'simd'.
4 Cf. PR middle-end/106449 (for pr106449.c) and PR middle-end/106467. */
6 void
7 foo (void)
9 int a[1024], *b[65536], *c[65536];
10 int *p, *q, **r = &b[0], **r2 = &c[0], i;
11 #pragma omp for collapse(2)
12 for (p = &a[0]; p < &a[512]; p++)
13 for (q = p + 64; q < p + 128; q++)
15 *r++ = p;
16 *r2++ = q;
18 for (i = 0; i < 32768; i++)
19 if (b[i] != &a[i / 64] || c[i] != &a[(i / 64) + 64 + (i % 64)])
20 __builtin_abort ();
23 void
24 bar (int n, int m)
26 int a[1024], *b[32768], *c[32768];
27 int *p, *q, **r = &b[0], **r2 = &c[0], i;
28 #pragma omp for collapse(2)
29 for (p = &a[0]; p < &a[512]; p++)
30 for (q = p + n; q < p + m; q++)
32 *r++ = p;
33 *r2++ = q;
35 for (i = 0; i < 32768; i++)
36 if (b[i] != &a[i / 64] || c[i] != &a[(i / 64) + 64 + (i % 64)])
37 __builtin_abort ();
40 void
41 baz (int n, int m)
43 int a[1024], *b[8192], *c[8192];
44 int *p, *q, **r = &b[0], **r2 = &c[0], i;
45 #pragma omp for collapse(2)
46 for (p = &a[0]; p < &a[512]; p += 4)
47 for (q = p + n; q < p + m; q += 2)
49 *r++ = p;
50 *r2++ = q;
52 for (i = 0; i < 4096; i++)
53 if (b[i] != &a[(i / 32) * 4] || c[i] != &a[(i / 32) * 4 + 64 + (i % 32) * 2])
54 __builtin_abort ();
57 int
58 main ()
60 foo ();
61 bar (64, 128);
62 baz (64, 128);
63 return 0;