]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: use ADDQ instead of LEAQ when we can
authorKeith Randall <khr@golang.org>
Sat, 30 Nov 2019 22:04:35 +0000 (14:04 -0800)
committerKeith Randall <khr@golang.org>
Mon, 24 Feb 2020 21:33:53 +0000 (21:33 +0000)
commit1cfe8e91b6d742140153d943e1b09ad48c670b1f
treeb0029edfe9e67f660ff947e3658881d30766f943
parent4f074b58d2016eee2b63ffb668f6ed28156ecf62
cmd/compile: use ADDQ instead of LEAQ when we can

The address calculations in the example end up doing x << 4 + y + 0.
Before this CL we use a SHLQ+LEAQ. Since the constant offset is 0,
we can use SHLQ+ADDQ instead.

Change-Id: Ia048c4fdbb3a42121c7e1ab707961062e8247fca
Reviewed-on: https://go-review.googlesource.com/c/go/+/209959
Run-TryBot: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/ssa/gen/AMD64.rules
src/cmd/compile/internal/ssa/rewriteAMD64.go
test/codegen/addrcalc.go [new file with mode: 0644]