1
0
mirror of https://github.com/golang/go synced 2024-11-11 22:50:22 -07:00

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/+/200578
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
diaxu01 2019-09-03 02:46:38 +00:00 committed by Cherry Zhang
parent 57c63e0fb2
commit 3876bd67ef
5 changed files with 9 additions and 3 deletions

View 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

View 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

View File

@ -701,6 +701,7 @@ const (
ANGCS
ANGCSW
ANGCW
ANOOP
AORN
AORNW
AORR

View File

@ -208,6 +208,7 @@ var Anames = []string{
"NGCS",
"NGCSW",
"NGCW",
"NOOP",
"ORN",
"ORNW",
"ORR",

View 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)