]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/loong64: add support for instructions F{MAX/NIN}.{S/D}
authorXiaolin Zhao <zhaoxiaolin@loongson.cn>
Wed, 10 Apr 2024 03:37:56 +0000 (11:37 +0800)
committerGopher Robot <gobot@golang.org>
Fri, 2 Aug 2024 14:33:57 +0000 (14:33 +0000)
Go asm syntax:
F{MAX/MIN}{F/D} FK, FJ, FD

Equivalent platform assembler syntax:
f{max/min}.{s/d} fd, fj, fk

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

Change-Id: Ib11fed1fe3700be5ebba33b5818661c4071b7b7c
Reviewed-on: https://go-review.googlesource.com/c/go/+/590676
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>

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 e648d178dddc19f6f7338ceb412e2dea366a9753..e16bd78feefeebf5ce23cf64562d9ae1e650db2c 100644 (file)
@@ -269,3 +269,12 @@ lable2:
        AMMAXDBVU       R14, (R13), R12 // acb97038
        AMMINDBWU       R14, (R13), R12 // ac397138
        AMMINDBVU       R14, (R13), R12 // acb97138
+
+       FMINF   F4, F5, F6              // a6900a01
+       FMINF   F4, F5                  // a5900a01
+       FMIND   F4, F5, F6              // a6100b01
+       FMIND   F4, F5                  // a5100b01
+       FMAXF   F4, F5, F6              // a6900801
+       FMAXF   F4, F5                  // a5900801
+       FMAXD   F4, F5, F6              // a6100901
+       FMAXD   F4, F5                  // a5100901
index cf5c74fde2ebb0270d90affa263fb331f4aa3767..9309a3b09a9c1f5abb74a71438c97ccf9261d5b1 100644 (file)
@@ -440,6 +440,12 @@ const (
        ARDTIMED
        ACPUCFG
 
+       // 3.2.1.3
+       AFMINF
+       AFMIND
+       AFMAXF
+       AFMAXD
+
        ALAST
 
        // aliases
index 9bfc57e239b7e76b2da1df6f18c46a68cce785c6..42d9ea4d18e5aaa725ae7ee4970e0096d8f439b0 100644 (file)
@@ -179,5 +179,9 @@ var Anames = []string{
        "RDTIMEHW",
        "RDTIMED",
        "CPUCFG",
+       "FMINF",
+       "FMIND",
+       "FMAXF",
+       "FMAXD",
        "LAST",
 }
index 8c9ff2096ed14a9447c290c7e513f83adf6fc1d1..c0f9dee380491d230b414ca92cb3ef128bbe5298 100644 (file)
@@ -1052,6 +1052,10 @@ func buildop(ctxt *obj.Link) {
                        opset(ASUBF, r0)
                        opset(ASUBD, r0)
                        opset(AADDD, r0)
+                       opset(AFMINF, r0)
+                       opset(AFMIND, r0)
+                       opset(AFMAXF, r0)
+                       opset(AFMAXD, r0)
 
                case AAND:
                        opset(AOR, r0)
@@ -1872,6 +1876,14 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
                return 0x0c2<<20 | 0x3<<15 // FCMP.SLT.D
        case ACMPGTF:
                return 0x0c1<<20 | 0x3<<15 // FCMP.SLT.S
+       case AFMINF:
+               return 0x215 << 15 // fmin.s
+       case AFMIND:
+               return 0x216 << 15 // fmin.d
+       case AFMAXF:
+               return 0x211 << 15 // fmax.s
+       case AFMAXD:
+               return 0x212 << 15 // fmax.d
        }
 
        if a < 0 {