Merge pull request #11966 from Dentomologist/convert_xemitter_prefetchlevel_to_enum_class

xEmitter: Convert PrefetchLevel to enum class
This commit is contained in:
Admiral H. Curtiss 2023-06-18 15:17:02 +02:00 committed by GitHub
commit 8039d10994
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 10 deletions

View File

@ -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);

View File

@ -481,12 +481,12 @@ public:
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);

View File

@ -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] "