I'm trying to run NEON code in my Xcode project for school purposes. I'm using Xcode 7, LLVM 7.0 and using a device to execute the program.
I have a .s file in the project with the code. If I run just ARM code it works perfectly, but when I add a single NEON line of code (like in the code snippet) I get the following message:
AssemblyTest.s:22:5: error: unrecognized instruction mnemonic
vmul.f32 q14, q8, q8
^
The test code I'm using is
.globl _addInts
.align 2
_addInts:
.cfi_startproc
sub sp, sp, #16
str w0, [sp, #12]
str w1, [sp, #8]
add w0, w0, w1
add sp, sp, #16
vmul.f32 q14, q8, q8 // --- This is the NEON line
ret
.cfi_endproc
Is there any compiler flag I should add to the project? Does LLVM support NEON instructions set?
Thanks!!
As Notlikethat points out you're mixing AArch32 and AArch64.. For example vmul.f32 qx,qy,qz (AArch32) is performing a two float multiply from 64 bit Q registers. While fmul vx.4s,vy.4s,vz.4s (AArch64) is performing 4 float multiplies from 128 bit V registers.
You can mix both architectures in a project by separating them using #ifdefs:
#ifdef __arm__ //AArch32
#ifdef __arm64__ //AArch64
Compile the following using architecture: arm64 in xcode and you're OK. You need to modify the fmul to something useful ;)
sub sp, sp, #16
str w0, [sp, #12]
str w1, [sp, #8]
add w0, w0, w1
add sp, sp, #16
fmul v14.4s, v8.4s, v9.4s
Good luck.
/A