From c651512c09237b824c5374b8787e9274b25f86ac Mon Sep 17 00:00:00 2001 From: Sun Yimin Date: Wed, 21 Aug 2024 11:31:36 +0800 Subject: [PATCH] Updated Golang s390x asm Reference (markdown) --- Golang-s390x-asm-Reference.md | 42 ++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/Golang-s390x-asm-Reference.md b/Golang-s390x-asm-Reference.md index df1fe5e..16ac150 100644 --- a/Golang-s390x-asm-Reference.md +++ b/Golang-s390x-asm-Reference.md @@ -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个数加法,只有进位结果。 + + +