]> granicus.if.org Git - llvm/commitdiff
[ARM] Don't omit non-default predication code
authorOliver Stannard <oliver.stannard@arm.com>
Tue, 21 Nov 2017 15:34:15 +0000 (15:34 +0000)
committerOliver Stannard <oliver.stannard@arm.com>
Tue, 21 Nov 2017 15:34:15 +0000 (15:34 +0000)
This was causing the (invalid) predicated versions of the NEON VRINTX and
VRINTZ instructions to be accepted, with the condition code being ignored.

Also, there is no NEON VRINTR instruction, so that part of the check was not
necessary.

Differential revision: https://reviews.llvm.org/D39193

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@318771 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/invalid-fp-armv8.s
test/MC/ARM/invalid-neon-v8.s

index 2690eed45cd6bfe7ddaff9953ea2de5f821a188a..6974c32d9b70e5528c7ec6c04161f7c01ff99521 100644 (file)
@@ -5804,9 +5804,9 @@ bool ARMAsmParser::shouldOmitCCOutOperand(StringRef Mnemonic,
 
 bool ARMAsmParser::shouldOmitPredicateOperand(StringRef Mnemonic,
                                               OperandVector &Operands) {
-  // VRINT{Z, R, X} have a predicate operand in VFP, but not in NEON
+  // VRINT{Z, X} have a predicate operand in VFP, but not in NEON
   unsigned RegIdx = 3;
-  if ((Mnemonic == "vrintz" || Mnemonic == "vrintx" || Mnemonic == "vrintr") &&
+  if ((Mnemonic == "vrintz" || Mnemonic == "vrintx") &&
       (static_cast<ARMOperand &>(*Operands[2]).getToken() == ".f32" ||
        static_cast<ARMOperand &>(*Operands[2]).getToken() == ".f16")) {
     if (static_cast<ARMOperand &>(*Operands[3]).isToken() &&
@@ -6100,7 +6100,8 @@ bool ARMAsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
   // Some instructions have the same mnemonic, but don't always
   // have a predicate. Distinguish them here and delete the
   // predicate if needed.
-  if (shouldOmitPredicateOperand(Mnemonic, Operands))
+  if (PredicationCode == ARMCC::AL &&
+      shouldOmitPredicateOperand(Mnemonic, Operands))
     Operands.erase(Operands.begin() + 1);
 
   // ARM mode 'blx' need special handling, as the register operand version
index da952cf7ed67519c7ae3fd80c832ebb41ff02883..dca0e448d1140fc0a475ea3fe2f53f55bef5e3cf 100644 (file)
@@ -81,7 +81,7 @@ vcvtthi.f16.f64 q0, d3
 vrintrlo.f32.f32 d3, q0
 @ V8: error: invalid instruction
 vrintxcs.f32.f32 d3, d0
-@ V8: error: instruction requires: NEON
+@ V8: error: invalid instruction
 
 vrinta.f64.f64 s3, q0
 @ V8: error: invalid instruction
index 6403904c1d3e29e6903f262fccf76d1b19dd5860..cae1fb331cf50fb92030d0dd016be5b64c40d1a2 100644 (file)
@@ -72,3 +72,9 @@ vmull.p64 s1, d2, d3
 @ CHECK: error: operand must be a register in range [q0, q15]
 vmullge.p64 q0, d16, d17
 @ CHECK: error: instruction 'vmull' is not predicable, but condition code specified
+
+// These instructions are predicable in VFP but not in NEON
+vrintzeq.f32 d0, d1
+vrintxgt.f32 d0, d1
+@ CHECK: error: invalid operand for instruction
+@ CHECK: error: invalid operand for instruction