[clang] [HLSL][Matrix] Add support for single subscript accessor (PR #170779)
Farzon Lotfi via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 16 09:50:24 PST 2025
================
@@ -2440,6 +2443,35 @@ RValue CodeGenFunction::EmitLoadOfLValue(LValue LV, SourceLocation Loc) {
Builder.CreateLoad(LV.getMatrixAddress(), LV.isVolatileQualified());
return RValue::get(Builder.CreateExtractElement(Load, Idx, "matrixext"));
}
+ if (LV.isMatrixRow()) {
+ QualType MatTy = LV.getType();
+ const ConstantMatrixType *MT = MatTy->castAs<ConstantMatrixType>();
+
+ unsigned NumRows = MT->getNumRows();
+ unsigned NumCols = MT->getNumColumns();
+
+ llvm::Value *MatrixVec = EmitLoadOfScalar(LV, Loc);
+
+ llvm::Value *Row = LV.getMatrixRowIdx();
+ llvm::Value *Result =
+ llvm::PoisonValue::get(ConvertType(LV.getType())); // <NumCols x T>
----------------
farzonl wrote:
That said I don't know how the size of the vector is getting set. It seems to just work, but maybe it would be better for me to be more explicit.
https://github.com/llvm/llvm-project/pull/170779
More information about the cfe-commits
mailing list