]> AND Private Git Repository - Cipher_code.git/blob - IDA_new/gf-complete/m4/ax_ext.m4
Logo AND Algorithmique Numérique Distribuée

Private GIT Repository
rc4_hash2
[Cipher_code.git] / IDA_new / gf-complete / m4 / ax_ext.m4
1 #
2 # This macro is based on http://www.gnu.org/software/autoconf-archive/ax_ext.html
3 # but simplified to do compile time SIMD checks only
4 #
5
6 AC_DEFUN([AX_EXT],
7 [
8   AC_REQUIRE([AC_CANONICAL_HOST])
9
10   case $host_cpu in
11     aarch64*)
12       AC_DEFINE(HAVE_ARCH_AARCH64,,[targeting AArch64])
13       SIMD_FLAGS="$SIMD_FLAGS -DARCH_AARCH64"
14
15       AC_CACHE_CHECK([whether NEON is enabled], [ax_cv_have_neon_ext], [ax_cv_have_neon_ext=yes])
16       if test "$ax_cv_have_neon_ext" = yes; then
17         AX_CHECK_COMPILE_FLAG(-march=armv8-a+simd, [SIMD_FLAGS="$SIMD_FLAGS -march=armv8-a+simd -DARM_NEON"], [ax_cv_have_neon_ext=no])
18       fi
19       ;;
20
21     arm*)
22       AC_CACHE_CHECK([whether NEON is enabled], [ax_cv_have_neon_ext], [ax_cv_have_neon_ext=yes])
23       if test "$ax_cv_have_neon_ext" = yes; then
24         AX_CHECK_COMPILE_FLAG(-mfpu=neon, [SIMD_FLAGS="$SIMD_FLAGS -mfpu=neon -DARM_NEON"], [ax_cv_have_neon_ext=no])
25       fi
26       ;;
27
28     powerpc*)
29       AC_CACHE_CHECK([whether altivec is enabled], [ax_cv_have_altivec_ext], [ax_cv_have_altivec_ext=yes])
30       if test "$ax_cv_have_altivec_ext" = yes; then
31         AX_CHECK_COMPILE_FLAG(-faltivec, [SIMD_FLAGS="$SIMD_FLAGS -faltivec"], [ax_cv_have_altivec_ext=no])
32       fi
33       ;;
34
35     i[[3456]]86*|x86_64*|amd64*)
36
37       AC_CACHE_CHECK([whether sse is enabled], [ax_cv_have_sse_ext], [ax_cv_have_sse_ext=yes])
38       if test "$ax_cv_have_sse_ext" = yes; then
39         AX_CHECK_COMPILE_FLAG(-msse, [SIMD_FLAGS="$SIMD_FLAGS -msse -DINTEL_SSE"], [ax_cv_have_sse_ext=no])
40       fi
41
42       AC_CACHE_CHECK([whether sse2 is enabled], [ax_cv_have_sse2_ext], [ax_cv_have_sse2_ext=yes])
43       if test "$ax_cv_have_sse2_ext" = yes; then
44         AX_CHECK_COMPILE_FLAG(-msse2, [SIMD_FLAGS="$SIMD_FLAGS -msse2 -DINTEL_SSE2"], [ax_cv_have_sse2_ext=no])
45       fi
46
47       AC_CACHE_CHECK([whether sse3 is enabled], [ax_cv_have_sse3_ext], [ax_cv_have_sse3_ext=yes])
48       if test "$ax_cv_have_sse3_ext" = yes; then
49         AX_CHECK_COMPILE_FLAG(-msse3, [SIMD_FLAGS="$SIMD_FLAGS -msse3 -DINTEL_SSE3"], [ax_cv_have_sse3_ext=no])
50       fi
51
52       AC_CACHE_CHECK([whether ssse3 is enabled], [ax_cv_have_ssse3_ext], [ax_cv_have_ssse3_ext=yes])
53       if test "$ax_cv_have_ssse3_ext" = yes; then
54         AX_CHECK_COMPILE_FLAG(-mssse3, [SIMD_FLAGS="$SIMD_FLAGS -mssse3 -DINTEL_SSSE3"], [ax_cv_have_ssse3_ext=no])
55       fi
56
57       AC_CACHE_CHECK([whether pclmuldq is enabled], [ax_cv_have_pclmuldq_ext], [ax_cv_have_pclmuldq_ext=yes])
58       if test "$ax_cv_have_pclmuldq_ext" = yes; then
59         AX_CHECK_COMPILE_FLAG(-mpclmul, [SIMD_FLAGS="$SIMD_FLAGS -mpclmul -DINTEL_SSE4_PCLMUL"], [ax_cv_have_pclmuldq_ext=no])
60       fi
61
62       AC_CACHE_CHECK([whether sse4.1 is enabled], [ax_cv_have_sse41_ext], [ax_cv_have_sse41_ext=yes])
63       if test "$ax_cv_have_sse41_ext" = yes; then
64         AX_CHECK_COMPILE_FLAG(-msse4.1, [SIMD_FLAGS="$SIMD_FLAGS -msse4.1 -DINTEL_SSE4"], [ax_cv_have_sse41_ext=no])
65       fi
66
67       AC_CACHE_CHECK([whether sse4.2 is enabled], [ax_cv_have_sse42_ext], [ax_cv_have_sse42_ext=yes])
68       if test "$ax_cv_have_sse42_ext" = yes; then
69         AX_CHECK_COMPILE_FLAG(-msse4.2, [SIMD_FLAGS="$SIMD_FLAGS -msse4.2 -DINTEL_SSE4"], [ax_cv_have_sse42_ext=no])
70       fi
71       ;;
72   esac
73
74   AC_SUBST(SIMD_FLAGS)
75 ])