Commit f30ce4e4 authored by Pierre Langlois's avatar Pierre Langlois Committed by Commit Bot

[arm] Use the converter when printing general registers

When disassembling some instructions we would print `r12`, which can be
confusing when the rest of the disassembly consistently uses `ip`.

Bug: 
Change-Id: Id4cfc5805ef102a0845cdaaa8390e618ee981b19
Reviewed-on: https://chromium-review.googlesource.com/570038Reviewed-by: 's avatarGeorg Neis <neis@chromium.org>
Commit-Queue: Pierre Langlois <pierre.langlois@arm.com>
Cr-Commit-Position: refs/heads/master@{#46628}
parent 7c00e15b
......@@ -415,8 +415,8 @@ void Decoder::FormatNeonList(int Vd, int type) {
void Decoder::FormatNeonMemory(int Rn, int align, int Rm) {
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"[r%d", Rn);
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "[%s",
converter_.NameOfCPURegister(Rn));
if (align != 0) {
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
":%d", (1 << align) << 6);
......@@ -426,8 +426,8 @@ void Decoder::FormatNeonMemory(int Rn, int align, int Rm) {
} else if (Rm == 13) {
Print("]!");
} else {
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"], r%d", Rm);
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_, "], %s",
converter_.NameOfCPURegister(Rm));
}
}
......@@ -1558,6 +1558,7 @@ void Decoder::DecodeTypeVFP(Instruction* instr) {
(instr->VAValue() == 0x0)) {
DecodeVMOVBetweenCoreAndSinglePrecisionRegisters(instr);
} else if ((instr->VLValue() == 0x0) && (instr->VCValue() == 0x1)) {
const char* rt_name = converter_.NameOfCPURegister(instr->RtValue());
if (instr->Bit(23) == 0) {
int opc1_opc2 = (instr->Bits(22, 21) << 2) | instr->Bits(6, 5);
if ((opc1_opc2 & 0xb) == 0) {
......@@ -1569,31 +1570,30 @@ void Decoder::DecodeTypeVFP(Instruction* instr) {
}
} else {
int vd = instr->VFPNRegValue(kDoublePrecision);
int rt = instr->RtValue();
if ((opc1_opc2 & 0x8) != 0) {
// NeonS8 / NeonU8
int i = opc1_opc2 & 0x7;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"vmov.8 d%d[%d], r%d", vd, i, rt);
"vmov.8 d%d[%d], %s", vd, i, rt_name);
} else if ((opc1_opc2 & 0x1) != 0) {
// NeonS16 / NeonU16
int i = (opc1_opc2 >> 1) & 0x3;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"vmov.16 d%d[%d], r%d", vd, i, rt);
"vmov.16 d%d[%d], %s", vd, i, rt_name);
} else {
Unknown(instr);
}
}
} else {
int size = 32;
if (instr->Bit(5) != 0)
if (instr->Bit(5) != 0) {
size = 16;
else if (instr->Bit(22) != 0)
} else if (instr->Bit(22) != 0) {
size = 8;
}
int Vd = instr->VFPNRegValue(kSimd128Precision);
int Rt = instr->RtValue();
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"vdup.%i q%d, r%d", size, Vd, Rt);
"vdup.%i q%d, %s", size, Vd, rt_name);
}
} else if ((instr->VLValue() == 0x1) && (instr->VCValue() == 0x1)) {
int opc1_opc2 = (instr->Bits(22, 21) << 2) | instr->Bits(6, 5);
......@@ -1606,19 +1606,20 @@ void Decoder::DecodeTypeVFP(Instruction* instr) {
}
} else {
char sign = instr->Bit(23) != 0 ? 'u' : 's';
int rt = instr->RtValue();
const char* rt_name = converter_.NameOfCPURegister(instr->RtValue());
int vn = instr->VFPNRegValue(kDoublePrecision);
if ((opc1_opc2 & 0x8) != 0) {
// NeonS8 / NeonU8
int i = opc1_opc2 & 0x7;
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"vmov.%c8 r%d, d%d[%d]", sign, rt, vn, i);
out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "vmov.%c8 %s, d%d[%d]",
sign, rt_name, vn, i);
} else if ((opc1_opc2 & 0x1) != 0) {
// NeonS16 / NeonU16
int i = (opc1_opc2 >> 1) & 0x3;
out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "vmov.%c16 r%d, d%d[%d]",
sign, rt, vn, i);
SNPrintF(out_buffer_ + out_buffer_pos_, "vmov.%c16 %s, d%d[%d]",
sign, rt_name, vn, i);
} else {
Unknown(instr);
}
......@@ -2423,17 +2424,17 @@ void Decoder::DecodeSpecialCondition(Instruction* instr) {
case 0xA:
case 0xB:
if ((instr->Bits(22, 20) == 5) && (instr->Bits(15, 12) == 0xf)) {
int Rn = instr->Bits(19, 16);
const char* rn_name = converter_.NameOfCPURegister(instr->Bits(19, 16));
int offset = instr->Bits(11, 0);
if (offset == 0) {
out_buffer_pos_ +=
SNPrintF(out_buffer_ + out_buffer_pos_, "pld [r%d]", Rn);
SNPrintF(out_buffer_ + out_buffer_pos_, "pld [%s]", rn_name);
} else if (instr->Bit(23) == 0) {
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"pld [r%d, #-%d]", Rn, offset);
"pld [%s, #-%d]", rn_name, offset);
} else {
out_buffer_pos_ += SNPrintF(out_buffer_ + out_buffer_pos_,
"pld [r%d, #+%d]", Rn, offset);
"pld [%s, #+%d]", rn_name, offset);
}
} else if (instr->SpecialValue() == 0xA && instr->Bits(22, 20) == 7) {
int option = instr->Bits(3, 0);
......
......@@ -528,6 +528,8 @@ TEST(Vfp) {
"ec432b10 vmov d0, r2, r3");
COMPARE(vmov(r2, r3, d0),
"ec532b10 vmov r2, r3, d0");
COMPARE(vmov(r4, ip, d1),
"ec5c4b11 vmov r4, ip, d1");
COMPARE(vmov(d0, d1),
"eeb00b41 vmov.f64 d0, d1");
COMPARE(vmov(d3, d3, eq),
......@@ -656,6 +658,8 @@ TEST(Vfp) {
"ed958a05 vldr s16, [r5 + 4*5]");
COMPARE(vldr(s31, r10, 1020),
"eddafaff vldr s31, [r10 + 4*255]");
COMPARE(vldr(s31, ip, 1020),
"eddcfaff vldr s31, [ip + 4*255]");
COMPARE(vstr(s0, r0, 0),
"ed800a00 vstr s0, [r0 + 4*0]");
......@@ -962,6 +966,7 @@ TEST(Neon) {
COMPARE(vmov(NeonU8, d1, 1, r1), "ee411b30 vmov.8 d1[1], r1");
COMPARE(vmov(NeonS8, d2, 2, r2), "ee422b50 vmov.8 d2[2], r2");
COMPARE(vmov(NeonU8, d3, 3, r8), "ee438b70 vmov.8 d3[3], r8");
COMPARE(vmov(NeonU8, d3, 3, ip), "ee43cb70 vmov.8 d3[3], ip");
COMPARE(vmov(NeonS8, d4, 4, r0), "ee640b10 vmov.8 d4[4], r0");
COMPARE(vmov(NeonU8, d5, 5, r1), "ee651b30 vmov.8 d5[5], r1");
COMPARE(vmov(NeonS8, d6, 6, r2), "ee662b50 vmov.8 d6[6], r2");
......@@ -970,6 +975,7 @@ TEST(Neon) {
COMPARE(vmov(NeonS16, d1, 1, r1), "ee011b70 vmov.16 d1[1], r1");
COMPARE(vmov(NeonS16, d2, 2, r2), "ee222b30 vmov.16 d2[2], r2");
COMPARE(vmov(NeonS16, d3, 3, r7), "ee237b70 vmov.16 d3[3], r7");
COMPARE(vmov(NeonS16, d3, 3, ip), "ee23cb70 vmov.16 d3[3], ip");
COMPARE(vmov(NeonS32, d0, 0, r0), "ee000b10 vmov.32 d0[0], r0");
COMPARE(vmov(NeonU32, d0, 1, r0), "ee200b10 vmov.32 d0[1], r0");
......@@ -981,6 +987,7 @@ TEST(Neon) {
COMPARE(vmov(NeonU8, r1, d5, 5), "eef51b30 vmov.u8 r1, d5[5]");
COMPARE(vmov(NeonS8, r2, d6, 6), "ee762b50 vmov.s8 r2, d6[6]");
COMPARE(vmov(NeonU8, r8, d7, 7), "eef78b70 vmov.u8 r8, d7[7]");
COMPARE(vmov(NeonU8, ip, d7, 7), "eef7cb70 vmov.u8 ip, d7[7]");
COMPARE(vmov(NeonS16, r0, d0, 0), "ee100b30 vmov.s16 r0, d0[0]");
COMPARE(vmov(NeonU16, r1, d1, 1), "ee911b70 vmov.u16 r1, d1[1]");
COMPARE(vmov(NeonS16, r2, d2, 2), "ee322b30 vmov.s16 r2, d2[2]");
......@@ -1413,6 +1420,8 @@ TEST(LoadStore) {
COMPARE(pld(MemOperand(r1, 0)),
"f5d1f000 pld [r1]");
COMPARE(pld(MemOperand(ip, 64)),
"f5dcf040 pld [ip, #+64]");
COMPARE(pld(MemOperand(r2, 128)),
"f5d2f080 pld [r2, #+128]");
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment