Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/coreclr/src/vm/cgensys.h
Original file line number Diff line number Diff line change
Expand Up @@ -105,12 +105,17 @@ extern "C" void __stdcall __cpuidex(int cpuInfo[4], int function_id, int subFunc
extern "C" DWORD __stdcall xmmYmmStateSupport();
#endif

const int CPUID_EAX = 0;
const int CPUID_EBX = 1;
const int CPUID_ECX = 2;
const int CPUID_EDX = 3;

inline bool TargetHasAVXSupport()
{
#if (defined(TARGET_X86) || defined(TARGET_AMD64)) && !defined(CROSSGEN_COMPILE)
int cpuInfo[4];
__cpuid(cpuInfo, 0x00000001); // All x86/AMD64 targets support cpuid.
return ((cpuInfo[3] & (1 << 28)) != 0); // The AVX feature is ECX bit 28.
return ((cpuInfo[CPUID_ECX] & (1 << 28)) != 0); // The AVX feature is ECX bit 28.
#endif // (defined(TARGET_X86) || defined(TARGET_AMD64)) && !defined(CROSSGEN_COMPILE)
return false;
}
Expand Down
8 changes: 4 additions & 4 deletions src/coreclr/src/vm/codeman.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1353,10 +1353,10 @@ void EEJitManager::SetCpuInfo()

int cpuidInfo[4];

const int EAX = 0;
const int EBX = 1;
const int ECX = 2;
const int EDX = 3;
const int EAX = CPUID_EAX;
const int EBX = CPUID_EBX;
const int ECX = CPUID_ECX;
const int EDX = CPUID_EDX;

__cpuid(cpuidInfo, 0x00000000);
uint32_t maxCpuId = static_cast<uint32_t>(cpuidInfo[EAX]);
Expand Down