Fixes 16bit addr offset calculation

In the case of 16bit addressing mode, the upper bits 16bits are zext
prior to result.
This commit is contained in:
Ryan Houdek 2021-01-13 10:46:53 -08:00
parent 1084ecf2d3
commit e884525434

View File

@ -4663,6 +4663,12 @@ OrderedNode *OpDispatchBuilder::LoadSource_WithOpSize(FEXCore::IR::RegisterClass
}
}
if (AddrSize < GPRSize) {
// If AddrSize == 16 then we need to clear the upper bits
// GPRSize will be 32 in this case
Src = _Bfe(AddrSize, AddrSize * 8, 0, Src);
}
LoadableType = true;
}
else {
@ -4792,6 +4798,12 @@ void OpDispatchBuilder::StoreResult_WithOpSize(FEXCore::IR::RegisterClassType Cl
}
}
if (AddrSize < GPRSize) {
// If AddrSize == 16 then we need to clear the upper bits
// GPRSize will be 32 in this case
MemStoreDst = _Bfe(AddrSize, AddrSize * 8, 0, MemStoreDst);
}
MemStore = true;
}