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>
(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])
v.AuxInt = int64ToAuxInt(int64(uint8(c)))
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
}
func rewriteValueLOONG64_OpLOONG64MOVBload(v *Value) bool {