[PATCH] D63774: android: enable double-word CAS on x86_64

Saleem Abdulrasool via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 25 08:54:12 PDT 2019


compnerd created this revision.
compnerd added reviewers: craig.topper, srhines.
Herald added a subscriber: jfb.
Herald added a project: clang.

The android target assumes that for the x86_64 target, the CPU supports SSE4.2 and `popcnt`.  This implies that the CPU is Nehalem or newer.  This should be sufficiently new to provide the double word compare and exchange instruction.  This allows us to directly lower `__sync_val_compare_and_swap_16` to a `cmpxchg16b`.  It appears that the libatomic in android's NDK does not provide the implementation for lowering calls to the library function.


Repository:
  rC Clang

https://reviews.llvm.org/D63774

Files:
  lib/Driver/ToolChains/Arch/X86.cpp


Index: lib/Driver/ToolChains/Arch/X86.cpp
===================================================================
--- lib/Driver/ToolChains/Arch/X86.cpp
+++ lib/Driver/ToolChains/Arch/X86.cpp
@@ -135,6 +135,7 @@
     if (ArchType == llvm::Triple::x86_64) {
       Features.push_back("+sse4.2");
       Features.push_back("+popcnt");
+      Features.push_back("+mcx16");
     } else
       Features.push_back("+ssse3");
   }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D63774.206461.patch
Type: text/x-patch
Size: 420 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20190625/9dd6adc1/attachment.bin>


More information about the cfe-commits mailing list