mirror of
https://github.com/azahar-emu/dynarmic.git
synced 2026-04-30 16:33:16 +02:00
41 lines
1.0 KiB
C++
41 lines
1.0 KiB
C++
/* This file is part of the dynarmic project.
|
|
* Copyright (c) 2020 MerryMage
|
|
* SPDX-License-Identifier: 0BSD
|
|
*/
|
|
|
|
#include "common/bit_util.h"
|
|
|
|
#include "frontend/A32/translate/impl/translate_arm.h"
|
|
|
|
namespace Dynarmic::A32 {
|
|
|
|
bool ArmTranslatorVisitor::asimd_VSWP(bool D, size_t Vd, bool Q, bool M, size_t Vm) {
|
|
if (Q && (Common::Bit<0>(Vd) || Common::Bit<0>(Vm))) {
|
|
return UndefinedInstruction();
|
|
}
|
|
|
|
// Swapping the same register results in the same contents.
|
|
const auto d = ToVector(Q, Vd, D);
|
|
const auto m = ToVector(Q, Vm, M);
|
|
if (d == m) {
|
|
return true;
|
|
}
|
|
|
|
if (Q) {
|
|
const auto reg_d = ir.GetVector(d);
|
|
const auto reg_m = ir.GetVector(m);
|
|
|
|
ir.SetVector(m, reg_d);
|
|
ir.SetVector(d, reg_m);
|
|
} else {
|
|
const auto reg_d = ir.GetExtendedRegister(d);
|
|
const auto reg_m = ir.GetExtendedRegister(m);
|
|
|
|
ir.SetExtendedRegister(m, reg_d);
|
|
ir.SetExtendedRegister(d, reg_m);
|
|
}
|
|
|
|
return true;
|
|
}
|
|
} // namespace Dynarmic::A32
|