fix(riscv): reject vector FP ops with reserved frm - #201
Conversation
|
Blocking review finding: the new “all vector FP instructions” whitelist omits Both operations are decoded in the OPFVF space ( Please include both FP slide operations—preferably through a centralized vector-FP classification that cannot drift from the decoder—and add regression tests for reserved Repository policy note: this PR adds to |
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 instructions take their rounding mode from frm and RVV does not support the dynamic mode, so encodings 101-111 are all reserved. The centralized Op::is_vector_fp classification covers every vector FP op, including vfslide1up/vfslide1down, and applies regardless of vl/vstart.
cdaa9b7 to
45eff06
Compare
|
Thanks for the review. Reworked as suggested:
Verified locally: |
|
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. |
fix(riscv): reject vector FP ops with reserved frm
Closes #196
Summary
The RISC-V F extension (§11.3) and RVV define frm encodings 101-111 as reserved for vector floating-point instructions: RVV takes the rounding mode from
frmand does not support the dynamic mode, so any vector FP instruction executed whilefrmholds 101/110/111 raises an illegal-instruction exception, including operations that do not round andvl=0/vstart>=vlcases.Validation
Op::is_vector_fpclassification next to the decoder covers every vector FP op, includingvfslide1up/vfslide1down.vfadd,vfslide1up.vf,vfslide1down.vf, legal-frm controls, andvl=0/vstart>=vlcases.cargo test --lib: cpu suite 72 passed, 0 failed.Notes
The vector semantics moved to
cpu/vector.rsin #202 so this change does not grow the oversizedcpu.rs.