From 39d7b91232de7df496918407fab545a797ebe79b Mon Sep 17 00:00:00 2001 From: Sven Verdoolaege Date: Fri, 7 Dec 2012 17:51:13 +0100 Subject: [PATCH] isl_hash_dim: make result independent of endianness The result computed by isl_hash_dim may affect the order of maps in a union map, which may in turn affect the result of AST generation. In particular, we would generate slightly different output depending on endianness, causing the tests to fail on big endian machines since the generated output is compared to output generated on a little endian machine. Instead of hashing in the dimensions of the space as integers, we now only hash in the least significant byte. This has some effect on the results of AST generation, but the output should now be the same on little endian and big endian. Reported-by: Richard Biener Signed-off-by: Sven Verdoolaege --- isl_space.c | 6 +-- test_inputs/codegen/atomic.c | 4 +- test_inputs/codegen/cloog/byu98-1-2-3.c | 10 ++--- test_inputs/codegen/cloog/cholesky2.c | 13 ++++--- test_inputs/codegen/cloog/christian.c | 4 +- test_inputs/codegen/cloog/classen.c | 28 ++++++------- test_inputs/codegen/cloog/dealII.c | 4 +- test_inputs/codegen/cloog/dot2.c | 4 +- test_inputs/codegen/cloog/gauss.c | 4 +- test_inputs/codegen/cloog/reservoir-lim-lam1.c | 14 +++---- test_inputs/codegen/cloog/vivien.c | 27 ++++++------- test_inputs/codegen/cloog/vivien2.c | 17 ++++---- test_inputs/codegen/cloog/yosr2.c | 4 +- test_inputs/codegen/omega/iter9-0.c | 20 +++++----- test_inputs/codegen/omega/m12-1.c | 8 ++-- test_inputs/codegen/omega/ts1d-mp-i_ts-m_b-0.c | 2 +- test_inputs/codegen/omega/wak1-0.c | 54 +++++++++++++------------- test_inputs/codegen/omega/wak1-1.c | 50 ++++++++++++------------ test_inputs/codegen/omega/x-0.c | 4 +- test_inputs/codegen/omega/x-1.c | 4 +- test_inputs/codegen/pldi2012/figure8_b.c | 9 +++-- test_inputs/codegen/separate.c | 2 +- 22 files changed, 150 insertions(+), 142 deletions(-) rewrite test_inputs/codegen/omega/wak1-0.c (82%) diff --git a/isl_space.c b/isl_space.c index b0aca350..e6f957c4 100644 --- a/isl_space.c +++ b/isl_space.c @@ -1549,9 +1549,9 @@ static uint32_t isl_hash_dim(uint32_t hash, __isl_keep isl_space *dim) if (!dim) return hash; - hash = isl_hash_builtin(hash, dim->nparam); - hash = isl_hash_builtin(hash, dim->n_in); - hash = isl_hash_builtin(hash, dim->n_out); + isl_hash_byte(hash, dim->nparam % 256); + isl_hash_byte(hash, dim->n_in % 256); + isl_hash_byte(hash, dim->n_out % 256); for (i = 0; i < dim->nparam; ++i) { id = get_id(dim, isl_dim_param, i); diff --git a/test_inputs/codegen/atomic.c b/test_inputs/codegen/atomic.c index 0b702798..73731c0c 100644 --- a/test_inputs/codegen/atomic.c +++ b/test_inputs/codegen/atomic.c @@ -1,6 +1,6 @@ for (int c0 = 0; c0 <= 10; c0 += 1) { - if (c0 <= 9) - a(c0); if (c0 >= 1) b(c0 - 1); + if (c0 <= 9) + a(c0); } diff --git a/test_inputs/codegen/cloog/byu98-1-2-3.c b/test_inputs/codegen/cloog/byu98-1-2-3.c index 8c4a0810..8e87cba3 100644 --- a/test_inputs/codegen/cloog/byu98-1-2-3.c +++ b/test_inputs/codegen/cloog/byu98-1-2-3.c @@ -3,12 +3,12 @@ for (int c1 = -c0 + 6; c1 <= 6; c1 += 1) S1(c0, c1); for (int c0 = 4; c0 <= 8; c0 += 1) { - if (c0 == 4) { - for (int c1 = 3; c1 <= 4; c1 += 1) - S1(4, c1); - } else if (c0 >= 6) + if (c0 >= 6) { S2(c0, -c0 + 9); - if (c0 <= 5) { + } else { + if (c0 == 4) + for (int c1 = 3; c1 <= 4; c1 += 1) + S1(4, c1); S1(c0, -c0 + 9); S2(c0, -c0 + 9); } diff --git a/test_inputs/codegen/cloog/cholesky2.c b/test_inputs/codegen/cloog/cholesky2.c index 7834ff49..c746460b 100644 --- a/test_inputs/codegen/cloog/cholesky2.c +++ b/test_inputs/codegen/cloog/cholesky2.c @@ -6,11 +6,14 @@ } for (int c0 = 1; c0 < 3 * M - 1; c0 += 3) { S3((c0 + 2) / 3); - for (int c1 = (c0 + 5) / 3; c1 <= M; c1 += 1) { - S6((c0 + 2) / 3, c1); - for (int c4 = (c0 + 5) / 3; c4 < c1; c4 += 1) - S5(c4, c1, (c0 + 2) / 3); - } + if (3 * M >= c0 + 8) { + for (int c1 = (c0 + 5) / 3; c1 <= M; c1 += 1) { + S6((c0 + 2) / 3, c1); + for (int c4 = (c0 + 5) / 3; c4 < c1; c4 += 1) + S5(c4, c1, (c0 + 2) / 3); + } + } else if (c0 + 5 == 3 * M) + S6(M - 1, M); for (int c1 = (c0 + 5) / 3; c1 <= M; c1 += 1) S2(c1, (c0 + 2) / 3); } diff --git a/test_inputs/codegen/cloog/christian.c b/test_inputs/codegen/cloog/christian.c index 9c69a4b3..4b4d5a33 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(0, c0); c1 < min(N, N + c0); c1 += 1) - S1(c1, -c0 + c1); for (int c1 = max(c0 - 1, 0); c1 < min(N + c0 - 1, N); c1 += 1) S2(c1, -c0 + 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 ec3a1f4a..fb12b9d6 100644 --- a/test_inputs/codegen/cloog/classen.c +++ b/test_inputs/codegen/cloog/classen.c @@ -4,8 +4,8 @@ S8(0, 1); } else if (m >= 2) { S1(0, 1, 1, 1); - S4(0, 1, 2, 2, 1, 1, 2, 2); S3(0, 1, 1, 2, 1, 1, 1, 2); + S4(0, 1, 2, 2, 1, 1, 2, 2); S2(0, 1, 1, 1, 1, 1, 2, 1); S8(0, 1); } @@ -14,17 +14,17 @@ 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 (m >= c0 + 2) { - S5(c0 - 1, 1, c0, 1, c0, 1, c0 + 1, 1); - S1(c0, 1, c0 + 1, 1); - S4(c0, 1, c0 + 2, 2, c0 + 1, 1, c0 + 2, 2); - S3(c0, 1, c0 + 1, 2, c0 + 1, 1, c0 + 1, 2); - S2(c0, 1, c0 + 1, 1, c0 + 1, 1, c0 + 2, 1); - } else { + } 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 { + 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); } for (int c2 = max(-m + c0 + 3, 2); c2 <= min(c0, m - 1); c2 += 1) { S5(c0 - 1, c2, c0, c2, c0 - c2 + 1, c2, c0 - c2 + 2, c2); @@ -32,18 +32,18 @@ S6(c0 - 1, c2 - 1, c0, c2, c0 - c2 + 2, c2 - 1, c0 - c2 + 2, c2); S1(c0, c2, c0 - c2 + 2, c2); S3(c0, c2, c0 + 1, c2 + 1, c0 - c2 + 2, c2, c0 - c2 + 2, c2 + 1); - S2(c0, c2, c0 + 1, c2, c0 - c2 + 2, c2, c0 - c2 + 3, c2); S4(c0, c2, c0 + 2, c2 + 1, c0 - c2 + 2, c2, c0 - c2 + 3, c2 + 1); + S2(c0, c2, c0 + 1, c2, c0 - c2 + 2, c2, c0 - c2 + 3, c2); } if (c0 + 1 == m) { - S6(m - 2, m - 1, m - 1, m, 1, m - 1, 1, m); S7(m - 2, m - 1, m, m, 1, m - 1, 2, m); + S6(m - 2, m - 1, m - 1, m, 1, m - 1, 1, m); S1(m - 1, m, 1, m); S2(m - 1, m, m, m, 1, m, 2, m); } else if (c0 >= m) { S5(c0 - 1, m, c0, m, -m + c0 + 1, m, -m + c0 + 2, m); - S6(c0 - 1, m - 1, c0, m, -m + c0 + 2, m - 1, -m + c0 + 2, m); S7(c0 - 1, m - 1, c0 + 1, m, -m + c0 + 2, m - 1, -m + c0 + 3, m); + S6(c0 - 1, m - 1, c0, m, -m + c0 + 2, m - 1, -m + c0 + 2, m); S1(c0, m, -m + c0 + 2, m); S2(c0, m, c0 + 1, m, -m + c0 + 2, m, -m + c0 + 3, m); } else { @@ -51,8 +51,8 @@ S6(c0 - 1, c0, c0, c0 + 1, 1, c0, 1, c0 + 1); S1(c0, c0 + 1, 1, c0 + 1); S3(c0, c0 + 1, c0 + 1, c0 + 2, 1, c0 + 1, 1, c0 + 2); - S2(c0, c0 + 1, c0 + 1, c0 + 1, 1, c0 + 1, 2, c0 + 1); 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(-m + c0 + 2, 1); c8 <= min(c0 + 1, m); c8 += 1) S8(c0, c8); @@ -64,15 +64,15 @@ S1(2 * m - 3, m - 1, m, m - 1); S3(2 * m - 3, m - 1, 2 * m - 2, m, m, m - 1, m, m); S5(2 * m - 4, m, 2 * m - 3, m, m - 2, m, m - 1, m); - S6(2 * m - 4, m - 1, 2 * m - 3, m, m - 1, m - 1, m - 1, m); S7(2 * m - 4, m - 1, 2 * m - 2, m, m - 1, m - 1, m, m); + S6(2 * m - 4, m - 1, 2 * m - 3, m, m - 1, m - 1, m - 1, m); S1(2 * m - 3, m, m - 1, m); } else { S5(0, 1, 1, 1, 1, 1, 2, 1); S1(1, 1, 2, 1); S3(1, 1, 2, 2, 2, 1, 2, 2); - S6(0, 1, 1, 2, 1, 1, 1, 2); S7(0, 1, 2, 2, 1, 1, 2, 2); + S6(0, 1, 1, 2, 1, 1, 1, 2); S1(1, 2, 1, 2); } S2(2 * m - 3, m, 2 * m - 2, m, m - 1, m, m, m); diff --git a/test_inputs/codegen/cloog/dealII.c b/test_inputs/codegen/cloog/dealII.c index 92fd6403..0ae7bfac 100644 --- a/test_inputs/codegen/cloog/dealII.c +++ b/test_inputs/codegen/cloog/dealII.c @@ -3,10 +3,10 @@ S1(c0); S2(c0); } + for (int c0 = T_2; c0 <= min(T_66, T_67 - 1); c0 += 1) + S2(c0); for (int c0 = max(T_66 + 1, 0); c0 < T_2; c0 += 1) S1(c0); if (T_67 == 0 && T_2 == 0) S1(0); - for (int c0 = T_2; c0 <= min(T_66, T_67 - 1); c0 += 1) - S2(c0); } diff --git a/test_inputs/codegen/cloog/dot2.c b/test_inputs/codegen/cloog/dot2.c index f36aae20..4ab31459 100644 --- a/test_inputs/codegen/cloog/dot2.c +++ b/test_inputs/codegen/cloog/dot2.c @@ -4,9 +4,9 @@ for (int c1 = 1; c1 <= M; c1 += 1) S2(c0, c1); } + for (int c0 = N + 1; c0 <= M; c0 += 1) + S1(c0); for (int c0 = M + 1; c0 <= N; c0 += 1) for (int c1 = 1; c1 <= M; c1 += 1) S2(c0, c1); - for (int c0 = N + 1; c0 <= M; c0 += 1) - S1(c0); } diff --git a/test_inputs/codegen/cloog/gauss.c b/test_inputs/codegen/cloog/gauss.c index 4bbe42cb..13a8e137 100644 --- a/test_inputs/codegen/cloog/gauss.c +++ b/test_inputs/codegen/cloog/gauss.c @@ -1,7 +1,7 @@ for (int c0 = 1; c0 < M; c0 += 1) for (int c1 = c0 + 1; c1 <= M; c1 += 1) { - for (int c3 = 1; c3 < c0; c3 += 1) - S1(c0, c3, c1); for (int c3 = c0 + 1; c3 <= M; c3 += 1) S2(c0, c3, c1); + for (int c3 = 1; c3 < c0; c3 += 1) + S1(c0, c3, c1); } diff --git a/test_inputs/codegen/cloog/reservoir-lim-lam1.c b/test_inputs/codegen/cloog/reservoir-lim-lam1.c index 8f93f150..ae9848be 100644 --- a/test_inputs/codegen/cloog/reservoir-lim-lam1.c +++ b/test_inputs/codegen/cloog/reservoir-lim-lam1.c @@ -1,10 +1,10 @@ for (int c1 = -99; c1 <= 100; c1 += 1) { - if (c1 >= 1) - S2(c1, 1); - for (int c3 = max(1, -c1 + 1); c3 <= min(-c1 + 100, 99); c3 += 1) { - S1(c1 + c3, c3); - S2(c1 + c3, c3 + 1); - } if (c1 <= 0) - S1(c1 + 100, 100); + S1(1, -c1 + 1); + for (int c3 = max(-2 * c1 + 3, 1); c3 <= min(199, -2 * c1 + 199); c3 += 2) { + S2((2 * c1 + c3 - 1) / 2, (c3 + 1) / 2); + S1((2 * c1 + c3 + 1) / 2, (c3 + 1) / 2); + } + if (c1 >= 1) + S2(100, -c1 + 101); } diff --git a/test_inputs/codegen/cloog/vivien.c b/test_inputs/codegen/cloog/vivien.c index 29470ed2..55c1d790 100644 --- a/test_inputs/codegen/cloog/vivien.c +++ b/test_inputs/codegen/cloog/vivien.c @@ -13,8 +13,8 @@ S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } for (int c1 = -c0 + c0 / 2 + 3; c1 <= min(n - c0, -1); c1 += 1) { - S6(-c1 + 2, c0 + c1 - 2); S4(-c1, c0 + c1); + S6(-c1 + 2, c0 + c1 - 2); for (int c2 = 1; c2 <= -c1; c2 += 1) S5(-c1 + 1, c0 + c1 - 1, c2); } @@ -23,22 +23,23 @@ for (int c2 = 1; c2 < -n + c0; c2 += 1) S5(-n + c0, n, c2); } - if (2 * n >= c0 + 1 && c0 >= n + 3) + if (2 * n >= c0 + 1 && c0 >= n + 3) { S6(-n + c0, n); - if (c0 >= n + 3) { - S1(c0 - 1); - } else if (c0 == n + 2 && n >= 3) { - S6(2, n); - S1(n + 1); } else { - if (c0 >= 5 && n + 1 >= c0) { + if (n + 1 >= c0 && c0 >= 5) { S6(2, c0 - 2); S1(c0 - 1); - } else if (n + 1 >= c0 && c0 >= 3) + } else if (c0 >= 3 && c0 <= 4 && n + 1 >= c0) S1(c0 - 1); - if (c0 >= 3 && n + 1 >= c0) + if (n + 1 >= c0 && c0 >= 3) S6(1, c0 - 1); } + 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) @@ -48,8 +49,6 @@ for (int c1 = max(-n + c0, 1); c1 < (c0 + 1) / 2; c1 += 1) S2(c0 - c1, c1); } - for (int c0 = max(-27 * n + 2, 2 * n + 1); 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); @@ -62,8 +61,8 @@ S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } for (int c1 = -c0 + c0 / 2 + 3; c1 <= n - c0; c1 += 1) { - S6(-c1 + 2, c0 + c1 - 2); S4(-c1, c0 + c1); + S6(-c1 + 2, c0 + c1 - 2); for (int c2 = 1; c2 <= -c1; c2 += 1) S5(-c1 + 1, c0 + c1 - 1, c2); } @@ -79,4 +78,6 @@ for (int c1 = -n + c0; c1 < (c0 + 1) / 2; c1 += 1) S2(c0 - c1, c1); } + for (int c0 = max(-27 * n + 2, 2 * n + 1); 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 3a679b62..b39b943f 100644 --- a/test_inputs/codegen/cloog/vivien2.c +++ b/test_inputs/codegen/cloog/vivien2.c @@ -14,8 +14,8 @@ } } for (int c1 = -c0 + c0 / 2 + 3; c1 <= min(n - c0, -1); c1 += 1) { - S6(-c1 + 2, c0 + c1 - 2); S4(-c1, c0 + c1); + S6(-c1 + 2, c0 + c1 - 2); for (int c2 = 1; c2 <= -c1; c2 += 1) S5(-c1 + 1, c0 + c1 - 1, c2); } @@ -27,17 +27,18 @@ if (c0 >= n + 3) { S6(-n + c0, n); S1(c0 - 1); - } else if (c0 == n + 2) { - S6(2, n); - S1(n + 1); } else { - if (c0 >= 5) { + if (c0 >= 5 && n + 1 >= c0) { S6(2, c0 - 2); S1(c0 - 1); - } else if (c0 >= 3) + } else if (c0 >= 3 && c0 <= 4) S1(c0 - 1); - if (c0 >= 3) + if (c0 >= 3 && n + 1 >= c0) S6(1, c0 - 1); + if (c0 == n + 2) { + S6(2, n); + S1(n + 1); + } } if (c0 == 2) S1(1); @@ -58,8 +59,8 @@ S5(c0 - c0 / 2 - 1, c0 / 2 + 1, c2); } for (int c1 = -c0 + c0 / 2 + 3; c1 <= n - c0; c1 += 1) { - S6(-c1 + 2, c0 + c1 - 2); S4(-c1, c0 + c1); + S6(-c1 + 2, c0 + c1 - 2); for (int c2 = 1; c2 <= -c1; c2 += 1) S5(-c1 + 1, c0 + c1 - 1, c2); } diff --git a/test_inputs/codegen/cloog/yosr2.c b/test_inputs/codegen/cloog/yosr2.c index a4c0cd29..a52909cc 100644 --- a/test_inputs/codegen/cloog/yosr2.c +++ b/test_inputs/codegen/cloog/yosr2.c @@ -2,12 +2,12 @@ for (int c1 = 1; c1 <= M; c1 += 1) S2(c1); for (int c0 = 2; c0 <= M; c0 += 1) { - for (int c2 = 1; c2 < c0; c2 += 1) - S1(c0, c2); for (int c2 = c0 + 1; c2 <= M; c2 += 1) for (int c3 = 1; c3 < c0; c3 += 1) S3(c0, c2, c3); for (int c1 = 1; c1 < c0; c1 += 1) S4(c1, c0); + for (int c2 = 1; c2 < c0; c2 += 1) + S1(c0, c2); } } diff --git a/test_inputs/codegen/omega/iter9-0.c b/test_inputs/codegen/omega/iter9-0.c index bf6b8875..2336f810 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 || (exprVar1 + 8 * floord(-exprVar1 + c0 - 1, 8) + 1 == c0 && c0 >= exprVar1 + 1)) { - s5(c0); - if (8 * floord(7 * exprVar1 + 7, 8) + 8 >= 7 * exprVar1 + c0) { - s0(c0); - s4(c0); - s1(c0); - s3(c0); - s2(c0); - } +for (int c0 = 1; c0 <= 15; c0 += 1) { + if (8 * floord(7 * exprVar1 + 7, 8) + 8 >= 7 * exprVar1 + c0) { + 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)) + s5(c0); +} diff --git a/test_inputs/codegen/omega/m12-1.c b/test_inputs/codegen/omega/m12-1.c index 555fbfb3..eba7c8a6 100644 --- a/test_inputs/codegen/omega/m12-1.c +++ b/test_inputs/codegen/omega/m12-1.c @@ -1,12 +1,12 @@ { for (int c1 = 1; c1 <= n; c1 += 1) for (int c2 = 1; c2 <= m; c2 += 1) { - s1(1, c1, c2, 0); s0(1, c1, c2, 0); + s1(1, c1, c2, 0); } for (int c1 = 1; c1 <= n; c1 += 1) { - s2(2, c1, 0, 0); s3(2, c1, 0, 0); + s2(2, c1, 0, 0); } for (int c1 = 1; c1 <= m; c1 += 1) { for (int c3 = 1; c3 <= n; c3 += 1) { @@ -14,12 +14,12 @@ s4(3, c1, 1, c3); } for (int c3 = 1; c3 <= n; c3 += 1) { - s6(3, c1, 2, c3); s7(3, c1, 2, c3); + s6(3, c1, 2, c3); } } for (int c1 = 1; c1 <= m; c1 += 1) { - s9(4, c1, 0, 0); s8(4, c1, 0, 0); + s9(4, c1, 0, 0); } } 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 819493d9..0cfc22a0 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 @@ -9,7 +9,7 @@ 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 c4 = max(1000 * c1 + 4000 * c3 - 3999, 500 * c1 + 1); c4 <= min(min(1000 * c1 + 4000 * c3 - 3000, 2 * N - 4000 * c3 + 3995), N + T - 3); c4 += 1) for (int c5 = max(-N - 500 * c1 + c4 + 2, 0); 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(-((c1 + 9) / 8) + 2, -((T + 4000) / 4000) + 2); c3 <= floord(N - 500 * c1 - 3, 4000) + 1; c3 += 1) diff --git a/test_inputs/codegen/omega/wak1-0.c b/test_inputs/codegen/omega/wak1-0.c dissimilarity index 82% index 1ce48187..086c5619 100644 --- a/test_inputs/codegen/omega/wak1-0.c +++ b/test_inputs/codegen/omega/wak1-0.c @@ -1,27 +1,27 @@ -{ - for (int c0 = a3; c0 <= min(min(a2 - 1, a1 - 1), b3); c0 += 1) - s2(c0); - for (int c0 = a1; c0 <= min(a2 - 1, b1); c0 += 1) { - s0(c0); - if (c0 >= a3 && b3 >= c0) - s2(c0); - } - for (int c0 = max(max(b1 + 1, a1), a3); c0 <= min(a2 - 1, b3); c0 += 1) - s2(c0); - for (int c0 = a2; c0 <= b2; c0 += 1) { - if (c0 >= a1 && b1 >= c0) - s0(c0); - s1(c0); - if (c0 >= a3 && b3 >= c0) - s2(c0); - } - for (int c0 = max(max(b2 + 1, a3), a2); c0 <= min(a1 - 1, b3); c0 += 1) - s2(c0); - for (int c0 = max(max(b2 + 1, a1), a2); c0 <= b1; c0 += 1) { - s0(c0); - if (b3 >= c0 && c0 >= a3) - s2(c0); - } - for (int c0 = max(max(max(max(b1 + 1, b2 + 1), a1), a3), a2); c0 <= b3; c0 += 1) - s2(c0); -} +{ + for (int c0 = a2; c0 <= min(min(a3 - 1, a1 - 1), b2); c0 += 1) + s1(c0); + 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(b3 + 1, a3), a2); c0 <= min(a1 - 1, b2); c0 += 1) + s1(c0); + for (int c0 = a1; c0 <= b1; c0 += 1) { + s0(c0); + if (b2 >= c0 && c0 >= a2) + s1(c0); + if (b3 >= c0 && c0 >= a3) + s2(c0); + } + for (int c0 = max(max(b1 + 1, a1), a2); c0 <= min(a3 - 1, b2); c0 += 1) + s1(c0); + for (int c0 = max(max(b1 + 1, a1), a3); c0 <= b3; c0 += 1) { + if (c0 >= a2 && b2 >= c0) + s1(c0); + s2(c0); + } + for (int c0 = max(max(max(max(b1 + 1, b3 + 1), a1), a3), 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 48a6f882..6314c44f 100644 --- a/test_inputs/codegen/omega/wak1-1.c +++ b/test_inputs/codegen/omega/wak1-1.c @@ -1,55 +1,55 @@ { - for (int c0 = a2; c0 <= min(min(a3 - 1, a1 - 1), b2); c0 += 1) - s1(c0); - for (int c0 = a1; c0 <= min(min(a2 - 1, a3 - 1), b1); c0 += 1) - s0(c0); - for (int c0 = max(a1, a2); c0 <= min(min(a3 - 1, b2), b1); c0 += 1) { - s0(c0); - s1(c0); - } - for (int c0 = max(max(b1 + 1, a1), a2); c0 <= min(a3 - 1, b2); c0 += 1) - s1(c0); for (int c0 = a3; c0 <= min(min(a2 - 1, a1 - 1), b3); c0 += 1) s2(c0); + for (int c0 = a2; c0 <= min(min(a3 - 1, a1 - 1), b2); c0 += 1) + s1(c0); for (int c0 = max(a3, a2); c0 <= min(min(a1 - 1, b2), b3); c0 += 1) { s1(c0); s2(c0); } - for (int c0 = max(max(b3 + 1, a3), a2); c0 <= min(a1 - 1, b2); c0 += 1) - s1(c0); + for (int c0 = max(max(b2 + 1, a3), a2); c0 <= min(a1 - 1, b3); c0 += 1) + s2(c0); + for (int c0 = a1; c0 <= min(min(a2 - 1, a3 - 1), b1); 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(b3 + 1, a1), a3); c0 <= min(a2 - 1, b1); c0 += 1) - s0(c0); - for (int c0 = max(max(a1, a3), a2); c0 <= min(min(b2, b3), b1); c0 += 1) { + for (int c0 = max(max(b1 + 1, a1), a3); c0 <= min(a2 - 1, b3); c0 += 1) + s2(c0); + for (int c0 = max(a1, a2); c0 <= min(min(a3 - 1, b2), b1); c0 += 1) { s0(c0); s1(c0); - s2(c0); } - for (int c0 = max(max(max(b3 + 1, a1), a3), a2); c0 <= min(b2, b1); c0 += 1) { + for (int c0 = max(max(b1 + 1, a1), 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) { s0(c0); s1(c0); - } - for (int c0 = max(max(b1 + 1, a1), a3); c0 <= min(a2 - 1, b3); c0 += 1) s2(c0); + } for (int c0 = max(max(max(b1 + 1, a1), a3), a2); c0 <= min(b2, b3); c0 += 1) { s1(c0); s2(c0); } - for (int c0 = max(max(max(max(b1 + 1, b3 + 1), a1), a3), a2); c0 <= b2; c0 += 1) - s1(c0); for (int c0 = max(max(b2 + 1, a1), a2); c0 <= min(a3 - 1, b1); c0 += 1) s0(c0); - for (int c0 = max(max(b2 + 1, a3), a2); c0 <= min(a1 - 1, b3); c0 += 1) - s2(c0); for (int c0 = max(max(max(b2 + 1, a1), a3), a2); c0 <= min(b3, b1); c0 += 1) { s0(c0); s2(c0); } - for (int c0 = max(max(max(max(b3 + 1, b2 + 1), a1), a3), a2); c0 <= b1; c0 += 1) - s0(c0); for (int c0 = max(max(max(max(b1 + 1, b2 + 1), a1), a3), a2); c0 <= b3; c0 += 1) s2(c0); + for (int c0 = max(max(b3 + 1, a3), a2); c0 <= min(a1 - 1, b2); c0 += 1) + s1(c0); + for (int c0 = max(max(b3 + 1, a1), a3); c0 <= min(a2 - 1, b1); c0 += 1) + s0(c0); + for (int c0 = max(max(max(b3 + 1, a1), a3), a2); c0 <= min(b2, b1); c0 += 1) { + s0(c0); + s1(c0); + } + for (int c0 = max(max(max(max(b1 + 1, b3 + 1), a1), a3), a2); c0 <= b2; c0 += 1) + s1(c0); + for (int c0 = max(max(max(max(b3 + 1, b2 + 1), a1), a3), a2); c0 <= b1; c0 += 1) + s0(c0); } diff --git a/test_inputs/codegen/omega/x-0.c b/test_inputs/codegen/omega/x-0.c index 16e6ed08..e009577e 100644 --- a/test_inputs/codegen/omega/x-0.c +++ b/test_inputs/codegen/omega/x-0.c @@ -7,8 +7,8 @@ for (int c0 = 1; c0 <= 11; c0 += 1) { s0(c1, c0 + c1 - 8); s1(c1, c0 - c1 + 1); } - for (int c1 = max(-c0 + 9, c0 + 1); c1 <= min(-c0 + 12, 8); c1 += 1) - s0(c1, c0 + c1 - 8); for (int c1 = max(-c0 + 13, c0 - 3); c1 <= min(c0, 8); c1 += 1) s1(c1, c0 - c1 + 1); + for (int c1 = max(-c0 + 9, c0 + 1); c1 <= min(-c0 + 12, 8); 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 16e6ed08..e009577e 100644 --- a/test_inputs/codegen/omega/x-1.c +++ b/test_inputs/codegen/omega/x-1.c @@ -7,8 +7,8 @@ for (int c0 = 1; c0 <= 11; c0 += 1) { s0(c1, c0 + c1 - 8); s1(c1, c0 - c1 + 1); } - for (int c1 = max(-c0 + 9, c0 + 1); c1 <= min(-c0 + 12, 8); c1 += 1) - s0(c1, c0 + c1 - 8); for (int c1 = max(-c0 + 13, c0 - 3); c1 <= min(c0, 8); c1 += 1) s1(c1, c0 - c1 + 1); + for (int c1 = max(-c0 + 9, c0 + 1); c1 <= min(-c0 + 12, 8); c1 += 1) + s0(c1, c0 + c1 - 8); } diff --git a/test_inputs/codegen/pldi2012/figure8_b.c b/test_inputs/codegen/pldi2012/figure8_b.c index 21b90f2d..a112d190 100644 --- a/test_inputs/codegen/pldi2012/figure8_b.c +++ b/test_inputs/codegen/pldi2012/figure8_b.c @@ -1,5 +1,8 @@ -for (int c0 = 2; c0 <= n; c0 += 4) { - s1(c0); - if (n >= c0 + 2) +{ + for (int c0 = 2; c0 < n - 1; c0 += 4) { + s1(c0); s0(c0 + 2); + } + if (n >= 4 * floord(n, 4) + 2 && n >= 0) + s1(-(n % 4) + n + 2); } diff --git a/test_inputs/codegen/separate.c b/test_inputs/codegen/separate.c index 14d91be3..042e3e77 100644 --- a/test_inputs/codegen/separate.c +++ b/test_inputs/codegen/separate.c @@ -1,8 +1,8 @@ { a(0); for (int c0 = 1; c0 <= 9; c0 += 1) { - a(c0); b(c0 - 1); + a(c0); } b(9); } -- 2.11.4.GIT