mirror of
https://github.com/golang/go.git
synced 2025-10-19 11:03:18 +00:00
cmd/compile: remove reduntant Zero rule
These two rules produce the same output but have opposite s%16 conditions. Consolidate them into a single rule. Change-Id: I6daa0e7f7af4a4e59a3125b66b85f59e888586c5 Reviewed-on: https://go-review.googlesource.com/c/go/+/640475 LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com> Reviewed-by: Keith Randall <khr@google.com> Reviewed-by: Keith Randall <khr@golang.org> Reviewed-by: Cherry Mui <cherryyz@google.com>
This commit is contained in:
parent
bdc2d856a8
commit
46fd6b4e37
2 changed files with 3 additions and 28 deletions
|
@ -404,11 +404,7 @@
|
|||
(MOVQstoreconst [makeValAndOff(0,0)] destptr mem))
|
||||
|
||||
// Adjust zeros to be a multiple of 16 bytes.
|
||||
(Zero [s] destptr mem) && s%16 != 0 && s > 16 && s%16 > 8 && config.useSSE =>
|
||||
(Zero [s-s%16] (OffPtr <destptr.Type> destptr [s%16])
|
||||
(MOVOstoreconst [makeValAndOff(0,0)] destptr mem))
|
||||
|
||||
(Zero [s] destptr mem) && s%16 != 0 && s > 16 && s%16 <= 8 && config.useSSE =>
|
||||
(Zero [s] destptr mem) && s%16 != 0 && s > 16 && config.useSSE =>
|
||||
(Zero [s-s%16] (OffPtr <destptr.Type> destptr [s%16])
|
||||
(MOVOstoreconst [makeValAndOff(0,0)] destptr mem))
|
||||
|
||||
|
|
|
@ -30270,34 +30270,13 @@ func rewriteValueAMD64_OpZero(v *Value) bool {
|
|||
return true
|
||||
}
|
||||
// match: (Zero [s] destptr mem)
|
||||
// cond: s%16 != 0 && s > 16 && s%16 > 8 && config.useSSE
|
||||
// cond: s%16 != 0 && s > 16 && config.useSSE
|
||||
// result: (Zero [s-s%16] (OffPtr <destptr.Type> destptr [s%16]) (MOVOstoreconst [makeValAndOff(0,0)] destptr mem))
|
||||
for {
|
||||
s := auxIntToInt64(v.AuxInt)
|
||||
destptr := v_0
|
||||
mem := v_1
|
||||
if !(s%16 != 0 && s > 16 && s%16 > 8 && config.useSSE) {
|
||||
break
|
||||
}
|
||||
v.reset(OpZero)
|
||||
v.AuxInt = int64ToAuxInt(s - s%16)
|
||||
v0 := b.NewValue0(v.Pos, OpOffPtr, destptr.Type)
|
||||
v0.AuxInt = int64ToAuxInt(s % 16)
|
||||
v0.AddArg(destptr)
|
||||
v1 := b.NewValue0(v.Pos, OpAMD64MOVOstoreconst, types.TypeMem)
|
||||
v1.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
|
||||
v1.AddArg2(destptr, mem)
|
||||
v.AddArg2(v0, v1)
|
||||
return true
|
||||
}
|
||||
// match: (Zero [s] destptr mem)
|
||||
// cond: s%16 != 0 && s > 16 && s%16 <= 8 && config.useSSE
|
||||
// result: (Zero [s-s%16] (OffPtr <destptr.Type> destptr [s%16]) (MOVOstoreconst [makeValAndOff(0,0)] destptr mem))
|
||||
for {
|
||||
s := auxIntToInt64(v.AuxInt)
|
||||
destptr := v_0
|
||||
mem := v_1
|
||||
if !(s%16 != 0 && s > 16 && s%16 <= 8 && config.useSSE) {
|
||||
if !(s%16 != 0 && s > 16 && config.useSSE) {
|
||||
break
|
||||
}
|
||||
v.reset(OpZero)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue