Updated Golang s390x asm Reference (markdown)

Sun Yimin 2024-08-22 09:27:51 +08:00
parent 75a83398d0
commit 1cc6215218

@ -1,5 +1,5 @@
# Reference # Reference
* https://go.dev/doc/asm - https://go.dev/doc/asm
IBM z/Architecture, a.k.a. s390x[](https://go.dev/doc/asm#s390x) 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. The registers R10 and R11 are reserved. The assembler uses them to hold temporary values when assembling some instructions.
@ -18,27 +18,29 @@ 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. (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/ - https://golang.google.cn/cmd/internal/obj/s390x/
# 向量指令 # 向量指令
## Reference ## Reference
* https://github.com/golang/go/blob/master/src/cmd/internal/obj/s390x/vector.go - https://github.com/golang/go/blob/master/src/cmd/internal/obj/s390x/vector.go
## Element Size ## Element Size
* B - 16个8位值 相当于一个128位数 - **B** - This stands for Byte and represents multiple 8-bit values in a 128-bit vector.
* H - 8个16位值 - **H** - This stands for Halfword and represents multiple 16-bit values in a 128-bit vector.
* F - - **F** - This stands for Fullword and represents multiple 32-bit values in a 128-bit vector.
* G - - **G** - This stands for Doubleword and represents multiple 64-bit values in a 128-bit vector.
* Q - 2个64位值? - **Q** - This stands for Quadword and represents a single 128-bit value in a 128-bit vector.
(以上解释来自Copilot)
## 算术加减法 ## 算术加减法
* VA - Vector Add. 无符号数加法。 - VA - Vector Add. 无符号数加法。
* VAC - Vector Add With Carry. 带进位无符号数加法相当于3个数加法。 - VAC - Vector Add With Carry. 带进位无符号数加法相当于3个数加法。
* VACC - Vector Add Compute Carry. 无符号数加法,计算进位。只有进位结果。 - VACC - Vector Add Compute Carry. 无符号数加法,计算进位。只有进位结果。
* VACCC - Vector Add With Carry Compute Carry. 带进位无符号数加法计算进位。相当于3个数加法只有进位结果。 - VACCC - Vector Add With Carry Compute Carry. 带进位无符号数加法计算进位。相当于3个数加法只有进位结果。
所以两个数相加要同时使用多个指令。示例演示T1||T0, RED2||RED1两个256位数的加法按64位值?,得到 T2||T1||T0。 所以两个数相加要同时使用多个指令。示例演示T1||T0, RED2||RED1两个256位数的加法得到 T2||T1||T0。
```asm ```asm
VACCQ T0, RED1, CAR1 VACCQ T0, RED1, CAR1
VAQ T0, RED1, T0 VAQ T0, RED1, T0