@@ -647,6 +647,9 @@ MSGFMT_FLAGS
647
647
MSGFMT
648
648
PG_CRC32C_OBJS
649
649
CFLAGS_CRC
650
+ PG_POPCNT_OBJS
651
+ CFLAGS_POPCNT
652
+ CFLAGS_XSAVE
650
653
LIBOBJS
651
654
OPENSSL
652
655
ZSTD
@@ -17404,6 +17407,40 @@ $as_echo "#define HAVE__GET_CPUID 1" >>confdefs.h
17404
17407
17405
17408
fi
17406
17409
17410
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __get_cpuid_count" >&5
17411
+ $as_echo_n "checking for __get_cpuid_count... " >&6; }
17412
+ if ${pgac_cv__get_cpuid_count+:} false; then :
17413
+ $as_echo_n "(cached) " >&6
17414
+ else
17415
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17416
+ /* end confdefs.h. */
17417
+ #include <cpuid.h>
17418
+ int
17419
+ main ()
17420
+ {
17421
+ unsigned int exx[4] = {0, 0, 0, 0};
17422
+ __get_cpuid_count(7, 0, &exx[0], &exx[1], &exx[2], &exx[3]);
17423
+
17424
+ ;
17425
+ return 0;
17426
+ }
17427
+ _ACEOF
17428
+ if ac_fn_c_try_link "$LINENO"; then :
17429
+ pgac_cv__get_cpuid_count="yes"
17430
+ else
17431
+ pgac_cv__get_cpuid_count="no"
17432
+ fi
17433
+ rm -f core conftest.err conftest.$ac_objext \
17434
+ conftest$ac_exeext conftest.$ac_ext
17435
+ fi
17436
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__get_cpuid_count" >&5
17437
+ $as_echo "$pgac_cv__get_cpuid_count" >&6; }
17438
+ if test x"$pgac_cv__get_cpuid_count" = x"yes"; then
17439
+
17440
+ $as_echo "#define HAVE__GET_CPUID_COUNT 1" >>confdefs.h
17441
+
17442
+ fi
17443
+
17407
17444
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cpuid" >&5
17408
17445
$as_echo_n "checking for __cpuid... " >&6; }
17409
17446
if ${pgac_cv__cpuid+:} false; then :
@@ -17438,6 +17475,221 @@ $as_echo "#define HAVE__CPUID 1" >>confdefs.h
17438
17475
17439
17476
fi
17440
17477
17478
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __cpuidex" >&5
17479
+ $as_echo_n "checking for __cpuidex... " >&6; }
17480
+ if ${pgac_cv__cpuidex+:} false; then :
17481
+ $as_echo_n "(cached) " >&6
17482
+ else
17483
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17484
+ /* end confdefs.h. */
17485
+ #include <intrin.h>
17486
+ int
17487
+ main ()
17488
+ {
17489
+ unsigned int exx[4] = {0, 0, 0, 0};
17490
+ __get_cpuidex(exx[0], 7, 0);
17491
+
17492
+ ;
17493
+ return 0;
17494
+ }
17495
+ _ACEOF
17496
+ if ac_fn_c_try_link "$LINENO"; then :
17497
+ pgac_cv__cpuidex="yes"
17498
+ else
17499
+ pgac_cv__cpuidex="no"
17500
+ fi
17501
+ rm -f core conftest.err conftest.$ac_objext \
17502
+ conftest$ac_exeext conftest.$ac_ext
17503
+ fi
17504
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv__cpuidex" >&5
17505
+ $as_echo "$pgac_cv__cpuidex" >&6; }
17506
+ if test x"$pgac_cv__cpuidex" = x"yes"; then
17507
+
17508
+ $as_echo "#define HAVE__CPUIDEX 1" >>confdefs.h
17509
+
17510
+ fi
17511
+
17512
+ # Check for XSAVE intrinsics
17513
+ #
17514
+ CFLAGS_XSAVE=""
17515
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _xgetbv with CFLAGS=" >&5
17516
+ $as_echo_n "checking for _xgetbv with CFLAGS=... " >&6; }
17517
+ if ${pgac_cv_xsave_intrinsics_+:} false; then :
17518
+ $as_echo_n "(cached) " >&6
17519
+ else
17520
+ pgac_save_CFLAGS=$CFLAGS
17521
+ CFLAGS="$pgac_save_CFLAGS "
17522
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17523
+ /* end confdefs.h. */
17524
+ #include <immintrin.h>
17525
+ int
17526
+ main ()
17527
+ {
17528
+ return _xgetbv(0) & 0xe0;
17529
+ ;
17530
+ return 0;
17531
+ }
17532
+ _ACEOF
17533
+ if ac_fn_c_try_link "$LINENO"; then :
17534
+ pgac_cv_xsave_intrinsics_=yes
17535
+ else
17536
+ pgac_cv_xsave_intrinsics_=no
17537
+ fi
17538
+ rm -f core conftest.err conftest.$ac_objext \
17539
+ conftest$ac_exeext conftest.$ac_ext
17540
+ CFLAGS="$pgac_save_CFLAGS"
17541
+ fi
17542
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_xsave_intrinsics_" >&5
17543
+ $as_echo "$pgac_cv_xsave_intrinsics_" >&6; }
17544
+ if test x"$pgac_cv_xsave_intrinsics_" = x"yes"; then
17545
+ CFLAGS_XSAVE=""
17546
+ pgac_xsave_intrinsics=yes
17547
+ fi
17548
+
17549
+ if test x"$pgac_xsave_intrinsics" != x"yes"; then
17550
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _xgetbv with CFLAGS=-mxsave" >&5
17551
+ $as_echo_n "checking for _xgetbv with CFLAGS=-mxsave... " >&6; }
17552
+ if ${pgac_cv_xsave_intrinsics__mxsave+:} false; then :
17553
+ $as_echo_n "(cached) " >&6
17554
+ else
17555
+ pgac_save_CFLAGS=$CFLAGS
17556
+ CFLAGS="$pgac_save_CFLAGS -mxsave"
17557
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17558
+ /* end confdefs.h. */
17559
+ #include <immintrin.h>
17560
+ int
17561
+ main ()
17562
+ {
17563
+ return _xgetbv(0) & 0xe0;
17564
+ ;
17565
+ return 0;
17566
+ }
17567
+ _ACEOF
17568
+ if ac_fn_c_try_link "$LINENO"; then :
17569
+ pgac_cv_xsave_intrinsics__mxsave=yes
17570
+ else
17571
+ pgac_cv_xsave_intrinsics__mxsave=no
17572
+ fi
17573
+ rm -f core conftest.err conftest.$ac_objext \
17574
+ conftest$ac_exeext conftest.$ac_ext
17575
+ CFLAGS="$pgac_save_CFLAGS"
17576
+ fi
17577
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_xsave_intrinsics__mxsave" >&5
17578
+ $as_echo "$pgac_cv_xsave_intrinsics__mxsave" >&6; }
17579
+ if test x"$pgac_cv_xsave_intrinsics__mxsave" = x"yes"; then
17580
+ CFLAGS_XSAVE="-mxsave"
17581
+ pgac_xsave_intrinsics=yes
17582
+ fi
17583
+
17584
+ fi
17585
+ if test x"$pgac_xsave_intrinsics" = x"yes"; then
17586
+
17587
+ $as_echo "#define HAVE_XSAVE_INTRINSICS 1" >>confdefs.h
17588
+
17589
+ fi
17590
+
17591
+
17592
+ # Check for AVX-512 popcount intrinsics
17593
+ #
17594
+ CFLAGS_POPCNT=""
17595
+ PG_POPCNT_OBJS=""
17596
+ if test x"$host_cpu" = x"x86_64"; then
17597
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm512_popcnt_epi64 with CFLAGS=" >&5
17598
+ $as_echo_n "checking for _mm512_popcnt_epi64 with CFLAGS=... " >&6; }
17599
+ if ${pgac_cv_avx512_popcnt_intrinsics_+:} false; then :
17600
+ $as_echo_n "(cached) " >&6
17601
+ else
17602
+ pgac_save_CFLAGS=$CFLAGS
17603
+ CFLAGS="$pgac_save_CFLAGS "
17604
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17605
+ /* end confdefs.h. */
17606
+ #include <immintrin.h>
17607
+ int
17608
+ main ()
17609
+ {
17610
+ const char buf[sizeof(__m512i)];
17611
+ PG_INT64_TYPE popcnt = 0;
17612
+ __m512i accum = _mm512_setzero_si512();
17613
+ const __m512i val = _mm512_maskz_loadu_epi8((__mmask64) 0xf0f0f0f0f0f0f0f0, (const __m512i *) buf);
17614
+ const __m512i cnt = _mm512_popcnt_epi64(val);
17615
+ accum = _mm512_add_epi64(accum, cnt);
17616
+ popcnt = _mm512_reduce_add_epi64(accum);
17617
+ /* return computed value, to prevent the above being optimized away */
17618
+ return popcnt == 0;
17619
+ ;
17620
+ return 0;
17621
+ }
17622
+ _ACEOF
17623
+ if ac_fn_c_try_link "$LINENO"; then :
17624
+ pgac_cv_avx512_popcnt_intrinsics_=yes
17625
+ else
17626
+ pgac_cv_avx512_popcnt_intrinsics_=no
17627
+ fi
17628
+ rm -f core conftest.err conftest.$ac_objext \
17629
+ conftest$ac_exeext conftest.$ac_ext
17630
+ CFLAGS="$pgac_save_CFLAGS"
17631
+ fi
17632
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_avx512_popcnt_intrinsics_" >&5
17633
+ $as_echo "$pgac_cv_avx512_popcnt_intrinsics_" >&6; }
17634
+ if test x"$pgac_cv_avx512_popcnt_intrinsics_" = x"yes"; then
17635
+ CFLAGS_POPCNT=""
17636
+ pgac_avx512_popcnt_intrinsics=yes
17637
+ fi
17638
+
17639
+ if test x"$pgac_avx512_popcnt_intrinsics" != x"yes"; then
17640
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm512_popcnt_epi64 with CFLAGS=-mavx512vpopcntdq -mavx512bw" >&5
17641
+ $as_echo_n "checking for _mm512_popcnt_epi64 with CFLAGS=-mavx512vpopcntdq -mavx512bw... " >&6; }
17642
+ if ${pgac_cv_avx512_popcnt_intrinsics__mavx512vpopcntdq__mavx512bw+:} false; then :
17643
+ $as_echo_n "(cached) " >&6
17644
+ else
17645
+ pgac_save_CFLAGS=$CFLAGS
17646
+ CFLAGS="$pgac_save_CFLAGS -mavx512vpopcntdq -mavx512bw"
17647
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17648
+ /* end confdefs.h. */
17649
+ #include <immintrin.h>
17650
+ int
17651
+ main ()
17652
+ {
17653
+ const char buf[sizeof(__m512i)];
17654
+ PG_INT64_TYPE popcnt = 0;
17655
+ __m512i accum = _mm512_setzero_si512();
17656
+ const __m512i val = _mm512_maskz_loadu_epi8((__mmask64) 0xf0f0f0f0f0f0f0f0, (const __m512i *) buf);
17657
+ const __m512i cnt = _mm512_popcnt_epi64(val);
17658
+ accum = _mm512_add_epi64(accum, cnt);
17659
+ popcnt = _mm512_reduce_add_epi64(accum);
17660
+ /* return computed value, to prevent the above being optimized away */
17661
+ return popcnt == 0;
17662
+ ;
17663
+ return 0;
17664
+ }
17665
+ _ACEOF
17666
+ if ac_fn_c_try_link "$LINENO"; then :
17667
+ pgac_cv_avx512_popcnt_intrinsics__mavx512vpopcntdq__mavx512bw=yes
17668
+ else
17669
+ pgac_cv_avx512_popcnt_intrinsics__mavx512vpopcntdq__mavx512bw=no
17670
+ fi
17671
+ rm -f core conftest.err conftest.$ac_objext \
17672
+ conftest$ac_exeext conftest.$ac_ext
17673
+ CFLAGS="$pgac_save_CFLAGS"
17674
+ fi
17675
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_avx512_popcnt_intrinsics__mavx512vpopcntdq__mavx512bw" >&5
17676
+ $as_echo "$pgac_cv_avx512_popcnt_intrinsics__mavx512vpopcntdq__mavx512bw" >&6; }
17677
+ if test x"$pgac_cv_avx512_popcnt_intrinsics__mavx512vpopcntdq__mavx512bw" = x"yes"; then
17678
+ CFLAGS_POPCNT="-mavx512vpopcntdq -mavx512bw"
17679
+ pgac_avx512_popcnt_intrinsics=yes
17680
+ fi
17681
+
17682
+ fi
17683
+ if test x"$pgac_avx512_popcnt_intrinsics" = x"yes"; then
17684
+ PG_POPCNT_OBJS="pg_popcount_avx512.o pg_popcount_avx512_choose.o"
17685
+
17686
+ $as_echo "#define USE_AVX512_POPCNT_WITH_RUNTIME_CHECK 1" >>confdefs.h
17687
+
17688
+ fi
17689
+ fi
17690
+
17691
+
17692
+
17441
17693
# Check for Intel SSE 4.2 intrinsics to do CRC calculations.
17442
17694
#
17443
17695
# First check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used
0 commit comments