]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/loong64: add {V,XV}NEG{B/H/W/V} instructions support
authorXiaolin Zhao <zhaoxiaolin@loongson.cn>
Fri, 13 Dec 2024 09:20:38 +0000 (17:20 +0800)
committerabner chenc <chenguoqi@loongson.cn>
Mon, 17 Mar 2025 03:39:28 +0000 (20:39 -0700)
Go asm syntax:
 VNEG{B/H/W/V} VJ, VD
XVNEG{B/H/W/V} XJ, XD

Equivalent platform assembler syntax:
 vneg.{b/h/w/d} vd, vj
xvneg.{b/h/w/d} xd, xj

Change-Id: Ie0a82a434b0ffbcb77425a65b96eff56e030028c
Reviewed-on: https://go-review.googlesource.com/c/go/+/635935
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: David Chase <drchase@google.com>
src/cmd/asm/internal/asm/testdata/loong64enc1.s
src/cmd/internal/obj/loong64/a.out.go
src/cmd/internal/obj/loong64/anames.go
src/cmd/internal/obj/loong64/asm.go

index 60e253cec3791c1343e4d6bd2b41ac1ba3559c36..8da4824dbc6ea7a368e04acb894de2321dd44142 100644 (file)
@@ -849,3 +849,13 @@ lable2:
        XVFRECIPD       X2, X1          // 41f89c76
        XVFRSQRTF       X2, X1          // 41049d76
        XVFRSQRTD       X2, X1          // 41089d76
+
+       // [X]VNEG{B/H/W/V} instructions
+       VNEGB           V1, V2          // 22309c72
+       VNEGH           V1, V2          // 22349c72
+       VNEGW           V1, V2          // 22389c72
+       VNEGV           V1, V2          // 223c9c72
+       XVNEGB          X2, X1          // 41309c76
+       XVNEGH          X2, X1          // 41349c76
+       XVNEGW          X2, X1          // 41389c76
+       XVNEGV          X2, X1          // 413c9c76
index 9df63de38896aaeef7e0ee74938f59ff07fd8228..7eaf5c0ce1cd0746d894c0fd0c5e4ec9b05ccb37 100644 (file)
@@ -950,6 +950,16 @@ const (
        AXVFRSQRTF
        AXVFRSQRTD
 
+       // LSX and LASX integer neg instructions
+       AVNEGB
+       AVNEGH
+       AVNEGW
+       AVNEGV
+       AXVNEGB
+       AXVNEGH
+       AXVNEGW
+       AXVNEGV
+
        ALAST
 
        // aliases
index bc7948eb004a4d55c10fb22a7bf9d64a16768ea8..eae240d5fde1e539aa0d129b1152ea2790a92558 100644 (file)
@@ -449,5 +449,13 @@ var Anames = []string{
        "XVFRECIPD",
        "XVFRSQRTF",
        "XVFRSQRTD",
+       "VNEGB",
+       "VNEGH",
+       "VNEGW",
+       "VNEGV",
+       "XVNEGB",
+       "XVNEGH",
+       "XVNEGW",
+       "XVNEGV",
        "LAST",
 }
index 31867917916f43f74615047789071caf227df81b..f128dc16e9d316756c3894cbdac5f16b298bb318 100644 (file)
@@ -1659,6 +1659,10 @@ func buildop(ctxt *obj.Link) {
                        opset(AVFRECIPD, r0)
                        opset(AVFRSQRTF, r0)
                        opset(AVFRSQRTD, r0)
+                       opset(AVNEGB, r0)
+                       opset(AVNEGH, r0)
+                       opset(AVNEGW, r0)
+                       opset(AVNEGV, r0)
 
                case AXVPCNTB:
                        opset(AXVPCNTH, r0)
@@ -1670,6 +1674,10 @@ func buildop(ctxt *obj.Link) {
                        opset(AXVFRECIPD, r0)
                        opset(AXVFRSQRTF, r0)
                        opset(AXVFRSQRTD, r0)
+                       opset(AXVNEGB, r0)
+                       opset(AXVNEGH, r0)
+                       opset(AXVNEGW, r0)
+                       opset(AXVNEGV, r0)
 
                case AVADDB:
                        opset(AVADDH, r0)
@@ -3366,6 +3374,22 @@ func (c *ctxt0) oprr(a obj.As) uint32 {
                return 0x1da741 << 10 // xvfrsqrt.s
        case AXVFRSQRTD:
                return 0x1da742 << 10 // xvfrsqrt.d
+       case AVNEGB:
+               return 0x1ca70c << 10 // vneg.b
+       case AVNEGH:
+               return 0x1ca70d << 10 // vneg.h
+       case AVNEGW:
+               return 0x1ca70e << 10 // vneg.w
+       case AVNEGV:
+               return 0x1ca70f << 10 // vneg.d
+       case AXVNEGB:
+               return 0x1da70c << 10 // xvneg.b
+       case AXVNEGH:
+               return 0x1da70d << 10 // xvneg.h
+       case AXVNEGW:
+               return 0x1da70e << 10 // xvneg.w
+       case AXVNEGV:
+               return 0x1da70f << 10 // xvneg.d
        }
 
        c.ctxt.Diag("bad rr opcode %v", a)