Skip to content

Commit 9bbbd9d

Browse files
committed
move matrix to first select
1 parent 68ca464 commit 9bbbd9d

File tree

3 files changed

+17
-16
lines changed

3 files changed

+17
-16
lines changed

clang/include/clang/Basic/DiagnosticSemaKinds.td

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12521,11 +12521,11 @@ def err_builtin_is_within_lifetime_invalid_arg : Error<
1252112521

1252212522
def err_builtin_invalid_arg_type: Error<
1252312523
"%ordinal0 argument must be a"
12524-
"%select{| scalar| vector| vector,| vector of| scalar or vector of}1"
12524+
"%select{| scalar| vector| matrix| vector,| vector of| scalar or vector of}1"
1252512525
"%select{| integer| signed integer| unsigned integer| 'int'|"
12526-
" matrix| pointer to a valid matrix element}2"
12526+
" pointer to a valid matrix element}2"
1252712527
"%plural{0:|:%plural{0:|: or}2}3"
12528-
"%select{| floating-point}3 %plural{[0,3]:type|:types}1 (was %4)">;
12528+
"%select{| floating-point}3 %plural{[0,4]:type|:types}1 (was %4)">;
1252912529

1253012530
def err_builtin_matrix_disabled: Error<
1253112531
"matrix types extension is disabled. Pass -fenable-matrix to enable it">;

clang/lib/Sema/SemaChecking.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,28 +1983,28 @@ checkMathBuiltinElementType(Sema &S, SourceLocation Loc, QualType ArgTy,
19831983
if (!ArgTy->getAs<VectorType>() &&
19841984
!ConstantMatrixType::isValidElementType(ArgTy)) {
19851985
return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
1986-
<< ArgOrdinal << /* vector, */ 3 << /* integer */ 1 << /* fp */ 1
1986+
<< ArgOrdinal << /* vector, */ 4 << /* integer */ 1 << /* fp */ 1
19871987
<< ArgTy;
19881988
}
19891989
break;
19901990
case Sema::EltwiseBuiltinArgTyRestriction::FloatTy:
19911991
if (!EltTy->isRealFloatingType()) {
19921992
return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
1993-
<< ArgOrdinal << /* scalar or vector */ 5 << /* no int */ 0
1993+
<< ArgOrdinal << /* scalar or vector */ 6 << /* no int */ 0
19941994
<< /* floating-point */ 1 << ArgTy;
19951995
}
19961996
break;
19971997
case Sema::EltwiseBuiltinArgTyRestriction::IntegerTy:
19981998
if (!EltTy->isIntegerType()) {
19991999
return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
2000-
<< ArgOrdinal << /* scalar or vector */ 5 << /* integer */ 1
2000+
<< ArgOrdinal << /* scalar or vector */ 6 << /* integer */ 1
20012001
<< /* no fp */ 0 << ArgTy;
20022002
}
20032003
break;
20042004
case Sema::EltwiseBuiltinArgTyRestriction::SignedIntOrFloatTy:
20052005
if (EltTy->isUnsignedIntegerType()) {
20062006
return S.Diag(Loc, diag::err_builtin_invalid_arg_type)
2007-
<< 1 << /* scalar or vector */ 5 << /* signed int */ 2
2007+
<< 1 << /* scalar or vector */ 6 << /* signed int */ 2
20082008
<< /* or fp */ 1 << ArgTy;
20092009
}
20102010
break;
@@ -2858,7 +2858,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
28582858

28592859
if (ElTy.isNull() || !ElTy->isFloatingType()) {
28602860
Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2861-
<< 1 << /* vector of */ 4 << /* no int */ 0 << /* fp */ 1
2861+
<< 1 << /* vector of */ 5 << /* no int */ 0 << /* fp */ 1
28622862
<< Arg->getType();
28632863
return ExprError();
28642864
}
@@ -2888,7 +2888,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
28882888

28892889
if (ElTy.isNull() || !ElTy->isIntegerType()) {
28902890
Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2891-
<< 1 << /* vector of */ 4 << /* int */ 1 << /* no fp */ 0
2891+
<< 1 << /* vector of */ 5 << /* int */ 1 << /* no fp */ 0
28922892
<< Arg->getType();
28932893
return ExprError();
28942894
}
@@ -15412,7 +15412,7 @@ bool Sema::BuiltinNonDeterministicValue(CallExpr *TheCall) {
1541215412
if (!TyArg->isBuiltinType() && !TyArg->isVectorType())
1541315413
return Diag(TheCall->getArg(0)->getBeginLoc(),
1541415414
diag::err_builtin_invalid_arg_type)
15415-
<< 1 << /* vector, */ 3 << /* integer */ 1 << /* fp */ 1 << TyArg;
15415+
<< 1 << /* vector, */ 4 << /* integer */ 1 << /* fp */ 1 << TyArg;
1541615416

1541715417
TheCall->setType(TyArg);
1541815418
return false;
@@ -15431,7 +15431,8 @@ ExprResult Sema::BuiltinMatrixTranspose(CallExpr *TheCall,
1543115431
auto *MType = Matrix->getType()->getAs<ConstantMatrixType>();
1543215432
if (!MType) {
1543315433
Diag(Matrix->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15434-
<< 1 << 0 << /* matrix ty */ 5 << /* no fp */ 0 << Matrix->getType();
15434+
<< 1 << /* matrix */ 3 << /* no int */ 0 << /* no fp */ 0
15435+
<< Matrix->getType();
1543515436
return ExprError();
1543615437
}
1543715438

@@ -15503,15 +15504,15 @@ ExprResult Sema::BuiltinMatrixColumnMajorLoad(CallExpr *TheCall,
1550315504
QualType ElementTy;
1550415505
if (!PtrTy) {
1550515506
Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15506-
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 6 << /* no fp */ 0
15507+
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 5 << /* no fp */ 0
1550715508
<< PtrExpr->getType();
1550815509
ArgError = true;
1550915510
} else {
1551015511
ElementTy = PtrTy->getPointeeType().getUnqualifiedType();
1551115512

1551215513
if (!ConstantMatrixType::isValidElementType(ElementTy)) {
1551315514
Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15514-
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 6
15515+
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 5
1551515516
<< /* no fp */ 0 << PtrExpr->getType();
1551615517
ArgError = true;
1551715518
}
@@ -15612,7 +15613,7 @@ ExprResult Sema::BuiltinMatrixColumnMajorStore(CallExpr *TheCall,
1561215613
auto *MatrixTy = MatrixExpr->getType()->getAs<ConstantMatrixType>();
1561315614
if (!MatrixTy) {
1561415615
Diag(MatrixExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15615-
<< 1 << 0 << /* matrix ty */ 5 << 0 << MatrixExpr->getType();
15616+
<< 1 << /* matrix ty */ 3 << 0 << 0 << MatrixExpr->getType();
1561615617
ArgError = true;
1561715618
}
1561815619

@@ -15632,7 +15633,7 @@ ExprResult Sema::BuiltinMatrixColumnMajorStore(CallExpr *TheCall,
1563215633
auto *PtrTy = PtrExpr->getType()->getAs<PointerType>();
1563315634
if (!PtrTy) {
1563415635
Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15635-
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 6 << 0
15636+
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 5 << 0
1563615637
<< PtrExpr->getType();
1563715638
ArgError = true;
1563815639
} else {

clang/lib/Sema/SemaHLSL.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2493,7 +2493,7 @@ bool SemaHLSL::CheckBuiltinFunctionCall(unsigned BuiltinID, CallExpr *TheCall) {
24932493

24942494
if (!EltTy->isIntegerType()) {
24952495
Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2496-
<< 1 << /* scalar or vector of */ 5 << /* integer ty */ 1
2496+
<< 1 << /* scalar or vector of */ 6 << /* integer ty */ 1
24972497
<< /* no fp */ 0 << ArgTy;
24982498
return true;
24992499
}

0 commit comments

Comments
 (0)