[Bug target/118945] RISC-V: VSETL pass: Don't promote Vectors ops from Tail agnostic to Tail Undisturbed

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Oct 4 14:30:17 GMT 2025


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=118945

--- Comment #14 from GCC Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jeff Law <law@gcc.gnu.org>:

https://gcc.gnu.org/g:4b4d5fc649a2678d539f6ed119ee2a1bb4db9a2e

commit r16-4215-g4b4d5fc649a2678d539f6ed119ee2a1bb4db9a2e
Author: Zhongyao Chen <chenzhongyao.hit@gmail.com>
Date:   Sat Oct 4 08:29:32 2025 -0600

    [PR target/118945][PATCH v3] RISC-V: Add 'prefer_agnostic' tune parameter
for vector policies

    Improve RISC-V vector code generation by preferring tail-agnostic (ta) and
    mask-agnostic (ma) policies for vector instructions when merge operands
    are undefined. This optimization, controlled by a uarch-specific
`prefer_agnostic`
    tuning parameter, reduces `vsetvl` instructions and avoids conservative
    undisturbed policy selections, addressing PR target/118945.

    Changes from v2:
            - more detailed comment.
            - refine the test to check for vsetvli ta/tu number explicitly.

            PR target/118945
    gcc/ChangeLog:

            * config/riscv/riscv.cc (riscv_prefer_agnostic_p): New function.
            (riscv_tune_param): Add prefer_agnostic member.
            (various tune info structures): Initialize prefer_agnostic.
            * config/riscv/riscv-protos.h (riscv_prefer_agnostic_p): Add
            prototype.
            * config/riscv/riscv-v.cc (get_prefer_tail_policy,
            get_prefer_mask_policy): Use riscv_prefer_agnostic_p.
            * config/riscv/riscv-vsetvl.cc (vsetvl_info::get_demand_flags):
            demand policy for agnostic when prefer_agnostic is true.

    gcc/testsuite/ChangeLog:

            * gcc.target/riscv/rvv/autovec/pr118945-1.c: New file.
            * gcc.target/riscv/rvv/autovec/pr118945-2.c: New file.


More information about the Gcc-bugs mailing list