summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2019-06-25 21:43:34 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2019-06-25 21:43:34 +0000
commitc32d307a49f5255602e7543e64e6c38a7f536abc (patch)
treeecb2cebdebc9b7ac9f12e781fc91ac962769328a
parentc8e450a9179cf699133a8f00ea3b08808b7a4c38 (diff)
downloadbcm5719-llvm-c32d307a49f5255602e7543e64e6c38a7f536abc.tar.gz
bcm5719-llvm-c32d307a49f5255602e7543e64e6c38a7f536abc.zip
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. llvm-svn: 364352
-rw-r--r--clang/lib/Driver/ToolChains/Arch/X86.cpp1
-rw-r--r--clang/test/Driver/clang-translation.c1
2 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains/Arch/X86.cpp b/clang/lib/Driver/ToolChains/Arch/X86.cpp
index a6606fd078e..2e75039bf0d 100644
--- a/clang/lib/Driver/ToolChains/Arch/X86.cpp
+++ b/clang/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/clang/test/Driver/clang-translation.c b/clang/test/Driver/clang-translation.c
index 25a54036b7e..0054535115a 100644
--- a/clang/test/Driver/clang-translation.c
+++ b/clang/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
OpenPOWER on IntegriCloud