]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/loong64: add support for instructions ANDN and ORN
authorXiaolin Zhao <zhaoxiaolin@loongson.cn>
Wed, 4 Sep 2024 08:19:22 +0000 (16:19 +0800)
committerGopher Robot <gobot@golang.org>
Thu, 5 Sep 2024 00:48:33 +0000 (00:48 +0000)
Go asm syntax:
ANDN/ORN RK, RJ, RD
    or  ANDN/ORN RK, RD

Equivalent platform assembler syntax:
andn/orn rd, rj, rk
    or  andn/orn rd, rd, rk

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

Change-Id: I6d240ecae8f9443811ca450aed3574f13f0f4a81
Reviewed-on: https://go-review.googlesource.com/c/go/+/610475
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
Commit-Queue: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
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 8d4231fa6cf1a9392d234b81c12830b2c031ac7d..45256beb7cf71f87e368a89dd154dbe66254b06f 100644 (file)
@@ -132,6 +132,11 @@ lable2:
        BREAK                           // 00002a00
        UNDEF                           // 00002a00
 
+       ANDN    R4, R5, R6              // a6901600
+       ANDN    R4, R5                  // a5901600
+       ORN     R4, R5, R6              // a6101600
+       ORN     R4, R5                  // a5101600
+
        // mul
        MUL     R4, R5                  // a5101c00
        MUL     R4, R5, R6              // a6101c00
index 7c20df3b2d541bc8e5f9f1f48df6a4d4dff4f09d..60b0a62180b91ed8637efafbf570543a94b6d296 100644 (file)
@@ -385,6 +385,10 @@ const (
        AMOVVF
        AMOVVD
 
+       // 2.2.1.8
+       AORN
+       AANDN
+
        // 2.2.7. Atomic Memory Access Instructions
        AAMSWAPB
        AAMSWAPH
index ed3d5b25ced88ddf9cd77fd3a0d321c9dd54f7b2..ddf13eec6e02ef062a7b3972a329f67c4eb150ab 100644 (file)
@@ -127,6 +127,8 @@ var Anames = []string{
        "MOVDV",
        "MOVVF",
        "MOVVD",
+       "ORN",
+       "ANDN",
        "AMSWAPB",
        "AMSWAPH",
        "AMSWAPW",
index 261e4a13c8b26e44cd4fce37aaefe148bebdfcd5..4e5bc15d332e9289171a0524cbaacc7b237517a7 100644 (file)
@@ -1100,6 +1100,8 @@ func buildop(ctxt *obj.Link) {
                case AAND:
                        opset(AOR, r0)
                        opset(AXOR, r0)
+                       opset(AORN, r0)
+                       opset(AANDN, r0)
 
                case ABEQ:
                        opset(ABNE, r0)
@@ -1858,6 +1860,10 @@ func (c *ctxt0) oprrr(a obj.As) uint32 {
                return 0x2a << 15
        case AXOR:
                return 0x2b << 15
+       case AORN:
+               return 0x2c << 15 // orn
+       case AANDN:
+               return 0x2d << 15 // andn
        case ASUB:
                return 0x22 << 15
        case ASUBU, ANEGW: