Skip to content

Commit 44eac87

Browse files
committed
Separate Autoconf and CMake compiler tests
1 parent 09901c7 commit 44eac87

File tree

1 file changed

+27
-2
lines changed

1 file changed

+27
-2
lines changed

configure.ac

+27-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,19 @@ if test $x86_64 = "yes"; then
6767
AC_MSG_CHECKING(whether -march=westmere works)
6868
BAKCFLAGS="$CFLAGS"
6969
CFLAGS="$CFLAGS -march=westmere"
70-
AC_COMPILE_IFELSE([AC_LANG_SOURCE(`cat cmake/westmere.test.c`)
70+
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
71+
AC_INCLUDES_DEFAULT
72+
[
73+
#include <stdint.h>
74+
#include <immintrin.h>
75+
76+
int main(int argc, char *argv[])
77+
{
78+
(void)argv;
79+
uint64_t popcnt = _mm_popcnt_64((uint64_t)argc);
80+
return popcnt == 11;
81+
}
82+
]])
7183
],[
7284
AC_DEFINE(HAVE_WESTMERE, 1, [Wether or not to compile support for SSE4.2])
7385
HAVE_WESTMERE=WESTMERE
@@ -84,7 +96,20 @@ if test $x86_64 = "yes"; then
8496
AC_MSG_CHECKING(whether -march=haswell works)
8597
BAKCFLAGS="$CFLAGS"
8698
CFLAGS="$CFLAGS -march=haswell"
87-
AC_COMPILE_IFELSE([AC_LANG_SOURCE(`cat cmake/haswell.test.c`)
99+
AC_COMPILE_IFELSE([AC_LANG_SOURCE([
100+
AC_INCLUDES_DEFAULT
101+
[
102+
#include <stdint.h>
103+
#include <immintrin.h>
104+
105+
int main(int argc, char *argv[])
106+
{
107+
(void)argv;
108+
int argc32x8[8] = { argc, 0, 0, 0, 0, 0, 0, 0 };
109+
__m256i argc256 = _mm256_loadu_si256((__m256i *)argc32x8);
110+
return _mm256_testz_si256(argc256, _mm256_set1_epi8(11));
111+
}
112+
]])
88113
],[
89114
AC_DEFINE(HAVE_HASWELL, 1, [Wether or not to compile support for AVX2])
90115
HAVE_HASWELL=HASWELL

0 commit comments

Comments
 (0)