On 2/3/2026 7:09 AM, Robin Dapp wrote:
Hi,

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 re-uses vldr and vstr as "type" attribute and disables
the "ratio" attribute for them when TARGET_XTHEADVECTOR is
enabled.

I didn't manage to come up with a simple test case, though.

Regtested on rv64gcv_zvl512b.

Regards
  Robin

        PR target/123870

gcc/ChangeLog:

        * config/riscv/thead-vector.md: Use vldr,vstr ad type for
        pred_th_whole_mov.
        * config/riscv/vector.md: Disable ratio for vldr,vstr with
        TARGET_XTHEADVECTOR.
Do we need the same fix for the other pred_th_whole_mov pattern which handles VB mode that immediately followed the one you changed?

OK with or without that additional change depending on your conclusion.
jeff

Reply via email to