On AArch64, the zero register (xzr) and the stack pointer (xsp) are alternately named by the same index `31` in machine code depending on context. In particular, in the reg-reg-immediate ALU instruction form, add/subtract will use the stack pointer, not the zero register, if index 31 is given for the first (register) source arg. In a few places, we were emitting subtract instructions with the zero register as an argument and a reg/immediate as the second argument. When an immediate could be incorporated directly (we have the `iconst` definition visible), this would result in incorrect code being generated. This issue was found in `ineg` and in the sequence for vector right-shifts. Reported by Ian Cullinan; thanks!
This crate contains the core Cranelift code generator. It translates code from an intermediate representation into executable machine code.