[llvm] ff95d25 - [X86] Prevent accidentally accepting cmpeqsh as a valid mnemonic.
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Sun Aug 15 12:01:55 PDT 2021
Author: Craig Topper
Date: 2021-08-15T12:00:56-07:00
New Revision: ff95d2524ac7197cbac3a801680d60b863fc1399
URL: https://github.com/llvm/llvm-project/commit/ff95d2524ac7197cbac3a801680d60b863fc1399
DIFF: https://github.com/llvm/llvm-project/commit/ff95d2524ac7197cbac3a801680d60b863fc1399.diff
LOG: [X86] Prevent accidentally accepting cmpeqsh as a valid mnemonic.
We should only accept as vcmpeqsh.
Same for all the other 31 comparison values.
Added:
Modified:
llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
llvm/test/MC/X86/avx512-err.s
Removed:
################################################################################
diff --git a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 6cd64ad2592a8..b9d8c148f5fbf 100644
--- a/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/llvm/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -3184,7 +3184,8 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
.Case("gt_oq", 0x1E)
.Case("true_us", 0x1F)
.Default(~0U);
- if (CC != ~0U && (IsVCMP || CC < 8)) {
+ if (CC != ~0U && (IsVCMP || CC < 8) &&
+ (IsVCMP || PatchedName.back() != 'h')) {
if (PatchedName.endswith("ss"))
PatchedName = IsVCMP ? "vcmpss" : "cmpss";
else if (PatchedName.endswith("sd"))
diff --git a/llvm/test/MC/X86/avx512-err.s b/llvm/test/MC/X86/avx512-err.s
index 0d353a6c54981..96e8c267979f3 100644
--- a/llvm/test/MC/X86/avx512-err.s
+++ b/llvm/test/MC/X86/avx512-err.s
@@ -20,3 +20,6 @@ vpmuld %xmm1, %xmm2, %xmm3
// ERR: invalid instruction mnemonic 'maskmov'
maskmov %mm1, %mm2
+
+// ERR: invalid instruction mnemonic 'cmpeqsh'
+cmpeqsh %xmm2, %xmm1, %k0
More information about the llvm-commits
mailing list