[PATCH] D35785: [AsmParser][AVX512]Enhance OpMask/Zero/Merge syntax check rubostness
coby via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 9 05:33:51 PDT 2017
This revision was automatically updated to reflect the committed changes.
Closed by commit rL310467: [AsmParser][AVX512]Enhance OpMask/Zero/Merge syntax check rubostness (authored by coby).
Changed prior to commit:
https://reviews.llvm.org/D35785?vs=110169&id=110368#toc
Repository:
rL LLVM
https://reviews.llvm.org/D35785
Files:
llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/trunk/test/MC/X86/avx512-err.s
llvm/trunk/test/MC/X86/intel-syntax-avx512-error.s
Index: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -2089,14 +2089,17 @@
// no errors.
// Query for the need of further parsing for a {%k<NUM>} 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<NUM>}), which is now to be
// expected
- if (std::unique_ptr<X86Operand> 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(),
@@ -2106,7 +2109,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: llvm/trunk/test/MC/X86/avx512-err.s
===================================================================
--- llvm/trunk/test/MC/X86/avx512-err.s
+++ llvm/trunk/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}
Index: llvm/trunk/test/MC/X86/intel-syntax-avx512-error.s
===================================================================
--- llvm/trunk/test/MC/X86/intel-syntax-avx512-error.s
+++ llvm/trunk/test/MC/X86/intel-syntax-avx512-error.s
@@ -0,0 +1,9 @@
+// RUN: not llvm-mc %s -triple x86_64-unknown-unknown -mcpu=knl -mattr=+avx512f -x86-asm-syntax=intel -output-asm-variant=1 -o /dev/null 2>&1 | FileCheck %s
+
+// Validate that only OpMask/Zero mark may immediately follow destination
+ vfmsub213ps zmm8{rn-sae} {k2}, zmm8, zmm8
+// CHECK: error: Expected an op-mask register at this point
+ vfmsub213ps zmm8{k2} {rn-sae}, zmm8, zmm8
+// CHECK: error: Expected a {z} mark at this point
+ vfmsub213ps zmm8{rn-sae}, zmm8, zmm8
+// CHECK: error: Expected an op-mask register at this point
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D35785.110368.patch
Type: text/x-patch
Size: 3394 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170809/9f8f0b3f/attachment.bin>
More information about the llvm-commits
mailing list