2323 optimization : " debug"
2424 assert : " debug"
2525 coverage : " nocov"
26+ detectcpuflags : " ignore"
2627 boost : " --build-boost"
2728 icu : " "
2829 secp256k1 : " --build-secp256k1"
3839 optimization : " size"
3940 assert : " ndebug"
4041 coverage : " nocov"
42+ detectcpuflags : " ignore"
4143 boost : " --build-boost"
4244 icu : " --build-icu --with-icu"
4345 secp256k1 : " --build-secp256k1"
5355 optimization : " size"
5456 assert : " ndebug"
5557 coverage : " nocov"
58+ detectcpuflags : " ignore"
5659 boost : " --build-boost"
5760 icu : " "
5861 secp256k1 : " --build-secp256k1"
6871 optimization : " size"
6972 assert : " ndebug"
7073 coverage : " cov"
74+ detectcpuflags : " detect"
7175 boost : " --build-boost"
7276 icu : " --build-icu --with-icu"
7377 secp256k1 : " --build-secp256k1"
8387 optimization : " size"
8488 assert : " ndebug"
8589 coverage : " nocov"
90+ detectcpuflags : " ignore"
8691 boost : " --build-boost"
8792 icu : " "
8893 secp256k1 : " --build-secp256k1"
98103 optimization : " size"
99104 assert : " ndebug"
100105 coverage : " nocov"
106+ detectcpuflags : " ignore"
101107 boost : " --build-boost"
102108 icu : " "
103109 secp256k1 : " --build-secp256k1"
@@ -136,6 +142,29 @@ jobs:
136142 run : |
137143 brew install autoconf automake libtool ${{ matrix.packages }}
138144
145+ - name : Determine CPU flags
146+ shell : bash
147+ run : |
148+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " sse4_1 ") ]]; then
149+ echo "CPU_SUPPORT_SSE41=--enable-sse41" >> $GITHUB_ENV
150+ fi
151+
152+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " avx " | grep " avx2 ") ]]; then
153+ echo "CPU_SUPPORT_AVX2=--enable-avx2" >> $GITHUB_ENV
154+ fi
155+
156+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " avx512bw ") ]]; then
157+ echo "CPU_SUPPORT_AVX512=--enable-avx512" >> $GITHUB_ENV
158+ fi
159+
160+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " sha_ni ") ]]; then
161+ echo "CPU_SUPPORT_SHANI=--enable-shani" >> $GITHUB_ENV
162+ fi
163+
164+ if [[ ${{ matrix.detectcpuflags }} == 'detect' ]]; then
165+ echo "CPU_SUPPORTED_FLAGS='$CPU_SUPPORT_SSE41 $CPU_SUPPORT_AVX2 $CPU_SUPPORT_AVX512 $CPU_SUPPORT_SHANI'" >> $GITHUB_ENV
166+ fi
167+
139168 - name : Denormalize parameterization
140169 shell : bash
141170 run : |
@@ -174,6 +203,7 @@ jobs:
174203 --prefix=${{ env.LIBBITCOIN_SRC_PATH }}prefix
175204 ${{ env.LINKAGE }}
176205 ${{ env.ASSERT_NDEBUG }}
206+ ${{ env.CPU_SUPPORTED_FLAGS }}
177207 ${{ matrix.boost }}
178208 ${{ matrix.icu }}
179209 ${{ matrix.secp256k1 }}
@@ -255,6 +285,7 @@ jobs:
255285 optimization : " debug"
256286 assert : " debug"
257287 coverage : " nocov"
288+ detectcpuflags : " ignore"
258289 boost : " --build-boost"
259290 icu : " "
260291 secp256k1 : " --build-secp256k1"
@@ -270,6 +301,7 @@ jobs:
270301 optimization : " size"
271302 assert : " ndebug"
272303 coverage : " nocov"
304+ detectcpuflags : " ignore"
273305 boost : " --build-boost"
274306 icu : " --build-icu --with-icu"
275307 secp256k1 : " --build-secp256k1"
@@ -285,6 +317,7 @@ jobs:
285317 optimization : " size"
286318 assert : " ndebug"
287319 coverage : " nocov"
320+ detectcpuflags : " ignore"
288321 boost : " --build-boost"
289322 icu : " "
290323 secp256k1 : " --build-secp256k1"
@@ -300,6 +333,7 @@ jobs:
300333 optimization : " size"
301334 assert : " ndebug"
302335 coverage : " nocov"
336+ detectcpuflags : " ignore"
303337 boost : " --build-boost"
304338 icu : " --build-icu --with-icu"
305339 secp256k1 : " --build-secp256k1"
@@ -315,6 +349,7 @@ jobs:
315349 optimization : " size"
316350 assert : " ndebug"
317351 coverage : " nocov"
352+ detectcpuflags : " ignore"
318353 boost : " --build-boost"
319354 icu : " "
320355 secp256k1 : " --build-secp256k1"
@@ -330,6 +365,7 @@ jobs:
330365 optimization : " size"
331366 assert : " ndebug"
332367 coverage : " nocov"
368+ detectcpuflags : " ignore"
333369 boost : " --build-boost"
334370 icu : " "
335371 secp256k1 : " --build-secp256k1"
@@ -368,6 +404,29 @@ jobs:
368404 run : |
369405 brew install autoconf automake libtool ${{ matrix.packages }}
370406
407+ - name : Determine CPU flags
408+ shell : bash
409+ run : |
410+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " sse4_1 ") ]]; then
411+ echo "CPU_SUPPORT_SSE41=-Denable-sse41=on" >> $GITHUB_ENV
412+ fi
413+
414+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " avx " | grep " avx2 ") ]]; then
415+ echo "CPU_SUPPORT_AVX2=-Denable-avx2=on" >> $GITHUB_ENV
416+ fi
417+
418+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " avx512bw ") ]]; then
419+ echo "CPU_SUPPORT_AVX512=-Denable-avx512=on" >> $GITHUB_ENV
420+ fi
421+
422+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " sha_ni ") ]]; then
423+ echo "CPU_SUPPORT_SHANI=-Denable-shani=on" >> $GITHUB_ENV
424+ fi
425+
426+ if [[ ${{ matrix.detectcpuflags }} == 'detect' ]]; then
427+ echo "CPU_SUPPORTED_FLAGS='$CPU_SUPPORT_SSE41 $CPU_SUPPORT_AVX2 $CPU_SUPPORT_AVX512 $CPU_SUPPORT_SHANI'" >> $GITHUB_ENV
428+ fi
429+
371430 - name : Denormalize parameterization
372431 shell : bash
373432 run : |
@@ -409,6 +468,7 @@ jobs:
409468 --prefix=${{ env.LIBBITCOIN_SRC_PATH }}prefix
410469 ${{ env.LINKAGE }}
411470 ${{ env.ASSERT_NDEBUG }}
471+ ${{ env.CPU_SUPPORTED_FLAGS }}
412472 ${{ matrix.boost }}
413473 ${{ matrix.icu }}
414474 ${{ matrix.secp256k1 }}
@@ -501,6 +561,7 @@ jobs:
501561 optimization : " debug"
502562 assert : " debug"
503563 coverage : " nocov"
564+ detectcpuflags : " ignore"
504565 boost : " --build-boost"
505566 icu : " "
506567 secp256k1 : " --build-secp256k1"
@@ -517,6 +578,7 @@ jobs:
517578 optimization : " size"
518579 assert : " ndebug"
519580 coverage : " nocov"
581+ detectcpuflags : " ignore"
520582 boost : " --build-boost"
521583 icu : " --build-icu --with-icu"
522584 secp256k1 : " --build-secp256k1"
@@ -533,6 +595,7 @@ jobs:
533595 optimization : " size"
534596 assert : " ndebug"
535597 coverage : " nocov"
598+ detectcpuflags : " ignore"
536599 boost : " --build-boost"
537600 icu : " "
538601 secp256k1 : " --build-secp256k1"
@@ -571,6 +634,29 @@ jobs:
571634 run : |
572635 brew install autoconf automake libtool ${{ matrix.packages }}
573636
637+ - name : Determine CPU flags
638+ shell : bash
639+ run : |
640+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " sse4_1 ") ]]; then
641+ echo "CPU_SUPPORT_SSE41=-Denable-sse41=on" >> $GITHUB_ENV
642+ fi
643+
644+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " avx " | grep " avx2 ") ]]; then
645+ echo "CPU_SUPPORT_AVX2=-Denable-avx2=on" >> $GITHUB_ENV
646+ fi
647+
648+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " avx512bw ") ]]; then
649+ echo "CPU_SUPPORT_AVX512=-Denable-avx512=on" >> $GITHUB_ENV
650+ fi
651+
652+ if [[ -n $(cat /proc/cpuinfo | grep flags | grep " sha_ni ") ]]; then
653+ echo "CPU_SUPPORT_SHANI=-Denable-shani=on" >> $GITHUB_ENV
654+ fi
655+
656+ if [[ ${{ matrix.detectcpuflags }} == 'detect' ]]; then
657+ echo "CPU_SUPPORTED_FLAGS='$CPU_SUPPORT_SSE41 $CPU_SUPPORT_AVX2 $CPU_SUPPORT_AVX512 $CPU_SUPPORT_SHANI'" >> $GITHUB_ENV
658+ fi
659+
574660 - name : Denormalize parameterization
575661 shell : bash
576662 run : |
@@ -613,6 +699,7 @@ jobs:
613699 --preset=${{ matrix.preset }}
614700 ${{ env.LINKAGE }}
615701 ${{ env.ASSERT_NDEBUG }}
702+ ${{ env.CPU_SUPPORTED_FLAGS }}
616703 ${{ matrix.boost }}
617704 ${{ matrix.icu }}
618705 ${{ matrix.secp256k1 }}
0 commit comments