================
@@ -137,6 +137,42 @@ bool SemaSPIRV::CheckSPIRVBuiltinFunctionCall(unsigned 
BuiltinID,
     TheCall->setType(RetTy);
     break;
   }
+  case SPIRV::BI__builtin_spirv_faceforward: {
+    if (SemaRef.checkArgCount(TheCall, 3))
+      return true;
+
+    // check if all arguments have floating representation
+    for (unsigned i = 0; i < TheCall->getNumArgs(); ++i) {
+      ExprResult Arg = TheCall->getArg(i);
+      QualType ArgTy = Arg.get()->getType();
+      if (!ArgTy->hasFloatingRepresentation()) {
+        SemaRef.Diag(Arg.get()->getBeginLoc(),
+                     diag::err_builtin_invalid_arg_type)
+            << i + 1 << /* scalar or vector */ 5 << /* no int */ 0 << /* fp */ 
1
----------------
inbelic wrote:

```suggestion
            << /* ordinal */ i + 1 << /* scalar or vector */ 5 << /* no int */ 
0 << /* fp */ 1
```

I think this for loop is the exact same as the smoothstep function? We could 
probably move it to a common function then. 

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

Reply via email to