summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/Disassembler
diff options
context:
space:
mode:
authorMatheus Almeida <matheus.almeida@imgtec.com>2013-11-18 12:32:49 +0000
committerMatheus Almeida <matheus.almeida@imgtec.com>2013-11-18 12:32:49 +0000
commit779c593708bd304f4f5c36c5beff535cef1d978a (patch)
tree78a27dcedeb5ef6adc96eae6adfe7284731dbe64 /llvm/lib/Target/Mips/Disassembler
parent5f86a0cce296de44f4fe62e550532290ab3047b0 (diff)
downloadbcm5719-llvm-779c593708bd304f4f5c36c5beff535cef1d978a.tar.gz
bcm5719-llvm-779c593708bd304f4f5c36c5beff535cef1d978a.zip
[mips][msa] Fix immediate value of LSA instruction as it was being wrongly encoded.
The immediate field should be encoded as "imm - 1" as the CPU always adds one to that field. llvm-svn: 195004
Diffstat (limited to 'llvm/lib/Target/Mips/Disassembler')
-rw-r--r--llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
index b890d3a887c..60508a8c4fc 100644
--- a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
+++ b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
@@ -246,6 +246,13 @@ static DecodeStatus DecodeSimm16(MCInst &Inst,
uint64_t Address,
const void *Decoder);
+// Decode the immediate field of an LSA instruction which
+// is off by one.
+static DecodeStatus DecodeLSAImm(MCInst &Inst,
+ unsigned Insn,
+ uint64_t Address,
+ const void *Decoder);
+
static DecodeStatus DecodeInsSize(MCInst &Inst,
unsigned Insn,
uint64_t Address,
@@ -785,6 +792,15 @@ static DecodeStatus DecodeSimm16(MCInst &Inst,
return MCDisassembler::Success;
}
+static DecodeStatus DecodeLSAImm(MCInst &Inst,
+ unsigned Insn,
+ uint64_t Address,
+ const void *Decoder) {
+ // We add one to the immediate field as it was encoded as 'imm - 1'.
+ Inst.addOperand(MCOperand::CreateImm(Insn + 1));
+ return MCDisassembler::Success;
+}
+
static DecodeStatus DecodeInsSize(MCInst &Inst,
unsigned Insn,
uint64_t Address,
OpenPOWER on IntegriCloud