================
@@ -7806,6 +7806,39 @@ ExprResult Sema::prepareVectorSplat(QualType VectorTy,
Expr *SplattedExpr) {
return ImpCastExprToType(SplattedExpr, DestElemTy, CK);
}
+ExprResult Sema::prepareMatrixSplat(QualType MatrixTy, Expr *SplattedExpr) {
+ QualType DestElemTy = MatrixTy->castAs<MatrixType>()->getElementType();
+
+ if (DestElemTy == SplattedExpr->getType())
+ return SplattedExpr;
+
+ assert(DestElemTy->isFloatingType() ||
+ DestElemTy->isIntegralOrEnumerationType());
+
+ CastKind CK;
+ if (SplattedExpr->getType()->isBooleanType()) {
+ // As with vectors, we want `true` to become -1 when splatting, and we
+ // need a two-step cast if the destination element type is floating.
----------------
farzonl wrote:
I have a branch that implements booleans in
`clang/lib/Headers/hlsl/hlsl_basic_types.h`. Maybe I should try to merge that
in first so I can put the tests for this in this pr.
https://github.com/llvm/llvm-project/pull/170885
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits