Skip to content

Commit

Permalink
Make gc/vxsort/isa_detection.cpp portable (dotnet#41517)
Browse files Browse the repository at this point in the history
  • Loading branch information
jkotas authored Aug 28, 2020
1 parent cf6fe8c commit af415cd
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/coreclr/src/gc/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ endif(CLR_CMAKE_HOST_UNIX)
if (CLR_CMAKE_TARGET_ARCH_AMD64 AND CLR_CMAKE_TARGET_WIN32)
set ( GC_SOURCES
${GC_SOURCES}
vxsort/isa_detection_dummy.cpp
vxsort/isa_detection.cpp
vxsort/do_vxsort_avx2.cpp
vxsort/do_vxsort_avx512.cpp
vxsort/machine_traits.avx2.cpp
Expand Down
2 changes: 1 addition & 1 deletion src/coreclr/src/gc/sample/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ set(SOURCES
if (CLR_CMAKE_TARGET_ARCH_AMD64 AND CLR_CMAKE_TARGET_WIN32)
set ( SOURCES
${SOURCES}
../vxsort/isa_detection_dummy.cpp
../vxsort/isa_detection.cpp
../vxsort/do_vxsort_avx2.cpp
../vxsort/do_vxsort_avx512.cpp
../vxsort/machine_traits.avx2.cpp
Expand Down
8 changes: 5 additions & 3 deletions src/coreclr/src/gc/vxsort/isa_detection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.

#include "common.h"

#ifdef TARGET_WINDOWS
#include <intrin.h>
#include <windows.h>
#endif

#include "do_vxsort.h"

Expand All @@ -17,13 +21,11 @@ enum class SupportedISA

static DWORD64 GetEnabledXStateFeaturesHelper()
{
LIMITED_METHOD_CONTRACT;

// On Windows we have an api(GetEnabledXStateFeatures) to check if AVX is supported
typedef DWORD64(WINAPI* PGETENABLEDXSTATEFEATURES)();
PGETENABLEDXSTATEFEATURES pfnGetEnabledXStateFeatures = NULL;

HMODULE hMod = WszLoadLibraryEx(WINDOWS_KERNEL32_DLLNAME_W, NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
HMODULE hMod = LoadLibraryExW(L"kernel32.dll", NULL, LOAD_LIBRARY_SEARCH_SYSTEM32);
if (hMod == NULL)
return 0;

Expand Down
19 changes: 0 additions & 19 deletions src/coreclr/src/gc/vxsort/isa_detection_dummy.cpp

This file was deleted.

0 comments on commit af415cd

Please sign in to comment.