]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Avoid vaaddu.vx combine pattern pollute VXRM csr
authorPan Li <pan2.li@intel.com>
Wed, 23 Jul 2025 04:08:02 +0000 (12:08 +0800)
committerPan Li <pan2.li@intel.com>
Thu, 24 Jul 2025 01:57:49 +0000 (09:57 +0800)
commit5aec85a5f490895f90c1ef75f965ea100e80f50e
treec62f10f2a962543d7a54983cbbed3293c46ae7bd
parentbe81c5c01c243013c4bac0718e63e0fdc132d384
RISC-V: Avoid vaaddu.vx combine pattern pollute VXRM csr

The vaaddu.vx combine almost comes from avg_floor, it will
requires the vxrm to be RDN.  But not all vaaddu.vx should
depends on the RDN.  The vaaddu.vx combine should leverage
the VXRM value as is instead of pollute them all to RDN.

This patch would like to fix this and set it as is.

gcc/ChangeLog:

* config/riscv/autovec-opt.md (*uavg_floor_vx_<mode>): Rename
from...
(*<sat_op_v_vdup>_vx_<mode>): Rename to...
(*<sat_op_vdup_v>_vx_<mode>): Rename to...
* config/riscv/riscv-protos.h (enum insn_flags): Add vxrm
RNE, ROD type.
(enum insn_type): Add RNE_P, ROD_P type.
(expand_vx_binary_vxrm_vec_vec_dup): Add new func decl.
(expand_vx_binary_vxrm_vec_dup_vec): Ditto.
* config/riscv/riscv-v.cc (get_insn_type_by_vxrm_val): Add
helper to get insn type by vxrm value.
(expand_vx_binary_vxrm_vec_vec_dup): Add new func impl
to expand vec + vec_dup pattern.
(expand_vx_binary_vxrm_vec_dup_vec): Ditto but for
vec_dup + vec pattern.
* config/riscv/vector-iterators.md: Add helper iterator
for sat vx combine.

Signed-off-by: Pan Li <pan2.li@intel.com>
gcc/config/riscv/autovec-opt.md
gcc/config/riscv/riscv-protos.h
gcc/config/riscv/riscv-v.cc
gcc/config/riscv/vector-iterators.md