diff options
| author | Joel Sing <joel@sing.id.au> | 2022-08-28 05:23:28 +1000 |
|---|---|---|
| committer | Joel Sing <joel@sing.id.au> | 2022-09-02 20:14:40 +0000 |
| commit | 3e11e61f3ced03d48e7d27ff6e51a3b1c0425db7 (patch) | |
| tree | 49a1cac1560217aaa4e0cfbc383365745f54960f /src/syscall/exec_linux_test.go | |
| parent | 646c3eee06fa4b1b869e8183977aa46d4d4eb646 (diff) | |
| download | go-3e11e61f3ced03d48e7d27ff6e51a3b1c0425db7.tar.xz | |
cmd/compile: optimise subtraction with const on riscv64
Convert subtraction from const to a negated ADDI with negative const
value, where possible. At worst this avoids a register load and uses
the same number of instructions. At best, this allows for further
optimisation to occur, particularly where equality is involved.
For example, this sequence:
li t0,-1
sub t1,t0,a0
snez t1,t1
Becomes:
addi t0,a0,1
snez t0,t0
Removes more than 2000 instructions from the Go binary on linux/riscv64.
Change-Id: I68f3be897bc645d4a8fa3ab3cef165a00a74df19
Reviewed-on: https://go-review.googlesource.com/c/go/+/426263
Reviewed-by: Meng Zhuo <mzh@golangcn.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
Reviewed-by: Cherry Mui <cherryyz@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Run-TryBot: Joel Sing <joel@sing.id.au>
Diffstat (limited to 'src/syscall/exec_linux_test.go')
0 files changed, 0 insertions, 0 deletions
