diff options
author | Michael Munday <mike.munday@ibm.com> | 2019-04-25 09:41:46 -0400 |
---|---|---|
committer | Michael Munday <mike.munday@ibm.com> | 2019-09-10 13:17:24 +0000 |
commit | 5c5f217b635d5bcbbda482f92264265eb61c13f2 (patch) | |
tree | 3d98214b58abbb173f1459feb577de8dd6adb6c8 /src/cmd/compile/internal/s390x | |
parent | b38be35e4c79fd3c5b9450e95cf092eaac094405 (diff) | |
download | go-5c5f217b635d5bcbbda482f92264265eb61c13f2.tar.gz go-5c5f217b635d5bcbbda482f92264265eb61c13f2.zip |
cmd/compile: improve s390x sign/zero extension removal
This CL gets rid of the MOVDreg and MOVDnop SSA operations on
s390x. They were originally inserted to help avoid situations
where a sign/zero extension was elided but a spill invalidated
the optimization. It's not really clear we need to do this though
(amd64 doesn't have these ops for example) so long as we are
careful when removing sign/zero extensions. Also, the MOVDreg
technique doesn't work if the register is spilled before the
MOVDreg op (I haven't seen that in practice).
Removing these ops reduces the complexity of the rules and also
allows us to unblock optimizations. For example, the compiler can
now merge the loads in binary.{Big,Little}Endian.PutUint16 which
it wasn't able to do before. This CL reduces the size of the .text
section in the go tool by about 4.7KB (0.09%).
Change-Id: Icaddae7f2e4f9b2debb6fabae845adb3f73b41db
Reviewed-on: https://go-review.googlesource.com/c/go/+/173897
Run-TryBot: Michael Munday <mike.munday@ibm.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Cherry Zhang <cherryyz@google.com>
Diffstat (limited to 'src/cmd/compile/internal/s390x')
-rw-r--r-- | src/cmd/compile/internal/s390x/ssa.go | 7 |
1 files changed, 1 insertions, 6 deletions
diff --git a/src/cmd/compile/internal/s390x/ssa.go b/src/cmd/compile/internal/s390x/ssa.go index 7ddebe7b64..fc828946b9 100644 --- a/src/cmd/compile/internal/s390x/ssa.go +++ b/src/cmd/compile/internal/s390x/ssa.go @@ -482,7 +482,7 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { p.To.Type = obj.TYPE_MEM p.To.Reg = v.Args[0].Reg() gc.AddAux2(&p.To, v, sc.Off()) - case ssa.OpCopy, ssa.OpS390XMOVDreg: + case ssa.OpCopy: if v.Type.IsMemory() { return } @@ -491,11 +491,6 @@ func ssaGenValue(s *gc.SSAGenState, v *ssa.Value) { if x != y { opregreg(s, moveByType(v.Type), y, x) } - case ssa.OpS390XMOVDnop: - if v.Reg() != v.Args[0].Reg() { - v.Fatalf("input[0] and output not in same register %s", v.LongString()) - } - // nothing to do case ssa.OpLoadReg: if v.Type.IsFlags() { v.Fatalf("load flags not implemented: %v", v.LongString()) |