diff options
author | Tamar Christina <tamar.christina@arm.com> | 2025-07-09 08:42:02 +0100 |
---|---|---|
committer | Tamar Christina <tamar.christina@arm.com> | 2025-07-09 08:42:02 +0100 |
commit | 963d5362c598d48ee7a896e674d2a68c41179785 (patch) | |
tree | c2425173931ec6094786eb00c54723135d25e827 | |
parent | 6c8d221b74869f2760ded2d67f95dd9d275bc1a2 (diff) | |
download | gcc-963d5362c598d48ee7a896e674d2a68c41179785.zip gcc-963d5362c598d48ee7a896e674d2a68c41179785.tar.gz gcc-963d5362c598d48ee7a896e674d2a68c41179785.tar.bz2 |
middle-end: Use rounding division for ranges for partial vectors [PR120922]
This patch adds support for niters ranges for partial
vector loops.
Due to the last iteration being partial the bounds should
be at least 1 but niters // vf as the max.
gcc/ChangeLog:
PR tree-optimization/120922
* tree-vect-loop-manip.cc (vect_gen_vector_loop_niters): Support range
for partial vectors.
-rw-r--r-- | gcc/tree-vect-loop-manip.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/gcc/tree-vect-loop-manip.cc b/gcc/tree-vect-loop-manip.cc index 9c58a6a..2d01a4b 100644 --- a/gcc/tree-vect-loop-manip.cc +++ b/gcc/tree-vect-loop-manip.cc @@ -2857,11 +2857,21 @@ vect_gen_vector_loop_niters (loop_vec_info loop_vinfo, tree niters, we set range information to make niters analyzer's life easier. Note the number of latch iteration value can be TYPE_MAX_VALUE so we have to represent the vector niter TYPE_MAX_VALUE + 1 / vf. */ - if (stmts != NULL - && const_vf > 0 - && !LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo)) + if (stmts != NULL && const_vf > 0) { - if (niters_no_overflow) + if (niters_no_overflow + && LOOP_VINFO_USING_PARTIAL_VECTORS_P (loop_vinfo)) + { + int_range<1> vr (type, + wi::one (TYPE_PRECISION (type)), + wi::div_ceil (wi::max_value + (TYPE_PRECISION (type), + TYPE_SIGN (type)), + const_vf, + TYPE_SIGN (type))); + set_range_info (niters_vector, vr); + } + else if (niters_no_overflow) { int_range<1> vr (type, wi::one (TYPE_PRECISION (type)), |