gpt4 book ai didi

assembly - ARMv8 高级 SIMD : "invalid addressing mode at operand 2 -- ` st1 {V1. D}[0],[x20,640 ]'"

转载 作者:行者123 更新时间:2023-12-05 02:08:34 25 4
gpt4 key购买 nike

我试图将 64 位存储到内存中,从 V 寄存器到 X 寄存器中保存的地址,但我收到错误消息,“操作数 2 处的寻址模式无效 -- `st1 {V1.D}[0], [x20,640]”。

ARMv8 Instruction Set Overview 来看,操作应该是这样的:

ST1 {Vt.<\T>}[index], vaddr Store single 1-element structure from one lane (of one register)

All SIMD load-store structure instructions use the syntax term vaddr as shorthand for the following addressing modes: [base] Memory addressed by base register Xn or SP. [base],Xm Memory addressed by base register Xn or SP, post-incremented by 64-bit index register Xm. [base],#immMemory addressed by Xn or SP, post-incremented by an immediate value which must equal the total number of bytes transferred to/from memory.

下面是具体显示我正在努力完成的代码。在我看来,它应该没问题。

__asm__ volatile (
"MOV V0.D[0], %[A_MASK] \n\t"
"ST1 {V0.D}[0], %[D] \n\t"
:
: [D] "m" (<pointer>), [A_MASK] "r" (0xFF000000)
: "memory", "V0"
);

最佳答案

st1 不采用偏移量,因此 [x20,640] 是非法的。只有 [x20] 和类似的是合法的。要强制 gcc 生成正确的地址,请使用 Q 约束 the manual定义为

A memory address which uses a single base register with no offset

请注意,gcc 支持矢量,因此您可能不需要为此使用汇编。

关于assembly - ARMv8 高级 SIMD : "invalid addressing mode at operand 2 -- ` st1 {V1. D}[0],[x20,640 ]'",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60748367/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com