summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2011-10-17 23:09:09 +0000
committerJim Grosbach <grosbach@apple.com>2011-10-17 23:09:09 +0000
commitcda32ae3723a821d3ce0f2f374ff28c2f84f0667 (patch)
tree010bfefc1ada3b75d87e7e2e5022632f2b97d9e6 /llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
parentb15c11c8190775de46e1c9973c032f63c7096940 (diff)
downloadbcm5719-llvm-cda32ae3723a821d3ce0f2f374ff28c2f84f0667.tar.gz
bcm5719-llvm-cda32ae3723a821d3ce0f2f374ff28c2f84f0667.zip
ARM assembly parsing and encoding for VMOV/VMVN/VORR/VBIC.i16.
llvm-svn: 142303
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
-rw-r--r--llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index c887179fc33..11b6574c286 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -924,6 +924,17 @@ public:
return Value >= 0 && Value < 256;
}
+ bool isNEONi16splat() const {
+ if (Kind != k_Immediate)
+ return false;
+ const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
+ // Must be a constant.
+ if (!CE) return false;
+ int64_t Value = CE->getValue();
+ // i16 value in the range [0,255] or [0x0100, 0xff00]
+ return (Value >= 0 && Value < 256) || (Value >= 0x0100 && Value <= 0xff00);
+ }
+
void addExpr(MCInst &Inst, const MCExpr *Expr) const {
// Add as immediates when possible. Null MCExpr = 0.
if (Expr == 0)
@@ -1454,6 +1465,18 @@ public:
Inst.addOperand(MCOperand::CreateImm(CE->getValue() | 0xe00));
}
+ void addNEONi16splatOperands(MCInst &Inst, unsigned N) const {
+ assert(N == 1 && "Invalid number of operands!");
+ // The immediate encodes the type of constant as well as the value.
+ const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm());
+ unsigned Value = CE->getValue();
+ if (Value >= 256)
+ Value = (Value >> 8) | 0xa00;
+ else
+ Value |= 0x800;
+ Inst.addOperand(MCOperand::CreateImm(Value));
+ }
+
virtual void print(raw_ostream &OS) const;
static ARMOperand *CreateITMask(unsigned Mask, SMLoc S) {
OpenPOWER on IntegriCloud