[Interest] Enabling NEON on a Qt Android app

Thiago Macieira thiago.macieira at intel.com
Fri May 6 23:52:17 CEST 2016


On sexta-feira, 6 de maio de 2016 00:38:10 PDT Thiago Macieira wrote:
> On sexta-feira, 6 de maio de 2016 07:58:30 PDT Nuno Santos wrote:
> > What are the necessary steps in order to enable NEON on a Arm processor
> > that supports it?
> 
> Compile a plugin for Neon and a plugin for non-Neon. At runtime, determine
> which one to load, then call functions on it. Do not try to include files
> built with and without Neon support into the same binary if those sources
> are C++.
> 
> I don't know Android API, but if you can't find a suitable function to tell
> you whether Neon is possible, you can always just read from /proc/cpuinfo
> or from /proc/self/auxv.

Note: the same answer applies to x86 features, like AVX. The only important 
difference is that there's a CPU instruction to tell you what's available.

Unless you want to use GCC features like function multiversioning/
multidispatching using __attribute((target())): in that case, you *can* have 
code for AVX and non-AVX in the same source file.

Whether that works on Android depends on:
 a) Clang having implemented this feature (I think it has)
 b) Clang's intrinsics headers being includable in any condition (it hadn't 
   until recently)
 c) If you allow GCC to generate the actual calls (the multidispatching part), 
   whether the dynamic loader understands indirect functions

-- 
Thiago Macieira - thiago.macieira (AT) intel.com
  Software Architect - Intel Open Source Technology Center




More information about the Interest mailing list