r364352 - android: enable double-word CAS on x64

Saleem Abdulrasool via cfe-commits cfe-commits at lists.llvm.org
Tue Jun 25 14:43:35 PDT 2019


Author: compnerd
Date: Tue Jun 25 14:43:34 2019
New Revision: 364352

URL: http://llvm.org/viewvc/llvm-project?rev=364352&view=rev
Log:
android: enable double-word CAS on x64

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.

Modified:
    cfe/trunk/lib/Driver/ToolChains/Arch/X86.cpp
    cfe/trunk/test/Driver/clang-translation.c

Modified: cfe/trunk/lib/Driver/ToolChains/Arch/X86.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains/Arch/X86.cpp?rev=364352&r1=364351&r2=364352&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains/Arch/X86.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains/Arch/X86.cpp Tue Jun 25 14:43:34 2019
@@ -135,6 +135,7 @@ void x86::getX86TargetFeatures(const Dri
     if (ArchType == llvm::Triple::x86_64) {
       Features.push_back("+sse4.2");
       Features.push_back("+popcnt");
+      Features.push_back("+mcx16");
     } else
       Features.push_back("+ssse3");
   }

Modified: cfe/trunk/test/Driver/clang-translation.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-translation.c?rev=364352&r1=364351&r2=364352&view=diff
==============================================================================
--- cfe/trunk/test/Driver/clang-translation.c (original)
+++ cfe/trunk/test/Driver/clang-translation.c Tue Jun 25 14:43:34 2019
@@ -318,6 +318,7 @@
 // ANDROID-X86_64: "-target-cpu" "x86-64"
 // ANDROID-X86_64: "-target-feature" "+sse4.2"
 // ANDROID-X86_64: "-target-feature" "+popcnt"
+// ANDROID-X86_64: "-target-feature" "+mcx16"
 
 // RUN: %clang -target mips-linux-gnu -### -S %s 2>&1 | \
 // RUN: FileCheck -check-prefix=MIPS %s




More information about the cfe-commits mailing list