mirror of
https://github.com/google/cpu_features.git
synced 2025-07-01 05:11:15 +02:00
add windows ssse3,sse4_1,sse4_2 detection for non avx path (#251)
* add windows ssse3,sse4_1,sse4_2 detection for non avx path * remove special WESTMERE case * move windows conditional redefinition to separate header * fix minor issues
This commit is contained in:
@ -24,7 +24,7 @@ static void OverrideOsPreserves(OsPreserves* os_preserves) {
|
||||
// No override
|
||||
}
|
||||
|
||||
#include <windows.h> // IsProcessorFeaturePresent
|
||||
#include "internal/windows_utils.h"
|
||||
|
||||
#if defined(CPU_FEATURES_MOCK_CPUID_X86)
|
||||
extern bool GetWindowsIsProcessorFeaturePresent(DWORD);
|
||||
@ -43,15 +43,15 @@ static void DetectFeaturesFromOs(X86Info* info, X86Features* features) {
|
||||
GetWindowsIsProcessorFeaturePresent(PF_XMMI64_INSTRUCTIONS_AVAILABLE);
|
||||
features->sse3 =
|
||||
GetWindowsIsProcessorFeaturePresent(PF_SSE3_INSTRUCTIONS_AVAILABLE);
|
||||
features->ssse3 =
|
||||
GetWindowsIsProcessorFeaturePresent(PF_SSSE3_INSTRUCTIONS_AVAILABLE);
|
||||
features->sse4_1 =
|
||||
GetWindowsIsProcessorFeaturePresent(PF_SSE4_1_INSTRUCTIONS_AVAILABLE);
|
||||
features->sse4_2 =
|
||||
GetWindowsIsProcessorFeaturePresent(PF_SSE4_2_INSTRUCTIONS_AVAILABLE);
|
||||
|
||||
// https://github.com/google/cpu_features/issues/200
|
||||
#if (_WIN32_WINNT >= 0x0601) // Win7+
|
||||
if (GetX86Microarchitecture(info) == INTEL_WSM) {
|
||||
features->ssse3 = true;
|
||||
features->sse4_1 = true;
|
||||
features->sse4_2 = true;
|
||||
}
|
||||
#endif
|
||||
// do not bother checking PF_AVX*
|
||||
// cause AVX enabled processor will have XCR0 be exposed and this function will be skipped at all
|
||||
}
|
||||
|
||||
#endif // CPU_FEATURES_OS_WINDOWS
|
||||
|
Reference in New Issue
Block a user