================ @@ -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 + << ArgTy; + return true; + } + } + + // check if all arguments are of the same type + ExprResult A = TheCall->getArg(0); + ExprResult B = TheCall->getArg(1); + ExprResult C = TheCall->getArg(2); + if (!(SemaRef.getASTContext().hasSameUnqualifiedType(A.get()->getType(), ---------------- inbelic wrote:
Same here, could be common function. See the `CheckAllArgsHaveTheSameType` in `SemaHLSL`. You could probably just copy paste that into this file. I think we previously decided to NOT move them to a common place so I wouldn't worry about doing that. 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