diff options
author | Michael Munday <mike.munday@ibm.com> | 2020-02-20 17:46:08 +0000 |
---|---|---|
committer | Michael Munday <mike.munday@ibm.com> | 2020-02-26 13:11:53 +0000 |
commit | cb74dcc172de2779a2f65ea830f687156c98ad50 (patch) | |
tree | f94450c829e15288289bcf99f27b91ede70954eb /src/cmd/compile/internal/ssa/rewritedec64.go | |
parent | 44fe355694798b5e1c55fc087e697886e93e633e (diff) | |
download | go-cb74dcc172de2779a2f65ea830f687156c98ad50.tar.gz go-cb74dcc172de2779a2f65ea830f687156c98ad50.zip |
cmd/compile: remove Greater* and Geq* generic integer ops
The generic Greater and Geq ops can always be replaced with the Less and
Leq ops. This CL therefore removes them. This simplifies the compiler since
it reduces the number of operations that need handling in both code and in
rewrite rules. This will be especially true when adding control flow
optimizations such as the integer-in-range optimizations in CL 165998.
Change-Id: If0648b2b19998ac1bddccbf251283f3be4ec3040
Reviewed-on: https://go-review.googlesource.com/c/go/+/220417
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Keith Randall <khr@golang.org>
Diffstat (limited to 'src/cmd/compile/internal/ssa/rewritedec64.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/rewritedec64.go | 168 |
1 files changed, 0 insertions, 168 deletions
diff --git a/src/cmd/compile/internal/ssa/rewritedec64.go b/src/cmd/compile/internal/ssa/rewritedec64.go index ae6d19142f..96a23afd8d 100644 --- a/src/cmd/compile/internal/ssa/rewritedec64.go +++ b/src/cmd/compile/internal/ssa/rewritedec64.go @@ -28,14 +28,6 @@ func rewriteValuedec64(v *Value) bool { return true case OpEq64: return rewriteValuedec64_OpEq64(v) - case OpGeq64: - return rewriteValuedec64_OpGeq64(v) - case OpGeq64U: - return rewriteValuedec64_OpGeq64U(v) - case OpGreater64: - return rewriteValuedec64_OpGreater64(v) - case OpGreater64U: - return rewriteValuedec64_OpGreater64U(v) case OpInt64Hi: return rewriteValuedec64_OpInt64Hi(v) case OpInt64Lo: @@ -462,166 +454,6 @@ func rewriteValuedec64_OpEq64(v *Value) bool { return true } } -func rewriteValuedec64_OpGeq64(v *Value) bool { - v_1 := v.Args[1] - v_0 := v.Args[0] - b := v.Block - typ := &b.Func.Config.Types - // match: (Geq64 x y) - // result: (OrB (Greater32 (Int64Hi x) (Int64Hi y)) (AndB (Eq32 (Int64Hi x) (Int64Hi y)) (Geq32U (Int64Lo x) (Int64Lo y)))) - for { - x := v_0 - y := v_1 - v.reset(OpOrB) - v0 := b.NewValue0(v.Pos, OpGreater32, typ.Bool) - v1 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v1.AddArg(x) - v0.AddArg(v1) - v2 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v2.AddArg(y) - v0.AddArg(v2) - v.AddArg(v0) - v3 := b.NewValue0(v.Pos, OpAndB, typ.Bool) - v4 := b.NewValue0(v.Pos, OpEq32, typ.Bool) - v5 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v5.AddArg(x) - v4.AddArg(v5) - v6 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v6.AddArg(y) - v4.AddArg(v6) - v3.AddArg(v4) - v7 := b.NewValue0(v.Pos, OpGeq32U, typ.Bool) - v8 := b.NewValue0(v.Pos, OpInt64Lo, typ.UInt32) - v8.AddArg(x) - v7.AddArg(v8) - v9 := b.NewValue0(v.Pos, OpInt64Lo, typ.UInt32) - v9.AddArg(y) - v7.AddArg(v9) - v3.AddArg(v7) - v.AddArg(v3) - return true - } -} -func rewriteValuedec64_OpGeq64U(v *Value) bool { - v_1 := v.Args[1] - v_0 := v.Args[0] - b := v.Block - typ := &b.Func.Config.Types - // match: (Geq64U x y) - // result: (OrB (Greater32U (Int64Hi x) (Int64Hi y)) (AndB (Eq32 (Int64Hi x) (Int64Hi y)) (Geq32U (Int64Lo x) (Int64Lo y)))) - for { - x := v_0 - y := v_1 - v.reset(OpOrB) - v0 := b.NewValue0(v.Pos, OpGreater32U, typ.Bool) - v1 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v1.AddArg(x) - v0.AddArg(v1) - v2 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v2.AddArg(y) - v0.AddArg(v2) - v.AddArg(v0) - v3 := b.NewValue0(v.Pos, OpAndB, typ.Bool) - v4 := b.NewValue0(v.Pos, OpEq32, typ.Bool) - v5 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v5.AddArg(x) - v4.AddArg(v5) - v6 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v6.AddArg(y) - v4.AddArg(v6) - v3.AddArg(v4) - v7 := b.NewValue0(v.Pos, OpGeq32U, typ.Bool) - v8 := b.NewValue0(v.Pos, OpInt64Lo, typ.UInt32) - v8.AddArg(x) - v7.AddArg(v8) - v9 := b.NewValue0(v.Pos, OpInt64Lo, typ.UInt32) - v9.AddArg(y) - v7.AddArg(v9) - v3.AddArg(v7) - v.AddArg(v3) - return true - } -} -func rewriteValuedec64_OpGreater64(v *Value) bool { - v_1 := v.Args[1] - v_0 := v.Args[0] - b := v.Block - typ := &b.Func.Config.Types - // match: (Greater64 x y) - // result: (OrB (Greater32 (Int64Hi x) (Int64Hi y)) (AndB (Eq32 (Int64Hi x) (Int64Hi y)) (Greater32U (Int64Lo x) (Int64Lo y)))) - for { - x := v_0 - y := v_1 - v.reset(OpOrB) - v0 := b.NewValue0(v.Pos, OpGreater32, typ.Bool) - v1 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v1.AddArg(x) - v0.AddArg(v1) - v2 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v2.AddArg(y) - v0.AddArg(v2) - v.AddArg(v0) - v3 := b.NewValue0(v.Pos, OpAndB, typ.Bool) - v4 := b.NewValue0(v.Pos, OpEq32, typ.Bool) - v5 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v5.AddArg(x) - v4.AddArg(v5) - v6 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v6.AddArg(y) - v4.AddArg(v6) - v3.AddArg(v4) - v7 := b.NewValue0(v.Pos, OpGreater32U, typ.Bool) - v8 := b.NewValue0(v.Pos, OpInt64Lo, typ.UInt32) - v8.AddArg(x) - v7.AddArg(v8) - v9 := b.NewValue0(v.Pos, OpInt64Lo, typ.UInt32) - v9.AddArg(y) - v7.AddArg(v9) - v3.AddArg(v7) - v.AddArg(v3) - return true - } -} -func rewriteValuedec64_OpGreater64U(v *Value) bool { - v_1 := v.Args[1] - v_0 := v.Args[0] - b := v.Block - typ := &b.Func.Config.Types - // match: (Greater64U x y) - // result: (OrB (Greater32U (Int64Hi x) (Int64Hi y)) (AndB (Eq32 (Int64Hi x) (Int64Hi y)) (Greater32U (Int64Lo x) (Int64Lo y)))) - for { - x := v_0 - y := v_1 - v.reset(OpOrB) - v0 := b.NewValue0(v.Pos, OpGreater32U, typ.Bool) - v1 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v1.AddArg(x) - v0.AddArg(v1) - v2 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v2.AddArg(y) - v0.AddArg(v2) - v.AddArg(v0) - v3 := b.NewValue0(v.Pos, OpAndB, typ.Bool) - v4 := b.NewValue0(v.Pos, OpEq32, typ.Bool) - v5 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v5.AddArg(x) - v4.AddArg(v5) - v6 := b.NewValue0(v.Pos, OpInt64Hi, typ.UInt32) - v6.AddArg(y) - v4.AddArg(v6) - v3.AddArg(v4) - v7 := b.NewValue0(v.Pos, OpGreater32U, typ.Bool) - v8 := b.NewValue0(v.Pos, OpInt64Lo, typ.UInt32) - v8.AddArg(x) - v7.AddArg(v8) - v9 := b.NewValue0(v.Pos, OpInt64Lo, typ.UInt32) - v9.AddArg(y) - v7.AddArg(v9) - v3.AddArg(v7) - v.AddArg(v3) - return true - } -} func rewriteValuedec64_OpInt64Hi(v *Value) bool { v_0 := v.Args[0] // match: (Int64Hi (Int64Make hi _)) |