mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-03-07 14:46:27 +00:00
Implemented the PKHTB and PKHBT instructions with tests. (#40)
This commit is contained in:
@@ -24,6 +24,7 @@ set(SRCS
|
||||
frontend/translate/translate_arm/extension.cpp
|
||||
frontend/translate/translate_arm/load_store.cpp
|
||||
frontend/translate/translate_arm/multiply.cpp
|
||||
frontend/translate/translate_arm/packing.cpp
|
||||
frontend/translate/translate_arm/parallel.cpp
|
||||
frontend/translate/translate_arm/reversal.cpp
|
||||
frontend/translate/translate_arm/status_register_access.cpp
|
||||
|
||||
41
src/frontend/translate/translate_arm/packing.cpp
Normal file
41
src/frontend/translate/translate_arm/packing.cpp
Normal file
@@ -0,0 +1,41 @@
|
||||
/* This file is part of the dynarmic project.
|
||||
* Copyright (c) 2016 MerryMage
|
||||
* This software may be used and distributed according to the terms of the GNU
|
||||
* General Public License version 2 or any later version.
|
||||
*/
|
||||
|
||||
#include "translate_arm.h"
|
||||
|
||||
namespace Dynarmic {
|
||||
namespace Arm {
|
||||
|
||||
bool ArmTranslatorVisitor::arm_PKHBT(Cond cond, Reg n, Reg d, Imm5 imm5, Reg m) {
|
||||
if (n == Reg::PC || d == Reg::PC || m == Reg::PC)
|
||||
return UnpredictableInstruction();
|
||||
|
||||
if (ConditionPassed(cond)) {
|
||||
auto shifted = EmitImmShift(ir.GetRegister(m), ShiftType::LSL, imm5, ir.Imm1(false)).result;
|
||||
auto lower_half = ir.And(ir.GetRegister(n), ir.Imm32(0x0000FFFF));
|
||||
auto upper_half = ir.And(shifted, ir.Imm32(0xFFFF0000));
|
||||
ir.SetRegister(d, ir.Or(lower_half, upper_half));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ArmTranslatorVisitor::arm_PKHTB(Cond cond, Reg n, Reg d, Imm5 imm5, Reg m) {
|
||||
if (n == Reg::PC || d == Reg::PC || m == Reg::PC)
|
||||
return UnpredictableInstruction();
|
||||
|
||||
if (ConditionPassed(cond)) {
|
||||
auto shifted = EmitImmShift(ir.GetRegister(m), ShiftType::ASR, imm5, ir.Imm1(false)).result;
|
||||
auto lower_half = ir.And(shifted, ir.Imm32(0x0000FFFF));
|
||||
auto upper_half = ir.And(ir.GetRegister(n), ir.Imm32(0xFFFF0000));
|
||||
ir.SetRegister(d, ir.Or(lower_half, upper_half));
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace Arm
|
||||
} // namespace Dynarmic
|
||||
@@ -218,8 +218,8 @@ struct ArmTranslatorVisitor final {
|
||||
bool arm_USADA8(Cond cond, Reg d, Reg a, Reg m, Reg n) { return InterpretThisInstruction(); }
|
||||
|
||||
// Packing instructions
|
||||
bool arm_PKHBT(Cond cond, Reg n, Reg d, Imm5 imm5, Reg m) { return InterpretThisInstruction(); }
|
||||
bool arm_PKHTB(Cond cond, Reg n, Reg d, Imm5 imm5, Reg m) { return InterpretThisInstruction(); }
|
||||
bool arm_PKHBT(Cond cond, Reg n, Reg d, Imm5 imm5, Reg m);
|
||||
bool arm_PKHTB(Cond cond, Reg n, Reg d, Imm5 imm5, Reg m);
|
||||
|
||||
// Reversal instructions
|
||||
bool arm_REV(Cond cond, Reg d, Reg m);
|
||||
|
||||
Reference in New Issue
Block a user