[clang] [HLSL] Add matrix support for `sign` (PR #235542)
David Browne via cfe-commits
cfe-commits at lists.llvm.org
Sun Oct 25 17:43:19 PDT 2026
================
@@ -3796,11 +3796,11 @@ static bool CheckNoDoubleVectors(Sema *S, SourceLocation Loc, int ArgOrdinal,
return false;
}
-static bool CheckFloatingOrIntRepresentation(Sema *S, SourceLocation Loc,
- int ArgOrdinal,
- clang::QualType PassedType) {
- if (!PassedType->hasIntegerRepresentation() &&
- !PassedType->hasFloatingRepresentation())
+static bool CheckFloatingOrNonBoolIntRepresentation(
+ Sema *S, SourceLocation Loc, int ArgOrdinal, clang::QualType PassedType) {
+ if (getScalarComponentType(PassedType)->isBooleanType() ||
+ (!PassedType->hasIntegerRepresentation() &&
+ !PassedType->hasFloatingRepresentation()))
----------------
djb wrote:
I included this fix because `__builtin_hlsl_elementwise_sign` would otherwise accept boolean matrix (and vector) inputs. I'm happy to split this into a separate PR if preferred, as it was a pre-existing issue for boolean vectors.
https://github.com/llvm/llvm-project/pull/235542
More information about the cfe-commits
mailing list