diff options
Diffstat (limited to 'src/cmd/compile/internal/ssa/rewriteS390X.go')
-rw-r--r-- | src/cmd/compile/internal/ssa/rewriteS390X.go | 6164 |
1 files changed, 1255 insertions, 4909 deletions
diff --git a/src/cmd/compile/internal/ssa/rewriteS390X.go b/src/cmd/compile/internal/ssa/rewriteS390X.go index 536f8db320..78a57c2388 100644 --- a/src/cmd/compile/internal/ssa/rewriteS390X.go +++ b/src/cmd/compile/internal/ssa/rewriteS390X.go @@ -3,6 +3,7 @@ package ssa +import "math" import "cmd/compile/internal/types" import "cmd/internal/obj/s390x" @@ -586,20 +587,12 @@ func rewriteValueS390X(v *Value) bool { return rewriteValueS390X_OpS390XFCMPS(v) case OpS390XFMOVDload: return rewriteValueS390X_OpS390XFMOVDload(v) - case OpS390XFMOVDloadidx: - return rewriteValueS390X_OpS390XFMOVDloadidx(v) case OpS390XFMOVDstore: return rewriteValueS390X_OpS390XFMOVDstore(v) - case OpS390XFMOVDstoreidx: - return rewriteValueS390X_OpS390XFMOVDstoreidx(v) case OpS390XFMOVSload: return rewriteValueS390X_OpS390XFMOVSload(v) - case OpS390XFMOVSloadidx: - return rewriteValueS390X_OpS390XFMOVSloadidx(v) case OpS390XFMOVSstore: return rewriteValueS390X_OpS390XFMOVSstore(v) - case OpS390XFMOVSstoreidx: - return rewriteValueS390X_OpS390XFMOVSstoreidx(v) case OpS390XFNEG: return rewriteValueS390X_OpS390XFNEG(v) case OpS390XFNEGS: @@ -622,78 +615,52 @@ func rewriteValueS390X(v *Value) bool { return rewriteValueS390X_OpS390XLoweredRound64F(v) case OpS390XMOVBZload: return rewriteValueS390X_OpS390XMOVBZload(v) - case OpS390XMOVBZloadidx: - return rewriteValueS390X_OpS390XMOVBZloadidx(v) case OpS390XMOVBZreg: return rewriteValueS390X_OpS390XMOVBZreg(v) case OpS390XMOVBload: return rewriteValueS390X_OpS390XMOVBload(v) - case OpS390XMOVBloadidx: - return rewriteValueS390X_OpS390XMOVBloadidx(v) case OpS390XMOVBreg: return rewriteValueS390X_OpS390XMOVBreg(v) case OpS390XMOVBstore: return rewriteValueS390X_OpS390XMOVBstore(v) case OpS390XMOVBstoreconst: return rewriteValueS390X_OpS390XMOVBstoreconst(v) - case OpS390XMOVBstoreidx: - return rewriteValueS390X_OpS390XMOVBstoreidx(v) case OpS390XMOVDaddridx: return rewriteValueS390X_OpS390XMOVDaddridx(v) case OpS390XMOVDload: return rewriteValueS390X_OpS390XMOVDload(v) - case OpS390XMOVDloadidx: - return rewriteValueS390X_OpS390XMOVDloadidx(v) case OpS390XMOVDstore: return rewriteValueS390X_OpS390XMOVDstore(v) case OpS390XMOVDstoreconst: return rewriteValueS390X_OpS390XMOVDstoreconst(v) - case OpS390XMOVDstoreidx: - return rewriteValueS390X_OpS390XMOVDstoreidx(v) case OpS390XMOVHBRstore: return rewriteValueS390X_OpS390XMOVHBRstore(v) - case OpS390XMOVHBRstoreidx: - return rewriteValueS390X_OpS390XMOVHBRstoreidx(v) case OpS390XMOVHZload: return rewriteValueS390X_OpS390XMOVHZload(v) - case OpS390XMOVHZloadidx: - return rewriteValueS390X_OpS390XMOVHZloadidx(v) case OpS390XMOVHZreg: return rewriteValueS390X_OpS390XMOVHZreg(v) case OpS390XMOVHload: return rewriteValueS390X_OpS390XMOVHload(v) - case OpS390XMOVHloadidx: - return rewriteValueS390X_OpS390XMOVHloadidx(v) case OpS390XMOVHreg: return rewriteValueS390X_OpS390XMOVHreg(v) case OpS390XMOVHstore: return rewriteValueS390X_OpS390XMOVHstore(v) case OpS390XMOVHstoreconst: return rewriteValueS390X_OpS390XMOVHstoreconst(v) - case OpS390XMOVHstoreidx: - return rewriteValueS390X_OpS390XMOVHstoreidx(v) case OpS390XMOVWBRstore: return rewriteValueS390X_OpS390XMOVWBRstore(v) - case OpS390XMOVWBRstoreidx: - return rewriteValueS390X_OpS390XMOVWBRstoreidx(v) case OpS390XMOVWZload: return rewriteValueS390X_OpS390XMOVWZload(v) - case OpS390XMOVWZloadidx: - return rewriteValueS390X_OpS390XMOVWZloadidx(v) case OpS390XMOVWZreg: return rewriteValueS390X_OpS390XMOVWZreg(v) case OpS390XMOVWload: return rewriteValueS390X_OpS390XMOVWload(v) - case OpS390XMOVWloadidx: - return rewriteValueS390X_OpS390XMOVWloadidx(v) case OpS390XMOVWreg: return rewriteValueS390X_OpS390XMOVWreg(v) case OpS390XMOVWstore: return rewriteValueS390X_OpS390XMOVWstore(v) case OpS390XMOVWstoreconst: return rewriteValueS390X_OpS390XMOVWstoreconst(v) - case OpS390XMOVWstoreidx: - return rewriteValueS390X_OpS390XMOVWstoreidx(v) case OpS390XMULLD: return rewriteValueS390X_OpS390XMULLD(v) case OpS390XMULLDconst: @@ -5281,19 +5248,19 @@ func rewriteValueS390X_OpS390XADD(v *Value) bool { v_0 := v.Args[0] // match: (ADD x (MOVDconst [c])) // cond: is32Bit(c) - // result: (ADDconst [c] x) + // result: (ADDconst [int32(c)] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { x := v_0 if v_1.Op != OpS390XMOVDconst { continue } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(is32Bit(c)) { continue } v.reset(OpS390XADDconst) - v.AuxInt = c + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } @@ -5324,7 +5291,7 @@ func rewriteValueS390X_OpS390XADD(v *Value) bool { break } // match: (ADD idx (MOVDaddr [c] {s} ptr)) - // cond: ptr.Op != OpSB && idx.Op != OpSB + // cond: ptr.Op != OpSB // result: (MOVDaddridx [c] {s} ptr idx) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -5335,7 +5302,7 @@ func rewriteValueS390X_OpS390XADD(v *Value) bool { c := auxIntToInt32(v_1.AuxInt) s := auxToSym(v_1.Aux) ptr := v_1.Args[0] - if !(ptr.Op != OpSB && idx.Op != OpSB) { + if !(ptr.Op != OpSB) { continue } v.reset(OpS390XMOVDaddridx) @@ -5362,7 +5329,7 @@ func rewriteValueS390X_OpS390XADD(v *Value) bool { break } // match: (ADD <t> x g:(MOVDload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (ADDload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -5372,17 +5339,17 @@ func rewriteValueS390X_OpS390XADD(v *Value) bool { if g.Op != OpS390XMOVDload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XADDload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } @@ -5395,19 +5362,19 @@ func rewriteValueS390X_OpS390XADDC(v *Value) bool { v_0 := v.Args[0] // match: (ADDC x (MOVDconst [c])) // cond: is16Bit(c) - // result: (ADDCconst x [c]) + // result: (ADDCconst x [int16(c)]) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { x := v_0 if v_1.Op != OpS390XMOVDconst { continue } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(is16Bit(c)) { continue } v.reset(OpS390XADDCconst) - v.AuxInt = c + v.AuxInt = int16ToAuxInt(int16(c)) v.AddArg(x) return true } @@ -5482,16 +5449,16 @@ func rewriteValueS390X_OpS390XADDW(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (ADDW x (MOVDconst [c])) - // result: (ADDWconst [int64(int32(c))] x) + // result: (ADDWconst [int32(c)] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { x := v_0 if v_1.Op != OpS390XMOVDconst { continue } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XADDWconst) - v.AuxInt = int64(int32(c)) + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } @@ -5537,7 +5504,7 @@ func rewriteValueS390X_OpS390XADDW(v *Value) bool { break } // match: (ADDW <t> x g:(MOVWload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (ADDWload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -5547,24 +5514,24 @@ func rewriteValueS390X_OpS390XADDW(v *Value) bool { if g.Op != OpS390XMOVWload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XADDWload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } break } // match: (ADDW <t> x g:(MOVWZload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (ADDWload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -5574,17 +5541,17 @@ func rewriteValueS390X_OpS390XADDW(v *Value) bool { if g.Op != OpS390XMOVWZload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XADDWload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } @@ -5607,28 +5574,28 @@ func rewriteValueS390X_OpS390XADDWconst(v *Value) bool { return true } // match: (ADDWconst [c] (MOVDconst [d])) - // result: (MOVDconst [int64(int32(c+d))]) + // result: (MOVDconst [int64(c)+d]) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDconst { break } - d := v_0.AuxInt + d := auxIntToInt64(v_0.AuxInt) v.reset(OpS390XMOVDconst) - v.AuxInt = int64(int32(c + d)) + v.AuxInt = int64ToAuxInt(int64(c) + d) return true } // match: (ADDWconst [c] (ADDWconst [d] x)) - // result: (ADDWconst [int64(int32(c+d))] x) + // result: (ADDWconst [int32(c+d)] x) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XADDWconst { break } - d := v_0.AuxInt + d := auxIntToInt32(v_0.AuxInt) x := v_0.Args[0] v.reset(OpS390XADDWconst) - v.AuxInt = int64(int32(c + d)) + v.AuxInt = int32ToAuxInt(int32(c + d)) v.AddArg(x) return true } @@ -5639,47 +5606,47 @@ func rewriteValueS390X_OpS390XADDWload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (ADDWload [off1] {sym} x (ADDconst [off2] ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(off1+off2) + // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) // result: (ADDWload [off1+off2] {sym} x ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - off2 := v_1.AuxInt + off2 := auxIntToInt32(v_1.AuxInt) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(off1+off2)) { + if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { break } v.reset(OpS390XADDWload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (ADDWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2) - // result: (ADDWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) + // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) + // result: (ADDWload [o1+o2] {mergeSymTyped(s1, s2)} x ptr mem) for { - o1 := v.AuxInt - s1 := v.Aux + o1 := auxIntToInt32(v.AuxInt) + s1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - o2 := v_1.AuxInt - s2 := v_1.Aux + o2 := auxIntToInt32(v_1.AuxInt) + s2 := auxToSym(v_1.Aux) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2)) { + if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { break } v.reset(OpS390XADDWload) - v.AuxInt = o1 + o2 - v.Aux = mergeSym(s1, s2) + v.AuxInt = int32ToAuxInt(o1 + o2) + v.Aux = symToAux(mergeSymTyped(s1, s2)) v.AddArg3(x, ptr, mem) return true } @@ -5688,63 +5655,63 @@ func rewriteValueS390X_OpS390XADDWload(v *Value) bool { func rewriteValueS390X_OpS390XADDconst(v *Value) bool { v_0 := v.Args[0] // match: (ADDconst [c] (MOVDaddr [d] {s} x:(SB))) - // cond: ((c+d)&1 == 0) && is32Bit(c+d) + // cond: ((c+d)&1 == 0) && is32Bit(int64(c)+int64(d)) // result: (MOVDaddr [c+d] {s} x) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDaddr { break } - d := v_0.AuxInt - s := v_0.Aux + d := auxIntToInt32(v_0.AuxInt) + s := auxToSym(v_0.Aux) x := v_0.Args[0] - if x.Op != OpSB || !(((c+d)&1 == 0) && is32Bit(c+d)) { + if x.Op != OpSB || !(((c+d)&1 == 0) && is32Bit(int64(c)+int64(d))) { break } v.reset(OpS390XMOVDaddr) - v.AuxInt = c + d - v.Aux = s + v.AuxInt = int32ToAuxInt(c + d) + v.Aux = symToAux(s) v.AddArg(x) return true } // match: (ADDconst [c] (MOVDaddr [d] {s} x)) - // cond: x.Op != OpSB && is20Bit(c+d) + // cond: x.Op != OpSB && is20Bit(int64(c)+int64(d)) // result: (MOVDaddr [c+d] {s} x) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDaddr { break } - d := v_0.AuxInt - s := v_0.Aux + d := auxIntToInt32(v_0.AuxInt) + s := auxToSym(v_0.Aux) x := v_0.Args[0] - if !(x.Op != OpSB && is20Bit(c+d)) { + if !(x.Op != OpSB && is20Bit(int64(c)+int64(d))) { break } v.reset(OpS390XMOVDaddr) - v.AuxInt = c + d - v.Aux = s + v.AuxInt = int32ToAuxInt(c + d) + v.Aux = symToAux(s) v.AddArg(x) return true } // match: (ADDconst [c] (MOVDaddridx [d] {s} x y)) - // cond: is20Bit(c+d) + // cond: is20Bit(int64(c)+int64(d)) // result: (MOVDaddridx [c+d] {s} x y) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDaddridx { break } - d := v_0.AuxInt - s := v_0.Aux + d := auxIntToInt32(v_0.AuxInt) + s := auxToSym(v_0.Aux) y := v_0.Args[1] x := v_0.Args[0] - if !(is20Bit(c + d)) { + if !(is20Bit(int64(c) + int64(d))) { break } v.reset(OpS390XMOVDaddridx) - v.AuxInt = c + d - v.Aux = s + v.AuxInt = int32ToAuxInt(c + d) + v.Aux = symToAux(s) v.AddArg2(x, y) return true } @@ -5759,32 +5726,32 @@ func rewriteValueS390X_OpS390XADDconst(v *Value) bool { return true } // match: (ADDconst [c] (MOVDconst [d])) - // result: (MOVDconst [c+d]) + // result: (MOVDconst [int64(c)+d]) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDconst { break } - d := v_0.AuxInt + d := auxIntToInt64(v_0.AuxInt) v.reset(OpS390XMOVDconst) - v.AuxInt = c + d + v.AuxInt = int64ToAuxInt(int64(c) + d) return true } // match: (ADDconst [c] (ADDconst [d] x)) - // cond: is32Bit(c+d) + // cond: is32Bit(int64(c)+int64(d)) // result: (ADDconst [c+d] x) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XADDconst { break } - d := v_0.AuxInt + d := auxIntToInt32(v_0.AuxInt) x := v_0.Args[0] - if !(is32Bit(c + d)) { + if !(is32Bit(int64(c) + int64(d))) { break } v.reset(OpS390XADDconst) - v.AuxInt = c + d + v.AuxInt = int32ToAuxInt(c + d) v.AddArg(x) return true } @@ -5819,47 +5786,47 @@ func rewriteValueS390X_OpS390XADDload(v *Value) bool { return true } // match: (ADDload [off1] {sym} x (ADDconst [off2] ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(off1+off2) + // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) // result: (ADDload [off1+off2] {sym} x ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - off2 := v_1.AuxInt + off2 := auxIntToInt32(v_1.AuxInt) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(off1+off2)) { + if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { break } v.reset(OpS390XADDload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (ADDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2) - // result: (ADDload [o1+o2] {mergeSym(s1, s2)} x ptr mem) + // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) + // result: (ADDload [o1+o2] {mergeSymTyped(s1, s2)} x ptr mem) for { - o1 := v.AuxInt - s1 := v.Aux + o1 := auxIntToInt32(v.AuxInt) + s1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - o2 := v_1.AuxInt - s2 := v_1.Aux + o2 := auxIntToInt32(v_1.AuxInt) + s2 := auxToSym(v_1.Aux) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2)) { + if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { break } v.reset(OpS390XADDload) - v.AuxInt = o1 + o2 - v.Aux = mergeSym(s1, s2) + v.AuxInt = int32ToAuxInt(o1 + o2) + v.Aux = symToAux(mergeSymTyped(s1, s2)) v.AddArg3(x, ptr, mem) return true } @@ -5892,20 +5859,20 @@ func rewriteValueS390X_OpS390XAND(v *Value) bool { } // match: (AND x (MOVDconst [c])) // cond: is32Bit(c) && c >= 0 - // result: (MOVWZreg (ANDWconst <typ.UInt32> [int64(int32(c))] x)) + // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(c)] x)) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { x := v_0 if v_1.Op != OpS390XMOVDconst { continue } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(is32Bit(c) && c >= 0) { continue } v.reset(OpS390XMOVWZreg) v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) - v0.AuxInt = int64(int32(c)) + v0.AuxInt = int32ToAuxInt(int32(c)) v0.AddArg(x) v.AddArg(v0) return true @@ -6001,7 +5968,7 @@ func rewriteValueS390X_OpS390XAND(v *Value) bool { return true } // match: (AND <t> x g:(MOVDload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (ANDload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -6011,17 +5978,17 @@ func rewriteValueS390X_OpS390XAND(v *Value) bool { if g.Op != OpS390XMOVDload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XANDload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } @@ -6033,16 +6000,16 @@ func rewriteValueS390X_OpS390XANDW(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (ANDW x (MOVDconst [c])) - // result: (ANDWconst [int64(int32(c))] x) + // result: (ANDWconst [int32(c)] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { x := v_0 if v_1.Op != OpS390XMOVDconst { continue } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XANDWconst) - v.AuxInt = int64(int32(c)) + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } @@ -6059,7 +6026,7 @@ func rewriteValueS390X_OpS390XANDW(v *Value) bool { return true } // match: (ANDW <t> x g:(MOVWload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (ANDWload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -6069,24 +6036,24 @@ func rewriteValueS390X_OpS390XANDW(v *Value) bool { if g.Op != OpS390XMOVWload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XANDWload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } break } // match: (ANDW <t> x g:(MOVWZload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (ANDWload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -6096,17 +6063,17 @@ func rewriteValueS390X_OpS390XANDW(v *Value) bool { if g.Op != OpS390XMOVWZload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XANDWload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } @@ -6117,7 +6084,7 @@ func rewriteValueS390X_OpS390XANDW(v *Value) bool { func rewriteValueS390X_OpS390XANDWconst(v *Value) bool { v_0 := v.Args[0] // match: (ANDWconst [c] (ANDWconst [d] x)) - // result: (ANDWconst [c & d] x) + // result: (ANDWconst [c&d] x) for { c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XANDWconst { @@ -6177,15 +6144,15 @@ func rewriteValueS390X_OpS390XANDWconst(v *Value) bool { return true } // match: (ANDWconst [c] (MOVDconst [d])) - // result: (MOVDconst [c&d]) + // result: (MOVDconst [int64(c)&d]) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDconst { break } - d := v_0.AuxInt + d := auxIntToInt64(v_0.AuxInt) v.reset(OpS390XMOVDconst) - v.AuxInt = c & d + v.AuxInt = int64ToAuxInt(int64(c) & d) return true } return false @@ -6195,47 +6162,47 @@ func rewriteValueS390X_OpS390XANDWload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (ANDWload [off1] {sym} x (ADDconst [off2] ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(off1+off2) + // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) // result: (ANDWload [off1+off2] {sym} x ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - off2 := v_1.AuxInt + off2 := auxIntToInt32(v_1.AuxInt) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(off1+off2)) { + if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { break } v.reset(OpS390XANDWload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (ANDWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2) - // result: (ANDWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) + // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) + // result: (ANDWload [o1+o2] {mergeSymTyped(s1, s2)} x ptr mem) for { - o1 := v.AuxInt - s1 := v.Aux + o1 := auxIntToInt32(v.AuxInt) + s1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - o2 := v_1.AuxInt - s2 := v_1.Aux + o2 := auxIntToInt32(v_1.AuxInt) + s2 := auxToSym(v_1.Aux) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2)) { + if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { break } v.reset(OpS390XANDWload) - v.AuxInt = o1 + o2 - v.Aux = mergeSym(s1, s2) + v.AuxInt = int32ToAuxInt(o1 + o2) + v.Aux = symToAux(mergeSymTyped(s1, s2)) v.AddArg3(x, ptr, mem) return true } @@ -6244,7 +6211,7 @@ func rewriteValueS390X_OpS390XANDWload(v *Value) bool { func rewriteValueS390X_OpS390XANDconst(v *Value) bool { v_0 := v.Args[0] // match: (ANDconst [c] (ANDconst [d] x)) - // result: (ANDconst [c & d] x) + // result: (ANDconst [c&d] x) for { c := auxIntToInt64(v.AuxInt) if v_0.Op != OpS390XANDconst { @@ -6320,47 +6287,47 @@ func rewriteValueS390X_OpS390XANDload(v *Value) bool { return true } // match: (ANDload [off1] {sym} x (ADDconst [off2] ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(off1+off2) + // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) // result: (ANDload [off1+off2] {sym} x ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - off2 := v_1.AuxInt + off2 := auxIntToInt32(v_1.AuxInt) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(off1+off2)) { + if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { break } v.reset(OpS390XANDload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (ANDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2) - // result: (ANDload [o1+o2] {mergeSym(s1, s2)} x ptr mem) + // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) + // result: (ANDload [o1+o2] {mergeSymTyped(s1, s2)} x ptr mem) for { - o1 := v.AuxInt - s1 := v.Aux + o1 := auxIntToInt32(v.AuxInt) + s1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - o2 := v_1.AuxInt - s2 := v_1.Aux + o2 := auxIntToInt32(v_1.AuxInt) + s2 := auxToSym(v_1.Aux) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2)) { + if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { break } v.reset(OpS390XANDload) - v.AuxInt = o1 + o2 - v.Aux = mergeSym(s1, s2) + v.AuxInt = int32ToAuxInt(o1 + o2) + v.Aux = symToAux(mergeSymTyped(s1, s2)) v.AddArg3(x, ptr, mem) return true } @@ -6372,36 +6339,36 @@ func rewriteValueS390X_OpS390XCMP(v *Value) bool { b := v.Block // match: (CMP x (MOVDconst [c])) // cond: is32Bit(c) - // result: (CMPconst x [c]) + // result: (CMPconst x [int32(c)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(is32Bit(c)) { break } v.reset(OpS390XCMPconst) - v.AuxInt = c + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } // match: (CMP (MOVDconst [c]) x) // cond: is32Bit(c) - // result: (InvertFlags (CMPconst x [c])) + // result: (InvertFlags (CMPconst x [int32(c)])) for { if v_0.Op != OpS390XMOVDconst { break } - c := v_0.AuxInt + c := auxIntToInt64(v_0.AuxInt) x := v_1 if !(is32Bit(c)) { break } v.reset(OpS390XInvertFlags) v0 := b.NewValue0(v.Pos, OpS390XCMPconst, types.TypeFlags) - v0.AuxInt = c + v0.AuxInt = int32ToAuxInt(int32(c)) v0.AddArg(x) v.AddArg(v0) return true @@ -6429,36 +6396,36 @@ func rewriteValueS390X_OpS390XCMPU(v *Value) bool { b := v.Block // match: (CMPU x (MOVDconst [c])) // cond: isU32Bit(c) - // result: (CMPUconst x [int64(int32(c))]) + // result: (CMPUconst x [int32(c)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(isU32Bit(c)) { break } v.reset(OpS390XCMPUconst) - v.AuxInt = int64(int32(c)) + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } // match: (CMPU (MOVDconst [c]) x) // cond: isU32Bit(c) - // result: (InvertFlags (CMPUconst x [int64(int32(c))])) + // result: (InvertFlags (CMPUconst x [int32(c)])) for { if v_0.Op != OpS390XMOVDconst { break } - c := v_0.AuxInt + c := auxIntToInt64(v_0.AuxInt) x := v_1 if !(isU32Bit(c)) { break } v.reset(OpS390XInvertFlags) v0 := b.NewValue0(v.Pos, OpS390XCMPUconst, types.TypeFlags) - v0.AuxInt = int64(int32(c)) + v0.AuxInt = int32ToAuxInt(int32(c)) v0.AddArg(x) v.AddArg(v0) return true @@ -6656,29 +6623,29 @@ func rewriteValueS390X_OpS390XCMPW(v *Value) bool { v_0 := v.Args[0] b := v.Block // match: (CMPW x (MOVDconst [c])) - // result: (CMPWconst x [int64(int32(c))]) + // result: (CMPWconst x [int32(c)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XCMPWconst) - v.AuxInt = int64(int32(c)) + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } // match: (CMPW (MOVDconst [c]) x) - // result: (InvertFlags (CMPWconst x [int64(int32(c))])) + // result: (InvertFlags (CMPWconst x [int32(c)])) for { if v_0.Op != OpS390XMOVDconst { break } - c := v_0.AuxInt + c := auxIntToInt64(v_0.AuxInt) x := v_1 v.reset(OpS390XInvertFlags) v0 := b.NewValue0(v.Pos, OpS390XCMPWconst, types.TypeFlags) - v0.AuxInt = int64(int32(c)) + v0.AuxInt = int32ToAuxInt(int32(c)) v0.AddArg(x) v.AddArg(v0) return true @@ -6753,29 +6720,29 @@ func rewriteValueS390X_OpS390XCMPWU(v *Value) bool { v_0 := v.Args[0] b := v.Block // match: (CMPWU x (MOVDconst [c])) - // result: (CMPWUconst x [int64(int32(c))]) + // result: (CMPWUconst x [int32(c)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XCMPWUconst) - v.AuxInt = int64(int32(c)) + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } // match: (CMPWU (MOVDconst [c]) x) - // result: (InvertFlags (CMPWUconst x [int64(int32(c))])) + // result: (InvertFlags (CMPWUconst x [int32(c)])) for { if v_0.Op != OpS390XMOVDconst { break } - c := v_0.AuxInt + c := auxIntToInt64(v_0.AuxInt) x := v_1 v.reset(OpS390XInvertFlags) v0 := b.NewValue0(v.Pos, OpS390XCMPWUconst, types.TypeFlags) - v0.AuxInt = int64(int32(c)) + v0.AuxInt = int32ToAuxInt(int32(c)) v0.AddArg(x) v.AddArg(v0) return true @@ -7120,45 +7087,45 @@ func rewriteValueS390X_OpS390XCMPWconst(v *Value) bool { func rewriteValueS390X_OpS390XCMPconst(v *Value) bool { v_0 := v.Args[0] // match: (CMPconst (MOVDconst [x]) [y]) - // cond: x==y + // cond: x==int64(y) // result: (FlagEQ) for { - y := v.AuxInt + y := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDconst { break } - x := v_0.AuxInt - if !(x == y) { + x := auxIntToInt64(v_0.AuxInt) + if !(x == int64(y)) { break } v.reset(OpS390XFlagEQ) return true } // match: (CMPconst (MOVDconst [x]) [y]) - // cond: x<y + // cond: x<int64(y) // result: (FlagLT) for { - y := v.AuxInt + y := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDconst { break } - x := v_0.AuxInt - if !(x < y) { + x := auxIntToInt64(v_0.AuxInt) + if !(x < int64(y)) { break } v.reset(OpS390XFlagLT) return true } // match: (CMPconst (MOVDconst [x]) [y]) - // cond: x>y + // cond: x>int64(y) // result: (FlagGT) for { - y := v.AuxInt + y := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDconst { break } - x := v_0.AuxInt - if !(x > y) { + x := auxIntToInt64(v_0.AuxInt) + if !(x > int64(y)) { break } v.reset(OpS390XFlagGT) @@ -7310,15 +7277,15 @@ func rewriteValueS390X_OpS390XCPSDR(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (CPSDR y (FMOVDconst [c])) - // cond: c & -1<<63 == 0 + // cond: !math.Signbit(c) // result: (LPDFR y) for { y := v_0 if v_1.Op != OpS390XFMOVDconst { break } - c := v_1.AuxInt - if !(c&-1<<63 == 0) { + c := auxIntToFloat64(v_1.AuxInt) + if !(!math.Signbit(c)) { break } v.reset(OpS390XLPDFR) @@ -7326,15 +7293,15 @@ func rewriteValueS390X_OpS390XCPSDR(v *Value) bool { return true } // match: (CPSDR y (FMOVDconst [c])) - // cond: c & -1<<63 != 0 + // cond: math.Signbit(c) // result: (LNDFR y) for { y := v_0 if v_1.Op != OpS390XFMOVDconst { break } - c := v_1.AuxInt - if !(c&-1<<63 != 0) { + c := auxIntToFloat64(v_1.AuxInt) + if !(math.Signbit(c)) { break } v.reset(OpS390XLNDFR) @@ -7347,34 +7314,24 @@ func rewriteValueS390X_OpS390XFCMP(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] b := v.Block - // match: (FCMP x (FMOVDconst [c])) - // cond: auxTo64F(c) == 0 + // match: (FCMP x (FMOVDconst [0.0])) // result: (LTDBR x) for { x := v_0 - if v_1.Op != OpS390XFMOVDconst { - break - } - c := v_1.AuxInt - if !(auxTo64F(c) == 0) { + if v_1.Op != OpS390XFMOVDconst || auxIntToFloat64(v_1.AuxInt) != 0.0 { break } v.reset(OpS390XLTDBR) v.AddArg(x) return true } - // match: (FCMP (FMOVDconst [c]) x) - // cond: auxTo64F(c) == 0 + // match: (FCMP (FMOVDconst [0.0]) x) // result: (InvertFlags (LTDBR <v.Type> x)) for { - if v_0.Op != OpS390XFMOVDconst { + if v_0.Op != OpS390XFMOVDconst || auxIntToFloat64(v_0.AuxInt) != 0.0 { break } - c := v_0.AuxInt x := v_1 - if !(auxTo64F(c) == 0) { - break - } v.reset(OpS390XInvertFlags) v0 := b.NewValue0(v.Pos, OpS390XLTDBR, v.Type) v0.AddArg(x) @@ -7387,34 +7344,24 @@ func rewriteValueS390X_OpS390XFCMPS(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] b := v.Block - // match: (FCMPS x (FMOVSconst [c])) - // cond: auxTo32F(c) == 0 + // match: (FCMPS x (FMOVSconst [0.0])) // result: (LTEBR x) for { x := v_0 - if v_1.Op != OpS390XFMOVSconst { - break - } - c := v_1.AuxInt - if !(auxTo32F(c) == 0) { + if v_1.Op != OpS390XFMOVSconst || auxIntToFloat32(v_1.AuxInt) != 0.0 { break } v.reset(OpS390XLTEBR) v.AddArg(x) return true } - // match: (FCMPS (FMOVSconst [c]) x) - // cond: auxTo32F(c) == 0 + // match: (FCMPS (FMOVSconst [0.0]) x) // result: (InvertFlags (LTEBR <v.Type> x)) for { - if v_0.Op != OpS390XFMOVSconst { + if v_0.Op != OpS390XFMOVSconst || auxIntToFloat32(v_0.AuxInt) != 0.0 { break } - c := v_0.AuxInt x := v_1 - if !(auxTo32F(c) == 0) { - break - } v.reset(OpS390XInvertFlags) v0 := b.NewValue0(v.Pos, OpS390XLTEBR, v.Type) v0.AddArg(x) @@ -7464,148 +7411,48 @@ func rewriteValueS390X_OpS390XFMOVDload(v *Value) bool { return true } // match: (FMOVDload [off1] {sym} (ADDconst [off2] ptr) mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (FMOVDload [off1+off2] {sym} ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XFMOVDload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (FMOVDload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (FMOVDload [off1+off2] {mergeSym(sym1,sym2)} base mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) + // result: (FMOVDload [off1+off2] {mergeSymTyped(sym1,sym2)} base mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { break } v.reset(OpS390XFMOVDload) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(base, mem) return true } - // match: (FMOVDload [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (FMOVDloadidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XFMOVDloadidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg3(ptr, idx, mem) - return true - } - // match: (FMOVDload [off] {sym} (ADD ptr idx) mem) - // cond: ptr.Op != OpSB - // result: (FMOVDloadidx [off] {sym} ptr idx mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - mem := v_1 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XFMOVDloadidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg3(ptr, idx, mem) - return true - } - break - } - return false -} -func rewriteValueS390X_OpS390XFMOVDloadidx(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (FMOVDloadidx [c] {sym} (ADDconst [d] ptr) idx mem) - // cond: is20Bit(c+d) - // result: (FMOVDloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - if v_0.Op != OpS390XADDconst { - break - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - mem := v_2 - if !(is20Bit(c + d)) { - break - } - v.reset(OpS390XFMOVDloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - // match: (FMOVDloadidx [c] {sym} ptr (ADDconst [d] idx) mem) - // cond: is20Bit(c+d) - // result: (FMOVDloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - ptr := v_0 - if v_1.Op != OpS390XADDconst { - break - } - d := v_1.AuxInt - idx := v_1.Args[0] - mem := v_2 - if !(is20Bit(c + d)) { - break - } - v.reset(OpS390XFMOVDloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } return false } func rewriteValueS390X_OpS390XFMOVDstore(v *Value) bool { @@ -7613,155 +7460,50 @@ func rewriteValueS390X_OpS390XFMOVDstore(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (FMOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (FMOVDstore [off1+off2] {sym} ptr val mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] val := v_1 mem := v_2 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XFMOVDstore) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(ptr, val, mem) return true } // match: (FMOVDstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) + // result: (FMOVDstore [off1+off2] {mergeSymTyped(sym1,sym2)} base val mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] val := v_1 mem := v_2 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { break } v.reset(OpS390XFMOVDstore) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg3(base, val, mem) return true } - // match: (FMOVDstore [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) val mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (FMOVDstoreidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - val := v_1 - mem := v_2 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XFMOVDstoreidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg4(ptr, idx, val, mem) - return true - } - // match: (FMOVDstore [off] {sym} (ADD ptr idx) val mem) - // cond: ptr.Op != OpSB - // result: (FMOVDstoreidx [off] {sym} ptr idx val mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - val := v_1 - mem := v_2 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XFMOVDstoreidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } - return false -} -func rewriteValueS390X_OpS390XFMOVDstoreidx(v *Value) bool { - v_3 := v.Args[3] - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (FMOVDstoreidx [c] {sym} (ADDconst [d] ptr) idx val mem) - // cond: is20Bit(c+d) - // result: (FMOVDstoreidx [c+d] {sym} ptr idx val mem) - for { - c := v.AuxInt - sym := v.Aux - if v_0.Op != OpS390XADDconst { - break - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - val := v_2 - mem := v_3 - if !(is20Bit(c + d)) { - break - } - v.reset(OpS390XFMOVDstoreidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg4(ptr, idx, val, mem) - return true - } - // match: (FMOVDstoreidx [c] {sym} ptr (ADDconst [d] idx) val mem) - // cond: is20Bit(c+d) - // result: (FMOVDstoreidx [c+d] {sym} ptr idx val mem) - for { - c := v.AuxInt - sym := v.Aux - ptr := v_0 - if v_1.Op != OpS390XADDconst { - break - } - d := v_1.AuxInt - idx := v_1.Args[0] - val := v_2 - mem := v_3 - if !(is20Bit(c + d)) { - break - } - v.reset(OpS390XFMOVDstoreidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg4(ptr, idx, val, mem) - return true - } return false } func rewriteValueS390X_OpS390XFMOVSload(v *Value) bool { @@ -7786,148 +7528,48 @@ func rewriteValueS390X_OpS390XFMOVSload(v *Value) bool { return true } // match: (FMOVSload [off1] {sym} (ADDconst [off2] ptr) mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (FMOVSload [off1+off2] {sym} ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XFMOVSload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (FMOVSload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (FMOVSload [off1+off2] {mergeSym(sym1,sym2)} base mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) + // result: (FMOVSload [off1+off2] {mergeSymTyped(sym1,sym2)} base mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { break } v.reset(OpS390XFMOVSload) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(base, mem) return true } - // match: (FMOVSload [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (FMOVSloadidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XFMOVSloadidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg3(ptr, idx, mem) - return true - } - // match: (FMOVSload [off] {sym} (ADD ptr idx) mem) - // cond: ptr.Op != OpSB - // result: (FMOVSloadidx [off] {sym} ptr idx mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - mem := v_1 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XFMOVSloadidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg3(ptr, idx, mem) - return true - } - break - } - return false -} -func rewriteValueS390X_OpS390XFMOVSloadidx(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (FMOVSloadidx [c] {sym} (ADDconst [d] ptr) idx mem) - // cond: is20Bit(c+d) - // result: (FMOVSloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - if v_0.Op != OpS390XADDconst { - break - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - mem := v_2 - if !(is20Bit(c + d)) { - break - } - v.reset(OpS390XFMOVSloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - // match: (FMOVSloadidx [c] {sym} ptr (ADDconst [d] idx) mem) - // cond: is20Bit(c+d) - // result: (FMOVSloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - ptr := v_0 - if v_1.Op != OpS390XADDconst { - break - } - d := v_1.AuxInt - idx := v_1.Args[0] - mem := v_2 - if !(is20Bit(c + d)) { - break - } - v.reset(OpS390XFMOVSloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } return false } func rewriteValueS390X_OpS390XFMOVSstore(v *Value) bool { @@ -7935,155 +7577,50 @@ func rewriteValueS390X_OpS390XFMOVSstore(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (FMOVSstore [off1] {sym} (ADDconst [off2] ptr) val mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (FMOVSstore [off1+off2] {sym} ptr val mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] val := v_1 mem := v_2 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XFMOVSstore) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(ptr, val, mem) return true } // match: (FMOVSstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (FMOVSstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) + // result: (FMOVSstore [off1+off2] {mergeSymTyped(sym1,sym2)} base val mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] val := v_1 mem := v_2 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { break } v.reset(OpS390XFMOVSstore) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg3(base, val, mem) return true } - // match: (FMOVSstore [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) val mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (FMOVSstoreidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - val := v_1 - mem := v_2 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XFMOVSstoreidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg4(ptr, idx, val, mem) - return true - } - // match: (FMOVSstore [off] {sym} (ADD ptr idx) val mem) - // cond: ptr.Op != OpSB - // result: (FMOVSstoreidx [off] {sym} ptr idx val mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - val := v_1 - mem := v_2 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XFMOVSstoreidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } - return false -} -func rewriteValueS390X_OpS390XFMOVSstoreidx(v *Value) bool { - v_3 := v.Args[3] - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (FMOVSstoreidx [c] {sym} (ADDconst [d] ptr) idx val mem) - // cond: is20Bit(c+d) - // result: (FMOVSstoreidx [c+d] {sym} ptr idx val mem) - for { - c := v.AuxInt - sym := v.Aux - if v_0.Op != OpS390XADDconst { - break - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - val := v_2 - mem := v_3 - if !(is20Bit(c + d)) { - break - } - v.reset(OpS390XFMOVSstoreidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg4(ptr, idx, val, mem) - return true - } - // match: (FMOVSstoreidx [c] {sym} ptr (ADDconst [d] idx) val mem) - // cond: is20Bit(c+d) - // result: (FMOVSstoreidx [c+d] {sym} ptr idx val mem) - for { - c := v.AuxInt - sym := v.Aux - ptr := v_0 - if v_1.Op != OpS390XADDconst { - break - } - d := v_1.AuxInt - idx := v_1.Args[0] - val := v_2 - mem := v_3 - if !(is20Bit(c + d)) { - break - } - v.reset(OpS390XFMOVSstoreidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg4(ptr, idx, val, mem) - return true - } return false } func rewriteValueS390X_OpS390XFNEG(v *Value) bool { @@ -8536,154 +8073,48 @@ func rewriteValueS390X_OpS390XMOVBZload(v *Value) bool { return true } // match: (MOVBZload [off1] {sym} (ADDconst [off2] ptr) mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (MOVBZload [off1+off2] {sym} ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XMOVBZload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (MOVBZload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVBZload [off1+off2] {mergeSym(sym1,sym2)} base mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) + // result: (MOVBZload [off1+off2] {mergeSymTyped(sym1,sym2)} base mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { break } v.reset(OpS390XMOVBZload) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(base, mem) return true } - // match: (MOVBZload [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVBZloadidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XMOVBZloadidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg3(ptr, idx, mem) - return true - } - // match: (MOVBZload [off] {sym} (ADD ptr idx) mem) - // cond: ptr.Op != OpSB - // result: (MOVBZloadidx [off] {sym} ptr idx mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - mem := v_1 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XMOVBZloadidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg3(ptr, idx, mem) - return true - } - break - } - return false -} -func rewriteValueS390X_OpS390XMOVBZloadidx(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVBZloadidx [c] {sym} (ADDconst [d] ptr) idx mem) - // cond: is20Bit(c+d) - // result: (MOVBZloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - if v_0.Op != OpS390XADDconst { - continue - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVBZloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } - // match: (MOVBZloadidx [c] {sym} ptr (ADDconst [d] idx) mem) - // cond: is20Bit(c+d) - // result: (MOVBZloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - ptr := v_0 - if v_1.Op != OpS390XADDconst { - continue - } - d := v_1.AuxInt - idx := v_1.Args[0] - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVBZloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } return false } func rewriteValueS390X_OpS390XMOVBZreg(v *Value) bool { @@ -8797,17 +8228,6 @@ func rewriteValueS390X_OpS390XMOVBZreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVBZreg x:(MOVBZloadidx _ _ _)) - // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVBZloadidx || !(!x.Type.IsSigned() || x.Type.Size() > 1) { - break - } - v.copyOf(x) - return true - } // match: (MOVBZreg <t> x:(MOVBload [o] {s} p mem)) // cond: x.Uses == 1 && clobber(x) // result: @x.Block (MOVBZload <t> [o] {s} p mem) @@ -8832,31 +8252,6 @@ func rewriteValueS390X_OpS390XMOVBZreg(v *Value) bool { v0.AddArg2(p, mem) return true } - // match: (MOVBZreg <t> x:(MOVBloadidx [o] {s} p i mem)) - // cond: x.Uses == 1 && clobber(x) - // result: @x.Block (MOVBZloadidx <t> [o] {s} p i mem) - for { - t := v.Type - x := v_0 - if x.Op != OpS390XMOVBloadidx { - break - } - o := auxIntToInt32(x.AuxInt) - s := auxToSym(x.Aux) - mem := x.Args[2] - p := x.Args[0] - i := x.Args[1] - if !(x.Uses == 1 && clobber(x)) { - break - } - b = x.Block - v0 := b.NewValue0(v.Pos, OpS390XMOVBZloadidx, t) - v.copyOf(v0) - v0.AuxInt = int32ToAuxInt(o) - v0.Aux = symToAux(s) - v0.AddArg3(p, i, mem) - return true - } // match: (MOVBZreg x:(Arg <t>)) // cond: !t.IsSigned() && t.Size() == 1 // result: x @@ -8909,16 +8304,16 @@ func rewriteValueS390X_OpS390XMOVBZreg(v *Value) bool { return true } // match: (MOVBZreg (ANDWconst [m] x)) - // result: (MOVWZreg (ANDWconst <typ.UInt32> [int64( uint8(m))] x)) + // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32( uint8(m))] x)) for { if v_0.Op != OpS390XANDWconst { break } - m := v_0.AuxInt + m := auxIntToInt32(v_0.AuxInt) x := v_0.Args[0] v.reset(OpS390XMOVWZreg) v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) - v0.AuxInt = int64(uint8(m)) + v0.AuxInt = int32ToAuxInt(int32(uint8(m))) v0.AddArg(x) v.AddArg(v0) return true @@ -8948,154 +8343,48 @@ func rewriteValueS390X_OpS390XMOVBload(v *Value) bool { return true } // match: (MOVBload [off1] {sym} (ADDconst [off2] ptr) mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (MOVBload [off1+off2] {sym} ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XMOVBload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (MOVBload [off1] {sym1} (MOVDaddr [off2] {sym2} base) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) + // result: (MOVBload [off1+off2] {mergeSymTyped(sym1,sym2)} base mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { break } v.reset(OpS390XMOVBload) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(base, mem) return true } - // match: (MOVBload [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVBloadidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XMOVBloadidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg3(ptr, idx, mem) - return true - } - // match: (MOVBload [off] {sym} (ADD ptr idx) mem) - // cond: ptr.Op != OpSB - // result: (MOVBloadidx [off] {sym} ptr idx mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - mem := v_1 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XMOVBloadidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg3(ptr, idx, mem) - return true - } - break - } - return false -} -func rewriteValueS390X_OpS390XMOVBloadidx(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVBloadidx [c] {sym} (ADDconst [d] ptr) idx mem) - // cond: is20Bit(c+d) - // result: (MOVBloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - if v_0.Op != OpS390XADDconst { - continue - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVBloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } - // match: (MOVBloadidx [c] {sym} ptr (ADDconst [d] idx) mem) - // cond: is20Bit(c+d) - // result: (MOVBloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - ptr := v_0 - if v_1.Op != OpS390XADDconst { - continue - } - d := v_1.AuxInt - idx := v_1.Args[0] - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVBloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } return false } func rewriteValueS390X_OpS390XMOVBreg(v *Value) bool { @@ -9209,17 +8498,6 @@ func rewriteValueS390X_OpS390XMOVBreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVBreg x:(MOVBloadidx _ _ _)) - // cond: (x.Type.IsSigned() || x.Type.Size() == 8) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVBloadidx || !(x.Type.IsSigned() || x.Type.Size() == 8) { - break - } - v.copyOf(x) - return true - } // match: (MOVBreg <t> x:(MOVBZload [o] {s} p mem)) // cond: x.Uses == 1 && clobber(x) // result: @x.Block (MOVBload <t> [o] {s} p mem) @@ -9244,31 +8522,6 @@ func rewriteValueS390X_OpS390XMOVBreg(v *Value) bool { v0.AddArg2(p, mem) return true } - // match: (MOVBreg <t> x:(MOVBZloadidx [o] {s} p i mem)) - // cond: x.Uses == 1 && clobber(x) - // result: @x.Block (MOVBloadidx <t> [o] {s} p i mem) - for { - t := v.Type - x := v_0 - if x.Op != OpS390XMOVBZloadidx { - break - } - o := auxIntToInt32(x.AuxInt) - s := auxToSym(x.Aux) - mem := x.Args[2] - p := x.Args[0] - i := x.Args[1] - if !(x.Uses == 1 && clobber(x)) { - break - } - b = x.Block - v0 := b.NewValue0(v.Pos, OpS390XMOVBloadidx, t) - v.copyOf(v0) - v0.AuxInt = int32ToAuxInt(o) - v0.Aux = symToAux(s) - v0.AddArg3(p, i, mem) - return true - } // match: (MOVBreg x:(Arg <t>)) // cond: t.IsSigned() && t.Size() == 1 // result: x @@ -9297,19 +8550,19 @@ func rewriteValueS390X_OpS390XMOVBreg(v *Value) bool { } // match: (MOVBreg (ANDWconst [m] x)) // cond: int8(m) >= 0 - // result: (MOVWZreg (ANDWconst <typ.UInt32> [int64( uint8(m))] x)) + // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32( uint8(m))] x)) for { if v_0.Op != OpS390XANDWconst { break } - m := v_0.AuxInt + m := auxIntToInt32(v_0.AuxInt) x := v_0.Args[0] if !(int8(m) >= 0) { break } v.reset(OpS390XMOVWZreg) v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) - v0.AuxInt = int64(uint8(m)) + v0.AuxInt = int32ToAuxInt(int32(uint8(m))) v0.AddArg(x) v.AddArg(v0) return true @@ -9355,133 +8608,81 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { return true } // match: (MOVBstore [off1] {sym} (ADDconst [off2] ptr) val mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (MOVBstore [off1+off2] {sym} ptr val mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] val := v_1 mem := v_2 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XMOVBstore) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(ptr, val, mem) return true } // match: (MOVBstore [off] {sym} ptr (MOVDconst [c]) mem) - // cond: is20Bit(off) && ptr.Op != OpSB - // result: (MOVBstoreconst [makeValAndOff(int64(int8(c)),off)] {sym} ptr mem) + // cond: is20Bit(int64(off)) && ptr.Op != OpSB + // result: (MOVBstoreconst [makeValAndOff32(int32(int8(c)),off)] {sym} ptr mem) for { - off := v.AuxInt - sym := v.Aux + off := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) ptr := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) mem := v_2 - if !(is20Bit(off) && ptr.Op != OpSB) { + if !(is20Bit(int64(off)) && ptr.Op != OpSB) { break } v.reset(OpS390XMOVBstoreconst) - v.AuxInt = makeValAndOff(int64(int8(c)), off) - v.Aux = sym + v.AuxInt = valAndOffToAuxInt(makeValAndOff32(int32(int8(c)), off)) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (MOVBstore [off1] {sym1} (MOVDaddr [off2] {sym2} base) val mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) + // result: (MOVBstore [off1+off2] {mergeSymTyped(sym1,sym2)} base val mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] val := v_1 mem := v_2 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) { break } v.reset(OpS390XMOVBstore) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg3(base, val, mem) return true } - // match: (MOVBstore [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) val mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVBstoreidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - val := v_1 - mem := v_2 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XMOVBstoreidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg4(ptr, idx, val, mem) - return true - } - // match: (MOVBstore [off] {sym} (ADD ptr idx) val mem) - // cond: ptr.Op != OpSB - // result: (MOVBstoreidx [off] {sym} ptr idx val mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - val := v_1 - mem := v_2 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XMOVBstoreidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } // match: (MOVBstore [i] {s} p w x:(MOVBstore [i-1] {s} p (SRDconst [8] w) mem)) // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVHstore [i-1] {s} p w mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w := v_1 x := v_2 - if x.Op != OpS390XMOVBstore || x.AuxInt != i-1 || x.Aux != s { + if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -9489,12 +8690,12 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { break } x_1 := x.Args[1] - if x_1.Op != OpS390XSRDconst || x_1.AuxInt != 8 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { + if x_1.Op != OpS390XSRDconst || auxIntToInt8(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVHstore) - v.AuxInt = i - 1 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 1) + v.Aux = symToAux(s) v.AddArg3(p, w, mem) return true } @@ -9502,17 +8703,17 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVHstore [i-1] {s} p w0 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w0 := v_1 if w0.Op != OpS390XSRDconst { break } - j := w0.AuxInt + j := auxIntToInt8(w0.AuxInt) w := w0.Args[0] x := v_2 - if x.Op != OpS390XMOVBstore || x.AuxInt != i-1 || x.Aux != s { + if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -9520,12 +8721,12 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { break } x_1 := x.Args[1] - if x_1.Op != OpS390XSRDconst || x_1.AuxInt != j+8 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { + if x_1.Op != OpS390XSRDconst || auxIntToInt8(x_1.AuxInt) != j+8 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVHstore) - v.AuxInt = i - 1 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 1) + v.Aux = symToAux(s) v.AddArg3(p, w0, mem) return true } @@ -9533,12 +8734,12 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVHstore [i-1] {s} p w mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w := v_1 x := v_2 - if x.Op != OpS390XMOVBstore || x.AuxInt != i-1 || x.Aux != s { + if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -9546,12 +8747,12 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { break } x_1 := x.Args[1] - if x_1.Op != OpS390XSRWconst || x_1.AuxInt != 8 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { + if x_1.Op != OpS390XSRWconst || auxIntToInt8(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVHstore) - v.AuxInt = i - 1 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 1) + v.Aux = symToAux(s) v.AddArg3(p, w, mem) return true } @@ -9559,17 +8760,17 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVHstore [i-1] {s} p w0 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w0 := v_1 if w0.Op != OpS390XSRWconst { break } - j := w0.AuxInt + j := auxIntToInt8(w0.AuxInt) w := w0.Args[0] x := v_2 - if x.Op != OpS390XMOVBstore || x.AuxInt != i-1 || x.Aux != s { + if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -9577,12 +8778,12 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { break } x_1 := x.Args[1] - if x_1.Op != OpS390XSRWconst || x_1.AuxInt != j+8 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { + if x_1.Op != OpS390XSRWconst || auxIntToInt8(x_1.AuxInt) != j+8 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVHstore) - v.AuxInt = i - 1 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 1) + v.Aux = symToAux(s) v.AddArg3(p, w0, mem) return true } @@ -9590,15 +8791,15 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVHBRstore [i-1] {s} p w mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 - if v_1.Op != OpS390XSRDconst || v_1.AuxInt != 8 { + if v_1.Op != OpS390XSRDconst || auxIntToInt8(v_1.AuxInt) != 8 { break } w := v_1.Args[0] x := v_2 - if x.Op != OpS390XMOVBstore || x.AuxInt != i-1 || x.Aux != s { + if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -9606,8 +8807,8 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { break } v.reset(OpS390XMOVHBRstore) - v.AuxInt = i - 1 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 1) + v.Aux = symToAux(s) v.AddArg3(p, w, mem) return true } @@ -9615,16 +8816,16 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVHBRstore [i-1] {s} p w0 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 if v_1.Op != OpS390XSRDconst { break } - j := v_1.AuxInt + j := auxIntToInt8(v_1.AuxInt) w := v_1.Args[0] x := v_2 - if x.Op != OpS390XMOVBstore || x.AuxInt != i-1 || x.Aux != s { + if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -9632,12 +8833,12 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { break } w0 := x.Args[1] - if w0.Op != OpS390XSRDconst || w0.AuxInt != j-8 || w != w0.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { + if w0.Op != OpS390XSRDconst || auxIntToInt8(w0.AuxInt) != j-8 || w != w0.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVHBRstore) - v.AuxInt = i - 1 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 1) + v.Aux = symToAux(s) v.AddArg3(p, w0, mem) return true } @@ -9645,15 +8846,15 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVHBRstore [i-1] {s} p w mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 - if v_1.Op != OpS390XSRWconst || v_1.AuxInt != 8 { + if v_1.Op != OpS390XSRWconst || auxIntToInt8(v_1.AuxInt) != 8 { break } w := v_1.Args[0] x := v_2 - if x.Op != OpS390XMOVBstore || x.AuxInt != i-1 || x.Aux != s { + if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -9661,8 +8862,8 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { break } v.reset(OpS390XMOVHBRstore) - v.AuxInt = i - 1 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 1) + v.Aux = symToAux(s) v.AddArg3(p, w, mem) return true } @@ -9670,16 +8871,16 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVHBRstore [i-1] {s} p w0 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 if v_1.Op != OpS390XSRWconst { break } - j := v_1.AuxInt + j := auxIntToInt8(v_1.AuxInt) w := v_1.Args[0] x := v_2 - if x.Op != OpS390XMOVBstore || x.AuxInt != i-1 || x.Aux != s { + if x.Op != OpS390XMOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -9687,12 +8888,12 @@ func rewriteValueS390X_OpS390XMOVBstore(v *Value) bool { break } w0 := x.Args[1] - if w0.Op != OpS390XSRWconst || w0.AuxInt != j-8 || w != w0.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { + if w0.Op != OpS390XSRWconst || auxIntToInt8(w0.AuxInt) != j-8 || w != w0.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVHBRstore) - v.AuxInt = i - 1 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 1) + v.Aux = symToAux(s) v.AddArg3(p, w0, mem) return true } @@ -9702,508 +8903,161 @@ func rewriteValueS390X_OpS390XMOVBstoreconst(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (MOVBstoreconst [sc] {s} (ADDconst [off] ptr) mem) - // cond: is20Bit(ValAndOff(sc).Off()+off) - // result: (MOVBstoreconst [ValAndOff(sc).add(off)] {s} ptr mem) + // cond: is20Bit(sc.Off()+int64(off)) + // result: (MOVBstoreconst [sc.addOffset32(off)] {s} ptr mem) for { - sc := v.AuxInt - s := v.Aux + sc := auxIntToValAndOff(v.AuxInt) + s := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off := v_0.AuxInt + off := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(is20Bit(ValAndOff(sc).Off() + off)) { + if !(is20Bit(sc.Off() + int64(off))) { break } v.reset(OpS390XMOVBstoreconst) - v.AuxInt = ValAndOff(sc).add(off) - v.Aux = s + v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) + v.Aux = symToAux(s) v.AddArg2(ptr, mem) return true } // match: (MOVBstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem) - // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) - // result: (MOVBstoreconst [ValAndOff(sc).add(off)] {mergeSym(sym1, sym2)} ptr mem) + // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off) + // result: (MOVBstoreconst [sc.addOffset32(off)] {mergeSymTyped(sym1, sym2)} ptr mem) for { - sc := v.AuxInt - sym1 := v.Aux + sc := auxIntToValAndOff(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } - off := v_0.AuxInt - sym2 := v_0.Aux + off := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) ptr := v_0.Args[0] mem := v_1 - if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off)) { + if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) { break } v.reset(OpS390XMOVBstoreconst) - v.AuxInt = ValAndOff(sc).add(off) - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(ptr, mem) return true } // match: (MOVBstoreconst [c] {s} p x:(MOVBstoreconst [a] {s} p mem)) - // cond: p.Op != OpSB && x.Uses == 1 && ValAndOff(a).Off() + 1 == ValAndOff(c).Off() && clobber(x) - // result: (MOVHstoreconst [makeValAndOff(ValAndOff(c).Val()&0xff | ValAndOff(a).Val()<<8, ValAndOff(a).Off())] {s} p mem) + // cond: p.Op != OpSB && x.Uses == 1 && a.Off() + 1 == c.Off() && clobber(x) + // result: (MOVHstoreconst [makeValAndOff32(c.Val32()&0xff | a.Val32()<<8, a.Off32())] {s} p mem) for { - c := v.AuxInt - s := v.Aux + c := auxIntToValAndOff(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 x := v_1 if x.Op != OpS390XMOVBstoreconst { break } - a := x.AuxInt - if x.Aux != s { + a := auxIntToValAndOff(x.AuxInt) + if auxToSym(x.Aux) != s { break } mem := x.Args[1] - if p != x.Args[0] || !(p.Op != OpSB && x.Uses == 1 && ValAndOff(a).Off()+1 == ValAndOff(c).Off() && clobber(x)) { + if p != x.Args[0] || !(p.Op != OpSB && x.Uses == 1 && a.Off()+1 == c.Off() && clobber(x)) { break } v.reset(OpS390XMOVHstoreconst) - v.AuxInt = makeValAndOff(ValAndOff(c).Val()&0xff|ValAndOff(a).Val()<<8, ValAndOff(a).Off()) - v.Aux = s + v.AuxInt = valAndOffToAuxInt(makeValAndOff32(c.Val32()&0xff|a.Val32()<<8, a.Off32())) + v.Aux = symToAux(s) v.AddArg2(p, mem) return true } return false } -func rewriteValueS390X_OpS390XMOVBstoreidx(v *Value) bool { - v_3 := v.Args[3] - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVBstoreidx [c] {sym} (ADDconst [d] ptr) idx val mem) - // cond: is20Bit(c+d) - // result: (MOVBstoreidx [c+d] {sym} ptr idx val mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - if v_0.Op != OpS390XADDconst { - continue - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - val := v_2 - mem := v_3 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVBstoreidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } - // match: (MOVBstoreidx [c] {sym} ptr (ADDconst [d] idx) val mem) - // cond: is20Bit(c+d) - // result: (MOVBstoreidx [c+d] {sym} ptr idx val mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - ptr := v_0 - if v_1.Op != OpS390XADDconst { - continue - } - d := v_1.AuxInt - idx := v_1.Args[0] - val := v_2 - mem := v_3 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVBstoreidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } - // match: (MOVBstoreidx [i] {s} p idx w x:(MOVBstoreidx [i-1] {s} p idx (SRDconst [8] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVHstoreidx [i-1] {s} p idx w mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - w := v_2 - x := v_3 - if x.Op != OpS390XMOVBstoreidx || x.AuxInt != i-1 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - x_2 := x.Args[2] - if x_2.Op != OpS390XSRDconst || x_2.AuxInt != 8 || w != x_2.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVHstoreidx) - v.AuxInt = i - 1 - v.Aux = s - v.AddArg4(p, idx, w, mem) - return true - } - } - break - } - // match: (MOVBstoreidx [i] {s} p idx w0:(SRDconst [j] w) x:(MOVBstoreidx [i-1] {s} p idx (SRDconst [j+8] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVHstoreidx [i-1] {s} p idx w0 mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - w0 := v_2 - if w0.Op != OpS390XSRDconst { - continue - } - j := w0.AuxInt - w := w0.Args[0] - x := v_3 - if x.Op != OpS390XMOVBstoreidx || x.AuxInt != i-1 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - x_2 := x.Args[2] - if x_2.Op != OpS390XSRDconst || x_2.AuxInt != j+8 || w != x_2.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVHstoreidx) - v.AuxInt = i - 1 - v.Aux = s - v.AddArg4(p, idx, w0, mem) - return true - } - } - break - } - // match: (MOVBstoreidx [i] {s} p idx w x:(MOVBstoreidx [i-1] {s} p idx (SRWconst [8] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVHstoreidx [i-1] {s} p idx w mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - w := v_2 - x := v_3 - if x.Op != OpS390XMOVBstoreidx || x.AuxInt != i-1 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - x_2 := x.Args[2] - if x_2.Op != OpS390XSRWconst || x_2.AuxInt != 8 || w != x_2.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVHstoreidx) - v.AuxInt = i - 1 - v.Aux = s - v.AddArg4(p, idx, w, mem) - return true - } - } - break - } - // match: (MOVBstoreidx [i] {s} p idx w0:(SRWconst [j] w) x:(MOVBstoreidx [i-1] {s} p idx (SRWconst [j+8] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVHstoreidx [i-1] {s} p idx w0 mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - w0 := v_2 - if w0.Op != OpS390XSRWconst { - continue - } - j := w0.AuxInt - w := w0.Args[0] - x := v_3 - if x.Op != OpS390XMOVBstoreidx || x.AuxInt != i-1 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - x_2 := x.Args[2] - if x_2.Op != OpS390XSRWconst || x_2.AuxInt != j+8 || w != x_2.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVHstoreidx) - v.AuxInt = i - 1 - v.Aux = s - v.AddArg4(p, idx, w0, mem) - return true - } - } - break - } - // match: (MOVBstoreidx [i] {s} p idx (SRDconst [8] w) x:(MOVBstoreidx [i-1] {s} p idx w mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVHBRstoreidx [i-1] {s} p idx w mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - if v_2.Op != OpS390XSRDconst || v_2.AuxInt != 8 { - continue - } - w := v_2.Args[0] - x := v_3 - if x.Op != OpS390XMOVBstoreidx || x.AuxInt != i-1 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 || w != x.Args[2] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVHBRstoreidx) - v.AuxInt = i - 1 - v.Aux = s - v.AddArg4(p, idx, w, mem) - return true - } - } - break - } - // match: (MOVBstoreidx [i] {s} p idx (SRDconst [j] w) x:(MOVBstoreidx [i-1] {s} p idx w0:(SRDconst [j-8] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVHBRstoreidx [i-1] {s} p idx w0 mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - if v_2.Op != OpS390XSRDconst { - continue - } - j := v_2.AuxInt - w := v_2.Args[0] - x := v_3 - if x.Op != OpS390XMOVBstoreidx || x.AuxInt != i-1 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - w0 := x.Args[2] - if w0.Op != OpS390XSRDconst || w0.AuxInt != j-8 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVHBRstoreidx) - v.AuxInt = i - 1 - v.Aux = s - v.AddArg4(p, idx, w0, mem) - return true - } - } - break - } - // match: (MOVBstoreidx [i] {s} p idx (SRWconst [8] w) x:(MOVBstoreidx [i-1] {s} p idx w mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVHBRstoreidx [i-1] {s} p idx w mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - if v_2.Op != OpS390XSRWconst || v_2.AuxInt != 8 { - continue - } - w := v_2.Args[0] - x := v_3 - if x.Op != OpS390XMOVBstoreidx || x.AuxInt != i-1 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 || w != x.Args[2] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVHBRstoreidx) - v.AuxInt = i - 1 - v.Aux = s - v.AddArg4(p, idx, w, mem) - return true - } - } - break - } - // match: (MOVBstoreidx [i] {s} p idx (SRWconst [j] w) x:(MOVBstoreidx [i-1] {s} p idx w0:(SRWconst [j-8] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVHBRstoreidx [i-1] {s} p idx w0 mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - if v_2.Op != OpS390XSRWconst { - continue - } - j := v_2.AuxInt - w := v_2.Args[0] - x := v_3 - if x.Op != OpS390XMOVBstoreidx || x.AuxInt != i-1 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - w0 := x.Args[2] - if w0.Op != OpS390XSRWconst || w0.AuxInt != j-8 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVHBRstoreidx) - v.AuxInt = i - 1 - v.Aux = s - v.AddArg4(p, idx, w0, mem) - return true - } - } - break - } - return false -} func rewriteValueS390X_OpS390XMOVDaddridx(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (MOVDaddridx [c] {s} (ADDconst [d] x) y) - // cond: is20Bit(c+d) && x.Op != OpSB + // cond: is20Bit(int64(c)+int64(d)) // result: (MOVDaddridx [c+d] {s} x y) for { - c := v.AuxInt - s := v.Aux + c := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - d := v_0.AuxInt + d := auxIntToInt32(v_0.AuxInt) x := v_0.Args[0] y := v_1 - if !(is20Bit(c+d) && x.Op != OpSB) { + if !(is20Bit(int64(c) + int64(d))) { break } v.reset(OpS390XMOVDaddridx) - v.AuxInt = c + d - v.Aux = s + v.AuxInt = int32ToAuxInt(c + d) + v.Aux = symToAux(s) v.AddArg2(x, y) return true } // match: (MOVDaddridx [c] {s} x (ADDconst [d] y)) - // cond: is20Bit(c+d) && y.Op != OpSB + // cond: is20Bit(int64(c)+int64(d)) // result: (MOVDaddridx [c+d] {s} x y) for { - c := v.AuxInt - s := v.Aux + c := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - d := v_1.AuxInt + d := auxIntToInt32(v_1.AuxInt) y := v_1.Args[0] - if !(is20Bit(c+d) && y.Op != OpSB) { + if !(is20Bit(int64(c) + int64(d))) { break } v.reset(OpS390XMOVDaddridx) - v.AuxInt = c + d - v.Aux = s + v.AuxInt = int32ToAuxInt(c + d) + v.Aux = symToAux(s) v.AddArg2(x, y) return true } // match: (MOVDaddridx [off1] {sym1} (MOVDaddr [off2] {sym2} x) y) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB - // result: (MOVDaddridx [off1+off2] {mergeSym(sym1,sym2)} x y) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB + // result: (MOVDaddridx [off1+off2] {mergeSymTyped(sym1,sym2)} x y) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) x := v_0.Args[0] y := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) { break } v.reset(OpS390XMOVDaddridx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(x, y) return true } // match: (MOVDaddridx [off1] {sym1} x (MOVDaddr [off2] {sym2} y)) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && y.Op != OpSB - // result: (MOVDaddridx [off1+off2] {mergeSym(sym1,sym2)} x y) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && y.Op != OpSB + // result: (MOVDaddridx [off1+off2] {mergeSymTyped(sym1,sym2)} x y) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - off2 := v_1.AuxInt - sym2 := v_1.Aux + off2 := auxIntToInt32(v_1.AuxInt) + sym2 := auxToSym(v_1.Aux) y := v_1.Args[0] - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && y.Op != OpSB) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && y.Op != OpSB) { break } v.reset(OpS390XMOVDaddridx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(x, y) return true } @@ -10250,155 +9104,49 @@ func rewriteValueS390X_OpS390XMOVDload(v *Value) bool { return true } // match: (MOVDload [off1] {sym} (ADDconst [off2] ptr) mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (MOVDload [off1+off2] {sym} ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XMOVDload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (MOVDload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0)) - // result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} base mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0)) + // result: (MOVDload [off1+off2] {mergeSymTyped(sym1,sym2)} base mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } t := v_0.Type - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))) { break } v.reset(OpS390XMOVDload) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(base, mem) return true } - // match: (MOVDload [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVDloadidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XMOVDloadidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg3(ptr, idx, mem) - return true - } - // match: (MOVDload [off] {sym} (ADD ptr idx) mem) - // cond: ptr.Op != OpSB - // result: (MOVDloadidx [off] {sym} ptr idx mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - mem := v_1 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XMOVDloadidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg3(ptr, idx, mem) - return true - } - break - } - return false -} -func rewriteValueS390X_OpS390XMOVDloadidx(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVDloadidx [c] {sym} (ADDconst [d] ptr) idx mem) - // cond: is20Bit(c+d) - // result: (MOVDloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - if v_0.Op != OpS390XADDconst { - continue - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVDloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } - // match: (MOVDloadidx [c] {sym} ptr (ADDconst [d] idx) mem) - // cond: is20Bit(c+d) - // result: (MOVDloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - ptr := v_0 - if v_1.Op != OpS390XADDconst { - continue - } - d := v_1.AuxInt - idx := v_1.Args[0] - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVDloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } return false } func rewriteValueS390X_OpS390XMOVDstore(v *Value) bool { @@ -10406,134 +9154,82 @@ func rewriteValueS390X_OpS390XMOVDstore(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (MOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (MOVDstore [off1+off2] {sym} ptr val mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] val := v_1 mem := v_2 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XMOVDstore) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(ptr, val, mem) return true } // match: (MOVDstore [off] {sym} ptr (MOVDconst [c]) mem) - // cond: is16Bit(c) && isU12Bit(off) && ptr.Op != OpSB - // result: (MOVDstoreconst [makeValAndOff(c,off)] {sym} ptr mem) + // cond: is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB + // result: (MOVDstoreconst [makeValAndOff32(int32(c),off)] {sym} ptr mem) for { - off := v.AuxInt - sym := v.Aux + off := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) ptr := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) mem := v_2 - if !(is16Bit(c) && isU12Bit(off) && ptr.Op != OpSB) { + if !(is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB) { break } v.reset(OpS390XMOVDstoreconst) - v.AuxInt = makeValAndOff(c, off) - v.Aux = sym + v.AuxInt = valAndOffToAuxInt(makeValAndOff32(int32(c), off)) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (MOVDstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0)) - // result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0)) + // result: (MOVDstore [off1+off2] {mergeSymTyped(sym1,sym2)} base val mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } t := v_0.Type - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] val := v_1 mem := v_2 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%8 == 0 && (off1+off2)%8 == 0))) { break } v.reset(OpS390XMOVDstore) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg3(base, val, mem) return true } - // match: (MOVDstore [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) val mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVDstoreidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - val := v_1 - mem := v_2 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XMOVDstoreidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg4(ptr, idx, val, mem) - return true - } - // match: (MOVDstore [off] {sym} (ADD ptr idx) val mem) - // cond: ptr.Op != OpSB - // result: (MOVDstoreidx [off] {sym} ptr idx val mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - val := v_1 - mem := v_2 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XMOVDstoreidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } // match: (MOVDstore [i] {s} p w1 x:(MOVDstore [i-8] {s} p w0 mem)) - // cond: p.Op != OpSB && x.Uses == 1 && is20Bit(i-8) && clobber(x) + // cond: p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-8) && clobber(x) // result: (STMG2 [i-8] {s} p w0 w1 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w1 := v_1 x := v_2 - if x.Op != OpS390XMOVDstore || x.AuxInt != i-8 || x.Aux != s { + if x.Op != OpS390XMOVDstore || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -10541,25 +9237,25 @@ func rewriteValueS390X_OpS390XMOVDstore(v *Value) bool { break } w0 := x.Args[1] - if !(p.Op != OpSB && x.Uses == 1 && is20Bit(i-8) && clobber(x)) { + if !(p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-8) && clobber(x)) { break } v.reset(OpS390XSTMG2) - v.AuxInt = i - 8 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 8) + v.Aux = symToAux(s) v.AddArg4(p, w0, w1, mem) return true } // match: (MOVDstore [i] {s} p w2 x:(STMG2 [i-16] {s} p w0 w1 mem)) - // cond: x.Uses == 1 && is20Bit(i-16) && clobber(x) + // cond: x.Uses == 1 && is20Bit(int64(i)-16) && clobber(x) // result: (STMG3 [i-16] {s} p w0 w1 w2 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w2 := v_1 x := v_2 - if x.Op != OpS390XSTMG2 || x.AuxInt != i-16 || x.Aux != s { + if x.Op != OpS390XSTMG2 || auxIntToInt32(x.AuxInt) != i-16 || auxToSym(x.Aux) != s { break } mem := x.Args[3] @@ -10568,25 +9264,25 @@ func rewriteValueS390X_OpS390XMOVDstore(v *Value) bool { } w0 := x.Args[1] w1 := x.Args[2] - if !(x.Uses == 1 && is20Bit(i-16) && clobber(x)) { + if !(x.Uses == 1 && is20Bit(int64(i)-16) && clobber(x)) { break } v.reset(OpS390XSTMG3) - v.AuxInt = i - 16 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 16) + v.Aux = symToAux(s) v.AddArg5(p, w0, w1, w2, mem) return true } // match: (MOVDstore [i] {s} p w3 x:(STMG3 [i-24] {s} p w0 w1 w2 mem)) - // cond: x.Uses == 1 && is20Bit(i-24) && clobber(x) + // cond: x.Uses == 1 && is20Bit(int64(i)-24) && clobber(x) // result: (STMG4 [i-24] {s} p w0 w1 w2 w3 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w3 := v_1 x := v_2 - if x.Op != OpS390XSTMG3 || x.AuxInt != i-24 || x.Aux != s { + if x.Op != OpS390XSTMG3 || auxIntToInt32(x.AuxInt) != i-24 || auxToSym(x.Aux) != s { break } mem := x.Args[4] @@ -10596,12 +9292,12 @@ func rewriteValueS390X_OpS390XMOVDstore(v *Value) bool { w0 := x.Args[1] w1 := x.Args[2] w2 := x.Args[3] - if !(x.Uses == 1 && is20Bit(i-24) && clobber(x)) { + if !(x.Uses == 1 && is20Bit(int64(i)-24) && clobber(x)) { break } v.reset(OpS390XSTMG4) - v.AuxInt = i - 24 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 24) + v.Aux = symToAux(s) v.AddArg6(p, w0, w1, w2, w3, mem) return true } @@ -10611,109 +9307,50 @@ func rewriteValueS390X_OpS390XMOVDstoreconst(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (MOVDstoreconst [sc] {s} (ADDconst [off] ptr) mem) - // cond: isU12Bit(ValAndOff(sc).Off()+off) - // result: (MOVDstoreconst [ValAndOff(sc).add(off)] {s} ptr mem) + // cond: isU12Bit(sc.Off()+int64(off)) + // result: (MOVDstoreconst [sc.addOffset32(off)] {s} ptr mem) for { - sc := v.AuxInt - s := v.Aux + sc := auxIntToValAndOff(v.AuxInt) + s := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off := v_0.AuxInt + off := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(isU12Bit(ValAndOff(sc).Off() + off)) { + if !(isU12Bit(sc.Off() + int64(off))) { break } v.reset(OpS390XMOVDstoreconst) - v.AuxInt = ValAndOff(sc).add(off) - v.Aux = s + v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) + v.Aux = symToAux(s) v.AddArg2(ptr, mem) return true } // match: (MOVDstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem) - // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) - // result: (MOVDstoreconst [ValAndOff(sc).add(off)] {mergeSym(sym1, sym2)} ptr mem) + // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off) + // result: (MOVDstoreconst [sc.addOffset32(off)] {mergeSymTyped(sym1, sym2)} ptr mem) for { - sc := v.AuxInt - sym1 := v.Aux + sc := auxIntToValAndOff(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } - off := v_0.AuxInt - sym2 := v_0.Aux + off := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) ptr := v_0.Args[0] mem := v_1 - if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off)) { + if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) { break } v.reset(OpS390XMOVDstoreconst) - v.AuxInt = ValAndOff(sc).add(off) - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(ptr, mem) return true } return false } -func rewriteValueS390X_OpS390XMOVDstoreidx(v *Value) bool { - v_3 := v.Args[3] - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVDstoreidx [c] {sym} (ADDconst [d] ptr) idx val mem) - // cond: is20Bit(c+d) - // result: (MOVDstoreidx [c+d] {sym} ptr idx val mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - if v_0.Op != OpS390XADDconst { - continue - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - val := v_2 - mem := v_3 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVDstoreidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } - // match: (MOVDstoreidx [c] {sym} ptr (ADDconst [d] idx) val mem) - // cond: is20Bit(c+d) - // result: (MOVDstoreidx [c+d] {sym} ptr idx val mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - ptr := v_0 - if v_1.Op != OpS390XADDconst { - continue - } - d := v_1.AuxInt - idx := v_1.Args[0] - val := v_2 - mem := v_3 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVDstoreidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } - return false -} func rewriteValueS390X_OpS390XMOVHBRstore(v *Value) bool { v_2 := v.Args[2] v_1 := v.Args[1] @@ -10722,15 +9359,15 @@ func rewriteValueS390X_OpS390XMOVHBRstore(v *Value) bool { // cond: x.Uses == 1 && clobber(x) // result: (MOVWBRstore [i-2] {s} p w mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 - if v_1.Op != OpS390XSRDconst || v_1.AuxInt != 16 { + if v_1.Op != OpS390XSRDconst || auxIntToInt8(v_1.AuxInt) != 16 { break } w := v_1.Args[0] x := v_2 - if x.Op != OpS390XMOVHBRstore || x.AuxInt != i-2 || x.Aux != s { + if x.Op != OpS390XMOVHBRstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -10738,8 +9375,8 @@ func rewriteValueS390X_OpS390XMOVHBRstore(v *Value) bool { break } v.reset(OpS390XMOVWBRstore) - v.AuxInt = i - 2 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 2) + v.Aux = symToAux(s) v.AddArg3(p, w, mem) return true } @@ -10747,16 +9384,16 @@ func rewriteValueS390X_OpS390XMOVHBRstore(v *Value) bool { // cond: x.Uses == 1 && clobber(x) // result: (MOVWBRstore [i-2] {s} p w0 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 if v_1.Op != OpS390XSRDconst { break } - j := v_1.AuxInt + j := auxIntToInt8(v_1.AuxInt) w := v_1.Args[0] x := v_2 - if x.Op != OpS390XMOVHBRstore || x.AuxInt != i-2 || x.Aux != s { + if x.Op != OpS390XMOVHBRstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -10764,12 +9401,12 @@ func rewriteValueS390X_OpS390XMOVHBRstore(v *Value) bool { break } w0 := x.Args[1] - if w0.Op != OpS390XSRDconst || w0.AuxInt != j-16 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { + if w0.Op != OpS390XSRDconst || auxIntToInt8(w0.AuxInt) != j-16 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVWBRstore) - v.AuxInt = i - 2 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 2) + v.Aux = symToAux(s) v.AddArg3(p, w0, mem) return true } @@ -10777,15 +9414,15 @@ func rewriteValueS390X_OpS390XMOVHBRstore(v *Value) bool { // cond: x.Uses == 1 && clobber(x) // result: (MOVWBRstore [i-2] {s} p w mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 - if v_1.Op != OpS390XSRWconst || v_1.AuxInt != 16 { + if v_1.Op != OpS390XSRWconst || auxIntToInt8(v_1.AuxInt) != 16 { break } w := v_1.Args[0] x := v_2 - if x.Op != OpS390XMOVHBRstore || x.AuxInt != i-2 || x.Aux != s { + if x.Op != OpS390XMOVHBRstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -10793,8 +9430,8 @@ func rewriteValueS390X_OpS390XMOVHBRstore(v *Value) bool { break } v.reset(OpS390XMOVWBRstore) - v.AuxInt = i - 2 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 2) + v.Aux = symToAux(s) v.AddArg3(p, w, mem) return true } @@ -10802,16 +9439,16 @@ func rewriteValueS390X_OpS390XMOVHBRstore(v *Value) bool { // cond: x.Uses == 1 && clobber(x) // result: (MOVWBRstore [i-2] {s} p w0 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 if v_1.Op != OpS390XSRWconst { break } - j := v_1.AuxInt + j := auxIntToInt8(v_1.AuxInt) w := v_1.Args[0] x := v_2 - if x.Op != OpS390XMOVHBRstore || x.AuxInt != i-2 || x.Aux != s { + if x.Op != OpS390XMOVHBRstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -10819,166 +9456,17 @@ func rewriteValueS390X_OpS390XMOVHBRstore(v *Value) bool { break } w0 := x.Args[1] - if w0.Op != OpS390XSRWconst || w0.AuxInt != j-16 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { + if w0.Op != OpS390XSRWconst || auxIntToInt8(w0.AuxInt) != j-16 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVWBRstore) - v.AuxInt = i - 2 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 2) + v.Aux = symToAux(s) v.AddArg3(p, w0, mem) return true } return false } -func rewriteValueS390X_OpS390XMOVHBRstoreidx(v *Value) bool { - v_3 := v.Args[3] - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVHBRstoreidx [i] {s} p idx (SRDconst [16] w) x:(MOVHBRstoreidx [i-2] {s} p idx w mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVWBRstoreidx [i-2] {s} p idx w mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - if v_2.Op != OpS390XSRDconst || v_2.AuxInt != 16 { - continue - } - w := v_2.Args[0] - x := v_3 - if x.Op != OpS390XMOVHBRstoreidx || x.AuxInt != i-2 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 || w != x.Args[2] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVWBRstoreidx) - v.AuxInt = i - 2 - v.Aux = s - v.AddArg4(p, idx, w, mem) - return true - } - } - break - } - // match: (MOVHBRstoreidx [i] {s} p idx (SRDconst [j] w) x:(MOVHBRstoreidx [i-2] {s} p idx w0:(SRDconst [j-16] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVWBRstoreidx [i-2] {s} p idx w0 mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - if v_2.Op != OpS390XSRDconst { - continue - } - j := v_2.AuxInt - w := v_2.Args[0] - x := v_3 - if x.Op != OpS390XMOVHBRstoreidx || x.AuxInt != i-2 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - w0 := x.Args[2] - if w0.Op != OpS390XSRDconst || w0.AuxInt != j-16 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVWBRstoreidx) - v.AuxInt = i - 2 - v.Aux = s - v.AddArg4(p, idx, w0, mem) - return true - } - } - break - } - // match: (MOVHBRstoreidx [i] {s} p idx (SRWconst [16] w) x:(MOVHBRstoreidx [i-2] {s} p idx w mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVWBRstoreidx [i-2] {s} p idx w mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - if v_2.Op != OpS390XSRWconst || v_2.AuxInt != 16 { - continue - } - w := v_2.Args[0] - x := v_3 - if x.Op != OpS390XMOVHBRstoreidx || x.AuxInt != i-2 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 || w != x.Args[2] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVWBRstoreidx) - v.AuxInt = i - 2 - v.Aux = s - v.AddArg4(p, idx, w, mem) - return true - } - } - break - } - // match: (MOVHBRstoreidx [i] {s} p idx (SRWconst [j] w) x:(MOVHBRstoreidx [i-2] {s} p idx w0:(SRWconst [j-16] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVWBRstoreidx [i-2] {s} p idx w0 mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - if v_2.Op != OpS390XSRWconst { - continue - } - j := v_2.AuxInt - w := v_2.Args[0] - x := v_3 - if x.Op != OpS390XMOVHBRstoreidx || x.AuxInt != i-2 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - w0 := x.Args[2] - if w0.Op != OpS390XSRWconst || w0.AuxInt != j-16 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVWBRstoreidx) - v.AuxInt = i - 2 - v.Aux = s - v.AddArg4(p, idx, w0, mem) - return true - } - } - break - } - return false -} func rewriteValueS390X_OpS390XMOVHZload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] @@ -11002,155 +9490,49 @@ func rewriteValueS390X_OpS390XMOVHZload(v *Value) bool { return true } // match: (MOVHZload [off1] {sym} (ADDconst [off2] ptr) mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (MOVHZload [off1+off2] {sym} ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XMOVHZload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (MOVHZload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0)) - // result: (MOVHZload [off1+off2] {mergeSym(sym1,sym2)} base mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0)) + // result: (MOVHZload [off1+off2] {mergeSymTyped(sym1,sym2)} base mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } t := v_0.Type - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) { break } v.reset(OpS390XMOVHZload) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(base, mem) return true } - // match: (MOVHZload [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVHZloadidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XMOVHZloadidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg3(ptr, idx, mem) - return true - } - // match: (MOVHZload [off] {sym} (ADD ptr idx) mem) - // cond: ptr.Op != OpSB - // result: (MOVHZloadidx [off] {sym} ptr idx mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - mem := v_1 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XMOVHZloadidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg3(ptr, idx, mem) - return true - } - break - } - return false -} -func rewriteValueS390X_OpS390XMOVHZloadidx(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVHZloadidx [c] {sym} (ADDconst [d] ptr) idx mem) - // cond: is20Bit(c+d) - // result: (MOVHZloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - if v_0.Op != OpS390XADDconst { - continue - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVHZloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } - // match: (MOVHZloadidx [c] {sym} ptr (ADDconst [d] idx) mem) - // cond: is20Bit(c+d) - // result: (MOVHZloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - ptr := v_0 - if v_1.Op != OpS390XADDconst { - continue - } - d := v_1.AuxInt - idx := v_1.Args[0] - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVHZloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } return false } func rewriteValueS390X_OpS390XMOVHZreg(v *Value) bool { @@ -11248,17 +9630,6 @@ func rewriteValueS390X_OpS390XMOVHZreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVHZreg x:(MOVBZloadidx _ _ _)) - // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVBZloadidx || !(!x.Type.IsSigned() || x.Type.Size() > 1) { - break - } - v.copyOf(x) - return true - } // match: (MOVHZreg x:(MOVHZload _ _)) // cond: (!x.Type.IsSigned() || x.Type.Size() > 2) // result: x @@ -11270,17 +9641,6 @@ func rewriteValueS390X_OpS390XMOVHZreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVHZreg x:(MOVHZloadidx _ _ _)) - // cond: (!x.Type.IsSigned() || x.Type.Size() > 2) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVHZloadidx || !(!x.Type.IsSigned() || x.Type.Size() > 2) { - break - } - v.copyOf(x) - return true - } // match: (MOVHZreg <t> x:(MOVHload [o] {s} p mem)) // cond: x.Uses == 1 && clobber(x) // result: @x.Block (MOVHZload <t> [o] {s} p mem) @@ -11305,31 +9665,6 @@ func rewriteValueS390X_OpS390XMOVHZreg(v *Value) bool { v0.AddArg2(p, mem) return true } - // match: (MOVHZreg <t> x:(MOVHloadidx [o] {s} p i mem)) - // cond: x.Uses == 1 && clobber(x) - // result: @x.Block (MOVHZloadidx <t> [o] {s} p i mem) - for { - t := v.Type - x := v_0 - if x.Op != OpS390XMOVHloadidx { - break - } - o := auxIntToInt32(x.AuxInt) - s := auxToSym(x.Aux) - mem := x.Args[2] - p := x.Args[0] - i := x.Args[1] - if !(x.Uses == 1 && clobber(x)) { - break - } - b = x.Block - v0 := b.NewValue0(v.Pos, OpS390XMOVHZloadidx, t) - v.copyOf(v0) - v0.AuxInt = int32ToAuxInt(o) - v0.Aux = symToAux(s) - v0.AddArg3(p, i, mem) - return true - } // match: (MOVHZreg x:(Arg <t>)) // cond: !t.IsSigned() && t.Size() <= 2 // result: x @@ -11357,16 +9692,16 @@ func rewriteValueS390X_OpS390XMOVHZreg(v *Value) bool { return true } // match: (MOVHZreg (ANDWconst [m] x)) - // result: (MOVWZreg (ANDWconst <typ.UInt32> [int64(uint16(m))] x)) + // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(uint16(m))] x)) for { if v_0.Op != OpS390XANDWconst { break } - m := v_0.AuxInt + m := auxIntToInt32(v_0.AuxInt) x := v_0.Args[0] v.reset(OpS390XMOVWZreg) v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) - v0.AuxInt = int64(uint16(m)) + v0.AuxInt = int32ToAuxInt(int32(uint16(m))) v0.AddArg(x) v.AddArg(v0) return true @@ -11396,155 +9731,49 @@ func rewriteValueS390X_OpS390XMOVHload(v *Value) bool { return true } // match: (MOVHload [off1] {sym} (ADDconst [off2] ptr) mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (MOVHload [off1+off2] {sym} ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XMOVHload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (MOVHload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0)) - // result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} base mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0)) + // result: (MOVHload [off1+off2] {mergeSymTyped(sym1,sym2)} base mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } t := v_0.Type - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) { break } v.reset(OpS390XMOVHload) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(base, mem) return true } - // match: (MOVHload [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVHloadidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XMOVHloadidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg3(ptr, idx, mem) - return true - } - // match: (MOVHload [off] {sym} (ADD ptr idx) mem) - // cond: ptr.Op != OpSB - // result: (MOVHloadidx [off] {sym} ptr idx mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - mem := v_1 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XMOVHloadidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg3(ptr, idx, mem) - return true - } - break - } - return false -} -func rewriteValueS390X_OpS390XMOVHloadidx(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVHloadidx [c] {sym} (ADDconst [d] ptr) idx mem) - // cond: is20Bit(c+d) - // result: (MOVHloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - if v_0.Op != OpS390XADDconst { - continue - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVHloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } - // match: (MOVHloadidx [c] {sym} ptr (ADDconst [d] idx) mem) - // cond: is20Bit(c+d) - // result: (MOVHloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - ptr := v_0 - if v_1.Op != OpS390XADDconst { - continue - } - d := v_1.AuxInt - idx := v_1.Args[0] - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVHloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } return false } func rewriteValueS390X_OpS390XMOVHreg(v *Value) bool { @@ -11642,17 +9871,6 @@ func rewriteValueS390X_OpS390XMOVHreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVHreg x:(MOVBloadidx _ _ _)) - // cond: (x.Type.IsSigned() || x.Type.Size() == 8) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVBloadidx || !(x.Type.IsSigned() || x.Type.Size() == 8) { - break - } - v.copyOf(x) - return true - } // match: (MOVHreg x:(MOVHload _ _)) // cond: (x.Type.IsSigned() || x.Type.Size() == 8) // result: x @@ -11664,17 +9882,6 @@ func rewriteValueS390X_OpS390XMOVHreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVHreg x:(MOVHloadidx _ _ _)) - // cond: (x.Type.IsSigned() || x.Type.Size() == 8) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVHloadidx || !(x.Type.IsSigned() || x.Type.Size() == 8) { - break - } - v.copyOf(x) - return true - } // match: (MOVHreg x:(MOVBZload _ _)) // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) // result: x @@ -11686,17 +9893,6 @@ func rewriteValueS390X_OpS390XMOVHreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVHreg x:(MOVBZloadidx _ _ _)) - // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVBZloadidx || !(!x.Type.IsSigned() || x.Type.Size() > 1) { - break - } - v.copyOf(x) - return true - } // match: (MOVHreg <t> x:(MOVHZload [o] {s} p mem)) // cond: x.Uses == 1 && clobber(x) // result: @x.Block (MOVHload <t> [o] {s} p mem) @@ -11721,31 +9917,6 @@ func rewriteValueS390X_OpS390XMOVHreg(v *Value) bool { v0.AddArg2(p, mem) return true } - // match: (MOVHreg <t> x:(MOVHZloadidx [o] {s} p i mem)) - // cond: x.Uses == 1 && clobber(x) - // result: @x.Block (MOVHloadidx <t> [o] {s} p i mem) - for { - t := v.Type - x := v_0 - if x.Op != OpS390XMOVHZloadidx { - break - } - o := auxIntToInt32(x.AuxInt) - s := auxToSym(x.Aux) - mem := x.Args[2] - p := x.Args[0] - i := x.Args[1] - if !(x.Uses == 1 && clobber(x)) { - break - } - b = x.Block - v0 := b.NewValue0(v.Pos, OpS390XMOVHloadidx, t) - v.copyOf(v0) - v0.AuxInt = int32ToAuxInt(o) - v0.Aux = symToAux(s) - v0.AddArg3(p, i, mem) - return true - } // match: (MOVHreg x:(Arg <t>)) // cond: t.IsSigned() && t.Size() <= 2 // result: x @@ -11774,19 +9945,19 @@ func rewriteValueS390X_OpS390XMOVHreg(v *Value) bool { } // match: (MOVHreg (ANDWconst [m] x)) // cond: int16(m) >= 0 - // result: (MOVWZreg (ANDWconst <typ.UInt32> [int64(uint16(m))] x)) + // result: (MOVWZreg (ANDWconst <typ.UInt32> [int32(uint16(m))] x)) for { if v_0.Op != OpS390XANDWconst { break } - m := v_0.AuxInt + m := auxIntToInt32(v_0.AuxInt) x := v_0.Args[0] if !(int16(m) >= 0) { break } v.reset(OpS390XMOVWZreg) v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) - v0.AuxInt = int64(uint16(m)) + v0.AuxInt = int32ToAuxInt(int32(uint16(m))) v0.AddArg(x) v.AddArg(v0) return true @@ -11832,134 +10003,82 @@ func rewriteValueS390X_OpS390XMOVHstore(v *Value) bool { return true } // match: (MOVHstore [off1] {sym} (ADDconst [off2] ptr) val mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (MOVHstore [off1+off2] {sym} ptr val mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] val := v_1 mem := v_2 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XMOVHstore) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(ptr, val, mem) return true } // match: (MOVHstore [off] {sym} ptr (MOVDconst [c]) mem) - // cond: isU12Bit(off) && ptr.Op != OpSB - // result: (MOVHstoreconst [makeValAndOff(int64(int16(c)),off)] {sym} ptr mem) + // cond: isU12Bit(int64(off)) && ptr.Op != OpSB + // result: (MOVHstoreconst [makeValAndOff32(int32(int16(c)),off)] {sym} ptr mem) for { - off := v.AuxInt - sym := v.Aux + off := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) ptr := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) mem := v_2 - if !(isU12Bit(off) && ptr.Op != OpSB) { + if !(isU12Bit(int64(off)) && ptr.Op != OpSB) { break } v.reset(OpS390XMOVHstoreconst) - v.AuxInt = makeValAndOff(int64(int16(c)), off) - v.Aux = sym + v.AuxInt = valAndOffToAuxInt(makeValAndOff32(int32(int16(c)), off)) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (MOVHstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0)) - // result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0)) + // result: (MOVHstore [off1+off2] {mergeSymTyped(sym1,sym2)} base val mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } t := v_0.Type - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] val := v_1 mem := v_2 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%2 == 0 && (off1+off2)%2 == 0))) { break } v.reset(OpS390XMOVHstore) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg3(base, val, mem) return true } - // match: (MOVHstore [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) val mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVHstoreidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - val := v_1 - mem := v_2 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XMOVHstoreidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg4(ptr, idx, val, mem) - return true - } - // match: (MOVHstore [off] {sym} (ADD ptr idx) val mem) - // cond: ptr.Op != OpSB - // result: (MOVHstoreidx [off] {sym} ptr idx val mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - val := v_1 - mem := v_2 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XMOVHstoreidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } // match: (MOVHstore [i] {s} p w x:(MOVHstore [i-2] {s} p (SRDconst [16] w) mem)) // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVWstore [i-2] {s} p w mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w := v_1 x := v_2 - if x.Op != OpS390XMOVHstore || x.AuxInt != i-2 || x.Aux != s { + if x.Op != OpS390XMOVHstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -11967,12 +10086,12 @@ func rewriteValueS390X_OpS390XMOVHstore(v *Value) bool { break } x_1 := x.Args[1] - if x_1.Op != OpS390XSRDconst || x_1.AuxInt != 16 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { + if x_1.Op != OpS390XSRDconst || auxIntToInt8(x_1.AuxInt) != 16 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVWstore) - v.AuxInt = i - 2 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 2) + v.Aux = symToAux(s) v.AddArg3(p, w, mem) return true } @@ -11980,17 +10099,17 @@ func rewriteValueS390X_OpS390XMOVHstore(v *Value) bool { // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVWstore [i-2] {s} p w0 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w0 := v_1 if w0.Op != OpS390XSRDconst { break } - j := w0.AuxInt + j := auxIntToInt8(w0.AuxInt) w := w0.Args[0] x := v_2 - if x.Op != OpS390XMOVHstore || x.AuxInt != i-2 || x.Aux != s { + if x.Op != OpS390XMOVHstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -11998,12 +10117,12 @@ func rewriteValueS390X_OpS390XMOVHstore(v *Value) bool { break } x_1 := x.Args[1] - if x_1.Op != OpS390XSRDconst || x_1.AuxInt != j+16 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { + if x_1.Op != OpS390XSRDconst || auxIntToInt8(x_1.AuxInt) != j+16 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVWstore) - v.AuxInt = i - 2 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 2) + v.Aux = symToAux(s) v.AddArg3(p, w0, mem) return true } @@ -12011,12 +10130,12 @@ func rewriteValueS390X_OpS390XMOVHstore(v *Value) bool { // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVWstore [i-2] {s} p w mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w := v_1 x := v_2 - if x.Op != OpS390XMOVHstore || x.AuxInt != i-2 || x.Aux != s { + if x.Op != OpS390XMOVHstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -12024,12 +10143,12 @@ func rewriteValueS390X_OpS390XMOVHstore(v *Value) bool { break } x_1 := x.Args[1] - if x_1.Op != OpS390XSRWconst || x_1.AuxInt != 16 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { + if x_1.Op != OpS390XSRWconst || auxIntToInt8(x_1.AuxInt) != 16 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVWstore) - v.AuxInt = i - 2 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 2) + v.Aux = symToAux(s) v.AddArg3(p, w, mem) return true } @@ -12037,17 +10156,17 @@ func rewriteValueS390X_OpS390XMOVHstore(v *Value) bool { // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVWstore [i-2] {s} p w0 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w0 := v_1 if w0.Op != OpS390XSRWconst { break } - j := w0.AuxInt + j := auxIntToInt8(w0.AuxInt) w := w0.Args[0] x := v_2 - if x.Op != OpS390XMOVHstore || x.AuxInt != i-2 || x.Aux != s { + if x.Op != OpS390XMOVHstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -12055,12 +10174,12 @@ func rewriteValueS390X_OpS390XMOVHstore(v *Value) bool { break } x_1 := x.Args[1] - if x_1.Op != OpS390XSRWconst || x_1.AuxInt != j+16 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { + if x_1.Op != OpS390XSRWconst || auxIntToInt8(x_1.AuxInt) != j+16 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVWstore) - v.AuxInt = i - 2 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 2) + v.Aux = symToAux(s) v.AddArg3(p, w0, mem) return true } @@ -12072,282 +10191,77 @@ func rewriteValueS390X_OpS390XMOVHstoreconst(v *Value) bool { b := v.Block typ := &b.Func.Config.Types // match: (MOVHstoreconst [sc] {s} (ADDconst [off] ptr) mem) - // cond: isU12Bit(ValAndOff(sc).Off()+off) - // result: (MOVHstoreconst [ValAndOff(sc).add(off)] {s} ptr mem) + // cond: isU12Bit(sc.Off()+int64(off)) + // result: (MOVHstoreconst [sc.addOffset32(off)] {s} ptr mem) for { - sc := v.AuxInt - s := v.Aux + sc := auxIntToValAndOff(v.AuxInt) + s := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off := v_0.AuxInt + off := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(isU12Bit(ValAndOff(sc).Off() + off)) { + if !(isU12Bit(sc.Off() + int64(off))) { break } v.reset(OpS390XMOVHstoreconst) - v.AuxInt = ValAndOff(sc).add(off) - v.Aux = s + v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) + v.Aux = symToAux(s) v.AddArg2(ptr, mem) return true } // match: (MOVHstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem) - // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) - // result: (MOVHstoreconst [ValAndOff(sc).add(off)] {mergeSym(sym1, sym2)} ptr mem) + // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off) + // result: (MOVHstoreconst [sc.addOffset32(off)] {mergeSymTyped(sym1, sym2)} ptr mem) for { - sc := v.AuxInt - sym1 := v.Aux + sc := auxIntToValAndOff(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } - off := v_0.AuxInt - sym2 := v_0.Aux + off := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) ptr := v_0.Args[0] mem := v_1 - if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off)) { + if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) { break } v.reset(OpS390XMOVHstoreconst) - v.AuxInt = ValAndOff(sc).add(off) - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(ptr, mem) return true } // match: (MOVHstoreconst [c] {s} p x:(MOVHstoreconst [a] {s} p mem)) - // cond: p.Op != OpSB && x.Uses == 1 && ValAndOff(a).Off() + 2 == ValAndOff(c).Off() && clobber(x) - // result: (MOVWstore [ValAndOff(a).Off()] {s} p (MOVDconst [int64(int32(ValAndOff(c).Val()&0xffff | ValAndOff(a).Val()<<16))]) mem) + // cond: p.Op != OpSB && x.Uses == 1 && a.Off() + 2 == c.Off() && clobber(x) + // result: (MOVWstore [a.Off32()] {s} p (MOVDconst [int64(c.Val32()&0xffff | a.Val32()<<16)]) mem) for { - c := v.AuxInt - s := v.Aux + c := auxIntToValAndOff(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 x := v_1 if x.Op != OpS390XMOVHstoreconst { break } - a := x.AuxInt - if x.Aux != s { + a := auxIntToValAndOff(x.AuxInt) + if auxToSym(x.Aux) != s { break } mem := x.Args[1] - if p != x.Args[0] || !(p.Op != OpSB && x.Uses == 1 && ValAndOff(a).Off()+2 == ValAndOff(c).Off() && clobber(x)) { + if p != x.Args[0] || !(p.Op != OpSB && x.Uses == 1 && a.Off()+2 == c.Off() && clobber(x)) { break } v.reset(OpS390XMOVWstore) - v.AuxInt = ValAndOff(a).Off() - v.Aux = s + v.AuxInt = int32ToAuxInt(a.Off32()) + v.Aux = symToAux(s) v0 := b.NewValue0(x.Pos, OpS390XMOVDconst, typ.UInt64) - v0.AuxInt = int64(int32(ValAndOff(c).Val()&0xffff | ValAndOff(a).Val()<<16)) + v0.AuxInt = int64ToAuxInt(int64(c.Val32()&0xffff | a.Val32()<<16)) v.AddArg3(p, v0, mem) return true } return false } -func rewriteValueS390X_OpS390XMOVHstoreidx(v *Value) bool { - v_3 := v.Args[3] - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVHstoreidx [c] {sym} (ADDconst [d] ptr) idx val mem) - // cond: is20Bit(c+d) - // result: (MOVHstoreidx [c+d] {sym} ptr idx val mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - if v_0.Op != OpS390XADDconst { - continue - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - val := v_2 - mem := v_3 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVHstoreidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } - // match: (MOVHstoreidx [c] {sym} ptr (ADDconst [d] idx) val mem) - // cond: is20Bit(c+d) - // result: (MOVHstoreidx [c+d] {sym} ptr idx val mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - ptr := v_0 - if v_1.Op != OpS390XADDconst { - continue - } - d := v_1.AuxInt - idx := v_1.Args[0] - val := v_2 - mem := v_3 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVHstoreidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } - // match: (MOVHstoreidx [i] {s} p idx w x:(MOVHstoreidx [i-2] {s} p idx (SRDconst [16] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVWstoreidx [i-2] {s} p idx w mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - w := v_2 - x := v_3 - if x.Op != OpS390XMOVHstoreidx || x.AuxInt != i-2 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - x_2 := x.Args[2] - if x_2.Op != OpS390XSRDconst || x_2.AuxInt != 16 || w != x_2.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVWstoreidx) - v.AuxInt = i - 2 - v.Aux = s - v.AddArg4(p, idx, w, mem) - return true - } - } - break - } - // match: (MOVHstoreidx [i] {s} p idx w0:(SRDconst [j] w) x:(MOVHstoreidx [i-2] {s} p idx (SRDconst [j+16] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVWstoreidx [i-2] {s} p idx w0 mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - w0 := v_2 - if w0.Op != OpS390XSRDconst { - continue - } - j := w0.AuxInt - w := w0.Args[0] - x := v_3 - if x.Op != OpS390XMOVHstoreidx || x.AuxInt != i-2 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - x_2 := x.Args[2] - if x_2.Op != OpS390XSRDconst || x_2.AuxInt != j+16 || w != x_2.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVWstoreidx) - v.AuxInt = i - 2 - v.Aux = s - v.AddArg4(p, idx, w0, mem) - return true - } - } - break - } - // match: (MOVHstoreidx [i] {s} p idx w x:(MOVHstoreidx [i-2] {s} p idx (SRWconst [16] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVWstoreidx [i-2] {s} p idx w mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - w := v_2 - x := v_3 - if x.Op != OpS390XMOVHstoreidx || x.AuxInt != i-2 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - x_2 := x.Args[2] - if x_2.Op != OpS390XSRWconst || x_2.AuxInt != 16 || w != x_2.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVWstoreidx) - v.AuxInt = i - 2 - v.Aux = s - v.AddArg4(p, idx, w, mem) - return true - } - } - break - } - // match: (MOVHstoreidx [i] {s} p idx w0:(SRWconst [j] w) x:(MOVHstoreidx [i-2] {s} p idx (SRWconst [j+16] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVWstoreidx [i-2] {s} p idx w0 mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - w0 := v_2 - if w0.Op != OpS390XSRWconst { - continue - } - j := w0.AuxInt - w := w0.Args[0] - x := v_3 - if x.Op != OpS390XMOVHstoreidx || x.AuxInt != i-2 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - x_2 := x.Args[2] - if x_2.Op != OpS390XSRWconst || x_2.AuxInt != j+16 || w != x_2.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVWstoreidx) - v.AuxInt = i - 2 - v.Aux = s - v.AddArg4(p, idx, w0, mem) - return true - } - } - break - } - return false -} func rewriteValueS390X_OpS390XMOVWBRstore(v *Value) bool { v_2 := v.Args[2] v_1 := v.Args[1] @@ -12356,15 +10270,15 @@ func rewriteValueS390X_OpS390XMOVWBRstore(v *Value) bool { // cond: x.Uses == 1 && clobber(x) // result: (MOVDBRstore [i-4] {s} p w mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 - if v_1.Op != OpS390XSRDconst || v_1.AuxInt != 32 { + if v_1.Op != OpS390XSRDconst || auxIntToInt8(v_1.AuxInt) != 32 { break } w := v_1.Args[0] x := v_2 - if x.Op != OpS390XMOVWBRstore || x.AuxInt != i-4 || x.Aux != s { + if x.Op != OpS390XMOVWBRstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -12372,8 +10286,8 @@ func rewriteValueS390X_OpS390XMOVWBRstore(v *Value) bool { break } v.reset(OpS390XMOVDBRstore) - v.AuxInt = i - 4 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 4) + v.Aux = symToAux(s) v.AddArg3(p, w, mem) return true } @@ -12381,16 +10295,16 @@ func rewriteValueS390X_OpS390XMOVWBRstore(v *Value) bool { // cond: x.Uses == 1 && clobber(x) // result: (MOVDBRstore [i-4] {s} p w0 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 if v_1.Op != OpS390XSRDconst { break } - j := v_1.AuxInt + j := auxIntToInt8(v_1.AuxInt) w := v_1.Args[0] x := v_2 - if x.Op != OpS390XMOVWBRstore || x.AuxInt != i-4 || x.Aux != s { + if x.Op != OpS390XMOVWBRstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -12398,95 +10312,17 @@ func rewriteValueS390X_OpS390XMOVWBRstore(v *Value) bool { break } w0 := x.Args[1] - if w0.Op != OpS390XSRDconst || w0.AuxInt != j-32 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { + if w0.Op != OpS390XSRDconst || auxIntToInt8(w0.AuxInt) != j-32 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVDBRstore) - v.AuxInt = i - 4 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 4) + v.Aux = symToAux(s) v.AddArg3(p, w0, mem) return true } return false } -func rewriteValueS390X_OpS390XMOVWBRstoreidx(v *Value) bool { - v_3 := v.Args[3] - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVWBRstoreidx [i] {s} p idx (SRDconst [32] w) x:(MOVWBRstoreidx [i-4] {s} p idx w mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVDBRstoreidx [i-4] {s} p idx w mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - if v_2.Op != OpS390XSRDconst || v_2.AuxInt != 32 { - continue - } - w := v_2.Args[0] - x := v_3 - if x.Op != OpS390XMOVWBRstoreidx || x.AuxInt != i-4 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 || w != x.Args[2] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVDBRstoreidx) - v.AuxInt = i - 4 - v.Aux = s - v.AddArg4(p, idx, w, mem) - return true - } - } - break - } - // match: (MOVWBRstoreidx [i] {s} p idx (SRDconst [j] w) x:(MOVWBRstoreidx [i-4] {s} p idx w0:(SRDconst [j-32] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVDBRstoreidx [i-4] {s} p idx w0 mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - if v_2.Op != OpS390XSRDconst { - continue - } - j := v_2.AuxInt - w := v_2.Args[0] - x := v_3 - if x.Op != OpS390XMOVWBRstoreidx || x.AuxInt != i-4 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - w0 := x.Args[2] - if w0.Op != OpS390XSRDconst || w0.AuxInt != j-32 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVDBRstoreidx) - v.AuxInt = i - 4 - v.Aux = s - v.AddArg4(p, idx, w0, mem) - return true - } - } - break - } - return false -} func rewriteValueS390X_OpS390XMOVWZload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] @@ -12510,155 +10346,49 @@ func rewriteValueS390X_OpS390XMOVWZload(v *Value) bool { return true } // match: (MOVWZload [off1] {sym} (ADDconst [off2] ptr) mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (MOVWZload [off1+off2] {sym} ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XMOVWZload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (MOVWZload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0)) - // result: (MOVWZload [off1+off2] {mergeSym(sym1,sym2)} base mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0)) + // result: (MOVWZload [off1+off2] {mergeSymTyped(sym1,sym2)} base mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } t := v_0.Type - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) { break } v.reset(OpS390XMOVWZload) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(base, mem) return true } - // match: (MOVWZload [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVWZloadidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XMOVWZloadidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg3(ptr, idx, mem) - return true - } - // match: (MOVWZload [off] {sym} (ADD ptr idx) mem) - // cond: ptr.Op != OpSB - // result: (MOVWZloadidx [off] {sym} ptr idx mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - mem := v_1 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XMOVWZloadidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg3(ptr, idx, mem) - return true - } - break - } - return false -} -func rewriteValueS390X_OpS390XMOVWZloadidx(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVWZloadidx [c] {sym} (ADDconst [d] ptr) idx mem) - // cond: is20Bit(c+d) - // result: (MOVWZloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - if v_0.Op != OpS390XADDconst { - continue - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVWZloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } - // match: (MOVWZloadidx [c] {sym} ptr (ADDconst [d] idx) mem) - // cond: is20Bit(c+d) - // result: (MOVWZloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - ptr := v_0 - if v_1.Op != OpS390XADDconst { - continue - } - d := v_1.AuxInt - idx := v_1.Args[0] - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVWZloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } return false } func rewriteValueS390X_OpS390XMOVWZreg(v *Value) bool { @@ -12739,17 +10469,6 @@ func rewriteValueS390X_OpS390XMOVWZreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVWZreg x:(MOVBZloadidx _ _ _)) - // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVBZloadidx || !(!x.Type.IsSigned() || x.Type.Size() > 1) { - break - } - v.copyOf(x) - return true - } // match: (MOVWZreg x:(MOVHZload _ _)) // cond: (!x.Type.IsSigned() || x.Type.Size() > 2) // result: x @@ -12761,17 +10480,6 @@ func rewriteValueS390X_OpS390XMOVWZreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVWZreg x:(MOVHZloadidx _ _ _)) - // cond: (!x.Type.IsSigned() || x.Type.Size() > 2) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVHZloadidx || !(!x.Type.IsSigned() || x.Type.Size() > 2) { - break - } - v.copyOf(x) - return true - } // match: (MOVWZreg x:(MOVWZload _ _)) // cond: (!x.Type.IsSigned() || x.Type.Size() > 4) // result: x @@ -12783,17 +10491,6 @@ func rewriteValueS390X_OpS390XMOVWZreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVWZreg x:(MOVWZloadidx _ _ _)) - // cond: (!x.Type.IsSigned() || x.Type.Size() > 4) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVWZloadidx || !(!x.Type.IsSigned() || x.Type.Size() > 4) { - break - } - v.copyOf(x) - return true - } // match: (MOVWZreg <t> x:(MOVWload [o] {s} p mem)) // cond: x.Uses == 1 && clobber(x) // result: @x.Block (MOVWZload <t> [o] {s} p mem) @@ -12818,31 +10515,6 @@ func rewriteValueS390X_OpS390XMOVWZreg(v *Value) bool { v0.AddArg2(p, mem) return true } - // match: (MOVWZreg <t> x:(MOVWloadidx [o] {s} p i mem)) - // cond: x.Uses == 1 && clobber(x) - // result: @x.Block (MOVWZloadidx <t> [o] {s} p i mem) - for { - t := v.Type - x := v_0 - if x.Op != OpS390XMOVWloadidx { - break - } - o := auxIntToInt32(x.AuxInt) - s := auxToSym(x.Aux) - mem := x.Args[2] - p := x.Args[0] - i := x.Args[1] - if !(x.Uses == 1 && clobber(x)) { - break - } - b = x.Block - v0 := b.NewValue0(v.Pos, OpS390XMOVWZloadidx, t) - v.copyOf(v0) - v0.AuxInt = int32ToAuxInt(o) - v0.Aux = symToAux(s) - v0.AddArg3(p, i, mem) - return true - } // match: (MOVWZreg x:(Arg <t>)) // cond: !t.IsSigned() && t.Size() <= 4 // result: x @@ -12894,155 +10566,49 @@ func rewriteValueS390X_OpS390XMOVWload(v *Value) bool { return true } // match: (MOVWload [off1] {sym} (ADDconst [off2] ptr) mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (MOVWload [off1+off2] {sym} ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XMOVWload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (MOVWload [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0)) - // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} base mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0)) + // result: (MOVWload [off1+off2] {mergeSymTyped(sym1,sym2)} base mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } t := v_0.Type - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) { break } v.reset(OpS390XMOVWload) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(base, mem) return true } - // match: (MOVWload [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVWloadidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - mem := v_1 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XMOVWloadidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg3(ptr, idx, mem) - return true - } - // match: (MOVWload [off] {sym} (ADD ptr idx) mem) - // cond: ptr.Op != OpSB - // result: (MOVWloadidx [off] {sym} ptr idx mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - mem := v_1 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XMOVWloadidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg3(ptr, idx, mem) - return true - } - break - } - return false -} -func rewriteValueS390X_OpS390XMOVWloadidx(v *Value) bool { - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVWloadidx [c] {sym} (ADDconst [d] ptr) idx mem) - // cond: is20Bit(c+d) - // result: (MOVWloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - if v_0.Op != OpS390XADDconst { - continue - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVWloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } - // match: (MOVWloadidx [c] {sym} ptr (ADDconst [d] idx) mem) - // cond: is20Bit(c+d) - // result: (MOVWloadidx [c+d] {sym} ptr idx mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - ptr := v_0 - if v_1.Op != OpS390XADDconst { - continue - } - d := v_1.AuxInt - idx := v_1.Args[0] - mem := v_2 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVWloadidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg3(ptr, idx, mem) - return true - } - break - } return false } func rewriteValueS390X_OpS390XMOVWreg(v *Value) bool { @@ -13123,17 +10689,6 @@ func rewriteValueS390X_OpS390XMOVWreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVWreg x:(MOVBloadidx _ _ _)) - // cond: (x.Type.IsSigned() || x.Type.Size() == 8) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVBloadidx || !(x.Type.IsSigned() || x.Type.Size() == 8) { - break - } - v.copyOf(x) - return true - } // match: (MOVWreg x:(MOVHload _ _)) // cond: (x.Type.IsSigned() || x.Type.Size() == 8) // result: x @@ -13145,17 +10700,6 @@ func rewriteValueS390X_OpS390XMOVWreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVWreg x:(MOVHloadidx _ _ _)) - // cond: (x.Type.IsSigned() || x.Type.Size() == 8) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVHloadidx || !(x.Type.IsSigned() || x.Type.Size() == 8) { - break - } - v.copyOf(x) - return true - } // match: (MOVWreg x:(MOVWload _ _)) // cond: (x.Type.IsSigned() || x.Type.Size() == 8) // result: x @@ -13167,17 +10711,6 @@ func rewriteValueS390X_OpS390XMOVWreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVWreg x:(MOVWloadidx _ _ _)) - // cond: (x.Type.IsSigned() || x.Type.Size() == 8) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVWloadidx || !(x.Type.IsSigned() || x.Type.Size() == 8) { - break - } - v.copyOf(x) - return true - } // match: (MOVWreg x:(MOVBZload _ _)) // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) // result: x @@ -13189,17 +10722,6 @@ func rewriteValueS390X_OpS390XMOVWreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVWreg x:(MOVBZloadidx _ _ _)) - // cond: (!x.Type.IsSigned() || x.Type.Size() > 1) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVBZloadidx || !(!x.Type.IsSigned() || x.Type.Size() > 1) { - break - } - v.copyOf(x) - return true - } // match: (MOVWreg x:(MOVHZload _ _)) // cond: (!x.Type.IsSigned() || x.Type.Size() > 2) // result: x @@ -13211,17 +10733,6 @@ func rewriteValueS390X_OpS390XMOVWreg(v *Value) bool { v.copyOf(x) return true } - // match: (MOVWreg x:(MOVHZloadidx _ _ _)) - // cond: (!x.Type.IsSigned() || x.Type.Size() > 2) - // result: x - for { - x := v_0 - if x.Op != OpS390XMOVHZloadidx || !(!x.Type.IsSigned() || x.Type.Size() > 2) { - break - } - v.copyOf(x) - return true - } // match: (MOVWreg <t> x:(MOVWZload [o] {s} p mem)) // cond: x.Uses == 1 && clobber(x) // result: @x.Block (MOVWload <t> [o] {s} p mem) @@ -13246,31 +10757,6 @@ func rewriteValueS390X_OpS390XMOVWreg(v *Value) bool { v0.AddArg2(p, mem) return true } - // match: (MOVWreg <t> x:(MOVWZloadidx [o] {s} p i mem)) - // cond: x.Uses == 1 && clobber(x) - // result: @x.Block (MOVWloadidx <t> [o] {s} p i mem) - for { - t := v.Type - x := v_0 - if x.Op != OpS390XMOVWZloadidx { - break - } - o := auxIntToInt32(x.AuxInt) - s := auxToSym(x.Aux) - mem := x.Args[2] - p := x.Args[0] - i := x.Args[1] - if !(x.Uses == 1 && clobber(x)) { - break - } - b = x.Block - v0 := b.NewValue0(v.Pos, OpS390XMOVWloadidx, t) - v.copyOf(v0) - v0.AuxInt = int32ToAuxInt(o) - v0.Aux = symToAux(s) - v0.AddArg3(p, i, mem) - return true - } // match: (MOVWreg x:(Arg <t>)) // cond: t.IsSigned() && t.Size() <= 4 // result: x @@ -13338,137 +10824,85 @@ func rewriteValueS390X_OpS390XMOVWstore(v *Value) bool { return true } // match: (MOVWstore [off1] {sym} (ADDconst [off2] ptr) val mem) - // cond: is20Bit(off1+off2) + // cond: is20Bit(int64(off1)+int64(off2)) // result: (MOVWstore [off1+off2] {sym} ptr val mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off2 := v_0.AuxInt + off2 := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] val := v_1 mem := v_2 - if !(is20Bit(off1 + off2)) { + if !(is20Bit(int64(off1) + int64(off2))) { break } v.reset(OpS390XMOVWstore) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(ptr, val, mem) return true } // match: (MOVWstore [off] {sym} ptr (MOVDconst [c]) mem) - // cond: is16Bit(c) && isU12Bit(off) && ptr.Op != OpSB - // result: (MOVWstoreconst [makeValAndOff(int64(int32(c)),off)] {sym} ptr mem) + // cond: is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB + // result: (MOVWstoreconst [makeValAndOff32(int32(c),off)] {sym} ptr mem) for { - off := v.AuxInt - sym := v.Aux + off := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) ptr := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) mem := v_2 - if !(is16Bit(c) && isU12Bit(off) && ptr.Op != OpSB) { + if !(is16Bit(c) && isU12Bit(int64(off)) && ptr.Op != OpSB) { break } v.reset(OpS390XMOVWstoreconst) - v.AuxInt = makeValAndOff(int64(int32(c)), off) - v.Aux = sym + v.AuxInt = valAndOffToAuxInt(makeValAndOff32(int32(c), off)) + v.Aux = symToAux(sym) v.AddArg2(ptr, mem) return true } // match: (MOVWstore [off1] {sym1} (MOVDaddr <t> [off2] {sym2} base) val mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0)) - // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} base val mem) + // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0)) + // result: (MOVWstore [off1+off2] {mergeSymTyped(sym1,sym2)} base val mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } t := v_0.Type - off2 := v_0.AuxInt - sym2 := v_0.Aux + off2 := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) base := v_0.Args[0] val := v_1 mem := v_2 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) { + if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || (t.IsPtr() && t.Elem().Alignment()%4 == 0 && (off1+off2)%4 == 0))) { break } v.reset(OpS390XMOVWstore) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg3(base, val, mem) return true } - // match: (MOVWstore [off1] {sym1} (MOVDaddridx [off2] {sym2} ptr idx) val mem) - // cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) - // result: (MOVWstoreidx [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem) - for { - off1 := v.AuxInt - sym1 := v.Aux - if v_0.Op != OpS390XMOVDaddridx { - break - } - off2 := v_0.AuxInt - sym2 := v_0.Aux - idx := v_0.Args[1] - ptr := v_0.Args[0] - val := v_1 - mem := v_2 - if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) { - break - } - v.reset(OpS390XMOVWstoreidx) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) - v.AddArg4(ptr, idx, val, mem) - return true - } - // match: (MOVWstore [off] {sym} (ADD ptr idx) val mem) - // cond: ptr.Op != OpSB - // result: (MOVWstoreidx [off] {sym} ptr idx val mem) - for { - off := auxIntToInt32(v.AuxInt) - sym := auxToSym(v.Aux) - if v_0.Op != OpS390XADD { - break - } - _ = v_0.Args[1] - v_0_0 := v_0.Args[0] - v_0_1 := v_0.Args[1] - for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { - ptr := v_0_0 - idx := v_0_1 - val := v_1 - mem := v_2 - if !(ptr.Op != OpSB) { - continue - } - v.reset(OpS390XMOVWstoreidx) - v.AuxInt = int32ToAuxInt(off) - v.Aux = symToAux(sym) - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } // match: (MOVWstore [i] {s} p (SRDconst [32] w) x:(MOVWstore [i-4] {s} p w mem)) // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVDstore [i-4] {s} p w mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 - if v_1.Op != OpS390XSRDconst || v_1.AuxInt != 32 { + if v_1.Op != OpS390XSRDconst || auxIntToInt8(v_1.AuxInt) != 32 { break } w := v_1.Args[0] x := v_2 - if x.Op != OpS390XMOVWstore || x.AuxInt != i-4 || x.Aux != s { + if x.Op != OpS390XMOVWstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -13476,8 +10910,8 @@ func rewriteValueS390X_OpS390XMOVWstore(v *Value) bool { break } v.reset(OpS390XMOVDstore) - v.AuxInt = i - 4 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 4) + v.Aux = symToAux(s) v.AddArg3(p, w, mem) return true } @@ -13485,17 +10919,17 @@ func rewriteValueS390X_OpS390XMOVWstore(v *Value) bool { // cond: p.Op != OpSB && x.Uses == 1 && clobber(x) // result: (MOVDstore [i-4] {s} p w0 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w0 := v_1 if w0.Op != OpS390XSRDconst { break } - j := w0.AuxInt + j := auxIntToInt8(w0.AuxInt) w := w0.Args[0] x := v_2 - if x.Op != OpS390XMOVWstore || x.AuxInt != i-4 || x.Aux != s { + if x.Op != OpS390XMOVWstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -13503,25 +10937,25 @@ func rewriteValueS390X_OpS390XMOVWstore(v *Value) bool { break } x_1 := x.Args[1] - if x_1.Op != OpS390XSRDconst || x_1.AuxInt != j+32 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { + if x_1.Op != OpS390XSRDconst || auxIntToInt8(x_1.AuxInt) != j+32 || w != x_1.Args[0] || !(p.Op != OpSB && x.Uses == 1 && clobber(x)) { break } v.reset(OpS390XMOVDstore) - v.AuxInt = i - 4 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 4) + v.Aux = symToAux(s) v.AddArg3(p, w0, mem) return true } // match: (MOVWstore [i] {s} p w1 x:(MOVWstore [i-4] {s} p w0 mem)) - // cond: p.Op != OpSB && x.Uses == 1 && is20Bit(i-4) && clobber(x) + // cond: p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-4) && clobber(x) // result: (STM2 [i-4] {s} p w0 w1 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w1 := v_1 x := v_2 - if x.Op != OpS390XMOVWstore || x.AuxInt != i-4 || x.Aux != s { + if x.Op != OpS390XMOVWstore || auxIntToInt32(x.AuxInt) != i-4 || auxToSym(x.Aux) != s { break } mem := x.Args[2] @@ -13529,25 +10963,25 @@ func rewriteValueS390X_OpS390XMOVWstore(v *Value) bool { break } w0 := x.Args[1] - if !(p.Op != OpSB && x.Uses == 1 && is20Bit(i-4) && clobber(x)) { + if !(p.Op != OpSB && x.Uses == 1 && is20Bit(int64(i)-4) && clobber(x)) { break } v.reset(OpS390XSTM2) - v.AuxInt = i - 4 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 4) + v.Aux = symToAux(s) v.AddArg4(p, w0, w1, mem) return true } // match: (MOVWstore [i] {s} p w2 x:(STM2 [i-8] {s} p w0 w1 mem)) - // cond: x.Uses == 1 && is20Bit(i-8) && clobber(x) + // cond: x.Uses == 1 && is20Bit(int64(i)-8) && clobber(x) // result: (STM3 [i-8] {s} p w0 w1 w2 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w2 := v_1 x := v_2 - if x.Op != OpS390XSTM2 || x.AuxInt != i-8 || x.Aux != s { + if x.Op != OpS390XSTM2 || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s { break } mem := x.Args[3] @@ -13556,25 +10990,25 @@ func rewriteValueS390X_OpS390XMOVWstore(v *Value) bool { } w0 := x.Args[1] w1 := x.Args[2] - if !(x.Uses == 1 && is20Bit(i-8) && clobber(x)) { + if !(x.Uses == 1 && is20Bit(int64(i)-8) && clobber(x)) { break } v.reset(OpS390XSTM3) - v.AuxInt = i - 8 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 8) + v.Aux = symToAux(s) v.AddArg5(p, w0, w1, w2, mem) return true } // match: (MOVWstore [i] {s} p w3 x:(STM3 [i-12] {s} p w0 w1 w2 mem)) - // cond: x.Uses == 1 && is20Bit(i-12) && clobber(x) + // cond: x.Uses == 1 && is20Bit(int64(i)-12) && clobber(x) // result: (STM4 [i-12] {s} p w0 w1 w2 w3 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w3 := v_1 x := v_2 - if x.Op != OpS390XSTM3 || x.AuxInt != i-12 || x.Aux != s { + if x.Op != OpS390XSTM3 || auxIntToInt32(x.AuxInt) != i-12 || auxToSym(x.Aux) != s { break } mem := x.Args[4] @@ -13584,12 +11018,12 @@ func rewriteValueS390X_OpS390XMOVWstore(v *Value) bool { w0 := x.Args[1] w1 := x.Args[2] w2 := x.Args[3] - if !(x.Uses == 1 && is20Bit(i-12) && clobber(x)) { + if !(x.Uses == 1 && is20Bit(int64(i)-12) && clobber(x)) { break } v.reset(OpS390XSTM4) - v.AuxInt = i - 12 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 12) + v.Aux = symToAux(s) v.AddArg6(p, w0, w1, w2, w3, mem) return true } @@ -13601,234 +11035,102 @@ func rewriteValueS390X_OpS390XMOVWstoreconst(v *Value) bool { b := v.Block typ := &b.Func.Config.Types // match: (MOVWstoreconst [sc] {s} (ADDconst [off] ptr) mem) - // cond: isU12Bit(ValAndOff(sc).Off()+off) - // result: (MOVWstoreconst [ValAndOff(sc).add(off)] {s} ptr mem) + // cond: isU12Bit(sc.Off()+int64(off)) + // result: (MOVWstoreconst [sc.addOffset32(off)] {s} ptr mem) for { - sc := v.AuxInt - s := v.Aux + sc := auxIntToValAndOff(v.AuxInt) + s := auxToSym(v.Aux) if v_0.Op != OpS390XADDconst { break } - off := v_0.AuxInt + off := auxIntToInt32(v_0.AuxInt) ptr := v_0.Args[0] mem := v_1 - if !(isU12Bit(ValAndOff(sc).Off() + off)) { + if !(isU12Bit(sc.Off() + int64(off))) { break } v.reset(OpS390XMOVWstoreconst) - v.AuxInt = ValAndOff(sc).add(off) - v.Aux = s + v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) + v.Aux = symToAux(s) v.AddArg2(ptr, mem) return true } // match: (MOVWstoreconst [sc] {sym1} (MOVDaddr [off] {sym2} ptr) mem) - // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) - // result: (MOVWstoreconst [ValAndOff(sc).add(off)] {mergeSym(sym1, sym2)} ptr mem) + // cond: ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off) + // result: (MOVWstoreconst [sc.addOffset32(off)] {mergeSymTyped(sym1, sym2)} ptr mem) for { - sc := v.AuxInt - sym1 := v.Aux + sc := auxIntToValAndOff(v.AuxInt) + sym1 := auxToSym(v.Aux) if v_0.Op != OpS390XMOVDaddr { break } - off := v_0.AuxInt - sym2 := v_0.Aux + off := auxIntToInt32(v_0.AuxInt) + sym2 := auxToSym(v_0.Aux) ptr := v_0.Args[0] mem := v_1 - if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off)) { + if !(ptr.Op != OpSB && canMergeSym(sym1, sym2) && sc.canAdd32(off)) { break } v.reset(OpS390XMOVWstoreconst) - v.AuxInt = ValAndOff(sc).add(off) - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off)) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(ptr, mem) return true } // match: (MOVWstoreconst [c] {s} p x:(MOVWstoreconst [a] {s} p mem)) - // cond: p.Op != OpSB && x.Uses == 1 && ValAndOff(a).Off() + 4 == ValAndOff(c).Off() && clobber(x) - // result: (MOVDstore [ValAndOff(a).Off()] {s} p (MOVDconst [ValAndOff(c).Val()&0xffffffff | ValAndOff(a).Val()<<32]) mem) + // cond: p.Op != OpSB && x.Uses == 1 && a.Off() + 4 == c.Off() && clobber(x) + // result: (MOVDstore [a.Off32()] {s} p (MOVDconst [c.Val()&0xffffffff | a.Val()<<32]) mem) for { - c := v.AuxInt - s := v.Aux + c := auxIntToValAndOff(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 x := v_1 if x.Op != OpS390XMOVWstoreconst { break } - a := x.AuxInt - if x.Aux != s { + a := auxIntToValAndOff(x.AuxInt) + if auxToSym(x.Aux) != s { break } mem := x.Args[1] - if p != x.Args[0] || !(p.Op != OpSB && x.Uses == 1 && ValAndOff(a).Off()+4 == ValAndOff(c).Off() && clobber(x)) { + if p != x.Args[0] || !(p.Op != OpSB && x.Uses == 1 && a.Off()+4 == c.Off() && clobber(x)) { break } v.reset(OpS390XMOVDstore) - v.AuxInt = ValAndOff(a).Off() - v.Aux = s + v.AuxInt = int32ToAuxInt(a.Off32()) + v.Aux = symToAux(s) v0 := b.NewValue0(x.Pos, OpS390XMOVDconst, typ.UInt64) - v0.AuxInt = ValAndOff(c).Val()&0xffffffff | ValAndOff(a).Val()<<32 + v0.AuxInt = int64ToAuxInt(c.Val()&0xffffffff | a.Val()<<32) v.AddArg3(p, v0, mem) return true } return false } -func rewriteValueS390X_OpS390XMOVWstoreidx(v *Value) bool { - v_3 := v.Args[3] - v_2 := v.Args[2] - v_1 := v.Args[1] - v_0 := v.Args[0] - // match: (MOVWstoreidx [c] {sym} (ADDconst [d] ptr) idx val mem) - // cond: is20Bit(c+d) - // result: (MOVWstoreidx [c+d] {sym} ptr idx val mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - if v_0.Op != OpS390XADDconst { - continue - } - d := v_0.AuxInt - ptr := v_0.Args[0] - idx := v_1 - val := v_2 - mem := v_3 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVWstoreidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } - // match: (MOVWstoreidx [c] {sym} ptr (ADDconst [d] idx) val mem) - // cond: is20Bit(c+d) - // result: (MOVWstoreidx [c+d] {sym} ptr idx val mem) - for { - c := v.AuxInt - sym := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - ptr := v_0 - if v_1.Op != OpS390XADDconst { - continue - } - d := v_1.AuxInt - idx := v_1.Args[0] - val := v_2 - mem := v_3 - if !(is20Bit(c + d)) { - continue - } - v.reset(OpS390XMOVWstoreidx) - v.AuxInt = c + d - v.Aux = sym - v.AddArg4(ptr, idx, val, mem) - return true - } - break - } - // match: (MOVWstoreidx [i] {s} p idx w x:(MOVWstoreidx [i-4] {s} p idx (SRDconst [32] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVDstoreidx [i-4] {s} p idx w mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - w := v_2 - x := v_3 - if x.Op != OpS390XMOVWstoreidx || x.AuxInt != i-4 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - x_2 := x.Args[2] - if x_2.Op != OpS390XSRDconst || x_2.AuxInt != 32 || w != x_2.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVDstoreidx) - v.AuxInt = i - 4 - v.Aux = s - v.AddArg4(p, idx, w, mem) - return true - } - } - break - } - // match: (MOVWstoreidx [i] {s} p idx w0:(SRDconst [j] w) x:(MOVWstoreidx [i-4] {s} p idx (SRDconst [j+32] w) mem)) - // cond: x.Uses == 1 && clobber(x) - // result: (MOVDstoreidx [i-4] {s} p idx w0 mem) - for { - i := v.AuxInt - s := v.Aux - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - p := v_0 - idx := v_1 - w0 := v_2 - if w0.Op != OpS390XSRDconst { - continue - } - j := w0.AuxInt - w := w0.Args[0] - x := v_3 - if x.Op != OpS390XMOVWstoreidx || x.AuxInt != i-4 || x.Aux != s { - continue - } - mem := x.Args[3] - x_0 := x.Args[0] - x_1 := x.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x_0, x_1 = _i1+1, x_1, x_0 { - if p != x_0 || idx != x_1 { - continue - } - x_2 := x.Args[2] - if x_2.Op != OpS390XSRDconst || x_2.AuxInt != j+32 || w != x_2.Args[0] || !(x.Uses == 1 && clobber(x)) { - continue - } - v.reset(OpS390XMOVDstoreidx) - v.AuxInt = i - 4 - v.Aux = s - v.AddArg4(p, idx, w0, mem) - return true - } - } - break - } - return false -} func rewriteValueS390X_OpS390XMULLD(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (MULLD x (MOVDconst [c])) // cond: is32Bit(c) - // result: (MULLDconst [c] x) + // result: (MULLDconst [int32(c)] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { x := v_0 if v_1.Op != OpS390XMOVDconst { continue } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(is32Bit(c)) { continue } v.reset(OpS390XMULLDconst) - v.AuxInt = c + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } break } // match: (MULLD <t> x g:(MOVDload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (MULLDload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -13838,17 +11140,17 @@ func rewriteValueS390X_OpS390XMULLD(v *Value) bool { if g.Op != OpS390XMOVDload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XMULLDload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } @@ -13920,15 +11222,15 @@ func rewriteValueS390X_OpS390XMULLDconst(v *Value) bool { return true } // match: (MULLDconst [c] (MOVDconst [d])) - // result: (MOVDconst [c*d]) + // result: (MOVDconst [int64(c)*d]) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDconst { break } - d := v_0.AuxInt + d := auxIntToInt64(v_0.AuxInt) v.reset(OpS390XMOVDconst) - v.AuxInt = c * d + v.AuxInt = int64ToAuxInt(int64(c) * d) return true } return false @@ -13962,47 +11264,47 @@ func rewriteValueS390X_OpS390XMULLDload(v *Value) bool { return true } // match: (MULLDload [off1] {sym} x (ADDconst [off2] ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(off1+off2) + // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) // result: (MULLDload [off1+off2] {sym} x ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - off2 := v_1.AuxInt + off2 := auxIntToInt32(v_1.AuxInt) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(off1+off2)) { + if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { break } v.reset(OpS390XMULLDload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (MULLDload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2) - // result: (MULLDload [o1+o2] {mergeSym(s1, s2)} x ptr mem) + // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) + // result: (MULLDload [o1+o2] {mergeSymTyped(s1, s2)} x ptr mem) for { - o1 := v.AuxInt - s1 := v.Aux + o1 := auxIntToInt32(v.AuxInt) + s1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - o2 := v_1.AuxInt - s2 := v_1.Aux + o2 := auxIntToInt32(v_1.AuxInt) + s2 := auxToSym(v_1.Aux) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2)) { + if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { break } v.reset(OpS390XMULLDload) - v.AuxInt = o1 + o2 - v.Aux = mergeSym(s1, s2) + v.AuxInt = int32ToAuxInt(o1 + o2) + v.Aux = symToAux(mergeSymTyped(s1, s2)) v.AddArg3(x, ptr, mem) return true } @@ -14012,23 +11314,23 @@ func rewriteValueS390X_OpS390XMULLW(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (MULLW x (MOVDconst [c])) - // result: (MULLWconst [int64(int32(c))] x) + // result: (MULLWconst [int32(c)] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { x := v_0 if v_1.Op != OpS390XMOVDconst { continue } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XMULLWconst) - v.AuxInt = int64(int32(c)) + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } break } // match: (MULLW <t> x g:(MOVWload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (MULLWload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -14038,24 +11340,24 @@ func rewriteValueS390X_OpS390XMULLW(v *Value) bool { if g.Op != OpS390XMOVWload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XMULLWload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } break } // match: (MULLW <t> x g:(MOVWZload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (MULLWload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -14065,17 +11367,17 @@ func rewriteValueS390X_OpS390XMULLW(v *Value) bool { if g.Op != OpS390XMOVWZload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XMULLWload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } @@ -14147,15 +11449,15 @@ func rewriteValueS390X_OpS390XMULLWconst(v *Value) bool { return true } // match: (MULLWconst [c] (MOVDconst [d])) - // result: (MOVDconst [int64(int32(c*d))]) + // result: (MOVDconst [int64(c*int32(d))]) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDconst { break } - d := v_0.AuxInt + d := auxIntToInt64(v_0.AuxInt) v.reset(OpS390XMOVDconst) - v.AuxInt = int64(int32(c * d)) + v.AuxInt = int64ToAuxInt(int64(c * int32(d))) return true } return false @@ -14165,47 +11467,47 @@ func rewriteValueS390X_OpS390XMULLWload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (MULLWload [off1] {sym} x (ADDconst [off2] ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(off1+off2) + // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) // result: (MULLWload [off1+off2] {sym} x ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - off2 := v_1.AuxInt + off2 := auxIntToInt32(v_1.AuxInt) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(off1+off2)) { + if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { break } v.reset(OpS390XMULLWload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (MULLWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2) - // result: (MULLWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) + // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) + // result: (MULLWload [o1+o2] {mergeSymTyped(s1, s2)} x ptr mem) for { - o1 := v.AuxInt - s1 := v.Aux + o1 := auxIntToInt32(v.AuxInt) + s1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - o2 := v_1.AuxInt - s2 := v_1.Aux + o2 := auxIntToInt32(v_1.AuxInt) + s2 := auxToSym(v_1.Aux) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2)) { + if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { break } v.reset(OpS390XMULLWload) - v.AuxInt = o1 + o2 - v.Aux = mergeSym(s1, s2) + v.AuxInt = int32ToAuxInt(o1 + o2) + v.Aux = symToAux(mergeSymTyped(s1, s2)) v.AddArg3(x, ptr, mem) return true } @@ -14391,14 +11693,14 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { } // match: (OR (SLDconst [63] (SRDconst [63] (LGDR x))) (MOVDconst [c])) // cond: c & -1<<63 == 0 - // result: (LGDR (CPSDR <x.Type> (FMOVDconst <x.Type> [c]) x)) + // result: (LGDR (CPSDR <x.Type> (FMOVDconst <x.Type> [math.Float64frombits(uint64(c))]) x)) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - if v_0.Op != OpS390XSLDconst || v_0.AuxInt != 63 { + if v_0.Op != OpS390XSLDconst || auxIntToInt8(v_0.AuxInt) != 63 { continue } v_0_0 := v_0.Args[0] - if v_0_0.Op != OpS390XSRDconst || v_0_0.AuxInt != 63 { + if v_0_0.Op != OpS390XSRDconst || auxIntToInt8(v_0_0.AuxInt) != 63 { continue } v_0_0_0 := v_0_0.Args[0] @@ -14409,14 +11711,14 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if v_1.Op != OpS390XMOVDconst { continue } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(c&-1<<63 == 0) { continue } v.reset(OpS390XLGDR) v0 := b.NewValue0(v.Pos, OpS390XCPSDR, x.Type) v1 := b.NewValue0(v.Pos, OpS390XFMOVDconst, x.Type) - v1.AuxInt = c + v1.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c))) v0.AddArg2(v1, x) v.AddArg(v0) return true @@ -14458,7 +11760,7 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { } // match: (OR (AND (MOVDconst [-1<<63]) (LGDR x)) (MOVDconst [c])) // cond: c & -1<<63 == 0 - // result: (LGDR (CPSDR <x.Type> (FMOVDconst <x.Type> [c]) x)) + // result: (LGDR (CPSDR <x.Type> (FMOVDconst <x.Type> [math.Float64frombits(uint64(c))]) x)) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpS390XAND { @@ -14468,21 +11770,21 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { v_0_0 := v_0.Args[0] v_0_1 := v_0.Args[1] for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { - if v_0_0.Op != OpS390XMOVDconst || v_0_0.AuxInt != -1<<63 || v_0_1.Op != OpS390XLGDR { + if v_0_0.Op != OpS390XMOVDconst || auxIntToInt64(v_0_0.AuxInt) != -1<<63 || v_0_1.Op != OpS390XLGDR { continue } x := v_0_1.Args[0] if v_1.Op != OpS390XMOVDconst { continue } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(c&-1<<63 == 0) { continue } v.reset(OpS390XLGDR) v0 := b.NewValue0(v.Pos, OpS390XCPSDR, x.Type) v1 := b.NewValue0(v.Pos, OpS390XFMOVDconst, x.Type) - v1.AuxInt = c + v1.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c))) v0.AddArg2(v1, x) v.AddArg(v0) return true @@ -14519,7 +11821,7 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { return true } // match: (OR <t> x g:(MOVDload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (ORload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -14529,17 +11831,17 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if g.Op != OpS390XMOVDload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XORload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } @@ -14554,20 +11856,20 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if x1.Op != OpS390XMOVBZload { continue } - i1 := x1.AuxInt - s := x1.Aux + i1 := auxIntToInt32(x1.AuxInt) + s := auxToSym(x1.Aux) mem := x1.Args[1] p := x1.Args[0] sh := v_1 - if sh.Op != OpS390XSLDconst || sh.AuxInt != 8 { + if sh.Op != OpS390XSLDconst || auxIntToInt8(sh.AuxInt) != 8 { continue } x0 := sh.Args[0] if x0.Op != OpS390XMOVBZload { continue } - i0 := x0.AuxInt - if x0.Aux != s { + i0 := auxIntToInt32(x0.AuxInt) + if auxToSym(x0.Aux) != s { continue } _ = x0.Args[1] @@ -14577,8 +11879,8 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { b = mergePoint(b, x0, x1) v0 := b.NewValue0(x0.Pos, OpS390XMOVHZload, typ.UInt16) v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s + v0.AuxInt = int32ToAuxInt(i0) + v0.Aux = symToAux(s) v0.AddArg2(p, mem) return true } @@ -14593,20 +11895,20 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if x1.Op != OpS390XMOVHZload { continue } - i1 := x1.AuxInt - s := x1.Aux + i1 := auxIntToInt32(x1.AuxInt) + s := auxToSym(x1.Aux) mem := x1.Args[1] p := x1.Args[0] sh := v_1 - if sh.Op != OpS390XSLDconst || sh.AuxInt != 16 { + if sh.Op != OpS390XSLDconst || auxIntToInt8(sh.AuxInt) != 16 { continue } x0 := sh.Args[0] if x0.Op != OpS390XMOVHZload { continue } - i0 := x0.AuxInt - if x0.Aux != s { + i0 := auxIntToInt32(x0.AuxInt) + if auxToSym(x0.Aux) != s { continue } _ = x0.Args[1] @@ -14616,8 +11918,8 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { b = mergePoint(b, x0, x1) v0 := b.NewValue0(x0.Pos, OpS390XMOVWZload, typ.UInt32) v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s + v0.AuxInt = int32ToAuxInt(i0) + v0.Aux = symToAux(s) v0.AddArg2(p, mem) return true } @@ -14632,20 +11934,20 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if x1.Op != OpS390XMOVWZload { continue } - i1 := x1.AuxInt - s := x1.Aux + i1 := auxIntToInt32(x1.AuxInt) + s := auxToSym(x1.Aux) mem := x1.Args[1] p := x1.Args[0] sh := v_1 - if sh.Op != OpS390XSLDconst || sh.AuxInt != 32 { + if sh.Op != OpS390XSLDconst || auxIntToInt8(sh.AuxInt) != 32 { continue } x0 := sh.Args[0] if x0.Op != OpS390XMOVWZload { continue } - i0 := x0.AuxInt - if x0.Aux != s { + i0 := auxIntToInt32(x0.AuxInt) + if auxToSym(x0.Aux) != s { continue } _ = x0.Args[1] @@ -14655,8 +11957,8 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { b = mergePoint(b, x0, x1) v0 := b.NewValue0(x0.Pos, OpS390XMOVDload, typ.UInt64) v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s + v0.AuxInt = int32ToAuxInt(i0) + v0.Aux = symToAux(s) v0.AddArg2(p, mem) return true } @@ -14671,13 +11973,13 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if s0.Op != OpS390XSLDconst { continue } - j0 := s0.AuxInt + j0 := auxIntToInt8(s0.AuxInt) x0 := s0.Args[0] if x0.Op != OpS390XMOVBZload { continue } - i0 := x0.AuxInt - s := x0.Aux + i0 := auxIntToInt32(x0.AuxInt) + s := auxToSym(x0.Aux) mem := x0.Args[1] p := x0.Args[0] or := v_1 @@ -14692,13 +11994,13 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if s1.Op != OpS390XSLDconst { continue } - j1 := s1.AuxInt + j1 := auxIntToInt8(s1.AuxInt) x1 := s1.Args[0] if x1.Op != OpS390XMOVBZload { continue } - i1 := x1.AuxInt - if x1.Aux != s { + i1 := auxIntToInt32(x1.AuxInt) + if auxToSym(x1.Aux) != s { continue } _ = x1.Args[1] @@ -14713,10 +12015,10 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { v0 := b.NewValue0(x1.Pos, OpS390XOR, v.Type) v.copyOf(v0) v1 := b.NewValue0(x1.Pos, OpS390XSLDconst, v.Type) - v1.AuxInt = j1 + v1.AuxInt = int8ToAuxInt(j1) v2 := b.NewValue0(x1.Pos, OpS390XMOVHZload, typ.UInt16) - v2.AuxInt = i0 - v2.Aux = s + v2.AuxInt = int32ToAuxInt(i0) + v2.Aux = symToAux(s) v2.AddArg2(p, mem) v1.AddArg(v2) v0.AddArg2(v1, y) @@ -14734,13 +12036,13 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if s0.Op != OpS390XSLDconst { continue } - j0 := s0.AuxInt + j0 := auxIntToInt8(s0.AuxInt) x0 := s0.Args[0] if x0.Op != OpS390XMOVHZload { continue } - i0 := x0.AuxInt - s := x0.Aux + i0 := auxIntToInt32(x0.AuxInt) + s := auxToSym(x0.Aux) mem := x0.Args[1] p := x0.Args[0] or := v_1 @@ -14755,13 +12057,13 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if s1.Op != OpS390XSLDconst { continue } - j1 := s1.AuxInt + j1 := auxIntToInt8(s1.AuxInt) x1 := s1.Args[0] if x1.Op != OpS390XMOVHZload { continue } - i1 := x1.AuxInt - if x1.Aux != s { + i1 := auxIntToInt32(x1.AuxInt) + if auxToSym(x1.Aux) != s { continue } _ = x1.Args[1] @@ -14776,10 +12078,10 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { v0 := b.NewValue0(x1.Pos, OpS390XOR, v.Type) v.copyOf(v0) v1 := b.NewValue0(x1.Pos, OpS390XSLDconst, v.Type) - v1.AuxInt = j1 + v1.AuxInt = int8ToAuxInt(j1) v2 := b.NewValue0(x1.Pos, OpS390XMOVWZload, typ.UInt32) - v2.AuxInt = i0 - v2.Aux = s + v2.AuxInt = int32ToAuxInt(i0) + v2.Aux = symToAux(s) v2.AddArg2(p, mem) v1.AddArg(v2) v0.AddArg2(v1, y) @@ -14788,294 +12090,6 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { } break } - // match: (OR x1:(MOVBZloadidx [i1] {s} p idx mem) sh:(SLDconst [8] x0:(MOVBZloadidx [i0] {s} p idx mem))) - // cond: i1 == i0+1 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) - // result: @mergePoint(b,x0,x1) (MOVHZloadidx [i0] {s} p idx mem) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - x1 := v_0 - if x1.Op != OpS390XMOVBZloadidx { - continue - } - i1 := x1.AuxInt - s := x1.Aux - mem := x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x1_0, x1_1 = _i1+1, x1_1, x1_0 { - p := x1_0 - idx := x1_1 - sh := v_1 - if sh.Op != OpS390XSLDconst || sh.AuxInt != 8 { - continue - } - x0 := sh.Args[0] - if x0.Op != OpS390XMOVBZloadidx { - continue - } - i0 := x0.AuxInt - if x0.Aux != s { - continue - } - _ = x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i2 := 0; _i2 <= 1; _i2, x0_0, x0_1 = _i2+1, x0_1, x0_0 { - if p != x0_0 || idx != x0_1 || mem != x0.Args[2] || !(i1 == i0+1 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { - continue - } - b = mergePoint(b, x0, x1) - v0 := b.NewValue0(v.Pos, OpS390XMOVHZloadidx, typ.UInt16) - v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s - v0.AddArg3(p, idx, mem) - return true - } - } - } - break - } - // match: (OR x1:(MOVHZloadidx [i1] {s} p idx mem) sh:(SLDconst [16] x0:(MOVHZloadidx [i0] {s} p idx mem))) - // cond: i1 == i0+2 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) - // result: @mergePoint(b,x0,x1) (MOVWZloadidx [i0] {s} p idx mem) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - x1 := v_0 - if x1.Op != OpS390XMOVHZloadidx { - continue - } - i1 := x1.AuxInt - s := x1.Aux - mem := x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x1_0, x1_1 = _i1+1, x1_1, x1_0 { - p := x1_0 - idx := x1_1 - sh := v_1 - if sh.Op != OpS390XSLDconst || sh.AuxInt != 16 { - continue - } - x0 := sh.Args[0] - if x0.Op != OpS390XMOVHZloadidx { - continue - } - i0 := x0.AuxInt - if x0.Aux != s { - continue - } - _ = x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i2 := 0; _i2 <= 1; _i2, x0_0, x0_1 = _i2+1, x0_1, x0_0 { - if p != x0_0 || idx != x0_1 || mem != x0.Args[2] || !(i1 == i0+2 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { - continue - } - b = mergePoint(b, x0, x1) - v0 := b.NewValue0(v.Pos, OpS390XMOVWZloadidx, typ.UInt32) - v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s - v0.AddArg3(p, idx, mem) - return true - } - } - } - break - } - // match: (OR x1:(MOVWZloadidx [i1] {s} p idx mem) sh:(SLDconst [32] x0:(MOVWZloadidx [i0] {s} p idx mem))) - // cond: i1 == i0+4 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) - // result: @mergePoint(b,x0,x1) (MOVDloadidx [i0] {s} p idx mem) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - x1 := v_0 - if x1.Op != OpS390XMOVWZloadidx { - continue - } - i1 := x1.AuxInt - s := x1.Aux - mem := x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x1_0, x1_1 = _i1+1, x1_1, x1_0 { - p := x1_0 - idx := x1_1 - sh := v_1 - if sh.Op != OpS390XSLDconst || sh.AuxInt != 32 { - continue - } - x0 := sh.Args[0] - if x0.Op != OpS390XMOVWZloadidx { - continue - } - i0 := x0.AuxInt - if x0.Aux != s { - continue - } - _ = x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i2 := 0; _i2 <= 1; _i2, x0_0, x0_1 = _i2+1, x0_1, x0_0 { - if p != x0_0 || idx != x0_1 || mem != x0.Args[2] || !(i1 == i0+4 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { - continue - } - b = mergePoint(b, x0, x1) - v0 := b.NewValue0(v.Pos, OpS390XMOVDloadidx, typ.UInt64) - v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s - v0.AddArg3(p, idx, mem) - return true - } - } - } - break - } - // match: (OR s0:(SLDconst [j0] x0:(MOVBZloadidx [i0] {s} p idx mem)) or:(OR s1:(SLDconst [j1] x1:(MOVBZloadidx [i1] {s} p idx mem)) y)) - // cond: i1 == i0+1 && j1 == j0-8 && j1 % 16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b,x0,x1,y) != nil && clobber(x0, x1, s0, s1, or) - // result: @mergePoint(b,x0,x1,y) (OR <v.Type> (SLDconst <v.Type> [j1] (MOVHZloadidx [i0] {s} p idx mem)) y) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - s0 := v_0 - if s0.Op != OpS390XSLDconst { - continue - } - j0 := s0.AuxInt - x0 := s0.Args[0] - if x0.Op != OpS390XMOVBZloadidx { - continue - } - i0 := x0.AuxInt - s := x0.Aux - mem := x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x0_0, x0_1 = _i1+1, x0_1, x0_0 { - p := x0_0 - idx := x0_1 - or := v_1 - if or.Op != OpS390XOR { - continue - } - _ = or.Args[1] - or_0 := or.Args[0] - or_1 := or.Args[1] - for _i2 := 0; _i2 <= 1; _i2, or_0, or_1 = _i2+1, or_1, or_0 { - s1 := or_0 - if s1.Op != OpS390XSLDconst { - continue - } - j1 := s1.AuxInt - x1 := s1.Args[0] - if x1.Op != OpS390XMOVBZloadidx { - continue - } - i1 := x1.AuxInt - if x1.Aux != s { - continue - } - _ = x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i3 := 0; _i3 <= 1; _i3, x1_0, x1_1 = _i3+1, x1_1, x1_0 { - if p != x1_0 || idx != x1_1 || mem != x1.Args[2] { - continue - } - y := or_1 - if !(i1 == i0+1 && j1 == j0-8 && j1%16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b, x0, x1, y) != nil && clobber(x0, x1, s0, s1, or)) { - continue - } - b = mergePoint(b, x0, x1, y) - v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type) - v.copyOf(v0) - v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type) - v1.AuxInt = j1 - v2 := b.NewValue0(v.Pos, OpS390XMOVHZloadidx, typ.UInt16) - v2.AuxInt = i0 - v2.Aux = s - v2.AddArg3(p, idx, mem) - v1.AddArg(v2) - v0.AddArg2(v1, y) - return true - } - } - } - } - break - } - // match: (OR s0:(SLDconst [j0] x0:(MOVHZloadidx [i0] {s} p idx mem)) or:(OR s1:(SLDconst [j1] x1:(MOVHZloadidx [i1] {s} p idx mem)) y)) - // cond: i1 == i0+2 && j1 == j0-16 && j1 % 32 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b,x0,x1,y) != nil && clobber(x0, x1, s0, s1, or) - // result: @mergePoint(b,x0,x1,y) (OR <v.Type> (SLDconst <v.Type> [j1] (MOVWZloadidx [i0] {s} p idx mem)) y) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - s0 := v_0 - if s0.Op != OpS390XSLDconst { - continue - } - j0 := s0.AuxInt - x0 := s0.Args[0] - if x0.Op != OpS390XMOVHZloadidx { - continue - } - i0 := x0.AuxInt - s := x0.Aux - mem := x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x0_0, x0_1 = _i1+1, x0_1, x0_0 { - p := x0_0 - idx := x0_1 - or := v_1 - if or.Op != OpS390XOR { - continue - } - _ = or.Args[1] - or_0 := or.Args[0] - or_1 := or.Args[1] - for _i2 := 0; _i2 <= 1; _i2, or_0, or_1 = _i2+1, or_1, or_0 { - s1 := or_0 - if s1.Op != OpS390XSLDconst { - continue - } - j1 := s1.AuxInt - x1 := s1.Args[0] - if x1.Op != OpS390XMOVHZloadidx { - continue - } - i1 := x1.AuxInt - if x1.Aux != s { - continue - } - _ = x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i3 := 0; _i3 <= 1; _i3, x1_0, x1_1 = _i3+1, x1_1, x1_0 { - if p != x1_0 || idx != x1_1 || mem != x1.Args[2] { - continue - } - y := or_1 - if !(i1 == i0+2 && j1 == j0-16 && j1%32 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b, x0, x1, y) != nil && clobber(x0, x1, s0, s1, or)) { - continue - } - b = mergePoint(b, x0, x1, y) - v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type) - v.copyOf(v0) - v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type) - v1.AuxInt = j1 - v2 := b.NewValue0(v.Pos, OpS390XMOVWZloadidx, typ.UInt32) - v2.AuxInt = i0 - v2.Aux = s - v2.AddArg3(p, idx, mem) - v1.AddArg(v2) - v0.AddArg2(v1, y) - return true - } - } - } - } - break - } // match: (OR x0:(MOVBZload [i0] {s} p mem) sh:(SLDconst [8] x1:(MOVBZload [i1] {s} p mem))) // cond: p.Op != OpSB && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) // result: @mergePoint(b,x0,x1) (MOVHZreg (MOVHBRload [i0] {s} p mem)) @@ -15085,20 +12099,20 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if x0.Op != OpS390XMOVBZload { continue } - i0 := x0.AuxInt - s := x0.Aux + i0 := auxIntToInt32(x0.AuxInt) + s := auxToSym(x0.Aux) mem := x0.Args[1] p := x0.Args[0] sh := v_1 - if sh.Op != OpS390XSLDconst || sh.AuxInt != 8 { + if sh.Op != OpS390XSLDconst || auxIntToInt8(sh.AuxInt) != 8 { continue } x1 := sh.Args[0] if x1.Op != OpS390XMOVBZload { continue } - i1 := x1.AuxInt - if x1.Aux != s { + i1 := auxIntToInt32(x1.AuxInt) + if auxToSym(x1.Aux) != s { continue } _ = x1.Args[1] @@ -15109,8 +12123,8 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { v0 := b.NewValue0(x1.Pos, OpS390XMOVHZreg, typ.UInt64) v.copyOf(v0) v1 := b.NewValue0(x1.Pos, OpS390XMOVHBRload, typ.UInt16) - v1.AuxInt = i0 - v1.Aux = s + v1.AuxInt = int32ToAuxInt(i0) + v1.Aux = symToAux(s) v1.AddArg2(p, mem) v0.AddArg(v1) return true @@ -15130,12 +12144,12 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if x0.Op != OpS390XMOVHBRload { continue } - i0 := x0.AuxInt - s := x0.Aux + i0 := auxIntToInt32(x0.AuxInt) + s := auxToSym(x0.Aux) mem := x0.Args[1] p := x0.Args[0] sh := v_1 - if sh.Op != OpS390XSLDconst || sh.AuxInt != 16 { + if sh.Op != OpS390XSLDconst || auxIntToInt8(sh.AuxInt) != 16 { continue } r1 := sh.Args[0] @@ -15146,8 +12160,8 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if x1.Op != OpS390XMOVHBRload { continue } - i1 := x1.AuxInt - if x1.Aux != s { + i1 := auxIntToInt32(x1.AuxInt) + if auxToSym(x1.Aux) != s { continue } _ = x1.Args[1] @@ -15158,8 +12172,8 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { v0 := b.NewValue0(x1.Pos, OpS390XMOVWZreg, typ.UInt64) v.copyOf(v0) v1 := b.NewValue0(x1.Pos, OpS390XMOVWBRload, typ.UInt32) - v1.AuxInt = i0 - v1.Aux = s + v1.AuxInt = int32ToAuxInt(i0) + v1.Aux = symToAux(s) v1.AddArg2(p, mem) v0.AddArg(v1) return true @@ -15179,12 +12193,12 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if x0.Op != OpS390XMOVWBRload { continue } - i0 := x0.AuxInt - s := x0.Aux + i0 := auxIntToInt32(x0.AuxInt) + s := auxToSym(x0.Aux) mem := x0.Args[1] p := x0.Args[0] sh := v_1 - if sh.Op != OpS390XSLDconst || sh.AuxInt != 32 { + if sh.Op != OpS390XSLDconst || auxIntToInt8(sh.AuxInt) != 32 { continue } r1 := sh.Args[0] @@ -15195,8 +12209,8 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if x1.Op != OpS390XMOVWBRload { continue } - i1 := x1.AuxInt - if x1.Aux != s { + i1 := auxIntToInt32(x1.AuxInt) + if auxToSym(x1.Aux) != s { continue } _ = x1.Args[1] @@ -15206,8 +12220,8 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { b = mergePoint(b, x0, x1) v0 := b.NewValue0(x1.Pos, OpS390XMOVDBRload, typ.UInt64) v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s + v0.AuxInt = int32ToAuxInt(i0) + v0.Aux = symToAux(s) v0.AddArg2(p, mem) return true } @@ -15222,13 +12236,13 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if s1.Op != OpS390XSLDconst { continue } - j1 := s1.AuxInt + j1 := auxIntToInt8(s1.AuxInt) x1 := s1.Args[0] if x1.Op != OpS390XMOVBZload { continue } - i1 := x1.AuxInt - s := x1.Aux + i1 := auxIntToInt32(x1.AuxInt) + s := auxToSym(x1.Aux) mem := x1.Args[1] p := x1.Args[0] or := v_1 @@ -15243,13 +12257,13 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if s0.Op != OpS390XSLDconst { continue } - j0 := s0.AuxInt + j0 := auxIntToInt8(s0.AuxInt) x0 := s0.Args[0] if x0.Op != OpS390XMOVBZload { continue } - i0 := x0.AuxInt - if x0.Aux != s { + i0 := auxIntToInt32(x0.AuxInt) + if auxToSym(x0.Aux) != s { continue } _ = x0.Args[1] @@ -15264,11 +12278,11 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { v0 := b.NewValue0(x0.Pos, OpS390XOR, v.Type) v.copyOf(v0) v1 := b.NewValue0(x0.Pos, OpS390XSLDconst, v.Type) - v1.AuxInt = j0 + v1.AuxInt = int8ToAuxInt(j0) v2 := b.NewValue0(x0.Pos, OpS390XMOVHZreg, typ.UInt64) v3 := b.NewValue0(x0.Pos, OpS390XMOVHBRload, typ.UInt16) - v3.AuxInt = i0 - v3.Aux = s + v3.AuxInt = int32ToAuxInt(i0) + v3.Aux = symToAux(s) v3.AddArg2(p, mem) v2.AddArg(v3) v1.AddArg(v2) @@ -15287,7 +12301,7 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if s1.Op != OpS390XSLDconst { continue } - j1 := s1.AuxInt + j1 := auxIntToInt8(s1.AuxInt) r1 := s1.Args[0] if r1.Op != OpS390XMOVHZreg { continue @@ -15296,8 +12310,8 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if x1.Op != OpS390XMOVHBRload { continue } - i1 := x1.AuxInt - s := x1.Aux + i1 := auxIntToInt32(x1.AuxInt) + s := auxToSym(x1.Aux) mem := x1.Args[1] p := x1.Args[0] or := v_1 @@ -15312,7 +12326,7 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if s0.Op != OpS390XSLDconst { continue } - j0 := s0.AuxInt + j0 := auxIntToInt8(s0.AuxInt) r0 := s0.Args[0] if r0.Op != OpS390XMOVHZreg { continue @@ -15321,8 +12335,8 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { if x0.Op != OpS390XMOVHBRload { continue } - i0 := x0.AuxInt - if x0.Aux != s { + i0 := auxIntToInt32(x0.AuxInt) + if auxToSym(x0.Aux) != s { continue } _ = x0.Args[1] @@ -15337,11 +12351,11 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { v0 := b.NewValue0(x0.Pos, OpS390XOR, v.Type) v.copyOf(v0) v1 := b.NewValue0(x0.Pos, OpS390XSLDconst, v.Type) - v1.AuxInt = j0 + v1.AuxInt = int8ToAuxInt(j0) v2 := b.NewValue0(x0.Pos, OpS390XMOVWZreg, typ.UInt64) v3 := b.NewValue0(x0.Pos, OpS390XMOVWBRload, typ.UInt32) - v3.AuxInt = i0 - v3.Aux = s + v3.AuxInt = int32ToAuxInt(i0) + v3.Aux = symToAux(s) v3.AddArg2(p, mem) v2.AddArg(v3) v1.AddArg(v2) @@ -15351,326 +12365,6 @@ func rewriteValueS390X_OpS390XOR(v *Value) bool { } break } - // match: (OR x0:(MOVBZloadidx [i0] {s} p idx mem) sh:(SLDconst [8] x1:(MOVBZloadidx [i1] {s} p idx mem))) - // cond: p.Op != OpSB && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) - // result: @mergePoint(b,x0,x1) (MOVHZreg (MOVHBRloadidx [i0] {s} p idx mem)) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - x0 := v_0 - if x0.Op != OpS390XMOVBZloadidx { - continue - } - i0 := x0.AuxInt - s := x0.Aux - mem := x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x0_0, x0_1 = _i1+1, x0_1, x0_0 { - p := x0_0 - idx := x0_1 - sh := v_1 - if sh.Op != OpS390XSLDconst || sh.AuxInt != 8 { - continue - } - x1 := sh.Args[0] - if x1.Op != OpS390XMOVBZloadidx { - continue - } - i1 := x1.AuxInt - if x1.Aux != s { - continue - } - _ = x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i2 := 0; _i2 <= 1; _i2, x1_0, x1_1 = _i2+1, x1_1, x1_0 { - if p != x1_0 || idx != x1_1 || mem != x1.Args[2] || !(p.Op != OpSB && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { - continue - } - b = mergePoint(b, x0, x1) - v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) - v.copyOf(v0) - v1 := b.NewValue0(v.Pos, OpS390XMOVHBRloadidx, typ.Int16) - v1.AuxInt = i0 - v1.Aux = s - v1.AddArg3(p, idx, mem) - v0.AddArg(v1) - return true - } - } - } - break - } - // match: (OR r0:(MOVHZreg x0:(MOVHBRloadidx [i0] {s} p idx mem)) sh:(SLDconst [16] r1:(MOVHZreg x1:(MOVHBRloadidx [i1] {s} p idx mem)))) - // cond: i1 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, r0, r1, sh) - // result: @mergePoint(b,x0,x1) (MOVWZreg (MOVWBRloadidx [i0] {s} p idx mem)) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - r0 := v_0 - if r0.Op != OpS390XMOVHZreg { - continue - } - x0 := r0.Args[0] - if x0.Op != OpS390XMOVHBRloadidx { - continue - } - i0 := x0.AuxInt - s := x0.Aux - mem := x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x0_0, x0_1 = _i1+1, x0_1, x0_0 { - p := x0_0 - idx := x0_1 - sh := v_1 - if sh.Op != OpS390XSLDconst || sh.AuxInt != 16 { - continue - } - r1 := sh.Args[0] - if r1.Op != OpS390XMOVHZreg { - continue - } - x1 := r1.Args[0] - if x1.Op != OpS390XMOVHBRloadidx { - continue - } - i1 := x1.AuxInt - if x1.Aux != s { - continue - } - _ = x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i2 := 0; _i2 <= 1; _i2, x1_0, x1_1 = _i2+1, x1_1, x1_0 { - if p != x1_0 || idx != x1_1 || mem != x1.Args[2] || !(i1 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, r0, r1, sh)) { - continue - } - b = mergePoint(b, x0, x1) - v0 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) - v.copyOf(v0) - v1 := b.NewValue0(v.Pos, OpS390XMOVWBRloadidx, typ.Int32) - v1.AuxInt = i0 - v1.Aux = s - v1.AddArg3(p, idx, mem) - v0.AddArg(v1) - return true - } - } - } - break - } - // match: (OR r0:(MOVWZreg x0:(MOVWBRloadidx [i0] {s} p idx mem)) sh:(SLDconst [32] r1:(MOVWZreg x1:(MOVWBRloadidx [i1] {s} p idx mem)))) - // cond: i1 == i0+4 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, r0, r1, sh) - // result: @mergePoint(b,x0,x1) (MOVDBRloadidx [i0] {s} p idx mem) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - r0 := v_0 - if r0.Op != OpS390XMOVWZreg { - continue - } - x0 := r0.Args[0] - if x0.Op != OpS390XMOVWBRloadidx { - continue - } - i0 := x0.AuxInt - s := x0.Aux - mem := x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x0_0, x0_1 = _i1+1, x0_1, x0_0 { - p := x0_0 - idx := x0_1 - sh := v_1 - if sh.Op != OpS390XSLDconst || sh.AuxInt != 32 { - continue - } - r1 := sh.Args[0] - if r1.Op != OpS390XMOVWZreg { - continue - } - x1 := r1.Args[0] - if x1.Op != OpS390XMOVWBRloadidx { - continue - } - i1 := x1.AuxInt - if x1.Aux != s { - continue - } - _ = x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i2 := 0; _i2 <= 1; _i2, x1_0, x1_1 = _i2+1, x1_1, x1_0 { - if p != x1_0 || idx != x1_1 || mem != x1.Args[2] || !(i1 == i0+4 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, r0, r1, sh)) { - continue - } - b = mergePoint(b, x0, x1) - v0 := b.NewValue0(v.Pos, OpS390XMOVDBRloadidx, typ.Int64) - v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s - v0.AddArg3(p, idx, mem) - return true - } - } - } - break - } - // match: (OR s1:(SLDconst [j1] x1:(MOVBZloadidx [i1] {s} p idx mem)) or:(OR s0:(SLDconst [j0] x0:(MOVBZloadidx [i0] {s} p idx mem)) y)) - // cond: p.Op != OpSB && i1 == i0+1 && j1 == j0+8 && j0 % 16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b,x0,x1,y) != nil && clobber(x0, x1, s0, s1, or) - // result: @mergePoint(b,x0,x1,y) (OR <v.Type> (SLDconst <v.Type> [j0] (MOVHZreg (MOVHBRloadidx [i0] {s} p idx mem))) y) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - s1 := v_0 - if s1.Op != OpS390XSLDconst { - continue - } - j1 := s1.AuxInt - x1 := s1.Args[0] - if x1.Op != OpS390XMOVBZloadidx { - continue - } - i1 := x1.AuxInt - s := x1.Aux - mem := x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x1_0, x1_1 = _i1+1, x1_1, x1_0 { - p := x1_0 - idx := x1_1 - or := v_1 - if or.Op != OpS390XOR { - continue - } - _ = or.Args[1] - or_0 := or.Args[0] - or_1 := or.Args[1] - for _i2 := 0; _i2 <= 1; _i2, or_0, or_1 = _i2+1, or_1, or_0 { - s0 := or_0 - if s0.Op != OpS390XSLDconst { - continue - } - j0 := s0.AuxInt - x0 := s0.Args[0] - if x0.Op != OpS390XMOVBZloadidx { - continue - } - i0 := x0.AuxInt - if x0.Aux != s { - continue - } - _ = x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i3 := 0; _i3 <= 1; _i3, x0_0, x0_1 = _i3+1, x0_1, x0_0 { - if p != x0_0 || idx != x0_1 || mem != x0.Args[2] { - continue - } - y := or_1 - if !(p.Op != OpSB && i1 == i0+1 && j1 == j0+8 && j0%16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b, x0, x1, y) != nil && clobber(x0, x1, s0, s1, or)) { - continue - } - b = mergePoint(b, x0, x1, y) - v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type) - v.copyOf(v0) - v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type) - v1.AuxInt = j0 - v2 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) - v3 := b.NewValue0(v.Pos, OpS390XMOVHBRloadidx, typ.Int16) - v3.AuxInt = i0 - v3.Aux = s - v3.AddArg3(p, idx, mem) - v2.AddArg(v3) - v1.AddArg(v2) - v0.AddArg2(v1, y) - return true - } - } - } - } - break - } - // match: (OR s1:(SLDconst [j1] r1:(MOVHZreg x1:(MOVHBRloadidx [i1] {s} p idx mem))) or:(OR s0:(SLDconst [j0] r0:(MOVHZreg x0:(MOVHBRloadidx [i0] {s} p idx mem))) y)) - // cond: i1 == i0+2 && j1 == j0+16 && j0 % 32 == 0 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b,x0,x1,y) != nil && clobber(x0, x1, r0, r1, s0, s1, or) - // result: @mergePoint(b,x0,x1,y) (OR <v.Type> (SLDconst <v.Type> [j0] (MOVWZreg (MOVWBRloadidx [i0] {s} p idx mem))) y) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - s1 := v_0 - if s1.Op != OpS390XSLDconst { - continue - } - j1 := s1.AuxInt - r1 := s1.Args[0] - if r1.Op != OpS390XMOVHZreg { - continue - } - x1 := r1.Args[0] - if x1.Op != OpS390XMOVHBRloadidx { - continue - } - i1 := x1.AuxInt - s := x1.Aux - mem := x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x1_0, x1_1 = _i1+1, x1_1, x1_0 { - p := x1_0 - idx := x1_1 - or := v_1 - if or.Op != OpS390XOR { - continue - } - _ = or.Args[1] - or_0 := or.Args[0] - or_1 := or.Args[1] - for _i2 := 0; _i2 <= 1; _i2, or_0, or_1 = _i2+1, or_1, or_0 { - s0 := or_0 - if s0.Op != OpS390XSLDconst { - continue - } - j0 := s0.AuxInt - r0 := s0.Args[0] - if r0.Op != OpS390XMOVHZreg { - continue - } - x0 := r0.Args[0] - if x0.Op != OpS390XMOVHBRloadidx { - continue - } - i0 := x0.AuxInt - if x0.Aux != s { - continue - } - _ = x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i3 := 0; _i3 <= 1; _i3, x0_0, x0_1 = _i3+1, x0_1, x0_0 { - if p != x0_0 || idx != x0_1 || mem != x0.Args[2] { - continue - } - y := or_1 - if !(i1 == i0+2 && j1 == j0+16 && j0%32 == 0 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b, x0, x1, y) != nil && clobber(x0, x1, r0, r1, s0, s1, or)) { - continue - } - b = mergePoint(b, x0, x1, y) - v0 := b.NewValue0(v.Pos, OpS390XOR, v.Type) - v.copyOf(v0) - v1 := b.NewValue0(v.Pos, OpS390XSLDconst, v.Type) - v1.AuxInt = j0 - v2 := b.NewValue0(v.Pos, OpS390XMOVWZreg, typ.UInt64) - v3 := b.NewValue0(v.Pos, OpS390XMOVWBRloadidx, typ.Int32) - v3.AuxInt = i0 - v3.Aux = s - v3.AddArg3(p, idx, mem) - v2.AddArg(v3) - v1.AddArg(v2) - v0.AddArg2(v1, y) - return true - } - } - } - } - break - } return false } func rewriteValueS390X_OpS390XORW(v *Value) bool { @@ -15679,16 +12373,16 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { b := v.Block typ := &b.Func.Config.Types // match: (ORW x (MOVDconst [c])) - // result: (ORWconst [int64(int32(c))] x) + // result: (ORWconst [int32(c)] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { x := v_0 if v_1.Op != OpS390XMOVDconst { continue } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XORWconst) - v.AuxInt = int64(int32(c)) + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } @@ -15729,7 +12423,7 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { return true } // match: (ORW <t> x g:(MOVWload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (ORWload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -15739,24 +12433,24 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { if g.Op != OpS390XMOVWload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XORWload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } break } // match: (ORW <t> x g:(MOVWZload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (ORWload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -15766,17 +12460,17 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { if g.Op != OpS390XMOVWZload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XORWload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } @@ -15791,20 +12485,20 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { if x1.Op != OpS390XMOVBZload { continue } - i1 := x1.AuxInt - s := x1.Aux + i1 := auxIntToInt32(x1.AuxInt) + s := auxToSym(x1.Aux) mem := x1.Args[1] p := x1.Args[0] sh := v_1 - if sh.Op != OpS390XSLWconst || sh.AuxInt != 8 { + if sh.Op != OpS390XSLWconst || auxIntToInt8(sh.AuxInt) != 8 { continue } x0 := sh.Args[0] if x0.Op != OpS390XMOVBZload { continue } - i0 := x0.AuxInt - if x0.Aux != s { + i0 := auxIntToInt32(x0.AuxInt) + if auxToSym(x0.Aux) != s { continue } _ = x0.Args[1] @@ -15814,8 +12508,8 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { b = mergePoint(b, x0, x1) v0 := b.NewValue0(x0.Pos, OpS390XMOVHZload, typ.UInt16) v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s + v0.AuxInt = int32ToAuxInt(i0) + v0.Aux = symToAux(s) v0.AddArg2(p, mem) return true } @@ -15830,20 +12524,20 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { if x1.Op != OpS390XMOVHZload { continue } - i1 := x1.AuxInt - s := x1.Aux + i1 := auxIntToInt32(x1.AuxInt) + s := auxToSym(x1.Aux) mem := x1.Args[1] p := x1.Args[0] sh := v_1 - if sh.Op != OpS390XSLWconst || sh.AuxInt != 16 { + if sh.Op != OpS390XSLWconst || auxIntToInt8(sh.AuxInt) != 16 { continue } x0 := sh.Args[0] if x0.Op != OpS390XMOVHZload { continue } - i0 := x0.AuxInt - if x0.Aux != s { + i0 := auxIntToInt32(x0.AuxInt) + if auxToSym(x0.Aux) != s { continue } _ = x0.Args[1] @@ -15853,8 +12547,8 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { b = mergePoint(b, x0, x1) v0 := b.NewValue0(x0.Pos, OpS390XMOVWZload, typ.UInt32) v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s + v0.AuxInt = int32ToAuxInt(i0) + v0.Aux = symToAux(s) v0.AddArg2(p, mem) return true } @@ -15869,13 +12563,13 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { if s0.Op != OpS390XSLWconst { continue } - j0 := s0.AuxInt + j0 := auxIntToInt8(s0.AuxInt) x0 := s0.Args[0] if x0.Op != OpS390XMOVBZload { continue } - i0 := x0.AuxInt - s := x0.Aux + i0 := auxIntToInt32(x0.AuxInt) + s := auxToSym(x0.Aux) mem := x0.Args[1] p := x0.Args[0] or := v_1 @@ -15890,13 +12584,13 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { if s1.Op != OpS390XSLWconst { continue } - j1 := s1.AuxInt + j1 := auxIntToInt8(s1.AuxInt) x1 := s1.Args[0] if x1.Op != OpS390XMOVBZload { continue } - i1 := x1.AuxInt - if x1.Aux != s { + i1 := auxIntToInt32(x1.AuxInt) + if auxToSym(x1.Aux) != s { continue } _ = x1.Args[1] @@ -15911,10 +12605,10 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { v0 := b.NewValue0(x1.Pos, OpS390XORW, v.Type) v.copyOf(v0) v1 := b.NewValue0(x1.Pos, OpS390XSLWconst, v.Type) - v1.AuxInt = j1 + v1.AuxInt = int8ToAuxInt(j1) v2 := b.NewValue0(x1.Pos, OpS390XMOVHZload, typ.UInt16) - v2.AuxInt = i0 - v2.Aux = s + v2.AuxInt = int32ToAuxInt(i0) + v2.Aux = symToAux(s) v2.AddArg2(p, mem) v1.AddArg(v2) v0.AddArg2(v1, y) @@ -15923,174 +12617,6 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { } break } - // match: (ORW x1:(MOVBZloadidx [i1] {s} p idx mem) sh:(SLWconst [8] x0:(MOVBZloadidx [i0] {s} p idx mem))) - // cond: i1 == i0+1 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) - // result: @mergePoint(b,x0,x1) (MOVHZloadidx [i0] {s} p idx mem) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - x1 := v_0 - if x1.Op != OpS390XMOVBZloadidx { - continue - } - i1 := x1.AuxInt - s := x1.Aux - mem := x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x1_0, x1_1 = _i1+1, x1_1, x1_0 { - p := x1_0 - idx := x1_1 - sh := v_1 - if sh.Op != OpS390XSLWconst || sh.AuxInt != 8 { - continue - } - x0 := sh.Args[0] - if x0.Op != OpS390XMOVBZloadidx { - continue - } - i0 := x0.AuxInt - if x0.Aux != s { - continue - } - _ = x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i2 := 0; _i2 <= 1; _i2, x0_0, x0_1 = _i2+1, x0_1, x0_0 { - if p != x0_0 || idx != x0_1 || mem != x0.Args[2] || !(i1 == i0+1 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { - continue - } - b = mergePoint(b, x0, x1) - v0 := b.NewValue0(v.Pos, OpS390XMOVHZloadidx, typ.UInt16) - v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s - v0.AddArg3(p, idx, mem) - return true - } - } - } - break - } - // match: (ORW x1:(MOVHZloadidx [i1] {s} p idx mem) sh:(SLWconst [16] x0:(MOVHZloadidx [i0] {s} p idx mem))) - // cond: i1 == i0+2 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) - // result: @mergePoint(b,x0,x1) (MOVWZloadidx [i0] {s} p idx mem) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - x1 := v_0 - if x1.Op != OpS390XMOVHZloadidx { - continue - } - i1 := x1.AuxInt - s := x1.Aux - mem := x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x1_0, x1_1 = _i1+1, x1_1, x1_0 { - p := x1_0 - idx := x1_1 - sh := v_1 - if sh.Op != OpS390XSLWconst || sh.AuxInt != 16 { - continue - } - x0 := sh.Args[0] - if x0.Op != OpS390XMOVHZloadidx { - continue - } - i0 := x0.AuxInt - if x0.Aux != s { - continue - } - _ = x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i2 := 0; _i2 <= 1; _i2, x0_0, x0_1 = _i2+1, x0_1, x0_0 { - if p != x0_0 || idx != x0_1 || mem != x0.Args[2] || !(i1 == i0+2 && p.Op != OpSB && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { - continue - } - b = mergePoint(b, x0, x1) - v0 := b.NewValue0(v.Pos, OpS390XMOVWZloadidx, typ.UInt32) - v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s - v0.AddArg3(p, idx, mem) - return true - } - } - } - break - } - // match: (ORW s0:(SLWconst [j0] x0:(MOVBZloadidx [i0] {s} p idx mem)) or:(ORW s1:(SLWconst [j1] x1:(MOVBZloadidx [i1] {s} p idx mem)) y)) - // cond: i1 == i0+1 && j1 == j0-8 && j1 % 16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b,x0,x1,y) != nil && clobber(x0, x1, s0, s1, or) - // result: @mergePoint(b,x0,x1,y) (ORW <v.Type> (SLWconst <v.Type> [j1] (MOVHZloadidx [i0] {s} p idx mem)) y) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - s0 := v_0 - if s0.Op != OpS390XSLWconst { - continue - } - j0 := s0.AuxInt - x0 := s0.Args[0] - if x0.Op != OpS390XMOVBZloadidx { - continue - } - i0 := x0.AuxInt - s := x0.Aux - mem := x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x0_0, x0_1 = _i1+1, x0_1, x0_0 { - p := x0_0 - idx := x0_1 - or := v_1 - if or.Op != OpS390XORW { - continue - } - _ = or.Args[1] - or_0 := or.Args[0] - or_1 := or.Args[1] - for _i2 := 0; _i2 <= 1; _i2, or_0, or_1 = _i2+1, or_1, or_0 { - s1 := or_0 - if s1.Op != OpS390XSLWconst { - continue - } - j1 := s1.AuxInt - x1 := s1.Args[0] - if x1.Op != OpS390XMOVBZloadidx { - continue - } - i1 := x1.AuxInt - if x1.Aux != s { - continue - } - _ = x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i3 := 0; _i3 <= 1; _i3, x1_0, x1_1 = _i3+1, x1_1, x1_0 { - if p != x1_0 || idx != x1_1 || mem != x1.Args[2] { - continue - } - y := or_1 - if !(i1 == i0+1 && j1 == j0-8 && j1%16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b, x0, x1, y) != nil && clobber(x0, x1, s0, s1, or)) { - continue - } - b = mergePoint(b, x0, x1, y) - v0 := b.NewValue0(v.Pos, OpS390XORW, v.Type) - v.copyOf(v0) - v1 := b.NewValue0(v.Pos, OpS390XSLWconst, v.Type) - v1.AuxInt = j1 - v2 := b.NewValue0(v.Pos, OpS390XMOVHZloadidx, typ.UInt16) - v2.AuxInt = i0 - v2.Aux = s - v2.AddArg3(p, idx, mem) - v1.AddArg(v2) - v0.AddArg2(v1, y) - return true - } - } - } - } - break - } // match: (ORW x0:(MOVBZload [i0] {s} p mem) sh:(SLWconst [8] x1:(MOVBZload [i1] {s} p mem))) // cond: p.Op != OpSB && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) // result: @mergePoint(b,x0,x1) (MOVHZreg (MOVHBRload [i0] {s} p mem)) @@ -16100,20 +12626,20 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { if x0.Op != OpS390XMOVBZload { continue } - i0 := x0.AuxInt - s := x0.Aux + i0 := auxIntToInt32(x0.AuxInt) + s := auxToSym(x0.Aux) mem := x0.Args[1] p := x0.Args[0] sh := v_1 - if sh.Op != OpS390XSLWconst || sh.AuxInt != 8 { + if sh.Op != OpS390XSLWconst || auxIntToInt8(sh.AuxInt) != 8 { continue } x1 := sh.Args[0] if x1.Op != OpS390XMOVBZload { continue } - i1 := x1.AuxInt - if x1.Aux != s { + i1 := auxIntToInt32(x1.AuxInt) + if auxToSym(x1.Aux) != s { continue } _ = x1.Args[1] @@ -16124,8 +12650,8 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { v0 := b.NewValue0(x1.Pos, OpS390XMOVHZreg, typ.UInt64) v.copyOf(v0) v1 := b.NewValue0(x1.Pos, OpS390XMOVHBRload, typ.UInt16) - v1.AuxInt = i0 - v1.Aux = s + v1.AuxInt = int32ToAuxInt(i0) + v1.Aux = symToAux(s) v1.AddArg2(p, mem) v0.AddArg(v1) return true @@ -16145,12 +12671,12 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { if x0.Op != OpS390XMOVHBRload { continue } - i0 := x0.AuxInt - s := x0.Aux + i0 := auxIntToInt32(x0.AuxInt) + s := auxToSym(x0.Aux) mem := x0.Args[1] p := x0.Args[0] sh := v_1 - if sh.Op != OpS390XSLWconst || sh.AuxInt != 16 { + if sh.Op != OpS390XSLWconst || auxIntToInt8(sh.AuxInt) != 16 { continue } r1 := sh.Args[0] @@ -16161,8 +12687,8 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { if x1.Op != OpS390XMOVHBRload { continue } - i1 := x1.AuxInt - if x1.Aux != s { + i1 := auxIntToInt32(x1.AuxInt) + if auxToSym(x1.Aux) != s { continue } _ = x1.Args[1] @@ -16172,8 +12698,8 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { b = mergePoint(b, x0, x1) v0 := b.NewValue0(x1.Pos, OpS390XMOVWBRload, typ.UInt32) v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s + v0.AuxInt = int32ToAuxInt(i0) + v0.Aux = symToAux(s) v0.AddArg2(p, mem) return true } @@ -16188,13 +12714,13 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { if s1.Op != OpS390XSLWconst { continue } - j1 := s1.AuxInt + j1 := auxIntToInt8(s1.AuxInt) x1 := s1.Args[0] if x1.Op != OpS390XMOVBZload { continue } - i1 := x1.AuxInt - s := x1.Aux + i1 := auxIntToInt32(x1.AuxInt) + s := auxToSym(x1.Aux) mem := x1.Args[1] p := x1.Args[0] or := v_1 @@ -16209,13 +12735,13 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { if s0.Op != OpS390XSLWconst { continue } - j0 := s0.AuxInt + j0 := auxIntToInt8(s0.AuxInt) x0 := s0.Args[0] if x0.Op != OpS390XMOVBZload { continue } - i0 := x0.AuxInt - if x0.Aux != s { + i0 := auxIntToInt32(x0.AuxInt) + if auxToSym(x0.Aux) != s { continue } _ = x0.Args[1] @@ -16230,11 +12756,11 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { v0 := b.NewValue0(x0.Pos, OpS390XORW, v.Type) v.copyOf(v0) v1 := b.NewValue0(x0.Pos, OpS390XSLWconst, v.Type) - v1.AuxInt = j0 + v1.AuxInt = int8ToAuxInt(j0) v2 := b.NewValue0(x0.Pos, OpS390XMOVHZreg, typ.UInt64) v3 := b.NewValue0(x0.Pos, OpS390XMOVHBRload, typ.UInt16) - v3.AuxInt = i0 - v3.Aux = s + v3.AuxInt = int32ToAuxInt(i0) + v3.Aux = symToAux(s) v3.AddArg2(p, mem) v2.AddArg(v3) v1.AddArg(v2) @@ -16244,186 +12770,6 @@ func rewriteValueS390X_OpS390XORW(v *Value) bool { } break } - // match: (ORW x0:(MOVBZloadidx [i0] {s} p idx mem) sh:(SLWconst [8] x1:(MOVBZloadidx [i1] {s} p idx mem))) - // cond: p.Op != OpSB && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, sh) - // result: @mergePoint(b,x0,x1) (MOVHZreg (MOVHBRloadidx [i0] {s} p idx mem)) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - x0 := v_0 - if x0.Op != OpS390XMOVBZloadidx { - continue - } - i0 := x0.AuxInt - s := x0.Aux - mem := x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x0_0, x0_1 = _i1+1, x0_1, x0_0 { - p := x0_0 - idx := x0_1 - sh := v_1 - if sh.Op != OpS390XSLWconst || sh.AuxInt != 8 { - continue - } - x1 := sh.Args[0] - if x1.Op != OpS390XMOVBZloadidx { - continue - } - i1 := x1.AuxInt - if x1.Aux != s { - continue - } - _ = x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i2 := 0; _i2 <= 1; _i2, x1_0, x1_1 = _i2+1, x1_1, x1_0 { - if p != x1_0 || idx != x1_1 || mem != x1.Args[2] || !(p.Op != OpSB && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, sh)) { - continue - } - b = mergePoint(b, x0, x1) - v0 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) - v.copyOf(v0) - v1 := b.NewValue0(v.Pos, OpS390XMOVHBRloadidx, typ.Int16) - v1.AuxInt = i0 - v1.Aux = s - v1.AddArg3(p, idx, mem) - v0.AddArg(v1) - return true - } - } - } - break - } - // match: (ORW r0:(MOVHZreg x0:(MOVHBRloadidx [i0] {s} p idx mem)) sh:(SLWconst [16] r1:(MOVHZreg x1:(MOVHBRloadidx [i1] {s} p idx mem)))) - // cond: i1 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && sh.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, r0, r1, sh) - // result: @mergePoint(b,x0,x1) (MOVWBRloadidx [i0] {s} p idx mem) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - r0 := v_0 - if r0.Op != OpS390XMOVHZreg { - continue - } - x0 := r0.Args[0] - if x0.Op != OpS390XMOVHBRloadidx { - continue - } - i0 := x0.AuxInt - s := x0.Aux - mem := x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x0_0, x0_1 = _i1+1, x0_1, x0_0 { - p := x0_0 - idx := x0_1 - sh := v_1 - if sh.Op != OpS390XSLWconst || sh.AuxInt != 16 { - continue - } - r1 := sh.Args[0] - if r1.Op != OpS390XMOVHZreg { - continue - } - x1 := r1.Args[0] - if x1.Op != OpS390XMOVHBRloadidx { - continue - } - i1 := x1.AuxInt - if x1.Aux != s { - continue - } - _ = x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i2 := 0; _i2 <= 1; _i2, x1_0, x1_1 = _i2+1, x1_1, x1_0 { - if p != x1_0 || idx != x1_1 || mem != x1.Args[2] || !(i1 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && r0.Uses == 1 && r1.Uses == 1 && sh.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, r0, r1, sh)) { - continue - } - b = mergePoint(b, x0, x1) - v0 := b.NewValue0(v.Pos, OpS390XMOVWBRloadidx, typ.Int32) - v.copyOf(v0) - v0.AuxInt = i0 - v0.Aux = s - v0.AddArg3(p, idx, mem) - return true - } - } - } - break - } - // match: (ORW s1:(SLWconst [j1] x1:(MOVBZloadidx [i1] {s} p idx mem)) or:(ORW s0:(SLWconst [j0] x0:(MOVBZloadidx [i0] {s} p idx mem)) y)) - // cond: p.Op != OpSB && i1 == i0+1 && j1 == j0+8 && j0 % 16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b,x0,x1,y) != nil && clobber(x0, x1, s0, s1, or) - // result: @mergePoint(b,x0,x1,y) (ORW <v.Type> (SLWconst <v.Type> [j0] (MOVHZreg (MOVHBRloadidx [i0] {s} p idx mem))) y) - for { - for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { - s1 := v_0 - if s1.Op != OpS390XSLWconst { - continue - } - j1 := s1.AuxInt - x1 := s1.Args[0] - if x1.Op != OpS390XMOVBZloadidx { - continue - } - i1 := x1.AuxInt - s := x1.Aux - mem := x1.Args[2] - x1_0 := x1.Args[0] - x1_1 := x1.Args[1] - for _i1 := 0; _i1 <= 1; _i1, x1_0, x1_1 = _i1+1, x1_1, x1_0 { - p := x1_0 - idx := x1_1 - or := v_1 - if or.Op != OpS390XORW { - continue - } - _ = or.Args[1] - or_0 := or.Args[0] - or_1 := or.Args[1] - for _i2 := 0; _i2 <= 1; _i2, or_0, or_1 = _i2+1, or_1, or_0 { - s0 := or_0 - if s0.Op != OpS390XSLWconst { - continue - } - j0 := s0.AuxInt - x0 := s0.Args[0] - if x0.Op != OpS390XMOVBZloadidx { - continue - } - i0 := x0.AuxInt - if x0.Aux != s { - continue - } - _ = x0.Args[2] - x0_0 := x0.Args[0] - x0_1 := x0.Args[1] - for _i3 := 0; _i3 <= 1; _i3, x0_0, x0_1 = _i3+1, x0_1, x0_0 { - if p != x0_0 || idx != x0_1 || mem != x0.Args[2] { - continue - } - y := or_1 - if !(p.Op != OpSB && i1 == i0+1 && j1 == j0+8 && j0%16 == 0 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && or.Uses == 1 && mergePoint(b, x0, x1, y) != nil && clobber(x0, x1, s0, s1, or)) { - continue - } - b = mergePoint(b, x0, x1, y) - v0 := b.NewValue0(v.Pos, OpS390XORW, v.Type) - v.copyOf(v0) - v1 := b.NewValue0(v.Pos, OpS390XSLWconst, v.Type) - v1.AuxInt = j0 - v2 := b.NewValue0(v.Pos, OpS390XMOVHZreg, typ.UInt64) - v3 := b.NewValue0(v.Pos, OpS390XMOVHBRloadidx, typ.Int16) - v3.AuxInt = i0 - v3.Aux = s - v3.AddArg3(p, idx, mem) - v2.AddArg(v3) - v1.AddArg(v2) - v0.AddArg2(v1, y) - return true - } - } - } - } - break - } return false } func rewriteValueS390X_OpS390XORWconst(v *Value) bool { @@ -16453,15 +12799,15 @@ func rewriteValueS390X_OpS390XORWconst(v *Value) bool { return true } // match: (ORWconst [c] (MOVDconst [d])) - // result: (MOVDconst [c|d]) + // result: (MOVDconst [int64(c)|d]) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDconst { break } - d := v_0.AuxInt + d := auxIntToInt64(v_0.AuxInt) v.reset(OpS390XMOVDconst) - v.AuxInt = c | d + v.AuxInt = int64ToAuxInt(int64(c) | d) return true } return false @@ -16471,47 +12817,47 @@ func rewriteValueS390X_OpS390XORWload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (ORWload [off1] {sym} x (ADDconst [off2] ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(off1+off2) + // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) // result: (ORWload [off1+off2] {sym} x ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - off2 := v_1.AuxInt + off2 := auxIntToInt32(v_1.AuxInt) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(off1+off2)) { + if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { break } v.reset(OpS390XORWload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (ORWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2) - // result: (ORWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) + // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) + // result: (ORWload [o1+o2] {mergeSymTyped(s1, s2)} x ptr mem) for { - o1 := v.AuxInt - s1 := v.Aux + o1 := auxIntToInt32(v.AuxInt) + s1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - o2 := v_1.AuxInt - s2 := v_1.Aux + o2 := auxIntToInt32(v_1.AuxInt) + s2 := auxToSym(v_1.Aux) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2)) { + if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { break } v.reset(OpS390XORWload) - v.AuxInt = o1 + o2 - v.Aux = mergeSym(s1, s2) + v.AuxInt = int32ToAuxInt(o1 + o2) + v.Aux = symToAux(mergeSymTyped(s1, s2)) v.AddArg3(x, ptr, mem) return true } @@ -16582,47 +12928,47 @@ func rewriteValueS390X_OpS390XORload(v *Value) bool { return true } // match: (ORload [off1] {sym} x (ADDconst [off2] ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(off1+off2) + // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) // result: (ORload [off1+off2] {sym} x ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - off2 := v_1.AuxInt + off2 := auxIntToInt32(v_1.AuxInt) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(off1+off2)) { + if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { break } v.reset(OpS390XORload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (ORload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2) - // result: (ORload [o1+o2] {mergeSym(s1, s2)} x ptr mem) + // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) + // result: (ORload [o1+o2] {mergeSymTyped(s1, s2)} x ptr mem) for { - o1 := v.AuxInt - s1 := v.Aux + o1 := auxIntToInt32(v.AuxInt) + s1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - o2 := v_1.AuxInt - s2 := v_1.Aux + o2 := auxIntToInt32(v_1.AuxInt) + s2 := auxToSym(v_1.Aux) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2)) { + if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { break } v.reset(OpS390XORload) - v.AuxInt = o1 + o2 - v.Aux = mergeSym(s1, s2) + v.AuxInt = int32ToAuxInt(o1 + o2) + v.Aux = symToAux(mergeSymTyped(s1, s2)) v.AddArg3(x, ptr, mem) return true } @@ -16632,15 +12978,15 @@ func rewriteValueS390X_OpS390XRLL(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (RLL x (MOVDconst [c])) - // result: (RLLconst x [c&31]) + // result: (RLLconst x [int8(c&31)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XRLLconst) - v.AuxInt = c & 31 + v.AuxInt = int8ToAuxInt(int8(c & 31)) v.AddArg(x) return true } @@ -16650,15 +12996,15 @@ func rewriteValueS390X_OpS390XRLLG(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (RLLG x (MOVDconst [c])) - // result: (RLLGconst x [c&63]) + // result: (RLLGconst x [int8(c&63)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XRLLGconst) - v.AuxInt = c & 63 + v.AuxInt = int8ToAuxInt(int8(c & 63)) v.AddArg(x) return true } @@ -16670,20 +13016,20 @@ func rewriteValueS390X_OpS390XSLD(v *Value) bool { b := v.Block typ := &b.Func.Config.Types // match: (SLD x (MOVDconst [c])) - // result: (SLDconst x [c&63]) + // result: (SLDconst x [int8(c&63)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XSLDconst) - v.AuxInt = c & 63 + v.AuxInt = int8ToAuxInt(int8(c & 63)) v.AddArg(x) return true } // match: (SLD x (AND (MOVDconst [c]) y)) - // result: (SLD x (ANDWconst <typ.UInt32> [c&63] y)) + // result: (SLD x (ANDWconst <typ.UInt32> [int32(c&63)] y)) for { x := v_0 if v_1.Op != OpS390XAND { @@ -16696,11 +13042,11 @@ func rewriteValueS390X_OpS390XSLD(v *Value) bool { if v_1_0.Op != OpS390XMOVDconst { continue } - c := v_1_0.AuxInt + c := auxIntToInt64(v_1_0.AuxInt) y := v_1_1 v.reset(OpS390XSLD) v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) - v0.AuxInt = c & 63 + v0.AuxInt = int32ToAuxInt(int32(c & 63)) v0.AddArg(y) v.AddArg2(x, v0) return true @@ -16818,20 +13164,20 @@ func rewriteValueS390X_OpS390XSLW(v *Value) bool { b := v.Block typ := &b.Func.Config.Types // match: (SLW x (MOVDconst [c])) - // result: (SLWconst x [c&63]) + // result: (SLWconst x [int8(c&63)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XSLWconst) - v.AuxInt = c & 63 + v.AuxInt = int8ToAuxInt(int8(c & 63)) v.AddArg(x) return true } // match: (SLW x (AND (MOVDconst [c]) y)) - // result: (SLW x (ANDWconst <typ.UInt32> [c&63] y)) + // result: (SLW x (ANDWconst <typ.UInt32> [int32(c&63)] y)) for { x := v_0 if v_1.Op != OpS390XAND { @@ -16844,11 +13190,11 @@ func rewriteValueS390X_OpS390XSLW(v *Value) bool { if v_1_0.Op != OpS390XMOVDconst { continue } - c := v_1_0.AuxInt + c := auxIntToInt64(v_1_0.AuxInt) y := v_1_1 v.reset(OpS390XSLW) v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) - v0.AuxInt = c & 63 + v0.AuxInt = int32ToAuxInt(int32(c & 63)) v0.AddArg(y) v.AddArg2(x, v0) return true @@ -16966,20 +13312,20 @@ func rewriteValueS390X_OpS390XSRAD(v *Value) bool { b := v.Block typ := &b.Func.Config.Types // match: (SRAD x (MOVDconst [c])) - // result: (SRADconst x [c&63]) + // result: (SRADconst x [int8(c&63)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XSRADconst) - v.AuxInt = c & 63 + v.AuxInt = int8ToAuxInt(int8(c & 63)) v.AddArg(x) return true } // match: (SRAD x (AND (MOVDconst [c]) y)) - // result: (SRAD x (ANDWconst <typ.UInt32> [c&63] y)) + // result: (SRAD x (ANDWconst <typ.UInt32> [int32(c&63)] y)) for { x := v_0 if v_1.Op != OpS390XAND { @@ -16992,11 +13338,11 @@ func rewriteValueS390X_OpS390XSRAD(v *Value) bool { if v_1_0.Op != OpS390XMOVDconst { continue } - c := v_1_0.AuxInt + c := auxIntToInt64(v_1_0.AuxInt) y := v_1_1 v.reset(OpS390XSRAD) v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) - v0.AuxInt = c & 63 + v0.AuxInt = int32ToAuxInt(int32(c & 63)) v0.AddArg(y) v.AddArg2(x, v0) return true @@ -17126,20 +13472,20 @@ func rewriteValueS390X_OpS390XSRAW(v *Value) bool { b := v.Block typ := &b.Func.Config.Types // match: (SRAW x (MOVDconst [c])) - // result: (SRAWconst x [c&63]) + // result: (SRAWconst x [int8(c&63)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XSRAWconst) - v.AuxInt = c & 63 + v.AuxInt = int8ToAuxInt(int8(c & 63)) v.AddArg(x) return true } // match: (SRAW x (AND (MOVDconst [c]) y)) - // result: (SRAW x (ANDWconst <typ.UInt32> [c&63] y)) + // result: (SRAW x (ANDWconst <typ.UInt32> [int32(c&63)] y)) for { x := v_0 if v_1.Op != OpS390XAND { @@ -17152,11 +13498,11 @@ func rewriteValueS390X_OpS390XSRAW(v *Value) bool { if v_1_0.Op != OpS390XMOVDconst { continue } - c := v_1_0.AuxInt + c := auxIntToInt64(v_1_0.AuxInt) y := v_1_1 v.reset(OpS390XSRAW) v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) - v0.AuxInt = c & 63 + v0.AuxInt = int32ToAuxInt(int32(c & 63)) v0.AddArg(y) v.AddArg2(x, v0) return true @@ -17286,20 +13632,20 @@ func rewriteValueS390X_OpS390XSRD(v *Value) bool { b := v.Block typ := &b.Func.Config.Types // match: (SRD x (MOVDconst [c])) - // result: (SRDconst x [c&63]) + // result: (SRDconst x [int8(c&63)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XSRDconst) - v.AuxInt = c & 63 + v.AuxInt = int8ToAuxInt(int8(c & 63)) v.AddArg(x) return true } // match: (SRD x (AND (MOVDconst [c]) y)) - // result: (SRD x (ANDWconst <typ.UInt32> [c&63] y)) + // result: (SRD x (ANDWconst <typ.UInt32> [int32(c&63)] y)) for { x := v_0 if v_1.Op != OpS390XAND { @@ -17312,11 +13658,11 @@ func rewriteValueS390X_OpS390XSRD(v *Value) bool { if v_1_0.Op != OpS390XMOVDconst { continue } - c := v_1_0.AuxInt + c := auxIntToInt64(v_1_0.AuxInt) y := v_1_1 v.reset(OpS390XSRD) v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) - v0.AuxInt = c & 63 + v0.AuxInt = int32ToAuxInt(int32(c & 63)) v0.AddArg(y) v.AddArg2(x, v0) return true @@ -17454,20 +13800,20 @@ func rewriteValueS390X_OpS390XSRW(v *Value) bool { b := v.Block typ := &b.Func.Config.Types // match: (SRW x (MOVDconst [c])) - // result: (SRWconst x [c&63]) + // result: (SRWconst x [int8(c&63)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XSRWconst) - v.AuxInt = c & 63 + v.AuxInt = int8ToAuxInt(int8(c & 63)) v.AddArg(x) return true } // match: (SRW x (AND (MOVDconst [c]) y)) - // result: (SRW x (ANDWconst <typ.UInt32> [c&63] y)) + // result: (SRW x (ANDWconst <typ.UInt32> [int32(c&63)] y)) for { x := v_0 if v_1.Op != OpS390XAND { @@ -17480,11 +13826,11 @@ func rewriteValueS390X_OpS390XSRW(v *Value) bool { if v_1_0.Op != OpS390XMOVDconst { continue } - c := v_1_0.AuxInt + c := auxIntToInt64(v_1_0.AuxInt) y := v_1_1 v.reset(OpS390XSRW) v0 := b.NewValue0(v.Pos, OpS390XANDWconst, typ.UInt32) - v0.AuxInt = c & 63 + v0.AuxInt = int32ToAuxInt(int32(c & 63)) v0.AddArg(y) v.AddArg2(x, v0) return true @@ -17602,16 +13948,16 @@ func rewriteValueS390X_OpS390XSTM2(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (STM2 [i] {s} p w2 w3 x:(STM2 [i-8] {s} p w0 w1 mem)) - // cond: x.Uses == 1 && is20Bit(i-8) && clobber(x) + // cond: x.Uses == 1 && is20Bit(int64(i)-8) && clobber(x) // result: (STM4 [i-8] {s} p w0 w1 w2 w3 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w2 := v_1 w3 := v_2 x := v_3 - if x.Op != OpS390XSTM2 || x.AuxInt != i-8 || x.Aux != s { + if x.Op != OpS390XSTM2 || auxIntToInt32(x.AuxInt) != i-8 || auxToSym(x.Aux) != s { break } mem := x.Args[3] @@ -17620,22 +13966,22 @@ func rewriteValueS390X_OpS390XSTM2(v *Value) bool { } w0 := x.Args[1] w1 := x.Args[2] - if !(x.Uses == 1 && is20Bit(i-8) && clobber(x)) { + if !(x.Uses == 1 && is20Bit(int64(i)-8) && clobber(x)) { break } v.reset(OpS390XSTM4) - v.AuxInt = i - 8 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 8) + v.Aux = symToAux(s) v.AddArg6(p, w0, w1, w2, w3, mem) return true } // match: (STM2 [i] {s} p (SRDconst [32] x) x mem) // result: (MOVDstore [i] {s} p x mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 - if v_1.Op != OpS390XSRDconst || v_1.AuxInt != 32 { + if v_1.Op != OpS390XSRDconst || auxIntToInt8(v_1.AuxInt) != 32 { break } x := v_1.Args[0] @@ -17644,8 +13990,8 @@ func rewriteValueS390X_OpS390XSTM2(v *Value) bool { } mem := v_3 v.reset(OpS390XMOVDstore) - v.AuxInt = i - v.Aux = s + v.AuxInt = int32ToAuxInt(i) + v.Aux = symToAux(s) v.AddArg3(p, x, mem) return true } @@ -17657,16 +14003,16 @@ func rewriteValueS390X_OpS390XSTMG2(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (STMG2 [i] {s} p w2 w3 x:(STMG2 [i-16] {s} p w0 w1 mem)) - // cond: x.Uses == 1 && is20Bit(i-16) && clobber(x) + // cond: x.Uses == 1 && is20Bit(int64(i)-16) && clobber(x) // result: (STMG4 [i-16] {s} p w0 w1 w2 w3 mem) for { - i := v.AuxInt - s := v.Aux + i := auxIntToInt32(v.AuxInt) + s := auxToSym(v.Aux) p := v_0 w2 := v_1 w3 := v_2 x := v_3 - if x.Op != OpS390XSTMG2 || x.AuxInt != i-16 || x.Aux != s { + if x.Op != OpS390XSTMG2 || auxIntToInt32(x.AuxInt) != i-16 || auxToSym(x.Aux) != s { break } mem := x.Args[3] @@ -17675,12 +14021,12 @@ func rewriteValueS390X_OpS390XSTMG2(v *Value) bool { } w0 := x.Args[1] w1 := x.Args[2] - if !(x.Uses == 1 && is20Bit(i-16) && clobber(x)) { + if !(x.Uses == 1 && is20Bit(int64(i)-16) && clobber(x)) { break } v.reset(OpS390XSTMG4) - v.AuxInt = i - 16 - v.Aux = s + v.AuxInt = int32ToAuxInt(i - 16) + v.Aux = symToAux(s) v.AddArg6(p, w0, w1, w2, w3, mem) return true } @@ -17692,36 +14038,36 @@ func rewriteValueS390X_OpS390XSUB(v *Value) bool { b := v.Block // match: (SUB x (MOVDconst [c])) // cond: is32Bit(c) - // result: (SUBconst x [c]) + // result: (SUBconst x [int32(c)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(is32Bit(c)) { break } v.reset(OpS390XSUBconst) - v.AuxInt = c + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } // match: (SUB (MOVDconst [c]) x) // cond: is32Bit(c) - // result: (NEG (SUBconst <v.Type> x [c])) + // result: (NEG (SUBconst <v.Type> x [int32(c)])) for { if v_0.Op != OpS390XMOVDconst { break } - c := v_0.AuxInt + c := auxIntToInt64(v_0.AuxInt) x := v_1 if !(is32Bit(c)) { break } v.reset(OpS390XNEG) v0 := b.NewValue0(v.Pos, OpS390XSUBconst, v.Type) - v0.AuxInt = c + v0.AuxInt = int32ToAuxInt(int32(c)) v0.AddArg(x) v.AddArg(v0) return true @@ -17738,7 +14084,7 @@ func rewriteValueS390X_OpS390XSUB(v *Value) bool { return true } // match: (SUB <t> x g:(MOVDload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (SUBload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -17747,17 +14093,17 @@ func rewriteValueS390X_OpS390XSUB(v *Value) bool { if g.Op != OpS390XMOVDload { break } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { break } v.reset(OpS390XSUBload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } @@ -17840,29 +14186,29 @@ func rewriteValueS390X_OpS390XSUBW(v *Value) bool { v_0 := v.Args[0] b := v.Block // match: (SUBW x (MOVDconst [c])) - // result: (SUBWconst x [int64(int32(c))]) + // result: (SUBWconst x [int32(c)]) for { x := v_0 if v_1.Op != OpS390XMOVDconst { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XSUBWconst) - v.AuxInt = int64(int32(c)) + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } // match: (SUBW (MOVDconst [c]) x) - // result: (NEGW (SUBWconst <v.Type> x [int64(int32(c))])) + // result: (NEGW (SUBWconst <v.Type> x [int32(c)])) for { if v_0.Op != OpS390XMOVDconst { break } - c := v_0.AuxInt + c := auxIntToInt64(v_0.AuxInt) x := v_1 v.reset(OpS390XNEGW) v0 := b.NewValue0(v.Pos, OpS390XSUBWconst, v.Type) - v0.AuxInt = int64(int32(c)) + v0.AuxInt = int32ToAuxInt(int32(c)) v0.AddArg(x) v.AddArg(v0) return true @@ -17879,7 +14225,7 @@ func rewriteValueS390X_OpS390XSUBW(v *Value) bool { return true } // match: (SUBW <t> x g:(MOVWload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (SUBWload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -17888,22 +14234,22 @@ func rewriteValueS390X_OpS390XSUBW(v *Value) bool { if g.Op != OpS390XMOVWload { break } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { break } v.reset(OpS390XSUBWload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (SUBW <t> x g:(MOVWZload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (SUBWload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -17912,17 +14258,17 @@ func rewriteValueS390X_OpS390XSUBW(v *Value) bool { if g.Op != OpS390XMOVWZload { break } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { break } v.reset(OpS390XSUBWload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } @@ -17943,12 +14289,12 @@ func rewriteValueS390X_OpS390XSUBWconst(v *Value) bool { return true } // match: (SUBWconst [c] x) - // result: (ADDWconst [int64(int32(-c))] x) + // result: (ADDWconst [-int32(c)] x) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) x := v_0 v.reset(OpS390XADDWconst) - v.AuxInt = int64(int32(-c)) + v.AuxInt = int32ToAuxInt(-int32(c)) v.AddArg(x) return true } @@ -17958,47 +14304,47 @@ func rewriteValueS390X_OpS390XSUBWload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (SUBWload [off1] {sym} x (ADDconst [off2] ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(off1+off2) + // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) // result: (SUBWload [off1+off2] {sym} x ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - off2 := v_1.AuxInt + off2 := auxIntToInt32(v_1.AuxInt) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(off1+off2)) { + if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { break } v.reset(OpS390XSUBWload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (SUBWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2) - // result: (SUBWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) + // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) + // result: (SUBWload [o1+o2] {mergeSymTyped(s1, s2)} x ptr mem) for { - o1 := v.AuxInt - s1 := v.Aux + o1 := auxIntToInt32(v.AuxInt) + s1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - o2 := v_1.AuxInt - s2 := v_1.Aux + o2 := auxIntToInt32(v_1.AuxInt) + s2 := auxToSym(v_1.Aux) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2)) { + if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { break } v.reset(OpS390XSUBWload) - v.AuxInt = o1 + o2 - v.Aux = mergeSym(s1, s2) + v.AuxInt = int32ToAuxInt(o1 + o2) + v.Aux = symToAux(mergeSymTyped(s1, s2)) v.AddArg3(x, ptr, mem) return true } @@ -18031,32 +14377,32 @@ func rewriteValueS390X_OpS390XSUBconst(v *Value) bool { return true } // match: (SUBconst (MOVDconst [d]) [c]) - // result: (MOVDconst [d-c]) + // result: (MOVDconst [d-int64(c)]) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDconst { break } - d := v_0.AuxInt + d := auxIntToInt64(v_0.AuxInt) v.reset(OpS390XMOVDconst) - v.AuxInt = d - c + v.AuxInt = int64ToAuxInt(d - int64(c)) return true } // match: (SUBconst (SUBconst x [d]) [c]) - // cond: is32Bit(-c-d) + // cond: is32Bit(-int64(c)-int64(d)) // result: (ADDconst [-c-d] x) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XSUBconst { break } - d := v_0.AuxInt + d := auxIntToInt32(v_0.AuxInt) x := v_0.Args[0] - if !(is32Bit(-c - d)) { + if !(is32Bit(-int64(c) - int64(d))) { break } v.reset(OpS390XADDconst) - v.AuxInt = -c - d + v.AuxInt = int32ToAuxInt(-c - d) v.AddArg(x) return true } @@ -18091,47 +14437,47 @@ func rewriteValueS390X_OpS390XSUBload(v *Value) bool { return true } // match: (SUBload [off1] {sym} x (ADDconst [off2] ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(off1+off2) + // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) // result: (SUBload [off1+off2] {sym} x ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - off2 := v_1.AuxInt + off2 := auxIntToInt32(v_1.AuxInt) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(off1+off2)) { + if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { break } v.reset(OpS390XSUBload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (SUBload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2) - // result: (SUBload [o1+o2] {mergeSym(s1, s2)} x ptr mem) + // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) + // result: (SUBload [o1+o2] {mergeSymTyped(s1, s2)} x ptr mem) for { - o1 := v.AuxInt - s1 := v.Aux + o1 := auxIntToInt32(v.AuxInt) + s1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - o2 := v_1.AuxInt - s2 := v_1.Aux + o2 := auxIntToInt32(v_1.AuxInt) + s2 := auxToSym(v_1.Aux) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2)) { + if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { break } v.reset(OpS390XSUBload) - v.AuxInt = o1 + o2 - v.Aux = mergeSym(s1, s2) + v.AuxInt = int32ToAuxInt(o1 + o2) + v.Aux = symToAux(mergeSymTyped(s1, s2)) v.AddArg3(x, ptr, mem) return true } @@ -18266,7 +14612,7 @@ func rewriteValueS390X_OpS390XXOR(v *Value) bool { return true } // match: (XOR <t> x g:(MOVDload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (XORload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -18276,17 +14622,17 @@ func rewriteValueS390X_OpS390XXOR(v *Value) bool { if g.Op != OpS390XMOVDload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XXORload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } @@ -18298,16 +14644,16 @@ func rewriteValueS390X_OpS390XXORW(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (XORW x (MOVDconst [c])) - // result: (XORWconst [int64(int32(c))] x) + // result: (XORWconst [int32(c)] x) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { x := v_0 if v_1.Op != OpS390XMOVDconst { continue } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) v.reset(OpS390XXORWconst) - v.AuxInt = int64(int32(c)) + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } @@ -18349,7 +14695,7 @@ func rewriteValueS390X_OpS390XXORW(v *Value) bool { return true } // match: (XORW <t> x g:(MOVWload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (XORWload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -18359,24 +14705,24 @@ func rewriteValueS390X_OpS390XXORW(v *Value) bool { if g.Op != OpS390XMOVWload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XXORWload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } break } // match: (XORW <t> x g:(MOVWZload [off] {sym} ptr mem)) - // cond: ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g) + // cond: ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g) // result: (XORWload <t> [off] {sym} x ptr mem) for { t := v.Type @@ -18386,17 +14732,17 @@ func rewriteValueS390X_OpS390XXORW(v *Value) bool { if g.Op != OpS390XMOVWZload { continue } - off := g.AuxInt - sym := g.Aux + off := auxIntToInt32(g.AuxInt) + sym := auxToSym(g.Aux) mem := g.Args[1] ptr := g.Args[0] - if !(ptr.Op != OpSB && is20Bit(off) && canMergeLoadClobber(v, g, x) && clobber(g)) { + if !(ptr.Op != OpSB && is20Bit(int64(off)) && canMergeLoadClobber(v, g, x) && clobber(g)) { continue } v.reset(OpS390XXORWload) v.Type = t - v.AuxInt = off - v.Aux = sym + v.AuxInt = int32ToAuxInt(off) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } @@ -18419,15 +14765,15 @@ func rewriteValueS390X_OpS390XXORWconst(v *Value) bool { return true } // match: (XORWconst [c] (MOVDconst [d])) - // result: (MOVDconst [c^d]) + // result: (MOVDconst [int64(c)^d]) for { - c := v.AuxInt + c := auxIntToInt32(v.AuxInt) if v_0.Op != OpS390XMOVDconst { break } - d := v_0.AuxInt + d := auxIntToInt64(v_0.AuxInt) v.reset(OpS390XMOVDconst) - v.AuxInt = c ^ d + v.AuxInt = int64ToAuxInt(int64(c) ^ d) return true } return false @@ -18437,47 +14783,47 @@ func rewriteValueS390X_OpS390XXORWload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (XORWload [off1] {sym} x (ADDconst [off2] ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(off1+off2) + // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) // result: (XORWload [off1+off2] {sym} x ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - off2 := v_1.AuxInt + off2 := auxIntToInt32(v_1.AuxInt) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(off1+off2)) { + if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { break } v.reset(OpS390XXORWload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (XORWload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2) - // result: (XORWload [o1+o2] {mergeSym(s1, s2)} x ptr mem) + // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) + // result: (XORWload [o1+o2] {mergeSymTyped(s1, s2)} x ptr mem) for { - o1 := v.AuxInt - s1 := v.Aux + o1 := auxIntToInt32(v.AuxInt) + s1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - o2 := v_1.AuxInt - s2 := v_1.Aux + o2 := auxIntToInt32(v_1.AuxInt) + s2 := auxToSym(v_1.Aux) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2)) { + if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { break } v.reset(OpS390XXORWload) - v.AuxInt = o1 + o2 - v.Aux = mergeSym(s1, s2) + v.AuxInt = int32ToAuxInt(o1 + o2) + v.Aux = symToAux(mergeSymTyped(s1, s2)) v.AddArg3(x, ptr, mem) return true } @@ -18538,47 +14884,47 @@ func rewriteValueS390X_OpS390XXORload(v *Value) bool { return true } // match: (XORload [off1] {sym} x (ADDconst [off2] ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(off1+off2) + // cond: ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2)) // result: (XORload [off1+off2] {sym} x ptr mem) for { - off1 := v.AuxInt - sym := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XADDconst { break } - off2 := v_1.AuxInt + off2 := auxIntToInt32(v_1.AuxInt) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(off1+off2)) { + if !(ptr.Op != OpSB && is20Bit(int64(off1)+int64(off2))) { break } v.reset(OpS390XXORload) - v.AuxInt = off1 + off2 - v.Aux = sym + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(sym) v.AddArg3(x, ptr, mem) return true } // match: (XORload [o1] {s1} x (MOVDaddr [o2] {s2} ptr) mem) - // cond: ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2) - // result: (XORload [o1+o2] {mergeSym(s1, s2)} x ptr mem) + // cond: ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2) + // result: (XORload [o1+o2] {mergeSymTyped(s1, s2)} x ptr mem) for { - o1 := v.AuxInt - s1 := v.Aux + o1 := auxIntToInt32(v.AuxInt) + s1 := auxToSym(v.Aux) x := v_0 if v_1.Op != OpS390XMOVDaddr { break } - o2 := v_1.AuxInt - s2 := v_1.Aux + o2 := auxIntToInt32(v_1.AuxInt) + s2 := auxToSym(v_1.Aux) ptr := v_1.Args[0] mem := v_2 - if !(ptr.Op != OpSB && is20Bit(o1+o2) && canMergeSym(s1, s2)) { + if !(ptr.Op != OpSB && is20Bit(int64(o1)+int64(o2)) && canMergeSym(s1, s2)) { break } v.reset(OpS390XXORload) - v.AuxInt = o1 + o2 - v.Aux = mergeSym(s1, s2) + v.AuxInt = int32ToAuxInt(o1 + o2) + v.Aux = symToAux(mergeSymTyped(s1, s2)) v.AddArg3(x, ptr, mem) return true } @@ -18662,19 +15008,19 @@ func rewriteValueS390X_OpSelect0(v *Value) bool { return true } // match: (Select0 (ADDCconst (MOVDconst [c]) [d])) - // result: (MOVDconst [c+d]) + // result: (MOVDconst [c+int64(d)]) for { if v_0.Op != OpS390XADDCconst { break } - d := v_0.AuxInt + d := auxIntToInt16(v_0.AuxInt) v_0_0 := v_0.Args[0] if v_0_0.Op != OpS390XMOVDconst { break } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) v.reset(OpS390XMOVDconst) - v.AuxInt = c + d + v.AuxInt = int64ToAuxInt(c + int64(d)) return true } // match: (Select0 (SUBC (MOVDconst [c]) (MOVDconst [d]))) @@ -18859,38 +15205,38 @@ func rewriteValueS390X_OpSelect1(v *Value) bool { return true } // match: (Select1 (ADDCconst (MOVDconst [c]) [d])) - // cond: uint64(c+d) >= uint64(c) && c+d == 0 + // cond: uint64(c+int64(d)) >= uint64(c) && c+int64(d) == 0 // result: (FlagEQ) for { if v_0.Op != OpS390XADDCconst { break } - d := v_0.AuxInt + d := auxIntToInt16(v_0.AuxInt) v_0_0 := v_0.Args[0] if v_0_0.Op != OpS390XMOVDconst { break } - c := v_0_0.AuxInt - if !(uint64(c+d) >= uint64(c) && c+d == 0) { + c := auxIntToInt64(v_0_0.AuxInt) + if !(uint64(c+int64(d)) >= uint64(c) && c+int64(d) == 0) { break } v.reset(OpS390XFlagEQ) return true } // match: (Select1 (ADDCconst (MOVDconst [c]) [d])) - // cond: uint64(c+d) >= uint64(c) && c+d != 0 + // cond: uint64(c+int64(d)) >= uint64(c) && c+int64(d) != 0 // result: (FlagLT) for { if v_0.Op != OpS390XADDCconst { break } - d := v_0.AuxInt + d := auxIntToInt16(v_0.AuxInt) v_0_0 := v_0.Args[0] if v_0_0.Op != OpS390XMOVDconst { break } - c := v_0_0.AuxInt - if !(uint64(c+d) >= uint64(c) && c+d != 0) { + c := auxIntToInt64(v_0_0.AuxInt) + if !(uint64(c+int64(d)) >= uint64(c) && c+int64(d) != 0) { break } v.reset(OpS390XFlagLT) |