]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: use the shorter version of XOR for breaking POPCNT register
authorJake Ciolek <jakub@ciolek.dev>
Sat, 9 Oct 2021 18:09:21 +0000 (20:09 +0200)
committerJosh Bleecher Snyder <josharian@gmail.com>
Sat, 9 Oct 2021 23:29:26 +0000 (23:29 +0000)
dependency

XORL accomplishes the same thing while being shorter to encode.

Change-Id: I4397999ff617edb61a7fb7d1eca757a202ab8134
Reviewed-on: https://go-review.googlesource.com/c/go/+/354832
Reviewed-by: Keith Randall <khr@golang.org>
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Trust: Josh Bleecher Snyder <josharian@gmail.com>

src/cmd/compile/internal/amd64/ssa.go

index 33cd5985e0ed7d7ea15974d20a28f355fd5f8ae1..78822098a78591012a65b50e66e1842146f40bb8 100644 (file)
@@ -1125,7 +1125,7 @@ func ssaGenValue(s *ssagen.State, v *ssa.Value) {
                if v.Args[0].Reg() != v.Reg() {
                        // POPCNT on Intel has a false dependency on the destination register.
                        // Xor register with itself to break the dependency.
-                       p := s.Prog(x86.AXORQ)
+                       p := s.Prog(x86.AXORL)
                        p.From.Type = obj.TYPE_REG
                        p.From.Reg = v.Reg()
                        p.To.Type = obj.TYPE_REG