如何将 32 位 NEON 程序集转换为 64 位?
How do I convert 32-bit NEON assembly to 64-bit?
我正在尝试在 64 位 iOS 设备上使用 MSFA(谷歌音乐合成器),它有四个用于 DSP 操作的 NEON 汇编源文件,显然是为 32 位架构编写的。最初有人告诉我,最好将其重写为 NEON 内在函数,这样它就与体系结构无关。不过看了一些文章(比如http://hilbert-space.de/?p=22),感觉还是纯手写汇编比较理想
我的问题是,将其转换为 64 位是否很简单?如果是这样,我将如何开始这样做?
.s 文件是:
https://github.com/google/music-synthesizer-for-android/blob/master/cpp/src/neon_fir.s
https://github.com/google/music-synthesizer-for-android/blob/master/cpp/src/neon_fm_kernel.s
https://github.com/google/music-synthesizer-for-android/blob/master/cpp/src/neon_iir.s
https://github.com/google/music-synthesizer-for-android/blob/master/cpp/src/neon_ladder.s
TL;DR: 使用内在函数
检查 asm 输出以确保它不是愚蠢的是个不错的主意,但使用内部函数可以让编译器进行常量传播,并为有序内核安排/软件管道。
如果您阅读 that post from 2009 you linked, you'd see that the bad code from NEON intrinsics was a gcc bug fixed in 2011 上的评论线程。
如今,编译器非常擅长处理内部函数,并且还在不断改进。
Clang 尤其可以做很多事情,例如使用与您使用内在函数编写的指令不同的洗牌指令。
asm 级别差异:
我根本不是这方面的专家,但 NEON 的主要变化之一是 Aarch64 有 32 个 128b NEON 寄存器(v0 - v31
),而不是由成对组成的大寄存器较小的 regs.
另见一些 official ARM documentation about syntax for element-size, where you can use .16B
to indicate a vector of 16 byte elements. (As opposed to 。)
我正在尝试在 64 位 iOS 设备上使用 MSFA(谷歌音乐合成器),它有四个用于 DSP 操作的 NEON 汇编源文件,显然是为 32 位架构编写的。最初有人告诉我,最好将其重写为 NEON 内在函数,这样它就与体系结构无关。不过看了一些文章(比如http://hilbert-space.de/?p=22),感觉还是纯手写汇编比较理想
我的问题是,将其转换为 64 位是否很简单?如果是这样,我将如何开始这样做?
.s 文件是:
https://github.com/google/music-synthesizer-for-android/blob/master/cpp/src/neon_fir.s
https://github.com/google/music-synthesizer-for-android/blob/master/cpp/src/neon_fm_kernel.s
https://github.com/google/music-synthesizer-for-android/blob/master/cpp/src/neon_iir.s
https://github.com/google/music-synthesizer-for-android/blob/master/cpp/src/neon_ladder.s
TL;DR: 使用内在函数
检查 asm 输出以确保它不是愚蠢的是个不错的主意,但使用内部函数可以让编译器进行常量传播,并为有序内核安排/软件管道。
如果您阅读 that post from 2009 you linked, you'd see that the bad code from NEON intrinsics was a gcc bug fixed in 2011 上的评论线程。
如今,编译器非常擅长处理内部函数,并且还在不断改进。
Clang 尤其可以做很多事情,例如使用与您使用内在函数编写的指令不同的洗牌指令。
asm 级别差异:
我根本不是这方面的专家,但 NEON 的主要变化之一是 Aarch64 有 32 个 128b NEON 寄存器(v0 - v31
),而不是由成对组成的大寄存器较小的 regs.
另见一些 official ARM documentation about syntax for element-size, where you can use .16B
to indicate a vector of 16 byte elements. (As opposed to