Skip to content

fix(riscv): reject vector FP ops at SEW=8 - #210

Closed
carlosqwqqwq wants to merge 2 commits into
HexRaysSA:masterfrom
carlosqwqqwq:fix-riscv-vector-fp-sew8
Closed

fix(riscv): reject vector FP ops at SEW=8#210
carlosqwqqwq wants to merge 2 commits into
HexRaysSA:masterfrom
carlosqwqqwq:fix-riscv-vector-fp-sew8

Conversation

@carlosqwqqwq

Copy link
Copy Markdown
Contributor

fix(riscv): reject vector FP ops at SEW=8

Closes #209

Summary

Vector floating-point operations are only defined for SEW in {16,32,64}; with SEW=8 the encodings are reserved and must raise an illegal-instruction exception (RVV 1.0). RAX silently fell back to f64 execution for every vector FP op class at SEW=8. The narrowing FP conversions follow a separate rule (the FP-to-integer variants are legal at SEW=8, tracked separately), and integer ops at SEW=8 stay legal.

Validation

  • Regression covers representative FP classes at SEW=8 (vfadd, vfslide1up.vf, vfwadd), the legal integer vadd at SEW=8, and legal SEW (e32) execution of the same FP ops.
  • 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.
Vector floating-point operations are only defined for SEW in {16,32,64}; with SEW=8 the encodings are reserved (RVV 1.0). The narrowing FP conversions follow a separate rule (FP-to-int variants are legal at SEW=8), and integer ops at SEW=8 stay legal.
@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.

vector floating-point instructions are executed at reserved SEW=8

2 participants