translate_arm/misc: Invert conditionals where applicable
This commit is contained in:
parent
a7bf5ff77d
commit
c8dad40d81
1 changed files with 19 additions and 10 deletions
|
@ -8,26 +8,35 @@
|
|||
|
||||
namespace Dynarmic::A32 {
|
||||
|
||||
// CLZ<c> <Rd>, <Rm>
|
||||
bool ArmTranslatorVisitor::arm_CLZ(Cond cond, Reg d, Reg m) {
|
||||
if (d == Reg::PC || m == Reg::PC)
|
||||
if (d == Reg::PC || m == Reg::PC) {
|
||||
return UnpredictableInstruction();
|
||||
if (ConditionPassed(cond)) {
|
||||
ir.SetRegister(d, ir.CountLeadingZeros(ir.GetRegister(m)));
|
||||
}
|
||||
|
||||
if (!ConditionPassed(cond)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
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);
|
||||
auto result = ir.PackedSelect(ir.GetGEFlags(), to, from);
|
||||
ir.SetRegister(d, result);
|
||||
ir.SetRegister(d, ir.CountLeadingZeros(ir.GetRegister(m)));
|
||||
return true;
|
||||
}
|
||||
|
||||
// SEL<c> <Rd>, <Rn>, <Rm>
|
||||
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)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const auto to = ir.GetRegister(m);
|
||||
const auto from = ir.GetRegister(n);
|
||||
const auto result = ir.PackedSelect(ir.GetGEFlags(), to, from);
|
||||
|
||||
ir.SetRegister(d, result);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue