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

Fixes #2388

Problem

trans_fsgnj_d lacks REQUIRE_FPU and REQUIRE_EXT(ctx, RVD), so fsgnj.d/fmv.d retire on CPU models without F/D (e.g. SiFive E51) instead of raising an illegal-instruction trap.

Change

qemu/target/riscv/insn_trans/trans_rvd.inc.c trans_fsgnj_d: add REQUIRE_FPU; REQUIRE_EXT(ctx, RVD); at the top, matching every other D-extension translation in the same file.

The focused unit test is test_riscv64_fsgnj_d_cpu_feature in tests/unit/test_riscv.c; the public u020 runner is linked below.

Validation

  • Rebased onto dev.
  • Added focused E51 coverage in tests/unit/test_riscv.c.
  • The public E51 witness traps without F/D.
  • The D-enabled control remains legal and the existing RISC-V test suite passes.

Public reproducer:
https://github.com/carlosqwqqwq/unicorn-riscv-repros/tree/main/u020

@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