diff options
Diffstat (limited to 'gcc/loop-unroll.c')
-rw-r--r-- | gcc/loop-unroll.c | 51 |
1 files changed, 21 insertions, 30 deletions
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index 40f06dbbca3..ac43f582d36 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -647,7 +647,7 @@ decide_unroll_constant_iterations (struct loop *loop, int flags) { unsigned nunroll, nunroll_by_av, best_copies, best_unroll = 0, n_copies, i; struct niter_desc *desc; - double_int iterations; + widest_int iterations; if (!(flags & UAP_UNROLL)) { @@ -697,7 +697,7 @@ decide_unroll_constant_iterations (struct loop *loop, int flags) if (desc->niter < 2 * nunroll || ((get_estimated_loop_iterations (loop, &iterations) || get_max_loop_iterations (loop, &iterations)) - && iterations.ult (double_int::from_shwi (2 * nunroll)))) + && wi::ltu_p (iterations, 2 * nunroll))) { if (dump_file) fprintf (dump_file, ";; Not unrolling loop, doesn't roll\n"); @@ -818,11 +818,10 @@ unroll_loop_constant_iterations (struct loop *loop) desc->noloop_assumptions = NULL_RTX; desc->niter -= exit_mod; - loop->nb_iterations_upper_bound -= double_int::from_uhwi (exit_mod); + loop->nb_iterations_upper_bound -= exit_mod; if (loop->any_estimate - && double_int::from_uhwi (exit_mod).ule - (loop->nb_iterations_estimate)) - loop->nb_iterations_estimate -= double_int::from_uhwi (exit_mod); + && wi::leu_p (exit_mod, loop->nb_iterations_estimate)) + loop->nb_iterations_estimate -= exit_mod; else loop->any_estimate = false; } @@ -862,11 +861,10 @@ unroll_loop_constant_iterations (struct loop *loop) apply_opt_in_copies (opt_info, exit_mod + 1, false, false); desc->niter -= exit_mod + 1; - loop->nb_iterations_upper_bound -= double_int::from_uhwi (exit_mod + 1); + loop->nb_iterations_upper_bound -= exit_mod + 1; if (loop->any_estimate - && double_int::from_uhwi (exit_mod + 1).ule - (loop->nb_iterations_estimate)) - loop->nb_iterations_estimate -= double_int::from_uhwi (exit_mod + 1); + && wi::leu_p (exit_mod + 1, loop->nb_iterations_estimate)) + loop->nb_iterations_estimate -= exit_mod + 1; else loop->any_estimate = false; desc->noloop_assumptions = NULL_RTX; @@ -918,14 +916,10 @@ unroll_loop_constant_iterations (struct loop *loop) desc->niter /= max_unroll + 1; loop->nb_iterations_upper_bound - = loop->nb_iterations_upper_bound.udiv (double_int::from_uhwi (max_unroll - + 1), - TRUNC_DIV_EXPR); + = wi::udiv_trunc (loop->nb_iterations_upper_bound, max_unroll + 1); if (loop->any_estimate) loop->nb_iterations_estimate - = loop->nb_iterations_estimate.udiv (double_int::from_uhwi (max_unroll - + 1), - TRUNC_DIV_EXPR); + = wi::udiv_trunc (loop->nb_iterations_estimate, max_unroll + 1); desc->niter_expr = GEN_INT (desc->niter); /* Remove the edges. */ @@ -946,7 +940,7 @@ decide_unroll_runtime_iterations (struct loop *loop, int flags) { unsigned nunroll, nunroll_by_av, i; struct niter_desc *desc; - double_int iterations; + widest_int iterations; if (!(flags & UAP_UNROLL)) { @@ -1002,7 +996,7 @@ decide_unroll_runtime_iterations (struct loop *loop, int flags) /* Check whether the loop rolls. */ if ((get_estimated_loop_iterations (loop, &iterations) || get_max_loop_iterations (loop, &iterations)) - && iterations.ult (double_int::from_shwi (2 * nunroll))) + && wi::ltu_p (iterations, 2 * nunroll)) { if (dump_file) fprintf (dump_file, ";; Not unrolling loop, doesn't roll\n"); @@ -1312,14 +1306,10 @@ unroll_loop_runtime_iterations (struct loop *loop) simplify_gen_binary (UDIV, desc->mode, old_niter, gen_int_mode (max_unroll + 1, desc->mode)); loop->nb_iterations_upper_bound - = loop->nb_iterations_upper_bound.udiv (double_int::from_uhwi (max_unroll - + 1), - TRUNC_DIV_EXPR); + = wi::udiv_trunc (loop->nb_iterations_upper_bound, max_unroll + 1); if (loop->any_estimate) loop->nb_iterations_estimate - = loop->nb_iterations_estimate.udiv (double_int::from_uhwi (max_unroll - + 1), - TRUNC_DIV_EXPR); + = wi::udiv_trunc (loop->nb_iterations_estimate, max_unroll + 1); if (exit_at_end) { desc->niter_expr = @@ -1327,7 +1317,7 @@ unroll_loop_runtime_iterations (struct loop *loop) desc->noloop_assumptions = NULL_RTX; --loop->nb_iterations_upper_bound; if (loop->any_estimate - && loop->nb_iterations_estimate != double_int_zero) + && loop->nb_iterations_estimate != 0) --loop->nb_iterations_estimate; else loop->any_estimate = false; @@ -1347,7 +1337,7 @@ static void decide_peel_simple (struct loop *loop, int flags) { unsigned npeel; - double_int iterations; + widest_int iterations; if (!(flags & UAP_PEEL)) { @@ -1391,7 +1381,8 @@ decide_peel_simple (struct loop *loop, int flags) /* If we have realistic estimate on number of iterations, use it. */ if (get_estimated_loop_iterations (loop, &iterations)) { - if (double_int::from_shwi (npeel).ule (iterations)) + /* TODO: unsigned/signed confusion */ + if (wi::leu_p (npeel, iterations)) { if (dump_file) { @@ -1408,7 +1399,7 @@ decide_peel_simple (struct loop *loop, int flags) /* If we have small enough bound on iterations, we can still peel (completely unroll). */ else if (get_max_loop_iterations (loop, &iterations) - && iterations.ult (double_int::from_shwi (npeel))) + && wi::ltu_p (iterations, npeel)) npeel = iterations.to_shwi () + 1; else { @@ -1502,7 +1493,7 @@ decide_unroll_stupid (struct loop *loop, int flags) { unsigned nunroll, nunroll_by_av, i; struct niter_desc *desc; - double_int iterations; + widest_int iterations; if (!(flags & UAP_UNROLL_ALL)) { @@ -1559,7 +1550,7 @@ decide_unroll_stupid (struct loop *loop, int flags) /* Check whether the loop rolls. */ if ((get_estimated_loop_iterations (loop, &iterations) || get_max_loop_iterations (loop, &iterations)) - && iterations.ult (double_int::from_shwi (2 * nunroll))) + && wi::ltu_p (iterations, 2 * nunroll)) { if (dump_file) fprintf (dump_file, ";; Not unrolling loop, doesn't roll\n"); |