如何在ARM64内联装配中使用多向量类型?

发布于 2025-01-20 12:24:53 字数 431 浏览 1 评论 0原文

在具有GCC的ARM64编译器中,__ ASM __,如何使用多矢量霓虹灯类型(例如uint8x16x4_t)?

uint8x16x4_t Meow()
{
    uint8x16x4_t result;
    __asm__(
        "meow %0"
    :   "=w"(result));
    return result;
}

这将导致以下组件输出:

    meow v0

有没有办法将其成为类似的东西?:

    meow { v0.16b - v3.16b }

甚至更好,请参考各个部分。

In ARM64 compilers with GCC-like __asm__, how could I make use of multi-vector NEON types like uint8x16x4_t?

uint8x16x4_t Meow()
{
    uint8x16x4_t result;
    __asm__(
        "meow %0"
    :   "=w"(result));
    return result;
}

That results in the following assembly output:

    meow v0

Is there a way to get it to be something like this?:

    meow { v0.16b - v3.16b }

Or even better, refer to the individual parts somehow.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

枯叶蝶 2025-01-27 12:24:53

您必须手动执行此操作,但是可以使用tuv修饰符这样做。并且可以从字面上指定后缀。以下代码:

uint8x16x4_t Meow()
{
    uint8x16x4_t result;
    __asm__(
        "meow { %0.16b, %T0.16b, %U0.16b, %V0.16b }"
    :   "=w"(result));
    return result;
}

给我:

Meow:
    meow { v4.16b, v5.16b, v6.16b, v7.16b }
    mov     v1.16b, v5.16b
    mov     v2.16b, v6.16b
    mov     v3.16b, v7.16b
    mov     v0.16b, v4.16b
    ret

You'll have to do it manually, but you can do so with the T, U and V modifiers. And suffixes can just be specified literally. The following code:

uint8x16x4_t Meow()
{
    uint8x16x4_t result;
    __asm__(
        "meow { %0.16b, %T0.16b, %U0.16b, %V0.16b }"
    :   "=w"(result));
    return result;
}

gives me:

Meow:
    meow { v4.16b, v5.16b, v6.16b, v7.16b }
    mov     v1.16b, v5.16b
    mov     v2.16b, v6.16b
    mov     v3.16b, v7.16b
    mov     v0.16b, v4.16b
    ret
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文