Merge "Add support for x86 to hello-neon sample"
diff --git a/ndk/samples/hello-neon/jni/Android.mk b/ndk/samples/hello-neon/jni/Android.mk
index 685b01b..eeaae96 100644
--- a/ndk/samples/hello-neon/jni/Android.mk
+++ b/ndk/samples/hello-neon/jni/Android.mk
@@ -6,8 +6,11 @@
 
 LOCAL_SRC_FILES := helloneon.c
 
-ifeq ($(TARGET_ARCH_ABI),armeabi-v7a)
+ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI), armeabi-v7a x86))
     LOCAL_CFLAGS := -DHAVE_NEON=1
+ifeq ($(TARGET_ARCH_ABI),x86)
+    LOCAL_CFLAGS += -mssse3
+endif
     LOCAL_SRC_FILES += helloneon-intrinsics.c.neon
 endif
 
diff --git a/ndk/samples/hello-neon/jni/Application.mk b/ndk/samples/hello-neon/jni/Application.mk
index 6e8154b..7985a68 100644
--- a/ndk/samples/hello-neon/jni/Application.mk
+++ b/ndk/samples/hello-neon/jni/Application.mk
@@ -1,2 +1 @@
-# Build both ARMv5TE and ARMv7-A machine code.
-APP_ABI := armeabi armeabi-v7a arm64-v8a
+APP_ABI := armeabi armeabi-v7a arm64-v8a x86
diff --git a/ndk/samples/hello-neon/jni/helloneon.c b/ndk/samples/hello-neon/jni/helloneon.c
index ee19e08..6d22c14 100644
--- a/ndk/samples/hello-neon/jni/helloneon.c
+++ b/ndk/samples/hello-neon/jni/helloneon.c
@@ -81,6 +81,7 @@
                                                jobject thiz )
 {
     char*  str;
+    AndroidCpuFamily family;
     uint64_t features;
     char buffer[512];
     char tryNeon = 0;
@@ -112,20 +113,27 @@
 
     strlcat(buffer, "Neon version   : ", sizeof buffer);
 
-    if (android_getCpuFamily() != ANDROID_CPU_FAMILY_ARM) {
-        strlcat(buffer, "Not an ARM CPU !\n", sizeof buffer);
+    family = android_getCpuFamily();
+    if ((family != ANDROID_CPU_FAMILY_ARM) &&
+        (family != ANDROID_CPU_FAMILY_X86))
+    {
+        strlcat(buffer, "Not an ARM and not an X86 CPU !\n", sizeof buffer);
         goto EXIT;
     }
 
     features = android_getCpuFeatures();
-    if ((features & ANDROID_CPU_ARM_FEATURE_ARMv7) == 0) {
-        strlcat(buffer, "Not an ARMv7 CPU !\n", sizeof buffer);
+    if (((features & ANDROID_CPU_ARM_FEATURE_ARMv7) == 0) &&
+        ((features & ANDROID_CPU_X86_FEATURE_SSSE3) == 0))
+    {
+        strlcat(buffer, "Not an ARMv7 and not an X86 SSSE3 CPU !\n", sizeof buffer);
         goto EXIT;
     }
 
     /* HAVE_NEON is defined in Android.mk ! */
 #ifdef HAVE_NEON
-    if ((features & ANDROID_CPU_ARM_FEATURE_NEON) == 0) {
+    if (((features & ANDROID_CPU_ARM_FEATURE_NEON) == 0) &&
+        ((features & ANDROID_CPU_X86_FEATURE_SSSE3) == 0))
+    {
         strlcat(buffer, "CPU doesn't support NEON !\n", sizeof buffer);
         goto EXIT;
     }