Skip to content

riscv: gate fsgnj.d/fmv.d on FPU and D extension - #2393

Open
carlosqwqqwq wants to merge 1 commit into
unicorn-engine:devfrom
carlosqwqqwq:fix/riscv-fsgnj-d-ext-gate
Open

riscv: gate fsgnj.d/fmv.d on FPU and D extension#2393
carlosqwqqwq wants to merge 1 commit into
unicorn-engine:devfrom
carlosqwqqwq:fix/riscv-fsgnj-d-ext-gate

Conversation

@carlosqwqqwq

@carlosqwqqwq carlosqwqqwq commented Aug 12, 2026

Copy link
Copy Markdown

riscv: gate fsgnj.d/fmv.d on FPU and D extension

Fixes #2388

Problem

trans_fsgnj_d lacks the FPU and D-extension checks used by the other D-extension translators. Consequently, fsgnj.d and fmv.d can retire on the SiFive E51 model even though that model does not advertise F or D.

Change

Add REQUIRE_FPU; and REQUIRE_EXT(ctx, RVD); at the start of qemu/target/riscv/insn_trans/trans_rvd.inc.c:trans_fsgnj_d(), matching the neighboring D-extension translators.

Validation

  • Rebased onto dev and built the RISC-V targets.
  • Added an E51 regression case to tests/unit/test_riscv.c.
  • Existing RV32 and RV64 floating-point move cases now set mstatus.FS=Dirty explicitly so they model an enabled floating-point state.
  • The full test_riscv suite passes; D-enabled control execution remains successful.

@carlosqwqqwq
carlosqwqqwq force-pushed the fix/riscv-fsgnj-d-ext-gate branch from ead4b4b to c61a607 Compare August 29, 2026 07:24
@carlosqwqqwq
carlosqwqqwq changed the base branch from master to dev August 29, 2026 07:26
@carlosqwqqwq

Copy link
Copy Markdown
Author

Thank you very much for taking the time to review this PR. We have rebased it onto dev, added the required feature checks, and added focused coverage for an RV64 CPU without the D extension. Could you please let us know what further code, test, or PR changes you would recommend? We will gladly adjust the patch to match the project guidelines.

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.

RISC-V: fsgnj.d/fmv.d retire without F/D extension

1 participant