ARM parsing/encoding for VCMP/VCMPE.
authorJim Grosbach <grosbach@apple.com>
Mon, 3 Oct 2011 22:30:24 +0000 (22:30 +0000)
committerJim Grosbach <grosbach@apple.com>
Mon, 3 Oct 2011 22:30:24 +0000 (22:30 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141038 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/ARM/AsmParser/ARMAsmParser.cpp
test/MC/ARM/simple-fp-encoding.s

index 9f69594b02a7d00834369679cb0947f0730ce364..81a67868049bb7d5fbb1716038b636755c203c07 100644 (file)
@@ -3582,6 +3582,17 @@ bool ARMAsmParser::ParseInstruction(StringRef Name, SMLoc NameLoc,
       delete Op;
     }
   }
+  // VCMP{E} does the same thing, but with a different operand count.
+  if ((Mnemonic == "vcmp" || Mnemonic == "vcmpe") && Operands.size() == 5 &&
+      static_cast<ARMOperand*>(Operands[4])->isImm()) {
+    ARMOperand *Op = static_cast<ARMOperand*>(Operands[4]);
+    const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(Op->getImm());
+    if (CE && CE->getValue() == 0) {
+      Operands.erase(Operands.begin() + 4);
+      Operands.push_back(ARMOperand::CreateToken("#0", Op->getStartLoc()));
+      delete Op;
+    }
+  }
   // Similarly, the Thumb1 "RSB" instruction has a literal "#0" on the
   // end. Convert it to a token here.
   if (Mnemonic == "rsb" && isThumb() && Operands.size() == 6 &&
index 67a78c435d905a6e17149b250fa4e3f1dc58c773..969cc8aa2edfd82f06f49d4177ad8ee5832e3e32 100644 (file)
 @ CHECK: vcmpe.f32 s1, s0            @ encoding: [0xc0,0x0a,0xf4,0xee]
         vcmpe.f32       s1, s0
 
-@ FIXME: vcmpe.f64 d16, #0           @ encoding: [0xc0,0x0b,0xf5,0xee]
-@        vcmpe.f64       d16, #0
+@ CHECK: vcmpe.f64 d16, #0           @ encoding: [0xc0,0x0b,0xf5,0xee]
+        vcmpe.f64       d16, #0
 
-@ FIXME: vcmpe.f32 s0, #0            @ encoding: [0xc0,0x0a,0xb5,0xee]
-@        vcmpe.f32       s0, #0
+@ CHECK: vcmpe.f32 s0, #0            @ encoding: [0xc0,0x0a,0xb5,0xee]
+        vcmpe.f32       s0, #0
 
 @ CHECK: vabs.f64 d16, d16           @ encoding: [0xe0,0x0b,0xf0,0xee]
         vabs.f64        d16, d16