mirror of
https://github.com/postgres/postgres.git
synced 2025-06-27 23:21:58 +03:00
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
This commit is contained in:
@ -95,7 +95,9 @@ pg_comp_crc32c_choose(pg_crc32c crc, const void *data, size_t len)
|
||||
__cpuidex(exx, 7, 0);
|
||||
#endif
|
||||
|
||||
#ifdef USE_AVX512_CRC32C_WITH_RUNTIME_CHECK
|
||||
#if defined(__clang__) && !defined(__OPTIMIZE__)
|
||||
/* Some versions of clang are broken at -O0 */
|
||||
#elif defined(USE_AVX512_CRC32C_WITH_RUNTIME_CHECK)
|
||||
if (exx[2] & (1 << 10) && /* VPCLMULQDQ */
|
||||
exx[1] & (1 << 31)) /* AVX512-VL */
|
||||
pg_comp_crc32c = pg_comp_crc32c_avx512;
|
||||
|
Reference in New Issue
Block a user