如何使用 ARM64 执行多项式乘法?

2023-12-25

Microsoft 最近发布了 ARM64 构建工具,作为 Visual Studio 15.9 的一部分。我正在完成 ARM64 的移植。我在多项式乘法方面遇到麻烦。

我遇到的问题是,微软没有提供预期的数据类型,例如poly64_t,或者像这样的演员vreinterpretq_u64_p128。另请参阅arm64_neon.h https://github.com/tpn/winsdk-10/blob/master/Include/10.0.14393.0/km/crt/arm64_neon.h在 GitHub 上。

这无法编译:

#include <arm64_neon.h>
poly128_t VMULL_P64(const poly64_t a, const poly64_t b)
{
    return vmull_p64(a, b);
}

结果:

test.cxx(2): error C4430: missing type specifier - int assumed. Note: C++ does n
ot support default-int
test.cxx(2): error C2146: syntax error: missing ';' before identifier 'VMULL_P64
'
test.cxx(3): error C2143: syntax error: missing ';' before '{'
test.cxx(3): error C2447: '{': missing function header (old-style formal list?)

这也无法编译:

#include <arm64_neon.h>
uint64x2_t VMULL_P64(const uint64_t a, const uint64_t b)
{
    return vmull_p64(a, b);
}

And:

test.cxx(4): error C2664: '__n128 neon_pmull_64(__n64,__n64)': cannot convert ar
gument 1 from 'const uint64_t' to '__n64'
test.cxx(4): note: No constructor could take the source type, or constructor ove
rload resolution was ambiguous

我把这些拼凑在一起,但似乎是错误的。尤其是中间__n64(我无法用一条语句来编译它):

#include <arm64_neon.h>
uint64x2_t VMULL_P64(const uint64_t a, const uint64_t b)
{
    __n64 x = {a}, y = {b};
    return vmull_p64(x, y);
}

其他内容,如 CRC32、CRC32C、AES、SHA-1 和 SHA-256 均正常工作。

微软打算如何让我们使用ARM64来执行多项式乘法?

(标题在哪里<arm64_neon.h>来自? ARM很清楚标头是<arm_acle.h>.)


ARM 在 中提供了以下内容ARM C 语言扩展 2.1 (ACLE) http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.ihi0053d/index.html:

poly128_t vmull_p64 (poly64_t, poly64_t);

对双字低位部分执行加宽多项式乘法。 适用于 ARMv8 AArch32 和 AArch64。

poly128_t vmull_high_p64 (poly64x2_t, poly64x2_t);

对双字高位部分执行加宽多项式乘法。 适用于 ARMv8 AArch32 和 AArch64。


Visual C++ 2017.9 (15.9) 中的 ARM 支持仍然相当有限...2017.9 将不再获得新功能,因此如果不升级到 Visual C++ 2019,编译代码将无法工作。

Visual C++ 2019 添加了 poly64_t 的类型定义。我正在与 ARM 和 Visual Studio 开发人员密切合作,解决针对 32 位或 64 位 ARM 目标进行编译时出现的问题。编译器中仍然存在一些需要解决方法的错误,因此它不太适合生产代码或从 Linux 和其他类 Unix 系统进行移植。

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

如何使用 ARM64 执行多项式乘法? 的相关文章

随机推荐