[PATCH] D105462: [X86] Add CRC32 feature.
H.J Lu via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jul 6 08:19:21 PDT 2021
hjl.tools added inline comments.
================
Comment at: llvm/lib/Target/X86/X86.td:84
"Enable SSE 4.2 instructions",
- [FeatureSSE41]>;
+ [FeatureSSE41, FeatureCRC32]>;
// The MMX subtarget feature is separate from the rest of the SSE features
----------------
craig.topper wrote:
> hjl.tools wrote:
> > craig.topper wrote:
> > > tianqing wrote:
> > > > craig.topper wrote:
> > > > > Doesn't this make -mno-crc32 disable sse4.2? Is that what we want?
> > > > >
> > > > > Or should we be doing this like popcnt where we loosely enable it at the end of X86TargetInfo::initFeatureMap
> > > > It does. But it's not a big deal in this case. The scenario described in the commit message doesn't require crc32 capable to be disabled separately.
> > > What does gcc do?
> > ```
> > [hjl at gnu-skx-1 gcc]$ cat /tmp/x.c
> > #include <x86intrin.h>
> >
> > int
> > foo (int x, char c)
> > {
> > return __crc32b (x, c);
> > }
> > [hjl at gnu-skx-1 gcc]$ /usr/gcc-12.0.0-x32/bin/gcc -S -O2 /tmp/x.c -S -msse4.2
> > [hjl at gnu-skx-1 gcc]$ /usr/gcc-12.0.0-x32/bin/gcc -S -O2 /tmp/x.c -S -mcrc32
> > [hjl at gnu-skx-1 gcc]$ /usr/gcc-12.0.0-x32/bin/gcc -S -O2 /tmp/x.c -S -msse4.2 -mno-crc32
> > In file included from /usr/gcc-12.0.0-x32/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include/x86gprintrin.h:27,
> > from /usr/gcc-12.0.0-x32/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include/x86intrin.h:27,
> > from /tmp/x.c:1:
> > /tmp/x.c: In function ??foo??:
> > /usr/gcc-12.0.0-x32/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include/ia32intrin.h:63:1: error: inlining failed in call to ??always_inline?? ??__crc32b??: target specific option mismatch
> > 63 | __crc32b (unsigned int __C, unsigned char __V)
> > | ^~~~~~~~
> > /tmp/x.c:6:10: note: called from here
> > 6 | return __crc32b (x, c);
> > | ^~~~~~~~~~~~~~~
> > [hjl at gnu-skx-1 gcc]$
> > ```
> What does gcc do for an sse4.2 intrinsic that isn't crc32 with "-msse4.2 -mno-crc32"?
-mno-crc32 has no impact on non-crc32 intrinsics.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D105462/new/
https://reviews.llvm.org/D105462
More information about the cfe-commits
mailing list