]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: avoid unnecessary sign/zero extension for consts on riscv64
authorJoel Sing <joel@sing.id.au>
Mon, 26 Oct 2020 07:35:40 +0000 (18:35 +1100)
committerJoel Sing <joel@sing.id.au>
Sat, 31 Oct 2020 08:31:08 +0000 (08:31 +0000)
commit12a2e72065105a7c167d7f41500b5a80547f14d0
treeea9434dcc2315664489df6f84412fc594150db5d
parent48be3ed1394d85af5a7e1a6313fa9cab4d1b7cf9
cmd/compile: avoid unnecessary sign/zero extension for consts on riscv64

Sign extension for consts is unnecessary and zero extension for consts can be avoided
via casts. This removes over 16,000 instructions from the Go binary, in part because it
allows for better zero const absorbtion in blocks - for example,
`(BEQ (MOVBU (MOVBconst [0])) cond yes no)` now becomes `(BEQZ cond yes no)` when
this change is combined with existing rules.

Change-Id: I27e791bfa84869639db653af6119f6e10369ba3d
Reviewed-on: https://go-review.googlesource.com/c/go/+/265041
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Run-TryBot: Cherry Zhang <cherryyz@google.com>
TryBot-Result: Go Bot <gobot@golang.org>
src/cmd/compile/internal/ssa/gen/RISCV64.rules
src/cmd/compile/internal/ssa/rewriteRISCV64.go