Updated Golang ppc64x asm Reference (markdown)

Sun Yimin 2024-09-05 16:32:57 +08:00
parent 9ec492591c
commit 464720b66b

@ -85,6 +85,39 @@
- **LXVDSX** "Load Vector Doubleword Scalar Indexed". This instruction is used to load a doubleword (64-bit element) from memory into a vector register.从指定内存位置加载64位数据将其存储到目标向量寄存器的lower halfbyte index from 0-7
- **LVXD2X** "Load Vector Doubleword 2 Indexed". This instruction is used to load two consecutive doublewords (64-bit elements) from memory into a vector register. 加载两个连续的64位数到目标向量寄存器。
### 示例PPC64LE
用**LVXD2X**加载两个连续64位整数
```asm
DATA ·mask+0x00(SB)/8, $0x0f0e0d0c0b0a0908 // Permute for vector doubleword endian swap
DATA ·mask+0x08(SB)/8, $0x0706050403020100
GLOBL ·mask(SB), RODATA, $16
MOVD $·mask(SB), R4
LVXD2X (R4), V0
```
那V[0] = 0x0f0e0d0c, V[1] = 0x0b0a0908, V[2] = 0x07060504, V[3] = 0x03020100
用**LVX**加载两个连续64位整数
```asm
DATA ·mask+0x00(SB)/8, $0x0f0e0d0c0b0a0908 // Permute for vector doubleword endian swap
DATA ·mask+0x08(SB)/8, $0x0706050403020100
GLOBL ·mask(SB), RODATA, $16
MOVD $·mask(SB), R4
LVX (R4), V0
```
那V[2] = 0x0f0e0d0c, V[3] = 0x0b0a0908, V[0] = 0x07060504, V[1] = 0x03020100
用**LVXD2X**加载四个32位整数
假设四个连续32位整数为[0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100]
则V[0] = 0x0b0a0908, V[1] = 0x0f0e0d0c, V[2] = 0x03020100, V[3] = 0x07060504
用**LVX**加载四个32位整数
假设四个连续32位整数为[0x0f0e0d0c, 0x0b0a0908, 0x07060504, 0x03020100]
则V[0] = 0x03020100, V[1] = 0x07060504, V[2] = 0x0b0a0908, V[3] = 0x0f0e0d0c
## 存储向量寄存器中的数据到内存
- **STVX** "Store Vector Indexed". This instruction is used to store a vector from a vector register into memory.The **STVX** instructions on ppc64 require 16 byte alignment of the data. To avoid that requirement, data is stored using **STXVD2X** with **VPERM** to reorder bytes correctly.
- **STXVD2X** "Store Vector Doubleword 2 Indexed". This instruction is used to store two consecutive doublewords (64-bit elements) from a vector register into memory.