【问题标题】:Cannot compile NEON code on xcode 8.3.2无法在 xcode 8.3.2 上编译 NEON 代码
【发布时间】:2017-05-17 16:36:17
【问题描述】:

我在单独的文件 csc_rotation.S 中编写了一个 ARM NEON 函数来进行色彩空间转换,并将纯汇编文件添加到 iOS 应用程序项目中进行测试,然后在 Xcode 上的 armv7 arch 下编译代码。

然后我得到了这些错误:

.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'

LLVM 似乎无法编译 neon 汇编代码? 你能帮帮我吗?

【问题讨论】:

  • 您根本不应该编译汇编代码。你应该组装它。谁能想到。
  • 你执行了哪些命令来“编译”汇编代码?

标签: ios xcode assembly arm neon


【解决方案1】:

是的,您可以使用 __asm__ 指令。

例如这样:

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

但是,如果您想在 Xcode 中编写 NEON 代码,我建议您通过包含使用内部函数->

#include <arm_neon.h>

同时使用:

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

如果您的目标未知,则分离架构。

/A

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-01-18
    • 2014-11-03
    • 2020-08-10
    • 2017-08-25
    • 1970-01-01
    • 2014-12-09
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多