[PATCH] D122789: [compiler-rt] [scudo] Use -mcrc32 on x86 when available
H.J Lu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 14 08:31:33 PDT 2022
hjl.tools added a comment.
In D122789#3447413 <https://reviews.llvm.org/D122789#3447413>, @pengfei wrote:
> In D122789#3446865 <https://reviews.llvm.org/D122789#3446865>, @MaskRay wrote:
>
>> To kurly (original Gentoo reporter):
>>
>> printf '#include <smmintrin.h>\n#include <stdint.h>\nuint32_t computeHardwareCRC32(uint32_t Crc, uint32_t Data) { return _mm_crc32_u32(Crc, Data); }' > a.c
>>
>>
>>
>> % clang -m32 -march=i686 -msse4.2 -c a.c # seems to compile fine
>> % gcc -m32 -march=i686 -msse4.2 -c a.c
>> % gcc -m32 -march=i686 -mcrc32 -c a.c
>> In file included from a.c:1:
>> a.c: In function ‘computeHardwareCRC32’:
>> /usr/lib/gcc/x86_64-linux-gnu/11/include/smmintrin.h:839:1: error: inlining failed in call to ‘always_inline’ ‘_mm_crc32_u32’: target specific option mismatch
>> 839 | _mm_crc32_u32 (unsigned int __C, unsigned int __V)
>> | ^~~~~~~~~~~~~
>> a.c:3:69: note: called from here
>> 3 | uint32_t computeHardwareCRC32(uint32_t Crc, uint32_t Data) { return _mm_crc32_u32(Crc, Data); }
>> | ^~~~~~~~~~~~~~~~~~~~~~~~
>>
>> I have some older GCC and latest GCC (2022-04, multilib), `gcc -m32 -march=i686 -msse4.2 -c a.c` builds while `-mcrc32` doesn't.
>>
>> I suspect we should revert the `-mcrc32` change. The `__CRC32__` macro may be fine.
>
> Thanks for the infromation. I got the same result. That's weird. I believe at some point, GCC supported `-mcrc32`. @hjl.tools, did GCC intentionally remove the support for `-mcrc32`?
"gcc -m32 -march=i686 -mcrc32" works with GCC 11.2: https://godbolt.org/z/nWzoofeKs
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122789/new/
https://reviews.llvm.org/D122789
More information about the cfe-commits
mailing list