Skip to content

Commit b266318

Browse files
limeidanabner-chenc
authored andcommitted
cmd/compile/internal/ssa: use BEQ/BNE to optimize the combination of XOR and EQ/NE on loong64
Reduce the number of go toolchain instructions on loong64 as follows: file before after Δ % go 1599056 1590560 -8496 -0.5313% gofmt 326188 326104 -84 -0.0258% asm 563482 561250 -2232 -0.3961% cgo 488644 485252 -3392 -0.6942% compile 2504614 2486388 -18226 -0.7277% cover 526322 523270 -3052 -0.5799% link 714532 711124 -3408 -0.4770% preprofile 242316 241112 -1204 -0.4969% vet 794446 786118 -8328 -1.0483% Change-Id: I0914889119a28ea672b694529ef54513fbb3f3b5 Reviewed-on: https://go-review.googlesource.com/c/go/+/693875 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: abner chenc <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]> Reviewed-by: Keith Randall <[email protected]>
1 parent adbf595 commit b266318

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

src/cmd/compile/internal/ssa/_gen/LOONG64latelower.rules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,6 @@
44

55
// Prefer addition when shifting left by one.
66
(SLLVconst [1] x) => (ADDV x x)
7+
8+
(EQZ (XOR x y) yes no) => (BEQ x y yes no)
9+
(NEZ (XOR x y) yes no) => (BNE x y yes no)

src/cmd/compile/internal/ssa/rewriteLOONG64latelower.go

Lines changed: 32 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)