chidiwilliams commited on
Commit
41956c6
·
1 Parent(s): 0c17e51

Check for AVX and AVX2 on Darwin

Browse files
Files changed (1) hide show
  1. Makefile +13 -1
Makefile CHANGED
@@ -50,7 +50,19 @@ endif
50
  # TODO: probably these flags need to be tweaked on some architectures
51
  # feel free to update the Makefile for your architecture and send a pull request or issue
52
  ifeq ($(UNAME_M),x86_64)
53
- CFLAGS += -mavx -mavx2 -mfma -mf16c
 
 
 
 
 
 
 
 
 
 
 
 
54
  endif
55
  ifeq ($(UNAME_M),amd64)
56
  CFLAGS += -mavx -mavx2 -mfma -mf16c
 
50
  # TODO: probably these flags need to be tweaked on some architectures
51
  # feel free to update the Makefile for your architecture and send a pull request or issue
52
  ifeq ($(UNAME_M),x86_64)
53
+ CFLAGS += -mfma -mf16c
54
+ ifeq ($(UNAME_S),Darwin)
55
+ AVX1_M := $(shell sysctl machdep.cpu.features)
56
+ ifneq (,$(findstring AVX1.0,$(AVX1_M)))
57
+ CFLAGS += -mavx
58
+ endif
59
+ AVX2_M := $(shell sysctl machdep.cpu.leaf7_features)
60
+ ifneq (,$(findstring AVX2,$(AVX2_M)))
61
+ CFLAGS += -mavx2
62
+ endif
63
+ else
64
+ CFLAGS += -mavx -mavx2
65
+ endif
66
  endif
67
  ifeq ($(UNAME_M),amd64)
68
  CFLAGS += -mavx -mavx2 -mfma -mf16c