[AMDGPU][MC] Corrected error message for s_waitcnt helpers

See Bug 32711: https://bugs.llvm.org//show_bug.cgi?id=32711

Reviewers: artem.tamazov

Differential Revision: https://reviews.llvm.org/D33781

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@304922 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Dmitry Preobrazhensky 2017-06-07 16:08:02 +00:00
parent 619317ee76
commit 8848866f05
2 changed files with 20 additions and 16 deletions

View File

@ -2849,6 +2849,7 @@ bool AMDGPUAsmParser::parseCnt(int64_t &IntVal) {
if (getLexer().isNot(AsmToken::Integer))
return true;
SMLoc ValLoc = Parser.getTok().getLoc();
if (getParser().parseAbsoluteExpression(CntVal))
return true;
@ -2866,21 +2867,24 @@ bool AMDGPUAsmParser::parseCnt(int64_t &IntVal) {
Failed = encodeCnt(ISA, IntVal, CntVal, Sat, encodeLgkmcnt, decodeLgkmcnt);
}
// To improve diagnostics, do not skip delimiters on errors
if (!Failed) {
if (getLexer().isNot(AsmToken::RParen)) {
return true;
}
Parser.Lex();
if (getLexer().is(AsmToken::Amp) || getLexer().is(AsmToken::Comma)) {
const AsmToken NextToken = getLexer().peekTok();
if (NextToken.is(AsmToken::Identifier)) {
Parser.Lex();
}
if (Failed) {
Error(ValLoc, "too large value for " + CntName);
return true;
}
if (getLexer().isNot(AsmToken::RParen)) {
return true;
}
Parser.Lex();
if (getLexer().is(AsmToken::Amp) || getLexer().is(AsmToken::Comma)) {
const AsmToken NextToken = getLexer().peekTok();
if (NextToken.is(AsmToken::Identifier)) {
Parser.Lex();
}
}
return Failed;
return false;
}
OperandMatchResultTy

View File

@ -75,16 +75,16 @@ s_sendmsg sendmsg(MSG_SYSMSG, 5)
// GCN: error: invalid/unsupported code of SYSMSG_OP
s_waitcnt lgkmcnt(16)
// GCN: error: failed parsing operand
// GCN: error: too large value for lgkmcnt
s_waitcnt expcnt(8)
// GCN: error: failed parsing operand
// GCN: error: too large value for expcnt
s_waitcnt vmcnt(16)
// GCN: error: failed parsing operand
// GCN: error: too large value for vmcnt
s_waitcnt vmcnt(0xFFFFFFFFFFFF0000)
// GCN: error: failed parsing operand
// GCN: error: too large value for vmcnt
s_waitcnt vmcnt(0), expcnt(0), lgkmcnt(0),
// GCN: error: failed parsing operand