[PATCH] D127189: [clang][AIX] Add option to control quadword lock free atomics ABI on AIX

ChenZheng via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 21 20:28:57 PDT 2022


shchenz added a comment.

Can we use the feature bit `FeatureQuadwordAtomic` to decide whether QuadAtomic is supported or not on AIX? Like what we do for Linux.

The reason we need this option is: we may need to compile a lock free libatomic on a Power7 or below target? If so, do we have similar issue on Linux? Thanks.



================
Comment at: clang/include/clang/Driver/Options.td:3611
   HelpText<"Enable the default Altivec ABI on AIX (AIX only). Uses only volatile vector registers.">;
+def maix_quadword_atomics : Flag<["-"], "maix64-quadword-atomics">,
+  Group<m_Group>, Flags<[CC1Option]>,
----------------
amyk wrote:
> Would it be better if we called this `maix64-quadword-atomics` instead? 
Do we need to change the backend check below too?
```
bool PPCTargetLowering::shouldInlineQuadwordAtomics() const {
  // TODO: 16-byte atomic type support for AIX is in progress; we should be able
  // to inline 16-byte atomic ops on AIX too in the future.
  return Subtarget.isPPC64() &&
         (EnableQuadwordAtomics || !Subtarget.getTargetTriple().isOSAIX()) &&
         Subtarget.hasQuadwordAtomics();
}
```


================
Comment at: clang/lib/Basic/Targets/PPC.cpp:854
+      HasQuadwordAtomics)
+    MaxAtomicInlineWidth = 128;
 }
----------------
Can we set `MaxAtomicInlineWidth` in `PPC64TargetInfo::setMaxAtomicWidth()`? There is a `TODO` there


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D127189/new/

https://reviews.llvm.org/D127189



More information about the cfe-commits mailing list