page.title=x86 Support @jd:body

On this page

  1. Overview
  2. ARM NEON Intrinsics Support
  3. Standalone Toolchain
  4. Compatibility

The NDK includes support for the {@code x86} ABI, which allows native code to run on Android-based devices running on CPUs supporting the IA-32 instruction set.

Overview

To generate x86 machine code, add {@code x86} to the {@code APP_ABI} definition in your {@code Application.mk} file. For example:

APP_ABI := armeabi armeabi-v7a x86
For more information about defining the {@code APP_ABI} variable, see {@code Application.mk}.

The build system places generated libraries into {@code $PROJECT/libs/x86/}, where {@code $PROJECT} represents your project's root directory, and embeds them in your APK under {@code /lib/mips/}.

The Android package extracts these libraries when installing your APK on a compatible x86-based device, placing them under your app's private data directory.

In the Google Play store, the server filters applications so that a consumer sees only the native libraries that run on the CPU powering his or her device.

x86 Support for ARM NEON Intrinsics

Support for ARM NEON intrinsics is provided in the form of C/C++ language headers with the same name as the standard ARM NEON intrinsics header, {@code arm_neon.h}. These headers are available for all NDK x86 toolchains. They translate NEON intrinsics to native x86 SSE ones.

Characteristics of this solution include the following:

Performance

In most cases, you should be able to attain performance similar to what you would get from ARM NEON code. Recommendations for best results include:

For more information on this topic, see From ARM NEON to Intel SSE– the automatic porting solution, tips and tricks.

Known differences from ARM version

In the great majority of cases, x86 implementations produce the same results as ARM implementations for NEON. x86 implementations pass NEON tests nearly 100% of the time. Still, there are several corner cases in which an x86 implementation produces results different from its ARM counterpart. Known incompatibilities are as follows:

Sample code

In your project make sure to include the {@code arm_neon.h} header, and define include {@code x86} in your definition of {@code APP_ABI}. The build system then ports your code to x86.

For an example of how porting ARM NEON to x86 SSE works, see the hello-neon sample.

Standalone Toolchain

You can incorporate the {@code x86} ABI into your own toolchain. For more information, see Standalone Toolchain.

Compatibility

x86 support requires, at minimum, Android 2.3 (Android API level 9). If your project files target an older API level, but include x86 as a targeted platform, the NDK build script automatically selects the right set of native platform headers/libraries for you.