]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/compile: remove reduntant Zero rule
authorJakub Ciolek <jakub@ciolek.dev>
Sun, 5 Jan 2025 10:31:11 +0000 (11:31 +0100)
committerKeith Randall <khr@golang.org>
Tue, 4 Feb 2025 17:41:43 +0000 (09:41 -0800)
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>
src/cmd/compile/internal/ssa/_gen/AMD64.rules
src/cmd/compile/internal/ssa/rewriteAMD64.go

index 716f4f1c32d15303de4664b402913e6e9c26a181..1a32c26ae24b264a82112fd855056687745e0bdb 100644 (file)
                (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))
 
index d62f38f0e2f59493ed9fdde89afd84b6d3ca1606..7dc0a7bdc2a1a172136f7878c6b760855ef693bf 100644 (file)
@@ -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)