aboutsummaryrefslogtreecommitdiff
path: root/src/cmd
diff options
context:
space:
mode:
authorJoel Sing <joel@sing.id.au>2023-01-08 02:03:30 +1100
committerJoel Sing <joel@sing.id.au>2023-02-23 06:09:10 +0000
commitecff9c9335584a58ff6c45e71876ba60d982676c (patch)
treeec0484734bf1108f7a9d171bd0ee8fef5dcd20db /src/cmd
parent8f3a13de9ac8c207b5bf1258179924dc09df53f2 (diff)
downloadgo-ecff9c9335584a58ff6c45e71876ba60d982676c.tar.xz
cmd/internal/obj/arm64: invert SP check
Check for REGSP use before checking for invalid instructions. This simplifies the code and avoids duplicated op generation. Change-Id: I302e3b54a29742f2c48024b25162200f5966cfaa Reviewed-on: https://go-review.googlesource.com/c/go/+/461138 TryBot-Result: Gopher Robot <gobot@golang.org> Reviewed-by: Eric Fang <eric.fang@arm.com> Reviewed-by: Than McIntosh <thanm@google.com> Run-TryBot: Joel Sing <joel@sing.id.au> Reviewed-by: Cherry Mui <cherryyz@google.com>
Diffstat (limited to 'src/cmd')
-rw-r--r--src/cmd/internal/obj/arm64/asm7.go8
1 files changed, 2 insertions, 6 deletions
diff --git a/src/cmd/internal/obj/arm64/asm7.go b/src/cmd/internal/obj/arm64/asm7.go
index 5290aa11ef..f96efaee9d 100644
--- a/src/cmd/internal/obj/arm64/asm7.go
+++ b/src/cmd/internal/obj/arm64/asm7.go
@@ -3776,14 +3776,10 @@ func (c *ctxt7) asmout(p *obj.Prog, o *Optab, out []uint32) {
case 24: /* mov/mvn Rs,Rd -> add $0,Rs,Rd or orr Rs,ZR,Rd */
rf := int(p.From.Reg)
rt := int(p.To.Reg)
- s := rf == REGSP || rt == REGSP
- if p.As == AMVN || p.As == AMVNW {
- if s {
+ if rf == REGSP || rt == REGSP {
+ if p.As == AMVN || p.As == AMVNW {
c.ctxt.Diag("illegal SP reference\n%v", p)
}
- o1 = c.oprrr(p, p.As)
- o1 |= (uint32(rf&31) << 16) | (REGZERO & 31 << 5) | uint32(rt&31)
- } else if s {
o1 = c.opirr(p, p.As)
o1 |= (uint32(rf&31) << 5) | uint32(rt&31)
} else {