[clang] [HLSL] Implement the 'and' HLSL function (PR #127098)
Deric Cheung via cfe-commits
cfe-commits at lists.llvm.org
Fri Feb 14 13:37:54 PST 2025
================
@@ -2245,6 +2245,17 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
break;
}
+ case Builtin::BI__builtin_hlsl_and: {
+ if (SemaRef.checkArgCount(TheCall, 2))
+ return true;
+ if (CheckVectorElementCallArgs(&SemaRef, TheCall))
+ return true;
+ ExprResult A = TheCall->getArg(0);
----------------
Icohedron wrote:
Currently, any type that can be implicitly cast to a bool (vector) are allowed to be passed to the `and` HLSL builtin function. Should that be disallowed?
Or is the check you mention just something to reinforce / make more clear in SemaHLSL.cpp that the `and` builtin operates only with bools?
https://github.com/llvm/llvm-project/pull/127098
More information about the cfe-commits
mailing list