alexcrichton transferred Issue #755 (assigned to bnjbvr):
Cranelift instructions sometimes have a variant taking an immediate as one operand (e.g.
icmphasicmp_imm) or a complex operand (that is, register + shifted register + offset, if I'm not mistaken; see for instanceloadwhich has theload_complexvariant). These instructions are defined manually, and thesimple_preoptpass contains a manual replacement of the normal variant by the immediate variant, for some given functions.I'd like to implement helpers in the meta-language to signal that a given instruction also has an immediate variant, or a complex one. This would automatically create the new Cranelift instructions with the suffixes, so they're just plain instructions from codegen's point of view. This should allow us to have many more complex encodings (nice for performance), but also more immediate encodings (both would be great to lower register pressure), and hopefully we can have automatically generated code to replace a given instruction by its immediate (as done in simple_preopt) or its complex (as done in postopt) counterpart.
Last updated: Dec 06 2025 at 06:05 UTC