From 0ef3ebcc83a4f9d4442c0ffe251d7bb29f6de6a1 Mon Sep 17 00:00:00 2001 From: Lynn Boger Date: Thu, 23 Apr 2020 14:00:33 -0400 Subject: [PATCH] cmd/compile: clean up PPC64.rules typed aux changes This adds a few minor changes from the first review. Passes toolstash-check Change-Id: I00f6f1b0235d0a8c686aa8793d0473b8fc6b1495 Reviewed-on: https://go-review.googlesource.com/c/go/+/229699 Run-TryBot: Lynn Boger Reviewed-by: Keith Randall --- src/cmd/compile/internal/ssa/gen/PPC64.rules | 48 ++++---- src/cmd/compile/internal/ssa/rewritePPC64.go | 120 +++++++++---------- 2 files changed, 84 insertions(+), 84 deletions(-) diff --git a/src/cmd/compile/internal/ssa/gen/PPC64.rules b/src/cmd/compile/internal/ssa/gen/PPC64.rules index 47c6c90fc6..e59bd3f90f 100644 --- a/src/cmd/compile/internal/ssa/gen/PPC64.rules +++ b/src/cmd/compile/internal/ssa/gen/PPC64.rules @@ -275,8 +275,8 @@ (ISEL [0] (ANDconst [d] y) (MOVDconst [-1]) (CMPUconst [c] (ANDconst [d] y))) && c >= d => (ANDconst [d] y) (ORN x (MOVDconst [-1])) => x -(ADDconstForCarry [c] (MOVDconst [d])) && c < 0 && (int64(c) < 0 || int64(c) + d >= 0) => (FlagCarryClear) -(ADDconstForCarry [c] (MOVDconst [d])) && c < 0 && int64(c) >= 0 && int64(c) + d < 0 => (FlagCarrySet) +(ADDconstForCarry [c] (MOVDconst [d])) && c < 0 && (c < 0 || int64(c) + d >= 0) => (FlagCarryClear) +(ADDconstForCarry [c] (MOVDconst [d])) && c < 0 && c >= 0 && int64(c) + d < 0 => (FlagCarrySet) (MaskIfNotCarry (FlagCarrySet)) => (MOVDconst [0]) (MaskIfNotCarry (FlagCarryClear)) => (MOVDconst [-1]) @@ -802,48 +802,48 @@ // the temp register. So don't fold address of global, unless there // is only one use. (MOVBstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) => (MOVBstore [off1+off2] {mergeSymTyped(sym1,sym2)} ptr val mem) (MOVHstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) => (MOVHstore [off1+off2] {mergeSymTyped(sym1,sym2)} ptr val mem) (MOVWstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) => (MOVWstore [off1+off2] {mergeSymTyped(sym1,sym2)} ptr val mem) (MOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 => (MOVDstore [off1+off2] {mergeSymTyped(sym1,sym2)} ptr val mem) (FMOVSstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) => (FMOVSstore [off1+off2] {mergeSymTyped(sym1,sym2)} ptr val mem) (FMOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) => (FMOVDstore [off1+off2] {mergeSymTyped(sym1,sym2)} ptr val mem) (MOVBZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) => (MOVBZload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) (MOVHload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) => (MOVHload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) (MOVHZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) => (MOVHZload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) (MOVWload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 => (MOVWload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) (MOVWZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) => (MOVWZload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) (MOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 => (MOVDload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) (FMOVSload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) => (FMOVSload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) (FMOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) && canMergeSym(sym1,sym2) - && (ptr.Op != OpSB || p.Uses == 1) => + && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) => (FMOVDload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) // Fold offsets for loads. @@ -893,17 +893,17 @@ // Fold symbols into storezero (MOVDstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem) && canMergeSym(sym1,sym2) - && (x.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 -> - (MOVDstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem) + && (x.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 => + (MOVDstorezero [off1+off2] {mergeSymTyped(sym1,sym2)} x mem) (MOVWstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem) && canMergeSym(sym1,sym2) - && (x.Op != OpSB || p.Uses == 1) -> - (MOVWstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem) + && (x.Op != OpSB || p.Uses == 1) => + (MOVWstorezero [off1+off2] {mergeSymTyped(sym1,sym2)} x mem) (MOVHstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem) && canMergeSym(sym1,sym2) - && (x.Op != OpSB || p.Uses == 1) -> - (MOVHstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem) + && (x.Op != OpSB || p.Uses == 1) => + (MOVHstorezero [off1+off2] {mergeSymTyped(sym1,sym2)} x mem) (MOVBstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem) && canMergeSym(sym1,sym2) - && (x.Op != OpSB || p.Uses == 1) -> - (MOVBstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem) + && (x.Op != OpSB || p.Uses == 1) => + (MOVBstorezero [off1+off2] {mergeSymTyped(sym1,sym2)} x mem) // atomic intrinsics (AtomicLoad(8|32|64|Ptr) ptr mem) => (LoweredAtomicLoad(8|32|64|Ptr) [1] ptr mem) diff --git a/src/cmd/compile/internal/ssa/rewritePPC64.go b/src/cmd/compile/internal/ssa/rewritePPC64.go index 1a61b409a0..5bf9a364f7 100644 --- a/src/cmd/compile/internal/ssa/rewritePPC64.go +++ b/src/cmd/compile/internal/ssa/rewritePPC64.go @@ -3985,7 +3985,7 @@ func rewriteValuePPC64_OpPPC64ADDconst(v *Value) bool { func rewriteValuePPC64_OpPPC64ADDconstForCarry(v *Value) bool { v_0 := v.Args[0] // match: (ADDconstForCarry [c] (MOVDconst [d])) - // cond: c < 0 && (int64(c) < 0 || int64(c) + d >= 0) + // cond: c < 0 && (c < 0 || int64(c) + d >= 0) // result: (FlagCarryClear) for { c := auxIntToInt16(v.AuxInt) @@ -3993,14 +3993,14 @@ func rewriteValuePPC64_OpPPC64ADDconstForCarry(v *Value) bool { break } d := auxIntToInt64(v_0.AuxInt) - if !(c < 0 && (int64(c) < 0 || int64(c)+d >= 0)) { + if !(c < 0 && (c < 0 || int64(c)+d >= 0)) { break } v.reset(OpPPC64FlagCarryClear) return true } // match: (ADDconstForCarry [c] (MOVDconst [d])) - // cond: c < 0 && int64(c) >= 0 && int64(c) + d < 0 + // cond: c < 0 && c >= 0 && int64(c) + d < 0 // result: (FlagCarrySet) for { c := auxIntToInt16(v.AuxInt) @@ -4008,7 +4008,7 @@ func rewriteValuePPC64_OpPPC64ADDconstForCarry(v *Value) bool { break } d := auxIntToInt64(v_0.AuxInt) - if !(c < 0 && int64(c) >= 0 && int64(c)+d < 0) { + if !(c < 0 && c >= 0 && int64(c)+d < 0) { break } v.reset(OpPPC64FlagCarrySet) @@ -5029,7 +5029,7 @@ func rewriteValuePPC64_OpPPC64FMOVDload(v *Value) bool { return true } // match: (FMOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) // result: (FMOVDload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -5042,7 +5042,7 @@ func rewriteValuePPC64_OpPPC64FMOVDload(v *Value) bool { sym2 := auxToSym(p.Aux) ptr := p.Args[0] mem := v_1 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1)) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64FMOVDload) @@ -5118,7 +5118,7 @@ func rewriteValuePPC64_OpPPC64FMOVDstore(v *Value) bool { return true } // match: (FMOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) // result: (FMOVDstore [off1+off2] {mergeSymTyped(sym1,sym2)} ptr val mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -5132,7 +5132,7 @@ func rewriteValuePPC64_OpPPC64FMOVDstore(v *Value) bool { ptr := p.Args[0] val := v_1 mem := v_2 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1)) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64FMOVDstore) @@ -5147,7 +5147,7 @@ func rewriteValuePPC64_OpPPC64FMOVSload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (FMOVSload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) // result: (FMOVSload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -5160,7 +5160,7 @@ func rewriteValuePPC64_OpPPC64FMOVSload(v *Value) bool { sym2 := auxToSym(p.Aux) ptr := p.Args[0] mem := v_1 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1)) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64FMOVSload) @@ -5219,7 +5219,7 @@ func rewriteValuePPC64_OpPPC64FMOVSstore(v *Value) bool { return true } // match: (FMOVSstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) // result: (FMOVSstore [off1+off2] {mergeSymTyped(sym1,sym2)} ptr val mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -5233,7 +5233,7 @@ func rewriteValuePPC64_OpPPC64FMOVSstore(v *Value) bool { ptr := p.Args[0] val := v_1 mem := v_2 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1)) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64FMOVSstore) @@ -6205,7 +6205,7 @@ func rewriteValuePPC64_OpPPC64MOVBZload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (MOVBZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) // result: (MOVBZload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -6218,7 +6218,7 @@ func rewriteValuePPC64_OpPPC64MOVBZload(v *Value) bool { sym2 := auxToSym(p.Aux) ptr := p.Args[0] mem := v_1 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1)) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64MOVBZload) @@ -6708,7 +6708,7 @@ func rewriteValuePPC64_OpPPC64MOVBstore(v *Value) bool { return true } // match: (MOVBstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) // result: (MOVBstore [off1+off2] {mergeSymTyped(sym1,sym2)} ptr val mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -6722,7 +6722,7 @@ func rewriteValuePPC64_OpPPC64MOVBstore(v *Value) bool { ptr := p.Args[0] val := v_1 mem := v_2 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1)) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64MOVBstore) @@ -7682,24 +7682,24 @@ func rewriteValuePPC64_OpPPC64MOVBstorezero(v *Value) bool { } // match: (MOVBstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem) // cond: canMergeSym(sym1,sym2) && (x.Op != OpSB || p.Uses == 1) - // result: (MOVBstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem) + // result: (MOVBstorezero [off1+off2] {mergeSymTyped(sym1,sym2)} x mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) p := v_0 if p.Op != OpPPC64MOVDaddr { break } - off2 := p.AuxInt - sym2 := p.Aux + off2 := auxIntToInt32(p.AuxInt) + sym2 := auxToSym(p.Aux) x := p.Args[0] mem := v_1 if !(canMergeSym(sym1, sym2) && (x.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64MOVBstorezero) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(x, mem) return true } @@ -7726,7 +7726,7 @@ func rewriteValuePPC64_OpPPC64MOVDload(v *Value) bool { return true } // match: (MOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 // result: (MOVDload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -7739,7 +7739,7 @@ func rewriteValuePPC64_OpPPC64MOVDload(v *Value) bool { sym2 := auxToSym(p.Aux) ptr := p.Args[0] mem := v_1 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0) { break } v.reset(OpPPC64MOVDload) @@ -7879,7 +7879,7 @@ func rewriteValuePPC64_OpPPC64MOVDstore(v *Value) bool { return true } // match: (MOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 // result: (MOVDstore [off1+off2] {mergeSymTyped(sym1,sym2)} ptr val mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -7893,7 +7893,7 @@ func rewriteValuePPC64_OpPPC64MOVDstore(v *Value) bool { ptr := p.Args[0] val := v_1 mem := v_2 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0) { break } v.reset(OpPPC64MOVDstore) @@ -8014,24 +8014,24 @@ func rewriteValuePPC64_OpPPC64MOVDstorezero(v *Value) bool { } // match: (MOVDstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem) // cond: canMergeSym(sym1,sym2) && (x.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 - // result: (MOVDstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem) + // result: (MOVDstorezero [off1+off2] {mergeSymTyped(sym1,sym2)} x mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) p := v_0 if p.Op != OpPPC64MOVDaddr { break } - off2 := p.AuxInt - sym2 := p.Aux + off2 := auxIntToInt32(p.AuxInt) + sym2 := auxToSym(p.Aux) x := p.Args[0] mem := v_1 if !(canMergeSym(sym1, sym2) && (x.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0) { break } v.reset(OpPPC64MOVDstorezero) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(x, mem) return true } @@ -8107,7 +8107,7 @@ func rewriteValuePPC64_OpPPC64MOVHZload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (MOVHZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) // result: (MOVHZload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -8120,7 +8120,7 @@ func rewriteValuePPC64_OpPPC64MOVHZload(v *Value) bool { sym2 := auxToSym(p.Aux) ptr := p.Args[0] mem := v_1 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1)) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64MOVHZload) @@ -8438,7 +8438,7 @@ func rewriteValuePPC64_OpPPC64MOVHload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (MOVHload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) // result: (MOVHload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -8451,7 +8451,7 @@ func rewriteValuePPC64_OpPPC64MOVHload(v *Value) bool { sym2 := auxToSym(p.Aux) ptr := p.Args[0] mem := v_1 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1)) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64MOVHload) @@ -8832,7 +8832,7 @@ func rewriteValuePPC64_OpPPC64MOVHstore(v *Value) bool { return true } // match: (MOVHstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) // result: (MOVHstore [off1+off2] {mergeSymTyped(sym1,sym2)} ptr val mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -8846,7 +8846,7 @@ func rewriteValuePPC64_OpPPC64MOVHstore(v *Value) bool { ptr := p.Args[0] val := v_1 mem := v_2 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1)) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64MOVHstore) @@ -9149,24 +9149,24 @@ func rewriteValuePPC64_OpPPC64MOVHstorezero(v *Value) bool { } // match: (MOVHstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem) // cond: canMergeSym(sym1,sym2) && (x.Op != OpSB || p.Uses == 1) - // result: (MOVHstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem) + // result: (MOVHstorezero [off1+off2] {mergeSymTyped(sym1,sym2)} x mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) p := v_0 if p.Op != OpPPC64MOVDaddr { break } - off2 := p.AuxInt - sym2 := p.Aux + off2 := auxIntToInt32(p.AuxInt) + sym2 := auxToSym(p.Aux) x := p.Args[0] mem := v_1 if !(canMergeSym(sym1, sym2) && (x.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64MOVHstorezero) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(x, mem) return true } @@ -9212,7 +9212,7 @@ func rewriteValuePPC64_OpPPC64MOVWZload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (MOVWZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) // result: (MOVWZload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -9225,7 +9225,7 @@ func rewriteValuePPC64_OpPPC64MOVWZload(v *Value) bool { sym2 := auxToSym(p.Aux) ptr := p.Args[0] mem := v_1 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1)) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64MOVWZload) @@ -9608,7 +9608,7 @@ func rewriteValuePPC64_OpPPC64MOVWload(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (MOVWload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0 // result: (MOVWload [off1+off2] {mergeSymTyped(sym1,sym2)} ptr mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -9621,7 +9621,7 @@ func rewriteValuePPC64_OpPPC64MOVWload(v *Value) bool { sym2 := auxToSym(p.Aux) ptr := p.Args[0] mem := v_1 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) && (off1+off2)%4 == 0) { break } v.reset(OpPPC64MOVWload) @@ -10021,7 +10021,7 @@ func rewriteValuePPC64_OpPPC64MOVWstore(v *Value) bool { return true } // match: (MOVWstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem) - // cond: canMergeSym(sym1,sym2) && (ptr.Op != OpSB || p.Uses == 1) + // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1) // result: (MOVWstore [off1+off2] {mergeSymTyped(sym1,sym2)} ptr val mem) for { off1 := auxIntToInt32(v.AuxInt) @@ -10035,7 +10035,7 @@ func rewriteValuePPC64_OpPPC64MOVWstore(v *Value) bool { ptr := p.Args[0] val := v_1 mem := v_2 - if !(canMergeSym(sym1, sym2) && (ptr.Op != OpSB || p.Uses == 1)) { + if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64MOVWstore) @@ -10218,24 +10218,24 @@ func rewriteValuePPC64_OpPPC64MOVWstorezero(v *Value) bool { } // match: (MOVWstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem) // cond: canMergeSym(sym1,sym2) && (x.Op != OpSB || p.Uses == 1) - // result: (MOVWstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem) + // result: (MOVWstorezero [off1+off2] {mergeSymTyped(sym1,sym2)} x mem) for { - off1 := v.AuxInt - sym1 := v.Aux + off1 := auxIntToInt32(v.AuxInt) + sym1 := auxToSym(v.Aux) p := v_0 if p.Op != OpPPC64MOVDaddr { break } - off2 := p.AuxInt - sym2 := p.Aux + off2 := auxIntToInt32(p.AuxInt) + sym2 := auxToSym(p.Aux) x := p.Args[0] mem := v_1 if !(canMergeSym(sym1, sym2) && (x.Op != OpSB || p.Uses == 1)) { break } v.reset(OpPPC64MOVWstorezero) - v.AuxInt = off1 + off2 - v.Aux = mergeSym(sym1, sym2) + v.AuxInt = int32ToAuxInt(off1 + off2) + v.Aux = symToAux(mergeSymTyped(sym1, sym2)) v.AddArg2(x, mem) return true } -- 2.50.0