[llvm] [IR][REVEC] Define llvm.vector.broadcast intrinsic (PR #208212)

Gaƫtan Bossu via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 25 01:56:35 PDT 2026


gbossu wrote:

> The only case we care about is `scalable vector.broadcast(fixed)`, as this is the only form not currently representable

Recapping a bit: my initial plan was to tailor the intrinsic to that particular case, while still allowing fixed -> wider fixed because that case can also arise once we allow fixed->fixed REVEC. Given that REVEC cannot produce scalable vectors with a lower minimum EC than the original fixed-length vectors, I had introduced the "known multiple EC" limitation to keep codegen simple, and it felt like a sensible scope for the intrinsic.

I feel that where I started was both too generic and too specific, while the additional commits made the `vector.broadcast` too generic to a point where codegen is IMO too complex given the lack of use case for being that generic. So I feel your `<vscale x n x ty> vector.vscale.repeat(<n x ty>)` suggestion is going the right way by specifically focusing on the one use case we cannot currently represent.

This means that for "broadcasting"/"repeating" for `VF = vscale x 2`, we'll need two instructions, but I'm sure we can still combine them back to one in the AArch64 backend.
```
%tmp = shufflevector <2 x i32> %in, <2 x i32> poison, <4 x i32> <0, 1, 0, 1>
%repeat = call <vscale x 4 x i32> @llvm.vector.repeat(<4 x i32> %tmp)

->

mov z0.d, d0
```

https://github.com/llvm/llvm-project/pull/208212


More information about the llvm-commits mailing list