Index: llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp =================================================================== --- llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp +++ llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -1655,6 +1655,8 @@ 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(Tok.getIdentifier()) .Case("rn", X86::STATIC_ROUNDING::TO_NEAREST_INT) Index: llvm/test/MC/X86/avx512-err.s =================================================================== --- llvm/test/MC/X86/avx512-err.s +++ llvm/test/MC/X86/avx512-err.s @@ -11,3 +11,6 @@ // ERR: invalid operand for instruction cvtsd2sil {rn-sae}, %xmm1, %eax + +// ERR: Expected an identifier after { +cvtsd2sil {{sae}, %xmm1, %eax