@@ -17540,7 +17540,38 @@ if test x"$pgac_cv_gcc_atomic_int64_cas" = x"yes"; then
17540
17540
$as_echo "#define HAVE_GCC__ATOMIC_INT64_CAS 1" >>confdefs.h
17541
17541
17542
17542
fi
17543
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for builtin __atomic int64 atomic store operations" >&5
17544
+ $as_echo_n "checking for builtin __atomic int64 atomic store operations... " >&6; }
17545
+ if ${pgac_cv_gcc_atomic_store_n+:} false; then :
17546
+ $as_echo_n "(cached) " >&6
17547
+ else
17548
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
17549
+ /* end confdefs.h. */
17550
+ #include <stdint.h>
17551
+ int
17552
+ main ()
17553
+ {
17554
+ int64_t val = 0;
17555
+ __atomic_store_n(&val,1,__ATOMIC_SEQ_CST);
17556
+ ;
17557
+ return 0;
17558
+ }
17559
+ _ACEOF
17560
+ if ac_fn_c_try_link "$LINENO"; then :
17561
+ pgac_cv_gcc_atomic_store_n="yes"
17562
+ else
17563
+ pgac_cv_gcc_atomic_store_n="no"
17564
+ fi
17565
+ rm -f core conftest.err conftest.$ac_objext \
17566
+ conftest$ac_exeext conftest.$ac_ext
17567
+ fi
17568
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_gcc_atomic_store_n" >&5
17569
+ $as_echo "$pgac_cv_gcc_atomic_store_n" >&6; }
17570
+ if test x"$pgac_cv_gcc_atomic_store_n" = x"yes"; then
17571
+
17572
+ $as_echo "#define HAVE_GCC__ATOMIC_STORE_N 1" >>confdefs.h
17543
17573
17574
+ fi
17544
17575
17545
17576
# Check for x86 cpuid instruction
17546
17577
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for __get_cpuid" >&5
@@ -18088,6 +18119,212 @@ if test x"$pgac_cv_loongarch_crc32c_intrinsics" = x"yes"; then
18088
18119
fi
18089
18120
18090
18121
18122
+ # Check for S390X Vector intrinsics to do CRC calculations.
18123
+ #
18124
+ # First check for the host cpu
18125
+ if test x"$host_cpu" = x"s390x"; then
18126
+ # Second check if we have atomic store
18127
+ if test x"$pgac_cv_gcc_atomic_store_n" = x"yes"; then
18128
+ # Third check if we have a compiler with bad intrinsics
18129
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Compiler Version with known bad S390X Vector Intrinsics" >&5
18130
+ $as_echo_n "checking for Compiler Version with known bad S390X Vector Intrinsics... " >&6; }
18131
+ if ${pgac_cv_s390x_bad_vector_intrinsics+:} false; then :
18132
+ $as_echo_n "(cached) " >&6
18133
+ else
18134
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18135
+ /* end confdefs.h. */
18136
+
18137
+ int
18138
+ main ()
18139
+ {
18140
+ #ifdef __clang__
18141
+ # if ((__clang_major__ == 18) || (__clang_major__ == 19 && (__clang_minor__ < 1 || (__clang_minor__ == 1 && __clang_patchlevel__ < 2))))
18142
+ # error CRC32-VX optimizations are broken due to compiler bug in Clang versions: 18.0.0 <= clang_version < 19.1.2. Either disable the CRC32-VX optimization, or switch to another compiler/compiler version.
18143
+ # endif
18144
+ #endif
18145
+ return 0;
18146
+ ;
18147
+ return 0;
18148
+ }
18149
+ _ACEOF
18150
+ if ac_fn_c_try_link "$LINENO"; then :
18151
+ pgac_cv_s390x_bad_vector_intrinsics=yes
18152
+ else
18153
+ pgac_cv_s390x_bad_vector_intrinsics=no
18154
+ fi
18155
+ rm -f core conftest.err conftest.$ac_objext \
18156
+ conftest$ac_exeext conftest.$ac_ext
18157
+ fi
18158
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_s390x_bad_vector_intrinsics" >&5
18159
+ $as_echo "$pgac_cv_s390x_bad_vector_intrinsics" >&6; }
18160
+ if test x"$pgac_cv_s390x_bad_vector_intrinsics" = x"yes"; then
18161
+ pgac_s390x_bad_vector_intrinsics=no
18162
+ fi
18163
+
18164
+ if test x"$pgac_s390x_bad_vector_intrinsics" != x"yes"; then
18165
+ # Finally check for all possible cflag combinations
18166
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((vector_size(16))), vec_gfmsum_accum_128 with CFLAGS=-fzvector " >&5
18167
+ $as_echo_n "checking for __attribute__((vector_size(16))), vec_gfmsum_accum_128 with CFLAGS=-fzvector ... " >&6; }
18168
+ if ${pgac_cv_s390x_vector_intrinsics__fzvector_+:} false; then :
18169
+ $as_echo_n "(cached) " >&6
18170
+ else
18171
+ pgac_save_CFLAGS=$CFLAGS
18172
+ CFLAGS="$pgac_save_CFLAGS -fzvector "
18173
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18174
+ /* end confdefs.h. */
18175
+ #include <vecintrin.h>
18176
+ int
18177
+ main ()
18178
+ {
18179
+ unsigned long long a __attribute__((vector_size(16))) = { 0 };
18180
+ unsigned long long b __attribute__((vector_size(16))) = { 0 };
18181
+ unsigned char c __attribute__((vector_size(16))) = { 0 };
18182
+ c = vec_gfmsum_accum_128(a, b, c);
18183
+ return 0;
18184
+ ;
18185
+ return 0;
18186
+ }
18187
+ _ACEOF
18188
+ if ac_fn_c_try_link "$LINENO"; then :
18189
+ pgac_cv_s390x_vector_intrinsics__fzvector_=yes
18190
+ else
18191
+ pgac_cv_s390x_vector_intrinsics__fzvector_=no
18192
+ fi
18193
+ rm -f core conftest.err conftest.$ac_objext \
18194
+ conftest$ac_exeext conftest.$ac_ext
18195
+ CFLAGS="$pgac_save_CFLAGS"
18196
+ fi
18197
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_s390x_vector_intrinsics__fzvector_" >&5
18198
+ $as_echo "$pgac_cv_s390x_vector_intrinsics__fzvector_" >&6; }
18199
+ if test x"$pgac_cv_s390x_vector_intrinsics__fzvector_" = x"yes"; then
18200
+ CFLAGS_CRC="-fzvector "
18201
+ pgac_s390x_vector_intrinsics__fzvector_=yes
18202
+ fi
18203
+
18204
+ if test x"$pgac_s390x_vector_intrinsics__fzvector_" != x"yes"; then
18205
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((vector_size(16))), vec_gfmsum_accum_128 with CFLAGS=-fzvector -march=z13" >&5
18206
+ $as_echo_n "checking for __attribute__((vector_size(16))), vec_gfmsum_accum_128 with CFLAGS=-fzvector -march=z13... " >&6; }
18207
+ if ${pgac_cv_s390x_vector_intrinsics__fzvector__march_z13+:} false; then :
18208
+ $as_echo_n "(cached) " >&6
18209
+ else
18210
+ pgac_save_CFLAGS=$CFLAGS
18211
+ CFLAGS="$pgac_save_CFLAGS -fzvector -march=z13"
18212
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18213
+ /* end confdefs.h. */
18214
+ #include <vecintrin.h>
18215
+ int
18216
+ main ()
18217
+ {
18218
+ unsigned long long a __attribute__((vector_size(16))) = { 0 };
18219
+ unsigned long long b __attribute__((vector_size(16))) = { 0 };
18220
+ unsigned char c __attribute__((vector_size(16))) = { 0 };
18221
+ c = vec_gfmsum_accum_128(a, b, c);
18222
+ return 0;
18223
+ ;
18224
+ return 0;
18225
+ }
18226
+ _ACEOF
18227
+ if ac_fn_c_try_link "$LINENO"; then :
18228
+ pgac_cv_s390x_vector_intrinsics__fzvector__march_z13=yes
18229
+ else
18230
+ pgac_cv_s390x_vector_intrinsics__fzvector__march_z13=no
18231
+ fi
18232
+ rm -f core conftest.err conftest.$ac_objext \
18233
+ conftest$ac_exeext conftest.$ac_ext
18234
+ CFLAGS="$pgac_save_CFLAGS"
18235
+ fi
18236
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_s390x_vector_intrinsics__fzvector__march_z13" >&5
18237
+ $as_echo "$pgac_cv_s390x_vector_intrinsics__fzvector__march_z13" >&6; }
18238
+ if test x"$pgac_cv_s390x_vector_intrinsics__fzvector__march_z13" = x"yes"; then
18239
+ CFLAGS_CRC="-fzvector -march=z13"
18240
+ pgac_s390x_vector_intrinsics__fzvector__march_z13=yes
18241
+ fi
18242
+
18243
+ if test x"$pgac_s390x_vector_intrinsics__fzvector__march_z13" != x"yes"; then
18244
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((vector_size(16))), vec_gfmsum_accum_128 with CFLAGS=-mzarch " >&5
18245
+ $as_echo_n "checking for __attribute__((vector_size(16))), vec_gfmsum_accum_128 with CFLAGS=-mzarch ... " >&6; }
18246
+ if ${pgac_cv_s390x_vector_intrinsics__mzarch_+:} false; then :
18247
+ $as_echo_n "(cached) " >&6
18248
+ else
18249
+ pgac_save_CFLAGS=$CFLAGS
18250
+ CFLAGS="$pgac_save_CFLAGS -mzarch "
18251
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18252
+ /* end confdefs.h. */
18253
+ #include <vecintrin.h>
18254
+ int
18255
+ main ()
18256
+ {
18257
+ unsigned long long a __attribute__((vector_size(16))) = { 0 };
18258
+ unsigned long long b __attribute__((vector_size(16))) = { 0 };
18259
+ unsigned char c __attribute__((vector_size(16))) = { 0 };
18260
+ c = vec_gfmsum_accum_128(a, b, c);
18261
+ return 0;
18262
+ ;
18263
+ return 0;
18264
+ }
18265
+ _ACEOF
18266
+ if ac_fn_c_try_link "$LINENO"; then :
18267
+ pgac_cv_s390x_vector_intrinsics__mzarch_=yes
18268
+ else
18269
+ pgac_cv_s390x_vector_intrinsics__mzarch_=no
18270
+ fi
18271
+ rm -f core conftest.err conftest.$ac_objext \
18272
+ conftest$ac_exeext conftest.$ac_ext
18273
+ CFLAGS="$pgac_save_CFLAGS"
18274
+ fi
18275
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_s390x_vector_intrinsics__mzarch_" >&5
18276
+ $as_echo "$pgac_cv_s390x_vector_intrinsics__mzarch_" >&6; }
18277
+ if test x"$pgac_cv_s390x_vector_intrinsics__mzarch_" = x"yes"; then
18278
+ CFLAGS_CRC="-mzarch "
18279
+ pgac_s390x_vector_intrinsics__mzarch_=yes
18280
+ fi
18281
+
18282
+ if test x"$pgac_s390x_vector_intrinsics__mzarch_" != x"yes"; then
18283
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((vector_size(16))), vec_gfmsum_accum_128 with CFLAGS=-mzarch -march=z13" >&5
18284
+ $as_echo_n "checking for __attribute__((vector_size(16))), vec_gfmsum_accum_128 with CFLAGS=-mzarch -march=z13... " >&6; }
18285
+ if ${pgac_cv_s390x_vector_intrinsics__mzarch__march_z13+:} false; then :
18286
+ $as_echo_n "(cached) " >&6
18287
+ else
18288
+ pgac_save_CFLAGS=$CFLAGS
18289
+ CFLAGS="$pgac_save_CFLAGS -mzarch -march=z13"
18290
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
18291
+ /* end confdefs.h. */
18292
+ #include <vecintrin.h>
18293
+ int
18294
+ main ()
18295
+ {
18296
+ unsigned long long a __attribute__((vector_size(16))) = { 0 };
18297
+ unsigned long long b __attribute__((vector_size(16))) = { 0 };
18298
+ unsigned char c __attribute__((vector_size(16))) = { 0 };
18299
+ c = vec_gfmsum_accum_128(a, b, c);
18300
+ return 0;
18301
+ ;
18302
+ return 0;
18303
+ }
18304
+ _ACEOF
18305
+ if ac_fn_c_try_link "$LINENO"; then :
18306
+ pgac_cv_s390x_vector_intrinsics__mzarch__march_z13=yes
18307
+ else
18308
+ pgac_cv_s390x_vector_intrinsics__mzarch__march_z13=no
18309
+ fi
18310
+ rm -f core conftest.err conftest.$ac_objext \
18311
+ conftest$ac_exeext conftest.$ac_ext
18312
+ CFLAGS="$pgac_save_CFLAGS"
18313
+ fi
18314
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_s390x_vector_intrinsics__mzarch__march_z13" >&5
18315
+ $as_echo "$pgac_cv_s390x_vector_intrinsics__mzarch__march_z13" >&6; }
18316
+ if test x"$pgac_cv_s390x_vector_intrinsics__mzarch__march_z13" = x"yes"; then
18317
+ CFLAGS_CRC="-mzarch -march=z13"
18318
+ pgac_s390x_vector_intrinsics__mzarch__march_z13=yes
18319
+ fi
18320
+
18321
+ fi
18322
+ fi
18323
+ fi
18324
+ fi
18325
+ fi
18326
+ fi
18327
+
18091
18328
18092
18329
18093
18330
# Select CRC-32C implementation.
@@ -18140,9 +18377,21 @@ if test x"$USE_SLICING_BY_8_CRC32C" = x"" && test x"$USE_SSE42_CRC32C" = x"" &&
18140
18377
if test x"$pgac_loongarch_crc32c_intrinsics" = x"yes"; then
18141
18378
USE_LOONGARCH_CRC32C=1
18142
18379
else
18143
- # fall back to slicing-by-8 algorithm, which doesn't require any
18144
- # special CPU support.
18145
- USE_SLICING_BY_8_CRC32C=1
18380
+ # Use S390X vector extension.
18381
+ if (test x"$pgac_s390x_vector_intrinsics__fzvector_" = x"yes" ||
18382
+ test x"$pgac_s390x_vector_intrinsics__mzarch_" = x"yes"); then
18383
+ USE_S390X_CRC32C=1
18384
+ else
18385
+ # Use S390X vector extension with runtime check.
18386
+ if test x"$pgac_s390x_vector_intrinsics__fzvector__march_z13" = x"yes" ||
18387
+ test x"$pgac_s390x_vector_intrinsics__mzarch__march_z13" = x"yes"; then
18388
+ USE_S390X_CRC32C_WITH_RUNTIME_CHECK=1
18389
+ else
18390
+ # fall back to slicing-by-8 algorithm, which doesn't require any
18391
+ # special CPU support.
18392
+ USE_SLICING_BY_8_CRC32C=1
18393
+ fi
18394
+ fi
18146
18395
fi
18147
18396
fi
18148
18397
fi
@@ -18193,12 +18442,30 @@ $as_echo "#define USE_LOONGARCH_CRC32C 1" >>confdefs.h
18193
18442
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: LoongArch CRCC instructions" >&5
18194
18443
$as_echo "LoongArch CRCC instructions" >&6; }
18195
18444
else
18445
+ if test x"$USE_S390X_CRC32C" = x"1"; then
18446
+
18447
+ $as_echo "#define USE_S390X_CRC32C 1" >>confdefs.h
18448
+
18449
+ PG_CRC32C_OBJS="pg_crc32c_s390x.o pg_crc32c_sb8.o"
18450
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: S390X Vector instructions for CRC" >&5
18451
+ $as_echo "S390X Vector instructions for CRC" >&6; }
18452
+ else
18453
+ if test x"$USE_S390X_CRC32C_WITH_RUNTIME_CHECK" = x"1"; then
18454
+
18455
+ $as_echo "#define USE_S390X_CRC32C_WITH_RUNTIME_CHECK 1" >>confdefs.h
18456
+
18457
+ PG_CRC32C_OBJS="pg_crc32c_s390x.o pg_crc32c_s390x_choose.o pg_crc32c_sb8.o"
18458
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: S390X Vector instructions for CRC with runtime check" >&5
18459
+ $as_echo "S390X Vector instructions for CRC with runtime check" >&6; }
18460
+ else
18196
18461
18197
18462
$as_echo "#define USE_SLICING_BY_8_CRC32C 1" >>confdefs.h
18198
18463
18199
- PG_CRC32C_OBJS="pg_crc32c_sb8.o"
18200
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: slicing-by-8" >&5
18464
+ PG_CRC32C_OBJS="pg_crc32c_sb8.o"
18465
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: slicing-by-8" >&5
18201
18466
$as_echo "slicing-by-8" >&6; }
18467
+ fi
18468
+ fi
18202
18469
fi
18203
18470
fi
18204
18471
fi
0 commit comments