ARMv8 高级 SIMD:"invalid addressing mode at operand 2 -- `st1 {V1.D}[0],[x20,640]'"
ARMv8 Advanced SIMD: "invalid addressing mode at operand 2 -- `st1 {V1.D}[0],[x20,640]'"
我正在尝试将 64 位存储到内存中,从 V 寄存器到 X 寄存器中保存的地址,但出现错误,"invalid addressing mode at operand 2 -- `st1 {V1.D}[0],[x20,640]"。
来自 ARMv8 指令集概述,操作应该如下所示:
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 支持向量,因此您可能不需要为此使用汇编。
我正在尝试将 64 位存储到内存中,从 V 寄存器到 X 寄存器中保存的地址,但出现错误,"invalid addressing mode at operand 2 -- `st1 {V1.D}[0],[x20,640]"。
来自 ARMv8 指令集概述,操作应该如下所示:
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 支持向量,因此您可能不需要为此使用汇编。