]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/internal/obj/arm64: invert SP check
authorJoel Sing <joel@sing.id.au>
Sat, 7 Jan 2023 15:03:30 +0000 (02:03 +1100)
committerJoel Sing <joel@sing.id.au>
Thu, 23 Feb 2023 06:09:10 +0000 (06:09 +0000)
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>
src/cmd/internal/obj/arm64/asm7.go

index 5290aa11ef41fa45953d311f27704166b3e599c5..f96efaee9d53d6e72c165da2384ae590cbdfd2c1 100644 (file)
@@ -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 {