[PATCH] Make x86 Android default target CPUs compatible with GCC
Alexey Volkov
avolkov.intel at gmail.com
Thu Jan 30 04:04:05 PST 2014
Hi eugenis,
On x86 Android GCC has the following defaults:
32-bit: -march=i686 -msse3 -mfpmath=sse
64-bit: -march=x86-64 -msse3
In this patch I made the same default options for clang on Android.
http://llvm-reviews.chandlerc.com/D2655
Files:
lib/Driver/Tools.cpp
test/Driver/clang-translation.c
Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1223,10 +1223,9 @@
return Is64Bit ? "core2" : "yonah";
}
- // All x86 devices running Android have core2 as their common
- // denominator. This makes a better choice than pentium4.
+ // On Android use targets compatible with gcc
if (Triple.getEnvironment() == llvm::Triple::Android)
- return "core2";
+ return Is64Bit ? "x86-64" : "i686";
// Everything else goes to x86-64 in 64-bit mode.
if (Is64Bit)
@@ -1339,6 +1338,11 @@
Features.push_back("-fsgsbase");
}
+ if (Triple.getEnvironment() == llvm::Triple::Android) {
+ // Add sse3 feature to comply with gcc on Android
+ Features.push_back("+sse3");
+ }
+
// Now add any that the user explicitly requested on the command line,
// which may override the defaults.
for (arg_iterator it = Args.filtered_begin(options::OPT_m_x86_Features_Group),
Index: test/Driver/clang-translation.c
===================================================================
--- test/Driver/clang-translation.c
+++ test/Driver/clang-translation.c
@@ -210,13 +210,15 @@
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=ANDROID-X86 %s
// ANDROID-X86: clang
-// ANDROID-X86: "-target-cpu" "core2"
+// ANDROID-X86: "-target-cpu" "i686"
+// ANDROID-X86: "-target-feature" "+sse3"
// RUN: %clang -target x86_64-linux-android -### -S %s 2>&1 \
// RUN: --sysroot=%S/Inputs/basic_android_tree/sysroot \
// RUN: | FileCheck --check-prefix=ANDROID-X86_64 %s
// ANDROID-X86_64: clang
-// ANDROID-X86_64: "-target-cpu" "core2"
+// ANDROID-X86_64: "-target-cpu" "x86-64"
+// ANDROID-X86_64: "-target-feature" "+sse3"
// RUN: %clang -target mips-linux-gnu -### -S %s 2>&1 | \
// RUN: FileCheck -check-prefix=MIPS %s
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D2655.1.patch
Type: text/x-patch
Size: 1907 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140130/c737d546/attachment.bin>
More information about the cfe-commits
mailing list