diff --git a/gcc/gimplify.c b/gcc/gimplify.c index 6a5349cbfdd..23d0e2511f7 100644 --- a/gcc/gimplify.c +++ b/gcc/gimplify.c @@ -10996,6 +10996,37 @@ gimplify_omp_task (tree *expr_p, gimple_seq *pre_p) *expr_p = NULL_TREE; } +/* Helper function for gimplify_omp_for. If *TP is not a gimple constant, + force it into a temporary initialized in PRE_P and add firstprivate clause + to ORIG_FOR_STMT. */ + +static void +gimplify_omp_taskloop_expr (tree type, tree *tp, gimple_seq *pre_p, + tree orig_for_stmt) +{ + if (*tp == NULL || is_gimple_constant (*tp)) + return; + + *tp = get_initialized_tmp_var (*tp, pre_p, NULL, false); + /* Reference to pointer conversion is considered useless, + but is significant for firstprivate clause. Force it + here. */ + if (type + && TREE_CODE (type) == POINTER_TYPE + && TREE_CODE (TREE_TYPE (*tp)) == REFERENCE_TYPE) + { + tree v = create_tmp_var (TYPE_MAIN_VARIANT (type)); + tree m = build2 (INIT_EXPR, TREE_TYPE (v), v, *tp); + gimplify_and_add (m, pre_p); + *tp = v; + } + + tree c = build_omp_clause (input_location, OMP_CLAUSE_FIRSTPRIVATE); + OMP_CLAUSE_DECL (c) = *tp; + OMP_CLAUSE_CHAIN (c) = OMP_FOR_CLAUSES (orig_for_stmt); + OMP_FOR_CLAUSES (orig_for_stmt) = c; +} + /* Gimplify the gross structure of an OMP_FOR statement. */ static enum gimplify_status @@ -11298,65 +11329,34 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) for (i = 0; i < TREE_VEC_LENGTH (OMP_FOR_INIT (for_stmt)); i++) { t = TREE_VEC_ELT (OMP_FOR_INIT (for_stmt), i); - if (!is_gimple_constant (TREE_OPERAND (t, 1))) - { + gimple_seq *for_pre_p = (gimple_seq_empty_p (for_pre_body) + ? pre_p : &for_pre_body); tree type = TREE_TYPE (TREE_OPERAND (t, 0)); - TREE_OPERAND (t, 1) - = get_initialized_tmp_var (TREE_OPERAND (t, 1), - gimple_seq_empty_p (for_pre_body) - ? pre_p : &for_pre_body, NULL, - false); - /* Reference to pointer conversion is considered useless, - but is significant for firstprivate clause. Force it - here. */ - if (TREE_CODE (type) == POINTER_TYPE - && (TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 1))) - == REFERENCE_TYPE)) - { - tree v = create_tmp_var (TYPE_MAIN_VARIANT (type)); - tree m = build2 (INIT_EXPR, TREE_TYPE (v), v, - TREE_OPERAND (t, 1)); - gimplify_and_add (m, gimple_seq_empty_p (for_pre_body) - ? pre_p : &for_pre_body); - TREE_OPERAND (t, 1) = v; - } - tree c = build_omp_clause (input_location, - OMP_CLAUSE_FIRSTPRIVATE); - OMP_CLAUSE_DECL (c) = TREE_OPERAND (t, 1); - OMP_CLAUSE_CHAIN (c) = OMP_FOR_CLAUSES (orig_for_stmt); - OMP_FOR_CLAUSES (orig_for_stmt) = c; + if (TREE_CODE (TREE_OPERAND (t, 1)) == TREE_VEC) + { + tree v = TREE_OPERAND (t, 1); + gimplify_omp_taskloop_expr (type, &TREE_VEC_ELT (v, 1), + for_pre_p, orig_for_stmt); + gimplify_omp_taskloop_expr (type, &TREE_VEC_ELT (v, 2), + for_pre_p, orig_for_stmt); } + else + gimplify_omp_taskloop_expr (type, &TREE_OPERAND (t, 1), for_pre_p, + orig_for_stmt); /* Handle OMP_FOR_COND. */ t = TREE_VEC_ELT (OMP_FOR_COND (for_stmt), i); - if (!is_gimple_constant (TREE_OPERAND (t, 1))) + if (TREE_CODE (TREE_OPERAND (t, 1)) == TREE_VEC) { - tree type = TREE_TYPE (TREE_OPERAND (t, 0)); - TREE_OPERAND (t, 1) - = get_initialized_tmp_var (TREE_OPERAND (t, 1), - gimple_seq_empty_p (for_pre_body) - ? pre_p : &for_pre_body, NULL, - false); - /* Reference to pointer conversion is considered useless, - but is significant for firstprivate clause. Force it - here. */ - if (TREE_CODE (type) == POINTER_TYPE - && (TREE_CODE (TREE_TYPE (TREE_OPERAND (t, 1))) - == REFERENCE_TYPE)) - { - tree v = create_tmp_var (TYPE_MAIN_VARIANT (type)); - tree m = build2 (INIT_EXPR, TREE_TYPE (v), v, - TREE_OPERAND (t, 1)); - gimplify_and_add (m, gimple_seq_empty_p (for_pre_body) - ? pre_p : &for_pre_body); - TREE_OPERAND (t, 1) = v; - } - tree c = build_omp_clause (input_location, - OMP_CLAUSE_FIRSTPRIVATE); - OMP_CLAUSE_DECL (c) = TREE_OPERAND (t, 1); - OMP_CLAUSE_CHAIN (c) = OMP_FOR_CLAUSES (orig_for_stmt); - OMP_FOR_CLAUSES (orig_for_stmt) = c; + tree v = TREE_OPERAND (t, 1); + gimplify_omp_taskloop_expr (type, &TREE_VEC_ELT (v, 1), + for_pre_p, orig_for_stmt); + gimplify_omp_taskloop_expr (type, &TREE_VEC_ELT (v, 2), + for_pre_p, orig_for_stmt); } + else + gimplify_omp_taskloop_expr (type, &TREE_OPERAND (t, 1), for_pre_p, + orig_for_stmt); /* Handle OMP_FOR_INCR. */ t = TREE_VEC_ELT (OMP_FOR_INCR (for_stmt), i); @@ -11368,17 +11368,8 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) if (TREE_CODE (t) == PLUS_EXPR && *tp == decl) tp = &TREE_OPERAND (t, 0); - if (!is_gimple_constant (*tp)) - { - gimple_seq *seq = gimple_seq_empty_p (for_pre_body) - ? pre_p : &for_pre_body; - *tp = get_initialized_tmp_var (*tp, seq, NULL, false); - tree c = build_omp_clause (input_location, - OMP_CLAUSE_FIRSTPRIVATE); - OMP_CLAUSE_DECL (c) = *tp; - OMP_CLAUSE_CHAIN (c) = OMP_FOR_CLAUSES (orig_for_stmt); - OMP_FOR_CLAUSES (orig_for_stmt) = c; - } + gimplify_omp_taskloop_expr (NULL_TREE, tp, for_pre_p, + orig_for_stmt); } } @@ -12220,6 +12211,34 @@ gimplify_omp_for (tree *expr_p, gimple_seq *pre_p) OMP_CLAUSE_DECL (t) = v; OMP_CLAUSE_CHAIN (t) = gimple_omp_for_clauses (gforo); gimple_omp_for_set_clauses (gforo, t); + if (OMP_FOR_NON_RECTANGULAR (for_stmt)) + { + tree *p1 = NULL, *p2 = NULL; + t = gimple_omp_for_initial (gforo, i); + if (TREE_CODE (t) == TREE_VEC) + p1 = &TREE_VEC_ELT (t, 0); + t = gimple_omp_for_final (gforo, i); + if (TREE_CODE (t) == TREE_VEC) + { + if (p1) + p2 = &TREE_VEC_ELT (t, 0); + else + p1 = &TREE_VEC_ELT (t, 0); + } + if (p1) + { + int j; + for (j = 0; j < i; j++) + if (*p1 == gimple_omp_for_index (gfor, j)) + { + *p1 = gimple_omp_for_index (gforo, j); + if (p2) + *p2 = *p1; + break; + } + gcc_assert (j < i); + } + } } gimplify_seq_add_stmt (pre_p, gforo); } diff --git a/gcc/omp-expand.c b/gcc/omp-expand.c index eb37b38e25d..8f1286e3176 100644 --- a/gcc/omp-expand.c +++ b/gcc/omp-expand.c @@ -6917,8 +6917,20 @@ expand_omp_taskloop_for_inner (struct omp_region *region, assign_stmt = gimple_build_assign (fd->loop.v, NOP_EXPR, e); gsi_insert_after (&gsi, assign_stmt, GSI_CONTINUE_LINKING); } + + tree *nonrect_bounds = NULL; if (fd->collapse > 1) - expand_omp_for_init_vars (fd, &gsi, counts, NULL, inner_stmt, startvar); + { + if (fd->non_rect) + { + nonrect_bounds = XALLOCAVEC (tree, fd->last_nonrect + 1); + memset (nonrect_bounds, 0, sizeof (tree) * (fd->last_nonrect + 1)); + } + gcc_assert (gsi_bb (gsi) == entry_bb); + expand_omp_for_init_vars (fd, &gsi, counts, nonrect_bounds, inner_stmt, + startvar); + entry_bb = gsi_bb (gsi); + } if (!broken_loop) { @@ -6953,7 +6965,8 @@ expand_omp_taskloop_for_inner (struct omp_region *region, gsi_remove (&gsi, true); if (fd->collapse > 1 && !gimple_omp_for_combined_p (fd->for_stmt)) - collapse_bb = extract_omp_for_update_vars (fd, NULL, cont_bb, body_bb); + collapse_bb = extract_omp_for_update_vars (fd, nonrect_bounds, + cont_bb, body_bb); } /* Remove the GIMPLE_OMP_FOR statement. */ @@ -7643,9 +7656,6 @@ expand_omp_for (struct omp_region *region, gimple *inner_stmt) } else if (gimple_omp_for_kind (fd.for_stmt) == GF_OMP_FOR_KIND_TASKLOOP) { - if (fd.non_rect) - sorry_at (gimple_location (fd.for_stmt), - "non-rectangular % not supported yet"); if (gimple_omp_for_combined_into_p (fd.for_stmt)) expand_omp_taskloop_for_inner (region, &fd, inner_stmt); else diff --git a/gcc/omp-general.c b/gcc/omp-general.c index 6e6d3e1c6f6..8e2665ab3a3 100644 --- a/gcc/omp-general.c +++ b/gcc/omp-general.c @@ -444,10 +444,6 @@ omp_extract_for_data (gomp_for *for_stmt, struct omp_for_data *fd, = build_nonstandard_integer_type (TYPE_PRECISION (TREE_TYPE (loop->v)), 1); } - else if (loop->m1 || loop->m2) - /* Non-rectangular loops should use static schedule and no - ordered clause. */ - gcc_unreachable (); else if (iter_type != long_long_unsigned_type_node) { if (POINTER_TYPE_P (TREE_TYPE (loop->v))) @@ -463,7 +459,9 @@ omp_extract_for_data (gomp_for *for_stmt, struct omp_for_data *fd, loop->n2, loop->step); else n = loop->n1; - if (TREE_CODE (n) != INTEGER_CST + if (loop->m1 + || loop->m2 + || TREE_CODE (n) != INTEGER_CST || tree_int_cst_lt (TYPE_MAX_VALUE (iter_type), n)) iter_type = long_long_unsigned_type_node; } @@ -484,7 +482,9 @@ omp_extract_for_data (gomp_for *for_stmt, struct omp_for_data *fd, loop->n2, loop->step); n2 = loop->n1; } - if (TREE_CODE (n1) != INTEGER_CST + if (loop->m1 + || loop->m2 + || TREE_CODE (n1) != INTEGER_CST || TREE_CODE (n2) != INTEGER_CST || !tree_int_cst_lt (TYPE_MIN_VALUE (iter_type), n1) || !tree_int_cst_lt (n2, TYPE_MAX_VALUE (iter_type))) diff --git a/libgomp/testsuite/libgomp.c/loop-22.c b/libgomp/testsuite/libgomp.c/loop-22.c index b07efee91f5..431e43bb9fa 100644 --- a/libgomp/testsuite/libgomp.c/loop-22.c +++ b/libgomp/testsuite/libgomp.c/loop-22.c @@ -185,5 +185,240 @@ main () for (int n = l; n < 2 * l; n++) if (v[0][j][0][l][0][n][0] != 7) abort (); + + { + static int i, j, x; + static volatile int a, b, c, d, e, f, g, h; + static int w[13][27]; + for (i = -4; i < 8; i++) + for (j = 3 * i; j > 2 * i; j--) + w[i + 5][j + 5] = 1; + a = -4; b = 8; c = 1; d = 3; e = 0; f = 2; g = 0; h = -1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute collapse(2) lastprivate (i, j, x) + for (i = -4; i < 8; i++) + for (j = 3 * i; j > 2 * i; j--) + { + if (i < -4 || i >= 8 || j > 3 * i || j <= i * 2 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != 8 || j != 14 || x != 7183 || niters != 28) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute collapse(2) lastprivate (i, j, x) + for (i = a; i < b; i += c) + for (j = d * i + e; j > g + i * f; j += h) + { + if (i < -4 || i >= 8 || j > 3 * i || j <= i * 2 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != 8 || j != 14 || x != 7183 || niters != 28) + abort (); + for (int i = -4; i < 8; i++) + for (int j = 3 * i; j > 2 * i; j--) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = -2; i < 4; i++) + for (j = -2 * i + 3; j > -3; j -= 2) + w[i + 5][j + 5] = 1; + a = -2; b = 4; c = 1; d = -2; e = 3; f = 0; g = -3; h = -2; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute collapse(2) lastprivate (i, j, x) + for (i = -2; i < 4; i++) + for (j = -2 * i + 3; j > -3; j -= 2) + { + if (i < -2 || i >= 4 || j <= -3 || j > -2 * i + 3 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/* i != 4 || j != -3 || */x != 3071 || niters != 15) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute collapse(2) lastprivate (i, j, x) + for (i = a; i < b; i += c) + for (j = d * i + e; j > g + i * f; j += h) + { + if (i < -2 || i >= 4 || j <= -3 || j > -2 * i + 3 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != 4 || j != -3 || */x != 3071 || niters != 15) + abort (); + for (i = -2; i < 4; i++) + for (j = -2 * i + 3; j > -3; j -= 2) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = 3; i > -3; i--) + for (j = -2 * i + 7; j > 2 * i + 1; j--) + w[i + 5][j + 5] = 1; + a = 3; b = -3; c = -1; d = -2; e = 7; f = 2; g = 1; h = -1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute collapse(2) lastprivate (i, j, x) + for (i = 3; i > -3; i--) + for (j = -2 * i + 7; j > 2 * i + 1; j--) + { + if (i <= -3 || i > 3 || j <= 2 * i + 1 || j > -2 * i + 7 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != -3 || j != -3 || x != -1026 || niters != 32) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute collapse(2) lastprivate (i, j, x) + for (i = a; i > b; i += c) + for (j = d * i + e; j > g + i * f; j += h) + { + if (i <= -3 || i > 3 || j <= 2 * i + 1 || j > -2 * i + 7 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != -3 || j != -3 || x != -1026 || niters != 32) + abort (); + for (i = 3; i > -3; i--) + for (j = -2 * i + 7; j > 2 * i + 1; j--) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = 3; i > -3; i--) + for (j = 2 * i + 7; j > -2 * i + 1; j--) + w[i + 5][j + 5] = 1; + a = 3; b = -3; c = -1; d = 2; e = 7; f = -2; g = 1; h = -1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute collapse(2) lastprivate (i, j, x) + for (i = 3; i > -3; i--) + for (j = 2 * i + 7; j > -2 * i + 1; j--) + { + if (i <= -3 || i > 3 || j <= -2 * i + 1 || j > 2 * i + 7 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != -3 || j != 3 || */x != -1020 || niters != 50) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute collapse(2) lastprivate (i, j, x) + for (i = a; i > b; i += c) + for (j = d * i + e; j > g + i * f; j += h) + { + if (i <= -3 || i > 3 || j <= -2 * i + 1 || j > 2 * i + 7 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != -3 || j != 3 || */x != -1020 || niters != 50) + abort (); + for (i = 3; i > -3; i--) + for (j = 2 * i + 7; j > -2 * i + 1; j--) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = 6; i > -6; i--) + for (j = 2 * i + 7; j <= -2 * i + 1; j++) + w[i + 5][j + 5] = 1; + a = 6; b = -6; c = -1; d = 2; e = 7; f = -2; g = 2; h = 1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute collapse(2) lastprivate (i, j, x) + for (i = 6; i > -6; i--) + for (j = 2 * i + 7; j <= -2 * i + 1; j++) + { + if (i <= -6 || i > 6 || j < 2 * i + 7 || j >= -2 * i + 2 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != -6 || j != 12 || x != -5109 || niters != 36) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute collapse(2) lastprivate (i, j, x) + for (i = a; i > b; i += c) + for (j = d * i + e; j < g + i * f; j += h) + { + if (i <= -6 || i > 6 || j < 2 * i + 7 || j >= -2 * i + 2 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != -6 || j != 12 || x != -5109 || niters != 36) + abort (); + for (i = 6; i > -6; i--) + for (j = 2 * i + 7; j <= -2 * i + 1; j++) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = 6; i > -6; i -= 2) + for (j = -2 * i + 7; j <= 2 * i + 1; j++) + w[i + 5][j + 5] = 1; + a = 6; b = -6; c = -2; d = -2; e = 7; f = 2; g = 2; h = 1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute collapse(2) lastprivate (i, j, x) + for (i = 6; i > -6; i -= 2) + for (j = -2 * i + 7; j <= 2 * i + 1; j++) + { + if (i <= -6 || i > 6 || j < -2 * i + 7 || j >= 2 * i + 2 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != -6 || j != 15 || */x != 2053 || niters != 33) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute collapse(2) lastprivate (i, j, x) + for (i = a; i > b; i += c) + for (j = d * i + e; j < g + i * f; j += h) + { + if (i <= -6 || i > 6 || j < -2 * i + 7 || j >= 2 * i + 2 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != -6 || j != 15 || */x != 2053 || niters != 33) + abort (); + for (i = 6; i > -6; i -= 2) + for (j = -2 * i + 7; j <= 2 * i + 1; j++) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + } + return 0; } diff --git a/libgomp/testsuite/libgomp.c/loop-23.c b/libgomp/testsuite/libgomp.c/loop-23.c index 30bb82c722f..1476db2e51e 100644 --- a/libgomp/testsuite/libgomp.c/loop-23.c +++ b/libgomp/testsuite/libgomp.c/loop-23.c @@ -185,5 +185,240 @@ main () for (int n = l; n < 2 * l; n++) if (v[0][j][0][l][0][n][0] != 7) abort (); + + { + static int i, j, x; + static volatile int a, b, c, d, e, f, g, h; + static int w[13][27]; + for (i = -4; i < 8; i++) + for (j = 3 * i; j > 2 * i; j--) + w[i + 5][j + 5] = 1; + a = -4; b = 8; c = 1; d = 3; e = 0; f = 2; g = 0; h = -1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters) + for (i = -4; i < 8; i++) + for (j = 3 * i; j > 2 * i; j--) + { + if (i < -4 || i >= 8 || j > 3 * i || j <= i * 2 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != 8 || j != 14 || x != 7183 || niters != 28) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters) + for (i = a; i < b; i += c) + for (j = d * i + e; j > g + i * f; j += h) + { + if (i < -4 || i >= 8 || j > 3 * i || j <= i * 2 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != 8 || j != 14 || x != 7183 || niters != 28) + abort (); + for (int i = -4; i < 8; i++) + for (int j = 3 * i; j > 2 * i; j--) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = -2; i < 4; i++) + for (j = -2 * i + 3; j > -3; j -= 2) + w[i + 5][j + 5] = 1; + a = -2; b = 4; c = 1; d = -2; e = 3; f = 0; g = -3; h = -2; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters) + for (i = -2; i < 4; i++) + for (j = -2 * i + 3; j > -3; j -= 2) + { + if (i < -2 || i >= 4 || j <= -3 || j > -2 * i + 3 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/* i != 4 || j != -3 || */x != 3071 || niters != 15) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters) + for (i = a; i < b; i += c) + for (j = d * i + e; j > g + i * f; j += h) + { + if (i < -2 || i >= 4 || j <= -3 || j > -2 * i + 3 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != 4 || j != -3 || */x != 3071 || niters != 15) + abort (); + for (i = -2; i < 4; i++) + for (j = -2 * i + 3; j > -3; j -= 2) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = 3; i > -3; i--) + for (j = -2 * i + 7; j > 2 * i + 1; j--) + w[i + 5][j + 5] = 1; + a = 3; b = -3; c = -1; d = -2; e = 7; f = 2; g = 1; h = -1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters) + for (i = 3; i > -3; i--) + for (j = -2 * i + 7; j > 2 * i + 1; j--) + { + if (i <= -3 || i > 3 || j <= 2 * i + 1 || j > -2 * i + 7 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != -3 || j != -3 || x != -1026 || niters != 32) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters) + for (i = a; i > b; i += c) + for (j = d * i + e; j > g + i * f; j += h) + { + if (i <= -3 || i > 3 || j <= 2 * i + 1 || j > -2 * i + 7 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != -3 || j != -3 || x != -1026 || niters != 32) + abort (); + for (i = 3; i > -3; i--) + for (j = -2 * i + 7; j > 2 * i + 1; j--) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = 3; i > -3; i--) + for (j = 2 * i + 7; j > -2 * i + 1; j--) + w[i + 5][j + 5] = 1; + a = 3; b = -3; c = -1; d = 2; e = 7; f = -2; g = 1; h = -1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters) + for (i = 3; i > -3; i--) + for (j = 2 * i + 7; j > -2 * i + 1; j--) + { + if (i <= -3 || i > 3 || j <= -2 * i + 1 || j > 2 * i + 7 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != -3 || j != 3 || */x != -1020 || niters != 50) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters) + for (i = a; i > b; i += c) + for (j = d * i + e; j > g + i * f; j += h) + { + if (i <= -3 || i > 3 || j <= -2 * i + 1 || j > 2 * i + 7 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != -3 || j != 3 || */x != -1020 || niters != 50) + abort (); + for (i = 3; i > -3; i--) + for (j = 2 * i + 7; j > -2 * i + 1; j--) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = 6; i > -6; i--) + for (j = 2 * i + 7; j <= -2 * i + 1; j++) + w[i + 5][j + 5] = 1; + a = 6; b = -6; c = -1; d = 2; e = 7; f = -2; g = 2; h = 1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters) + for (i = 6; i > -6; i--) + for (j = 2 * i + 7; j <= -2 * i + 1; j++) + { + if (i <= -6 || i > 6 || j < 2 * i + 7 || j >= -2 * i + 2 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != -6 || j != 12 || x != -5109 || niters != 36) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters) + for (i = a; i > b; i += c) + for (j = d * i + e; j < g + i * f; j += h) + { + if (i <= -6 || i > 6 || j < 2 * i + 7 || j >= -2 * i + 2 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != -6 || j != 12 || x != -5109 || niters != 36) + abort (); + for (i = 6; i > -6; i--) + for (j = 2 * i + 7; j <= -2 * i + 1; j++) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = 6; i > -6; i -= 2) + for (j = -2 * i + 7; j <= 2 * i + 1; j++) + w[i + 5][j + 5] = 1; + a = 6; b = -6; c = -2; d = -2; e = 7; f = 2; g = 2; h = 1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters) + for (i = 6; i > -6; i -= 2) + for (j = -2 * i + 7; j <= 2 * i + 1; j++) + { + if (i <= -6 || i > 6 || j < -2 * i + 7 || j >= 2 * i + 2 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != -6 || j != 15 || */x != 2053 || niters != 33) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp teams reduction(+:niters) + #pragma omp distribute parallel for collapse(2) lastprivate (i, j, x) reduction(+:niters) + for (i = a; i > b; i += c) + for (j = d * i + e; j < g + i * f; j += h) + { + if (i <= -6 || i > 6 || j < -2 * i + 7 || j >= 2 * i + 2 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != -6 || j != 15 || */x != 2053 || niters != 33) + abort (); + for (i = 6; i > -6; i -= 2) + for (j = -2 * i + 7; j <= 2 * i + 1; j++) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + } + return 0; } diff --git a/libgomp/testsuite/libgomp.c/loop-24.c b/libgomp/testsuite/libgomp.c/loop-24.c new file mode 100644 index 00000000000..24aa01e0889 --- /dev/null +++ b/libgomp/testsuite/libgomp.c/loop-24.c @@ -0,0 +1,424 @@ +/* { dg-do run } */ + +extern void abort (void); + +signed char v[5][7][9][21][4][42][3]; +volatile int zero = 0, one = 1, two = 2, three = 3; +volatile int five = 5, seven = 7, nine = 9, eleven = 11; + +int +main () +{ + for (int i = 0; i < 5; i++) + for (int j = 0; j < 7; j++) + for (int k = 0; k < 9; k++) + for (int l = 2 * j; l < 3 * j; l++) + for (int m = 7; m < 11; m++) + for (int n = l; n < 2 * l; n++) + for (int o = 0; o < 3; o++) + v[i][j][k][l][m - 7][n][o] = 1; + + int niters = 0; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(7) in_reduction(+:niters) + for (int i = 0; i < 5; i++) + for (int j = 0; j < 7; j++) + for (int k = 0; k < 9; k++) + for (int l = 2 * j; l < 3 * j; l++) + for (int m = 7; m < 11; m++) + for (int n = l; n < 2 * l; n++) + for (int o = 0; o < 3; o++) + { + niters++; + if (i < 0 || i >= 5 + || j < 0 || j >= 7 + || k < 0 || k >= 9 + || l < 2 * j || l >= 3 * j + || m < 7 || m >= 11 + || n < l || n >= 2 * l + || o < 0 || o >= 3) + abort (); + if (v[i][j][k][l][m - 7][n][o] != 1) + abort (); + v[i][j][k][l][m - 7][n][o]++; + } + + if (niters != 117180) + abort (); + + int niters2 = 0; + #pragma omp parallel master reduction(task, +:niters2) + #pragma omp taskloop collapse(7) in_reduction(+:niters2) + for (int i = zero; i < five; i += one) + for (int j = seven - one; j >= zero; j -= one) + for (int k = nine - one; k >= zero; k += -one) + for (int l = two * j + zero; l < three * j; l += one) + for (int m = eleven - one; m >= seven; m -= one) + for (int n = two * l - one; n > one * l - one; n -= one) + for (int o = zero; o < three; o += one) + { + niters2++; + if (i < 0 || i >= 5 + || j < 0 || j >= 7 + || k < 0 || k >= 9 + || l < 2 * j || l >= 3 * j + || m < 7 || m >= 11 + || n < l || n >= 2 * l + || o < 0 || o >= 3) + abort (); + if (v[i][j][k][l][m - 7][n][o] != 2) + abort (); + v[i][j][k][l][m - 7][n][o]++; + } + + if (niters2 != 117180) + abort (); + + for (int i = 0; i < 5; i++) + for (int j = 0; j < 7; j++) + for (int k = 0; k < 9; k++) + for (int l = 2 * j; l < 3 * j; l++) + for (int m = 7; m < 11; m++) + for (int n = l; n < 2 * l; n++) + for (int o = 0; o < 3; o++) + if (v[i][j][k][l][m - 7][n][o] != 3) + abort (); + + int niters3 = 0; + #pragma omp parallel master reduction(task, +:niters3) + #pragma omp taskloop collapse(5) in_reduction(+:niters3) + for (int i = 4; i >= 0; i--) + for (int j = 6; j >= 0; --j) + for (int l = 3 * j - 1; l >= 2 * j; l--) + for (int n = 2 * l + -1; n > l - 1; --n) + for (int o = 2; o >= 0; o--) + { + niters3++; + if (i < 0 || i >= 5 + || j < 0 || j >= 7 + || l < 2 * j || l >= 3 * j + || n < l || n >= 2 * l + || o < 0 || o >= 3) + abort (); + if (v[i][j][0][l][0][n][o] != 3) + abort (); + v[i][j][0][l][0][n][o]++; + } + + if (niters3 != 3255) + abort (); + + int niters4 = 0; + #pragma omp parallel master reduction(task, +:niters4) + #pragma omp taskloop collapse(5) in_reduction(+:niters4) + for (int i = zero; i < five; i += one) + for (int j = zero; j <= seven - one; j += one) + for (int l = j * two; l < three * j + zero; l += one) + for (int n = one * l; n <= l * two - one; n += one) + for (int o = zero; o < three; o += one) + { + niters4++; + if (i < 0 || i >= 5 + || j < 0 || j >= 7 + || l < 2 * j || l >= 3 * j + || n < l || n >= 2 * l + || o < 0 || o >= 3) + abort (); + if (v[i][j][0][l][0][n][o] != 4) + abort (); + v[i][j][0][l][0][n][o]++; + } + + if (niters4 != 3255) + abort (); + + for (int i = 0; i < 5; i++) + for (int j = 0; j < 7; j++) + for (int l = 2 * j; l < 3 * j; l++) + for (int n = l; n < 2 * l; n++) + for (int o = 0; o < 3; o++) + if (v[i][j][0][l][0][n][o] != 5) + abort (); + + int niters5 = 0; + #pragma omp parallel master reduction(task, +:niters5) + #pragma omp taskloop collapse(3) in_reduction(+:niters5) + for (int j = 6; j >= 0; --j) + for (int l = 2 * j; l <= 3 * j - 1; l++) + for (int n = 2 * l + -1; n > l - 1; --n) + { + niters5++; + if (j < 0 || j >= 7 + || l < 2 * j || l >= 3 * j + || n < l || n >= 2 * l) + abort (); + if (v[0][j][0][l][0][n][0] != 5) + abort (); + v[0][j][0][l][0][n][0]++; + } + + if (niters5 != 217) + abort (); + + int niters6 = 0; + #pragma omp parallel master reduction(task, +:niters6) + #pragma omp taskloop collapse(3) in_reduction(+:niters6) + for (int j = seven - one; j > - one; j -= one) + for (int l = j * three - one; l >= j * two + zero; l += -one) + for (int n = two * l - one; n > l - one; n -= one) + { + niters6++; + if (j < 0 || j >= 7 + || l < 2 * j || l >= 3 * j + || n < l || n >= 2 * l) + abort (); + if (v[0][j][0][l][0][n][0] != 6) + abort (); + v[0][j][0][l][0][n][0]++; + } + + if (niters6 != 217) + abort (); + + for (int j = 0; j < 7; j++) + for (int l = 2 * j; l < 3 * j; l++) + for (int n = l; n < 2 * l; n++) + if (v[0][j][0][l][0][n][0] != 7) + abort (); + + { + static int i, j, x; + static volatile int a, b, c, d, e, f, g, h; + static int w[13][27]; + for (i = -4; i < 8; i++) + for (j = 3 * i; j > 2 * i; j--) + w[i + 5][j + 5] = 1; + a = -4; b = 8; c = 1; d = 3; e = 0; f = 2; g = 0; h = -1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(2) lastprivate (i, j, x) in_reduction(+:niters) + for (i = -4; i < 8; i++) + for (j = 3 * i; j > 2 * i; j--) + { + if (i < -4 || i >= 8 || j > 3 * i || j <= i * 2 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != 8 || j != 14 || x != 7183 || niters != 28) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(2) lastprivate (i, j, x) in_reduction(+:niters) + for (i = a; i < b; i += c) + for (j = d * i + e; j > g + i * f; j += h) + { + if (i < -4 || i >= 8 || j > 3 * i || j <= i * 2 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != 8 || j != 14 || x != 7183 || niters != 28) + abort (); + for (int i = -4; i < 8; i++) + for (int j = 3 * i; j > 2 * i; j--) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = -2; i < 4; i++) + for (j = -2 * i + 3; j > -3; j -= 2) + w[i + 5][j + 5] = 1; + a = -2; b = 4; c = 1; d = -2; e = 3; f = 0; g = -3; h = -2; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(2) lastprivate (i, j, x) in_reduction(+:niters) + for (i = -2; i < 4; i++) + for (j = -2 * i + 3; j > -3; j -= 2) + { + if (i < -2 || i >= 4 || j <= -3 || j > -2 * i + 3 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/* i != 4 || j != -3 || */x != 3071 || niters != 15) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(2) lastprivate (i, j, x) in_reduction(+:niters) + for (i = a; i < b; i += c) + for (j = d * i + e; j > g + i * f; j += h) + { + if (i < -2 || i >= 4 || j <= -3 || j > -2 * i + 3 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != 4 || j != -3 || */x != 3071 || niters != 15) + abort (); + for (i = -2; i < 4; i++) + for (j = -2 * i + 3; j > -3; j -= 2) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = 3; i > -3; i--) + for (j = -2 * i + 7; j > 2 * i + 1; j--) + w[i + 5][j + 5] = 1; + a = 3; b = -3; c = -1; d = -2; e = 7; f = 2; g = 1; h = -1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(2) lastprivate (i, j, x) in_reduction(+:niters) + for (i = 3; i > -3; i--) + for (j = -2 * i + 7; j > 2 * i + 1; j--) + { + if (i <= -3 || i > 3 || j <= 2 * i + 1 || j > -2 * i + 7 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != -3 || j != -3 || x != -1026 || niters != 32) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(2) lastprivate (i, j, x) in_reduction(+:niters) + for (i = a; i > b; i += c) + for (j = d * i + e; j > g + i * f; j += h) + { + if (i <= -3 || i > 3 || j <= 2 * i + 1 || j > -2 * i + 7 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != -3 || j != -3 || x != -1026 || niters != 32) + abort (); + for (i = 3; i > -3; i--) + for (j = -2 * i + 7; j > 2 * i + 1; j--) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = 3; i > -3; i--) + for (j = 2 * i + 7; j > -2 * i + 1; j--) + w[i + 5][j + 5] = 1; + a = 3; b = -3; c = -1; d = 2; e = 7; f = -2; g = 1; h = -1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(2) lastprivate (i, j, x) in_reduction(+:niters) + for (i = 3; i > -3; i--) + for (j = 2 * i + 7; j > -2 * i + 1; j--) + { + if (i <= -3 || i > 3 || j <= -2 * i + 1 || j > 2 * i + 7 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != -3 || j != 3 || */x != -1020 || niters != 50) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(2) lastprivate (i, j, x) in_reduction(+:niters) + for (i = a; i > b; i += c) + for (j = d * i + e; j > g + i * f; j += h) + { + if (i <= -3 || i > 3 || j <= -2 * i + 1 || j > 2 * i + 7 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != -3 || j != 3 || */x != -1020 || niters != 50) + abort (); + for (i = 3; i > -3; i--) + for (j = 2 * i + 7; j > -2 * i + 1; j--) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = 6; i > -6; i--) + for (j = 2 * i + 7; j <= -2 * i + 1; j++) + w[i + 5][j + 5] = 1; + a = 6; b = -6; c = -1; d = 2; e = 7; f = -2; g = 2; h = 1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(2) lastprivate (i, j, x) in_reduction(+:niters) + for (i = 6; i > -6; i--) + for (j = 2 * i + 7; j <= -2 * i + 1; j++) + { + if (i <= -6 || i > 6 || j < 2 * i + 7 || j >= -2 * i + 2 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != -6 || j != 12 || x != -5109 || niters != 36) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(2) lastprivate (i, j, x) in_reduction(+:niters) + for (i = a; i > b; i += c) + for (j = d * i + e; j < g + i * f; j += h) + { + if (i <= -6 || i > 6 || j < 2 * i + 7 || j >= -2 * i + 2 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (i != -6 || j != 12 || x != -5109 || niters != 36) + abort (); + for (i = 6; i > -6; i--) + for (j = 2 * i + 7; j <= -2 * i + 1; j++) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + for (i = 6; i > -6; i -= 2) + for (j = -2 * i + 7; j <= 2 * i + 1; j++) + w[i + 5][j + 5] = 1; + a = 6; b = -6; c = -2; d = -2; e = 7; f = 2; g = 2; h = 1; + niters = 0; i = -100; j = -100; x = -100; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(2) lastprivate (i, j, x) in_reduction(+:niters) + for (i = 6; i > -6; i -= 2) + for (j = -2 * i + 7; j <= 2 * i + 1; j++) + { + if (i <= -6 || i > 6 || j < -2 * i + 7 || j >= 2 * i + 2 || w[i + 5][j + 5] != 1) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != -6 || j != 15 || */x != 2053 || niters != 33) + abort (); + niters = 0; i = -100; j = -100; x = -100; + #pragma omp parallel master reduction(task, +:niters) + #pragma omp taskloop collapse(2) lastprivate (i, j, x) in_reduction(+:niters) + for (i = a; i > b; i += c) + for (j = d * i + e; j < g + i * f; j += h) + { + if (i <= -6 || i > 6 || j < -2 * i + 7 || j >= 2 * i + 2 || w[i + 5][j + 5] != 2) + abort (); + w[i + 5][j + 5]++; + x = i * 1024 + (j & 1023); + niters++; + } + if (/*i != -6 || j != 15 || */x != 2053 || niters != 33) + abort (); + for (i = 6; i > -6; i -= 2) + for (j = -2 * i + 7; j <= 2 * i + 1; j++) + if (w[i + 5][j + 5] == 3) + w[i + 5][j + 5] = 0; + else + abort (); + } + + return 0; +}