2323 optimization : " debug"
2424 assert : " debug"
2525 coverage : " nocov"
26+ detectcpuflags : " ignore"
2627 boost : " --build-boost"
2728 icu : " "
2829 secp256k1 : " --build-secp256k1"
3940 optimization : " size"
4041 assert : " ndebug"
4142 coverage : " nocov"
43+ detectcpuflags : " ignore"
4244 boost : " --build-boost"
4345 icu : " --build-icu --with-icu"
4446 secp256k1 : " --build-secp256k1"
5557 optimization : " size"
5658 assert : " ndebug"
5759 coverage : " nocov"
60+ detectcpuflags : " ignore"
5861 boost : " --build-boost"
5962 icu : " "
6063 secp256k1 : " --build-secp256k1"
7174 optimization : " size"
7275 assert : " ndebug"
7376 coverage : " nocov"
77+ detectcpuflags : " detect"
7478 boost : " --build-boost"
7579 icu : " --build-icu --with-icu"
7680 secp256k1 : " --build-secp256k1"
8791 optimization : " size"
8892 assert : " ndebug"
8993 coverage : " nocov"
94+ detectcpuflags : " ignore"
9095 boost : " --build-boost"
9196 icu : " "
9297 secp256k1 : " --build-secp256k1"
@@ -103,6 +108,7 @@ jobs:
103108 optimization : " size"
104109 assert : " ndebug"
105110 coverage : " nocov"
111+ detectcpuflags : " ignore"
106112 boost : " --build-boost"
107113 icu : " "
108114 secp256k1 : " --build-secp256k1"
@@ -142,6 +148,29 @@ jobs:
142148 run : |
143149 brew install autoconf automake libtool ${{ matrix.packages }}
144150
151+ - name : Determine CPU flags
152+ shell : bash
153+ run : |
154+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " sse4_1 ") ]]; then
155+ echo "CPU_SUPPORT_SSE41=--enable-sse41" >> $GITHUB_ENV
156+ fi
157+
158+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " avx " | grep " avx2 ") ]]; then
159+ echo "CPU_SUPPORT_AVX2=--enable-avx2" >> $GITHUB_ENV
160+ fi
161+
162+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " avx512bw ") ]]; then
163+ echo "CPU_SUPPORT_AVX512=--enable-avx512" >> $GITHUB_ENV
164+ fi
165+
166+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " sha_ni ") ]]; then
167+ echo "CPU_SUPPORT_SHANI=--enable-shani" >> $GITHUB_ENV
168+ fi
169+
170+ if [[ ${{ matrix.detectcpuflags }} == 'detect' ]]; then
171+ echo "CPU_SUPPORTED_FLAGS='$CPU_SUPPORT_SSE41 $CPU_SUPPORT_AVX2 $CPU_SUPPORT_AVX512 $CPU_SUPPORT_SHANI'" >> $GITHUB_ENV
172+ fi
173+
145174 - name : Denormalize parameterization
146175 shell : bash
147176 run : |
@@ -180,6 +209,7 @@ jobs:
180209 --prefix=${{ env.LIBBITCOIN_SRC_PATH }}prefix
181210 ${{ env.LINKAGE }}
182211 ${{ env.ASSERT_NDEBUG }}
212+ ${{ env.CPU_SUPPORTED_FLAGS }}
183213 ${{ matrix.boost }}
184214 ${{ matrix.icu }}
185215 ${{ matrix.secp256k1 }}
@@ -262,6 +292,7 @@ jobs:
262292 optimization : " debug"
263293 assert : " debug"
264294 coverage : " nocov"
295+ detectcpuflags : " ignore"
265296 boost : " --build-boost"
266297 icu : " "
267298 secp256k1 : " --build-secp256k1"
@@ -278,6 +309,7 @@ jobs:
278309 optimization : " size"
279310 assert : " ndebug"
280311 coverage : " nocov"
312+ detectcpuflags : " ignore"
281313 boost : " --build-boost"
282314 icu : " --build-icu --with-icu"
283315 secp256k1 : " --build-secp256k1"
@@ -294,6 +326,7 @@ jobs:
294326 optimization : " size"
295327 assert : " ndebug"
296328 coverage : " nocov"
329+ detectcpuflags : " ignore"
297330 boost : " --build-boost"
298331 icu : " "
299332 secp256k1 : " --build-secp256k1"
@@ -310,6 +343,7 @@ jobs:
310343 optimization : " size"
311344 assert : " ndebug"
312345 coverage : " nocov"
346+ detectcpuflags : " ignore"
313347 boost : " --build-boost"
314348 icu : " --build-icu --with-icu"
315349 secp256k1 : " --build-secp256k1"
@@ -326,6 +360,7 @@ jobs:
326360 optimization : " size"
327361 assert : " ndebug"
328362 coverage : " nocov"
363+ detectcpuflags : " ignore"
329364 boost : " --build-boost"
330365 icu : " "
331366 secp256k1 : " --build-secp256k1"
@@ -342,6 +377,7 @@ jobs:
342377 optimization : " size"
343378 assert : " ndebug"
344379 coverage : " nocov"
380+ detectcpuflags : " ignore"
345381 boost : " --build-boost"
346382 icu : " "
347383 secp256k1 : " --build-secp256k1"
@@ -381,6 +417,29 @@ jobs:
381417 run : |
382418 brew install autoconf automake libtool ${{ matrix.packages }}
383419
420+ - name : Determine CPU flags
421+ shell : bash
422+ run : |
423+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " sse4_1 ") ]]; then
424+ echo "CPU_SUPPORT_SSE41=-Denable-sse41=on" >> $GITHUB_ENV
425+ fi
426+
427+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " avx " | grep " avx2 ") ]]; then
428+ echo "CPU_SUPPORT_AVX2=-Denable-avx2=on" >> $GITHUB_ENV
429+ fi
430+
431+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " avx512bw ") ]]; then
432+ echo "CPU_SUPPORT_AVX512=-Denable-avx512=on" >> $GITHUB_ENV
433+ fi
434+
435+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " sha_ni ") ]]; then
436+ echo "CPU_SUPPORT_SHANI=-Denable-shani=on" >> $GITHUB_ENV
437+ fi
438+
439+ if [[ ${{ matrix.detectcpuflags }} == 'detect' ]]; then
440+ echo "CPU_SUPPORTED_FLAGS='$CPU_SUPPORT_SSE41 $CPU_SUPPORT_AVX2 $CPU_SUPPORT_AVX512 $CPU_SUPPORT_SHANI'" >> $GITHUB_ENV
441+ fi
442+
384443 - name : Denormalize parameterization
385444 shell : bash
386445 run : |
@@ -422,6 +481,7 @@ jobs:
422481 --prefix=${{ env.LIBBITCOIN_SRC_PATH }}prefix
423482 ${{ env.LINKAGE }}
424483 ${{ env.ASSERT_NDEBUG }}
484+ ${{ env.CPU_SUPPORTED_FLAGS }}
425485 ${{ matrix.boost }}
426486 ${{ matrix.icu }}
427487 ${{ matrix.secp256k1 }}
@@ -515,6 +575,7 @@ jobs:
515575 optimization : " debug"
516576 assert : " debug"
517577 coverage : " nocov"
578+ detectcpuflags : " ignore"
518579 boost : " --build-boost"
519580 icu : " "
520581 secp256k1 : " --build-secp256k1"
@@ -532,6 +593,7 @@ jobs:
532593 optimization : " size"
533594 assert : " ndebug"
534595 coverage : " nocov"
596+ detectcpuflags : " ignore"
535597 boost : " --build-boost"
536598 icu : " --build-icu --with-icu"
537599 secp256k1 : " --build-secp256k1"
@@ -549,6 +611,7 @@ jobs:
549611 optimization : " size"
550612 assert : " ndebug"
551613 coverage : " nocov"
614+ detectcpuflags : " ignore"
552615 boost : " --build-boost"
553616 icu : " "
554617 secp256k1 : " --build-secp256k1"
@@ -588,6 +651,29 @@ jobs:
588651 run : |
589652 brew install autoconf automake libtool ${{ matrix.packages }}
590653
654+ - name : Determine CPU flags
655+ shell : bash
656+ run : |
657+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " sse4_1 ") ]]; then
658+ echo "CPU_SUPPORT_SSE41=-Denable-sse41=on" >> $GITHUB_ENV
659+ fi
660+
661+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " avx " | grep " avx2 ") ]]; then
662+ echo "CPU_SUPPORT_AVX2=-Denable-avx2=on" >> $GITHUB_ENV
663+ fi
664+
665+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " avx512bw ") ]]; then
666+ echo "CPU_SUPPORT_AVX512=-Denable-avx512=on" >> $GITHUB_ENV
667+ fi
668+
669+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " sha_ni ") ]]; then
670+ echo "CPU_SUPPORT_SHANI=-Denable-shani=on" >> $GITHUB_ENV
671+ fi
672+
673+ if [[ ${{ matrix.detectcpuflags }} == 'detect' ]]; then
674+ echo "CPU_SUPPORTED_FLAGS='$CPU_SUPPORT_SSE41 $CPU_SUPPORT_AVX2 $CPU_SUPPORT_AVX512 $CPU_SUPPORT_SHANI'" >> $GITHUB_ENV
675+ fi
676+
591677 - name : Denormalize parameterization
592678 shell : bash
593679 run : |
@@ -630,6 +716,7 @@ jobs:
630716 --preset=${{ matrix.preset }}
631717 ${{ env.LINKAGE }}
632718 ${{ env.ASSERT_NDEBUG }}
719+ ${{ env.CPU_SUPPORTED_FLAGS }}
633720 ${{ matrix.boost }}
634721 ${{ matrix.icu }}
635722 ${{ matrix.secp256k1 }}
0 commit comments