تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
يتوافق NDK مع ARM Advanced SIMD، المعروف باسم Neon، وهو إضافة اختيارية لمجموعة التعليمات الخاصة بمعالجات ARMv7 وARMv8. توفّر Neon تعليمات ومسجّلات عددية/متجهة (مشتركة مع وحدة الفاصلة العائمة) مماثلة لـ MMX/SSE/3DNow! في عالم x86.
تتوافق جميع أجهزة Android المستندة إلى ARMv8 ("arm64") مع Neon. تتوافق جميع أجهزة Android المستندة إلى ARMv7 ("32 بت") تقريبًا مع Neon، بما في ذلك جميع الأجهزة التي تم شحنها مع المستوى 21 من واجهة برمجة التطبيقات أو مستوى أحدث. يتيح NDK استخدام Neon تلقائيًا لكلا واجهتَي التطبيق الثنائية (ABI) المستندتَين إلى Arm.
إذا كنت تستهدف أجهزة قديمة جدًا، يمكنك فلترة الأجهزة غير المتوافقة على Google Play Console. يمكنك أيضًا استخدام وحدة التحكّم الخاصة بتطبيقك لمعرفة عدد الأجهزة التي سيتأثر بها هذا التغيير.
بدلاً من ذلك، ولضمان التوافق إلى أقصى حد، يمكن أن ينفّذ الرمز البرمجي ذو 32 بت عملية رصد وقت التشغيل للتأكّد من إمكانية تشغيل رمز Neon على الجهاز المستهدف. يمكن لأي تطبيق إجراء هذا التحقّق باستخدام أي من الخيارات المذكورة في ميزات وحدة المعالجة المركزية.
يجب عدم كتابة وظائف Neon المضمّنة الصريحة في رمز C/C++. ستستخدم أنواع المتجهات المحمولة في Clang تعليمات Neon تلقائيًا. إنّ وظائف Clang المضمّنة في Neon هي في الواقع مجرد برنامج تضمين غير قابل للنقل حول الأنواع القابلة للنقل، لذا فإنّ كتابة وظائف Neon المضمّنة لن تجعل الرمز البرمجي أسرع من استخدام الأنواع القابلة للنقل، بل ستجعله أقل قابلية للنقل.
إنشاء
إيقاف Neon على مستوى العالم
ndk-build
لا يتيح ndk-build إيقاف Neon على مستوى العالم. لإيقاف Neon في تطبيق ndk-build بالكامل، طبِّق الخطوات الخاصة بكل وحدة على كل وحدة في تطبيقك.
CMake
مرِّر -DANDROID_ARM_NEON=ON عند استدعاء CMake. إذا كنت تستخدم Android Studio/Gradle في عملية الإنشاء، اضبط الخيار التالي في ملف build.gradle:
يوضّح نموذج تحويل البيانات إلى متجهات كيفية استخدام مجموعة متنوعة من أدوات تحويل البيانات إلى متجهات لتنفيذ عملية ضرب المصفوفات، ويقارن بين أدائها.
يخضع كل من المحتوى وعيّنات التعليمات البرمجية في هذه الصفحة للتراخيص الموضحّة في ترخيص استخدام المحتوى. إنّ Java وOpenJDK هما علامتان تجاريتان مسجَّلتان لشركة Oracle و/أو الشركات التابعة لها.
تاريخ التعديل الأخير: 2025-08-25 (حسب التوقيت العالمي المتفَّق عليه)
[[["يسهُل فهم المحتوى.","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 (حسب التوقيت العالمي المتفَّق عليه)"],[],[],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."]]