NDK에서는 ARMv7 및 ARMv8용 선택적 명령 집합 확장인 ARM 고급 SIMD(통칭 Neon)를 지원합니다. NEON은 x86의 MMX/SSE/3DNow!와 유사한 스칼라/벡터 명령 및 레지스터(FPU와 공유)를 제공합니다.
모든 ARMv8 기반 ('arm64') Android 기기는 Neon을 지원합니다. API 수준 21 이상으로 출시된 모든 기기를 포함하여 거의 모든 ARMv7 기반('32비트') Android 기기에서는 Neon을 지원합니다. NDK는 두 Arm ABI 모두에 대해 기본적으로 Neon을 사용 설정합니다.
매우 오래된 기기를 타겟팅하는 경우 Google Play Console에서 호환되지 않는 기기를 필터링할 수 있습니다. 앱의 콘솔을 사용하여 얼마나 많은 기기가 영향을 받는지 확인할 수도 있습니다.
또는 호환성을 최대화하기 위해 32비트 코드는 런타임 검색을 실행하여 Neon 코드가 대상 기기에서 실행되는지 확인할 수 있습니다. 앱은 CPU 기능에 언급된 옵션을 사용하여 이 확인을 실행할 수 있습니다.
C/C++ 코드에 명시적 Neon 내장 함수를 작성해서는 안 됩니다. Clang의 이식 가능한 벡터 유형은 Neon 명령어를 자동으로 사용합니다. Clang의 Neon 내장 함수는 실제로 이식 가능한 유형을 래핑하는 이식 불가능한 래퍼일 뿐이므로 Neon 내장 함수를 작성해도 이식 가능한 유형을 사용하는 것보다 코드가 더 빨라지지는 않으며 이식성이 떨어질 뿐입니다.
빌드
전역으로 Neon 사용 중지
ndk-build
ndk-build는 Neo 전역 사용 중지를 지원하지 않습니다. Neon을 전체 ndk-build 애플리케이션에 사용 중지하려면 애플리케이션의 모든 모듈에 모듈별 단계를 적용하세요.
CMake
CMake를 호출할 때 -DANDROID_ARM_NEON=ON를 전달합니다. Android 스튜디오/Gradle로 빌드한다면 build.gradle에서 다음 옵션을 설정합니다.
벡터화 샘플에서는 다양한 벡터화 도구를 사용하여 행렬 곱셈을 구현하는 방법을 보여주고 성능을 비교합니다.
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-25(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-08-25(UTC)"],[],[],null,["# Neon support\n\nThe NDK supports ARM Advanced SIMD, commonly known as Neon, an optional\ninstruction set extension for ARMv7 and ARMv8. Neon provides scalar/vector\ninstructions and registers (shared with the FPU) comparable to MMX/SSE/3DNow!\nin the x86 world.\n\nAll ARMv8-based (\"arm64\") Android devices support Neon. Almost all ARMv7-based\n(\"32-bit\") Android devices support Neon, including all devices that shipped with\nAPI level 21 or later. The NDK enables Neon by default for both Arm ABIs.\n\nIf you target very old devices, you can filter out incompatible devices on the\nGoogle Play Console. You can also use the console for your app to see how many\ndevices this would affect.\n\nAlternatively, for maximum compatibility, 32-bit code can perform runtime\ndetection to confirm that Neon code can be run on the target device. An app can\nperform this check using any of the options mentioned in\n[CPU features](/ndk/guides/cpu-features).\n\nYou should not write explicit Neon intrinsics in your C/C++ code. Clang's\n[portable vector types](https://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors) will automatically use Neon instructions. Clang's Neon\nintrinsics are actually just a non-portable wrapper around the portable types,\nso writing Neon intrinsics will not make your code any faster than using the\nportable types, just less portable.\n\nBuild\n-----\n\n| **Note:** For NDK r21 and newer Neon is enabled by default for all API levels. If you need to disable Neon to support non-Neon devices (which are rare), invert the settings described below. Alternatively, the Play Store console can be used to [exclude CPUs](https://support.google.com/googleplay/android-developer/answer/7353455) that do not support Neon to prevent your application from being installed on those devices.\n\nDisable Neon globally\n---------------------\n\n### ndk-build\n\nndk-build does not support disabling Neon globally. To disable Neon an entire\nndk-build application, apply the per-module steps to every module in your\napplication.\n\n### CMake\n\nPass `-DANDROID_ARM_NEON=ON` when invoking CMake. If building with Android\nStudio/Gradle, set the following option in your build.gradle: \n\n android {\n defaultConfig {\n externalNativeBuild {\n cmake {\n arguments \"-DANDROID_ARM_NEON=OFF\"\n }\n }\n }\n }\n\nDisable Neon per module\n-----------------------\n\n### ndk-build\n\nTo build all the source files in an ndk-build module without Neon, add the\nfollowing to the module definition in your Android.mk: \n\n LOCAL_ARM_NEON := false\n\n### CMake\n\nTo build all the source files in a CMake target without Neon, add the\nfollowing to your CMakeLists.txt: \n\n if(ANDROID_ABI STREQUAL armeabi-v7a)\n set_target_properties(${TARGET} PROPERTIES COMPILE_FLAGS -mfpu=vfpv3-d16)\n endif()\n\nWhere `${TARGET}` is replaced with the name of your library.\n\nCross-platform support for x86\n------------------------------\n\n\nNDK supports cross-platform compilation of your existing ARM SIMD (Neon)\ninstrinsic functions into x86 SSE code, through the use of the third-party\n[NEON_2_SSE.h](https://github.com/intel/ARM_NEON_2_x86_SSE).\nFor more information on this topic, see\n[From ARM NEON to Intel SSE-the automatic porting solution, tips and tricks](http://software.intel.com/en-us/blogs/2012/12/12/from-arm-neon-to-intel-mmxsse-automatic-porting-solution-tips-and-tricks).\n\nSample code\n-----------\n\nThe [vectorization sample](https://github.com/android/ndk-samples/tree/main/vectorization) demonstrates how to use a variety of vectorization\ntools to implement a matrix multiply, and compares their performance."]]