Index: lib/Target/X86/AsmParser/X86AsmParser.cpp =================================================================== --- lib/Target/X86/AsmParser/X86AsmParser.cpp +++ lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -2055,14 +2055,17 @@ // no errors. // Query for the need of further parsing for a {%k} mark if (!Z || getLexer().is(AsmToken::LCurly)) { - const SMLoc StartLoc = Z ? consumeToken() : consumedToken; + SMLoc StartLoc = Z ? consumeToken() : consumedToken; // Parse an op-mask register mark ({%k}), which is now to be // expected - if (std::unique_ptr Op = ParseOperand()) { + unsigned RegNo; + if (!ParseRegister(RegNo, StartLoc, StartLoc) && + X86MCRegisterClasses[X86::VK1RegClassID].contains(RegNo)) { if (!getLexer().is(AsmToken::RCurly)) return Error(getLexer().getLoc(), "Expected } at this point"); Operands.push_back(X86Operand::CreateToken("{", StartLoc)); - Operands.push_back(std::move(Op)); + Operands.push_back(std::move(X86Operand::CreateReg(RegNo, StartLoc, + StartLoc))); Operands.push_back(X86Operand::CreateToken("}", consumeToken())); } else return Error(getLexer().getLoc(), @@ -2072,7 +2075,8 @@ // Have we've found a parsing error, or found no (expected) {z} mark // - report an error if (ParseZ(Z, consumeToken()) || !Z) - return true; + return Error(getLexer().getLoc(), + "Expected a {z} mark at this point"); } // '{z}' on its own is meaningless, hence should be ignored. Index: test/MC/X86/avx512-err.s =================================================================== --- test/MC/X86/avx512-err.s +++ test/MC/X86/avx512-err.s @@ -1,6 +1,11 @@ -// RUN: not llvm-mc -triple x86_64-unknown-unknown -mcpu=knl -mattr=+avx512dq --show-encoding %s 2> %t.err +// RUN: not llvm-mc -triple x86_64-unknown-unknown -mcpu=knl -mattr=+avx512dq -mattr=+avx512f --show-encoding %s 2> %t.err // RUN: FileCheck --check-prefix=ERR < %t.err %s // ERR: invalid operand for instruction vpcmpd $1, %zmm24, %zmm7, %k5{%k0} +// ERR: Expected a {z} mark at this point +vfmsub213ps %zmm8, %zmm8, %zmm8{%k2} {rn-sae} + +// ERR: Expected an op-mask register at this point +vfmsub213ps %zmm8, %zmm8, %zmm8 {rn-sae}