From 6702e592cfb0d6f895b810c715e053c99c528c30 Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Thu, 23 Jan 2014 14:52:48 +0100 Subject: [PATCH] isl_ast_build_ast_from_schedule: sort lower and upper bounds of for loops The order used to sort the bounds is not meant to have any specific impact. However, by sorting the lower and upper bounds, the generated output should hopefully depend a bit less on changes to the internal representation of the isl sets. Signed-off-by: Sven Verdoolaege --- isl_ast_codegen.c | 24 +++++++++++++++++-- test_inputs/codegen/cloog/4-param.c | 6 ++--- test_inputs/codegen/cloog/christian.c | 4 ++-- test_inputs/codegen/cloog/classen.c | 4 ++-- test_inputs/codegen/cloog/classen2.c | 8 +++---- test_inputs/codegen/cloog/constant.c | 4 ++-- test_inputs/codegen/cloog/darte.c | 2 +- test_inputs/codegen/cloog/dealII.c | 2 +- test_inputs/codegen/cloog/dot2.c | 2 +- test_inputs/codegen/cloog/jacobi-shared.c | 2 +- test_inputs/codegen/cloog/min-1-1.c | 2 +- test_inputs/codegen/cloog/min-2-1.c | 4 ++-- test_inputs/codegen/cloog/min-3-1.c | 4 ++-- test_inputs/codegen/cloog/min-4-1.c | 2 +- test_inputs/codegen/cloog/mod3.c | 2 +- test_inputs/codegen/cloog/mode.c | 2 +- test_inputs/codegen/cloog/mxm-shared.c | 4 ++-- test_inputs/codegen/cloog/nul_complex1.c | 2 +- test_inputs/codegen/cloog/otl.c | 14 +++++------ test_inputs/codegen/cloog/pouchet.c | 2 +- test_inputs/codegen/cloog/rectangle.c | 2 +- test_inputs/codegen/cloog/reservoir-cholesky2.c | 6 ++--- test_inputs/codegen/cloog/reservoir-lim-lam1.c | 2 +- test_inputs/codegen/cloog/reservoir-lim-lam3.c | 6 ++--- test_inputs/codegen/cloog/reservoir-lim-lam4.c | 6 ++--- test_inputs/codegen/cloog/reservoir-loechner3.c | 2 +- test_inputs/codegen/cloog/reservoir-loechner4.c | 2 +- test_inputs/codegen/cloog/reservoir-tang-xue1.c | 4 ++-- test_inputs/codegen/cloog/stride3.c | 2 +- test_inputs/codegen/cloog/thomasset.c | 2 +- test_inputs/codegen/cloog/tiling.c | 2 +- test_inputs/codegen/cloog/vivien.c | 6 ++--- test_inputs/codegen/cloog/vivien2.c | 4 ++-- test_inputs/codegen/cloog/wavefront.c | 2 +- test_inputs/codegen/omega/basics-1.c | 2 +- test_inputs/codegen/omega/code_gen-1.c | 2 +- test_inputs/codegen/omega/hpf-0.c | 2 +- test_inputs/codegen/omega/iter8-0.c | 2 +- test_inputs/codegen/omega/lefur00-0.c | 10 ++++---- test_inputs/codegen/omega/lefur01-0.c | 10 ++++---- test_inputs/codegen/omega/lefur01-1.c | 10 ++++---- test_inputs/codegen/omega/lefur03-0.c | 14 +++++------ test_inputs/codegen/omega/lefur04-0.c | 16 ++++++------- test_inputs/codegen/omega/lu-0.c | 4 ++-- test_inputs/codegen/omega/lu-1.c | 4 ++-- test_inputs/codegen/omega/lu-2.c | 4 ++-- test_inputs/codegen/omega/lu-3.c | 6 ++--- test_inputs/codegen/omega/lu_spmd-0.c | 2 +- test_inputs/codegen/omega/lu_spmd-1.c | 2 +- test_inputs/codegen/omega/m11-0.c | 4 ++-- test_inputs/codegen/omega/m3-0.c | 2 +- test_inputs/codegen/omega/p.delft-0.c | 2 +- test_inputs/codegen/omega/p6-1.c | 2 +- test_inputs/codegen/omega/stride2-0.c | 2 +- test_inputs/codegen/omega/stride3-0.c | 2 +- test_inputs/codegen/omega/stride5-0.c | 2 +- test_inputs/codegen/omega/syr2k-0.c | 6 ++--- test_inputs/codegen/omega/syr2k-1.c | 4 ++-- test_inputs/codegen/omega/syr2k-2.c | 6 ++--- test_inputs/codegen/omega/syr2k-3.c | 4 ++-- test_inputs/codegen/omega/ts1d-check-sblock-0.c | 2 +- test_inputs/codegen/omega/ts1d-check0-0.c | 2 +- test_inputs/codegen/omega/ts1d-mp-i_ts-m_b-0.c | 16 ++++++------- test_inputs/codegen/omega/wak1-0.c | 8 +++---- test_inputs/codegen/omega/wak1-1.c | 32 ++++++++++++------------- test_inputs/codegen/omega/wak2-0.c | 8 +++---- test_inputs/codegen/omega/wak2-1.c | 14 +++++------ test_inputs/codegen/omega/wak3-1.c | 6 ++--- test_inputs/codegen/omega/wak4-0.c | 2 +- test_inputs/codegen/omega/wak4-1.c | 2 +- test_inputs/codegen/omega/x-0.c | 8 +++---- test_inputs/codegen/omega/x-1.c | 8 +++---- test_inputs/codegen/separation_class.c | 2 +- test_inputs/codegen/separation_class2.c | 2 +- test_inputs/codegen/separation_class3.c | 2 +- test_inputs/codegen/separation_class4.c | 8 +++---- test_inputs/codegen/shift2.c | 14 +++++------ test_inputs/codegen/stride6.c | 4 ++-- 78 files changed, 215 insertions(+), 195 deletions(-) rewrite test_inputs/codegen/cloog/classen2.c (94%) rewrite test_inputs/codegen/cloog/otl.c (81%) rewrite test_inputs/codegen/omega/lefur00-0.c (67%) rewrite test_inputs/codegen/omega/lefur01-0.c (67%) rewrite test_inputs/codegen/omega/lefur01-1.c (79%) rewrite test_inputs/codegen/omega/lefur03-0.c (83%) rewrite test_inputs/codegen/omega/lefur04-0.c (76%) diff --git a/isl_ast_codegen.c b/isl_ast_codegen.c index 13c40c60..235e651d 100644 --- a/isl_ast_codegen.c +++ b/isl_ast_codegen.c @@ -1,5 +1,5 @@ /* - * Copyright 2012 Ecole Normale Superieure + * Copyright 2012-2014 Ecole Normale Superieure * * Use of this software is governed by the MIT license * @@ -515,12 +515,22 @@ static __isl_give isl_pw_aff_list *upper_bounds( return list; } +/* Callback for sorting the isl_pw_aff_list passed to reduce_list. + */ +static int reduce_list_cmp(__isl_keep isl_pw_aff *a, __isl_keep isl_pw_aff *b, + void *user) +{ + return isl_pw_aff_plain_cmp(a, b); +} + /* Return an isl_ast_expr that performs the reduction of type "type" * on AST expressions corresponding to the elements in "list". * * The list is assumed to contain at least one element. * If the list contains exactly one element, then the returned isl_ast_expr * simply computes that affine expression. + * If the list contains more than one element, then we sort it + * using a fairly abitrary but hopefully reasonably stable order. */ static __isl_give isl_ast_expr *reduce_list(enum isl_ast_op_type type, __isl_keep isl_pw_aff_list *list, __isl_keep isl_ast_build *build) @@ -543,17 +553,27 @@ static __isl_give isl_ast_expr *reduce_list(enum isl_ast_op_type type, if (!expr) return NULL; + list = isl_pw_aff_list_copy(list); + list = isl_pw_aff_list_sort(list, &reduce_list_cmp, NULL); + if (!list) + return isl_ast_expr_free(expr); + for (i = 0; i < n; ++i) { isl_ast_expr *expr_i; expr_i = isl_ast_build_expr_from_pw_aff_internal(build, isl_pw_aff_list_get_pw_aff(list, i)); if (!expr_i) - return isl_ast_expr_free(expr); + goto error; expr->u.op.args[i] = expr_i; } + isl_pw_aff_list_free(list); return expr; +error: + isl_pw_aff_list_free(list); + isl_ast_expr_free(expr); + return NULL; } /* Add a guard to "graft" based on "bound" in the case of a degenerate 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..64bf9cf7 100644 --- a/test_inputs/codegen/cloog/classen.c +++ b/test_inputs/codegen/cloog/classen.c @@ -26,7 +26,7 @@ S4(c0, 1, c0 + 2, 2, c0 + 1, 1, c0 + 2, 2); S2(c0, 1, c0 + 1, 1, c0 + 1, 1, c0 + 2, 1); } - 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 dissimilarity index 94% 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) - S1(c0 - c1 + 1, -c0 + c1 + c2 - 2, c1 - c2, c0, c1, c2); +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 4f2ca915..acb63714 100644 --- a/test_inputs/codegen/cloog/darte.c +++ b/test_inputs/codegen/cloog/darte.c @@ -2,7 +2,7 @@ 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) - 1); - for (int c1 = max(c0 + 2, -c0 + 4); c1 <= min(2 * n + c0, 2 * n - c0); c1 += 2) { + 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) 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/jacobi-shared.c b/test_inputs/codegen/cloog/jacobi-shared.c index 99197cd3..74193cdd 100644 --- a/test_inputs/codegen/cloog/jacobi-shared.c +++ b/test_inputs/codegen/cloog/jacobi-shared.c @@ -1,3 +1,3 @@ if ((h0 + 1) % 2 == 0 && 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) + 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 825793d6..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, -((5 * n - c0 + 1) % 2) - n + c0 + 1); c1 <= min(c0, n + c0 - (n + c0 + 2) / 3); c1 += 2) + 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 dissimilarity index 81% 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) - S1(c0, c1, c2, c3, c4, c2); +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(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 69027eaf..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); 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 e036a3c0..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) + 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 9e9e1796..d8a80d66 100644 --- a/test_inputs/codegen/cloog/reservoir-lim-lam1.c +++ b/test_inputs/codegen/cloog/reservoir-lim-lam1.c @@ -1,7 +1,7 @@ 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) { + 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); } 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-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/vivien.c b/test_inputs/codegen/cloog/vivien.c index b0a8fd46..ee4887e8 100644 --- a/test_inputs/codegen/cloog/vivien.c +++ b/test_inputs/codegen/cloog/vivien.c @@ -1,7 +1,7 @@ { 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) { @@ -12,7 +12,7 @@ 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) @@ -46,7 +46,7 @@ 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 = n + 30; c0 <= 2 * n; c0 += 1) { diff --git a/test_inputs/codegen/cloog/vivien2.c b/test_inputs/codegen/cloog/vivien2.c index 5b34efcb..116c910e 100644 --- a/test_inputs/codegen/cloog/vivien2.c +++ b/test_inputs/codegen/cloog/vivien2.c @@ -13,7 +13,7 @@ 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) @@ -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) { 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/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/hpf-0.c b/test_inputs/codegen/omega/hpf-0.c index d4e088bf..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 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/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/lefur00-0.c b/test_inputs/codegen/omega/lefur00-0.c dissimilarity index 67% 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) - s0(c0, c1, c2, c3); +for (int c0 = 0; c0 <= 15; c0 += 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 dissimilarity index 67% 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) - s0(c0, c1, c2, c3); +for (int c0 = 0; c0 <= 15; c0 += 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 dissimilarity index 79% 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) - s0(c0, c1, c2, c3); +for (int c0 = 0; c0 <= 15; c0 += 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 dissimilarity index 83% 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) - s0(c0, c1, c2, c3, c4, c5); +for (int c0 = 0; c0 <= 3; c0 += 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 dissimilarity index 76% 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 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) - s0(c0, c1, c2, c3, c2 / 3, c5, c6, c7); +for (int c0 = 0; c0 <= 3; c0 += 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(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/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/m11-0.c b/test_inputs/codegen/omega/m11-0.c index e7046f73..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(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(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 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/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/p.delft-0.c b/test_inputs/codegen/omega/p.delft-0.c index d4e088bf..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 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/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/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 56a10ca2..c70e95bc 100644 --- a/test_inputs/codegen/omega/ts1d-check-sblock-0.c +++ b/test_inputs/codegen/omega/ts1d-check-sblock-0.c @@ -9,6 +9,6 @@ } 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 5639a733..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 @@ -10,22 +10,22 @@ } 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..8ac39342 100644 --- a/test_inputs/codegen/omega/wak1-0.c +++ b/test_inputs/codegen/omega/wak1-0.c @@ -1,12 +1,12 @@ { - 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 = a3; c0 <= min(a1 - 1, b3); c0 += 1) { 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(a3, b3 + 1), a2); c0 <= min(a1 - 1, b2); c0 += 1) s1(c0); for (int c0 = a1; c0 <= b1; c0 += 1) { s0(c0); @@ -15,7 +15,7 @@ if (b3 >= c0 && c0 >= a3) s2(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, b1 + 1), a3); c0 <= b3; c0 += 1) { if (c0 >= a2 && b2 >= c0) diff --git a/test_inputs/codegen/omega/wak1-1.c b/test_inputs/codegen/omega/wak1-1.c index a925f613..a423d863 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) + for (int c0 = a3; c0 <= min(min(a1 - 1, b3), a2 - 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 = 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) + for (int c0 = max(max(a3, a2), b2 + 1); c0 <= min(a1 - 1, b3); 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) { + 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(a2 - 1, b3); c0 += 1) + for (int c0 = max(max(a1, b1 + 1), a3); c0 <= min(b3, a2 - 1); 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(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(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 56fc8a6e..cc203577 100644 --- a/test_inputs/codegen/omega/wak2-1.c +++ b/test_inputs/codegen/omega/wak2-1.c @@ -1,9 +1,9 @@ { - 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 @@ -15,17 +15,17 @@ 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); } } 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..3abd5c37 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) + 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, 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(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..3abd5c37 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) + 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, 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(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/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 index 4b10b5ca..2ff23642 100644 --- a/test_inputs/codegen/separation_class4.c +++ b/test_inputs/codegen/separation_class4.c @@ -6,12 +6,12 @@ for (int c0 = 0; c0 <= 128; c0 += 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 + 6 * c2 - 7, 4 * c0 + 1); c3 += 1) - for (int c5 = max(4 * c0 - c3 + 57, -4 * c0 + c3 + 58); c5 <= min(-4 * c0 + c3 + 62, 4 * c0 - c3 + 61); c5 += 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 + 6 * c2 - 10, 4 * c0); c3 <= min(4 * c0 + 6 * c2 - 5, 4 * c0 + 3); c3 += 1) - for (int c5 = max(4 * c0 - c3 + 62, -4 * c0 + c3 + 59); c5 <= min(4 * c0 - c3 + 66, -4 * c0 + c3 + 63); c5 += 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) diff --git a/test_inputs/codegen/shift2.c b/test_inputs/codegen/shift2.c index beffb463..5bb8b3f4 100644 --- a/test_inputs/codegen/shift2.c +++ b/test_inputs/codegen/shift2.c @@ -4,10 +4,10 @@ for (int c0 = 0; c0 <= 1; c0 += 1) { if (c1 == 0) for (int c3 = 0; c3 <= min(length, 2 * c2 - 32); c3 += 32) for (int c5 = 0; c5 <= min(31, length - c2 - 1); c5 += 1) - for (int c6 = max(-c3 + 1, 0); c6 <= min(31, length - c3); c6 += 1) + for (int c6 = max(0, -c3 + 1); c6 <= min(31, length - c3); c6 += 1) S_0(c0, c2 + c5, c3 + c6 - 1); - for (int c3 = max(2 * c1, 2 * c2); c3 <= min(2 * c2 + 62, 2 * length - 2); c3 += 32) - for (int c4 = 0; c4 <= min(min(length - c1 - 2, (c3 / 2) - c1 + 14), 31); c4 += 1) { + for (int c3 = max(2 * c1, 2 * c2); c3 <= min(2 * length - 2, 2 * c2 + 62); c3 += 32) + for (int c4 = 0; c4 <= min(min(31, length - c1 - 2), (c3 / 2) - c1 + 14); c4 += 1) { if (c4 == 0 && c3 == 0 && c2 == 0 && c1 == 0) { for (int c6 = 1; c6 <= min(31, length); c6 += 1) S_0(c0, 0, c6 - 1); @@ -15,21 +15,21 @@ for (int c0 = 0; c0 <= 1; c0 += 1) { for (int c5 = 0; c5 <= 15; c5 += 1) for (int c6 = 0; c6 <= min(31, length - 2 * c2 - 32); c6 += 1) S_0(c0, c2 + c5, 2 * c2 + c6 + 31); - for (int c5 = max((c3 / 2) - c2, c1 - c2 + c4 + 1); c5 <= min((c3 / 2) - c2 + 15, length - c2 - 1); c5 += 1) { + for (int c5 = max((c3 / 2) - c2, c1 - c2 + c4 + 1); c5 <= min(length - c2 - 1, (c3 / 2) - c2 + 15); c5 += 1) { if (c4 == 0 && c1 == 0) - for (int c6 = max(-c3 + 1, 0); c6 <= min(2 * c2 - c3 + 2 * c5 - 1, length - c3); c6 += 1) + for (int c6 = max(0, -c3 + 1); c6 <= min(length - c3, 2 * c2 - c3 + 2 * c5 - 1); c6 += 1) S_0(c0, c2 + c5, c3 + c6 - 1); S_3(c0, c1 + c4, c2 + c5); if (c4 == 0 && c1 == 0 && length >= 2 * c2 + 2 * c5) S_0(c0, c2 + c5, 2 * c2 + 2 * c5 - 1); if (c4 == 0 && c1 == 0) - for (int c6 = 2 * c2 - c3 + 2 * c5 + 1; c6 <= min(length - c3, 31); c6 += 1) + for (int c6 = 2 * c2 - c3 + 2 * c5 + 1; c6 <= min(31, length - c3); c6 += 1) S_0(c0, c2 + c5, c3 + c6 - 1); } if (c4 == 0 && c1 == 0 && c3 + 30 >= 2 * length) S_4(c0); if (c4 == 0 && c3 == 2 * c2 && c1 == 0) - for (int c5 = 16; c5 <= min(length - c2 - 1, 31); c5 += 1) + for (int c5 = 16; c5 <= min(31, length - c2 - 1); c5 += 1) for (int c6 = max(0, -2 * c2 + 1); c6 <= min(31, length - 2 * c2); c6 += 1) S_0(c0, c2 + c5, 2 * c2 + c6 - 1); } 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); -- 2.11.4.GIT