We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
how to compile neon instruction on linux using gnu assemler and gnu comiler ?
Hi mahesh.
Assuming you already have a GNU toolchain (if not, see here), you have a few options for how to get Neon instructions using the GNU toolchain.
1) Use Neon intrinsics. This is the recommended way if you have a good idea of the Neon instructions you want, since it allows you to call functions that cause the relevant Neon instructions to be generated, along with setting up of operands in the right registers. This leaves GCC free to perform its own scheduling and register allocation for your function to try to get the best output it can.
There's an example of use of neon intrinsics here. Whilst that example is for armcc, it will also work with the GNU toolchain. You compile with -mfpu=neon to tell GCC that you want it to generate Neon instructions.
2) Rely on auto-vectorisation. GCC will generate Neon instructions automatically where it can detect they are worthwhile.
For example, if you compile the following with "-O2 -ftree-vectorize -ffast-math", the vmla Neon instruction should be generated.
void f1(int n, int a, int x[], int y[]) {
int i;
for (i = 0; i < n; ++i)
y[i] = a * x[i] + y[i];
}
3) Plant your own instructions directly in ASM statements. This is not recommended unless you already know assembly programming and the intrinsics option isn't sufficient for whatever reason. If this is the option you think you need, let me know and I can give examples.
I hope this will act as a good starting point. Please post again if you need any more assistance. In particular, if you can give more specifics about your situation (e.g. version of the toolchain, target processor/architecture, etc) then more explicit steps can be provided.