10-29-2011 06:22 PM
I know the PlayBook is using an OMAP 4 chipset, that embedds a NEON coprocessor. I would like to know if we can use it with the current version of the NDK. If yes, what is the preferred way: compile time assumption (as on iOS), or runtime detection (as on Android), and if the latter is there a detection API?
Thanks in advance.
10-30-2011 09:41 AM - edited 10-30-2011 09:42 AM
Playbook allows compiling directly in C++ using a compiler such as gcc. As such, when you compile for a target such as march=arm7-le, gcc already knows that the device supports NEON instructions and then enables this (-mfpu neon).
So it is done on compile time.
All QNX devices will support NEON. If this is cross-platform code your NEON code should already be wrapped around the proper #ifdef/#endif.
I see that a lot of people use:
#ifdef _ARM_ARCH_7 #include <arm_neon.h>
However, as you've probably discovered on Android, some devices use Tegra 2 which is Armv7 but does not have NEON.
To get around this, developer will usually add this after the #ifdef:
flags = arm_cpu_caps();
if (flags & HAS_NEON)
While this is not necessary for Playbook. This *is* necessarily if one of your targets is Android where some Armv7 devices may or may not support NEON (eg. Tegra 2).
Hope that helps.
10-30-2011 11:46 AM
Hi xsacha, thanks for your reply
I just made a quick test, adding "-mfloat-abi=softfp -mfpu=neon" to the compile flags (else arm_neon.h is complaining) and adding my NEON files to the Makefile (I keep them in separate files to properly handle the VFP/Tegra case on Android), and all compiles well... but unfortunately half of the NEON routines do not work, though do not crash: I just cannot see my characters (I'm using NEON for vertex skinning). And the routines that work do not give any performance improvement (on Android and iOS I have a 50% gain). I'll make deeper tests and let you know if that works. For info I'm using assembly (so not intrinsics), don't know if that can be a problem.
Thanks again for your time.
10-30-2011 06:13 PM - edited 10-30-2011 06:14 PM
It's likely the flags were already there if you're using an IDE like the native SDK. If you're comparing from when you added the flags you'll probably not notice the difference then.
Not sure why you can't see the characters :\