@@ -2048,16 +2048,14 @@ static bool CheckAllArgTypesAreCorrect(
20482048static bool CheckFloatOrHalfVecRepresentation (Sema *S, SourceLocation Loc,
20492049 int ArgOrdinal,
20502050 clang::QualType PassedType) {
2051- QualType EltTy = PassedType;
2052- if (auto *VecTy = EltTy->getAs <VectorType>())
2053- EltTy = VecTy->getElementType ();
2051+ if (auto *VecTy = PassedType->getAs <VectorType>())
2052+ if (VecTy->getElementType ()->isHalfType () ||
2053+ VecTy->getElementType ()->isFloat32Type ())
2054+ return false ;
20542055
2055- if (!PassedType->getAs <VectorType>() ||
2056- !(EltTy->isHalfType () || EltTy->isFloat32Type ()))
2057- return S->Diag (Loc, diag::err_builtin_invalid_arg_type)
2058- << ArgOrdinal << /* vector of */ 4 << /* no int */ 0
2059- << /* half or float */ 2 << PassedType;
2060- return false ;
2056+ return S->Diag (Loc, diag::err_builtin_invalid_arg_type)
2057+ << ArgOrdinal << /* vector of */ 4 << /* no int */ 0
2058+ << /* half or float */ 2 << PassedType;
20612059}
20622060
20632061static bool CheckFloatOrHalfRepresentation (Sema *S, SourceLocation Loc,
@@ -2109,17 +2107,16 @@ static bool CheckFloatingOrIntRepresentation(Sema *S, SourceLocation Loc,
21092107static bool CheckUnsignedIntVecRepresentation (Sema *S, SourceLocation Loc,
21102108 int ArgOrdinal,
21112109 clang::QualType PassedType) {
2112- QualType EltTy = PassedType;
2113- if (auto * VecTy = EltTy-> getAs <VectorType> ())
2114- EltTy = VecTy-> getElementType () ;
2110+ if ( auto *VecTy = PassedType-> getAs <VectorType>())
2111+ if (VecTy-> getElementType ()-> isUnsignedIntegerType ())
2112+ return false ;
21152113
2116- if (!PassedType->getAs <VectorType>() || !EltTy->isUnsignedIntegerType ())
2117- return S->Diag (Loc, diag::err_builtin_invalid_arg_type)
2118- << ArgOrdinal << /* vector of */ 4 << /* uint */ 3 << /* no fp */ 0
2119- << PassedType;
2120- return false ;
2114+ return S->Diag (Loc, diag::err_builtin_invalid_arg_type)
2115+ << ArgOrdinal << /* vector of */ 4 << /* uint */ 3 << /* no fp */ 0
2116+ << PassedType;
21212117}
21222118
2119+ // checks for unsigned ints of all sizes
21232120static bool CheckUnsignedIntRepresentation (Sema *S, SourceLocation Loc,
21242121 int ArgOrdinal,
21252122 clang::QualType PassedType) {
@@ -2387,10 +2384,10 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
23872384 if (SemaRef.checkArgCount (TheCall, 2 ))
23882385 return true ;
23892386 if (CheckScalarOrVector (&SemaRef, TheCall, SemaRef.Context .UnsignedIntTy ,
2390- 0 ))
2387+ 0 )) // only check for uint
23912388 return true ;
23922389 if (CheckScalarOrVector (&SemaRef, TheCall, SemaRef.Context .UnsignedIntTy ,
2393- 1 ))
2390+ 1 )) // only check for uint
23942391 return true ;
23952392 if (CheckAllArgsHaveSameType (&SemaRef, TheCall))
23962393 return true ;
0 commit comments