]> Cypherpunks repositories - gostls13.git/commit
cmd/compile/internal/ssa: optimise more branches with SGTconst/SGTUconst on loong64
authorXiaolin Zhao <zhaoxiaolin@loongson.cn>
Tue, 5 Aug 2025 09:14:35 +0000 (17:14 +0800)
committerabner chenc <chenguoqi@loongson.cn>
Mon, 11 Aug 2025 01:53:21 +0000 (18:53 -0700)
commita62f72f7a7ee606c803d1c68cadd24e45eea5e83
tree46c38f4320bb87970e8f3e74c67a69979374ce28
parentfbac94a79998d4730a58592f0634fa8a39d8b9fb
cmd/compile/internal/ssa: optimise more branches with SGTconst/SGTUconst on loong64

Add branches to convert EQZ/NEZ into more optimal branch conditions.
This reduces 720 instructions from the go toolchain binary on loong64.

file         before      after      Δ       %
asm          555306      555082   -224   -0.0403%
cgo          481814      481742   -72    -0.0149%
compile      2475686     2475710  +24    +0.0010%
cover        516854      516770   -84    -0.0163%
link         702566      702530   -36    -0.0051%
preprofile   238612      238548   -64    -0.0268%
vet          793140      793060   -80    -0.0101%
go           1573466     1573346  -120   -0.0076%
gofmt        320560      320496   -64    -0.0200%
total        7658004     7657284  -720   -0.0094%

Additionally, rename EQ/NE to EQZ/NEZ to enhance readability.

Change-Id: Ibc876bc8b8d4e81d5c3aaf0b74b60419f3c771b1
Reviewed-on: https://go-review.googlesource.com/c/go/+/693455
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Keith Randall <khr@google.com>
src/cmd/compile/internal/loong64/ssa.go
src/cmd/compile/internal/ssa/_gen/LOONG64.rules
src/cmd/compile/internal/ssa/_gen/LOONG64Ops.go
src/cmd/compile/internal/ssa/opGen.go
src/cmd/compile/internal/ssa/rewriteLOONG64.go