]> git.ipfire.org Git - thirdparty/gcc.git/commit
tree-optimization/122474 - adjust check for .VEC_SHL_INSERT
authorRichard Biener <rguenther@suse.de>
Fri, 23 Jan 2026 14:24:53 +0000 (15:24 +0100)
committerRichard Biener <rguenther@suse.de>
Mon, 26 Jan 2026 13:03:02 +0000 (14:03 +0100)
commitbc9e32c5ebb0237a36e17825276f892ef7e41f1d
treed78050c716ca91933d787bb63115b721bbb7b3ef
parentdd38fa87afc8a9bb17af0121282dade697111f4d
tree-optimization/122474 - adjust check for .VEC_SHL_INSERT

The r16-4558-g1b387bd8978577 change added a check that does not
match what the commit message says.  The following fixes this,
trying to more closely match up what we later do during transform
and what we check here.  As cleanup this also makes sure that
we compute the neutral value for the scalar type and consistently
when it depends on the initial value, recording it in a new
VECT_REDUC_INFO_NEUTRAL_OP.  This avoids issues with comparing
the neutral and initial value when it is bool.  This also
refactors vect_transform_cycle_phi a bit to remove dead code
and make the flow easier to follow.

PR tree-optimization/122474
* tree-vectorizer.h (vect_reduc_info_s::neutral_op): New.
(VECT_REDUC_INFO_NEUTRAL_OP): New.
* tree-vect-loop.cc (vectorizable_reduction): Adjust condition
guarding the check for .VEC_SHL_INSERT.

* gcc.target/aarch64/sve2/pr123053.c: New testcase.
* gcc.target/riscv/rvv/pr122474.c: Likewise.
gcc/testsuite/gcc.target/aarch64/sve2/pr123053.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/rvv/pr122474.c [new file with mode: 0644]
gcc/tree-vect-loop.cc
gcc/tree-vectorizer.h