move_wide: Make variables const where applicable
This commit is contained in:
parent
78024a9dc4
commit
867b666285
1 changed files with 23 additions and 17 deletions
|
@ -9,45 +9,51 @@
|
||||||
namespace Dynarmic::A64 {
|
namespace Dynarmic::A64 {
|
||||||
|
|
||||||
bool TranslatorVisitor::MOVN(bool sf, Imm<2> hw, Imm<16> imm16, Reg Rd) {
|
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();
|
const size_t datasize = sf ? 64 : 32;
|
||||||
size_t pos = hw.ZeroExtend<size_t>() << 4;
|
const size_t pos = hw.ZeroExtend<size_t>() << 4;
|
||||||
|
|
||||||
u64 value = imm16.ZeroExtend<u64>() << pos;
|
u64 value = imm16.ZeroExtend<u64>() << pos;
|
||||||
value = ~value;
|
value = ~value;
|
||||||
auto result = I(datasize, value);
|
|
||||||
X(datasize, Rd, result);
|
|
||||||
|
|
||||||
|
const auto result = I(datasize, value);
|
||||||
|
X(datasize, Rd, result);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::MOVZ(bool sf, Imm<2> hw, Imm<16> imm16, Reg Rd) {
|
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();
|
const size_t datasize = sf ? 64 : 32;
|
||||||
size_t pos = hw.ZeroExtend<size_t>() << 4;
|
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);
|
X(datasize, Rd, result);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TranslatorVisitor::MOVK(bool sf, Imm<2> hw, Imm<16> imm16, Reg Rd) {
|
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();
|
const size_t datasize = sf ? 64 : 32;
|
||||||
size_t pos = hw.ZeroExtend<size_t>() << 4;
|
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);
|
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.And(result, I(datasize, ~mask));
|
||||||
result = ir.Or(result, I(datasize, value));
|
result = ir.Or(result, I(datasize, value));
|
||||||
X(datasize, Rd, result);
|
X(datasize, Rd, result);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue