diff options
Diffstat (limited to 'gcc/loop-unroll.c')
-rw-r--r-- | gcc/loop-unroll.c | 50 |
1 files changed, 20 insertions, 30 deletions
diff --git a/gcc/loop-unroll.c b/gcc/loop-unroll.c index df6fc9c..5797d20 100644 --- a/gcc/loop-unroll.c +++ b/gcc/loop-unroll.c @@ -641,7 +641,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)) { @@ -694,7 +694,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"); @@ -814,11 +814,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; } @@ -858,11 +857,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; @@ -914,14 +912,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. */ @@ -941,7 +935,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)) { @@ -997,7 +991,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"); @@ -1357,14 +1351,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 = @@ -1372,7 +1362,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; @@ -1390,7 +1380,7 @@ static void decide_peel_simple (struct loop *loop, int flags) { unsigned npeel; - double_int iterations; + widest_int iterations; if (!(flags & UAP_PEEL)) { @@ -1434,7 +1424,7 @@ 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)) + if (wi::leu_p (npeel, iterations)) { if (dump_file) { @@ -1451,7 +1441,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 { @@ -1545,7 +1535,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)) { @@ -1602,7 +1592,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"); |