[PATCH] D54062: [COFF, ARM64] Implement InterlockedCompareExchange*_* builtins

Mandeep Singh Grang via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 5 12:33:06 PST 2018


mgrang added inline comments.


================
Comment at: include/clang/Basic/BuiltinsARM.def:270
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_nf,  "LLiLLiD*LLiLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+TARGET_HEADER_BUILTIN(_InterlockedCompareExchange64_rel, "LLiLLiD*LLiLLi", "nh", "intrin.h", ALL_MS_LANGUAGES, "")
+
----------------
rnk wrote:
> Given how much duplication there is, I think we need to have some kind of BuiltinsMSVC.def that contains a list of all the interlocked builitin families, like this:
> ```
> INTERLOCKED_BUILTIN(_InterlockedCompareExchange)
> INTERLOCKED_BUILTIN(_InterlockedOr)
> INTERLOCKED_BUILTIN(_InterlockedAnd)
> ```
> We'd include this file here, with INTERLOCKED_BUILTIN defined as:
> ```
> #define INTERLOCKED_BUILTIN(Op) \
>   TARGET_HEADER_BUILTIN(Op##8_acq, "ccD*cc", "nh", "intrin.h", ALL_MS_LANGUAGES, "") \
>   TARGET_HEADER_BUILTIN(Op##8_nf, "ccD*cc", "nh", "intrin.h", ALL_MS_LANGUAGES, "") \
> ...
> ```
> That'll stamp out the enums that we need, and then we can reuse the .def file to reduce duplication in the switch/case below.
> 
> Every op is basically 16 operations: {8, 16, 32, 64} X {seq_cst, rel, acq, nf}
> 
> I'm not sure what to do about the ones that overlap with x86.
Thanks Reid. Yes, I think we can certainly cleanup further. That being said, can we get these patches committed first and then cleanup in a follow-up patch?


Repository:
  rC Clang

https://reviews.llvm.org/D54062





More information about the cfe-commits mailing list