Reliably detect AVX2 at runtime on Linux (#1614)

ECX must be set to 0 to read this flag, the easiest way to achieve this
is to use __cpuid_count with 0 as the second argument.
This commit is contained in:
Chris Mayo 2019-01-08 03:41:26 +00:00 committed by Davis E. King
parent 6b5b461dd0
commit 9ca72b3e1c
1 changed files with 1 additions and 1 deletions

View File

@ -129,7 +129,7 @@
{
std::array<unsigned int,4> info;
// Load EAX, EBX, ECX, EDX into info
__cpuid(function_id, info[0], info[1], info[2], info[3]);
__cpuid_count(function_id, 0, info[0], info[1], info[2], info[3]);
return info;
}