bytecodealliance / bytecodealliance/wasmtime

cranelift: Disable NaN Canonicalization for RISC-V

Open
#7,322 0 comments 0 reactions 0 assignees View on GitHub
cranelift:area:riscv64
Dominant language
Rust
Stars
18.6k
Forks
1.8k
Avg merge
1d 18h
Merged PRs (30d)
126

Description

👋 Hey,

In RISC-V almost all [floating point instructions return a canonical NaN when its result would be a NaN](https://github.com/riscv/riscv-isa-manual/blob/c8155afea51a0d47297936aa2f5d29d7ce3946f3/src/f-st-ext.adoc#nan-generation-and-propagation). In cranelift we have a separate pass that includes some NaN normalization code when the `enable_nan_canonicalization` flag is enabled. RISC-V's canonical NaN pattern is also defined to be the same as WASM's canonical NaN.

This isn't really required for RISC-V and just causes additional overhead, so it would be nice if we could disable it. This thought occurred to me while reading #7321 which might make that easier by querying each backend and applying those legalization rules conditionally.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.