How to perform polynomial multiplication using ARM64?

落爺英雄遲暮 提交于 2019-12-10 23:37:22

问题


Microsoft released their ARM64 build tools recently as part of Visual Studio 15.9. I'm finishing a port to ARM64. I'm having trouble with polynomial multiplication.

The problem I am having is, Microsoft does not provide the expected data types like poly64_t, or casts like vreinterpretq_u64_p128. Also see arm64_neon.h on GitHub.

This fails to compile:

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

And the result:

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?)

This also fails to compile:

#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

I cobbled this together but it just seems wrong. Especially the intermediate __n64 (I could not get it to compile with a single statement):

#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);
}

The other stuff, like CRC32, CRC32C, AES, SHA-1 and SHA-256 are working as excepted.

How does Microsoft intend for us to use ARM64 to perform polynomial multiplication?

(And where did the header <arm64_neon.h> come from? ARM is very clear the header is <arm_acle.h>.)


ARM provides the following in the ARM C Language Extensions 2.1 (ACLE):

poly128_t vmull_p64 (poly64_t, poly64_t);

Performs widening polynomial multiplication on double-words low part. Available on ARMv8 AArch32 and AArch64.

poly128_t vmull_high_p64 (poly64x2_t, poly64x2_t);

Performs widening polynomial multiplication on double-words high part. Available on ARMv8 AArch32 and AArch64.

来源:https://stackoverflow.com/questions/54048837/how-to-perform-polynomial-multiplication-using-arm64

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!