[clang] [HLSL][Matrix] Implement dynamic single subscript swizzle (PR #173201)
Helena Kotas via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 6 11:38:02 PST 2026
================
@@ -2471,17 +2471,27 @@ RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, SourceLocation Loc) {
unsigned NumRows = MT->getNumRows();
unsigned NumCols = MT->getNumColumns();
-
+ unsigned NumLanes = NumCols;
llvm::Value *MatrixVec = EmitLoadOfScalar(LV, Loc);
llvm::Value *Row = LV.getMatrixRowIdx();
llvm::Type *ElemTy = ConvertType(MT->getElementType());
llvm::Type *RowTy = llvm::FixedVectorType::get(ElemTy, MT->getNumColumns());
llvm::Value *Result = llvm::PoisonValue::get(RowTy); // <NumCols x T>
----------------
hekota wrote:
```suggestion
llvm::Value *Result = nullptr; // will be <NumLanes x T> once NumLanes is known
```
The `Result` value needs to be created later since its vector size depends on the swizzle element count.
https://github.com/llvm/llvm-project/pull/173201
More information about the cfe-commits
mailing list