2016-12-04 22:56:33 +00:00
|
|
|
/* 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 {
|
2018-01-01 15:23:56 +00:00
|
|
|
namespace A32 {
|
2016-12-04 22:56:33 +00:00
|
|
|
|
|
|
|
bool ArmTranslatorVisitor::arm_CLZ(Cond cond, Reg d, Reg m) {
|
|
|
|
if (d == Reg::PC || m == Reg::PC)
|
|
|
|
return UnpredictableInstruction();
|
|
|
|
if (ConditionPassed(cond)) {
|
|
|
|
ir.SetRegister(d, ir.CountLeadingZeros(ir.GetRegister(m)));
|
|
|
|
}
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2017-04-25 13:57:27 +01:00
|
|
|
bool ArmTranslatorVisitor::arm_SEL(Cond cond, Reg n, Reg d, Reg m) {
|
|
|
|
if (n == Reg::PC || d == Reg::PC || m == Reg::PC)
|
|
|
|
return UnpredictableInstruction();
|
|
|
|
|
|
|
|
if (ConditionPassed(cond)) {
|
|
|
|
auto to = ir.GetRegister(m);
|
|
|
|
auto from = ir.GetRegister(n);
|
2017-11-25 16:33:48 +00:00
|
|
|
auto result = ir.PackedSelect(ir.GetGEFlags(), to, from);
|
2017-04-25 13:57:27 +01:00
|
|
|
ir.SetRegister(d, result);
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-01-01 15:23:56 +00:00
|
|
|
} // namespace A32
|
2016-12-04 22:56:33 +00:00
|
|
|
} // namespace Dynarmic
|