BLAKE2 / libb2

C library providing BLAKE2b, BLAKE2s, BLAKE2bp, BLAKE2sp
Creative Commons Zero v1.0 Universal
132 stars 47 forks source link

SSE detection is broken on arm64 macos #36

Open gjasny opened 3 years ago

gjasny commented 3 years ago

Hello,

on arm64 macOS configure detects the following:

checking whether C compiler accepts -msse2... yes
checking whether C compiler accepts -mssse3... yes
checking whether C compiler accepts -msse4.1... yes
checking whether C compiler accepts -mavx... yes
checking whether C compiler accepts -mxop... yes

Looking into config.log shows the following:

configure:12899: checking whether C compiler accepts -mavx
configure:12918: gcc -c -g -O2 -O3  -mavx  conftest.c >&5
clang: warning: argument unused during compilation: '-mavx' [-Wunused-command-line-argument]
configure:12918: $? = 0
configure:12926: result: yes

The right fix would be to check the target cpu family and restrict the SSE/AVX checks to the Intel family.

A more hacky way would be to check for a working -Werror=unused-command-line-argument flag and pass it to the AX_CHECK_COMPILE_FLAG macro as extra parameter.

Thanks, Gregor