aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r--gcc/tree-vect-loop.cc13
1 files changed, 9 insertions, 4 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 4a8b0a1..40f167d 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -9222,12 +9222,17 @@ vect_peel_nonlinear_iv_init (gimple_seq* stmts, tree init_expr,
{
tree utype = unsigned_type_for (type);
init_expr = gimple_convert (stmts, utype, init_expr);
- unsigned skipn = TREE_INT_CST_LOW (skip_niters);
+ wide_int skipn = wi::to_wide (skip_niters);
wide_int begin = wi::to_wide (step_expr);
- for (unsigned i = 0; i != skipn - 1; i++)
- begin = wi::mul (begin, wi::to_wide (step_expr));
+ auto_mpz base, exp, mod, res;
+ wi::to_mpz (begin, base, TYPE_SIGN (type));
+ wi::to_mpz (skipn, exp, UNSIGNED);
+ mpz_ui_pow_ui (mod, 2, TYPE_PRECISION (type));
+ mpz_powm (res, base, exp, mod);
+ begin = wi::from_mpz (type, res, TYPE_SIGN (type));
tree mult_expr = wide_int_to_tree (utype, begin);
- init_expr = gimple_build (stmts, MULT_EXPR, utype, init_expr, mult_expr);
+ init_expr = gimple_build (stmts, MULT_EXPR, utype,
+ init_expr, mult_expr);
init_expr = gimple_convert (stmts, type, init_expr);
}
break;