I'm working on implementing 32bit divsion in cranelift and winch, and I notice that a lot of intructions have the size bit hard-coded to 1, but not always. For example, ALU op is inconsistent, with most of them being encoded as 32 bits, and others as 64bits, while cbz, is hardcoded to 64 bits. Is there some reason for that, of is this simply accidental?
for ref: https://github.com/bytecodealliance/wasmtime/blob/main/cranelift/codegen/src/isa/aarch64/inst/emit.rs#L736-L755, notice the first bit
As a followup, should we rather introduce new instructions when a size variant is required, or patch existing ones?
This is almost certainly a case of "that variant is all we've needed so far"; we can definitely add the 32-bit variants
Probably an enum field in the existing instruction is best (OperandSize or equivalent) rather than a whole new variant of the Inst
Ok, I think this is the approach I have ended up taking here, in the end: https://github.com/bytecodealliance/wasmtime/pull/9798
ah, cool, sorry I hadn't connected the dots with the PR :-) I'll go review that
NP, i'm in no rush anyway :)
Last updated: Jan 09 2026 at 13:15 UTC