[llvm] r298593 - [Mips] Fix for decoding DINS instruction - disassembler
Strahinja Petrovic via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 23 06:19:05 PDT 2017
Author: spetrovic
Date: Thu Mar 23 08:19:04 2017
New Revision: 298593
URL: http://llvm.org/viewvc/llvm-project?rev=298593&view=rev
Log:
[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
Modified:
llvm/trunk/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
llvm/trunk/test/MC/Mips/mips64extins.s
Modified: llvm/trunk/lib/Target/Mips/Disassembler/MipsDisassembler.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Mips/Disassembler/MipsDisassembler.cpp?rev=298593&r1=298592&r2=298593&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Mips/Disassembler/MipsDisassembler.cpp (original)
+++ llvm/trunk/lib/Target/Mips/Disassembler/MipsDisassembler.cpp Thu Mar 23 08:19:04 2017
@@ -2264,7 +2264,14 @@ static DecodeStatus DecodeInsSize(MCInst
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;
}
Modified: llvm/trunk/test/MC/Mips/mips64extins.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/Mips/mips64extins.s?rev=298593&r1=298592&r2=298593&view=diff
==============================================================================
--- llvm/trunk/test/MC/Mips/mips64extins.s (original)
+++ llvm/trunk/test/MC/Mips/mips64extins.s Thu Mar 23 08:19:04 2017
@@ -5,5 +5,5 @@
dextu $2, $4, 34, 6 # CHECK: dextu ${{[0-9]+}}, ${{[0-9]+}}, 34, 6
dextm $2, $4, 5, 34 # CHECK: dextm ${{[0-9]+}}, ${{[0-9]+}}, 5, 34
dins $4, $5, 8, 10 # CHECK: dins ${{[0-9]+}}, ${{[0-9]+}}, 8, 10
- dinsm $4, $5, 10, 1 # CHECK: dinsm ${{[0-9]+}}, ${{[0-9]+}}, 10, 1
+ dinsm $4, $5, 30, 6 # CHECK: dinsm ${{[0-9]+}}, ${{[0-9]+}}, 30, 6
dinsu $4, $5, 40, 13 # CHECK: dinsu ${{[0-9]+}}, ${{[0-9]+}}, 40, 13
More information about the llvm-commits
mailing list