Skip to content

Commit 638e60c

Browse files
committed
move matrix to first select
1 parent 92a4769 commit 638e60c

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
@@ -12430,11 +12430,11 @@ def err_builtin_is_within_lifetime_invalid_arg : Error<
1243012430

1243112431
def err_builtin_invalid_arg_type: Error<
1243212432
"%ordinal0 argument must be a"
12433-
"%select{| scalar| vector| vector,| vector of| scalar or vector of}1"
12433+
"%select{| scalar| vector| matrix| vector,| vector of| scalar or vector of}1"
1243412434
"%select{| integer| signed integer| unsigned integer| 'int'|"
12435-
" matrix| pointer to a valid matrix element}2"
12435+
" pointer to a valid matrix element}2"
1243612436
"%plural{0:|:%plural{0:|: or}2}3"
12437-
"%select{| floating-point}3 %plural{[0,3]:type|:types}1 (was %4)">;
12437+
"%select{| floating-point}3 %plural{[0,4]:type|:types}1 (was %4)">;
1243812438

1243912439
def err_builtin_matrix_disabled: Error<
1244012440
"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;
@@ -2856,7 +2856,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
28562856

28572857
if (ElTy.isNull() || !ElTy->isFloatingType()) {
28582858
Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2859-
<< 1 << /* vector of */ 4 << /* no int */ 0 << /* fp */ 1
2859+
<< 1 << /* vector of */ 5 << /* no int */ 0 << /* fp */ 1
28602860
<< Arg->getType();
28612861
return ExprError();
28622862
}
@@ -2886,7 +2886,7 @@ Sema::CheckBuiltinFunctionCall(FunctionDecl *FDecl, unsigned BuiltinID,
28862886

28872887
if (ElTy.isNull() || !ElTy->isIntegerType()) {
28882888
Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2889-
<< 1 << /* vector of */ 4 << /* int */ 1 << /* no fp */ 0
2889+
<< 1 << /* vector of */ 5 << /* int */ 1 << /* no fp */ 0
28902890
<< Arg->getType();
28912891
return ExprError();
28922892
}
@@ -15349,7 +15349,7 @@ bool Sema::BuiltinNonDeterministicValue(CallExpr *TheCall) {
1534915349
if (!TyArg->isBuiltinType() && !TyArg->isVectorType())
1535015350
return Diag(TheCall->getArg(0)->getBeginLoc(),
1535115351
diag::err_builtin_invalid_arg_type)
15352-
<< 1 << /* vector, */ 3 << /* integer */ 1 << /* fp */ 1 << TyArg;
15352+
<< 1 << /* vector, */ 4 << /* integer */ 1 << /* fp */ 1 << TyArg;
1535315353

1535415354
TheCall->setType(TyArg);
1535515355
return false;
@@ -15368,7 +15368,8 @@ ExprResult Sema::BuiltinMatrixTranspose(CallExpr *TheCall,
1536815368
auto *MType = Matrix->getType()->getAs<ConstantMatrixType>();
1536915369
if (!MType) {
1537015370
Diag(Matrix->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15371-
<< 1 << 0 << /* matrix ty */ 5 << /* no fp */ 0 << Matrix->getType();
15371+
<< 1 << /* matrix */ 3 << /* no int */ 0 << /* no fp */ 0
15372+
<< Matrix->getType();
1537215373
return ExprError();
1537315374
}
1537415375

@@ -15440,15 +15441,15 @@ ExprResult Sema::BuiltinMatrixColumnMajorLoad(CallExpr *TheCall,
1544015441
QualType ElementTy;
1544115442
if (!PtrTy) {
1544215443
Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15443-
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 6 << /* no fp */ 0
15444+
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 5 << /* no fp */ 0
1544415445
<< PtrExpr->getType();
1544515446
ArgError = true;
1544615447
} else {
1544715448
ElementTy = PtrTy->getPointeeType().getUnqualifiedType();
1544815449

1544915450
if (!ConstantMatrixType::isValidElementType(ElementTy)) {
1545015451
Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15451-
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 6
15452+
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 5
1545215453
<< /* no fp */ 0 << PtrExpr->getType();
1545315454
ArgError = true;
1545415455
}
@@ -15549,7 +15550,7 @@ ExprResult Sema::BuiltinMatrixColumnMajorStore(CallExpr *TheCall,
1554915550
auto *MatrixTy = MatrixExpr->getType()->getAs<ConstantMatrixType>();
1555015551
if (!MatrixTy) {
1555115552
Diag(MatrixExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15552-
<< 1 << 0 << /* matrix ty */ 5 << 0 << MatrixExpr->getType();
15553+
<< 1 << /* matrix ty */ 3 << 0 << 0 << MatrixExpr->getType();
1555315554
ArgError = true;
1555415555
}
1555515556

@@ -15569,7 +15570,7 @@ ExprResult Sema::BuiltinMatrixColumnMajorStore(CallExpr *TheCall,
1556915570
auto *PtrTy = PtrExpr->getType()->getAs<PointerType>();
1557015571
if (!PtrTy) {
1557115572
Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15572-
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 6 << 0
15573+
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 5 << 0
1557315574
<< PtrExpr->getType();
1557415575
ArgError = true;
1557515576
} else {

clang/lib/Sema/SemaHLSL.cpp

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

23622362
if (!EltTy->isIntegerType()) {
23632363
Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2364-
<< 1 << /* scalar or vector of */ 5 << /* integer ty */ 1
2364+
<< 1 << /* scalar or vector of */ 6 << /* integer ty */ 1
23652365
<< /* no fp */ 0 << ArgTy;
23662366
return true;
23672367
}

0 commit comments

Comments
 (0)