[clang] [HLSL][Matrix] Add support for Matrix element and trunc Casts (PR #168915)
Sarah Spall via cfe-commits
cfe-commits at lists.llvm.org
Tue Dec 2 10:02:22 PST 2025
================
@@ -2102,6 +2105,57 @@ static bool IsVectorElementConversion(Sema &S, QualType FromType,
return false;
}
+/// Determine whether the conversion from FromType to ToType is a valid
+/// matrix conversion.
+///
+/// \param ICK Will be set to the matrix conversion kind, if this is a matrix
+/// conversion.
+static bool IsMatrixConversion(Sema &S, QualType FromType, QualType ToType,
+ ImplicitConversionKind &ICK,
+ ImplicitConversionKind &ElConv, Expr *From,
+ bool InOverloadResolution, bool CStyle) {
+ // Implicit conversions for matrices are an HLSL feature not present in C/C++.
+ if (!S.getLangOpts().HLSL)
+ return false;
+
+ auto *ToMatrixType = ToType->getAs<ConstantMatrixType>();
+ auto *FromMatrixType = FromType->getAs<ConstantMatrixType>();
+
+ // If both arguments are vectors, handle possible vector truncation and
----------------
spall wrote:
is this meant to say matrices and not vectors?
https://github.com/llvm/llvm-project/pull/168915
More information about the cfe-commits
mailing list