]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/loong64: add {V,XV}SEQ.{B,H,W,D} instructions support
authorGuoqi Chen <chenguoqi@loongson.cn>
Thu, 26 Sep 2024 11:11:50 +0000 (19:11 +0800)
committerabner chenc <chenguoqi@loongson.cn>
Thu, 7 Nov 2024 02:20:26 +0000 (02:20 +0000)
Go asm syntax:
         VSEQ{B,H,W,V}  VJ, VK, VD
        XVSEQ{B,H,W,V}  XJ, XK, XD

Equivalent platform assembler syntax:
         vseq.{b,w,h,d}  vd, vj, vk
        xvseq.{b,w,h,d}  xd, xj, xk

Change-Id: Ia87277b12c817ebc41a46f4c3d09f4b76995ff2f
Reviewed-on: https://go-review.googlesource.com/c/go/+/616076
Reviewed-by: Meidan Li <limeidan@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: Qiqi Huang <huangqiqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: sophie zhao <zhaoxiaolin@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@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 7638ab1be5c125d535ca769f3a3dd0190785e31d..fbfe90a2b0ba91ae6203420040603d6d93c1e9ac 100644 (file)
@@ -433,3 +433,13 @@ lable2:
        XVMOVQ          -2044(R4), X5   // 8510a02c
        XVMOVQ          y+16(FP), X6    // 0660802c
        XVMOVQ          x+2030(FP), X7  // 07d89f2c
+
+       // VSEQ{B,H,W,V}, XVSEQ{B,H,W,V} instruction
+       VSEQB           V1, V2, V3      // 43040070
+       VSEQH           V1, V2, V3      // 43840070
+       VSEQW           V1, V2, V3      // 43040170
+       VSEQV           V1, V2, V3      // 43840170
+       XVSEQB          X3, X2, X4      // 440c0074
+       XVSEQH          X3, X2, X4      // 448c0074
+       XVSEQW          X3, X2, X4      // 440c0174
+       XVSEQV          X3, X2, X4      // 448c0174
index e7736a918da11fd5da62a1aeeca04514d9a70137..4e4135b01796cff527cb4ef9802cb3c65d8b0ead 100644 (file)
@@ -628,6 +628,16 @@ const (
        AVMOVQ
        AXVMOVQ
 
+       // LSX and LASX integer comparison instruction
+       AVSEQB
+       AXVSEQB
+       AVSEQH
+       AXVSEQH
+       AVSEQW
+       AXVSEQW
+       AVSEQV
+       AXVSEQV
+
        ALAST
 
        // aliases
index fc5100d595b61a69c1f173818be2d21a1b307e0f..a316c755225d5bb437198072ab16caffa5f96a19 100644 (file)
@@ -257,5 +257,13 @@ var Anames = []string{
        "FTINTRNEVD",
        "VMOVQ",
        "XVMOVQ",
+       "VSEQB",
+       "XVSEQB",
+       "VSEQH",
+       "XVSEQH",
+       "VSEQW",
+       "XVSEQW",
+       "VSEQV",
+       "XVSEQV",
        "LAST",
 }
index c59c3576c132c171c251cee6b6b209e83128bbef..be316ff7630b0b8b7f03476d3b61d0008f09a954 100644 (file)
@@ -85,6 +85,8 @@ var optab = []Optab{
        {AADDF, C_FREG, C_NONE, C_NONE, C_FREG, C_NONE, 2, 4, 0, 0},
        {AADDF, C_FREG, C_FREG, C_NONE, C_FREG, C_NONE, 2, 4, 0, 0},
        {ACMPEQF, C_FREG, C_FREG, C_NONE, C_FCCREG, C_NONE, 2, 4, 0, 0},
+       {AVSEQB, C_VREG, C_VREG, C_NONE, C_VREG, C_NONE, 2, 4, 0, 0},
+       {AXVSEQB, C_XREG, C_XREG, C_NONE, C_XREG, C_NONE, 2, 4, 0, 0},
 
        {ACLOW, C_REG, C_NONE, C_NONE, C_REG, C_NONE, 9, 4, 0, 0},
        {AABSF, C_FREG, C_NONE, C_NONE, C_FREG, C_NONE, 9, 4, 0, 0},
@@ -1283,6 +1285,15 @@ func buildop(ctxt *obj.Link) {
                                }
                                opset(i, r0)
                        }
+               case AVSEQB:
+                       opset(AVSEQH, r0)
+                       opset(AVSEQW, r0)
+                       opset(AVSEQV, r0)
+
+               case AXVSEQB:
+                       opset(AXVSEQH, r0)
+                       opset(AXVSEQW, r0)
+                       opset(AXVSEQV, r0)
                }
        }
 }
@@ -2125,6 +2136,22 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
                return 0x07088 << 15 // vstx
        case AXVMOVQ:
                return 0x07098 << 15 // xvstx
+       case AVSEQB:
+               return 0x0e000 << 15 // vseq.b
+       case AXVSEQB:
+               return 0x0e800 << 15 // xvseq.b
+       case AVSEQH:
+               return 0x0e001 << 15 // vseq.h
+       case AXVSEQH:
+               return 0x0e801 << 15 // xvseq.h
+       case AVSEQW:
+               return 0x0e002 << 15 // vseq.w
+       case AXVSEQW:
+               return 0x0e802 << 15 // xvseq.w
+       case AVSEQV:
+               return 0x0e003 << 15 // vseq.d
+       case AXVSEQV:
+               return 0x0e803 << 15 // xvseq.d
        }
 
        if a < 0 {