Skip to content
Open
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
18 changes: 16 additions & 2 deletions src/native/minipal/cpufeatures.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,6 +237,7 @@ int minipal_getcpufeatures(void)

bool hasAvx2Dependencies = false;
bool hasAvx10v1Dependencies = false;
bool hasApxDependencies = false;

if (((cpuidInfo[CPUID_EDX] & (1 << 25)) == 0) || // SSE
((cpuidInfo[CPUID_EDX] & (1 << 26)) == 0) || // SSE2
Expand Down Expand Up @@ -406,9 +407,13 @@ int minipal_getcpufeatures(void)

if (IsApxEnabled() && apxStateSupport())
{
if ((cpuidInfo[CPUID_EDX] & (1 << 21)) != 0) // Apx
if ((cpuidInfo[CPUID_EDX] & (1 << 21)) != 0) // Apx_F
{
result |= XArchIntrinsicConstants_Apx;
// APX availability check is split into two parts, Apx_F here
// checks the fundamental support, and APX_NCI_NDD_NF checks
// feature support.
// Full APX requires both parts to be present to be enabled.
hasApxDependencies = true;
}
}
}
Expand Down Expand Up @@ -446,6 +451,15 @@ int minipal_getcpufeatures(void)
}
}
}

if (maxCpuId >= 0x29)
{
__cpuidex(cpuidInfo, 0x00000029, 0x00000000);
if (((cpuidInfo[CPUID_EBX] & (1 << 0)) != 0) && hasApxDependencies) // APX_NCI_NDD_NF
{
result |= XArchIntrinsicConstants_Apx;
}
}
}
#endif // HOST_X86 || HOST_AMD64

Expand Down
Loading