2 dnl # Checks if host toolchain supports SIMD instructions
4 AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_SIMD], [
6 amd64 | x86_64 | x86 | i686)
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
24 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AES
25 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_PCLMULQDQ
26 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_MOVBE
27 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_XSAVE
28 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_XSAVEOPT
29 ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_XSAVES
35 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE
37 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE], [
38 AC_MSG_CHECKING([whether host toolchain supports SSE])
40 AC_LINK_IFELSE([AC_LANG_SOURCE([[
43 __asm__ __volatile__("xorps %xmm0, %xmm1");
46 AC_DEFINE([HAVE_SSE], 1, [Define if host toolchain supports SSE])
54 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE2
56 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE2], [
57 AC_MSG_CHECKING([whether host toolchain supports SSE2])
59 AC_LINK_IFELSE([AC_LANG_SOURCE([[
62 __asm__ __volatile__("pxor %xmm0, %xmm1");
65 AC_DEFINE([HAVE_SSE2], 1, [Define if host toolchain supports SSE2])
73 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE3
75 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE3], [
76 AC_MSG_CHECKING([whether host toolchain supports SSE3])
78 AC_LINK_IFELSE([AC_LANG_SOURCE([[
82 __asm__ __volatile__("lddqu %0,%%xmm0" :: "m"(v[0]));
85 AC_DEFINE([HAVE_SSE3], 1, [Define if host toolchain supports SSE3])
93 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSSE3
95 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSSE3], [
96 AC_MSG_CHECKING([whether host toolchain supports SSSE3])
98 AC_LINK_IFELSE([AC_LANG_SOURCE([[
101 __asm__ __volatile__("pshufb %xmm0,%xmm1");
104 AC_DEFINE([HAVE_SSSE3], 1, [Define if host toolchain supports SSSE3])
112 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_1
114 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_1], [
115 AC_MSG_CHECKING([whether host toolchain supports SSE4.1])
117 AC_LINK_IFELSE([AC_LANG_SOURCE([[
120 __asm__ __volatile__("pmaxsb %xmm0,%xmm1");
123 AC_DEFINE([HAVE_SSE4_1], 1, [Define if host toolchain supports SSE4.1])
131 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_2
133 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_2], [
134 AC_MSG_CHECKING([whether host toolchain supports SSE4.2])
136 AC_LINK_IFELSE([AC_LANG_SOURCE([[
139 __asm__ __volatile__("pcmpgtq %xmm0, %xmm1");
142 AC_DEFINE([HAVE_SSE4_2], 1, [Define if host toolchain supports SSE4.2])
150 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX
152 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX], [
153 AC_MSG_CHECKING([whether host toolchain supports AVX])
155 AC_LINK_IFELSE([AC_LANG_SOURCE([[
159 __asm__ __volatile__("vmovdqa %0,%%ymm0" :: "m"(v[0]));
163 AC_DEFINE([HAVE_AVX], 1, [Define if host toolchain supports AVX])
170 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX2
172 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX2], [
173 AC_MSG_CHECKING([whether host toolchain supports AVX2])
175 AC_LINK_IFELSE([AC_LANG_SOURCE([
179 __asm__ __volatile__("vpshufb %ymm0,%ymm1,%ymm2");
183 AC_DEFINE([HAVE_AVX2], 1, [Define if host toolchain supports AVX2])
190 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512F
192 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512F], [
193 AC_MSG_CHECKING([whether host toolchain supports AVX512F])
195 AC_LINK_IFELSE([AC_LANG_SOURCE([
199 __asm__ __volatile__("vpandd %zmm0,%zmm1,%zmm2");
203 AC_DEFINE([HAVE_AVX512F], 1, [Define if host toolchain supports AVX512F])
210 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512CD
212 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512CD], [
213 AC_MSG_CHECKING([whether host toolchain supports AVX512CD])
215 AC_LINK_IFELSE([AC_LANG_SOURCE([
219 __asm__ __volatile__("vplzcntd %zmm0,%zmm1");
223 AC_DEFINE([HAVE_AVX512CD], 1, [Define if host toolchain supports AVX512CD])
230 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512DQ
232 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512DQ], [
233 AC_MSG_CHECKING([whether host toolchain supports AVX512DQ])
235 AC_LINK_IFELSE([AC_LANG_SOURCE([
239 __asm__ __volatile__("vandpd %zmm0,%zmm1,%zmm2");
243 AC_DEFINE([HAVE_AVX512DQ], 1, [Define if host toolchain supports AVX512DQ])
250 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512BW
252 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512BW], [
253 AC_MSG_CHECKING([whether host toolchain supports AVX512BW])
255 AC_LINK_IFELSE([AC_LANG_SOURCE([
259 __asm__ __volatile__("vpshufb %zmm0,%zmm1,%zmm2");
263 AC_DEFINE([HAVE_AVX512BW], 1, [Define if host toolchain supports AVX512BW])
270 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512IFMA
272 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512IFMA], [
273 AC_MSG_CHECKING([whether host toolchain supports AVX512IFMA])
275 AC_LINK_IFELSE([AC_LANG_SOURCE([
279 __asm__ __volatile__("vpmadd52luq %zmm0,%zmm1,%zmm2");
283 AC_DEFINE([HAVE_AVX512IFMA], 1, [Define if host toolchain supports AVX512IFMA])
290 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VBMI
292 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VBMI], [
293 AC_MSG_CHECKING([whether host toolchain supports AVX512VBMI])
295 AC_LINK_IFELSE([AC_LANG_SOURCE([
299 __asm__ __volatile__("vpermb %zmm0,%zmm1,%zmm2");
303 AC_DEFINE([HAVE_AVX512VBMI], 1, [Define if host toolchain supports AVX512VBMI])
310 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512PF
312 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512PF], [
313 AC_MSG_CHECKING([whether host toolchain supports AVX512PF])
315 AC_LINK_IFELSE([AC_LANG_SOURCE([
319 __asm__ __volatile__("vgatherpf0dps (%rsi,%zmm0,4){%k1}");
323 AC_DEFINE([HAVE_AVX512PF], 1, [Define if host toolchain supports AVX512PF])
330 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512ER
332 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512ER], [
333 AC_MSG_CHECKING([whether host toolchain supports AVX512ER])
335 AC_LINK_IFELSE([AC_LANG_SOURCE([
339 __asm__ __volatile__("vexp2pd %zmm0,%zmm1");
343 AC_DEFINE([HAVE_AVX512ER], 1, [Define if host toolchain supports AVX512ER])
350 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VL
352 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VL], [
353 AC_MSG_CHECKING([whether host toolchain supports AVX512VL])
355 AC_LINK_IFELSE([AC_LANG_SOURCE([
359 __asm__ __volatile__("vpabsq %zmm0,%zmm1");
363 AC_DEFINE([HAVE_AVX512VL], 1, [Define if host toolchain supports AVX512VL])
370 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AES
372 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AES], [
373 AC_MSG_CHECKING([whether host toolchain supports AES])
375 AC_LINK_IFELSE([AC_LANG_SOURCE([
379 __asm__ __volatile__("aesenc %xmm0, %xmm1");
383 AC_DEFINE([HAVE_AES], 1, [Define if host toolchain supports AES])
390 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_PCLMULQDQ
392 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_PCLMULQDQ], [
393 AC_MSG_CHECKING([whether host toolchain supports PCLMULQDQ])
395 AC_LINK_IFELSE([AC_LANG_SOURCE([
399 __asm__ __volatile__("pclmulqdq %0, %%xmm0, %%xmm1" :: "i"(0));
403 AC_DEFINE([HAVE_PCLMULQDQ], 1, [Define if host toolchain supports PCLMULQDQ])
410 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_MOVBE
412 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_MOVBE], [
413 AC_MSG_CHECKING([whether host toolchain supports MOVBE])
415 AC_LINK_IFELSE([AC_LANG_SOURCE([
419 __asm__ __volatile__("movbe 0(%eax), %eax");
423 AC_DEFINE([HAVE_MOVBE], 1, [Define if host toolchain supports MOVBE])
430 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_XSAVE
432 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_XSAVE], [
433 AC_MSG_CHECKING([whether host toolchain supports XSAVE])
435 AC_LINK_IFELSE([AC_LANG_SOURCE([
439 char b[4096] __attribute__ ((aligned (64)));
440 __asm__ __volatile__("xsave %[b]\n" : : [b] "m" (*b) : "memory");
444 AC_DEFINE([HAVE_XSAVE], 1, [Define if host toolchain supports XSAVE])
451 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_XSAVEOPT
453 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_XSAVEOPT], [
454 AC_MSG_CHECKING([whether host toolchain supports XSAVEOPT])
456 AC_LINK_IFELSE([AC_LANG_SOURCE([
460 char b[4096] __attribute__ ((aligned (64)));
461 __asm__ __volatile__("xsaveopt %[b]\n" : : [b] "m" (*b) : "memory");
465 AC_DEFINE([HAVE_XSAVEOPT], 1, [Define if host toolchain supports XSAVEOPT])
472 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_XSAVES
474 AC_DEFUN([ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_XSAVES], [
475 AC_MSG_CHECKING([whether host toolchain supports XSAVES])
477 AC_LINK_IFELSE([AC_LANG_SOURCE([
481 char b[4096] __attribute__ ((aligned (64)));
482 __asm__ __volatile__("xsaves %[b]\n" : : [b] "m" (*b) : "memory");
486 AC_DEFINE([HAVE_XSAVES], 1, [Define if host toolchain supports XSAVES])