move_wide: Make variables const where applicable

This commit is contained in:
Lioncash 2018-09-17 21:25:31 -04:00 committed by MerryMage
parent 78024a9dc4
commit 867b666285

View file

@ -9,45 +9,51 @@
namespace Dynarmic::A64 {
bool TranslatorVisitor::MOVN(bool sf, Imm<2> hw, Imm<16> imm16, Reg Rd) {
size_t datasize = sf ? 64 : 32;
if (!sf && hw.Bit<1>()) {
return UnallocatedEncoding();
}
if (!sf && hw.Bit<1>()) return UnallocatedEncoding();
size_t pos = hw.ZeroExtend<size_t>() << 4;
const size_t datasize = sf ? 64 : 32;
const size_t pos = hw.ZeroExtend<size_t>() << 4;
u64 value = imm16.ZeroExtend<u64>() << pos;
value = ~value;
auto result = I(datasize, value);
X(datasize, Rd, result);
const auto result = I(datasize, value);
X(datasize, Rd, result);
return true;
}
bool TranslatorVisitor::MOVZ(bool sf, Imm<2> hw, Imm<16> imm16, Reg Rd) {
size_t datasize = sf ? 64 : 32;
if (!sf && hw.Bit<1>()) {
return UnallocatedEncoding();
}
if (!sf && hw.Bit<1>()) return UnallocatedEncoding();
size_t pos = hw.ZeroExtend<size_t>() << 4;
const size_t datasize = sf ? 64 : 32;
const size_t pos = hw.ZeroExtend<size_t>() << 4;
const u64 value = imm16.ZeroExtend<u64>() << pos;
const auto result = I(datasize, value);
u64 value = imm16.ZeroExtend<u64>() << pos;
auto result = I(datasize, value);
X(datasize, Rd, result);
return true;
}
bool TranslatorVisitor::MOVK(bool sf, Imm<2> hw, Imm<16> imm16, Reg Rd) {
size_t datasize = sf ? 64 : 32;
if (!sf && hw.Bit<1>()) {
return UnallocatedEncoding();
}
if (!sf && hw.Bit<1>()) return UnallocatedEncoding();
size_t pos = hw.ZeroExtend<size_t>() << 4;
const size_t datasize = sf ? 64 : 32;
const size_t pos = hw.ZeroExtend<size_t>() << 4;
const u64 mask = u64(0xFFFF) << pos;
const u64 value = imm16.ZeroExtend<u64>() << pos;
auto result = X(datasize, Rd);
u64 mask = u64(0xFFFF) << pos;
u64 value = imm16.ZeroExtend<u64>() << pos;
result = ir.And(result, I(datasize, ~mask));
result = ir.Or(result, I(datasize, value));
X(datasize, Rd, result);
return true;
}