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

Benjamin Maxwell via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 24 02:59:21 PDT 2026


=?utf-8?q?Gaëtan?= Bossu <gaetan.bossu at arm.com>,
=?utf-8?q?Gaëtan?= Bossu <gaetan.bossu at arm.com>,
=?utf-8?q?Gaëtan?= Bossu <gaetan.bossu at arm.com>,
=?utf-8?q?Gaëtan?= Bossu <gaetan.bossu at arm.com>,
=?utf-8?q?Gaëtan?= Bossu <gaetan.bossu at arm.com>,
=?utf-8?q?Gaëtan?= Bossu <gaetan.bossu at arm.com>,
=?utf-8?q?Gaëtan?= Bossu <gaetan.bossu at arm.com>,
=?utf-8?q?Gaëtan?= Bossu <gaetan.bossu at arm.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/208212 at github.com>


================
@@ -4019,6 +4072,13 @@ bool DAGTypeLegalizer::SplitVectorOperand(SDNode *N, unsigned OpNo) {
   return false;
 }
 
+SDValue DAGTypeLegalizer::SplitVecOp_VECTOR_BROADCAST(SDNode *N) {
+  SDLoc DL(N);
+  SDValue SrcLo, SrcHi;
+  GetSplitVector(N->getOperand(0), SrcLo, SrcHi);
+  return buildSplitVectorBroadcast(DAG, DL, N->getValueType(0), SrcLo, SrcHi);
+}
----------------
MacDue wrote:

This looks suspicious. `buildSplitVectorBroadcast` returns a `VECTOR_INTERLEAVE` node with two results. This replaces the `VECTOR_BROADCAST` with that node, but that ignores the second result of the interleave. 

I'd expect something like:

```c++
SDValue DAGTypeLegalizer::SplitVecOp_VECTOR_BROADCAST(SDNode *N) {
  SDLoc DL(N);
  SDValue SrcLo, SrcHi;
  GetSplitVector(N->getOperand(0), SrcLo, SrcHi);
  auto [LoVT, HiVT] = DAG.GetSplitDestVTs(N->getValueType(0));
  assert(LoVT == HiVT && "Expected equal split types");
  auto Interleaved = buildSplitVectorBroadcast(DAG, DL, LoVT, SrcLo, SrcHi);
    return DAG.getNode(ISD::CONCAT_VECTORS, DL, N->getValueType(0),
       Interleaved.getValue(0), Interleaved.getValue(1));
}
```

i.e., broadcast the even/odd lanes of the operand to half VT, then concat the results. 

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


More information about the llvm-commits mailing list