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>
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 {