1
0
mirror of https://github.com/golang/go synced 2024-09-29 19:34:38 -06:00

cmd/compile/internal, runtime: use NOOP for hardware NOPs on loong64

The canonical LoongArch NOP instruction form is "andi r0, r0, 0", as
described in the LoongArch Reference Manual Volume 1, Section 2.2.1.10.
We currently use NOR instead, which may or may not change anything (e.g.
performance on less capable micro-architectures) but is deviation from
upstream standards nevertheless. Fix them to use the explicit hardware
NOP which happens to be supported as `NOOP`.

Change-Id: I0a799a1da959e9c3b582feb88202df2bab0ab23a
Reviewed-on: https://go-review.googlesource.com/c/go/+/475615
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Ian Lance Taylor <iant@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
WANG Xuerui 2023-03-11 22:26:39 +08:00 committed by M Zhuo
parent b5c8ae9816
commit 7789966286
2 changed files with 3 additions and 7 deletions

View File

@ -50,10 +50,6 @@ func zerorange(pp *objw.Progs, p *obj.Prog, off, cnt int64, _ *uint32) *obj.Prog
}
func ginsnop(pp *objw.Progs) *obj.Prog {
p := pp.Prog(loong64.ANOR)
p.From.Type = obj.TYPE_REG
p.From.Reg = loong64.REG_R0
p.To.Type = obj.TYPE_REG
p.To.Reg = loong64.REG_R0
p := pp.Prog(loong64.ANOOP)
return p
}

View File

@ -618,10 +618,10 @@ TEXT _cgo_topofstack(SB),NOSPLIT,$16
// The top-most function running on a goroutine
// returns to goexit+PCQuantum.
TEXT runtime·goexit(SB),NOSPLIT|NOFRAME|TOPFRAME,$0-0
NOR R0, R0 // NOP
NOOP
JAL runtime·goexit1(SB) // does not return
// traceback from goexit1 must hit code range of goexit
NOR R0, R0 // NOP
NOOP
TEXT ·checkASM(SB),NOSPLIT,$0-1
MOVW $1, R19