]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Expand const_vector with 2 elts per pattern.
authorRobin Dapp <rdapp.gcc@gmail.com>
Mon, 4 Aug 2025 09:09:50 +0000 (11:09 +0200)
committerJeff Law <jlaw@ventanamicro.com>
Tue, 12 Aug 2025 21:37:23 +0000 (15:37 -0600)
commit980e1fc195325cd4637ce52d0e2b0e7fcc763f60
tree27adec2a410352b7d6001c19b8a88491aa8901a6
parent9467435253948b83fcb5f7430f6cd571236960d8
RISC-V: Expand const_vector with 2 elts per pattern.

Hi,

In PR121334 we are asked to expand a const_vector of size 4 with
poly_int elements.  It has 2 elts per pattern so is neither a
const_vector_duplicate nor a const_vector_stepped.

We don't allow this kind of constant in legitimate_constant_p but expr
apparently still wants us to expand it under certain conditions.

This patch implements a basic expander for such kinds of patterns.
As slide1up is used to build the individual vectors it also adds
a helper function expand_slide1up.

I regtested on rv64gcv_zvl512b but unfortunately the newly created pattern is
not even executed.  I tried some variations of the original code but didn't
manage to trigger it.

Regards
 Robin

PR target/121334

gcc/ChangeLog:

* config/riscv/riscv-v.cc (expand_slide1up): New function.
(expand_vector_init_trailing_same_elem): Use new function.
(expand_const_vector_onestep): New function.
(expand_const_vector): Uew expand_slide1up.
(expand_vector_init_merge_repeating_sequence): Ditto.
(shuffle_off_by_one_patterns): Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/autovec/pr121334.c: New test.
gcc/config/riscv/riscv-v.cc
gcc/testsuite/gcc.target/riscv/rvv/autovec/pr121334.c [new file with mode: 0644]