<html><body><pre>Android NDK CPU Features detection library:
-------------------------------------------

This NDK provides a small library named "cpufeatures" that can be used at
runtime to detect the target device's CPU family and the optional features
it supports.

Usage:
------

The library is available as an import module. To use it, you must:

To use it, you must:

  * List 'cpufeatures' in your list of static library dependencies, as in:

        LOCAL_STATIC_LIBRARIES := cpufeatures

  * At the end of your Android.mk, import the 'android/cpufeatures' module,
    as in:

        $(call import-module,android/cpufeatures)

  * In your source code, include the header named &lt;cpu-features.h&gt;


Here is a simple example:

&lt;project-path&gt;/jni/Android.mk:
    LOCAL_PATH := $(call my-dir)

    include $(CLEAR_VARS)
    LOCAL_MODULE := &lt;your-module-name&gt;
    LOCAL_SRC_FILES := &lt;your-source-files&gt;
    LOCAL_STATIC_LIBRARIES := cpufeatures
    include $(BUILD_SHARED_LIBRARY)

    $(call import-module,android/cpufeatures)


Features:
---------

Two functions are provided for now:

   AndroidCpuFamily   android_getCpuFamily();

Returns the target device's CPU Family as an enum. For now, the only
supported family is ANDROID_CPU_FAMILY_ARM.


   uint64_t   android_getCpuFeatures();

Returns the set of optional features supported by the device's CPU.
The result is a set of bit-flags, each corresponding to one CPU
Family-specific optional feature.

Currently, only the following flags are defined, for the ARM CPU Family:

   ANDROID_CPU_ARM_FEATURE_ARMv7
      Indicates that the device's CPU supports the ARMv7-A instruction
      set as supported by the "armeabi-v7a" abi (see CPU-ARCH-ABIS.html).
      This corresponds to Thumb-2 and VFPv3-D16 instructions.

   ANDROID_CPU_ARM_FEATURE_VFPv3
      Indicates that the device's CPU supports the VFPv3 hardware FPU
      instruction set extension. Due to the definition of 'armeabi-v7a',
      this will always be the case if ANDROID_CPU_ARM_FEATURE_ARMv7 is
      returned.

      Note that this corresponds to the minimum profile VFPv3-D16 that
      _only_ provides 16 hardware FP registers.

   ANDROID_CPU_ARM_FEATURE_NEON
      Indicates that the device's CPU supports the ARM Advanced SIMD
      (a.k.a. NEON) vector instruction set extension. Note that ARM
      mandates that such CPUs also implement VFPv3-D32, which provides
      32 hardware FP registers (shared with the NEON unit).

And the following flags for the x86 CPU Family:

    ANDROID_CPU_X86_FEATURE_SSSE3
      Indicates that the device's CPU supports the SSSE3 instruction
      extension set. Note that this is unlike SSE3 which is required
      by the x86 NDK ABI.

    ANDROID_CPU_X86_FEATURE_POPCNT
      Indicates that the device's CPU supports the POPCNT instruction.

    ANDROID_CPU_X86_FEATURE_MOVBE
      Indicates that the device's CPU supports the MOVBE instruction.
      This one is specific to some Intel IA-32 CPUs, like the Atom.


The following function is also defined to return the max number of
CPU cores on the target device:

    int  android_getCpuCount(void);


Important Note:
---------------

The cpufeatures library will be updated to support more CPU families and
optional features in the future. It is designed to work as-is on all
official Android platform versions.


Change History:
---------------

Please see the comments in $NDK/sources/android/cpufeatures/cpu-features.c
for the complete change history for this library.
</pre></body></html>