Commit 3876bd67 authored by diaxu01's avatar diaxu01 Committed by Cherry Zhang

cmd/internal/obj/arm64: add support of NOOP instruction

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/+/200578Reviewed-by: default avatarCherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 57c63e0f
...@@ -1038,6 +1038,8 @@ again: ...@@ -1038,6 +1038,8 @@ again:
FSTPS (F3, F4), 1024(RSP) // fb0310916313002d FSTPS (F3, F4), 1024(RSP) // fb0310916313002d
FSTPS (F3, F4), x(SB) FSTPS (F3, F4), x(SB)
FSTPS (F3, F4), x+8(SB) FSTPS (F3, F4), x+8(SB)
NOOP // 1f2003d5
HINT $0 // 1f2003d5
// System Register // System Register
MSR $1, SPSel // bf4100d5 MSR $1, SPSel // bf4100d5
......
...@@ -152,6 +152,7 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8 ...@@ -152,6 +152,7 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8
EXTR $35, R22, R12, R8 // 888dd693 EXTR $35, R22, R12, R8 // 888dd693
SEVL // bf2003d5 SEVL // bf2003d5
HINT $6 // df2003d5 HINT $6 // df2003d5
HINT $0 // 1f2003d5
HLT $65509 // a0fc5fd4 HLT $65509 // a0fc5fd4
HVC $61428 // 82fe1dd4 HVC $61428 // 82fe1dd4
ISB $1 // df3103d5 ISB $1 // df3103d5
...@@ -281,7 +282,7 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8 ...@@ -281,7 +282,7 @@ TEXT asmtest(SB),DUPOK|NOSPLIT,$-8
NGC R2, R7 // e70302da NGC R2, R7 // e70302da
NGCSW R10, R5 // e5030a7a NGCSW R10, R5 // e5030a7a
NGCS R24, R16 // f00318fa NGCS R24, R16 // f00318fa
//TODO NOP // 1f2003d5 NOOP // 1f2003d5
ORNW R4@>11, R16, R3 // 032ee42a ORNW R4@>11, R16, R3 // 032ee42a
ORN R22@>19, R3, R3 // 634cf6aa ORN R22@>19, R3, R3 // 634cf6aa
ORRW $4294443071, R15, R24 // f8490d32 ORRW $4294443071, R15, R24 // f8490d32
......
...@@ -701,6 +701,7 @@ const ( ...@@ -701,6 +701,7 @@ const (
ANGCS ANGCS
ANGCSW ANGCSW
ANGCW ANGCW
ANOOP
AORN AORN
AORNW AORNW
AORR AORR
......
...@@ -208,6 +208,7 @@ var Anames = []string{ ...@@ -208,6 +208,7 @@ var Anames = []string{
"NGCS", "NGCS",
"NGCSW", "NGCSW",
"NGCW", "NGCW",
"NOOP",
"ORN", "ORN",
"ORNW", "ORNW",
"ORR", "ORR",
......
...@@ -2486,6 +2486,7 @@ func buildop(ctxt *obj.Link) { ...@@ -2486,6 +2486,7 @@ func buildop(ctxt *obj.Link) {
oprangeset(AYIELD, t) oprangeset(AYIELD, t)
oprangeset(ASEV, t) oprangeset(ASEV, t)
oprangeset(ASEVL, t) oprangeset(ASEVL, t)
oprangeset(ANOOP, t)
oprangeset(ADRPS, t) oprangeset(ADRPS, t)
case ACBZ: case ACBZ:
...@@ -6036,8 +6037,8 @@ func (c *ctxt7) op0(p *obj.Prog, a obj.As) uint32 { ...@@ -6036,8 +6037,8 @@ func (c *ctxt7) op0(p *obj.Prog, a obj.As) uint32 {
case AERET: case AERET:
return 0x6B<<25 | 4<<21 | 0x1F<<16 | 0<<10 | 0x1F<<5 return 0x6B<<25 | 4<<21 | 0x1F<<16 | 0<<10 | 0x1F<<5
// case ANOP: case ANOOP:
// return SYSHINT(0) return SYSHINT(0)
case AYIELD: case AYIELD:
return SYSHINT(1) return SYSHINT(1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment