================ @@ -2446,37 +2376,41 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) { case Builtin::BI__builtin_hlsl_any: { if (SemaRef.checkArgCount(TheCall, 1)) return true; + if (CheckAnyScalarOrVector(&SemaRef, TheCall, 0)) + return true; break; } case Builtin::BI__builtin_hlsl_asdouble: { if (SemaRef.checkArgCount(TheCall, 2)) return true; - if (CheckUnsignedIntRepresentation(&SemaRef, TheCall)) + if (CheckScalarOrVector(&SemaRef, TheCall, SemaRef.Context.UnsignedIntTy, + 0)) // only check for uint + return true; + if (CheckScalarOrVector(&SemaRef, TheCall, SemaRef.Context.UnsignedIntTy, + 1)) // only check for uint + return true; + if (CheckAllArgsHaveSameType(&SemaRef, TheCall)) return true; SetElementTypeAsReturnType(&SemaRef, TheCall, getASTContext().DoubleTy); break; } case Builtin::BI__builtin_hlsl_elementwise_clamp: { - if (SemaRef.checkArgCount(TheCall, 3)) - return true; - if (CheckAnyScalarOrVector(&SemaRef, TheCall, 0) || - CheckAllArgsHaveSameType(&SemaRef, TheCall)) - return true; if (SemaRef.BuiltinElementwiseTernaryMath( TheCall, /*ArgTyRestr=*/ - TheCall->getArg(0)->getType()->hasFloatingRepresentation() - ? Sema::EltwiseBuiltinArgTyRestriction::FloatTy - : Sema::EltwiseBuiltinArgTyRestriction::None)) + Sema::EltwiseBuiltinArgTyRestriction::None)) return true; break; } case Builtin::BI__builtin_hlsl_cross: { if (SemaRef.checkArgCount(TheCall, 2)) return true; - if (CheckVectorElementCallArgs(&SemaRef, TheCall)) + + // ensure args are a half3 or float3 ---------------- spall wrote:
Yes this is a weird one to typecheck. The comment was really meant to just refer to that entire block of code below it, rather than just the CheckAllArgTypesAreCorrect. https://github.com/llvm/llvm-project/pull/138429 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits