]> git.ipfire.org Git - thirdparty/gcc.git/commit
RISC-V: Fix xtheadvector ratio attribute. [PR123870]
authorRobin Dapp <rdapp@oss.qualcomm.com>
Wed, 4 Feb 2026 20:20:22 +0000 (21:20 +0100)
committerRobin Dapp <rdapp@oss.qualcomm.com>
Thu, 5 Feb 2026 09:52:49 +0000 (10:52 +0100)
commitcca779f6b4cfc35c7c771e0604c915b2eecb6236
treef0e94ef11be4450ef751d9c4d777e6bbd209aa23
parentecc37444062b408c9e06f811fb3f382ea94f3245
RISC-V: Fix xtheadvector ratio attribute. [PR123870]

As reported in PR123870 we miscompile an RVV-optimized jpeg-quantsmooth
with xtheadvector.  The core issue is that we forget to emit a vsetvl
before a -fschedule-insn induced spill restore.  Spills are usually
handled by full-register loads and stores but xtheadvector doesn't have
those.  Instead, the regular loads and stores are used which differ from
full-register loads/store in the fact that they don't encode the LMUL
in the instruction directly and thus require a proper SEW and LMUL in
the vtype rather than just the ratio.

This patch makes vlds have an SEW/LMUL demand instead of a "ratio only"
demand for theadvector.

I didn't manage to come up with a simple test case, though.
PR123969 has a test but it won't fail without slight changes to the
16 codebase.  I'm still adding it for documentation and backport
reasons.

Regtested on rv64gcv_zvl512b.

PR target/123870
PR target/123969

gcc/ChangeLog:

* config/riscv/vector.md: Add vlds to "no ratio" for
theadvector.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/rvv/xtheadvector/pr123969.c: New test.

Signed-off-by: Robin Dapp <rdapp@oss.qualcomm.com>
gcc/config/riscv/vector.md
gcc/testsuite/gcc.target/riscv/rvv/xtheadvector/pr123969.c [new file with mode: 0644]