cmd/compile: fix s390x load-combining rules

MOVD{reg,nop} operations (added in CL 36256) inserted to preserve
type information were blocking the load-combining rules. Fix this
by merging type changes into loads wherever possible.

Fixes #19059.

Change-Id: I8a1df06eb0f231b40ae43107d4a3bd0b9c441b59
Reviewed-on: https://go-review.googlesource.com/36843
Run-TryBot: Michael Munday <munday@ca.ibm.com>
Reviewed-by: Keith Randall <khr@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
This commit is contained in:
Michael Munday 2017-02-13 14:39:58 -05:00
parent 40c27ed5bc
commit 074b73b1b2
3 changed files with 657 additions and 4 deletions

View file

@ -227,7 +227,7 @@ func f(b []byte) uint32 {
return binary.LittleEndian.Uint32(b)
}
`,
[]string{"\tMOVWZ\t\\(.*\\),"},
[]string{"\tMOVWBR\t\\(.*\\),"},
},
{"s390x", "linux", `
import "encoding/binary"
@ -235,7 +235,7 @@ func f(b []byte, i int) uint32 {
return binary.LittleEndian.Uint32(b[i:])
}
`,
[]string{"\tMOVWZ\t\\(.*\\)\\(.*\\*1\\),"},
[]string{"\tMOVWBR\t\\(.*\\)\\(.*\\*1\\),"},
},
{"s390x", "linux", `
import "encoding/binary"
@ -243,17 +243,48 @@ func f(b []byte) uint64 {
return binary.LittleEndian.Uint64(b)
}
`,
[]string{"\tMOVD\t\\(.*\\),"},
[]string{"\tMOVDBR\t\\(.*\\),"},
},
{"s390x", "linux", `
import "encoding/binary"
func f(b []byte, i int) uint64 {
return binary.LittleEndian.Uint64(b[i:])
}
`,
[]string{"\tMOVDBR\t\\(.*\\)\\(.*\\*1\\),"},
},
{"s390x", "linux", `
import "encoding/binary"
func f(b []byte) uint32 {
return binary.BigEndian.Uint32(b)
}
`,
[]string{"\tMOVWZ\t\\(.*\\),"},
},
{"s390x", "linux", `
import "encoding/binary"
func f(b []byte, i int) uint32 {
return binary.BigEndian.Uint32(b[i:])
}
`,
[]string{"\tMOVWZ\t\\(.*\\)\\(.*\\*1\\),"},
},
{"s390x", "linux", `
import "encoding/binary"
func f(b []byte) uint64 {
return binary.BigEndian.Uint64(b)
}
`,
[]string{"\tMOVD\t\\(.*\\),"},
},
{"s390x", "linux", `
import "encoding/binary"
func f(b []byte, i int) uint64 {
return binary.BigEndian.Uint64(b[i:])
}
`,
[]string{"\tMOVD\t\\(.*\\)\\(.*\\*1\\),"},
},
// TODO: s390x big-endian tests.
// Structure zeroing. See issue #18370.
{"amd64", "linux", `