From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1666) id 9B97D385E83F; Wed, 16 Mar 2022 08:22:07 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9B97D385E83F MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Richard Biener To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-9656] tree-optimization/103641 - improve vect_synth_mult_by_constant X-Act-Checkin: gcc X-Git-Author: Richard Biener X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: c54f95a7984dd0319e87f5cdc522de10c58dd0f7 X-Git-Newrev: b6950623cd13c98354b105d7210cc1cf6a284f3a Message-Id: <20220316082207.9B97D385E83F@sourceware.org> Date: Wed, 16 Mar 2022 08:22:07 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Mar 2022 08:22:07 -0000 https://gcc.gnu.org/g:b6950623cd13c98354b105d7210cc1cf6a284f3a commit r11-9656-gb6950623cd13c98354b105d7210cc1cf6a284f3a Author: Richard Biener Date: Fri Feb 4 09:26:57 2022 +0100 tree-optimization/103641 - improve vect_synth_mult_by_constant The following happens to improve compile-time of the PR103641 testcase on aarch64 significantly. I did not investigate the effect on the generated code but at least in theory choose_mult_variant should do a better job when we tell it the actual mode we are going to use for the operations it synthesizes. 2022-02-04 Richard Biener PR tree-optimization/103641 * tree-vect-patterns.c (vect_synth_mult_by_constant): Pass the vector mode to choose_mult_variant. (cherry picked from commit 876e70d4681332a600492173af0c7259e5a438c6) Diff: --- gcc/tree-vect-patterns.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/gcc/tree-vect-patterns.c b/gcc/tree-vect-patterns.c index a48b7deceb8..f6e8c3c8575 100644 --- a/gcc/tree-vect-patterns.c +++ b/gcc/tree-vect-patterns.c @@ -2858,6 +2858,9 @@ vect_synth_mult_by_constant (vec_info *vinfo, tree op, tree val, bool cast_to_unsigned_p = !TYPE_OVERFLOW_WRAPS (itype); tree multtype = cast_to_unsigned_p ? unsigned_type_for (itype) : itype; + tree vectype = get_vectype_for_scalar_type (vinfo, multtype); + if (!vectype) + return NULL; /* Targets that don't support vector shifts but support vector additions can synthesize shifts that way. */ @@ -2867,16 +2870,13 @@ vect_synth_mult_by_constant (vec_info *vinfo, tree op, tree val, /* Use MAX_COST here as we don't want to limit the sequence on rtx costs. The vectorizer's benefit analysis will decide whether it's beneficial to do this. */ - bool possible = choose_mult_variant (mode, hwval, &alg, - &variant, MAX_COST); + bool possible = choose_mult_variant (VECTOR_MODE_P (TYPE_MODE (vectype)) + ? TYPE_MODE (vectype) : mode, + hwval, &alg, &variant, MAX_COST); if (!possible) return NULL; - tree vectype = get_vectype_for_scalar_type (vinfo, multtype); - - if (!vectype - || !target_supports_mult_synth_alg (&alg, variant, - vectype, synth_shift_p)) + if (!target_supports_mult_synth_alg (&alg, variant, vectype, synth_shift_p)) return NULL; tree accumulator;