cmd/internal/obj/loong64: add {V,XV}PCNT.{B,H,W,D} instructions support

Go asm syntax:
          VPCNT{B,H,W,V}  VJ, VD
         XVPCNT{B,H,W,V}  XJ, XD

Equivalent platform assembler syntax:
          vpcnt.{b,w,h,d}  vd, vj
         xvpcnt.{b,w,h,d}  xd, xj

Change-Id: Icec4446b1925745bc3a0bc3f6397d862953b9098
Reviewed-on: https://go-review.googlesource.com/c/go/+/620736
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
This commit is contained in:
Guoqi Chen 2024-10-17 16:26:52 +08:00 committed by abner chenc
parent e534989d18
commit 2751443e92
4 changed files with 56 additions and 0 deletions

View file

@ -93,6 +93,8 @@ var optab = []Optab{
{AMOVVF, C_FREG, C_NONE, C_NONE, C_FREG, C_NONE, 9, 4, 0, 0},
{AMOVF, C_FREG, C_NONE, C_NONE, C_FREG, C_NONE, 9, 4, 0, 0},
{AMOVD, C_FREG, C_NONE, C_NONE, C_FREG, C_NONE, 9, 4, 0, 0},
{AVPCNTB, C_VREG, C_NONE, C_NONE, C_VREG, C_NONE, 9, 4, 0, 0},
{AXVPCNTB, C_XREG, C_NONE, C_NONE, C_XREG, C_NONE, 9, 4, 0, 0},
{AFMADDF, C_FREG, C_FREG, C_NONE, C_FREG, C_NONE, 39, 4, 0, 0},
{AFMADDF, C_FREG, C_FREG, C_FREG, C_FREG, C_NONE, 39, 4, 0, 0},
@ -1294,6 +1296,16 @@ func buildop(ctxt *obj.Link) {
opset(AXVSEQH, r0)
opset(AXVSEQW, r0)
opset(AXVSEQV, r0)
case AVPCNTB:
opset(AVPCNTH, r0)
opset(AVPCNTW, r0)
opset(AVPCNTV, r0)
case AXVPCNTB:
opset(AXVPCNTH, r0)
opset(AXVPCNTW, r0)
opset(AXVPCNTV, r0)
}
}
}
@ -2322,6 +2334,22 @@ func (c *ctxt0) oprr(a obj.As) uint32 {
return 0x46b9 << 10 // ftintrne.l.s
case AFTINTRNEVD:
return 0x46ba << 10 // ftintrne.l.d
case AVPCNTB:
return 0x1ca708 << 10 // vpcnt.b
case AVPCNTH:
return 0x1ca709 << 10 // vpcnt.h
case AVPCNTW:
return 0x1ca70a << 10 // vpcnt.w
case AVPCNTV:
return 0x1ca70b << 10 // vpcnt.v
case AXVPCNTB:
return 0x1da708 << 10 // xvpcnt.b
case AXVPCNTH:
return 0x1da709 << 10 // xvpcnt.h
case AXVPCNTW:
return 0x1da70a << 10 // xvpcnt.w
case AXVPCNTV:
return 0x1da70b << 10 // xvpcnt.v
}
c.ctxt.Diag("bad rr opcode %v", a)