From a1738fc5ecece05976d53214b21183c57ead7972 Mon Sep 17 00:00:00 2001 From: Jean-Philip Desjardins Date: Sun, 22 Dec 2024 18:10:56 -0500 Subject: [PATCH] Use MD_LoadFromRefMasked and MD_StoreAtRefMasked. --- Source/ee/VUShared.cpp | 71 +++++++----------------------------------- deps/CodeGen | 2 +- 2 files changed, 12 insertions(+), 61 deletions(-) diff --git a/Source/ee/VUShared.cpp b/Source/ee/VUShared.cpp index 739f2b7140..a5a355d69a 100644 --- a/Source/ee/VUShared.cpp +++ b/Source/ee/VUShared.cpp @@ -1052,36 +1052,12 @@ void VUShared::LQbase(CMipsJitter* codeGen, uint8 dest, uint8 it) } else { - codeGen->AddRef(); - - //Try some aligned 64-bit reads first - for(unsigned int i = 0; i < 3; i += 2) - { - uint8 mask = (0x03 << i); - if((dest & mask) == mask) - { - unsigned int element = (i ^ 0x03) - 1; - codeGen->PushTop(); - codeGen->PushCst(element * 4); - codeGen->Load64FromRefIdx(1); - codeGen->PullRel64(offsetof(CMIPS, m_State.nCOP2[it].nV[element])); - dest &= ~mask; - } - } - - //Read any remaining data - for(unsigned int i = 0; i < 4; i++) - { - if(VUShared::DestinationHasElement(static_cast(dest), i)) - { - codeGen->PushTop(); - codeGen->PushCst(i * 4); - codeGen->LoadFromRefIdx(1); - codeGen->PullRel(offsetof(CMIPS, m_State.nCOP2[it].nV[i])); - } - } - - codeGen->PullTop(); + codeGen->MD_PushRel(offsetof(CMIPS, m_State.nCOP2[it])); + codeGen->MD_LoadFromRefIdxMasked(DestinationHasElement(dest, 0), + DestinationHasElement(dest, 1), + DestinationHasElement(dest, 2), + DestinationHasElement(dest, 3)); + codeGen->MD_PullRel(offsetof(CMIPS, m_State.nCOP2[it])); } } @@ -1615,36 +1591,11 @@ void VUShared::SQbase(CMipsJitter* codeGen, uint8 dest, uint8 is) } else { - codeGen->AddRef(); - - //Try some aligned 64-bit writes first - for(unsigned int i = 0; i < 3; i += 2) - { - uint8 mask = (0x03 << i); - if((dest & mask) == mask) - { - unsigned int element = (i ^ 0x03) - 1; - codeGen->PushTop(); - codeGen->PushCst(element * 4); - codeGen->PushRel64(offsetof(CMIPS, m_State.nCOP2[is].nV[element])); - codeGen->Store64AtRefIdx(1); - dest &= ~mask; - } - } - - //Write any remaining data - for(unsigned int i = 0; i < 4; i++) - { - if(VUShared::DestinationHasElement(static_cast(dest), i)) - { - codeGen->PushTop(); //Push dest memory ref - codeGen->PushCst(i * 4); //Push index - codeGen->PushRel(offsetof(CMIPS, m_State.nCOP2[is].nV[i])); - codeGen->StoreAtRefIdx(1); - } - } - - codeGen->PullTop(); + codeGen->MD_PushRel(offsetof(CMIPS, m_State.nCOP2[is])); + codeGen->MD_StoreAtRefIdxMasked(DestinationHasElement(dest, 0), + DestinationHasElement(dest, 1), + DestinationHasElement(dest, 2), + DestinationHasElement(dest, 3)); } } diff --git a/deps/CodeGen b/deps/CodeGen index 352092512e..a9cf91f49a 160000 --- a/deps/CodeGen +++ b/deps/CodeGen @@ -1 +1 @@ -Subproject commit 352092512e7a0aee70861d7c9a7bfa0ecdaff96a +Subproject commit a9cf91f49a35bd724501b6d658bf2697b2aec70a