1
0
mirror of https://github.com/golang/go synced 2024-11-11 17:11:36 -07:00

cmd/internal/obj/loong64: add support for instructions ANDN and ORN

Go asm syntax:
	ANDN/ORN	RK, RJ, RD
    or  ANDN/ORN	RK, RD

Equivalent platform assembler syntax:
	andn/orn	rd, rj, rk
    or  andn/orn	rd, rd, rk

Ref: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Change-Id: I6d240ecae8f9443811ca450aed3574f13f0f4a81
Reviewed-on: https://go-review.googlesource.com/c/go/+/610475
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
This commit is contained in:
Xiaolin Zhao 2024-09-04 16:19:22 +08:00 committed by Gopher Robot
parent 501b389efc
commit db07c8607a
4 changed files with 17 additions and 0 deletions

View File

@ -132,6 +132,11 @@ lable2:
BREAK // 00002a00
UNDEF // 00002a00
ANDN R4, R5, R6 // a6901600
ANDN R4, R5 // a5901600
ORN R4, R5, R6 // a6101600
ORN R4, R5 // a5101600
// mul
MUL R4, R5 // a5101c00
MUL R4, R5, R6 // a6101c00

View File

@ -385,6 +385,10 @@ const (
AMOVVF
AMOVVD
// 2.2.1.8
AORN
AANDN
// 2.2.7. Atomic Memory Access Instructions
AAMSWAPB
AAMSWAPH

View File

@ -127,6 +127,8 @@ var Anames = []string{
"MOVDV",
"MOVVF",
"MOVVD",
"ORN",
"ANDN",
"AMSWAPB",
"AMSWAPH",
"AMSWAPW",

View File

@ -1100,6 +1100,8 @@ func buildop(ctxt *obj.Link) {
case AAND:
opset(AOR, r0)
opset(AXOR, r0)
opset(AORN, r0)
opset(AANDN, r0)
case ABEQ:
opset(ABNE, r0)
@ -1858,6 +1860,10 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
return 0x2a << 15
case AXOR:
return 0x2b << 15
case AORN:
return 0x2c << 15 // orn
case AANDN:
return 0x2d << 15 // andn
case ASUB:
return 0x22 << 15
case ASUBU, ANEGW: