aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/compile/internal/ssa/rewriteS390X.go
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2020-04-23 19:22:26 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2020-04-24 16:44:20 +0000
commit67a8660b5acd570530f3777727d67e739e54cb2b (patch)
tree4a2550a3801fcb5bf4e8a341309a8315ab46ff24 /src/cmd/compile/internal/ssa/rewriteS390X.go
parent3a37fd4010dc20403d642e2c628cb0656a4fb968 (diff)
downloadgo-67a8660b5acd570530f3777727d67e739e54cb2b.tar.gz
go-67a8660b5acd570530f3777727d67e739e54cb2b.zip
cmd/compile: CSE the RHS of rewrite rules
Keep track of all expressions encountered while generating a rewrite result, and re-use them whenever possible. Named expressions may still be used for clarity when desired. Change-Id: I640dca108763eb8baeff8f9a4169300af3445b82 Reviewed-on: https://go-review.googlesource.com/c/go/+/229800 Run-TryBot: Josh Bleecher Snyder <josharian@gmail.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Daniel Martí <mvdan@mvdan.cc>
Diffstat (limited to 'src/cmd/compile/internal/ssa/rewriteS390X.go')
-rw-r--r--src/cmd/compile/internal/ssa/rewriteS390X.go44
1 files changed, 19 insertions, 25 deletions
diff --git a/src/cmd/compile/internal/ssa/rewriteS390X.go b/src/cmd/compile/internal/ssa/rewriteS390X.go
index a7f6b3cd9c..d104c4e54b 100644
--- a/src/cmd/compile/internal/ssa/rewriteS390X.go
+++ b/src/cmd/compile/internal/ssa/rewriteS390X.go
@@ -18537,18 +18537,16 @@ func rewriteValueS390X_OpSelect1(v *Value) bool {
v0 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags))
v1 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
v1.AuxInt = 0
- v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
- v2.AuxInt = 0
- v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
- v4 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags))
- v5 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
- v6 := b.NewValue0(v.Pos, OpS390XADDCconst, types.NewTuple(typ.UInt64, types.TypeFlags))
- v6.AuxInt = -1
- v6.AddArg(c)
- v5.AddArg(v6)
- v4.AddArg3(x, y, v5)
- v3.AddArg(v4)
- v0.AddArg3(v1, v2, v3)
+ v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
+ v3 := b.NewValue0(v.Pos, OpS390XADDE, types.NewTuple(typ.UInt64, types.TypeFlags))
+ v4 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
+ v5 := b.NewValue0(v.Pos, OpS390XADDCconst, types.NewTuple(typ.UInt64, types.TypeFlags))
+ v5.AuxInt = -1
+ v5.AddArg(c)
+ v4.AddArg(v5)
+ v3.AddArg3(x, y, v4)
+ v2.AddArg(v3)
+ v0.AddArg3(v1, v1, v2)
v.AddArg(v0)
return true
}
@@ -18566,19 +18564,15 @@ func rewriteValueS390X_OpSelect1(v *Value) bool {
v1 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags))
v2 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
v2.AuxInt = 0
- v3 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
- v3.AuxInt = 0
- v4 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
- v5 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags))
- v6 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
- v7 := b.NewValue0(v.Pos, OpS390XSUBC, types.NewTuple(typ.UInt64, types.TypeFlags))
- v8 := b.NewValue0(v.Pos, OpS390XMOVDconst, typ.UInt64)
- v8.AuxInt = 0
- v7.AddArg2(v8, c)
- v6.AddArg(v7)
- v5.AddArg3(x, y, v6)
- v4.AddArg(v5)
- v1.AddArg3(v2, v3, v4)
+ v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
+ v4 := b.NewValue0(v.Pos, OpS390XSUBE, types.NewTuple(typ.UInt64, types.TypeFlags))
+ v5 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
+ v6 := b.NewValue0(v.Pos, OpS390XSUBC, types.NewTuple(typ.UInt64, types.TypeFlags))
+ v6.AddArg2(v2, c)
+ v5.AddArg(v6)
+ v4.AddArg3(x, y, v5)
+ v3.AddArg(v4)
+ v1.AddArg3(v2, v2, v3)
v0.AddArg(v1)
v.AddArg(v0)
return true