ARM64: Fix LDP disassembly

This commit is contained in:
Henrik Rydgard 2015-03-21 19:19:12 +01:00
parent 34e61ab875
commit 6cb107d6fc
4 changed files with 9 additions and 8 deletions

View file

@ -754,13 +754,10 @@ void ARM64XEmitter::EncodeLoadStorePair(u32 op, u32 load, IndexType type, ARM64R
break;
}
if (b64Bit)
{
if (b64Bit) {
op |= 2;
imm >>= 3;
}
else
{
} else {
imm >>= 2;
}
@ -769,7 +766,7 @@ void ARM64XEmitter::EncodeLoadStorePair(u32 op, u32 load, IndexType type, ARM64R
Rn = DecodeReg(Rn);
Write32((op << 30) | (5 << 27) | (type_encode << 23) | (load << 22) | \
((imm & 0x7F) << 15) | (Rt2 << 10) | (Rn << 5) | Rt);
(((uint32_t)imm & 0x7F) << 15) | (Rt2 << 10) | (Rn << 5) | Rt);
}
void ARM64XEmitter::EncodeAddressInst(u32 op, ARM64Reg Rd, s32 imm)

View file

@ -100,6 +100,7 @@ void Arm64Jit::GenerateFixedCode() {
enterCode = GetCodePtr();
ABI_PushRegisters(regs_to_save);
// TODO: Also push D8-D15, the fp registers we need to save.
// Fixed registers, these are always kept when in Jit context.
// R8 is used to hold flags during delay slots. Not always needed.

View file

@ -225,7 +225,6 @@ static void BranchExceptionAndSystem(uint32_t w, uint64_t addr, Instruction *ins
static void LoadStore(uint32_t w, uint64_t addr, Instruction *instr) {
int size = w >> 30;
bool is64bit = (w >> 31) ? true : false;
int imm9 = SignExtend9((w >> 12) & 0x1FF);
int Rt = (w & 0x1F);
int Rn = ((w >> 5) & 0x1F);
@ -279,10 +278,12 @@ static void LoadStore(uint32_t w, uint64_t addr, Instruction *instr) {
}
} else if (((w >> 25) & 0x3F) == 0x14) {
// store pair
int offset = SignExtend7((w >> 15) & 0x7f) << (is64bit ? 3 : 2);
int Rt2 = (w >> 10) & 0x1f;
bool load = (w >> 22) & 1;
int index_type = ((w >> 23) & 3);
bool sf = (w >> 31);
r = sf ? 'x' : 'w';
int offset = SignExtend7((w >> 15) & 0x7f) << (sf ? 3 : 2);
if (index_type == 2) {
snprintf(instr->text, sizeof(instr->text), "%s %c%d, %c%d, [x%d, #%d]", load ? "ldp" : "stp", r, Rt, r, Rt2, Rn, offset);
return;

View file

@ -82,6 +82,8 @@ bool TestArm64Emitter() {
RET(CheckLast(emitter, "9a87c0a3 csel x3, x5, x7, gt"));
emitter.LDR(W23, X3, X12);
RET(CheckLast(emitter, "b86c6877 ldr w23, [x3 + x12]"));
emitter.LDP(INDEX_SIGNED, X23, X5, X3, 32);
RET(CheckLast(emitter, "a9421477 ldp x23, x5, [x3, #32]"));
emitter.LDP(INDEX_SIGNED, W23, W5, X3, 36);
RET(CheckLast(emitter, "29449477 ldp w23, w5, [x3, #36]"));
emitter.STP(INDEX_PRE, W23, W5, SP, -16);