Search code examples
iosllvmxcode5neonarm64

Unknown register name "q0" in asm (arm64)


I'm currently trying to compile my lib for the new arm64 arch. I have a bunch of NEON assembly and for all of them I receive an error

Unknown register name "q0" in asm.

Even if I write smth simple as this:

asm (
     ""
     :
     :
     : "q0", "q1", "q2", "q3"
     );

I thought arm64 supports NEON. Am i missing something ?


Solution

  • “v0”:

    scanon$ cat bar.c
    int foo(void) {
      __asm__("":::"q0");
      return 0;
    }
    scanon$ xcrun -sdk iphoneos clang bar.c -arch arm64 -c
    bar.c:2:16: error: unknown register name 'q0' in asm
      __asm__("":::"q0");
                   ^
    1 error generated.
    scanon$ cat foo.c
    int foo(void) {
      __asm__("":::"v0");
      return 0;
    }
    scanon$ xcrun -sdk iphoneos clang foo.c -arch arm64 -c
    scanon$
    

    arm64 is a new ISA. The actual NEON instructions and register layout are entirely new. You will need to re-write or adapt assembly code for the new architecture.