afonso360 opened PR #7181 from afonso360:riscv-fminmax to bytecodealliance:main:
:wave: Hey,
This PR improves our lowerings for
fminandfmaxand moves them to ISLE.The native
fmin/fmaxinstructions in RISC-V almost match the WASM semantics, they correctly order-0.0 < +0.0, however they return the non-NaN input if there is one. This does not match the semantics of the instruction so we fixup this case manually.This codegen can be further improved using the
fminm/fmaxminstructions available in theZfaextension which I'm planing on implementing next.
afonso360 requested cfallin for a review on PR #7181.
afonso360 requested wasmtime-compiler-reviewers for a review on PR #7181.
cfallin submitted PR review:
LGTM, thanks! The
faddtrick to get a NaN is clever.It's too bad the semantics are just a tad off -- especially without a true select/cmove instruction to use in the fixup!
cfallin submitted PR review:
LGTM, thanks! The
faddtrick to get a NaN is clever.It's too bad the semantics are just a tad off -- especially without a true select/cmove instruction to use in the fixup!
cfallin created PR review comment:
s/NaN of/one of/ ?
afonso360 updated PR #7181.
afonso360 has enabled auto merge for PR #7181.
afonso360 merged PR #7181.
Last updated: Dec 13 2025 at 19:03 UTC