paulwalker-arm wrote: > Would you like me to add the lowering to `AArch64ISD::BSP` here or in a separate PR? Up to you. I don't mind the refactoring and the improved code generation being within this one PR. https://github.com/llvm/llvm-project/pull/138689