From fc327a14c490db9d2e14c4c44ba8791dc54be02a Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Tue, 4 Apr 2017 15:26:04 -0700 Subject: [PATCH] cmd/compile: remove order canonicalization rules from mips CL 38801 introduced automatic commutative rule generation. Manual order canonicalization rules thus lead to infinite loops. Fixes #19842 Change-Id: I877c476152f4d207fdc67bc6f3018265aa9bc5ac Reviewed-on: https://go-review.googlesource.com/39533 Run-TryBot: Josh Bleecher Snyder TryBot-Result: Gobot Gobot Reviewed-by: Keith Randall --- src/cmd/compile/internal/ssa/gen/MIPS.rules | 3 - src/cmd/compile/internal/ssa/rewriteMIPS.go | 104 -------------------- 2 files changed, 107 deletions(-) diff --git a/src/cmd/compile/internal/ssa/gen/MIPS.rules b/src/cmd/compile/internal/ssa/gen/MIPS.rules index ec875ddea3..5124daa48d 100644 --- a/src/cmd/compile/internal/ssa/gen/MIPS.rules +++ b/src/cmd/compile/internal/ssa/gen/MIPS.rules @@ -611,9 +611,6 @@ (SGTU x (MOVWconst [0])) -> (SGTUzero x) // mul with constant -(Select1 (MULTU x (MOVWconst [c]))) && x.Op != OpMIPSMOVWconst -> (Select1 (MULTU (MOVWconst [c]) x )) -(Select0 (MULTU x (MOVWconst [c]))) && x.Op != OpMIPSMOVWconst -> (Select0 (MULTU (MOVWconst [c]) x )) - (Select1 (MULTU (MOVWconst [0]) _ )) -> (MOVWconst [0]) (Select0 (MULTU (MOVWconst [0]) _ )) -> (MOVWconst [0]) (Select1 (MULTU (MOVWconst [1]) x )) -> x diff --git a/src/cmd/compile/internal/ssa/rewriteMIPS.go b/src/cmd/compile/internal/ssa/rewriteMIPS.go index 082c67ad78..740b62a83f 100644 --- a/src/cmd/compile/internal/ssa/rewriteMIPS.go +++ b/src/cmd/compile/internal/ssa/rewriteMIPS.go @@ -7886,58 +7886,6 @@ func rewriteValueMIPS_OpSelect0(v *Value) bool { v.AddArg(y) return true } - // match: (Select0 (MULTU x (MOVWconst [c]))) - // cond: x.Op != OpMIPSMOVWconst - // result: (Select0 (MULTU (MOVWconst [c]) x )) - for { - v_0 := v.Args[0] - if v_0.Op != OpMIPSMULTU { - break - } - x := v_0.Args[0] - v_0_1 := v_0.Args[1] - if v_0_1.Op != OpMIPSMOVWconst { - break - } - c := v_0_1.AuxInt - if !(x.Op != OpMIPSMOVWconst) { - break - } - v.reset(OpSelect0) - v0 := b.NewValue0(v.Pos, OpMIPSMULTU, MakeTuple(types.UInt32, types.UInt32)) - v1 := b.NewValue0(v.Pos, OpMIPSMOVWconst, types.UInt32) - v1.AuxInt = c - v0.AddArg(v1) - v0.AddArg(x) - v.AddArg(v0) - return true - } - // match: (Select0 (MULTU (MOVWconst [c]) x)) - // cond: x.Op != OpMIPSMOVWconst - // result: (Select0 (MULTU (MOVWconst [c]) x )) - for { - v_0 := v.Args[0] - if v_0.Op != OpMIPSMULTU { - break - } - v_0_0 := v_0.Args[0] - if v_0_0.Op != OpMIPSMOVWconst { - break - } - c := v_0_0.AuxInt - x := v_0.Args[1] - if !(x.Op != OpMIPSMOVWconst) { - break - } - v.reset(OpSelect0) - v0 := b.NewValue0(v.Pos, OpMIPSMULTU, MakeTuple(types.UInt32, types.UInt32)) - v1 := b.NewValue0(v.Pos, OpMIPSMOVWconst, types.UInt32) - v1.AuxInt = c - v0.AddArg(v1) - v0.AddArg(x) - v.AddArg(v0) - return true - } // match: (Select0 (MULTU (MOVWconst [0]) _)) // cond: // result: (MOVWconst [0]) @@ -8247,58 +8195,6 @@ func rewriteValueMIPS_OpSelect1(v *Value) bool { v.AddArg(x) return true } - // match: (Select1 (MULTU x (MOVWconst [c]))) - // cond: x.Op != OpMIPSMOVWconst - // result: (Select1 (MULTU (MOVWconst [c]) x )) - for { - v_0 := v.Args[0] - if v_0.Op != OpMIPSMULTU { - break - } - x := v_0.Args[0] - v_0_1 := v_0.Args[1] - if v_0_1.Op != OpMIPSMOVWconst { - break - } - c := v_0_1.AuxInt - if !(x.Op != OpMIPSMOVWconst) { - break - } - v.reset(OpSelect1) - v0 := b.NewValue0(v.Pos, OpMIPSMULTU, MakeTuple(types.UInt32, types.UInt32)) - v1 := b.NewValue0(v.Pos, OpMIPSMOVWconst, types.UInt32) - v1.AuxInt = c - v0.AddArg(v1) - v0.AddArg(x) - v.AddArg(v0) - return true - } - // match: (Select1 (MULTU (MOVWconst [c]) x)) - // cond: x.Op != OpMIPSMOVWconst - // result: (Select1 (MULTU (MOVWconst [c]) x )) - for { - v_0 := v.Args[0] - if v_0.Op != OpMIPSMULTU { - break - } - v_0_0 := v_0.Args[0] - if v_0_0.Op != OpMIPSMOVWconst { - break - } - c := v_0_0.AuxInt - x := v_0.Args[1] - if !(x.Op != OpMIPSMOVWconst) { - break - } - v.reset(OpSelect1) - v0 := b.NewValue0(v.Pos, OpMIPSMULTU, MakeTuple(types.UInt32, types.UInt32)) - v1 := b.NewValue0(v.Pos, OpMIPSMOVWconst, types.UInt32) - v1.AuxInt = c - v0.AddArg(v1) - v0.AddArg(x) - v.AddArg(v0) - return true - } // match: (Select1 (MULTU (MOVWconst [0]) _)) // cond: // result: (MOVWconst [0]) -- 2.48.1