From f6f6a10da19201936e3b9636fd97f695b782774f Mon Sep 17 00:00:00 2001 From: nfynt Date: Sat, 6 Apr 2024 14:46:03 +0100 Subject: [PATCH 1/3] * added test support for arm64-v8a architecture (which should've supported by default) --- hello-neon/app/build.gradle | 2 +- hello-neon/app/src/main/cpp/CMakeLists.txt | 3 ++- hello-neon/app/src/main/cpp/helloneon.c | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/hello-neon/app/build.gradle b/hello-neon/app/build.gradle index 4237b3219..e108c3dba 100644 --- a/hello-neon/app/build.gradle +++ b/hello-neon/app/build.gradle @@ -12,7 +12,7 @@ android { targetSdkVersion 33 versionCode 1 versionName "1.0" - ndk.abiFilters 'x86', 'x86_64', 'armeabi-v7a' + ndk.abiFilters 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' } buildTypes { release { diff --git a/hello-neon/app/src/main/cpp/CMakeLists.txt b/hello-neon/app/src/main/cpp/CMakeLists.txt index 10077c8f0..c2de1aab4 100644 --- a/hello-neon/app/src/main/cpp/CMakeLists.txt +++ b/hello-neon/app/src/main/cpp/CMakeLists.txt @@ -28,7 +28,8 @@ elseif (${ANDROID_ABI} STREQUAL "x86") -Wno-static-in-inline") add_definitions(-DHAVE_NEON_X86=1 -DHAVE_NEON=1) else () - set(neon_SRCS) + set(neon_SRCS helloneon-intrinsics.c) + add_definitions("-DHAVE_NEON=1") endif () add_library(hello-neon SHARED helloneon.c ${neon_SRCS}) diff --git a/hello-neon/app/src/main/cpp/helloneon.c b/hello-neon/app/src/main/cpp/helloneon.c index fe4b8d36f..6d1e8e3d6 100644 --- a/hello-neon/app/src/main/cpp/helloneon.c +++ b/hello-neon/app/src/main/cpp/helloneon.c @@ -114,7 +114,7 @@ jstring Java_com_example_helloneon_HelloNeon_stringFromJNI(JNIEnv* env, strlcat(buffer, "Neon version : ", sizeof buffer); family = android_getCpuFamily(); - if ((family != ANDROID_CPU_FAMILY_ARM) && + if ((family != ANDROID_CPU_FAMILY_ARM) && (family!=ANDROID_CPU_FAMILY_ARM64) && (family != ANDROID_CPU_FAMILY_X86)) { strlcat(buffer, "Not an ARM and not an X86 CPU !\n", sizeof buffer); goto EXIT; From b572aa5bed2eb83738705eec4ae9ff3d475644f5 Mon Sep 17 00:00:00 2001 From: nfynt Date: Sat, 20 Apr 2024 14:41:23 +0100 Subject: [PATCH 2/3] * removed android cpu family check as it should be supported across all arches now. --- hello-neon/app/src/main/cpp/helloneon.c | 7 ------- 1 file changed, 7 deletions(-) diff --git a/hello-neon/app/src/main/cpp/helloneon.c b/hello-neon/app/src/main/cpp/helloneon.c index 6d1e8e3d6..86888f1c9 100644 --- a/hello-neon/app/src/main/cpp/helloneon.c +++ b/hello-neon/app/src/main/cpp/helloneon.c @@ -113,13 +113,6 @@ jstring Java_com_example_helloneon_HelloNeon_stringFromJNI(JNIEnv* env, strlcat(buffer, "Neon version : ", sizeof buffer); - family = android_getCpuFamily(); - if ((family != ANDROID_CPU_FAMILY_ARM) && (family!=ANDROID_CPU_FAMILY_ARM64) && - (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) && ((features & ANDROID_CPU_X86_FEATURE_SSSE3) == 0)) { From f750d87208580f2c0013aaeb3dd8b2d6aa14d393 Mon Sep 17 00:00:00 2001 From: Dan Albert Date: Fri, 3 May 2024 13:24:43 -0700 Subject: [PATCH 3/3] Fix build for x86_64. --- hello-neon/app/src/main/cpp/CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hello-neon/app/src/main/cpp/CMakeLists.txt b/hello-neon/app/src/main/cpp/CMakeLists.txt index c2de1aab4..0b1c5c495 100644 --- a/hello-neon/app/src/main/cpp/CMakeLists.txt +++ b/hello-neon/app/src/main/cpp/CMakeLists.txt @@ -27,6 +27,9 @@ elseif (${ANDROID_ABI} STREQUAL "x86") -Wno-constant-conversion \ -Wno-static-in-inline") add_definitions(-DHAVE_NEON_X86=1 -DHAVE_NEON=1) +elseif (${ANDROID_ABI} STREQUAL "x86_64") + set(neon_SRCS helloneon-intrinsics.c) + add_definitions(-DHAVE_NEON_X86=1 -DHAVE_NEON=1) else () set(neon_SRCS helloneon-intrinsics.c) add_definitions("-DHAVE_NEON=1")