Skip to content

Commit

Permalink
cmd/compile/internal/ssa: optimize ANDconst rule of loong64
Browse files Browse the repository at this point in the history
Change-Id: I0e88f885ff17b4932c2f448dc3c577c0329a6658
Reviewed-on: https://go-review.googlesource.com/c/go/+/620976
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
Reviewed-by: abner chenc <chenguoqi@loongson.cn>
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
  • Loading branch information
limeidan authored and abner-chenc committed Oct 22, 2024
1 parent 0753396 commit 4bfc81a
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cmd/compile/internal/ssa/_gen/LOONG64.rules
Original file line number Diff line number Diff line change
Expand Up @@ -730,6 +730,8 @@
(MOVWUreg (MOVVconst [c])) => (MOVVconst [int64(uint32(c))])
(MOVVreg (MOVVconst [c])) => (MOVVconst [c])

(MOVBUreg (ANDconst [c] x)) => (ANDconst [c&0xff] x)

// constant comparisons
(SGTconst [c] (MOVVconst [d])) && c>d => (MOVVconst [1])
(SGTconst [c] (MOVVconst [d])) && c<=d => (MOVVconst [0])
Expand Down
13 changes: 13 additions & 0 deletions src/cmd/compile/internal/ssa/rewriteLOONG64.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 4bfc81a

Please sign in to comment.