diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-26 15:39:46 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2016-10-26 15:40:12 +0900 |
commit | 9d104ec326ac98e2a335cb3477a6ad2c2f0c87df (patch) | |
tree | 740d8e283e6dbf5713dfe12e920b0a724e802a35 /test_inputs/codegen | |
parent | 1bc80b1e1cf5941b141ce5c51162d6bd75c071f5 (diff) | |
download | isl-9d104ec326ac98e2a335cb3477a6ad2c2f0c87df.tar.gz isl-9d104ec326ac98e2a335cb3477a6ad2c2f0c87df.tar.bz2 isl-9d104ec326ac98e2a335cb3477a6ad2c2f0c87df.zip |
Imported Upstream version 0.13upstream/0.13
Change-Id: I7cc83b826345ba2d53631534ce803771a505f7f0
Signed-off-by: DongHun Kwak <dh0128.kwak@samsung.com>
Diffstat (limited to 'test_inputs/codegen')
115 files changed, 394 insertions, 263 deletions
diff --git a/test_inputs/codegen/atomic3.c b/test_inputs/codegen/atomic3.c new file mode 100644 index 00000000..e63e0920 --- /dev/null +++ b/test_inputs/codegen/atomic3.c @@ -0,0 +1,8 @@ +for (int c0 = 0; c0 <= 64; c0 += 1) { + if (c0 >= 63) { + sync(); + } else if (c0 >= 1) { + sync(); + } else + sync(); +} diff --git a/test_inputs/codegen/atomic3.in b/test_inputs/codegen/atomic3.in new file mode 100644 index 00000000..4d0c4953 --- /dev/null +++ b/test_inputs/codegen/atomic3.in @@ -0,0 +1,5 @@ +# Check that isl is not confused by inconsistent +# separation_class and atomic options. +{ sync[] -> [i, 0] : 0 <= i <= 64 } +{ : } +{ [i, 0] -> separation_class[[1] -> [0]] : 1 <= i <= 62; [i, 0] -> atomic[1]} diff --git a/test_inputs/codegen/atomic4.c b/test_inputs/codegen/atomic4.c new file mode 100644 index 00000000..624c2af1 --- /dev/null +++ b/test_inputs/codegen/atomic4.c @@ -0,0 +1,2 @@ +for (int c0 = 0; c0 <= 64; c0 += 1) + sync(); diff --git a/test_inputs/codegen/atomic4.in b/test_inputs/codegen/atomic4.in new file mode 100644 index 00000000..c5dab102 --- /dev/null +++ b/test_inputs/codegen/atomic4.in @@ -0,0 +1,4 @@ +# Check that isl is not confused by inconsistent separate and atomic options. +{ sync[] -> [i, 0] : 0 <= i <= 64 } +{ : } +{ [i, 0] -> separate[1] : 1 <= i <= 62; [i, 0] -> atomic[1] : i <= 10 or i >= 20 } diff --git a/test_inputs/codegen/cloog/4-param.c b/test_inputs/codegen/cloog/4-param.c index 0e0e254b..56659a06 100644 --- a/test_inputs/codegen/cloog/4-param.c +++ b/test_inputs/codegen/cloog/4-param.c @@ -1,9 +1,9 @@ { - for (int c0 = m; c0 <= min(p - 1, n); c0 += 1) + for (int c0 = m; c0 <= min(n, p - 1); c0 += 1) S1(c0); - for (int c0 = p; c0 <= min(q, m - 1); c0 += 1) + for (int c0 = p; c0 <= min(m - 1, q); c0 += 1) S2(c0); - for (int c0 = max(m, p); c0 <= min(q, n); c0 += 1) { + for (int c0 = max(m, p); c0 <= min(n, q); c0 += 1) { S1(c0); S2(c0); } diff --git a/test_inputs/codegen/cloog/christian.c b/test_inputs/codegen/cloog/christian.c index 3faa319e..98b52d8d 100644 --- a/test_inputs/codegen/cloog/christian.c +++ b/test_inputs/codegen/cloog/christian.c @@ -1,6 +1,6 @@ for (int c0 = -N + 1; c0 <= N; c0 += 1) { - for (int c1 = max(c0 - 1, 0); c1 < min(N + c0 - 1, N); c1 += 1) + for (int c1 = max(0, c0 - 1); c1 < min(N, N + c0 - 1); c1 += 1) S2(c1, -c0 + c1 + 1); - for (int c1 = max(c0, 0); c1 < min(N + c0, N); c1 += 1) + for (int c1 = max(0, c0); c1 < min(N, N + c0); c1 += 1) S1(c1, -c0 + c1); } diff --git a/test_inputs/codegen/cloog/classen.c b/test_inputs/codegen/cloog/classen.c index 17296bf7..ad7be335 100644 --- a/test_inputs/codegen/cloog/classen.c +++ b/test_inputs/codegen/cloog/classen.c @@ -14,19 +14,19 @@ S5(m - 2, 1, m - 1, 1, m - 1, 1, m, 1); S1(m - 1, 1, m, 1); S3(m - 1, 1, m, 2, m, 1, m, 2); - } else if (c0 >= m) { - S5(c0 - 1, -m + c0 + 2, c0, -m + c0 + 2, m - 1, -m + c0 + 2, m, -m + c0 + 2); - S6(c0 - 1, -m + c0 + 1, c0, -m + c0 + 2, m, -m + c0 + 1, m, -m + c0 + 2); - S1(c0, -m + c0 + 2, m, -m + c0 + 2); - S3(c0, -m + c0 + 2, c0 + 1, -m + c0 + 3, m, -m + c0 + 2, m, -m + c0 + 3); - } else { + } else if (m >= c0 + 2) { S5(c0 - 1, 1, c0, 1, c0, 1, c0 + 1, 1); S1(c0, 1, c0 + 1, 1); S3(c0, 1, c0 + 1, 2, c0 + 1, 1, c0 + 1, 2); S4(c0, 1, c0 + 2, 2, c0 + 1, 1, c0 + 2, 2); S2(c0, 1, c0 + 1, 1, c0 + 1, 1, c0 + 2, 1); + } else { + S5(c0 - 1, -m + c0 + 2, c0, -m + c0 + 2, m - 1, -m + c0 + 2, m, -m + c0 + 2); + S6(c0 - 1, -m + c0 + 1, c0, -m + c0 + 2, m, -m + c0 + 1, m, -m + c0 + 2); + S1(c0, -m + c0 + 2, m, -m + c0 + 2); + S3(c0, -m + c0 + 2, c0 + 1, -m + c0 + 3, m, -m + c0 + 2, m, -m + c0 + 3); } - for (int c2 = max(2, -m + c0 + 3); c2 <= min(c0, m - 1); c2 += 1) { + for (int c2 = max(2, -m + c0 + 3); c2 <= min(m - 1, c0); c2 += 1) { S5(c0 - 1, c2, c0, c2, c0 - c2 + 1, c2, c0 - c2 + 2, c2); S7(c0 - 1, c2 - 1, c0 + 1, c2, c0 - c2 + 2, c2 - 1, c0 - c2 + 3, c2); S6(c0 - 1, c2 - 1, c0, c2, c0 - c2 + 2, c2 - 1, c0 - c2 + 2, c2); @@ -54,7 +54,7 @@ S4(c0, c0 + 1, c0 + 2, c0 + 2, 1, c0 + 1, 2, c0 + 2); S2(c0, c0 + 1, c0 + 1, c0 + 1, 1, c0 + 1, 2, c0 + 1); } - for (int c8 = max(1, -m + c0 + 2); c8 <= min(c0 + 1, m); c8 += 1) + for (int c8 = max(1, -m + c0 + 2); c8 <= min(m, c0 + 1); c8 += 1) S8(c0, c8); } if (m >= 2) { diff --git a/test_inputs/codegen/cloog/classen2.c b/test_inputs/codegen/cloog/classen2.c index 2f2e518e..a737d2d4 100644 --- a/test_inputs/codegen/cloog/classen2.c +++ b/test_inputs/codegen/cloog/classen2.c @@ -1,4 +1,4 @@ -for (int c0 = max(max(max(max(max(max(5 * outerTimeTileScatter, 10 * outerProcTileScatter1 - 2 * N + 2), 5 * outerProcTileScatter1 + 5 * outerProcTileScatter2 - N), 5 * outerProcTileScatter1), 10 * outerProcTileScatter2 - N + 1), 5 * outerProcTileScatter2 + 1), 4); c0 <= min(min(min(min(min(min(2 * M + 2 * N - 6, 5 * outerProcTileScatter2 + M + N), 10 * outerProcTileScatter2 + N + 3), 5 * outerProcTileScatter1 + M + 2), 5 * outerProcTileScatter1 + 5 * outerProcTileScatter2 + 5), 10 * outerProcTileScatter1 + 4), 5 * outerTimeTileScatter + 4); c0 += 1) - for (int c1 = max(max(max(max(-5 * outerProcTileScatter2 + c0 - 1, -M + c0 + 2), (c0 + 1) / 2 + 2), 5 * outerProcTileScatter2 + 1), 5 * outerProcTileScatter1); c1 <= min(min(min(min(5 * outerProcTileScatter1 + 4, 5 * outerProcTileScatter2 + N + 2), N + c0 / 2 - 1), c0), -5 * outerProcTileScatter2 + N + c0); c1 += 1) - for (int c2 = max(max(-N + c1 + 2, c0 - c1 + 3), 5 * outerProcTileScatter2); c2 <= min(min(5 * outerProcTileScatter2 + 4, N + c0 - c1), c1 - 1); c2 += 1) +for (int c0 = max(max(max(max(max(max(4, 5 * outerTimeTileScatter), 5 * outerProcTileScatter1), 5 * outerProcTileScatter2 + 1), 5 * outerProcTileScatter1 + 5 * outerProcTileScatter2 - N), 10 * outerProcTileScatter2 - N + 1), 10 * outerProcTileScatter1 - 2 * N + 2); c0 <= min(min(min(min(min(min(5 * outerTimeTileScatter + 4, 10 * outerProcTileScatter1 + 4), 5 * outerProcTileScatter1 + 5 * outerProcTileScatter2 + 5), 5 * outerProcTileScatter1 + M + 2), 2 * M + 2 * N - 6), 5 * outerProcTileScatter2 + M + N), 10 * outerProcTileScatter2 + N + 3); c0 += 1) + for (int c1 = max(max(max(max(5 * outerProcTileScatter1, 5 * outerProcTileScatter2 + 1), -5 * outerProcTileScatter2 + c0 - 1), -M + c0 + 2), (c0 + 1) / 2 + 2); c1 <= min(min(min(min(5 * outerProcTileScatter1 + 4, 5 * outerProcTileScatter2 + N + 2), -5 * outerProcTileScatter2 + N + c0), c0), N + c0 / 2 - 1); c1 += 1) + for (int c2 = max(max(5 * outerProcTileScatter2, -N + c1 + 2), c0 - c1 + 3); c2 <= min(min(5 * outerProcTileScatter2 + 4, c1 - 1), N + c0 - c1); c2 += 1) S1(c0 - c1 + 1, -c0 + c1 + c2 - 2, c1 - c2, c0, c1, c2); diff --git a/test_inputs/codegen/cloog/constant.c b/test_inputs/codegen/cloog/constant.c index b8281433..f39a3a2b 100644 --- a/test_inputs/codegen/cloog/constant.c +++ b/test_inputs/codegen/cloog/constant.c @@ -3,7 +3,7 @@ S1(c1); S3(c1); } - for (int c1 = max(M + 1025, 0); c1 <= 1023; c1 += 1) { + for (int c1 = max(0, M + 1025); c1 <= 1023; c1 += 1) { S2(c1); S3(c1); } @@ -11,7 +11,7 @@ S4(c0); S6(c0); } - for (int c0 = max(M + 1025, 0); c0 <= 1023; c0 += 1) { + for (int c0 = max(0, M + 1025); c0 <= 1023; c0 += 1) { S5(c0); S6(c0); } diff --git a/test_inputs/codegen/cloog/darte.c b/test_inputs/codegen/cloog/darte.c index 3799f41e..acb63714 100644 --- a/test_inputs/codegen/cloog/darte.c +++ b/test_inputs/codegen/cloog/darte.c @@ -1,12 +1,12 @@ for (int c0 = -n + 1; c0 <= n; c0 += 1) { if (c0 <= 0) for (int c2 = -c0 + 4; c2 <= 2 * n - c0 + 2; c2 += 2) - S1(1, -c0 + 1, (c0 + c2 - 2) / 2); - for (int c1 = max(c0 + 2, -c0 + 4); c1 <= min(2 * n + c0, 2 * n - c0); c1 += 2) { + S1(1, -c0 + 1, ((c0 + c2) / 2) - 1); + for (int c1 = max(c0 + 2, -c0 + 4); c1 <= min(2 * n - c0, 2 * n + c0); c1 += 2) { for (int c2 = c1 + 2; c2 <= 2 * n + c1; c2 += 2) S1((c0 + c1) / 2, (-c0 + c1) / 2, (-c1 + c2) / 2); for (int c2 = 1; c2 <= n; c2 += 1) - S2((c0 + c1 - 2) / 2, (-c0 + c1) / 2, c2); + S2(((c0 + c1) / 2) - 1, (-c0 + c1) / 2, c2); } if (c0 >= 1) for (int c2 = 1; c2 <= n; c2 += 1) diff --git a/test_inputs/codegen/cloog/dealII.c b/test_inputs/codegen/cloog/dealII.c index be4d92f0..0b77d37b 100644 --- a/test_inputs/codegen/cloog/dealII.c +++ b/test_inputs/codegen/cloog/dealII.c @@ -1,5 +1,5 @@ { - for (int c0 = 0; c0 <= min(T_66, T_2 - 1); c0 += 1) { + for (int c0 = 0; c0 <= min(T_2 - 1, T_66); c0 += 1) { S1(c0); S2(c0); } diff --git a/test_inputs/codegen/cloog/dot2.c b/test_inputs/codegen/cloog/dot2.c index 4ab31459..a1b10692 100644 --- a/test_inputs/codegen/cloog/dot2.c +++ b/test_inputs/codegen/cloog/dot2.c @@ -1,5 +1,5 @@ { - for (int c0 = 1; c0 <= min(N, M); c0 += 1) { + for (int c0 = 1; c0 <= min(M, N); c0 += 1) { S1(c0); for (int c1 = 1; c1 <= M; c1 += 1) S2(c0, c1); diff --git a/test_inputs/codegen/cloog/equality2.c b/test_inputs/codegen/cloog/equality2.c index 12d8c037..0a3f8ba8 100644 --- a/test_inputs/codegen/cloog/equality2.c +++ b/test_inputs/codegen/cloog/equality2.c @@ -4,5 +4,5 @@ for (int c0 = 1; c0 <= 10000; c0 += 1) if (c2 + 1999 == 2 * c1 && c1 <= 1008) S2(c0, c1, 2 * c1 - 1999, 1, c0, 2 * c1 - 1000, 1, 2, c0, c1 - 499, 2 * c1 - 1999, c0, 2 * c1 - 1999, c1 - 999, c1 - 999); if (c1 % 2 == 0 && c2 == 1) - S1(c0, c1, 1, 2, c0, (c1 + 2) / 2, c1 - 999, c0, c1 - 999, (c1 - 998) / 2, (c1 - 998) / 2); + S1(c0, c1, 1, 2, c0, (c1 / 2) + 1, c1 - 999, c0, c1 - 999, (c1 / 2) - 499, (c1 / 2) - 499); } diff --git a/test_inputs/codegen/cloog/jacobi-shared.c b/test_inputs/codegen/cloog/jacobi-shared.c index 4a718ea7..74193cdd 100644 --- a/test_inputs/codegen/cloog/jacobi-shared.c +++ b/test_inputs/codegen/cloog/jacobi-shared.c @@ -1,3 +1,3 @@ -if (2 * floord(h0 - 1, 2) + 1 == h0 && g2 + 29 >= (g2 - t1 + 32) % 32 && ((g2 - t1 + 32) % 32) + N >= g2 + 33) - for (int c0 = max(((g1 + t0 + 13) % 16) - g1 + 3, ((t0 + 15) % 16) + 1); c0 <= min(32, N - g1 - 1); c0 += 16) +if ((h0 + 1) % 2 == 0 && g2 + 29 >= (g2 - t1 + 32) % 32 && ((g2 - t1 + 32) % 32) + N >= g2 + 33) + for (int c0 = max(((t0 + 15) % 16) + 1, ((g1 + t0 + 13) % 16) - g1 + 3); c0 <= min(32, N - g1 - 1); c0 += 16) S1(g1 + c0 - 1, ((t1 + 31) % 32) + g2); diff --git a/test_inputs/codegen/cloog/min-1-1.c b/test_inputs/codegen/cloog/min-1-1.c index 0580d1ab..b869e1b8 100644 --- a/test_inputs/codegen/cloog/min-1-1.c +++ b/test_inputs/codegen/cloog/min-1-1.c @@ -1,3 +1,3 @@ for (int c0 = 1; c0 <= N; c0 += 1) - for (int c1 = 0; c1 <= min(min(N - c0, c0), M); c1 += 1) + for (int c1 = 0; c1 <= min(min(M, c0), N - c0); c1 += 1) S1(c0, c1); diff --git a/test_inputs/codegen/cloog/min-2-1.c b/test_inputs/codegen/cloog/min-2-1.c index bf5c9a71..8e6fabf7 100644 --- a/test_inputs/codegen/cloog/min-2-1.c +++ b/test_inputs/codegen/cloog/min-2-1.c @@ -1,4 +1,4 @@ for (int c0 = 1; c0 <= N; c0 += 1) - for (int c1 = 0; c1 <= min(min(N - c0, c0), M); c1 += 1) - for (int c2 = 0; c2 <= min(min(M, N - c0), c0); c2 += 1) + for (int c1 = 0; c1 <= min(min(M, c0), N - c0); c1 += 1) + for (int c2 = 0; c2 <= min(min(M, c0), N - c0); c2 += 1) S1(c0, c1, c2); diff --git a/test_inputs/codegen/cloog/min-3-1.c b/test_inputs/codegen/cloog/min-3-1.c index fbfc7a81..8d11d76d 100644 --- a/test_inputs/codegen/cloog/min-3-1.c +++ b/test_inputs/codegen/cloog/min-3-1.c @@ -1,3 +1,3 @@ -for (int c0 = 0; c0 <= min(M, 10); c0 += 1) - for (int c1 = 0; c1 <= min(M, 10); c1 += 1) +for (int c0 = 0; c0 <= min(10, M); c0 += 1) + for (int c1 = 0; c1 <= min(10, M); c1 += 1) S1(c0, c1); diff --git a/test_inputs/codegen/cloog/min-4-1.c b/test_inputs/codegen/cloog/min-4-1.c index d8be1840..da272fc2 100644 --- a/test_inputs/codegen/cloog/min-4-1.c +++ b/test_inputs/codegen/cloog/min-4-1.c @@ -1,2 +1,2 @@ -for (int c0 = max(-N, -M); c0 <= min(O, N); c0 += 1) +for (int c0 = max(-M, -N); c0 <= min(N, O); c0 += 1) S1(c0); diff --git a/test_inputs/codegen/cloog/mod3.c b/test_inputs/codegen/cloog/mod3.c index 04e6b3ed..f8d879ce 100644 --- a/test_inputs/codegen/cloog/mod3.c +++ b/test_inputs/codegen/cloog/mod3.c @@ -1,4 +1,4 @@ -for (int c0 = max(32 * h0 - 1991, 0); c0 <= min(999, 32 * h0 + 31); c0 += 1) +for (int c0 = max(0, 32 * h0 - 1991); c0 <= min(999, 32 * h0 + 31); c0 += 1) if ((32 * h0 - c0 + 32) % 64 >= 1) for (int c1 = 0; c1 <= 999; c1 += 1) S1(c0, c1); diff --git a/test_inputs/codegen/cloog/mode.c b/test_inputs/codegen/cloog/mode.c index c88622c9..bcfd3183 100644 --- a/test_inputs/codegen/cloog/mode.c +++ b/test_inputs/codegen/cloog/mode.c @@ -1,5 +1,5 @@ for (int c0 = 0; c0 <= M; c0 += 1) { - for (int c1 = 0; c1 <= min(c0, N); c1 += 1) { + for (int c1 = 0; c1 <= min(N, c0); c1 += 1) { S1(c0, c1); S2(c0, c1); } diff --git a/test_inputs/codegen/cloog/mxm-shared.c b/test_inputs/codegen/cloog/mxm-shared.c index f2b7e459..e4528392 100644 --- a/test_inputs/codegen/cloog/mxm-shared.c +++ b/test_inputs/codegen/cloog/mxm-shared.c @@ -1,6 +1,6 @@ if (g4 == 0 && t1 <= 7 && N >= g0 + t1 + 1) { - for (int c0 = t0; c0 <= min(N - g1 - 1, 127); c0 += 16) + for (int c0 = t0; c0 <= min(127, N - g1 - 1); c0 += 16) S1(g0 + t1, g1 + c0); } else if (g4 % 4 == 0 && N >= g0 + t1 + 1 && t1 <= 7 && g4 >= 4) - for (int c0 = t0; c0 <= min(N - g1 - 1, 127); c0 += 16) + for (int c0 = t0; c0 <= min(127, N - g1 - 1); c0 += 16) S1(g0 + t1, g1 + c0); diff --git a/test_inputs/codegen/cloog/nul_complex1.c b/test_inputs/codegen/cloog/nul_complex1.c index ddea3b00..70533516 100644 --- a/test_inputs/codegen/cloog/nul_complex1.c +++ b/test_inputs/codegen/cloog/nul_complex1.c @@ -1,3 +1,3 @@ for (int c0 = 0; c0 <= 5 * n; c0 += 1) - for (int c1 = max(2 * floord(c0 - 1, 3) + 2, -((n + c0 + 1) % 2) - n + c0 + 1); c1 <= min(c0, n + c0 - (n + c0 + 2) / 3); c1 += 2) - S1((-2 * c0 + 3 * c1) / 2, c0 - c1); + for (int c1 = max(-((5 * n - c0 + 1) % 2) - n + c0 + 1, 2 * floord(c0 - 1, 3) + 2); c1 <= min(c0, n + c0 - (n + c0 + 2) / 3); c1 += 2) + S1((3 * c1 / 2) - c0, c0 - c1); diff --git a/test_inputs/codegen/cloog/otl.c b/test_inputs/codegen/cloog/otl.c index 499451ae..79373344 100644 --- a/test_inputs/codegen/cloog/otl.c +++ b/test_inputs/codegen/cloog/otl.c @@ -1,7 +1,7 @@ if (M >= 3 && N >= 4) for (int c0 = 1; c0 < (2 * M + 2 * N - 2) / 5; c0 += 1) - for (int c1 = max(c0 - (M + 2) / 5, (c0 + 1) / 2); c1 <= min(min((2 * N + 5 * c0 + 1) / 10, c0), (M + 2 * N) / 5 - 1); c1 += 1) - for (int c2 = max(max(max(max(c0 - (M + N + 4) / 5 + 1, c1 - (N + 6) / 5 + 1), floord(-N + 5 * c0 - 3, 10) + 1), 0), c0 - c1 - 1); c2 <= min(min(min((M + N - 2) / 5, (N + 5 * c0 + 3) / 10), c0 - c1 + (N - 1) / 5 + 1), c1); c2 += 1) - for (int c3 = max(max(max(2 * c1 - (2 * N + 5) / 5 + 1, 2 * c2 - (N + 2) / 5), c1 + c2 - (N + 3) / 5), c0); c3 <= min(min(min(min(min(c1 + (M - 2) / 5 + 1, 2 * c2 + (N - 2) / 5 + 1), c0 + 1), c1 + c2 + 1), (2 * M + 2 * N - 1) / 5 - 1), c2 + (M + N) / 5); c3 += 1) - for (int c4 = max(max(max(max(c0 - c2, c3 - (M + 2) / 5), c0 - (M + 6) / 5 + 1), (c3 + 1) / 2), c1); c4 <= min(min(min(min(min(min(min((M + 2 * N + 1) / 5 - 1, (2 * N + 5 * c0 + 3) / 10), (2 * N + 5 * c3 + 2) / 10), c0 - c2 + N / 5 + 1), c2 + (N + 2) / 5), -c2 + c3 + (N - 1) / 5 + 1), c0), c1 + 1); c4 += 1) + for (int c1 = max(c0 - (M + 2) / 5, (c0 + 1) / 2); c1 <= min(min(c0, (M + 2 * N) / 5 - 1), (2 * N + 5 * c0 + 1) / 10); c1 += 1) + for (int c2 = max(max(max(max(0, c0 - c1 - 1), c1 - (N + 6) / 5 + 1), c0 - (M + N + 4) / 5 + 1), floord(-N + 5 * c0 - 3, 10) + 1); c2 <= min(min(min(c1, (M + N - 2) / 5), c0 - c1 + (N - 1) / 5 + 1), (N + 5 * c0 + 3) / 10); c2 += 1) + for (int c3 = max(max(max(c0, 2 * c1 - (2 * N + 5) / 5 + 1), c1 + c2 - (N + 3) / 5), 2 * c2 - (N + 2) / 5); c3 <= min(min(min(min(min(c0 + 1, c1 + c2 + 1), c1 + (M - 2) / 5 + 1), 2 * c2 + (N - 2) / 5 + 1), (2 * M + 2 * N - 1) / 5 - 1), c2 + (M + N) / 5); c3 += 1) + for (int c4 = max(max(max(max(c1, c0 - c2), c0 - (M + 6) / 5 + 1), c3 - (M + 2) / 5), (c3 + 1) / 2); c4 <= min(min(min(min(min(min(min(c0, c1 + 1), -c2 + c3 + (N - 1) / 5 + 1), c0 - c2 + N / 5 + 1), (M + 2 * N + 1) / 5 - 1), c2 + (N + 2) / 5), (2 * N + 5 * c0 + 3) / 10), (2 * N + 5 * c3 + 2) / 10); c4 += 1) S1(c0, c1, c2, c3, c4, c2); diff --git a/test_inputs/codegen/cloog/pouchet.c b/test_inputs/codegen/cloog/pouchet.c index 55bb2863..dc844442 100644 --- a/test_inputs/codegen/cloog/pouchet.c +++ b/test_inputs/codegen/cloog/pouchet.c @@ -1,5 +1,5 @@ for (int c0 = 1; c0 <= floord(Ny, 2) + 2; c0 += 1) - for (int c1 = max(c0 / 2 + 1, c0 - 1); c1 <= min(c0, (Ny + 2 * c0) / 4); c1 += 1) + for (int c1 = max(c0 - 1, c0 / 2 + 1); c1 <= min(c0, (Ny + 2 * c0) / 4); c1 += 1) { if (Ny + 2 * c0 >= 4 * c1 + 1) { for (int c2 = 1; c2 <= 2; c2 += 1) { S1(c0 - c1, c1, 2 * c0 - 2 * c1, -2 * c0 + 4 * c1, c2); @@ -7,4 +7,5 @@ for (int c0 = 1; c0 <= floord(Ny, 2) + 2; c0 += 1) } } else for (int c2 = 1; c2 <= 2; c2 += 1) - S2((-Ny + 2 * c0) / 4, (Ny + 2 * c0) / 4, (-Ny + 2 * c0) / 2, Ny - 1, c2); + S2((-Ny + 2 * c0) / 4, (Ny + 2 * c0) / 4, (-Ny / 2) + c0, Ny - 1, c2); + } diff --git a/test_inputs/codegen/cloog/rectangle.c b/test_inputs/codegen/cloog/rectangle.c index a6ea93ab..10d1f76c 100644 --- a/test_inputs/codegen/cloog/rectangle.c +++ b/test_inputs/codegen/cloog/rectangle.c @@ -1,3 +1,3 @@ for (int c0 = 0; c0 <= 2 * n; c0 += 1) - for (int c1 = max(0, -n + c0); c1 <= min(c0, n); c1 += 1) + for (int c1 = max(0, -n + c0); c1 <= min(n, c0); c1 += 1) S1(c1, c0 - c1); diff --git a/test_inputs/codegen/cloog/reservoir-cholesky2.c b/test_inputs/codegen/cloog/reservoir-cholesky2.c index 7ed1450f..4d1a9118 100644 --- a/test_inputs/codegen/cloog/reservoir-cholesky2.c +++ b/test_inputs/codegen/cloog/reservoir-cholesky2.c @@ -1,9 +1,9 @@ for (int c1 = 2; c1 < 3 * M; c1 += 1) { if ((c1 - 2) % 3 == 0) S1((c1 + 1) / 3); - for (int c3 = (c1 + 1) / 3 + 1; c3 <= min(c1 - 2, M); c3 += 1) - for (int c5 = -c3 + (c1 + c3 + 1) / 2 + 1; c5 <= min(c1 - c3, c3); c5 += 1) + for (int c3 = (c1 + 1) / 3 + 1; c3 <= min(M, c1 - 2); c3 += 1) + for (int c5 = -c3 + (c1 + c3 + 1) / 2 + 1; c5 <= min(c3, c1 - c3); c5 += 1) S3(c1 - c3 - c5 + 1, c3, c5); - for (int c3 = -c1 + 2 * ((2 * c1 + 1) / 3) + 2; c3 <= min(c1, M); c3 += 2) - S2((c1 - c3 + 2) / 2, c3); + for (int c3 = -c1 + 2 * ((2 * c1 + 1) / 3) + 2; c3 <= min(M, c1); c3 += 2) + S2(((c1 - c3) / 2) + 1, c3); } diff --git a/test_inputs/codegen/cloog/reservoir-lim-lam1.c b/test_inputs/codegen/cloog/reservoir-lim-lam1.c index 19442d6f..d8a80d66 100644 --- a/test_inputs/codegen/cloog/reservoir-lim-lam1.c +++ b/test_inputs/codegen/cloog/reservoir-lim-lam1.c @@ -1,9 +1,9 @@ for (int c1 = -99; c1 <= 100; c1 += 1) { if (c1 <= 0) S1(1, -c1 + 1); - for (int c3 = max(-2 * c1 + 3, 1); c3 <= min(-2 * c1 + 199, 199); c3 += 2) { - S2((2 * c1 + c3 - 1) / 2, (c3 + 1) / 2); - S1((2 * c1 + c3 + 1) / 2, (c3 + 1) / 2); + for (int c3 = max(1, -2 * c1 + 3); c3 <= min(199, -2 * c1 + 199); c3 += 2) { + S2(((c3 - 1) / 2) + c1, (c3 + 1) / 2); + S1(((c3 + 1) / 2) + c1, (c3 + 1) / 2); } if (c1 >= 1) S2(100, -c1 + 101); diff --git a/test_inputs/codegen/cloog/reservoir-lim-lam3.c b/test_inputs/codegen/cloog/reservoir-lim-lam3.c index 894c2414..c786628d 100644 --- a/test_inputs/codegen/cloog/reservoir-lim-lam3.c +++ b/test_inputs/codegen/cloog/reservoir-lim-lam3.c @@ -1,11 +1,11 @@ for (int c1 = 5; c1 <= 5 * M; c1 += 1) { - for (int c3 = max(2, floord(-M + c1, 4)); c3 < min((c1 + 1) / 3 - 2, M); c3 += 1) - for (int c5 = max(-M - c3 + (M + c1) / 2 - 2, 1); c5 < min(-2 * c3 + (c1 + c3) / 2 - 2, c3); c5 += 1) + for (int c3 = max(2, floord(-M + c1, 4)); c3 < min(M, (c1 + 1) / 3 - 2); c3 += 1) + for (int c5 = max(1, -M - c3 + (M + c1) / 2 - 2); c5 < min(c3, -2 * c3 + (c1 + c3) / 2 - 2); c5 += 1) S1(c1 - 2 * c3 - 2 * c5 - 5, c3, c5); for (int c3 = max(1, floord(-M + c1, 4)); c3 < (c1 + 1) / 5; c3 += 1) S2(c1 - 4 * c3 - 3, c3); if (c1 % 5 == 0) S4(c1 / 5); - for (int c3 = max(-((c1 - 1) % 3) + 3, -3 * M - c1 + 3 * ((M + c1) / 2) + 1); c3 < (c1 + 1) / 5; c3 += 3) + for (int c3 = max(-3 * M - c1 + 3 * ((M + c1) / 2) + 1, -((c1 - 1) % 3) + 3); c3 < (c1 + 1) / 5; c3 += 3) S3((c1 - 2 * c3 - 1) / 3, c3); } diff --git a/test_inputs/codegen/cloog/reservoir-lim-lam4.c b/test_inputs/codegen/cloog/reservoir-lim-lam4.c index 4793f6ae..6a0b0bad 100644 --- a/test_inputs/codegen/cloog/reservoir-lim-lam4.c +++ b/test_inputs/codegen/cloog/reservoir-lim-lam4.c @@ -1,10 +1,10 @@ for (int c1 = 1; c1 < 2 * M - 1; c1 += 1) { - for (int c3 = max(-c1 + 1, -M + 1); c3 < 0; c3 += 1) { - for (int c7 = max(-M + c1 + 1, 1); c7 <= min(M - 1, c1 + c3); c7 += 1) + for (int c3 = max(-M + 1, -c1 + 1); c3 < 0; c3 += 1) { + for (int c7 = max(1, -M + c1 + 1); c7 <= min(M - 1, c1 + c3); c7 += 1) S1(c7, c1 + c3 - c7, -c3); for (int c5 = max(-M + c1 + 1, -c3); c5 < min(M, c1); c5 += 1) S2(c1 - c5, c3 + c5, c5); } - for (int c7 = max(1, -M + c1 + 1); c7 <= min(c1, M - 1); c7 += 1) + for (int c7 = max(1, -M + c1 + 1); c7 <= min(M - 1, c1); c7 += 1) S1(c7, c1 - c7, 0); } diff --git a/test_inputs/codegen/cloog/reservoir-liu-zhuge1.c b/test_inputs/codegen/cloog/reservoir-liu-zhuge1.c index e6b49ea3..c580bbbe 100644 --- a/test_inputs/codegen/cloog/reservoir-liu-zhuge1.c +++ b/test_inputs/codegen/cloog/reservoir-liu-zhuge1.c @@ -2,16 +2,16 @@ if (N >= 0 && M >= 0) for (int c1 = -4; c1 <= 3 * M + N; c1 += 1) { if (c1 >= 3 * M) { S2(M, -3 * M + c1); - } else if (3 * floord(c1 - 2, 3) + 2 == c1 && c1 >= -1 && 3 * M >= c1 + 4) + } else if ((c1 + 4) % 3 == 0 && 3 * M >= c1 + 4) S1((c1 + 4) / 3, 0); - for (int c3 = max(-3 * M + c1 + 3, c1 + 3 * floord(-c1 - 1, 3) + 3); c3 <= min(N - 1, c1); c3 += 3) { + for (int c3 = max(-3 * M + c1 + 3, (c1 + 6) % 3); c3 <= min(N - 1, c1); c3 += 3) { S2((c1 - c3) / 3, c3); - S1((c1 - c3 + 3) / 3, c3 + 1); + S1(((c1 - c3) / 3) + 1, c3 + 1); } if (N + 3 * floord(-N + c1, 3) == c1 && 3 * M + N >= c1 + 3 && c1 >= N) { S2((-N + c1) / 3, N); - } else if (N >= c1 + 4) + } else if (N >= c1 + 4 && c1 >= -3) S1(0, c1 + 4); - for (int c3 = max(-3 * M + c1, c1 + 3 * floord(-c1 - 1, 3) + 3); c3 <= min(N, c1); c3 += 3) + for (int c3 = max(-3 * M + c1, (c1 + 6) % 3); c3 <= min(N, c1); c3 += 3) S3((c1 - c3) / 3, c3); } diff --git a/test_inputs/codegen/cloog/reservoir-loechner3.c b/test_inputs/codegen/cloog/reservoir-loechner3.c index 849724b4..d37df98b 100644 --- a/test_inputs/codegen/cloog/reservoir-loechner3.c +++ b/test_inputs/codegen/cloog/reservoir-loechner3.c @@ -1,4 +1,4 @@ for (int c1 = 1; c1 <= M; c1 += 1) for (int c3 = 2; c3 <= M + c1; c3 += 1) - for (int c5 = max(-c1 + c3, 1); c5 <= min(M, c3 - 1); c5 += 1) + for (int c5 = max(1, -c1 + c3); c5 <= min(M, c3 - 1); c5 += 1) S1(c1, c5, c3 - c5); diff --git a/test_inputs/codegen/cloog/reservoir-loechner4.c b/test_inputs/codegen/cloog/reservoir-loechner4.c index bf48290b..7a67212b 100644 --- a/test_inputs/codegen/cloog/reservoir-loechner4.c +++ b/test_inputs/codegen/cloog/reservoir-loechner4.c @@ -1,5 +1,5 @@ for (int c1 = 2; c1 <= 2 * M; c1 += 1) for (int c3 = 1; c3 <= M; c3 += 1) for (int c5 = 1; c5 <= M; c5 += 1) - for (int c7 = max(1, -M + c1); c7 <= min(c1 - 1, M); c7 += 1) + for (int c7 = max(1, -M + c1); c7 <= min(M, c1 - 1); c7 += 1) S1(c5, c3, c7, c1 - c7); diff --git a/test_inputs/codegen/cloog/reservoir-tang-xue1.c b/test_inputs/codegen/cloog/reservoir-tang-xue1.c index 03d2dde8..8874eabf 100644 --- a/test_inputs/codegen/cloog/reservoir-tang-xue1.c +++ b/test_inputs/codegen/cloog/reservoir-tang-xue1.c @@ -1,5 +1,5 @@ for (int c1 = 0; c1 <= 9; c1 += 2) for (int c3 = 0; c3 <= min(4, c1 + 3); c3 += 2) - for (int c5 = max(c1, 1); c5 <= min(c1 + 1, c1 - c3 + 4); c5 += 1) - for (int c7 = max(-c1 + c3 + c5, 1); c7 <= min(4, -c1 + c3 + c5 + 1); c7 += 1) + for (int c5 = max(1, c1); c5 <= min(c1 + 1, c1 - c3 + 4); c5 += 1) + for (int c7 = max(1, -c1 + c3 + c5); c7 <= min(4, -c1 + c3 + c5 + 1); c7 += 1) S1(c1 / 2, (-c1 + c3) / 2, -c1 + c5, -c3 + c7); diff --git a/test_inputs/codegen/cloog/stride3.c b/test_inputs/codegen/cloog/stride3.c index 23d921f1..d145938b 100644 --- a/test_inputs/codegen/cloog/stride3.c +++ b/test_inputs/codegen/cloog/stride3.c @@ -1,2 +1,2 @@ -for (int c0 = max(m, 1); c0 <= n; c0 += 1) +for (int c0 = max(1, m); c0 <= n; c0 += 1) S1(c0); diff --git a/test_inputs/codegen/cloog/thomasset.c b/test_inputs/codegen/cloog/thomasset.c index 387b3e59..8d6709e7 100644 --- a/test_inputs/codegen/cloog/thomasset.c +++ b/test_inputs/codegen/cloog/thomasset.c @@ -1,6 +1,6 @@ { for (int c0 = 0; c0 <= floord(n - 1, 3); c0 += 1) - for (int c2 = 3 * c0 + 1; c2 <= min(3 * c0 + 3, n); c2 += 1) + for (int c2 = 3 * c0 + 1; c2 <= min(n, 3 * c0 + 3); c2 += 1) S1(c2, c0); for (int c0 = floord(n, 3); c0 <= 2 * floord(n, 3); c0 += 1) for (int c1 = 0; c1 < n; c1 += 1) diff --git a/test_inputs/codegen/cloog/tiling.c b/test_inputs/codegen/cloog/tiling.c index 8cbaf8c4..971b988a 100644 --- a/test_inputs/codegen/cloog/tiling.c +++ b/test_inputs/codegen/cloog/tiling.c @@ -1,3 +1,3 @@ for (int c0 = 0; c0 <= n / 10; c0 += 1) - for (int c1 = 10 * c0; c1 <= min(10 * c0 + 9, n); c1 += 1) + for (int c1 = 10 * c0; c1 <= min(n, 10 * c0 + 9); c1 += 1) S1(c0, c1); diff --git a/test_inputs/codegen/cloog/vasilache.c b/test_inputs/codegen/cloog/vasilache.c index 567e41f4..c6d32ca6 100644 --- a/test_inputs/codegen/cloog/vasilache.c +++ b/test_inputs/codegen/cloog/vasilache.c @@ -14,10 +14,10 @@ S6(c1, c3, c5, c7 - 1); S7(c1, c3, c5, c7); } - if (N >= 32 * c5 + 33) { - S6(c1, c3, c5, 32 * c5 + 31); - } else + if (32 * c5 + 31 >= N) { S6(c1, c3, c5, N - 1); + } else + S6(c1, c3, c5, 32 * c5 + 31); } S8(); } diff --git a/test_inputs/codegen/cloog/vivien.c b/test_inputs/codegen/cloog/vivien.c index 77255586..4d7b7858 100644 --- a/test_inputs/codegen/cloog/vivien.c +++ b/test_inputs/codegen/cloog/vivien.c @@ -1,18 +1,18 @@ { for (int c0 = -27 * n + 2; c0 <= 1; c0 += 1) S1(c0 - 1); - for (int c0 = 2; c0 <= min(n + 29, 2 * n); c0 += 1) { + for (int c0 = 2; c0 <= min(2 * n, n + 29); c0 += 1) { if (2 * n >= c0 + 1 && c0 >= 3) S4(c0 - c0 / 2 - 1, c0 / 2 + 1); - if (2 * n >= c0 + 1 && c0 + 2 >= 2 * n) { + if (c0 + 2 >= 2 * n && 2 * n >= c0 + 1) { for (int c2 = 1; c2 < -n + c0; c2 += 1) S5(-n + c0, n, c2); } else if (2 * n >= c0 + 3 && c0 >= 5) { S4(c0 - c0 / 2 - 2, c0 / 2 + 2); - for (int c2 = 1; c2 < (c0 + 1) / 2 - 1; c2 += 1) + for (int c2 = 1; c2 < c0 - c0 / 2 - 1; c2 += 1) S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } - for (int c1 = -c0 + c0 / 2 + 3; c1 <= min(n - c0, -1); c1 += 1) { + for (int c1 = -c0 + c0 / 2 + 3; c1 <= min(-1, n - c0); c1 += 1) { S4(-c1, c0 + c1); S6(-c1 + 2, c0 + c1 - 2); for (int c2 = 1; c2 <= -c1; c2 += 1) @@ -31,24 +31,26 @@ S1(c0 - 1); } else if (c0 <= 4 && c0 >= 3 && n + 1 >= c0) S1(c0 - 1); - if (n + 1 >= c0 && c0 >= 3) + if (n + 1 >= c0 && c0 >= 3) { S6(1, c0 - 1); + } else if (c0 == n + 2 && n >= 3) { + S6(2, n); + S1(n + 1); + } } - if (c0 >= n + 3) { + if (c0 >= n + 3) S1(c0 - 1); - } else if (c0 == n + 2 && n >= 3) { - S6(2, n); - S1(n + 1); - } if (c0 == 2) { S1(1); } else if (c0 == 4 && n == 2) S1(3); if (c0 % 2 == 0) S3(c0 / 2); - for (int c1 = max(-n + c0, 1); c1 < (c0 + 1) / 2; c1 += 1) + for (int c1 = max(1, -n + c0); c1 < (c0 + 1) / 2; c1 += 1) S2(c0 - c1, c1); } + for (int c0 = max(2 * n + 1, -27 * n + 2); c0 <= n + 29; c0 += 1) + S1(c0 - 1); for (int c0 = n + 30; c0 <= 2 * n; c0 += 1) { if (2 * n >= c0 + 1) { S4(c0 - c0 / 2 - 1, c0 / 2 + 1); @@ -57,7 +59,7 @@ S5(-n + c0, n, c2); } else { S4(c0 - c0 / 2 - 2, c0 / 2 + 2); - for (int c2 = 1; c2 < (c0 + 1) / 2 - 1; c2 += 1) + for (int c2 = 1; c2 < c0 - c0 / 2 - 1; c2 += 1) S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } for (int c1 = -c0 + c0 / 2 + 3; c1 <= n - c0; c1 += 1) { @@ -78,6 +80,4 @@ for (int c1 = -n + c0; c1 < (c0 + 1) / 2; c1 += 1) S2(c0 - c1, c1); } - for (int c0 = max(2 * n + 1, -27 * n + 2); c0 <= n + 29; c0 += 1) - S1(c0 - 1); } diff --git a/test_inputs/codegen/cloog/vivien2.c b/test_inputs/codegen/cloog/vivien2.c index 440f54f8..28ca721a 100644 --- a/test_inputs/codegen/cloog/vivien2.c +++ b/test_inputs/codegen/cloog/vivien2.c @@ -9,11 +9,11 @@ S5(-n + c0, n, c2); } else if (c0 >= 5) { S4(c0 - c0 / 2 - 2, c0 / 2 + 2); - for (int c2 = 1; c2 < (c0 + 1) / 2 - 1; c2 += 1) + for (int c2 = 1; c2 < c0 - c0 / 2 - 1; c2 += 1) S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } } - for (int c1 = -c0 + c0 / 2 + 3; c1 <= min(n - c0, -1); c1 += 1) { + for (int c1 = -c0 + c0 / 2 + 3; c1 <= min(-1, n - c0); c1 += 1) { S4(-c1, c0 + c1); S6(-c1 + 2, c0 + c1 - 2); for (int c2 = 1; c2 <= -c1; c2 += 1) @@ -33,9 +33,9 @@ S1(c0 - 1); } else if (c0 <= 4 && c0 >= 3) S1(c0 - 1); - if (c0 >= 3 && n + 1 >= c0) + if (c0 >= 3 && n + 1 >= c0) { S6(1, c0 - 1); - if (c0 == n + 2) { + } else if (c0 == n + 2) { S6(2, n); S1(n + 1); } @@ -44,7 +44,7 @@ S1(1); if (c0 % 2 == 0) S3(c0 / 2); - for (int c1 = max(-n + c0, 1); c1 < (c0 + 1) / 2; c1 += 1) + for (int c1 = max(1, -n + c0); c1 < (c0 + 1) / 2; c1 += 1) S2(c0 - c1, c1); } for (int c0 = n + 30; c0 <= 2 * n; c0 += 1) { @@ -55,7 +55,7 @@ S5(-n + c0, n, c2); } else { S4(c0 - c0 / 2 - 2, c0 / 2 + 2); - for (int c2 = 1; c2 < (c0 + 1) / 2 - 1; c2 += 1) + for (int c2 = 1; c2 < c0 - c0 / 2 - 1; c2 += 1) S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } for (int c1 = -c0 + c0 / 2 + 3; c1 <= n - c0; c1 += 1) { diff --git a/test_inputs/codegen/cloog/wavefront.c b/test_inputs/codegen/cloog/wavefront.c index cfb4e11f..7db0788f 100644 --- a/test_inputs/codegen/cloog/wavefront.c +++ b/test_inputs/codegen/cloog/wavefront.c @@ -1,3 +1,3 @@ for (int c0 = 2; c0 <= n + m; c0 += 1) - for (int c1 = max(-m + c0, 1); c1 <= min(n, c0 - 1); c1 += 1) + for (int c1 = max(1, -m + c0); c1 <= min(n, c0 - 1); c1 += 1) S1(c1, c0 - c1); diff --git a/test_inputs/codegen/dwt.c b/test_inputs/codegen/dwt.c index daec6f79..52adb5d6 100644 --- a/test_inputs/codegen/dwt.c +++ b/test_inputs/codegen/dwt.c @@ -1,7 +1,8 @@ -for (int c0 = 0; c0 < Ncl; c0 += 1) +for (int c0 = 0; c0 < Ncl; c0 += 1) { if (Ncl >= c0 + 2 && c0 >= 1) { S(c0, 28); } else if (c0 == 0) { S(0, 26); } else S(Ncl - 1, 27); +} diff --git a/test_inputs/codegen/hoist2.c b/test_inputs/codegen/hoist2.c index 4d43f4cb..55998c2b 100644 --- a/test_inputs/codegen/hoist2.c +++ b/test_inputs/codegen/hoist2.c @@ -1,3 +1,3 @@ for (int c0 = 1; c0 <= 5; c0 += 1) - for (int c1 = max(t1, t1 - 64 * b + 64); c1 <= min(70, -((c0 + 1) % 2) - c0 + 73); c1 += 64) + for (int c1 = max(t1, t1 - 64 * b + 64); c1 <= min(70, -((c0 - 1) % 2) - c0 + 73); c1 += 64) A(c0, 64 * b + c1 - 8); diff --git a/test_inputs/codegen/omega/basics-1.c b/test_inputs/codegen/omega/basics-1.c index 21a6f8ef..d3d69704 100644 --- a/test_inputs/codegen/omega/basics-1.c +++ b/test_inputs/codegen/omega/basics-1.c @@ -1,3 +1,3 @@ for (int c0 = -9; c0 <= 9; c0 += 1) - for (int c1 = max(-c0 + 1, 1); c1 <= min(-c0 + 10, 10); c1 += 1) + for (int c1 = max(1, -c0 + 1); c1 <= min(10, -c0 + 10); c1 += 1) s0(c0, c1); diff --git a/test_inputs/codegen/omega/code_gen-1.c b/test_inputs/codegen/omega/code_gen-1.c index edac4961..9a676fdd 100644 --- a/test_inputs/codegen/omega/code_gen-1.c +++ b/test_inputs/codegen/omega/code_gen-1.c @@ -7,7 +7,7 @@ for (int c0 = 1; c0 <= 8; c0 += 1) { s1(c0, c1); s0(c0, c1); } - for (int c1 = max(c0 - 1, 5); c1 <= 7; c1 += 1) + for (int c1 = max(5, c0 - 1); c1 <= 7; c1 += 1) s0(c0, c1); } if (c0 == 1) diff --git a/test_inputs/codegen/omega/dagstuhl1-1.c b/test_inputs/codegen/omega/dagstuhl1-1.c index 491fada1..a3e4458f 100644 --- a/test_inputs/codegen/omega/dagstuhl1-1.c +++ b/test_inputs/codegen/omega/dagstuhl1-1.c @@ -1,2 +1,2 @@ for (int c0 = 0; c0 <= 99; c0 += 1) - s0(c0, (c0 + 10) % 10, (c0 + 10) / 10 - 1); + s0(c0, c0 % 10, (c0 + 10) / 10 - 1); diff --git a/test_inputs/codegen/omega/hpf-0.c b/test_inputs/codegen/omega/hpf-0.c index be015bc6..6b38972f 100644 --- a/test_inputs/codegen/omega/hpf-0.c +++ b/test_inputs/codegen/omega/hpf-0.c @@ -1,4 +1,4 @@ if (P1 == P2 && P2 >= 0 && P2 <= 3) - for (int c0 = 0; c0 <= min(-P2 + 4, 2); c0 += 1) - for (int c2 = -P2 - c0 + 3 * floord(P2 + c0 - 1, 3) + 3; c2 <= 3; c2 += 3) + for (int c0 = 0; c0 <= min(2, -P2 + 4); c0 += 1) + for (int c2 = (-P2 - c0 + 6) % 3; c2 <= 3; c2 += 3) s0(c0, c0, c2, c2); diff --git a/test_inputs/codegen/omega/if_then-2.c b/test_inputs/codegen/omega/if_then-2.c index b372c862..d1ce579a 100644 --- a/test_inputs/codegen/omega/if_then-2.c +++ b/test_inputs/codegen/omega/if_then-2.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= 100; c0 += 1) +for (int c0 = 1; c0 <= 100; c0 += 1) { if (n >= 2) { s0(c0); for (int c1 = 1; c1 <= 100; c1 += 1) { @@ -8,3 +8,4 @@ for (int c0 = 1; c0 <= 100; c0 += 1) } else for (int c1 = 1; c1 <= 100; c1 += 1) s2(c0, c1); +} diff --git a/test_inputs/codegen/omega/iter8-0.c b/test_inputs/codegen/omega/iter8-0.c index 505dd79a..a33fc49b 100644 --- a/test_inputs/codegen/omega/iter8-0.c +++ b/test_inputs/codegen/omega/iter8-0.c @@ -1,2 +1,2 @@ -for (int c0 = max(exprVar2 + 8 * floord(-exprVar2 + exprVar1 - 1, 8) + 9, exprVar2 + 1); c0 <= 16; c0 += 8) +for (int c0 = max(exprVar2 + 1, exprVar2 + 8 * floord(-exprVar2 + exprVar1 - 1, 8) + 9); c0 <= 16; c0 += 8) s0(c0); diff --git a/test_inputs/codegen/omega/iter9-0.c b/test_inputs/codegen/omega/iter9-0.c index 2336f810..e8b95bd0 100644 --- a/test_inputs/codegen/omega/iter9-0.c +++ b/test_inputs/codegen/omega/iter9-0.c @@ -1,11 +1,11 @@ for (int c0 = 1; c0 <= 15; c0 += 1) { - if (8 * floord(7 * exprVar1 + 7, 8) + 8 >= 7 * exprVar1 + c0) { + if (((-exprVar1 + 15) % 8) + c0 <= 15) { s4(c0); s0(c0); s3(c0); s2(c0); s1(c0); } - if (8 * floord(7 * exprVar1 + 7, 8) + 8 >= 7 * exprVar1 + c0 || (exprVar1 + 8 * floord(-exprVar1 + c0 - 1, 8) + 1 == c0 && c0 >= exprVar1 + 1)) + if (((-exprVar1 + 15) % 8) + c0 <= 15 || (exprVar1 + 8 * floord(-exprVar1 + c0 - 1, 8) + 1 == c0 && c0 >= exprVar1 + 1)) s5(c0); } diff --git a/test_inputs/codegen/omega/lefur00-0.c b/test_inputs/codegen/omega/lefur00-0.c index 18bd3033..aab26208 100644 --- a/test_inputs/codegen/omega/lefur00-0.c +++ b/test_inputs/codegen/omega/lefur00-0.c @@ -1,5 +1,5 @@ for (int c0 = 0; c0 <= 15; c0 += 1) - for (int c1 = max(2 * c0 - 15, c0 / 2); c1 <= min(c0 + 1, 15); c1 += 1) - for (int c2 = max(max(max(67 * c0 - (c0 + 1) / 3, 1), 67 * c1 - (c1 + 2) / 3), 133 * c0 - 67 * c1 + (c0 + c1 + 1) / 3 - 66); c2 <= min(min(100 * c0 + 99, 1000), 133 * c0 - 67 * c1 + floord(c0 + c1 - 1, 3) + 133); c2 += 1) - for (int c3 = max(max(100 * c1 + (c2 + 1) / 2, 200 * c0 - c2), c2); c3 <= min(min(200 * c0 - c2 + 199, 100 * c1 + (c2 + 1) / 2 + 99), 2 * c2 + 1); c3 += 1) + for (int c1 = max(2 * c0 - 15, c0 / 2); c1 <= min(15, c0 + 1); c1 += 1) + for (int c2 = max(max(max(1, 67 * c0 - (c0 + 1) / 3), 67 * c1 - (c1 + 2) / 3), 133 * c0 - 67 * c1 + (c0 + c1 + 1) / 3 - 66); c2 <= min(min(1000, 100 * c0 + 99), 133 * c0 - 67 * c1 + floord(c0 + c1 - 1, 3) + 133); c2 += 1) + for (int c3 = max(max(c2, 200 * c0 - c2), 100 * c1 + (c2 + 1) / 2); c3 <= min(min(2 * c2 + 1, 200 * c0 - c2 + 199), 100 * c1 + (c2 + 1) / 2 + 99); c3 += 1) s0(c0, c1, c2, c3); diff --git a/test_inputs/codegen/omega/lefur01-0.c b/test_inputs/codegen/omega/lefur01-0.c index 18bd3033..aab26208 100644 --- a/test_inputs/codegen/omega/lefur01-0.c +++ b/test_inputs/codegen/omega/lefur01-0.c @@ -1,5 +1,5 @@ for (int c0 = 0; c0 <= 15; c0 += 1) - for (int c1 = max(2 * c0 - 15, c0 / 2); c1 <= min(c0 + 1, 15); c1 += 1) - for (int c2 = max(max(max(67 * c0 - (c0 + 1) / 3, 1), 67 * c1 - (c1 + 2) / 3), 133 * c0 - 67 * c1 + (c0 + c1 + 1) / 3 - 66); c2 <= min(min(100 * c0 + 99, 1000), 133 * c0 - 67 * c1 + floord(c0 + c1 - 1, 3) + 133); c2 += 1) - for (int c3 = max(max(100 * c1 + (c2 + 1) / 2, 200 * c0 - c2), c2); c3 <= min(min(200 * c0 - c2 + 199, 100 * c1 + (c2 + 1) / 2 + 99), 2 * c2 + 1); c3 += 1) + for (int c1 = max(2 * c0 - 15, c0 / 2); c1 <= min(15, c0 + 1); c1 += 1) + for (int c2 = max(max(max(1, 67 * c0 - (c0 + 1) / 3), 67 * c1 - (c1 + 2) / 3), 133 * c0 - 67 * c1 + (c0 + c1 + 1) / 3 - 66); c2 <= min(min(1000, 100 * c0 + 99), 133 * c0 - 67 * c1 + floord(c0 + c1 - 1, 3) + 133); c2 += 1) + for (int c3 = max(max(c2, 200 * c0 - c2), 100 * c1 + (c2 + 1) / 2); c3 <= min(min(2 * c2 + 1, 200 * c0 - c2 + 199), 100 * c1 + (c2 + 1) / 2 + 99); c3 += 1) s0(c0, c1, c2, c3); diff --git a/test_inputs/codegen/omega/lefur01-1.c b/test_inputs/codegen/omega/lefur01-1.c index 175f17f8..aab26208 100644 --- a/test_inputs/codegen/omega/lefur01-1.c +++ b/test_inputs/codegen/omega/lefur01-1.c @@ -1,5 +1,5 @@ for (int c0 = 0; c0 <= 15; c0 += 1) - for (int c1 = max(2 * c0 - 15, c0 / 2); c1 <= min(c0 + 1, 15); c1 += 1) - for (int c2 = max(max(max(1, 67 * c1 - (c1 + 2) / 3), 67 * c0 - (c0 + 1) / 3), 133 * c0 - 67 * c1 + (c0 + c1 + 1) / 3 - 66); c2 <= min(min(100 * c0 + 99, 1000), 133 * c0 - 67 * c1 + floord(c0 + c1 - 1, 3) + 133); c2 += 1) - for (int c3 = max(max(100 * c1 + (c2 + 1) / 2, 200 * c0 - c2), c2); c3 <= min(min(200 * c0 - c2 + 199, 100 * c1 + (c2 + 1) / 2 + 99), 2 * c2 + 1); c3 += 1) + for (int c1 = max(2 * c0 - 15, c0 / 2); c1 <= min(15, c0 + 1); c1 += 1) + for (int c2 = max(max(max(1, 67 * c0 - (c0 + 1) / 3), 67 * c1 - (c1 + 2) / 3), 133 * c0 - 67 * c1 + (c0 + c1 + 1) / 3 - 66); c2 <= min(min(1000, 100 * c0 + 99), 133 * c0 - 67 * c1 + floord(c0 + c1 - 1, 3) + 133); c2 += 1) + for (int c3 = max(max(c2, 200 * c0 - c2), 100 * c1 + (c2 + 1) / 2); c3 <= min(min(2 * c2 + 1, 200 * c0 - c2 + 199), 100 * c1 + (c2 + 1) / 2 + 99); c3 += 1) s0(c0, c1, c2, c3); diff --git a/test_inputs/codegen/omega/lefur03-0.c b/test_inputs/codegen/omega/lefur03-0.c index 94fc83d0..92a6cc5a 100644 --- a/test_inputs/codegen/omega/lefur03-0.c +++ b/test_inputs/codegen/omega/lefur03-0.c @@ -1,7 +1,7 @@ for (int c0 = 0; c0 <= 3; c0 += 1) - for (int c1 = max(2 * c0 - 3, 0); c1 <= min(3, c0 + c0 / 2 + 1); c1 += 1) - for (int c2 = c0; c2 <= min(min(2 * c0 - c1 + 1, 3 * c1 + 2), 3); c2 += 1) - for (int c3 = max(max(max(c2 + floord(3 * c1 - c2 - 1, 6), c1 - (-c1 + 3) / 3), c0 - (-c0 + 3) / 3), 0); c3 <= min(c0 + 1, 3); c3 += 1) - for (int c4 = max(max(max(max(250 * c3 + 1, 333 * c2 + (c2 + 1) / 3), 333 * c1 + c1 / 3), -200 * c1 + 400 * c3 - 199), 667 * c0 - 333 * c1 - (c0 + c1 + 3) / 3 - 332); c4 <= min(min(min(min(1000, -200 * c1 + 400 * c3 + 400), 500 * c0 + 499), 333 * c2 - (-c2 + 3) / 3 + 333), 333 * c3 - (-c3 + 3) / 3 + 334); c4 += 1) - for (int c5 = max(max(max(c4, 1000 * c3 - 2 * c4 + 2), 500 * c1 + (c4 + 1) / 2), 1000 * c0 - c4); c5 <= min(min(min(1000 * c0 - c4 + 999, 500 * c1 + (c4 + 1) / 2 + 499), 1000 * c3 - 2 * c4 + 1001), 2 * c4 + 1); c5 += 1) + for (int c1 = max(0, 2 * c0 - 3); c1 <= min(3, c0 + c0 / 2 + 1); c1 += 1) + for (int c2 = c0; c2 <= min(min(3, 2 * c0 - c1 + 1), 3 * c1 + 2); c2 += 1) + for (int c3 = max(max(max(0, c0 - (-c0 + 3) / 3), c1 - (-c1 + 3) / 3), c2 + floord(3 * c1 - c2 - 1, 6)); c3 <= min(3, c0 + 1); c3 += 1) + for (int c4 = max(max(max(max(-200 * c1 + 400 * c3 - 199, 250 * c3 + 1), 667 * c0 - 333 * c1 - (c0 + c1 + 3) / 3 - 332), 333 * c1 + c1 / 3), 333 * c2 + (c2 + 1) / 3); c4 <= min(min(min(min(1000, 500 * c0 + 499), -200 * c1 + 400 * c3 + 400), 333 * c2 - (-c2 + 3) / 3 + 333), 333 * c3 - (-c3 + 3) / 3 + 334); c4 += 1) + for (int c5 = max(max(max(c4, 1000 * c0 - c4), 1000 * c3 - 2 * c4 + 2), 500 * c1 + (c4 + 1) / 2); c5 <= min(min(min(2 * c4 + 1, 1000 * c0 - c4 + 999), 1000 * c3 - 2 * c4 + 1001), 500 * c1 + (c4 + 1) / 2 + 499); c5 += 1) s0(c0, c1, c2, c3, c4, c5); diff --git a/test_inputs/codegen/omega/lefur04-0.c b/test_inputs/codegen/omega/lefur04-0.c index 6c348e7b..de299fb1 100644 --- a/test_inputs/codegen/omega/lefur04-0.c +++ b/test_inputs/codegen/omega/lefur04-0.c @@ -1,8 +1,8 @@ for (int c0 = 0; c0 <= 3; c0 += 1) - for (int c1 = max(2 * c0 - 3, c0 / 2); c1 <= min(c0 + 1, 3); c1 += 1) + for (int c1 = max(2 * c0 - 3, c0 / 2); c1 <= min(3, c0 + 1); c1 += 1) for (int c2 = c0; c2 <= min(min(3, 2 * c0 - c1 + 1), 3 * c1 + 2); c2 += 1) - for (int c3 = max(max(max(c2 - (c2 + 2) / 3, c2 + floord(3 * c1 - c2 - 1, 6)), c1 - (-c1 + 3) / 3), c0 - (-c2 + 3) / 3); c3 <= min(c0 + c0 / 2 + 1, 3); c3 += 1) - for (int c5 = max(max(max(max(c1 - (c1 - 2 * c3 + 5) / 5, 0), c3 - (c3 + 3) / 3), 2 * c3 - 4), c2 - (c2 + 3) / 3); c5 <= min(min(c1 + 1, c3), -c2 + 2 * c3 - (c2 + 3) / 3 + 2); c5 += 1) - for (int c6 = max(max(max(max(max(1000 * c0 - 500 * c5 - 501, -200 * c1 + 400 * c3 - 199), 333 * c1 + c1 / 3), 250 * c3 + 1), 667 * c0 - 333 * c1 - (c0 + c1 + 3) / 3 - 332), 333 * c2 + (c2 + 1) / 3); c6 <= min(min(min(min(min(min(-200 * c1 + 400 * c3 + 400, 500 * c0 + 499), 333 * c2 - (-c2 + 3) / 3 + 333), 333 * c3 - (-c3 + 3) / 3 + 334), 500 * c5 + 501), 1000), 1000 * c0 - 500 * c5 + 997); c6 += 1) - for (int c7 = max(max(max(max(c6, 500 * c5 + 2), 1000 * c3 - 2 * c6 + 2), 500 * c1 + (c6 + 1) / 2), 1000 * c0 - c6); c7 <= min(min(min(min(500 * c5 + 501, 2 * c6 + 1), 1000 * c0 - c6 + 999), 500 * c1 + (c6 + 1) / 2 + 499), 1000 * c3 - 2 * c6 + 1001); c7 += 1) + for (int c3 = max(max(max(c1 - (-c1 + 3) / 3, c0 - (-c2 + 3) / 3), c2 - (c2 + 2) / 3), c2 + floord(3 * c1 - c2 - 1, 6)); c3 <= min(3, c0 + c0 / 2 + 1); c3 += 1) + for (int c5 = max(max(max(max(0, 2 * c3 - 4), c2 - (c2 + 3) / 3), c3 - (c3 + 3) / 3), c1 - (c1 - 2 * c3 + 5) / 5); c5 <= min(min(c1 + 1, c3), -c2 + 2 * c3 - (c2 + 3) / 3 + 2); c5 += 1) + for (int c6 = max(max(max(max(max(-200 * c1 + 400 * c3 - 199, 250 * c3 + 1), 1000 * c0 - 500 * c5 - 501), 667 * c0 - 333 * c1 - (c0 + c1 + 3) / 3 - 332), 333 * c1 + c1 / 3), 333 * c2 + (c2 + 1) / 3); c6 <= min(min(min(min(min(min(1000, 500 * c0 + 499), -200 * c1 + 400 * c3 + 400), 500 * c5 + 501), 1000 * c0 - 500 * c5 + 997), 333 * c2 - (-c2 + 3) / 3 + 333), 333 * c3 - (-c3 + 3) / 3 + 334); c6 += 1) + for (int c7 = max(max(max(max(500 * c5 + 2, c6), 1000 * c0 - c6), 1000 * c3 - 2 * c6 + 2), 500 * c1 + (c6 + 1) / 2); c7 <= min(min(min(min(500 * c5 + 501, 2 * c6 + 1), 1000 * c0 - c6 + 999), 1000 * c3 - 2 * c6 + 1001), 500 * c1 + (c6 + 1) / 2 + 499); c7 += 1) s0(c0, c1, c2, c3, c2 / 3, c5, c6, c7); diff --git a/test_inputs/codegen/omega/lift1-1.c b/test_inputs/codegen/omega/lift1-1.c index a32e25fa..3910e4f2 100644 --- a/test_inputs/codegen/omega/lift1-1.c +++ b/test_inputs/codegen/omega/lift1-1.c @@ -1,7 +1,7 @@ for (int c0 = 1; c0 <= 100; c0 += 1) for (int c1 = 1; c1 <= 100; c1 += 1) for (int c2 = 1; c2 <= 100; c2 += 1) - for (int c3 = 1; c3 <= 100; c3 += 1) + for (int c3 = 1; c3 <= 100; c3 += 1) { if (c0 >= 61) { for (int c4 = 1; c4 <= 100; c4 += 1) s1(c0, c1, c2, c3, c4); @@ -10,3 +10,4 @@ for (int c0 = 1; c0 <= 100; c0 += 1) s1(c0, c1, c2, c3, c4); s0(c0, c1, c2, c3, c4); } + } diff --git a/test_inputs/codegen/omega/lift1-2.c b/test_inputs/codegen/omega/lift1-2.c index aae7bfca..8737f3c5 100644 --- a/test_inputs/codegen/omega/lift1-2.c +++ b/test_inputs/codegen/omega/lift1-2.c @@ -1,6 +1,6 @@ for (int c0 = 1; c0 <= 100; c0 += 1) for (int c1 = 1; c1 <= 100; c1 += 1) - for (int c2 = 1; c2 <= 100; c2 += 1) + for (int c2 = 1; c2 <= 100; c2 += 1) { if (c0 >= 61) { for (int c3 = 1; c3 <= 100; c3 += 1) for (int c4 = 1; c4 <= 100; c4 += 1) @@ -11,3 +11,4 @@ for (int c0 = 1; c0 <= 100; c0 += 1) s1(c0, c1, c2, c3, c4); s0(c0, c1, c2, c3, c4); } + } diff --git a/test_inputs/codegen/omega/lift1-3.c b/test_inputs/codegen/omega/lift1-3.c index de9025bc..4d73f89d 100644 --- a/test_inputs/codegen/omega/lift1-3.c +++ b/test_inputs/codegen/omega/lift1-3.c @@ -1,5 +1,5 @@ for (int c0 = 1; c0 <= 100; c0 += 1) - for (int c1 = 1; c1 <= 100; c1 += 1) + for (int c1 = 1; c1 <= 100; c1 += 1) { if (c0 >= 61) { for (int c2 = 1; c2 <= 100; c2 += 1) for (int c3 = 1; c3 <= 100; c3 += 1) @@ -12,3 +12,4 @@ for (int c0 = 1; c0 <= 100; c0 += 1) s1(c0, c1, c2, c3, c4); s0(c0, c1, c2, c3, c4); } + } diff --git a/test_inputs/codegen/omega/lift1-4.c b/test_inputs/codegen/omega/lift1-4.c index 1b859698..7d2de292 100644 --- a/test_inputs/codegen/omega/lift1-4.c +++ b/test_inputs/codegen/omega/lift1-4.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= 100; c0 += 1) +for (int c0 = 1; c0 <= 100; c0 += 1) { if (c0 >= 61) { for (int c1 = 1; c1 <= 100; c1 += 1) for (int c2 = 1; c2 <= 100; c2 += 1) @@ -13,3 +13,4 @@ for (int c0 = 1; c0 <= 100; c0 += 1) s1(c0, c1, c2, c3, c4); s0(c0, c1, c2, c3, c4); } +} diff --git a/test_inputs/codegen/omega/lift2-1.c b/test_inputs/codegen/omega/lift2-1.c index e799eae2..f914743e 100644 --- a/test_inputs/codegen/omega/lift2-1.c +++ b/test_inputs/codegen/omega/lift2-1.c @@ -1,7 +1,7 @@ for (int c0 = 1; c0 <= 100; c0 += 1) for (int c1 = 1; c1 <= 100; c1 += 1) for (int c2 = 1; c2 <= 100; c2 += 1) - for (int c3 = 1; c3 <= 100; c3 += 1) + for (int c3 = 1; c3 <= 100; c3 += 1) { if (c0 >= 61) { for (int c4 = 1; c4 <= 100; c4 += 1) s1(c0, c1, c2, c3, c4); @@ -13,3 +13,4 @@ for (int c0 = 1; c0 <= 100; c0 += 1) s1(c0, c1, c2, c3, c4); s0(c0, c1, c2, c3, c4); } + } diff --git a/test_inputs/codegen/omega/lift2-2.c b/test_inputs/codegen/omega/lift2-2.c index 429733ae..8b6dbafc 100644 --- a/test_inputs/codegen/omega/lift2-2.c +++ b/test_inputs/codegen/omega/lift2-2.c @@ -1,6 +1,6 @@ for (int c0 = 1; c0 <= 100; c0 += 1) for (int c1 = 1; c1 <= 100; c1 += 1) - for (int c2 = 1; c2 <= 100; c2 += 1) + for (int c2 = 1; c2 <= 100; c2 += 1) { if (c0 >= 61) { for (int c3 = 1; c3 <= 100; c3 += 1) for (int c4 = 1; c4 <= 100; c4 += 1) @@ -15,3 +15,4 @@ for (int c0 = 1; c0 <= 100; c0 += 1) s1(c0, c1, c2, c3, c4); s0(c0, c1, c2, c3, c4); } + } diff --git a/test_inputs/codegen/omega/lift2-3.c b/test_inputs/codegen/omega/lift2-3.c index b0818f1a..1a5954a8 100644 --- a/test_inputs/codegen/omega/lift2-3.c +++ b/test_inputs/codegen/omega/lift2-3.c @@ -1,5 +1,5 @@ for (int c0 = 1; c0 <= 100; c0 += 1) - for (int c1 = 1; c1 <= 100; c1 += 1) + for (int c1 = 1; c1 <= 100; c1 += 1) { if (c0 >= 61) { for (int c2 = 1; c2 <= 100; c2 += 1) for (int c3 = 1; c3 <= 100; c3 += 1) @@ -17,3 +17,4 @@ for (int c0 = 1; c0 <= 100; c0 += 1) s1(c0, c1, c2, c3, c4); s0(c0, c1, c2, c3, c4); } + } diff --git a/test_inputs/codegen/omega/lift2-4.c b/test_inputs/codegen/omega/lift2-4.c index 5437c17c..d1d04d65 100644 --- a/test_inputs/codegen/omega/lift2-4.c +++ b/test_inputs/codegen/omega/lift2-4.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= 100; c0 += 1) +for (int c0 = 1; c0 <= 100; c0 += 1) { if (c0 >= 61) { for (int c1 = 1; c1 <= 100; c1 += 1) for (int c2 = 1; c2 <= 100; c2 += 1) @@ -19,3 +19,4 @@ for (int c0 = 1; c0 <= 100; c0 += 1) s1(c0, c1, c2, c3, c4); s0(c0, c1, c2, c3, c4); } +} diff --git a/test_inputs/codegen/omega/lu-0.c b/test_inputs/codegen/omega/lu-0.c index 7ecc7cc8..e71f47bb 100644 --- a/test_inputs/codegen/omega/lu-0.c +++ b/test_inputs/codegen/omega/lu-0.c @@ -2,9 +2,9 @@ for (int c0 = 1; c0 < n; c0 += 64) for (int c1 = c0 - 1; c1 <= n; c1 += 64) for (int c2 = c0; c2 <= n; c2 += 1) { for (int c3 = c0; c3 <= min(min(c0 + 63, c1 + 62), c2 - 1); c3 += 1) - for (int c4 = max(c3 + 1, c1); c4 <= min(c1 + 63, n); c4 += 1) + for (int c4 = max(c1, c3 + 1); c4 <= min(n, c1 + 63); c4 += 1) s1(c3, c4, c2); if (c0 + 63 >= c2) - for (int c4 = max(c2 + 1, c1); c4 <= min(n, c1 + 63); c4 += 1) + for (int c4 = max(c1, c2 + 1); c4 <= min(n, c1 + 63); c4 += 1) s0(c2, c4); } diff --git a/test_inputs/codegen/omega/lu-1.c b/test_inputs/codegen/omega/lu-1.c index 7ecc7cc8..e71f47bb 100644 --- a/test_inputs/codegen/omega/lu-1.c +++ b/test_inputs/codegen/omega/lu-1.c @@ -2,9 +2,9 @@ for (int c0 = 1; c0 < n; c0 += 64) for (int c1 = c0 - 1; c1 <= n; c1 += 64) for (int c2 = c0; c2 <= n; c2 += 1) { for (int c3 = c0; c3 <= min(min(c0 + 63, c1 + 62), c2 - 1); c3 += 1) - for (int c4 = max(c3 + 1, c1); c4 <= min(c1 + 63, n); c4 += 1) + for (int c4 = max(c1, c3 + 1); c4 <= min(n, c1 + 63); c4 += 1) s1(c3, c4, c2); if (c0 + 63 >= c2) - for (int c4 = max(c2 + 1, c1); c4 <= min(n, c1 + 63); c4 += 1) + for (int c4 = max(c1, c2 + 1); c4 <= min(n, c1 + 63); c4 += 1) s0(c2, c4); } diff --git a/test_inputs/codegen/omega/lu-2.c b/test_inputs/codegen/omega/lu-2.c index 7ecc7cc8..e71f47bb 100644 --- a/test_inputs/codegen/omega/lu-2.c +++ b/test_inputs/codegen/omega/lu-2.c @@ -2,9 +2,9 @@ for (int c0 = 1; c0 < n; c0 += 64) for (int c1 = c0 - 1; c1 <= n; c1 += 64) for (int c2 = c0; c2 <= n; c2 += 1) { for (int c3 = c0; c3 <= min(min(c0 + 63, c1 + 62), c2 - 1); c3 += 1) - for (int c4 = max(c3 + 1, c1); c4 <= min(c1 + 63, n); c4 += 1) + for (int c4 = max(c1, c3 + 1); c4 <= min(n, c1 + 63); c4 += 1) s1(c3, c4, c2); if (c0 + 63 >= c2) - for (int c4 = max(c2 + 1, c1); c4 <= min(n, c1 + 63); c4 += 1) + for (int c4 = max(c1, c2 + 1); c4 <= min(n, c1 + 63); c4 += 1) s0(c2, c4); } diff --git a/test_inputs/codegen/omega/lu-3.c b/test_inputs/codegen/omega/lu-3.c index 9128107c..3fd0d4eb 100644 --- a/test_inputs/codegen/omega/lu-3.c +++ b/test_inputs/codegen/omega/lu-3.c @@ -2,13 +2,13 @@ for (int c0 = 1; c0 < n; c0 += 64) for (int c1 = c0 - 1; c1 <= n; c1 += 64) { for (int c2 = c0; c2 <= min(n, c0 + 63); c2 += 1) { for (int c3 = c0; c3 <= min(c1 + 62, c2 - 1); c3 += 1) - for (int c4 = max(c3 + 1, c1); c4 <= min(c1 + 63, n); c4 += 1) + for (int c4 = max(c1, c3 + 1); c4 <= min(n, c1 + 63); c4 += 1) s1(c3, c4, c2); - for (int c4 = max(c2 + 1, c1); c4 <= min(n, c1 + 63); c4 += 1) + for (int c4 = max(c1, c2 + 1); c4 <= min(n, c1 + 63); c4 += 1) s0(c2, c4); } for (int c2 = c0 + 64; c2 <= n; c2 += 1) for (int c3 = c0; c3 <= min(c0 + 63, c1 + 62); c3 += 1) - for (int c4 = max(c3 + 1, c1); c4 <= min(c1 + 63, n); c4 += 1) + for (int c4 = max(c1, c3 + 1); c4 <= min(n, c1 + 63); c4 += 1) s1(c3, c4, c2); } diff --git a/test_inputs/codegen/omega/lu_spmd-0.c b/test_inputs/codegen/omega/lu_spmd-0.c index 05e5699d..b123e779 100644 --- a/test_inputs/codegen/omega/lu_spmd-0.c +++ b/test_inputs/codegen/omega/lu_spmd-0.c @@ -8,6 +8,6 @@ if (ub >= lb) if (n >= ub + 1) s2(c0, c1); } - for (int c3 = max(c0, lb); c3 <= ub; c3 += 1) + for (int c3 = max(lb, c0); c3 <= ub; c3 += 1) s1(c0, c1, c3); } diff --git a/test_inputs/codegen/omega/lu_spmd-1.c b/test_inputs/codegen/omega/lu_spmd-1.c index 05e5699d..b123e779 100644 --- a/test_inputs/codegen/omega/lu_spmd-1.c +++ b/test_inputs/codegen/omega/lu_spmd-1.c @@ -8,6 +8,6 @@ if (ub >= lb) if (n >= ub + 1) s2(c0, c1); } - for (int c3 = max(c0, lb); c3 <= ub; c3 += 1) + for (int c3 = max(lb, c0); c3 <= ub; c3 += 1) s1(c0, c1, c3); } diff --git a/test_inputs/codegen/omega/m1-1.c b/test_inputs/codegen/omega/m1-1.c index 8f57f56f..07b91f79 100644 --- a/test_inputs/codegen/omega/m1-1.c +++ b/test_inputs/codegen/omega/m1-1.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= 9; c0 += 1) +for (int c0 = 1; c0 <= 9; c0 += 1) { if (c0 >= 6) { for (int c1 = 1; c1 <= 9; c1 += 1) s0(c0, c1); @@ -10,3 +10,4 @@ for (int c0 = 1; c0 <= 9; c0 += 1) s0(5, c1); s1(5, c1); } +} diff --git a/test_inputs/codegen/omega/m10-1.c b/test_inputs/codegen/omega/m10-1.c index d57375ed..0b2851f9 100644 --- a/test_inputs/codegen/omega/m10-1.c +++ b/test_inputs/codegen/omega/m10-1.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= 18; c0 += 1) +for (int c0 = 1; c0 <= 18; c0 += 1) { if (c0 <= 9 && c0 >= 2) { for (int c1 = 1; c1 <= 9; c1 += 1) { if (c0 % 2 == 0) @@ -11,3 +11,4 @@ for (int c0 = 1; c0 <= 18; c0 += 1) } else if (c0 % 2 == 0) for (int c1 = 1; c1 <= 9; c1 += 1) s0(c1, c0 / 2); +} diff --git a/test_inputs/codegen/omega/m11-0.c b/test_inputs/codegen/omega/m11-0.c index 4d422eba..1ecb4a53 100644 --- a/test_inputs/codegen/omega/m11-0.c +++ b/test_inputs/codegen/omega/m11-0.c @@ -1,6 +1,6 @@ for (int c0 = 1; c0 <= min(4, floord(2 * m - 1, 17) + 1); c0 += 1) for (int c1 = 1; c1 <= 2; c1 += 1) - for (int c2 = 0; c2 <= min(-c1 + c1 / 2 + 3, -c0 - c1 + (2 * m + 3 * c0 + 10 * c1 + 6) / 20 + 1); c2 += 1) - for (int c3 = 8 * c0 + (c0 + 1) / 2 - 8; c3 <= min(min(8 * c0 + c0 / 2, 30), m - 5 * c1 - 10 * c2 + 5); c3 += 1) - for (int c4 = 5 * c1 + 10 * c2 - 4; c4 <= min(m - c3 + 1, 5 * c1 + 10 * c2); c4 += 1) + for (int c2 = 0; c2 <= min(2, -c0 - c1 + (2 * m + 3 * c0 + 10 * c1 + 6) / 20 + 1); c2 += 1) + for (int c3 = 8 * c0 + (c0 + 1) / 2 - 8; c3 <= min(min(30, m - 5 * c1 - 10 * c2 + 5), 8 * c0 + c0 / 2); c3 += 1) + for (int c4 = 5 * c1 + 10 * c2 - 4; c4 <= min(5 * c1 + 10 * c2, m - c3 + 1); c4 += 1) s0(c0, c1, c2, c3, c4, -9 * c0 + c3 + c0 / 2 + 9, -5 * c1 - 5 * c2 + c4 + 5); diff --git a/test_inputs/codegen/omega/m2-0.c b/test_inputs/codegen/omega/m2-0.c index 97fcb7b5..669f51a7 100644 --- a/test_inputs/codegen/omega/m2-0.c +++ b/test_inputs/codegen/omega/m2-0.c @@ -1,4 +1,4 @@ -for (int c0 = 2; c0 <= 9; c0 += 1) +for (int c0 = 2; c0 <= 9; c0 += 1) { if (c0 >= 5) { s1(c0, 1); for (int c1 = 2; c1 <= 9; c1 += 1) { @@ -8,3 +8,4 @@ for (int c0 = 2; c0 <= 9; c0 += 1) } else for (int c1 = 2; c1 <= 9; c1 += 1) s0(c0, c1); +} diff --git a/test_inputs/codegen/omega/m3-0.c b/test_inputs/codegen/omega/m3-0.c index 21a6f8ef..d3d69704 100644 --- a/test_inputs/codegen/omega/m3-0.c +++ b/test_inputs/codegen/omega/m3-0.c @@ -1,3 +1,3 @@ for (int c0 = -9; c0 <= 9; c0 += 1) - for (int c1 = max(-c0 + 1, 1); c1 <= min(-c0 + 10, 10); c1 += 1) + for (int c1 = max(1, -c0 + 1); c1 <= min(10, -c0 + 10); c1 += 1) s0(c0, c1); diff --git a/test_inputs/codegen/omega/m7-1.c b/test_inputs/codegen/omega/m7-1.c index 690dc506..a01856e4 100644 --- a/test_inputs/codegen/omega/m7-1.c +++ b/test_inputs/codegen/omega/m7-1.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= 9; c0 += 1) +for (int c0 = 1; c0 <= 9; c0 += 1) { if (c0 % 2 == 0) { for (int c1 = 1; c1 <= 9; c1 += 1) { s0(c1, c0); @@ -7,3 +7,4 @@ for (int c0 = 1; c0 <= 9; c0 += 1) } else for (int c1 = 1; c1 <= 9; c1 += 1) s0(c1, c0); +} diff --git a/test_inputs/codegen/omega/m8-1.c b/test_inputs/codegen/omega/m8-1.c index a36f516e..51c77dae 100644 --- a/test_inputs/codegen/omega/m8-1.c +++ b/test_inputs/codegen/omega/m8-1.c @@ -1,4 +1,4 @@ -for (int c0 = 2; c0 <= 8; c0 += 2) +for (int c0 = 2; c0 <= 8; c0 += 2) { if (c0 % 4 == 0) { for (int c1 = 1; c1 <= 9; c1 += 1) { s0(c1, c0); @@ -7,3 +7,4 @@ for (int c0 = 2; c0 <= 8; c0 += 2) } else for (int c1 = 1; c1 <= 9; c1 += 1) s1(c1, c0); +} diff --git a/test_inputs/codegen/omega/p.delft-0.c b/test_inputs/codegen/omega/p.delft-0.c index be015bc6..6b38972f 100644 --- a/test_inputs/codegen/omega/p.delft-0.c +++ b/test_inputs/codegen/omega/p.delft-0.c @@ -1,4 +1,4 @@ if (P1 == P2 && P2 >= 0 && P2 <= 3) - for (int c0 = 0; c0 <= min(-P2 + 4, 2); c0 += 1) - for (int c2 = -P2 - c0 + 3 * floord(P2 + c0 - 1, 3) + 3; c2 <= 3; c2 += 3) + for (int c0 = 0; c0 <= min(2, -P2 + 4); c0 += 1) + for (int c2 = (-P2 - c0 + 6) % 3; c2 <= 3; c2 += 3) s0(c0, c0, c2, c2); diff --git a/test_inputs/codegen/omega/p.delft2-0.c b/test_inputs/codegen/omega/p.delft2-0.c index 3ccbf81f..1b99a92a 100644 --- a/test_inputs/codegen/omega/p.delft2-0.c +++ b/test_inputs/codegen/omega/p.delft2-0.c @@ -1,11 +1,12 @@ if (P2 <= 3 && P2 >= 0 && P1 <= 3 && P1 >= 0) for (int c0 = P1 - 1; c0 <= 3; c0 += 1) - if (P1 + 2 * floord(-P1 + c0 - 1, 2) + 1 == c0) - for (int c2 = 0; c2 <= -((P1 + 4) / 4) + 8; c2 += 1) + if ((-P1 + c0 + 1) % 2 == 0) + for (int c2 = 0; c2 <= 7; c2 += 1) if ((5 * c0 + 2 * c2 + 5) % 9 <= 2) - for (int c3 = 0; c3 <= -((P2 + 4) / 4) + 8; c3 += 1) - if ((5 * P2 + 2 * c3) % 9 <= 3) + for (int c3 = 0; c3 <= 7; c3 += 1) + if ((5 * P2 + 2 * c3) % 9 <= 3) { if (c0 + 1 == P1 && (5 * P1 + 2 * c2) % 9 <= 2 && P1 >= 1) { s0(P1 - 1, P2, c2, c3, ((5 * P1 + 2 * c2) % 9) + 1, (-4 * P2 + 2 * c3 + 9) % 9); } else if (c2 % 4 == 0 && c0 == 3 && P1 == 0) - s0(3, P2, c2, c3, (-c2 + 12) / 4, (-4 * P2 + 2 * c3 + 9) % 9); + s0(3, P2, c2, c3, (-c2 / 4) + 3, (-4 * P2 + 2 * c3 + 9) % 9); + } diff --git a/test_inputs/codegen/omega/p6-1.c b/test_inputs/codegen/omega/p6-1.c index 21a6f8ef..d3d69704 100644 --- a/test_inputs/codegen/omega/p6-1.c +++ b/test_inputs/codegen/omega/p6-1.c @@ -1,3 +1,3 @@ for (int c0 = -9; c0 <= 9; c0 += 1) - for (int c1 = max(-c0 + 1, 1); c1 <= min(-c0 + 10, 10); c1 += 1) + for (int c1 = max(1, -c0 + 1); c1 <= min(10, -c0 + 10); c1 += 1) s0(c0, c1); diff --git a/test_inputs/codegen/omega/stride2-0.c b/test_inputs/codegen/omega/stride2-0.c index c292b785..0a7e8e74 100644 --- a/test_inputs/codegen/omega/stride2-0.c +++ b/test_inputs/codegen/omega/stride2-0.c @@ -1,3 +1,3 @@ for (int c0 = 0; c0 <= n; c0 += 32) - for (int c1 = c0; c1 <= min(c0 + 31, n); c1 += 1) + for (int c1 = c0; c1 <= min(n, c0 + 31); c1 += 1) s0(c0, c1); diff --git a/test_inputs/codegen/omega/stride3-0.c b/test_inputs/codegen/omega/stride3-0.c index d3daa2af..8913c802 100644 --- a/test_inputs/codegen/omega/stride3-0.c +++ b/test_inputs/codegen/omega/stride3-0.c @@ -1,3 +1,3 @@ for (int c0 = 3; c0 <= n; c0 += 32) - for (int c1 = c0; c1 <= min(c0 + 31, n); c1 += 1) + for (int c1 = c0; c1 <= min(n, c0 + 31); c1 += 1) s0(c0, c1); diff --git a/test_inputs/codegen/omega/stride5-0.c b/test_inputs/codegen/omega/stride5-0.c index dc67339e..2eeeb5a7 100644 --- a/test_inputs/codegen/omega/stride5-0.c +++ b/test_inputs/codegen/omega/stride5-0.c @@ -1,3 +1,3 @@ -for (int c0 = 2; c0 <= min(-2 * n + 400, 100); c0 += 2) +for (int c0 = 2; c0 <= min(100, -2 * n + 400); c0 += 2) for (int c1 = 2 * n + c0; c1 <= 400; c1 += 2) s0(c0, c1); diff --git a/test_inputs/codegen/omega/stride6-0.c b/test_inputs/codegen/omega/stride6-0.c index 5f619bf5..f4df469c 100644 --- a/test_inputs/codegen/omega/stride6-0.c +++ b/test_inputs/codegen/omega/stride6-0.c @@ -1,3 +1,3 @@ for (int c0 = 1; c0 <= 101; c0 += 1) - for (int c1 = -((c0 + 1) % 2) + c0 + 1; c1 <= 400; c1 += 2) + for (int c1 = -((c0 - 1) % 2) + c0 + 1; c1 <= 400; c1 += 2) s0(c0, c1); diff --git a/test_inputs/codegen/omega/stride7-0.c b/test_inputs/codegen/omega/stride7-0.c index ba476896..7fe17588 100644 --- a/test_inputs/codegen/omega/stride7-0.c +++ b/test_inputs/codegen/omega/stride7-0.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= 36; c0 += 1) +for (int c0 = 1; c0 <= 36; c0 += 1) { if (c0 <= 3) { for (int c1 = 1; c1 <= 9; c1 += 1) s1(c1, c0); @@ -11,3 +11,4 @@ for (int c0 = 1; c0 <= 36; c0 += 1) } else if (c0 % 4 == 0) for (int c1 = 1; c1 <= 9; c1 += 1) s0(c1, c0 / 4); +} diff --git a/test_inputs/codegen/omega/syr2k-0.c b/test_inputs/codegen/omega/syr2k-0.c index 2c9b286c..bb3ef7fa 100644 --- a/test_inputs/codegen/omega/syr2k-0.c +++ b/test_inputs/codegen/omega/syr2k-0.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= min(2 * b - 1, n); c0 += 1) - for (int c1 = max(-b + 1, -n + 1); c1 <= min(n - c0, b - c0); c1 += 1) - for (int c2 = max(1, c0 + c1); c2 <= min(n + c1, n); c2 += 1) +for (int c0 = 1; c0 <= min(n, 2 * b - 1); c0 += 1) + for (int c1 = max(-n + 1, -b + 1); c1 <= min(b - c0, n - c0); c1 += 1) + for (int c2 = max(1, c0 + c1); c2 <= min(n, n + c1); c2 += 1) s0(-c0 - c1 + c2 + 1, -c1 + c2, c2); diff --git a/test_inputs/codegen/omega/syr2k-1.c b/test_inputs/codegen/omega/syr2k-1.c index 146b4e64..22ec83ec 100644 --- a/test_inputs/codegen/omega/syr2k-1.c +++ b/test_inputs/codegen/omega/syr2k-1.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= min(2 * b - 1, n); c0 += 1) +for (int c0 = 1; c0 <= min(n, 2 * b - 1); c0 += 1) for (int c1 = -b + 1; c1 <= b - c0; c1 += 1) - for (int c2 = max(c0 + c1, 1); c2 <= min(n + c1, n); c2 += 1) + for (int c2 = max(1, c0 + c1); c2 <= min(n, n + c1); c2 += 1) s0(-c0 - c1 + c2 + 1, -c1 + c2, c2); diff --git a/test_inputs/codegen/omega/syr2k-2.c b/test_inputs/codegen/omega/syr2k-2.c index 2c9b286c..bb3ef7fa 100644 --- a/test_inputs/codegen/omega/syr2k-2.c +++ b/test_inputs/codegen/omega/syr2k-2.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= min(2 * b - 1, n); c0 += 1) - for (int c1 = max(-b + 1, -n + 1); c1 <= min(n - c0, b - c0); c1 += 1) - for (int c2 = max(1, c0 + c1); c2 <= min(n + c1, n); c2 += 1) +for (int c0 = 1; c0 <= min(n, 2 * b - 1); c0 += 1) + for (int c1 = max(-n + 1, -b + 1); c1 <= min(b - c0, n - c0); c1 += 1) + for (int c2 = max(1, c0 + c1); c2 <= min(n, n + c1); c2 += 1) s0(-c0 - c1 + c2 + 1, -c1 + c2, c2); diff --git a/test_inputs/codegen/omega/syr2k-3.c b/test_inputs/codegen/omega/syr2k-3.c index 146b4e64..22ec83ec 100644 --- a/test_inputs/codegen/omega/syr2k-3.c +++ b/test_inputs/codegen/omega/syr2k-3.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= min(2 * b - 1, n); c0 += 1) +for (int c0 = 1; c0 <= min(n, 2 * b - 1); c0 += 1) for (int c1 = -b + 1; c1 <= b - c0; c1 += 1) - for (int c2 = max(c0 + c1, 1); c2 <= min(n + c1, n); c2 += 1) + for (int c2 = max(1, c0 + c1); c2 <= min(n, n + c1); c2 += 1) s0(-c0 - c1 + c2 + 1, -c1 + c2, c2); diff --git a/test_inputs/codegen/omega/ts1d-check-sblock-0.c b/test_inputs/codegen/omega/ts1d-check-sblock-0.c index 0a75c9ab..c70e95bc 100644 --- a/test_inputs/codegen/omega/ts1d-check-sblock-0.c +++ b/test_inputs/codegen/omega/ts1d-check-sblock-0.c @@ -1,13 +1,14 @@ { - for (int c1 = 0; c1 <= 1; c1 += 1) + for (int c1 = 0; c1 <= 1; c1 += 1) { if (c1 == 1) { s0(1, 1, 1, 0, 0); s0(1, 1, 1, N - 1, 0); } else for (int c3 = 0; c3 < N; c3 += 1) s0(1, 0, 1, c3, 0); + } for (int c1 = 0; c1 <= floord(T - 1, 1000); c1 += 1) for (int c2 = 1000 * c1 + 1; c2 <= min(N + T - 3, N + 1000 * c1 + 997); c2 += 1) - for (int c3 = max(-N - 1000 * c1 + c2 + 2, 0); c3 <= min(min(999, T - 1000 * c1 - 1), -1000 * c1 + c2 - 1); c3 += 1) + for (int c3 = max(0, -N - 1000 * c1 + c2 + 2); c3 <= min(min(999, T - 1000 * c1 - 1), -1000 * c1 + c2 - 1); c3 += 1) s1(2, 1000 * c1 + c3, 1, -1000 * c1 + c2 - c3, 1); } diff --git a/test_inputs/codegen/omega/ts1d-check0-0.c b/test_inputs/codegen/omega/ts1d-check0-0.c index 436fcf6e..5cf4bc9f 100644 --- a/test_inputs/codegen/omega/ts1d-check0-0.c +++ b/test_inputs/codegen/omega/ts1d-check0-0.c @@ -3,7 +3,7 @@ s0(1, c1, 1, 0, 0); for (int c1 = 0; c1 <= floord(T - 1, 500); c1 += 1) for (int c2 = 1000 * c1; c2 <= min(N + 2 * T - 3, N + 1000 * c1 + 997); c2 += 1) { - for (int c3 = max(-((N + c2) % 2) - N - 1000 * c1 + c2 + 2, 0); c3 <= min(min(998, 2 * T - 1000 * c1 - 2), -1000 * c1 + c2 - 2); c3 += 2) { + for (int c3 = max(0, -((N + c2) % 2) - N - 1000 * c1 + c2 + 2); c3 <= min(min(998, 2 * T - 1000 * c1 - 2), -1000 * c1 + c2 - 2); c3 += 2) { s1(2, 1000 * c1 + c3, 0, -1000 * c1 + c2 - c3, 1); s2(2, 1000 * c1 + c3 + 1, 0, -1000 * c1 + c2 - c3 - 1, 1); } diff --git a/test_inputs/codegen/omega/ts1d-mp-i_ts-m_b-0.c b/test_inputs/codegen/omega/ts1d-mp-i_ts-m_b-0.c index ca440248..b32e95a1 100644 --- a/test_inputs/codegen/omega/ts1d-mp-i_ts-m_b-0.c +++ b/test_inputs/codegen/omega/ts1d-mp-i_ts-m_b-0.c @@ -1,30 +1,31 @@ { for (int c1 = -1; c1 < (T >= 1 ? T : 0); c1 += 1) - for (int c2 = 0; c2 < N; c2 += 1) + for (int c2 = 0; c2 < N; c2 += 1) { if (c2 == 0 && T >= c1 + 1 && c1 >= 0) { s0(1, c1, 0, 0, 0); } else if (c2 + 1 == N && T >= c1 + 1 && c1 >= 0) { s0(1, c1, N - 1, 0, 0); } else if (c1 == -1 && c2 >= 0 && N >= c2 + 1) s0(1, -1, c2, 0, 0); + } for (int c1 = 0; c1 <= floord(T - 1, 500); c1 += 1) { for (int c3 = -((c1 + 9) / 8) + 2; c3 <= floord(N - 500 * c1 - 3, 4000) + 1; c3 += 1) - for (int c4 = max(1000 * c1 + 4000 * c3 - 3999, 500 * c1 + 1); c4 <= min(min(2 * N - 4000 * c3 + 3995, N + T - 3), 1000 * c1 + 4000 * c3 - 3000); c4 += 1) - for (int c5 = max(0, -N - 500 * c1 + c4 + 2); c5 <= min(min(-500 * c1 + c4 - 1, -500 * c1 - 2000 * c3 + (c4 + 1) / 2 + 1999), T - 500 * c1 - 1); c5 += 1) + for (int c4 = max(500 * c1 + 1, 1000 * c1 + 4000 * c3 - 3999); c4 <= min(min(N + T - 3, 1000 * c1 + 4000 * c3 - 3000), 2 * N - 4000 * c3 + 3995); c4 += 1) + for (int c5 = max(0, -N - 500 * c1 + c4 + 2); c5 <= min(min(T - 500 * c1 - 1, -500 * c1 + c4 - 1), -500 * c1 - 2000 * c3 + (c4 + 1) / 2 + 1999); c5 += 1) s1(2, 500 * c1 + c5, 1, -500 * c1 + c4 - c5, 1); for (int c3 = max(-((T + 4000) / 4000) + 2, -((c1 + 9) / 8) + 2); c3 <= floord(N - 500 * c1 - 3, 4000) + 1; c3 += 1) - for (int c4 = max(1000 * c1 + 4000 * c3 - 3999, -4000 * c3 + 4000); c4 <= min(min(2 * N - 4000 * c3 + 3995, 2 * T + 4000 * c3 - 4000), 1000 * c1 + 4000 * c3 - 3000); c4 += 1) + for (int c4 = max(1000 * c1 + 4000 * c3 - 3999, -4000 * c3 + 4000); c4 <= min(min(2 * T + 4000 * c3 - 4000, 1000 * c1 + 4000 * c3 - 3000), 2 * N - 4000 * c3 + 3995); c4 += 1) s2(2, -2000 * c3 + (c4 + 1) / 2 + 1999, 1, 2000 * c3 + c4 - (c4 + 1) / 2 - 1999, 1); for (int c3 = -((c1 + 7) / 8) + 1; c3 <= min(floord(N + T - 1000 * c1 - 1004, 4000) + 1, floord(N - 500 * c1 - 504, 4000) + 1); c3 += 1) - for (int c4 = max(1000 * c1 + 4000 * c3 - 2999, 500 * c1 + 1); c4 <= min(min(N + T - 3, N + 500 * c1 + 497), 1000 * c1 + 4000 * c3); c4 += 1) - for (int c5 = max(0, -N - 500 * c1 + c4 + 2); c5 <= min(min(-500 * c1 + c4 - 1, 499), T - 500 * c1 - 1); c5 += 1) + for (int c4 = max(500 * c1 + 1, 1000 * c1 + 4000 * c3 - 2999); c4 <= min(min(N + T - 3, N + 500 * c1 + 497), 1000 * c1 + 4000 * c3); c4 += 1) + for (int c5 = max(0, -N - 500 * c1 + c4 + 2); c5 <= min(min(499, T - 500 * c1 - 1), -500 * c1 + c4 - 1); c5 += 1) s3(2, 500 * c1 + c5, 1, -500 * c1 + c4 - c5, 1); for (int c3 = max(-((T + 4000) / 4000) + 1, -((c1 + 9) / 8) + 1); c3 <= floord(N - 500 * c1 - 3, 4000); c3 += 1) - for (int c4 = max(1000 * c1 + 4000 * c3 + 1, -4000 * c3); c4 <= min(min(2 * N - 4000 * c3 - 5, 2 * T + 4000 * c3), 1000 * c1 + 4000 * c3 + 1000); c4 += 1) + for (int c4 = max(-4000 * c3, 1000 * c1 + 4000 * c3 + 1); c4 <= min(min(2 * N - 4000 * c3 - 5, 2 * T + 4000 * c3), 1000 * c1 + 4000 * c3 + 1000); c4 += 1) s4(2, -2000 * c3 + (c4 + 1) / 2 - 1, 1, 2000 * c3 + c4 - (c4 + 1) / 2 + 1, 1); for (int c3 = -((c1 + 8) / 8) + 1; c3 <= min(floord(N + T - 1000 * c1 - 4, 4000), floord(N - 500 * c1 + 496, 4000)); c3 += 1) - for (int c4 = max(-4000 * c3 + 2, 1000 * c1 + 4000 * c3 + 1); c4 <= min(min(min(N + T - 3, N + 500 * c1 + 497), 2 * T + 4000 * c3 - 2), 1000 * c1 + 4000 * c3 + 998); c4 += 1) - for (int c5 = max(-500 * c1 - 2000 * c3 + (c4 + 1) / 2, -N - 500 * c1 + c4 + 2); c5 <= min(min(499, -500 * c1 + c4 - 1), T - 500 * c1 - 1); c5 += 1) + for (int c4 = max(1000 * c1 + 4000 * c3 + 1, -4000 * c3 + 2); c4 <= min(min(min(N + T - 3, N + 500 * c1 + 497), 2 * T + 4000 * c3 - 2), 1000 * c1 + 4000 * c3 + 998); c4 += 1) + for (int c5 = max(-N - 500 * c1 + c4 + 2, -500 * c1 - 2000 * c3 + (c4 + 1) / 2); c5 <= min(min(499, T - 500 * c1 - 1), -500 * c1 + c4 - 1); c5 += 1) s5(2, 500 * c1 + c5, 1, -500 * c1 + c4 - c5, 1); } if (T >= 1) diff --git a/test_inputs/codegen/omega/wak1-0.c b/test_inputs/codegen/omega/wak1-0.c index 0548b8aa..443ec732 100644 --- a/test_inputs/codegen/omega/wak1-0.c +++ b/test_inputs/codegen/omega/wak1-0.c @@ -1,26 +1,26 @@ { - for (int c0 = a2; c0 <= min(min(b2, a3 - 1), a1 - 1); c0 += 1) + for (int c0 = a2; c0 <= min(min(a1 - 1, a3 - 1), b2); c0 += 1) s1(c0); - for (int c0 = a3; c0 <= min(b3, a1 - 1); c0 += 1) { + for (int c0 = a1; c0 <= min(b1, a3 - 1); c0 += 1) { + s0(c0); if (c0 >= a2 && b2 >= c0) s1(c0); - s2(c0); } - for (int c0 = max(max(a3, b3 + 1), a2); c0 <= min(b2, a1 - 1); c0 += 1) + for (int c0 = max(max(a1, b1 + 1), a2); c0 <= min(a3 - 1, b2); c0 += 1) s1(c0); - for (int c0 = a1; c0 <= b1; c0 += 1) { - s0(c0); - if (b2 >= c0 && c0 >= a2) + for (int c0 = a3; c0 <= b3; c0 += 1) { + if (c0 >= a1 && b1 >= c0) + s0(c0); + if (c0 >= a2 && b2 >= c0) s1(c0); - if (b3 >= c0 && c0 >= a3) - s2(c0); + s2(c0); } - for (int c0 = max(max(a1, b1 + 1), a2); c0 <= min(b2, a3 - 1); c0 += 1) + for (int c0 = max(max(a3, b3 + 1), a2); c0 <= min(a1 - 1, b2); c0 += 1) s1(c0); - for (int c0 = max(max(a1, b1 + 1), a3); c0 <= b3; c0 += 1) { - if (c0 >= a2 && b2 >= c0) + for (int c0 = max(max(a1, a3), b3 + 1); c0 <= b1; c0 += 1) { + s0(c0); + if (b2 >= c0 && c0 >= a2) s1(c0); - s2(c0); } for (int c0 = max(max(max(max(a1, b1 + 1), a3), b3 + 1), a2); c0 <= b2; c0 += 1) s1(c0); diff --git a/test_inputs/codegen/omega/wak1-1.c b/test_inputs/codegen/omega/wak1-1.c index a925f613..7fdda1dd 100644 --- a/test_inputs/codegen/omega/wak1-1.c +++ b/test_inputs/codegen/omega/wak1-1.c @@ -1,50 +1,50 @@ { - for (int c0 = a3; c0 <= min(min(a2 - 1, b3), a1 - 1); c0 += 1) - s2(c0); - for (int c0 = a2; c0 <= min(min(b2, a3 - 1), a1 - 1); c0 += 1) + for (int c0 = a2; c0 <= min(min(a1 - 1, a3 - 1), b2); c0 += 1) s1(c0); - for (int c0 = max(a3, a2); c0 <= min(min(b2, b3), a1 - 1); c0 += 1) { + for (int c0 = a3; c0 <= min(min(a1 - 1, b3), a2 - 1); c0 += 1) + s2(c0); + for (int c0 = max(a3, a2); c0 <= min(min(a1 - 1, b3), b2); c0 += 1) { s1(c0); s2(c0); } - for (int c0 = max(max(a3, a2), b2 + 1); c0 <= min(b3, a1 - 1); c0 += 1) - s2(c0); - for (int c0 = a1; c0 <= min(min(a2 - 1, a3 - 1), b1); c0 += 1) + for (int c0 = a1; c0 <= min(min(b1, a3 - 1), a2 - 1); c0 += 1) s0(c0); - for (int c0 = max(a1, a3); c0 <= min(min(a2 - 1, b3), b1); c0 += 1) { - s0(c0); - s2(c0); - } - for (int c0 = max(max(a1, b1 + 1), a3); c0 <= min(a2 - 1, b3); c0 += 1) - s2(c0); - for (int c0 = max(a1, a2); c0 <= min(min(b2, a3 - 1), b1); c0 += 1) { + for (int c0 = max(a1, a2); c0 <= min(min(b1, a3 - 1), b2); c0 += 1) { s0(c0); s1(c0); } - for (int c0 = max(max(a1, b1 + 1), a2); c0 <= min(b2, a3 - 1); c0 += 1) + for (int c0 = max(max(a1, b1 + 1), a2); c0 <= min(a3 - 1, b2); c0 += 1) s1(c0); - for (int c0 = max(max(a1, a3), a2); c0 <= min(min(b2, b3), b1); c0 += 1) { + for (int c0 = max(a1, a3); c0 <= min(min(b1, b3), a2 - 1); c0 += 1) { + s0(c0); + s2(c0); + } + for (int c0 = max(max(a1, b1 + 1), a3); c0 <= min(b3, a2 - 1); c0 += 1) + s2(c0); + for (int c0 = max(max(a1, a3), a2); c0 <= min(min(b1, b3), b2); c0 += 1) { s0(c0); s1(c0); s2(c0); } - for (int c0 = max(max(max(a1, b1 + 1), a3), a2); c0 <= min(b2, b3); c0 += 1) { + for (int c0 = max(max(max(a1, b1 + 1), a3), a2); c0 <= min(b3, b2); c0 += 1) { s1(c0); s2(c0); } - for (int c0 = max(max(a1, a2), b2 + 1); c0 <= min(a3 - 1, b1); c0 += 1) + for (int c0 = max(max(a3, a2), b2 + 1); c0 <= min(a1 - 1, b3); c0 += 1) + s2(c0); + for (int c0 = max(max(a1, a2), b2 + 1); c0 <= min(b1, a3 - 1); c0 += 1) s0(c0); - for (int c0 = max(max(max(a1, a3), a2), b2 + 1); c0 <= min(b3, b1); c0 += 1) { + for (int c0 = max(max(max(a1, a3), a2), b2 + 1); c0 <= min(b1, b3); c0 += 1) { s0(c0); s2(c0); } for (int c0 = max(max(max(max(a1, b1 + 1), a3), a2), b2 + 1); c0 <= b3; c0 += 1) s2(c0); - for (int c0 = max(max(a3, b3 + 1), a2); c0 <= min(b2, a1 - 1); c0 += 1) + for (int c0 = max(max(a3, b3 + 1), a2); c0 <= min(a1 - 1, b2); c0 += 1) s1(c0); - for (int c0 = max(max(a1, a3), b3 + 1); c0 <= min(a2 - 1, b1); c0 += 1) + for (int c0 = max(max(a1, a3), b3 + 1); c0 <= min(b1, a2 - 1); c0 += 1) s0(c0); - for (int c0 = max(max(max(a1, a3), b3 + 1), a2); c0 <= min(b2, b1); c0 += 1) { + for (int c0 = max(max(max(a1, a3), b3 + 1), a2); c0 <= min(b1, b2); c0 += 1) { s0(c0); s1(c0); } diff --git a/test_inputs/codegen/omega/wak2-0.c b/test_inputs/codegen/omega/wak2-0.c index 6c968d0a..3f51dbca 100644 --- a/test_inputs/codegen/omega/wak2-0.c +++ b/test_inputs/codegen/omega/wak2-0.c @@ -1,15 +1,15 @@ { - for (int c0 = a1; c0 <= min(a2 - 1, b1); c0 += 1) + for (int c0 = a1; c0 <= min(b1, a2 - 1); c0 += 1) for (int c1_0 = c1; c1_0 <= d1; c1_0 += 1) s0(c0, c1_0); if (c2 >= d2 + 1) { - for (int c0 = max(a1, a2); c0 <= min(b2, b1); c0 += 1) + for (int c0 = max(a1, a2); c0 <= min(b1, b2); c0 += 1) for (int c1_0 = c1; c1_0 <= d1; c1_0 += 1) s0(c0, c1_0); } else for (int c0 = a2; c0 <= b2; c0 += 1) { if (c0 >= a1 && b1 >= c0) - for (int c1_0 = c1; c1_0 <= min(c2 - 1, d1); c1_0 += 1) + for (int c1_0 = c1; c1_0 <= min(d1, c2 - 1); c1_0 += 1) s0(c0, c1_0); for (int c1_0 = c2; c1_0 <= d2; c1_0 += 1) { if (c0 >= a1 && b1 >= c0 && c1_0 >= c1 && d1 >= c1_0) @@ -17,7 +17,7 @@ s1(c0, c1_0); } if (c0 >= a1 && b1 >= c0) - for (int c1_0 = max(d2 + 1, c1); c1_0 <= d1; c1_0 += 1) + for (int c1_0 = max(c1, d2 + 1); c1_0 <= d1; c1_0 += 1) s0(c0, c1_0); } for (int c0 = max(max(a1, a2), b2 + 1); c0 <= b1; c0 += 1) diff --git a/test_inputs/codegen/omega/wak2-1.c b/test_inputs/codegen/omega/wak2-1.c index a689e348..cc203577 100644 --- a/test_inputs/codegen/omega/wak2-1.c +++ b/test_inputs/codegen/omega/wak2-1.c @@ -1,13 +1,13 @@ { - for (int c0 = a1; c0 <= min(a2 - 1, b1); c0 += 1) + for (int c0 = a1; c0 <= min(b1, a2 - 1); c0 += 1) for (int c1_0 = c1; c1_0 <= d1; c1_0 += 1) s0(c0, c1_0); if (c2 >= d2 + 1) { - for (int c0 = max(a1, a2); c0 <= min(b2, b1); c0 += 1) + for (int c0 = max(a1, a2); c0 <= min(b1, b2); c0 += 1) for (int c1_0 = c1; c1_0 <= d1; c1_0 += 1) s0(c0, c1_0); } else - for (int c0 = a2; c0 <= b2; c0 += 1) + for (int c0 = a2; c0 <= b2; c0 += 1) { if (a1 >= c0 + 1) { for (int c1_0 = c2; c1_0 <= d2; c1_0 += 1) s1(c0, c1_0); @@ -15,19 +15,20 @@ for (int c1_0 = c2; c1_0 <= d2; c1_0 += 1) s1(c0, c1_0); } else { - for (int c1_0 = c1; c1_0 <= min(c2 - 1, d1); c1_0 += 1) + for (int c1_0 = c1; c1_0 <= min(d1, c2 - 1); c1_0 += 1) s0(c0, c1_0); - for (int c1_0 = c2; c1_0 <= min(d2, c1 - 1); c1_0 += 1) + for (int c1_0 = c2; c1_0 <= min(c1 - 1, d2); c1_0 += 1) s1(c0, c1_0); - for (int c1_0 = max(c2, c1); c1_0 <= min(d1, d2); c1_0 += 1) { + for (int c1_0 = max(c1, c2); c1_0 <= min(d1, d2); c1_0 += 1) { s0(c0, c1_0); s1(c0, c1_0); } - for (int c1_0 = max(d2 + 1, c1); c1_0 <= d1; c1_0 += 1) + for (int c1_0 = max(c1, d2 + 1); c1_0 <= d1; c1_0 += 1) s0(c0, c1_0); - for (int c1_0 = max(max(d1 + 1, c1), c2); c1_0 <= d2; c1_0 += 1) + for (int c1_0 = max(max(c1, d1 + 1), c2); c1_0 <= d2; c1_0 += 1) s1(c0, c1_0); } + } for (int c0 = max(max(a1, a2), b2 + 1); c0 <= b1; c0 += 1) for (int c1_0 = c1; c1_0 <= d1; c1_0 += 1) s0(c0, c1_0); diff --git a/test_inputs/codegen/omega/wak3-1.c b/test_inputs/codegen/omega/wak3-1.c index 38d3d5c3..3045b219 100644 --- a/test_inputs/codegen/omega/wak3-1.c +++ b/test_inputs/codegen/omega/wak3-1.c @@ -1,11 +1,11 @@ { - for (int c0 = a; c0 <= min(b, a + 9); c0 += 1) + for (int c0 = a; c0 <= min(a + 9, b); c0 += 1) s0(c0); - for (int c0 = a + 10; c0 <= min(b, a + 19); c0 += 1) { + for (int c0 = a + 10; c0 <= min(a + 19, b); c0 += 1) { s0(c0); s1(c0); } - for (int c0 = max(a + 10, b + 1); c0 <= min(b + 10, a + 19); c0 += 1) + for (int c0 = max(a + 10, b + 1); c0 <= min(a + 19, b + 10); c0 += 1) s1(c0); for (int c0 = a + 20; c0 <= b; c0 += 1) { s0(c0); diff --git a/test_inputs/codegen/omega/wak4-0.c b/test_inputs/codegen/omega/wak4-0.c index bf6eb223..5cefe4be 100644 --- a/test_inputs/codegen/omega/wak4-0.c +++ b/test_inputs/codegen/omega/wak4-0.c @@ -1,4 +1,4 @@ -for (int c0 = max(max(max(max(a1, a2), a3), a4), a5); c0 <= min(min(min(min(b5, b4), b3), b2), b1); c0 += 1) { +for (int c0 = max(max(max(max(a1, a2), a3), a4), a5); c0 <= min(min(min(min(b1, b2), b3), b4), b5); c0 += 1) { s0(c0); s1(c0); } diff --git a/test_inputs/codegen/omega/wak4-1.c b/test_inputs/codegen/omega/wak4-1.c index bf6eb223..5cefe4be 100644 --- a/test_inputs/codegen/omega/wak4-1.c +++ b/test_inputs/codegen/omega/wak4-1.c @@ -1,4 +1,4 @@ -for (int c0 = max(max(max(max(a1, a2), a3), a4), a5); c0 <= min(min(min(min(b5, b4), b3), b2), b1); c0 += 1) { +for (int c0 = max(max(max(max(a1, a2), a3), a4), a5); c0 <= min(min(min(min(b1, b2), b3), b4), b5); c0 += 1) { s0(c0); s1(c0); } diff --git a/test_inputs/codegen/omega/x-0.c b/test_inputs/codegen/omega/x-0.c index 820f71c2..f890920d 100644 --- a/test_inputs/codegen/omega/x-0.c +++ b/test_inputs/codegen/omega/x-0.c @@ -1,14 +1,14 @@ for (int c0 = 1; c0 <= 11; c0 += 1) { - for (int c1 = max(1, -c0 + 9); c1 <= min(-c0 + 12, c0 - 4); c1 += 1) - s0(c1, c0 + c1 - 8); - for (int c1 = max(c0 - 3, 1); c1 <= min(-c0 + 8, c0); c1 += 1) + for (int c1 = max(1, c0 - 3); c1 <= min(c0, -c0 + 8); c1 += 1) s1(c1, c0 - c1 + 1); - for (int c1 = max(c0 - 3, -c0 + 9); c1 <= min(-c0 + 12, c0); c1 += 1) { + for (int c1 = max(1, -c0 + 9); c1 <= min(c0 - 4, -c0 + 12); c1 += 1) + s0(c1, c0 + c1 - 8); + for (int c1 = max(c0 - 3, -c0 + 9); c1 <= min(c0, -c0 + 12); c1 += 1) { s0(c1, c0 + c1 - 8); s1(c1, c0 - c1 + 1); } for (int c1 = max(c0 - 3, -c0 + 13); c1 <= min(8, c0); c1 += 1) s1(c1, c0 - c1 + 1); - for (int c1 = max(c0 + 1, -c0 + 9); c1 <= min(-c0 + 12, 8); c1 += 1) + for (int c1 = max(c0 + 1, -c0 + 9); c1 <= min(8, -c0 + 12); c1 += 1) s0(c1, c0 + c1 - 8); } diff --git a/test_inputs/codegen/omega/x-1.c b/test_inputs/codegen/omega/x-1.c index 820f71c2..f890920d 100644 --- a/test_inputs/codegen/omega/x-1.c +++ b/test_inputs/codegen/omega/x-1.c @@ -1,14 +1,14 @@ for (int c0 = 1; c0 <= 11; c0 += 1) { - for (int c1 = max(1, -c0 + 9); c1 <= min(-c0 + 12, c0 - 4); c1 += 1) - s0(c1, c0 + c1 - 8); - for (int c1 = max(c0 - 3, 1); c1 <= min(-c0 + 8, c0); c1 += 1) + for (int c1 = max(1, c0 - 3); c1 <= min(c0, -c0 + 8); c1 += 1) s1(c1, c0 - c1 + 1); - for (int c1 = max(c0 - 3, -c0 + 9); c1 <= min(-c0 + 12, c0); c1 += 1) { + for (int c1 = max(1, -c0 + 9); c1 <= min(c0 - 4, -c0 + 12); c1 += 1) + s0(c1, c0 + c1 - 8); + for (int c1 = max(c0 - 3, -c0 + 9); c1 <= min(c0, -c0 + 12); c1 += 1) { s0(c1, c0 + c1 - 8); s1(c1, c0 - c1 + 1); } for (int c1 = max(c0 - 3, -c0 + 13); c1 <= min(8, c0); c1 += 1) s1(c1, c0 - c1 + 1); - for (int c1 = max(c0 + 1, -c0 + 9); c1 <= min(-c0 + 12, 8); c1 += 1) + for (int c1 = max(c0 + 1, -c0 + 9); c1 <= min(8, -c0 + 12); c1 += 1) s0(c1, c0 + c1 - 8); } diff --git a/test_inputs/codegen/pldi2012/figure7_c.c b/test_inputs/codegen/pldi2012/figure7_c.c index b372c862..d1ce579a 100644 --- a/test_inputs/codegen/pldi2012/figure7_c.c +++ b/test_inputs/codegen/pldi2012/figure7_c.c @@ -1,4 +1,4 @@ -for (int c0 = 1; c0 <= 100; c0 += 1) +for (int c0 = 1; c0 <= 100; c0 += 1) { if (n >= 2) { s0(c0); for (int c1 = 1; c1 <= 100; c1 += 1) { @@ -8,3 +8,4 @@ for (int c0 = 1; c0 <= 100; c0 += 1) } else for (int c1 = 1; c1 <= 100; c1 += 1) s2(c0, c1); +} diff --git a/test_inputs/codegen/separate2.c b/test_inputs/codegen/separate2.c new file mode 100644 index 00000000..b3c1ed46 --- /dev/null +++ b/test_inputs/codegen/separate2.c @@ -0,0 +1,9 @@ +if ((length - 1) % 16 <= 14) + for (int c0 = 0; c0 <= 1; c0 += 1) + for (int c5 = 0; c5 <= 31; c5 += 1) + for (int c6 = 0; c6 <= 30; c6 += 1) { + if ((2 * c5 - c6 + 31) % 32 == 31 && 2 * ((length - 1) % 16) + 2 * c5 == 2 * ((length - 1) % 32) + c6 && c6 + 62 >= 2 * ((length - 1) % 16) + 2 * c5 && 2 * length + c6 >= 2 * ((length - 1) % 16) + 4 && 2 * ((length - 1) % 16) >= c6 && 2 * ((length - 1) % 16) + 2 * c5 >= c6) + S_3(c0, 0, (c6 / 2) - ((length - 1) % 16) + length - 1); + if (length <= 16 && length >= c5 + 1 && c6 >= 1 && length >= c6) + S_0(c0, c5, c6 - 1); + } diff --git a/test_inputs/codegen/separate2.in b/test_inputs/codegen/separate2.in new file mode 100644 index 00000000..8f4ebf1a --- /dev/null +++ b/test_inputs/codegen/separate2.in @@ -0,0 +1,4 @@ +# Check that rational affine expressions are printer properly. +[tsteps, length] -> { S_0[iter, i, j] -> [iter, 0, o2, o3, 0, o5, o6, 4] : exists (e0 = [(o2)/32], e1 = [(o3)/32], e2 = [(-i + o5)/32], e3 = [(-31 + j - o6)/32]: tsteps = 2 and 32e0 = o2 and 32e1 = o3 and 32e2 = -i + o5 and 32e3 = -31 + j - o6 and o2 <= i and o2 >= -31 + i and o3 <= 1 + j and o3 >= -30 + j and o5 >= 0 and o5 <= 31 and o6 >= 0 and o6 <= 31 and i <= -1 + length and i >= 0 and iter >= 0 and iter <= 1 and j <= -1 + length and j >= 0 and o2 >= -31 + length and o3 >= -30 + 2length); S_3[iter, 0, j] -> [iter, 0, o2, o3, o4, o5, o6, 2] : exists (e0 = [(o2)/32], e1 = [(o3)/32], e2 = [(o4)/32], e3 = [(-2o5 + o6)/32], e4 = [(j - o5)/32]: tsteps = 2 and 32e0 = o2 and 32e1 = o3 and 32e2 = o4 and 32e3 = -2o5 + o6 and 32e4 = j - o5 and iter <= 1 and j <= -1 + length and o2 <= j and o2 >= -31 + j and o3 <= 2j and o3 >= -30 + 2j and o4 >= 0 and o4 <= 31 and o5 >= 0 and o5 <= 31 and o6 >= 0 and o6 <= 30 and j >= 1 and iter >= 0 and o2 >= -31 + length and o3 >= -30 + 2length) } +[tsteps, length] -> { : length >= 1 and length <= 1024 and tsteps = 2 } +{ [o0,o1,o2,o3,o4,o5,o6,o7] -> separate[x] } diff --git a/test_inputs/codegen/separation_class.c b/test_inputs/codegen/separation_class.c index 1a1810c8..daac0d76 100644 --- a/test_inputs/codegen/separation_class.c +++ b/test_inputs/codegen/separation_class.c @@ -12,6 +12,6 @@ for (int c0 = 9; c0 <= 10; c0 += 1) for (int c1 = 0; c1 <= -c0 + 10; c1 += 1) for (int c2 = 10 * c0; c2 <= min(10 * c0 + 9, -10 * c1 + 100); c2 += 1) - for (int c3 = 10 * c1; c3 <= min(-c2 + 100, 10 * c1 + 9); c3 += 1) + for (int c3 = 10 * c1; c3 <= min(10 * c1 + 9, -c2 + 100); c3 += 1) A(c2, c3); } diff --git a/test_inputs/codegen/separation_class2.c b/test_inputs/codegen/separation_class2.c index 2bddda28..3ea48aff 100644 --- a/test_inputs/codegen/separation_class2.c +++ b/test_inputs/codegen/separation_class2.c @@ -10,6 +10,6 @@ } for (int c1 = 0; c1 < n; c1 += 8) for (int c2 = 0; c2 < n % 8; c2 += 1) - for (int c3 = 0; c3 <= min(n - c1 - 1, 7); c3 += 1) + for (int c3 = 0; c3 <= min(7, n - c1 - 1); c3 += 1) A(-((n - 1) % 8) + n + c2 - 1, c1 + c3); } diff --git a/test_inputs/codegen/separation_class3.c b/test_inputs/codegen/separation_class3.c index 136cd07a..9731c770 100644 --- a/test_inputs/codegen/separation_class3.c +++ b/test_inputs/codegen/separation_class3.c @@ -11,7 +11,7 @@ for (int c0 = 0; c0 <= 4; c0 += 1) { for (int c6 = -2 * c0 + c4 + 4; c6 <= 2 * c0 - c4 + 4; c6 += 1) S_0(c4, c6); } - for (int c4 = max(2 * c0 - 1, 0); c4 <= min(7, 2 * c0); c4 += 1) + for (int c4 = max(0, 2 * c0 - 1); c4 <= min(7, 2 * c0); c4 += 1) for (int c6 = -2 * c0 + c4 + 8; c6 <= 8; c6 += 1) S_0(c4, c6); if (c0 <= 3 && c0 >= 1) { diff --git a/test_inputs/codegen/separation_class4.c b/test_inputs/codegen/separation_class4.c new file mode 100644 index 00000000..2ff23642 --- /dev/null +++ b/test_inputs/codegen/separation_class4.c @@ -0,0 +1,20 @@ +for (int c0 = 0; c0 <= 128; c0 += 1) { + if (c0 <= 127) { + if (c0 == 0) { + for (int c3 = 0; c3 <= 1; c3 += 1) + for (int c5 = c3 + 58; c5 <= -c3 + 61; c5 += 1) + S_0(c3, c5); + } else + for (int c2 = 1; c2 <= 2; c2 += 1) + for (int c3 = max(4 * c0 - 2, 4 * c0 + 6 * c2 - 12); c3 <= min(4 * c0 + 1, 4 * c0 + 6 * c2 - 7); c3 += 1) + for (int c5 = max(4 * c0 - c3 + 57, -4 * c0 + c3 + 58); c5 <= min(4 * c0 - c3 + 61, -4 * c0 + c3 + 62); c5 += 1) + S_0(c3, c5); + for (int c2 = 1; c2 <= 2; c2 += 1) + for (int c3 = max(4 * c0, 4 * c0 + 6 * c2 - 10); c3 <= min(4 * c0 + 3, 4 * c0 + 6 * c2 - 5); c3 += 1) + for (int c5 = max(-4 * c0 + c3 + 59, 4 * c0 - c3 + 62); c5 <= min(-4 * c0 + c3 + 63, 4 * c0 - c3 + 66); c5 += 1) + S_0(c3, c5); + } else + for (int c3 = 510; c3 <= 511; c3 += 1) + for (int c5 = -c3 + 569; c5 < c3 - 449; c5 += 1) + S_0(c3, c5); +} diff --git a/test_inputs/codegen/separation_class4.in b/test_inputs/codegen/separation_class4.in new file mode 100644 index 00000000..c04dd79b --- /dev/null +++ b/test_inputs/codegen/separation_class4.in @@ -0,0 +1,10 @@ +# Check that isl is not confused by the combination of separation classes +# and unroll. +{ S_0[t, i] -> [o0, 1, o9, t] : 4o0 >= -3 + t and 4o0 <= t and i >= 60 and i <= 65 and 6o9 >= 5 + t - 4o0 and 6o9 <= 10 + t - 4o0 and 4o0 <= -62 + t + i and 4o0 >= 59 + t - i and o0 >= 0 and o0 <= 127 and t <= 511 and t >= 0 and 4o0 >= -66 + t + i and 4o0 <= 63 + t - i; +S_0[t, i] -> [o0, 0, o9, t] : 4o0 >= -1 + t and 4o0 <= 2 + t and i >= 57 and i <= 62 and 6o9 >= 7 + t - 4o0 and 6o9 <= 12 + t - 4o0 and t >= 0 and t <= 511 and 4o0 <= -57 + t + i and 4o0 >= 58 + t - i and o0 >= 0 and o0 <= 128 and 4o0 >= -61 + t + i and 4o0 <= 62 + t - i } +{ : } +{ [i0, i1, i2, t] -> unroll[1]; +[i0, 1, i2, t] -> separation_class[[1] -> [0]] + : 0 <= i0 <= 127; +[i0, 0, i2, t] -> separation_class[[1] -> [0]] + : 1 <= i0 <= 127} diff --git a/test_inputs/codegen/shift2.c b/test_inputs/codegen/shift2.c new file mode 100644 index 00000000..3ee58f5f --- /dev/null +++ b/test_inputs/codegen/shift2.c @@ -0,0 +1,42 @@ +for (int c0 = 0; c0 <= 1; c0 += 1) { + for (int c2 = 0; c2 < length; c2 += 32) { + for (int c3 = 0; c3 <= length; c3 += 32) { + for (int c5 = 0; c5 <= min(31, length - c2 - 1); c5 += 1) { + for (int c6 = max(0, -c3 + 1); c6 <= min(min(31, length - c3), 2 * c2 - c3 + 2 * c5 - 1); c6 += 1) + S_0(c0, c2 + c5, c3 + c6 - 1); + if (c3 + 30 >= 2 * c2 + 2 * c5 && 2 * c2 + 2 * c5 >= c3 && c2 + c5 >= 1) { + S_3(c0, 0, c2 + c5); + if (length >= 2 * c2 + 2 * c5) + S_0(c0, c2 + c5, 2 * c2 + 2 * c5 - 1); + } + for (int c6 = max(0, 2 * c2 - c3 + 2 * c5 + 1); c6 <= min(31, length - c3); c6 += 1) + S_0(c0, c2 + c5, c3 + c6 - 1); + } + if (c3 == 0 && c2 == 0 && length <= 15) + S_4(c0); + if (2 * c2 + 32 >= c3 && c3 >= 2 * c2) + for (int c4 = 1; c4 <= min(min(31, length - 2), (c3 / 2) + 14); c4 += 1) + for (int c5 = max((c3 / 2) - c2, -c2 + c4 + 1); c5 <= min(length - c2 - 1, (c3 / 2) - c2 + 15); c5 += 1) + S_3(c0, c4, c2 + c5); + } + for (int c3 = max(2 * c2, -(length % 32) + length + 32); c3 <= min(2 * length - 2, 2 * c2 + 62); c3 += 32) + for (int c4 = 0; c4 <= min(31, length - 2); c4 += 1) { + for (int c5 = max((c3 / 2) - c2, -c2 + c4 + 1); c5 <= min(length - c2 - 1, (c3 / 2) - c2 + 15); c5 += 1) + S_3(c0, c4, c2 + c5); + if (c4 == 0 && c3 + 30 >= 2 * length) + S_4(c0); + } + if ((length + 16) % 32 == 0 && c2 + 16 == length) + S_4(c0); + } + if (length % 32 == 0 && length >= 32) + S_4(c0); + if (length == 0) + S_4(c0); + for (int c1 = 32; c1 < length - 1; c1 += 32) + for (int c2 = c1; c2 < length; c2 += 32) + for (int c3 = max(c1, c2); c3 <= min(length - 1, c2 + 31); c3 += 16) + for (int c4 = 0; c4 <= min(min(31, length - c1 - 2), -c1 + c3 + 14); c4 += 1) + for (int c5 = max(-c2 + c3, c1 - c2 + c4 + 1); c5 <= min(length - c2 - 1, -c2 + c3 + 15); c5 += 1) + S_3(c0, c1 + c4, c2 + c5); +} diff --git a/test_inputs/codegen/shift2.in b/test_inputs/codegen/shift2.in new file mode 100644 index 00000000..3c05fac3 --- /dev/null +++ b/test_inputs/codegen/shift2.in @@ -0,0 +1,5 @@ +# Check that the shifting code is not confused by domains that +# have a non-obviously fixed value. +[tsteps, length] -> { S_4[iter] -> [iter, 0, o2, o3, 0, o5, o6, 3] : exists (e0 = [(o2)/32], e1 = [(o3)/32], e2 = [(-length + o5)/32], e3 = [(-2length + o6)/32]: tsteps = 2 and 32e0 = o2 and 32e1 = o3 and 32e2 = -length + o5 and 32e3 = -2length + o6 and o2 <= length and o2 >= -31 + length and o3 <= 2length and o3 >= -30 + 2length and o5 >= 0 and o5 <= 31 and o6 >= 0 and o6 <= 30 and iter <= 1 and iter >= 0); S_3[iter, i, j] -> [iter, o1, o2, o3, o4, o5, o6, 2] : exists (e0 = [(o1)/32], e1 = [(o2)/32], e2 = [(o3)/32], e3 = [(-i + o4)/32], e4 = [(-j + o5)/32], e5 = [(-2j + o6)/32]: tsteps = 2 and 32e0 = o1 and 32e1 = o2 and 32e2 = o3 and 32e3 = -i + o4 and 32e4 = -j + o5 and 32e5 = -2j + o6 and o1 <= i and o1 >= -31 + i and o2 <= j and o2 >= -31 + j and o3 <= 2j and o3 >= -30 + 2j and o4 >= 0 and o4 <= 31 and o5 >= 0 and o5 <= 31 and o6 >= 0 and o6 <= 30 and j >= 1 + i and i >= 0 and iter <= 1 and iter >= 0 and j <= -1 + length); S_0[iter, i, j] -> [iter, 0, o2, o3, 0, o5, o6, 4] : exists (e0 = [(o2)/32], e1 = [(o3)/32], e2 = [(-i + o5)/32], e3 = [(-31 + j - o6)/32]: tsteps = 2 and 32e0 = o2 and 32e1 = o3 and 32e2 = -i + o5 and 32e3 = -31 + j - o6 and o2 <= i and o2 >= -31 + i and o3 <= 1 + j and o3 >= -30 + j and o5 >= 0 and o5 <= 31 and o6 >= 0 and o6 <= 31 and i <= -1 + length and i >= 0 and iter >= 0 and iter <= 1 and j <= -1 + length and j >= 0) } +[tsteps, length] -> { : length >= 0 and length <= 1024 and tsteps = 2 } +{ } diff --git a/test_inputs/codegen/single_valued.c b/test_inputs/codegen/single_valued.c index 64127842..e071002b 100644 --- a/test_inputs/codegen/single_valued.c +++ b/test_inputs/codegen/single_valued.c @@ -1,2 +1,2 @@ -if (2 * (63 * t1 % 64) + t1 <= 134) +if (2 * ((t1 - 1) % 64) + 8 >= t1) S(-(2 * ((t1 - 1) % 64)) + t1 + 126); diff --git a/test_inputs/codegen/stride5.c b/test_inputs/codegen/stride5.c index 080bea07..37b9052a 100644 --- a/test_inputs/codegen/stride5.c +++ b/test_inputs/codegen/stride5.c @@ -1,3 +1,3 @@ if (2 * floord(n, 2) == n) - for (int c0 = (n + 4 * floord(-n - 1, 4) + 4) / 2; c0 <= 100; c0 += 2) + for (int c0 = (n / 2) + 2 * floord(-n - 1, 4) + 2; c0 <= 100; c0 += 2) S(c0); diff --git a/test_inputs/codegen/stride6.c b/test_inputs/codegen/stride6.c index a7f60821..c09e8b54 100644 --- a/test_inputs/codegen/stride6.c +++ b/test_inputs/codegen/stride6.c @@ -1,4 +1,4 @@ for (int c1 = -1024; c1 <= 0; c1 += 32) - for (int c2 = max(-((niter - c1) % 32) + niter - c1 - 32, -((niter - 1) % 32) + niter - 1); c2 <= min(niter + 1022, niter - c1 - 1); c2 += 32) - for (int c5 = max(max(niter - c1 - c2 - 32, -c1 - 1023), 0); c5 <= min(min(-c1, niter - c1 - c2 - 1), 31); c5 += 1) + for (int c2 = max(-((niter - 1) % 32) + niter - 1, -((niter - c1) % 32) + niter - c1 - 32); c2 <= min(niter + 1022, niter - c1 - 1); c2 += 32) + for (int c5 = max(max(0, -c1 - 1023), niter - c1 - c2 - 32); c5 <= min(min(31, -c1), niter - c1 - c2 - 1); c5 += 1) S_4(niter - 1, -c1 - c5); diff --git a/test_inputs/codegen/unroll3.c b/test_inputs/codegen/unroll3.c index 95a30ba7..b67fb502 100644 --- a/test_inputs/codegen/unroll3.c +++ b/test_inputs/codegen/unroll3.c @@ -1,2 +1,2 @@ -if ((t1 + 121) % 128 <= 123) +if ((t1 + 125) % 128 >= 4) write_shared_A(((t1 + 125) % 128) - 3); diff --git a/test_inputs/codegen/unroll4.c b/test_inputs/codegen/unroll4.c index 8bed4a22..3fa1e191 100644 --- a/test_inputs/codegen/unroll4.c +++ b/test_inputs/codegen/unroll4.c @@ -1,20 +1,20 @@ { write_shared_A(3, ((t1 + 3) % 4) + 1, ((t2 + 31) % 32) + 1); if (t1 % 3 == 0 && t2 >= 1 && t2 <= 2) - write_shared_A(3, (-t1 + 12) / 3, t2 + 32); + write_shared_A(3, (-t1 / 3) + 4, t2 + 32); { int c3 = ((t1 + 3) % 4) + 1 >= t2 && t2 >= 2 && t2 <= 33 ? t2 + 32 : ((t2 + 30) % 32) + 2; - if (c3 == t2 + 32 || (c3 == t2 && ((-t1 + 8) % 4) + t2 >= ((t2 + 1) % 2) + 5)) + if (c3 == t2 + 32 || (c3 == t2 && t2 >= ((t1 + 3) % 4) + ((t2 + 1) % 2) + 2)) write_shared_A(3, ((t1 + 3) % 4) + 5, c3); } if (t2 >= t1 + 1 && t2 <= 4 && t1 >= 1) write_shared_A(3, t1 + 4, t2 + 32); write_shared_A(4, ((t1 + 3) % 4) + 1, ((t2 + 31) % 32) + 1); if (t1 % 3 == 0 && t2 >= 1 && t2 <= 2) - write_shared_A(4, (-t1 + 12) / 3, t2 + 32); + write_shared_A(4, (-t1 / 3) + 4, t2 + 32); { int c3 = ((t1 + 3) % 4) + 1 >= t2 && t2 >= 2 && t2 <= 33 ? t2 + 32 : ((t2 + 30) % 32) + 2; - if (c3 == t2 + 32 || (c3 == t2 && ((-t1 + 8) % 4) + t2 >= ((t2 + 1) % 2) + 5)) + if (c3 == t2 + 32 || (c3 == t2 && t2 >= ((t1 + 3) % 4) + ((t2 + 1) % 2) + 2)) write_shared_A(4, ((t1 + 3) % 4) + 5, c3); } if (t2 >= t1 + 1 && t2 <= 4 && t1 >= 1) diff --git a/test_inputs/codegen/unroll6.c b/test_inputs/codegen/unroll6.c index 1b78a17b..2594dbaa 100644 --- a/test_inputs/codegen/unroll6.c +++ b/test_inputs/codegen/unroll6.c @@ -1,5 +1,5 @@ { - if (((-t1 + 128) % 128) + nn >= 128 * g + 130 && 128 * g + 127 >= (-t1 + 128) % 128 && nn >= 128 * g + 6) + if (nn >= ((t1 + 127) % 128) + 128 * g + 3 && ((t1 + 127) % 128) + 128 * g >= 0 && nn >= 128 * g + 6) for (int c1 = 393214; c1 < nn - 1; c1 += 393216) A(c1, ((t1 + 127) % 128) + 128 * g + 1, ((t1 + 127) % 128) + 1); if (nn >= t1 + 128 * g + 130 && t1 + 128 * g >= -127 && t1 <= 2 && t1 >= 1) |