Skip to content

Commit 20acbb1

Browse files
committed
move matrix to first select
1 parent e27f326 commit 20acbb1

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

1241912419
def err_builtin_invalid_arg_type: Error<
1242012420
"%ordinal0 argument must be a"
12421-
"%select{| scalar| vector| vector,| vector of| scalar or vector of}1"
12421+
"%select{| scalar| vector| matrix| vector,| vector of| scalar or vector of}1"
1242212422
"%select{| integer| signed integer| unsigned integer| 'int'|"
12423-
" matrix| pointer to a valid matrix element}2"
12423+
" pointer to a valid matrix element}2"
1242412424
"%plural{0:|:%plural{0:|: or}2}3"
12425-
"%select{| floating-point}3 %plural{[0,3]:type|:types}1 (was %4)">;
12425+
"%select{| floating-point}3 %plural{[0,4]:type|:types}1 (was %4)">;
1242612426

1242712427
def err_builtin_matrix_disabled: Error<
1242812428
"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
}
@@ -14800,7 +14800,7 @@ bool Sema::BuiltinNonDeterministicValue(CallExpr *TheCall) {
1480014800
if (!TyArg->isBuiltinType() && !TyArg->isVectorType())
1480114801
return Diag(TheCall->getArg(0)->getBeginLoc(),
1480214802
diag::err_builtin_invalid_arg_type)
14803-
<< 1 << /* vector, */ 3 << /* integer */ 1 << /* fp */ 1 << TyArg;
14803+
<< 1 << /* vector, */ 4 << /* integer */ 1 << /* fp */ 1 << TyArg;
1480414804

1480514805
TheCall->setType(TyArg);
1480614806
return false;
@@ -14819,7 +14819,8 @@ ExprResult Sema::BuiltinMatrixTranspose(CallExpr *TheCall,
1481914819
auto *MType = Matrix->getType()->getAs<ConstantMatrixType>();
1482014820
if (!MType) {
1482114821
Diag(Matrix->getBeginLoc(), diag::err_builtin_invalid_arg_type)
14822-
<< 1 << 0 << /* matrix ty */ 5 << /* no fp */ 0 << Matrix->getType();
14822+
<< 1 << /* matrix */ 3 << /* no int */ 0 << /* no fp */ 0
14823+
<< Matrix->getType();
1482314824
return ExprError();
1482414825
}
1482514826

@@ -14891,15 +14892,15 @@ ExprResult Sema::BuiltinMatrixColumnMajorLoad(CallExpr *TheCall,
1489114892
QualType ElementTy;
1489214893
if (!PtrTy) {
1489314894
Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
14894-
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 6 << /* no fp */ 0
14895+
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 5 << /* no fp */ 0
1489514896
<< PtrExpr->getType();
1489614897
ArgError = true;
1489714898
} else {
1489814899
ElementTy = PtrTy->getPointeeType().getUnqualifiedType();
1489914900

1490014901
if (!ConstantMatrixType::isValidElementType(ElementTy)) {
1490114902
Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
14902-
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 6
14903+
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 5
1490314904
<< /* no fp */ 0 << PtrExpr->getType();
1490414905
ArgError = true;
1490514906
}
@@ -15000,7 +15001,7 @@ ExprResult Sema::BuiltinMatrixColumnMajorStore(CallExpr *TheCall,
1500015001
auto *MatrixTy = MatrixExpr->getType()->getAs<ConstantMatrixType>();
1500115002
if (!MatrixTy) {
1500215003
Diag(MatrixExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15003-
<< 1 << 0 << /* matrix ty */ 5 << 0 << MatrixExpr->getType();
15004+
<< 1 << /* matrix ty */ 3 << 0 << 0 << MatrixExpr->getType();
1500415005
ArgError = true;
1500515006
}
1500615007

@@ -15020,7 +15021,7 @@ ExprResult Sema::BuiltinMatrixColumnMajorStore(CallExpr *TheCall,
1502015021
auto *PtrTy = PtrExpr->getType()->getAs<PointerType>();
1502115022
if (!PtrTy) {
1502215023
Diag(PtrExpr->getBeginLoc(), diag::err_builtin_invalid_arg_type)
15023-
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 6 << 0
15024+
<< PtrArgIdx + 1 << 0 << /* pointer to element ty */ 5 << 0
1502415025
<< PtrExpr->getType();
1502515026
ArgError = true;
1502615027
} else {

clang/lib/Sema/SemaHLSL.cpp

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

23392339
if (!EltTy->isIntegerType()) {
23402340
Diag(Arg->getBeginLoc(), diag::err_builtin_invalid_arg_type)
2341-
<< 1 << /* scalar or vector of */ 5 << /* integer ty */ 1
2341+
<< 1 << /* scalar or vector of */ 6 << /* integer ty */ 1
23422342
<< /* no fp */ 0 << ArgTy;
23432343
return true;
23442344
}

0 commit comments

Comments
 (0)