skip to Main Content

To date I have had no issue compiling and running complex ARM Neon assembly language routines in Xcode/CLANG, and the Apple M1 supposedly supports ARMv8.4.

But – when I try to use half precision with the following syntax:
" fadd v2.8h, v0.8h, v1.8h nt"
I get the compiler error "Invalid Operand for instruction".
Adding -mfpu=neon-fp16 to the compiler options didn’t help. Hoping it just uses a different syntax?

If anyone has achieved .8h instructions compiling in Xcode, I would be very grateful for any tips. Thank you.

2

Answers


  1. Chosen as BEST ANSWER

    I think I've solved the issue - or at least half of the issue - I can now get it to compile. There were two key points:

    1. The compiler flag to add is JUST -march=armv8.2-a+fp16 and nothing else. I was trying too many things.

    2. In XCode the way to add the flags is per C file. Specifically... Click on your project go to the Build Phases Tab. Click on your target and you should see a list of the source files. Click on each relevant source file and add -march=armv8.2-a+fp16

    After I did this, it compiled. I will add another comment if I find more info.


  2. That’s wonderful news. :). Maybe over time this is becoming standard.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search