Fix MoveRegister to clear when value is 0

The register wouldn't be cleared with a `MOVZ` when a value was zero due to the condition for writing an instruction requiring the `offsetValue` to be non-zero.
This commit is contained in:
PixelyIon 2022-11-05 21:52:27 +05:30
parent f7ab3abb86
commit 8892eb08e6

View File

@ -257,13 +257,11 @@ namespace skyline::nce {
for (auto &instruction : instructions) { for (auto &instruction : instructions) {
auto offsetValue{*(valuePointer + offset)}; auto offsetValue{*(valuePointer + offset)};
if (offsetValue) { if (!zeroed) {
if (zeroed) {
instruction = instructions::Movk(destination, offsetValue, offset).raw;
} else {
instruction = instructions::Movz(destination, offsetValue, offset).raw; instruction = instructions::Movz(destination, offsetValue, offset).raw;
zeroed = true; zeroed = true;
} } else if (offsetValue && zeroed) {
instruction = instructions::Movk(destination, offsetValue, offset).raw;
} else { } else {
instruction = 0; instruction = 0;
} }