mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-05 02:49:18 +00:00
Modify DisassembleThumb2LdStEx() to be more robust/correct in light of recent change to
t2LDREX/t2STREX instructions. Add two test cases. llvm-svn: 128293
This commit is contained in:
parent
1cbd2c6c88
commit
c69c7b19ae
@ -1194,8 +1194,8 @@ static bool DisassembleThumb2LdStEx(MCInst &MI, unsigned Opcode, uint32_t insn,
|
||||
OpIdx = 0;
|
||||
|
||||
assert(NumOps >= 2
|
||||
&& OpInfo[0].RegClass == ARM::GPRRegClassID
|
||||
&& OpInfo[1].RegClass == ARM::GPRRegClassID
|
||||
&& OpInfo[0].RegClass > 0
|
||||
&& OpInfo[1].RegClass > 0
|
||||
&& "Expect >=2 operands and first two as reg operands");
|
||||
|
||||
bool isStore = (ARM::t2STREX <= Opcode && Opcode <= ARM::t2STREXH);
|
||||
@ -1205,25 +1205,25 @@ static bool DisassembleThumb2LdStEx(MCInst &MI, unsigned Opcode, uint32_t insn,
|
||||
// Add the destination operand for store.
|
||||
if (isStore) {
|
||||
MI.addOperand(MCOperand::CreateReg(
|
||||
getRegisterEnum(B, ARM::GPRRegClassID,
|
||||
getRegisterEnum(B, OpInfo[OpIdx].RegClass,
|
||||
isSW ? decodeRs(insn) : decodeRm(insn))));
|
||||
++OpIdx;
|
||||
}
|
||||
|
||||
// Source operand for store and destination operand for load.
|
||||
MI.addOperand(MCOperand::CreateReg(getRegisterEnum(B, ARM::GPRRegClassID,
|
||||
MI.addOperand(MCOperand::CreateReg(getRegisterEnum(B, OpInfo[OpIdx].RegClass,
|
||||
decodeRd(insn))));
|
||||
++OpIdx;
|
||||
|
||||
// Thumb2 doubleword complication: with an extra source/destination operand.
|
||||
if (isDW) {
|
||||
MI.addOperand(MCOperand::CreateReg(getRegisterEnum(B, ARM::GPRRegClassID,
|
||||
MI.addOperand(MCOperand::CreateReg(getRegisterEnum(B,OpInfo[OpIdx].RegClass,
|
||||
decodeRs(insn))));
|
||||
++OpIdx;
|
||||
}
|
||||
|
||||
// Finally add the pointer operand.
|
||||
MI.addOperand(MCOperand::CreateReg(getRegisterEnum(B, ARM::GPRRegClassID,
|
||||
MI.addOperand(MCOperand::CreateReg(getRegisterEnum(B, OpInfo[OpIdx].RegClass,
|
||||
decodeRn(insn))));
|
||||
++OpIdx;
|
||||
|
||||
|
@ -154,3 +154,9 @@
|
||||
|
||||
# CHECK: ldrd r3, r8, [r11, #-60]
|
||||
0x5b 0xe9 0x0f 0x38
|
||||
|
||||
# CHECK: ldrex r8, [r2]
|
||||
0x52 0xe8 0x00 0x8f
|
||||
|
||||
# CHECK: strexd r1, r7, r8, [r2]
|
||||
0xc2 0xe8 0x71 0x78
|
||||
|
Loading…
x
Reference in New Issue
Block a user