cmd/internal/obj/loong64: add MULW.D.W[U] instructions

Go asm syntax:
	MULWVW		RK, RJ, RD
	MULWVWU		RK, RJ, RD

Equivalent platform assembler syntax:
	mulw.d.w	rd, rj, rk
	mulw.d.wu	rd, rj, rk

Change-Id: Ie46a21904a4c25d04200b0663f83072c38a76c6f
Reviewed-on: https://go-review.googlesource.com/c/go/+/721521
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Mark Freeman <markfreeman@google.com>
Reviewed-by: Keith Randall <khr@google.com>
This commit is contained in:
Xiaolin Zhao 2025-11-18 10:55:19 +08:00 committed by abner chenc
parent a2946f2385
commit 7f2ae21fb4
4 changed files with 18 additions and 0 deletions

View file

@ -212,6 +212,12 @@ lable2:
SRLV $32, R4, R5 // 85804500
SRLV $32, R4 // 84804500
// MULW.D.W[U] instructions
MULWVW R4, R5 // a5101f00
MULWVW R4, R5, R6 // a6101f00
MULWVWU R4, R5 // a5901f00
MULWVWU R4, R5, R6 // a6901f00
MASKEQZ R4, R5, R6 // a6101300
MASKNEZ R4, R5, R6 // a6901300

View file

@ -589,6 +589,10 @@ const (
AORN
AANDN
// 2.2.1.12
AMULWVW
AMULWVWU
// 2.2.7. Atomic Memory Access Instructions
AAMSWAPB
AAMSWAPH

View file

@ -131,6 +131,8 @@ var Anames = []string{
"ALSLV",
"ORN",
"ANDN",
"MULWVW",
"MULWVWU",
"AMSWAPB",
"AMSWAPH",
"AMSWAPW",

View file

@ -1503,6 +1503,8 @@ func buildop(ctxt *obj.Link) {
opset(AREMU, r0)
opset(ADIV, r0)
opset(ADIVU, r0)
opset(AMULWVW, r0)
opset(AMULWVWU, r0)
case AMULV:
opset(AMULVU, r0)
@ -3230,6 +3232,10 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
return 0x3c << 15 // mulh.d
case AMULHVU:
return 0x3d << 15 // mulhu.d
case AMULWVW:
return 0x3e << 15 // mulw.d.w
case AMULWVWU:
return 0x3f << 15 // mulw.d.wu
case ADIV:
return 0x40 << 15 // div.w
case ADIVU: