Skip to content

Commit f83f148

Browse files
committed
Workaround code generation bug in clang
At optimization level -O0, builds on recent clang fail to produce the correct CRC32C with our AVX-512 implementation. For now, just disable the runtime check for clang at -O0. When this is fixed upstream and we know the extent of the breakage, we can adjust to be version-specific. Reported-by: Soumyadeep Chakraborty <soumyadeep2007@gmail.com> Reported-by: Andy Fan <zhihuifan1213@163.com> Tested-by: Andy Fan <zhihuifan1213@163.com> Discussion: https://postgr.es/m/CAE-ML%2B-OV6p9uvCFBcSQjZUEh__y0h-KjN%2BBseyGJHt7u8EP%2Bw%40mail.gmail.com Discussion: https://postgr.es/m/87o6uqd3iv.fsf%40163.com
1 parent fd385c4 commit f83f148

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/port/pg_crc32c_sse42_choose.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,9 @@ pg_comp_crc32c_choose(pg_crc32c crc, const void *data, size_t len)
9595
__cpuidex(exx, 7, 0);
9696
#endif
9797

98-
#ifdef USE_AVX512_CRC32C_WITH_RUNTIME_CHECK
98+
#if defined(__clang__) && !defined(__OPTIMIZE__)
99+
/* Some versions of clang are broken at -O0 */
100+
#elif defined(USE_AVX512_CRC32C_WITH_RUNTIME_CHECK)
99101
if (exx[2] & (1 << 10) && /* VPCLMULQDQ */
100102
exx[1] & (1 << 31)) /* AVX512-VL */
101103
pg_comp_crc32c = pg_comp_crc32c_avx512;

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy