diff options
author | Jim Grosbach <grosbach@apple.com> | 2011-07-25 23:09:14 +0000 |
---|---|---|
committer | Jim Grosbach <grosbach@apple.com> | 2011-07-25 23:09:14 +0000 |
commit | f49433523e8a39db6d83503e312ae55160eed90a (patch) | |
tree | c57c25ecbbd1a36741686c7dfc3e0d23830abc76 /lib/Target/ARM/AsmParser/ARMAsmParser.cpp | |
parent | 863bd9d5cf86e57752975d1ab6779f3116a23b90 (diff) | |
download | external_llvm-f49433523e8a39db6d83503e312ae55160eed90a.tar.gz external_llvm-f49433523e8a39db6d83503e312ae55160eed90a.tar.bz2 external_llvm-f49433523e8a39db6d83503e312ae55160eed90a.zip |
ARM assembly parsing and encoding for SSAT16 instruction.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@136006 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
-rw-r--r-- | lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 02ed5477d4..f6f8adc666 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -433,6 +433,14 @@ public: int64_t Value = CE->getValue(); return Value >= 0 && Value < 32; } + bool isImm1_16() const { + if (Kind != Immediate) + return false; + const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm()); + if (!CE) return false; + int64_t Value = CE->getValue(); + return Value > 0 && Value < 17; + } bool isImm1_32() const { if (Kind != Immediate) return false; @@ -704,6 +712,14 @@ public: addExpr(Inst, getImm()); } + void addImm1_16Operands(MCInst &Inst, unsigned N) const { + assert(N == 1 && "Invalid number of operands!"); + // The constant encodes as the immediate-1, and we store in the instruction + // the bits as encoded, so subtract off one here. + const MCConstantExpr *CE = dyn_cast<MCConstantExpr>(getImm()); + Inst.addOperand(MCOperand::CreateImm(CE->getValue() - 1)); + } + void addImm1_32Operands(MCInst &Inst, unsigned N) const { assert(N == 1 && "Invalid number of operands!"); // The constant encodes as the immediate-1, and we store in the instruction |