return
}
- if Ctxt.Arch.InFamily(sys.AMD64, sys.I386) && n.Addable {
+ if Ctxt.Arch.InFamily(sys.AMD64, sys.I386, sys.S390X) && n.Addable {
Thearch.Gmove(n, res)
return
}
// Some architectures might need a temporary or other help here,
// but they don't support direct generation of a bool value yet.
// We can fix that as we go.
- mayNeedTemp := Ctxt.Arch.InFamily(sys.ARM, sys.ARM64, sys.MIPS64, sys.PPC64)
+ mayNeedTemp := Ctxt.Arch.InFamily(sys.ARM, sys.ARM64, sys.MIPS64, sys.PPC64, sys.S390X)
if genval {
if mayNeedTemp {
return true
case OADDR:
- return Thearch.LinkArch.InFamily(sys.AMD64, sys.PPC64) // because 6g uses PC-relative addressing; TODO(rsc): not sure why 9g too
+ // amd64 and s390x use PC relative addressing.
+ // TODO(rsc): not sure why ppc64 needs this too.
+ return Thearch.LinkArch.InFamily(sys.AMD64, sys.PPC64, sys.S390X)
}
return false
p := Prog(as)
p.To.Type = obj.TYPE_BRANCH
p.To.Val = nil
- if as != obj.AJMP && likely != 0 && Thearch.LinkArch.Family != sys.PPC64 && Thearch.LinkArch.Family != sys.ARM64 && Thearch.LinkArch.Family != sys.MIPS64 {
+ if as != obj.AJMP && likely != 0 && !Thearch.LinkArch.InFamily(sys.PPC64, sys.ARM64, sys.MIPS64, sys.S390X) {
p.From.Type = obj.TYPE_CONST
if likely > 0 {
p.From.Offset = 1
case OADDR:
Naddr(a, n.Left)
a.Etype = uint8(Tptr)
- if !Thearch.LinkArch.InFamily(sys.MIPS64, sys.ARM, sys.ARM64, sys.PPC64) { // TODO(rsc): Do this even for arm, ppc64.
+ if !Thearch.LinkArch.InFamily(sys.MIPS64, sys.ARM, sys.ARM64, sys.PPC64, sys.S390X) { // TODO(rsc): Do this even for these architectures.
a.Width = int64(Widthptr)
}
if a.Type != obj.TYPE_MEM {
if haspointers(n.Type) {
stkptrsize = Stksize
}
- if Thearch.LinkArch.InFamily(sys.MIPS64, sys.ARM, sys.ARM64, sys.PPC64) {
+ if Thearch.LinkArch.InFamily(sys.MIPS64, sys.ARM, sys.ARM64, sys.PPC64, sys.S390X) {
Stksize = Rnd(Stksize, int64(Widthptr))
}
if Stksize >= 1<<31 {
// Currently we never generate three register forms.
// If we do, this will need to change.
- if p.From3Type() != obj.TYPE_NONE {
+ if p.From3Type() != obj.TYPE_NONE && p.From3Type() != obj.TYPE_CONST {
Fatalf("regopt not implemented for from3")
}
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)
// 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 {