Skip to content

fix(riscv): reject FP widening vd/vs2 overlap beyond the high part - #208

Closed
carlosqwqqwq wants to merge 2 commits into
HexRaysSA:masterfrom
carlosqwqqwq:fix-riscv-fp-widening-overlap
Closed

fix(riscv): reject FP widening vd/vs2 overlap beyond the high part#208
carlosqwqqwq wants to merge 2 commits into
HexRaysSA:masterfrom
carlosqwqqwq:fix-riscv-fp-widening-overlap

Conversation

@carlosqwqqwq

Copy link
Copy Markdown
Contributor

fix(riscv): reject FP widening vd/vs2 overlap beyond the high part

Closes #207

Summary

The FP widening ops (vfwadd/vfwsub/vfwmul/vfwcvt*/vfwmacc*) write a 2*LMUL destination; RVV §5.2 only permits an overlap in the highest-numbered part of the destination group (source group ends where the destination ends). No group-overlap validation existed for this family, so reserved encodings executed normally.

Validation

  • Validation covers the whole FP widening family with the .w forms using the wide source group width; fractional LMUL keeps one-register source and destination groups.
  • CPU regression covers high-part legal overlap, disjoint groups, low-part reserved overlap, misaligned destination, the vfwmacc family, and fractional-LMUL cases.
  • cargo test --lib: cpu suite 70 passed, 0 failed.

Notes

The vector semantics live in cpu/vector.rs after the refactor in #202, so this change does not grow the oversized cpu.rs.

carlosqwqqwq and others added 2 commits August 11, 2026 22:52
cpu.rs exceeded the AGENTS.md hard split triggers (2000 lines / 150 kB). Move the vector (RVV) element access and data-path execution group, including set_vtype, into cpu/vector.rs with no behavior change.
The FP widening ops (vfwadd/vfwsub/vfwmul/vfwcvt*/vfwmacc*) write a 2*LMUL destination; only an overlap in the highest-numbered part of the destination group is legal (RVV §5.2). No group-overlap validation existed for this family. Fractional LMUL keeps one-register source and destination groups.
@19h

19h commented Aug 11, 2026

Copy link
Copy Markdown
Member

Thanks @carlosqwqqwq. This fix is being consolidated into rollup PR #203, where it shares centralized direct-interpreter, SMIR/JIT, and QEMU differential coverage with the related RVV corrections. Closing this PR in favor of #203; the relevant rollup commits credit you as co-author.

@19h 19h closed this Aug 11, 2026
@carlosqwqqwq

Copy link
Copy Markdown
Contributor Author

Thanks for consolidating these into #203 and for the co-author credit. The local evidence (QEMU 8.2.2 -cpu max + native RV64 X60, three runs per probe) and the regression tests remain available in this branch if the rollup needs them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

FP widening ops are executed with illegal vd/vs2 group overlaps

2 participants