X86AsmParser AVX-512: Return error instead of hitting assert

When parsing a sequence of tokens beginning with {, it will hit an assert and crash if the token afterwards is not an identifier. Instead of this, return a more verbose error as seen elsewhere in the function.

Patch by Brandon Jones (BrandonTJones)

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

llvm-svn: 354356
This commit is contained in:
Craig Topper 2019-02-19 17:13:40 +00:00
parent 236e1ce1d9
commit d8acfe69f0
2 changed files with 5 additions and 0 deletions

View File

@ -1654,6 +1654,8 @@ X86AsmParser::ParseRoundingModeOp(SMLoc Start) {
const AsmToken &Tok = Parser.getTok();
// Eat "{" and mark the current place.
const SMLoc consumedToken = consumeToken();
if (Tok.isNot(AsmToken::Identifier))
return ErrorOperand(Tok.getLoc(), "Expected an identifier after {");
if (Tok.getIdentifier().startswith("r")){
int rndMode = StringSwitch<int>(Tok.getIdentifier())
.Case("rn", X86::STATIC_ROUNDING::TO_NEAREST_INT)

View File

@ -11,3 +11,6 @@ vfmsub213ps %zmm8, %zmm8, %zmm8 {rn-sae}
// ERR: invalid operand for instruction
cvtsd2sil {rn-sae}, %xmm1, %eax
// ERR: Expected an identifier after {
cvtsd2sil {{sae}, %xmm1, %eax