2 dnl # Checks if host toolchain supports SIMD instructions
4 AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_SIMD], [
7 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE
8 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE2
9 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE3
10 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSSE3
11 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_1
12 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_2
13 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX
14 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX2
15 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512F
16 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512CD
17 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512DQ
18 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512BW
19 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512IFMA
20 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VBMI
21 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512PF
22 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512ER
23 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VL
29 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE
31 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE], [
32 AC_MSG_CHECKING([whether host toolchain supports SSE])
34 AC_LINK_IFELSE([AC_LANG_SOURCE([[
37 __asm__ __volatile__("xorps %xmm0, %xmm1");
40 AC_DEFINE([HAVE_SSE], 1, [Define if host toolchain supports SSE])
48 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE2
50 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE2], [
51 AC_MSG_CHECKING([whether host toolchain supports SSE2])
53 AC_LINK_IFELSE([AC_LANG_SOURCE([[
56 __asm__ __volatile__("pxor %xmm0, %xmm1");
59 AC_DEFINE([HAVE_SSE2], 1, [Define if host toolchain supports SSE2])
67 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE3
69 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE3], [
70 AC_MSG_CHECKING([whether host toolchain supports SSE3])
72 AC_LINK_IFELSE([AC_LANG_SOURCE([[
76 __asm__ __volatile__("lddqu %0,%%xmm0" :: "m"(v[0]));
79 AC_DEFINE([HAVE_SSE3], 1, [Define if host toolchain supports SSE3])
87 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSSE3
89 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSSE3], [
90 AC_MSG_CHECKING([whether host toolchain supports SSSE3])
92 AC_LINK_IFELSE([AC_LANG_SOURCE([[
95 __asm__ __volatile__("pshufb %xmm0,%xmm1");
98 AC_DEFINE([HAVE_SSSE3], 1, [Define if host toolchain supports SSSE3])
106 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_1
108 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_1], [
109 AC_MSG_CHECKING([whether host toolchain supports SSE4.1])
111 AC_LINK_IFELSE([AC_LANG_SOURCE([[
114 __asm__ __volatile__("pmaxsb %xmm0,%xmm1");
117 AC_DEFINE([HAVE_SSE4_1], 1, [Define if host toolchain supports SSE4.1])
125 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_2
127 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_2], [
128 AC_MSG_CHECKING([whether host toolchain supports SSE4.2])
130 AC_LINK_IFELSE([AC_LANG_SOURCE([[
133 __asm__ __volatile__("pcmpgtq %xmm0, %xmm1");
136 AC_DEFINE([HAVE_SSE4_2], 1, [Define if host toolchain supports SSE4.2])
144 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX
146 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX], [
147 AC_MSG_CHECKING([whether host toolchain supports AVX])
149 AC_LINK_IFELSE([AC_LANG_SOURCE([[
153 __asm__ __volatile__("vmovdqa %0,%%ymm0" :: "m"(v[0]));
157 AC_DEFINE([HAVE_AVX], 1, [Define if host toolchain supports AVX])
164 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX2
166 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX2], [
167 AC_MSG_CHECKING([whether host toolchain supports AVX2])
169 AC_LINK_IFELSE([AC_LANG_SOURCE([
173 __asm__ __volatile__("vpshufb %ymm0,%ymm1,%ymm2");
177 AC_DEFINE([HAVE_AVX2], 1, [Define if host toolchain supports AVX2])
184 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512F
186 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512F], [
187 AC_MSG_CHECKING([whether host toolchain supports AVX512F])
189 AC_LINK_IFELSE([AC_LANG_SOURCE([
193 __asm__ __volatile__("vpandd %zmm0,%zmm1,%zmm2");
197 AC_DEFINE([HAVE_AVX512F], 1, [Define if host toolchain supports AVX512F])
204 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512CD
206 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512CD], [
207 AC_MSG_CHECKING([whether host toolchain supports AVX512CD])
209 AC_LINK_IFELSE([AC_LANG_SOURCE([
213 __asm__ __volatile__("vplzcntd %zmm0,%zmm1");
217 AC_DEFINE([HAVE_AVX512CD], 1, [Define if host toolchain supports AVX512CD])
224 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512DQ
226 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512DQ], [
227 AC_MSG_CHECKING([whether host toolchain supports AVX512DQ])
229 AC_LINK_IFELSE([AC_LANG_SOURCE([
233 __asm__ __volatile__("vandpd %zmm0,%zmm1,%zmm2");
237 AC_DEFINE([HAVE_AVX512DQ], 1, [Define if host toolchain supports AVX512DQ])
244 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512BW
246 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512BW], [
247 AC_MSG_CHECKING([whether host toolchain supports AVX512BW])
249 AC_LINK_IFELSE([AC_LANG_SOURCE([
253 __asm__ __volatile__("vpshufb %zmm0,%zmm1,%zmm2");
257 AC_DEFINE([HAVE_AVX512BW], 1, [Define if host toolchain supports AVX512BW])
264 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512IFMA
266 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512IFMA], [
267 AC_MSG_CHECKING([whether host toolchain supports AVX512IFMA])
269 AC_LINK_IFELSE([AC_LANG_SOURCE([
273 __asm__ __volatile__("vpmadd52luq %zmm0,%zmm1,%zmm2");
277 AC_DEFINE([HAVE_AVX512IFMA], 1, [Define if host toolchain supports AVX512IFMA])
284 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VBMI
286 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VBMI], [
287 AC_MSG_CHECKING([whether host toolchain supports AVX512VBMI])
289 AC_LINK_IFELSE([AC_LANG_SOURCE([
293 __asm__ __volatile__("vpermb %zmm0,%zmm1,%zmm2");
297 AC_DEFINE([HAVE_AVX512VBMI], 1, [Define if host toolchain supports AVX512VBMI])
304 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512PF
306 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512PF], [
307 AC_MSG_CHECKING([whether host toolchain supports AVX512PF])
309 AC_LINK_IFELSE([AC_LANG_SOURCE([
313 __asm__ __volatile__("vgatherpf0dps (%rsi,%zmm0,4){%k1}");
317 AC_DEFINE([HAVE_AVX512PF], 1, [Define if host toolchain supports AVX512PF])
324 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512ER
326 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512ER], [
327 AC_MSG_CHECKING([whether host toolchain supports AVX512ER])
329 AC_LINK_IFELSE([AC_LANG_SOURCE([
333 __asm__ __volatile__("vexp2pd %zmm0,%zmm1");
337 AC_DEFINE([HAVE_AVX512ER], 1, [Define if host toolchain supports AVX512ER])
344 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VL
346 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VL], [
347 AC_MSG_CHECKING([whether host toolchain supports AVX512VL])
349 AC_LINK_IFELSE([AC_LANG_SOURCE([
353 __asm__ __volatile__("vpabsq %zmm0,%zmm1");
357 AC_DEFINE([HAVE_AVX512VL], 1, [Define if host toolchain supports AVX512VL])