From f32921d4936115ed1b7aff1117fc05997c17a271 Mon Sep 17 00:00:00 2001 From: Sebastian Valle Date: Thu, 24 Nov 2016 03:21:12 -0500 Subject: [PATCH] ARM: Implemented UXTB16. (#42) It passes tests. --- src/frontend/translate/translate_arm/extension.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/frontend/translate/translate_arm/extension.cpp b/src/frontend/translate/translate_arm/extension.cpp index 9986d616..7a08acf8 100644 --- a/src/frontend/translate/translate_arm/extension.cpp +++ b/src/frontend/translate/translate_arm/extension.cpp @@ -121,7 +121,16 @@ bool ArmTranslatorVisitor::arm_UXTB(Cond cond, Reg d, SignExtendRotation rotate, } bool ArmTranslatorVisitor::arm_UXTB16(Cond cond, Reg d, SignExtendRotation rotate, Reg m) { - return InterpretThisInstruction(); + if (d == Reg::PC || m == Reg::PC) + return UnpredictableInstruction(); + if (ConditionPassed(cond)) { + auto rotated = SignZeroExtendRor(m, rotate); + auto lower_half = ir.ZeroExtendByteToWord(ir.LeastSignificantByte(rotated)); + auto upper_half = ir.And(rotated, ir.Imm32(0x00FF0000)); + auto result = ir.Or(lower_half, upper_half); + ir.SetRegister(d, result); + } + return true; } bool ArmTranslatorVisitor::arm_UXTH(Cond cond, Reg d, SignExtendRotation rotate, Reg m) {