cmd/compile/internal/gc: add s390x support
Allows instructions with a From3 field to be used in regopt so
long as From3 represents a constant. This is needed because the
storage-to-storage instructions on s390x place the length of the
data into From3.
Change-Id: I12cd32d4f997baf2fe97937bb7d45bbf716dfcb5
Reviewed-on: https://go-review.googlesource.com/20875
Reviewed-by: Matthew Dempsky <mdempsky@google.com>
Run-TryBot: Matthew Dempsky <mdempsky@google.com>
diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go
index 586a8e9c..3e5f516 100644
--- a/src/cmd/compile/internal/gc/walk.go
+++ b/src/cmd/compile/internal/gc/walk.go
@@ -673,7 +673,7 @@
walkexprlist(n.List.Slice(), init)
if n.Left.Op == ONAME && n.Left.Sym.Name == "Sqrt" && n.Left.Sym.Pkg.Path == "math" {
- if Thearch.LinkArch.InFamily(sys.AMD64, sys.ARM, sys.ARM64, sys.PPC64) {
+ if Thearch.LinkArch.InFamily(sys.AMD64, sys.ARM, sys.ARM64, sys.PPC64, sys.S390X) {
n.Op = OSQRT
n.Left = n.List.First()
n.List.Set(nil)
@@ -3294,6 +3294,11 @@
// Constants adding to width?
w := int(l.Type.Width * 8)
+ if Thearch.LinkArch.Family == sys.S390X && w != 32 && w != 64 {
+ // only supports 32-bit and 64-bit rotates
+ return n
+ }
+
if Smallintconst(l.Right) && Smallintconst(r.Right) {
sl := int(l.Right.Int64())
if sl >= 0 {