From: Saleem Abdulrasool Date: Tue, 25 Jun 2019 21:43:34 +0000 (+0000) Subject: android: enable double-word CAS on x64 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=d3f9eac03b57df52b2b096a70e38082c9e989c88;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@364352 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Driver/ToolChains/Arch/X86.cpp b/lib/Driver/ToolChains/Arch/X86.cpp index a6606fd078..2e75039bf0 100644 --- a/lib/Driver/ToolChains/Arch/X86.cpp +++ b/lib/Driver/ToolChains/Arch/X86.cpp @@ -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"); } diff --git a/test/Driver/clang-translation.c b/test/Driver/clang-translation.c index 25a54036b7..0054535115 100644 --- a/test/Driver/clang-translation.c +++ b/test/Driver/clang-translation.c @@ -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