BRT: Clear bv_entcount_dirty on destroy
[zfs.git] / config / toolchain-simd.m4
blob061576fd94e3967dc409030512b3d0f8fc99de61
1 dnl #
2 dnl # Checks if host toolchain supports SIMD instructions
3 dnl #
4 AC_DEFUN([ZFS_AC_CONFIG_ALWAYS_TOOLCHAIN_SIMD], [
5         case "$host_cpu" in
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
30                         ;;
31         esac
34 dnl #
35 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE
36 dnl #
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([[
41                 void main()
42                 {
43                         __asm__ __volatile__("xorps %xmm0, %xmm1");
44                 }
45         ]])], [
46                 AC_DEFINE([HAVE_SSE], 1, [Define if host toolchain supports SSE])
47                 AC_MSG_RESULT([yes])
48         ], [
49                 AC_MSG_RESULT([no])
50         ])
53 dnl #
54 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE2
55 dnl #
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([[
60                 void main()
61                 {
62                         __asm__ __volatile__("pxor %xmm0, %xmm1");
63                 }
64         ]])], [
65                 AC_DEFINE([HAVE_SSE2], 1, [Define if host toolchain supports SSE2])
66                 AC_MSG_RESULT([yes])
67         ], [
68                 AC_MSG_RESULT([no])
69         ])
72 dnl #
73 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE3
74 dnl #
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([[
79                 void main()
80                 {
81                         char v[16];
82                         __asm__ __volatile__("lddqu %0,%%xmm0" :: "m"(v[0]));
83                 }
84         ]])], [
85                 AC_DEFINE([HAVE_SSE3], 1, [Define if host toolchain supports SSE3])
86                 AC_MSG_RESULT([yes])
87         ], [
88                 AC_MSG_RESULT([no])
89         ])
92 dnl #
93 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSSE3
94 dnl #
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([[
99                 void main()
100                 {
101                         __asm__ __volatile__("pshufb %xmm0,%xmm1");
102                 }
103         ]])], [
104                 AC_DEFINE([HAVE_SSSE3], 1, [Define if host toolchain supports SSSE3])
105                 AC_MSG_RESULT([yes])
106         ], [
107                 AC_MSG_RESULT([no])
108         ])
111 dnl #
112 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_1
113 dnl #
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([[
118                 void main()
119                 {
120                         __asm__ __volatile__("pmaxsb %xmm0,%xmm1");
121                 }
122         ]])], [
123                 AC_DEFINE([HAVE_SSE4_1], 1, [Define if host toolchain supports SSE4.1])
124                 AC_MSG_RESULT([yes])
125         ], [
126                 AC_MSG_RESULT([no])
127         ])
130 dnl #
131 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_SSE4_2
132 dnl #
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([[
137                 void main()
138                 {
139                         __asm__ __volatile__("pcmpgtq %xmm0, %xmm1");
140                 }
141         ]])], [
142                 AC_DEFINE([HAVE_SSE4_2], 1, [Define if host toolchain supports SSE4.2])
143                 AC_MSG_RESULT([yes])
144         ], [
145                 AC_MSG_RESULT([no])
146         ])
149 dnl #
150 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX
151 dnl #
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([[
156                 void main()
157                 {
158                         char v[32];
159                         __asm__ __volatile__("vmovdqa %0,%%ymm0" :: "m"(v[0]));
160                 }
161         ]])], [
162                 AC_MSG_RESULT([yes])
163                 AC_DEFINE([HAVE_AVX], 1, [Define if host toolchain supports AVX])
164         ], [
165                 AC_MSG_RESULT([no])
166         ])
169 dnl #
170 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX2
171 dnl #
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([
176         [
177                 void main()
178                 {
179                         __asm__ __volatile__("vpshufb %ymm0,%ymm1,%ymm2");
180                 }
181         ]])], [
182                 AC_MSG_RESULT([yes])
183                 AC_DEFINE([HAVE_AVX2], 1, [Define if host toolchain supports AVX2])
184         ], [
185                 AC_MSG_RESULT([no])
186         ])
189 dnl #
190 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512F
191 dnl #
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([
196         [
197                 void main()
198                 {
199                         __asm__ __volatile__("vpandd %zmm0,%zmm1,%zmm2");
200                 }
201         ]])], [
202                 AC_MSG_RESULT([yes])
203                 AC_DEFINE([HAVE_AVX512F], 1, [Define if host toolchain supports AVX512F])
204         ], [
205                 AC_MSG_RESULT([no])
206         ])
209 dnl #
210 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512CD
211 dnl #
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([
216         [
217                 void main()
218                 {
219                         __asm__ __volatile__("vplzcntd %zmm0,%zmm1");
220                 }
221         ]])], [
222                 AC_MSG_RESULT([yes])
223                 AC_DEFINE([HAVE_AVX512CD], 1, [Define if host toolchain supports AVX512CD])
224         ], [
225                 AC_MSG_RESULT([no])
226         ])
229 dnl #
230 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512DQ
231 dnl #
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([
236         [
237                 void main()
238                 {
239                         __asm__ __volatile__("vandpd %zmm0,%zmm1,%zmm2");
240                 }
241         ]])], [
242                 AC_MSG_RESULT([yes])
243                 AC_DEFINE([HAVE_AVX512DQ], 1, [Define if host toolchain supports AVX512DQ])
244         ], [
245                 AC_MSG_RESULT([no])
246         ])
249 dnl #
250 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512BW
251 dnl #
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([
256         [
257                 void main()
258                 {
259                         __asm__ __volatile__("vpshufb %zmm0,%zmm1,%zmm2");
260                 }
261         ]])], [
262                 AC_MSG_RESULT([yes])
263                 AC_DEFINE([HAVE_AVX512BW], 1, [Define if host toolchain supports AVX512BW])
264         ], [
265                 AC_MSG_RESULT([no])
266         ])
269 dnl #
270 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512IFMA
271 dnl #
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([
276         [
277                 void main()
278                 {
279                         __asm__ __volatile__("vpmadd52luq %zmm0,%zmm1,%zmm2");
280                 }
281         ]])], [
282                 AC_MSG_RESULT([yes])
283                 AC_DEFINE([HAVE_AVX512IFMA], 1, [Define if host toolchain supports AVX512IFMA])
284         ], [
285                 AC_MSG_RESULT([no])
286         ])
289 dnl #
290 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VBMI
291 dnl #
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([
296         [
297                 void main()
298                 {
299                         __asm__ __volatile__("vpermb %zmm0,%zmm1,%zmm2");
300                 }
301         ]])], [
302                 AC_MSG_RESULT([yes])
303                 AC_DEFINE([HAVE_AVX512VBMI], 1, [Define if host toolchain supports AVX512VBMI])
304         ], [
305                 AC_MSG_RESULT([no])
306         ])
309 dnl #
310 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512PF
311 dnl #
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([
316         [
317                 void main()
318                 {
319                         __asm__ __volatile__("vgatherpf0dps (%rsi,%zmm0,4){%k1}");
320                 }
321         ]])], [
322                 AC_MSG_RESULT([yes])
323                 AC_DEFINE([HAVE_AVX512PF], 1, [Define if host toolchain supports AVX512PF])
324         ], [
325                 AC_MSG_RESULT([no])
326         ])
329 dnl #
330 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512ER
331 dnl #
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([
336         [
337                 void main()
338                 {
339                         __asm__ __volatile__("vexp2pd %zmm0,%zmm1");
340                 }
341         ]])], [
342                 AC_MSG_RESULT([yes])
343                 AC_DEFINE([HAVE_AVX512ER], 1, [Define if host toolchain supports AVX512ER])
344         ], [
345                 AC_MSG_RESULT([no])
346         ])
349 dnl #
350 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AVX512VL
351 dnl #
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([
356         [
357                 void main()
358                 {
359                         __asm__ __volatile__("vpabsq %zmm0,%zmm1");
360                 }
361         ]])], [
362                 AC_MSG_RESULT([yes])
363                 AC_DEFINE([HAVE_AVX512VL], 1, [Define if host toolchain supports AVX512VL])
364         ], [
365                 AC_MSG_RESULT([no])
366         ])
369 dnl #
370 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_AES
371 dnl #
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([
376         [
377                 void main()
378                 {
379                         __asm__ __volatile__("aesenc %xmm0, %xmm1");
380                 }
381         ]])], [
382                 AC_MSG_RESULT([yes])
383                 AC_DEFINE([HAVE_AES], 1, [Define if host toolchain supports AES])
384         ], [
385                 AC_MSG_RESULT([no])
386         ])
389 dnl #
390 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_PCLMULQDQ
391 dnl #
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([
396         [
397                 void main()
398                 {
399                         __asm__ __volatile__("pclmulqdq %0, %%xmm0, %%xmm1" :: "i"(0));
400                 }
401         ]])], [
402                 AC_MSG_RESULT([yes])
403                 AC_DEFINE([HAVE_PCLMULQDQ], 1, [Define if host toolchain supports PCLMULQDQ])
404         ], [
405                 AC_MSG_RESULT([no])
406         ])
409 dnl #
410 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_MOVBE
411 dnl #
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([
416         [
417                 void main()
418                 {
419                         __asm__ __volatile__("movbe 0(%eax), %eax");
420                 }
421         ]])], [
422                 AC_MSG_RESULT([yes])
423                 AC_DEFINE([HAVE_MOVBE], 1, [Define if host toolchain supports MOVBE])
424         ], [
425                 AC_MSG_RESULT([no])
426         ])
429 dnl #
430 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_XSAVE
431 dnl #
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([
436         [
437                 void main()
438                 {
439                   char b[4096] __attribute__ ((aligned (64)));
440                   __asm__ __volatile__("xsave %[b]\n" : : [b] "m" (*b) : "memory");
441                 }
442         ]])], [
443                 AC_MSG_RESULT([yes])
444                 AC_DEFINE([HAVE_XSAVE], 1, [Define if host toolchain supports XSAVE])
445         ], [
446                 AC_MSG_RESULT([no])
447         ])
450 dnl #
451 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_XSAVEOPT
452 dnl #
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([
457         [
458                 void main()
459                 {
460                   char b[4096] __attribute__ ((aligned (64)));
461                   __asm__ __volatile__("xsaveopt %[b]\n" : : [b] "m" (*b) : "memory");
462                 }
463         ]])], [
464                 AC_MSG_RESULT([yes])
465                 AC_DEFINE([HAVE_XSAVEOPT], 1, [Define if host toolchain supports XSAVEOPT])
466         ], [
467                 AC_MSG_RESULT([no])
468         ])
471 dnl #
472 dnl # ZFS_AC_CONFIG_TOOLCHAIN_CAN_BUILD_XSAVES
473 dnl #
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([
478         [
479                 void main()
480                 {
481                   char b[4096] __attribute__ ((aligned (64)));
482                   __asm__ __volatile__("xsaves %[b]\n" : : [b] "m" (*b) : "memory");
483                 }
484         ]])], [
485                 AC_MSG_RESULT([yes])
486                 AC_DEFINE([HAVE_XSAVES], 1, [Define if host toolchain supports XSAVES])
487         ], [
488                 AC_MSG_RESULT([no])
489         ])