diff options
author | John Naylor <john.naylor@postgresql.org> | 2022-08-29 17:25:59 +0700 |
---|---|---|
committer | John Naylor <john.naylor@postgresql.org> | 2022-08-29 17:44:35 +0700 |
commit | c6a43c25a8ba1a825588f7af25a7173f2e66ce8d (patch) | |
tree | 38f905124f4ad8aed3fabe82457868a6d55af66a /src/include/port/simd.h | |
parent | 82739d4a80f2eeb2f96b56477bb04e463ea24800 (diff) | |
download | postgresql-c6a43c25a8ba1a825588f7af25a7173f2e66ce8d.tar.gz postgresql-c6a43c25a8ba1a825588f7af25a7173f2e66ce8d.zip |
Fix broken cast on MSVC
Per buildfarm animal drongo, casting a vector type to the same type
causes a compile error. We still need the cast on ARM64, so invent a
wrapper function that does the casting only where necessary.
Discussion: https://www.postgresql.org/message-id/CAFBsxsEouaTwbmpqV%2BEW2%3DwFbhw2vHRe26NQTRcd0%3DNaOFDy7A%40mail.gmail.com
Diffstat (limited to 'src/include/port/simd.h')
-rw-r--r-- | src/include/port/simd.h | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/src/include/port/simd.h b/src/include/port/simd.h index b538ac070f7..0ff1549083a 100644 --- a/src/include/port/simd.h +++ b/src/include/port/simd.h @@ -275,6 +275,28 @@ vector8_is_highbit_set(const Vector8 v) } /* + * Exactly like vector32_is_highbit_set except for the input type, so it + * looks at each byte separately. + * + * XXX x86 uses the same underlying type for 8-bit, 16-bit, and 32-bit + * integer elements, but Arm does not, hence the need for a separate + * function. We could instead adopt the behavior of Arm's vmaxvq_u32(), i.e. + * check each 32-bit element, but that would require an additional mask + * operation on x86. + */ +#ifndef USE_NO_SIMD +static inline bool +vector32_is_highbit_set(const Vector32 v) +{ +#if defined(USE_NEON) + return vector8_is_highbit_set((Vector8) v); +#else + return vector8_is_highbit_set(v); +#endif +} +#endif /* ! USE_NO_SIMD */ + +/* * Return the bitwise OR of the inputs */ static inline Vector8 |