summaryrefslogtreecommitdiff
path: root/test/codegen/arithmetic.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2019-03-19 12:26:22 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2019-03-19 19:44:52 +0000
commit250b96a7bfa5b9ac0f31e70e768173f57a61d2f7 (patch)
tree105be22ff285df0d1f5b40819b69a1b3844d3285 /test/codegen/arithmetic.go
parentfc1e6915dc04aeb95c2f736f8c8805ba6a696c30 (diff)
downloadgo-git-250b96a7bfa5b9ac0f31e70e768173f57a61d2f7.tar.gz
cmd/compile: slightly optimize adding 128
'SUBQ $-0x80, r' is shorter to encode than 'ADDQ $0x80, r', and functionally equivalent. Use it instead. Shaves off a few bytes here and there: file before after Δ % compile 25935856 25927664 -8192 -0.032% nm 4251840 4247744 -4096 -0.096% Change-Id: Ia9e02ea38cbded6a52a613b92e3a914f878d931e Reviewed-on: https://go-review.googlesource.com/c/go/+/168344 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Diffstat (limited to 'test/codegen/arithmetic.go')
-rw-r--r--test/codegen/arithmetic.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/codegen/arithmetic.go b/test/codegen/arithmetic.go
index 16d7d25d3e..b5976be9d2 100644
--- a/test/codegen/arithmetic.go
+++ b/test/codegen/arithmetic.go
@@ -381,3 +381,13 @@ func MULS(a, b, c uint32) (uint32, uint32, uint32) {
r2 := c - b*64
return r0, r1, r2
}
+
+func addSpecial(a, b, c uint32) (uint32, uint32, uint32) {
+ // amd64:`INCL`
+ a++
+ // amd64:`DECL`
+ b--
+ // amd64:`SUBL.*-128`
+ c += 128
+ return a, b, c
+}