Skip to content

Commit

Permalink
Merge pull request #1282 from Sonicadvance1/InterpreterLoadStores
Browse files Browse the repository at this point in the history
Interpreter: Changes basic loadstores to sized accesses
  • Loading branch information
Sonicadvance1 authored Oct 2, 2021
2 parents fb01e8b + fc46cb9 commit 08f5654
Showing 1 changed file with 49 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1740,7 +1740,32 @@ void InterpreterOps::InterpretIR(FEXCore::Core::InternalThreadState *Thread, uin
}
}
memset(GDP, 0, 16);
memcpy(GDP, Data, Op->Size);
switch (OpSize) {
case 1: {
const uint8_t *D = (const uint8_t*)Data;
GD = *D;
break;
}
case 2: {
const uint16_t *D = (const uint16_t*)Data;
GD = *D;
break;
}
case 4: {
const uint32_t *D = (const uint32_t*)Data;
GD = *D;
break;
}
case 8: {
const uint64_t *D = (const uint64_t*)Data;
GD = *D;
break;
}

default:
memcpy(GDP, Data, Op->Size);
break;
}
break;
}
case IR::OP_VLOADMEMELEMENT: {
Expand All @@ -1767,7 +1792,29 @@ void InterpreterOps::InterpretIR(FEXCore::Core::InternalThreadState *Thread, uin
case MEM_OFFSET_SXTW.Val: Data += (int32_t)Offset; break;
}
}
memcpy(Data, GetSrc<void*>(SSAData, Op->Value), Op->Size);
switch (OpSize) {
case 1: {
*reinterpret_cast<uint8_t*>(Data) = *GetSrc<uint8_t*>(SSAData, Op->Value);
break;
}
case 2: {
*reinterpret_cast<uint16_t*>(Data) = *GetSrc<uint16_t*>(SSAData, Op->Value);
break;
}
case 4: {
*reinterpret_cast<uint32_t*>(Data) = *GetSrc<uint32_t*>(SSAData, Op->Value);
break;
}
case 8: {
*reinterpret_cast<uint64_t*>(Data) = *GetSrc<uint64_t*>(SSAData, Op->Value);
break;
}

default:
memcpy(Data, GetSrc<void*>(SSAData, Op->Value), Op->Size);
break;
}

break;
}
case IR::OP_VSTOREMEMELEMENT: {
Expand Down

0 comments on commit 08f5654

Please sign in to comment.