Updated Golang s390x asm Reference (markdown)

Sun Yimin 2024-08-21 11:31:36 +08:00
parent 595298d468
commit c651512c09

@ -1,2 +1,42 @@
# Reference
* https://go.dev/doc/asm
IBM z/Architecture, a.k.a. s390x[](https://go.dev/doc/asm#s390x)
The registers R10 and R11 are reserved. The assembler uses them to hold temporary values when assembling some instructions.
R13 points to the g (goroutine) structure. This register must be referred to as g; the name R13 is not recognized.
R15 points to the stack frame and should typically only be accessed using the virtual registers SP and FP.
Load- and store-multiple instructions operate on a range of registers. The range of registers is specified by a start register and an end register. For example, LMG (R9), R5, R7 would load R5, R6 and R7 with the 64-bit values at 0(R9), 8(R9) and 16(R9) respectively.
Storage-and-storage instructions such as MVC and XC are written with the length as the first argument. For example, XC $8, (R9), (R9) would clear eight bytes at the address specified in R9.
If a vector instruction takes a length or an index as an argument then it will be the first argument. For example, VLEIF $1, $16, V2 will load the value sixteen into index one of V2. Care should be taken when using vector instructions to ensure that they are available at runtime. To use vector instructions a machine must have both the vector facility (bit 129 in the facility list) and kernel support. Without kernel support a vector instruction will have no effect (it will be equivalent to a NOP instruction).
Addressing modes:
(R5)(R6*1): The location at R5 plus R6. It is a scaled mode as on the x86, but the only scale allowed is 1.
* https://golang.google.cn/cmd/internal/obj/s390x/
# 向量指令 # 向量指令
* VZERO ## Reference
* https://github.com/golang/go/blob/master/src/cmd/internal/obj/s390x/vector.go
## Element Size
* B
* H
* F
* G
* Q
## 算术加减法
* VA - Vector Add. 无符号整数加法。
* VAC - Vector Add With Carry. 无符号整数加法, 同时加进位相当于3个数加法。
* VACC - Vector Add Compute Carry. 无符号整数加法,计算进位。只有进位结果。
* VACCC - Vector Add With Carry Compute Carry. 无符号整数加法同时加进位计算进位。相当于3个数加法只有进位结果。