[PATCH] D42154: Don't generate inline atomics for i386/i486
Craig Topper via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 16 18:28:37 PST 2018
craig.topper added inline comments.
================
Comment at: lib/Basic/Targets/X86.h:472
+ CPUKind Kind = getCPUKind(Opts.CPU);
+ if (Kind >= CK_i586 || Kind == CK_Generic)
+ MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64;
----------------
craig.topper wrote:
> efriedma wrote:
> > What exactly does "CK_Generic" mean here? Under what circumstances does it show up? We should have a specific default for every supported target, if user doesn't specify a CPU with -march.
> CK_Generic is the default for 32-bit mode with no -march. CK_x86_64 is the default for 64-bit mode with no march.
>
> I'm not sure we can assume CK_Generic is 586 or better. We don't assume that in the preprocessor defines.
>
> ```
> if (CPU >= CK_i486) {
> Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_1");
> Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_2");
> Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4");
> }
> if (CPU >= CK_i586)
> Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_8");
> if (HasCX16)
> Builder.defineMacro("__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16");
> ```
Maybe we don't default to "generic" anywhere. Its very platform specific. getX86TargetCPU in lib/Driver/ToolChains/Arch/X86.cpp contains the magic I think.
Repository:
rC Clang
https://reviews.llvm.org/D42154
More information about the cfe-commits
mailing list