aboutsummaryrefslogtreecommitdiff
path: root/Makefile
diff options
context:
space:
mode:
authorFabian <cmdrf@users.noreply.github.com>2023-04-02 09:17:05 +0200
committerGitHub <noreply@github.com>2023-04-02 10:17:05 +0300
commitc4f89d8d73aab4318a6c61e3835135adfcf55407 (patch)
tree337d181b154683d54423a19e35ec06dfef6067bc /Makefile
parent5b70e7de4c0b8186669d0c5609ba61a2d46de562 (diff)
make : use -march=native -mtune=native on x86 (#609)
Diffstat (limited to 'Makefile')
-rw-r--r--Makefile91
1 files changed, 2 insertions, 89 deletions
diff --git a/Makefile b/Makefile
index 83a4514..2f828bf 100644
--- a/Makefile
+++ b/Makefile
@@ -70,95 +70,8 @@ endif
# TODO: probably these flags need to be tweaked on some architectures
# feel free to update the Makefile for your architecture and send a pull request or issue
ifeq ($(UNAME_M),$(filter $(UNAME_M),x86_64 i686))
- ifeq ($(UNAME_S),Darwin)
- F16C_M := $(shell sysctl machdep.cpu.features)
- ifneq (,$(findstring F16C,$(F16C_M)))
- CFLAGS += -mf16c
- endif
- AVX1_M := $(shell sysctl machdep.cpu.features)
- ifneq (,$(findstring FMA,$(AVX1_M)))
- CFLAGS += -mfma
- endif
- ifneq (,$(findstring AVX1.0,$(AVX1_M)))
- CFLAGS += -mavx
- endif
- AVX2_M := $(shell sysctl machdep.cpu.leaf7_features)
- ifneq (,$(findstring AVX2,$(AVX2_M)))
- CFLAGS += -mavx2
- endif
- else ifeq ($(UNAME_S),Linux)
- AVX1_M := $(shell grep "avx " /proc/cpuinfo)
- ifneq (,$(findstring avx,$(AVX1_M)))
- CFLAGS += -mavx
- endif
- AVX2_M := $(shell grep "avx2 " /proc/cpuinfo)
- ifneq (,$(findstring avx2,$(AVX2_M)))
- CFLAGS += -mavx2
- endif
- FMA_M := $(shell grep "fma " /proc/cpuinfo)
- ifneq (,$(findstring fma,$(FMA_M)))
- CFLAGS += -mfma
- endif
- F16C_M := $(shell grep "f16c " /proc/cpuinfo)
- ifneq (,$(findstring f16c,$(F16C_M)))
- CFLAGS += -mf16c
- endif
- SSE3_M := $(shell grep "sse3 " /proc/cpuinfo)
- ifneq (,$(findstring sse3,$(SSE3_M)))
- CFLAGS += -msse3
- endif
- AVX512F_M := $(shell grep "avx512f " /proc/cpuinfo)
- ifneq (,$(findstring avx512f,$(AVX512F_M)))
- CFLAGS += -mavx512f
- endif
- AVX512BW_M := $(shell grep "avx512bw " /proc/cpuinfo)
- ifneq (,$(findstring avx512bw,$(AVX512BW_M)))
- CFLAGS += -mavx512bw
- endif
- AVX512DQ_M := $(shell grep "avx512dq " /proc/cpuinfo)
- ifneq (,$(findstring avx512dq,$(AVX512DQ_M)))
- CFLAGS += -mavx512dq
- endif
- AVX512VL_M := $(shell grep "avx512vl " /proc/cpuinfo)
- ifneq (,$(findstring avx512vl,$(AVX512VL_M)))
- CFLAGS += -mavx512vl
- endif
- AVX512CD_M := $(shell grep "avx512cd " /proc/cpuinfo)
- ifneq (,$(findstring avx512cd,$(AVX512CD_M)))
- CFLAGS += -mavx512cd
- endif
- AVX512ER_M := $(shell grep "avx512er " /proc/cpuinfo)
- ifneq (,$(findstring avx512er,$(AVX512ER_M)))
- CFLAGS += -mavx512er
- endif
- AVX512IFMA_M := $(shell grep "avx512ifma " /proc/cpuinfo)
- ifneq (,$(findstring avx512ifma,$(AVX512IFMA_M)))
- CFLAGS += -mavx512ifma
- endif
- AVX512PF_M := $(shell grep "avx512pf " /proc/cpuinfo)
- ifneq (,$(findstring avx512pf,$(AVX512PF_M)))
- CFLAGS += -mavx512pf
- endif
- else ifeq ($(UNAME_S),Haiku)
- AVX1_M := $(shell sysinfo -cpu | grep -w "AVX")
- ifneq (,$(findstring AVX,$(AVX1_M)))
- CFLAGS += -mavx
- endif
- AVX2_M := $(shell sysinfo -cpu | grep -w "AVX2")
- ifneq (,$(findstring AVX2,$(AVX2_M)))
- CFLAGS += -mavx2
- endif
- FMA_M := $(shell sysinfo -cpu | grep -w "FMA")
- ifneq (,$(findstring FMA,$(FMA_M)))
- CFLAGS += -mfma
- endif
- F16C_M := $(shell sysinfo -cpu | grep -w "F16C")
- ifneq (,$(findstring F16C,$(F16C_M)))
- CFLAGS += -mf16c
- endif
- else
- CFLAGS += -mfma -mf16c -mavx -mavx2
- endif
+ # Use all CPU extensions that are available:
+ CFLAGS += -march=native -mtune=native
endif
ifneq ($(filter ppc64%,$(UNAME_M)),)
POWER9_M := $(shell grep "POWER9" /proc/cpuinfo)