ARM vector compare to zero instruction assembly parsing support.
authorJim Grosbach <grosbach@apple.com>
Thu, 11 Aug 2011 23:51:13 +0000 (23:51 +0000)
committerJim Grosbach <grosbach@apple.com>
Thu, 11 Aug 2011 23:51:13 +0000 (23:51 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137389 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/neon-cmp-encoding.s

index 07570ae8e2064e591745009b0929f37e169bd860..13a7f0b902460efabbc057b257e0e47ae61f0b2f 100644 (file)
@@ -2865,6 +2865,21 @@ bool ARMAsmParser::ParseInstruction(StringRef Name, SMLoc NameLoc,
     Operands.erase(Operands.begin() + 1);
     delete Op;
   }
+
+  // The vector-compare-to-zero instructions have a literal token "#0" at
+  // the end that comes to here as an immediate operand. Convert it to a
+  // token to play nicely with the matcher.
+  if ((Mnemonic == "vceq" || Mnemonic == "vcge" || Mnemonic == "vcgt" ||
+      Mnemonic == "vcle" || Mnemonic == "vclt") && Operands.size() == 6 &&
+      static_cast<ARMOperand*>(Operands[5])->isImm()) {
+    ARMOperand *Op = static_cast<ARMOperand*>(Operands[5]);
+    const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Op->getImm());
+    if (CE && CE->getValue() == 0) {
+      Operands.erase(Operands.begin() + 5);
+      Operands.push_back(ARMOperand::CreateToken("#0", Op->getStartLoc()));
+      delete Op;
+    }
+  }
   return false;
 }
 
index 6bfc549e9474aa94bae2cfa7ea601b461622f232..4933e720347e3853efa8333811b6cc8609d4b267 100644 (file)
@@ -1,11 +1,4 @@
 @ RUN: llvm-mc -mcpu=cortex-a8 -triple arm-unknown-unknown -show-encoding < %s | FileCheck %s
-@ XFAIL: *
-
-@ FIXME: We cannot currently test the following instructions, which are 
-@ currently marked as for-disassembly only in the .td files:
-@  - VCEQz
-@  - VCGEz, VCLEz
-@  - VCGTz, VCLTz
 
 @ CHECK: vceq.i8       d16, d16, d17           @ encoding: [0xb1,0x08,0x40,0xf3]
        vceq.i8 d16, d16, d17