]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/loong64: add support for instructions FSCALEB{F/D} and FLOGB{F/D}
authorXiaolin Zhao <zhaoxiaolin@loongson.cn>
Fri, 13 Sep 2024 07:32:03 +0000 (15:32 +0800)
committerGopher Robot <gobot@golang.org>
Fri, 13 Sep 2024 17:05:38 +0000 (17:05 +0000)
Go asm syntax:
FSCALEB{F/D} FK, FJ, FD
FLOGB{F/D} FJ, FD

Equivalent platform assembler syntax:
fscaleb.{s/d} fd, fj, fk
flogb.{s/d} fd, fj

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

Change-Id: I6cd75c7605adbb572dae86d6470ec7cf20ce0f6c
Reviewed-on: https://go-review.googlesource.com/c/go/+/612975
Auto-Submit: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Reviewed-by: Tim King <taking@google.com>
Reviewed-by: Meidan Li <limeidan@loongson.cn>
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 45256beb7cf71f87e368a89dd154dbe66254b06f..2688f7f22c4c22776699e4a983744588e6e36778 100644 (file)
@@ -351,3 +351,8 @@ lable2:
        BSTRPICKV       $0, R4, $0, R5  // 8500c000
        BSTRPICKV       $63, R4, $0, R5 // 8500ff00
        BSTRPICKV       $15, R4, $6, R5 // 8518cf00
+
+       FSCALEBF        F4, F5, F6      // a6901001
+       FSCALEBD        F4, F5, F6      // a6101101
+       FLOGBF          F4, F5          // 85241401
+       FLOGBD          F4, F5          // 85281401
index 60b0a62180b91ed8637efafbf570543a94b6d296..a2a809cbc0e7ef9c1176b19ff37b2f3ad075803f 100644 (file)
@@ -462,6 +462,10 @@ const (
        // 3.2.1.7
        AFCOPYSGF
        AFCOPYSGD
+       AFSCALEBF
+       AFSCALEBD
+       AFLOGBF
+       AFLOGBD
 
        // 3.2.1.8
        AFCLASSF
index ddf13eec6e02ef062a7b3972a329f67c4eb150ab..2dc6319c4b41e98dd25d8d92242794f9c84e9ba7 100644 (file)
@@ -191,6 +191,10 @@ var Anames = []string{
        "FMAXD",
        "FCOPYSGF",
        "FCOPYSGD",
+       "FSCALEBF",
+       "FSCALEBD",
+       "FLOGBF",
+       "FLOGBD",
        "FCLASSF",
        "FCLASSD",
        "FFINTFW",
index 4e5bc15d332e9289171a0524cbaacc7b237517a7..926b9952a2487a0bf3cfe3eda152b787598583e7 100644 (file)
@@ -1042,6 +1042,8 @@ func buildop(ctxt *obj.Link) {
                        opset(ASQRTD, r0)
                        opset(AFCLASSF, r0)
                        opset(AFCLASSD, r0)
+                       opset(AFLOGBF, r0)
+                       opset(AFLOGBD, r0)
 
                case AMOVVF:
                        opset(AMOVVD, r0)
@@ -1096,6 +1098,8 @@ func buildop(ctxt *obj.Link) {
                        opset(AFMAXD, r0)
                        opset(AFCOPYSGF, r0)
                        opset(AFCOPYSGD, r0)
+                       opset(AFSCALEBF, r0)
+                       opset(AFSCALEBD, r0)
 
                case AAND:
                        opset(AOR, r0)
@@ -1969,6 +1973,10 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
                return 0x211 << 15 // fmax.s
        case AFMAXD:
                return 0x212 << 15 // fmax.d
+       case AFSCALEBF:
+               return 0x221 << 15 // fscaleb.s
+       case AFSCALEBD:
+               return 0x222 << 15 // fscaleb.d
        case AFCOPYSGF:
                return 0x225 << 15 // fcopysign.s
        case AFCOPYSGD:
@@ -2071,6 +2079,10 @@ func (c *ctxt0) oprr(a obj.As) uint32 {
                return 0x4511 << 10
        case ASQRTD:
                return 0x4512 << 10
+       case AFLOGBF:
+               return 0x4509 << 10 // flogb.s
+       case AFLOGBD:
+               return 0x450a << 10 // flogb.d
        case AFCLASSF:
                return 0x450d << 10 // fclass.s
        case AFCLASSD: