tgross35 opened issue #8312:
Thanks for filing a feature request! Please fill out the TODOs below.
Feature
Add support for 16-bit and 128-bit IEEE floating point numbers.
Benefit
This will allow using these types with
rustc_codegen_clif
, as described at https://github.com/rust-lang/rustc_codegen_cranelift/issues/1461Implementation
Unsure
Alternatives
Unsure, maybe it would be possible to stub out these types if adding them is difficult.
jameysharp added the cranelift label to Issue #8312.
jameysharp added the cranelift:area:clif label to Issue #8312.
jameysharp commented on issue #8312:
Adding the types is pretty easy, I think, and extending CLIF floating-point instructions to allow the new types is also pretty easy. Successfully compiling anything that uses the types is the hard part, I imagine.
I think the places to add the types are:
- https://github.com/bytecodealliance/wasmtime/blob/e6f9ca5efa0c4bf59c9cf133d9abeaab63ec07bb/cranelift/codegen/meta/src/cdsl/typevar.rs#L646
- https://github.com/bytecodealliance/wasmtime/blob/e6f9ca5efa0c4bf59c9cf133d9abeaab63ec07bb/cranelift/codegen/meta/src/shared/types.rs#L44-L73
- various places in https://github.com/bytecodealliance/wasmtime/blob/e6f9ca5efa0c4bf59c9cf133d9abeaab63ec07bb/cranelift/codegen/src/ir/types.rs
Once the tests are passing again after that, I think you'll have a compiler that will accept f16/f128 instructions. But if you use them, then it will fail later: during lowering on all backends; in the interpreter; in compiletests and runtests; and in fuzzing.
I think this is a fairly large project, but if rustc needs these types, I think it's reasonable to add the types in one PR and then work on adding implementations for them everywhere over time.
Last updated: Nov 22 2024 at 17:03 UTC