Reputation: 25386
By default Android NDK does not generate code with VFP (vector floating point) or NEON instructions turned on. How can i turn them on?
Upvotes: 4
Views: 4893
Reputation: 12917
There are documentation about this in the following files in Android NDK: docs/CPU-ARCH-ABIS.html and docs/CPU-ARM-NEON.html.
Basically you want to put
APP_ABI := armeabi armeabi-v7a
to generate two shared libraries, one without (targeting ARMv5TE) and one with VFP support (targeting ARMv7).
To build .c/.cpp file with NEON support add .neon suffix to filename (for example: file.cpp.neon) in Android.mk file. Or to build all files with NEON enabled, put into Android.mk file:
LOCAL_ARM_NEON := true
Be careful - not all ARMv7 devices support NEON (like Nvidia Tegra 2). Better detect it at runtime and choose different codepath then.
Read the docs for more info.
Upvotes: 7