Skip to content

Commit 4bfc81a

Browse files
limeidanabner-chenc
authored andcommitted
cmd/compile/internal/ssa: optimize ANDconst rule of loong64
Change-Id: I0e88f885ff17b4932c2f448dc3c577c0329a6658 Reviewed-on: https://go-review.googlesource.com/c/go/+/620976 LUCI-TryBot-Result: Go LUCI <[email protected]> Reviewed-by: Michael Pratt <[email protected]> Reviewed-by: abner chenc <[email protected]> Reviewed-by: Dmitri Shuralyov <[email protected]>
1 parent 0753396 commit 4bfc81a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -730,6 +730,8 @@
730730
(MOVWUreg (MOVVconst [c])) => (MOVVconst [int64(uint32(c))])
731731
(MOVVreg (MOVVconst [c])) => (MOVVconst [c])
732732

733+
(MOVBUreg (ANDconst [c] x)) => (ANDconst [c&0xff] x)
734+
733735
// constant comparisons
734736
(SGTconst [c] (MOVVconst [d])) && c>d => (MOVVconst [1])
735737
(SGTconst [c] (MOVVconst [d])) && c<=d => (MOVVconst [0])

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

Lines changed: 13 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)