]> Cypherpunks.ru repositories - gostls13.git/commit
cmd/compile: fold constant shift with extension on riscv64
authorWayne Zuo <wdvxdr@golangcn.org>
Tue, 6 Sep 2022 03:43:28 +0000 (11:43 +0800)
committerJoel Sing <joel@sing.id.au>
Thu, 6 Oct 2022 05:21:04 +0000 (05:21 +0000)
commitaf668c689c66588f8adb9f5cd6db812706536338
tree1537804de703171a60a5996aac6228e84d9aab28
parentb314eea4cdba0755caedc9a3e683d3f7e1e2be6f
cmd/compile: fold constant shift with extension on riscv64

For example:

  movb a0, a0
  srai $1, a0, a0

the assembler will expand to:

  slli $56, a0, a0
  srai $56, a0, a0
  srai $1, a0, a0

this CL optimize to:

  slli $56, a0, a0
  srai $57, a0, a0

Remove 270+ instructions from Go binary on linux/riscv64.

Change-Id: I375e19f9d3bd54f2781791d8cbe5970191297dc8
Reviewed-on: https://go-review.googlesource.com/c/go/+/428496
Reviewed-by: Keith Randall <khr@google.com>
Run-TryBot: Wayne Zuo <wdvxdr@golangcn.org>
Reviewed-by: Joel Sing <joel@sing.id.au>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
src/cmd/compile/internal/ssa/_gen/RISCV64latelower.rules [new file with mode: 0644]
src/cmd/compile/internal/ssa/config.go
src/cmd/compile/internal/ssa/rewriteRISCV64latelower.go [new file with mode: 0644]
test/codegen/shift.go