代码之家  ›  专栏  ›  技术社区  ›  jww avp

如何使用ARM64实现多项式乘法?

  •  2
  • jww avp  · 技术社区  · 6 年前

    微软最近发布了他们的ARM64构建工具作为visualstudio15.9的一部分。我要完成到ARM64的端口。我的多项式乘法有问题。

    我遇到的问题是,微软没有提供预期的数据类型,比如 poly64_t 或者像 vreinterpretq_u64_p128 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);
    }
    

    以及:

    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_acle.h> .)


    ARM在 ARM C Language Extensions 2.1 (ACLE)

    poly128_t vmull_p64 (poly64_t, poly64_t);
    

    对双字低位执行加宽多项式乘法。 在ARMv8 AArch32和AArch64上提供。

    poly128_t vmull_high_p64 (poly64x2_t, poly64x2_t);
    

    对双字高位执行加宽多项式乘法。

    0 回复  |  直到 6 年前
        1
  •  1
  •   Mika Lindqvist    4 年前

    在Visual C++ 2017.9(15.9)中的ARM支持仍然很有限…2017.9不再有新的特性,所以编译代码在升级到VisualC++ 2019的情况下是行不通的。

    VisualC++ 2019为Py64 64 T增加了类型定义。我正在与ARM和VisualStudio开发人员紧密合作,以解决32位或64位ARM目标编译时的问题。编译器中仍然存在一些需要解决的错误,因此对于生产代码,或者从Linux和其他类似Unix的系统移植来说,它不是很好。