]> Cypherpunks repositories - gostls13.git/commit
cmd/compile: use MOV pseudo-instructions for sign/zero extension
authorJoel Sing <joel@sing.id.au>
Sat, 24 Oct 2020 13:32:23 +0000 (00:32 +1100)
committerJoel Sing <joel@sing.id.au>
Tue, 27 Oct 2020 11:40:45 +0000 (11:40 +0000)
commit8a013233ac53d934e53cd7d118b5ff7836d8973a
tree9db5bf290b5fe33b402660f655e678902d35d6c4
parent1095dd6339dbaf8d7c92214396c0a4dbcfa38521
cmd/compile: use MOV pseudo-instructions for sign/zero extension

Rather than handling sign and zero extension via rules, defer to the assembler
and use MOV pseudo-instructions. The instruction can also be omitted where the
type and size is already correct. This change results in more than 6,000
instructions being removed from the go binary (in part due to omitted
instructions, in part due to MOVBU having a more efficient implementation in
the assembler than what is used in the current ZeroExt8to{16,32,64} rules).

This will also allow for further rewriting to remove redundant sign/zero
extension.

Change-Id: I05e42fd9f09f40a69948be7de772cce8946c8744
Reviewed-on: https://go-review.googlesource.com/c/go/+/264658
Trust: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
src/cmd/compile/internal/riscv64/ssa.go
src/cmd/compile/internal/ssa/gen/RISCV64.rules
src/cmd/compile/internal/ssa/gen/RISCV64Ops.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/ssa/rewriteRISCV64.go