================
@@ -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
----------------
damyanp wrote:

Can you help me understand what the "same as the return type" part means here? 

I don't really know this code but after reading the rest of the file I think:

```c++

// Check that there's two arguments to the function
if (SemaRef.checkArgCount(TheCall, 2))
    return true;

// Check that the arguments are all the the same "size" (ie all scalars, 
// or all vectors of the same length), and the are the same type. But this 
function
// takes into account type promotions and things for you.
if (CheckVectorElementCallArgs(&SemaRef, TheCall))
      return true;

// Check that that type is either a scalar bool or a vector of bools.  Only the 
first 
// argument needs to be checked because the earlier checks validate that the
// arguments are the same.
 if (CheckScalarOrVector(&SemaRef, TheCall, getASTContext().BoolTy, 0))
    return true;
```

I don't think these checks do anything with the return type.

Anyway, I think that readers of this file are expected to understand what these 
functions do, so I think adding comments here doesn't help much.

https://github.com/llvm/llvm-project/pull/128979
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to