[clang] [HLSL][Matrix] Add support for Matrix element and trunc Casts (PR #168915)
Chris B via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 2 08:36:44 PST 2025
================
@@ -2422,9 +2422,31 @@ static Value *EmitHLSLElementwiseCast(CodeGenFunction &CGF, LValue SrcVal,
}
return V;
}
+ if (auto *MatTy = DestTy->getAs<ConstantMatrixType>()) {
+ assert(LoadList.size() >= MatTy->getNumElementsFlattened() &&
+ "Flattened type on RHS must have the same number or more elements "
+ "than vector on LHS.");
+
+ llvm::Value *V =
+ CGF.Builder.CreateLoad(CGF.CreateIRTemp(DestTy, "flatcast.tmp"));
+ // write to V.
----------------
llvm-beanz wrote:
```suggestion
// V is an allocated temporary to build the truncated matrix into.
```
https://github.com/llvm/llvm-project/pull/168915
More information about the cfe-commits
mailing list