wasmtime icon indicating copy to clipboard operation
wasmtime copied to clipboard

Cranelift: aarch64: canonicalize `const <= value` into `value >= const` in lowering

Open fitzgen opened this issue 1 year ago • 0 comments

This would let us reuse existing immediate-encoding optimizations for rewriting value >= C + 1 into value > C when C + 1 is odd. In general this is pretty nice to have, since it turns a four instruction sequence into a two instruction sequence.

Follow up issue from:

In the future, we could try and "rotate" const <= value into value >= const and then go through this same optimization path so that we don't need to duplicate the rules but with tiny tweaks. I opted not to do that in this PR and removed the buggy optimizations to just get this land-able.

Originally posted by @fitzgen in https://github.com/bytecodealliance/wasmtime/issues/5252#issuecomment-1315621231

fitzgen avatar Nov 15 '22 17:11 fitzgen