-1

I wrote an ARM NEON function in an individual file csc_rotation.S to do the colorspace conversion and I added the pure assembly file into a iOS app project to test it, and then compile the code under armv7 arch on Xcode.

Then I got these error:

.text
csc_rotation.S:3:1: Cannot use dot operator on a type

ldr  r4, [sp, #24]  //Save width to r4
csc_rotation.S:20:1: Unknown type name 'ldr'
csc_rotation.S:20:15: Expected identifier
csc_rotation.S:20:19: Expected ';' after top level declarator

image_rotate_180D_neon(y_ptr, y_stride, x_ptr, x_stride, width, height);
i420_888.cpp:536:5: Use of undeclared identifier 'image_rotate_180D_neon'

It seems LLVM can't compile the neon assembly code? Could you help me?

Andy Hu
  • 97
  • 1
  • 7
  • You're not supposed to compile assembly code *at all*. You're supposed to *assemble* it. Who'd have thought. – EOF May 17 '17 at 16:42
  • What commands do you execute to “compile” the assembly code? – fuz May 17 '17 at 20:02

1 Answers1

0

Yes you can use the __asm__ directive.

For example like this:

-(int) roundff:(float)a {
    int y;
    __asm__("fcvtzs %w0, %s1\n\t" : "=r"(y) : "w"(a));
    return y;
}

However if you want to write NEON code in Xcode I do recommend to use the intrinsics by including->

#include <arm_neon.h>

Also use:

#ifdef __arm__ //AArch32
#ifdef __arm64__ //AArch64 

to separate the architectures if your target is unknown.

/A

Anders Cedronius
  • 2,036
  • 1
  • 23
  • 29