mirror of
https://github.com/golang/go
synced 2024-11-14 13:30:30 -07:00
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 <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>
This commit is contained in:
parent
0753396628
commit
4bfc81a727
@ -730,6 +730,8 @@
|
|||||||
(MOVWUreg (MOVVconst [c])) => (MOVVconst [int64(uint32(c))])
|
(MOVWUreg (MOVVconst [c])) => (MOVVconst [int64(uint32(c))])
|
||||||
(MOVVreg (MOVVconst [c])) => (MOVVconst [c])
|
(MOVVreg (MOVVconst [c])) => (MOVVconst [c])
|
||||||
|
|
||||||
|
(MOVBUreg (ANDconst [c] x)) => (ANDconst [c&0xff] x)
|
||||||
|
|
||||||
// constant comparisons
|
// constant comparisons
|
||||||
(SGTconst [c] (MOVVconst [d])) && c>d => (MOVVconst [1])
|
(SGTconst [c] (MOVVconst [d])) && c>d => (MOVVconst [1])
|
||||||
(SGTconst [c] (MOVVconst [d])) && c<=d => (MOVVconst [0])
|
(SGTconst [c] (MOVVconst [d])) && c<=d => (MOVVconst [0])
|
||||||
|
@ -1960,6 +1960,19 @@ func rewriteValueLOONG64_OpLOONG64MOVBUreg(v *Value) bool {
|
|||||||
v.AuxInt = int64ToAuxInt(int64(uint8(c)))
|
v.AuxInt = int64ToAuxInt(int64(uint8(c)))
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
// match: (MOVBUreg (ANDconst [c] x))
|
||||||
|
// result: (ANDconst [c&0xff] x)
|
||||||
|
for {
|
||||||
|
if v_0.Op != OpLOONG64ANDconst {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
c := auxIntToInt64(v_0.AuxInt)
|
||||||
|
x := v_0.Args[0]
|
||||||
|
v.reset(OpLOONG64ANDconst)
|
||||||
|
v.AuxInt = int64ToAuxInt(c & 0xff)
|
||||||
|
v.AddArg(x)
|
||||||
|
return true
|
||||||
|
}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
func rewriteValueLOONG64_OpLOONG64MOVBload(v *Value) bool {
|
func rewriteValueLOONG64_OpLOONG64MOVBload(v *Value) bool {
|
||||||
|
Loading…
Reference in New Issue
Block a user