diff --git a/src/cmd/compile/internal/gc/walk.go b/src/cmd/compile/internal/gc/walk.go index 06910450ff..8ad7f6ace8 100644 --- a/src/cmd/compile/internal/gc/walk.go +++ b/src/cmd/compile/internal/gc/walk.go @@ -3658,7 +3658,8 @@ func usemethod(n *Node) { // Note: Don't rely on res0.Type.String() since its formatting depends on multiple factors // (including global variables such as numImports - was issue #19028). - if s := res0.Type.Sym; s != nil && s.Name == "Method" && s.Pkg != nil && s.Pkg.Path == "reflect" { + // Also need to check for reflect package itself (see Issue #38515). + if s := res0.Type.Sym; s != nil && s.Name == "Method" && s.Pkg != nil && (s.Pkg.Path == "reflect" || s.Pkg == localpkg && myimportpath == "reflect") { Curfn.Func.SetReflectMethod(true) } } diff --git a/src/cmd/compile/internal/ssa/gen/386.rules b/src/cmd/compile/internal/ssa/gen/386.rules index c0f4911313..6e30caaa0d 100644 --- a/src/cmd/compile/internal/ssa/gen/386.rules +++ b/src/cmd/compile/internal/ssa/gen/386.rules @@ -3,243 +3,243 @@ // license that can be found in the LICENSE file. // Lowering arithmetic -(Add(Ptr|32|16|8) ...) -> (ADDL ...) -(Add(32|64)F ...) -> (ADDS(S|D) ...) -(Add32carry ...) -> (ADDLcarry ...) -(Add32withcarry ...) -> (ADCL ...) +(Add(Ptr|32|16|8) ...) => (ADDL ...) +(Add(32|64)F ...) => (ADDS(S|D) ...) +(Add32carry ...) => (ADDLcarry ...) +(Add32withcarry ...) => (ADCL ...) -(Sub(Ptr|32|16|8) ...) -> (SUBL ...) -(Sub(32|64)F ...) -> (SUBS(S|D) ...) -(Sub32carry ...) -> (SUBLcarry ...) -(Sub32withcarry ...) -> (SBBL ...) +(Sub(Ptr|32|16|8) ...) => (SUBL ...) +(Sub(32|64)F ...) => (SUBS(S|D) ...) +(Sub32carry ...) => (SUBLcarry ...) +(Sub32withcarry ...) => (SBBL ...) -(Mul(32|16|8) ...) -> (MULL ...) -(Mul(32|64)F ...) -> (MULS(S|D) ...) -(Mul32uhilo ...) -> (MULLQU ...) +(Mul(32|16|8) ...) => (MULL ...) +(Mul(32|64)F ...) => (MULS(S|D) ...) +(Mul32uhilo ...) => (MULLQU ...) -(Select0 (Mul32uover x y)) -> (Select0 (MULLU x y)) -(Select1 (Mul32uover x y)) -> (SETO (Select1 (MULLU x y))) +(Select0 (Mul32uover x y)) => (Select0 (MULLU x y)) +(Select1 (Mul32uover x y)) => (SETO (Select1 (MULLU x y))) -(Avg32u ...) -> (AVGLU ...) +(Avg32u ...) => (AVGLU ...) -(Div(32|64)F ...) -> (DIVS(S|D) ...) -(Div(32|32u|16|16u) ...) -> (DIV(L|LU|W|WU) ...) -(Div8 x y) -> (DIVW (SignExt8to16 x) (SignExt8to16 y)) -(Div8u x y) -> (DIVWU (ZeroExt8to16 x) (ZeroExt8to16 y)) +(Div(32|64)F ...) => (DIVS(S|D) ...) +(Div(32|32u|16|16u) ...) => (DIV(L|LU|W|WU) ...) +(Div8 x y) => (DIVW (SignExt8to16 x) (SignExt8to16 y)) +(Div8u x y) => (DIVWU (ZeroExt8to16 x) (ZeroExt8to16 y)) -(Hmul(32|32u) ...) -> (HMUL(L|LU) ...) +(Hmul(32|32u) ...) => (HMUL(L|LU) ...) -(Mod(32|32u|16|16u) ...) -> (MOD(L|LU|W|WU) ...) -(Mod8 x y) -> (MODW (SignExt8to16 x) (SignExt8to16 y)) -(Mod8u x y) -> (MODWU (ZeroExt8to16 x) (ZeroExt8to16 y)) +(Mod(32|32u|16|16u) ...) => (MOD(L|LU|W|WU) ...) +(Mod8 x y) => (MODW (SignExt8to16 x) (SignExt8to16 y)) +(Mod8u x y) => (MODWU (ZeroExt8to16 x) (ZeroExt8to16 y)) -(And(32|16|8) ...) -> (ANDL ...) -(Or(32|16|8) ...) -> (ORL ...) -(Xor(32|16|8) ...) -> (XORL ...) +(And(32|16|8) ...) => (ANDL ...) +(Or(32|16|8) ...) => (ORL ...) +(Xor(32|16|8) ...) => (XORL ...) -(Neg(32|16|8) ...) -> (NEGL ...) -(Neg32F x) && !config.use387 -> (PXOR x (MOVSSconst [auxFrom32F(float32(math.Copysign(0, -1)))])) -(Neg64F x) && !config.use387 -> (PXOR x (MOVSDconst [auxFrom64F(math.Copysign(0, -1))])) -(Neg32F x) && config.use387 -> (FCHS x) -(Neg64F x) && config.use387 -> (FCHS x) +(Neg(32|16|8) ...) => (NEGL ...) +(Neg32F x) && !config.use387 => (PXOR x (MOVSSconst [float32(math.Copysign(0, -1))])) +(Neg64F x) && !config.use387 => (PXOR x (MOVSDconst [math.Copysign(0, -1)])) +(Neg32F x) && config.use387 => (FCHS x) +(Neg64F x) && config.use387 => (FCHS x) -(Com(32|16|8) ...) -> (NOTL ...) +(Com(32|16|8) ...) => (NOTL ...) // Lowering boolean ops -(AndB ...) -> (ANDL ...) -(OrB ...) -> (ORL ...) -(Not x) -> (XORLconst [1] x) +(AndB ...) => (ANDL ...) +(OrB ...) => (ORL ...) +(Not x) => (XORLconst [1] x) // Lowering pointer arithmetic -(OffPtr ...) -> (ADDLconst ...) +(OffPtr [off] ptr) => (ADDLconst [int32(off)] ptr) -(Bswap32 ...) -> (BSWAPL ...) +(Bswap32 ...) => (BSWAPL ...) -(Sqrt ...) -> (SQRTSD ...) +(Sqrt ...) => (SQRTSD ...) -(Ctz16 x) -> (BSFL (ORLconst [0x10000] x)) -(Ctz16NonZero ...) -> (BSFL ...) +(Ctz16 x) => (BSFL (ORLconst [0x10000] x)) +(Ctz16NonZero ...) => (BSFL ...) // Lowering extension -(SignExt8to16 ...) -> (MOVBLSX ...) -(SignExt8to32 ...) -> (MOVBLSX ...) -(SignExt16to32 ...) -> (MOVWLSX ...) +(SignExt8to16 ...) => (MOVBLSX ...) +(SignExt8to32 ...) => (MOVBLSX ...) +(SignExt16to32 ...) => (MOVWLSX ...) -(ZeroExt8to16 ...) -> (MOVBLZX ...) -(ZeroExt8to32 ...) -> (MOVBLZX ...) -(ZeroExt16to32 ...) -> (MOVWLZX ...) +(ZeroExt8to16 ...) => (MOVBLZX ...) +(ZeroExt8to32 ...) => (MOVBLZX ...) +(ZeroExt16to32 ...) => (MOVWLZX ...) -(Signmask x) -> (SARLconst x [31]) -(Zeromask x) -> (XORLconst [-1] (SBBLcarrymask (CMPLconst x [1]))) -(Slicemask x) -> (SARLconst (NEGL x) [31]) +(Signmask x) => (SARLconst x [31]) +(Zeromask x) => (XORLconst [-1] (SBBLcarrymask (CMPLconst x [1]))) +(Slicemask x) => (SARLconst (NEGL x) [31]) // Lowering truncation // Because we ignore high parts of registers, truncates are just copies. -(Trunc16to8 ...) -> (Copy ...) -(Trunc32to8 ...) -> (Copy ...) -(Trunc32to16 ...) -> (Copy ...) +(Trunc16to8 ...) => (Copy ...) +(Trunc32to8 ...) => (Copy ...) +(Trunc32to16 ...) => (Copy ...) // Lowering float <-> int -(Cvt32to32F ...) -> (CVTSL2SS ...) -(Cvt32to64F ...) -> (CVTSL2SD ...) +(Cvt32to32F ...) => (CVTSL2SS ...) +(Cvt32to64F ...) => (CVTSL2SD ...) -(Cvt32Fto32 ...) -> (CVTTSS2SL ...) -(Cvt64Fto32 ...) -> (CVTTSD2SL ...) +(Cvt32Fto32 ...) => (CVTTSS2SL ...) +(Cvt64Fto32 ...) => (CVTTSD2SL ...) -(Cvt32Fto64F ...) -> (CVTSS2SD ...) -(Cvt64Fto32F ...) -> (CVTSD2SS ...) +(Cvt32Fto64F ...) => (CVTSS2SD ...) +(Cvt64Fto32F ...) => (CVTSD2SS ...) -(Round32F ...) -> (Copy ...) -(Round64F ...) -> (Copy ...) +(Round32F ...) => (Copy ...) +(Round64F ...) => (Copy ...) -(CvtBoolToUint8 ...) -> (Copy ...) +(CvtBoolToUint8 ...) => (Copy ...) // Lowering shifts // Unsigned shifts need to return 0 if shift amount is >= width of shifted value. // result = (arg << shift) & (shift >= argbits ? 0 : 0xffffffffffffffff) -(Lsh32x(32|16|8) x y) && !shiftIsBounded(v) -> (ANDL (SHLL x y) (SBBLcarrymask (CMP(L|W|B)const y [32]))) -(Lsh16x(32|16|8) x y) && !shiftIsBounded(v) -> (ANDL (SHLL x y) (SBBLcarrymask (CMP(L|W|B)const y [32]))) -(Lsh8x(32|16|8) x y) && !shiftIsBounded(v) -> (ANDL (SHLL x y) (SBBLcarrymask (CMP(L|W|B)const y [32]))) +(Lsh32x(32|16|8) x y) && !shiftIsBounded(v) => (ANDL (SHLL x y) (SBBLcarrymask (CMP(L|W|B)const y [32]))) +(Lsh16x(32|16|8) x y) && !shiftIsBounded(v) => (ANDL (SHLL x y) (SBBLcarrymask (CMP(L|W|B)const y [32]))) +(Lsh8x(32|16|8) x y) && !shiftIsBounded(v) => (ANDL (SHLL x y) (SBBLcarrymask (CMP(L|W|B)const y [32]))) -(Lsh32x(32|16|8) x y) && shiftIsBounded(v) -> (SHLL x y) -(Lsh16x(32|16|8) x y) && shiftIsBounded(v) -> (SHLL x y) -(Lsh8x(32|16|8) x y) && shiftIsBounded(v) -> (SHLL x y) +(Lsh32x(32|16|8) x y) && shiftIsBounded(v) => (SHLL x y) +(Lsh16x(32|16|8) x y) && shiftIsBounded(v) => (SHLL x y) +(Lsh8x(32|16|8) x y) && shiftIsBounded(v) => (SHLL x y) -(Rsh32Ux(32|16|8) x y) && !shiftIsBounded(v) -> (ANDL (SHRL x y) (SBBLcarrymask (CMP(L|W|B)const y [32]))) -(Rsh16Ux(32|16|8) x y) && !shiftIsBounded(v) -> (ANDL (SHRW x y) (SBBLcarrymask (CMP(L|W|B)const y [16]))) -(Rsh8Ux(32|16|8) x y) && !shiftIsBounded(v) -> (ANDL (SHRB x y) (SBBLcarrymask (CMP(L|W|B)const y [8]))) +(Rsh32Ux(32|16|8) x y) && !shiftIsBounded(v) => (ANDL (SHRL x y) (SBBLcarrymask (CMP(L|W|B)const y [32]))) +(Rsh16Ux(32|16|8) x y) && !shiftIsBounded(v) => (ANDL (SHRW x y) (SBBLcarrymask (CMP(L|W|B)const y [16]))) +(Rsh8Ux(32|16|8) x y) && !shiftIsBounded(v) => (ANDL (SHRB x y) (SBBLcarrymask (CMP(L|W|B)const y [8]))) -(Rsh32Ux(32|16|8) x y) && shiftIsBounded(v) -> (SHRL x y) -(Rsh16Ux(32|16|8) x y) && shiftIsBounded(v) -> (SHRW x y) -(Rsh8Ux(32|16|8) x y) && shiftIsBounded(v) -> (SHRB x y) +(Rsh32Ux(32|16|8) x y) && shiftIsBounded(v) => (SHRL x y) +(Rsh16Ux(32|16|8) x y) && shiftIsBounded(v) => (SHRW x y) +(Rsh8Ux(32|16|8) x y) && shiftIsBounded(v) => (SHRB x y) // Signed right shift needs to return 0/-1 if shift amount is >= width of shifted value. // We implement this by setting the shift value to -1 (all ones) if the shift value is >= width. -(Rsh32x(32|16|8) x y) && !shiftIsBounded(v) -> (SARL x (ORL y (NOTL (SBBLcarrymask (CMP(L|W|B)const y [32]))))) -(Rsh16x(32|16|8) x y) && !shiftIsBounded(v) -> (SARW x (ORL y (NOTL (SBBLcarrymask (CMP(L|W|B)const y [16]))))) -(Rsh8x(32|16|8) x y) && !shiftIsBounded(v) -> (SARB x (ORL y (NOTL (SBBLcarrymask (CMP(L|W|B)const y [8]))))) +(Rsh32x(32|16|8) x y) && !shiftIsBounded(v) => (SARL x (ORL y (NOTL (SBBLcarrymask (CMP(L|W|B)const y [32]))))) +(Rsh16x(32|16|8) x y) && !shiftIsBounded(v) => (SARW x (ORL y (NOTL (SBBLcarrymask (CMP(L|W|B)const y [16]))))) +(Rsh8x(32|16|8) x y) && !shiftIsBounded(v) => (SARB x (ORL y (NOTL (SBBLcarrymask (CMP(L|W|B)const y [8]))))) -(Rsh32x(32|16|8) x y) && shiftIsBounded(v) -> (SARL x y) -(Rsh16x(32|16|8) x y) && shiftIsBounded(v) -> (SARW x y) -(Rsh8x(32|16|8) x y) && shiftIsBounded(v) -> (SARB x y) +(Rsh32x(32|16|8) x y) && shiftIsBounded(v) => (SARL x y) +(Rsh16x(32|16|8) x y) && shiftIsBounded(v) => (SARW x y) +(Rsh8x(32|16|8) x y) && shiftIsBounded(v) => (SARB x y) // constant shifts // generic opt rewrites all constant shifts to shift by Const64 -(Lsh32x64 x (Const64 [c])) && uint64(c) < 32 -> (SHLLconst x [c]) -(Rsh32x64 x (Const64 [c])) && uint64(c) < 32 -> (SARLconst x [c]) -(Rsh32Ux64 x (Const64 [c])) && uint64(c) < 32 -> (SHRLconst x [c]) -(Lsh16x64 x (Const64 [c])) && uint64(c) < 16 -> (SHLLconst x [c]) -(Rsh16x64 x (Const64 [c])) && uint64(c) < 16 -> (SARWconst x [c]) -(Rsh16Ux64 x (Const64 [c])) && uint64(c) < 16 -> (SHRWconst x [c]) -(Lsh8x64 x (Const64 [c])) && uint64(c) < 8 -> (SHLLconst x [c]) -(Rsh8x64 x (Const64 [c])) && uint64(c) < 8 -> (SARBconst x [c]) -(Rsh8Ux64 x (Const64 [c])) && uint64(c) < 8 -> (SHRBconst x [c]) +(Lsh32x64 x (Const64 [c])) && uint64(c) < 32 => (SHLLconst x [int32(c)]) +(Rsh32x64 x (Const64 [c])) && uint64(c) < 32 => (SARLconst x [int32(c)]) +(Rsh32Ux64 x (Const64 [c])) && uint64(c) < 32 => (SHRLconst x [int32(c)]) +(Lsh16x64 x (Const64 [c])) && uint64(c) < 16 => (SHLLconst x [int32(c)]) +(Rsh16x64 x (Const64 [c])) && uint64(c) < 16 => (SARWconst x [int16(c)]) +(Rsh16Ux64 x (Const64 [c])) && uint64(c) < 16 => (SHRWconst x [int16(c)]) +(Lsh8x64 x (Const64 [c])) && uint64(c) < 8 => (SHLLconst x [int32(c)]) +(Rsh8x64 x (Const64 [c])) && uint64(c) < 8 => (SARBconst x [int8(c)]) +(Rsh8Ux64 x (Const64 [c])) && uint64(c) < 8 => (SHRBconst x [int8(c)]) // large constant shifts -(Lsh32x64 _ (Const64 [c])) && uint64(c) >= 32 -> (Const32 [0]) -(Rsh32Ux64 _ (Const64 [c])) && uint64(c) >= 32 -> (Const32 [0]) -(Lsh16x64 _ (Const64 [c])) && uint64(c) >= 16 -> (Const16 [0]) -(Rsh16Ux64 _ (Const64 [c])) && uint64(c) >= 16 -> (Const16 [0]) -(Lsh8x64 _ (Const64 [c])) && uint64(c) >= 8 -> (Const8 [0]) -(Rsh8Ux64 _ (Const64 [c])) && uint64(c) >= 8 -> (Const8 [0]) +(Lsh32x64 _ (Const64 [c])) && uint64(c) >= 32 => (Const32 [0]) +(Rsh32Ux64 _ (Const64 [c])) && uint64(c) >= 32 => (Const32 [0]) +(Lsh16x64 _ (Const64 [c])) && uint64(c) >= 16 => (Const16 [0]) +(Rsh16Ux64 _ (Const64 [c])) && uint64(c) >= 16 => (Const16 [0]) +(Lsh8x64 _ (Const64 [c])) && uint64(c) >= 8 => (Const8 [0]) +(Rsh8Ux64 _ (Const64 [c])) && uint64(c) >= 8 => (Const8 [0]) // large constant signed right shift, we leave the sign bit -(Rsh32x64 x (Const64 [c])) && uint64(c) >= 32 -> (SARLconst x [31]) -(Rsh16x64 x (Const64 [c])) && uint64(c) >= 16 -> (SARWconst x [15]) -(Rsh8x64 x (Const64 [c])) && uint64(c) >= 8 -> (SARBconst x [7]) +(Rsh32x64 x (Const64 [c])) && uint64(c) >= 32 => (SARLconst x [31]) +(Rsh16x64 x (Const64 [c])) && uint64(c) >= 16 => (SARWconst x [15]) +(Rsh8x64 x (Const64 [c])) && uint64(c) >= 8 => (SARBconst x [7]) // constant rotates -(RotateLeft32 x (MOVLconst [c])) -> (ROLLconst [c&31] x) -(RotateLeft16 x (MOVLconst [c])) -> (ROLWconst [c&15] x) -(RotateLeft8 x (MOVLconst [c])) -> (ROLBconst [c&7] x) +(RotateLeft32 x (MOVLconst [c])) => (ROLLconst [c&31] x) +(RotateLeft16 x (MOVLconst [c])) => (ROLWconst [int16(c&15)] x) +(RotateLeft8 x (MOVLconst [c])) => (ROLBconst [int8(c&7)] x) // Lowering comparisons -(Less32 x y) -> (SETL (CMPL x y)) -(Less16 x y) -> (SETL (CMPW x y)) -(Less8 x y) -> (SETL (CMPB x y)) -(Less32U x y) -> (SETB (CMPL x y)) -(Less16U x y) -> (SETB (CMPW x y)) -(Less8U x y) -> (SETB (CMPB x y)) +(Less32 x y) => (SETL (CMPL x y)) +(Less16 x y) => (SETL (CMPW x y)) +(Less8 x y) => (SETL (CMPB x y)) +(Less32U x y) => (SETB (CMPL x y)) +(Less16U x y) => (SETB (CMPW x y)) +(Less8U x y) => (SETB (CMPB x y)) // Use SETGF with reversed operands to dodge NaN case -(Less64F x y) -> (SETGF (UCOMISD y x)) -(Less32F x y) -> (SETGF (UCOMISS y x)) +(Less64F x y) => (SETGF (UCOMISD y x)) +(Less32F x y) => (SETGF (UCOMISS y x)) -(Leq32 x y) -> (SETLE (CMPL x y)) -(Leq16 x y) -> (SETLE (CMPW x y)) -(Leq8 x y) -> (SETLE (CMPB x y)) -(Leq32U x y) -> (SETBE (CMPL x y)) -(Leq16U x y) -> (SETBE (CMPW x y)) -(Leq8U x y) -> (SETBE (CMPB x y)) +(Leq32 x y) => (SETLE (CMPL x y)) +(Leq16 x y) => (SETLE (CMPW x y)) +(Leq8 x y) => (SETLE (CMPB x y)) +(Leq32U x y) => (SETBE (CMPL x y)) +(Leq16U x y) => (SETBE (CMPW x y)) +(Leq8U x y) => (SETBE (CMPB x y)) // Use SETGEF with reversed operands to dodge NaN case -(Leq64F x y) -> (SETGEF (UCOMISD y x)) -(Leq32F x y) -> (SETGEF (UCOMISS y x)) +(Leq64F x y) => (SETGEF (UCOMISD y x)) +(Leq32F x y) => (SETGEF (UCOMISS y x)) -(Eq32 x y) -> (SETEQ (CMPL x y)) -(Eq16 x y) -> (SETEQ (CMPW x y)) -(Eq8 x y) -> (SETEQ (CMPB x y)) -(EqB x y) -> (SETEQ (CMPB x y)) -(EqPtr x y) -> (SETEQ (CMPL x y)) -(Eq64F x y) -> (SETEQF (UCOMISD x y)) -(Eq32F x y) -> (SETEQF (UCOMISS x y)) +(Eq32 x y) => (SETEQ (CMPL x y)) +(Eq16 x y) => (SETEQ (CMPW x y)) +(Eq8 x y) => (SETEQ (CMPB x y)) +(EqB x y) => (SETEQ (CMPB x y)) +(EqPtr x y) => (SETEQ (CMPL x y)) +(Eq64F x y) => (SETEQF (UCOMISD x y)) +(Eq32F x y) => (SETEQF (UCOMISS x y)) -(Neq32 x y) -> (SETNE (CMPL x y)) -(Neq16 x y) -> (SETNE (CMPW x y)) -(Neq8 x y) -> (SETNE (CMPB x y)) -(NeqB x y) -> (SETNE (CMPB x y)) -(NeqPtr x y) -> (SETNE (CMPL x y)) -(Neq64F x y) -> (SETNEF (UCOMISD x y)) -(Neq32F x y) -> (SETNEF (UCOMISS x y)) +(Neq32 x y) => (SETNE (CMPL x y)) +(Neq16 x y) => (SETNE (CMPW x y)) +(Neq8 x y) => (SETNE (CMPB x y)) +(NeqB x y) => (SETNE (CMPB x y)) +(NeqPtr x y) => (SETNE (CMPL x y)) +(Neq64F x y) => (SETNEF (UCOMISD x y)) +(Neq32F x y) => (SETNEF (UCOMISS x y)) // Lowering loads -(Load ptr mem) && (is32BitInt(t) || isPtr(t)) -> (MOVLload ptr mem) -(Load ptr mem) && is16BitInt(t) -> (MOVWload ptr mem) -(Load ptr mem) && (t.IsBoolean() || is8BitInt(t)) -> (MOVBload ptr mem) -(Load ptr mem) && is32BitFloat(t) -> (MOVSSload ptr mem) -(Load ptr mem) && is64BitFloat(t) -> (MOVSDload ptr mem) +(Load ptr mem) && (is32BitInt(t) || isPtr(t)) => (MOVLload ptr mem) +(Load ptr mem) && is16BitInt(t) => (MOVWload ptr mem) +(Load ptr mem) && (t.IsBoolean() || is8BitInt(t)) => (MOVBload ptr mem) +(Load ptr mem) && is32BitFloat(t) => (MOVSSload ptr mem) +(Load ptr mem) && is64BitFloat(t) => (MOVSDload ptr mem) // Lowering stores // These more-specific FP versions of Store pattern should come first. -(Store {t} ptr val mem) && t.(*types.Type).Size() == 8 && is64BitFloat(val.Type) -> (MOVSDstore ptr val mem) -(Store {t} ptr val mem) && t.(*types.Type).Size() == 4 && is32BitFloat(val.Type) -> (MOVSSstore ptr val mem) +(Store {t} ptr val mem) && t.Size() == 8 && is64BitFloat(val.Type) => (MOVSDstore ptr val mem) +(Store {t} ptr val mem) && t.Size() == 4 && is32BitFloat(val.Type) => (MOVSSstore ptr val mem) -(Store {t} ptr val mem) && t.(*types.Type).Size() == 4 -> (MOVLstore ptr val mem) -(Store {t} ptr val mem) && t.(*types.Type).Size() == 2 -> (MOVWstore ptr val mem) -(Store {t} ptr val mem) && t.(*types.Type).Size() == 1 -> (MOVBstore ptr val mem) +(Store {t} ptr val mem) && t.Size() == 4 => (MOVLstore ptr val mem) +(Store {t} ptr val mem) && t.Size() == 2 => (MOVWstore ptr val mem) +(Store {t} ptr val mem) && t.Size() == 1 => (MOVBstore ptr val mem) // Lowering moves -(Move [0] _ _ mem) -> mem -(Move [1] dst src mem) -> (MOVBstore dst (MOVBload src mem) mem) -(Move [2] dst src mem) -> (MOVWstore dst (MOVWload src mem) mem) -(Move [4] dst src mem) -> (MOVLstore dst (MOVLload src mem) mem) -(Move [3] dst src mem) -> +(Move [0] _ _ mem) => mem +(Move [1] dst src mem) => (MOVBstore dst (MOVBload src mem) mem) +(Move [2] dst src mem) => (MOVWstore dst (MOVWload src mem) mem) +(Move [4] dst src mem) => (MOVLstore dst (MOVLload src mem) mem) +(Move [3] dst src mem) => (MOVBstore [2] dst (MOVBload [2] src mem) (MOVWstore dst (MOVWload src mem) mem)) -(Move [5] dst src mem) -> +(Move [5] dst src mem) => (MOVBstore [4] dst (MOVBload [4] src mem) (MOVLstore dst (MOVLload src mem) mem)) -(Move [6] dst src mem) -> +(Move [6] dst src mem) => (MOVWstore [4] dst (MOVWload [4] src mem) (MOVLstore dst (MOVLload src mem) mem)) -(Move [7] dst src mem) -> +(Move [7] dst src mem) => (MOVLstore [3] dst (MOVLload [3] src mem) (MOVLstore dst (MOVLload src mem) mem)) -(Move [8] dst src mem) -> +(Move [8] dst src mem) => (MOVLstore [4] dst (MOVLload [4] src mem) (MOVLstore dst (MOVLload src mem) mem)) // Adjust moves to be a multiple of 4 bytes. (Move [s] dst src mem) - && s > 8 && s%4 != 0 -> + && s > 8 && s%4 != 0 => (Move [s-s%4] - (ADDLconst dst [s%4]) - (ADDLconst src [s%4]) + (ADDLconst dst [int32(s%4)]) + (ADDLconst src [int32(s%4)]) (MOVLstore dst (MOVLload src mem) mem)) // Medium copying uses a duff device. (Move [s] dst src mem) && s > 8 && s <= 4*128 && s%4 == 0 - && !config.noDuffDevice && logLargeCopy(v, s) -> + && !config.noDuffDevice && logLargeCopy(v, s) => (DUFFCOPY [10*(128-s/4)] dst src mem) // 10 and 128 are magic constants. 10 is the number of bytes to encode: // MOVL (SI), CX @@ -249,27 +249,27 @@ // and 128 is the number of such blocks. See src/runtime/duff_386.s:duffcopy. // Large copying uses REP MOVSL. -(Move [s] dst src mem) && (s > 4*128 || config.noDuffDevice) && s%4 == 0 && logLargeCopy(v, s) -> - (REPMOVSL dst src (MOVLconst [s/4]) mem) +(Move [s] dst src mem) && (s > 4*128 || config.noDuffDevice) && s%4 == 0 && logLargeCopy(v, s) => + (REPMOVSL dst src (MOVLconst [int32(s/4)]) mem) // Lowering Zero instructions -(Zero [0] _ mem) -> mem -(Zero [1] destptr mem) -> (MOVBstoreconst [0] destptr mem) -(Zero [2] destptr mem) -> (MOVWstoreconst [0] destptr mem) -(Zero [4] destptr mem) -> (MOVLstoreconst [0] destptr mem) +(Zero [0] _ mem) => mem +(Zero [1] destptr mem) => (MOVBstoreconst [0] destptr mem) +(Zero [2] destptr mem) => (MOVWstoreconst [0] destptr mem) +(Zero [4] destptr mem) => (MOVLstoreconst [0] destptr mem) -(Zero [3] destptr mem) -> - (MOVBstoreconst [makeValAndOff(0,2)] destptr - (MOVWstoreconst [0] destptr mem)) -(Zero [5] destptr mem) -> - (MOVBstoreconst [makeValAndOff(0,4)] destptr - (MOVLstoreconst [0] destptr mem)) -(Zero [6] destptr mem) -> - (MOVWstoreconst [makeValAndOff(0,4)] destptr - (MOVLstoreconst [0] destptr mem)) -(Zero [7] destptr mem) -> - (MOVLstoreconst [makeValAndOff(0,3)] destptr - (MOVLstoreconst [0] destptr mem)) +(Zero [3] destptr mem) => + (MOVBstoreconst [makeValAndOff32(0,2)] destptr + (MOVWstoreconst [makeValAndOff32(0,0)] destptr mem)) +(Zero [5] destptr mem) => + (MOVBstoreconst [makeValAndOff32(0,4)] destptr + (MOVLstoreconst [makeValAndOff32(0,0)] destptr mem)) +(Zero [6] destptr mem) => + (MOVWstoreconst [makeValAndOff32(0,4)] destptr + (MOVLstoreconst [makeValAndOff32(0,0)] destptr mem)) +(Zero [7] destptr mem) => + (MOVLstoreconst [makeValAndOff32(0,3)] destptr + (MOVLstoreconst [makeValAndOff32(0,0)] destptr mem)) // Strip off any fractional word zeroing. (Zero [s] destptr mem) && s%4 != 0 && s > 4 -> @@ -277,23 +277,23 @@ (MOVLstoreconst [0] destptr mem)) // Zero small numbers of words directly. -(Zero [8] destptr mem) -> - (MOVLstoreconst [makeValAndOff(0,4)] destptr - (MOVLstoreconst [0] destptr mem)) -(Zero [12] destptr mem) -> - (MOVLstoreconst [makeValAndOff(0,8)] destptr - (MOVLstoreconst [makeValAndOff(0,4)] destptr - (MOVLstoreconst [0] destptr mem))) -(Zero [16] destptr mem) -> - (MOVLstoreconst [makeValAndOff(0,12)] destptr - (MOVLstoreconst [makeValAndOff(0,8)] destptr - (MOVLstoreconst [makeValAndOff(0,4)] destptr - (MOVLstoreconst [0] destptr mem)))) +(Zero [8] destptr mem) => + (MOVLstoreconst [makeValAndOff32(0,4)] destptr + (MOVLstoreconst [makeValAndOff32(0,0)] destptr mem)) +(Zero [12] destptr mem) => + (MOVLstoreconst [makeValAndOff32(0,8)] destptr + (MOVLstoreconst [makeValAndOff32(0,4)] destptr + (MOVLstoreconst [makeValAndOff32(0,0)] destptr mem))) +(Zero [16] destptr mem) => + (MOVLstoreconst [makeValAndOff32(0,12)] destptr + (MOVLstoreconst [makeValAndOff32(0,8)] destptr + (MOVLstoreconst [makeValAndOff32(0,4)] destptr + (MOVLstoreconst [makeValAndOff32(0,0)] destptr mem)))) // Medium zeroing uses a duff device. (Zero [s] destptr mem) && s > 16 && s <= 4*128 && s%4 == 0 - && !config.noDuffDevice -> + && !config.noDuffDevice => (DUFFZERO [1*(128-s/4)] destptr (MOVLconst [0]) mem) // 1 and 128 are magic constants. 1 is the number of bytes to encode STOSL. // 128 is the number of STOSL instructions in duffzero. @@ -302,63 +302,66 @@ // Large zeroing uses REP STOSQ. (Zero [s] destptr mem) && (s > 4*128 || (config.noDuffDevice && s > 16)) - && s%4 == 0 -> - (REPSTOSL destptr (MOVLconst [s/4]) (MOVLconst [0]) mem) + && s%4 == 0 => + (REPSTOSL destptr (MOVLconst [int32(s/4)]) (MOVLconst [0]) mem) + // Lowering constants -(Const(8|16|32) ...) -> (MOVLconst ...) -(Const(32|64)F ...) -> (MOVS(S|D)const ...) -(ConstNil) -> (MOVLconst [0]) -(ConstBool ...) -> (MOVLconst ...) +(Const8 [c]) => (MOVLconst [int32(c)]) +(Const16 [c]) => (MOVLconst [int32(c)]) +(Const32 ...) => (MOVLconst ...) +(Const(32|64)F ...) => (MOVS(S|D)const ...) +(ConstNil) => (MOVLconst [0]) +(ConstBool [c]) => (MOVLconst [int32(b2i(c))]) // Lowering calls -(StaticCall ...) -> (CALLstatic ...) -(ClosureCall ...) -> (CALLclosure ...) -(InterCall ...) -> (CALLinter ...) +(StaticCall ...) => (CALLstatic ...) +(ClosureCall ...) => (CALLclosure ...) +(InterCall ...) => (CALLinter ...) // Miscellaneous -(IsNonNil p) -> (SETNE (TESTL p p)) -(IsInBounds idx len) -> (SETB (CMPL idx len)) -(IsSliceInBounds idx len) -> (SETBE (CMPL idx len)) -(NilCheck ...) -> (LoweredNilCheck ...) -(GetG ...) -> (LoweredGetG ...) -(GetClosurePtr ...) -> (LoweredGetClosurePtr ...) -(GetCallerPC ...) -> (LoweredGetCallerPC ...) -(GetCallerSP ...) -> (LoweredGetCallerSP ...) -(Addr ...) -> (LEAL ...) -(LocalAddr {sym} base _) -> (LEAL {sym} base) +(IsNonNil p) => (SETNE (TESTL p p)) +(IsInBounds idx len) => (SETB (CMPL idx len)) +(IsSliceInBounds idx len) => (SETBE (CMPL idx len)) +(NilCheck ...) => (LoweredNilCheck ...) +(GetG ...) => (LoweredGetG ...) +(GetClosurePtr ...) => (LoweredGetClosurePtr ...) +(GetCallerPC ...) => (LoweredGetCallerPC ...) +(GetCallerSP ...) => (LoweredGetCallerSP ...) +(Addr {sym} base) => (LEAL {sym} base) +(LocalAddr {sym} base _) => (LEAL {sym} base) // block rewrites -(If (SETL cmp) yes no) -> (LT cmp yes no) -(If (SETLE cmp) yes no) -> (LE cmp yes no) -(If (SETG cmp) yes no) -> (GT cmp yes no) -(If (SETGE cmp) yes no) -> (GE cmp yes no) -(If (SETEQ cmp) yes no) -> (EQ cmp yes no) -(If (SETNE cmp) yes no) -> (NE cmp yes no) -(If (SETB cmp) yes no) -> (ULT cmp yes no) -(If (SETBE cmp) yes no) -> (ULE cmp yes no) -(If (SETA cmp) yes no) -> (UGT cmp yes no) -(If (SETAE cmp) yes no) -> (UGE cmp yes no) -(If (SETO cmp) yes no) -> (OS cmp yes no) +(If (SETL cmp) yes no) => (LT cmp yes no) +(If (SETLE cmp) yes no) => (LE cmp yes no) +(If (SETG cmp) yes no) => (GT cmp yes no) +(If (SETGE cmp) yes no) => (GE cmp yes no) +(If (SETEQ cmp) yes no) => (EQ cmp yes no) +(If (SETNE cmp) yes no) => (NE cmp yes no) +(If (SETB cmp) yes no) => (ULT cmp yes no) +(If (SETBE cmp) yes no) => (ULE cmp yes no) +(If (SETA cmp) yes no) => (UGT cmp yes no) +(If (SETAE cmp) yes no) => (UGE cmp yes no) +(If (SETO cmp) yes no) => (OS cmp yes no) // Special case for floating point - LF/LEF not generated -(If (SETGF cmp) yes no) -> (UGT cmp yes no) -(If (SETGEF cmp) yes no) -> (UGE cmp yes no) -(If (SETEQF cmp) yes no) -> (EQF cmp yes no) -(If (SETNEF cmp) yes no) -> (NEF cmp yes no) +(If (SETGF cmp) yes no) => (UGT cmp yes no) +(If (SETGEF cmp) yes no) => (UGE cmp yes no) +(If (SETEQF cmp) yes no) => (EQF cmp yes no) +(If (SETNEF cmp) yes no) => (NEF cmp yes no) -(If cond yes no) -> (NE (TESTB cond cond) yes no) +(If cond yes no) => (NE (TESTB cond cond) yes no) // Write barrier. -(WB ...) -> (LoweredWB ...) +(WB ...) => (LoweredWB ...) -(PanicBounds [kind] x y mem) && boundsABI(kind) == 0 -> (LoweredPanicBoundsA [kind] x y mem) -(PanicBounds [kind] x y mem) && boundsABI(kind) == 1 -> (LoweredPanicBoundsB [kind] x y mem) -(PanicBounds [kind] x y mem) && boundsABI(kind) == 2 -> (LoweredPanicBoundsC [kind] x y mem) +(PanicBounds [kind] x y mem) && boundsABI(kind) == 0 => (LoweredPanicBoundsA [kind] x y mem) +(PanicBounds [kind] x y mem) && boundsABI(kind) == 1 => (LoweredPanicBoundsB [kind] x y mem) +(PanicBounds [kind] x y mem) && boundsABI(kind) == 2 => (LoweredPanicBoundsC [kind] x y mem) -(PanicExtend [kind] hi lo y mem) && boundsABI(kind) == 0 -> (LoweredPanicExtendA [kind] hi lo y mem) -(PanicExtend [kind] hi lo y mem) && boundsABI(kind) == 1 -> (LoweredPanicExtendB [kind] hi lo y mem) -(PanicExtend [kind] hi lo y mem) && boundsABI(kind) == 2 -> (LoweredPanicExtendC [kind] hi lo y mem) +(PanicExtend [kind] hi lo y mem) && boundsABI(kind) == 0 => (LoweredPanicExtendA [kind] hi lo y mem) +(PanicExtend [kind] hi lo y mem) && boundsABI(kind) == 1 => (LoweredPanicExtendB [kind] hi lo y mem) +(PanicExtend [kind] hi lo y mem) && boundsABI(kind) == 2 => (LoweredPanicExtendC [kind] hi lo y mem) // *************************** // Above: lowering rules diff --git a/src/cmd/compile/internal/ssa/gen/generic.rules b/src/cmd/compile/internal/ssa/gen/generic.rules index e581ad58f4..15d80afb45 100644 --- a/src/cmd/compile/internal/ssa/gen/generic.rules +++ b/src/cmd/compile/internal/ssa/gen/generic.rules @@ -266,52 +266,52 @@ (Neq8 (Const8 [c]) (Add8 (Const8 [d]) x)) -> (Neq8 (Const8 [int64(int8(c-d))]) x) // signed integer range: ( c <= x && x (<|<=) d ) -> ( unsigned(x-c) (<|<=) unsigned(d-c) ) -(AndB (Leq64 (Const64 [c]) x) ((Less|Leq)64 x (Const64 [d]))) && d >= c -> ((Less|Leq)64U (Sub64 x (Const64 [c])) (Const64 [d-c])) -(AndB (Leq32 (Const32 [c]) x) ((Less|Leq)32 x (Const32 [d]))) && d >= c -> ((Less|Leq)32U (Sub32 x (Const32 [c])) (Const32 [d-c])) -(AndB (Leq16 (Const16 [c]) x) ((Less|Leq)16 x (Const16 [d]))) && d >= c -> ((Less|Leq)16U (Sub16 x (Const16 [c])) (Const16 [d-c])) -(AndB (Leq8 (Const8 [c]) x) ((Less|Leq)8 x (Const8 [d]))) && d >= c -> ((Less|Leq)8U (Sub8 x (Const8 [c])) (Const8 [d-c])) +(AndB (Leq64 (Const64 [c]) x) ((Less|Leq)64 x (Const64 [d]))) && d >= c => ((Less|Leq)64U (Sub64 x (Const64 [c])) (Const64 [d-c])) +(AndB (Leq32 (Const32 [c]) x) ((Less|Leq)32 x (Const32 [d]))) && d >= c => ((Less|Leq)32U (Sub32 x (Const32 [c])) (Const32 [d-c])) +(AndB (Leq16 (Const16 [c]) x) ((Less|Leq)16 x (Const16 [d]))) && d >= c => ((Less|Leq)16U (Sub16 x (Const16 [c])) (Const16 [d-c])) +(AndB (Leq8 (Const8 [c]) x) ((Less|Leq)8 x (Const8 [d]))) && d >= c => ((Less|Leq)8U (Sub8 x (Const8 [c])) (Const8 [d-c])) // signed integer range: ( c < x && x (<|<=) d ) -> ( unsigned(x-(c+1)) (<|<=) unsigned(d-(c+1)) ) -(AndB (Less64 (Const64 [c]) x) ((Less|Leq)64 x (Const64 [d]))) && d >= c+1 && int64(c+1) > int64(c) -> ((Less|Leq)64U (Sub64 x (Const64 [c+1])) (Const64 [d-c-1])) -(AndB (Less32 (Const32 [c]) x) ((Less|Leq)32 x (Const32 [d]))) && d >= c+1 && int32(c+1) > int32(c) -> ((Less|Leq)32U (Sub32 x (Const32 [c+1])) (Const32 [d-c-1])) -(AndB (Less16 (Const16 [c]) x) ((Less|Leq)16 x (Const16 [d]))) && d >= c+1 && int16(c+1) > int16(c) -> ((Less|Leq)16U (Sub16 x (Const16 [c+1])) (Const16 [d-c-1])) -(AndB (Less8 (Const8 [c]) x) ((Less|Leq)8 x (Const8 [d]))) && d >= c+1 && int8(c+1) > int8(c) -> ((Less|Leq)8U (Sub8 x (Const8 [c+1])) (Const8 [d-c-1])) +(AndB (Less64 (Const64 [c]) x) ((Less|Leq)64 x (Const64 [d]))) && d >= c+1 && c+1 > c => ((Less|Leq)64U (Sub64 x (Const64 [c+1])) (Const64 [d-c-1])) +(AndB (Less32 (Const32 [c]) x) ((Less|Leq)32 x (Const32 [d]))) && d >= c+1 && c+1 > c => ((Less|Leq)32U (Sub32 x (Const32 [c+1])) (Const32 [d-c-1])) +(AndB (Less16 (Const16 [c]) x) ((Less|Leq)16 x (Const16 [d]))) && d >= c+1 && c+1 > c => ((Less|Leq)16U (Sub16 x (Const16 [c+1])) (Const16 [d-c-1])) +(AndB (Less8 (Const8 [c]) x) ((Less|Leq)8 x (Const8 [d]))) && d >= c+1 && c+1 > c => ((Less|Leq)8U (Sub8 x (Const8 [c+1])) (Const8 [d-c-1])) // unsigned integer range: ( c <= x && x (<|<=) d ) -> ( x-c (<|<=) d-c ) -(AndB (Leq64U (Const64 [c]) x) ((Less|Leq)64U x (Const64 [d]))) && uint64(d) >= uint64(c) -> ((Less|Leq)64U (Sub64 x (Const64 [c])) (Const64 [d-c])) -(AndB (Leq32U (Const32 [c]) x) ((Less|Leq)32U x (Const32 [d]))) && uint32(d) >= uint32(c) -> ((Less|Leq)32U (Sub32 x (Const32 [c])) (Const32 [int64(int32(d-c))])) -(AndB (Leq16U (Const16 [c]) x) ((Less|Leq)16U x (Const16 [d]))) && uint16(d) >= uint16(c) -> ((Less|Leq)16U (Sub16 x (Const16 [c])) (Const16 [int64(int16(d-c))])) -(AndB (Leq8U (Const8 [c]) x) ((Less|Leq)8U x (Const8 [d]))) && uint8(d) >= uint8(c) -> ((Less|Leq)8U (Sub8 x (Const8 [c])) (Const8 [int64(int8(d-c))])) +(AndB (Leq64U (Const64 [c]) x) ((Less|Leq)64U x (Const64 [d]))) && uint64(d) >= uint64(c) => ((Less|Leq)64U (Sub64 x (Const64 [c])) (Const64 [d-c])) +(AndB (Leq32U (Const32 [c]) x) ((Less|Leq)32U x (Const32 [d]))) && uint32(d) >= uint32(c) => ((Less|Leq)32U (Sub32 x (Const32 [c])) (Const32 [d-c])) +(AndB (Leq16U (Const16 [c]) x) ((Less|Leq)16U x (Const16 [d]))) && uint16(d) >= uint16(c) => ((Less|Leq)16U (Sub16 x (Const16 [c])) (Const16 [d-c])) +(AndB (Leq8U (Const8 [c]) x) ((Less|Leq)8U x (Const8 [d]))) && uint8(d) >= uint8(c) => ((Less|Leq)8U (Sub8 x (Const8 [c])) (Const8 [d-c])) // unsigned integer range: ( c < x && x (<|<=) d ) -> ( x-(c+1) (<|<=) d-(c+1) ) -(AndB (Less64U (Const64 [c]) x) ((Less|Leq)64U x (Const64 [d]))) && uint64(d) >= uint64(c+1) && uint64(c+1) > uint64(c) -> ((Less|Leq)64U (Sub64 x (Const64 [c+1])) (Const64 [d-c-1])) -(AndB (Less32U (Const32 [c]) x) ((Less|Leq)32U x (Const32 [d]))) && uint32(d) >= uint32(c+1) && uint32(c+1) > uint32(c) -> ((Less|Leq)32U (Sub32 x (Const32 [int64(int32(c+1))])) (Const32 [int64(int32(d-c-1))])) -(AndB (Less16U (Const16 [c]) x) ((Less|Leq)16U x (Const16 [d]))) && uint16(d) >= uint16(c+1) && uint16(c+1) > uint16(c) -> ((Less|Leq)16U (Sub16 x (Const16 [int64(int16(c+1))])) (Const16 [int64(int16(d-c-1))])) -(AndB (Less8U (Const8 [c]) x) ((Less|Leq)8U x (Const8 [d]))) && uint8(d) >= uint8(c+1) && uint8(c+1) > uint8(c) -> ((Less|Leq)8U (Sub8 x (Const8 [int64(int8(c+1))])) (Const8 [int64(int8(d-c-1))])) +(AndB (Less64U (Const64 [c]) x) ((Less|Leq)64U x (Const64 [d]))) && uint64(d) >= uint64(c+1) && uint64(c+1) > uint64(c) => ((Less|Leq)64U (Sub64 x (Const64 [c+1])) (Const64 [d-c-1])) +(AndB (Less32U (Const32 [c]) x) ((Less|Leq)32U x (Const32 [d]))) && uint32(d) >= uint32(c+1) && uint32(c+1) > uint32(c) => ((Less|Leq)32U (Sub32 x (Const32 [c+1])) (Const32 [d-c-1])) +(AndB (Less16U (Const16 [c]) x) ((Less|Leq)16U x (Const16 [d]))) && uint16(d) >= uint16(c+1) && uint16(c+1) > uint16(c) => ((Less|Leq)16U (Sub16 x (Const16 [c+1])) (Const16 [d-c-1])) +(AndB (Less8U (Const8 [c]) x) ((Less|Leq)8U x (Const8 [d]))) && uint8(d) >= uint8(c+1) && uint8(c+1) > uint8(c) => ((Less|Leq)8U (Sub8 x (Const8 [c+1])) (Const8 [d-c-1])) // signed integer range: ( c (<|<=) x || x < d ) -> ( unsigned(c-d) (<|<=) unsigned(x-d) ) -(OrB ((Less|Leq)64 (Const64 [c]) x) (Less64 x (Const64 [d]))) && c >= d -> ((Less|Leq)64U (Const64 [c-d]) (Sub64 x (Const64 [d]))) -(OrB ((Less|Leq)32 (Const32 [c]) x) (Less32 x (Const32 [d]))) && c >= d -> ((Less|Leq)32U (Const32 [c-d]) (Sub32 x (Const32 [d]))) -(OrB ((Less|Leq)16 (Const16 [c]) x) (Less16 x (Const16 [d]))) && c >= d -> ((Less|Leq)16U (Const16 [c-d]) (Sub16 x (Const16 [d]))) -(OrB ((Less|Leq)8 (Const8 [c]) x) (Less8 x (Const8 [d]))) && c >= d -> ((Less|Leq)8U (Const8 [c-d]) (Sub8 x (Const8 [d]))) +(OrB ((Less|Leq)64 (Const64 [c]) x) (Less64 x (Const64 [d]))) && c >= d => ((Less|Leq)64U (Const64 [c-d]) (Sub64 x (Const64 [d]))) +(OrB ((Less|Leq)32 (Const32 [c]) x) (Less32 x (Const32 [d]))) && c >= d => ((Less|Leq)32U (Const32 [c-d]) (Sub32 x (Const32 [d]))) +(OrB ((Less|Leq)16 (Const16 [c]) x) (Less16 x (Const16 [d]))) && c >= d => ((Less|Leq)16U (Const16 [c-d]) (Sub16 x (Const16 [d]))) +(OrB ((Less|Leq)8 (Const8 [c]) x) (Less8 x (Const8 [d]))) && c >= d => ((Less|Leq)8U (Const8 [c-d]) (Sub8 x (Const8 [d]))) // signed integer range: ( c (<|<=) x || x <= d ) -> ( unsigned(c-(d+1)) (<|<=) unsigned(x-(d+1)) ) -(OrB ((Less|Leq)64 (Const64 [c]) x) (Leq64 x (Const64 [d]))) && c >= d+1 && int64(d+1) > int64(d) -> ((Less|Leq)64U (Const64 [c-d-1]) (Sub64 x (Const64 [d+1]))) -(OrB ((Less|Leq)32 (Const32 [c]) x) (Leq32 x (Const32 [d]))) && c >= d+1 && int32(d+1) > int32(d) -> ((Less|Leq)32U (Const32 [c-d-1]) (Sub32 x (Const32 [d+1]))) -(OrB ((Less|Leq)16 (Const16 [c]) x) (Leq16 x (Const16 [d]))) && c >= d+1 && int16(d+1) > int16(d) -> ((Less|Leq)16U (Const16 [c-d-1]) (Sub16 x (Const16 [d+1]))) -(OrB ((Less|Leq)8 (Const8 [c]) x) (Leq8 x (Const8 [d]))) && c >= d+1 && int8(d+1) > int8(d) -> ((Less|Leq)8U (Const8 [c-d-1]) (Sub8 x (Const8 [d+1]))) +(OrB ((Less|Leq)64 (Const64 [c]) x) (Leq64 x (Const64 [d]))) && c >= d+1 && d+1 > d => ((Less|Leq)64U (Const64 [c-d-1]) (Sub64 x (Const64 [d+1]))) +(OrB ((Less|Leq)32 (Const32 [c]) x) (Leq32 x (Const32 [d]))) && c >= d+1 && d+1 > d => ((Less|Leq)32U (Const32 [c-d-1]) (Sub32 x (Const32 [d+1]))) +(OrB ((Less|Leq)16 (Const16 [c]) x) (Leq16 x (Const16 [d]))) && c >= d+1 && d+1 > d => ((Less|Leq)16U (Const16 [c-d-1]) (Sub16 x (Const16 [d+1]))) +(OrB ((Less|Leq)8 (Const8 [c]) x) (Leq8 x (Const8 [d]))) && c >= d+1 && d+1 > d => ((Less|Leq)8U (Const8 [c-d-1]) (Sub8 x (Const8 [d+1]))) // unsigned integer range: ( c (<|<=) x || x < d ) -> ( c-d (<|<=) x-d ) -(OrB ((Less|Leq)64U (Const64 [c]) x) (Less64U x (Const64 [d]))) && uint64(c) >= uint64(d) -> ((Less|Leq)64U (Const64 [c-d]) (Sub64 x (Const64 [d]))) -(OrB ((Less|Leq)32U (Const32 [c]) x) (Less32U x (Const32 [d]))) && uint32(c) >= uint32(d) -> ((Less|Leq)32U (Const32 [int64(int32(c-d))]) (Sub32 x (Const32 [d]))) -(OrB ((Less|Leq)16U (Const16 [c]) x) (Less16U x (Const16 [d]))) && uint16(c) >= uint16(d) -> ((Less|Leq)16U (Const16 [int64(int16(c-d))]) (Sub16 x (Const16 [d]))) -(OrB ((Less|Leq)8U (Const8 [c]) x) (Less8U x (Const8 [d]))) && uint8(c) >= uint8(d) -> ((Less|Leq)8U (Const8 [int64( int8(c-d))]) (Sub8 x (Const8 [d]))) +(OrB ((Less|Leq)64U (Const64 [c]) x) (Less64U x (Const64 [d]))) && uint64(c) >= uint64(d) => ((Less|Leq)64U (Const64 [c-d]) (Sub64 x (Const64 [d]))) +(OrB ((Less|Leq)32U (Const32 [c]) x) (Less32U x (Const32 [d]))) && uint32(c) >= uint32(d) => ((Less|Leq)32U (Const32 [c-d]) (Sub32 x (Const32 [d]))) +(OrB ((Less|Leq)16U (Const16 [c]) x) (Less16U x (Const16 [d]))) && uint16(c) >= uint16(d) => ((Less|Leq)16U (Const16 [c-d]) (Sub16 x (Const16 [d]))) +(OrB ((Less|Leq)8U (Const8 [c]) x) (Less8U x (Const8 [d]))) && uint8(c) >= uint8(d) => ((Less|Leq)8U (Const8 [c-d]) (Sub8 x (Const8 [d]))) // unsigned integer range: ( c (<|<=) x || x <= d ) -> ( c-(d+1) (<|<=) x-(d+1) ) -(OrB ((Less|Leq)64U (Const64 [c]) x) (Leq64U x (Const64 [d]))) && uint64(c) >= uint64(d+1) && uint64(d+1) > uint64(d) -> ((Less|Leq)64U (Const64 [c-d-1]) (Sub64 x (Const64 [d+1]))) -(OrB ((Less|Leq)32U (Const32 [c]) x) (Leq32U x (Const32 [d]))) && uint32(c) >= uint32(d+1) && uint32(d+1) > uint32(d) -> ((Less|Leq)32U (Const32 [int64(int32(c-d-1))]) (Sub32 x (Const32 [int64(int32(d+1))]))) -(OrB ((Less|Leq)16U (Const16 [c]) x) (Leq16U x (Const16 [d]))) && uint16(c) >= uint16(d+1) && uint16(d+1) > uint16(d) -> ((Less|Leq)16U (Const16 [int64(int16(c-d-1))]) (Sub16 x (Const16 [int64(int16(d+1))]))) -(OrB ((Less|Leq)8U (Const8 [c]) x) (Leq8U x (Const8 [d]))) && uint8(c) >= uint8(d+1) && uint8(d+1) > uint8(d) -> ((Less|Leq)8U (Const8 [int64( int8(c-d-1))]) (Sub8 x (Const8 [int64( int8(d+1))]))) +(OrB ((Less|Leq)64U (Const64 [c]) x) (Leq64U x (Const64 [d]))) && uint64(c) >= uint64(d+1) && uint64(d+1) > uint64(d) => ((Less|Leq)64U (Const64 [c-d-1]) (Sub64 x (Const64 [d+1]))) +(OrB ((Less|Leq)32U (Const32 [c]) x) (Leq32U x (Const32 [d]))) && uint32(c) >= uint32(d+1) && uint32(d+1) > uint32(d) => ((Less|Leq)32U (Const32 [c-d-1]) (Sub32 x (Const32 [d+1]))) +(OrB ((Less|Leq)16U (Const16 [c]) x) (Leq16U x (Const16 [d]))) && uint16(c) >= uint16(d+1) && uint16(d+1) > uint16(d) => ((Less|Leq)16U (Const16 [c-d-1]) (Sub16 x (Const16 [d+1]))) +(OrB ((Less|Leq)8U (Const8 [c]) x) (Leq8U x (Const8 [d]))) && uint8(c) >= uint8(d+1) && uint8(d+1) > uint8(d) => ((Less|Leq)8U (Const8 [c-d-1]) (Sub8 x (Const8 [d+1]))) // Canonicalize x-const to x+(-const) (Sub64 x (Const64 [c])) && x.Op != OpConst64 -> (Add64 (Const64 [-c]) x) diff --git a/src/cmd/compile/internal/ssa/rewrite386.go b/src/cmd/compile/internal/ssa/rewrite386.go index 2a8b6ace1e..494aeaf95f 100644 --- a/src/cmd/compile/internal/ssa/rewrite386.go +++ b/src/cmd/compile/internal/ssa/rewrite386.go @@ -257,8 +257,7 @@ func rewriteValue386(v *Value) bool { v.Op = Op386ADDL return true case OpAddr: - v.Op = Op386LEAL - return true + return rewriteValue386_OpAddr(v) case OpAnd16: v.Op = Op386ANDL return true @@ -290,8 +289,7 @@ func rewriteValue386(v *Value) bool { v.Op = Op386NOTL return true case OpConst16: - v.Op = Op386MOVLconst - return true + return rewriteValue386_OpConst16(v) case OpConst32: v.Op = Op386MOVLconst return true @@ -302,11 +300,9 @@ func rewriteValue386(v *Value) bool { v.Op = Op386MOVSDconst return true case OpConst8: - v.Op = Op386MOVLconst - return true + return rewriteValue386_OpConst8(v) case OpConstBool: - v.Op = Op386MOVLconst - return true + return rewriteValue386_OpConstBool(v) case OpConstNil: return rewriteValue386_OpConstNil(v) case OpCtz16: @@ -527,8 +523,7 @@ func rewriteValue386(v *Value) bool { case OpNot: return rewriteValue386_OpNot(v) case OpOffPtr: - v.Op = Op386ADDLconst - return true + return rewriteValue386_OpOffPtr(v) case OpOr16: v.Op = Op386ORL return true @@ -8688,12 +8683,55 @@ func rewriteValue386_Op386XORLmodify(v *Value) bool { } return false } +func rewriteValue386_OpAddr(v *Value) bool { + v_0 := v.Args[0] + // match: (Addr {sym} base) + // result: (LEAL {sym} base) + for { + sym := auxToSym(v.Aux) + base := v_0 + v.reset(Op386LEAL) + v.Aux = symToAux(sym) + v.AddArg(base) + return true + } +} +func rewriteValue386_OpConst16(v *Value) bool { + // match: (Const16 [c]) + // result: (MOVLconst [int32(c)]) + for { + c := auxIntToInt16(v.AuxInt) + v.reset(Op386MOVLconst) + v.AuxInt = int32ToAuxInt(int32(c)) + return true + } +} +func rewriteValue386_OpConst8(v *Value) bool { + // match: (Const8 [c]) + // result: (MOVLconst [int32(c)]) + for { + c := auxIntToInt8(v.AuxInt) + v.reset(Op386MOVLconst) + v.AuxInt = int32ToAuxInt(int32(c)) + return true + } +} +func rewriteValue386_OpConstBool(v *Value) bool { + // match: (ConstBool [c]) + // result: (MOVLconst [int32(b2i(c))]) + for { + c := auxIntToBool(v.AuxInt) + v.reset(Op386MOVLconst) + v.AuxInt = int32ToAuxInt(int32(b2i(c))) + return true + } +} func rewriteValue386_OpConstNil(v *Value) bool { // match: (ConstNil) // result: (MOVLconst [0]) for { v.reset(Op386MOVLconst) - v.AuxInt = 0 + v.AuxInt = int32ToAuxInt(0) return true } } @@ -8707,7 +8745,7 @@ func rewriteValue386_OpCtz16(v *Value) bool { x := v_0 v.reset(Op386BSFL) v0 := b.NewValue0(v.Pos, Op386ORLconst, typ.UInt32) - v0.AuxInt = 0x10000 + v0.AuxInt = int32ToAuxInt(0x10000) v0.AddArg(x) v.AddArg(v0) return true @@ -9245,10 +9283,10 @@ func rewriteValue386_OpLocalAddr(v *Value) bool { // match: (LocalAddr {sym} base _) // result: (LEAL {sym} base) for { - sym := v.Aux + sym := auxToSym(v.Aux) base := v_0 v.reset(Op386LEAL) - v.Aux = sym + v.Aux = symToAux(sym) v.AddArg(base) return true } @@ -9272,7 +9310,7 @@ func rewriteValue386_OpLsh16x16(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) - v2.AuxInt = 32 + v2.AuxInt = int16ToAuxInt(32) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -9314,7 +9352,7 @@ func rewriteValue386_OpLsh16x32(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) - v2.AuxInt = 32 + v2.AuxInt = int32ToAuxInt(32) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -9342,18 +9380,18 @@ func rewriteValue386_OpLsh16x64(v *Value) bool { v_0 := v.Args[0] // match: (Lsh16x64 x (Const64 [c])) // cond: uint64(c) < 16 - // result: (SHLLconst x [c]) + // result: (SHLLconst x [int32(c)]) for { x := v_0 if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) < 16) { break } v.reset(Op386SHLLconst) - v.AuxInt = c + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } @@ -9364,12 +9402,12 @@ func rewriteValue386_OpLsh16x64(v *Value) bool { if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) >= 16) { break } v.reset(OpConst16) - v.AuxInt = 0 + v.AuxInt = int16ToAuxInt(0) return true } return false @@ -9393,7 +9431,7 @@ func rewriteValue386_OpLsh16x8(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) - v2.AuxInt = 32 + v2.AuxInt = int8ToAuxInt(32) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -9435,7 +9473,7 @@ func rewriteValue386_OpLsh32x16(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) - v2.AuxInt = 32 + v2.AuxInt = int16ToAuxInt(32) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -9477,7 +9515,7 @@ func rewriteValue386_OpLsh32x32(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) - v2.AuxInt = 32 + v2.AuxInt = int32ToAuxInt(32) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -9505,18 +9543,18 @@ func rewriteValue386_OpLsh32x64(v *Value) bool { v_0 := v.Args[0] // match: (Lsh32x64 x (Const64 [c])) // cond: uint64(c) < 32 - // result: (SHLLconst x [c]) + // result: (SHLLconst x [int32(c)]) for { x := v_0 if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) < 32) { break } v.reset(Op386SHLLconst) - v.AuxInt = c + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } @@ -9527,12 +9565,12 @@ func rewriteValue386_OpLsh32x64(v *Value) bool { if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) >= 32) { break } v.reset(OpConst32) - v.AuxInt = 0 + v.AuxInt = int32ToAuxInt(0) return true } return false @@ -9556,7 +9594,7 @@ func rewriteValue386_OpLsh32x8(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) - v2.AuxInt = 32 + v2.AuxInt = int8ToAuxInt(32) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -9598,7 +9636,7 @@ func rewriteValue386_OpLsh8x16(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) - v2.AuxInt = 32 + v2.AuxInt = int16ToAuxInt(32) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -9640,7 +9678,7 @@ func rewriteValue386_OpLsh8x32(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) - v2.AuxInt = 32 + v2.AuxInt = int32ToAuxInt(32) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -9668,18 +9706,18 @@ func rewriteValue386_OpLsh8x64(v *Value) bool { v_0 := v.Args[0] // match: (Lsh8x64 x (Const64 [c])) // cond: uint64(c) < 8 - // result: (SHLLconst x [c]) + // result: (SHLLconst x [int32(c)]) for { x := v_0 if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) < 8) { break } v.reset(Op386SHLLconst) - v.AuxInt = c + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } @@ -9690,12 +9728,12 @@ func rewriteValue386_OpLsh8x64(v *Value) bool { if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) >= 8) { break } v.reset(OpConst8) - v.AuxInt = 0 + v.AuxInt = int8ToAuxInt(0) return true } return false @@ -9719,7 +9757,7 @@ func rewriteValue386_OpLsh8x8(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) - v2.AuxInt = 32 + v2.AuxInt = int8ToAuxInt(32) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -9790,7 +9828,7 @@ func rewriteValue386_OpMove(v *Value) bool { // match: (Move [0] _ _ mem) // result: mem for { - if v.AuxInt != 0 { + if auxIntToInt64(v.AuxInt) != 0 { break } mem := v_2 @@ -9800,7 +9838,7 @@ func rewriteValue386_OpMove(v *Value) bool { // match: (Move [1] dst src mem) // result: (MOVBstore dst (MOVBload src mem) mem) for { - if v.AuxInt != 1 { + if auxIntToInt64(v.AuxInt) != 1 { break } dst := v_0 @@ -9815,7 +9853,7 @@ func rewriteValue386_OpMove(v *Value) bool { // match: (Move [2] dst src mem) // result: (MOVWstore dst (MOVWload src mem) mem) for { - if v.AuxInt != 2 { + if auxIntToInt64(v.AuxInt) != 2 { break } dst := v_0 @@ -9830,7 +9868,7 @@ func rewriteValue386_OpMove(v *Value) bool { // match: (Move [4] dst src mem) // result: (MOVLstore dst (MOVLload src mem) mem) for { - if v.AuxInt != 4 { + if auxIntToInt64(v.AuxInt) != 4 { break } dst := v_0 @@ -9845,16 +9883,16 @@ func rewriteValue386_OpMove(v *Value) bool { // match: (Move [3] dst src mem) // result: (MOVBstore [2] dst (MOVBload [2] src mem) (MOVWstore dst (MOVWload src mem) mem)) for { - if v.AuxInt != 3 { + if auxIntToInt64(v.AuxInt) != 3 { break } dst := v_0 src := v_1 mem := v_2 v.reset(Op386MOVBstore) - v.AuxInt = 2 + v.AuxInt = int32ToAuxInt(2) v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8) - v0.AuxInt = 2 + v0.AuxInt = int32ToAuxInt(2) v0.AddArg2(src, mem) v1 := b.NewValue0(v.Pos, Op386MOVWstore, types.TypeMem) v2 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16) @@ -9866,16 +9904,16 @@ func rewriteValue386_OpMove(v *Value) bool { // match: (Move [5] dst src mem) // result: (MOVBstore [4] dst (MOVBload [4] src mem) (MOVLstore dst (MOVLload src mem) mem)) for { - if v.AuxInt != 5 { + if auxIntToInt64(v.AuxInt) != 5 { break } dst := v_0 src := v_1 mem := v_2 v.reset(Op386MOVBstore) - v.AuxInt = 4 + v.AuxInt = int32ToAuxInt(4) v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8) - v0.AuxInt = 4 + v0.AuxInt = int32ToAuxInt(4) v0.AddArg2(src, mem) v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem) v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) @@ -9887,16 +9925,16 @@ func rewriteValue386_OpMove(v *Value) bool { // match: (Move [6] dst src mem) // result: (MOVWstore [4] dst (MOVWload [4] src mem) (MOVLstore dst (MOVLload src mem) mem)) for { - if v.AuxInt != 6 { + if auxIntToInt64(v.AuxInt) != 6 { break } dst := v_0 src := v_1 mem := v_2 v.reset(Op386MOVWstore) - v.AuxInt = 4 + v.AuxInt = int32ToAuxInt(4) v0 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16) - v0.AuxInt = 4 + v0.AuxInt = int32ToAuxInt(4) v0.AddArg2(src, mem) v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem) v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) @@ -9908,16 +9946,16 @@ func rewriteValue386_OpMove(v *Value) bool { // match: (Move [7] dst src mem) // result: (MOVLstore [3] dst (MOVLload [3] src mem) (MOVLstore dst (MOVLload src mem) mem)) for { - if v.AuxInt != 7 { + if auxIntToInt64(v.AuxInt) != 7 { break } dst := v_0 src := v_1 mem := v_2 v.reset(Op386MOVLstore) - v.AuxInt = 3 + v.AuxInt = int32ToAuxInt(3) v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) - v0.AuxInt = 3 + v0.AuxInt = int32ToAuxInt(3) v0.AddArg2(src, mem) v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem) v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) @@ -9929,16 +9967,16 @@ func rewriteValue386_OpMove(v *Value) bool { // match: (Move [8] dst src mem) // result: (MOVLstore [4] dst (MOVLload [4] src mem) (MOVLstore dst (MOVLload src mem) mem)) for { - if v.AuxInt != 8 { + if auxIntToInt64(v.AuxInt) != 8 { break } dst := v_0 src := v_1 mem := v_2 v.reset(Op386MOVLstore) - v.AuxInt = 4 + v.AuxInt = int32ToAuxInt(4) v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) - v0.AuxInt = 4 + v0.AuxInt = int32ToAuxInt(4) v0.AddArg2(src, mem) v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem) v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) @@ -9949,9 +9987,9 @@ func rewriteValue386_OpMove(v *Value) bool { } // match: (Move [s] dst src mem) // cond: s > 8 && s%4 != 0 - // result: (Move [s-s%4] (ADDLconst dst [s%4]) (ADDLconst src [s%4]) (MOVLstore dst (MOVLload src mem) mem)) + // result: (Move [s-s%4] (ADDLconst dst [int32(s%4)]) (ADDLconst src [int32(s%4)]) (MOVLstore dst (MOVLload src mem) mem)) for { - s := v.AuxInt + s := auxIntToInt64(v.AuxInt) dst := v_0 src := v_1 mem := v_2 @@ -9959,12 +9997,12 @@ func rewriteValue386_OpMove(v *Value) bool { break } v.reset(OpMove) - v.AuxInt = s - s%4 + v.AuxInt = int64ToAuxInt(s - s%4) v0 := b.NewValue0(v.Pos, Op386ADDLconst, dst.Type) - v0.AuxInt = s % 4 + v0.AuxInt = int32ToAuxInt(int32(s % 4)) v0.AddArg(dst) v1 := b.NewValue0(v.Pos, Op386ADDLconst, src.Type) - v1.AuxInt = s % 4 + v1.AuxInt = int32ToAuxInt(int32(s % 4)) v1.AddArg(src) v2 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem) v3 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32) @@ -9977,7 +10015,7 @@ func rewriteValue386_OpMove(v *Value) bool { // cond: s > 8 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice && logLargeCopy(v, s) // result: (DUFFCOPY [10*(128-s/4)] dst src mem) for { - s := v.AuxInt + s := auxIntToInt64(v.AuxInt) dst := v_0 src := v_1 mem := v_2 @@ -9985,15 +10023,15 @@ func rewriteValue386_OpMove(v *Value) bool { break } v.reset(Op386DUFFCOPY) - v.AuxInt = 10 * (128 - s/4) + v.AuxInt = int64ToAuxInt(10 * (128 - s/4)) v.AddArg3(dst, src, mem) return true } // match: (Move [s] dst src mem) // cond: (s > 4*128 || config.noDuffDevice) && s%4 == 0 && logLargeCopy(v, s) - // result: (REPMOVSL dst src (MOVLconst [s/4]) mem) + // result: (REPMOVSL dst src (MOVLconst [int32(s/4)]) mem) for { - s := v.AuxInt + s := auxIntToInt64(v.AuxInt) dst := v_0 src := v_1 mem := v_2 @@ -10002,7 +10040,7 @@ func rewriteValue386_OpMove(v *Value) bool { } v.reset(Op386REPMOVSL) v0 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32) - v0.AuxInt = s / 4 + v0.AuxInt = int32ToAuxInt(int32(s / 4)) v.AddArg4(dst, src, v0, mem) return true } @@ -10015,7 +10053,7 @@ func rewriteValue386_OpNeg32F(v *Value) bool { typ := &b.Func.Config.Types // match: (Neg32F x) // cond: !config.use387 - // result: (PXOR x (MOVSSconst [auxFrom32F(float32(math.Copysign(0, -1)))])) + // result: (PXOR x (MOVSSconst [float32(math.Copysign(0, -1))])) for { x := v_0 if !(!config.use387) { @@ -10023,7 +10061,7 @@ func rewriteValue386_OpNeg32F(v *Value) bool { } v.reset(Op386PXOR) v0 := b.NewValue0(v.Pos, Op386MOVSSconst, typ.Float32) - v0.AuxInt = auxFrom32F(float32(math.Copysign(0, -1))) + v0.AuxInt = float32ToAuxInt(float32(math.Copysign(0, -1))) v.AddArg2(x, v0) return true } @@ -10048,7 +10086,7 @@ func rewriteValue386_OpNeg64F(v *Value) bool { typ := &b.Func.Config.Types // match: (Neg64F x) // cond: !config.use387 - // result: (PXOR x (MOVSDconst [auxFrom64F(math.Copysign(0, -1))])) + // result: (PXOR x (MOVSDconst [math.Copysign(0, -1)])) for { x := v_0 if !(!config.use387) { @@ -10056,7 +10094,7 @@ func rewriteValue386_OpNeg64F(v *Value) bool { } v.reset(Op386PXOR) v0 := b.NewValue0(v.Pos, Op386MOVSDconst, typ.Float64) - v0.AuxInt = auxFrom64F(math.Copysign(0, -1)) + v0.AuxInt = float64ToAuxInt(math.Copysign(0, -1)) v.AddArg2(x, v0) return true } @@ -10193,11 +10231,24 @@ func rewriteValue386_OpNot(v *Value) bool { for { x := v_0 v.reset(Op386XORLconst) - v.AuxInt = 1 + v.AuxInt = int32ToAuxInt(1) v.AddArg(x) return true } } +func rewriteValue386_OpOffPtr(v *Value) bool { + v_0 := v.Args[0] + // match: (OffPtr [off] ptr) + // result: (ADDLconst [int32(off)] ptr) + for { + off := auxIntToInt64(v.AuxInt) + ptr := v_0 + v.reset(Op386ADDLconst) + v.AuxInt = int32ToAuxInt(int32(off)) + v.AddArg(ptr) + return true + } +} func rewriteValue386_OpPanicBounds(v *Value) bool { v_2 := v.Args[2] v_1 := v.Args[1] @@ -10206,7 +10257,7 @@ func rewriteValue386_OpPanicBounds(v *Value) bool { // cond: boundsABI(kind) == 0 // result: (LoweredPanicBoundsA [kind] x y mem) for { - kind := v.AuxInt + kind := auxIntToInt64(v.AuxInt) x := v_0 y := v_1 mem := v_2 @@ -10214,7 +10265,7 @@ func rewriteValue386_OpPanicBounds(v *Value) bool { break } v.reset(Op386LoweredPanicBoundsA) - v.AuxInt = kind + v.AuxInt = int64ToAuxInt(kind) v.AddArg3(x, y, mem) return true } @@ -10222,7 +10273,7 @@ func rewriteValue386_OpPanicBounds(v *Value) bool { // cond: boundsABI(kind) == 1 // result: (LoweredPanicBoundsB [kind] x y mem) for { - kind := v.AuxInt + kind := auxIntToInt64(v.AuxInt) x := v_0 y := v_1 mem := v_2 @@ -10230,7 +10281,7 @@ func rewriteValue386_OpPanicBounds(v *Value) bool { break } v.reset(Op386LoweredPanicBoundsB) - v.AuxInt = kind + v.AuxInt = int64ToAuxInt(kind) v.AddArg3(x, y, mem) return true } @@ -10238,7 +10289,7 @@ func rewriteValue386_OpPanicBounds(v *Value) bool { // cond: boundsABI(kind) == 2 // result: (LoweredPanicBoundsC [kind] x y mem) for { - kind := v.AuxInt + kind := auxIntToInt64(v.AuxInt) x := v_0 y := v_1 mem := v_2 @@ -10246,7 +10297,7 @@ func rewriteValue386_OpPanicBounds(v *Value) bool { break } v.reset(Op386LoweredPanicBoundsC) - v.AuxInt = kind + v.AuxInt = int64ToAuxInt(kind) v.AddArg3(x, y, mem) return true } @@ -10261,7 +10312,7 @@ func rewriteValue386_OpPanicExtend(v *Value) bool { // cond: boundsABI(kind) == 0 // result: (LoweredPanicExtendA [kind] hi lo y mem) for { - kind := v.AuxInt + kind := auxIntToInt64(v.AuxInt) hi := v_0 lo := v_1 y := v_2 @@ -10270,7 +10321,7 @@ func rewriteValue386_OpPanicExtend(v *Value) bool { break } v.reset(Op386LoweredPanicExtendA) - v.AuxInt = kind + v.AuxInt = int64ToAuxInt(kind) v.AddArg4(hi, lo, y, mem) return true } @@ -10278,7 +10329,7 @@ func rewriteValue386_OpPanicExtend(v *Value) bool { // cond: boundsABI(kind) == 1 // result: (LoweredPanicExtendB [kind] hi lo y mem) for { - kind := v.AuxInt + kind := auxIntToInt64(v.AuxInt) hi := v_0 lo := v_1 y := v_2 @@ -10287,7 +10338,7 @@ func rewriteValue386_OpPanicExtend(v *Value) bool { break } v.reset(Op386LoweredPanicExtendB) - v.AuxInt = kind + v.AuxInt = int64ToAuxInt(kind) v.AddArg4(hi, lo, y, mem) return true } @@ -10295,7 +10346,7 @@ func rewriteValue386_OpPanicExtend(v *Value) bool { // cond: boundsABI(kind) == 2 // result: (LoweredPanicExtendC [kind] hi lo y mem) for { - kind := v.AuxInt + kind := auxIntToInt64(v.AuxInt) hi := v_0 lo := v_1 y := v_2 @@ -10304,7 +10355,7 @@ func rewriteValue386_OpPanicExtend(v *Value) bool { break } v.reset(Op386LoweredPanicExtendC) - v.AuxInt = kind + v.AuxInt = int64ToAuxInt(kind) v.AddArg4(hi, lo, y, mem) return true } @@ -10314,15 +10365,15 @@ func rewriteValue386_OpRotateLeft16(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (RotateLeft16 x (MOVLconst [c])) - // result: (ROLWconst [c&15] x) + // result: (ROLWconst [int16(c&15)] x) for { x := v_0 if v_1.Op != Op386MOVLconst { break } - c := v_1.AuxInt + c := auxIntToInt32(v_1.AuxInt) v.reset(Op386ROLWconst) - v.AuxInt = c & 15 + v.AuxInt = int16ToAuxInt(int16(c & 15)) v.AddArg(x) return true } @@ -10338,9 +10389,9 @@ func rewriteValue386_OpRotateLeft32(v *Value) bool { if v_1.Op != Op386MOVLconst { break } - c := v_1.AuxInt + c := auxIntToInt32(v_1.AuxInt) v.reset(Op386ROLLconst) - v.AuxInt = c & 31 + v.AuxInt = int32ToAuxInt(c & 31) v.AddArg(x) return true } @@ -10350,15 +10401,15 @@ func rewriteValue386_OpRotateLeft8(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (RotateLeft8 x (MOVLconst [c])) - // result: (ROLBconst [c&7] x) + // result: (ROLBconst [int8(c&7)] x) for { x := v_0 if v_1.Op != Op386MOVLconst { break } - c := v_1.AuxInt + c := auxIntToInt32(v_1.AuxInt) v.reset(Op386ROLBconst) - v.AuxInt = c & 7 + v.AuxInt = int8ToAuxInt(int8(c & 7)) v.AddArg(x) return true } @@ -10383,7 +10434,7 @@ func rewriteValue386_OpRsh16Ux16(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) - v2.AuxInt = 16 + v2.AuxInt = int16ToAuxInt(16) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -10425,7 +10476,7 @@ func rewriteValue386_OpRsh16Ux32(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) - v2.AuxInt = 16 + v2.AuxInt = int32ToAuxInt(16) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -10453,18 +10504,18 @@ func rewriteValue386_OpRsh16Ux64(v *Value) bool { v_0 := v.Args[0] // match: (Rsh16Ux64 x (Const64 [c])) // cond: uint64(c) < 16 - // result: (SHRWconst x [c]) + // result: (SHRWconst x [int16(c)]) for { x := v_0 if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) < 16) { break } v.reset(Op386SHRWconst) - v.AuxInt = c + v.AuxInt = int16ToAuxInt(int16(c)) v.AddArg(x) return true } @@ -10475,12 +10526,12 @@ func rewriteValue386_OpRsh16Ux64(v *Value) bool { if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) >= 16) { break } v.reset(OpConst16) - v.AuxInt = 0 + v.AuxInt = int16ToAuxInt(0) return true } return false @@ -10504,7 +10555,7 @@ func rewriteValue386_OpRsh16Ux8(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) - v2.AuxInt = 16 + v2.AuxInt = int8ToAuxInt(16) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -10547,7 +10598,7 @@ func rewriteValue386_OpRsh16x16(v *Value) bool { v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) - v3.AuxInt = 16 + v3.AuxInt = int16ToAuxInt(16) v3.AddArg(y) v2.AddArg(v3) v1.AddArg(v2) @@ -10590,7 +10641,7 @@ func rewriteValue386_OpRsh16x32(v *Value) bool { v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) - v3.AuxInt = 16 + v3.AuxInt = int32ToAuxInt(16) v3.AddArg(y) v2.AddArg(v3) v1.AddArg(v2) @@ -10618,18 +10669,18 @@ func rewriteValue386_OpRsh16x64(v *Value) bool { v_0 := v.Args[0] // match: (Rsh16x64 x (Const64 [c])) // cond: uint64(c) < 16 - // result: (SARWconst x [c]) + // result: (SARWconst x [int16(c)]) for { x := v_0 if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) < 16) { break } v.reset(Op386SARWconst) - v.AuxInt = c + v.AuxInt = int16ToAuxInt(int16(c)) v.AddArg(x) return true } @@ -10641,12 +10692,12 @@ func rewriteValue386_OpRsh16x64(v *Value) bool { if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) >= 16) { break } v.reset(Op386SARWconst) - v.AuxInt = 15 + v.AuxInt = int16ToAuxInt(15) v.AddArg(x) return true } @@ -10672,7 +10723,7 @@ func rewriteValue386_OpRsh16x8(v *Value) bool { v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) - v3.AuxInt = 16 + v3.AuxInt = int8ToAuxInt(16) v3.AddArg(y) v2.AddArg(v3) v1.AddArg(v2) @@ -10714,7 +10765,7 @@ func rewriteValue386_OpRsh32Ux16(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) - v2.AuxInt = 32 + v2.AuxInt = int16ToAuxInt(32) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -10756,7 +10807,7 @@ func rewriteValue386_OpRsh32Ux32(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) - v2.AuxInt = 32 + v2.AuxInt = int32ToAuxInt(32) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -10784,18 +10835,18 @@ func rewriteValue386_OpRsh32Ux64(v *Value) bool { v_0 := v.Args[0] // match: (Rsh32Ux64 x (Const64 [c])) // cond: uint64(c) < 32 - // result: (SHRLconst x [c]) + // result: (SHRLconst x [int32(c)]) for { x := v_0 if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) < 32) { break } v.reset(Op386SHRLconst) - v.AuxInt = c + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } @@ -10806,12 +10857,12 @@ func rewriteValue386_OpRsh32Ux64(v *Value) bool { if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) >= 32) { break } v.reset(OpConst32) - v.AuxInt = 0 + v.AuxInt = int32ToAuxInt(0) return true } return false @@ -10835,7 +10886,7 @@ func rewriteValue386_OpRsh32Ux8(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) - v2.AuxInt = 32 + v2.AuxInt = int8ToAuxInt(32) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -10878,7 +10929,7 @@ func rewriteValue386_OpRsh32x16(v *Value) bool { v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) - v3.AuxInt = 32 + v3.AuxInt = int16ToAuxInt(32) v3.AddArg(y) v2.AddArg(v3) v1.AddArg(v2) @@ -10921,7 +10972,7 @@ func rewriteValue386_OpRsh32x32(v *Value) bool { v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) - v3.AuxInt = 32 + v3.AuxInt = int32ToAuxInt(32) v3.AddArg(y) v2.AddArg(v3) v1.AddArg(v2) @@ -10949,18 +11000,18 @@ func rewriteValue386_OpRsh32x64(v *Value) bool { v_0 := v.Args[0] // match: (Rsh32x64 x (Const64 [c])) // cond: uint64(c) < 32 - // result: (SARLconst x [c]) + // result: (SARLconst x [int32(c)]) for { x := v_0 if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) < 32) { break } v.reset(Op386SARLconst) - v.AuxInt = c + v.AuxInt = int32ToAuxInt(int32(c)) v.AddArg(x) return true } @@ -10972,12 +11023,12 @@ func rewriteValue386_OpRsh32x64(v *Value) bool { if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) >= 32) { break } v.reset(Op386SARLconst) - v.AuxInt = 31 + v.AuxInt = int32ToAuxInt(31) v.AddArg(x) return true } @@ -11003,7 +11054,7 @@ func rewriteValue386_OpRsh32x8(v *Value) bool { v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) - v3.AuxInt = 32 + v3.AuxInt = int8ToAuxInt(32) v3.AddArg(y) v2.AddArg(v3) v1.AddArg(v2) @@ -11045,7 +11096,7 @@ func rewriteValue386_OpRsh8Ux16(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) - v2.AuxInt = 8 + v2.AuxInt = int16ToAuxInt(8) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -11087,7 +11138,7 @@ func rewriteValue386_OpRsh8Ux32(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) - v2.AuxInt = 8 + v2.AuxInt = int32ToAuxInt(8) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -11115,18 +11166,18 @@ func rewriteValue386_OpRsh8Ux64(v *Value) bool { v_0 := v.Args[0] // match: (Rsh8Ux64 x (Const64 [c])) // cond: uint64(c) < 8 - // result: (SHRBconst x [c]) + // result: (SHRBconst x [int8(c)]) for { x := v_0 if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) < 8) { break } v.reset(Op386SHRBconst) - v.AuxInt = c + v.AuxInt = int8ToAuxInt(int8(c)) v.AddArg(x) return true } @@ -11137,12 +11188,12 @@ func rewriteValue386_OpRsh8Ux64(v *Value) bool { if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) >= 8) { break } v.reset(OpConst8) - v.AuxInt = 0 + v.AuxInt = int8ToAuxInt(0) return true } return false @@ -11166,7 +11217,7 @@ func rewriteValue386_OpRsh8Ux8(v *Value) bool { v0.AddArg2(x, y) v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) - v2.AuxInt = 8 + v2.AuxInt = int8ToAuxInt(8) v2.AddArg(y) v1.AddArg(v2) v.AddArg2(v0, v1) @@ -11209,7 +11260,7 @@ func rewriteValue386_OpRsh8x16(v *Value) bool { v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags) - v3.AuxInt = 8 + v3.AuxInt = int16ToAuxInt(8) v3.AddArg(y) v2.AddArg(v3) v1.AddArg(v2) @@ -11252,7 +11303,7 @@ func rewriteValue386_OpRsh8x32(v *Value) bool { v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) - v3.AuxInt = 8 + v3.AuxInt = int32ToAuxInt(8) v3.AddArg(y) v2.AddArg(v3) v1.AddArg(v2) @@ -11280,18 +11331,18 @@ func rewriteValue386_OpRsh8x64(v *Value) bool { v_0 := v.Args[0] // match: (Rsh8x64 x (Const64 [c])) // cond: uint64(c) < 8 - // result: (SARBconst x [c]) + // result: (SARBconst x [int8(c)]) for { x := v_0 if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) < 8) { break } v.reset(Op386SARBconst) - v.AuxInt = c + v.AuxInt = int8ToAuxInt(int8(c)) v.AddArg(x) return true } @@ -11303,12 +11354,12 @@ func rewriteValue386_OpRsh8x64(v *Value) bool { if v_1.Op != OpConst64 { break } - c := v_1.AuxInt + c := auxIntToInt64(v_1.AuxInt) if !(uint64(c) >= 8) { break } v.reset(Op386SARBconst) - v.AuxInt = 7 + v.AuxInt = int8ToAuxInt(7) v.AddArg(x) return true } @@ -11334,7 +11385,7 @@ func rewriteValue386_OpRsh8x8(v *Value) bool { v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type) v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type) v3 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags) - v3.AuxInt = 8 + v3.AuxInt = int8ToAuxInt(8) v3.AddArg(y) v2.AddArg(v3) v1.AddArg(v2) @@ -11407,7 +11458,7 @@ func rewriteValue386_OpSignmask(v *Value) bool { for { x := v_0 v.reset(Op386SARLconst) - v.AuxInt = 31 + v.AuxInt = int32ToAuxInt(31) v.AddArg(x) return true } @@ -11421,7 +11472,7 @@ func rewriteValue386_OpSlicemask(v *Value) bool { t := v.Type x := v_0 v.reset(Op386SARLconst) - v.AuxInt = 31 + v.AuxInt = int32ToAuxInt(31) v0 := b.NewValue0(v.Pos, Op386NEGL, t) v0.AddArg(x) v.AddArg(v0) @@ -11433,14 +11484,14 @@ func rewriteValue386_OpStore(v *Value) bool { v_1 := v.Args[1] v_0 := v.Args[0] // match: (Store {t} ptr val mem) - // cond: t.(*types.Type).Size() == 8 && is64BitFloat(val.Type) + // cond: t.Size() == 8 && is64BitFloat(val.Type) // result: (MOVSDstore ptr val mem) for { - t := v.Aux + t := auxToType(v.Aux) ptr := v_0 val := v_1 mem := v_2 - if !(t.(*types.Type).Size() == 8 && is64BitFloat(val.Type)) { + if !(t.Size() == 8 && is64BitFloat(val.Type)) { break } v.reset(Op386MOVSDstore) @@ -11448,14 +11499,14 @@ func rewriteValue386_OpStore(v *Value) bool { return true } // match: (Store {t} ptr val mem) - // cond: t.(*types.Type).Size() == 4 && is32BitFloat(val.Type) + // cond: t.Size() == 4 && is32BitFloat(val.Type) // result: (MOVSSstore ptr val mem) for { - t := v.Aux + t := auxToType(v.Aux) ptr := v_0 val := v_1 mem := v_2 - if !(t.(*types.Type).Size() == 4 && is32BitFloat(val.Type)) { + if !(t.Size() == 4 && is32BitFloat(val.Type)) { break } v.reset(Op386MOVSSstore) @@ -11463,14 +11514,14 @@ func rewriteValue386_OpStore(v *Value) bool { return true } // match: (Store {t} ptr val mem) - // cond: t.(*types.Type).Size() == 4 + // cond: t.Size() == 4 // result: (MOVLstore ptr val mem) for { - t := v.Aux + t := auxToType(v.Aux) ptr := v_0 val := v_1 mem := v_2 - if !(t.(*types.Type).Size() == 4) { + if !(t.Size() == 4) { break } v.reset(Op386MOVLstore) @@ -11478,14 +11529,14 @@ func rewriteValue386_OpStore(v *Value) bool { return true } // match: (Store {t} ptr val mem) - // cond: t.(*types.Type).Size() == 2 + // cond: t.Size() == 2 // result: (MOVWstore ptr val mem) for { - t := v.Aux + t := auxToType(v.Aux) ptr := v_0 val := v_1 mem := v_2 - if !(t.(*types.Type).Size() == 2) { + if !(t.Size() == 2) { break } v.reset(Op386MOVWstore) @@ -11493,14 +11544,14 @@ func rewriteValue386_OpStore(v *Value) bool { return true } // match: (Store {t} ptr val mem) - // cond: t.(*types.Type).Size() == 1 + // cond: t.Size() == 1 // result: (MOVBstore ptr val mem) for { - t := v.Aux + t := auxToType(v.Aux) ptr := v_0 val := v_1 mem := v_2 - if !(t.(*types.Type).Size() == 1) { + if !(t.Size() == 1) { break } v.reset(Op386MOVBstore) @@ -11518,7 +11569,7 @@ func rewriteValue386_OpZero(v *Value) bool { // match: (Zero [0] _ mem) // result: mem for { - if v.AuxInt != 0 { + if auxIntToInt64(v.AuxInt) != 0 { break } mem := v_1 @@ -11528,102 +11579,102 @@ func rewriteValue386_OpZero(v *Value) bool { // match: (Zero [1] destptr mem) // result: (MOVBstoreconst [0] destptr mem) for { - if v.AuxInt != 1 { + if auxIntToInt64(v.AuxInt) != 1 { break } destptr := v_0 mem := v_1 v.reset(Op386MOVBstoreconst) - v.AuxInt = 0 + v.AuxInt = valAndOffToAuxInt(0) v.AddArg2(destptr, mem) return true } // match: (Zero [2] destptr mem) // result: (MOVWstoreconst [0] destptr mem) for { - if v.AuxInt != 2 { + if auxIntToInt64(v.AuxInt) != 2 { break } destptr := v_0 mem := v_1 v.reset(Op386MOVWstoreconst) - v.AuxInt = 0 + v.AuxInt = valAndOffToAuxInt(0) v.AddArg2(destptr, mem) return true } // match: (Zero [4] destptr mem) // result: (MOVLstoreconst [0] destptr mem) for { - if v.AuxInt != 4 { + if auxIntToInt64(v.AuxInt) != 4 { break } destptr := v_0 mem := v_1 v.reset(Op386MOVLstoreconst) - v.AuxInt = 0 + v.AuxInt = valAndOffToAuxInt(0) v.AddArg2(destptr, mem) return true } // match: (Zero [3] destptr mem) - // result: (MOVBstoreconst [makeValAndOff(0,2)] destptr (MOVWstoreconst [0] destptr mem)) + // result: (MOVBstoreconst [makeValAndOff32(0,2)] destptr (MOVWstoreconst [makeValAndOff32(0,0)] destptr mem)) for { - if v.AuxInt != 3 { + if auxIntToInt64(v.AuxInt) != 3 { break } destptr := v_0 mem := v_1 v.reset(Op386MOVBstoreconst) - v.AuxInt = makeValAndOff(0, 2) + v.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 2)) v0 := b.NewValue0(v.Pos, Op386MOVWstoreconst, types.TypeMem) - v0.AuxInt = 0 + v0.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 0)) v0.AddArg2(destptr, mem) v.AddArg2(destptr, v0) return true } // match: (Zero [5] destptr mem) - // result: (MOVBstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [0] destptr mem)) + // result: (MOVBstoreconst [makeValAndOff32(0,4)] destptr (MOVLstoreconst [makeValAndOff32(0,0)] destptr mem)) for { - if v.AuxInt != 5 { + if auxIntToInt64(v.AuxInt) != 5 { break } destptr := v_0 mem := v_1 v.reset(Op386MOVBstoreconst) - v.AuxInt = makeValAndOff(0, 4) + v.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 4)) v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) - v0.AuxInt = 0 + v0.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 0)) v0.AddArg2(destptr, mem) v.AddArg2(destptr, v0) return true } // match: (Zero [6] destptr mem) - // result: (MOVWstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [0] destptr mem)) + // result: (MOVWstoreconst [makeValAndOff32(0,4)] destptr (MOVLstoreconst [makeValAndOff32(0,0)] destptr mem)) for { - if v.AuxInt != 6 { + if auxIntToInt64(v.AuxInt) != 6 { break } destptr := v_0 mem := v_1 v.reset(Op386MOVWstoreconst) - v.AuxInt = makeValAndOff(0, 4) + v.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 4)) v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) - v0.AuxInt = 0 + v0.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 0)) v0.AddArg2(destptr, mem) v.AddArg2(destptr, v0) return true } // match: (Zero [7] destptr mem) - // result: (MOVLstoreconst [makeValAndOff(0,3)] destptr (MOVLstoreconst [0] destptr mem)) + // result: (MOVLstoreconst [makeValAndOff32(0,3)] destptr (MOVLstoreconst [makeValAndOff32(0,0)] destptr mem)) for { - if v.AuxInt != 7 { + if auxIntToInt64(v.AuxInt) != 7 { break } destptr := v_0 mem := v_1 v.reset(Op386MOVLstoreconst) - v.AuxInt = makeValAndOff(0, 3) + v.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 3)) v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) - v0.AuxInt = 0 + v0.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 0)) v0.AddArg2(destptr, mem) v.AddArg2(destptr, v0) return true @@ -11650,56 +11701,56 @@ func rewriteValue386_OpZero(v *Value) bool { return true } // match: (Zero [8] destptr mem) - // result: (MOVLstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [0] destptr mem)) + // result: (MOVLstoreconst [makeValAndOff32(0,4)] destptr (MOVLstoreconst [makeValAndOff32(0,0)] destptr mem)) for { - if v.AuxInt != 8 { + if auxIntToInt64(v.AuxInt) != 8 { break } destptr := v_0 mem := v_1 v.reset(Op386MOVLstoreconst) - v.AuxInt = makeValAndOff(0, 4) + v.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 4)) v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) - v0.AuxInt = 0 + v0.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 0)) v0.AddArg2(destptr, mem) v.AddArg2(destptr, v0) return true } // match: (Zero [12] destptr mem) - // result: (MOVLstoreconst [makeValAndOff(0,8)] destptr (MOVLstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [0] destptr mem))) + // result: (MOVLstoreconst [makeValAndOff32(0,8)] destptr (MOVLstoreconst [makeValAndOff32(0,4)] destptr (MOVLstoreconst [makeValAndOff32(0,0)] destptr mem))) for { - if v.AuxInt != 12 { + if auxIntToInt64(v.AuxInt) != 12 { break } destptr := v_0 mem := v_1 v.reset(Op386MOVLstoreconst) - v.AuxInt = makeValAndOff(0, 8) + v.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 8)) v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) - v0.AuxInt = makeValAndOff(0, 4) + v0.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 4)) v1 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) - v1.AuxInt = 0 + v1.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 0)) v1.AddArg2(destptr, mem) v0.AddArg2(destptr, v1) v.AddArg2(destptr, v0) return true } // match: (Zero [16] destptr mem) - // result: (MOVLstoreconst [makeValAndOff(0,12)] destptr (MOVLstoreconst [makeValAndOff(0,8)] destptr (MOVLstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [0] destptr mem)))) + // result: (MOVLstoreconst [makeValAndOff32(0,12)] destptr (MOVLstoreconst [makeValAndOff32(0,8)] destptr (MOVLstoreconst [makeValAndOff32(0,4)] destptr (MOVLstoreconst [makeValAndOff32(0,0)] destptr mem)))) for { - if v.AuxInt != 16 { + if auxIntToInt64(v.AuxInt) != 16 { break } destptr := v_0 mem := v_1 v.reset(Op386MOVLstoreconst) - v.AuxInt = makeValAndOff(0, 12) + v.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 12)) v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) - v0.AuxInt = makeValAndOff(0, 8) + v0.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 8)) v1 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) - v1.AuxInt = makeValAndOff(0, 4) + v1.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 4)) v2 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem) - v2.AuxInt = 0 + v2.AuxInt = valAndOffToAuxInt(makeValAndOff32(0, 0)) v2.AddArg2(destptr, mem) v1.AddArg2(destptr, v2) v0.AddArg2(destptr, v1) @@ -11710,24 +11761,24 @@ func rewriteValue386_OpZero(v *Value) bool { // cond: s > 16 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice // result: (DUFFZERO [1*(128-s/4)] destptr (MOVLconst [0]) mem) for { - s := v.AuxInt + s := auxIntToInt64(v.AuxInt) destptr := v_0 mem := v_1 if !(s > 16 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice) { break } v.reset(Op386DUFFZERO) - v.AuxInt = 1 * (128 - s/4) + v.AuxInt = int64ToAuxInt(1 * (128 - s/4)) v0 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32) - v0.AuxInt = 0 + v0.AuxInt = int32ToAuxInt(0) v.AddArg3(destptr, v0, mem) return true } // match: (Zero [s] destptr mem) // cond: (s > 4*128 || (config.noDuffDevice && s > 16)) && s%4 == 0 - // result: (REPSTOSL destptr (MOVLconst [s/4]) (MOVLconst [0]) mem) + // result: (REPSTOSL destptr (MOVLconst [int32(s/4)]) (MOVLconst [0]) mem) for { - s := v.AuxInt + s := auxIntToInt64(v.AuxInt) destptr := v_0 mem := v_1 if !((s > 4*128 || (config.noDuffDevice && s > 16)) && s%4 == 0) { @@ -11735,9 +11786,9 @@ func rewriteValue386_OpZero(v *Value) bool { } v.reset(Op386REPSTOSL) v0 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32) - v0.AuxInt = s / 4 + v0.AuxInt = int32ToAuxInt(int32(s / 4)) v1 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32) - v1.AuxInt = 0 + v1.AuxInt = int32ToAuxInt(0) v.AddArg4(destptr, v0, v1, mem) return true } @@ -11752,10 +11803,10 @@ func rewriteValue386_OpZeromask(v *Value) bool { t := v.Type x := v_0 v.reset(Op386XORLconst) - v.AuxInt = -1 + v.AuxInt = int32ToAuxInt(-1) v0 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t) v1 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags) - v1.AuxInt = 1 + v1.AuxInt = int32ToAuxInt(1) v1.AddArg(x) v0.AddArg(v1) v.AddArg(v0) diff --git a/src/cmd/compile/internal/ssa/rewritegeneric.go b/src/cmd/compile/internal/ssa/rewritegeneric.go index 33c122789e..28b3492c98 100644 --- a/src/cmd/compile/internal/ssa/rewritegeneric.go +++ b/src/cmd/compile/internal/ssa/rewritegeneric.go @@ -2357,7 +2357,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLess64 { continue } @@ -2369,17 +2369,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt + d := auxIntToInt64(v_1_1.AuxInt) if !(d >= c) { continue } v.reset(OpLess64U) v0 := b.NewValue0(v.Pos, OpSub64, x.Type) v1 := b.NewValue0(v.Pos, OpConst64, x.Type) - v1.AuxInt = c + v1.AuxInt = int64ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d - c + v2.AuxInt = int64ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -2398,7 +2398,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLeq64 { continue } @@ -2410,17 +2410,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt + d := auxIntToInt64(v_1_1.AuxInt) if !(d >= c) { continue } v.reset(OpLeq64U) v0 := b.NewValue0(v.Pos, OpSub64, x.Type) v1 := b.NewValue0(v.Pos, OpConst64, x.Type) - v1.AuxInt = c + v1.AuxInt = int64ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d - c + v2.AuxInt = int64ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -2439,7 +2439,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLess32 { continue } @@ -2451,17 +2451,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt + d := auxIntToInt32(v_1_1.AuxInt) if !(d >= c) { continue } v.reset(OpLess32U) v0 := b.NewValue0(v.Pos, OpSub32, x.Type) v1 := b.NewValue0(v.Pos, OpConst32, x.Type) - v1.AuxInt = c + v1.AuxInt = int32ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = d - c + v2.AuxInt = int32ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -2480,7 +2480,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLeq32 { continue } @@ -2492,17 +2492,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt + d := auxIntToInt32(v_1_1.AuxInt) if !(d >= c) { continue } v.reset(OpLeq32U) v0 := b.NewValue0(v.Pos, OpSub32, x.Type) v1 := b.NewValue0(v.Pos, OpConst32, x.Type) - v1.AuxInt = c + v1.AuxInt = int32ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = d - c + v2.AuxInt = int32ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -2521,7 +2521,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLess16 { continue } @@ -2533,17 +2533,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt + d := auxIntToInt16(v_1_1.AuxInt) if !(d >= c) { continue } v.reset(OpLess16U) v0 := b.NewValue0(v.Pos, OpSub16, x.Type) v1 := b.NewValue0(v.Pos, OpConst16, x.Type) - v1.AuxInt = c + v1.AuxInt = int16ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = d - c + v2.AuxInt = int16ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -2562,7 +2562,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLeq16 { continue } @@ -2574,17 +2574,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt + d := auxIntToInt16(v_1_1.AuxInt) if !(d >= c) { continue } v.reset(OpLeq16U) v0 := b.NewValue0(v.Pos, OpSub16, x.Type) v1 := b.NewValue0(v.Pos, OpConst16, x.Type) - v1.AuxInt = c + v1.AuxInt = int16ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = d - c + v2.AuxInt = int16ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -2603,7 +2603,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLess8 { continue } @@ -2615,17 +2615,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt + d := auxIntToInt8(v_1_1.AuxInt) if !(d >= c) { continue } v.reset(OpLess8U) v0 := b.NewValue0(v.Pos, OpSub8, x.Type) v1 := b.NewValue0(v.Pos, OpConst8, x.Type) - v1.AuxInt = c + v1.AuxInt = int8ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = d - c + v2.AuxInt = int8ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -2644,7 +2644,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLeq8 { continue } @@ -2656,24 +2656,24 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt + d := auxIntToInt8(v_1_1.AuxInt) if !(d >= c) { continue } v.reset(OpLeq8U) v0 := b.NewValue0(v.Pos, OpSub8, x.Type) v1 := b.NewValue0(v.Pos, OpConst8, x.Type) - v1.AuxInt = c + v1.AuxInt = int8ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = d - c + v2.AuxInt = int8ToAuxInt(d - c) v.AddArg2(v0, v2) return true } break } // match: (AndB (Less64 (Const64 [c]) x) (Less64 x (Const64 [d]))) - // cond: d >= c+1 && int64(c+1) > int64(c) + // cond: d >= c+1 && c+1 > c // result: (Less64U (Sub64 x (Const64 [c+1])) (Const64 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -2685,7 +2685,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLess64 { continue } @@ -2697,24 +2697,24 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt - if !(d >= c+1 && int64(c+1) > int64(c)) { + d := auxIntToInt64(v_1_1.AuxInt) + if !(d >= c+1 && c+1 > c) { continue } v.reset(OpLess64U) v0 := b.NewValue0(v.Pos, OpSub64, x.Type) v1 := b.NewValue0(v.Pos, OpConst64, x.Type) - v1.AuxInt = c + 1 + v1.AuxInt = int64ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d - c - 1 + v2.AuxInt = int64ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } break } // match: (AndB (Less64 (Const64 [c]) x) (Leq64 x (Const64 [d]))) - // cond: d >= c+1 && int64(c+1) > int64(c) + // cond: d >= c+1 && c+1 > c // result: (Leq64U (Sub64 x (Const64 [c+1])) (Const64 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -2726,7 +2726,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLeq64 { continue } @@ -2738,24 +2738,24 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt - if !(d >= c+1 && int64(c+1) > int64(c)) { + d := auxIntToInt64(v_1_1.AuxInt) + if !(d >= c+1 && c+1 > c) { continue } v.reset(OpLeq64U) v0 := b.NewValue0(v.Pos, OpSub64, x.Type) v1 := b.NewValue0(v.Pos, OpConst64, x.Type) - v1.AuxInt = c + 1 + v1.AuxInt = int64ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d - c - 1 + v2.AuxInt = int64ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } break } // match: (AndB (Less32 (Const32 [c]) x) (Less32 x (Const32 [d]))) - // cond: d >= c+1 && int32(c+1) > int32(c) + // cond: d >= c+1 && c+1 > c // result: (Less32U (Sub32 x (Const32 [c+1])) (Const32 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -2767,7 +2767,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLess32 { continue } @@ -2779,24 +2779,24 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt - if !(d >= c+1 && int32(c+1) > int32(c)) { + d := auxIntToInt32(v_1_1.AuxInt) + if !(d >= c+1 && c+1 > c) { continue } v.reset(OpLess32U) v0 := b.NewValue0(v.Pos, OpSub32, x.Type) v1 := b.NewValue0(v.Pos, OpConst32, x.Type) - v1.AuxInt = c + 1 + v1.AuxInt = int32ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = d - c - 1 + v2.AuxInt = int32ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } break } // match: (AndB (Less32 (Const32 [c]) x) (Leq32 x (Const32 [d]))) - // cond: d >= c+1 && int32(c+1) > int32(c) + // cond: d >= c+1 && c+1 > c // result: (Leq32U (Sub32 x (Const32 [c+1])) (Const32 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -2808,7 +2808,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLeq32 { continue } @@ -2820,24 +2820,24 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt - if !(d >= c+1 && int32(c+1) > int32(c)) { + d := auxIntToInt32(v_1_1.AuxInt) + if !(d >= c+1 && c+1 > c) { continue } v.reset(OpLeq32U) v0 := b.NewValue0(v.Pos, OpSub32, x.Type) v1 := b.NewValue0(v.Pos, OpConst32, x.Type) - v1.AuxInt = c + 1 + v1.AuxInt = int32ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = d - c - 1 + v2.AuxInt = int32ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } break } // match: (AndB (Less16 (Const16 [c]) x) (Less16 x (Const16 [d]))) - // cond: d >= c+1 && int16(c+1) > int16(c) + // cond: d >= c+1 && c+1 > c // result: (Less16U (Sub16 x (Const16 [c+1])) (Const16 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -2849,7 +2849,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLess16 { continue } @@ -2861,24 +2861,24 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt - if !(d >= c+1 && int16(c+1) > int16(c)) { + d := auxIntToInt16(v_1_1.AuxInt) + if !(d >= c+1 && c+1 > c) { continue } v.reset(OpLess16U) v0 := b.NewValue0(v.Pos, OpSub16, x.Type) v1 := b.NewValue0(v.Pos, OpConst16, x.Type) - v1.AuxInt = c + 1 + v1.AuxInt = int16ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = d - c - 1 + v2.AuxInt = int16ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } break } // match: (AndB (Less16 (Const16 [c]) x) (Leq16 x (Const16 [d]))) - // cond: d >= c+1 && int16(c+1) > int16(c) + // cond: d >= c+1 && c+1 > c // result: (Leq16U (Sub16 x (Const16 [c+1])) (Const16 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -2890,7 +2890,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLeq16 { continue } @@ -2902,24 +2902,24 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt - if !(d >= c+1 && int16(c+1) > int16(c)) { + d := auxIntToInt16(v_1_1.AuxInt) + if !(d >= c+1 && c+1 > c) { continue } v.reset(OpLeq16U) v0 := b.NewValue0(v.Pos, OpSub16, x.Type) v1 := b.NewValue0(v.Pos, OpConst16, x.Type) - v1.AuxInt = c + 1 + v1.AuxInt = int16ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = d - c - 1 + v2.AuxInt = int16ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } break } // match: (AndB (Less8 (Const8 [c]) x) (Less8 x (Const8 [d]))) - // cond: d >= c+1 && int8(c+1) > int8(c) + // cond: d >= c+1 && c+1 > c // result: (Less8U (Sub8 x (Const8 [c+1])) (Const8 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -2931,7 +2931,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLess8 { continue } @@ -2943,24 +2943,24 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt - if !(d >= c+1 && int8(c+1) > int8(c)) { + d := auxIntToInt8(v_1_1.AuxInt) + if !(d >= c+1 && c+1 > c) { continue } v.reset(OpLess8U) v0 := b.NewValue0(v.Pos, OpSub8, x.Type) v1 := b.NewValue0(v.Pos, OpConst8, x.Type) - v1.AuxInt = c + 1 + v1.AuxInt = int8ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = d - c - 1 + v2.AuxInt = int8ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } break } // match: (AndB (Less8 (Const8 [c]) x) (Leq8 x (Const8 [d]))) - // cond: d >= c+1 && int8(c+1) > int8(c) + // cond: d >= c+1 && c+1 > c // result: (Leq8U (Sub8 x (Const8 [c+1])) (Const8 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -2972,7 +2972,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLeq8 { continue } @@ -2984,17 +2984,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt - if !(d >= c+1 && int8(c+1) > int8(c)) { + d := auxIntToInt8(v_1_1.AuxInt) + if !(d >= c+1 && c+1 > c) { continue } v.reset(OpLeq8U) v0 := b.NewValue0(v.Pos, OpSub8, x.Type) v1 := b.NewValue0(v.Pos, OpConst8, x.Type) - v1.AuxInt = c + 1 + v1.AuxInt = int8ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = d - c - 1 + v2.AuxInt = int8ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } @@ -3013,7 +3013,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLess64U { continue } @@ -3025,17 +3025,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt + d := auxIntToInt64(v_1_1.AuxInt) if !(uint64(d) >= uint64(c)) { continue } v.reset(OpLess64U) v0 := b.NewValue0(v.Pos, OpSub64, x.Type) v1 := b.NewValue0(v.Pos, OpConst64, x.Type) - v1.AuxInt = c + v1.AuxInt = int64ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d - c + v2.AuxInt = int64ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -3054,7 +3054,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLeq64U { continue } @@ -3066,17 +3066,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt + d := auxIntToInt64(v_1_1.AuxInt) if !(uint64(d) >= uint64(c)) { continue } v.reset(OpLeq64U) v0 := b.NewValue0(v.Pos, OpSub64, x.Type) v1 := b.NewValue0(v.Pos, OpConst64, x.Type) - v1.AuxInt = c + v1.AuxInt = int64ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d - c + v2.AuxInt = int64ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -3084,7 +3084,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { } // match: (AndB (Leq32U (Const32 [c]) x) (Less32U x (Const32 [d]))) // cond: uint32(d) >= uint32(c) - // result: (Less32U (Sub32 x (Const32 [c])) (Const32 [int64(int32(d-c))])) + // result: (Less32U (Sub32 x (Const32 [c])) (Const32 [d-c])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLeq32U { @@ -3095,7 +3095,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLess32U { continue } @@ -3107,17 +3107,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt + d := auxIntToInt32(v_1_1.AuxInt) if !(uint32(d) >= uint32(c)) { continue } v.reset(OpLess32U) v0 := b.NewValue0(v.Pos, OpSub32, x.Type) v1 := b.NewValue0(v.Pos, OpConst32, x.Type) - v1.AuxInt = c + v1.AuxInt = int32ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = int64(int32(d - c)) + v2.AuxInt = int32ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -3125,7 +3125,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { } // match: (AndB (Leq32U (Const32 [c]) x) (Leq32U x (Const32 [d]))) // cond: uint32(d) >= uint32(c) - // result: (Leq32U (Sub32 x (Const32 [c])) (Const32 [int64(int32(d-c))])) + // result: (Leq32U (Sub32 x (Const32 [c])) (Const32 [d-c])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLeq32U { @@ -3136,7 +3136,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLeq32U { continue } @@ -3148,17 +3148,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt + d := auxIntToInt32(v_1_1.AuxInt) if !(uint32(d) >= uint32(c)) { continue } v.reset(OpLeq32U) v0 := b.NewValue0(v.Pos, OpSub32, x.Type) v1 := b.NewValue0(v.Pos, OpConst32, x.Type) - v1.AuxInt = c + v1.AuxInt = int32ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = int64(int32(d - c)) + v2.AuxInt = int32ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -3166,7 +3166,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { } // match: (AndB (Leq16U (Const16 [c]) x) (Less16U x (Const16 [d]))) // cond: uint16(d) >= uint16(c) - // result: (Less16U (Sub16 x (Const16 [c])) (Const16 [int64(int16(d-c))])) + // result: (Less16U (Sub16 x (Const16 [c])) (Const16 [d-c])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLeq16U { @@ -3177,7 +3177,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLess16U { continue } @@ -3189,17 +3189,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt + d := auxIntToInt16(v_1_1.AuxInt) if !(uint16(d) >= uint16(c)) { continue } v.reset(OpLess16U) v0 := b.NewValue0(v.Pos, OpSub16, x.Type) v1 := b.NewValue0(v.Pos, OpConst16, x.Type) - v1.AuxInt = c + v1.AuxInt = int16ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = int64(int16(d - c)) + v2.AuxInt = int16ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -3207,7 +3207,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { } // match: (AndB (Leq16U (Const16 [c]) x) (Leq16U x (Const16 [d]))) // cond: uint16(d) >= uint16(c) - // result: (Leq16U (Sub16 x (Const16 [c])) (Const16 [int64(int16(d-c))])) + // result: (Leq16U (Sub16 x (Const16 [c])) (Const16 [d-c])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLeq16U { @@ -3218,7 +3218,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLeq16U { continue } @@ -3230,17 +3230,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt + d := auxIntToInt16(v_1_1.AuxInt) if !(uint16(d) >= uint16(c)) { continue } v.reset(OpLeq16U) v0 := b.NewValue0(v.Pos, OpSub16, x.Type) v1 := b.NewValue0(v.Pos, OpConst16, x.Type) - v1.AuxInt = c + v1.AuxInt = int16ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = int64(int16(d - c)) + v2.AuxInt = int16ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -3248,7 +3248,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { } // match: (AndB (Leq8U (Const8 [c]) x) (Less8U x (Const8 [d]))) // cond: uint8(d) >= uint8(c) - // result: (Less8U (Sub8 x (Const8 [c])) (Const8 [int64(int8(d-c))])) + // result: (Less8U (Sub8 x (Const8 [c])) (Const8 [d-c])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLeq8U { @@ -3259,7 +3259,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLess8U { continue } @@ -3271,17 +3271,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt + d := auxIntToInt8(v_1_1.AuxInt) if !(uint8(d) >= uint8(c)) { continue } v.reset(OpLess8U) v0 := b.NewValue0(v.Pos, OpSub8, x.Type) v1 := b.NewValue0(v.Pos, OpConst8, x.Type) - v1.AuxInt = c + v1.AuxInt = int8ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = int64(int8(d - c)) + v2.AuxInt = int8ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -3289,7 +3289,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { } // match: (AndB (Leq8U (Const8 [c]) x) (Leq8U x (Const8 [d]))) // cond: uint8(d) >= uint8(c) - // result: (Leq8U (Sub8 x (Const8 [c])) (Const8 [int64(int8(d-c))])) + // result: (Leq8U (Sub8 x (Const8 [c])) (Const8 [d-c])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLeq8U { @@ -3300,7 +3300,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLeq8U { continue } @@ -3312,17 +3312,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt + d := auxIntToInt8(v_1_1.AuxInt) if !(uint8(d) >= uint8(c)) { continue } v.reset(OpLeq8U) v0 := b.NewValue0(v.Pos, OpSub8, x.Type) v1 := b.NewValue0(v.Pos, OpConst8, x.Type) - v1.AuxInt = c + v1.AuxInt = int8ToAuxInt(c) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = int64(int8(d - c)) + v2.AuxInt = int8ToAuxInt(d - c) v.AddArg2(v0, v2) return true } @@ -3341,7 +3341,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLess64U { continue } @@ -3353,17 +3353,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt + d := auxIntToInt64(v_1_1.AuxInt) if !(uint64(d) >= uint64(c+1) && uint64(c+1) > uint64(c)) { continue } v.reset(OpLess64U) v0 := b.NewValue0(v.Pos, OpSub64, x.Type) v1 := b.NewValue0(v.Pos, OpConst64, x.Type) - v1.AuxInt = c + 1 + v1.AuxInt = int64ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d - c - 1 + v2.AuxInt = int64ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } @@ -3382,7 +3382,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLeq64U { continue } @@ -3394,17 +3394,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt + d := auxIntToInt64(v_1_1.AuxInt) if !(uint64(d) >= uint64(c+1) && uint64(c+1) > uint64(c)) { continue } v.reset(OpLeq64U) v0 := b.NewValue0(v.Pos, OpSub64, x.Type) v1 := b.NewValue0(v.Pos, OpConst64, x.Type) - v1.AuxInt = c + 1 + v1.AuxInt = int64ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d - c - 1 + v2.AuxInt = int64ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } @@ -3412,7 +3412,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { } // match: (AndB (Less32U (Const32 [c]) x) (Less32U x (Const32 [d]))) // cond: uint32(d) >= uint32(c+1) && uint32(c+1) > uint32(c) - // result: (Less32U (Sub32 x (Const32 [int64(int32(c+1))])) (Const32 [int64(int32(d-c-1))])) + // result: (Less32U (Sub32 x (Const32 [c+1])) (Const32 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLess32U { @@ -3423,7 +3423,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLess32U { continue } @@ -3435,17 +3435,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt + d := auxIntToInt32(v_1_1.AuxInt) if !(uint32(d) >= uint32(c+1) && uint32(c+1) > uint32(c)) { continue } v.reset(OpLess32U) v0 := b.NewValue0(v.Pos, OpSub32, x.Type) v1 := b.NewValue0(v.Pos, OpConst32, x.Type) - v1.AuxInt = int64(int32(c + 1)) + v1.AuxInt = int32ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = int64(int32(d - c - 1)) + v2.AuxInt = int32ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } @@ -3453,7 +3453,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { } // match: (AndB (Less32U (Const32 [c]) x) (Leq32U x (Const32 [d]))) // cond: uint32(d) >= uint32(c+1) && uint32(c+1) > uint32(c) - // result: (Leq32U (Sub32 x (Const32 [int64(int32(c+1))])) (Const32 [int64(int32(d-c-1))])) + // result: (Leq32U (Sub32 x (Const32 [c+1])) (Const32 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLess32U { @@ -3464,7 +3464,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLeq32U { continue } @@ -3476,17 +3476,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt + d := auxIntToInt32(v_1_1.AuxInt) if !(uint32(d) >= uint32(c+1) && uint32(c+1) > uint32(c)) { continue } v.reset(OpLeq32U) v0 := b.NewValue0(v.Pos, OpSub32, x.Type) v1 := b.NewValue0(v.Pos, OpConst32, x.Type) - v1.AuxInt = int64(int32(c + 1)) + v1.AuxInt = int32ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = int64(int32(d - c - 1)) + v2.AuxInt = int32ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } @@ -3494,7 +3494,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { } // match: (AndB (Less16U (Const16 [c]) x) (Less16U x (Const16 [d]))) // cond: uint16(d) >= uint16(c+1) && uint16(c+1) > uint16(c) - // result: (Less16U (Sub16 x (Const16 [int64(int16(c+1))])) (Const16 [int64(int16(d-c-1))])) + // result: (Less16U (Sub16 x (Const16 [c+1])) (Const16 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLess16U { @@ -3505,7 +3505,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLess16U { continue } @@ -3517,17 +3517,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt + d := auxIntToInt16(v_1_1.AuxInt) if !(uint16(d) >= uint16(c+1) && uint16(c+1) > uint16(c)) { continue } v.reset(OpLess16U) v0 := b.NewValue0(v.Pos, OpSub16, x.Type) v1 := b.NewValue0(v.Pos, OpConst16, x.Type) - v1.AuxInt = int64(int16(c + 1)) + v1.AuxInt = int16ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = int64(int16(d - c - 1)) + v2.AuxInt = int16ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } @@ -3535,7 +3535,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { } // match: (AndB (Less16U (Const16 [c]) x) (Leq16U x (Const16 [d]))) // cond: uint16(d) >= uint16(c+1) && uint16(c+1) > uint16(c) - // result: (Leq16U (Sub16 x (Const16 [int64(int16(c+1))])) (Const16 [int64(int16(d-c-1))])) + // result: (Leq16U (Sub16 x (Const16 [c+1])) (Const16 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLess16U { @@ -3546,7 +3546,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLeq16U { continue } @@ -3558,17 +3558,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt + d := auxIntToInt16(v_1_1.AuxInt) if !(uint16(d) >= uint16(c+1) && uint16(c+1) > uint16(c)) { continue } v.reset(OpLeq16U) v0 := b.NewValue0(v.Pos, OpSub16, x.Type) v1 := b.NewValue0(v.Pos, OpConst16, x.Type) - v1.AuxInt = int64(int16(c + 1)) + v1.AuxInt = int16ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = int64(int16(d - c - 1)) + v2.AuxInt = int16ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } @@ -3576,7 +3576,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { } // match: (AndB (Less8U (Const8 [c]) x) (Less8U x (Const8 [d]))) // cond: uint8(d) >= uint8(c+1) && uint8(c+1) > uint8(c) - // result: (Less8U (Sub8 x (Const8 [int64(int8(c+1))])) (Const8 [int64(int8(d-c-1))])) + // result: (Less8U (Sub8 x (Const8 [c+1])) (Const8 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLess8U { @@ -3587,7 +3587,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLess8U { continue } @@ -3599,17 +3599,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt + d := auxIntToInt8(v_1_1.AuxInt) if !(uint8(d) >= uint8(c+1) && uint8(c+1) > uint8(c)) { continue } v.reset(OpLess8U) v0 := b.NewValue0(v.Pos, OpSub8, x.Type) v1 := b.NewValue0(v.Pos, OpConst8, x.Type) - v1.AuxInt = int64(int8(c + 1)) + v1.AuxInt = int8ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = int64(int8(d - c - 1)) + v2.AuxInt = int8ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } @@ -3617,7 +3617,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { } // match: (AndB (Less8U (Const8 [c]) x) (Leq8U x (Const8 [d]))) // cond: uint8(d) >= uint8(c+1) && uint8(c+1) > uint8(c) - // result: (Leq8U (Sub8 x (Const8 [int64(int8(c+1))])) (Const8 [int64(int8(d-c-1))])) + // result: (Leq8U (Sub8 x (Const8 [c+1])) (Const8 [d-c-1])) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLess8U { @@ -3628,7 +3628,7 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLeq8U { continue } @@ -3640,17 +3640,17 @@ func rewriteValuegeneric_OpAndB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt + d := auxIntToInt8(v_1_1.AuxInt) if !(uint8(d) >= uint8(c+1) && uint8(c+1) > uint8(c)) { continue } v.reset(OpLeq8U) v0 := b.NewValue0(v.Pos, OpSub8, x.Type) v1 := b.NewValue0(v.Pos, OpConst8, x.Type) - v1.AuxInt = int64(int8(c + 1)) + v1.AuxInt = int8ToAuxInt(c + 1) v0.AddArg2(x, v1) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = int64(int8(d - c - 1)) + v2.AuxInt = int8ToAuxInt(d - c - 1) v.AddArg2(v0, v2) return true } @@ -17260,7 +17260,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLess64 { continue } @@ -17272,16 +17272,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt + d := auxIntToInt64(v_1_1.AuxInt) if !(c >= d) { continue } v.reset(OpLess64U) v0 := b.NewValue0(v.Pos, OpConst64, x.Type) - v0.AuxInt = c - d + v0.AuxInt = int64ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub64, x.Type) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d + v2.AuxInt = int64ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17301,7 +17301,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLess64 { continue } @@ -17313,16 +17313,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt + d := auxIntToInt64(v_1_1.AuxInt) if !(c >= d) { continue } v.reset(OpLeq64U) v0 := b.NewValue0(v.Pos, OpConst64, x.Type) - v0.AuxInt = c - d + v0.AuxInt = int64ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub64, x.Type) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d + v2.AuxInt = int64ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17342,7 +17342,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLess32 { continue } @@ -17354,16 +17354,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt + d := auxIntToInt32(v_1_1.AuxInt) if !(c >= d) { continue } v.reset(OpLess32U) v0 := b.NewValue0(v.Pos, OpConst32, x.Type) - v0.AuxInt = c - d + v0.AuxInt = int32ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub32, x.Type) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = d + v2.AuxInt = int32ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17383,7 +17383,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLess32 { continue } @@ -17395,16 +17395,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt + d := auxIntToInt32(v_1_1.AuxInt) if !(c >= d) { continue } v.reset(OpLeq32U) v0 := b.NewValue0(v.Pos, OpConst32, x.Type) - v0.AuxInt = c - d + v0.AuxInt = int32ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub32, x.Type) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = d + v2.AuxInt = int32ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17424,7 +17424,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLess16 { continue } @@ -17436,16 +17436,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt + d := auxIntToInt16(v_1_1.AuxInt) if !(c >= d) { continue } v.reset(OpLess16U) v0 := b.NewValue0(v.Pos, OpConst16, x.Type) - v0.AuxInt = c - d + v0.AuxInt = int16ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub16, x.Type) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = d + v2.AuxInt = int16ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17465,7 +17465,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLess16 { continue } @@ -17477,16 +17477,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt + d := auxIntToInt16(v_1_1.AuxInt) if !(c >= d) { continue } v.reset(OpLeq16U) v0 := b.NewValue0(v.Pos, OpConst16, x.Type) - v0.AuxInt = c - d + v0.AuxInt = int16ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub16, x.Type) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = d + v2.AuxInt = int16ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17506,7 +17506,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLess8 { continue } @@ -17518,16 +17518,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt + d := auxIntToInt8(v_1_1.AuxInt) if !(c >= d) { continue } v.reset(OpLess8U) v0 := b.NewValue0(v.Pos, OpConst8, x.Type) - v0.AuxInt = c - d + v0.AuxInt = int8ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub8, x.Type) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = d + v2.AuxInt = int8ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17547,7 +17547,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLess8 { continue } @@ -17559,16 +17559,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt + d := auxIntToInt8(v_1_1.AuxInt) if !(c >= d) { continue } v.reset(OpLeq8U) v0 := b.NewValue0(v.Pos, OpConst8, x.Type) - v0.AuxInt = c - d + v0.AuxInt = int8ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub8, x.Type) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = d + v2.AuxInt = int8ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17576,7 +17576,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { break } // match: (OrB (Less64 (Const64 [c]) x) (Leq64 x (Const64 [d]))) - // cond: c >= d+1 && int64(d+1) > int64(d) + // cond: c >= d+1 && d+1 > d // result: (Less64U (Const64 [c-d-1]) (Sub64 x (Const64 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -17588,7 +17588,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLeq64 { continue } @@ -17600,16 +17600,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt - if !(c >= d+1 && int64(d+1) > int64(d)) { + d := auxIntToInt64(v_1_1.AuxInt) + if !(c >= d+1 && d+1 > d) { continue } v.reset(OpLess64U) v0 := b.NewValue0(v.Pos, OpConst64, x.Type) - v0.AuxInt = c - d - 1 + v0.AuxInt = int64ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub64, x.Type) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d + 1 + v2.AuxInt = int64ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17617,7 +17617,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { break } // match: (OrB (Leq64 (Const64 [c]) x) (Leq64 x (Const64 [d]))) - // cond: c >= d+1 && int64(d+1) > int64(d) + // cond: c >= d+1 && d+1 > d // result: (Leq64U (Const64 [c-d-1]) (Sub64 x (Const64 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -17629,7 +17629,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLeq64 { continue } @@ -17641,16 +17641,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt - if !(c >= d+1 && int64(d+1) > int64(d)) { + d := auxIntToInt64(v_1_1.AuxInt) + if !(c >= d+1 && d+1 > d) { continue } v.reset(OpLeq64U) v0 := b.NewValue0(v.Pos, OpConst64, x.Type) - v0.AuxInt = c - d - 1 + v0.AuxInt = int64ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub64, x.Type) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d + 1 + v2.AuxInt = int64ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17658,7 +17658,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { break } // match: (OrB (Less32 (Const32 [c]) x) (Leq32 x (Const32 [d]))) - // cond: c >= d+1 && int32(d+1) > int32(d) + // cond: c >= d+1 && d+1 > d // result: (Less32U (Const32 [c-d-1]) (Sub32 x (Const32 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -17670,7 +17670,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLeq32 { continue } @@ -17682,16 +17682,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt - if !(c >= d+1 && int32(d+1) > int32(d)) { + d := auxIntToInt32(v_1_1.AuxInt) + if !(c >= d+1 && d+1 > d) { continue } v.reset(OpLess32U) v0 := b.NewValue0(v.Pos, OpConst32, x.Type) - v0.AuxInt = c - d - 1 + v0.AuxInt = int32ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub32, x.Type) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = d + 1 + v2.AuxInt = int32ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17699,7 +17699,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { break } // match: (OrB (Leq32 (Const32 [c]) x) (Leq32 x (Const32 [d]))) - // cond: c >= d+1 && int32(d+1) > int32(d) + // cond: c >= d+1 && d+1 > d // result: (Leq32U (Const32 [c-d-1]) (Sub32 x (Const32 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -17711,7 +17711,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLeq32 { continue } @@ -17723,16 +17723,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt - if !(c >= d+1 && int32(d+1) > int32(d)) { + d := auxIntToInt32(v_1_1.AuxInt) + if !(c >= d+1 && d+1 > d) { continue } v.reset(OpLeq32U) v0 := b.NewValue0(v.Pos, OpConst32, x.Type) - v0.AuxInt = c - d - 1 + v0.AuxInt = int32ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub32, x.Type) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = d + 1 + v2.AuxInt = int32ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17740,7 +17740,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { break } // match: (OrB (Less16 (Const16 [c]) x) (Leq16 x (Const16 [d]))) - // cond: c >= d+1 && int16(d+1) > int16(d) + // cond: c >= d+1 && d+1 > d // result: (Less16U (Const16 [c-d-1]) (Sub16 x (Const16 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -17752,7 +17752,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLeq16 { continue } @@ -17764,16 +17764,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt - if !(c >= d+1 && int16(d+1) > int16(d)) { + d := auxIntToInt16(v_1_1.AuxInt) + if !(c >= d+1 && d+1 > d) { continue } v.reset(OpLess16U) v0 := b.NewValue0(v.Pos, OpConst16, x.Type) - v0.AuxInt = c - d - 1 + v0.AuxInt = int16ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub16, x.Type) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = d + 1 + v2.AuxInt = int16ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17781,7 +17781,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { break } // match: (OrB (Leq16 (Const16 [c]) x) (Leq16 x (Const16 [d]))) - // cond: c >= d+1 && int16(d+1) > int16(d) + // cond: c >= d+1 && d+1 > d // result: (Leq16U (Const16 [c-d-1]) (Sub16 x (Const16 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -17793,7 +17793,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLeq16 { continue } @@ -17805,16 +17805,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt - if !(c >= d+1 && int16(d+1) > int16(d)) { + d := auxIntToInt16(v_1_1.AuxInt) + if !(c >= d+1 && d+1 > d) { continue } v.reset(OpLeq16U) v0 := b.NewValue0(v.Pos, OpConst16, x.Type) - v0.AuxInt = c - d - 1 + v0.AuxInt = int16ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub16, x.Type) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = d + 1 + v2.AuxInt = int16ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17822,7 +17822,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { break } // match: (OrB (Less8 (Const8 [c]) x) (Leq8 x (Const8 [d]))) - // cond: c >= d+1 && int8(d+1) > int8(d) + // cond: c >= d+1 && d+1 > d // result: (Less8U (Const8 [c-d-1]) (Sub8 x (Const8 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -17834,7 +17834,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLeq8 { continue } @@ -17846,16 +17846,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt - if !(c >= d+1 && int8(d+1) > int8(d)) { + d := auxIntToInt8(v_1_1.AuxInt) + if !(c >= d+1 && d+1 > d) { continue } v.reset(OpLess8U) v0 := b.NewValue0(v.Pos, OpConst8, x.Type) - v0.AuxInt = c - d - 1 + v0.AuxInt = int8ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub8, x.Type) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = d + 1 + v2.AuxInt = int8ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17863,7 +17863,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { break } // match: (OrB (Leq8 (Const8 [c]) x) (Leq8 x (Const8 [d]))) - // cond: c >= d+1 && int8(d+1) > int8(d) + // cond: c >= d+1 && d+1 > d // result: (Leq8U (Const8 [c-d-1]) (Sub8 x (Const8 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { @@ -17875,7 +17875,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLeq8 { continue } @@ -17887,16 +17887,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt - if !(c >= d+1 && int8(d+1) > int8(d)) { + d := auxIntToInt8(v_1_1.AuxInt) + if !(c >= d+1 && d+1 > d) { continue } v.reset(OpLeq8U) v0 := b.NewValue0(v.Pos, OpConst8, x.Type) - v0.AuxInt = c - d - 1 + v0.AuxInt = int8ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub8, x.Type) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = d + 1 + v2.AuxInt = int8ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17916,7 +17916,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLess64U { continue } @@ -17928,16 +17928,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt + d := auxIntToInt64(v_1_1.AuxInt) if !(uint64(c) >= uint64(d)) { continue } v.reset(OpLess64U) v0 := b.NewValue0(v.Pos, OpConst64, x.Type) - v0.AuxInt = c - d + v0.AuxInt = int64ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub64, x.Type) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d + v2.AuxInt = int64ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17957,7 +17957,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLess64U { continue } @@ -17969,16 +17969,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt + d := auxIntToInt64(v_1_1.AuxInt) if !(uint64(c) >= uint64(d)) { continue } v.reset(OpLeq64U) v0 := b.NewValue0(v.Pos, OpConst64, x.Type) - v0.AuxInt = c - d + v0.AuxInt = int64ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub64, x.Type) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d + v2.AuxInt = int64ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -17987,7 +17987,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { } // match: (OrB (Less32U (Const32 [c]) x) (Less32U x (Const32 [d]))) // cond: uint32(c) >= uint32(d) - // result: (Less32U (Const32 [int64(int32(c-d))]) (Sub32 x (Const32 [d]))) + // result: (Less32U (Const32 [c-d]) (Sub32 x (Const32 [d]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLess32U { @@ -17998,7 +17998,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLess32U { continue } @@ -18010,16 +18010,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt + d := auxIntToInt32(v_1_1.AuxInt) if !(uint32(c) >= uint32(d)) { continue } v.reset(OpLess32U) v0 := b.NewValue0(v.Pos, OpConst32, x.Type) - v0.AuxInt = int64(int32(c - d)) + v0.AuxInt = int32ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub32, x.Type) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = d + v2.AuxInt = int32ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18028,7 +18028,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { } // match: (OrB (Leq32U (Const32 [c]) x) (Less32U x (Const32 [d]))) // cond: uint32(c) >= uint32(d) - // result: (Leq32U (Const32 [int64(int32(c-d))]) (Sub32 x (Const32 [d]))) + // result: (Leq32U (Const32 [c-d]) (Sub32 x (Const32 [d]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLeq32U { @@ -18039,7 +18039,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLess32U { continue } @@ -18051,16 +18051,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt + d := auxIntToInt32(v_1_1.AuxInt) if !(uint32(c) >= uint32(d)) { continue } v.reset(OpLeq32U) v0 := b.NewValue0(v.Pos, OpConst32, x.Type) - v0.AuxInt = int64(int32(c - d)) + v0.AuxInt = int32ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub32, x.Type) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = d + v2.AuxInt = int32ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18069,7 +18069,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { } // match: (OrB (Less16U (Const16 [c]) x) (Less16U x (Const16 [d]))) // cond: uint16(c) >= uint16(d) - // result: (Less16U (Const16 [int64(int16(c-d))]) (Sub16 x (Const16 [d]))) + // result: (Less16U (Const16 [c-d]) (Sub16 x (Const16 [d]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLess16U { @@ -18080,7 +18080,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLess16U { continue } @@ -18092,16 +18092,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt + d := auxIntToInt16(v_1_1.AuxInt) if !(uint16(c) >= uint16(d)) { continue } v.reset(OpLess16U) v0 := b.NewValue0(v.Pos, OpConst16, x.Type) - v0.AuxInt = int64(int16(c - d)) + v0.AuxInt = int16ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub16, x.Type) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = d + v2.AuxInt = int16ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18110,7 +18110,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { } // match: (OrB (Leq16U (Const16 [c]) x) (Less16U x (Const16 [d]))) // cond: uint16(c) >= uint16(d) - // result: (Leq16U (Const16 [int64(int16(c-d))]) (Sub16 x (Const16 [d]))) + // result: (Leq16U (Const16 [c-d]) (Sub16 x (Const16 [d]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLeq16U { @@ -18121,7 +18121,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLess16U { continue } @@ -18133,16 +18133,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt + d := auxIntToInt16(v_1_1.AuxInt) if !(uint16(c) >= uint16(d)) { continue } v.reset(OpLeq16U) v0 := b.NewValue0(v.Pos, OpConst16, x.Type) - v0.AuxInt = int64(int16(c - d)) + v0.AuxInt = int16ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub16, x.Type) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = d + v2.AuxInt = int16ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18151,7 +18151,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { } // match: (OrB (Less8U (Const8 [c]) x) (Less8U x (Const8 [d]))) // cond: uint8(c) >= uint8(d) - // result: (Less8U (Const8 [int64( int8(c-d))]) (Sub8 x (Const8 [d]))) + // result: (Less8U (Const8 [c-d]) (Sub8 x (Const8 [d]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLess8U { @@ -18162,7 +18162,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLess8U { continue } @@ -18174,16 +18174,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt + d := auxIntToInt8(v_1_1.AuxInt) if !(uint8(c) >= uint8(d)) { continue } v.reset(OpLess8U) v0 := b.NewValue0(v.Pos, OpConst8, x.Type) - v0.AuxInt = int64(int8(c - d)) + v0.AuxInt = int8ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub8, x.Type) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = d + v2.AuxInt = int8ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18192,7 +18192,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { } // match: (OrB (Leq8U (Const8 [c]) x) (Less8U x (Const8 [d]))) // cond: uint8(c) >= uint8(d) - // result: (Leq8U (Const8 [int64( int8(c-d))]) (Sub8 x (Const8 [d]))) + // result: (Leq8U (Const8 [c-d]) (Sub8 x (Const8 [d]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLeq8U { @@ -18203,7 +18203,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLess8U { continue } @@ -18215,16 +18215,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt + d := auxIntToInt8(v_1_1.AuxInt) if !(uint8(c) >= uint8(d)) { continue } v.reset(OpLeq8U) v0 := b.NewValue0(v.Pos, OpConst8, x.Type) - v0.AuxInt = int64(int8(c - d)) + v0.AuxInt = int8ToAuxInt(c - d) v1 := b.NewValue0(v.Pos, OpSub8, x.Type) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = d + v2.AuxInt = int8ToAuxInt(d) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18244,7 +18244,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLeq64U { continue } @@ -18256,16 +18256,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt + d := auxIntToInt64(v_1_1.AuxInt) if !(uint64(c) >= uint64(d+1) && uint64(d+1) > uint64(d)) { continue } v.reset(OpLess64U) v0 := b.NewValue0(v.Pos, OpConst64, x.Type) - v0.AuxInt = c - d - 1 + v0.AuxInt = int64ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub64, x.Type) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d + 1 + v2.AuxInt = int64ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18285,7 +18285,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst64 { continue } - c := v_0_0.AuxInt + c := auxIntToInt64(v_0_0.AuxInt) if v_1.Op != OpLeq64U { continue } @@ -18297,16 +18297,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst64 { continue } - d := v_1_1.AuxInt + d := auxIntToInt64(v_1_1.AuxInt) if !(uint64(c) >= uint64(d+1) && uint64(d+1) > uint64(d)) { continue } v.reset(OpLeq64U) v0 := b.NewValue0(v.Pos, OpConst64, x.Type) - v0.AuxInt = c - d - 1 + v0.AuxInt = int64ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub64, x.Type) v2 := b.NewValue0(v.Pos, OpConst64, x.Type) - v2.AuxInt = d + 1 + v2.AuxInt = int64ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18315,7 +18315,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { } // match: (OrB (Less32U (Const32 [c]) x) (Leq32U x (Const32 [d]))) // cond: uint32(c) >= uint32(d+1) && uint32(d+1) > uint32(d) - // result: (Less32U (Const32 [int64(int32(c-d-1))]) (Sub32 x (Const32 [int64(int32(d+1))]))) + // result: (Less32U (Const32 [c-d-1]) (Sub32 x (Const32 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLess32U { @@ -18326,7 +18326,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLeq32U { continue } @@ -18338,16 +18338,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt + d := auxIntToInt32(v_1_1.AuxInt) if !(uint32(c) >= uint32(d+1) && uint32(d+1) > uint32(d)) { continue } v.reset(OpLess32U) v0 := b.NewValue0(v.Pos, OpConst32, x.Type) - v0.AuxInt = int64(int32(c - d - 1)) + v0.AuxInt = int32ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub32, x.Type) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = int64(int32(d + 1)) + v2.AuxInt = int32ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18356,7 +18356,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { } // match: (OrB (Leq32U (Const32 [c]) x) (Leq32U x (Const32 [d]))) // cond: uint32(c) >= uint32(d+1) && uint32(d+1) > uint32(d) - // result: (Leq32U (Const32 [int64(int32(c-d-1))]) (Sub32 x (Const32 [int64(int32(d+1))]))) + // result: (Leq32U (Const32 [c-d-1]) (Sub32 x (Const32 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLeq32U { @@ -18367,7 +18367,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst32 { continue } - c := v_0_0.AuxInt + c := auxIntToInt32(v_0_0.AuxInt) if v_1.Op != OpLeq32U { continue } @@ -18379,16 +18379,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst32 { continue } - d := v_1_1.AuxInt + d := auxIntToInt32(v_1_1.AuxInt) if !(uint32(c) >= uint32(d+1) && uint32(d+1) > uint32(d)) { continue } v.reset(OpLeq32U) v0 := b.NewValue0(v.Pos, OpConst32, x.Type) - v0.AuxInt = int64(int32(c - d - 1)) + v0.AuxInt = int32ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub32, x.Type) v2 := b.NewValue0(v.Pos, OpConst32, x.Type) - v2.AuxInt = int64(int32(d + 1)) + v2.AuxInt = int32ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18397,7 +18397,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { } // match: (OrB (Less16U (Const16 [c]) x) (Leq16U x (Const16 [d]))) // cond: uint16(c) >= uint16(d+1) && uint16(d+1) > uint16(d) - // result: (Less16U (Const16 [int64(int16(c-d-1))]) (Sub16 x (Const16 [int64(int16(d+1))]))) + // result: (Less16U (Const16 [c-d-1]) (Sub16 x (Const16 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLess16U { @@ -18408,7 +18408,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLeq16U { continue } @@ -18420,16 +18420,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt + d := auxIntToInt16(v_1_1.AuxInt) if !(uint16(c) >= uint16(d+1) && uint16(d+1) > uint16(d)) { continue } v.reset(OpLess16U) v0 := b.NewValue0(v.Pos, OpConst16, x.Type) - v0.AuxInt = int64(int16(c - d - 1)) + v0.AuxInt = int16ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub16, x.Type) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = int64(int16(d + 1)) + v2.AuxInt = int16ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18438,7 +18438,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { } // match: (OrB (Leq16U (Const16 [c]) x) (Leq16U x (Const16 [d]))) // cond: uint16(c) >= uint16(d+1) && uint16(d+1) > uint16(d) - // result: (Leq16U (Const16 [int64(int16(c-d-1))]) (Sub16 x (Const16 [int64(int16(d+1))]))) + // result: (Leq16U (Const16 [c-d-1]) (Sub16 x (Const16 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLeq16U { @@ -18449,7 +18449,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst16 { continue } - c := v_0_0.AuxInt + c := auxIntToInt16(v_0_0.AuxInt) if v_1.Op != OpLeq16U { continue } @@ -18461,16 +18461,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst16 { continue } - d := v_1_1.AuxInt + d := auxIntToInt16(v_1_1.AuxInt) if !(uint16(c) >= uint16(d+1) && uint16(d+1) > uint16(d)) { continue } v.reset(OpLeq16U) v0 := b.NewValue0(v.Pos, OpConst16, x.Type) - v0.AuxInt = int64(int16(c - d - 1)) + v0.AuxInt = int16ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub16, x.Type) v2 := b.NewValue0(v.Pos, OpConst16, x.Type) - v2.AuxInt = int64(int16(d + 1)) + v2.AuxInt = int16ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18479,7 +18479,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { } // match: (OrB (Less8U (Const8 [c]) x) (Leq8U x (Const8 [d]))) // cond: uint8(c) >= uint8(d+1) && uint8(d+1) > uint8(d) - // result: (Less8U (Const8 [int64( int8(c-d-1))]) (Sub8 x (Const8 [int64( int8(d+1))]))) + // result: (Less8U (Const8 [c-d-1]) (Sub8 x (Const8 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLess8U { @@ -18490,7 +18490,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLeq8U { continue } @@ -18502,16 +18502,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt + d := auxIntToInt8(v_1_1.AuxInt) if !(uint8(c) >= uint8(d+1) && uint8(d+1) > uint8(d)) { continue } v.reset(OpLess8U) v0 := b.NewValue0(v.Pos, OpConst8, x.Type) - v0.AuxInt = int64(int8(c - d - 1)) + v0.AuxInt = int8ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub8, x.Type) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = int64(int8(d + 1)) + v2.AuxInt = int8ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true @@ -18520,7 +18520,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { } // match: (OrB (Leq8U (Const8 [c]) x) (Leq8U x (Const8 [d]))) // cond: uint8(c) >= uint8(d+1) && uint8(d+1) > uint8(d) - // result: (Leq8U (Const8 [int64( int8(c-d-1))]) (Sub8 x (Const8 [int64( int8(d+1))]))) + // result: (Leq8U (Const8 [c-d-1]) (Sub8 x (Const8 [d+1]))) for { for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { if v_0.Op != OpLeq8U { @@ -18531,7 +18531,7 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_0_0.Op != OpConst8 { continue } - c := v_0_0.AuxInt + c := auxIntToInt8(v_0_0.AuxInt) if v_1.Op != OpLeq8U { continue } @@ -18543,16 +18543,16 @@ func rewriteValuegeneric_OpOrB(v *Value) bool { if v_1_1.Op != OpConst8 { continue } - d := v_1_1.AuxInt + d := auxIntToInt8(v_1_1.AuxInt) if !(uint8(c) >= uint8(d+1) && uint8(d+1) > uint8(d)) { continue } v.reset(OpLeq8U) v0 := b.NewValue0(v.Pos, OpConst8, x.Type) - v0.AuxInt = int64(int8(c - d - 1)) + v0.AuxInt = int8ToAuxInt(c - d - 1) v1 := b.NewValue0(v.Pos, OpSub8, x.Type) v2 := b.NewValue0(v.Pos, OpConst8, x.Type) - v2.AuxInt = int64(int8(d + 1)) + v2.AuxInt = int8ToAuxInt(d + 1) v1.AddArg2(x, v2) v.AddArg2(v0, v1) return true diff --git a/src/cmd/link/internal/ld/deadcode.go b/src/cmd/link/internal/ld/deadcode.go index b5bc508356..ae676935fc 100644 --- a/src/cmd/link/internal/ld/deadcode.go +++ b/src/cmd/link/internal/ld/deadcode.go @@ -22,7 +22,8 @@ import ( // // 1. direct call // 2. through a reachable interface type -// 3. reflect.Value.Method, or reflect.Type.Method +// 3. reflect.Value.Method (or MethodByName), or reflect.Type.Method +// (or MethodByName) // // The first case is handled by the flood fill, a directly called method // is marked as reachable. @@ -33,7 +34,7 @@ import ( // as reachable. This is extremely conservative, but easy and correct. // // The third case is handled by looking to see if any of: -// - reflect.Value.Method is reachable +// - reflect.Value.Method or MethodByName is reachable // - reflect.Type.Method or MethodByName is called (through the // REFLECTMETHOD attribute marked by the compiler). // If any of these happen, all bets are off and all exported methods diff --git a/src/cmd/link/internal/ld/deadcode2.go b/src/cmd/link/internal/ld/deadcode2.go index 1aa65aee78..93df626c21 100644 --- a/src/cmd/link/internal/ld/deadcode2.go +++ b/src/cmd/link/internal/ld/deadcode2.go @@ -220,6 +220,7 @@ func deadcode2(ctxt *Link) { d.flood() methSym := ldr.Lookup("reflect.Value.Method", sym.SymVerABIInternal) + methByNameSym := ldr.Lookup("reflect.Value.MethodByName", sym.SymVerABIInternal) if ctxt.DynlinkingGo() { // Exported methods may satisfy interfaces we don't know // about yet when dynamically linking. @@ -230,7 +231,7 @@ func deadcode2(ctxt *Link) { // Methods might be called via reflection. Give up on // static analysis, mark all exported methods of // all reachable types as reachable. - d.reflectSeen = d.reflectSeen || (methSym != 0 && ldr.AttrReachable(methSym)) + d.reflectSeen = d.reflectSeen || (methSym != 0 && ldr.AttrReachable(methSym)) || (methByNameSym != 0 && ldr.AttrReachable(methByNameSym)) // Mark all methods that could satisfy a discovered // interface as reachable. We recheck old marked interfaces diff --git a/src/cmd/link/internal/ld/deadcode_test.go b/src/cmd/link/internal/ld/deadcode_test.go new file mode 100644 index 0000000000..197a057c2f --- /dev/null +++ b/src/cmd/link/internal/ld/deadcode_test.go @@ -0,0 +1,61 @@ +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +package ld + +import ( + "bytes" + "internal/testenv" + "io/ioutil" + "os" + "os/exec" + "path/filepath" + "testing" +) + +// This example uses reflect.Value.Call, but not +// reflect.{Value,Type}.Method. This should not +// need to bring all methods live. +const deadcodeTestSrc = ` +package main +import "reflect" + +func f() { println("call") } + +type T int +func (T) M() {} + +func main() { + v := reflect.ValueOf(f) + v.Call(nil) + i := interface{}(T(1)) + println(i) +} +` + +func TestDeadcode(t *testing.T) { + testenv.MustHaveGoBuild(t) + + tmpdir, err := ioutil.TempDir("", "TestDeadcode") + if err != nil { + t.Fatal(err) + } + defer os.RemoveAll(tmpdir) + + src := filepath.Join(tmpdir, "main.go") + err = ioutil.WriteFile(src, []byte(deadcodeTestSrc), 0666) + if err != nil { + t.Fatal(err) + } + exe := filepath.Join(tmpdir, "main.exe") + + cmd := exec.Command(testenv.GoToolPath(t), "build", "-ldflags=-dumpdep", "-o", exe, src) + out, err := cmd.CombinedOutput() + if err != nil { + t.Fatalf("%v: %v:\n%s", cmd.Args, err, out) + } + if bytes.Contains(out, []byte("main.T.M")) { + t.Errorf("main.T.M should not be reachable. Output:\n%s", out) + } +} diff --git a/test/reflectmethod5.go b/test/reflectmethod5.go new file mode 100644 index 0000000000..a3fdaa2dcd --- /dev/null +++ b/test/reflectmethod5.go @@ -0,0 +1,30 @@ +// run + +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Issue 38515: failed to mark the method wrapper +// reflect.Type.Method itself as REFLECTMETHOD. + +package main + +import "reflect" + +var called bool + +type foo struct{} + +func (foo) X() { called = true } + +var h = reflect.Type.Method + +func main() { + v := reflect.ValueOf(foo{}) + m := h(v.Type(), 0) + f := m.Func.Interface().(func(foo)) + f(foo{}) + if !called { + panic("FAIL") + } +} diff --git a/test/reflectmethod6.go b/test/reflectmethod6.go new file mode 100644 index 0000000000..004ea303e6 --- /dev/null +++ b/test/reflectmethod6.go @@ -0,0 +1,32 @@ +// run + +// Copyright 2020 The Go Authors. All rights reserved. +// Use of this source code is governed by a BSD-style +// license that can be found in the LICENSE file. + +// Similar to reflectmethod5.go, but for reflect.Type.MethodByName. + +package main + +import "reflect" + +var called bool + +type foo struct{} + +func (foo) X() { called = true } + +var h = reflect.Type.MethodByName + +func main() { + v := reflect.ValueOf(foo{}) + m, ok := h(v.Type(), "X") + if !ok { + panic("FAIL") + } + f := m.Func.Interface().(func(foo)) + f(foo{}) + if !called { + panic("FAIL") + } +}