Artem-B wrote: I actually like ptmt better than bfi, as it also allows us to handle sign extension. We could use it as a base or example for cleaning up other i8/i16/i32 conversions later. I think you're good to go. https://github.com/llvm/llvm-project/pull/110766