Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Merge pull request #11966 from Dentomologist/convert_xemitter_prefetc…
…hlevel_to_enum_class

xEmitter: Convert PrefetchLevel to enum class
  • Loading branch information
AdmiralCurtiss committed Jun 18, 2023
2 parents 2d18c9e + 04fcf68 commit 8039d10
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion Source/Core/Common/x64Emitter.cpp
Expand Up @@ -920,7 +920,7 @@ void XEmitter::UD2()
void XEmitter::PREFETCH(PrefetchLevel level, OpArg arg)
{
ASSERT_MSG(DYNA_REC, !arg.IsImm(), "PREFETCH - Imm argument");
arg.operandReg = (u8)level;
arg.operandReg = static_cast<u8>(level);
arg.WriteREX(this, 0, 0);
Write8(0x0F);
Write8(0x18);
Expand Down
10 changes: 5 additions & 5 deletions Source/Core/Common/x64Emitter.h
Expand Up @@ -481,12 +481,12 @@ class XEmitter
void BSR(int bits, X64Reg dest, const OpArg& src); // Top bit to bottom bit

// Cache control
enum PrefetchLevel
enum class PrefetchLevel : u8
{
PF_NTA, // Non-temporal (data used once and only once)
PF_T0, // All cache levels
PF_T1, // Levels 2+ (aliased to T0 on AMD)
PF_T2, // Levels 3+ (aliased to T0 on AMD)
NTA = 0, // Non-temporal (data used once and only once)
T0 = 1, // All cache levels
T1 = 2, // Levels 2+ (aliased to T0 on AMD)
T2 = 3, // Levels 3+ (aliased to T0 on AMD)
};
void PREFETCH(PrefetchLevel level, OpArg arg);
void MOVNTI(int bits, const OpArg& dest, X64Reg src);
Expand Down
8 changes: 4 additions & 4 deletions Source/UnitTests/Common/x64EmitterTest.cpp
Expand Up @@ -380,10 +380,10 @@ BITSEARCH_TEST(TZCNT);

TEST_F(x64EmitterTest, PREFETCH)
{
emitter->PREFETCH(XEmitter::PF_NTA, MatR(R12));
emitter->PREFETCH(XEmitter::PF_T0, MatR(R12));
emitter->PREFETCH(XEmitter::PF_T1, MatR(R12));
emitter->PREFETCH(XEmitter::PF_T2, MatR(R12));
emitter->PREFETCH(XEmitter::PrefetchLevel::NTA, MatR(R12));
emitter->PREFETCH(XEmitter::PrefetchLevel::T0, MatR(R12));
emitter->PREFETCH(XEmitter::PrefetchLevel::T1, MatR(R12));
emitter->PREFETCH(XEmitter::PrefetchLevel::T2, MatR(R12));

ExpectDisassembly("prefetchnta byte ptr ds:[r12] "
"prefetcht0 byte ptr ds:[r12] "
Expand Down

0 comments on commit 8039d10

Please sign in to comment.