From 4c800f03c9f988d5de0481de0d77d103213b295c Mon Sep 17 00:00:00 2001 From: Keith Randall Date: Thu, 7 Dec 2017 14:11:19 -0800 Subject: [PATCH] cmd/compile: fix large load/store offsets on 386 Pointer arithemetic is done mod 2^32 on 386, so we can just drop the high bits of any large constant offsets. The bounds check will make sure wraparounds are never observed. Fixes #21655 Change-Id: I68ae5bbea9f02c73968ea2b21ca017e5ecb89223 Reviewed-on: https://go-review.googlesource.com/82675 Run-TryBot: Keith Randall TryBot-Result: Gobot Gobot Reviewed-by: David Chase --- src/cmd/compile/internal/ssa/gen/386.rules | 72 ++++---- src/cmd/compile/internal/ssa/rewrite386.go | 192 ++++++++++----------- test/fixedbugs/issue21655.go | 22 +++ 3 files changed, 154 insertions(+), 132 deletions(-) diff --git a/src/cmd/compile/internal/ssa/gen/386.rules b/src/cmd/compile/internal/ssa/gen/386.rules index 226bea6b74..e012891aed 100644 --- a/src/cmd/compile/internal/ssa/gen/386.rules +++ b/src/cmd/compile/internal/ssa/gen/386.rules @@ -799,45 +799,45 @@ (MOVLstoreconstidx1 [c] {sym} ptr (SHLLconst [2] idx) mem) -> (MOVLstoreconstidx4 [c] {sym} ptr idx mem) // combine ADDL into indexed loads and stores -(MOVBloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVBloadidx1 [c+d] {sym} ptr idx mem) -(MOVWloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVWloadidx1 [c+d] {sym} ptr idx mem) -(MOVWloadidx2 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVWloadidx2 [c+d] {sym} ptr idx mem) -(MOVLloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVLloadidx1 [c+d] {sym} ptr idx mem) -(MOVLloadidx4 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVLloadidx4 [c+d] {sym} ptr idx mem) -(MOVSSloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVSSloadidx1 [c+d] {sym} ptr idx mem) -(MOVSSloadidx4 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVSSloadidx4 [c+d] {sym} ptr idx mem) -(MOVSDloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVSDloadidx1 [c+d] {sym} ptr idx mem) -(MOVSDloadidx8 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVSDloadidx8 [c+d] {sym} ptr idx mem) +(MOVBloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVBloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVWloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVWloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVWloadidx2 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVWloadidx2 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVLloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVLloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVLloadidx4 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVLloadidx4 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVSSloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVSSloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVSSloadidx4 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVSSloadidx4 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVSDloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVSDloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVSDloadidx8 [c] {sym} (ADDLconst [d] ptr) idx mem) -> (MOVSDloadidx8 [int64(int32(c+d))] {sym} ptr idx mem) -(MOVBstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVBstoreidx1 [c+d] {sym} ptr idx val mem) -(MOVWstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVWstoreidx1 [c+d] {sym} ptr idx val mem) -(MOVWstoreidx2 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVWstoreidx2 [c+d] {sym} ptr idx val mem) -(MOVLstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVLstoreidx1 [c+d] {sym} ptr idx val mem) -(MOVLstoreidx4 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVLstoreidx4 [c+d] {sym} ptr idx val mem) -(MOVSSstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVSSstoreidx1 [c+d] {sym} ptr idx val mem) -(MOVSSstoreidx4 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVSSstoreidx4 [c+d] {sym} ptr idx val mem) -(MOVSDstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVSDstoreidx1 [c+d] {sym} ptr idx val mem) -(MOVSDstoreidx8 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVSDstoreidx8 [c+d] {sym} ptr idx val mem) +(MOVBstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVBstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVWstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVWstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVWstoreidx2 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVWstoreidx2 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVLstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVLstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVLstoreidx4 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVLstoreidx4 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVSSstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVSSstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVSSstoreidx4 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVSSstoreidx4 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVSDstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVSDstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVSDstoreidx8 [c] {sym} (ADDLconst [d] ptr) idx val mem) -> (MOVSDstoreidx8 [int64(int32(c+d))] {sym} ptr idx val mem) -(MOVBloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVBloadidx1 [c+d] {sym} ptr idx mem) -(MOVWloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVWloadidx1 [c+d] {sym} ptr idx mem) -(MOVWloadidx2 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVWloadidx2 [c+2*d] {sym} ptr idx mem) -(MOVLloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVLloadidx1 [c+d] {sym} ptr idx mem) -(MOVLloadidx4 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVLloadidx4 [c+4*d] {sym} ptr idx mem) -(MOVSSloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVSSloadidx1 [c+d] {sym} ptr idx mem) -(MOVSSloadidx4 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVSSloadidx4 [c+4*d] {sym} ptr idx mem) -(MOVSDloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVSDloadidx1 [c+d] {sym} ptr idx mem) -(MOVSDloadidx8 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVSDloadidx8 [c+8*d] {sym} ptr idx mem) +(MOVBloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVBloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVWloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVWloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVWloadidx2 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVWloadidx2 [int64(int32(c+2*d))] {sym} ptr idx mem) +(MOVLloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVLloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVLloadidx4 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVLloadidx4 [int64(int32(c+4*d))] {sym} ptr idx mem) +(MOVSSloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVSSloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVSSloadidx4 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVSSloadidx4 [int64(int32(c+4*d))] {sym} ptr idx mem) +(MOVSDloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVSDloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) +(MOVSDloadidx8 [c] {sym} ptr (ADDLconst [d] idx) mem) -> (MOVSDloadidx8 [int64(int32(c+8*d))] {sym} ptr idx mem) -(MOVBstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVBstoreidx1 [c+d] {sym} ptr idx val mem) -(MOVWstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVWstoreidx1 [c+d] {sym} ptr idx val mem) -(MOVWstoreidx2 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVWstoreidx2 [c+2*d] {sym} ptr idx val mem) -(MOVLstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVLstoreidx1 [c+d] {sym} ptr idx val mem) -(MOVLstoreidx4 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVLstoreidx4 [c+4*d] {sym} ptr idx val mem) -(MOVSSstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVSSstoreidx1 [c+d] {sym} ptr idx val mem) -(MOVSSstoreidx4 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVSSstoreidx4 [c+4*d] {sym} ptr idx val mem) -(MOVSDstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVSDstoreidx1 [c+d] {sym} ptr idx val mem) -(MOVSDstoreidx8 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVSDstoreidx8 [c+8*d] {sym} ptr idx val mem) +(MOVBstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVBstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVWstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVWstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVWstoreidx2 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVWstoreidx2 [int64(int32(c+2*d))] {sym} ptr idx val mem) +(MOVLstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVLstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVLstoreidx4 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVLstoreidx4 [int64(int32(c+4*d))] {sym} ptr idx val mem) +(MOVSSstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVSSstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVSSstoreidx4 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVSSstoreidx4 [int64(int32(c+4*d))] {sym} ptr idx val mem) +(MOVSDstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVSDstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) +(MOVSDstoreidx8 [c] {sym} ptr (ADDLconst [d] idx) val mem) -> (MOVSDstoreidx8 [int64(int32(c+8*d))] {sym} ptr idx val mem) (MOVBstoreconstidx1 [x] {sym} (ADDLconst [c] ptr) idx mem) -> (MOVBstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem) diff --git a/src/cmd/compile/internal/ssa/rewrite386.go b/src/cmd/compile/internal/ssa/rewrite386.go index 3706302d63..32e86088f1 100644 --- a/src/cmd/compile/internal/ssa/rewrite386.go +++ b/src/cmd/compile/internal/ssa/rewrite386.go @@ -3152,7 +3152,7 @@ func rewriteValue386_Op386MOVBload_0(v *Value) bool { func rewriteValue386_Op386MOVBloadidx1_0(v *Value) bool { // match: (MOVBloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) // cond: - // result: (MOVBloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVBloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -3166,7 +3166,7 @@ func rewriteValue386_Op386MOVBloadidx1_0(v *Value) bool { idx := v.Args[1] mem := v.Args[2] v.reset(Op386MOVBloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -3175,7 +3175,7 @@ func rewriteValue386_Op386MOVBloadidx1_0(v *Value) bool { } // match: (MOVBloadidx1 [c] {sym} idx (ADDLconst [d] ptr) mem) // cond: - // result: (MOVBloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVBloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -3189,7 +3189,7 @@ func rewriteValue386_Op386MOVBloadidx1_0(v *Value) bool { ptr := v_1.Args[0] mem := v.Args[2] v.reset(Op386MOVBloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -3198,7 +3198,7 @@ func rewriteValue386_Op386MOVBloadidx1_0(v *Value) bool { } // match: (MOVBloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) // cond: - // result: (MOVBloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVBloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -3212,7 +3212,7 @@ func rewriteValue386_Op386MOVBloadidx1_0(v *Value) bool { idx := v_1.Args[0] mem := v.Args[2] v.reset(Op386MOVBloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -3221,7 +3221,7 @@ func rewriteValue386_Op386MOVBloadidx1_0(v *Value) bool { } // match: (MOVBloadidx1 [c] {sym} (ADDLconst [d] idx) ptr mem) // cond: - // result: (MOVBloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVBloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -3235,7 +3235,7 @@ func rewriteValue386_Op386MOVBloadidx1_0(v *Value) bool { ptr := v.Args[1] mem := v.Args[2] v.reset(Op386MOVBloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -3751,7 +3751,7 @@ func rewriteValue386_Op386MOVBstoreconstidx1_0(v *Value) bool { func rewriteValue386_Op386MOVBstoreidx1_0(v *Value) bool { // match: (MOVBstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) // cond: - // result: (MOVBstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVBstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -3766,7 +3766,7 @@ func rewriteValue386_Op386MOVBstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVBstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -3776,7 +3776,7 @@ func rewriteValue386_Op386MOVBstoreidx1_0(v *Value) bool { } // match: (MOVBstoreidx1 [c] {sym} idx (ADDLconst [d] ptr) val mem) // cond: - // result: (MOVBstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVBstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -3791,7 +3791,7 @@ func rewriteValue386_Op386MOVBstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVBstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -3801,7 +3801,7 @@ func rewriteValue386_Op386MOVBstoreidx1_0(v *Value) bool { } // match: (MOVBstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) // cond: - // result: (MOVBstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVBstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -3816,7 +3816,7 @@ func rewriteValue386_Op386MOVBstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVBstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -3826,7 +3826,7 @@ func rewriteValue386_Op386MOVBstoreidx1_0(v *Value) bool { } // match: (MOVBstoreidx1 [c] {sym} (ADDLconst [d] idx) ptr val mem) // cond: - // result: (MOVBstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVBstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -3841,7 +3841,7 @@ func rewriteValue386_Op386MOVBstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVBstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -4490,7 +4490,7 @@ func rewriteValue386_Op386MOVLloadidx1_0(v *Value) bool { } // match: (MOVLloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) // cond: - // result: (MOVLloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVLloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -4504,7 +4504,7 @@ func rewriteValue386_Op386MOVLloadidx1_0(v *Value) bool { idx := v.Args[1] mem := v.Args[2] v.reset(Op386MOVLloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -4513,7 +4513,7 @@ func rewriteValue386_Op386MOVLloadidx1_0(v *Value) bool { } // match: (MOVLloadidx1 [c] {sym} idx (ADDLconst [d] ptr) mem) // cond: - // result: (MOVLloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVLloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -4527,7 +4527,7 @@ func rewriteValue386_Op386MOVLloadidx1_0(v *Value) bool { ptr := v_1.Args[0] mem := v.Args[2] v.reset(Op386MOVLloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -4536,7 +4536,7 @@ func rewriteValue386_Op386MOVLloadidx1_0(v *Value) bool { } // match: (MOVLloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) // cond: - // result: (MOVLloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVLloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -4550,7 +4550,7 @@ func rewriteValue386_Op386MOVLloadidx1_0(v *Value) bool { idx := v_1.Args[0] mem := v.Args[2] v.reset(Op386MOVLloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -4559,7 +4559,7 @@ func rewriteValue386_Op386MOVLloadidx1_0(v *Value) bool { } // match: (MOVLloadidx1 [c] {sym} (ADDLconst [d] idx) ptr mem) // cond: - // result: (MOVLloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVLloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -4573,7 +4573,7 @@ func rewriteValue386_Op386MOVLloadidx1_0(v *Value) bool { ptr := v.Args[1] mem := v.Args[2] v.reset(Op386MOVLloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -4585,7 +4585,7 @@ func rewriteValue386_Op386MOVLloadidx1_0(v *Value) bool { func rewriteValue386_Op386MOVLloadidx4_0(v *Value) bool { // match: (MOVLloadidx4 [c] {sym} (ADDLconst [d] ptr) idx mem) // cond: - // result: (MOVLloadidx4 [c+d] {sym} ptr idx mem) + // result: (MOVLloadidx4 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -4599,7 +4599,7 @@ func rewriteValue386_Op386MOVLloadidx4_0(v *Value) bool { idx := v.Args[1] mem := v.Args[2] v.reset(Op386MOVLloadidx4) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -4608,7 +4608,7 @@ func rewriteValue386_Op386MOVLloadidx4_0(v *Value) bool { } // match: (MOVLloadidx4 [c] {sym} ptr (ADDLconst [d] idx) mem) // cond: - // result: (MOVLloadidx4 [c+4*d] {sym} ptr idx mem) + // result: (MOVLloadidx4 [int64(int32(c+4*d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -4622,7 +4622,7 @@ func rewriteValue386_Op386MOVLloadidx4_0(v *Value) bool { idx := v_1.Args[0] mem := v.Args[2] v.reset(Op386MOVLloadidx4) - v.AuxInt = c + 4*d + v.AuxInt = int64(int32(c + 4*d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5118,7 +5118,7 @@ func rewriteValue386_Op386MOVLstoreidx1_0(v *Value) bool { } // match: (MOVLstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) // cond: - // result: (MOVLstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVLstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -5133,7 +5133,7 @@ func rewriteValue386_Op386MOVLstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVLstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5143,7 +5143,7 @@ func rewriteValue386_Op386MOVLstoreidx1_0(v *Value) bool { } // match: (MOVLstoreidx1 [c] {sym} idx (ADDLconst [d] ptr) val mem) // cond: - // result: (MOVLstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVLstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -5158,7 +5158,7 @@ func rewriteValue386_Op386MOVLstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVLstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5168,7 +5168,7 @@ func rewriteValue386_Op386MOVLstoreidx1_0(v *Value) bool { } // match: (MOVLstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) // cond: - // result: (MOVLstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVLstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -5183,7 +5183,7 @@ func rewriteValue386_Op386MOVLstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVLstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5193,7 +5193,7 @@ func rewriteValue386_Op386MOVLstoreidx1_0(v *Value) bool { } // match: (MOVLstoreidx1 [c] {sym} (ADDLconst [d] idx) ptr val mem) // cond: - // result: (MOVLstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVLstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -5208,7 +5208,7 @@ func rewriteValue386_Op386MOVLstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVLstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5221,7 +5221,7 @@ func rewriteValue386_Op386MOVLstoreidx1_0(v *Value) bool { func rewriteValue386_Op386MOVLstoreidx4_0(v *Value) bool { // match: (MOVLstoreidx4 [c] {sym} (ADDLconst [d] ptr) idx val mem) // cond: - // result: (MOVLstoreidx4 [c+d] {sym} ptr idx val mem) + // result: (MOVLstoreidx4 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -5236,7 +5236,7 @@ func rewriteValue386_Op386MOVLstoreidx4_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVLstoreidx4) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5246,7 +5246,7 @@ func rewriteValue386_Op386MOVLstoreidx4_0(v *Value) bool { } // match: (MOVLstoreidx4 [c] {sym} ptr (ADDLconst [d] idx) val mem) // cond: - // result: (MOVLstoreidx4 [c+4*d] {sym} ptr idx val mem) + // result: (MOVLstoreidx4 [int64(int32(c+4*d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -5261,7 +5261,7 @@ func rewriteValue386_Op386MOVLstoreidx4_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVLstoreidx4) - v.AuxInt = c + 4*d + v.AuxInt = int64(int32(c + 4*d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5435,7 +5435,7 @@ func rewriteValue386_Op386MOVSDload_0(v *Value) bool { func rewriteValue386_Op386MOVSDloadidx1_0(v *Value) bool { // match: (MOVSDloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) // cond: - // result: (MOVSDloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVSDloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -5449,7 +5449,7 @@ func rewriteValue386_Op386MOVSDloadidx1_0(v *Value) bool { idx := v.Args[1] mem := v.Args[2] v.reset(Op386MOVSDloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5458,7 +5458,7 @@ func rewriteValue386_Op386MOVSDloadidx1_0(v *Value) bool { } // match: (MOVSDloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) // cond: - // result: (MOVSDloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVSDloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -5472,7 +5472,7 @@ func rewriteValue386_Op386MOVSDloadidx1_0(v *Value) bool { idx := v_1.Args[0] mem := v.Args[2] v.reset(Op386MOVSDloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5484,7 +5484,7 @@ func rewriteValue386_Op386MOVSDloadidx1_0(v *Value) bool { func rewriteValue386_Op386MOVSDloadidx8_0(v *Value) bool { // match: (MOVSDloadidx8 [c] {sym} (ADDLconst [d] ptr) idx mem) // cond: - // result: (MOVSDloadidx8 [c+d] {sym} ptr idx mem) + // result: (MOVSDloadidx8 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -5498,7 +5498,7 @@ func rewriteValue386_Op386MOVSDloadidx8_0(v *Value) bool { idx := v.Args[1] mem := v.Args[2] v.reset(Op386MOVSDloadidx8) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5507,7 +5507,7 @@ func rewriteValue386_Op386MOVSDloadidx8_0(v *Value) bool { } // match: (MOVSDloadidx8 [c] {sym} ptr (ADDLconst [d] idx) mem) // cond: - // result: (MOVSDloadidx8 [c+8*d] {sym} ptr idx mem) + // result: (MOVSDloadidx8 [int64(int32(c+8*d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -5521,7 +5521,7 @@ func rewriteValue386_Op386MOVSDloadidx8_0(v *Value) bool { idx := v_1.Args[0] mem := v.Args[2] v.reset(Op386MOVSDloadidx8) - v.AuxInt = c + 8*d + v.AuxInt = int64(int32(c + 8*d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5681,7 +5681,7 @@ func rewriteValue386_Op386MOVSDstore_0(v *Value) bool { func rewriteValue386_Op386MOVSDstoreidx1_0(v *Value) bool { // match: (MOVSDstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) // cond: - // result: (MOVSDstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVSDstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -5696,7 +5696,7 @@ func rewriteValue386_Op386MOVSDstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVSDstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5706,7 +5706,7 @@ func rewriteValue386_Op386MOVSDstoreidx1_0(v *Value) bool { } // match: (MOVSDstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) // cond: - // result: (MOVSDstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVSDstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -5721,7 +5721,7 @@ func rewriteValue386_Op386MOVSDstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVSDstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5734,7 +5734,7 @@ func rewriteValue386_Op386MOVSDstoreidx1_0(v *Value) bool { func rewriteValue386_Op386MOVSDstoreidx8_0(v *Value) bool { // match: (MOVSDstoreidx8 [c] {sym} (ADDLconst [d] ptr) idx val mem) // cond: - // result: (MOVSDstoreidx8 [c+d] {sym} ptr idx val mem) + // result: (MOVSDstoreidx8 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -5749,7 +5749,7 @@ func rewriteValue386_Op386MOVSDstoreidx8_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVSDstoreidx8) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5759,7 +5759,7 @@ func rewriteValue386_Op386MOVSDstoreidx8_0(v *Value) bool { } // match: (MOVSDstoreidx8 [c] {sym} ptr (ADDLconst [d] idx) val mem) // cond: - // result: (MOVSDstoreidx8 [c+8*d] {sym} ptr idx val mem) + // result: (MOVSDstoreidx8 [int64(int32(c+8*d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -5774,7 +5774,7 @@ func rewriteValue386_Op386MOVSDstoreidx8_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVSDstoreidx8) - v.AuxInt = c + 8*d + v.AuxInt = int64(int32(c + 8*d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5948,7 +5948,7 @@ func rewriteValue386_Op386MOVSSload_0(v *Value) bool { func rewriteValue386_Op386MOVSSloadidx1_0(v *Value) bool { // match: (MOVSSloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) // cond: - // result: (MOVSSloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVSSloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -5962,7 +5962,7 @@ func rewriteValue386_Op386MOVSSloadidx1_0(v *Value) bool { idx := v.Args[1] mem := v.Args[2] v.reset(Op386MOVSSloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5971,7 +5971,7 @@ func rewriteValue386_Op386MOVSSloadidx1_0(v *Value) bool { } // match: (MOVSSloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) // cond: - // result: (MOVSSloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVSSloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -5985,7 +5985,7 @@ func rewriteValue386_Op386MOVSSloadidx1_0(v *Value) bool { idx := v_1.Args[0] mem := v.Args[2] v.reset(Op386MOVSSloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -5997,7 +5997,7 @@ func rewriteValue386_Op386MOVSSloadidx1_0(v *Value) bool { func rewriteValue386_Op386MOVSSloadidx4_0(v *Value) bool { // match: (MOVSSloadidx4 [c] {sym} (ADDLconst [d] ptr) idx mem) // cond: - // result: (MOVSSloadidx4 [c+d] {sym} ptr idx mem) + // result: (MOVSSloadidx4 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -6011,7 +6011,7 @@ func rewriteValue386_Op386MOVSSloadidx4_0(v *Value) bool { idx := v.Args[1] mem := v.Args[2] v.reset(Op386MOVSSloadidx4) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -6020,7 +6020,7 @@ func rewriteValue386_Op386MOVSSloadidx4_0(v *Value) bool { } // match: (MOVSSloadidx4 [c] {sym} ptr (ADDLconst [d] idx) mem) // cond: - // result: (MOVSSloadidx4 [c+4*d] {sym} ptr idx mem) + // result: (MOVSSloadidx4 [int64(int32(c+4*d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -6034,7 +6034,7 @@ func rewriteValue386_Op386MOVSSloadidx4_0(v *Value) bool { idx := v_1.Args[0] mem := v.Args[2] v.reset(Op386MOVSSloadidx4) - v.AuxInt = c + 4*d + v.AuxInt = int64(int32(c + 4*d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -6194,7 +6194,7 @@ func rewriteValue386_Op386MOVSSstore_0(v *Value) bool { func rewriteValue386_Op386MOVSSstoreidx1_0(v *Value) bool { // match: (MOVSSstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) // cond: - // result: (MOVSSstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVSSstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -6209,7 +6209,7 @@ func rewriteValue386_Op386MOVSSstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVSSstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -6219,7 +6219,7 @@ func rewriteValue386_Op386MOVSSstoreidx1_0(v *Value) bool { } // match: (MOVSSstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) // cond: - // result: (MOVSSstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVSSstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -6234,7 +6234,7 @@ func rewriteValue386_Op386MOVSSstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVSSstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -6247,7 +6247,7 @@ func rewriteValue386_Op386MOVSSstoreidx1_0(v *Value) bool { func rewriteValue386_Op386MOVSSstoreidx4_0(v *Value) bool { // match: (MOVSSstoreidx4 [c] {sym} (ADDLconst [d] ptr) idx val mem) // cond: - // result: (MOVSSstoreidx4 [c+d] {sym} ptr idx val mem) + // result: (MOVSSstoreidx4 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -6262,7 +6262,7 @@ func rewriteValue386_Op386MOVSSstoreidx4_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVSSstoreidx4) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -6272,7 +6272,7 @@ func rewriteValue386_Op386MOVSSstoreidx4_0(v *Value) bool { } // match: (MOVSSstoreidx4 [c] {sym} ptr (ADDLconst [d] idx) val mem) // cond: - // result: (MOVSSstoreidx4 [c+4*d] {sym} ptr idx val mem) + // result: (MOVSSstoreidx4 [int64(int32(c+4*d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -6287,7 +6287,7 @@ func rewriteValue386_Op386MOVSSstoreidx4_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVSSstoreidx4) - v.AuxInt = c + 4*d + v.AuxInt = int64(int32(c + 4*d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -6719,7 +6719,7 @@ func rewriteValue386_Op386MOVWloadidx1_0(v *Value) bool { } // match: (MOVWloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem) // cond: - // result: (MOVWloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVWloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -6733,7 +6733,7 @@ func rewriteValue386_Op386MOVWloadidx1_0(v *Value) bool { idx := v.Args[1] mem := v.Args[2] v.reset(Op386MOVWloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -6742,7 +6742,7 @@ func rewriteValue386_Op386MOVWloadidx1_0(v *Value) bool { } // match: (MOVWloadidx1 [c] {sym} idx (ADDLconst [d] ptr) mem) // cond: - // result: (MOVWloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVWloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -6756,7 +6756,7 @@ func rewriteValue386_Op386MOVWloadidx1_0(v *Value) bool { ptr := v_1.Args[0] mem := v.Args[2] v.reset(Op386MOVWloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -6765,7 +6765,7 @@ func rewriteValue386_Op386MOVWloadidx1_0(v *Value) bool { } // match: (MOVWloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem) // cond: - // result: (MOVWloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVWloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -6779,7 +6779,7 @@ func rewriteValue386_Op386MOVWloadidx1_0(v *Value) bool { idx := v_1.Args[0] mem := v.Args[2] v.reset(Op386MOVWloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -6788,7 +6788,7 @@ func rewriteValue386_Op386MOVWloadidx1_0(v *Value) bool { } // match: (MOVWloadidx1 [c] {sym} (ADDLconst [d] idx) ptr mem) // cond: - // result: (MOVWloadidx1 [c+d] {sym} ptr idx mem) + // result: (MOVWloadidx1 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -6802,7 +6802,7 @@ func rewriteValue386_Op386MOVWloadidx1_0(v *Value) bool { ptr := v.Args[1] mem := v.Args[2] v.reset(Op386MOVWloadidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -6814,7 +6814,7 @@ func rewriteValue386_Op386MOVWloadidx1_0(v *Value) bool { func rewriteValue386_Op386MOVWloadidx2_0(v *Value) bool { // match: (MOVWloadidx2 [c] {sym} (ADDLconst [d] ptr) idx mem) // cond: - // result: (MOVWloadidx2 [c+d] {sym} ptr idx mem) + // result: (MOVWloadidx2 [int64(int32(c+d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -6828,7 +6828,7 @@ func rewriteValue386_Op386MOVWloadidx2_0(v *Value) bool { idx := v.Args[1] mem := v.Args[2] v.reset(Op386MOVWloadidx2) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -6837,7 +6837,7 @@ func rewriteValue386_Op386MOVWloadidx2_0(v *Value) bool { } // match: (MOVWloadidx2 [c] {sym} ptr (ADDLconst [d] idx) mem) // cond: - // result: (MOVWloadidx2 [c+2*d] {sym} ptr idx mem) + // result: (MOVWloadidx2 [int64(int32(c+2*d))] {sym} ptr idx mem) for { c := v.AuxInt sym := v.Aux @@ -6851,7 +6851,7 @@ func rewriteValue386_Op386MOVWloadidx2_0(v *Value) bool { idx := v_1.Args[0] mem := v.Args[2] v.reset(Op386MOVWloadidx2) - v.AuxInt = c + 2*d + v.AuxInt = int64(int32(c + 2*d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -7594,7 +7594,7 @@ func rewriteValue386_Op386MOVWstoreidx1_0(v *Value) bool { } // match: (MOVWstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem) // cond: - // result: (MOVWstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVWstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -7609,7 +7609,7 @@ func rewriteValue386_Op386MOVWstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVWstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -7619,7 +7619,7 @@ func rewriteValue386_Op386MOVWstoreidx1_0(v *Value) bool { } // match: (MOVWstoreidx1 [c] {sym} idx (ADDLconst [d] ptr) val mem) // cond: - // result: (MOVWstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVWstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -7634,7 +7634,7 @@ func rewriteValue386_Op386MOVWstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVWstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -7644,7 +7644,7 @@ func rewriteValue386_Op386MOVWstoreidx1_0(v *Value) bool { } // match: (MOVWstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem) // cond: - // result: (MOVWstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVWstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -7659,7 +7659,7 @@ func rewriteValue386_Op386MOVWstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVWstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -7669,7 +7669,7 @@ func rewriteValue386_Op386MOVWstoreidx1_0(v *Value) bool { } // match: (MOVWstoreidx1 [c] {sym} (ADDLconst [d] idx) ptr val mem) // cond: - // result: (MOVWstoreidx1 [c+d] {sym} ptr idx val mem) + // result: (MOVWstoreidx1 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -7684,7 +7684,7 @@ func rewriteValue386_Op386MOVWstoreidx1_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVWstoreidx1) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -8122,7 +8122,7 @@ func rewriteValue386_Op386MOVWstoreidx2_0(v *Value) bool { _ = b // match: (MOVWstoreidx2 [c] {sym} (ADDLconst [d] ptr) idx val mem) // cond: - // result: (MOVWstoreidx2 [c+d] {sym} ptr idx val mem) + // result: (MOVWstoreidx2 [int64(int32(c+d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -8137,7 +8137,7 @@ func rewriteValue386_Op386MOVWstoreidx2_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVWstoreidx2) - v.AuxInt = c + d + v.AuxInt = int64(int32(c + d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) @@ -8147,7 +8147,7 @@ func rewriteValue386_Op386MOVWstoreidx2_0(v *Value) bool { } // match: (MOVWstoreidx2 [c] {sym} ptr (ADDLconst [d] idx) val mem) // cond: - // result: (MOVWstoreidx2 [c+2*d] {sym} ptr idx val mem) + // result: (MOVWstoreidx2 [int64(int32(c+2*d))] {sym} ptr idx val mem) for { c := v.AuxInt sym := v.Aux @@ -8162,7 +8162,7 @@ func rewriteValue386_Op386MOVWstoreidx2_0(v *Value) bool { val := v.Args[2] mem := v.Args[3] v.reset(Op386MOVWstoreidx2) - v.AuxInt = c + 2*d + v.AuxInt = int64(int32(c + 2*d)) v.Aux = sym v.AddArg(ptr) v.AddArg(idx) diff --git a/test/fixedbugs/issue21655.go b/test/fixedbugs/issue21655.go index 4060c8ddbb..66d4e3a7f5 100644 --- a/test/fixedbugs/issue21655.go +++ b/test/fixedbugs/issue21655.go @@ -38,3 +38,25 @@ func f6(a []float32, i int64) float32 { // like 0x80000000 and silently using them as // signed 32 bit offsets.) // f4 was ok, but testing it can't hurt. + +func f7(ss []*string, i int) string { + const offset = 3 << 29 // 3<<29 * 4 = 3<<31 = 1<<31 mod 1<<32. + if i > offset { + return *ss[i-offset] + } + return "" +} +func f8(ss []*string, i int) string { + const offset = 3<<29 + 10 + if i > offset { + return *ss[i-offset] + } + return "" +} +func f9(ss []*string, i int) string { + const offset = 3<<29 - 10 + if i > offset { + return *ss[i-offset] + } + return "" +}