efriedma-quic wrote: Reliably matching the integer arithmetic seems problematic; I think I'd lean towards an intrinsic. Maybe `llvm.vector.extract.last.active(data, mask, passthru)`, set the passthru to poison if you don't care. https://github.com/llvm/llvm-project/pull/112738