diff --git a/Makefile b/Makefile index 94acefdde..0cfc11d78 100644 --- a/Makefile +++ b/Makefile @@ -78,13 +78,14 @@ 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)) - # Use all CPU extensions that are available: - CFLAGS += -march=native -mtune=native - CXXFLAGS += -march=native -mtune=native - - # Usage AVX-only - #CFLAGS += -mfma -mf16c -mavx - #CXXFLAGS += -mfma -mf16c -mavx + ifdef LLAMA_AVX2_ONLY + CFLAGS += -mfma -mf16c -mavx2 + CXXFLAGS += -mfma -mf16c -mavx2 + else + # Use all CPU extensions that are available: + CFLAGS += -march=native -mtune=native + CXXFLAGS += -march=native -mtune=native + endif endif ifneq ($(filter ppc64%,$(UNAME_M)),) POWER9_M := $(shell grep "POWER9" /proc/cpuinfo)