[X86][AsmParser][AVX512] Error appropriately when K0 is tried as a write-mask

K0 isn't expected as a write-mask, so provide a detailed error here, instead of the more generic one (invalid op for insn)
Conforms with gas

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

llvm-svn: 310789
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index fd083b0..881d35e 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -2088,8 +2088,11 @@
           // Parse an op-mask register mark ({%k<NUM>}), which is now to be
           // expected
           unsigned RegNo;
-          if (!ParseRegister(RegNo, StartLoc, StartLoc) &&
+          SMLoc RegLoc;
+          if (!ParseRegister(RegNo, RegLoc, StartLoc) &&
               X86MCRegisterClasses[X86::VK1RegClassID].contains(RegNo)) {
+            if (RegNo == X86::K0)
+              return Error(RegLoc, "Register k0 can't be used as write mask");
             if (!getLexer().is(AsmToken::RCurly))
               return Error(getLexer().getLoc(), "Expected } at this point");
             Operands.push_back(X86Operand::CreateToken("{", StartLoc));