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

标签 assembly memory arm neon armv8

我试图将 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/

相关文章:

c - 条件移动优化是否针对 C 标准?

assembly - BIOS 连续两次从不同端口读取同一寄存器

c - 带有指向 const 数据的目标指针的 memcpy

c - 为什么realloc需要两个指针?处理 NULL 返回?

c - ASF4 Microchip API定时器驱动复位函数

linux - 解释基本的 ARM 指令

c - "int"之间的区别

linux - 如何理解 "cmpl $0x0, -0x30(%rbp)"/"je ..."

ios - 在 Swift 中,我应该在完成后将可选实例变量设置为 nil 吗?

arm - "CPU is not halted"和 "No APB-AP found"错误