OpcodeDispatcher: reg cache avx high

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
This commit is contained in:
Alyssa Rosenzweig 2024-07-03 08:50:49 -04:00
parent cf5ab05b90
commit a4f8bbff02
2 changed files with 11 additions and 4 deletions

View File

@ -1819,9 +1819,12 @@ private:
static const int DFIndex = 31;
static const int FPR0Index = 32;
static const int FPR15Index = 47;
static const int AVXHigh0Index = 48;
static const int AVXHigh15Index = 63;
int CacheIndexToContextOffset(int Index) {
switch (Index) {
case AVXHigh0Index ... AVXHigh15Index: return offsetof(FEXCore::Core::CPUState, avx_high[Index - AVXHigh0Index][0]);
case AbridgedFTWIndex: return offsetof(FEXCore::Core::CPUState, AbridgedFTW);
default: return -1;
}
@ -1836,7 +1839,11 @@ private:
}
unsigned CacheIndexToSize(int Index) {
return 1;
if (Index >= AVXHigh0Index) {
return 16;
} else {
return 1;
}
}
struct {
@ -1858,7 +1865,7 @@ private:
if (!(RegCache.Cached & Bit)) {
if (Index == DFIndex) {
RegCache.Value[Index] = _LoadDF();
} else if (Index == AbridgedFTWIndex) {
} else if (Index == AbridgedFTWIndex || Index >= AVXHigh0Index) {
RegCache.Value[Index] = _LoadContext(Size, RegClass, Offset);
} else {
RegCache.Value[Index] = _LoadRegister(Offset, RegClass, Size);

View File

@ -562,7 +562,7 @@ void OpDispatchBuilder::AVX128_StoreResult_WithOpSize(FEXCore::X86Tables::Decode
Ref OpDispatchBuilder::AVX128_LoadXMMRegister(uint32_t XMM, bool High) {
if (High) {
return _LoadContext(16, FPRClass, offsetof(FEXCore::Core::CPUState, avx_high[XMM][0]));
return LoadContext(AVXHigh0Index + XMM);
} else {
return LoadXMMRegister(XMM);
}
@ -570,7 +570,7 @@ Ref OpDispatchBuilder::AVX128_LoadXMMRegister(uint32_t XMM, bool High) {
void OpDispatchBuilder::AVX128_StoreXMMRegister(uint32_t XMM, const Ref Src, bool High) {
if (High) {
_StoreContext(16, FPRClass, Src, offsetof(FEXCore::Core::CPUState, avx_high[XMM][0]));
StoreContext(AVXHigh0Index + XMM, Src);
} else {
StoreXMMRegister(XMM, Src);
}