]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: Add some CMP and CMN optimization rules on arm64
authoreric fang <eric.fang@arm.com>
Wed, 7 Sep 2022 08:34:52 +0000 (08:34 +0000)
committerEric Fang <eric.fang@arm.com>
Tue, 20 Sep 2022 01:14:40 +0000 (01:14 +0000)
commitcf53990b18750e77963e5cf075c5a921d384b33b
treee697ec21b681344ddbb397fa7be66e1dcc6313e9
parent7db923fe565465f292d3e62d6c7ded86e724062d
cmd/compile: Add some CMP and CMN optimization rules on arm64

This CL adds some optimizaion rules:
1, Converts CMP to CMN, or vice versa, when comparing with a negative
number.
2, For equal and not equal comparisons, CMP can be converted to CMN in
some cases. In theory we could do the same optimization for LT, LE, GT
and GE, but need to account for overflow, this CL doesn't handle them.

There are no noticeable performance changes.

Change-Id: Ia49266c019ab7908ebc9510c2f02e121b1607869
Reviewed-on: https://go-review.googlesource.com/c/go/+/429795
Reviewed-by: Keith Randall <khr@golang.org>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Eric Fang <eric.fang@arm.com>
src/cmd/compile/internal/ssa/gen/ARM64.rules
src/cmd/compile/internal/ssa/rewriteARM64.go
src/cmd/internal/obj/arm64/obj7.go
test/codegen/comparisons.go