public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r11-9656] tree-optimization/103641 - improve vect_synth_mult_by_constant
@ 2022-03-16  8:22 Richard Biener
  0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2022-03-16  8:22 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:b6950623cd13c98354b105d7210cc1cf6a284f3a

commit r11-9656-gb6950623cd13c98354b105d7210cc1cf6a284f3a
Author: Richard Biener <rguenther@suse.de>
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  <rguenther@suse.de>
    
            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;


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-16  8:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-16  8:22 [gcc r11-9656] tree-optimization/103641 - improve vect_synth_mult_by_constant Richard Biener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).