@@ -647,9 +647,6 @@ MSGFMT_FLAGS
647
647
MSGFMT
648
648
PG_CRC32C_OBJS
649
649
CFLAGS_CRC
650
- PG_POPCNT_OBJS
651
- CFLAGS_POPCNT
652
- CFLAGS_XSAVE
653
650
LIBOBJS
654
651
OPENSSL
655
652
ZSTD
@@ -17272,185 +17269,103 @@ fi
17272
17269
17273
17270
# Check for XSAVE intrinsics
17274
17271
#
17275
- CFLAGS_XSAVE=""
17276
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _xgetbv with CFLAGS=" >&5
17277
- $as_echo_n "checking for _xgetbv with CFLAGS=... " >&6; }
17278
- if ${pgac_cv_xsave_intrinsics_+:} false; then :
17272
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _xgetbv" >&5
17273
+ $as_echo_n "checking for _xgetbv... " >&6; }
17274
+ if ${pgac_cv_xsave_intrinsics+:} false; then :
17279
17275
$as_echo_n "(cached) " >&6
17280
17276
else
17281
- pgac_save_CFLAGS=$CFLAGS
17282
- CFLAGS="$pgac_save_CFLAGS "
17283
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17284
- /* end confdefs.h. */
17285
- #include <immintrin.h>
17286
- int
17287
- main ()
17288
- {
17289
- return _xgetbv(0) & 0xe0;
17290
- ;
17291
- return 0;
17292
- }
17293
- _ACEOF
17294
- if ac_fn_c_try_link "$LINENO"; then :
17295
- pgac_cv_xsave_intrinsics_=yes
17296
- else
17297
- pgac_cv_xsave_intrinsics_=no
17298
- fi
17299
- rm -f core conftest.err conftest.$ac_objext \
17300
- conftest$ac_exeext conftest.$ac_ext
17301
- CFLAGS="$pgac_save_CFLAGS"
17302
- fi
17303
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_xsave_intrinsics_" >&5
17304
- $as_echo "$pgac_cv_xsave_intrinsics_" >&6; }
17305
- if test x"$pgac_cv_xsave_intrinsics_" = x"yes"; then
17306
- CFLAGS_XSAVE=""
17307
- pgac_xsave_intrinsics=yes
17308
- fi
17309
-
17310
- if test x"$pgac_xsave_intrinsics" != x"yes"; then
17311
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _xgetbv with CFLAGS=-mxsave" >&5
17312
- $as_echo_n "checking for _xgetbv with CFLAGS=-mxsave... " >&6; }
17313
- if ${pgac_cv_xsave_intrinsics__mxsave+:} false; then :
17314
- $as_echo_n "(cached) " >&6
17315
- else
17316
- pgac_save_CFLAGS=$CFLAGS
17317
- CFLAGS="$pgac_save_CFLAGS -mxsave"
17318
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17277
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17319
17278
/* end confdefs.h. */
17320
17279
#include <immintrin.h>
17280
+ #if defined(__has_attribute) && __has_attribute (target)
17281
+ __attribute__((target("xsave")))
17282
+ #endif
17283
+ static int xsave_test(void)
17284
+ {
17285
+ return _xgetbv(0) & 0xe0;
17286
+ }
17321
17287
int
17322
17288
main ()
17323
17289
{
17324
- return _xgetbv(0) & 0xe0 ;
17290
+ return xsave_test() ;
17325
17291
;
17326
17292
return 0;
17327
17293
}
17328
17294
_ACEOF
17329
17295
if ac_fn_c_try_link "$LINENO"; then :
17330
- pgac_cv_xsave_intrinsics__mxsave =yes
17296
+ pgac_cv_xsave_intrinsics =yes
17331
17297
else
17332
- pgac_cv_xsave_intrinsics__mxsave =no
17298
+ pgac_cv_xsave_intrinsics =no
17333
17299
fi
17334
17300
rm -f core conftest.err conftest.$ac_objext \
17335
17301
conftest$ac_exeext conftest.$ac_ext
17336
- CFLAGS="$pgac_save_CFLAGS"
17337
17302
fi
17338
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_xsave_intrinsics__mxsave" >&5
17339
- $as_echo "$pgac_cv_xsave_intrinsics__mxsave" >&6; }
17340
- if test x"$pgac_cv_xsave_intrinsics__mxsave" = x"yes"; then
17341
- CFLAGS_XSAVE="-mxsave"
17303
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_xsave_intrinsics" >&5
17304
+ $as_echo "$pgac_cv_xsave_intrinsics" >&6; }
17305
+ if test x"$pgac_cv_xsave_intrinsics" = x"yes"; then
17342
17306
pgac_xsave_intrinsics=yes
17343
17307
fi
17344
17308
17345
- fi
17346
17309
if test x"$pgac_xsave_intrinsics" = x"yes"; then
17347
17310
17348
17311
$as_echo "#define HAVE_XSAVE_INTRINSICS 1" >>confdefs.h
17349
17312
17350
17313
fi
17351
17314
17352
-
17353
17315
# Check for AVX-512 popcount intrinsics
17354
17316
#
17355
- CFLAGS_POPCNT=""
17356
- PG_POPCNT_OBJS=""
17357
17317
if test x"$host_cpu" = x"x86_64"; then
17358
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm512_popcnt_epi64 with CFLAGS= " >&5
17359
- $as_echo_n "checking for _mm512_popcnt_epi64 with CFLAGS= ... " >&6; }
17360
- if ${pgac_cv_avx512_popcnt_intrinsics_ +:} false; then :
17318
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm512_popcnt_epi64" >&5
17319
+ $as_echo_n "checking for _mm512_popcnt_epi64... " >&6; }
17320
+ if ${pgac_cv_avx512_popcnt_intrinsics +:} false; then :
17361
17321
$as_echo_n "(cached) " >&6
17362
17322
else
17363
- pgac_save_CFLAGS=$CFLAGS
17364
- CFLAGS="$pgac_save_CFLAGS "
17365
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17366
- /* end confdefs.h. */
17367
- #include <immintrin.h>
17368
- int
17369
- main ()
17370
- {
17371
- const char buf[sizeof(__m512i)];
17372
- PG_INT64_TYPE popcnt = 0;
17373
- __m512i accum = _mm512_setzero_si512();
17374
- const __m512i val = _mm512_maskz_loadu_epi8((__mmask64) 0xf0f0f0f0f0f0f0f0, (const __m512i *) buf);
17375
- const __m512i cnt = _mm512_popcnt_epi64(val);
17376
- accum = _mm512_add_epi64(accum, cnt);
17377
- popcnt = _mm512_reduce_add_epi64(accum);
17378
- /* return computed value, to prevent the above being optimized away */
17379
- return popcnt == 0;
17380
- ;
17381
- return 0;
17382
- }
17383
- _ACEOF
17384
- if ac_fn_c_try_link "$LINENO"; then :
17385
- pgac_cv_avx512_popcnt_intrinsics_=yes
17386
- else
17387
- pgac_cv_avx512_popcnt_intrinsics_=no
17388
- fi
17389
- rm -f core conftest.err conftest.$ac_objext \
17390
- conftest$ac_exeext conftest.$ac_ext
17391
- CFLAGS="$pgac_save_CFLAGS"
17392
- fi
17393
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_avx512_popcnt_intrinsics_" >&5
17394
- $as_echo "$pgac_cv_avx512_popcnt_intrinsics_" >&6; }
17395
- if test x"$pgac_cv_avx512_popcnt_intrinsics_" = x"yes"; then
17396
- CFLAGS_POPCNT=""
17397
- pgac_avx512_popcnt_intrinsics=yes
17398
- fi
17399
-
17400
- if test x"$pgac_avx512_popcnt_intrinsics" != x"yes"; then
17401
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mm512_popcnt_epi64 with CFLAGS=-mavx512vpopcntdq -mavx512bw" >&5
17402
- $as_echo_n "checking for _mm512_popcnt_epi64 with CFLAGS=-mavx512vpopcntdq -mavx512bw... " >&6; }
17403
- if ${pgac_cv_avx512_popcnt_intrinsics__mavx512vpopcntdq__mavx512bw+:} false; then :
17404
- $as_echo_n "(cached) " >&6
17405
- else
17406
- pgac_save_CFLAGS=$CFLAGS
17407
- CFLAGS="$pgac_save_CFLAGS -mavx512vpopcntdq -mavx512bw"
17408
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17323
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17409
17324
/* end confdefs.h. */
17410
17325
#include <immintrin.h>
17326
+ #if defined(__has_attribute) && __has_attribute (target)
17327
+ __attribute__((target("avx512vpopcntdq","avx512bw")))
17328
+ #endif
17329
+ static int popcount_test(void)
17330
+ {
17331
+ const char buf[sizeof(__m512i)];
17332
+ PG_INT64_TYPE popcnt = 0;
17333
+ __m512i accum = _mm512_setzero_si512();
17334
+ const __m512i val = _mm512_maskz_loadu_epi8((__mmask64) 0xf0f0f0f0f0f0f0f0, (const __m512i *) buf);
17335
+ const __m512i cnt = _mm512_popcnt_epi64(val);
17336
+ accum = _mm512_add_epi64(accum, cnt);
17337
+ popcnt = _mm512_reduce_add_epi64(accum);
17338
+ return (int) popcnt;
17339
+ }
17411
17340
int
17412
17341
main ()
17413
17342
{
17414
- const char buf[sizeof(__m512i)];
17415
- PG_INT64_TYPE popcnt = 0;
17416
- __m512i accum = _mm512_setzero_si512();
17417
- const __m512i val = _mm512_maskz_loadu_epi8((__mmask64) 0xf0f0f0f0f0f0f0f0, (const __m512i *) buf);
17418
- const __m512i cnt = _mm512_popcnt_epi64(val);
17419
- accum = _mm512_add_epi64(accum, cnt);
17420
- popcnt = _mm512_reduce_add_epi64(accum);
17421
- /* return computed value, to prevent the above being optimized away */
17422
- return popcnt == 0;
17343
+ return popcount_test();
17423
17344
;
17424
17345
return 0;
17425
17346
}
17426
17347
_ACEOF
17427
17348
if ac_fn_c_try_link "$LINENO"; then :
17428
- pgac_cv_avx512_popcnt_intrinsics__mavx512vpopcntdq__mavx512bw =yes
17349
+ pgac_cv_avx512_popcnt_intrinsics =yes
17429
17350
else
17430
- pgac_cv_avx512_popcnt_intrinsics__mavx512vpopcntdq__mavx512bw =no
17351
+ pgac_cv_avx512_popcnt_intrinsics =no
17431
17352
fi
17432
17353
rm -f core conftest.err conftest.$ac_objext \
17433
17354
conftest$ac_exeext conftest.$ac_ext
17434
- CFLAGS="$pgac_save_CFLAGS"
17435
17355
fi
17436
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_avx512_popcnt_intrinsics__mavx512vpopcntdq__mavx512bw" >&5
17437
- $as_echo "$pgac_cv_avx512_popcnt_intrinsics__mavx512vpopcntdq__mavx512bw" >&6; }
17438
- if test x"$pgac_cv_avx512_popcnt_intrinsics__mavx512vpopcntdq__mavx512bw" = x"yes"; then
17439
- CFLAGS_POPCNT="-mavx512vpopcntdq -mavx512bw"
17356
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_avx512_popcnt_intrinsics" >&5
17357
+ $as_echo "$pgac_cv_avx512_popcnt_intrinsics" >&6; }
17358
+ if test x"$pgac_cv_avx512_popcnt_intrinsics" = x"yes"; then
17440
17359
pgac_avx512_popcnt_intrinsics=yes
17441
17360
fi
17442
17361
17443
- fi
17444
17362
if test x"$pgac_avx512_popcnt_intrinsics" = x"yes"; then
17445
- PG_POPCNT_OBJS="pg_popcount_avx512.o pg_popcount_avx512_choose.o"
17446
17363
17447
17364
$as_echo "#define USE_AVX512_POPCNT_WITH_RUNTIME_CHECK 1" >>confdefs.h
17448
17365
17449
17366
fi
17450
17367
fi
17451
17368
17452
-
17453
-
17454
17369
# Check for Intel SSE 4.2 intrinsics to do CRC calculations.
17455
17370
#
17456
17371
# First check if the _mm_crc32_u8 and _mm_crc32_u64 intrinsics can be used
0 commit comments