aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree-vect-loop.cc
diff options
context:
space:
mode:
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>2023-12-14 21:45:59 +0800
committerPan Li <pan2.li@intel.com>2023-12-15 08:26:45 +0800
commitc7ef2189855a8cf12427a778cd5a31d42ddf6260 (patch)
tree6242fc448fcc3a15a09d77424d2871072594743f /gcc/tree-vect-loop.cc
parentf998335ac0aa56261789282cba5ae1286ddf3a1f (diff)
downloadgcc-c7ef2189855a8cf12427a778cd5a31d42ddf6260.zip
gcc-c7ef2189855a8cf12427a778cd5a31d42ddf6260.tar.gz
gcc-c7ef2189855a8cf12427a778cd5a31d42ddf6260.tar.bz2
Middle-end: Do not model address cost for SELECT_VL style vectorization
Follow Richard's suggestions, we should not model address cost in the loop vectorizer for select_vl or decrement IV since other style vectorization doesn't do that. To make cost model comparison apple to apple. This patch set COST from 2 to 1 which turns out have better codegen in various codegen for RVV. Ok for trunk ? PR target/111153 gcc/ChangeLog: * tree-vect-loop.cc (vect_estimate_min_profitable_iters): Remove address cost for select_vl/decrement IV. gcc/testsuite/ChangeLog: * gcc.dg/vect/costmodel/riscv/rvv/pr111153.c: Moved to... * gcc.dg/vect/costmodel/riscv/rvv/pr11153-2.c: ...here. * gcc.dg/vect/costmodel/riscv/rvv/pr111153-1.c: New test.
Diffstat (limited to 'gcc/tree-vect-loop.cc')
-rw-r--r--gcc/tree-vect-loop.cc10
1 files changed, 4 insertions, 6 deletions
diff --git a/gcc/tree-vect-loop.cc b/gcc/tree-vect-loop.cc
index 19e38b8..7a3db5f 100644
--- a/gcc/tree-vect-loop.cc
+++ b/gcc/tree-vect-loop.cc
@@ -4872,12 +4872,10 @@ vect_estimate_min_profitable_iters (loop_vec_info loop_vinfo,
unsigned int length_update_cost = 0;
if (LOOP_VINFO_USING_DECREMENTING_IV_P (loop_vinfo))
- /* For decrement IV style, we use a single SELECT_VL since
- beginning to calculate the number of elements need to be
- processed in current iteration, and a SHIFT operation to
- compute the next memory address instead of adding vectorization
- factor. */
- length_update_cost = 2;
+ /* For decrement IV style, Each only need a single SELECT_VL
+ or MIN since beginning to calculate the number of elements
+ need to be processed in current iteration. */
+ length_update_cost = 1;
else
/* For increment IV stype, Each may need two MINs and one MINUS to
update lengths in body for next iteration. */