|
From: <sv...@va...> - 2009-12-27 23:21:26
|
Author: sewardj
Date: 2009-12-27 23:21:08 +0000 (Sun, 27 Dec 2009)
New Revision: 1942
Log:
Fix incorrect implementation of SXTAB in r1941 (zero extended when
should have sign extended) and implement UXTAH.
Modified:
branches/ARM/priv/guest_arm_toIR.c
Modified: branches/ARM/priv/guest_arm_toIR.c
===================================================================
--- branches/ARM/priv/guest_arm_toIR.c 2009-12-27 17:00:11 UTC (rev 1941)
+++ branches/ARM/priv/guest_arm_toIR.c 2009-12-27 23:21:08 UTC (rev 1942)
@@ -4548,18 +4548,45 @@
IRTemp srcL = newTemp(Ity_I32);
IRTemp srcR = newTemp(Ity_I32);
IRTemp res = newTemp(Ity_I32);
+ assign(srcR, getIReg(rM));
+ assign(srcL, getIReg(rN));
+ assign(res, binop(Iop_Add32,
+ mkexpr(srcL),
+ unop(Iop_8Sto32,
+ unop(Iop_32to8,
+ genROR32(srcR, 8 * rot)))));
+ putIReg(rD, mkexpr(res), condT, Ijk_Boring);
+ DIP("sxtab%s r%u, r%u, r%u, ror #%u\n",
+ nCC(insn_cond), rD, rN, rM, rot);
+ goto decode_success;
+ }
+ /* fall through */
+ }
+ /* ------------------- uxtah ------------- */
+ if (BITS8(0,1,1,0,1,1,1,1) == insn_27_20
+ && BITS4(0,0,0,0) == (insn_11_8 & BITS4(0,0,1,1))
+ && BITS4(0,1,1,1) == insn_7_4) {
+ UInt rN = insn_19_16;
+ UInt rD = insn_15_12;
+ UInt rM = insn_3_0;
+ UInt rot = (insn >> 10) & 3;
+ if (rN == 15/*it's UXTH*/ || rD == 15 || rM == 15) {
+ /* undecodable; fall through */
+ } else {
+ IRTemp srcL = newTemp(Ity_I32);
+ IRTemp srcR = newTemp(Ity_I32);
+ IRTemp res = newTemp(Ity_I32);
assign(srcR, getIReg(rM));
assign(srcL, getIReg(rN));
assign(res, binop(Iop_Add32,
mkexpr(srcL),
- binop(Iop_And32,
- genROR32(srcR, 8 * rot),
- mkU32(0xFF))));
-
+ unop(Iop_16Uto32,
+ unop(Iop_32to16,
+ genROR32(srcR, 8 * rot)))));
putIReg(rD, mkexpr(res), condT, Ijk_Boring);
- DIP("sxtab%s r%u, r%u, r%u, ror #%u\n",
+ DIP("uxtah%s r%u, r%u, r%u, ror #%u\n",
nCC(insn_cond), rD, rN, rM, rot);
goto decode_success;
}
|