summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/Mips/Disassembler
diff options
context:
space:
mode:
authorZoran Jovanovic <zoran.jovanovic@imgtec.com>2015-11-30 12:56:18 +0000
committerZoran Jovanovic <zoran.jovanovic@imgtec.com>2015-11-30 12:56:18 +0000
commita887b36167922a8821dc229011336a36409409da (patch)
tree658085df90a803892cfe850e1abbc81ffdcd7f68 /llvm/lib/Target/Mips/Disassembler
parentea7932cfb7e352360ba9408dfe87e1e1527b22f1 (diff)
downloadbcm5719-llvm-a887b36167922a8821dc229011336a36409409da.tar.gz
bcm5719-llvm-a887b36167922a8821dc229011336a36409409da.zip
[mips][microMIPS] Fix issue with offset operand of BALC and BC instructions
Value of offset operand for microMIPS BALC and BC instructions is currently shifted 2 bits, but it should be 1 bit. Differential Revision: http://reviews.llvm.org/D14770 llvm-svn: 254296
Diffstat (limited to 'llvm/lib/Target/Mips/Disassembler')
-rw-r--r--llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
index f9601839b44..716a96e2c46 100644
--- a/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
+++ b/llvm/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
@@ -229,6 +229,13 @@ static DecodeStatus DecodeBranchTargetMM(MCInst &Inst,
uint64_t Address,
const void *Decoder);
+// DecodeBranchTarget26MM - Decode microMIPS branch offset, which is
+// shifted left by 1 bit.
+static DecodeStatus DecodeBranchTarget26MM(MCInst &Inst,
+ unsigned Offset,
+ uint64_t Address,
+ const void *Decoder);
+
// DecodeJumpTargetMM - Decode microMIPS jump target, which is
// shifted left by 1 bit.
static DecodeStatus DecodeJumpTargetMM(MCInst &Inst,
@@ -1863,6 +1870,16 @@ static DecodeStatus DecodeBranchTargetMM(MCInst &Inst,
return MCDisassembler::Success;
}
+static DecodeStatus DecodeBranchTarget26MM(MCInst &Inst,
+ unsigned Offset,
+ uint64_t Address,
+ const void *Decoder) {
+ int32_t BranchOffset = SignExtend32<26>(Offset) << 1;
+
+ Inst.addOperand(MCOperand::createImm(BranchOffset));
+ return MCDisassembler::Success;
+}
+
static DecodeStatus DecodeJumpTargetMM(MCInst &Inst,
unsigned Insn,
uint64_t Address,
OpenPOWER on IntegriCloud