]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/arm64: add support of NOOP instruction
authordiaxu01 <dianhong.xu@arm.com>
Tue, 3 Sep 2019 02:46:38 +0000 (02:46 +0000)
committerCherry Zhang <cherryyz@google.com>
Fri, 18 Oct 2019 14:15:51 +0000 (14:15 +0000)
This patch uses symbol NOOP to support arm64 instruction NOP. In
arm64, NOP stands for that No Operation does nothing, other than
advance the value of the program counter by 4. This instruction
can be used for instruction alignment purposes. This patch uses
NOOP to support arm64 instruction NOP, because we have a generic
"NOP" instruction, which is a zero-width pseudo-instruction.

In arm64, instruction NOP is an alias of HINT #0. This patch adds
test cases for instruction HINT #0.

Change-Id: I54e6854c46516eb652b412ef9e0f73ab7f171f8c
Reviewed-on: https://go-review.googlesource.com/c/go/+/200578
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>

src/cmd/asm/internal/asm/testdata/arm64.s
src/cmd/asm/internal/asm/testdata/arm64enc.s
src/cmd/internal/obj/arm64/a.out.go
src/cmd/internal/obj/arm64/anames.go
src/cmd/internal/obj/arm64/asm7.go

index 4af47fc6269237df5629c0fcdaa41dd386753f97..c0e2fb7e0e4df32c0d74f29851797350e963e00a 100644 (file)
@@ -1038,6 +1038,8 @@ again:
        FSTPS   (F3, F4), 1024(RSP) // fb0310916313002d
        FSTPS   (F3, F4), x(SB)
        FSTPS   (F3, F4), x+8(SB)
+       NOOP                        // 1f2003d5
+       HINT $0                     // 1f2003d5
 
 // System Register
        MSR     $1, SPSel                          // bf4100d5
index a2850e2e46b69e392ea0ef24b448863ae44947b5..71270ce43f499eeec55ff8b0c283f2a4c38848b7 100644 (file)
@@ -152,6 +152,7 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8
    EXTR $35, R22, R12, R8                     // 888dd693
    SEVL                                       // bf2003d5
    HINT $6                                    // df2003d5
+   HINT $0                                    // 1f2003d5
    HLT $65509                                 // a0fc5fd4
    HVC $61428                                 // 82fe1dd4
    ISB $1                                     // df3103d5
@@ -281,7 +282,7 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8
    NGC R2, R7                                 // e70302da
    NGCSW R10, R5                              // e5030a7a
    NGCS R24, R16                              // f00318fa
-   //TODO NOP                                 // 1f2003d5
+   NOOP                                        // 1f2003d5
    ORNW R4@>11, R16, R3                       // 032ee42a
    ORN R22@>19, R3, R3                        // 634cf6aa
    ORRW $4294443071, R15, R24                 // f8490d32
index bd9e9542b8dd028530a7203250328536a2f6ad33..30362081e1a685df27f867b0d284f33c2e650916 100644 (file)
@@ -701,6 +701,7 @@ const (
        ANGCS
        ANGCSW
        ANGCW
+       ANOOP
        AORN
        AORNW
        AORR
index 2c277dfb95de34733a3c458575b5e068e92f237b..e4dd5f2eb1e686b7f2a00c23d3e79244ea19b6d2 100644 (file)
@@ -208,6 +208,7 @@ var Anames = []string{
        "NGCS",
        "NGCSW",
        "NGCW",
+       "NOOP",
        "ORN",
        "ORNW",
        "ORR",
index 7c3e1d18a549f4280c2d905552603296aefd139c..ff53738d81e382aca9838ce0b1dd550dab1e7596 100644 (file)
@@ -2486,6 +2486,7 @@ func buildop(ctxt *obj.Link) {
                        oprangeset(AYIELD, t)
                        oprangeset(ASEV, t)
                        oprangeset(ASEVL, t)
+                       oprangeset(ANOOP, t)
                        oprangeset(ADRPS, t)
 
                case ACBZ:
@@ -6036,8 +6037,8 @@ func (c *ctxt7) op0(p *obj.Prog, a obj.As) uint32 {
        case AERET:
                return 0x6B<<25 | 4<<21 | 0x1F<<16 | 0<<10 | 0x1F<<5
 
-       // case ANOP:
-       //      return SYSHINT(0)
+       case ANOOP:
+               return SYSHINT(0)
 
        case AYIELD:
                return SYSHINT(1)