[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:23:47 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;
----------------
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");
```


Repository:
  rC Clang

https://reviews.llvm.org/D42154





More information about the cfe-commits mailing list