Nathan Bossart <nathandbossart@gmail.com> writes:
> On Mon, Jun 23, 2025 at 11:10:45AM -0400, Tom Lane wrote:
>> I was imagining just including _mm512_zextsi128_si512() in the
>> code being tested during configure, so that we fall back to
>> the non-AVX-512 code if the compiler is too old to have it.
>> I don't really feel a need to work harder than that.
> Sorry, my note wasn't clear. Right now, the configure test uses
> _mm512_castsi512_si128(), so we can't just do a simple s/cast/zext. We'll
> need to make a slightly bigger modification to the test to make sure the
> zext intrinsics are understood. I agree that we needn't work any harder
> than that.
The code still uses _mm512_castsi512_si128, so I think removing it
from the configure snippet might not be bright. I adapted what's
there now to get the attached, which builds successfully on my old
compiler. I still need to check it on a newer compiler.
regards, tom lane
diff --git a/config/c-compiler.m4 b/config/c-compiler.m4
index 5f3e1d1faf9..da40bd6a647 100644
--- a/config/c-compiler.m4
+++ b/config/c-compiler.m4
@@ -602,6 +602,7 @@ AC_CACHE_CHECK([for _mm512_clmulepi64_epi128], [Ac_cachevar],
{
__m128i z;
+ x = _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0)), x);
y = _mm512_clmulepi64_epi128(x, y, 0);
z = _mm_ternarylogic_epi64(
_mm512_castsi512_si128(y),
diff --git a/configure b/configure
index 4f15347cc95..3d3d3db97a4 100755
--- a/configure
+++ b/configure
@@ -18227,6 +18227,7 @@ else
{
__m128i z;
+ x = _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0)), x);
y = _mm512_clmulepi64_epi128(x, y, 0);
z = _mm_ternarylogic_epi64(
_mm512_castsi512_si128(y),
diff --git a/meson.build b/meson.build
index 474763ad19f..6ffe7b47275 100644
--- a/meson.build
+++ b/meson.build
@@ -2465,6 +2465,7 @@ int main(void)
{
__m128i z;
+ x = _mm512_xor_si512(_mm512_zextsi128_si512(_mm_cvtsi32_si128(0)), x);
y = _mm512_clmulepi64_epi128(x, y, 0);
z = _mm_ternarylogic_epi64(
_mm512_castsi512_si128(y),