diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-04-29 17:46:20 +0200 |
---|---|---|
committer | Eric Botcazou <ebotcazou@adacore.com> | 2024-05-08 10:06:17 +0200 |
commit | 10e34aa5b1d23e1517f0ca5cfae3cac3b51a7a53 (patch) | |
tree | 1ec993e2da35d41caeb7f1575061601f8cb4e5e5 /gcc/tree-vect-patterns.cc | |
parent | d826f7945609046f922732b138fb90795d5b1985 (diff) | |
download | gcc-10e34aa5b1d23e1517f0ca5cfae3cac3b51a7a53.zip gcc-10e34aa5b1d23e1517f0ca5cfae3cac3b51a7a53.tar.gz gcc-10e34aa5b1d23e1517f0ca5cfae3cac3b51a7a53.tar.bz2 |
Minor tweaks to code computing modular multiplicative inverse
This removes the last parameter of choose_multiplier, which is unused, adds
another assertion and more details to the description and various comments.
Likewise to the closely related invert_mod2n, except for the last parameter.
[changelog]
* expmed.h (choose_multiplier): Tweak description and remove last
parameter.
* expmed.cc (choose_multiplier): Likewise. Add assertion for the
third parameter and adds details to various comments.
(invert_mod2n): Tweak description and add assertion for the first
parameter.
(expand_divmod): Adjust calls to choose_multiplier.
* tree-vect-generic.cc (expand_vector_divmod): Likewise.
* tree-vect-patterns.cc (vect_recog_divmod_pattern): Likewise.
Diffstat (limited to 'gcc/tree-vect-patterns.cc')
-rw-r--r-- | gcc/tree-vect-patterns.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc index 87c2acf..8e8de5e 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -4535,7 +4535,7 @@ vect_recog_divmod_pattern (vec_info *vinfo, enum tree_code rhs_code; optab optab; tree q, cst; - int dummy_int, prec; + int prec; if (!is_gimple_assign (last_stmt)) return NULL; @@ -4795,17 +4795,17 @@ vect_recog_divmod_pattern (vec_info *vinfo, /* FIXME: Can transform this into oprnd0 >= oprnd1 ? 1 : 0. */ return NULL; - /* Find a suitable multiplier and right shift count - instead of multiplying with D. */ - mh = choose_multiplier (d, prec, prec, &ml, &post_shift, &dummy_int); + /* Find a suitable multiplier and right shift count instead of + directly dividing by D. */ + mh = choose_multiplier (d, prec, prec, &ml, &post_shift); - /* If the suggested multiplier is more than SIZE bits, we can do better + /* If the suggested multiplier is more than PREC bits, we can do better for even divisors, using an initial right shift. */ if (mh != 0 && (d & 1) == 0) { pre_shift = ctz_or_zero (d); mh = choose_multiplier (d >> pre_shift, prec, prec - pre_shift, - &ml, &post_shift, &dummy_int); + &ml, &post_shift); gcc_assert (!mh); } else @@ -4924,7 +4924,7 @@ vect_recog_divmod_pattern (vec_info *vinfo, /* This case is not handled correctly below. */ return NULL; - choose_multiplier (abs_d, prec, prec - 1, &ml, &post_shift, &dummy_int); + choose_multiplier (abs_d, prec, prec - 1, &ml, &post_shift); if (ml >= HOST_WIDE_INT_1U << (prec - 1)) { add = true; |