ARM锵:无法分配的约束输出寄存器“W”
问题描述:
uint8_t* dataPtr;
uint8x8x4_t dataVec;
__asm__ __volatile__("vldmia %1, %h0" : "=w"(dataVec) : "r"(dataPtr));
以上ARM内联汇编代码时使用GCC
工具链armeabi-v7a
ABI的Android NDK编译工作正常。不过,我得到以下编译器错误,当我切换到Clang
ARM锵:无法分配的约束输出寄存器“W”
error: couldn't allocate output register for constraint 'w'
据LLVM docs,约束“W”可以用于ARM的目标SIMD寄存器。
我错过了什么吗?有没有人遇到过这个问题?这是LLVM中的错误吗?
感谢
答
正如LLVM文件中提到:
The constraint codes are, in general, expected to behave the same way they do in GCC. LLVM’s support is often implemented on an ‘as-needed’ basis, to support C inline asm code which was supported by GCC. A mismatch in behavior between LLVM and GCC likely indicates a bug in LLVM.
也许这是一个好主意,你就https://bugs.llvm.org/
报告这听起来像是你还没有告诉GCC启用SIMD扩展。此外,你可能要考虑使用内建代替asm。 –
@DavidWohlferd:我传递编译器标志LOCAL_CFLAGS + = -mfpu = neon。我有更多的编译好的NEON内部代码和汇编代码。这就是我知道NEON优化已启用的方式。 –