[clang] Hlsl or intrinsic (PR #128979)

Damyan Pepper via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 26 21:04:18 PST 2025


================
@@ -2305,6 +2305,25 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
     TheCall->setType(ArgTyA);
     break;
   }
+  case Builtin::BI__builtin_hlsl_or: {
+    if (SemaRef.checkArgCount(TheCall, 2))
+      return true;
+    if (CheckVectorElementCallArgs(&SemaRef, TheCall))
+      return true;
+
+    // Ensure input expr type is a scalar/vector and the same as the return type
+    if (CheckScalarOrVector(&SemaRef, TheCall, getASTContext().BoolTy, 0))
+      return true;
+
+    // Ensure input parameter type is bool
----------------
damyanp wrote:

> `// Ensure input parameter type is bool`

That's what the code above was doing.  This is just getting the type of the first argument, and then setting the return type of the entire expression to match that.



https://github.com/llvm/llvm-project/pull/128979


More information about the cfe-commits mailing list