summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorStrahinja Petrovic <strahinja.petrovic@rt-rk.com>2017-03-23 13:19:04 +0000
committerStrahinja Petrovic <strahinja.petrovic@rt-rk.com>2017-03-23 13:19:04 +0000
commitcac14b5334c38d03d3dd7008db8e99529ed7e610 (patch)
tree82391b24f2a0a77b175e683ce0376d3a5d465af5 /llvm/lib
parentd341290b5c30745139880dfeb38e52439e7e4c31 (diff)
downloadbcm5719-llvm-cac14b5334c38d03d3dd7008db8e99529ed7e610.tar.gz
bcm5719-llvm-cac14b5334c38d03d3dd7008db8e99529ed7e610.zip
[Mips] Fix for decoding DINS instruction - disassembler
This patch fixes decoding of size and position for DINSM and DINSU instructions. Differential Revision: https://reviews.llvm.org/D31072 llvm-svn: 298593
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp9
1 files changed, 8 insertions, 1 deletions
diff --git a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
index 4098ea796bf..ecdf6b0de6e 100644
--- a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
+++ b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
@@ -2264,7 +2264,14 @@ static DecodeStatus DecodeInsSize(MCInst &Inst,
const void *Decoder) {
// First we need to grab the pos(lsb) from MCInst.
int Pos = Inst.getOperand(2).getImm();
- int Size = (int) Insn - Pos + 1;
+ if (Inst.getOpcode() == Mips::DINSU)
+ Pos += 32;
+ int Size;
+ if (Inst.getOpcode() == Mips::DINSM ||
+ Inst.getOpcode() == Mips::DINSU)
+ Size = (int) Insn - Pos + 33;
+ else
+ Size = (int) Insn - Pos + 1;
Inst.addOperand(MCOperand::createImm(SignExtend32<16>(Size)));
return MCDisassembler::Success;
}
OpenPOWER on IntegriCloud