]> granicus.if.org Git - clang/commitdiff
android: enable double-word CAS on x64
authorSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 25 Jun 2019 21:43:34 +0000 (21:43 +0000)
committerSaleem Abdulrasool <compnerd@compnerd.org>
Tue, 25 Jun 2019 21:43:34 +0000 (21:43 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364352 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Driver/ToolChains/Arch/X86.cpp
test/Driver/clang-translation.c

index a6606fd078e76bfd609826e3b613877597cdd764..2e75039bf0d65e08bc8ef28252b26bfdde5afea0 100644 (file)
@@ -135,6 +135,7 @@ void x86::getX86TargetFeatures(const Driver &D, const llvm::Triple &Triple,
     if (ArchType == llvm::Triple::x86_64) {
       Features.push_back("+sse4.2");
       Features.push_back("+popcnt");
+      Features.push_back("+mcx16");
     } else
       Features.push_back("+ssse3");
   }
index 25a54036b7e5b5ff08916cd0ffb3185457220347..0054535115aad64ea6e6b42df6d3f33504d49f6d 100644 (file)
 // 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