]> git.ipfire.org Git - thirdparty/gcc.git/commit
vect: Use type precision in reduction epilogue [PR123097].
authorRobin Dapp <rdapp@ventanamicro.com>
Fri, 12 Dec 2025 08:52:16 +0000 (09:52 +0100)
committerRobin Dapp <rdapp@oss.qualcomm.com>
Fri, 19 Dec 2025 18:41:53 +0000 (19:41 +0100)
commite8937196b2bdb0c7c7f967a4ddca3520e2db9b6b
treea342885770018466fda073068fa55c30601671a0
parentd9a375eafa566ffc5f0157b5d7c527fa615252be
vect: Use type precision in reduction epilogue [PR123097].

In the PR we extract non-existent bits/elements from a vector.  This is
because we use TYPE_SIZE (vectype) for a boolean vector which returns 8
instead of 4 for RVV's vector (4) <signed-boolean:1>.

The patch uses TYPE_VECTOR_SUBPARTS instead and multiplies its result
with vector_element_bits to get the proper number of elements and size.

PR tree-optimization/123097

gcc/ChangeLog:

* tree-vect-loop.cc (vect_create_epilog_for_reduction):
Calculate vector size by number of elements * bit size per
element.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr123097-run.c: New test.
* gcc.target/riscv/rvv/autovec/pr123097.c: New test.
gcc/testsuite/gcc.target/riscv/rvv/autovec/pr123097-run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/rvv/autovec/pr123097.c [new file with mode: 0644]
gcc/tree-vect-loop.cc