]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/loong64: add ROTR, ROTRV instructions support
authorWayne Zuo <wdvxdr@golangcn.org>
Tue, 9 Aug 2022 15:08:57 +0000 (23:08 +0800)
committerDavid Chase <drchase@google.com>
Tue, 30 Aug 2022 03:21:06 +0000 (03:21 +0000)
Reference: https://loongson.github.io/LoongArch-Documentation/LoongArch-Vol1-EN.html

Change-Id: I29adb84eb70bffd963c79ed6957a5197896fb2bf
Reviewed-on: https://go-review.googlesource.com/c/go/+/422316
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
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 320046609ab0950188b04773d9c11610f37c032a..83bb6ec078d22dc53fead905fcf168ba1c507e06 100644 (file)
@@ -41,8 +41,12 @@ lable2:
        SRL     R4, R5, R6              // a6901700
        SRA     R4, R5                  // a5101800
        SRA     R4, R5, R6              // a6101800
+       ROTR    R4, R5                  // a5101b00
+       ROTR    R4, R5, R6              // a6101b00
        SLLV    R4, R5                  // a5901800
        SLLV    R4, R5, R6              // a6901800
+       ROTRV   R4, R5                  // a5901b00
+       ROTRV   R4, R5, R6              // a6901b00
        CLO     R4, R5                  // 85100000
        CLZ     R4, R5                  // 85140000
        ADDF    F4, F5                  // a5900001
@@ -102,8 +106,12 @@ lable2:
        SRL     $4, R4                  // 84904400
        SRA     $4, R4, R5              // 85904800
        SRA     $4, R4                  // 84904800
+       ROTR    $4, R4, R5              // 85904c00
+       ROTR    $4, R4                  // 84904c00
        SLLV    $4, R4, R5              // 85104100
        SLLV    $4, R4                  // 84104100
+       ROTRV   $4, R4, R5              // 85104d00
+       ROTRV   $4, R4                  // 84104d00
        SYSCALL                         // 00002b00
        BEQ     R4, R5, 1(PC)           // 85040058
        BEQ     R4, 1(PC)               // 80040058
index f57d16758fc1aa0c3dc319bb77abd934544d0eaa..88bf714c5f6cedbbd29ff7d143cd16396f551bff 100644 (file)
@@ -335,6 +335,7 @@ const (
        ASQRTF
        ASRA
        ASRL
+       AROTR
        ASUB
        ASUBD
        ASUBF
@@ -362,6 +363,7 @@ const (
        ASLLV
        ASRAV
        ASRLV
+       AROTRV
        ADIVV
        ADIVVU
 
index c1dcb5bab4ff82dd3bc47faa615e4ec8bec14fb1..20e74655563bed7845ee4c2b835a86780aa7ca5b 100644 (file)
@@ -88,6 +88,7 @@ var Anames = []string{
        "SQRTF",
        "SRA",
        "SRL",
+       "ROTR",
        "SUB",
        "SUBD",
        "SUBF",
@@ -107,6 +108,7 @@ var Anames = []string{
        "SLLV",
        "SRAV",
        "SRLV",
+       "ROTRV",
        "DIVV",
        "DIVVU",
        "REMV",
index 7b46f3cb6d310fe8aa5e9338b4a2d85e37ccb37d..2ac4d3e50eaeefec728cfd700e0f13d10bba73a0 100644 (file)
@@ -980,10 +980,12 @@ func buildop(ctxt *obj.Link) {
                case ASLL:
                        opset(ASRL, r0)
                        opset(ASRA, r0)
+                       opset(AROTR, r0)
 
                case ASLLV:
                        opset(ASRAV, r0)
                        opset(ASRLV, r0)
+                       opset(AROTRV, r0)
 
                case ASUB:
                        opset(ASUBU, r0)
@@ -1653,12 +1655,16 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
                return 0x2f << 15
        case ASRA:
                return 0x30 << 15
+       case AROTR:
+               return 0x36 << 15
        case ASLLV:
                return 0x31 << 15
        case ASRLV:
                return 0x32 << 15
        case ASRAV:
                return 0x33 << 15
+       case AROTRV:
+               return 0x37 << 15
        case AADDV:
                return 0x21 << 15
        case AADDVU:
@@ -1845,6 +1851,8 @@ func (c *ctxt0) opirr(a obj.As) uint32 {
                return 0x00089 << 15
        case ASRA:
                return 0x00091 << 15
+       case AROTR:
+               return 0x00099 << 15
        case AADDV:
                return 0x00b << 22
        case AADDVU:
@@ -1939,6 +1947,9 @@ func (c *ctxt0) opirr(a obj.As) uint32 {
        case ASRAV,
                -ASRAV:
                return 0x0049 << 16
+       case AROTRV,
+               -AROTRV:
+               return 0x004d << 16
        case -ALL:
                return 0x020 << 24
        case -ALLV:
@@ -1961,7 +1972,8 @@ func vshift(a obj.As) bool {
        switch a {
        case ASLLV,
                ASRLV,
-               ASRAV:
+               ASRAV,
+               AROTRV:
                return true
        }
        return false