alexcrichton commented on issue #6220:
Indeed! This is inspired by LLVM's alternate lowerings for casts in Rust which produce different sequences of wasm instructions. Piping these through Cranelift the old shift-based lowering generates two shifts while the "new"
i32.extend8_s
generates a singlemovsx
instruction. Given thatireduce
is typically a noop with respect to backends I figured it'd be good to get this two-instruction folding into a single-instruction folding. Additionally I figured that the purpose of addingi32.extend8_s
was to be a bit more optimal/compact and we may as well try to represent both of these equivalently in the IR.I'll add some tests though to the backend for the codegen too!
Last updated: Dec 23 2024 at 12:05 UTC