diff options
author | Richard Biener <rguenther@suse.de> | 2022-02-04 09:26:57 +0100 |
---|---|---|
committer | Richard Biener <rguenther@suse.de> | 2022-02-04 11:30:11 +0100 |
commit | 876e70d4681332a600492173af0c7259e5a438c6 (patch) | |
tree | 70ab826fa8708c4b33d41f54afda85ad102b1c15 /gcc | |
parent | 49365d511ac9b64009b1de11ef8a941f59407f67 (diff) | |
download | gcc-876e70d4681332a600492173af0c7259e5a438c6.zip gcc-876e70d4681332a600492173af0c7259e5a438c6.tar.gz gcc-876e70d4681332a600492173af0c7259e5a438c6.tar.bz2 |
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.cc (vect_synth_mult_by_constant):
Pass the vector mode to choose_mult_variant.
Diffstat (limited to 'gcc')
-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 bea0499..2baf974 100644 --- a/gcc/tree-vect-patterns.cc +++ b/gcc/tree-vect-patterns.cc @@ -3041,6 +3041,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. */ @@ -3050,16 +3053,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; |