1 // RUN: %libomp-compile-and-run
4 // Non-rectangular loop collapsing.
6 // Nested loops conform to OpenMP 5.2 standard,
7 // inner loops bounds may depend on outer loops induction variables.
11 for (i = iLB; i <= iUB; i += iStep) \
12 for (j = i * jA1 + jA0; j <= i * jB1 + jB0; j += jStep) \
13 for (k = j * kA1 + kA0; k <= j * kB1 + kB0; k += kStep)
14 #include "collapse_test.inc"
32 PRINTF("\nOne off iLB=%d; iUB=%d; jA0=%d; jA1=%d; jB0=%d; jB1=%d; kA0=%d; "
33 "kA1=%d; kB0=%d; kB1=%d; iStep=%d; jStep=%d; kStep=%d;\n",
34 iLB
, iUB
, jA0
, jA1
, jB0
, jB1
, kA0
, kA1
, kB0
, kB1
, iStep
, jStep
, kStep
);
35 fail
= fail
|| (test() == 0);
39 // NOTE: if a loop on some level won't execute for all iterations of an
40 // outer loop, it still should work. Runtime doesn't require lower bounds to
41 // be <= upper bounds for all possible i, j, k.
50 for (kA1
= -2; kA1
<= 2; ++kA1
) { // <=
51 for (kB1
= -2; kB1
<= 2; ++kB1
) {
52 for (jA1
= -3; jA1
<= 3; ++jA1
) {
53 for (jB1
= -3; jB1
<= 3; ++jB1
) {
54 for (iStep
= 1; iStep
<= 3; ++iStep
) {
55 for (jStep
= 2; jStep
<= 6; jStep
+= 2) {
56 for (kStep
= 2; kStep
<= 8; kStep
+= 3) {
57 PRINTF("\nTrying iLB=%d; iUB=%d; jA0=%d; jA1=%d; jB0=%d; "
58 "jB1=%d; kA0=%d; kA1=%d; kB0=%d; kB1=%d; iStep=%d; "
59 "jStep=%d; kStep=%d;\n",
60 iLB
, iUB
, jA0
, jA1
, jB0
, jB1
, kA0
, kA1
, kB0
, kB1
,
62 fail
= fail
|| (test() == 0);