[PATCH] Align with new GCC options for x86 Android

Alexey Volkov avolkov.intel at gmail.com
Wed Jun 25 05:11:26 PDT 2014


Hi eugenis,

GCC default options for x86 Android were recently changed:
32-bit: replace -msse3 by -mssse3
64-bit: setup default options as -msse4.2 -mpopcnt
This patch adds these features for Android target.

http://reviews.llvm.org/D4287

Files:
  lib/Driver/Tools.cpp
  test/Driver/clang-translation.c

Index: lib/Driver/Tools.cpp
===================================================================
--- lib/Driver/Tools.cpp
+++ lib/Driver/Tools.cpp
@@ -1426,9 +1426,13 @@
     Features.push_back("-fsgsbase");
   }
 
+  // Add features to comply with gcc on Android
   if (Triple.getEnvironment() == llvm::Triple::Android) {
-    // Add sse3 feature to comply with gcc on Android
-    Features.push_back("+sse3");
+    if (Triple.getArch() == llvm::Triple::x86_64) {
+      Features.push_back("+sse4.2");
+      Features.push_back("+popcnt");
+    } else
+      Features.push_back("+ssse3");
   }
 
   // Now add any that the user explicitly requested on the command line,
Index: test/Driver/clang-translation.c
===================================================================
--- test/Driver/clang-translation.c
+++ test/Driver/clang-translation.c
@@ -211,14 +211,15 @@
 // RUN:   | FileCheck --check-prefix=ANDROID-X86 %s
 // ANDROID-X86: clang
 // ANDROID-X86: "-target-cpu" "i686"
-// ANDROID-X86: "-target-feature" "+sse3"
+// ANDROID-X86: "-target-feature" "+ssse3"
 
 // 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" "x86-64"
-// ANDROID-X86_64: "-target-feature" "+sse3"
+// ANDROID-X86_64: "-target-feature" "+sse4.2"
+// ANDROID-X86_64: "-target-feature" "+popcnt"
 
 // 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: D4287.10825.patch
Type: text/x-patch
Size: 1571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20140625/7228d931/attachment.bin>


More information about the cfe-commits mailing list