]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/loong64: add support for instructions FCOPYSIGN.{S/D} and FCLASS...
authorXiaolin Zhao <zhaoxiaolin@loongson.cn>
Wed, 5 Jun 2024 02:52:08 +0000 (10:52 +0800)
committerGopher Robot <gobot@golang.org>
Sat, 3 Aug 2024 01:57:52 +0000 (01:57 +0000)
Go asm syntax:
FCOPYSG{F/D} FK, FJ, FD
FCLASSF{F/D} FJ, FD

Equivalent platform assembler syntax:
fcopysign.{s/d} fd, fj, fk
fclass.{s/d} fd, fj

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

Change-Id: Ied34b71c9d0b34456ac5782a59d29d2d0229e326
Reviewed-on: https://go-review.googlesource.com/c/go/+/590675
Reviewed-by: Cherry Mui <cherryyz@google.com>
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Michael Knyszek <mknyszek@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.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 e16bd78feefeebf5ce23cf64562d9ae1e650db2c..7aeb2920bd4e0216209810644a018fbc3faa2f6b 100644 (file)
@@ -278,3 +278,8 @@ lable2:
        FMAXF   F4, F5                  // a5900801
        FMAXD   F4, F5, F6              // a6100901
        FMAXD   F4, F5                  // a5100901
+
+       FCOPYSGF        F4, F5, F6      // a6901201
+       FCOPYSGD        F4, F5, F6      // a6101301
+       FCLASSF         F4, F5          // 85341401
+       FCLASSD         F4, F5          // 85381401
index e48160eaa292ef15fcc801808dff7dbbd4f4602a..878f148f15290dde11387e490dc4d837e2de097f 100644 (file)
@@ -446,6 +446,14 @@ const (
        AFMAXF
        AFMAXD
 
+       // 3.2.1.7
+       AFCOPYSGF
+       AFCOPYSGD
+
+       // 3.2.1.8
+       AFCLASSF
+       AFCLASSD
+
        ALAST
 
        // aliases
index 42d9ea4d18e5aaa725ae7ee4970e0096d8f439b0..aac8ac92b88d36eef595de3bc16ede08a0a6bc7a 100644 (file)
@@ -183,5 +183,9 @@ var Anames = []string{
        "FMIND",
        "FMAXF",
        "FMAXD",
+       "FCOPYSGF",
+       "FCOPYSGD",
+       "FCLASSF",
+       "FCLASSD",
        "LAST",
 }
index c0f9dee380491d230b414ca92cb3ef128bbe5298..6ac02df988777b9b773de82aaf421502291598f1 100644 (file)
@@ -1028,6 +1028,8 @@ func buildop(ctxt *obj.Link) {
                        opset(ATRUNCFW, r0)
                        opset(ASQRTF, r0)
                        opset(ASQRTD, r0)
+                       opset(AFCLASSF, r0)
+                       opset(AFCLASSD, r0)
 
                case AMOVVF:
                        opset(AMOVVD, r0)
@@ -1056,6 +1058,8 @@ func buildop(ctxt *obj.Link) {
                        opset(AFMIND, r0)
                        opset(AFMAXF, r0)
                        opset(AFMAXD, r0)
+                       opset(AFCOPYSGF, r0)
+                       opset(AFCOPYSGD, r0)
 
                case AAND:
                        opset(AOR, r0)
@@ -1884,6 +1888,10 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
                return 0x211 << 15 // fmax.s
        case AFMAXD:
                return 0x212 << 15 // fmax.d
+       case AFCOPYSGF:
+               return 0x225 << 15 // fcopysign.s
+       case AFCOPYSGD:
+               return 0x226 << 15 // fcopysign.d
        }
 
        if a < 0 {
@@ -1952,6 +1960,10 @@ func (c *ctxt0) oprr(a obj.As) uint32 {
                return 0x4511 << 10
        case ASQRTD:
                return 0x4512 << 10
+       case AFCLASSF:
+               return 0x450d << 10 // fclass.s
+       case AFCLASSD:
+               return 0x450e << 10 // fclass.d
        }
 
        c.ctxt.Diag("bad rr opcode %v", a)