Skip to content

Commit 417efd4

Browse files
authored
Merge pull request #2110 from pc2/cpu-detection
Fix detection of Skylake processors when using GCC
2 parents 27649b9 + 9cdc828 commit 417efd4

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

Makefile.system

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ ifndef TOPDIR
99
TOPDIR = .
1010
endif
1111

12+
# If ARCH is not set, we use the host system's architecture.
13+
ifndef ARCH
14+
ARCH := $(shell uname -m)
15+
endif
16+
1217
# Catch conflicting usage of ARCH in some BSD environments
1318
ifeq ($(ARCH), amd64)
1419
override ARCH=x86_64
@@ -137,6 +142,10 @@ endif
137142
endif
138143

139144

145+
# On x86_64 build getarch with march=native. This is required to detect AVX512 support in getarch.
146+
ifeq ($(ARCH), x86_64)
147+
GETARCH_FLAGS += -march=native
148+
endif
140149

141150

142151
ifdef INTERFACE64

c_check

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ if (($architecture eq "x86") || ($architecture eq "x86_64")) {
240240
} else {
241241
$no_avx512 = 0;
242242
}
243-
unlink("tmpf.o");
243+
unlink("$tmpf.o");
244244
}
245245
}
246246

cmake/system.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,11 @@ if (DEFINED TARGET)
6565
set(GETARCH_FLAGS "-DFORCE_${TARGET}")
6666
endif ()
6767

68+
# On x86_64 build getarch with march=native. This is required to detect AVX512 support in getarch.
69+
if (X86_64)
70+
set(GETARCH_FLAGS "${GETARCH_FLAGS} -march=native")
71+
endif ()
72+
6873
if (INTERFACE64)
6974
message(STATUS "Using 64-bit integers.")
7075
set(GETARCH_FLAGS "${GETARCH_FLAGS} -DUSE64BITINT")

0 commit comments

Comments
 (0)