| // Code generated from _gen/generic.rules using 'go generate'; DO NOT EDIT. |
| |
| package rewritegeneric |
| |
| import "math" |
| import "math/bits" |
| import "cmd/internal/obj" |
| import "cmd/compile/internal/types" |
| import "cmd/compile/internal/ir" |
| import "cmd/compile/internal/ssa/block" |
| import "cmd/compile/internal/ssa/ssaop" |
| import "cmd/compile/internal/ssa" |
| |
| func RewriteValue(v *ssa.Value) bool { |
| switch v.Op { |
| case ssaop.OpAdd16: |
| return rewriteValue_OpAdd16(v) |
| case ssaop.OpAdd32: |
| return rewriteValue_OpAdd32(v) |
| case ssaop.OpAdd32F: |
| return rewriteValue_OpAdd32F(v) |
| case ssaop.OpAdd64: |
| return rewriteValue_OpAdd64(v) |
| case ssaop.OpAdd64F: |
| return rewriteValue_OpAdd64F(v) |
| case ssaop.OpAdd64carry: |
| return rewriteValue_OpAdd64carry(v) |
| case ssaop.OpAdd8: |
| return rewriteValue_OpAdd8(v) |
| case ssaop.OpAddPtr: |
| return rewriteValue_OpAddPtr(v) |
| case ssaop.OpAnd16: |
| return rewriteValue_OpAnd16(v) |
| case ssaop.OpAnd32: |
| return rewriteValue_OpAnd32(v) |
| case ssaop.OpAnd64: |
| return rewriteValue_OpAnd64(v) |
| case ssaop.OpAnd8: |
| return rewriteValue_OpAnd8(v) |
| case ssaop.OpAndB: |
| return rewriteValue_OpAndB(v) |
| case ssaop.OpArraySelect: |
| return rewriteValue_OpArraySelect(v) |
| case ssaop.OpBitLen16: |
| return rewriteValue_OpBitLen16(v) |
| case ssaop.OpBitLen32: |
| return rewriteValue_OpBitLen32(v) |
| case ssaop.OpBitLen64: |
| return rewriteValue_OpBitLen64(v) |
| case ssaop.OpBitLen8: |
| return rewriteValue_OpBitLen8(v) |
| case ssaop.OpBitRev16: |
| return rewriteValue_OpBitRev16(v) |
| case ssaop.OpBitRev32: |
| return rewriteValue_OpBitRev32(v) |
| case ssaop.OpBitRev64: |
| return rewriteValue_OpBitRev64(v) |
| case ssaop.OpBitRev8: |
| return rewriteValue_OpBitRev8(v) |
| case ssaop.OpBswap16: |
| return rewriteValue_OpBswap16(v) |
| case ssaop.OpBswap32: |
| return rewriteValue_OpBswap32(v) |
| case ssaop.OpBswap64: |
| return rewriteValue_OpBswap64(v) |
| case ssaop.OpCeil: |
| return rewriteValue_OpCeil(v) |
| case ssaop.OpCom16: |
| return rewriteValue_OpCom16(v) |
| case ssaop.OpCom32: |
| return rewriteValue_OpCom32(v) |
| case ssaop.OpCom64: |
| return rewriteValue_OpCom64(v) |
| case ssaop.OpCom8: |
| return rewriteValue_OpCom8(v) |
| case ssaop.OpCondSelect: |
| return rewriteValue_OpCondSelect(v) |
| case ssaop.OpConstInterface: |
| return rewriteValue_OpConstInterface(v) |
| case ssaop.OpConstSlice: |
| return rewriteValue_OpConstSlice(v) |
| case ssaop.OpConstString: |
| return rewriteValue_OpConstString(v) |
| case ssaop.OpConvert: |
| return rewriteValue_OpConvert(v) |
| case ssaop.OpCtz16: |
| return rewriteValue_OpCtz16(v) |
| case ssaop.OpCtz32: |
| return rewriteValue_OpCtz32(v) |
| case ssaop.OpCtz64: |
| return rewriteValue_OpCtz64(v) |
| case ssaop.OpCtz8: |
| return rewriteValue_OpCtz8(v) |
| case ssaop.OpCvt32Fto32: |
| return rewriteValue_OpCvt32Fto32(v) |
| case ssaop.OpCvt32Fto64: |
| return rewriteValue_OpCvt32Fto64(v) |
| case ssaop.OpCvt32Fto64F: |
| return rewriteValue_OpCvt32Fto64F(v) |
| case ssaop.OpCvt32to32F: |
| return rewriteValue_OpCvt32to32F(v) |
| case ssaop.OpCvt32to64F: |
| return rewriteValue_OpCvt32to64F(v) |
| case ssaop.OpCvt64Fto32: |
| return rewriteValue_OpCvt64Fto32(v) |
| case ssaop.OpCvt64Fto32F: |
| return rewriteValue_OpCvt64Fto32F(v) |
| case ssaop.OpCvt64Fto64: |
| return rewriteValue_OpCvt64Fto64(v) |
| case ssaop.OpCvt64to32F: |
| return rewriteValue_OpCvt64to32F(v) |
| case ssaop.OpCvt64to64F: |
| return rewriteValue_OpCvt64to64F(v) |
| case ssaop.OpCvtBoolToUint8: |
| return rewriteValue_OpCvtBoolToUint8(v) |
| case ssaop.OpDiv128u: |
| return rewriteValue_OpDiv128u(v) |
| case ssaop.OpDiv16: |
| return rewriteValue_OpDiv16(v) |
| case ssaop.OpDiv16u: |
| return rewriteValue_OpDiv16u(v) |
| case ssaop.OpDiv32: |
| return rewriteValue_OpDiv32(v) |
| case ssaop.OpDiv32F: |
| return rewriteValue_OpDiv32F(v) |
| case ssaop.OpDiv32u: |
| return rewriteValue_OpDiv32u(v) |
| case ssaop.OpDiv64: |
| return rewriteValue_OpDiv64(v) |
| case ssaop.OpDiv64F: |
| return rewriteValue_OpDiv64F(v) |
| case ssaop.OpDiv64u: |
| return rewriteValue_OpDiv64u(v) |
| case ssaop.OpDiv8: |
| return rewriteValue_OpDiv8(v) |
| case ssaop.OpDiv8u: |
| return rewriteValue_OpDiv8u(v) |
| case ssaop.OpEq16: |
| return rewriteValue_OpEq16(v) |
| case ssaop.OpEq32: |
| return rewriteValue_OpEq32(v) |
| case ssaop.OpEq32F: |
| return rewriteValue_OpEq32F(v) |
| case ssaop.OpEq64: |
| return rewriteValue_OpEq64(v) |
| case ssaop.OpEq64F: |
| return rewriteValue_OpEq64F(v) |
| case ssaop.OpEq8: |
| return rewriteValue_OpEq8(v) |
| case ssaop.OpEqB: |
| return rewriteValue_OpEqB(v) |
| case ssaop.OpEqInter: |
| return rewriteValue_OpEqInter(v) |
| case ssaop.OpEqPtr: |
| return rewriteValue_OpEqPtr(v) |
| case ssaop.OpEqSlice: |
| return rewriteValue_OpEqSlice(v) |
| case ssaop.OpFloor: |
| return rewriteValue_OpFloor(v) |
| case ssaop.OpIMake: |
| return rewriteValue_OpIMake(v) |
| case ssaop.OpInterLECall: |
| return rewriteValue_OpInterLECall(v) |
| case ssaop.OpIsInBounds: |
| return rewriteValue_OpIsInBounds(v) |
| case ssaop.OpIsNonNil: |
| return rewriteValue_OpIsNonNil(v) |
| case ssaop.OpIsSliceInBounds: |
| return rewriteValue_OpIsSliceInBounds(v) |
| case ssaop.OpLeq16: |
| return rewriteValue_OpLeq16(v) |
| case ssaop.OpLeq16U: |
| return rewriteValue_OpLeq16U(v) |
| case ssaop.OpLeq32: |
| return rewriteValue_OpLeq32(v) |
| case ssaop.OpLeq32F: |
| return rewriteValue_OpLeq32F(v) |
| case ssaop.OpLeq32U: |
| return rewriteValue_OpLeq32U(v) |
| case ssaop.OpLeq64: |
| return rewriteValue_OpLeq64(v) |
| case ssaop.OpLeq64F: |
| return rewriteValue_OpLeq64F(v) |
| case ssaop.OpLeq64U: |
| return rewriteValue_OpLeq64U(v) |
| case ssaop.OpLeq8: |
| return rewriteValue_OpLeq8(v) |
| case ssaop.OpLeq8U: |
| return rewriteValue_OpLeq8U(v) |
| case ssaop.OpLess16: |
| return rewriteValue_OpLess16(v) |
| case ssaop.OpLess16U: |
| return rewriteValue_OpLess16U(v) |
| case ssaop.OpLess32: |
| return rewriteValue_OpLess32(v) |
| case ssaop.OpLess32F: |
| return rewriteValue_OpLess32F(v) |
| case ssaop.OpLess32U: |
| return rewriteValue_OpLess32U(v) |
| case ssaop.OpLess64: |
| return rewriteValue_OpLess64(v) |
| case ssaop.OpLess64F: |
| return rewriteValue_OpLess64F(v) |
| case ssaop.OpLess64U: |
| return rewriteValue_OpLess64U(v) |
| case ssaop.OpLess8: |
| return rewriteValue_OpLess8(v) |
| case ssaop.OpLess8U: |
| return rewriteValue_OpLess8U(v) |
| case ssaop.OpLoad: |
| return rewriteValue_OpLoad(v) |
| case ssaop.OpLsh16x16: |
| return rewriteValue_OpLsh16x16(v) |
| case ssaop.OpLsh16x32: |
| return rewriteValue_OpLsh16x32(v) |
| case ssaop.OpLsh16x64: |
| return rewriteValue_OpLsh16x64(v) |
| case ssaop.OpLsh16x8: |
| return rewriteValue_OpLsh16x8(v) |
| case ssaop.OpLsh32x16: |
| return rewriteValue_OpLsh32x16(v) |
| case ssaop.OpLsh32x32: |
| return rewriteValue_OpLsh32x32(v) |
| case ssaop.OpLsh32x64: |
| return rewriteValue_OpLsh32x64(v) |
| case ssaop.OpLsh32x8: |
| return rewriteValue_OpLsh32x8(v) |
| case ssaop.OpLsh64x16: |
| return rewriteValue_OpLsh64x16(v) |
| case ssaop.OpLsh64x32: |
| return rewriteValue_OpLsh64x32(v) |
| case ssaop.OpLsh64x64: |
| return rewriteValue_OpLsh64x64(v) |
| case ssaop.OpLsh64x8: |
| return rewriteValue_OpLsh64x8(v) |
| case ssaop.OpLsh8x16: |
| return rewriteValue_OpLsh8x16(v) |
| case ssaop.OpLsh8x32: |
| return rewriteValue_OpLsh8x32(v) |
| case ssaop.OpLsh8x64: |
| return rewriteValue_OpLsh8x64(v) |
| case ssaop.OpLsh8x8: |
| return rewriteValue_OpLsh8x8(v) |
| case ssaop.OpMemEq: |
| return rewriteValue_OpMemEq(v) |
| case ssaop.OpMod16: |
| return rewriteValue_OpMod16(v) |
| case ssaop.OpMod16u: |
| return rewriteValue_OpMod16u(v) |
| case ssaop.OpMod32: |
| return rewriteValue_OpMod32(v) |
| case ssaop.OpMod32u: |
| return rewriteValue_OpMod32u(v) |
| case ssaop.OpMod64: |
| return rewriteValue_OpMod64(v) |
| case ssaop.OpMod64u: |
| return rewriteValue_OpMod64u(v) |
| case ssaop.OpMod8: |
| return rewriteValue_OpMod8(v) |
| case ssaop.OpMod8u: |
| return rewriteValue_OpMod8u(v) |
| case ssaop.OpMove: |
| return rewriteValue_OpMove(v) |
| case ssaop.OpMul16: |
| return rewriteValue_OpMul16(v) |
| case ssaop.OpMul32: |
| return rewriteValue_OpMul32(v) |
| case ssaop.OpMul32F: |
| return rewriteValue_OpMul32F(v) |
| case ssaop.OpMul32uhilo: |
| return rewriteValue_OpMul32uhilo(v) |
| case ssaop.OpMul32uover: |
| return rewriteValue_OpMul32uover(v) |
| case ssaop.OpMul64: |
| return rewriteValue_OpMul64(v) |
| case ssaop.OpMul64F: |
| return rewriteValue_OpMul64F(v) |
| case ssaop.OpMul64uhilo: |
| return rewriteValue_OpMul64uhilo(v) |
| case ssaop.OpMul64uover: |
| return rewriteValue_OpMul64uover(v) |
| case ssaop.OpMul8: |
| return rewriteValue_OpMul8(v) |
| case ssaop.OpNeg16: |
| return rewriteValue_OpNeg16(v) |
| case ssaop.OpNeg32: |
| return rewriteValue_OpNeg32(v) |
| case ssaop.OpNeg32F: |
| return rewriteValue_OpNeg32F(v) |
| case ssaop.OpNeg64: |
| return rewriteValue_OpNeg64(v) |
| case ssaop.OpNeg64F: |
| return rewriteValue_OpNeg64F(v) |
| case ssaop.OpNeg8: |
| return rewriteValue_OpNeg8(v) |
| case ssaop.OpNeq16: |
| return rewriteValue_OpNeq16(v) |
| case ssaop.OpNeq32: |
| return rewriteValue_OpNeq32(v) |
| case ssaop.OpNeq32F: |
| return rewriteValue_OpNeq32F(v) |
| case ssaop.OpNeq64: |
| return rewriteValue_OpNeq64(v) |
| case ssaop.OpNeq64F: |
| return rewriteValue_OpNeq64F(v) |
| case ssaop.OpNeq8: |
| return rewriteValue_OpNeq8(v) |
| case ssaop.OpNeqB: |
| return rewriteValue_OpNeqB(v) |
| case ssaop.OpNeqInter: |
| return rewriteValue_OpNeqInter(v) |
| case ssaop.OpNeqPtr: |
| return rewriteValue_OpNeqPtr(v) |
| case ssaop.OpNeqSlice: |
| return rewriteValue_OpNeqSlice(v) |
| case ssaop.OpNilCheck: |
| return rewriteValue_OpNilCheck(v) |
| case ssaop.OpNot: |
| return rewriteValue_OpNot(v) |
| case ssaop.OpOffPtr: |
| return rewriteValue_OpOffPtr(v) |
| case ssaop.OpOr16: |
| return rewriteValue_OpOr16(v) |
| case ssaop.OpOr32: |
| return rewriteValue_OpOr32(v) |
| case ssaop.OpOr64: |
| return rewriteValue_OpOr64(v) |
| case ssaop.OpOr8: |
| return rewriteValue_OpOr8(v) |
| case ssaop.OpOrB: |
| return rewriteValue_OpOrB(v) |
| case ssaop.OpPhi: |
| return rewriteValue_OpPhi(v) |
| case ssaop.OpPopCount16: |
| return rewriteValue_OpPopCount16(v) |
| case ssaop.OpPopCount32: |
| return rewriteValue_OpPopCount32(v) |
| case ssaop.OpPopCount64: |
| return rewriteValue_OpPopCount64(v) |
| case ssaop.OpPopCount8: |
| return rewriteValue_OpPopCount8(v) |
| case ssaop.OpPtrIndex: |
| return rewriteValue_OpPtrIndex(v) |
| case ssaop.OpRotateLeft16: |
| return rewriteValue_OpRotateLeft16(v) |
| case ssaop.OpRotateLeft32: |
| return rewriteValue_OpRotateLeft32(v) |
| case ssaop.OpRotateLeft64: |
| return rewriteValue_OpRotateLeft64(v) |
| case ssaop.OpRotateLeft8: |
| return rewriteValue_OpRotateLeft8(v) |
| case ssaop.OpRound32F: |
| return rewriteValue_OpRound32F(v) |
| case ssaop.OpRound64F: |
| return rewriteValue_OpRound64F(v) |
| case ssaop.OpRoundToEven: |
| return rewriteValue_OpRoundToEven(v) |
| case ssaop.OpRsh16Ux16: |
| return rewriteValue_OpRsh16Ux16(v) |
| case ssaop.OpRsh16Ux32: |
| return rewriteValue_OpRsh16Ux32(v) |
| case ssaop.OpRsh16Ux64: |
| return rewriteValue_OpRsh16Ux64(v) |
| case ssaop.OpRsh16Ux8: |
| return rewriteValue_OpRsh16Ux8(v) |
| case ssaop.OpRsh16x16: |
| return rewriteValue_OpRsh16x16(v) |
| case ssaop.OpRsh16x32: |
| return rewriteValue_OpRsh16x32(v) |
| case ssaop.OpRsh16x64: |
| return rewriteValue_OpRsh16x64(v) |
| case ssaop.OpRsh16x8: |
| return rewriteValue_OpRsh16x8(v) |
| case ssaop.OpRsh32Ux16: |
| return rewriteValue_OpRsh32Ux16(v) |
| case ssaop.OpRsh32Ux32: |
| return rewriteValue_OpRsh32Ux32(v) |
| case ssaop.OpRsh32Ux64: |
| return rewriteValue_OpRsh32Ux64(v) |
| case ssaop.OpRsh32Ux8: |
| return rewriteValue_OpRsh32Ux8(v) |
| case ssaop.OpRsh32x16: |
| return rewriteValue_OpRsh32x16(v) |
| case ssaop.OpRsh32x32: |
| return rewriteValue_OpRsh32x32(v) |
| case ssaop.OpRsh32x64: |
| return rewriteValue_OpRsh32x64(v) |
| case ssaop.OpRsh32x8: |
| return rewriteValue_OpRsh32x8(v) |
| case ssaop.OpRsh64Ux16: |
| return rewriteValue_OpRsh64Ux16(v) |
| case ssaop.OpRsh64Ux32: |
| return rewriteValue_OpRsh64Ux32(v) |
| case ssaop.OpRsh64Ux64: |
| return rewriteValue_OpRsh64Ux64(v) |
| case ssaop.OpRsh64Ux8: |
| return rewriteValue_OpRsh64Ux8(v) |
| case ssaop.OpRsh64x16: |
| return rewriteValue_OpRsh64x16(v) |
| case ssaop.OpRsh64x32: |
| return rewriteValue_OpRsh64x32(v) |
| case ssaop.OpRsh64x64: |
| return rewriteValue_OpRsh64x64(v) |
| case ssaop.OpRsh64x8: |
| return rewriteValue_OpRsh64x8(v) |
| case ssaop.OpRsh8Ux16: |
| return rewriteValue_OpRsh8Ux16(v) |
| case ssaop.OpRsh8Ux32: |
| return rewriteValue_OpRsh8Ux32(v) |
| case ssaop.OpRsh8Ux64: |
| return rewriteValue_OpRsh8Ux64(v) |
| case ssaop.OpRsh8Ux8: |
| return rewriteValue_OpRsh8Ux8(v) |
| case ssaop.OpRsh8x16: |
| return rewriteValue_OpRsh8x16(v) |
| case ssaop.OpRsh8x32: |
| return rewriteValue_OpRsh8x32(v) |
| case ssaop.OpRsh8x64: |
| return rewriteValue_OpRsh8x64(v) |
| case ssaop.OpRsh8x8: |
| return rewriteValue_OpRsh8x8(v) |
| case ssaop.OpSelect0: |
| return rewriteValue_OpSelect0(v) |
| case ssaop.OpSelect1: |
| return rewriteValue_OpSelect1(v) |
| case ssaop.OpSelectN: |
| return rewriteValue_OpSelectN(v) |
| case ssaop.OpSignExt16to32: |
| return rewriteValue_OpSignExt16to32(v) |
| case ssaop.OpSignExt16to64: |
| return rewriteValue_OpSignExt16to64(v) |
| case ssaop.OpSignExt32to64: |
| return rewriteValue_OpSignExt32to64(v) |
| case ssaop.OpSignExt8to16: |
| return rewriteValue_OpSignExt8to16(v) |
| case ssaop.OpSignExt8to32: |
| return rewriteValue_OpSignExt8to32(v) |
| case ssaop.OpSignExt8to64: |
| return rewriteValue_OpSignExt8to64(v) |
| case ssaop.OpSliceCap: |
| return rewriteValue_OpSliceCap(v) |
| case ssaop.OpSliceLen: |
| return rewriteValue_OpSliceLen(v) |
| case ssaop.OpSliceMake: |
| return rewriteValue_OpSliceMake(v) |
| case ssaop.OpSlicePtr: |
| return rewriteValue_OpSlicePtr(v) |
| case ssaop.OpSlicemask: |
| return rewriteValue_OpSlicemask(v) |
| case ssaop.OpSqrt: |
| return rewriteValue_OpSqrt(v) |
| case ssaop.OpStaticCall: |
| return rewriteValue_OpStaticCall(v) |
| case ssaop.OpStaticLECall: |
| return rewriteValue_OpStaticLECall(v) |
| case ssaop.OpStore: |
| return rewriteValue_OpStore(v) |
| case ssaop.OpStringLen: |
| return rewriteValue_OpStringLen(v) |
| case ssaop.OpStringPtr: |
| return rewriteValue_OpStringPtr(v) |
| case ssaop.OpStructSelect: |
| return rewriteValue_OpStructSelect(v) |
| case ssaop.OpSub16: |
| return rewriteValue_OpSub16(v) |
| case ssaop.OpSub32: |
| return rewriteValue_OpSub32(v) |
| case ssaop.OpSub32F: |
| return rewriteValue_OpSub32F(v) |
| case ssaop.OpSub64: |
| return rewriteValue_OpSub64(v) |
| case ssaop.OpSub64F: |
| return rewriteValue_OpSub64F(v) |
| case ssaop.OpSub64borrow: |
| return rewriteValue_OpSub64borrow(v) |
| case ssaop.OpSub8: |
| return rewriteValue_OpSub8(v) |
| case ssaop.OpTrunc: |
| return rewriteValue_OpTrunc(v) |
| case ssaop.OpTrunc16to8: |
| return rewriteValue_OpTrunc16to8(v) |
| case ssaop.OpTrunc32to16: |
| return rewriteValue_OpTrunc32to16(v) |
| case ssaop.OpTrunc32to8: |
| return rewriteValue_OpTrunc32to8(v) |
| case ssaop.OpTrunc64to16: |
| return rewriteValue_OpTrunc64to16(v) |
| case ssaop.OpTrunc64to32: |
| return rewriteValue_OpTrunc64to32(v) |
| case ssaop.OpTrunc64to8: |
| return rewriteValue_OpTrunc64to8(v) |
| case ssaop.OpXor16: |
| return rewriteValue_OpXor16(v) |
| case ssaop.OpXor32: |
| return rewriteValue_OpXor32(v) |
| case ssaop.OpXor64: |
| return rewriteValue_OpXor64(v) |
| case ssaop.OpXor8: |
| return rewriteValue_OpXor8(v) |
| case ssaop.OpZero: |
| return rewriteValue_OpZero(v) |
| case ssaop.OpZeroExt16to32: |
| return rewriteValue_OpZeroExt16to32(v) |
| case ssaop.OpZeroExt16to64: |
| return rewriteValue_OpZeroExt16to64(v) |
| case ssaop.OpZeroExt32to64: |
| return rewriteValue_OpZeroExt32to64(v) |
| case ssaop.OpZeroExt8to16: |
| return rewriteValue_OpZeroExt8to16(v) |
| case ssaop.OpZeroExt8to32: |
| return rewriteValue_OpZeroExt8to32(v) |
| case ssaop.OpZeroExt8to64: |
| return rewriteValue_OpZeroExt8to64(v) |
| } |
| return false |
| } |
| func rewriteValue_OpAdd16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Add16 (Const16 [c]) (Const16 [d])) |
| // result: (Const16 [c+d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(c + d) |
| return true |
| } |
| break |
| } |
| // match: (Add16 <t> (Mul16 x y) (Mul16 x z)) |
| // result: (Mul16 x (Add16 <t> y z)) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpMul16 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if v_1.Op != ssaop.OpMul16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| z := v_1_1 |
| v.Reset(ssaop.OpMul16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd16, t) |
| v0.AddArg2(y, z) |
| v.AddArg2(x, v0) |
| return true |
| } |
| } |
| } |
| break |
| } |
| // match: (Add16 x x) |
| // result: (Lsh16x64 x (Const64 <types.Types[types.TUINT64]> [1])) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpLsh16x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Add16 (Const16 [0]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Add16 x (Neg16 y)) |
| // result: (Sub16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg16 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpSub16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add16 (Com16 x) x) |
| // result: (Const16 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom16 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Add16 (Sub16 x t) (Add16 t y)) |
| // result: (Add16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpSub16 { |
| continue |
| } |
| t := v_0.Args[1] |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpAdd16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if t != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpAdd16) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add16 (Const16 [1]) (Com16 x)) |
| // result: (Neg16 x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 1 || v_1.Op != ssaop.OpCom16 { |
| continue |
| } |
| x := v_1.Args[0] |
| v.Reset(ssaop.OpNeg16) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Add16 x (Sub16 y x)) |
| // result: y |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if x != v_1.Args[1] { |
| continue |
| } |
| v.CopyOf(y) |
| return true |
| } |
| break |
| } |
| // match: (Add16 x (Add16 y (Sub16 z x))) |
| // result: (Add16 y z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = v_1_1.Args[1] |
| z := v_1_1.Args[0] |
| if x != v_1_1.Args[1] { |
| continue |
| } |
| v.Reset(ssaop.OpAdd16) |
| v.AddArg2(y, z) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add16 x (Sub16 y (Sub16 x z))) |
| // result: (Add16 y z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| z := v_1_1.Args[1] |
| if x != v_1_1.Args[0] { |
| continue |
| } |
| v.Reset(ssaop.OpAdd16) |
| v.AddArg2(y, z) |
| return true |
| } |
| break |
| } |
| // match: (Add16 (Add16 i:(Const16 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) |
| // result: (Add16 i (Add16 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAdd16 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd16, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add16 (Sub16 i:(Const16 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) |
| // result: (Add16 i (Sub16 <t> x z)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpSub16 { |
| continue |
| } |
| z := v_0.Args[1] |
| i := v_0.Args[0] |
| if i.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := i.Type |
| x := v_1 |
| if !(z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(i, v0) |
| return true |
| } |
| break |
| } |
| // match: (Add16 (Const16 <t> [c]) (Add16 (Const16 <t> [d]) x)) |
| // result: (Add16 (Const16 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAdd16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst16 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpAdd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add16 (Const16 <t> [c]) (Sub16 (Const16 <t> [d]) x)) |
| // result: (Sub16 (Const16 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| x := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst16 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_0.AuxInt) |
| v.Reset(ssaop.OpSub16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Add16 (Lsh16x64 x z:(Const64 <t> [c])) (Rsh16Ux64 x (Const64 [d]))) |
| // cond: c < 16 && d == 16-c && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLsh16x64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| z := v_0.Args[1] |
| if z.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(z.AuxInt) |
| if v_1.Op != ssaop.OpRsh16Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c < 16 && d == 16-c && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add16 left:(Lsh16x64 x y) right:(Rsh16Ux64 x (Sub64 (Const64 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh16x64 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh16Ux64 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add16 left:(Lsh16x32 x y) right:(Rsh16Ux32 x (Sub32 (Const32 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh16x32 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh16Ux32 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add16 left:(Lsh16x16 x y) right:(Rsh16Ux16 x (Sub16 (Const16 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh16x16 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh16Ux16 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add16 left:(Lsh16x8 x y) right:(Rsh16Ux8 x (Sub8 (Const8 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh16x8 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh16Ux8 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add16 right:(Rsh16Ux64 x y) left:(Lsh16x64 x z:(Sub64 (Const64 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh16Ux64 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh16x64 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(z_0.AuxInt) != 16 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add16 right:(Rsh16Ux32 x y) left:(Lsh16x32 x z:(Sub32 (Const32 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh16Ux32 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh16x32 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(z_0.AuxInt) != 16 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add16 right:(Rsh16Ux16 x y) left:(Lsh16x16 x z:(Sub16 (Const16 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh16Ux16 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh16x16 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(z_0.AuxInt) != 16 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add16 right:(Rsh16Ux8 x y) left:(Lsh16x8 x z:(Sub8 (Const8 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh16Ux8 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh16x8 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(z_0.AuxInt) != 16 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpAdd32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Add32 (Const32 [c]) (Const32 [d])) |
| // result: (Const32 [c+d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(c + d) |
| return true |
| } |
| break |
| } |
| // match: (Add32 <t> (Mul32 x y) (Mul32 x z)) |
| // result: (Mul32 x (Add32 <t> y z)) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpMul32 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if v_1.Op != ssaop.OpMul32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| z := v_1_1 |
| v.Reset(ssaop.OpMul32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd32, t) |
| v0.AddArg2(y, z) |
| v.AddArg2(x, v0) |
| return true |
| } |
| } |
| } |
| break |
| } |
| // match: (Add32 x x) |
| // result: (Lsh32x64 x (Const64 <types.Types[types.TUINT64]> [1])) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpLsh32x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Add32 (Const32 [0]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Add32 x (Neg32 y)) |
| // result: (Sub32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg32 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpSub32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add32 (Com32 x) x) |
| // result: (Const32 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom32 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Add32 (Sub32 x t) (Add32 t y)) |
| // result: (Add32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpSub32 { |
| continue |
| } |
| t := v_0.Args[1] |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpAdd32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if t != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpAdd32) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add32 (Const32 [1]) (Com32 x)) |
| // result: (Neg32 x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 1 || v_1.Op != ssaop.OpCom32 { |
| continue |
| } |
| x := v_1.Args[0] |
| v.Reset(ssaop.OpNeg32) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Add32 x (Sub32 y x)) |
| // result: y |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if x != v_1.Args[1] { |
| continue |
| } |
| v.CopyOf(y) |
| return true |
| } |
| break |
| } |
| // match: (Add32 x (Add32 y (Sub32 z x))) |
| // result: (Add32 y z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = v_1_1.Args[1] |
| z := v_1_1.Args[0] |
| if x != v_1_1.Args[1] { |
| continue |
| } |
| v.Reset(ssaop.OpAdd32) |
| v.AddArg2(y, z) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add32 x (Sub32 y (Sub32 x z))) |
| // result: (Add32 y z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| z := v_1_1.Args[1] |
| if x != v_1_1.Args[0] { |
| continue |
| } |
| v.Reset(ssaop.OpAdd32) |
| v.AddArg2(y, z) |
| return true |
| } |
| break |
| } |
| // match: (Add32 (Add32 i:(Const32 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) |
| // result: (Add32 i (Add32 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAdd32 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd32, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add32 (Sub32 i:(Const32 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) |
| // result: (Add32 i (Sub32 <t> x z)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpSub32 { |
| continue |
| } |
| z := v_0.Args[1] |
| i := v_0.Args[0] |
| if i.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := i.Type |
| x := v_1 |
| if !(z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(i, v0) |
| return true |
| } |
| break |
| } |
| // match: (Add32 (Const32 <t> [c]) (Add32 (Const32 <t> [d]) x)) |
| // result: (Add32 (Const32 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAdd32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst32 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpAdd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add32 (Const32 <t> [c]) (Sub32 (Const32 <t> [d]) x)) |
| // result: (Sub32 (Const32 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| x := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst32 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_0.AuxInt) |
| v.Reset(ssaop.OpSub32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Add32 (Lsh32x64 x z:(Const64 <t> [c])) (Rsh32Ux64 x (Const64 [d]))) |
| // cond: c < 32 && d == 32-c && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLsh32x64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| z := v_0.Args[1] |
| if z.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(z.AuxInt) |
| if v_1.Op != ssaop.OpRsh32Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c < 32 && d == 32-c && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add32 left:(Lsh32x64 x y) right:(Rsh32Ux64 x (Sub64 (Const64 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh32x64 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh32Ux64 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add32 left:(Lsh32x32 x y) right:(Rsh32Ux32 x (Sub32 (Const32 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh32x32 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh32Ux32 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add32 left:(Lsh32x16 x y) right:(Rsh32Ux16 x (Sub16 (Const16 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh32x16 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh32Ux16 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add32 left:(Lsh32x8 x y) right:(Rsh32Ux8 x (Sub8 (Const8 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh32x8 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh32Ux8 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add32 right:(Rsh32Ux64 x y) left:(Lsh32x64 x z:(Sub64 (Const64 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh32Ux64 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh32x64 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(z_0.AuxInt) != 32 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add32 right:(Rsh32Ux32 x y) left:(Lsh32x32 x z:(Sub32 (Const32 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh32Ux32 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh32x32 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(z_0.AuxInt) != 32 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add32 right:(Rsh32Ux16 x y) left:(Lsh32x16 x z:(Sub16 (Const16 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh32Ux16 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh32x16 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(z_0.AuxInt) != 32 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add32 right:(Rsh32Ux8 x y) left:(Lsh32x8 x z:(Sub8 (Const8 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh32Ux8 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh32x8 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(z_0.AuxInt) != 32 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpAdd32F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Add32F (Const32F [c]) (Const32F [d])) |
| // cond: c+d == c+d |
| // result: (Const32F [c+d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32F { |
| continue |
| } |
| c := ssa.AuxIntToFloat32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32F { |
| continue |
| } |
| d := ssa.AuxIntToFloat32(v_1.AuxInt) |
| if !(c+d == c+d) { |
| continue |
| } |
| v.Reset(ssaop.OpConst32F) |
| v.AuxInt = ssa.Float32ToAuxInt(c + d) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpAdd64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Add64 (Const64 [c]) (Const64 [d])) |
| // result: (Const64 [c+d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(c + d) |
| return true |
| } |
| break |
| } |
| // match: (Add64 <t> (Mul64 x y) (Mul64 x z)) |
| // result: (Mul64 x (Add64 <t> y z)) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpMul64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if v_1.Op != ssaop.OpMul64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| z := v_1_1 |
| v.Reset(ssaop.OpMul64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd64, t) |
| v0.AddArg2(y, z) |
| v.AddArg2(x, v0) |
| return true |
| } |
| } |
| } |
| break |
| } |
| // match: (Add64 x x) |
| // result: (Lsh64x64 x (Const64 <types.Types[types.TUINT64]> [1])) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpLsh64x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Add64 (Const64 [0]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Add64 x (Neg64 y)) |
| // result: (Sub64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg64 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpSub64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add64 (Com64 x) x) |
| // result: (Const64 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom64 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Add64 (Sub64 x t) (Add64 t y)) |
| // result: (Add64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpSub64 { |
| continue |
| } |
| t := v_0.Args[1] |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpAdd64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if t != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpAdd64) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add64 (Const64 [1]) (Com64 x)) |
| // result: (Neg64 x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 1 || v_1.Op != ssaop.OpCom64 { |
| continue |
| } |
| x := v_1.Args[0] |
| v.Reset(ssaop.OpNeg64) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Add64 x (Sub64 y x)) |
| // result: y |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if x != v_1.Args[1] { |
| continue |
| } |
| v.CopyOf(y) |
| return true |
| } |
| break |
| } |
| // match: (Add64 x (Add64 y (Sub64 z x))) |
| // result: (Add64 y z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = v_1_1.Args[1] |
| z := v_1_1.Args[0] |
| if x != v_1_1.Args[1] { |
| continue |
| } |
| v.Reset(ssaop.OpAdd64) |
| v.AddArg2(y, z) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add64 x (Sub64 y (Sub64 x z))) |
| // result: (Add64 y z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| z := v_1_1.Args[1] |
| if x != v_1_1.Args[0] { |
| continue |
| } |
| v.Reset(ssaop.OpAdd64) |
| v.AddArg2(y, z) |
| return true |
| } |
| break |
| } |
| // match: (Add64 (Add64 i:(Const64 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) |
| // result: (Add64 i (Add64 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAdd64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd64, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add64 (Sub64 i:(Const64 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) |
| // result: (Add64 i (Sub64 <t> x z)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpSub64 { |
| continue |
| } |
| z := v_0.Args[1] |
| i := v_0.Args[0] |
| if i.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := i.Type |
| x := v_1 |
| if !(z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(i, v0) |
| return true |
| } |
| break |
| } |
| // match: (Add64 (Const64 <t> [c]) (Add64 (Const64 <t> [d]) x)) |
| // result: (Add64 (Const64 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAdd64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst64 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpAdd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add64 (Const64 <t> [c]) (Sub64 (Const64 <t> [d]) x)) |
| // result: (Sub64 (Const64 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| x := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst64 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_0.AuxInt) |
| v.Reset(ssaop.OpSub64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Add64 (Lsh64x64 x z:(Const64 <t> [c])) (Rsh64Ux64 x (Const64 [d]))) |
| // cond: c < 64 && d == 64-c && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLsh64x64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| z := v_0.Args[1] |
| if z.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(z.AuxInt) |
| if v_1.Op != ssaop.OpRsh64Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c < 64 && d == 64-c && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add64 left:(Lsh64x64 x y) right:(Rsh64Ux64 x (Sub64 (Const64 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh64x64 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh64Ux64 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(right_1_0.AuxInt) != 64 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add64 left:(Lsh64x32 x y) right:(Rsh64Ux32 x (Sub32 (Const32 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh64x32 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh64Ux32 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(right_1_0.AuxInt) != 64 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add64 left:(Lsh64x16 x y) right:(Rsh64Ux16 x (Sub16 (Const16 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh64x16 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh64Ux16 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(right_1_0.AuxInt) != 64 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add64 left:(Lsh64x8 x y) right:(Rsh64Ux8 x (Sub8 (Const8 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh64x8 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh64Ux8 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(right_1_0.AuxInt) != 64 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add64 right:(Rsh64Ux64 x y) left:(Lsh64x64 x z:(Sub64 (Const64 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh64Ux64 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh64x64 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(z_0.AuxInt) != 64 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add64 right:(Rsh64Ux32 x y) left:(Lsh64x32 x z:(Sub32 (Const32 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh64Ux32 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh64x32 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(z_0.AuxInt) != 64 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add64 right:(Rsh64Ux16 x y) left:(Lsh64x16 x z:(Sub16 (Const16 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh64Ux16 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh64x16 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(z_0.AuxInt) != 64 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add64 right:(Rsh64Ux8 x y) left:(Lsh64x8 x z:(Sub8 (Const8 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh64Ux8 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh64x8 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(z_0.AuxInt) != 64 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpAdd64F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Add64F (Const64F [c]) (Const64F [d])) |
| // cond: c+d == c+d |
| // result: (Const64F [c+d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64F { |
| continue |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64F { |
| continue |
| } |
| d := ssa.AuxIntToFloat64(v_1.AuxInt) |
| if !(c+d == c+d) { |
| continue |
| } |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(c + d) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpAdd64carry(v *ssa.Value) bool { |
| v_2 := v.Args[2] |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Add64carry (Const64 <t> [x]) (Const64 [y]) (Const64 [c])) |
| // cond: c >= 0 && c <= 1 |
| // result: (MakeTuple (Const64 <t> [bitsAdd64(x, y, c).sum]) (Const64 <t> [bitsAdd64(x, y, c).carry])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| x := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| y := ssa.AuxIntToInt64(v_1.AuxInt) |
| if v_2.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_2.AuxInt) |
| if !(c >= 0 && c <= 1) { |
| continue |
| } |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(bitsAdd64(x, y, c).sum) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v1.AuxInt = ssa.Int64ToAuxInt(bitsAdd64(x, y, c).carry) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpAdd8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Add8 (Const8 [c]) (Const8 [d])) |
| // result: (Const8 [c+d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(c + d) |
| return true |
| } |
| break |
| } |
| // match: (Add8 <t> (Mul8 x y) (Mul8 x z)) |
| // result: (Mul8 x (Add8 <t> y z)) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpMul8 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if v_1.Op != ssaop.OpMul8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| z := v_1_1 |
| v.Reset(ssaop.OpMul8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd8, t) |
| v0.AddArg2(y, z) |
| v.AddArg2(x, v0) |
| return true |
| } |
| } |
| } |
| break |
| } |
| // match: (Add8 x x) |
| // result: (Lsh8x64 x (Const64 <types.Types[types.TUINT64]> [1])) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpLsh8x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Add8 (Const8 [0]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Add8 x (Neg8 y)) |
| // result: (Sub8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg8 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpSub8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add8 (Com8 x) x) |
| // result: (Const8 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom8 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Add8 (Sub8 x t) (Add8 t y)) |
| // result: (Add8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpSub8 { |
| continue |
| } |
| t := v_0.Args[1] |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpAdd8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if t != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpAdd8) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add8 (Const8 [1]) (Com8 x)) |
| // result: (Neg8 x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 1 || v_1.Op != ssaop.OpCom8 { |
| continue |
| } |
| x := v_1.Args[0] |
| v.Reset(ssaop.OpNeg8) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Add8 x (Sub8 y x)) |
| // result: y |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if x != v_1.Args[1] { |
| continue |
| } |
| v.CopyOf(y) |
| return true |
| } |
| break |
| } |
| // match: (Add8 x (Add8 y (Sub8 z x))) |
| // result: (Add8 y z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = v_1_1.Args[1] |
| z := v_1_1.Args[0] |
| if x != v_1_1.Args[1] { |
| continue |
| } |
| v.Reset(ssaop.OpAdd8) |
| v.AddArg2(y, z) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add8 x (Sub8 y (Sub8 x z))) |
| // result: (Add8 y z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| z := v_1_1.Args[1] |
| if x != v_1_1.Args[0] { |
| continue |
| } |
| v.Reset(ssaop.OpAdd8) |
| v.AddArg2(y, z) |
| return true |
| } |
| break |
| } |
| // match: (Add8 (Add8 i:(Const8 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) |
| // result: (Add8 i (Add8 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAdd8 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd8, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add8 (Sub8 i:(Const8 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) |
| // result: (Add8 i (Sub8 <t> x z)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpSub8 { |
| continue |
| } |
| z := v_0.Args[1] |
| i := v_0.Args[0] |
| if i.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := i.Type |
| x := v_1 |
| if !(z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(i, v0) |
| return true |
| } |
| break |
| } |
| // match: (Add8 (Const8 <t> [c]) (Add8 (Const8 <t> [d]) x)) |
| // result: (Add8 (Const8 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAdd8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst8 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpAdd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Add8 (Const8 <t> [c]) (Sub8 (Const8 <t> [d]) x)) |
| // result: (Sub8 (Const8 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| x := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst8 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_0.AuxInt) |
| v.Reset(ssaop.OpSub8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Add8 (Lsh8x64 x z:(Const64 <t> [c])) (Rsh8Ux64 x (Const64 [d]))) |
| // cond: c < 8 && d == 8-c && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLsh8x64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| z := v_0.Args[1] |
| if z.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(z.AuxInt) |
| if v_1.Op != ssaop.OpRsh8Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c < 8 && d == 8-c && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add8 left:(Lsh8x64 x y) right:(Rsh8Ux64 x (Sub64 (Const64 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh8x64 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh8Ux64 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(right_1_0.AuxInt) != 8 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add8 left:(Lsh8x32 x y) right:(Rsh8Ux32 x (Sub32 (Const32 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh8x32 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh8Ux32 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(right_1_0.AuxInt) != 8 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add8 left:(Lsh8x16 x y) right:(Rsh8Ux16 x (Sub16 (Const16 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh8x16 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh8Ux16 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(right_1_0.AuxInt) != 8 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add8 left:(Lsh8x8 x y) right:(Rsh8Ux8 x (Sub8 (Const8 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh8x8 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh8Ux8 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(right_1_0.AuxInt) != 8 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Add8 right:(Rsh8Ux64 x y) left:(Lsh8x64 x z:(Sub64 (Const64 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh8Ux64 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh8x64 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(z_0.AuxInt) != 8 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add8 right:(Rsh8Ux32 x y) left:(Lsh8x32 x z:(Sub32 (Const32 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh8Ux32 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh8x32 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(z_0.AuxInt) != 8 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add8 right:(Rsh8Ux16 x y) left:(Lsh8x16 x z:(Sub16 (Const16 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh8Ux16 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh8x16 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(z_0.AuxInt) != 8 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Add8 right:(Rsh8Ux8 x y) left:(Lsh8x8 x z:(Sub8 (Const8 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh8Ux8 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh8x8 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(z_0.AuxInt) != 8 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpAddPtr(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (AddPtr <t> x (Const64 [c])) |
| // result: (OffPtr <t> x [c]) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpOffPtr) |
| v.Type = t |
| v.AuxInt = ssa.Int64ToAuxInt(c) |
| v.AddArg(x) |
| return true |
| } |
| // match: (AddPtr <t> x (Const32 [c])) |
| // result: (OffPtr <t> x [int64(c)]) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpOffPtr) |
| v.Type = t |
| v.AuxInt = ssa.Int64ToAuxInt(int64(c)) |
| v.AddArg(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpAnd16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (And16 (Const16 [c]) (Const16 [d])) |
| // result: (Const16 [c&d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(c & d) |
| return true |
| } |
| break |
| } |
| // match: (And16 <t> (Com16 x) (Com16 y)) |
| // result: (Com16 (Or16 <t> x y)) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom16 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpCom16 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpCom16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr16, t) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (And16 x (Or16 x y)) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpOr16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (And16 (Const16 [m]) (Rsh16Ux64 _ (Const64 [c]))) |
| // cond: c >= int64(16-ntz16(m)) |
| // result: (Const16 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| m := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpRsh16Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= int64(16-ntz16(m))) { |
| continue |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And16 (Const16 [m]) (Lsh16x64 _ (Const64 [c]))) |
| // cond: c >= int64(16-nlz16(m)) |
| // result: (Const16 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| m := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpLsh16x64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= int64(16-nlz16(m))) { |
| continue |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And16 x x) |
| // result: x |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (And16 (Const16 [-1]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (And16 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And16 (Com16 x) x) |
| // result: (Const16 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom16 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And16 x (And16 x y)) |
| // result: (And16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpAnd16) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (And16 (And16 i:(Const16 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) |
| // result: (And16 i (And16 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd16 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd16, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (And16 (Const16 <t> [c]) (And16 (Const16 <t> [d]) x)) |
| // result: (And16 (Const16 <t> [c&d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAnd16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst16 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpAnd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c & d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpAnd32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (And32 (Const32 [c]) (Const32 [d])) |
| // result: (Const32 [c&d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(c & d) |
| return true |
| } |
| break |
| } |
| // match: (And32 <t> (Com32 x) (Com32 y)) |
| // result: (Com32 (Or32 <t> x y)) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom32 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpCom32 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpCom32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr32, t) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (And32 x (Or32 x y)) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpOr32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (And32 (Const32 [m]) (Rsh32Ux64 _ (Const64 [c]))) |
| // cond: c >= int64(32-ntz32(m)) |
| // result: (Const32 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| m := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpRsh32Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= int64(32-ntz32(m))) { |
| continue |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And32 (Const32 [m]) (Lsh32x64 _ (Const64 [c]))) |
| // cond: c >= int64(32-nlz32(m)) |
| // result: (Const32 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| m := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpLsh32x64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= int64(32-nlz32(m))) { |
| continue |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And32 x x) |
| // result: x |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (And32 (Const32 [-1]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (And32 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And32 (Com32 x) x) |
| // result: (Const32 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom32 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And32 x (And32 x y)) |
| // result: (And32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpAnd32) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (And32 (And32 i:(Const32 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) |
| // result: (And32 i (And32 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd32 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd32, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (And32 (Const32 <t> [c]) (And32 (Const32 <t> [d]) x)) |
| // result: (And32 (Const32 <t> [c&d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAnd32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst32 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpAnd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c & d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpAnd64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (And64 (Const64 [c]) (Const64 [d])) |
| // result: (Const64 [c&d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(c & d) |
| return true |
| } |
| break |
| } |
| // match: (And64 <t> (Com64 x) (Com64 y)) |
| // result: (Com64 (Or64 <t> x y)) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom64 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpCom64 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpCom64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr64, t) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (And64 x (Or64 x y)) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpOr64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (And64 (Const64 [m]) (Rsh64Ux64 _ (Const64 [c]))) |
| // cond: c >= int64(64-ssa.Ntz64(m)) |
| // result: (Const64 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| m := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpRsh64Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= int64(64-ssa.Ntz64(m))) { |
| continue |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And64 (Const64 [m]) (Lsh64x64 _ (Const64 [c]))) |
| // cond: c >= int64(64-nlz64(m)) |
| // result: (Const64 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| m := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpLsh64x64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= int64(64-nlz64(m))) { |
| continue |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And64 x x) |
| // result: x |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (And64 (Const64 [-1]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (And64 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And64 (Com64 x) x) |
| // result: (Const64 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom64 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And64 x (And64 x y)) |
| // result: (And64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpAnd64) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (And64 (And64 i:(Const64 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) |
| // result: (And64 i (And64 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd64, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (And64 (Const64 <t> [c]) (And64 (Const64 <t> [d]) x)) |
| // result: (And64 (Const64 <t> [c&d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAnd64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst64 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpAnd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c & d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpAnd8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (And8 (Const8 [c]) (Const8 [d])) |
| // result: (Const8 [c&d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(c & d) |
| return true |
| } |
| break |
| } |
| // match: (And8 <t> (Com8 x) (Com8 y)) |
| // result: (Com8 (Or8 <t> x y)) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom8 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpCom8 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpCom8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr8, t) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (And8 x (Or8 x y)) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpOr8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (And8 (Const8 [m]) (Rsh8Ux64 _ (Const64 [c]))) |
| // cond: c >= int64(8-ntz8(m)) |
| // result: (Const8 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| m := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpRsh8Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= int64(8-ntz8(m))) { |
| continue |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And8 (Const8 [m]) (Lsh8x64 _ (Const64 [c]))) |
| // cond: c >= int64(8-nlz8(m)) |
| // result: (Const8 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| m := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpLsh8x64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= int64(8-nlz8(m))) { |
| continue |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And8 x x) |
| // result: x |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (And8 (Const8 [-1]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (And8 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And8 (Com8 x) x) |
| // result: (Const8 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom8 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (And8 x (And8 x y)) |
| // result: (And8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpAnd8) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (And8 (And8 i:(Const8 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) |
| // result: (And8 i (And8 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd8 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd8, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (And8 (Const8 <t> [c]) (And8 (Const8 <t> [d]) x)) |
| // result: (And8 (Const8 <t> [c&d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAnd8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst8 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpAnd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c & d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpAndB(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (AndB (ConstBool [c]) (ConstBool [d])) |
| // result: (ConstBool [c&&d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstBool { |
| continue |
| } |
| c := ssa.AuxIntToBool(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConstBool { |
| continue |
| } |
| d := ssa.AuxIntToBool(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c && d) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq64 (Const64 [c]) x) (Less64 x (Const64 [d]))) |
| // cond: d >= c |
| // result: (Less64U (Sub64 <x.Type> x (Const64 <x.Type> [c])) (Const64 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq64 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(d >= c) { |
| continue |
| } |
| v.Reset(ssaop.OpLess64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq64 (Const64 [c]) x) (Leq64 x (Const64 [d]))) |
| // cond: d >= c |
| // result: (Leq64U (Sub64 <x.Type> x (Const64 <x.Type> [c])) (Const64 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq64 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(d >= c) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq32 (Const32 [c]) x) (Less32 x (Const32 [d]))) |
| // cond: d >= c |
| // result: (Less32U (Sub32 <x.Type> x (Const32 <x.Type> [c])) (Const32 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq32 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(d >= c) { |
| continue |
| } |
| v.Reset(ssaop.OpLess32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v1.AuxInt = ssa.Int32ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq32 (Const32 [c]) x) (Leq32 x (Const32 [d]))) |
| // cond: d >= c |
| // result: (Leq32U (Sub32 <x.Type> x (Const32 <x.Type> [c])) (Const32 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq32 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(d >= c) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v1.AuxInt = ssa.Int32ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq16 (Const16 [c]) x) (Less16 x (Const16 [d]))) |
| // cond: d >= c |
| // result: (Less16U (Sub16 <x.Type> x (Const16 <x.Type> [c])) (Const16 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq16 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(d >= c) { |
| continue |
| } |
| v.Reset(ssaop.OpLess16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v1.AuxInt = ssa.Int16ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq16 (Const16 [c]) x) (Leq16 x (Const16 [d]))) |
| // cond: d >= c |
| // result: (Leq16U (Sub16 <x.Type> x (Const16 <x.Type> [c])) (Const16 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq16 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(d >= c) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v1.AuxInt = ssa.Int16ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq8 (Const8 [c]) x) (Less8 x (Const8 [d]))) |
| // cond: d >= c |
| // result: (Less8U (Sub8 <x.Type> x (Const8 <x.Type> [c])) (Const8 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq8 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(d >= c) { |
| continue |
| } |
| v.Reset(ssaop.OpLess8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v1.AuxInt = ssa.Int8ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq8 (Const8 [c]) x) (Leq8 x (Const8 [d]))) |
| // cond: d >= c |
| // result: (Leq8U (Sub8 <x.Type> x (Const8 <x.Type> [c])) (Const8 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq8 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(d >= c) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v1.AuxInt = ssa.Int8ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Less64 (Const64 [c]) x) (Less64 x (Const64 [d]))) |
| // cond: d >= c+1 && c+1 > c |
| // result: (Less64U (Sub64 <x.Type> x (Const64 <x.Type> [c+1])) (Const64 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess64 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(d >= c+1 && c+1 > c) { |
| continue |
| } |
| v.Reset(ssaop.OpLess64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.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 && c+1 > c |
| // result: (Leq64U (Sub64 <x.Type> x (Const64 <x.Type> [c+1])) (Const64 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess64 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(d >= c+1 && c+1 > c) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.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 && c+1 > c |
| // result: (Less32U (Sub32 <x.Type> x (Const32 <x.Type> [c+1])) (Const32 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess32 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(d >= c+1 && c+1 > c) { |
| continue |
| } |
| v.Reset(ssaop.OpLess32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v1.AuxInt = ssa.Int32ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.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 && c+1 > c |
| // result: (Leq32U (Sub32 <x.Type> x (Const32 <x.Type> [c+1])) (Const32 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess32 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(d >= c+1 && c+1 > c) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v1.AuxInt = ssa.Int32ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.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 && c+1 > c |
| // result: (Less16U (Sub16 <x.Type> x (Const16 <x.Type> [c+1])) (Const16 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess16 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(d >= c+1 && c+1 > c) { |
| continue |
| } |
| v.Reset(ssaop.OpLess16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v1.AuxInt = ssa.Int16ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.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 && c+1 > c |
| // result: (Leq16U (Sub16 <x.Type> x (Const16 <x.Type> [c+1])) (Const16 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess16 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(d >= c+1 && c+1 > c) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v1.AuxInt = ssa.Int16ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.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 && c+1 > c |
| // result: (Less8U (Sub8 <x.Type> x (Const8 <x.Type> [c+1])) (Const8 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess8 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(d >= c+1 && c+1 > c) { |
| continue |
| } |
| v.Reset(ssaop.OpLess8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v1.AuxInt = ssa.Int8ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.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 && c+1 > c |
| // result: (Leq8U (Sub8 <x.Type> x (Const8 <x.Type> [c+1])) (Const8 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess8 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(d >= c+1 && c+1 > c) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v1.AuxInt = ssa.Int8ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d - c - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq64U (Const64 [c]) x) (Less64U x (Const64 [d]))) |
| // cond: uint64(d) >= uint64(c) |
| // result: (Less64U (Sub64 <x.Type> x (Const64 <x.Type> [c])) (Const64 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq64U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess64U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(uint64(d) >= uint64(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq64U (Const64 [c]) x) (Leq64U x (Const64 [d]))) |
| // cond: uint64(d) >= uint64(c) |
| // result: (Leq64U (Sub64 <x.Type> x (Const64 <x.Type> [c])) (Const64 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq64U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq64U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(uint64(d) >= uint64(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq32U (Const32 [c]) x) (Less32U x (Const32 [d]))) |
| // cond: uint32(d) >= uint32(c) |
| // result: (Less32U (Sub32 <x.Type> x (Const32 <x.Type> [c])) (Const32 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq32U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess32U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(uint32(d) >= uint32(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v1.AuxInt = ssa.Int32ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq32U (Const32 [c]) x) (Leq32U x (Const32 [d]))) |
| // cond: uint32(d) >= uint32(c) |
| // result: (Leq32U (Sub32 <x.Type> x (Const32 <x.Type> [c])) (Const32 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq32U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq32U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(uint32(d) >= uint32(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v1.AuxInt = ssa.Int32ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq16U (Const16 [c]) x) (Less16U x (Const16 [d]))) |
| // cond: uint16(d) >= uint16(c) |
| // result: (Less16U (Sub16 <x.Type> x (Const16 <x.Type> [c])) (Const16 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq16U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess16U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(uint16(d) >= uint16(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v1.AuxInt = ssa.Int16ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq16U (Const16 [c]) x) (Leq16U x (Const16 [d]))) |
| // cond: uint16(d) >= uint16(c) |
| // result: (Leq16U (Sub16 <x.Type> x (Const16 <x.Type> [c])) (Const16 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq16U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq16U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(uint16(d) >= uint16(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v1.AuxInt = ssa.Int16ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq8U (Const8 [c]) x) (Less8U x (Const8 [d]))) |
| // cond: uint8(d) >= uint8(c) |
| // result: (Less8U (Sub8 <x.Type> x (Const8 <x.Type> [c])) (Const8 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq8U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess8U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(uint8(d) >= uint8(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v1.AuxInt = ssa.Int8ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Leq8U (Const8 [c]) x) (Leq8U x (Const8 [d]))) |
| // cond: uint8(d) >= uint8(c) |
| // result: (Leq8U (Sub8 <x.Type> x (Const8 <x.Type> [c])) (Const8 <x.Type> [d-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq8U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq8U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(uint8(d) >= uint8(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v1.AuxInt = ssa.Int8ToAuxInt(c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d - c) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Less64U (Const64 [c]) x) (Less64U x (Const64 [d]))) |
| // cond: uint64(d) >= uint64(c+1) && uint64(c+1) > uint64(c) |
| // result: (Less64U (Sub64 <x.Type> x (Const64 <x.Type> [c+1])) (Const64 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess64U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess64U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(uint64(d) >= uint64(c+1) && uint64(c+1) > uint64(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d - c - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Less64U (Const64 [c]) x) (Leq64U x (Const64 [d]))) |
| // cond: uint64(d) >= uint64(c+1) && uint64(c+1) > uint64(c) |
| // result: (Leq64U (Sub64 <x.Type> x (Const64 <x.Type> [c+1])) (Const64 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess64U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq64U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(uint64(d) >= uint64(c+1) && uint64(c+1) > uint64(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d - c - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // 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.Type> x (Const32 <x.Type> [c+1])) (Const32 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess32U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess32U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(uint32(d) >= uint32(c+1) && uint32(c+1) > uint32(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v1.AuxInt = ssa.Int32ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d - c - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // 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.Type> x (Const32 <x.Type> [c+1])) (Const32 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess32U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq32U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(uint32(d) >= uint32(c+1) && uint32(c+1) > uint32(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v1.AuxInt = ssa.Int32ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d - c - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // 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.Type> x (Const16 <x.Type> [c+1])) (Const16 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess16U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess16U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(uint16(d) >= uint16(c+1) && uint16(c+1) > uint16(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v1.AuxInt = ssa.Int16ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d - c - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // 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.Type> x (Const16 <x.Type> [c+1])) (Const16 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess16U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq16U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(uint16(d) >= uint16(c+1) && uint16(c+1) > uint16(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v1.AuxInt = ssa.Int16ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d - c - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // 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.Type> x (Const8 <x.Type> [c+1])) (Const8 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess8U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess8U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(uint8(d) >= uint8(c+1) && uint8(c+1) > uint8(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v1.AuxInt = ssa.Int8ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d - c - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // 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.Type> x (Const8 <x.Type> [c+1])) (Const8 <x.Type> [d-c-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess8U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq8U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(uint8(d) >= uint8(c+1) && uint8(c+1) > uint8(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v1.AuxInt = ssa.Int8ToAuxInt(c + 1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d - c - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (AndB (Neq64 x (Const64 [0])) (Less64U x (Const64 [d]))) |
| // cond: uint64(d) >= 1 |
| // result: (Less64U (Sub64 <x.Type> x (Const64 <x.Type> [1])) (Const64 <x.Type> [d-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 0 || v_1.Op != ssaop.OpLess64U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(uint64(d) >= 1) { |
| continue |
| } |
| v.Reset(ssaop.OpLess64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (AndB (Neq64 x (Const64 [0])) (Leq64U x (Const64 [d]))) |
| // cond: uint64(d) >= 1 |
| // result: (Leq64U (Sub64 <x.Type> x (Const64 <x.Type> [1])) (Const64 <x.Type> [d-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 0 || v_1.Op != ssaop.OpLeq64U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(uint64(d) >= 1) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (AndB (Neq32 x (Const32 [0])) (Less32U x (Const32 [d]))) |
| // cond: uint32(d) >= 1 |
| // result: (Less32U (Sub32 <x.Type> x (Const32 <x.Type> [1])) (Const32 <x.Type> [d-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq32 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0_1.AuxInt) != 0 || v_1.Op != ssaop.OpLess32U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(uint32(d) >= 1) { |
| continue |
| } |
| v.Reset(ssaop.OpLess32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v1.AuxInt = ssa.Int32ToAuxInt(1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (AndB (Neq32 x (Const32 [0])) (Leq32U x (Const32 [d]))) |
| // cond: uint32(d) >= 1 |
| // result: (Leq32U (Sub32 <x.Type> x (Const32 <x.Type> [1])) (Const32 <x.Type> [d-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq32 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0_1.AuxInt) != 0 || v_1.Op != ssaop.OpLeq32U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(uint32(d) >= 1) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v1.AuxInt = ssa.Int32ToAuxInt(1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (AndB (Neq16 x (Const16 [0])) (Less16U x (Const16 [d]))) |
| // cond: uint16(d) >= 1 |
| // result: (Less16U (Sub16 <x.Type> x (Const16 <x.Type> [1])) (Const16 <x.Type> [d-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq16 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0_1.AuxInt) != 0 || v_1.Op != ssaop.OpLess16U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(uint16(d) >= 1) { |
| continue |
| } |
| v.Reset(ssaop.OpLess16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v1.AuxInt = ssa.Int16ToAuxInt(1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (AndB (Neq16 x (Const16 [0])) (Leq16U x (Const16 [d]))) |
| // cond: uint16(d) >= 1 |
| // result: (Leq16U (Sub16 <x.Type> x (Const16 <x.Type> [1])) (Const16 <x.Type> [d-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq16 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0_1.AuxInt) != 0 || v_1.Op != ssaop.OpLeq16U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(uint16(d) >= 1) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v1.AuxInt = ssa.Int16ToAuxInt(1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (AndB (Neq8 x (Const8 [0])) (Less8U x (Const8 [d]))) |
| // cond: uint8(d) >= 1 |
| // result: (Less8U (Sub8 <x.Type> x (Const8 <x.Type> [1])) (Const8 <x.Type> [d-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq8 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0_1.AuxInt) != 0 || v_1.Op != ssaop.OpLess8U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(uint8(d) >= 1) { |
| continue |
| } |
| v.Reset(ssaop.OpLess8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v1.AuxInt = ssa.Int8ToAuxInt(1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (AndB (Neq8 x (Const8 [0])) (Leq8U x (Const8 [d]))) |
| // cond: uint8(d) >= 1 |
| // result: (Leq8U (Sub8 <x.Type> x (Const8 <x.Type> [1])) (Const8 <x.Type> [d-1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq8 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0_1.AuxInt) != 0 || v_1.Op != ssaop.OpLeq8U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(uint8(d) >= 1) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v1.AuxInt = ssa.Int8ToAuxInt(1) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d - 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (AndB (Neq64 x cv:(Const64 [c])) (Neq64 x (Const64 [d]))) |
| // cond: c|d == c && ssa.OneBit(c^d) |
| // result: (Neq64 (Or64 <x.Type> x (Const64 <x.Type> [c^d])) cv) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| cv := v_0_1 |
| if cv.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(cv.AuxInt) |
| if v_1.Op != ssaop.OpNeq64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 { |
| if x != v_1_0 || v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c|d == c && ssa.OneBit(c^d)) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr64, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(c ^ d) |
| v0.AddArg2(x, v1) |
| v.AddArg2(v0, cv) |
| return true |
| } |
| } |
| } |
| break |
| } |
| // match: (AndB (Neq32 x cv:(Const32 [c])) (Neq32 x (Const32 [d]))) |
| // cond: c|d == c && ssa.OneBit(c^d) |
| // result: (Neq32 (Or32 <x.Type> x (Const32 <x.Type> [c^d])) cv) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq32 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| cv := v_0_1 |
| if cv.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(cv.AuxInt) |
| if v_1.Op != ssaop.OpNeq32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 { |
| if x != v_1_0 || v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c|d == c && ssa.OneBit(c^d)) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr32, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v1.AuxInt = ssa.Int32ToAuxInt(c ^ d) |
| v0.AddArg2(x, v1) |
| v.AddArg2(v0, cv) |
| return true |
| } |
| } |
| } |
| break |
| } |
| // match: (AndB (Neq16 x cv:(Const16 [c])) (Neq16 x (Const16 [d]))) |
| // cond: c|d == c && ssa.OneBit(c^d) |
| // result: (Neq16 (Or16 <x.Type> x (Const16 <x.Type> [c^d])) cv) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq16 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| cv := v_0_1 |
| if cv.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(cv.AuxInt) |
| if v_1.Op != ssaop.OpNeq16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 { |
| if x != v_1_0 || v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c|d == c && ssa.OneBit(c^d)) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr16, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v1.AuxInt = ssa.Int16ToAuxInt(c ^ d) |
| v0.AddArg2(x, v1) |
| v.AddArg2(v0, cv) |
| return true |
| } |
| } |
| } |
| break |
| } |
| // match: (AndB (Neq8 x cv:(Const8 [c])) (Neq8 x (Const8 [d]))) |
| // cond: c|d == c && ssa.OneBit(c^d) |
| // result: (Neq8 (Or8 <x.Type> x (Const8 <x.Type> [c^d])) cv) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq8 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| cv := v_0_1 |
| if cv.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(cv.AuxInt) |
| if v_1.Op != ssaop.OpNeq8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 { |
| if x != v_1_0 || v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c|d == c && ssa.OneBit(c^d)) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr8, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v1.AuxInt = ssa.Int8ToAuxInt(c ^ d) |
| v0.AddArg2(x, v1) |
| v.AddArg2(v0, cv) |
| return true |
| } |
| } |
| } |
| break |
| } |
| // match: (AndB x x) |
| // result: x |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (AndB (ConstBool [true]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstBool || ssa.AuxIntToBool(v_0.AuxInt) != true { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (AndB (ConstBool [false]) _) |
| // result: (ConstBool [false]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstBool || ssa.AuxIntToBool(v_0.AuxInt) != false { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpArraySelect(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (ArraySelect (ArrayMake1 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpArrayMake1 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (ArraySelect [0] (IData x)) |
| // result: (IData x) |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpIData { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpIData) |
| v.AddArg(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpBitLen16(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (BitLen16 (Const16 [c])) |
| // cond: config.PtrSize == 8 |
| // result: (Const64 [int64(bits.Len16(uint16(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(bits.Len16(uint16(c)))) |
| return true |
| } |
| // match: (BitLen16 (Const16 [c])) |
| // cond: config.PtrSize == 4 |
| // result: (Const32 [int32(bits.Len16(uint16(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(bits.Len16(uint16(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpBitLen32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (BitLen32 (Const32 [c])) |
| // cond: config.PtrSize == 8 |
| // result: (Const64 [int64(bits.Len32(uint32(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(bits.Len32(uint32(c)))) |
| return true |
| } |
| // match: (BitLen32 (Const32 [c])) |
| // cond: config.PtrSize == 4 |
| // result: (Const32 [int32(bits.Len32(uint32(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(bits.Len32(uint32(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpBitLen64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (BitLen64 (Const64 [c])) |
| // cond: config.PtrSize == 8 |
| // result: (Const64 [int64(bits.Len64(uint64(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(bits.Len64(uint64(c)))) |
| return true |
| } |
| // match: (BitLen64 (Const64 [c])) |
| // cond: config.PtrSize == 4 |
| // result: (Const32 [int32(bits.Len64(uint64(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(bits.Len64(uint64(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpBitLen8(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (BitLen8 (Const8 [c])) |
| // cond: config.PtrSize == 8 |
| // result: (Const64 [int64(bits.Len8(uint8(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(bits.Len8(uint8(c)))) |
| return true |
| } |
| // match: (BitLen8 (Const8 [c])) |
| // cond: config.PtrSize == 4 |
| // result: (Const32 [int32(bits.Len8(uint8(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(bits.Len8(uint8(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpBitRev16(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (BitRev16 (Const16 [c])) |
| // result: (Const16 [int16(bits.Reverse16(uint16(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(int16(bits.Reverse16(uint16(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpBitRev32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (BitRev32 (Const32 [c])) |
| // result: (Const32 [int32(bits.Reverse32(uint32(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(bits.Reverse32(uint32(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpBitRev64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (BitRev64 (Const64 [c])) |
| // result: (Const64 [int64(bits.Reverse64(uint64(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(bits.Reverse64(uint64(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpBitRev8(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (BitRev8 (Const8 [c])) |
| // result: (Const8 [int8(bits.Reverse8(uint8(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(int8(bits.Reverse8(uint8(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpBswap16(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Bswap16 (Const16 [c])) |
| // result: (Const16 [int16(bits.ReverseBytes16(uint16(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(int16(bits.ReverseBytes16(uint16(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpBswap32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Bswap32 (Const32 [c])) |
| // result: (Const32 [int32(bits.ReverseBytes32(uint32(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(bits.ReverseBytes32(uint32(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpBswap64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Bswap64 (Const64 [c])) |
| // result: (Const64 [int64(bits.ReverseBytes64(uint64(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(bits.ReverseBytes64(uint64(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCeil(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Ceil (Const64F [c])) |
| // result: (Const64F [math.Ceil(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(math.Ceil(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCom16(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Com16 (Com16 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpCom16 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Com16 (Const16 [c])) |
| // result: (Const16 [^c]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(^c) |
| return true |
| } |
| // match: (Com16 (Add16 (Const16 [-1]) x)) |
| // result: (Neg16 x) |
| for { |
| if v_0.Op != ssaop.OpAdd16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_0_1 |
| v.Reset(ssaop.OpNeg16) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpCom32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Com32 (Com32 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpCom32 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Com32 (Const32 [c])) |
| // result: (Const32 [^c]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(^c) |
| return true |
| } |
| // match: (Com32 (Add32 (Const32 [-1]) x)) |
| // result: (Neg32 x) |
| for { |
| if v_0.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_0_1 |
| v.Reset(ssaop.OpNeg32) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpCom64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Com64 (Com64 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpCom64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Com64 (Const64 [c])) |
| // result: (Const64 [^c]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(^c) |
| return true |
| } |
| // match: (Com64 (Add64 (Const64 [-1]) x)) |
| // result: (Neg64 x) |
| for { |
| if v_0.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_0_1 |
| v.Reset(ssaop.OpNeg64) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpCom8(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Com8 (Com8 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpCom8 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Com8 (Const8 [c])) |
| // result: (Const8 [^c]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(^c) |
| return true |
| } |
| // match: (Com8 (Add8 (Const8 [-1]) x)) |
| // result: (Neg8 x) |
| for { |
| if v_0.Op != ssaop.OpAdd8 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_0_1 |
| v.Reset(ssaop.OpNeg8) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpCondSelect(v *ssa.Value) bool { |
| v_2 := v.Args[2] |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (CondSelect x _ (ConstBool [true ])) |
| // result: x |
| for { |
| x := v_0 |
| if v_2.Op != ssaop.OpConstBool || ssa.AuxIntToBool(v_2.AuxInt) != true { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (CondSelect _ y (ConstBool [false])) |
| // result: y |
| for { |
| y := v_1 |
| if v_2.Op != ssaop.OpConstBool || ssa.AuxIntToBool(v_2.AuxInt) != false { |
| break |
| } |
| v.CopyOf(y) |
| return true |
| } |
| // match: (CondSelect x x _) |
| // result: x |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (CondSelect op1:(Add8 <t> x c:(Const8)) x bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Add8 x (Mul8 <t> c (CvtBoolToUint8 <t> bool))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpAdd8 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst8 || x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, t) |
| v1.AddArg(bool) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Add64 <t> x c:(Const64)) x bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Add64 x (Mul64 <t> c (ZeroExt8to64 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpAdd64 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst64 || x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v2.AddArg(bool) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Add32 <t> x c:(Const32)) x bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Add32 x (Mul32 <t> c (ZeroExt8to32 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpAdd32 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst32 || x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v2.AddArg(bool) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Add16 <t> x c:(Const16)) x bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Add16 x (Mul16 <t> c (ZeroExt8to16 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpAdd16 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst16 || x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to16, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v2.AddArg(bool) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Add8 <t> x c:(Const8)) bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Add8 x (Mul8 <t> c (CvtBoolToUint8 <t> (Not <bool.Type> bool)))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpAdd8 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst8 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v2.AddArg(bool) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Add64 <t> x c:(Const64)) bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Add64 x (Mul64 <t> c (ZeroExt8to64 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpAdd64 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst64 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v3 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Add32 <t> x c:(Const32)) bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Add32 x (Mul32 <t> c (ZeroExt8to32 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpAdd32 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst32 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v3 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Add16 <t> x c:(Const16)) bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Add16 x (Mul16 <t> c (ZeroExt8to16 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpAdd16 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst16 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to16, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v3 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Add8 <t> x c:(Const8 [consT])) x bool) |
| // cond: !rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt) |
| // result: (Sub8 x (Mul8 <t> (Const8 <t> [-consT]) (CvtBoolToUint8 <t> bool))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpAdd8 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst8 { |
| continue |
| } |
| consT := ssa.AuxIntToInt8(c.AuxInt) |
| if x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(!rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpSub8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v1.AuxInt = ssa.Int8ToAuxInt(-consT) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, t) |
| v2.AddArg(bool) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Add64 <t> x c:(Const64 [consT])) x bool) |
| // cond: !rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt) |
| // result: (Sub64 x (Mul64 <t> (Const64 <t> [-consT]) (ZeroExt8to64 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpAdd64 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst64 { |
| continue |
| } |
| consT := ssa.AuxIntToInt64(c.AuxInt) |
| if x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(!rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpSub64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v1.AuxInt = ssa.Int64ToAuxInt(-consT) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, t) |
| v3 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Add32 <t> x c:(Const32 [consT])) x bool) |
| // cond: !rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt) |
| // result: (Sub32 x (Mul32 <t> (Const32 <t> [-consT]) (ZeroExt8to32 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpAdd32 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst32 { |
| continue |
| } |
| consT := ssa.AuxIntToInt32(c.AuxInt) |
| if x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(!rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpSub32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v1.AuxInt = ssa.Int32ToAuxInt(-consT) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, t) |
| v3 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Add16 <t> x c:(Const16 [consT])) x bool) |
| // cond: !rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt) |
| // result: (Sub16 x (Mul16 <t> (Const16 <t> [-consT]) (ZeroExt8to16 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpAdd16 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst16 { |
| continue |
| } |
| consT := ssa.AuxIntToInt16(c.AuxInt) |
| if x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(!rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpSub16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v1.AuxInt = ssa.Int16ToAuxInt(-consT) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to16, t) |
| v3 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Add8 <t> x c:(Const8 [consT])) bool) |
| // cond: !rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt) |
| // result: (Sub8 x (Mul8 <t> (Const8 <t> [-consT]) (CvtBoolToUint8 <t> (Not <bool.Type> bool)))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpAdd8 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst8 { |
| continue |
| } |
| consT := ssa.AuxIntToInt8(c.AuxInt) |
| bool := v_2 |
| if !(!rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpSub8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v1.AuxInt = ssa.Int8ToAuxInt(-consT) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, t) |
| v3 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Add64 <t> x c:(Const64 [consT])) bool) |
| // cond: !rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt) |
| // result: (Sub64 x (Mul64 <t> (Const64 <t> [-consT]) (ZeroExt8to64 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpAdd64 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst64 { |
| continue |
| } |
| consT := ssa.AuxIntToInt64(c.AuxInt) |
| bool := v_2 |
| if !(!rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpSub64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v1.AuxInt = ssa.Int64ToAuxInt(-consT) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, t) |
| v3 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v4 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v4.AddArg(bool) |
| v3.AddArg(v4) |
| v2.AddArg(v3) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Add32 <t> x c:(Const32 [consT])) bool) |
| // cond: !rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt) |
| // result: (Sub32 x (Mul32 <t> (Const32 <t> [-consT]) (ZeroExt8to32 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpAdd32 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst32 { |
| continue |
| } |
| consT := ssa.AuxIntToInt32(c.AuxInt) |
| bool := v_2 |
| if !(!rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpSub32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v1.AuxInt = ssa.Int32ToAuxInt(-consT) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, t) |
| v3 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v4 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v4.AddArg(bool) |
| v3.AddArg(v4) |
| v2.AddArg(v3) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Add16 <t> x c:(Const16 [consT])) bool) |
| // cond: !rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt) |
| // result: (Sub16 x (Mul16 <t> (Const16 <t> [-consT]) (ZeroExt8to16 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpAdd16 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst16 { |
| continue |
| } |
| consT := ssa.AuxIntToInt16(c.AuxInt) |
| bool := v_2 |
| if !(!rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) && rewriteCondSelectIntoMath(config, addToSub(op1.Op), -c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpSub16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v1.AuxInt = ssa.Int16ToAuxInt(-consT) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to16, t) |
| v3 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v4 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v4.AddArg(bool) |
| v3.AddArg(v4) |
| v2.AddArg(v3) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect (Lsh64x64 x (Const64 [1])) x bool) |
| // result: (Lsh64x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)) |
| for { |
| if v_0.Op != ssaop.OpLsh64x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 1 || x != v_1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpLsh64x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v0.AddArg(bool) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect (Lsh32x64 x (Const64 [1])) x bool) |
| // result: (Lsh32x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)) |
| for { |
| if v_0.Op != ssaop.OpLsh32x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 1 || x != v_1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpLsh32x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v0.AddArg(bool) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect (Lsh16x64 x (Const64 [1])) x bool) |
| // result: (Lsh16x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)) |
| for { |
| if v_0.Op != ssaop.OpLsh16x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 1 || x != v_1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpLsh16x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v0.AddArg(bool) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect (Lsh8x64 x (Const64 [1])) x bool) |
| // result: (Lsh8x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)) |
| for { |
| if v_0.Op != ssaop.OpLsh8x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 1 || x != v_1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpLsh8x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v0.AddArg(bool) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect x (Lsh64x64 x (Const64 [1])) bool) |
| // result: (Lsh64x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpLsh64x64 { |
| break |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| break |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1_1.AuxInt) != 1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpLsh64x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect x (Lsh32x64 x (Const64 [1])) bool) |
| // result: (Lsh32x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpLsh32x64 { |
| break |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| break |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1_1.AuxInt) != 1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpLsh32x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect x (Lsh16x64 x (Const64 [1])) bool) |
| // result: (Lsh16x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpLsh16x64 { |
| break |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| break |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1_1.AuxInt) != 1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpLsh16x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect x (Lsh8x64 x (Const64 [1])) bool) |
| // result: (Lsh8x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpLsh8x64 { |
| break |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| break |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1_1.AuxInt) != 1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpLsh8x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect (Rsh64x64 x (Const64 [1])) x bool) |
| // result: (Rsh64x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)) |
| for { |
| if v_0.Op != ssaop.OpRsh64x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 1 || x != v_1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh64x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v0.AddArg(bool) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect (Rsh32x64 x (Const64 [1])) x bool) |
| // result: (Rsh32x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)) |
| for { |
| if v_0.Op != ssaop.OpRsh32x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 1 || x != v_1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh32x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v0.AddArg(bool) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect (Rsh16x64 x (Const64 [1])) x bool) |
| // result: (Rsh16x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)) |
| for { |
| if v_0.Op != ssaop.OpRsh16x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 1 || x != v_1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh16x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v0.AddArg(bool) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect (Rsh8x64 x (Const64 [1])) x bool) |
| // result: (Rsh8x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)) |
| for { |
| if v_0.Op != ssaop.OpRsh8x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 1 || x != v_1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh8x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v0.AddArg(bool) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect (Rsh64Ux64 x (Const64 [1])) x bool) |
| // result: (Rsh64Ux8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)) |
| for { |
| if v_0.Op != ssaop.OpRsh64Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 1 || x != v_1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh64Ux8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v0.AddArg(bool) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect (Rsh32Ux64 x (Const64 [1])) x bool) |
| // result: (Rsh32Ux8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)) |
| for { |
| if v_0.Op != ssaop.OpRsh32Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 1 || x != v_1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh32Ux8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v0.AddArg(bool) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect (Rsh16Ux64 x (Const64 [1])) x bool) |
| // result: (Rsh16Ux8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)) |
| for { |
| if v_0.Op != ssaop.OpRsh16Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 1 || x != v_1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh16Ux8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v0.AddArg(bool) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect (Rsh8Ux64 x (Const64 [1])) x bool) |
| // result: (Rsh8Ux8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)) |
| for { |
| if v_0.Op != ssaop.OpRsh8Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 1 || x != v_1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh8Ux8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v0.AddArg(bool) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect x (Rsh64x64 x (Const64 [1])) bool) |
| // result: (Rsh64x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpRsh64x64 { |
| break |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| break |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1_1.AuxInt) != 1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh64x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect x (Rsh32x64 x (Const64 [1])) bool) |
| // result: (Rsh32x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpRsh32x64 { |
| break |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| break |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1_1.AuxInt) != 1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh32x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect x (Rsh16x64 x (Const64 [1])) bool) |
| // result: (Rsh16x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpRsh16x64 { |
| break |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| break |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1_1.AuxInt) != 1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh16x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect x (Rsh8x64 x (Const64 [1])) bool) |
| // result: (Rsh8x8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpRsh8x64 { |
| break |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| break |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1_1.AuxInt) != 1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh8x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect x (Rsh64Ux64 x (Const64 [1])) bool) |
| // result: (Rsh64Ux8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpRsh64Ux64 { |
| break |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| break |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1_1.AuxInt) != 1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh64Ux8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect x (Rsh32Ux64 x (Const64 [1])) bool) |
| // result: (Rsh32Ux8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpRsh32Ux64 { |
| break |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| break |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1_1.AuxInt) != 1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh32Ux8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect x (Rsh16Ux64 x (Const64 [1])) bool) |
| // result: (Rsh16Ux8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpRsh16Ux64 { |
| break |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| break |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1_1.AuxInt) != 1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh16Ux8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect x (Rsh8Ux64 x (Const64 [1])) bool) |
| // result: (Rsh8Ux8 [true] x (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpRsh8Ux64 { |
| break |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| break |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1_1.AuxInt) != 1 { |
| break |
| } |
| bool := v_2 |
| v.Reset(ssaop.OpRsh8Ux8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (CondSelect op1:(Or8 <t> x c:(Const8)) x bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Or8 x (Mul8 <t> c (CvtBoolToUint8 <t> bool))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpOr8 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst8 || x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpOr8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, t) |
| v1.AddArg(bool) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Or64 <t> x c:(Const64)) x bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Or64 x (Mul64 <t> c (ZeroExt8to64 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpOr64 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst64 || x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpOr64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v2.AddArg(bool) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Or32 <t> x c:(Const32)) x bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Or32 x (Mul32 <t> c (ZeroExt8to32 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpOr32 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst32 || x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpOr32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v2.AddArg(bool) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Or16 <t> x c:(Const16)) x bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Or16 x (Mul16 <t> c (ZeroExt8to16 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpOr16 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst16 || x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpOr16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to16, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v2.AddArg(bool) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Or8 <t> x c:(Const8)) bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Or8 x (Mul8 <t> c (CvtBoolToUint8 <t> (Not <bool.Type> bool)))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpOr8 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst8 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpOr8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v2.AddArg(bool) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Or64 <t> x c:(Const64)) bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Or64 x (Mul64 <t> c (ZeroExt8to64 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpOr64 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst64 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpOr64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v3 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Or32 <t> x c:(Const32)) bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Or32 x (Mul32 <t> c (ZeroExt8to32 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpOr32 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst32 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpOr32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v3 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Or16 <t> x c:(Const16)) bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Or16 x (Mul16 <t> c (ZeroExt8to16 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpOr16 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst16 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpOr16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to16, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v3 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Xor8 <t> x c:(Const8)) x bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Xor8 x (Mul8 <t> c (CvtBoolToUint8 <t> bool))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpXor8 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst8 || x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpXor8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, t) |
| v1.AddArg(bool) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Xor64 <t> x c:(Const64)) x bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Xor64 x (Mul64 <t> c (ZeroExt8to64 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpXor64 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst64 || x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpXor64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v2.AddArg(bool) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Xor32 <t> x c:(Const32)) x bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Xor32 x (Mul32 <t> c (ZeroExt8to32 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpXor32 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst32 || x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpXor32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v2.AddArg(bool) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect op1:(Xor16 <t> x c:(Const16)) x bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Xor16 x (Mul16 <t> c (ZeroExt8to16 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> bool)))) |
| for { |
| op1 := v_0 |
| if op1.Op != ssaop.OpXor16 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| x := op1_0 |
| c := op1_1 |
| if c.Op != ssaop.OpConst16 || x != v_1 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpXor16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to16, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v2.AddArg(bool) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Xor8 <t> x c:(Const8)) bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Xor8 x (Mul8 <t> c (CvtBoolToUint8 <t> (Not <bool.Type> bool)))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpXor8 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst8 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpXor8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v2.AddArg(bool) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Xor64 <t> x c:(Const64)) bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Xor64 x (Mul64 <t> c (ZeroExt8to64 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpXor64 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst64 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpXor64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v3 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Xor32 <t> x c:(Const32)) bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Xor32 x (Mul32 <t> c (ZeroExt8to32 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpXor32 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst32 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpXor32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v3 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (CondSelect x op1:(Xor16 <t> x c:(Const16)) bool) |
| // cond: rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt) |
| // result: (Xor16 x (Mul16 <t> c (ZeroExt8to16 <t> (CvtBoolToUint8 <types.Types[types.TUINT8]> (Not <bool.Type> bool))))) |
| for { |
| x := v_0 |
| op1 := v_1 |
| if op1.Op != ssaop.OpXor16 { |
| break |
| } |
| t := op1.Type |
| _ = op1.Args[1] |
| op1_0 := op1.Args[0] |
| op1_1 := op1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, op1_0, op1_1 = _i0+1, op1_1, op1_0 { |
| if x != op1_0 { |
| continue |
| } |
| c := op1_1 |
| if c.Op != ssaop.OpConst16 { |
| continue |
| } |
| bool := v_2 |
| if !(rewriteCondSelectIntoMath(config, op1.Op, c.AuxInt)) { |
| continue |
| } |
| v.Reset(ssaop.OpXor16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to16, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, types.Types[types.TUINT8]) |
| v3 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v3.AddArg(bool) |
| v2.AddArg(v3) |
| v1.AddArg(v2) |
| v0.AddArg2(c, v1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpConstInterface(v *ssa.Value) bool { |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (ConstInterface) |
| // result: (IMake (ConstNil <typ.Uintptr>) (ConstNil <typ.BytePtr>)) |
| for { |
| v.Reset(ssaop.OpIMake) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConstNil, typ.Uintptr) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConstNil, typ.BytePtr) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| } |
| func rewriteValue_OpConstSlice(v *ssa.Value) bool { |
| b := v.Block |
| config := b.Func.Config |
| typ := &b.Func.Config.Types |
| // match: (ConstSlice) |
| // cond: config.PtrSize == 4 |
| // result: (SliceMake (ConstNil <v.Type.Elem().PtrTo()>) (Const32 <typ.Int> [0]) (Const32 <typ.Int> [0])) |
| for { |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpSliceMake) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConstNil, v.Type.Elem().PtrTo()) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int) |
| v1.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg3(v0, v1, v1) |
| return true |
| } |
| // match: (ConstSlice) |
| // cond: config.PtrSize == 8 |
| // result: (SliceMake (ConstNil <v.Type.Elem().PtrTo()>) (Const64 <typ.Int> [0]) (Const64 <typ.Int> [0])) |
| for { |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpSliceMake) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConstNil, v.Type.Elem().PtrTo()) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int) |
| v1.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg3(v0, v1, v1) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpConstString(v *ssa.Value) bool { |
| b := v.Block |
| config := b.Func.Config |
| fe := b.Func.Fe |
| typ := &b.Func.Config.Types |
| // match: (ConstString {str}) |
| // cond: config.PtrSize == 4 && str == "" |
| // result: (StringMake (ConstNil) (Const32 <typ.Int> [0])) |
| for { |
| str := ssa.AuxToString(v.Aux) |
| if !(config.PtrSize == 4 && str == "") { |
| break |
| } |
| v.Reset(ssaop.OpStringMake) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConstNil, typ.BytePtr) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int) |
| v1.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| // match: (ConstString {str}) |
| // cond: config.PtrSize == 8 && str == "" |
| // result: (StringMake (ConstNil) (Const64 <typ.Int> [0])) |
| for { |
| str := ssa.AuxToString(v.Aux) |
| if !(config.PtrSize == 8 && str == "") { |
| break |
| } |
| v.Reset(ssaop.OpStringMake) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConstNil, typ.BytePtr) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int) |
| v1.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| // match: (ConstString {str}) |
| // cond: config.PtrSize == 4 && str != "" |
| // result: (StringMake (Addr <typ.BytePtr> {fe.StringData(str)} (SB)) (Const32 <typ.Int> [int32(len(str))])) |
| for { |
| str := ssa.AuxToString(v.Aux) |
| if !(config.PtrSize == 4 && str != "") { |
| break |
| } |
| v.Reset(ssaop.OpStringMake) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAddr, typ.BytePtr) |
| v0.Aux = ssa.SymToAux(fe.StringData(str)) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSB, typ.Uintptr) |
| v0.AddArg(v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int) |
| v2.AuxInt = ssa.Int32ToAuxInt(int32(len(str))) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| // match: (ConstString {str}) |
| // cond: config.PtrSize == 8 && str != "" |
| // result: (StringMake (Addr <typ.BytePtr> {fe.StringData(str)} (SB)) (Const64 <typ.Int> [int64(len(str))])) |
| for { |
| str := ssa.AuxToString(v.Aux) |
| if !(config.PtrSize == 8 && str != "") { |
| break |
| } |
| v.Reset(ssaop.OpStringMake) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAddr, typ.BytePtr) |
| v0.Aux = ssa.SymToAux(fe.StringData(str)) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSB, typ.Uintptr) |
| v0.AddArg(v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int) |
| v2.AuxInt = ssa.Int64ToAuxInt(int64(len(str))) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpConvert(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Convert (Add64 (Convert ptr mem) off) mem) |
| // result: (AddPtr ptr off) |
| for { |
| if v_0.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConvert { |
| continue |
| } |
| mem := v_0_0.Args[1] |
| ptr := v_0_0.Args[0] |
| off := v_0_1 |
| if mem != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpAddPtr) |
| v.AddArg2(ptr, off) |
| return true |
| } |
| break |
| } |
| // match: (Convert (Add32 (Convert ptr mem) off) mem) |
| // result: (AddPtr ptr off) |
| for { |
| if v_0.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConvert { |
| continue |
| } |
| mem := v_0_0.Args[1] |
| ptr := v_0_0.Args[0] |
| off := v_0_1 |
| if mem != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpAddPtr) |
| v.AddArg2(ptr, off) |
| return true |
| } |
| break |
| } |
| // match: (Convert (Convert ptr mem) mem) |
| // result: ptr |
| for { |
| if v_0.Op != ssaop.OpConvert { |
| break |
| } |
| mem := v_0.Args[1] |
| ptr := v_0.Args[0] |
| if mem != v_1 { |
| break |
| } |
| v.CopyOf(ptr) |
| return true |
| } |
| // match: (Convert a:(Add64 (Add64 (Convert ptr mem) off1) off2) mem) |
| // result: (AddPtr ptr (Add64 <a.Type> off1 off2)) |
| for { |
| a := v_0 |
| if a.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = a.Args[1] |
| a_0 := a.Args[0] |
| a_1 := a.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, a_0, a_1 = _i0+1, a_1, a_0 { |
| if a_0.Op != ssaop.OpAdd64 { |
| continue |
| } |
| _ = a_0.Args[1] |
| a_0_0 := a_0.Args[0] |
| a_0_1 := a_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, a_0_0, a_0_1 = _i1+1, a_0_1, a_0_0 { |
| if a_0_0.Op != ssaop.OpConvert { |
| continue |
| } |
| mem := a_0_0.Args[1] |
| ptr := a_0_0.Args[0] |
| off1 := a_0_1 |
| off2 := a_1 |
| if mem != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpAddPtr) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd64, a.Type) |
| v0.AddArg2(off1, off2) |
| v.AddArg2(ptr, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Convert a:(Add32 (Add32 (Convert ptr mem) off1) off2) mem) |
| // result: (AddPtr ptr (Add32 <a.Type> off1 off2)) |
| for { |
| a := v_0 |
| if a.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = a.Args[1] |
| a_0 := a.Args[0] |
| a_1 := a.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, a_0, a_1 = _i0+1, a_1, a_0 { |
| if a_0.Op != ssaop.OpAdd32 { |
| continue |
| } |
| _ = a_0.Args[1] |
| a_0_0 := a_0.Args[0] |
| a_0_1 := a_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, a_0_0, a_0_1 = _i1+1, a_0_1, a_0_0 { |
| if a_0_0.Op != ssaop.OpConvert { |
| continue |
| } |
| mem := a_0_0.Args[1] |
| ptr := a_0_0.Args[0] |
| off1 := a_0_1 |
| off2 := a_1 |
| if mem != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpAddPtr) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd32, a.Type) |
| v0.AddArg2(off1, off2) |
| v.AddArg2(ptr, v0) |
| return true |
| } |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpCtz16(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Ctz16 (Const16 [c])) |
| // cond: config.PtrSize == 4 |
| // result: (Const32 [int32(ntz16(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(ntz16(c))) |
| return true |
| } |
| // match: (Ctz16 (Const16 [c])) |
| // cond: config.PtrSize == 8 |
| // result: (Const64 [int64(ntz16(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(ntz16(c))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCtz32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Ctz32 (Const32 [c])) |
| // cond: config.PtrSize == 4 |
| // result: (Const32 [int32(ntz32(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(ntz32(c))) |
| return true |
| } |
| // match: (Ctz32 (Const32 [c])) |
| // cond: config.PtrSize == 8 |
| // result: (Const64 [int64(ntz32(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(ntz32(c))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCtz64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Ctz64 (Const64 [c])) |
| // cond: config.PtrSize == 4 |
| // result: (Const32 [int32(ssa.Ntz64(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(ssa.Ntz64(c))) |
| return true |
| } |
| // match: (Ctz64 (Const64 [c])) |
| // cond: config.PtrSize == 8 |
| // result: (Const64 [int64(ssa.Ntz64(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(ssa.Ntz64(c))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCtz8(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Ctz8 (Const8 [c])) |
| // cond: config.PtrSize == 4 |
| // result: (Const32 [int32(ntz8(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(ntz8(c))) |
| return true |
| } |
| // match: (Ctz8 (Const8 [c])) |
| // cond: config.PtrSize == 8 |
| // result: (Const64 [int64(ntz8(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(ntz8(c))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCvt32Fto32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Cvt32Fto32 (Const32F [c])) |
| // cond: c >= -1<<31 && c < 1<<31 |
| // result: (Const32 [int32(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst32F { |
| break |
| } |
| c := ssa.AuxIntToFloat32(v_0.AuxInt) |
| if !(c >= -1<<31 && c < 1<<31) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCvt32Fto64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Cvt32Fto64 (Const32F [c])) |
| // cond: c >= -1<<63 && c < 1<<63 |
| // result: (Const64 [int64(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst32F { |
| break |
| } |
| c := ssa.AuxIntToFloat32(v_0.AuxInt) |
| if !(c >= -1<<63 && c < 1<<63) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCvt32Fto64F(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Cvt32Fto64F (Const32F [c])) |
| // result: (Const64F [float64(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst32F { |
| break |
| } |
| c := ssa.AuxIntToFloat32(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(float64(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCvt32to32F(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Cvt32to32F (Const32 [c])) |
| // result: (Const32F [float32(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| v.Reset(ssaop.OpConst32F) |
| v.AuxInt = ssa.Float32ToAuxInt(float32(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCvt32to64F(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Cvt32to64F (Const32 [c])) |
| // result: (Const64F [float64(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(float64(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCvt64Fto32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Cvt64Fto32 (Const64F [c])) |
| // cond: c >= -1<<31 && c < 1<<31 |
| // result: (Const32 [int32(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| if !(c >= -1<<31 && c < 1<<31) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCvt64Fto32F(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Cvt64Fto32F (Const64F [c])) |
| // result: (Const32F [float32(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst32F) |
| v.AuxInt = ssa.Float32ToAuxInt(float32(c)) |
| return true |
| } |
| // match: (Cvt64Fto32F sqrt0:(Sqrt (Cvt32Fto64F x))) |
| // cond: sqrt0.Uses==1 |
| // result: (Sqrt32 x) |
| for { |
| sqrt0 := v_0 |
| if sqrt0.Op != ssaop.OpSqrt { |
| break |
| } |
| sqrt0_0 := sqrt0.Args[0] |
| if sqrt0_0.Op != ssaop.OpCvt32Fto64F { |
| break |
| } |
| x := sqrt0_0.Args[0] |
| if !(sqrt0.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpSqrt32) |
| v.AddArg(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCvt64Fto64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Cvt64Fto64 (Const64F [c])) |
| // cond: c >= -1<<63 && c < 1<<63 |
| // result: (Const64 [int64(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| if !(c >= -1<<63 && c < 1<<63) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCvt64to32F(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Cvt64to32F (Const64 [c])) |
| // result: (Const32F [float32(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst32F) |
| v.AuxInt = ssa.Float32ToAuxInt(float32(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCvt64to64F(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Cvt64to64F (Const64 [c])) |
| // result: (Const64F [float64(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(float64(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpCvtBoolToUint8(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (CvtBoolToUint8 (ConstBool [false])) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConstBool || ssa.AuxIntToBool(v_0.AuxInt) != false { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (CvtBoolToUint8 (ConstBool [true])) |
| // result: (Const8 [1]) |
| for { |
| if v_0.Op != ssaop.OpConstBool || ssa.AuxIntToBool(v_0.AuxInt) != true { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(1) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpDiv128u(v *ssa.Value) bool { |
| v_2 := v.Args[2] |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Div128u <t> (Const64 [hi]) (Const64 [lo]) (Const64 [y])) |
| // cond: y != 0 && uint64(hi) < uint64(y) |
| // result: (MakeTuple (Const64 <t.FieldType(0)> [bitsDiv128u(hi, lo, y).quo]) (Const64 <t.FieldType(1)> [bitsDiv128u(hi, lo, y).rem])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| hi := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| lo := ssa.AuxIntToInt64(v_1.AuxInt) |
| if v_2.Op != ssaop.OpConst64 { |
| break |
| } |
| y := ssa.AuxIntToInt64(v_2.AuxInt) |
| if !(y != 0 && uint64(hi) < uint64(y)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t.FieldType(0)) |
| v0.AuxInt = ssa.Int64ToAuxInt(bitsDiv128u(hi, lo, y).quo) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t.FieldType(1)) |
| v1.AuxInt = ssa.Int64ToAuxInt(bitsDiv128u(hi, lo, y).rem) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| // match: (Div128u <t> (Const64 [0]) lo y) |
| // result: (MakeTuple (Div64u <t.FieldType(0)> lo y) (Mod64u <t.FieldType(1)> lo y)) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| lo := v_1 |
| y := v_2 |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpDiv64u, t.FieldType(0)) |
| v0.AddArg2(lo, y) |
| v1 := b.NewValue0(v.Pos, ssaop.OpMod64u, t.FieldType(1)) |
| v1.AddArg2(lo, y) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpDiv16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Div16 (Const16 [c]) (Const16 [d])) |
| // cond: d != 0 |
| // result: (Const16 [c/d]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(c / d) |
| return true |
| } |
| // match: (Div16 <t> n (Const16 [c])) |
| // cond: c < 0 && c != -1<<15 |
| // result: (Neg16 (Div16 <t> n (Const16 <t> [-c]))) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(c < 0 && c != -1<<15) { |
| break |
| } |
| v.Reset(ssaop.OpNeg16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpDiv16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v1.AuxInt = ssa.Int16ToAuxInt(-c) |
| v0.AddArg2(n, v1) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Div16 <t> x (Const16 [-1<<15])) |
| // result: (Rsh16Ux64 (And16 <t> x (Neg16 <t> x)) (Const64 <typ.UInt64> [15])) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != -1<<15 { |
| break |
| } |
| v.Reset(ssaop.OpRsh16Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNeg16, t) |
| v1.AddArg(x) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v2.AuxInt = ssa.Int64ToAuxInt(15) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpDiv16u(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Div16u (Const16 [c]) (Const16 [d])) |
| // cond: d != 0 |
| // result: (Const16 [int16(uint16(c)/uint16(d))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(int16(uint16(c) / uint16(d))) |
| return true |
| } |
| // match: (Div16u n (Const16 [c])) |
| // cond: ssa.IsPowerOfTwo(uint16(c)) |
| // result: (Rsh16Ux64 n (Const64 <typ.UInt64> [ssa.Log16u(uint16(c))])) |
| for { |
| n := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint16(c))) { |
| break |
| } |
| v.Reset(ssaop.OpRsh16Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(ssa.Log16u(uint16(c))) |
| v.AddArg2(n, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpDiv32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Div32 (Const32 [c]) (Const32 [d])) |
| // cond: d != 0 |
| // result: (Const32 [c/d]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(c / d) |
| return true |
| } |
| // match: (Div32 <t> n (Const32 [c])) |
| // cond: c < 0 && c != -1<<31 |
| // result: (Neg32 (Div32 <t> n (Const32 <t> [-c]))) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(c < 0 && c != -1<<31) { |
| break |
| } |
| v.Reset(ssaop.OpNeg32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpDiv32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v1.AuxInt = ssa.Int32ToAuxInt(-c) |
| v0.AddArg2(n, v1) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Div32 <t> x (Const32 [-1<<31])) |
| // result: (Rsh32Ux64 (And32 <t> x (Neg32 <t> x)) (Const64 <typ.UInt64> [31])) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != -1<<31 { |
| break |
| } |
| v.Reset(ssaop.OpRsh32Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNeg32, t) |
| v1.AddArg(x) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v2.AuxInt = ssa.Int64ToAuxInt(31) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpDiv32F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Div32F (Const32F [c]) (Const32F [d])) |
| // cond: c/d == c/d |
| // result: (Const32F [c/d]) |
| for { |
| if v_0.Op != ssaop.OpConst32F { |
| break |
| } |
| c := ssa.AuxIntToFloat32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32F { |
| break |
| } |
| d := ssa.AuxIntToFloat32(v_1.AuxInt) |
| if !(c/d == c/d) { |
| break |
| } |
| v.Reset(ssaop.OpConst32F) |
| v.AuxInt = ssa.Float32ToAuxInt(c / d) |
| return true |
| } |
| // match: (Div32F x (Const32F <t> [c])) |
| // cond: reciprocalExact32(c) |
| // result: (Mul32F x (Const32F <t> [1/c])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32F { |
| break |
| } |
| t := v_1.Type |
| c := ssa.AuxIntToFloat32(v_1.AuxInt) |
| if !(reciprocalExact32(c)) { |
| break |
| } |
| v.Reset(ssaop.OpMul32F) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32F, t) |
| v0.AuxInt = ssa.Float32ToAuxInt(1 / c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpDiv32u(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Div32u (Const32 [c]) (Const32 [d])) |
| // cond: d != 0 |
| // result: (Const32 [int32(uint32(c)/uint32(d))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(uint32(c) / uint32(d))) |
| return true |
| } |
| // match: (Div32u n (Const32 [c])) |
| // cond: ssa.IsPowerOfTwo(uint32(c)) |
| // result: (Rsh32Ux64 n (Const64 <typ.UInt64> [ssa.Log32u(uint32(c))])) |
| for { |
| n := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint32(c))) { |
| break |
| } |
| v.Reset(ssaop.OpRsh32Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(ssa.Log32u(uint32(c))) |
| v.AddArg2(n, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpDiv64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Div64 (Const64 [c]) (Const64 [d])) |
| // cond: d != 0 |
| // result: (Const64 [c/d]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(c / d) |
| return true |
| } |
| // match: (Div64 <t> n (Const64 [c])) |
| // cond: c < 0 && c != -1<<63 |
| // result: (Neg64 (Div64 <t> n (Const64 <t> [-c]))) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c < 0 && c != -1<<63) { |
| break |
| } |
| v.Reset(ssaop.OpNeg64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpDiv64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v1.AuxInt = ssa.Int64ToAuxInt(-c) |
| v0.AddArg2(n, v1) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Div64 x (Const64 [-1<<63])) |
| // cond: isNonNegative(x) |
| // result: (Const64 [0]) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != -1<<63 || !(isNonNegative(x)) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Div64 <t> x (Const64 [-1<<63])) |
| // result: (Rsh64Ux64 (And64 <t> x (Neg64 <t> x)) (Const64 <typ.UInt64> [63])) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != -1<<63 { |
| break |
| } |
| v.Reset(ssaop.OpRsh64Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNeg64, t) |
| v1.AddArg(x) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v2.AuxInt = ssa.Int64ToAuxInt(63) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpDiv64F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Div64F (Const64F [c]) (Const64F [d])) |
| // cond: c/d == c/d |
| // result: (Const64F [c/d]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64F { |
| break |
| } |
| d := ssa.AuxIntToFloat64(v_1.AuxInt) |
| if !(c/d == c/d) { |
| break |
| } |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(c / d) |
| return true |
| } |
| // match: (Div64F x (Const64F <t> [c])) |
| // cond: reciprocalExact64(c) |
| // result: (Mul64F x (Const64F <t> [1/c])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64F { |
| break |
| } |
| t := v_1.Type |
| c := ssa.AuxIntToFloat64(v_1.AuxInt) |
| if !(reciprocalExact64(c)) { |
| break |
| } |
| v.Reset(ssaop.OpMul64F) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64F, t) |
| v0.AuxInt = ssa.Float64ToAuxInt(1 / c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpDiv64u(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Div64u (Const64 [c]) (Const64 [d])) |
| // cond: d != 0 |
| // result: (Const64 [int64(uint64(c)/uint64(d))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(uint64(c) / uint64(d))) |
| return true |
| } |
| // match: (Div64u n (Const64 [c])) |
| // cond: ssa.IsPowerOfTwo(uint64(c)) |
| // result: (Rsh64Ux64 n (Const64 <typ.UInt64> [ssa.Log64u(uint64(c))])) |
| for { |
| n := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint64(c))) { |
| break |
| } |
| v.Reset(ssaop.OpRsh64Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(ssa.Log64u(uint64(c))) |
| v.AddArg2(n, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpDiv8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Div8 (Const8 [c]) (Const8 [d])) |
| // cond: d != 0 |
| // result: (Const8 [c/d]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(c / d) |
| return true |
| } |
| // match: (Div8 <t> n (Const8 [c])) |
| // cond: c < 0 && c != -1<<7 |
| // result: (Neg8 (Div8 <t> n (Const8 <t> [-c]))) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(c < 0 && c != -1<<7) { |
| break |
| } |
| v.Reset(ssaop.OpNeg8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpDiv8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v1.AuxInt = ssa.Int8ToAuxInt(-c) |
| v0.AddArg2(n, v1) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Div8 <t> x (Const8 [-1<<7 ])) |
| // result: (Rsh8Ux64 (And8 <t> x (Neg8 <t> x)) (Const64 <typ.UInt64> [7 ])) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != -1<<7 { |
| break |
| } |
| v.Reset(ssaop.OpRsh8Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNeg8, t) |
| v1.AddArg(x) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v2.AuxInt = ssa.Int64ToAuxInt(7) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpDiv8u(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Div8u (Const8 [c]) (Const8 [d])) |
| // cond: d != 0 |
| // result: (Const8 [int8(uint8(c)/uint8(d))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(int8(uint8(c) / uint8(d))) |
| return true |
| } |
| // match: (Div8u n (Const8 [c])) |
| // cond: ssa.IsPowerOfTwo(uint8(c)) |
| // result: (Rsh8Ux64 n (Const64 <typ.UInt64> [ssa.Log8u(uint8(c))])) |
| for { |
| n := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint8(c))) { |
| break |
| } |
| v.Reset(ssaop.OpRsh8Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(ssa.Log8u(uint8(c))) |
| v.AddArg2(n, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpEq16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| typ := &b.Func.Config.Types |
| // match: (Eq16 x x) |
| // result: (ConstBool [true]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Eq16 (Const16 <t> [c]) o:(Add16 (Const16 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Eq16 (Const16 <t> [c-d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpAdd16 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq16 (Const16 <t> [c]) o:(Sub16 x (Const16 [d]))) |
| // cond: o.Uses == 1 |
| // result: (Eq16 (Const16 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = o.Args[1] |
| x := o.Args[0] |
| o_1 := o.Args[1] |
| if o_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(o_1.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq16 (Const16 <t> [c]) o:(Sub16 (Const16 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Eq16 (Const16 <t> [d-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub16 { |
| continue |
| } |
| x := o.Args[1] |
| o_0 := o.Args[0] |
| if o_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(o_0.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(d - c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq16 (Const16 <t> [c]) o:(Xor16 (Const16 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Eq16 (Const16 <t> [d^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpXor16 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(d ^ c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq16 (Const16 <t> [c]) o:(Com16 x)) |
| // cond: o.Uses == 1 |
| // result: (Eq16 (Const16 <t> [^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpCom16 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(^c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq16 (Const16 <t> [c]) o:(Neg16 x)) |
| // cond: o.Uses == 1 |
| // result: (Eq16 (Const16 <t> [-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpNeg16 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(-c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq16 (Const16 <t> [c]) o:(Mul16 (Const16 [d]) x)) |
| // cond: uint16(d)%2 == 1 && o.Uses == 1 |
| // result: (Eq16 (Const16 <t> [int16(uint16(c) * uint16(modularMultiplicativeInverse(uint64(d))))]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpMul16 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(o_0.AuxInt) |
| x := o_1 |
| if !(uint16(d)%2 == 1 && o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(int16(uint16(c) * uint16(modularMultiplicativeInverse(uint64(d))))) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq16 (Const16 [c]) (Const16 [d])) |
| // result: (ConstBool [c == d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c == d) |
| return true |
| } |
| break |
| } |
| // match: (Eq16 (Mod16u x (Const16 [c])) (Const16 [0])) |
| // cond: x.Op != ssaop.OpConst16 && ssa.UdivisibleOK16(c) && !hasSmallRotate(config) |
| // result: (Eq32 (Mod32u <typ.UInt32> (ZeroExt16to32 <typ.UInt32> x) (Const32 <typ.UInt32> [int32(uint16(c))])) (Const32 <typ.UInt32> [0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpMod16u { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != 0 || !(x.Op != ssaop.OpConst16 && ssa.UdivisibleOK16(c) && !hasSmallRotate(config)) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMod32u, typ.UInt32) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to32, typ.UInt32) |
| v1.AddArg(x) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.UInt32) |
| v2.AuxInt = ssa.Int32ToAuxInt(int32(uint16(c))) |
| v0.AddArg2(v1, v2) |
| v3 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.UInt32) |
| v3.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, v3) |
| return true |
| } |
| break |
| } |
| // match: (Eq16 (Mod16 x (Const16 [c])) (Const16 [0])) |
| // cond: x.Op != ssaop.OpConst16 && ssa.SdivisibleOK16(c) && !hasSmallRotate(config) |
| // result: (Eq32 (Mod32 <typ.Int32> (SignExt16to32 <typ.Int32> x) (Const32 <typ.Int32> [int32(c)])) (Const32 <typ.Int32> [0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpMod16 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != 0 || !(x.Op != ssaop.OpConst16 && ssa.SdivisibleOK16(c) && !hasSmallRotate(config)) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMod32, typ.Int32) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSignExt16to32, typ.Int32) |
| v1.AddArg(x) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int32) |
| v2.AuxInt = ssa.Int32ToAuxInt(int32(c)) |
| v0.AddArg2(v1, v2) |
| v3 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int32) |
| v3.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, v3) |
| return true |
| } |
| break |
| } |
| // match: (Eq16 s:(Sub16 x y) (Const16 [0])) |
| // cond: s.Uses == 1 |
| // result: (Eq16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| s := v_0 |
| if s.Op != ssaop.OpSub16 { |
| continue |
| } |
| y := s.Args[1] |
| x := s.Args[0] |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != 0 || !(s.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Eq16 (And16 <t> x (Const16 <t> [y])) (Const16 <t> [y])) |
| // cond: ssa.OneBit(y) |
| // result: (Neq16 (And16 <t> x (Const16 <t> [y])) (Const16 <t> [0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd16 { |
| continue |
| } |
| t := v_0.Type |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst16 || v_0_1.Type != t { |
| continue |
| } |
| y := ssa.AuxIntToInt16(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst16 || v_1.Type != t || ssa.AuxIntToInt16(v_1.AuxInt) != y || !(ssa.OneBit(y)) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v1.AuxInt = ssa.Int16ToAuxInt(y) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v2.AuxInt = ssa.Int16ToAuxInt(0) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq16 (ZeroExt8to16 (CvtBoolToUint8 x)) (Const16 [1])) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to16 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != 1 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Eq16 (ZeroExt8to16 (CvtBoolToUint8 x)) (Const16 [0])) |
| // result: (Not x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to16 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpEq32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Eq32 x x) |
| // result: (ConstBool [true]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Eq32 (Const32 <t> [c]) o:(Add32 (Const32 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Eq32 (Const32 <t> [c-d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpAdd32 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq32 (Const32 <t> [c]) o:(Sub32 x (Const32 [d]))) |
| // cond: o.Uses == 1 |
| // result: (Eq32 (Const32 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = o.Args[1] |
| x := o.Args[0] |
| o_1 := o.Args[1] |
| if o_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(o_1.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq32 (Const32 <t> [c]) o:(Sub32 (Const32 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Eq32 (Const32 <t> [d-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub32 { |
| continue |
| } |
| x := o.Args[1] |
| o_0 := o.Args[0] |
| if o_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(o_0.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(d - c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq32 (Const32 <t> [c]) o:(Xor32 (Const32 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Eq32 (Const32 <t> [d^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpXor32 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(d ^ c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq32 (Const32 <t> [c]) o:(Com32 x)) |
| // cond: o.Uses == 1 |
| // result: (Eq32 (Const32 <t> [^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpCom32 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(^c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq32 (Const32 <t> [c]) o:(Neg32 x)) |
| // cond: o.Uses == 1 |
| // result: (Eq32 (Const32 <t> [-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpNeg32 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(-c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq32 (Const32 <t> [c]) o:(Mul32 (Const32 [d]) x)) |
| // cond: uint32(d)%2 == 1 && o.Uses == 1 |
| // result: (Eq32 (Const32 <t> [int32(uint32(c) * uint32(modularMultiplicativeInverse(uint64(d))))]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpMul32 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(o_0.AuxInt) |
| x := o_1 |
| if !(uint32(d)%2 == 1 && o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(int32(uint32(c) * uint32(modularMultiplicativeInverse(uint64(d))))) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq32 (Const32 [c]) (Const32 [d])) |
| // result: (ConstBool [c == d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c == d) |
| return true |
| } |
| break |
| } |
| // match: (Eq32 s:(Sub32 x y) (Const32 [0])) |
| // cond: s.Uses == 1 |
| // result: (Eq32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| s := v_0 |
| if s.Op != ssaop.OpSub32 { |
| continue |
| } |
| y := s.Args[1] |
| x := s.Args[0] |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != 0 || !(s.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Eq32 (And32 <t> x (Const32 <t> [y])) (Const32 <t> [y])) |
| // cond: ssa.OneBit(y) |
| // result: (Neq32 (And32 <t> x (Const32 <t> [y])) (Const32 <t> [0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd32 { |
| continue |
| } |
| t := v_0.Type |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst32 || v_0_1.Type != t { |
| continue |
| } |
| y := ssa.AuxIntToInt32(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst32 || v_1.Type != t || ssa.AuxIntToInt32(v_1.AuxInt) != y || !(ssa.OneBit(y)) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v1.AuxInt = ssa.Int32ToAuxInt(y) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v2.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq32 (ZeroExt8to32 (CvtBoolToUint8 x)) (Const32 [1])) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to32 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != 1 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Eq32 (ZeroExt8to32 (CvtBoolToUint8 x)) (Const32 [0])) |
| // result: (Not x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to32 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpEq32F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Eq32F (Const32F [c]) (Const32F [d])) |
| // result: (ConstBool [c == d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32F { |
| continue |
| } |
| c := ssa.AuxIntToFloat32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32F { |
| continue |
| } |
| d := ssa.AuxIntToFloat32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c == d) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpEq64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Eq64 x x) |
| // result: (ConstBool [true]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Eq64 (Const64 <t> [c]) o:(Add64 (Const64 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Eq64 (Const64 <t> [c-d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpAdd64 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq64 (Const64 <t> [c]) o:(Sub64 x (Const64 [d]))) |
| // cond: o.Uses == 1 |
| // result: (Eq64 (Const64 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = o.Args[1] |
| x := o.Args[0] |
| o_1 := o.Args[1] |
| if o_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(o_1.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq64 (Const64 <t> [c]) o:(Sub64 (Const64 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Eq64 (Const64 <t> [d-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub64 { |
| continue |
| } |
| x := o.Args[1] |
| o_0 := o.Args[0] |
| if o_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(o_0.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(d - c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq64 (Const64 <t> [c]) o:(Xor64 (Const64 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Eq64 (Const64 <t> [d^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpXor64 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(d ^ c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq64 (Const64 <t> [c]) o:(Com64 x)) |
| // cond: o.Uses == 1 |
| // result: (Eq64 (Const64 <t> [^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpCom64 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(^c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq64 (Const64 <t> [c]) o:(Neg64 x)) |
| // cond: o.Uses == 1 |
| // result: (Eq64 (Const64 <t> [-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpNeg64 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(-c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq64 (Const64 <t> [c]) o:(Mul64 (Const64 [d]) x)) |
| // cond: uint64(d)%2 == 1 && o.Uses == 1 |
| // result: (Eq64 (Const64 <t> [int64(uint64(c) * modularMultiplicativeInverse(uint64(d))) ]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpMul64 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(o_0.AuxInt) |
| x := o_1 |
| if !(uint64(d)%2 == 1 && o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint64(c) * modularMultiplicativeInverse(uint64(d)))) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq64 (Const64 [c]) (Const64 [d])) |
| // result: (ConstBool [c == d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c == d) |
| return true |
| } |
| break |
| } |
| // match: (Eq64 s:(Sub64 x y) (Const64 [0])) |
| // cond: s.Uses == 1 |
| // result: (Eq64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| s := v_0 |
| if s.Op != ssaop.OpSub64 { |
| continue |
| } |
| y := s.Args[1] |
| x := s.Args[0] |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 || !(s.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Eq64 (And64 <t> x (Const64 <t> [y])) (Const64 <t> [y])) |
| // cond: ssa.OneBit(y) |
| // result: (Neq64 (And64 <t> x (Const64 <t> [y])) (Const64 <t> [0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd64 { |
| continue |
| } |
| t := v_0.Type |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst64 || v_0_1.Type != t { |
| continue |
| } |
| y := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || v_1.Type != t || ssa.AuxIntToInt64(v_1.AuxInt) != y || !(ssa.OneBit(y)) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v1.AuxInt = ssa.Int64ToAuxInt(y) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v2.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq64 (ZeroExt8to64 (CvtBoolToUint8 x)) (Const64 [1])) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to64 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 1 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Eq64 (ZeroExt8to64 (CvtBoolToUint8 x)) (Const64 [0])) |
| // result: (Not x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to64 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpEq64F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Eq64F (Const64F [c]) (Const64F [d])) |
| // result: (ConstBool [c == d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64F { |
| continue |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64F { |
| continue |
| } |
| d := ssa.AuxIntToFloat64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c == d) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpEq8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| typ := &b.Func.Config.Types |
| // match: (Eq8 x x) |
| // result: (ConstBool [true]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Eq8 (Const8 <t> [c]) o:(Add8 (Const8 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Eq8 (Const8 <t> [c-d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpAdd8 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq8 (Const8 <t> [c]) o:(Sub8 x (Const8 [d]))) |
| // cond: o.Uses == 1 |
| // result: (Eq8 (Const8 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = o.Args[1] |
| x := o.Args[0] |
| o_1 := o.Args[1] |
| if o_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(o_1.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq8 (Const8 <t> [c]) o:(Sub8 (Const8 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Eq8 (Const8 <t> [d-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub8 { |
| continue |
| } |
| x := o.Args[1] |
| o_0 := o.Args[0] |
| if o_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(o_0.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(d - c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq8 (Const8 <t> [c]) o:(Xor8 (Const8 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Eq8 (Const8 <t> [d^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpXor8 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(d ^ c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq8 (Const8 <t> [c]) o:(Com8 x)) |
| // cond: o.Uses == 1 |
| // result: (Eq8 (Const8 <t> [^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpCom8 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(^c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq8 (Const8 <t> [c]) o:(Neg8 x)) |
| // cond: o.Uses == 1 |
| // result: (Eq8 (Const8 <t> [-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpNeg8 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(-c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Eq8 (Const8 <t> [c]) o:(Mul8 (Const8 [d]) x)) |
| // cond: uint8( d)%2 == 1 && o.Uses == 1 |
| // result: (Eq8 (Const8 <t> [int8( uint8( c) * uint8( modularMultiplicativeInverse(uint64(d))))]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpMul8 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(o_0.AuxInt) |
| x := o_1 |
| if !(uint8(d)%2 == 1 && o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(int8(uint8(c) * uint8(modularMultiplicativeInverse(uint64(d))))) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq8 (Const8 [c]) (Const8 [d])) |
| // result: (ConstBool [c == d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c == d) |
| return true |
| } |
| break |
| } |
| // match: (Eq8 (Mod8u x (Const8 [c])) (Const8 [0])) |
| // cond: x.Op != ssaop.OpConst8 && ssa.UdivisibleOK8(c) && !hasSmallRotate(config) |
| // result: (Eq32 (Mod32u <typ.UInt32> (ZeroExt8to32 <typ.UInt32> x) (Const32 <typ.UInt32> [int32(uint8(c))])) (Const32 <typ.UInt32> [0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpMod8u { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != 0 || !(x.Op != ssaop.OpConst8 && ssa.UdivisibleOK8(c) && !hasSmallRotate(config)) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMod32u, typ.UInt32) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, typ.UInt32) |
| v1.AddArg(x) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.UInt32) |
| v2.AuxInt = ssa.Int32ToAuxInt(int32(uint8(c))) |
| v0.AddArg2(v1, v2) |
| v3 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.UInt32) |
| v3.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, v3) |
| return true |
| } |
| break |
| } |
| // match: (Eq8 (Mod8 x (Const8 [c])) (Const8 [0])) |
| // cond: x.Op != ssaop.OpConst8 && ssa.SdivisibleOK8(c) && !hasSmallRotate(config) |
| // result: (Eq32 (Mod32 <typ.Int32> (SignExt8to32 <typ.Int32> x) (Const32 <typ.Int32> [int32(c)])) (Const32 <typ.Int32> [0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpMod8 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != 0 || !(x.Op != ssaop.OpConst8 && ssa.SdivisibleOK8(c) && !hasSmallRotate(config)) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMod32, typ.Int32) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSignExt8to32, typ.Int32) |
| v1.AddArg(x) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int32) |
| v2.AuxInt = ssa.Int32ToAuxInt(int32(c)) |
| v0.AddArg2(v1, v2) |
| v3 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int32) |
| v3.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, v3) |
| return true |
| } |
| break |
| } |
| // match: (Eq8 s:(Sub8 x y) (Const8 [0])) |
| // cond: s.Uses == 1 |
| // result: (Eq8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| s := v_0 |
| if s.Op != ssaop.OpSub8 { |
| continue |
| } |
| y := s.Args[1] |
| x := s.Args[0] |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != 0 || !(s.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpEq8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Eq8 (And8 <t> x (Const8 <t> [y])) (Const8 <t> [y])) |
| // cond: ssa.OneBit(y) |
| // result: (Neq8 (And8 <t> x (Const8 <t> [y])) (Const8 <t> [0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd8 { |
| continue |
| } |
| t := v_0.Type |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst8 || v_0_1.Type != t { |
| continue |
| } |
| y := ssa.AuxIntToInt8(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst8 || v_1.Type != t || ssa.AuxIntToInt8(v_1.AuxInt) != y || !(ssa.OneBit(y)) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v1.AuxInt = ssa.Int8ToAuxInt(y) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v2.AuxInt = ssa.Int8ToAuxInt(0) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Eq8 (CvtBoolToUint8 x) (Const8 [1])) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != 1 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Eq8 (CvtBoolToUint8 x) (Const8 [0])) |
| // result: (Not x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpEqB(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (EqB x x) |
| // result: (ConstBool [true]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (EqB (ConstBool [c]) (ConstBool [d])) |
| // result: (ConstBool [c == d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstBool { |
| continue |
| } |
| c := ssa.AuxIntToBool(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConstBool { |
| continue |
| } |
| d := ssa.AuxIntToBool(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c == d) |
| return true |
| } |
| break |
| } |
| // match: (EqB (ConstBool [false]) x) |
| // result: (Not x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstBool || ssa.AuxIntToBool(v_0.AuxInt) != false { |
| continue |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNot) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (EqB (ConstBool [true]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstBool || ssa.AuxIntToBool(v_0.AuxInt) != true { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (EqB (Not x) y) |
| // result: (NeqB x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNot { |
| continue |
| } |
| x := v_0.Args[0] |
| y := v_1 |
| v.Reset(ssaop.OpNeqB) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpEqInter(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (EqInter x y) |
| // result: (EqPtr (ITab x) (ITab y)) |
| for { |
| x := v_0 |
| y := v_1 |
| v.Reset(ssaop.OpEqPtr) |
| v0 := b.NewValue0(v.Pos, ssaop.OpITab, typ.Uintptr) |
| v0.AddArg(x) |
| v1 := b.NewValue0(v.Pos, ssaop.OpITab, typ.Uintptr) |
| v1.AddArg(y) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| } |
| func rewriteValue_OpEqPtr(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (EqPtr x x) |
| // result: (ConstBool [true]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (EqPtr (Addr {x} _) (Addr {y} _)) |
| // result: (ConstBool [x == y]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0.Aux) |
| if v_1.Op != ssaop.OpAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x == y) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (Addr {x} _) (OffPtr [o] (Addr {y} _))) |
| // result: (ConstBool [x == y && o == 0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0.Aux) |
| if v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o := ssa.AuxIntToInt64(v_1.AuxInt) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1_0.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x == y && o == 0) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (OffPtr [o1] (Addr {x} _)) (OffPtr [o2] (Addr {y} _))) |
| // result: (ConstBool [x == y && o1 == o2]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o1 := ssa.AuxIntToInt64(v_0.AuxInt) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0_0.Aux) |
| if v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o2 := ssa.AuxIntToInt64(v_1.AuxInt) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1_0.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x == y && o1 == o2) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (LocalAddr {x} _ _) (LocalAddr {y} _ _)) |
| // result: (ConstBool [x == y]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLocalAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0.Aux) |
| if v_1.Op != ssaop.OpLocalAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x == y) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (LocalAddr {x} _ _) (OffPtr [o] (LocalAddr {y} _ _))) |
| // result: (ConstBool [x == y && o == 0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLocalAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0.Aux) |
| if v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o := ssa.AuxIntToInt64(v_1.AuxInt) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpLocalAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1_0.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x == y && o == 0) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (OffPtr [o1] (LocalAddr {x} _ _)) (OffPtr [o2] (LocalAddr {y} _ _))) |
| // result: (ConstBool [x == y && o1 == o2]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o1 := ssa.AuxIntToInt64(v_0.AuxInt) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpLocalAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0_0.Aux) |
| if v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o2 := ssa.AuxIntToInt64(v_1.AuxInt) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpLocalAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1_0.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x == y && o1 == o2) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (OffPtr [o1] p1) p2) |
| // cond: ssa.IsSamePtr(p1, p2) |
| // result: (ConstBool [o1 == 0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o1 := ssa.AuxIntToInt64(v_0.AuxInt) |
| p1 := v_0.Args[0] |
| p2 := v_1 |
| if !(ssa.IsSamePtr(p1, p2)) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(o1 == 0) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (OffPtr [o1] p1) (OffPtr [o2] p2)) |
| // cond: ssa.IsSamePtr(p1, p2) |
| // result: (ConstBool [o1 == o2]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o1 := ssa.AuxIntToInt64(v_0.AuxInt) |
| p1 := v_0.Args[0] |
| if v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o2 := ssa.AuxIntToInt64(v_1.AuxInt) |
| p2 := v_1.Args[0] |
| if !(ssa.IsSamePtr(p1, p2)) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(o1 == o2) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (Const32 [c]) (Const32 [d])) |
| // result: (ConstBool [c == d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c == d) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (Const64 [c]) (Const64 [d])) |
| // result: (ConstBool [c == d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c == d) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (Convert (Addr {x} _) _) (Addr {y} _)) |
| // result: (ConstBool [x==y]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConvert { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0_0.Aux) |
| if v_1.Op != ssaop.OpAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x == y) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (LocalAddr _ _) (Addr _)) |
| // result: (ConstBool [false]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLocalAddr || v_1.Op != ssaop.OpAddr { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (OffPtr (LocalAddr _ _)) (Addr _)) |
| // result: (ConstBool [false]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOffPtr { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpLocalAddr || v_1.Op != ssaop.OpAddr { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (LocalAddr _ _) (OffPtr (Addr _))) |
| // result: (ConstBool [false]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLocalAddr || v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAddr { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (OffPtr (LocalAddr _ _)) (OffPtr (Addr _))) |
| // result: (ConstBool [false]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOffPtr { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpLocalAddr || v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAddr { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (AddPtr p1 o1) p2) |
| // cond: ssa.IsSamePtr(p1, p2) |
| // result: (Not (IsNonNil o1)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAddPtr { |
| continue |
| } |
| o1 := v_0.Args[1] |
| p1 := v_0.Args[0] |
| p2 := v_1 |
| if !(ssa.IsSamePtr(p1, p2)) { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpIsNonNil, typ.Bool) |
| v0.AddArg(o1) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (Const32 [0]) p) |
| // result: (Not (IsNonNil p)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| continue |
| } |
| p := v_1 |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpIsNonNil, typ.Bool) |
| v0.AddArg(p) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (Const64 [0]) p) |
| // result: (Not (IsNonNil p)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| continue |
| } |
| p := v_1 |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpIsNonNil, typ.Bool) |
| v0.AddArg(p) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (EqPtr (ConstNil) p) |
| // result: (Not (IsNonNil p)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstNil { |
| continue |
| } |
| p := v_1 |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpIsNonNil, typ.Bool) |
| v0.AddArg(p) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpEqSlice(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (EqSlice x y) |
| // result: (EqPtr (SlicePtr x) (SlicePtr y)) |
| for { |
| x := v_0 |
| y := v_1 |
| v.Reset(ssaop.OpEqPtr) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSlicePtr, typ.BytePtr) |
| v0.AddArg(x) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSlicePtr, typ.BytePtr) |
| v1.AddArg(y) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| } |
| func rewriteValue_OpFloor(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Floor (Const64F [c])) |
| // result: (Const64F [math.Floor(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(math.Floor(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpIMake(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (IMake _typ (StructMake ___)) |
| // result: ssa.ImakeOfStructMake(v) |
| for { |
| if v_1.Op != ssaop.OpStructMake { |
| break |
| } |
| v.CopyOf(ssa.ImakeOfStructMake(v)) |
| return true |
| } |
| // match: (IMake _typ (ArrayMake1 val)) |
| // result: (IMake _typ val) |
| for { |
| _typ := v_0 |
| if v_1.Op != ssaop.OpArrayMake1 { |
| break |
| } |
| val := v_1.Args[0] |
| v.Reset(ssaop.OpIMake) |
| v.AddArg2(_typ, val) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpInterLECall(v *ssa.Value) bool { |
| // match: (InterLECall [argsize] {auxCall} (Addr {fn} (SB)) ___) |
| // result: devirtLECall(v, fn.(*obj.LSym)) |
| for { |
| if len(v.Args) < 1 { |
| break |
| } |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpAddr { |
| break |
| } |
| fn := ssa.AuxToSym(v_0.Aux) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSB { |
| break |
| } |
| v.CopyOf(devirtLECall(v, fn.(*obj.LSym))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpIsInBounds(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (IsInBounds (ZeroExt8to32 _) (Const32 [c])) |
| // cond: (1 << 8) <= c |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to32 || v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !((1 << 8) <= c) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (ZeroExt8to64 _) (Const64 [c])) |
| // cond: (1 << 8) <= c |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to64 || v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !((1 << 8) <= c) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (ZeroExt16to32 _) (Const32 [c])) |
| // cond: (1 << 16) <= c |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt16to32 || v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !((1 << 16) <= c) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (ZeroExt16to64 _) (Const64 [c])) |
| // cond: (1 << 16) <= c |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt16to64 || v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !((1 << 16) <= c) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds x x) |
| // result: (ConstBool [false]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (IsInBounds (And8 (Const8 [c]) _) (Const8 [d])) |
| // cond: 0 <= c && c < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpAnd8 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(0 <= c && c < d) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (IsInBounds (ZeroExt8to16 (And8 (Const8 [c]) _)) (Const16 [d])) |
| // cond: 0 <= c && int16(c) < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to16 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAnd8 { |
| break |
| } |
| v_0_0_0 := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0_0, v_0_0_1 = _i0+1, v_0_0_1, v_0_0_0 { |
| if v_0_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(0 <= c && int16(c) < d) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (IsInBounds (ZeroExt8to32 (And8 (Const8 [c]) _)) (Const32 [d])) |
| // cond: 0 <= c && int32(c) < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to32 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAnd8 { |
| break |
| } |
| v_0_0_0 := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0_0, v_0_0_1 = _i0+1, v_0_0_1, v_0_0_0 { |
| if v_0_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(0 <= c && int32(c) < d) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (IsInBounds (ZeroExt8to64 (And8 (Const8 [c]) _)) (Const64 [d])) |
| // cond: 0 <= c && int64(c) < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to64 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAnd8 { |
| break |
| } |
| v_0_0_0 := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0_0, v_0_0_1 = _i0+1, v_0_0_1, v_0_0_0 { |
| if v_0_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(0 <= c && int64(c) < d) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (IsInBounds (And16 (Const16 [c]) _) (Const16 [d])) |
| // cond: 0 <= c && c < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpAnd16 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(0 <= c && c < d) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (IsInBounds (ZeroExt16to32 (And16 (Const16 [c]) _)) (Const32 [d])) |
| // cond: 0 <= c && int32(c) < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt16to32 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAnd16 { |
| break |
| } |
| v_0_0_0 := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0_0, v_0_0_1 = _i0+1, v_0_0_1, v_0_0_0 { |
| if v_0_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(0 <= c && int32(c) < d) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (IsInBounds (ZeroExt16to64 (And16 (Const16 [c]) _)) (Const64 [d])) |
| // cond: 0 <= c && int64(c) < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt16to64 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAnd16 { |
| break |
| } |
| v_0_0_0 := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0_0, v_0_0_1 = _i0+1, v_0_0_1, v_0_0_0 { |
| if v_0_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(0 <= c && int64(c) < d) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (IsInBounds (And32 (Const32 [c]) _) (Const32 [d])) |
| // cond: 0 <= c && c < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(0 <= c && c < d) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (IsInBounds (ZeroExt32to64 (And32 (Const32 [c]) _)) (Const64 [d])) |
| // cond: 0 <= c && int64(c) < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt32to64 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| v_0_0_0 := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0_0, v_0_0_1 = _i0+1, v_0_0_1, v_0_0_0 { |
| if v_0_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(0 <= c && int64(c) < d) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (IsInBounds (And64 (Const64 [c]) _) (Const64 [d])) |
| // cond: 0 <= c && c < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(0 <= c && c < d) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (IsInBounds (Const32 [c]) (Const32 [d])) |
| // result: (ConstBool [0 <= c && c < d]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(0 <= c && c < d) |
| return true |
| } |
| // match: (IsInBounds (Const64 [c]) (Const64 [d])) |
| // result: (ConstBool [0 <= c && c < d]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(0 <= c && c < d) |
| return true |
| } |
| // match: (IsInBounds (Mod32u _ y) y) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpMod32u { |
| break |
| } |
| y := v_0.Args[1] |
| if y != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (Mod64u _ y) y) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpMod64u { |
| break |
| } |
| y := v_0.Args[1] |
| if y != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (ZeroExt8to64 (Rsh8Ux64 _ (Const64 [c]))) (Const64 [d])) |
| // cond: 0 < c && c < 8 && 1<<uint( 8-c)-1 < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to64 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpRsh8Ux64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(0 < c && c < 8 && 1<<uint(8-c)-1 < d) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (ZeroExt8to32 (Rsh8Ux64 _ (Const64 [c]))) (Const32 [d])) |
| // cond: 0 < c && c < 8 && 1<<uint( 8-c)-1 < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to32 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpRsh8Ux64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(0 < c && c < 8 && 1<<uint(8-c)-1 < d) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (ZeroExt8to16 (Rsh8Ux64 _ (Const64 [c]))) (Const16 [d])) |
| // cond: 0 < c && c < 8 && 1<<uint( 8-c)-1 < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to16 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpRsh8Ux64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(0 < c && c < 8 && 1<<uint(8-c)-1 < d) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (Rsh8Ux64 _ (Const64 [c])) (Const8 [d])) |
| // cond: 0 < c && c < 8 && 1<<uint( 8-c)-1 < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpRsh8Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(0 < c && c < 8 && 1<<uint(8-c)-1 < d) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (ZeroExt16to64 (Rsh16Ux64 _ (Const64 [c]))) (Const64 [d])) |
| // cond: 0 < c && c < 16 && 1<<uint(16-c)-1 < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt16to64 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpRsh16Ux64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(0 < c && c < 16 && 1<<uint(16-c)-1 < d) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (ZeroExt16to32 (Rsh16Ux64 _ (Const64 [c]))) (Const32 [d])) |
| // cond: 0 < c && c < 16 && 1<<uint(16-c)-1 < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt16to32 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpRsh16Ux64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(0 < c && c < 16 && 1<<uint(16-c)-1 < d) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (Rsh16Ux64 _ (Const64 [c])) (Const16 [d])) |
| // cond: 0 < c && c < 16 && 1<<uint(16-c)-1 < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpRsh16Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(0 < c && c < 16 && 1<<uint(16-c)-1 < d) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (ZeroExt32to64 (Rsh32Ux64 _ (Const64 [c]))) (Const64 [d])) |
| // cond: 0 < c && c < 32 && 1<<uint(32-c)-1 < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpZeroExt32to64 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpRsh32Ux64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(0 < c && c < 32 && 1<<uint(32-c)-1 < d) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (Rsh32Ux64 _ (Const64 [c])) (Const32 [d])) |
| // cond: 0 < c && c < 32 && 1<<uint(32-c)-1 < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpRsh32Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(0 < c && c < 32 && 1<<uint(32-c)-1 < d) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsInBounds (Rsh64Ux64 _ (Const64 [c])) (Const64 [d])) |
| // cond: 0 < c && c < 64 && 1<<uint(64-c)-1 < d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpRsh64Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(0 < c && c < 64 && 1<<uint(64-c)-1 < d) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpIsNonNil(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (IsNonNil (ConstNil)) |
| // result: (ConstBool [false]) |
| for { |
| if v_0.Op != ssaop.OpConstNil { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (IsNonNil (Const32 [c])) |
| // result: (ConstBool [c != 0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c != 0) |
| return true |
| } |
| // match: (IsNonNil (Const64 [c])) |
| // result: (ConstBool [c != 0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c != 0) |
| return true |
| } |
| // match: (IsNonNil (Addr _) ) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpAddr { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsNonNil (Convert (Addr _) _)) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConvert { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAddr { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsNonNil (LocalAddr _ _)) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpLocalAddr { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpIsSliceInBounds(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (IsSliceInBounds x x) |
| // result: (ConstBool [true]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsSliceInBounds (And32 (Const32 [c]) _) (Const32 [d])) |
| // cond: 0 <= c && c <= d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(0 <= c && c <= d) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (IsSliceInBounds (And64 (Const64 [c]) _) (Const64 [d])) |
| // cond: 0 <= c && c <= d |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(0 <= c && c <= d) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (IsSliceInBounds (Const32 [0]) _) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsSliceInBounds (Const64 [0]) _) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (IsSliceInBounds (Const32 [c]) (Const32 [d])) |
| // result: (ConstBool [0 <= c && c <= d]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(0 <= c && c <= d) |
| return true |
| } |
| // match: (IsSliceInBounds (Const64 [c]) (Const64 [d])) |
| // result: (ConstBool [0 <= c && c <= d]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(0 <= c && c <= d) |
| return true |
| } |
| // match: (IsSliceInBounds (SliceLen x) (SliceCap x)) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpSliceLen { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpSliceCap || x != v_1.Args[0] { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLeq16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Leq16 (Const16 [c]) (Const16 [d])) |
| // result: (ConstBool [c <= d]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c <= d) |
| return true |
| } |
| // match: (Leq16 (Const16 [0]) (And16 _ (Const16 [c]))) |
| // cond: c >= 0 |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 || v_1.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c >= 0) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (Leq16 (Const16 [0]) (Rsh16Ux64 _ (Const64 [c]))) |
| // cond: c > 0 |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 || v_1.Op != ssaop.OpRsh16Ux64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c > 0) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq16 x (Const16 <t> [0])) |
| // cond: isNonNegative(x) |
| // result: (Eq16 (Const16 <t> [0]) x) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt16(v_1.AuxInt) != 0 || !(isNonNegative(x)) { |
| break |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Leq16 x (Const16 <t> [-1])) |
| // result: (Less16 x (Const16 <t> [0])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt16(v_1.AuxInt) != -1 { |
| break |
| } |
| v.Reset(ssaop.OpLess16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(0) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Leq16 (Const16 <t> [1]) x) |
| // result: (Less16 (Const16 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt16(v_0.AuxInt) != 1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpLess16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Leq16 (Const16 [math.MinInt16]) _) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != math.MinInt16 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq16 _ (Const16 [math.MaxInt16])) |
| // result: (ConstBool [true]) |
| for { |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != math.MaxInt16 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq16 x c:(Const16 [math.MinInt16])) |
| // result: (Eq16 x c) |
| for { |
| x := v_0 |
| c := v_1 |
| if c.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(c.AuxInt) != math.MinInt16 { |
| break |
| } |
| v.Reset(ssaop.OpEq16) |
| v.AddArg2(x, c) |
| return true |
| } |
| // match: (Leq16 c:(Const16 [math.MaxInt16]) x) |
| // result: (Eq16 x c) |
| for { |
| c := v_0 |
| if c.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(c.AuxInt) != math.MaxInt16 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq16) |
| v.AddArg2(x, c) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLeq16U(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Leq16U (Const16 [c]) (Const16 [d])) |
| // result: (ConstBool [uint16(c) <= uint16(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(uint16(c) <= uint16(d)) |
| return true |
| } |
| // match: (Leq16U (Const16 <t> [1]) x) |
| // result: (Neq16 (Const16 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt16(v_0.AuxInt) != 1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Leq16U (Const16 [0]) _) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq16U _ (Const16 [-1])) |
| // result: (ConstBool [true]) |
| for { |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != -1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq16U x c:(Const16 [0])) |
| // result: (Eq16 x c) |
| for { |
| x := v_0 |
| c := v_1 |
| if c.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(c.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpEq16) |
| v.AddArg2(x, c) |
| return true |
| } |
| // match: (Leq16U c:(Const16 [-1]) x) |
| // result: (Eq16 x c) |
| for { |
| c := v_0 |
| if c.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(c.AuxInt) != -1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq16) |
| v.AddArg2(x, c) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLeq32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Leq32 (Const32 [c]) (Const32 [d])) |
| // result: (ConstBool [c <= d]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c <= d) |
| return true |
| } |
| // match: (Leq32 (Const32 [0]) (And32 _ (Const32 [c]))) |
| // cond: c >= 0 |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 || v_1.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c >= 0) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (Leq32 (Const32 [0]) (Rsh32Ux64 _ (Const64 [c]))) |
| // cond: c > 0 |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 || v_1.Op != ssaop.OpRsh32Ux64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c > 0) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq32 x (Const32 <t> [0])) |
| // cond: isNonNegative(x) |
| // result: (Eq32 (Const32 <t> [0]) x) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt32(v_1.AuxInt) != 0 || !(isNonNegative(x)) { |
| break |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Leq32 x (Const32 <t> [-1])) |
| // result: (Less32 x (Const32 <t> [0])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt32(v_1.AuxInt) != -1 { |
| break |
| } |
| v.Reset(ssaop.OpLess32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Leq32 (Const32 <t> [1]) x) |
| // result: (Less32 (Const32 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt32(v_0.AuxInt) != 1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpLess32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Leq32 (Const32 [math.MinInt32]) _) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != math.MinInt32 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq32 _ (Const32 [math.MaxInt32])) |
| // result: (ConstBool [true]) |
| for { |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != math.MaxInt32 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq32 x c:(Const32 [math.MinInt32])) |
| // result: (Eq32 x c) |
| for { |
| x := v_0 |
| c := v_1 |
| if c.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(c.AuxInt) != math.MinInt32 { |
| break |
| } |
| v.Reset(ssaop.OpEq32) |
| v.AddArg2(x, c) |
| return true |
| } |
| // match: (Leq32 c:(Const32 [math.MaxInt32]) x) |
| // result: (Eq32 x c) |
| for { |
| c := v_0 |
| if c.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(c.AuxInt) != math.MaxInt32 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq32) |
| v.AddArg2(x, c) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLeq32F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Leq32F (Const32F [c]) (Const32F [d])) |
| // result: (ConstBool [c <= d]) |
| for { |
| if v_0.Op != ssaop.OpConst32F { |
| break |
| } |
| c := ssa.AuxIntToFloat32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32F { |
| break |
| } |
| d := ssa.AuxIntToFloat32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c <= d) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLeq32U(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Leq32U (Const32 [c]) (Const32 [d])) |
| // result: (ConstBool [uint32(c) <= uint32(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(uint32(c) <= uint32(d)) |
| return true |
| } |
| // match: (Leq32U (Const32 <t> [1]) x) |
| // result: (Neq32 (Const32 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt32(v_0.AuxInt) != 1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Leq32U (Const32 [0]) _) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq32U _ (Const32 [-1])) |
| // result: (ConstBool [true]) |
| for { |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != -1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq32U x c:(Const32 [0])) |
| // result: (Eq32 x c) |
| for { |
| x := v_0 |
| c := v_1 |
| if c.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(c.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpEq32) |
| v.AddArg2(x, c) |
| return true |
| } |
| // match: (Leq32U c:(Const32 [-1]) x) |
| // result: (Eq32 x c) |
| for { |
| c := v_0 |
| if c.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(c.AuxInt) != -1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq32) |
| v.AddArg2(x, c) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLeq64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Leq64 (Const64 [c]) (Const64 [d])) |
| // result: (ConstBool [c <= d]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c <= d) |
| return true |
| } |
| // match: (Leq64 (Const64 [0]) (And64 _ (Const64 [c]))) |
| // cond: c >= 0 |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 || v_1.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= 0) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (Leq64 (Const64 [0]) (Rsh64Ux64 _ (Const64 [c]))) |
| // cond: c > 0 |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 || v_1.Op != ssaop.OpRsh64Ux64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c > 0) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq64 x (Const64 <t> [0])) |
| // cond: isNonNegative(x) |
| // result: (Eq64 (Const64 <t> [0]) x) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt64(v_1.AuxInt) != 0 || !(isNonNegative(x)) { |
| break |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Leq64 x (Const64 <t> [-1])) |
| // result: (Less64 x (Const64 <t> [0])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt64(v_1.AuxInt) != -1 { |
| break |
| } |
| v.Reset(ssaop.OpLess64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Leq64 (Const64 <t> [1]) x) |
| // result: (Less64 (Const64 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt64(v_0.AuxInt) != 1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpLess64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Leq64 (Const64 [math.MinInt64]) _) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != math.MinInt64 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq64 _ (Const64 [math.MaxInt64])) |
| // result: (ConstBool [true]) |
| for { |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != math.MaxInt64 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq64 x c:(Const64 [math.MinInt64])) |
| // result: (Eq64 x c) |
| for { |
| x := v_0 |
| c := v_1 |
| if c.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(c.AuxInt) != math.MinInt64 { |
| break |
| } |
| v.Reset(ssaop.OpEq64) |
| v.AddArg2(x, c) |
| return true |
| } |
| // match: (Leq64 c:(Const64 [math.MaxInt64]) x) |
| // result: (Eq64 x c) |
| for { |
| c := v_0 |
| if c.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(c.AuxInt) != math.MaxInt64 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq64) |
| v.AddArg2(x, c) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLeq64F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Leq64F (Const64F [c]) (Const64F [d])) |
| // result: (ConstBool [c <= d]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64F { |
| break |
| } |
| d := ssa.AuxIntToFloat64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c <= d) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLeq64U(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Leq64U (Const64 [c]) (Const64 [d])) |
| // result: (ConstBool [uint64(c) <= uint64(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(uint64(c) <= uint64(d)) |
| return true |
| } |
| // match: (Leq64U (Const64 <t> [1]) x) |
| // result: (Neq64 (Const64 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt64(v_0.AuxInt) != 1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Leq64U (Const64 [0]) _) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq64U _ (Const64 [-1])) |
| // result: (ConstBool [true]) |
| for { |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != -1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq64U x c:(Const64 [0])) |
| // result: (Eq64 x c) |
| for { |
| x := v_0 |
| c := v_1 |
| if c.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(c.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpEq64) |
| v.AddArg2(x, c) |
| return true |
| } |
| // match: (Leq64U c:(Const64 [-1]) x) |
| // result: (Eq64 x c) |
| for { |
| c := v_0 |
| if c.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(c.AuxInt) != -1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq64) |
| v.AddArg2(x, c) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLeq8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Leq8 (Const8 [c]) (Const8 [d])) |
| // result: (ConstBool [c <= d]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c <= d) |
| return true |
| } |
| // match: (Leq8 (Const8 [0]) (And8 _ (Const8 [c]))) |
| // cond: c >= 0 |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 || v_1.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c >= 0) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (Leq8 (Const8 [0]) (Rsh8Ux64 _ (Const64 [c]))) |
| // cond: c > 0 |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 || v_1.Op != ssaop.OpRsh8Ux64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c > 0) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq8 x (Const8 <t> [0])) |
| // cond: isNonNegative(x) |
| // result: (Eq8 (Const8 <t> [0]) x) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt8(v_1.AuxInt) != 0 || !(isNonNegative(x)) { |
| break |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Leq8 x (Const8 <t> [-1])) |
| // result: (Less8 x (Const8 <t> [0])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt8(v_1.AuxInt) != -1 { |
| break |
| } |
| v.Reset(ssaop.OpLess8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(0) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Leq8 (Const8 <t> [1]) x) |
| // result: (Less8 (Const8 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt8(v_0.AuxInt) != 1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpLess8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Leq8 (Const8 [math.MinInt8 ]) _) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != math.MinInt8 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq8 _ (Const8 [math.MaxInt8 ])) |
| // result: (ConstBool [true]) |
| for { |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != math.MaxInt8 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq8 x c:(Const8 [math.MinInt8 ])) |
| // result: (Eq8 x c) |
| for { |
| x := v_0 |
| c := v_1 |
| if c.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(c.AuxInt) != math.MinInt8 { |
| break |
| } |
| v.Reset(ssaop.OpEq8) |
| v.AddArg2(x, c) |
| return true |
| } |
| // match: (Leq8 c:(Const8 [math.MaxInt8 ]) x) |
| // result: (Eq8 x c) |
| for { |
| c := v_0 |
| if c.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(c.AuxInt) != math.MaxInt8 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq8) |
| v.AddArg2(x, c) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLeq8U(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Leq8U (Const8 [c]) (Const8 [d])) |
| // result: (ConstBool [ uint8(c) <= uint8(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(uint8(c) <= uint8(d)) |
| return true |
| } |
| // match: (Leq8U (Const8 <t> [1]) x) |
| // result: (Neq8 (Const8 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt8(v_0.AuxInt) != 1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Leq8U (Const8 [0]) _) |
| // result: (ConstBool [true]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq8U _ (Const8 [-1])) |
| // result: (ConstBool [true]) |
| for { |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != -1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (Leq8U x c:(Const8 [0])) |
| // result: (Eq8 x c) |
| for { |
| x := v_0 |
| c := v_1 |
| if c.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(c.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpEq8) |
| v.AddArg2(x, c) |
| return true |
| } |
| // match: (Leq8U c:(Const8 [-1]) x) |
| // result: (Eq8 x c) |
| for { |
| c := v_0 |
| if c.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(c.AuxInt) != -1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq8) |
| v.AddArg2(x, c) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLess16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Less16 (Const16 [c]) (Const16 [d])) |
| // result: (ConstBool [c < d]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c < d) |
| return true |
| } |
| // match: (Less16 (Const16 <t> [0]) x) |
| // cond: isNonNegative(x) |
| // result: (Neq16 (Const16 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| x := v_1 |
| if !(isNonNegative(x)) { |
| break |
| } |
| v.Reset(ssaop.OpNeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less16 x (Const16 <t> [1])) |
| // result: (Leq16 x (Const16 <t> [0])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt16(v_1.AuxInt) != 1 { |
| break |
| } |
| v.Reset(ssaop.OpLeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(0) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Less16 (Const16 <t> [-1]) x) |
| // result: (Leq16 (Const16 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt16(v_0.AuxInt) != -1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpLeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less16 _ (Const16 [math.MinInt16])) |
| // result: (ConstBool [false]) |
| for { |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != math.MinInt16 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less16 (Const16 [math.MaxInt16]) _) |
| // result: (ConstBool [false]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != math.MaxInt16 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less16 x (Const16 <t> [math.MinInt16+1])) |
| // result: (Eq16 x (Const16 <t> [math.MinInt16])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt16(v_1.AuxInt) != math.MinInt16+1 { |
| break |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(math.MinInt16) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Less16 (Const16 <t> [math.MaxInt16-1]) x) |
| // result: (Eq16 x (Const16 <t> [math.MaxInt16])) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt16(v_0.AuxInt) != math.MaxInt16-1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(math.MaxInt16) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLess16U(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Less16U (Const16 [c]) (Const16 [d])) |
| // result: (ConstBool [uint16(c) < uint16(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(uint16(c) < uint16(d)) |
| return true |
| } |
| // match: (Less16U (Const16 <t> [0]) x) |
| // result: (Neq16 (Const16 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less16U x (Const16 <t> [1])) |
| // result: (Eq16 (Const16 <t> [0]) x) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt16(v_1.AuxInt) != 1 { |
| break |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less16U _ (Const16 [0])) |
| // result: (ConstBool [false]) |
| for { |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less16U (Const16 [-1]) _) |
| // result: (ConstBool [false]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != -1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less16U x (Const16 <t> [1])) |
| // result: (Eq16 x (Const16 <t> [0])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt16(v_1.AuxInt) != 1 { |
| break |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(0) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Less16U (Const16 <t> [-2]) x) |
| // result: (Eq16 x (Const16 <t> [-1])) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt16(v_0.AuxInt) != -2 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(-1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLess32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Less32 (Const32 [c]) (Const32 [d])) |
| // result: (ConstBool [c < d]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c < d) |
| return true |
| } |
| // match: (Less32 (Const32 <t> [0]) x) |
| // cond: isNonNegative(x) |
| // result: (Neq32 (Const32 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| x := v_1 |
| if !(isNonNegative(x)) { |
| break |
| } |
| v.Reset(ssaop.OpNeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less32 x (Const32 <t> [1])) |
| // result: (Leq32 x (Const32 <t> [0])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt32(v_1.AuxInt) != 1 { |
| break |
| } |
| v.Reset(ssaop.OpLeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Less32 (Const32 <t> [-1]) x) |
| // result: (Leq32 (Const32 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt32(v_0.AuxInt) != -1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpLeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less32 _ (Const32 [math.MinInt32])) |
| // result: (ConstBool [false]) |
| for { |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != math.MinInt32 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less32 (Const32 [math.MaxInt32]) _) |
| // result: (ConstBool [false]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != math.MaxInt32 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less32 x (Const32 <t> [math.MinInt32+1])) |
| // result: (Eq32 x (Const32 <t> [math.MinInt32])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt32(v_1.AuxInt) != math.MinInt32+1 { |
| break |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(math.MinInt32) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Less32 (Const32 <t> [math.MaxInt32-1]) x) |
| // result: (Eq32 x (Const32 <t> [math.MaxInt32])) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt32(v_0.AuxInt) != math.MaxInt32-1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(math.MaxInt32) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLess32F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Less32F (Const32F [c]) (Const32F [d])) |
| // result: (ConstBool [c < d]) |
| for { |
| if v_0.Op != ssaop.OpConst32F { |
| break |
| } |
| c := ssa.AuxIntToFloat32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32F { |
| break |
| } |
| d := ssa.AuxIntToFloat32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c < d) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLess32U(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Less32U (Const32 [c]) (Const32 [d])) |
| // result: (ConstBool [uint32(c) < uint32(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(uint32(c) < uint32(d)) |
| return true |
| } |
| // match: (Less32U (Const32 <t> [0]) x) |
| // result: (Neq32 (Const32 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less32U x (Const32 <t> [1])) |
| // result: (Eq32 (Const32 <t> [0]) x) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt32(v_1.AuxInt) != 1 { |
| break |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less32U _ (Const32 [0])) |
| // result: (ConstBool [false]) |
| for { |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less32U (Const32 [-1]) _) |
| // result: (ConstBool [false]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != -1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less32U x (Const32 <t> [1])) |
| // result: (Eq32 x (Const32 <t> [0])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt32(v_1.AuxInt) != 1 { |
| break |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Less32U (Const32 <t> [-2]) x) |
| // result: (Eq32 x (Const32 <t> [-1])) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt32(v_0.AuxInt) != -2 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(-1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLess64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Less64 (Const64 [c]) (Const64 [d])) |
| // result: (ConstBool [c < d]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c < d) |
| return true |
| } |
| // match: (Less64 (Const64 <t> [0]) x) |
| // cond: isNonNegative(x) |
| // result: (Neq64 (Const64 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| x := v_1 |
| if !(isNonNegative(x)) { |
| break |
| } |
| v.Reset(ssaop.OpNeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less64 x (Const64 <t> [1])) |
| // result: (Leq64 x (Const64 <t> [0])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt64(v_1.AuxInt) != 1 { |
| break |
| } |
| v.Reset(ssaop.OpLeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Less64 (Const64 <t> [-1]) x) |
| // result: (Leq64 (Const64 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt64(v_0.AuxInt) != -1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpLeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less64 _ (Const64 [math.MinInt64])) |
| // result: (ConstBool [false]) |
| for { |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != math.MinInt64 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less64 (Const64 [math.MaxInt64]) _) |
| // result: (ConstBool [false]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != math.MaxInt64 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less64 x (Const64 <t> [math.MinInt64+1])) |
| // result: (Eq64 x (Const64 <t> [math.MinInt64])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt64(v_1.AuxInt) != math.MinInt64+1 { |
| break |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(math.MinInt64) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Less64 (Const64 <t> [math.MaxInt64-1]) x) |
| // result: (Eq64 x (Const64 <t> [math.MaxInt64])) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt64(v_0.AuxInt) != math.MaxInt64-1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(math.MaxInt64) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLess64F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Less64F (Const64F [c]) (Const64F [d])) |
| // result: (ConstBool [c < d]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64F { |
| break |
| } |
| d := ssa.AuxIntToFloat64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c < d) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLess64U(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Less64U (Const64 [c]) (Const64 [d])) |
| // result: (ConstBool [uint64(c) < uint64(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(uint64(c) < uint64(d)) |
| return true |
| } |
| // match: (Less64U (Const64 <t> [0]) x) |
| // result: (Neq64 (Const64 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less64U x (Const64 <t> [1])) |
| // result: (Eq64 (Const64 <t> [0]) x) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt64(v_1.AuxInt) != 1 { |
| break |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less64U _ (Const64 [0])) |
| // result: (ConstBool [false]) |
| for { |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less64U (Const64 [-1]) _) |
| // result: (ConstBool [false]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != -1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less64U x (Const64 <t> [1])) |
| // result: (Eq64 x (Const64 <t> [0])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt64(v_1.AuxInt) != 1 { |
| break |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Less64U (Const64 <t> [-2]) x) |
| // result: (Eq64 x (Const64 <t> [-1])) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt64(v_0.AuxInt) != -2 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(-1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLess8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Less8 (Const8 [c]) (Const8 [d])) |
| // result: (ConstBool [c < d]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c < d) |
| return true |
| } |
| // match: (Less8 (Const8 <t> [0]) x) |
| // cond: isNonNegative(x) |
| // result: (Neq8 (Const8 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| x := v_1 |
| if !(isNonNegative(x)) { |
| break |
| } |
| v.Reset(ssaop.OpNeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less8 x (Const8 <t> [1])) |
| // result: (Leq8 x (Const8 <t> [0])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt8(v_1.AuxInt) != 1 { |
| break |
| } |
| v.Reset(ssaop.OpLeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(0) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Less8 (Const8 <t> [-1]) x) |
| // result: (Leq8 (Const8 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt8(v_0.AuxInt) != -1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpLeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less8 _ (Const8 [math.MinInt8 ])) |
| // result: (ConstBool [false]) |
| for { |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != math.MinInt8 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less8 (Const8 [math.MaxInt8 ]) _) |
| // result: (ConstBool [false]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != math.MaxInt8 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less8 x (Const8 <t> [math.MinInt8 +1])) |
| // result: (Eq8 x (Const8 <t> [math.MinInt8 ])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt8(v_1.AuxInt) != math.MinInt8+1 { |
| break |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(math.MinInt8) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Less8 (Const8 <t> [math.MaxInt8 -1]) x) |
| // result: (Eq8 x (Const8 <t> [math.MaxInt8 ])) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt8(v_0.AuxInt) != math.MaxInt8-1 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(math.MaxInt8) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLess8U(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Less8U (Const8 [c]) (Const8 [d])) |
| // result: (ConstBool [ uint8(c) < uint8(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(uint8(c) < uint8(d)) |
| return true |
| } |
| // match: (Less8U (Const8 <t> [0]) x) |
| // result: (Neq8 (Const8 <t> [0]) x) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less8U x (Const8 <t> [1])) |
| // result: (Eq8 (Const8 <t> [0]) x) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt8(v_1.AuxInt) != 1 { |
| break |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(0) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Less8U _ (Const8 [0])) |
| // result: (ConstBool [false]) |
| for { |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less8U (Const8 [-1]) _) |
| // result: (ConstBool [false]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != -1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Less8U x (Const8 <t> [1])) |
| // result: (Eq8 x (Const8 <t> [0])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt8(v_1.AuxInt) != 1 { |
| break |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(0) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Less8U (Const8 <t> [-2]) x) |
| // result: (Eq8 x (Const8 <t> [-1])) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_0.Type |
| if ssa.AuxIntToInt8(v_0.AuxInt) != -2 { |
| break |
| } |
| x := v_1 |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(-1) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLoad(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| typ := &b.Func.Config.Types |
| // match: (Load <t1> p1 (Store {t2} p2 x _)) |
| // cond: ssa.IsSamePtr(p1, p2) && copyCompatibleType(t1, x.Type) && t1.Size() == t2.Size() |
| // result: x |
| for { |
| t1 := v.Type |
| p1 := v_0 |
| if v_1.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(v_1.Aux) |
| x := v_1.Args[1] |
| p2 := v_1.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && copyCompatibleType(t1, x.Type) && t1.Size() == t2.Size()) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Load <t1> p1 (Store {t2} p2 _ (Store {t3} p3 x _))) |
| // cond: ssa.IsSamePtr(p1, p3) && copyCompatibleType(t1, x.Type) && t1.Size() == t3.Size() && ssa.Disjoint(p3, t3, p2, t2) |
| // result: x |
| for { |
| t1 := v.Type |
| p1 := v_0 |
| if v_1.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(v_1.Aux) |
| _ = v_1.Args[2] |
| p2 := v_1.Args[0] |
| v_1_2 := v_1.Args[2] |
| if v_1_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(v_1_2.Aux) |
| x := v_1_2.Args[1] |
| p3 := v_1_2.Args[0] |
| if !(ssa.IsSamePtr(p1, p3) && copyCompatibleType(t1, x.Type) && t1.Size() == t3.Size() && ssa.Disjoint(p3, t3, p2, t2)) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Load <t1> p1 (Store {t2} p2 _ (Store {t3} p3 _ (Store {t4} p4 x _)))) |
| // cond: ssa.IsSamePtr(p1, p4) && copyCompatibleType(t1, x.Type) && t1.Size() == t4.Size() && ssa.Disjoint(p4, t4, p2, t2) && ssa.Disjoint(p4, t4, p3, t3) |
| // result: x |
| for { |
| t1 := v.Type |
| p1 := v_0 |
| if v_1.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(v_1.Aux) |
| _ = v_1.Args[2] |
| p2 := v_1.Args[0] |
| v_1_2 := v_1.Args[2] |
| if v_1_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(v_1_2.Aux) |
| _ = v_1_2.Args[2] |
| p3 := v_1_2.Args[0] |
| v_1_2_2 := v_1_2.Args[2] |
| if v_1_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(v_1_2_2.Aux) |
| x := v_1_2_2.Args[1] |
| p4 := v_1_2_2.Args[0] |
| if !(ssa.IsSamePtr(p1, p4) && copyCompatibleType(t1, x.Type) && t1.Size() == t4.Size() && ssa.Disjoint(p4, t4, p2, t2) && ssa.Disjoint(p4, t4, p3, t3)) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Load <t1> p1 (Store {t2} p2 _ (Store {t3} p3 _ (Store {t4} p4 _ (Store {t5} p5 x _))))) |
| // cond: ssa.IsSamePtr(p1, p5) && copyCompatibleType(t1, x.Type) && t1.Size() == t5.Size() && ssa.Disjoint(p5, t5, p2, t2) && ssa.Disjoint(p5, t5, p3, t3) && ssa.Disjoint(p5, t5, p4, t4) |
| // result: x |
| for { |
| t1 := v.Type |
| p1 := v_0 |
| if v_1.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(v_1.Aux) |
| _ = v_1.Args[2] |
| p2 := v_1.Args[0] |
| v_1_2 := v_1.Args[2] |
| if v_1_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(v_1_2.Aux) |
| _ = v_1_2.Args[2] |
| p3 := v_1_2.Args[0] |
| v_1_2_2 := v_1_2.Args[2] |
| if v_1_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(v_1_2_2.Aux) |
| _ = v_1_2_2.Args[2] |
| p4 := v_1_2_2.Args[0] |
| v_1_2_2_2 := v_1_2_2.Args[2] |
| if v_1_2_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t5 := ssa.AuxToType(v_1_2_2_2.Aux) |
| x := v_1_2_2_2.Args[1] |
| p5 := v_1_2_2_2.Args[0] |
| if !(ssa.IsSamePtr(p1, p5) && copyCompatibleType(t1, x.Type) && t1.Size() == t5.Size() && ssa.Disjoint(p5, t5, p2, t2) && ssa.Disjoint(p5, t5, p3, t3) && ssa.Disjoint(p5, t5, p4, t4)) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Load <t1> op1:(OffPtr [o1] p1) move:(Move [n] p2 src mem)) |
| // cond: o1 >= 0 && o1+t1.Size() <= n && ssa.IsSamePtr(p1, p2) && !ssa.IsVolatile(src) |
| // result: @move.Block (Load <t1> (OffPtr <op1.Type> [o1] src) mem) |
| for { |
| t1 := v.Type |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| move := v_1 |
| if move.Op != ssaop.OpMove { |
| break |
| } |
| n := ssa.AuxIntToInt64(move.AuxInt) |
| mem := move.Args[2] |
| p2 := move.Args[0] |
| src := move.Args[1] |
| if !(o1 >= 0 && o1+t1.Size() <= n && ssa.IsSamePtr(p1, p2) && !ssa.IsVolatile(src)) { |
| break |
| } |
| b = move.Block |
| v0 := b.NewValue0(v.Pos, ssaop.OpLoad, t1) |
| v.CopyOf(v0) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOffPtr, op1.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(o1) |
| v1.AddArg(src) |
| v0.AddArg2(v1, mem) |
| return true |
| } |
| // match: (Load <t1> p1 (Store {t2} p2 (Const64 [x]) _)) |
| // cond: ssa.IsSamePtr(p1,p2) && t2.Size() == 8 && ssa.Is64BitFloat(t1) && !math.IsNaN(math.Float64frombits(uint64(x))) |
| // result: (Const64F [math.Float64frombits(uint64(x))]) |
| for { |
| t1 := v.Type |
| p1 := v_0 |
| if v_1.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(v_1.Aux) |
| _ = v_1.Args[1] |
| p2 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| break |
| } |
| x := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(ssa.IsSamePtr(p1, p2) && t2.Size() == 8 && ssa.Is64BitFloat(t1) && !math.IsNaN(math.Float64frombits(uint64(x)))) { |
| break |
| } |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(math.Float64frombits(uint64(x))) |
| return true |
| } |
| // match: (Load <t1> p1 (Store {t2} p2 (Const32 [x]) _)) |
| // cond: ssa.IsSamePtr(p1,p2) && t2.Size() == 4 && ssa.Is32BitFloat(t1) && !math.IsNaN(float64(math.Float32frombits(uint32(x)))) |
| // result: (Const32F [math.Float32frombits(uint32(x))]) |
| for { |
| t1 := v.Type |
| p1 := v_0 |
| if v_1.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(v_1.Aux) |
| _ = v_1.Args[1] |
| p2 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| break |
| } |
| x := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(ssa.IsSamePtr(p1, p2) && t2.Size() == 4 && ssa.Is32BitFloat(t1) && !math.IsNaN(float64(math.Float32frombits(uint32(x))))) { |
| break |
| } |
| v.Reset(ssaop.OpConst32F) |
| v.AuxInt = ssa.Float32ToAuxInt(math.Float32frombits(uint32(x))) |
| return true |
| } |
| // match: (Load <t1> p1 (Store {t2} p2 (Const64F [x]) _)) |
| // cond: ssa.IsSamePtr(p1,p2) && t2.Size() == 8 && ssa.Is64BitInt(t1) |
| // result: (Const64 [int64(math.Float64bits(x))]) |
| for { |
| t1 := v.Type |
| p1 := v_0 |
| if v_1.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(v_1.Aux) |
| _ = v_1.Args[1] |
| p2 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64F { |
| break |
| } |
| x := ssa.AuxIntToFloat64(v_1_1.AuxInt) |
| if !(ssa.IsSamePtr(p1, p2) && t2.Size() == 8 && ssa.Is64BitInt(t1)) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(math.Float64bits(x))) |
| return true |
| } |
| // match: (Load <t1> p1 (Store {t2} p2 (Const32F [x]) _)) |
| // cond: ssa.IsSamePtr(p1,p2) && t2.Size() == 4 && ssa.Is32BitInt(t1) |
| // result: (Const32 [int32(math.Float32bits(x))]) |
| for { |
| t1 := v.Type |
| p1 := v_0 |
| if v_1.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(v_1.Aux) |
| _ = v_1.Args[1] |
| p2 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32F { |
| break |
| } |
| x := ssa.AuxIntToFloat32(v_1_1.AuxInt) |
| if !(ssa.IsSamePtr(p1, p2) && t2.Size() == 4 && ssa.Is32BitInt(t1)) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(math.Float32bits(x))) |
| return true |
| } |
| // match: (Load <t1> op1:(OffPtr [o1] p1) (Store {t2} p2 _ mem:(Zero [n] p3 _))) |
| // cond: o1 >= 0 && o1+t1.Size() <= n && ssa.IsSamePtr(p1, p3) && ssa.CanSSA(t1) && ssa.Disjoint(op1, t1, p2, t2) |
| // result: @mem.Block (Load <t1> (OffPtr <op1.Type> [o1] p3) mem) |
| for { |
| t1 := v.Type |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| if v_1.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(v_1.Aux) |
| _ = v_1.Args[2] |
| p2 := v_1.Args[0] |
| mem := v_1.Args[2] |
| if mem.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(mem.AuxInt) |
| p3 := mem.Args[0] |
| if !(o1 >= 0 && o1+t1.Size() <= n && ssa.IsSamePtr(p1, p3) && ssa.CanSSA(t1) && ssa.Disjoint(op1, t1, p2, t2)) { |
| break |
| } |
| b = mem.Block |
| v0 := b.NewValue0(v.Pos, ssaop.OpLoad, t1) |
| v.CopyOf(v0) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOffPtr, op1.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(o1) |
| v1.AddArg(p3) |
| v0.AddArg2(v1, mem) |
| return true |
| } |
| // match: (Load <t1> op1:(OffPtr [o1] p1) (Store {t2} p2 _ (Store {t3} p3 _ mem:(Zero [n] p4 _)))) |
| // cond: o1 >= 0 && o1+t1.Size() <= n && ssa.IsSamePtr(p1, p4) && ssa.CanSSA(t1) && ssa.Disjoint(op1, t1, p2, t2) && ssa.Disjoint(op1, t1, p3, t3) |
| // result: @mem.Block (Load <t1> (OffPtr <op1.Type> [o1] p4) mem) |
| for { |
| t1 := v.Type |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| if v_1.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(v_1.Aux) |
| _ = v_1.Args[2] |
| p2 := v_1.Args[0] |
| v_1_2 := v_1.Args[2] |
| if v_1_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(v_1_2.Aux) |
| _ = v_1_2.Args[2] |
| p3 := v_1_2.Args[0] |
| mem := v_1_2.Args[2] |
| if mem.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(mem.AuxInt) |
| p4 := mem.Args[0] |
| if !(o1 >= 0 && o1+t1.Size() <= n && ssa.IsSamePtr(p1, p4) && ssa.CanSSA(t1) && ssa.Disjoint(op1, t1, p2, t2) && ssa.Disjoint(op1, t1, p3, t3)) { |
| break |
| } |
| b = mem.Block |
| v0 := b.NewValue0(v.Pos, ssaop.OpLoad, t1) |
| v.CopyOf(v0) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOffPtr, op1.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(o1) |
| v1.AddArg(p4) |
| v0.AddArg2(v1, mem) |
| return true |
| } |
| // match: (Load <t1> op1:(OffPtr [o1] p1) (Store {t2} p2 _ (Store {t3} p3 _ (Store {t4} p4 _ mem:(Zero [n] p5 _))))) |
| // cond: o1 >= 0 && o1+t1.Size() <= n && ssa.IsSamePtr(p1, p5) && ssa.CanSSA(t1) && ssa.Disjoint(op1, t1, p2, t2) && ssa.Disjoint(op1, t1, p3, t3) && ssa.Disjoint(op1, t1, p4, t4) |
| // result: @mem.Block (Load <t1> (OffPtr <op1.Type> [o1] p5) mem) |
| for { |
| t1 := v.Type |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| if v_1.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(v_1.Aux) |
| _ = v_1.Args[2] |
| p2 := v_1.Args[0] |
| v_1_2 := v_1.Args[2] |
| if v_1_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(v_1_2.Aux) |
| _ = v_1_2.Args[2] |
| p3 := v_1_2.Args[0] |
| v_1_2_2 := v_1_2.Args[2] |
| if v_1_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(v_1_2_2.Aux) |
| _ = v_1_2_2.Args[2] |
| p4 := v_1_2_2.Args[0] |
| mem := v_1_2_2.Args[2] |
| if mem.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(mem.AuxInt) |
| p5 := mem.Args[0] |
| if !(o1 >= 0 && o1+t1.Size() <= n && ssa.IsSamePtr(p1, p5) && ssa.CanSSA(t1) && ssa.Disjoint(op1, t1, p2, t2) && ssa.Disjoint(op1, t1, p3, t3) && ssa.Disjoint(op1, t1, p4, t4)) { |
| break |
| } |
| b = mem.Block |
| v0 := b.NewValue0(v.Pos, ssaop.OpLoad, t1) |
| v.CopyOf(v0) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOffPtr, op1.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(o1) |
| v1.AddArg(p5) |
| v0.AddArg2(v1, mem) |
| return true |
| } |
| // match: (Load <t1> op1:(OffPtr [o1] p1) (Store {t2} p2 _ (Store {t3} p3 _ (Store {t4} p4 _ (Store {t5} p5 _ mem:(Zero [n] p6 _)))))) |
| // cond: o1 >= 0 && o1+t1.Size() <= n && ssa.IsSamePtr(p1, p6) && ssa.CanSSA(t1) && ssa.Disjoint(op1, t1, p2, t2) && ssa.Disjoint(op1, t1, p3, t3) && ssa.Disjoint(op1, t1, p4, t4) && ssa.Disjoint(op1, t1, p5, t5) |
| // result: @mem.Block (Load <t1> (OffPtr <op1.Type> [o1] p6) mem) |
| for { |
| t1 := v.Type |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| if v_1.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(v_1.Aux) |
| _ = v_1.Args[2] |
| p2 := v_1.Args[0] |
| v_1_2 := v_1.Args[2] |
| if v_1_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(v_1_2.Aux) |
| _ = v_1_2.Args[2] |
| p3 := v_1_2.Args[0] |
| v_1_2_2 := v_1_2.Args[2] |
| if v_1_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(v_1_2_2.Aux) |
| _ = v_1_2_2.Args[2] |
| p4 := v_1_2_2.Args[0] |
| v_1_2_2_2 := v_1_2_2.Args[2] |
| if v_1_2_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t5 := ssa.AuxToType(v_1_2_2_2.Aux) |
| _ = v_1_2_2_2.Args[2] |
| p5 := v_1_2_2_2.Args[0] |
| mem := v_1_2_2_2.Args[2] |
| if mem.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(mem.AuxInt) |
| p6 := mem.Args[0] |
| if !(o1 >= 0 && o1+t1.Size() <= n && ssa.IsSamePtr(p1, p6) && ssa.CanSSA(t1) && ssa.Disjoint(op1, t1, p2, t2) && ssa.Disjoint(op1, t1, p3, t3) && ssa.Disjoint(op1, t1, p4, t4) && ssa.Disjoint(op1, t1, p5, t5)) { |
| break |
| } |
| b = mem.Block |
| v0 := b.NewValue0(v.Pos, ssaop.OpLoad, t1) |
| v.CopyOf(v0) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOffPtr, op1.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(o1) |
| v1.AddArg(p6) |
| v0.AddArg2(v1, mem) |
| return true |
| } |
| // match: (Load <t1> (OffPtr [o] p1) (Zero [n] p2 _)) |
| // cond: t1.IsBoolean() && ssa.IsSamePtr(p1, p2) && n >= o + 1 |
| // result: (ConstBool [false]) |
| for { |
| t1 := v.Type |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| o := ssa.AuxIntToInt64(v_0.AuxInt) |
| p1 := v_0.Args[0] |
| if v_1.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(v_1.AuxInt) |
| p2 := v_1.Args[0] |
| if !(t1.IsBoolean() && ssa.IsSamePtr(p1, p2) && n >= o+1) { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Load <t1> (OffPtr [o] p1) (Zero [n] p2 _)) |
| // cond: ssa.Is8BitInt(t1) && ssa.IsSamePtr(p1, p2) && n >= o + 1 |
| // result: (Const8 [0]) |
| for { |
| t1 := v.Type |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| o := ssa.AuxIntToInt64(v_0.AuxInt) |
| p1 := v_0.Args[0] |
| if v_1.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(v_1.AuxInt) |
| p2 := v_1.Args[0] |
| if !(ssa.Is8BitInt(t1) && ssa.IsSamePtr(p1, p2) && n >= o+1) { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Load <t1> (OffPtr [o] p1) (Zero [n] p2 _)) |
| // cond: ssa.Is16BitInt(t1) && ssa.IsSamePtr(p1, p2) && n >= o + 2 |
| // result: (Const16 [0]) |
| for { |
| t1 := v.Type |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| o := ssa.AuxIntToInt64(v_0.AuxInt) |
| p1 := v_0.Args[0] |
| if v_1.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(v_1.AuxInt) |
| p2 := v_1.Args[0] |
| if !(ssa.Is16BitInt(t1) && ssa.IsSamePtr(p1, p2) && n >= o+2) { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Load <t1> (OffPtr [o] p1) (Zero [n] p2 _)) |
| // cond: ssa.Is32BitInt(t1) && ssa.IsSamePtr(p1, p2) && n >= o + 4 |
| // result: (Const32 [0]) |
| for { |
| t1 := v.Type |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| o := ssa.AuxIntToInt64(v_0.AuxInt) |
| p1 := v_0.Args[0] |
| if v_1.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(v_1.AuxInt) |
| p2 := v_1.Args[0] |
| if !(ssa.Is32BitInt(t1) && ssa.IsSamePtr(p1, p2) && n >= o+4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Load <t1> (OffPtr [o] p1) (Zero [n] p2 _)) |
| // cond: ssa.Is64BitInt(t1) && ssa.IsSamePtr(p1, p2) && n >= o + 8 |
| // result: (Const64 [0]) |
| for { |
| t1 := v.Type |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| o := ssa.AuxIntToInt64(v_0.AuxInt) |
| p1 := v_0.Args[0] |
| if v_1.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(v_1.AuxInt) |
| p2 := v_1.Args[0] |
| if !(ssa.Is64BitInt(t1) && ssa.IsSamePtr(p1, p2) && n >= o+8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Load <t1> (OffPtr [o] p1) (Zero [n] p2 _)) |
| // cond: ssa.Is32BitFloat(t1) && ssa.IsSamePtr(p1, p2) && n >= o + 4 |
| // result: (Const32F [0]) |
| for { |
| t1 := v.Type |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| o := ssa.AuxIntToInt64(v_0.AuxInt) |
| p1 := v_0.Args[0] |
| if v_1.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(v_1.AuxInt) |
| p2 := v_1.Args[0] |
| if !(ssa.Is32BitFloat(t1) && ssa.IsSamePtr(p1, p2) && n >= o+4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32F) |
| v.AuxInt = ssa.Float32ToAuxInt(0) |
| return true |
| } |
| // match: (Load <t1> (OffPtr [o] p1) (Zero [n] p2 _)) |
| // cond: ssa.Is64BitFloat(t1) && ssa.IsSamePtr(p1, p2) && n >= o + 8 |
| // result: (Const64F [0]) |
| for { |
| t1 := v.Type |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| o := ssa.AuxIntToInt64(v_0.AuxInt) |
| p1 := v_0.Args[0] |
| if v_1.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(v_1.AuxInt) |
| p2 := v_1.Args[0] |
| if !(ssa.Is64BitFloat(t1) && ssa.IsSamePtr(p1, p2) && n >= o+8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(0) |
| return true |
| } |
| // match: (Load <t> _ _) |
| // cond: t.IsStruct() && t.Size() > 0 && ssa.CanSSA(t) && !t.IsSIMD() |
| // result: rewriteStructLoad(v) |
| for { |
| t := v.Type |
| if !(t.IsStruct() && t.Size() > 0 && ssa.CanSSA(t) && !t.IsSIMD()) { |
| break |
| } |
| v.CopyOf(rewriteStructLoad(v)) |
| return true |
| } |
| // match: (Load <t> ptr mem) |
| // cond: t.IsArray() && t.NumElem() == 1 && t.Size() > 0 && ssa.CanSSA(t) |
| // result: (ArrayMake1 (Load <t.Elem()> ptr mem)) |
| for { |
| t := v.Type |
| ptr := v_0 |
| mem := v_1 |
| if !(t.IsArray() && t.NumElem() == 1 && t.Size() > 0 && ssa.CanSSA(t)) { |
| break |
| } |
| v.Reset(ssaop.OpArrayMake1) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLoad, t.Elem()) |
| v0.AddArg2(ptr, mem) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Load <t> _ _) |
| // cond: t.Size() == 0 |
| // result: (Empty) |
| for { |
| t := v.Type |
| if !(t.Size() == 0) { |
| break |
| } |
| v.Reset(ssaop.OpEmpty) |
| return true |
| } |
| // match: (Load <typ.Int8> sptr:(Addr {scon} (SB)) mem) |
| // cond: ssa.SymIsRO(scon) |
| // result: (Const8 <typ.Int8> [int8(ssa.Read8(scon,0))]) |
| for { |
| if v.Type != typ.Int8 { |
| break |
| } |
| sptr := v_0 |
| if sptr.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(sptr.Aux) |
| sptr_0 := sptr.Args[0] |
| if sptr_0.Op != ssaop.OpSB { |
| break |
| } |
| if !(ssa.SymIsRO(scon)) { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.Type = typ.Int8 |
| v.AuxInt = ssa.Int8ToAuxInt(int8(ssa.Read8(scon, 0))) |
| return true |
| } |
| // match: (Load <typ.Int16> sptr:(Addr {scon} (SB)) mem) |
| // cond: ssa.SymIsRO(scon) |
| // result: (Const16 <typ.Int16> [int16(ssa.Read16(scon,0,config.Ctxt.Arch.ByteOrder))]) |
| for { |
| if v.Type != typ.Int16 { |
| break |
| } |
| sptr := v_0 |
| if sptr.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(sptr.Aux) |
| sptr_0 := sptr.Args[0] |
| if sptr_0.Op != ssaop.OpSB { |
| break |
| } |
| if !(ssa.SymIsRO(scon)) { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.Type = typ.Int16 |
| v.AuxInt = ssa.Int16ToAuxInt(int16(ssa.Read16(scon, 0, config.Ctxt.Arch.ByteOrder))) |
| return true |
| } |
| // match: (Load <typ.Int32> sptr:(Addr {scon} (SB)) mem) |
| // cond: ssa.SymIsRO(scon) |
| // result: (Const32 <typ.Int32> [int32(ssa.Read32(scon,0,config.Ctxt.Arch.ByteOrder))]) |
| for { |
| if v.Type != typ.Int32 { |
| break |
| } |
| sptr := v_0 |
| if sptr.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(sptr.Aux) |
| sptr_0 := sptr.Args[0] |
| if sptr_0.Op != ssaop.OpSB { |
| break |
| } |
| if !(ssa.SymIsRO(scon)) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.Type = typ.Int32 |
| v.AuxInt = ssa.Int32ToAuxInt(int32(ssa.Read32(scon, 0, config.Ctxt.Arch.ByteOrder))) |
| return true |
| } |
| // match: (Load <typ.Int64> sptr:(Addr {scon} (SB)) mem) |
| // cond: ssa.SymIsRO(scon) |
| // result: (Const64 <typ.Int64> [int64(ssa.Read64(scon,0,config.Ctxt.Arch.ByteOrder))]) |
| for { |
| if v.Type != typ.Int64 { |
| break |
| } |
| sptr := v_0 |
| if sptr.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(sptr.Aux) |
| sptr_0 := sptr.Args[0] |
| if sptr_0.Op != ssaop.OpSB { |
| break |
| } |
| if !(ssa.SymIsRO(scon)) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.Type = typ.Int64 |
| v.AuxInt = ssa.Int64ToAuxInt(int64(ssa.Read64(scon, 0, config.Ctxt.Arch.ByteOrder))) |
| return true |
| } |
| // match: (Load (Addr {s} sb) _) |
| // cond: isFixedLoad(v, s, 0) |
| // result: rewriteFixedLoad(v, s, sb, 0) |
| for { |
| if v_0.Op != ssaop.OpAddr { |
| break |
| } |
| s := ssa.AuxToSym(v_0.Aux) |
| sb := v_0.Args[0] |
| if !(isFixedLoad(v, s, 0)) { |
| break |
| } |
| v.CopyOf(rewriteFixedLoad(v, s, sb, 0)) |
| return true |
| } |
| // match: (Load (Convert (Addr {s} sb) _) _) |
| // cond: isFixedLoad(v, s, 0) |
| // result: rewriteFixedLoad(v, s, sb, 0) |
| for { |
| if v_0.Op != ssaop.OpConvert { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAddr { |
| break |
| } |
| s := ssa.AuxToSym(v_0_0.Aux) |
| sb := v_0_0.Args[0] |
| if !(isFixedLoad(v, s, 0)) { |
| break |
| } |
| v.CopyOf(rewriteFixedLoad(v, s, sb, 0)) |
| return true |
| } |
| // match: (Load (ITab (IMake (Addr {s} sb) _)) _) |
| // cond: isFixedLoad(v, s, 0) |
| // result: rewriteFixedLoad(v, s, sb, 0) |
| for { |
| if v_0.Op != ssaop.OpITab { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpIMake { |
| break |
| } |
| v_0_0_0 := v_0_0.Args[0] |
| if v_0_0_0.Op != ssaop.OpAddr { |
| break |
| } |
| s := ssa.AuxToSym(v_0_0_0.Aux) |
| sb := v_0_0_0.Args[0] |
| if !(isFixedLoad(v, s, 0)) { |
| break |
| } |
| v.CopyOf(rewriteFixedLoad(v, s, sb, 0)) |
| return true |
| } |
| // match: (Load (ITab (IMake (Convert (Addr {s} sb) _) _)) _) |
| // cond: isFixedLoad(v, s, 0) |
| // result: rewriteFixedLoad(v, s, sb, 0) |
| for { |
| if v_0.Op != ssaop.OpITab { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpIMake { |
| break |
| } |
| v_0_0_0 := v_0_0.Args[0] |
| if v_0_0_0.Op != ssaop.OpConvert { |
| break |
| } |
| v_0_0_0_0 := v_0_0_0.Args[0] |
| if v_0_0_0_0.Op != ssaop.OpAddr { |
| break |
| } |
| s := ssa.AuxToSym(v_0_0_0_0.Aux) |
| sb := v_0_0_0_0.Args[0] |
| if !(isFixedLoad(v, s, 0)) { |
| break |
| } |
| v.CopyOf(rewriteFixedLoad(v, s, sb, 0)) |
| return true |
| } |
| // match: (Load (OffPtr [off] (Addr {s} sb) ) _) |
| // cond: isFixedLoad(v, s, off) |
| // result: rewriteFixedLoad(v, s, sb, off) |
| for { |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| off := ssa.AuxIntToInt64(v_0.AuxInt) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAddr { |
| break |
| } |
| s := ssa.AuxToSym(v_0_0.Aux) |
| sb := v_0_0.Args[0] |
| if !(isFixedLoad(v, s, off)) { |
| break |
| } |
| v.CopyOf(rewriteFixedLoad(v, s, sb, off)) |
| return true |
| } |
| // match: (Load (OffPtr [off] (Convert (Addr {s} sb) _) ) _) |
| // cond: isFixedLoad(v, s, off) |
| // result: rewriteFixedLoad(v, s, sb, off) |
| for { |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| off := ssa.AuxIntToInt64(v_0.AuxInt) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConvert { |
| break |
| } |
| v_0_0_0 := v_0_0.Args[0] |
| if v_0_0_0.Op != ssaop.OpAddr { |
| break |
| } |
| s := ssa.AuxToSym(v_0_0_0.Aux) |
| sb := v_0_0_0.Args[0] |
| if !(isFixedLoad(v, s, off)) { |
| break |
| } |
| v.CopyOf(rewriteFixedLoad(v, s, sb, off)) |
| return true |
| } |
| // match: (Load (OffPtr [off] (ITab (IMake (Addr {s} sb) _))) _) |
| // cond: isFixedLoad(v, s, off) |
| // result: rewriteFixedLoad(v, s, sb, off) |
| for { |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| off := ssa.AuxIntToInt64(v_0.AuxInt) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpITab { |
| break |
| } |
| v_0_0_0 := v_0_0.Args[0] |
| if v_0_0_0.Op != ssaop.OpIMake { |
| break |
| } |
| v_0_0_0_0 := v_0_0_0.Args[0] |
| if v_0_0_0_0.Op != ssaop.OpAddr { |
| break |
| } |
| s := ssa.AuxToSym(v_0_0_0_0.Aux) |
| sb := v_0_0_0_0.Args[0] |
| if !(isFixedLoad(v, s, off)) { |
| break |
| } |
| v.CopyOf(rewriteFixedLoad(v, s, sb, off)) |
| return true |
| } |
| // match: (Load (OffPtr [off] (ITab (IMake (Convert (Addr {s} sb) _) _))) _) |
| // cond: isFixedLoad(v, s, off) |
| // result: rewriteFixedLoad(v, s, sb, off) |
| for { |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| off := ssa.AuxIntToInt64(v_0.AuxInt) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpITab { |
| break |
| } |
| v_0_0_0 := v_0_0.Args[0] |
| if v_0_0_0.Op != ssaop.OpIMake { |
| break |
| } |
| v_0_0_0_0 := v_0_0_0.Args[0] |
| if v_0_0_0_0.Op != ssaop.OpConvert { |
| break |
| } |
| v_0_0_0_0_0 := v_0_0_0_0.Args[0] |
| if v_0_0_0_0_0.Op != ssaop.OpAddr { |
| break |
| } |
| s := ssa.AuxToSym(v_0_0_0_0_0.Aux) |
| sb := v_0_0_0_0_0.Args[0] |
| if !(isFixedLoad(v, s, off)) { |
| break |
| } |
| v.CopyOf(rewriteFixedLoad(v, s, sb, off)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh16x16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Lsh16x16 x (Const16 [c])) |
| // result: (Lsh16x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint16(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpLsh16x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh16x16 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh16x16 [false] x con:(Const16 [c])) |
| // cond: 0 < c && c < 16 |
| // result: (Lsh16x16 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(con.AuxInt) |
| if !(0 < c && c < 16) { |
| break |
| } |
| v.Reset(ssaop.OpLsh16x16) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh16x32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Lsh16x32 x (Const32 [c])) |
| // result: (Lsh16x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint32(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpLsh16x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh16x32 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh16x32 [false] x con:(Const32 [c])) |
| // cond: 0 < c && c < 16 |
| // result: (Lsh16x32 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(con.AuxInt) |
| if !(0 < c && c < 16) { |
| break |
| } |
| v.Reset(ssaop.OpLsh16x32) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh16x64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Lsh16x64 (Const16 [c]) (Const64 [d])) |
| // result: (Const16 [c << uint64(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(c << uint64(d)) |
| return true |
| } |
| // match: (Lsh16x64 x (Const64 [0])) |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Lsh16x64 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh16x64 _ (Const64 [c])) |
| // cond: uint64(c) >= 16 |
| // result: (Const16 [0]) |
| for { |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c) >= 16) { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh16x64 <t> (Lsh16x64 x (Const64 [c])) (Const64 [d])) |
| // cond: !uaddOvf(c,d) |
| // result: (Lsh16x64 x (Const64 <t> [c+d])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpLsh16x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(!uaddOvf(c, d)) { |
| break |
| } |
| v.Reset(ssaop.OpLsh16x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh16x64 i:(Rsh16x64 x (Const64 [c])) (Const64 [c])) |
| // cond: c >= 0 && c < 16 && i.Uses == 1 |
| // result: (And16 x (Const16 <v.Type> [int16(-1) << c])) |
| for { |
| i := v_0 |
| if i.Op != ssaop.OpRsh16x64 { |
| break |
| } |
| _ = i.Args[1] |
| x := i.Args[0] |
| i_1 := i.Args[1] |
| if i_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(i_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c || !(c >= 0 && c < 16 && i.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAnd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, v.Type) |
| v0.AuxInt = ssa.Int16ToAuxInt(int16(-1) << c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh16x64 i:(Rsh16Ux64 x (Const64 [c])) (Const64 [c])) |
| // cond: c >= 0 && c < 16 && i.Uses == 1 |
| // result: (And16 x (Const16 <v.Type> [int16(-1) << c])) |
| for { |
| i := v_0 |
| if i.Op != ssaop.OpRsh16Ux64 { |
| break |
| } |
| _ = i.Args[1] |
| x := i.Args[0] |
| i_1 := i.Args[1] |
| if i_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(i_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c || !(c >= 0 && c < 16 && i.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAnd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, v.Type) |
| v0.AuxInt = ssa.Int16ToAuxInt(int16(-1) << c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh16x64 (Rsh16Ux64 (Lsh16x64 x (Const64 [c1])) (Const64 [c2])) (Const64 [c3])) |
| // cond: uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3) |
| // result: (Lsh16x64 x (Const64 <typ.UInt64> [c1-c2+c3])) |
| for { |
| if v_0.Op != ssaop.OpRsh16Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpLsh16x64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c1 := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c2 := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c3 := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3)) { |
| break |
| } |
| v.Reset(ssaop.OpLsh16x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(c1 - c2 + c3) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh16x64 (And16 (Rsh16x64 <t> x (Const64 <t2> [c])) (Const16 [d])) (Const64 [e])) |
| // cond: c >= e |
| // result: (And16 (Rsh16x64 <t> x (Const64 <t2> [c-e])) (Const16 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh16x64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c >= e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpRsh16x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(c - e) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v2.AuxInt = ssa.Int16ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh16x64 (And16 (Rsh16Ux64 <t> x (Const64 <t2> [c])) (Const16 [d])) (Const64 [e])) |
| // cond: c >= e |
| // result: (And16 (Rsh16Ux64 <t> x (Const64 <t2> [c-e])) (Const16 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh16Ux64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c >= e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpRsh16Ux64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(c - e) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v2.AuxInt = ssa.Int16ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh16x64 (And16 (Rsh16x64 <t> x (Const64 <t2> [c])) (Const16 [d])) (Const64 [e])) |
| // cond: c < e |
| // result: (And16 (Lsh16x64 <t> x (Const64 <t2> [e-c])) (Const16 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh16x64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c < e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLsh16x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(e - c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v2.AuxInt = ssa.Int16ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh16x64 (And16 (Rsh16Ux64 <t> x (Const64 <t2> [c])) (Const16 [d])) (Const64 [e])) |
| // cond: c < e |
| // result: (And16 (Lsh16x64 <t> x (Const64 <t2> [e-c])) (Const16 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh16Ux64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c < e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLsh16x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(e - c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v2.AuxInt = ssa.Int16ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh16x64 [false] x con:(Const64 [c])) |
| // cond: 0 < c && c < 16 |
| // result: (Lsh16x64 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(con.AuxInt) |
| if !(0 < c && c < 16) { |
| break |
| } |
| v.Reset(ssaop.OpLsh16x64) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh16x8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Lsh16x8 x (Const8 [c])) |
| // result: (Lsh16x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint8(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpLsh16x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh16x8 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh16x8 [false] x con:(Const8 [c])) |
| // cond: 0 < c && c < 16 |
| // result: (Lsh16x8 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(con.AuxInt) |
| if !(0 < c && c < 16) { |
| break |
| } |
| v.Reset(ssaop.OpLsh16x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh32x16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Lsh32x16 x (Const16 [c])) |
| // result: (Lsh32x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint16(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpLsh32x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh32x16 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh32x16 [false] x con:(Const16 [c])) |
| // cond: 0 < c && c < 32 |
| // result: (Lsh32x16 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(con.AuxInt) |
| if !(0 < c && c < 32) { |
| break |
| } |
| v.Reset(ssaop.OpLsh32x16) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh32x32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Lsh32x32 x (Const32 [c])) |
| // result: (Lsh32x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint32(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpLsh32x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh32x32 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh32x32 [false] x con:(Const32 [c])) |
| // cond: 0 < c && c < 32 |
| // result: (Lsh32x32 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(con.AuxInt) |
| if !(0 < c && c < 32) { |
| break |
| } |
| v.Reset(ssaop.OpLsh32x32) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh32x64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Lsh32x64 (Const32 [c]) (Const64 [d])) |
| // result: (Const32 [c << uint64(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(c << uint64(d)) |
| return true |
| } |
| // match: (Lsh32x64 x (Const64 [0])) |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Lsh32x64 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh32x64 _ (Const64 [c])) |
| // cond: uint64(c) >= 32 |
| // result: (Const32 [0]) |
| for { |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c) >= 32) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh32x64 <t> (Lsh32x64 x (Const64 [c])) (Const64 [d])) |
| // cond: !uaddOvf(c,d) |
| // result: (Lsh32x64 x (Const64 <t> [c+d])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpLsh32x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(!uaddOvf(c, d)) { |
| break |
| } |
| v.Reset(ssaop.OpLsh32x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh32x64 i:(Rsh32x64 x (Const64 [c])) (Const64 [c])) |
| // cond: c >= 0 && c < 32 && i.Uses == 1 |
| // result: (And32 x (Const32 <v.Type> [int32(-1) << c])) |
| for { |
| i := v_0 |
| if i.Op != ssaop.OpRsh32x64 { |
| break |
| } |
| _ = i.Args[1] |
| x := i.Args[0] |
| i_1 := i.Args[1] |
| if i_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(i_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c || !(c >= 0 && c < 32 && i.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAnd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, v.Type) |
| v0.AuxInt = ssa.Int32ToAuxInt(int32(-1) << c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh32x64 i:(Rsh32Ux64 x (Const64 [c])) (Const64 [c])) |
| // cond: c >= 0 && c < 32 && i.Uses == 1 |
| // result: (And32 x (Const32 <v.Type> [int32(-1) << c])) |
| for { |
| i := v_0 |
| if i.Op != ssaop.OpRsh32Ux64 { |
| break |
| } |
| _ = i.Args[1] |
| x := i.Args[0] |
| i_1 := i.Args[1] |
| if i_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(i_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c || !(c >= 0 && c < 32 && i.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAnd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, v.Type) |
| v0.AuxInt = ssa.Int32ToAuxInt(int32(-1) << c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh32x64 (Rsh32Ux64 (Lsh32x64 x (Const64 [c1])) (Const64 [c2])) (Const64 [c3])) |
| // cond: uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3) |
| // result: (Lsh32x64 x (Const64 <typ.UInt64> [c1-c2+c3])) |
| for { |
| if v_0.Op != ssaop.OpRsh32Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpLsh32x64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c1 := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c2 := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c3 := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3)) { |
| break |
| } |
| v.Reset(ssaop.OpLsh32x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(c1 - c2 + c3) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh32x64 (And32 (Rsh32x64 <t> x (Const64 <t2> [c])) (Const32 [d])) (Const64 [e])) |
| // cond: c >= e |
| // result: (And32 (Rsh32x64 <t> x (Const64 <t2> [c-e])) (Const32 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh32x64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c >= e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpRsh32x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(c - e) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v2.AuxInt = ssa.Int32ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh32x64 (And32 (Rsh32Ux64 <t> x (Const64 <t2> [c])) (Const32 [d])) (Const64 [e])) |
| // cond: c >= e |
| // result: (And32 (Rsh32Ux64 <t> x (Const64 <t2> [c-e])) (Const32 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh32Ux64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c >= e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpRsh32Ux64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(c - e) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v2.AuxInt = ssa.Int32ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh32x64 (And32 (Rsh32x64 <t> x (Const64 <t2> [c])) (Const32 [d])) (Const64 [e])) |
| // cond: c < e |
| // result: (And32 (Lsh32x64 <t> x (Const64 <t2> [e-c])) (Const32 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh32x64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c < e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLsh32x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(e - c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v2.AuxInt = ssa.Int32ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh32x64 (And32 (Rsh32Ux64 <t> x (Const64 <t2> [c])) (Const32 [d])) (Const64 [e])) |
| // cond: c < e |
| // result: (And32 (Lsh32x64 <t> x (Const64 <t2> [e-c])) (Const32 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh32Ux64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c < e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLsh32x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(e - c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v2.AuxInt = ssa.Int32ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh32x64 [false] x con:(Const64 [c])) |
| // cond: 0 < c && c < 32 |
| // result: (Lsh32x64 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(con.AuxInt) |
| if !(0 < c && c < 32) { |
| break |
| } |
| v.Reset(ssaop.OpLsh32x64) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh32x8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Lsh32x8 x (Const8 [c])) |
| // result: (Lsh32x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint8(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpLsh32x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh32x8 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh32x8 [false] x con:(Const8 [c])) |
| // cond: 0 < c && c < 32 |
| // result: (Lsh32x8 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(con.AuxInt) |
| if !(0 < c && c < 32) { |
| break |
| } |
| v.Reset(ssaop.OpLsh32x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh64x16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Lsh64x16 x (Const16 [c])) |
| // result: (Lsh64x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint16(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpLsh64x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh64x16 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh64x16 [false] x con:(Const16 [c])) |
| // cond: 0 < c && c < 64 |
| // result: (Lsh64x16 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(con.AuxInt) |
| if !(0 < c && c < 64) { |
| break |
| } |
| v.Reset(ssaop.OpLsh64x16) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh64x32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Lsh64x32 x (Const32 [c])) |
| // result: (Lsh64x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint32(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpLsh64x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh64x32 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh64x32 [false] x con:(Const32 [c])) |
| // cond: 0 < c && c < 64 |
| // result: (Lsh64x32 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(con.AuxInt) |
| if !(0 < c && c < 64) { |
| break |
| } |
| v.Reset(ssaop.OpLsh64x32) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh64x64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Lsh64x64 (Const64 [c]) (Const64 [d])) |
| // result: (Const64 [c << uint64(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(c << uint64(d)) |
| return true |
| } |
| // match: (Lsh64x64 x (Const64 [0])) |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Lsh64x64 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh64x64 _ (Const64 [c])) |
| // cond: uint64(c) >= 64 |
| // result: (Const64 [0]) |
| for { |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c) >= 64) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh64x64 <t> (Lsh64x64 x (Const64 [c])) (Const64 [d])) |
| // cond: !uaddOvf(c,d) |
| // result: (Lsh64x64 x (Const64 <t> [c+d])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpLsh64x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(!uaddOvf(c, d)) { |
| break |
| } |
| v.Reset(ssaop.OpLsh64x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh64x64 i:(Rsh64x64 x (Const64 [c])) (Const64 [c])) |
| // cond: c >= 0 && c < 64 && i.Uses == 1 |
| // result: (And64 x (Const64 <v.Type> [int64(-1) << c])) |
| for { |
| i := v_0 |
| if i.Op != ssaop.OpRsh64x64 { |
| break |
| } |
| _ = i.Args[1] |
| x := i.Args[0] |
| i_1 := i.Args[1] |
| if i_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(i_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c || !(c >= 0 && c < 64 && i.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAnd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, v.Type) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(-1) << c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh64x64 i:(Rsh64Ux64 x (Const64 [c])) (Const64 [c])) |
| // cond: c >= 0 && c < 64 && i.Uses == 1 |
| // result: (And64 x (Const64 <v.Type> [int64(-1) << c])) |
| for { |
| i := v_0 |
| if i.Op != ssaop.OpRsh64Ux64 { |
| break |
| } |
| _ = i.Args[1] |
| x := i.Args[0] |
| i_1 := i.Args[1] |
| if i_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(i_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c || !(c >= 0 && c < 64 && i.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAnd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, v.Type) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(-1) << c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh64x64 (Rsh64Ux64 (Lsh64x64 x (Const64 [c1])) (Const64 [c2])) (Const64 [c3])) |
| // cond: uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3) |
| // result: (Lsh64x64 x (Const64 <typ.UInt64> [c1-c2+c3])) |
| for { |
| if v_0.Op != ssaop.OpRsh64Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpLsh64x64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c1 := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c2 := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c3 := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3)) { |
| break |
| } |
| v.Reset(ssaop.OpLsh64x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(c1 - c2 + c3) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh64x64 (And64 (Rsh64x64 <t> x (Const64 <t2> [c])) (Const64 [d])) (Const64 [e])) |
| // cond: c >= e |
| // result: (And64 (Rsh64x64 <t> x (Const64 <t2> [c-e])) (Const64 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh64x64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c >= e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpRsh64x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(c - e) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v2.AuxInt = ssa.Int64ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh64x64 (And64 (Rsh64Ux64 <t> x (Const64 <t2> [c])) (Const64 [d])) (Const64 [e])) |
| // cond: c >= e |
| // result: (And64 (Rsh64Ux64 <t> x (Const64 <t2> [c-e])) (Const64 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh64Ux64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c >= e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpRsh64Ux64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(c - e) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v2.AuxInt = ssa.Int64ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh64x64 (And64 (Rsh64x64 <t> x (Const64 <t2> [c])) (Const64 [d])) (Const64 [e])) |
| // cond: c < e |
| // result: (And64 (Lsh64x64 <t> x (Const64 <t2> [e-c])) (Const64 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh64x64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c < e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLsh64x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(e - c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v2.AuxInt = ssa.Int64ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh64x64 (And64 (Rsh64Ux64 <t> x (Const64 <t2> [c])) (Const64 [d])) (Const64 [e])) |
| // cond: c < e |
| // result: (And64 (Lsh64x64 <t> x (Const64 <t2> [e-c])) (Const64 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh64Ux64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c < e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLsh64x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(e - c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v2.AuxInt = ssa.Int64ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh64x64 [false] x con:(Const64 [c])) |
| // cond: 0 < c && c < 64 |
| // result: (Lsh64x64 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(con.AuxInt) |
| if !(0 < c && c < 64) { |
| break |
| } |
| v.Reset(ssaop.OpLsh64x64) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh64x8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Lsh64x8 x (Const8 [c])) |
| // result: (Lsh64x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint8(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpLsh64x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh64x8 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh64x8 [false] x con:(Const8 [c])) |
| // cond: 0 < c && c < 64 |
| // result: (Lsh64x8 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(con.AuxInt) |
| if !(0 < c && c < 64) { |
| break |
| } |
| v.Reset(ssaop.OpLsh64x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh8x16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Lsh8x16 x (Const16 [c])) |
| // result: (Lsh8x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint16(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpLsh8x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh8x16 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh8x16 [false] x con:(Const16 [c])) |
| // cond: 0 < c && c < 8 |
| // result: (Lsh8x16 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(con.AuxInt) |
| if !(0 < c && c < 8) { |
| break |
| } |
| v.Reset(ssaop.OpLsh8x16) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh8x32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Lsh8x32 x (Const32 [c])) |
| // result: (Lsh8x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint32(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpLsh8x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh8x32 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh8x32 [false] x con:(Const32 [c])) |
| // cond: 0 < c && c < 8 |
| // result: (Lsh8x32 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(con.AuxInt) |
| if !(0 < c && c < 8) { |
| break |
| } |
| v.Reset(ssaop.OpLsh8x32) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh8x64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Lsh8x64 (Const8 [c]) (Const64 [d])) |
| // result: (Const8 [c << uint64(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(c << uint64(d)) |
| return true |
| } |
| // match: (Lsh8x64 x (Const64 [0])) |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Lsh8x64 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh8x64 _ (Const64 [c])) |
| // cond: uint64(c) >= 8 |
| // result: (Const8 [0]) |
| for { |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c) >= 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh8x64 <t> (Lsh8x64 x (Const64 [c])) (Const64 [d])) |
| // cond: !uaddOvf(c,d) |
| // result: (Lsh8x64 x (Const64 <t> [c+d])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpLsh8x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(!uaddOvf(c, d)) { |
| break |
| } |
| v.Reset(ssaop.OpLsh8x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh8x64 i:(Rsh8x64 x (Const64 [c])) (Const64 [c])) |
| // cond: c >= 0 && c < 8 && i.Uses == 1 |
| // result: (And8 x (Const8 <v.Type> [int8(-1) << c])) |
| for { |
| i := v_0 |
| if i.Op != ssaop.OpRsh8x64 { |
| break |
| } |
| _ = i.Args[1] |
| x := i.Args[0] |
| i_1 := i.Args[1] |
| if i_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(i_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c || !(c >= 0 && c < 8 && i.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAnd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, v.Type) |
| v0.AuxInt = ssa.Int8ToAuxInt(int8(-1) << c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh8x64 i:(Rsh8Ux64 x (Const64 [c])) (Const64 [c])) |
| // cond: c >= 0 && c < 8 && i.Uses == 1 |
| // result: (And8 x (Const8 <v.Type> [int8(-1) << c])) |
| for { |
| i := v_0 |
| if i.Op != ssaop.OpRsh8Ux64 { |
| break |
| } |
| _ = i.Args[1] |
| x := i.Args[0] |
| i_1 := i.Args[1] |
| if i_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(i_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c || !(c >= 0 && c < 8 && i.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAnd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, v.Type) |
| v0.AuxInt = ssa.Int8ToAuxInt(int8(-1) << c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh8x64 (Rsh8Ux64 (Lsh8x64 x (Const64 [c1])) (Const64 [c2])) (Const64 [c3])) |
| // cond: uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3) |
| // result: (Lsh8x64 x (Const64 <typ.UInt64> [c1-c2+c3])) |
| for { |
| if v_0.Op != ssaop.OpRsh8Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpLsh8x64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c1 := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c2 := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c3 := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3)) { |
| break |
| } |
| v.Reset(ssaop.OpLsh8x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(c1 - c2 + c3) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh8x64 (And8 (Rsh8x64 <t> x (Const64 <t2> [c])) (Const8 [d])) (Const64 [e])) |
| // cond: c >= e |
| // result: (And8 (Rsh8x64 <t> x (Const64 <t2> [c-e])) (Const8 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh8x64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c >= e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpRsh8x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(c - e) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v2.AuxInt = ssa.Int8ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh8x64 (And8 (Rsh8Ux64 <t> x (Const64 <t2> [c])) (Const8 [d])) (Const64 [e])) |
| // cond: c >= e |
| // result: (And8 (Rsh8Ux64 <t> x (Const64 <t2> [c-e])) (Const8 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh8Ux64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c >= e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpRsh8Ux64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(c - e) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v2.AuxInt = ssa.Int8ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh8x64 (And8 (Rsh8x64 <t> x (Const64 <t2> [c])) (Const8 [d])) (Const64 [e])) |
| // cond: c < e |
| // result: (And8 (Lsh8x64 <t> x (Const64 <t2> [e-c])) (Const8 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh8x64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c < e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLsh8x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(e - c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v2.AuxInt = ssa.Int8ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh8x64 (And8 (Rsh8Ux64 <t> x (Const64 <t2> [c])) (Const8 [d])) (Const64 [e])) |
| // cond: c < e |
| // result: (And8 (Lsh8x64 <t> x (Const64 <t2> [e-c])) (Const8 <t> [d<<e])) |
| for { |
| if v_0.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpRsh8Ux64 { |
| continue |
| } |
| t := v_0_0.Type |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t2 := v_0_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| if v_0_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| e := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c < e) { |
| continue |
| } |
| v.Reset(ssaop.OpAnd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLsh8x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t2) |
| v1.AuxInt = ssa.Int64ToAuxInt(e - c) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v2.AuxInt = ssa.Int8ToAuxInt(d << e) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| // match: (Lsh8x64 [false] x con:(Const64 [c])) |
| // cond: 0 < c && c < 8 |
| // result: (Lsh8x64 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(con.AuxInt) |
| if !(0 < c && c < 8) { |
| break |
| } |
| v.Reset(ssaop.OpLsh8x64) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpLsh8x8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Lsh8x8 x (Const8 [c])) |
| // result: (Lsh8x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint8(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpLsh8x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Lsh8x8 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Lsh8x8 [false] x con:(Const8 [c])) |
| // cond: 0 < c && c < 8 |
| // result: (Lsh8x8 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(con.AuxInt) |
| if !(0 < c && c < 8) { |
| break |
| } |
| v.Reset(ssaop.OpLsh8x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpMemEq(v *ssa.Value) bool { |
| v_3 := v.Args[3] |
| v_2 := v.Args[2] |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| typ := &b.Func.Config.Types |
| // match: (MemEq sptr tptr (Const64 [1]) mem) |
| // result: (Eq8 (Load <typ.Int8> sptr mem) (Load <typ.Int8> tptr mem)) |
| for { |
| sptr := v_0 |
| tptr := v_1 |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 1 { |
| break |
| } |
| mem := v_3 |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int8) |
| v0.AddArg2(sptr, mem) |
| v1 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int8) |
| v1.AddArg2(tptr, mem) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| // match: (MemEq sptr tptr (Const64 [2]) mem) |
| // cond: canLoadUnaligned(config) |
| // result: (Eq16 (Load <typ.Int16> sptr mem) (Load <typ.Int16> tptr mem)) |
| for { |
| sptr := v_0 |
| tptr := v_1 |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 2 { |
| break |
| } |
| mem := v_3 |
| if !(canLoadUnaligned(config)) { |
| break |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int16) |
| v0.AddArg2(sptr, mem) |
| v1 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int16) |
| v1.AddArg2(tptr, mem) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| // match: (MemEq sptr tptr (Const64 [4]) mem) |
| // cond: canLoadUnaligned(config) |
| // result: (Eq32 (Load <typ.Int32> sptr mem) (Load <typ.Int32> tptr mem)) |
| for { |
| sptr := v_0 |
| tptr := v_1 |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 4 { |
| break |
| } |
| mem := v_3 |
| if !(canLoadUnaligned(config)) { |
| break |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v0.AddArg2(sptr, mem) |
| v1 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v1.AddArg2(tptr, mem) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| // match: (MemEq sptr tptr (Const64 [8]) mem) |
| // cond: canLoadUnaligned(config) && config.PtrSize == 8 |
| // result: (Eq64 (Load <typ.Int64> sptr mem) (Load <typ.Int64> tptr mem)) |
| for { |
| sptr := v_0 |
| tptr := v_1 |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 8 { |
| break |
| } |
| mem := v_3 |
| if !(canLoadUnaligned(config) && config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int64) |
| v0.AddArg2(sptr, mem) |
| v1 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int64) |
| v1.AddArg2(tptr, mem) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| // match: (MemEq _ _ (Const64 [0]) _) |
| // result: (ConstBool <typ.Bool> [true]) |
| for { |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.Type = typ.Bool |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| // match: (MemEq p q _ _) |
| // cond: ssa.IsSamePtr(p, q) |
| // result: (ConstBool <typ.Bool> [true]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| p := v_0 |
| q := v_1 |
| if !(ssa.IsSamePtr(p, q)) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.Type = typ.Bool |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (MemEq p q (Const64 [c]) mem) |
| // cond: (c == 3 || c == 5 || c == 9 || c == 17) && canLoadUnaligned(config) && config.RegSize == 8 |
| // result: (AndB (MemEq p q (Const64 <typ.Int64> [c-1]) mem) (Eq8 (Load <typ.Int8> (OffPtr <p.Type> p [c-1]) mem) (Load <typ.Int8> (OffPtr <q.Type> q [c-1]) mem))) |
| for { |
| p := v_0 |
| q := v_1 |
| if v_2.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_2.AuxInt) |
| mem := v_3 |
| if !((c == 3 || c == 5 || c == 9 || c == 17) && canLoadUnaligned(config) && config.RegSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpAndB) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMemEq, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v1.AuxInt = ssa.Int64ToAuxInt(c - 1) |
| v0.AddArg4(p, q, v1, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpEq8, typ.Bool) |
| v3 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int8) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, p.Type) |
| v4.AuxInt = ssa.Int64ToAuxInt(c - 1) |
| v4.AddArg(p) |
| v3.AddArg2(v4, mem) |
| v5 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int8) |
| v6 := b.NewValue0(v.Pos, ssaop.OpOffPtr, q.Type) |
| v6.AuxInt = ssa.Int64ToAuxInt(c - 1) |
| v6.AddArg(q) |
| v5.AddArg2(v6, mem) |
| v2.AddArg2(v3, v5) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| // match: (MemEq p q (Const64 [c]) mem) |
| // cond: (c == 6 || c == 10 || c == 18) && canLoadUnaligned(config) && config.RegSize == 8 |
| // result: (AndB (MemEq p q (Const64 <typ.Int64> [c-2]) mem) (Eq16 (Load <typ.Int16> (OffPtr <p.Type> p [c-2]) mem) (Load <typ.Int16> (OffPtr <q.Type> q [c-2]) mem))) |
| for { |
| p := v_0 |
| q := v_1 |
| if v_2.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_2.AuxInt) |
| mem := v_3 |
| if !((c == 6 || c == 10 || c == 18) && canLoadUnaligned(config) && config.RegSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpAndB) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMemEq, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v1.AuxInt = ssa.Int64ToAuxInt(c - 2) |
| v0.AddArg4(p, q, v1, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpEq16, typ.Bool) |
| v3 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int16) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, p.Type) |
| v4.AuxInt = ssa.Int64ToAuxInt(c - 2) |
| v4.AddArg(p) |
| v3.AddArg2(v4, mem) |
| v5 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int16) |
| v6 := b.NewValue0(v.Pos, ssaop.OpOffPtr, q.Type) |
| v6.AuxInt = ssa.Int64ToAuxInt(c - 2) |
| v6.AddArg(q) |
| v5.AddArg2(v6, mem) |
| v2.AddArg2(v3, v5) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| // match: (MemEq p q (Const64 [c]) mem) |
| // cond: (c == 7 || c == 11 || c == 19 || c == 20) && canLoadUnaligned(config) && config.RegSize == 8 |
| // result: (AndB (MemEq p q (Const64 <typ.Int64> [min(c-3,16)]) mem) (Eq32 (Load <typ.Int32> (OffPtr <p.Type> p [c-4]) mem) (Load <typ.Int32> (OffPtr <q.Type> q [c-4]) mem))) |
| for { |
| p := v_0 |
| q := v_1 |
| if v_2.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_2.AuxInt) |
| mem := v_3 |
| if !((c == 7 || c == 11 || c == 19 || c == 20) && canLoadUnaligned(config) && config.RegSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpAndB) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMemEq, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v1.AuxInt = ssa.Int64ToAuxInt(min(c-3, 16)) |
| v0.AddArg4(p, q, v1, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpEq32, typ.Bool) |
| v3 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, p.Type) |
| v4.AuxInt = ssa.Int64ToAuxInt(c - 4) |
| v4.AddArg(p) |
| v3.AddArg2(v4, mem) |
| v5 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v6 := b.NewValue0(v.Pos, ssaop.OpOffPtr, q.Type) |
| v6.AuxInt = ssa.Int64ToAuxInt(c - 4) |
| v6.AddArg(q) |
| v5.AddArg2(v6, mem) |
| v2.AddArg2(v3, v5) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| // match: (MemEq p q (Const64 [c]) mem) |
| // cond: ((c >= 12 && c <= 16) || (c >= 21 && c <= 24)) && canLoadUnaligned(config) && config.RegSize == 8 |
| // result: (AndB (MemEq p q (Const64 <typ.Int64> [8 + int64(bool2int(c>16))*8]) mem) (Eq64 (Load <typ.Int64> (OffPtr <p.Type> p [c-8]) mem) (Load <typ.Int64> (OffPtr <q.Type> q [c-8]) mem))) |
| for { |
| p := v_0 |
| q := v_1 |
| if v_2.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_2.AuxInt) |
| mem := v_3 |
| if !(((c >= 12 && c <= 16) || (c >= 21 && c <= 24)) && canLoadUnaligned(config) && config.RegSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpAndB) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMemEq, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v1.AuxInt = ssa.Int64ToAuxInt(8 + int64(bool2int(c > 16))*8) |
| v0.AddArg4(p, q, v1, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpEq64, typ.Bool) |
| v3 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int64) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, p.Type) |
| v4.AuxInt = ssa.Int64ToAuxInt(c - 8) |
| v4.AddArg(p) |
| v3.AddArg2(v4, mem) |
| v5 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int64) |
| v6 := b.NewValue0(v.Pos, ssaop.OpOffPtr, q.Type) |
| v6.AuxInt = ssa.Int64ToAuxInt(c - 8) |
| v6.AddArg(q) |
| v5.AddArg2(v6, mem) |
| v2.AddArg2(v3, v5) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| // match: (MemEq p q (Const64 [c]) mem) |
| // cond: c >= 25 && c <= 32 && canLoadUnaligned(config) && config.RegSize == 8 |
| // result: (AndB (MemEq p q (Const64 <typ.Int64> [16]) mem) (MemEq (OffPtr <p.Type> p [16]) (OffPtr <q.Type> q [16]) (Const64 <typ.Int64> [c-16]) mem)) |
| for { |
| p := v_0 |
| q := v_1 |
| if v_2.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_2.AuxInt) |
| mem := v_3 |
| if !(c >= 25 && c <= 32 && canLoadUnaligned(config) && config.RegSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpAndB) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMemEq, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v1.AuxInt = ssa.Int64ToAuxInt(16) |
| v0.AddArg4(p, q, v1, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpMemEq, typ.Bool) |
| v3 := b.NewValue0(v.Pos, ssaop.OpOffPtr, p.Type) |
| v3.AuxInt = ssa.Int64ToAuxInt(16) |
| v3.AddArg(p) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, q.Type) |
| v4.AuxInt = ssa.Int64ToAuxInt(16) |
| v4.AddArg(q) |
| v5 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v5.AuxInt = ssa.Int64ToAuxInt(c - 16) |
| v2.AddArg4(v3, v4, v5, mem) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpMod16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Mod16 (Const16 [c]) (Const16 [d])) |
| // cond: d != 0 |
| // result: (Const16 [c % d]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(c % d) |
| return true |
| } |
| // match: (Mod16 <t> n (Const16 [c])) |
| // cond: isNonNegative(n) && ssa.IsPowerOfTwo(c) |
| // result: (And16 n (Const16 <t> [c-1])) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(isNonNegative(n) && ssa.IsPowerOfTwo(c)) { |
| break |
| } |
| v.Reset(ssaop.OpAnd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - 1) |
| v.AddArg2(n, v0) |
| return true |
| } |
| // match: (Mod16 <t> n (Const16 [c])) |
| // cond: c < 0 && c != -1<<15 |
| // result: (Mod16 <t> n (Const16 <t> [-c])) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(c < 0 && c != -1<<15) { |
| break |
| } |
| v.Reset(ssaop.OpMod16) |
| v.Type = t |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(-c) |
| v.AddArg2(n, v0) |
| return true |
| } |
| // match: (Mod16 <t> x (Const16 [c])) |
| // cond: x.Op != ssaop.OpConst16 && (c > 0 || c == -1<<15) |
| // result: (Sub16 x (Mul16 <t> (Div16 <t> x (Const16 <t> [c])) (Const16 <t> [c]))) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(x.Op != ssaop.OpConst16 && (c > 0 || c == -1<<15)) { |
| break |
| } |
| v.Reset(ssaop.OpSub16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpDiv16, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v2.AuxInt = ssa.Int16ToAuxInt(c) |
| v1.AddArg2(x, v2) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpMod16u(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Mod16u (Const16 [c]) (Const16 [d])) |
| // cond: d != 0 |
| // result: (Const16 [int16(uint16(c) % uint16(d))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(int16(uint16(c) % uint16(d))) |
| return true |
| } |
| // match: (Mod16u <t> n (Const16 [c])) |
| // cond: ssa.IsPowerOfTwo(uint16(c)) |
| // result: (And16 n (Const16 <t> [c-1])) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint16(c))) { |
| break |
| } |
| v.Reset(ssaop.OpAnd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - 1) |
| v.AddArg2(n, v0) |
| return true |
| } |
| // match: (Mod16u <t> x (Const16 [c])) |
| // cond: x.Op != ssaop.OpConst16 && c != 0 |
| // result: (Sub16 x (Mul16 <t> (Div16u <t> x (Const16 <t> [c])) (Const16 <t> [c]))) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(x.Op != ssaop.OpConst16 && c != 0) { |
| break |
| } |
| v.Reset(ssaop.OpSub16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpDiv16u, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v2.AuxInt = ssa.Int16ToAuxInt(c) |
| v1.AddArg2(x, v2) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpMod32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Mod32 (Const32 [c]) (Const32 [d])) |
| // cond: d != 0 |
| // result: (Const32 [c % d]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(c % d) |
| return true |
| } |
| // match: (Mod32 <t> n (Const32 [c])) |
| // cond: isNonNegative(n) && ssa.IsPowerOfTwo(c) |
| // result: (And32 n (Const32 <t> [c-1])) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(isNonNegative(n) && ssa.IsPowerOfTwo(c)) { |
| break |
| } |
| v.Reset(ssaop.OpAnd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - 1) |
| v.AddArg2(n, v0) |
| return true |
| } |
| // match: (Mod32 <t> n (Const32 [c])) |
| // cond: c < 0 && c != -1<<31 |
| // result: (Mod32 <t> n (Const32 <t> [-c])) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(c < 0 && c != -1<<31) { |
| break |
| } |
| v.Reset(ssaop.OpMod32) |
| v.Type = t |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(-c) |
| v.AddArg2(n, v0) |
| return true |
| } |
| // match: (Mod32 <t> x (Const32 [c])) |
| // cond: x.Op != ssaop.OpConst32 && (c > 0 || c == -1<<31) |
| // result: (Sub32 x (Mul32 <t> (Div32 <t> x (Const32 <t> [c])) (Const32 <t> [c]))) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(x.Op != ssaop.OpConst32 && (c > 0 || c == -1<<31)) { |
| break |
| } |
| v.Reset(ssaop.OpSub32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpDiv32, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v2.AuxInt = ssa.Int32ToAuxInt(c) |
| v1.AddArg2(x, v2) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpMod32u(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Mod32u (Const32 [c]) (Const32 [d])) |
| // cond: d != 0 |
| // result: (Const32 [int32(uint32(c) % uint32(d))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(uint32(c) % uint32(d))) |
| return true |
| } |
| // match: (Mod32u <t> n (Const32 [c])) |
| // cond: ssa.IsPowerOfTwo(uint32(c)) |
| // result: (And32 n (Const32 <t> [c-1])) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint32(c))) { |
| break |
| } |
| v.Reset(ssaop.OpAnd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - 1) |
| v.AddArg2(n, v0) |
| return true |
| } |
| // match: (Mod32u <t> x (Const32 [c])) |
| // cond: x.Op != ssaop.OpConst32 && c != 0 |
| // result: (Sub32 x (Mul32 <t> (Div32u <t> x (Const32 <t> [c])) (Const32 <t> [c]))) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(x.Op != ssaop.OpConst32 && c != 0) { |
| break |
| } |
| v.Reset(ssaop.OpSub32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpDiv32u, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v2.AuxInt = ssa.Int32ToAuxInt(c) |
| v1.AddArg2(x, v2) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpMod64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Mod64 (Const64 [c]) (Const64 [d])) |
| // cond: d != 0 |
| // result: (Const64 [c % d]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(c % d) |
| return true |
| } |
| // match: (Mod64 <t> n (Const64 [c])) |
| // cond: isNonNegative(n) && ssa.IsPowerOfTwo(c) |
| // result: (And64 n (Const64 <t> [c-1])) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(isNonNegative(n) && ssa.IsPowerOfTwo(c)) { |
| break |
| } |
| v.Reset(ssaop.OpAnd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - 1) |
| v.AddArg2(n, v0) |
| return true |
| } |
| // match: (Mod64 n (Const64 [-1<<63])) |
| // cond: isNonNegative(n) |
| // result: n |
| for { |
| n := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != -1<<63 || !(isNonNegative(n)) { |
| break |
| } |
| v.CopyOf(n) |
| return true |
| } |
| // match: (Mod64 <t> n (Const64 [c])) |
| // cond: c < 0 && c != -1<<63 |
| // result: (Mod64 <t> n (Const64 <t> [-c])) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c < 0 && c != -1<<63) { |
| break |
| } |
| v.Reset(ssaop.OpMod64) |
| v.Type = t |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(-c) |
| v.AddArg2(n, v0) |
| return true |
| } |
| // match: (Mod64 <t> x (Const64 [c])) |
| // cond: x.Op != ssaop.OpConst64 && (c > 0 || c == -1<<63) |
| // result: (Sub64 x (Mul64 <t> (Div64 <t> x (Const64 <t> [c])) (Const64 <t> [c]))) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(x.Op != ssaop.OpConst64 && (c > 0 || c == -1<<63)) { |
| break |
| } |
| v.Reset(ssaop.OpSub64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpDiv64, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v2.AuxInt = ssa.Int64ToAuxInt(c) |
| v1.AddArg2(x, v2) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpMod64u(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Mod64u (Const64 [c]) (Const64 [d])) |
| // cond: d != 0 |
| // result: (Const64 [int64(uint64(c) % uint64(d))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(uint64(c) % uint64(d))) |
| return true |
| } |
| // match: (Mod64u <t> n (Const64 [c])) |
| // cond: ssa.IsPowerOfTwo(uint64(c)) |
| // result: (And64 n (Const64 <t> [c-1])) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint64(c))) { |
| break |
| } |
| v.Reset(ssaop.OpAnd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - 1) |
| v.AddArg2(n, v0) |
| return true |
| } |
| // match: (Mod64u <t> x (Const64 [c])) |
| // cond: x.Op != ssaop.OpConst64 && c != 0 |
| // result: (Sub64 x (Mul64 <t> (Div64u <t> x (Const64 <t> [c])) (Const64 <t> [c]))) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(x.Op != ssaop.OpConst64 && c != 0) { |
| break |
| } |
| v.Reset(ssaop.OpSub64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpDiv64u, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v2.AuxInt = ssa.Int64ToAuxInt(c) |
| v1.AddArg2(x, v2) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpMod8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Mod8 (Const8 [c]) (Const8 [d])) |
| // cond: d != 0 |
| // result: (Const8 [c % d]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(c % d) |
| return true |
| } |
| // match: (Mod8 <t> n (Const8 [c])) |
| // cond: isNonNegative(n) && ssa.IsPowerOfTwo(c) |
| // result: (And8 n (Const8 <t> [c-1])) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(isNonNegative(n) && ssa.IsPowerOfTwo(c)) { |
| break |
| } |
| v.Reset(ssaop.OpAnd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - 1) |
| v.AddArg2(n, v0) |
| return true |
| } |
| // match: (Mod8 <t> n (Const8 [c])) |
| // cond: c < 0 && c != -1<<7 |
| // result: (Mod8 <t> n (Const8 <t> [-c])) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(c < 0 && c != -1<<7) { |
| break |
| } |
| v.Reset(ssaop.OpMod8) |
| v.Type = t |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(-c) |
| v.AddArg2(n, v0) |
| return true |
| } |
| // match: (Mod8 <t> x (Const8 [c])) |
| // cond: x.Op != ssaop.OpConst8 && (c > 0 || c == -1<<7) |
| // result: (Sub8 x (Mul8 <t> (Div8 <t> x (Const8 <t> [c])) (Const8 <t> [c]))) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(x.Op != ssaop.OpConst8 && (c > 0 || c == -1<<7)) { |
| break |
| } |
| v.Reset(ssaop.OpSub8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpDiv8, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v2.AuxInt = ssa.Int8ToAuxInt(c) |
| v1.AddArg2(x, v2) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpMod8u(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Mod8u (Const8 [c]) (Const8 [d])) |
| // cond: d != 0 |
| // result: (Const8 [int8(uint8(c) % uint8(d))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(d != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(int8(uint8(c) % uint8(d))) |
| return true |
| } |
| // match: (Mod8u <t> n (Const8 [c])) |
| // cond: ssa.IsPowerOfTwo(uint8(c)) |
| // result: (And8 n (Const8 <t> [c-1])) |
| for { |
| t := v.Type |
| n := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint8(c))) { |
| break |
| } |
| v.Reset(ssaop.OpAnd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - 1) |
| v.AddArg2(n, v0) |
| return true |
| } |
| // match: (Mod8u <t> x (Const8 [c])) |
| // cond: x.Op != ssaop.OpConst8 && c != 0 |
| // result: (Sub8 x (Mul8 <t> (Div8u <t> x (Const8 <t> [c])) (Const8 <t> [c]))) |
| for { |
| t := v.Type |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(x.Op != ssaop.OpConst8 && c != 0) { |
| break |
| } |
| v.Reset(ssaop.OpSub8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpDiv8u, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v2.AuxInt = ssa.Int8ToAuxInt(c) |
| v1.AddArg2(x, v2) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpMove(v *ssa.Value) bool { |
| v_2 := v.Args[2] |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Move {t} [n] dst1 src mem:(Zero {t} [n] dst2 _)) |
| // cond: ssa.IsSamePtr(src, dst2) |
| // result: (Zero {t} [n] dst1 mem) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t := ssa.AuxToType(v.Aux) |
| dst1 := v_0 |
| src := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpZero || ssa.AuxIntToInt64(mem.AuxInt) != n || ssa.AuxToType(mem.Aux) != t { |
| break |
| } |
| dst2 := mem.Args[0] |
| if !(ssa.IsSamePtr(src, dst2)) { |
| break |
| } |
| v.Reset(ssaop.OpZero) |
| v.AuxInt = ssa.Int64ToAuxInt(n) |
| v.Aux = ssa.TypeToAux(t) |
| v.AddArg2(dst1, mem) |
| return true |
| } |
| // match: (Move {t} [n] dst1 src mem:(VarDef (Zero {t} [n] dst0 _))) |
| // cond: ssa.IsSamePtr(src, dst0) |
| // result: (Zero {t} [n] dst1 mem) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t := ssa.AuxToType(v.Aux) |
| dst1 := v_0 |
| src := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpVarDef { |
| break |
| } |
| mem_0 := mem.Args[0] |
| if mem_0.Op != ssaop.OpZero || ssa.AuxIntToInt64(mem_0.AuxInt) != n || ssa.AuxToType(mem_0.Aux) != t { |
| break |
| } |
| dst0 := mem_0.Args[0] |
| if !(ssa.IsSamePtr(src, dst0)) { |
| break |
| } |
| v.Reset(ssaop.OpZero) |
| v.AuxInt = ssa.Int64ToAuxInt(n) |
| v.Aux = ssa.TypeToAux(t) |
| v.AddArg2(dst1, mem) |
| return true |
| } |
| // match: (Move {t} [n] dst (Addr {sym} (SB)) mem) |
| // cond: symIsROZero(sym) |
| // result: (Zero {t} [n] dst mem) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| if v_1.Op != ssaop.OpAddr { |
| break |
| } |
| sym := ssa.AuxToSym(v_1.Aux) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpSB { |
| break |
| } |
| mem := v_2 |
| if !(symIsROZero(sym)) { |
| break |
| } |
| v.Reset(ssaop.OpZero) |
| v.AuxInt = ssa.Int64ToAuxInt(n) |
| v.Aux = ssa.TypeToAux(t) |
| v.AddArg2(dst, mem) |
| return true |
| } |
| // match: (Move {t1} [n] dst1 src1 store:(Store {t2} op1:(OffPtr [o2] dst2) _ mem)) |
| // cond: ssa.IsSamePtr(dst1, dst2) && store.Uses == 1 && n >= o2 + t2.Size() && ssa.Disjoint1(src1, n, op1, t2.Size()) && ssa.Clobber(store) |
| // result: (Move {t1} [n] dst1 src1 mem) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst1 := v_0 |
| src1 := v_1 |
| store := v_2 |
| if store.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(store.Aux) |
| mem := store.Args[2] |
| op1 := store.Args[0] |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o2 := ssa.AuxIntToInt64(op1.AuxInt) |
| dst2 := op1.Args[0] |
| if !(ssa.IsSamePtr(dst1, dst2) && store.Uses == 1 && n >= o2+t2.Size() && ssa.Disjoint1(src1, n, op1, t2.Size()) && ssa.Clobber(store)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(n) |
| v.Aux = ssa.TypeToAux(t1) |
| v.AddArg3(dst1, src1, mem) |
| return true |
| } |
| // match: (Move {t} [n] dst1 src1 move:(Move {t} [n] dst2 _ mem)) |
| // cond: move.Uses == 1 && ssa.IsSamePtr(dst1, dst2) && ssa.Disjoint1(src1, n, dst2, n) && ssa.Clobber(move) |
| // result: (Move {t} [n] dst1 src1 mem) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t := ssa.AuxToType(v.Aux) |
| dst1 := v_0 |
| src1 := v_1 |
| move := v_2 |
| if move.Op != ssaop.OpMove || ssa.AuxIntToInt64(move.AuxInt) != n || ssa.AuxToType(move.Aux) != t { |
| break |
| } |
| mem := move.Args[2] |
| dst2 := move.Args[0] |
| if !(move.Uses == 1 && ssa.IsSamePtr(dst1, dst2) && ssa.Disjoint1(src1, n, dst2, n) && ssa.Clobber(move)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(n) |
| v.Aux = ssa.TypeToAux(t) |
| v.AddArg3(dst1, src1, mem) |
| return true |
| } |
| // match: (Move {t} [n] dst1 src1 vardef:(VarDef {x} move:(Move {t} [n] dst2 _ mem))) |
| // cond: move.Uses == 1 && vardef.Uses == 1 && ssa.IsSamePtr(dst1, dst2) && ssa.Disjoint1(src1, n, dst2, n) && ssa.Clobber(move, vardef) |
| // result: (Move {t} [n] dst1 src1 (VarDef {x} mem)) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t := ssa.AuxToType(v.Aux) |
| dst1 := v_0 |
| src1 := v_1 |
| vardef := v_2 |
| if vardef.Op != ssaop.OpVarDef { |
| break |
| } |
| x := ssa.AuxToSym(vardef.Aux) |
| move := vardef.Args[0] |
| if move.Op != ssaop.OpMove || ssa.AuxIntToInt64(move.AuxInt) != n || ssa.AuxToType(move.Aux) != t { |
| break |
| } |
| mem := move.Args[2] |
| dst2 := move.Args[0] |
| if !(move.Uses == 1 && vardef.Uses == 1 && ssa.IsSamePtr(dst1, dst2) && ssa.Disjoint1(src1, n, dst2, n) && ssa.Clobber(move, vardef)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(n) |
| v.Aux = ssa.TypeToAux(t) |
| v0 := b.NewValue0(v.Pos, ssaop.OpVarDef, types.TypeMem) |
| v0.Aux = ssa.SymToAux(x) |
| v0.AddArg(mem) |
| v.AddArg3(dst1, src1, v0) |
| return true |
| } |
| // match: (Move {t} [n] dst1 src1 zero:(Zero {t} [n] dst2 mem)) |
| // cond: zero.Uses == 1 && ssa.IsSamePtr(dst1, dst2) && ssa.Disjoint1(src1, n, dst2, n) && ssa.Clobber(zero) |
| // result: (Move {t} [n] dst1 src1 mem) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t := ssa.AuxToType(v.Aux) |
| dst1 := v_0 |
| src1 := v_1 |
| zero := v_2 |
| if zero.Op != ssaop.OpZero || ssa.AuxIntToInt64(zero.AuxInt) != n || ssa.AuxToType(zero.Aux) != t { |
| break |
| } |
| mem := zero.Args[1] |
| dst2 := zero.Args[0] |
| if !(zero.Uses == 1 && ssa.IsSamePtr(dst1, dst2) && ssa.Disjoint1(src1, n, dst2, n) && ssa.Clobber(zero)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(n) |
| v.Aux = ssa.TypeToAux(t) |
| v.AddArg3(dst1, src1, mem) |
| return true |
| } |
| // match: (Move {t} [n] dst1 src1 vardef:(VarDef {x} zero:(Zero {t} [n] dst2 mem))) |
| // cond: zero.Uses == 1 && vardef.Uses == 1 && ssa.IsSamePtr(dst1, dst2) && ssa.Disjoint1(src1, n, dst2, n) && ssa.Clobber(zero, vardef) |
| // result: (Move {t} [n] dst1 src1 (VarDef {x} mem)) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t := ssa.AuxToType(v.Aux) |
| dst1 := v_0 |
| src1 := v_1 |
| vardef := v_2 |
| if vardef.Op != ssaop.OpVarDef { |
| break |
| } |
| x := ssa.AuxToSym(vardef.Aux) |
| zero := vardef.Args[0] |
| if zero.Op != ssaop.OpZero || ssa.AuxIntToInt64(zero.AuxInt) != n || ssa.AuxToType(zero.Aux) != t { |
| break |
| } |
| mem := zero.Args[1] |
| dst2 := zero.Args[0] |
| if !(zero.Uses == 1 && vardef.Uses == 1 && ssa.IsSamePtr(dst1, dst2) && ssa.Disjoint1(src1, n, dst2, n) && ssa.Clobber(zero, vardef)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(n) |
| v.Aux = ssa.TypeToAux(t) |
| v0 := b.NewValue0(v.Pos, ssaop.OpVarDef, types.TypeMem) |
| v0.Aux = ssa.SymToAux(x) |
| v0.AddArg(mem) |
| v.AddArg3(dst1, src1, v0) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(Store {t2} op2:(OffPtr <tt2> [o2] p2) d1 (Store {t3} op3:(OffPtr <tt3> [0] p3) d2 _))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && o2 == t3.Size() && n == t2.Size() + t3.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Store {t3} (OffPtr <tt3> [0] dst) d2 mem)) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| op2 := mem.Args[0] |
| if op2.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := op2.Type |
| o2 := ssa.AuxIntToInt64(op2.AuxInt) |
| p2 := op2.Args[0] |
| d1 := mem.Args[1] |
| mem_2 := mem.Args[2] |
| if mem_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_2.Aux) |
| d2 := mem_2.Args[1] |
| op3 := mem_2.Args[0] |
| if op3.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt3 := op3.Type |
| if ssa.AuxIntToInt64(op3.AuxInt) != 0 { |
| break |
| } |
| p3 := op3.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && o2 == t3.Size() && n == t2.Size()+t3.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt3) |
| v2.AuxInt = ssa.Int64ToAuxInt(0) |
| v2.AddArg(dst) |
| v1.AddArg3(v2, d2, mem) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(Store {t2} op2:(OffPtr <tt2> [o2] p2) d1 (Store {t3} op3:(OffPtr <tt3> [o3] p3) d2 (Store {t4} op4:(OffPtr <tt4> [0] p4) d3 _)))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && o3 == t4.Size() && o2-o3 == t3.Size() && n == t2.Size() + t3.Size() + t4.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Store {t3} (OffPtr <tt3> [o3] dst) d2 (Store {t4} (OffPtr <tt4> [0] dst) d3 mem))) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| op2 := mem.Args[0] |
| if op2.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := op2.Type |
| o2 := ssa.AuxIntToInt64(op2.AuxInt) |
| p2 := op2.Args[0] |
| d1 := mem.Args[1] |
| mem_2 := mem.Args[2] |
| if mem_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_2.Aux) |
| _ = mem_2.Args[2] |
| op3 := mem_2.Args[0] |
| if op3.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt3 := op3.Type |
| o3 := ssa.AuxIntToInt64(op3.AuxInt) |
| p3 := op3.Args[0] |
| d2 := mem_2.Args[1] |
| mem_2_2 := mem_2.Args[2] |
| if mem_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(mem_2_2.Aux) |
| d3 := mem_2_2.Args[1] |
| op4 := mem_2_2.Args[0] |
| if op4.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt4 := op4.Type |
| if ssa.AuxIntToInt64(op4.AuxInt) != 0 { |
| break |
| } |
| p4 := op4.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && o3 == t4.Size() && o2-o3 == t3.Size() && n == t2.Size()+t3.Size()+t4.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt3) |
| v2.AuxInt = ssa.Int64ToAuxInt(o3) |
| v2.AddArg(dst) |
| v3 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v3.Aux = ssa.TypeToAux(t4) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt4) |
| v4.AuxInt = ssa.Int64ToAuxInt(0) |
| v4.AddArg(dst) |
| v3.AddArg3(v4, d3, mem) |
| v1.AddArg3(v2, d2, v3) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(Store {t2} op2:(OffPtr <tt2> [o2] p2) d1 (Store {t3} op3:(OffPtr <tt3> [o3] p3) d2 (Store {t4} op4:(OffPtr <tt4> [o4] p4) d3 (Store {t5} op5:(OffPtr <tt5> [0] p5) d4 _))))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && t5.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && registerizable(b, t5) && o4 == t5.Size() && o3-o4 == t4.Size() && o2-o3 == t3.Size() && n == t2.Size() + t3.Size() + t4.Size() + t5.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Store {t3} (OffPtr <tt3> [o3] dst) d2 (Store {t4} (OffPtr <tt4> [o4] dst) d3 (Store {t5} (OffPtr <tt5> [0] dst) d4 mem)))) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| op2 := mem.Args[0] |
| if op2.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := op2.Type |
| o2 := ssa.AuxIntToInt64(op2.AuxInt) |
| p2 := op2.Args[0] |
| d1 := mem.Args[1] |
| mem_2 := mem.Args[2] |
| if mem_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_2.Aux) |
| _ = mem_2.Args[2] |
| op3 := mem_2.Args[0] |
| if op3.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt3 := op3.Type |
| o3 := ssa.AuxIntToInt64(op3.AuxInt) |
| p3 := op3.Args[0] |
| d2 := mem_2.Args[1] |
| mem_2_2 := mem_2.Args[2] |
| if mem_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(mem_2_2.Aux) |
| _ = mem_2_2.Args[2] |
| op4 := mem_2_2.Args[0] |
| if op4.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt4 := op4.Type |
| o4 := ssa.AuxIntToInt64(op4.AuxInt) |
| p4 := op4.Args[0] |
| d3 := mem_2_2.Args[1] |
| mem_2_2_2 := mem_2_2.Args[2] |
| if mem_2_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t5 := ssa.AuxToType(mem_2_2_2.Aux) |
| d4 := mem_2_2_2.Args[1] |
| op5 := mem_2_2_2.Args[0] |
| if op5.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt5 := op5.Type |
| if ssa.AuxIntToInt64(op5.AuxInt) != 0 { |
| break |
| } |
| p5 := op5.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && t5.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && registerizable(b, t5) && o4 == t5.Size() && o3-o4 == t4.Size() && o2-o3 == t3.Size() && n == t2.Size()+t3.Size()+t4.Size()+t5.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt3) |
| v2.AuxInt = ssa.Int64ToAuxInt(o3) |
| v2.AddArg(dst) |
| v3 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v3.Aux = ssa.TypeToAux(t4) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt4) |
| v4.AuxInt = ssa.Int64ToAuxInt(o4) |
| v4.AddArg(dst) |
| v5 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v5.Aux = ssa.TypeToAux(t5) |
| v6 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt5) |
| v6.AuxInt = ssa.Int64ToAuxInt(0) |
| v6.AddArg(dst) |
| v5.AddArg3(v6, d4, mem) |
| v3.AddArg3(v4, d3, v5) |
| v1.AddArg3(v2, d2, v3) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(VarDef (Store {t2} op2:(OffPtr <tt2> [o2] p2) d1 (Store {t3} op3:(OffPtr <tt3> [0] p3) d2 _)))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && o2 == t3.Size() && n == t2.Size() + t3.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Store {t3} (OffPtr <tt3> [0] dst) d2 mem)) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpVarDef { |
| break |
| } |
| mem_0 := mem.Args[0] |
| if mem_0.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem_0.Aux) |
| _ = mem_0.Args[2] |
| op2 := mem_0.Args[0] |
| if op2.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := op2.Type |
| o2 := ssa.AuxIntToInt64(op2.AuxInt) |
| p2 := op2.Args[0] |
| d1 := mem_0.Args[1] |
| mem_0_2 := mem_0.Args[2] |
| if mem_0_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_0_2.Aux) |
| d2 := mem_0_2.Args[1] |
| op3 := mem_0_2.Args[0] |
| if op3.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt3 := op3.Type |
| if ssa.AuxIntToInt64(op3.AuxInt) != 0 { |
| break |
| } |
| p3 := op3.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && o2 == t3.Size() && n == t2.Size()+t3.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt3) |
| v2.AuxInt = ssa.Int64ToAuxInt(0) |
| v2.AddArg(dst) |
| v1.AddArg3(v2, d2, mem) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(VarDef (Store {t2} op2:(OffPtr <tt2> [o2] p2) d1 (Store {t3} op3:(OffPtr <tt3> [o3] p3) d2 (Store {t4} op4:(OffPtr <tt4> [0] p4) d3 _))))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && o3 == t4.Size() && o2-o3 == t3.Size() && n == t2.Size() + t3.Size() + t4.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Store {t3} (OffPtr <tt3> [o3] dst) d2 (Store {t4} (OffPtr <tt4> [0] dst) d3 mem))) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpVarDef { |
| break |
| } |
| mem_0 := mem.Args[0] |
| if mem_0.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem_0.Aux) |
| _ = mem_0.Args[2] |
| op2 := mem_0.Args[0] |
| if op2.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := op2.Type |
| o2 := ssa.AuxIntToInt64(op2.AuxInt) |
| p2 := op2.Args[0] |
| d1 := mem_0.Args[1] |
| mem_0_2 := mem_0.Args[2] |
| if mem_0_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_0_2.Aux) |
| _ = mem_0_2.Args[2] |
| op3 := mem_0_2.Args[0] |
| if op3.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt3 := op3.Type |
| o3 := ssa.AuxIntToInt64(op3.AuxInt) |
| p3 := op3.Args[0] |
| d2 := mem_0_2.Args[1] |
| mem_0_2_2 := mem_0_2.Args[2] |
| if mem_0_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(mem_0_2_2.Aux) |
| d3 := mem_0_2_2.Args[1] |
| op4 := mem_0_2_2.Args[0] |
| if op4.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt4 := op4.Type |
| if ssa.AuxIntToInt64(op4.AuxInt) != 0 { |
| break |
| } |
| p4 := op4.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && o3 == t4.Size() && o2-o3 == t3.Size() && n == t2.Size()+t3.Size()+t4.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt3) |
| v2.AuxInt = ssa.Int64ToAuxInt(o3) |
| v2.AddArg(dst) |
| v3 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v3.Aux = ssa.TypeToAux(t4) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt4) |
| v4.AuxInt = ssa.Int64ToAuxInt(0) |
| v4.AddArg(dst) |
| v3.AddArg3(v4, d3, mem) |
| v1.AddArg3(v2, d2, v3) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(VarDef (Store {t2} op2:(OffPtr <tt2> [o2] p2) d1 (Store {t3} op3:(OffPtr <tt3> [o3] p3) d2 (Store {t4} op4:(OffPtr <tt4> [o4] p4) d3 (Store {t5} op5:(OffPtr <tt5> [0] p5) d4 _)))))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && t5.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && registerizable(b, t5) && o4 == t5.Size() && o3-o4 == t4.Size() && o2-o3 == t3.Size() && n == t2.Size() + t3.Size() + t4.Size() + t5.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Store {t3} (OffPtr <tt3> [o3] dst) d2 (Store {t4} (OffPtr <tt4> [o4] dst) d3 (Store {t5} (OffPtr <tt5> [0] dst) d4 mem)))) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpVarDef { |
| break |
| } |
| mem_0 := mem.Args[0] |
| if mem_0.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem_0.Aux) |
| _ = mem_0.Args[2] |
| op2 := mem_0.Args[0] |
| if op2.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := op2.Type |
| o2 := ssa.AuxIntToInt64(op2.AuxInt) |
| p2 := op2.Args[0] |
| d1 := mem_0.Args[1] |
| mem_0_2 := mem_0.Args[2] |
| if mem_0_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_0_2.Aux) |
| _ = mem_0_2.Args[2] |
| op3 := mem_0_2.Args[0] |
| if op3.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt3 := op3.Type |
| o3 := ssa.AuxIntToInt64(op3.AuxInt) |
| p3 := op3.Args[0] |
| d2 := mem_0_2.Args[1] |
| mem_0_2_2 := mem_0_2.Args[2] |
| if mem_0_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(mem_0_2_2.Aux) |
| _ = mem_0_2_2.Args[2] |
| op4 := mem_0_2_2.Args[0] |
| if op4.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt4 := op4.Type |
| o4 := ssa.AuxIntToInt64(op4.AuxInt) |
| p4 := op4.Args[0] |
| d3 := mem_0_2_2.Args[1] |
| mem_0_2_2_2 := mem_0_2_2.Args[2] |
| if mem_0_2_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t5 := ssa.AuxToType(mem_0_2_2_2.Aux) |
| d4 := mem_0_2_2_2.Args[1] |
| op5 := mem_0_2_2_2.Args[0] |
| if op5.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt5 := op5.Type |
| if ssa.AuxIntToInt64(op5.AuxInt) != 0 { |
| break |
| } |
| p5 := op5.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && t5.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && registerizable(b, t5) && o4 == t5.Size() && o3-o4 == t4.Size() && o2-o3 == t3.Size() && n == t2.Size()+t3.Size()+t4.Size()+t5.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt3) |
| v2.AuxInt = ssa.Int64ToAuxInt(o3) |
| v2.AddArg(dst) |
| v3 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v3.Aux = ssa.TypeToAux(t4) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt4) |
| v4.AuxInt = ssa.Int64ToAuxInt(o4) |
| v4.AddArg(dst) |
| v5 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v5.Aux = ssa.TypeToAux(t5) |
| v6 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt5) |
| v6.AuxInt = ssa.Int64ToAuxInt(0) |
| v6.AddArg(dst) |
| v5.AddArg3(v6, d4, mem) |
| v3.AddArg3(v4, d3, v5) |
| v1.AddArg3(v2, d2, v3) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(Store {t2} op2:(OffPtr <tt2> [o2] p2) d1 (Zero {t3} [n] p3 _))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && registerizable(b, t2) && n >= o2 + t2.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Zero {t1} [n] dst mem)) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| op2 := mem.Args[0] |
| if op2.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := op2.Type |
| o2 := ssa.AuxIntToInt64(op2.AuxInt) |
| p2 := op2.Args[0] |
| d1 := mem.Args[1] |
| mem_2 := mem.Args[2] |
| if mem_2.Op != ssaop.OpZero || ssa.AuxIntToInt64(mem_2.AuxInt) != n { |
| break |
| } |
| t3 := ssa.AuxToType(mem_2.Aux) |
| p3 := mem_2.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && registerizable(b, t2) && n >= o2+t2.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZero, types.TypeMem) |
| v1.AuxInt = ssa.Int64ToAuxInt(n) |
| v1.Aux = ssa.TypeToAux(t1) |
| v1.AddArg2(dst, mem) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(Store {t2} (OffPtr <tt2> [o2] p2) d1 (Store {t3} (OffPtr <tt3> [o3] p3) d2 (Zero {t4} [n] p4 _)))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && n >= o2 + t2.Size() && n >= o3 + t3.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Store {t3} (OffPtr <tt3> [o3] dst) d2 (Zero {t1} [n] dst mem))) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| mem_0 := mem.Args[0] |
| if mem_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := mem_0.Type |
| o2 := ssa.AuxIntToInt64(mem_0.AuxInt) |
| p2 := mem_0.Args[0] |
| d1 := mem.Args[1] |
| mem_2 := mem.Args[2] |
| if mem_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_2.Aux) |
| _ = mem_2.Args[2] |
| mem_2_0 := mem_2.Args[0] |
| if mem_2_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt3 := mem_2_0.Type |
| o3 := ssa.AuxIntToInt64(mem_2_0.AuxInt) |
| p3 := mem_2_0.Args[0] |
| d2 := mem_2.Args[1] |
| mem_2_2 := mem_2.Args[2] |
| if mem_2_2.Op != ssaop.OpZero || ssa.AuxIntToInt64(mem_2_2.AuxInt) != n { |
| break |
| } |
| t4 := ssa.AuxToType(mem_2_2.Aux) |
| p4 := mem_2_2.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && n >= o2+t2.Size() && n >= o3+t3.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt3) |
| v2.AuxInt = ssa.Int64ToAuxInt(o3) |
| v2.AddArg(dst) |
| v3 := b.NewValue0(v.Pos, ssaop.OpZero, types.TypeMem) |
| v3.AuxInt = ssa.Int64ToAuxInt(n) |
| v3.Aux = ssa.TypeToAux(t1) |
| v3.AddArg2(dst, mem) |
| v1.AddArg3(v2, d2, v3) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(Store {t2} (OffPtr <tt2> [o2] p2) d1 (Store {t3} (OffPtr <tt3> [o3] p3) d2 (Store {t4} (OffPtr <tt4> [o4] p4) d3 (Zero {t5} [n] p5 _))))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && t5.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && n >= o2 + t2.Size() && n >= o3 + t3.Size() && n >= o4 + t4.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Store {t3} (OffPtr <tt3> [o3] dst) d2 (Store {t4} (OffPtr <tt4> [o4] dst) d3 (Zero {t1} [n] dst mem)))) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| mem_0 := mem.Args[0] |
| if mem_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := mem_0.Type |
| o2 := ssa.AuxIntToInt64(mem_0.AuxInt) |
| p2 := mem_0.Args[0] |
| d1 := mem.Args[1] |
| mem_2 := mem.Args[2] |
| if mem_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_2.Aux) |
| _ = mem_2.Args[2] |
| mem_2_0 := mem_2.Args[0] |
| if mem_2_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt3 := mem_2_0.Type |
| o3 := ssa.AuxIntToInt64(mem_2_0.AuxInt) |
| p3 := mem_2_0.Args[0] |
| d2 := mem_2.Args[1] |
| mem_2_2 := mem_2.Args[2] |
| if mem_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(mem_2_2.Aux) |
| _ = mem_2_2.Args[2] |
| mem_2_2_0 := mem_2_2.Args[0] |
| if mem_2_2_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt4 := mem_2_2_0.Type |
| o4 := ssa.AuxIntToInt64(mem_2_2_0.AuxInt) |
| p4 := mem_2_2_0.Args[0] |
| d3 := mem_2_2.Args[1] |
| mem_2_2_2 := mem_2_2.Args[2] |
| if mem_2_2_2.Op != ssaop.OpZero || ssa.AuxIntToInt64(mem_2_2_2.AuxInt) != n { |
| break |
| } |
| t5 := ssa.AuxToType(mem_2_2_2.Aux) |
| p5 := mem_2_2_2.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && t5.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && n >= o2+t2.Size() && n >= o3+t3.Size() && n >= o4+t4.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt3) |
| v2.AuxInt = ssa.Int64ToAuxInt(o3) |
| v2.AddArg(dst) |
| v3 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v3.Aux = ssa.TypeToAux(t4) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt4) |
| v4.AuxInt = ssa.Int64ToAuxInt(o4) |
| v4.AddArg(dst) |
| v5 := b.NewValue0(v.Pos, ssaop.OpZero, types.TypeMem) |
| v5.AuxInt = ssa.Int64ToAuxInt(n) |
| v5.Aux = ssa.TypeToAux(t1) |
| v5.AddArg2(dst, mem) |
| v3.AddArg3(v4, d3, v5) |
| v1.AddArg3(v2, d2, v3) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(Store {t2} (OffPtr <tt2> [o2] p2) d1 (Store {t3} (OffPtr <tt3> [o3] p3) d2 (Store {t4} (OffPtr <tt4> [o4] p4) d3 (Store {t5} (OffPtr <tt5> [o5] p5) d4 (Zero {t6} [n] p6 _)))))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && ssa.IsSamePtr(p5, p6) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && t5.Alignment() <= t1.Alignment() && t6.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && registerizable(b, t5) && n >= o2 + t2.Size() && n >= o3 + t3.Size() && n >= o4 + t4.Size() && n >= o5 + t5.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Store {t3} (OffPtr <tt3> [o3] dst) d2 (Store {t4} (OffPtr <tt4> [o4] dst) d3 (Store {t5} (OffPtr <tt5> [o5] dst) d4 (Zero {t1} [n] dst mem))))) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| mem_0 := mem.Args[0] |
| if mem_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := mem_0.Type |
| o2 := ssa.AuxIntToInt64(mem_0.AuxInt) |
| p2 := mem_0.Args[0] |
| d1 := mem.Args[1] |
| mem_2 := mem.Args[2] |
| if mem_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_2.Aux) |
| _ = mem_2.Args[2] |
| mem_2_0 := mem_2.Args[0] |
| if mem_2_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt3 := mem_2_0.Type |
| o3 := ssa.AuxIntToInt64(mem_2_0.AuxInt) |
| p3 := mem_2_0.Args[0] |
| d2 := mem_2.Args[1] |
| mem_2_2 := mem_2.Args[2] |
| if mem_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(mem_2_2.Aux) |
| _ = mem_2_2.Args[2] |
| mem_2_2_0 := mem_2_2.Args[0] |
| if mem_2_2_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt4 := mem_2_2_0.Type |
| o4 := ssa.AuxIntToInt64(mem_2_2_0.AuxInt) |
| p4 := mem_2_2_0.Args[0] |
| d3 := mem_2_2.Args[1] |
| mem_2_2_2 := mem_2_2.Args[2] |
| if mem_2_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t5 := ssa.AuxToType(mem_2_2_2.Aux) |
| _ = mem_2_2_2.Args[2] |
| mem_2_2_2_0 := mem_2_2_2.Args[0] |
| if mem_2_2_2_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt5 := mem_2_2_2_0.Type |
| o5 := ssa.AuxIntToInt64(mem_2_2_2_0.AuxInt) |
| p5 := mem_2_2_2_0.Args[0] |
| d4 := mem_2_2_2.Args[1] |
| mem_2_2_2_2 := mem_2_2_2.Args[2] |
| if mem_2_2_2_2.Op != ssaop.OpZero || ssa.AuxIntToInt64(mem_2_2_2_2.AuxInt) != n { |
| break |
| } |
| t6 := ssa.AuxToType(mem_2_2_2_2.Aux) |
| p6 := mem_2_2_2_2.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && ssa.IsSamePtr(p5, p6) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && t5.Alignment() <= t1.Alignment() && t6.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && registerizable(b, t5) && n >= o2+t2.Size() && n >= o3+t3.Size() && n >= o4+t4.Size() && n >= o5+t5.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt3) |
| v2.AuxInt = ssa.Int64ToAuxInt(o3) |
| v2.AddArg(dst) |
| v3 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v3.Aux = ssa.TypeToAux(t4) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt4) |
| v4.AuxInt = ssa.Int64ToAuxInt(o4) |
| v4.AddArg(dst) |
| v5 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v5.Aux = ssa.TypeToAux(t5) |
| v6 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt5) |
| v6.AuxInt = ssa.Int64ToAuxInt(o5) |
| v6.AddArg(dst) |
| v7 := b.NewValue0(v.Pos, ssaop.OpZero, types.TypeMem) |
| v7.AuxInt = ssa.Int64ToAuxInt(n) |
| v7.Aux = ssa.TypeToAux(t1) |
| v7.AddArg2(dst, mem) |
| v5.AddArg3(v6, d4, v7) |
| v3.AddArg3(v4, d3, v5) |
| v1.AddArg3(v2, d2, v3) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(VarDef (Store {t2} op2:(OffPtr <tt2> [o2] p2) d1 (Zero {t3} [n] p3 _)))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && registerizable(b, t2) && n >= o2 + t2.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Zero {t1} [n] dst mem)) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpVarDef { |
| break |
| } |
| mem_0 := mem.Args[0] |
| if mem_0.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem_0.Aux) |
| _ = mem_0.Args[2] |
| op2 := mem_0.Args[0] |
| if op2.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := op2.Type |
| o2 := ssa.AuxIntToInt64(op2.AuxInt) |
| p2 := op2.Args[0] |
| d1 := mem_0.Args[1] |
| mem_0_2 := mem_0.Args[2] |
| if mem_0_2.Op != ssaop.OpZero || ssa.AuxIntToInt64(mem_0_2.AuxInt) != n { |
| break |
| } |
| t3 := ssa.AuxToType(mem_0_2.Aux) |
| p3 := mem_0_2.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && registerizable(b, t2) && n >= o2+t2.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpZero, types.TypeMem) |
| v1.AuxInt = ssa.Int64ToAuxInt(n) |
| v1.Aux = ssa.TypeToAux(t1) |
| v1.AddArg2(dst, mem) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(VarDef (Store {t2} (OffPtr <tt2> [o2] p2) d1 (Store {t3} (OffPtr <tt3> [o3] p3) d2 (Zero {t4} [n] p4 _))))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && n >= o2 + t2.Size() && n >= o3 + t3.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Store {t3} (OffPtr <tt3> [o3] dst) d2 (Zero {t1} [n] dst mem))) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpVarDef { |
| break |
| } |
| mem_0 := mem.Args[0] |
| if mem_0.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem_0.Aux) |
| _ = mem_0.Args[2] |
| mem_0_0 := mem_0.Args[0] |
| if mem_0_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := mem_0_0.Type |
| o2 := ssa.AuxIntToInt64(mem_0_0.AuxInt) |
| p2 := mem_0_0.Args[0] |
| d1 := mem_0.Args[1] |
| mem_0_2 := mem_0.Args[2] |
| if mem_0_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_0_2.Aux) |
| _ = mem_0_2.Args[2] |
| mem_0_2_0 := mem_0_2.Args[0] |
| if mem_0_2_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt3 := mem_0_2_0.Type |
| o3 := ssa.AuxIntToInt64(mem_0_2_0.AuxInt) |
| p3 := mem_0_2_0.Args[0] |
| d2 := mem_0_2.Args[1] |
| mem_0_2_2 := mem_0_2.Args[2] |
| if mem_0_2_2.Op != ssaop.OpZero || ssa.AuxIntToInt64(mem_0_2_2.AuxInt) != n { |
| break |
| } |
| t4 := ssa.AuxToType(mem_0_2_2.Aux) |
| p4 := mem_0_2_2.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && n >= o2+t2.Size() && n >= o3+t3.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt3) |
| v2.AuxInt = ssa.Int64ToAuxInt(o3) |
| v2.AddArg(dst) |
| v3 := b.NewValue0(v.Pos, ssaop.OpZero, types.TypeMem) |
| v3.AuxInt = ssa.Int64ToAuxInt(n) |
| v3.Aux = ssa.TypeToAux(t1) |
| v3.AddArg2(dst, mem) |
| v1.AddArg3(v2, d2, v3) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(VarDef (Store {t2} (OffPtr <tt2> [o2] p2) d1 (Store {t3} (OffPtr <tt3> [o3] p3) d2 (Store {t4} (OffPtr <tt4> [o4] p4) d3 (Zero {t5} [n] p5 _)))))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && t5.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && n >= o2 + t2.Size() && n >= o3 + t3.Size() && n >= o4 + t4.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Store {t3} (OffPtr <tt3> [o3] dst) d2 (Store {t4} (OffPtr <tt4> [o4] dst) d3 (Zero {t1} [n] dst mem)))) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpVarDef { |
| break |
| } |
| mem_0 := mem.Args[0] |
| if mem_0.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem_0.Aux) |
| _ = mem_0.Args[2] |
| mem_0_0 := mem_0.Args[0] |
| if mem_0_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := mem_0_0.Type |
| o2 := ssa.AuxIntToInt64(mem_0_0.AuxInt) |
| p2 := mem_0_0.Args[0] |
| d1 := mem_0.Args[1] |
| mem_0_2 := mem_0.Args[2] |
| if mem_0_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_0_2.Aux) |
| _ = mem_0_2.Args[2] |
| mem_0_2_0 := mem_0_2.Args[0] |
| if mem_0_2_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt3 := mem_0_2_0.Type |
| o3 := ssa.AuxIntToInt64(mem_0_2_0.AuxInt) |
| p3 := mem_0_2_0.Args[0] |
| d2 := mem_0_2.Args[1] |
| mem_0_2_2 := mem_0_2.Args[2] |
| if mem_0_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(mem_0_2_2.Aux) |
| _ = mem_0_2_2.Args[2] |
| mem_0_2_2_0 := mem_0_2_2.Args[0] |
| if mem_0_2_2_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt4 := mem_0_2_2_0.Type |
| o4 := ssa.AuxIntToInt64(mem_0_2_2_0.AuxInt) |
| p4 := mem_0_2_2_0.Args[0] |
| d3 := mem_0_2_2.Args[1] |
| mem_0_2_2_2 := mem_0_2_2.Args[2] |
| if mem_0_2_2_2.Op != ssaop.OpZero || ssa.AuxIntToInt64(mem_0_2_2_2.AuxInt) != n { |
| break |
| } |
| t5 := ssa.AuxToType(mem_0_2_2_2.Aux) |
| p5 := mem_0_2_2_2.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && t5.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && n >= o2+t2.Size() && n >= o3+t3.Size() && n >= o4+t4.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt3) |
| v2.AuxInt = ssa.Int64ToAuxInt(o3) |
| v2.AddArg(dst) |
| v3 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v3.Aux = ssa.TypeToAux(t4) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt4) |
| v4.AuxInt = ssa.Int64ToAuxInt(o4) |
| v4.AddArg(dst) |
| v5 := b.NewValue0(v.Pos, ssaop.OpZero, types.TypeMem) |
| v5.AuxInt = ssa.Int64ToAuxInt(n) |
| v5.Aux = ssa.TypeToAux(t1) |
| v5.AddArg2(dst, mem) |
| v3.AddArg3(v4, d3, v5) |
| v1.AddArg3(v2, d2, v3) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [n] dst p1 mem:(VarDef (Store {t2} (OffPtr <tt2> [o2] p2) d1 (Store {t3} (OffPtr <tt3> [o3] p3) d2 (Store {t4} (OffPtr <tt4> [o4] p4) d3 (Store {t5} (OffPtr <tt5> [o5] p5) d4 (Zero {t6} [n] p6 _))))))) |
| // cond: ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && ssa.IsSamePtr(p5, p6) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && t5.Alignment() <= t1.Alignment() && t6.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && registerizable(b, t5) && n >= o2 + t2.Size() && n >= o3 + t3.Size() && n >= o4 + t4.Size() && n >= o5 + t5.Size() |
| // result: (Store {t2} (OffPtr <tt2> [o2] dst) d1 (Store {t3} (OffPtr <tt3> [o3] dst) d2 (Store {t4} (OffPtr <tt4> [o4] dst) d3 (Store {t5} (OffPtr <tt5> [o5] dst) d4 (Zero {t1} [n] dst mem))))) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| p1 := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpVarDef { |
| break |
| } |
| mem_0 := mem.Args[0] |
| if mem_0.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem_0.Aux) |
| _ = mem_0.Args[2] |
| mem_0_0 := mem_0.Args[0] |
| if mem_0_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt2 := mem_0_0.Type |
| o2 := ssa.AuxIntToInt64(mem_0_0.AuxInt) |
| p2 := mem_0_0.Args[0] |
| d1 := mem_0.Args[1] |
| mem_0_2 := mem_0.Args[2] |
| if mem_0_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_0_2.Aux) |
| _ = mem_0_2.Args[2] |
| mem_0_2_0 := mem_0_2.Args[0] |
| if mem_0_2_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt3 := mem_0_2_0.Type |
| o3 := ssa.AuxIntToInt64(mem_0_2_0.AuxInt) |
| p3 := mem_0_2_0.Args[0] |
| d2 := mem_0_2.Args[1] |
| mem_0_2_2 := mem_0_2.Args[2] |
| if mem_0_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(mem_0_2_2.Aux) |
| _ = mem_0_2_2.Args[2] |
| mem_0_2_2_0 := mem_0_2_2.Args[0] |
| if mem_0_2_2_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt4 := mem_0_2_2_0.Type |
| o4 := ssa.AuxIntToInt64(mem_0_2_2_0.AuxInt) |
| p4 := mem_0_2_2_0.Args[0] |
| d3 := mem_0_2_2.Args[1] |
| mem_0_2_2_2 := mem_0_2_2.Args[2] |
| if mem_0_2_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t5 := ssa.AuxToType(mem_0_2_2_2.Aux) |
| _ = mem_0_2_2_2.Args[2] |
| mem_0_2_2_2_0 := mem_0_2_2_2.Args[0] |
| if mem_0_2_2_2_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| tt5 := mem_0_2_2_2_0.Type |
| o5 := ssa.AuxIntToInt64(mem_0_2_2_2_0.AuxInt) |
| p5 := mem_0_2_2_2_0.Args[0] |
| d4 := mem_0_2_2_2.Args[1] |
| mem_0_2_2_2_2 := mem_0_2_2_2.Args[2] |
| if mem_0_2_2_2_2.Op != ssaop.OpZero || ssa.AuxIntToInt64(mem_0_2_2_2_2.AuxInt) != n { |
| break |
| } |
| t6 := ssa.AuxToType(mem_0_2_2_2_2.Aux) |
| p6 := mem_0_2_2_2_2.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && ssa.IsSamePtr(p5, p6) && t2.Alignment() <= t1.Alignment() && t3.Alignment() <= t1.Alignment() && t4.Alignment() <= t1.Alignment() && t5.Alignment() <= t1.Alignment() && t6.Alignment() <= t1.Alignment() && registerizable(b, t2) && registerizable(b, t3) && registerizable(b, t4) && registerizable(b, t5) && n >= o2+t2.Size() && n >= o3+t3.Size() && n >= o4+t4.Size() && n >= o5+t5.Size()) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t2) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt2) |
| v0.AuxInt = ssa.Int64ToAuxInt(o2) |
| v0.AddArg(dst) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt3) |
| v2.AuxInt = ssa.Int64ToAuxInt(o3) |
| v2.AddArg(dst) |
| v3 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v3.Aux = ssa.TypeToAux(t4) |
| v4 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt4) |
| v4.AuxInt = ssa.Int64ToAuxInt(o4) |
| v4.AddArg(dst) |
| v5 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v5.Aux = ssa.TypeToAux(t5) |
| v6 := b.NewValue0(v.Pos, ssaop.OpOffPtr, tt5) |
| v6.AuxInt = ssa.Int64ToAuxInt(o5) |
| v6.AddArg(dst) |
| v7 := b.NewValue0(v.Pos, ssaop.OpZero, types.TypeMem) |
| v7.AuxInt = ssa.Int64ToAuxInt(n) |
| v7.Aux = ssa.TypeToAux(t1) |
| v7.AddArg2(dst, mem) |
| v5.AddArg3(v6, d4, v7) |
| v3.AddArg3(v4, d3, v5) |
| v1.AddArg3(v2, d2, v3) |
| v.AddArg3(v0, d1, v1) |
| return true |
| } |
| // match: (Move {t1} [s] dst tmp1 midmem:(Move {t2} [s] tmp2 src _)) |
| // cond: t1.Compare(t2) == types.CMPeq && ssa.IsSamePtr(tmp1, tmp2) && isStackPtr(src) && !ssa.IsVolatile(src) && ssa.Disjoint1(src, s, tmp2, s) && (ssa.Disjoint1(src, s, dst, s) || ssa.IsInlinableMemmove(dst, src, s, config)) |
| // result: (Move {t1} [s] dst src midmem) |
| for { |
| s := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| tmp1 := v_1 |
| midmem := v_2 |
| if midmem.Op != ssaop.OpMove || ssa.AuxIntToInt64(midmem.AuxInt) != s { |
| break |
| } |
| t2 := ssa.AuxToType(midmem.Aux) |
| src := midmem.Args[1] |
| tmp2 := midmem.Args[0] |
| if !(t1.Compare(t2) == types.CMPeq && ssa.IsSamePtr(tmp1, tmp2) && isStackPtr(src) && !ssa.IsVolatile(src) && ssa.Disjoint1(src, s, tmp2, s) && (ssa.Disjoint1(src, s, dst, s) || ssa.IsInlinableMemmove(dst, src, s, config))) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(s) |
| v.Aux = ssa.TypeToAux(t1) |
| v.AddArg3(dst, src, midmem) |
| return true |
| } |
| // match: (Move {t1} [s] dst tmp1 midmem:(VarDef (Move {t2} [s] tmp2 src _))) |
| // cond: t1.Compare(t2) == types.CMPeq && ssa.IsSamePtr(tmp1, tmp2) && isStackPtr(src) && !ssa.IsVolatile(src) && ssa.Disjoint1(src, s, tmp2, s) && (ssa.Disjoint1(src, s, dst, s) || ssa.IsInlinableMemmove(dst, src, s, config)) |
| // result: (Move {t1} [s] dst src midmem) |
| for { |
| s := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| tmp1 := v_1 |
| midmem := v_2 |
| if midmem.Op != ssaop.OpVarDef { |
| break |
| } |
| midmem_0 := midmem.Args[0] |
| if midmem_0.Op != ssaop.OpMove || ssa.AuxIntToInt64(midmem_0.AuxInt) != s { |
| break |
| } |
| t2 := ssa.AuxToType(midmem_0.Aux) |
| src := midmem_0.Args[1] |
| tmp2 := midmem_0.Args[0] |
| if !(t1.Compare(t2) == types.CMPeq && ssa.IsSamePtr(tmp1, tmp2) && isStackPtr(src) && !ssa.IsVolatile(src) && ssa.Disjoint1(src, s, tmp2, s) && (ssa.Disjoint1(src, s, dst, s) || ssa.IsInlinableMemmove(dst, src, s, config))) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(s) |
| v.Aux = ssa.TypeToAux(t1) |
| v.AddArg3(dst, src, midmem) |
| return true |
| } |
| // match: (Move dst src mem) |
| // cond: ssa.IsSamePtr(dst, src) |
| // result: mem |
| for { |
| dst := v_0 |
| src := v_1 |
| mem := v_2 |
| if !(ssa.IsSamePtr(dst, src)) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpMul16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Mul16 (Const16 [c]) (Const16 [d])) |
| // result: (Const16 [c*d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(c * d) |
| return true |
| } |
| break |
| } |
| // match: (Mul16 (Const16 [1]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 1 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Mul16 (Const16 [-1]) x) |
| // result: (Neg16 x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNeg16) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Mul16 (Const16 <t> [c]) (Neg16 x)) |
| // result: (Mul16 x (Const16 <t> [-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpNeg16 { |
| continue |
| } |
| x := v_1.Args[0] |
| v.Reset(ssaop.OpMul16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(-c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul16 (Neg16 x) (Neg16 y)) |
| // result: (Mul16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeg16 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpNeg16 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpMul16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Mul16 (Const16 <t> [c]) (Add16 <t> (Const16 <t> [d]) x)) |
| // cond: !ssa.IsPowerOfTwo(c) |
| // result: (Add16 (Const16 <t> [c*d]) (Mul16 <t> (Const16 <t> [c]) x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAdd16 || v_1.Type != t { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst16 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_0.AuxInt) |
| x := v_1_1 |
| if !(!ssa.IsPowerOfTwo(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c * d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpMul16, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v2.AuxInt = ssa.Int16ToAuxInt(c) |
| v1.AddArg2(v2, x) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Mul16 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (Mul16 <t> x (Const16 [c])) |
| // cond: ssa.IsPowerOfTwo(uint16(c)) && v.Block.Func.Pass.Name != "opt" |
| // result: (Lsh16x64 <t> x (Const64 <typ.UInt64> [ssa.Log16u(uint16(c))])) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint16(c)) && v.Block.Func.Pass.Name != "opt") { |
| continue |
| } |
| v.Reset(ssaop.OpLsh16x64) |
| v.Type = t |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(ssa.Log16u(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul16 <t> x (Const16 [c])) |
| // cond: ssa.IsPowerOfTwo(uint16(-c)) && v.Block.Func.Pass.Name != "opt" |
| // result: (Neg16 (Lsh16x64 <t> x (Const64 <typ.UInt64> [ssa.Log16u(uint16(-c))]))) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint16(-c)) && v.Block.Func.Pass.Name != "opt") { |
| continue |
| } |
| v.Reset(ssaop.OpNeg16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLsh16x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v1.AuxInt = ssa.Int64ToAuxInt(ssa.Log16u(uint16(-c))) |
| v0.AddArg2(x, v1) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul16 (Mul16 i:(Const16 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) |
| // result: (Mul16 i (Mul16 <t> x z)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpMul16 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) { |
| continue |
| } |
| v.Reset(ssaop.OpMul16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul16, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Mul16 (Const16 <t> [c]) m:(Mul16 (Const16 <t> [d]) x)) |
| // cond: (!ssa.IsPowerOfTwo(c) || m.Uses == 1) |
| // result: (Mul16 (Const16 <t> [c*d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| m := v_1 |
| if m.Op != ssaop.OpMul16 { |
| continue |
| } |
| _ = m.Args[1] |
| m_0 := m.Args[0] |
| m_1 := m.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, m_0, m_1 = _i1+1, m_1, m_0 { |
| if m_0.Op != ssaop.OpConst16 || m_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt16(m_0.AuxInt) |
| x := m_1 |
| if !(!ssa.IsPowerOfTwo(c) || m.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpMul16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c * d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpMul32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Mul32 (Const32 [c]) (Const32 [d])) |
| // result: (Const32 [c*d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(c * d) |
| return true |
| } |
| break |
| } |
| // match: (Mul32 (Const32 [1]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 1 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Mul32 (Const32 [-1]) x) |
| // result: (Neg32 x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNeg32) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Mul32 (Const32 <t> [c]) (Neg32 x)) |
| // result: (Mul32 x (Const32 <t> [-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpNeg32 { |
| continue |
| } |
| x := v_1.Args[0] |
| v.Reset(ssaop.OpMul32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(-c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul32 (Neg32 x) (Neg32 y)) |
| // result: (Mul32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeg32 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpNeg32 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpMul32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Mul32 (Const32 <t> [c]) (Add32 <t> (Const32 <t> [d]) x)) |
| // cond: !ssa.IsPowerOfTwo(c) |
| // result: (Add32 (Const32 <t> [c*d]) (Mul32 <t> (Const32 <t> [c]) x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAdd32 || v_1.Type != t { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst32 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_0.AuxInt) |
| x := v_1_1 |
| if !(!ssa.IsPowerOfTwo(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c * d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpMul32, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v2.AuxInt = ssa.Int32ToAuxInt(c) |
| v1.AddArg2(v2, x) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Mul32 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (Mul32 <t> x (Const32 [c])) |
| // cond: ssa.IsPowerOfTwo(uint32(c)) && v.Block.Func.Pass.Name != "opt" |
| // result: (Lsh32x64 <t> x (Const64 <typ.UInt64> [ssa.Log32u(uint32(c))])) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint32(c)) && v.Block.Func.Pass.Name != "opt") { |
| continue |
| } |
| v.Reset(ssaop.OpLsh32x64) |
| v.Type = t |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(ssa.Log32u(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul32 <t> x (Const32 [c])) |
| // cond: ssa.IsPowerOfTwo(uint32(-c)) && v.Block.Func.Pass.Name != "opt" |
| // result: (Neg32 (Lsh32x64 <t> x (Const64 <typ.UInt64> [ssa.Log32u(uint32(-c))]))) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint32(-c)) && v.Block.Func.Pass.Name != "opt") { |
| continue |
| } |
| v.Reset(ssaop.OpNeg32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLsh32x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v1.AuxInt = ssa.Int64ToAuxInt(ssa.Log32u(uint32(-c))) |
| v0.AddArg2(x, v1) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul32 (Mul32 i:(Const32 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) |
| // result: (Mul32 i (Mul32 <t> x z)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpMul32 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) { |
| continue |
| } |
| v.Reset(ssaop.OpMul32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul32, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Mul32 (Const32 <t> [c]) m:(Mul32 (Const32 <t> [d]) x)) |
| // cond: (!ssa.IsPowerOfTwo(c) || m.Uses == 1) |
| // result: (Mul32 (Const32 <t> [c*d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| m := v_1 |
| if m.Op != ssaop.OpMul32 { |
| continue |
| } |
| _ = m.Args[1] |
| m_0 := m.Args[0] |
| m_1 := m.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, m_0, m_1 = _i1+1, m_1, m_0 { |
| if m_0.Op != ssaop.OpConst32 || m_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt32(m_0.AuxInt) |
| x := m_1 |
| if !(!ssa.IsPowerOfTwo(c) || m.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpMul32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c * d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpMul32F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Mul32F (Const32F [c]) (Const32F [d])) |
| // cond: c*d == c*d |
| // result: (Const32F [c*d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32F { |
| continue |
| } |
| c := ssa.AuxIntToFloat32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32F { |
| continue |
| } |
| d := ssa.AuxIntToFloat32(v_1.AuxInt) |
| if !(c*d == c*d) { |
| continue |
| } |
| v.Reset(ssaop.OpConst32F) |
| v.AuxInt = ssa.Float32ToAuxInt(c * d) |
| return true |
| } |
| break |
| } |
| // match: (Mul32F x (Const32F [1])) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32F || ssa.AuxIntToFloat32(v_1.AuxInt) != 1 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Mul32F x (Const32F [-1])) |
| // result: (Neg32F x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32F || ssa.AuxIntToFloat32(v_1.AuxInt) != -1 { |
| continue |
| } |
| v.Reset(ssaop.OpNeg32F) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Mul32F x (Const32F [2])) |
| // result: (Add32F x x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32F || ssa.AuxIntToFloat32(v_1.AuxInt) != 2 { |
| continue |
| } |
| v.Reset(ssaop.OpAdd32F) |
| v.AddArg2(x, x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpMul32uhilo(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Mul32uhilo (Const32 [c]) (Const32 [d])) |
| // result: (MakeTuple (Const32 <typ.UInt32> [bitsMulU32(c, d).hi]) (Const32 <typ.UInt32> [bitsMulU32(c,d).lo])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.UInt32) |
| v0.AuxInt = ssa.Int32ToAuxInt(bitsMulU32(c, d).hi) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.UInt32) |
| v1.AuxInt = ssa.Int32ToAuxInt(bitsMulU32(c, d).lo) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpMul32uover(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Mul32uover (Const32 [c]) (Const32 [d])) |
| // result: (MakeTuple (Const32 <typ.UInt32> [bitsMulU32(c, d).lo]) (ConstBool <typ.Bool> [bitsMulU32(c,d).hi != 0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.UInt32) |
| v0.AuxInt = ssa.Int32ToAuxInt(bitsMulU32(c, d).lo) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConstBool, typ.Bool) |
| v1.AuxInt = ssa.BoolToAuxInt(bitsMulU32(c, d).hi != 0) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (Mul32uover <t> (Const32 [1]) x) |
| // result: (MakeTuple x (ConstBool <t.FieldType(1)> [false])) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 1 { |
| continue |
| } |
| x := v_1 |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConstBool, t.FieldType(1)) |
| v0.AuxInt = ssa.BoolToAuxInt(false) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul32uover <t> (Const32 [0]) x) |
| // result: (MakeTuple (Const32 <t.FieldType(0)> [0]) (ConstBool <t.FieldType(1)> [false])) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t.FieldType(0)) |
| v0.AuxInt = ssa.Int32ToAuxInt(0) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConstBool, t.FieldType(1)) |
| v1.AuxInt = ssa.BoolToAuxInt(false) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpMul64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Mul64 (Const64 [c]) (Const64 [d])) |
| // result: (Const64 [c*d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(c * d) |
| return true |
| } |
| break |
| } |
| // match: (Mul64 (Const64 [1]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 1 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Mul64 (Const64 [-1]) x) |
| // result: (Neg64 x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNeg64) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Mul64 (Const64 <t> [c]) (Neg64 x)) |
| // result: (Mul64 x (Const64 <t> [-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpNeg64 { |
| continue |
| } |
| x := v_1.Args[0] |
| v.Reset(ssaop.OpMul64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(-c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul64 (Neg64 x) (Neg64 y)) |
| // result: (Mul64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeg64 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpNeg64 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpMul64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Mul64 (Const64 <t> [c]) (Add64 <t> (Const64 <t> [d]) x)) |
| // cond: !ssa.IsPowerOfTwo(c) |
| // result: (Add64 (Const64 <t> [c*d]) (Mul64 <t> (Const64 <t> [c]) x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAdd64 || v_1.Type != t { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst64 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_0.AuxInt) |
| x := v_1_1 |
| if !(!ssa.IsPowerOfTwo(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c * d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpMul64, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v2.AuxInt = ssa.Int64ToAuxInt(c) |
| v1.AddArg2(v2, x) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Mul64 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (Mul64 <t> x (Const64 [c])) |
| // cond: ssa.IsPowerOfTwo(uint64(c)) && v.Block.Func.Pass.Name != "opt" |
| // result: (Lsh64x64 <t> x (Const64 <typ.UInt64> [ssa.Log64u(uint64(c))])) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint64(c)) && v.Block.Func.Pass.Name != "opt") { |
| continue |
| } |
| v.Reset(ssaop.OpLsh64x64) |
| v.Type = t |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(ssa.Log64u(uint64(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul64 <t> x (Const64 [c])) |
| // cond: ssa.IsPowerOfTwo(uint64(-c)) && v.Block.Func.Pass.Name != "opt" |
| // result: (Neg64 (Lsh64x64 <t> x (Const64 <typ.UInt64> [ssa.Log64u(uint64(-c))]))) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint64(-c)) && v.Block.Func.Pass.Name != "opt") { |
| continue |
| } |
| v.Reset(ssaop.OpNeg64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLsh64x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v1.AuxInt = ssa.Int64ToAuxInt(ssa.Log64u(uint64(-c))) |
| v0.AddArg2(x, v1) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul64 (Mul64 i:(Const64 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) |
| // result: (Mul64 i (Mul64 <t> x z)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpMul64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) { |
| continue |
| } |
| v.Reset(ssaop.OpMul64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul64, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Mul64 (Const64 <t> [c]) m:(Mul64 (Const64 <t> [d]) x)) |
| // cond: (!ssa.IsPowerOfTwo(c) || m.Uses == 1) |
| // result: (Mul64 (Const64 <t> [c*d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| m := v_1 |
| if m.Op != ssaop.OpMul64 { |
| continue |
| } |
| _ = m.Args[1] |
| m_0 := m.Args[0] |
| m_1 := m.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, m_0, m_1 = _i1+1, m_1, m_0 { |
| if m_0.Op != ssaop.OpConst64 || m_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt64(m_0.AuxInt) |
| x := m_1 |
| if !(!ssa.IsPowerOfTwo(c) || m.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpMul64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c * d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpMul64F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Mul64F (Const64F [c]) (Const64F [d])) |
| // cond: c*d == c*d |
| // result: (Const64F [c*d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64F { |
| continue |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64F { |
| continue |
| } |
| d := ssa.AuxIntToFloat64(v_1.AuxInt) |
| if !(c*d == c*d) { |
| continue |
| } |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(c * d) |
| return true |
| } |
| break |
| } |
| // match: (Mul64F x (Const64F [1])) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64F || ssa.AuxIntToFloat64(v_1.AuxInt) != 1 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Mul64F x (Const64F [-1])) |
| // result: (Neg64F x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64F || ssa.AuxIntToFloat64(v_1.AuxInt) != -1 { |
| continue |
| } |
| v.Reset(ssaop.OpNeg64F) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Mul64F x (Const64F [2])) |
| // result: (Add64F x x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64F || ssa.AuxIntToFloat64(v_1.AuxInt) != 2 { |
| continue |
| } |
| v.Reset(ssaop.OpAdd64F) |
| v.AddArg2(x, x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpMul64uhilo(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Mul64uhilo (Const64 [c]) (Const64 [d])) |
| // result: (MakeTuple (Const64 <typ.UInt64> [bitsMulU64(c, d).hi]) (Const64 <typ.UInt64> [bitsMulU64(c,d).lo])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(bitsMulU64(c, d).hi) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v1.AuxInt = ssa.Int64ToAuxInt(bitsMulU64(c, d).lo) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (Mul64uhilo x (Const64 [c])) |
| // cond: c > 0 && ssa.IsPowerOfTwo(uint64(c)) |
| // result: (MakeTuple (Rsh64Ux64 <typ.UInt64> x (Const64 <typ.UInt64> [64 - ssa.Log64u(uint64(c))])) (Lsh64x64 <typ.UInt64> x (Const64 <typ.UInt64> [ssa.Log64u(uint64(c))]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c > 0 && ssa.IsPowerOfTwo(uint64(c))) { |
| continue |
| } |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpRsh64Ux64, typ.UInt64) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v1.AuxInt = ssa.Int64ToAuxInt(64 - ssa.Log64u(uint64(c))) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpLsh64x64, typ.UInt64) |
| v3 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v3.AuxInt = ssa.Int64ToAuxInt(ssa.Log64u(uint64(c))) |
| v2.AddArg2(x, v3) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpMul64uover(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Mul64uover (Const64 [c]) (Const64 [d])) |
| // result: (MakeTuple (Const64 <typ.UInt64> [bitsMulU64(c, d).lo]) (ConstBool <typ.Bool> [bitsMulU64(c,d).hi != 0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(bitsMulU64(c, d).lo) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConstBool, typ.Bool) |
| v1.AuxInt = ssa.BoolToAuxInt(bitsMulU64(c, d).hi != 0) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (Mul64uover <t> (Const64 [1]) x) |
| // result: (MakeTuple x (ConstBool <t.FieldType(1)> [false])) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 1 { |
| continue |
| } |
| x := v_1 |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConstBool, t.FieldType(1)) |
| v0.AuxInt = ssa.BoolToAuxInt(false) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul64uover <t> (Const64 [0]) x) |
| // result: (MakeTuple (Const64 <t.FieldType(0)> [0]) (ConstBool <t.FieldType(1)> [false])) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t.FieldType(0)) |
| v0.AuxInt = ssa.Int64ToAuxInt(0) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConstBool, t.FieldType(1)) |
| v1.AuxInt = ssa.BoolToAuxInt(false) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpMul8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Mul8 (Const8 [c]) (Const8 [d])) |
| // result: (Const8 [c*d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(c * d) |
| return true |
| } |
| break |
| } |
| // match: (Mul8 (Const8 [1]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 1 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Mul8 (Const8 [-1]) x) |
| // result: (Neg8 x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNeg8) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Mul8 (Const8 <t> [c]) (Neg8 x)) |
| // result: (Mul8 x (Const8 <t> [-c])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpNeg8 { |
| continue |
| } |
| x := v_1.Args[0] |
| v.Reset(ssaop.OpMul8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(-c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul8 (Neg8 x) (Neg8 y)) |
| // result: (Mul8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeg8 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpNeg8 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpMul8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Mul8 (Const8 <t> [c]) (Add8 <t> (Const8 <t> [d]) x)) |
| // cond: !ssa.IsPowerOfTwo(c) |
| // result: (Add8 (Const8 <t> [c*d]) (Mul8 <t> (Const8 <t> [c]) x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAdd8 || v_1.Type != t { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst8 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_0.AuxInt) |
| x := v_1_1 |
| if !(!ssa.IsPowerOfTwo(c)) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c * d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpMul8, t) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v2.AuxInt = ssa.Int8ToAuxInt(c) |
| v1.AddArg2(v2, x) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Mul8 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| continue |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| break |
| } |
| // match: (Mul8 <t> x (Const8 [c])) |
| // cond: ssa.IsPowerOfTwo(uint8(c)) && v.Block.Func.Pass.Name != "opt" |
| // result: (Lsh8x64 <t> x (Const64 <typ.UInt64> [ssa.Log8u(uint8(c))])) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint8(c)) && v.Block.Func.Pass.Name != "opt") { |
| continue |
| } |
| v.Reset(ssaop.OpLsh8x64) |
| v.Type = t |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(ssa.Log8u(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul8 <t> x (Const8 [c])) |
| // cond: ssa.IsPowerOfTwo(uint8(-c)) && v.Block.Func.Pass.Name != "opt" |
| // result: (Neg8 (Lsh8x64 <t> x (Const64 <typ.UInt64> [ssa.Log8u(uint8(-c))]))) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(ssa.IsPowerOfTwo(uint8(-c)) && v.Block.Func.Pass.Name != "opt") { |
| continue |
| } |
| v.Reset(ssaop.OpNeg8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLsh8x64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v1.AuxInt = ssa.Int64ToAuxInt(ssa.Log8u(uint8(-c))) |
| v0.AddArg2(x, v1) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (Mul8 (Mul8 i:(Const8 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) |
| // result: (Mul8 i (Mul8 <t> x z)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpMul8 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) { |
| continue |
| } |
| v.Reset(ssaop.OpMul8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul8, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Mul8 (Const8 <t> [c]) m:(Mul8 (Const8 <t> [d]) x)) |
| // cond: (!ssa.IsPowerOfTwo(c) || m.Uses == 1) |
| // result: (Mul8 (Const8 <t> [c*d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| m := v_1 |
| if m.Op != ssaop.OpMul8 { |
| continue |
| } |
| _ = m.Args[1] |
| m_0 := m.Args[0] |
| m_1 := m.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, m_0, m_1 = _i1+1, m_1, m_0 { |
| if m_0.Op != ssaop.OpConst8 || m_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt8(m_0.AuxInt) |
| x := m_1 |
| if !(!ssa.IsPowerOfTwo(c) || m.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpMul8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c * d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpNeg16(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Neg16 (Const16 [c])) |
| // result: (Const16 [-c]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(-c) |
| return true |
| } |
| // match: (Neg16 (Mul16 x (Const16 <t> [c]))) |
| // result: (Mul16 x (Const16 <t> [-c])) |
| for { |
| if v_0.Op != ssaop.OpMul16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0_1.Type |
| c := ssa.AuxIntToInt16(v_0_1.AuxInt) |
| v.Reset(ssaop.OpMul16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(-c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Neg16 (Mul16 x (Neg16 y))) |
| // result: (Mul16 x y) |
| for { |
| if v_0.Op != ssaop.OpMul16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpNeg16 { |
| continue |
| } |
| y := v_0_1.Args[0] |
| v.Reset(ssaop.OpMul16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Neg16 (Sub16 x y)) |
| // result: (Sub16 y x) |
| for { |
| if v_0.Op != ssaop.OpSub16 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpSub16) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Neg16 (Neg16 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpNeg16 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Neg16 <t> (Com16 x)) |
| // result: (Add16 (Const16 <t> [1]) x) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpCom16 { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpAdd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(1) |
| v.AddArg2(v0, x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpNeg32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Neg32 (Const32 [c])) |
| // result: (Const32 [-c]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(-c) |
| return true |
| } |
| // match: (Neg32 (Mul32 x (Const32 <t> [c]))) |
| // result: (Mul32 x (Const32 <t> [-c])) |
| for { |
| if v_0.Op != ssaop.OpMul32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0_1.Type |
| c := ssa.AuxIntToInt32(v_0_1.AuxInt) |
| v.Reset(ssaop.OpMul32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(-c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Neg32 (Mul32 x (Neg32 y))) |
| // result: (Mul32 x y) |
| for { |
| if v_0.Op != ssaop.OpMul32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpNeg32 { |
| continue |
| } |
| y := v_0_1.Args[0] |
| v.Reset(ssaop.OpMul32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Neg32 (Sub32 x y)) |
| // result: (Sub32 y x) |
| for { |
| if v_0.Op != ssaop.OpSub32 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpSub32) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Neg32 (Neg32 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpNeg32 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Neg32 <t> (Com32 x)) |
| // result: (Add32 (Const32 <t> [1]) x) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpCom32 { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpAdd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(1) |
| v.AddArg2(v0, x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpNeg32F(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Neg32F (Const32F [c])) |
| // cond: c != 0 |
| // result: (Const32F [-c]) |
| for { |
| if v_0.Op != ssaop.OpConst32F { |
| break |
| } |
| c := ssa.AuxIntToFloat32(v_0.AuxInt) |
| if !(c != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst32F) |
| v.AuxInt = ssa.Float32ToAuxInt(-c) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpNeg64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Neg64 (Const64 [c])) |
| // result: (Const64 [-c]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(-c) |
| return true |
| } |
| // match: (Neg64 (Mul64 x (Const64 <t> [c]))) |
| // result: (Mul64 x (Const64 <t> [-c])) |
| for { |
| if v_0.Op != ssaop.OpMul64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| v.Reset(ssaop.OpMul64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(-c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Neg64 (Mul64 x (Neg64 y))) |
| // result: (Mul64 x y) |
| for { |
| if v_0.Op != ssaop.OpMul64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpNeg64 { |
| continue |
| } |
| y := v_0_1.Args[0] |
| v.Reset(ssaop.OpMul64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Neg64 (Sub64 x y)) |
| // result: (Sub64 y x) |
| for { |
| if v_0.Op != ssaop.OpSub64 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpSub64) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Neg64 (Neg64 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpNeg64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Neg64 <t> (Com64 x)) |
| // result: (Add64 (Const64 <t> [1]) x) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpCom64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpAdd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(1) |
| v.AddArg2(v0, x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpNeg64F(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Neg64F (Const64F [c])) |
| // cond: c != 0 |
| // result: (Const64F [-c]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| if !(c != 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(-c) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpNeg8(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Neg8 (Const8 [c])) |
| // result: (Const8 [-c]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(-c) |
| return true |
| } |
| // match: (Neg8 (Mul8 x (Const8 <t> [c]))) |
| // result: (Mul8 x (Const8 <t> [-c])) |
| for { |
| if v_0.Op != ssaop.OpMul8 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0_1.Type |
| c := ssa.AuxIntToInt8(v_0_1.AuxInt) |
| v.Reset(ssaop.OpMul8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(-c) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Neg8 (Mul8 x (Neg8 y))) |
| // result: (Mul8 x y) |
| for { |
| if v_0.Op != ssaop.OpMul8 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpNeg8 { |
| continue |
| } |
| y := v_0_1.Args[0] |
| v.Reset(ssaop.OpMul8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Neg8 (Sub8 x y)) |
| // result: (Sub8 y x) |
| for { |
| if v_0.Op != ssaop.OpSub8 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpSub8) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Neg8 (Neg8 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpNeg8 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Neg8 <t> (Com8 x)) |
| // result: (Add8 (Const8 <t> [1]) x) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpCom8 { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpAdd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(1) |
| v.AddArg2(v0, x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpNeq16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Neq16 x x) |
| // result: (ConstBool [false]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Neq16 (Const16 <t> [c]) o:(Add16 (Const16 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Neq16 (Const16 <t> [c-d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpAdd16 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq16 (Const16 <t> [c]) o:(Sub16 x (Const16 [d]))) |
| // cond: o.Uses == 1 |
| // result: (Neq16 (Const16 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = o.Args[1] |
| x := o.Args[0] |
| o_1 := o.Args[1] |
| if o_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(o_1.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq16 (Const16 <t> [c]) o:(Sub16 (Const16 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Neq16 (Const16 <t> [d-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub16 { |
| continue |
| } |
| x := o.Args[1] |
| o_0 := o.Args[0] |
| if o_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(o_0.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(d - c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq16 (Const16 <t> [c]) o:(Xor16 (Const16 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Neq16 (Const16 <t> [d^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpXor16 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(d ^ c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq16 (Const16 <t> [c]) o:(Com16 x)) |
| // cond: o.Uses == 1 |
| // result: (Neq16 (Const16 <t> [^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpCom16 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(^c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq16 (Const16 <t> [c]) o:(Neg16 x)) |
| // cond: o.Uses == 1 |
| // result: (Neq16 (Const16 <t> [-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpNeg16 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(-c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq16 (Const16 <t> [c]) o:(Mul16 (Const16 [d]) x)) |
| // cond: uint16(d)%2 == 1 && o.Uses == 1 |
| // result: (Neq16 (Const16 <t> [int16(uint16(c) * uint16(modularMultiplicativeInverse(uint64(d))))]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpMul16 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(o_0.AuxInt) |
| x := o_1 |
| if !(uint16(d)%2 == 1 && o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(int16(uint16(c) * uint16(modularMultiplicativeInverse(uint64(d))))) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq16 (Const16 [c]) (Const16 [d])) |
| // result: (ConstBool [c != d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c != d) |
| return true |
| } |
| break |
| } |
| // match: (Neq16 s:(Sub16 x y) (Const16 [0])) |
| // cond: s.Uses == 1 |
| // result: (Neq16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| s := v_0 |
| if s.Op != ssaop.OpSub16 { |
| continue |
| } |
| y := s.Args[1] |
| x := s.Args[0] |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != 0 || !(s.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Neq16 (And16 <t> x (Const16 <t> [y])) (Const16 <t> [y])) |
| // cond: ssa.OneBit(y) |
| // result: (Eq16 (And16 <t> x (Const16 <t> [y])) (Const16 <t> [0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd16 { |
| continue |
| } |
| t := v_0.Type |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst16 || v_0_1.Type != t { |
| continue |
| } |
| y := ssa.AuxIntToInt16(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst16 || v_1.Type != t || ssa.AuxIntToInt16(v_1.AuxInt) != y || !(ssa.OneBit(y)) { |
| continue |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd16, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v1.AuxInt = ssa.Int16ToAuxInt(y) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v2.AuxInt = ssa.Int16ToAuxInt(0) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq16 (ZeroExt8to16 (CvtBoolToUint8 x)) (Const16 [0])) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to16 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != 0 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Neq16 (ZeroExt8to16 (CvtBoolToUint8 x)) (Const16 [1])) |
| // result: (Not x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to16 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != 1 { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpNeq32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Neq32 x x) |
| // result: (ConstBool [false]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Neq32 (Const32 <t> [c]) o:(Add32 (Const32 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Neq32 (Const32 <t> [c-d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpAdd32 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq32 (Const32 <t> [c]) o:(Sub32 x (Const32 [d]))) |
| // cond: o.Uses == 1 |
| // result: (Neq32 (Const32 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = o.Args[1] |
| x := o.Args[0] |
| o_1 := o.Args[1] |
| if o_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(o_1.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq32 (Const32 <t> [c]) o:(Sub32 (Const32 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Neq32 (Const32 <t> [d-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub32 { |
| continue |
| } |
| x := o.Args[1] |
| o_0 := o.Args[0] |
| if o_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(o_0.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(d - c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq32 (Const32 <t> [c]) o:(Xor32 (Const32 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Neq32 (Const32 <t> [d^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpXor32 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(d ^ c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq32 (Const32 <t> [c]) o:(Com32 x)) |
| // cond: o.Uses == 1 |
| // result: (Neq32 (Const32 <t> [^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpCom32 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(^c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq32 (Const32 <t> [c]) o:(Neg32 x)) |
| // cond: o.Uses == 1 |
| // result: (Neq32 (Const32 <t> [-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpNeg32 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(-c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq32 (Const32 <t> [c]) o:(Mul32 (Const32 [d]) x)) |
| // cond: uint32(d)%2 == 1 && o.Uses == 1 |
| // result: (Neq32 (Const32 <t> [int32(uint32(c) * uint32(modularMultiplicativeInverse(uint64(d))))]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpMul32 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(o_0.AuxInt) |
| x := o_1 |
| if !(uint32(d)%2 == 1 && o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(int32(uint32(c) * uint32(modularMultiplicativeInverse(uint64(d))))) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq32 (Const32 [c]) (Const32 [d])) |
| // result: (ConstBool [c != d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c != d) |
| return true |
| } |
| break |
| } |
| // match: (Neq32 s:(Sub32 x y) (Const32 [0])) |
| // cond: s.Uses == 1 |
| // result: (Neq32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| s := v_0 |
| if s.Op != ssaop.OpSub32 { |
| continue |
| } |
| y := s.Args[1] |
| x := s.Args[0] |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != 0 || !(s.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Neq32 (And32 <t> x (Const32 <t> [y])) (Const32 <t> [y])) |
| // cond: ssa.OneBit(y) |
| // result: (Eq32 (And32 <t> x (Const32 <t> [y])) (Const32 <t> [0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd32 { |
| continue |
| } |
| t := v_0.Type |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst32 || v_0_1.Type != t { |
| continue |
| } |
| y := ssa.AuxIntToInt32(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst32 || v_1.Type != t || ssa.AuxIntToInt32(v_1.AuxInt) != y || !(ssa.OneBit(y)) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd32, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v1.AuxInt = ssa.Int32ToAuxInt(y) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v2.AuxInt = ssa.Int32ToAuxInt(0) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq32 (ZeroExt8to32 (CvtBoolToUint8 x)) (Const32 [0])) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to32 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != 0 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Neq32 (ZeroExt8to32 (CvtBoolToUint8 x)) (Const32 [1])) |
| // result: (Not x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to32 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != 1 { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpNeq32F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Neq32F (Const32F [c]) (Const32F [d])) |
| // result: (ConstBool [c != d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32F { |
| continue |
| } |
| c := ssa.AuxIntToFloat32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32F { |
| continue |
| } |
| d := ssa.AuxIntToFloat32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c != d) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpNeq64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Neq64 x x) |
| // result: (ConstBool [false]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Neq64 (Const64 <t> [c]) o:(Add64 (Const64 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Neq64 (Const64 <t> [c-d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpAdd64 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq64 (Const64 <t> [c]) o:(Sub64 x (Const64 [d]))) |
| // cond: o.Uses == 1 |
| // result: (Neq64 (Const64 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = o.Args[1] |
| x := o.Args[0] |
| o_1 := o.Args[1] |
| if o_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(o_1.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq64 (Const64 <t> [c]) o:(Sub64 (Const64 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Neq64 (Const64 <t> [d-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub64 { |
| continue |
| } |
| x := o.Args[1] |
| o_0 := o.Args[0] |
| if o_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(o_0.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(d - c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq64 (Const64 <t> [c]) o:(Xor64 (Const64 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Neq64 (Const64 <t> [d^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpXor64 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(d ^ c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq64 (Const64 <t> [c]) o:(Com64 x)) |
| // cond: o.Uses == 1 |
| // result: (Neq64 (Const64 <t> [^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpCom64 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(^c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq64 (Const64 <t> [c]) o:(Neg64 x)) |
| // cond: o.Uses == 1 |
| // result: (Neq64 (Const64 <t> [-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpNeg64 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(-c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq64 (Const64 <t> [c]) o:(Mul64 (Const64 [d]) x)) |
| // cond: uint64(d)%2 == 1 && o.Uses == 1 |
| // result: (Neq64 (Const64 <t> [int64(uint64(c) * modularMultiplicativeInverse(uint64(d))) ]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpMul64 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(o_0.AuxInt) |
| x := o_1 |
| if !(uint64(d)%2 == 1 && o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint64(c) * modularMultiplicativeInverse(uint64(d)))) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq64 (Const64 [c]) (Const64 [d])) |
| // result: (ConstBool [c != d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c != d) |
| return true |
| } |
| break |
| } |
| // match: (Neq64 s:(Sub64 x y) (Const64 [0])) |
| // cond: s.Uses == 1 |
| // result: (Neq64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| s := v_0 |
| if s.Op != ssaop.OpSub64 { |
| continue |
| } |
| y := s.Args[1] |
| x := s.Args[0] |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 || !(s.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Neq64 (And64 <t> x (Const64 <t> [y])) (Const64 <t> [y])) |
| // cond: ssa.OneBit(y) |
| // result: (Eq64 (And64 <t> x (Const64 <t> [y])) (Const64 <t> [0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd64 { |
| continue |
| } |
| t := v_0.Type |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst64 || v_0_1.Type != t { |
| continue |
| } |
| y := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || v_1.Type != t || ssa.AuxIntToInt64(v_1.AuxInt) != y || !(ssa.OneBit(y)) { |
| continue |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd64, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v1.AuxInt = ssa.Int64ToAuxInt(y) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v2.AuxInt = ssa.Int64ToAuxInt(0) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq64 (ZeroExt8to64 (CvtBoolToUint8 x)) (Const64 [0])) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to64 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Neq64 (ZeroExt8to64 (CvtBoolToUint8 x)) (Const64 [1])) |
| // result: (Not x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to64 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 1 { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpNeq64F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Neq64F (Const64F [c]) (Const64F [d])) |
| // result: (ConstBool [c != d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64F { |
| continue |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64F { |
| continue |
| } |
| d := ssa.AuxIntToFloat64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c != d) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpNeq8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Neq8 x x) |
| // result: (ConstBool [false]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (Neq8 (Const8 <t> [c]) o:(Add8 (Const8 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Neq8 (Const8 <t> [c-d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpAdd8 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq8 (Const8 <t> [c]) o:(Sub8 x (Const8 [d]))) |
| // cond: o.Uses == 1 |
| // result: (Neq8 (Const8 <t> [c+d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = o.Args[1] |
| x := o.Args[0] |
| o_1 := o.Args[1] |
| if o_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(o_1.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c + d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq8 (Const8 <t> [c]) o:(Sub8 (Const8 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Neq8 (Const8 <t> [d-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpSub8 { |
| continue |
| } |
| x := o.Args[1] |
| o_0 := o.Args[0] |
| if o_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(o_0.AuxInt) |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(d - c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq8 (Const8 <t> [c]) o:(Xor8 (Const8 [d]) x)) |
| // cond: o.Uses == 1 |
| // result: (Neq8 (Const8 <t> [d^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpXor8 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(o_0.AuxInt) |
| x := o_1 |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(d ^ c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq8 (Const8 <t> [c]) o:(Com8 x)) |
| // cond: o.Uses == 1 |
| // result: (Neq8 (Const8 <t> [^c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpCom8 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(^c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq8 (Const8 <t> [c]) o:(Neg8 x)) |
| // cond: o.Uses == 1 |
| // result: (Neq8 (Const8 <t> [-c]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpNeg8 { |
| continue |
| } |
| x := o.Args[0] |
| if !(o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(-c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| // match: (Neq8 (Const8 <t> [c]) o:(Mul8 (Const8 [d]) x)) |
| // cond: uint8( d)%2 == 1 && o.Uses == 1 |
| // result: (Neq8 (Const8 <t> [int8( uint8( c) * uint8( modularMultiplicativeInverse(uint64(d))))]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| o := v_1 |
| if o.Op != ssaop.OpMul8 { |
| continue |
| } |
| _ = o.Args[1] |
| o_0 := o.Args[0] |
| o_1 := o.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, o_0, o_1 = _i1+1, o_1, o_0 { |
| if o_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(o_0.AuxInt) |
| x := o_1 |
| if !(uint8(d)%2 == 1 && o.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(int8(uint8(c) * uint8(modularMultiplicativeInverse(uint64(d))))) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq8 (Const8 [c]) (Const8 [d])) |
| // result: (ConstBool [c != d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c != d) |
| return true |
| } |
| break |
| } |
| // match: (Neq8 s:(Sub8 x y) (Const8 [0])) |
| // cond: s.Uses == 1 |
| // result: (Neq8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| s := v_0 |
| if s.Op != ssaop.OpSub8 { |
| continue |
| } |
| y := s.Args[1] |
| x := s.Args[0] |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != 0 || !(s.Uses == 1) { |
| continue |
| } |
| v.Reset(ssaop.OpNeq8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Neq8 (And8 <t> x (Const8 <t> [y])) (Const8 <t> [y])) |
| // cond: ssa.OneBit(y) |
| // result: (Eq8 (And8 <t> x (Const8 <t> [y])) (Const8 <t> [0])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd8 { |
| continue |
| } |
| t := v_0.Type |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst8 || v_0_1.Type != t { |
| continue |
| } |
| y := ssa.AuxIntToInt8(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst8 || v_1.Type != t || ssa.AuxIntToInt8(v_1.AuxInt) != y || !(ssa.OneBit(y)) { |
| continue |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd8, t) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v1.AuxInt = ssa.Int8ToAuxInt(y) |
| v0.AddArg2(x, v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v2.AuxInt = ssa.Int8ToAuxInt(0) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Neq8 (CvtBoolToUint8 x) (Const8 [0])) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != 0 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Neq8 (CvtBoolToUint8 x) (Const8 [1])) |
| // result: (Not x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != 1 { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpNeqB(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (NeqB x x) |
| // result: (ConstBool [false]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (NeqB (ConstBool [c]) (ConstBool [d])) |
| // result: (ConstBool [c != d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstBool { |
| continue |
| } |
| c := ssa.AuxIntToBool(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConstBool { |
| continue |
| } |
| d := ssa.AuxIntToBool(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c != d) |
| return true |
| } |
| break |
| } |
| // match: (NeqB (ConstBool [false]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstBool || ssa.AuxIntToBool(v_0.AuxInt) != false { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (NeqB (ConstBool [true]) x) |
| // result: (Not x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstBool || ssa.AuxIntToBool(v_0.AuxInt) != true { |
| continue |
| } |
| x := v_1 |
| v.Reset(ssaop.OpNot) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (NeqB (Not x) y) |
| // result: (EqB x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNot { |
| continue |
| } |
| x := v_0.Args[0] |
| y := v_1 |
| v.Reset(ssaop.OpEqB) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpNeqInter(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (NeqInter x y) |
| // result: (NeqPtr (ITab x) (ITab y)) |
| for { |
| x := v_0 |
| y := v_1 |
| v.Reset(ssaop.OpNeqPtr) |
| v0 := b.NewValue0(v.Pos, ssaop.OpITab, typ.Uintptr) |
| v0.AddArg(x) |
| v1 := b.NewValue0(v.Pos, ssaop.OpITab, typ.Uintptr) |
| v1.AddArg(y) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| } |
| func rewriteValue_OpNeqPtr(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (NeqPtr x x) |
| // result: (ConstBool [false]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(false) |
| return true |
| } |
| // match: (NeqPtr (Addr {x} _) (Addr {y} _)) |
| // result: (ConstBool [x != y]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0.Aux) |
| if v_1.Op != ssaop.OpAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x != y) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (Addr {x} _) (OffPtr [o] (Addr {y} _))) |
| // result: (ConstBool [x != y || o != 0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0.Aux) |
| if v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o := ssa.AuxIntToInt64(v_1.AuxInt) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1_0.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x != y || o != 0) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (OffPtr [o1] (Addr {x} _)) (OffPtr [o2] (Addr {y} _))) |
| // result: (ConstBool [x != y || o1 != o2]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o1 := ssa.AuxIntToInt64(v_0.AuxInt) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0_0.Aux) |
| if v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o2 := ssa.AuxIntToInt64(v_1.AuxInt) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1_0.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x != y || o1 != o2) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (LocalAddr {x} _ _) (LocalAddr {y} _ _)) |
| // result: (ConstBool [x != y]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLocalAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0.Aux) |
| if v_1.Op != ssaop.OpLocalAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x != y) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (LocalAddr {x} _ _) (OffPtr [o] (LocalAddr {y} _ _))) |
| // result: (ConstBool [x != y || o != 0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLocalAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0.Aux) |
| if v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o := ssa.AuxIntToInt64(v_1.AuxInt) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpLocalAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1_0.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x != y || o != 0) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (OffPtr [o1] (LocalAddr {x} _ _)) (OffPtr [o2] (LocalAddr {y} _ _))) |
| // result: (ConstBool [x != y || o1 != o2]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o1 := ssa.AuxIntToInt64(v_0.AuxInt) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpLocalAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0_0.Aux) |
| if v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o2 := ssa.AuxIntToInt64(v_1.AuxInt) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpLocalAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1_0.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x != y || o1 != o2) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (OffPtr [o1] p1) p2) |
| // cond: ssa.IsSamePtr(p1, p2) |
| // result: (ConstBool [o1 != 0]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o1 := ssa.AuxIntToInt64(v_0.AuxInt) |
| p1 := v_0.Args[0] |
| p2 := v_1 |
| if !(ssa.IsSamePtr(p1, p2)) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(o1 != 0) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (OffPtr [o1] p1) (OffPtr [o2] p2)) |
| // cond: ssa.IsSamePtr(p1, p2) |
| // result: (ConstBool [o1 != o2]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o1 := ssa.AuxIntToInt64(v_0.AuxInt) |
| p1 := v_0.Args[0] |
| if v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| o2 := ssa.AuxIntToInt64(v_1.AuxInt) |
| p2 := v_1.Args[0] |
| if !(ssa.IsSamePtr(p1, p2)) { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(o1 != o2) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (Const32 [c]) (Const32 [d])) |
| // result: (ConstBool [c != d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c != d) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (Const64 [c]) (Const64 [d])) |
| // result: (ConstBool [c != d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c != d) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (Convert (Addr {x} _) _) (Addr {y} _)) |
| // result: (ConstBool [x!=y]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConvert { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAddr { |
| continue |
| } |
| x := ssa.AuxToSym(v_0_0.Aux) |
| if v_1.Op != ssaop.OpAddr { |
| continue |
| } |
| y := ssa.AuxToSym(v_1.Aux) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(x != y) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (LocalAddr _ _) (Addr _)) |
| // result: (ConstBool [true]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLocalAddr || v_1.Op != ssaop.OpAddr { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (OffPtr (LocalAddr _ _)) (Addr _)) |
| // result: (ConstBool [true]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOffPtr { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpLocalAddr || v_1.Op != ssaop.OpAddr { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (LocalAddr _ _) (OffPtr (Addr _))) |
| // result: (ConstBool [true]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLocalAddr || v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAddr { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (OffPtr (LocalAddr _ _)) (OffPtr (Addr _))) |
| // result: (ConstBool [true]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOffPtr { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpLocalAddr || v_1.Op != ssaop.OpOffPtr { |
| continue |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAddr { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (AddPtr p1 o1) p2) |
| // cond: ssa.IsSamePtr(p1, p2) |
| // result: (IsNonNil o1) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAddPtr { |
| continue |
| } |
| o1 := v_0.Args[1] |
| p1 := v_0.Args[0] |
| p2 := v_1 |
| if !(ssa.IsSamePtr(p1, p2)) { |
| continue |
| } |
| v.Reset(ssaop.OpIsNonNil) |
| v.AddArg(o1) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (Const32 [0]) p) |
| // result: (IsNonNil p) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| continue |
| } |
| p := v_1 |
| v.Reset(ssaop.OpIsNonNil) |
| v.AddArg(p) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (Const64 [0]) p) |
| // result: (IsNonNil p) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| continue |
| } |
| p := v_1 |
| v.Reset(ssaop.OpIsNonNil) |
| v.AddArg(p) |
| return true |
| } |
| break |
| } |
| // match: (NeqPtr (ConstNil) p) |
| // result: (IsNonNil p) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstNil { |
| continue |
| } |
| p := v_1 |
| v.Reset(ssaop.OpIsNonNil) |
| v.AddArg(p) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpNeqSlice(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (NeqSlice x y) |
| // result: (NeqPtr (SlicePtr x) (SlicePtr y)) |
| for { |
| x := v_0 |
| y := v_1 |
| v.Reset(ssaop.OpNeqPtr) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSlicePtr, typ.BytePtr) |
| v0.AddArg(x) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSlicePtr, typ.BytePtr) |
| v1.AddArg(y) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| } |
| func rewriteValue_OpNilCheck(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| fe := b.Func.Fe |
| // match: (NilCheck ptr:(GetG mem) mem) |
| // result: ptr |
| for { |
| ptr := v_0 |
| if ptr.Op != ssaop.OpGetG { |
| break |
| } |
| mem := ptr.Args[0] |
| if mem != v_1 { |
| break |
| } |
| v.CopyOf(ptr) |
| return true |
| } |
| // match: (NilCheck ptr:(SelectN [0] call:(StaticLECall ___)) _) |
| // cond: isMalloc(call.Aux) && warnRule(fe.Debug_checknil(), v, "removed nil check") |
| // result: ptr |
| for { |
| ptr := v_0 |
| if ptr.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(ptr.AuxInt) != 0 { |
| break |
| } |
| call := ptr.Args[0] |
| if call.Op != ssaop.OpStaticLECall { |
| break |
| } |
| if !(isMalloc(call.Aux) && warnRule(fe.Debug_checknil(), v, "removed nil check")) { |
| break |
| } |
| v.CopyOf(ptr) |
| return true |
| } |
| // match: (NilCheck ptr:(OffPtr (SelectN [0] call:(StaticLECall ___))) _) |
| // cond: isMalloc(call.Aux) && warnRule(fe.Debug_checknil(), v, "removed nil check") |
| // result: ptr |
| for { |
| ptr := v_0 |
| if ptr.Op != ssaop.OpOffPtr { |
| break |
| } |
| ptr_0 := ptr.Args[0] |
| if ptr_0.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(ptr_0.AuxInt) != 0 { |
| break |
| } |
| call := ptr_0.Args[0] |
| if call.Op != ssaop.OpStaticLECall { |
| break |
| } |
| if !(isMalloc(call.Aux) && warnRule(fe.Debug_checknil(), v, "removed nil check")) { |
| break |
| } |
| v.CopyOf(ptr) |
| return true |
| } |
| // match: (NilCheck ptr:(Addr {_} (SB)) _) |
| // result: ptr |
| for { |
| ptr := v_0 |
| if ptr.Op != ssaop.OpAddr { |
| break |
| } |
| ptr_0 := ptr.Args[0] |
| if ptr_0.Op != ssaop.OpSB { |
| break |
| } |
| v.CopyOf(ptr) |
| return true |
| } |
| // match: (NilCheck ptr:(Convert (Addr {_} (SB)) _) _) |
| // result: ptr |
| for { |
| ptr := v_0 |
| if ptr.Op != ssaop.OpConvert { |
| break |
| } |
| ptr_0 := ptr.Args[0] |
| if ptr_0.Op != ssaop.OpAddr { |
| break |
| } |
| ptr_0_0 := ptr_0.Args[0] |
| if ptr_0_0.Op != ssaop.OpSB { |
| break |
| } |
| v.CopyOf(ptr) |
| return true |
| } |
| // match: (NilCheck ptr:(LocalAddr _ _) _) |
| // cond: warnRule(fe.Debug_checknil(), v, "removed nil check") |
| // result: ptr |
| for { |
| ptr := v_0 |
| if ptr.Op != ssaop.OpLocalAddr || !(warnRule(fe.Debug_checknil(), v, "removed nil check")) { |
| break |
| } |
| v.CopyOf(ptr) |
| return true |
| } |
| // match: (NilCheck ptr:(Arg {sym}) _) |
| // cond: isDictArgSym(sym) |
| // result: ptr |
| for { |
| ptr := v_0 |
| if ptr.Op != ssaop.OpArg { |
| break |
| } |
| sym := ssa.AuxToSym(ptr.Aux) |
| if !(isDictArgSym(sym)) { |
| break |
| } |
| v.CopyOf(ptr) |
| return true |
| } |
| // match: (NilCheck ptr:(NilCheck _ _) _ ) |
| // result: ptr |
| for { |
| ptr := v_0 |
| if ptr.Op != ssaop.OpNilCheck { |
| break |
| } |
| v.CopyOf(ptr) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpNot(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Not (ConstBool [c])) |
| // result: (ConstBool [!c]) |
| for { |
| if v_0.Op != ssaop.OpConstBool { |
| break |
| } |
| c := ssa.AuxIntToBool(v_0.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(!c) |
| return true |
| } |
| // match: (Not (Eq64 x y)) |
| // result: (Neq64 x y) |
| for { |
| if v_0.Op != ssaop.OpEq64 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpNeq64) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (Eq32 x y)) |
| // result: (Neq32 x y) |
| for { |
| if v_0.Op != ssaop.OpEq32 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpNeq32) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (Eq16 x y)) |
| // result: (Neq16 x y) |
| for { |
| if v_0.Op != ssaop.OpEq16 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpNeq16) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (Eq8 x y)) |
| // result: (Neq8 x y) |
| for { |
| if v_0.Op != ssaop.OpEq8 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpNeq8) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (EqB x y)) |
| // result: (NeqB x y) |
| for { |
| if v_0.Op != ssaop.OpEqB { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpNeqB) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (EqPtr x y)) |
| // result: (NeqPtr x y) |
| for { |
| if v_0.Op != ssaop.OpEqPtr { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpNeqPtr) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (Eq64F x y)) |
| // result: (Neq64F x y) |
| for { |
| if v_0.Op != ssaop.OpEq64F { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpNeq64F) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (Eq32F x y)) |
| // result: (Neq32F x y) |
| for { |
| if v_0.Op != ssaop.OpEq32F { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpNeq32F) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (Neq64 x y)) |
| // result: (Eq64 x y) |
| for { |
| if v_0.Op != ssaop.OpNeq64 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpEq64) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (Neq32 x y)) |
| // result: (Eq32 x y) |
| for { |
| if v_0.Op != ssaop.OpNeq32 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpEq32) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (Neq16 x y)) |
| // result: (Eq16 x y) |
| for { |
| if v_0.Op != ssaop.OpNeq16 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpEq16) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (Neq8 x y)) |
| // result: (Eq8 x y) |
| for { |
| if v_0.Op != ssaop.OpNeq8 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpEq8) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (NeqB x y)) |
| // result: (EqB x y) |
| for { |
| if v_0.Op != ssaop.OpNeqB { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpEqB) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (NeqPtr x y)) |
| // result: (EqPtr x y) |
| for { |
| if v_0.Op != ssaop.OpNeqPtr { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpEqPtr) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (Neq64F x y)) |
| // result: (Eq64F x y) |
| for { |
| if v_0.Op != ssaop.OpNeq64F { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpEq64F) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (Neq32F x y)) |
| // result: (Eq32F x y) |
| for { |
| if v_0.Op != ssaop.OpNeq32F { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpEq32F) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Not (Less64 x y)) |
| // result: (Leq64 y x) |
| for { |
| if v_0.Op != ssaop.OpLess64 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLeq64) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Less32 x y)) |
| // result: (Leq32 y x) |
| for { |
| if v_0.Op != ssaop.OpLess32 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLeq32) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Less16 x y)) |
| // result: (Leq16 y x) |
| for { |
| if v_0.Op != ssaop.OpLess16 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLeq16) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Less8 x y)) |
| // result: (Leq8 y x) |
| for { |
| if v_0.Op != ssaop.OpLess8 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLeq8) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Less64U x y)) |
| // result: (Leq64U y x) |
| for { |
| if v_0.Op != ssaop.OpLess64U { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLeq64U) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Less32U x y)) |
| // result: (Leq32U y x) |
| for { |
| if v_0.Op != ssaop.OpLess32U { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLeq32U) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Less16U x y)) |
| // result: (Leq16U y x) |
| for { |
| if v_0.Op != ssaop.OpLess16U { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLeq16U) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Less8U x y)) |
| // result: (Leq8U y x) |
| for { |
| if v_0.Op != ssaop.OpLess8U { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLeq8U) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Leq64 x y)) |
| // result: (Less64 y x) |
| for { |
| if v_0.Op != ssaop.OpLeq64 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLess64) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Leq32 x y)) |
| // result: (Less32 y x) |
| for { |
| if v_0.Op != ssaop.OpLeq32 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLess32) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Leq16 x y)) |
| // result: (Less16 y x) |
| for { |
| if v_0.Op != ssaop.OpLeq16 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLess16) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Leq8 x y)) |
| // result: (Less8 y x) |
| for { |
| if v_0.Op != ssaop.OpLeq8 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLess8) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Leq64U x y)) |
| // result: (Less64U y x) |
| for { |
| if v_0.Op != ssaop.OpLeq64U { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLess64U) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Leq32U x y)) |
| // result: (Less32U y x) |
| for { |
| if v_0.Op != ssaop.OpLeq32U { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLess32U) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Leq16U x y)) |
| // result: (Less16U y x) |
| for { |
| if v_0.Op != ssaop.OpLeq16U { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLess16U) |
| v.AddArg2(y, x) |
| return true |
| } |
| // match: (Not (Leq8U x y)) |
| // result: (Less8U y x) |
| for { |
| if v_0.Op != ssaop.OpLeq8U { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpLess8U) |
| v.AddArg2(y, x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpOffPtr(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (OffPtr (OffPtr p [y]) [x]) |
| // result: (OffPtr p [x+y]) |
| for { |
| x := ssa.AuxIntToInt64(v.AuxInt) |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| y := ssa.AuxIntToInt64(v_0.AuxInt) |
| p := v_0.Args[0] |
| v.Reset(ssaop.OpOffPtr) |
| v.AuxInt = ssa.Int64ToAuxInt(x + y) |
| v.AddArg(p) |
| return true |
| } |
| // match: (OffPtr p [0]) |
| // cond: v.Type.Compare(p.Type) == types.CMPeq |
| // result: p |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 { |
| break |
| } |
| p := v_0 |
| if !(v.Type.Compare(p.Type) == types.CMPeq) { |
| break |
| } |
| v.CopyOf(p) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpOr16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Or16 (Const16 [c]) (Const16 [d])) |
| // result: (Const16 [c|d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(c | d) |
| return true |
| } |
| break |
| } |
| // match: (Or16 <t> (Com16 x) (Com16 y)) |
| // result: (Com16 (And16 <t> x y)) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom16 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpCom16 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpCom16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd16, t) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (Or16 x (And16 x y)) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or16 x x) |
| // result: x |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Or16 (Const16 [0]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Or16 (Const16 [-1]) _) |
| // result: (Const16 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != -1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Or16 (Com16 x) x) |
| // result: (Const16 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom16 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Or16 x (Or16 x y)) |
| // result: (Or16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpOr16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpOr16) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or16 (And16 x (Const16 [c2])) (Const16 <t> [c1])) |
| // cond: ^(c1 | c2) == 0 |
| // result: (Or16 (Const16 <t> [c1]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd16 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c2 := ssa.AuxIntToInt16(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_1.Type |
| c1 := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(^(c1 | c2) == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpOr16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c1) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or16 (Or16 i:(Const16 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) |
| // result: (Or16 i (Or16 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOr16 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) { |
| continue |
| } |
| v.Reset(ssaop.OpOr16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr16, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or16 (Const16 <t> [c]) (Or16 (Const16 <t> [d]) x)) |
| // result: (Or16 (Const16 <t> [c|d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpOr16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst16 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpOr16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c | d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or16 (Lsh16x64 x z:(Const64 <t> [c])) (Rsh16Ux64 x (Const64 [d]))) |
| // cond: c < 16 && d == 16-c && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLsh16x64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| z := v_0.Args[1] |
| if z.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(z.AuxInt) |
| if v_1.Op != ssaop.OpRsh16Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c < 16 && d == 16-c && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or16 left:(Lsh16x64 x y) right:(Rsh16Ux64 x (Sub64 (Const64 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh16x64 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh16Ux64 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or16 left:(Lsh16x32 x y) right:(Rsh16Ux32 x (Sub32 (Const32 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh16x32 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh16Ux32 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or16 left:(Lsh16x16 x y) right:(Rsh16Ux16 x (Sub16 (Const16 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh16x16 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh16Ux16 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or16 left:(Lsh16x8 x y) right:(Rsh16Ux8 x (Sub8 (Const8 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh16x8 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh16Ux8 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or16 right:(Rsh16Ux64 x y) left:(Lsh16x64 x z:(Sub64 (Const64 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh16Ux64 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh16x64 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(z_0.AuxInt) != 16 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or16 right:(Rsh16Ux32 x y) left:(Lsh16x32 x z:(Sub32 (Const32 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh16Ux32 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh16x32 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(z_0.AuxInt) != 16 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or16 right:(Rsh16Ux16 x y) left:(Lsh16x16 x z:(Sub16 (Const16 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh16Ux16 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh16x16 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(z_0.AuxInt) != 16 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or16 right:(Rsh16Ux8 x y) left:(Lsh16x8 x z:(Sub8 (Const8 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh16Ux8 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh16x8 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(z_0.AuxInt) != 16 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpOr32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Or32 (Const32 [c]) (Const32 [d])) |
| // result: (Const32 [c|d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(c | d) |
| return true |
| } |
| break |
| } |
| // match: (Or32 <t> (Com32 x) (Com32 y)) |
| // result: (Com32 (And32 <t> x y)) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom32 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpCom32 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpCom32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd32, t) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (Or32 x (And32 x y)) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or32 x x) |
| // result: x |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Or32 (Const32 [0]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Or32 (Const32 [-1]) _) |
| // result: (Const32 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != -1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Or32 (Com32 x) x) |
| // result: (Const32 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom32 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Or32 x (Or32 x y)) |
| // result: (Or32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpOr32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpOr32) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or32 (And32 x (Const32 [c2])) (Const32 <t> [c1])) |
| // cond: ^(c1 | c2) == 0 |
| // result: (Or32 (Const32 <t> [c1]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd32 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c2 := ssa.AuxIntToInt32(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_1.Type |
| c1 := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(^(c1 | c2) == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpOr32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c1) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or32 (Or32 i:(Const32 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) |
| // result: (Or32 i (Or32 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOr32 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) { |
| continue |
| } |
| v.Reset(ssaop.OpOr32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr32, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or32 (Const32 <t> [c]) (Or32 (Const32 <t> [d]) x)) |
| // result: (Or32 (Const32 <t> [c|d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpOr32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst32 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpOr32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c | d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or32 (Lsh32x64 x z:(Const64 <t> [c])) (Rsh32Ux64 x (Const64 [d]))) |
| // cond: c < 32 && d == 32-c && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLsh32x64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| z := v_0.Args[1] |
| if z.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(z.AuxInt) |
| if v_1.Op != ssaop.OpRsh32Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c < 32 && d == 32-c && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or32 left:(Lsh32x64 x y) right:(Rsh32Ux64 x (Sub64 (Const64 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh32x64 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh32Ux64 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or32 left:(Lsh32x32 x y) right:(Rsh32Ux32 x (Sub32 (Const32 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh32x32 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh32Ux32 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or32 left:(Lsh32x16 x y) right:(Rsh32Ux16 x (Sub16 (Const16 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh32x16 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh32Ux16 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or32 left:(Lsh32x8 x y) right:(Rsh32Ux8 x (Sub8 (Const8 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh32x8 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh32Ux8 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or32 right:(Rsh32Ux64 x y) left:(Lsh32x64 x z:(Sub64 (Const64 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh32Ux64 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh32x64 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(z_0.AuxInt) != 32 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or32 right:(Rsh32Ux32 x y) left:(Lsh32x32 x z:(Sub32 (Const32 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh32Ux32 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh32x32 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(z_0.AuxInt) != 32 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or32 right:(Rsh32Ux16 x y) left:(Lsh32x16 x z:(Sub16 (Const16 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh32Ux16 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh32x16 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(z_0.AuxInt) != 32 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or32 right:(Rsh32Ux8 x y) left:(Lsh32x8 x z:(Sub8 (Const8 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh32Ux8 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh32x8 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(z_0.AuxInt) != 32 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpOr64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Or64 (Const64 [c]) (Const64 [d])) |
| // result: (Const64 [c|d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(c | d) |
| return true |
| } |
| break |
| } |
| // match: (Or64 <t> (Com64 x) (Com64 y)) |
| // result: (Com64 (And64 <t> x y)) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom64 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpCom64 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpCom64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd64, t) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (Or64 x (And64 x y)) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or64 x x) |
| // result: x |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Or64 (Const64 [0]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Or64 (Const64 [-1]) _) |
| // result: (Const64 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != -1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Or64 (Com64 x) x) |
| // result: (Const64 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom64 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Or64 x (Or64 x y)) |
| // result: (Or64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpOr64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpOr64) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or64 (And64 x (Const64 [c2])) (Const64 <t> [c1])) |
| // cond: ^(c1 | c2) == 0 |
| // result: (Or64 (Const64 <t> [c1]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c2 := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_1.Type |
| c1 := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(^(c1 | c2) == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpOr64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c1) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or64 (Or64 i:(Const64 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) |
| // result: (Or64 i (Or64 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOr64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) { |
| continue |
| } |
| v.Reset(ssaop.OpOr64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr64, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or64 (Const64 <t> [c]) (Or64 (Const64 <t> [d]) x)) |
| // result: (Or64 (Const64 <t> [c|d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpOr64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst64 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpOr64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c | d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or64 (Lsh64x64 x z:(Const64 <t> [c])) (Rsh64Ux64 x (Const64 [d]))) |
| // cond: c < 64 && d == 64-c && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLsh64x64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| z := v_0.Args[1] |
| if z.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(z.AuxInt) |
| if v_1.Op != ssaop.OpRsh64Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c < 64 && d == 64-c && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or64 left:(Lsh64x64 x y) right:(Rsh64Ux64 x (Sub64 (Const64 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh64x64 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh64Ux64 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(right_1_0.AuxInt) != 64 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or64 left:(Lsh64x32 x y) right:(Rsh64Ux32 x (Sub32 (Const32 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh64x32 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh64Ux32 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(right_1_0.AuxInt) != 64 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or64 left:(Lsh64x16 x y) right:(Rsh64Ux16 x (Sub16 (Const16 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh64x16 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh64Ux16 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(right_1_0.AuxInt) != 64 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or64 left:(Lsh64x8 x y) right:(Rsh64Ux8 x (Sub8 (Const8 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh64x8 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh64Ux8 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(right_1_0.AuxInt) != 64 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or64 right:(Rsh64Ux64 x y) left:(Lsh64x64 x z:(Sub64 (Const64 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh64Ux64 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh64x64 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(z_0.AuxInt) != 64 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or64 right:(Rsh64Ux32 x y) left:(Lsh64x32 x z:(Sub32 (Const32 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh64Ux32 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh64x32 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(z_0.AuxInt) != 64 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or64 right:(Rsh64Ux16 x y) left:(Lsh64x16 x z:(Sub16 (Const16 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh64Ux16 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh64x16 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(z_0.AuxInt) != 64 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or64 right:(Rsh64Ux8 x y) left:(Lsh64x8 x z:(Sub8 (Const8 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh64Ux8 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh64x8 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(z_0.AuxInt) != 64 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpOr8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Or8 (Const8 [c]) (Const8 [d])) |
| // result: (Const8 [c|d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(c | d) |
| return true |
| } |
| break |
| } |
| // match: (Or8 <t> (Com8 x) (Com8 y)) |
| // result: (Com8 (And8 <t> x y)) |
| for { |
| t := v.Type |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom8 { |
| continue |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpCom8 { |
| continue |
| } |
| y := v_1.Args[0] |
| v.Reset(ssaop.OpCom8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAnd8, t) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (Or8 x (And8 x y)) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or8 x x) |
| // result: x |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Or8 (Const8 [0]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Or8 (Const8 [-1]) _) |
| // result: (Const8 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != -1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Or8 (Com8 x) x) |
| // result: (Const8 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom8 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Or8 x (Or8 x y)) |
| // result: (Or8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpOr8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpOr8) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or8 (And8 x (Const8 [c2])) (Const8 <t> [c1])) |
| // cond: ^(c1 | c2) == 0 |
| // result: (Or8 (Const8 <t> [c1]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpAnd8 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| if v_0_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c2 := ssa.AuxIntToInt8(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_1.Type |
| c1 := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(^(c1 | c2) == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpOr8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c1) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or8 (Or8 i:(Const8 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) |
| // result: (Or8 i (Or8 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpOr8 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) { |
| continue |
| } |
| v.Reset(ssaop.OpOr8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr8, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or8 (Const8 <t> [c]) (Or8 (Const8 <t> [d]) x)) |
| // result: (Or8 (Const8 <t> [c|d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpOr8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst8 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpOr8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c | d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Or8 (Lsh8x64 x z:(Const64 <t> [c])) (Rsh8Ux64 x (Const64 [d]))) |
| // cond: c < 8 && d == 8-c && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLsh8x64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| z := v_0.Args[1] |
| if z.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(z.AuxInt) |
| if v_1.Op != ssaop.OpRsh8Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c < 8 && d == 8-c && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or8 left:(Lsh8x64 x y) right:(Rsh8Ux64 x (Sub64 (Const64 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh8x64 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh8Ux64 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(right_1_0.AuxInt) != 8 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or8 left:(Lsh8x32 x y) right:(Rsh8Ux32 x (Sub32 (Const32 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh8x32 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh8Ux32 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(right_1_0.AuxInt) != 8 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or8 left:(Lsh8x16 x y) right:(Rsh8Ux16 x (Sub16 (Const16 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh8x16 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh8Ux16 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(right_1_0.AuxInt) != 8 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or8 left:(Lsh8x8 x y) right:(Rsh8Ux8 x (Sub8 (Const8 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh8x8 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh8Ux8 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(right_1_0.AuxInt) != 8 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Or8 right:(Rsh8Ux64 x y) left:(Lsh8x64 x z:(Sub64 (Const64 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh8Ux64 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh8x64 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(z_0.AuxInt) != 8 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or8 right:(Rsh8Ux32 x y) left:(Lsh8x32 x z:(Sub32 (Const32 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh8Ux32 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh8x32 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(z_0.AuxInt) != 8 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or8 right:(Rsh8Ux16 x y) left:(Lsh8x16 x z:(Sub16 (Const16 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh8Ux16 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh8x16 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(z_0.AuxInt) != 8 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Or8 right:(Rsh8Ux8 x y) left:(Lsh8x8 x z:(Sub8 (Const8 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh8Ux8 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh8x8 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(z_0.AuxInt) != 8 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpOrB(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (OrB (ConstBool [c]) (ConstBool [d])) |
| // result: (ConstBool [c||d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstBool { |
| continue |
| } |
| c := ssa.AuxIntToBool(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConstBool { |
| continue |
| } |
| d := ssa.AuxIntToBool(v_1.AuxInt) |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(c || d) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less64 (Const64 [c]) x) (Less64 x (Const64 [d]))) |
| // cond: c >= d |
| // result: (Less64U (Const64 <x.Type> [c-d]) (Sub64 <x.Type> x (Const64 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess64 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= d) { |
| continue |
| } |
| v.Reset(ssaop.OpLess64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq64 (Const64 [c]) x) (Less64 x (Const64 [d]))) |
| // cond: c >= d |
| // result: (Leq64U (Const64 <x.Type> [c-d]) (Sub64 <x.Type> x (Const64 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq64 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= d) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less32 (Const32 [c]) x) (Less32 x (Const32 [d]))) |
| // cond: c >= d |
| // result: (Less32U (Const32 <x.Type> [c-d]) (Sub32 <x.Type> x (Const32 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess32 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c >= d) { |
| continue |
| } |
| v.Reset(ssaop.OpLess32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq32 (Const32 [c]) x) (Less32 x (Const32 [d]))) |
| // cond: c >= d |
| // result: (Leq32U (Const32 <x.Type> [c-d]) (Sub32 <x.Type> x (Const32 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq32 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c >= d) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less16 (Const16 [c]) x) (Less16 x (Const16 [d]))) |
| // cond: c >= d |
| // result: (Less16U (Const16 <x.Type> [c-d]) (Sub16 <x.Type> x (Const16 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess16 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c >= d) { |
| continue |
| } |
| v.Reset(ssaop.OpLess16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq16 (Const16 [c]) x) (Less16 x (Const16 [d]))) |
| // cond: c >= d |
| // result: (Leq16U (Const16 <x.Type> [c-d]) (Sub16 <x.Type> x (Const16 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq16 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c >= d) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less8 (Const8 [c]) x) (Less8 x (Const8 [d]))) |
| // cond: c >= d |
| // result: (Less8U (Const8 <x.Type> [c-d]) (Sub8 <x.Type> x (Const8 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess8 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c >= d) { |
| continue |
| } |
| v.Reset(ssaop.OpLess8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq8 (Const8 [c]) x) (Less8 x (Const8 [d]))) |
| // cond: c >= d |
| // result: (Leq8U (Const8 <x.Type> [c-d]) (Sub8 <x.Type> x (Const8 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq8 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c >= d) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less64 (Const64 [c]) x) (Leq64 x (Const64 [d]))) |
| // cond: c >= d+1 && d+1 > d |
| // result: (Less64U (Const64 <x.Type> [c-d-1]) (Sub64 <x.Type> x (Const64 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess64 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= d+1 && d+1 > d) { |
| continue |
| } |
| v.Reset(ssaop.OpLess64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq64 (Const64 [c]) x) (Leq64 x (Const64 [d]))) |
| // cond: c >= d+1 && d+1 > d |
| // result: (Leq64U (Const64 <x.Type> [c-d-1]) (Sub64 <x.Type> x (Const64 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq64 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c >= d+1 && d+1 > d) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less32 (Const32 [c]) x) (Leq32 x (Const32 [d]))) |
| // cond: c >= d+1 && d+1 > d |
| // result: (Less32U (Const32 <x.Type> [c-d-1]) (Sub32 <x.Type> x (Const32 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess32 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c >= d+1 && d+1 > d) { |
| continue |
| } |
| v.Reset(ssaop.OpLess32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq32 (Const32 [c]) x) (Leq32 x (Const32 [d]))) |
| // cond: c >= d+1 && d+1 > d |
| // result: (Leq32U (Const32 <x.Type> [c-d-1]) (Sub32 <x.Type> x (Const32 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq32 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c >= d+1 && d+1 > d) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less16 (Const16 [c]) x) (Leq16 x (Const16 [d]))) |
| // cond: c >= d+1 && d+1 > d |
| // result: (Less16U (Const16 <x.Type> [c-d-1]) (Sub16 <x.Type> x (Const16 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess16 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c >= d+1 && d+1 > d) { |
| continue |
| } |
| v.Reset(ssaop.OpLess16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq16 (Const16 [c]) x) (Leq16 x (Const16 [d]))) |
| // cond: c >= d+1 && d+1 > d |
| // result: (Leq16U (Const16 <x.Type> [c-d-1]) (Sub16 <x.Type> x (Const16 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq16 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c >= d+1 && d+1 > d) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less8 (Const8 [c]) x) (Leq8 x (Const8 [d]))) |
| // cond: c >= d+1 && d+1 > d |
| // result: (Less8U (Const8 <x.Type> [c-d-1]) (Sub8 <x.Type> x (Const8 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess8 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c >= d+1 && d+1 > d) { |
| continue |
| } |
| v.Reset(ssaop.OpLess8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq8 (Const8 [c]) x) (Leq8 x (Const8 [d]))) |
| // cond: c >= d+1 && d+1 > d |
| // result: (Leq8U (Const8 <x.Type> [c-d-1]) (Sub8 <x.Type> x (Const8 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq8 { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c >= d+1 && d+1 > d) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less64U (Const64 [c]) x) (Less64U x (Const64 [d]))) |
| // cond: uint64(c) >= uint64(d) |
| // result: (Less64U (Const64 <x.Type> [c-d]) (Sub64 <x.Type> x (Const64 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess64U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess64U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(uint64(c) >= uint64(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq64U (Const64 [c]) x) (Less64U x (Const64 [d]))) |
| // cond: uint64(c) >= uint64(d) |
| // result: (Leq64U (Const64 <x.Type> [c-d]) (Sub64 <x.Type> x (Const64 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq64U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess64U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(uint64(c) >= uint64(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less32U (Const32 [c]) x) (Less32U x (Const32 [d]))) |
| // cond: uint32(c) >= uint32(d) |
| // result: (Less32U (Const32 <x.Type> [c-d]) (Sub32 <x.Type> x (Const32 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess32U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess32U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(uint32(c) >= uint32(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq32U (Const32 [c]) x) (Less32U x (Const32 [d]))) |
| // cond: uint32(c) >= uint32(d) |
| // result: (Leq32U (Const32 <x.Type> [c-d]) (Sub32 <x.Type> x (Const32 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq32U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess32U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(uint32(c) >= uint32(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less16U (Const16 [c]) x) (Less16U x (Const16 [d]))) |
| // cond: uint16(c) >= uint16(d) |
| // result: (Less16U (Const16 <x.Type> [c-d]) (Sub16 <x.Type> x (Const16 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess16U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess16U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(uint16(c) >= uint16(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq16U (Const16 [c]) x) (Less16U x (Const16 [d]))) |
| // cond: uint16(c) >= uint16(d) |
| // result: (Leq16U (Const16 <x.Type> [c-d]) (Sub16 <x.Type> x (Const16 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq16U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess16U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(uint16(c) >= uint16(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less8U (Const8 [c]) x) (Less8U x (Const8 [d]))) |
| // cond: uint8(c) >= uint8(d) |
| // result: (Less8U (Const8 <x.Type> [c-d]) (Sub8 <x.Type> x (Const8 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess8U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess8U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(uint8(c) >= uint8(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq8U (Const8 [c]) x) (Less8U x (Const8 [d]))) |
| // cond: uint8(c) >= uint8(d) |
| // result: (Leq8U (Const8 <x.Type> [c-d]) (Sub8 <x.Type> x (Const8 <x.Type> [d]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq8U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLess8U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(uint8(c) >= uint8(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - d) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less64U (Const64 [c]) x) (Leq64U x (Const64 [d]))) |
| // cond: uint64(c) >= uint64(d+1) && uint64(d+1) > uint64(d) |
| // result: (Less64U (Const64 <x.Type> [c-d-1]) (Sub64 <x.Type> x (Const64 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess64U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq64U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(uint64(c) >= uint64(d+1) && uint64(d+1) > uint64(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq64U (Const64 [c]) x) (Leq64U x (Const64 [d]))) |
| // cond: uint64(c) >= uint64(d+1) && uint64(d+1) > uint64(d) |
| // result: (Leq64U (Const64 <x.Type> [c-d-1]) (Sub64 <x.Type> x (Const64 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq64U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq64U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(uint64(c) >= uint64(d+1) && uint64(d+1) > uint64(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq64U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub64, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v2.AuxInt = ssa.Int64ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less32U (Const32 [c]) x) (Leq32U x (Const32 [d]))) |
| // cond: uint32(c) >= uint32(d+1) && uint32(d+1) > uint32(d) |
| // result: (Less32U (Const32 <x.Type> [c-d-1]) (Sub32 <x.Type> x (Const32 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess32U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq32U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(uint32(c) >= uint32(d+1) && uint32(d+1) > uint32(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq32U (Const32 [c]) x) (Leq32U x (Const32 [d]))) |
| // cond: uint32(c) >= uint32(d+1) && uint32(d+1) > uint32(d) |
| // result: (Leq32U (Const32 <x.Type> [c-d-1]) (Sub32 <x.Type> x (Const32 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq32U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq32U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(uint32(c) >= uint32(d+1) && uint32(d+1) > uint32(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq32U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub32, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v2.AuxInt = ssa.Int32ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less16U (Const16 [c]) x) (Leq16U x (Const16 [d]))) |
| // cond: uint16(c) >= uint16(d+1) && uint16(d+1) > uint16(d) |
| // result: (Less16U (Const16 <x.Type> [c-d-1]) (Sub16 <x.Type> x (Const16 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess16U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq16U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(uint16(c) >= uint16(d+1) && uint16(d+1) > uint16(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq16U (Const16 [c]) x) (Leq16U x (Const16 [d]))) |
| // cond: uint16(c) >= uint16(d+1) && uint16(d+1) > uint16(d) |
| // result: (Leq16U (Const16 <x.Type> [c-d-1]) (Sub16 <x.Type> x (Const16 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq16U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq16U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(uint16(c) >= uint16(d+1) && uint16(d+1) > uint16(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq16U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub16, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v2.AuxInt = ssa.Int16ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Less8U (Const8 [c]) x) (Leq8U x (Const8 [d]))) |
| // cond: uint8(c) >= uint8(d+1) && uint8(d+1) > uint8(d) |
| // result: (Less8U (Const8 <x.Type> [c-d-1]) (Sub8 <x.Type> x (Const8 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLess8U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq8U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(uint8(c) >= uint8(d+1) && uint8(d+1) > uint8(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLess8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Leq8U (Const8 [c]) x) (Leq8U x (Const8 [d]))) |
| // cond: uint8(c) >= uint8(d+1) && uint8(d+1) > uint8(d) |
| // result: (Leq8U (Const8 <x.Type> [c-d-1]) (Sub8 <x.Type> x (Const8 <x.Type> [d+1]))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLeq8U { |
| continue |
| } |
| x := v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0_0.AuxInt) |
| if v_1.Op != ssaop.OpLeq8U { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(uint8(c) >= uint8(d+1) && uint8(d+1) > uint8(d)) { |
| continue |
| } |
| v.Reset(ssaop.OpLeq8U) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - d - 1) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSub8, x.Type) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v2.AuxInt = ssa.Int8ToAuxInt(d + 1) |
| v1.AddArg2(x, v2) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Eq64 x cv:(Const64 [c])) (Eq64 x (Const64 [d]))) |
| // cond: c|d == c && ssa.OneBit(c^d) |
| // result: (Eq64 (Or64 <x.Type> x (Const64 <x.Type> [c^d])) cv) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpEq64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| cv := v_0_1 |
| if cv.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(cv.AuxInt) |
| if v_1.Op != ssaop.OpEq64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 { |
| if x != v_1_0 || v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c|d == c && ssa.OneBit(c^d)) { |
| continue |
| } |
| v.Reset(ssaop.OpEq64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr64, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, x.Type) |
| v1.AuxInt = ssa.Int64ToAuxInt(c ^ d) |
| v0.AddArg2(x, v1) |
| v.AddArg2(v0, cv) |
| return true |
| } |
| } |
| } |
| break |
| } |
| // match: (OrB (Eq32 x cv:(Const32 [c])) (Eq32 x (Const32 [d]))) |
| // cond: c|d == c && ssa.OneBit(c^d) |
| // result: (Eq32 (Or32 <x.Type> x (Const32 <x.Type> [c^d])) cv) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpEq32 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| cv := v_0_1 |
| if cv.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(cv.AuxInt) |
| if v_1.Op != ssaop.OpEq32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 { |
| if x != v_1_0 || v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c|d == c && ssa.OneBit(c^d)) { |
| continue |
| } |
| v.Reset(ssaop.OpEq32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr32, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, x.Type) |
| v1.AuxInt = ssa.Int32ToAuxInt(c ^ d) |
| v0.AddArg2(x, v1) |
| v.AddArg2(v0, cv) |
| return true |
| } |
| } |
| } |
| break |
| } |
| // match: (OrB (Eq16 x cv:(Const16 [c])) (Eq16 x (Const16 [d]))) |
| // cond: c|d == c && ssa.OneBit(c^d) |
| // result: (Eq16 (Or16 <x.Type> x (Const16 <x.Type> [c^d])) cv) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpEq16 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| cv := v_0_1 |
| if cv.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(cv.AuxInt) |
| if v_1.Op != ssaop.OpEq16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 { |
| if x != v_1_0 || v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c|d == c && ssa.OneBit(c^d)) { |
| continue |
| } |
| v.Reset(ssaop.OpEq16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr16, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst16, x.Type) |
| v1.AuxInt = ssa.Int16ToAuxInt(c ^ d) |
| v0.AddArg2(x, v1) |
| v.AddArg2(v0, cv) |
| return true |
| } |
| } |
| } |
| break |
| } |
| // match: (OrB (Eq8 x cv:(Const8 [c])) (Eq8 x (Const8 [d]))) |
| // cond: c|d == c && ssa.OneBit(c^d) |
| // result: (Eq8 (Or8 <x.Type> x (Const8 <x.Type> [c^d])) cv) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpEq8 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| cv := v_0_1 |
| if cv.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(cv.AuxInt) |
| if v_1.Op != ssaop.OpEq8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 { |
| if x != v_1_0 || v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c|d == c && ssa.OneBit(c^d)) { |
| continue |
| } |
| v.Reset(ssaop.OpEq8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpOr8, x.Type) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, x.Type) |
| v1.AuxInt = ssa.Int8ToAuxInt(c ^ d) |
| v0.AddArg2(x, v1) |
| v.AddArg2(v0, cv) |
| return true |
| } |
| } |
| } |
| break |
| } |
| // match: (OrB (Neq64F x x) (Less64F x y:(Const64F [c]))) |
| // result: (Not (Leq64F y x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLess64F { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| y := v_1.Args[1] |
| if y.Op != ssaop.OpConst64F { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLeq64F, typ.Bool) |
| v0.AddArg2(y, x) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq64F x x) (Leq64F x y:(Const64F [c]))) |
| // result: (Not (Less64F y x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLeq64F { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| y := v_1.Args[1] |
| if y.Op != ssaop.OpConst64F { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLess64F, typ.Bool) |
| v0.AddArg2(y, x) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq64F x x) (Less64F y:(Const64F [c]) x)) |
| // result: (Not (Leq64F x y)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLess64F { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if y.Op != ssaop.OpConst64F { |
| continue |
| } |
| if x != v_1.Args[1] { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLeq64F, typ.Bool) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq64F x x) (Leq64F y:(Const64F [c]) x)) |
| // result: (Not (Less64F x y)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLeq64F { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if y.Op != ssaop.OpConst64F { |
| continue |
| } |
| if x != v_1.Args[1] { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLess64F, typ.Bool) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq32F x x) (Less32F x y:(Const32F [c]))) |
| // result: (Not (Leq32F y x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq32F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLess32F { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| y := v_1.Args[1] |
| if y.Op != ssaop.OpConst32F { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLeq32F, typ.Bool) |
| v0.AddArg2(y, x) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq32F x x) (Leq32F x y:(Const32F [c]))) |
| // result: (Not (Less32F y x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq32F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLeq32F { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| y := v_1.Args[1] |
| if y.Op != ssaop.OpConst32F { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLess32F, typ.Bool) |
| v0.AddArg2(y, x) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq32F x x) (Less32F y:(Const32F [c]) x)) |
| // result: (Not (Leq32F x y)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq32F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLess32F { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if y.Op != ssaop.OpConst32F { |
| continue |
| } |
| if x != v_1.Args[1] { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLeq32F, typ.Bool) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq32F x x) (Leq32F y:(Const32F [c]) x)) |
| // result: (Not (Less32F x y)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq32F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLeq32F { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if y.Op != ssaop.OpConst32F { |
| continue |
| } |
| if x != v_1.Args[1] { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLess32F, typ.Bool) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq64F x x) (Less64F abs:(Abs x) y:(Const64F [c]))) |
| // result: (Not (Leq64F y abs)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLess64F { |
| continue |
| } |
| _ = v_1.Args[1] |
| abs := v_1.Args[0] |
| if abs.Op != ssaop.OpAbs || x != abs.Args[0] { |
| continue |
| } |
| y := v_1.Args[1] |
| if y.Op != ssaop.OpConst64F { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLeq64F, typ.Bool) |
| v0.AddArg2(y, abs) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq64F x x) (Leq64F abs:(Abs x) y:(Const64F [c]))) |
| // result: (Not (Less64F y abs)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLeq64F { |
| continue |
| } |
| _ = v_1.Args[1] |
| abs := v_1.Args[0] |
| if abs.Op != ssaop.OpAbs || x != abs.Args[0] { |
| continue |
| } |
| y := v_1.Args[1] |
| if y.Op != ssaop.OpConst64F { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLess64F, typ.Bool) |
| v0.AddArg2(y, abs) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq64F x x) (Less64F y:(Const64F [c]) abs:(Abs x))) |
| // result: (Not (Leq64F abs y)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLess64F { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if y.Op != ssaop.OpConst64F { |
| continue |
| } |
| abs := v_1.Args[1] |
| if abs.Op != ssaop.OpAbs || x != abs.Args[0] { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLeq64F, typ.Bool) |
| v0.AddArg2(abs, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq64F x x) (Leq64F y:(Const64F [c]) abs:(Abs x))) |
| // result: (Not (Less64F abs y)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLeq64F { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if y.Op != ssaop.OpConst64F { |
| continue |
| } |
| abs := v_1.Args[1] |
| if abs.Op != ssaop.OpAbs || x != abs.Args[0] { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLess64F, typ.Bool) |
| v0.AddArg2(abs, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq64F x x) (Less64F neg:(Neg64F x) y:(Const64F [c]))) |
| // result: (Not (Leq64F y neg)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLess64F { |
| continue |
| } |
| _ = v_1.Args[1] |
| neg := v_1.Args[0] |
| if neg.Op != ssaop.OpNeg64F || x != neg.Args[0] { |
| continue |
| } |
| y := v_1.Args[1] |
| if y.Op != ssaop.OpConst64F { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLeq64F, typ.Bool) |
| v0.AddArg2(y, neg) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq64F x x) (Leq64F neg:(Neg64F x) y:(Const64F [c]))) |
| // result: (Not (Less64F y neg)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLeq64F { |
| continue |
| } |
| _ = v_1.Args[1] |
| neg := v_1.Args[0] |
| if neg.Op != ssaop.OpNeg64F || x != neg.Args[0] { |
| continue |
| } |
| y := v_1.Args[1] |
| if y.Op != ssaop.OpConst64F { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLess64F, typ.Bool) |
| v0.AddArg2(y, neg) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq64F x x) (Less64F y:(Const64F [c]) neg:(Neg64F x))) |
| // result: (Not (Leq64F neg y)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLess64F { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if y.Op != ssaop.OpConst64F { |
| continue |
| } |
| neg := v_1.Args[1] |
| if neg.Op != ssaop.OpNeg64F || x != neg.Args[0] { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLeq64F, typ.Bool) |
| v0.AddArg2(neg, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq64F x x) (Leq64F y:(Const64F [c]) neg:(Neg64F x))) |
| // result: (Not (Less64F neg y)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq64F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLeq64F { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if y.Op != ssaop.OpConst64F { |
| continue |
| } |
| neg := v_1.Args[1] |
| if neg.Op != ssaop.OpNeg64F || x != neg.Args[0] { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLess64F, typ.Bool) |
| v0.AddArg2(neg, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq32F x x) (Less32F neg:(Neg32F x) y:(Const32F [c]))) |
| // result: (Not (Leq32F y neg)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq32F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLess32F { |
| continue |
| } |
| _ = v_1.Args[1] |
| neg := v_1.Args[0] |
| if neg.Op != ssaop.OpNeg32F || x != neg.Args[0] { |
| continue |
| } |
| y := v_1.Args[1] |
| if y.Op != ssaop.OpConst32F { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLeq32F, typ.Bool) |
| v0.AddArg2(y, neg) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq32F x x) (Leq32F neg:(Neg32F x) y:(Const32F [c]))) |
| // result: (Not (Less32F y neg)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq32F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLeq32F { |
| continue |
| } |
| _ = v_1.Args[1] |
| neg := v_1.Args[0] |
| if neg.Op != ssaop.OpNeg32F || x != neg.Args[0] { |
| continue |
| } |
| y := v_1.Args[1] |
| if y.Op != ssaop.OpConst32F { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLess32F, typ.Bool) |
| v0.AddArg2(y, neg) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq32F x x) (Less32F y:(Const32F [c]) neg:(Neg32F x))) |
| // result: (Not (Leq32F neg y)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq32F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLess32F { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if y.Op != ssaop.OpConst32F { |
| continue |
| } |
| neg := v_1.Args[1] |
| if neg.Op != ssaop.OpNeg32F || x != neg.Args[0] { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLeq32F, typ.Bool) |
| v0.AddArg2(neg, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB (Neq32F x x) (Leq32F y:(Const32F [c]) neg:(Neg32F x))) |
| // result: (Not (Less32F neg y)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpNeq32F { |
| continue |
| } |
| x := v_0.Args[1] |
| if x != v_0.Args[0] || v_1.Op != ssaop.OpLeq32F { |
| continue |
| } |
| _ = v_1.Args[1] |
| y := v_1.Args[0] |
| if y.Op != ssaop.OpConst32F { |
| continue |
| } |
| neg := v_1.Args[1] |
| if neg.Op != ssaop.OpNeg32F || x != neg.Args[0] { |
| continue |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpLess32F, typ.Bool) |
| v0.AddArg2(neg, y) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (OrB x x) |
| // result: x |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (OrB (ConstBool [false]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstBool || ssa.AuxIntToBool(v_0.AuxInt) != false { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (OrB (ConstBool [true]) _) |
| // result: (ConstBool [true]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConstBool || ssa.AuxIntToBool(v_0.AuxInt) != true { |
| continue |
| } |
| v.Reset(ssaop.OpConstBool) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpPhi(v *ssa.Value) bool { |
| b := v.Block |
| // match: (Phi (Const8 [c]) (Const8 [c])) |
| // result: (Const8 [c]) |
| for { |
| if len(v.Args) != 2 { |
| break |
| } |
| _ = v.Args[1] |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != c { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(c) |
| return true |
| } |
| // match: (Phi (Const16 [c]) (Const16 [c])) |
| // result: (Const16 [c]) |
| for { |
| if len(v.Args) != 2 { |
| break |
| } |
| _ = v.Args[1] |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != c { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(c) |
| return true |
| } |
| // match: (Phi (Const32 [c]) (Const32 [c])) |
| // result: (Const32 [c]) |
| for { |
| if len(v.Args) != 2 { |
| break |
| } |
| _ = v.Args[1] |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != c { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(c) |
| return true |
| } |
| // match: (Phi (Const64 [c]) (Const64 [c])) |
| // result: (Const64 [c]) |
| for { |
| if len(v.Args) != 2 { |
| break |
| } |
| _ = v.Args[1] |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(c) |
| return true |
| } |
| // match: (Phi <t> nx:(Not x) ny:(Not y)) |
| // cond: nx.Uses == 1 && ny.Uses == 1 |
| // result: (Not (Phi <t> x y)) |
| for { |
| if len(v.Args) != 2 { |
| break |
| } |
| t := v.Type |
| _ = v.Args[1] |
| nx := v.Args[0] |
| if nx.Op != ssaop.OpNot { |
| break |
| } |
| x := nx.Args[0] |
| ny := v.Args[1] |
| if ny.Op != ssaop.OpNot { |
| break |
| } |
| y := ny.Args[0] |
| if !(nx.Uses == 1 && ny.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpNot) |
| v0 := b.NewValue0(v.Pos, ssaop.OpPhi, t) |
| v0.AddArg2(x, y) |
| v.AddArg(v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpPopCount16(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (PopCount16 (Const16 [c])) |
| // cond: config.PtrSize == 8 |
| // result: (Const64 [int64(bits.OnesCount16(uint16(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(bits.OnesCount16(uint16(c)))) |
| return true |
| } |
| // match: (PopCount16 (Const16 [c])) |
| // cond: config.PtrSize == 4 |
| // result: (Const32 [int32(bits.OnesCount16(uint16(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(bits.OnesCount16(uint16(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpPopCount32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (PopCount32 (Const32 [c])) |
| // cond: config.PtrSize == 8 |
| // result: (Const64 [int64(bits.OnesCount32(uint32(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(bits.OnesCount32(uint32(c)))) |
| return true |
| } |
| // match: (PopCount32 (Const32 [c])) |
| // cond: config.PtrSize == 4 |
| // result: (Const32 [int32(bits.OnesCount32(uint32(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(bits.OnesCount32(uint32(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpPopCount64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (PopCount64 (Const64 [c])) |
| // cond: config.PtrSize == 8 |
| // result: (Const64 [int64(bits.OnesCount64(uint64(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(bits.OnesCount64(uint64(c)))) |
| return true |
| } |
| // match: (PopCount64 (Const64 [c])) |
| // cond: config.PtrSize == 4 |
| // result: (Const32 [int32(bits.OnesCount64(uint64(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(bits.OnesCount64(uint64(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpPopCount8(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (PopCount8 (Const8 [c])) |
| // cond: config.PtrSize == 8 |
| // result: (Const64 [int64(bits.OnesCount8(uint8(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(bits.OnesCount8(uint8(c)))) |
| return true |
| } |
| // match: (PopCount8 (Const8 [c])) |
| // cond: config.PtrSize == 4 |
| // result: (Const32 [int32(bits.OnesCount8(uint8(c)))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(bits.OnesCount8(uint8(c)))) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpPtrIndex(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| typ := &b.Func.Config.Types |
| // match: (PtrIndex <t> ptr idx) |
| // cond: config.PtrSize == 4 && ssa.Is32Bit(t.Elem().Size()) |
| // result: (AddPtr ptr (Mul32 <typ.Int> idx (Const32 <typ.Int> [int32(t.Elem().Size())]))) |
| for { |
| t := v.Type |
| ptr := v_0 |
| idx := v_1 |
| if !(config.PtrSize == 4 && ssa.Is32Bit(t.Elem().Size())) { |
| break |
| } |
| v.Reset(ssaop.OpAddPtr) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul32, typ.Int) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int) |
| v1.AuxInt = ssa.Int32ToAuxInt(int32(t.Elem().Size())) |
| v0.AddArg2(idx, v1) |
| v.AddArg2(ptr, v0) |
| return true |
| } |
| // match: (PtrIndex <t> ptr idx) |
| // cond: config.PtrSize == 8 |
| // result: (AddPtr ptr (Mul64 <typ.Int> idx (Const64 <typ.Int> [t.Elem().Size()]))) |
| for { |
| t := v.Type |
| ptr := v_0 |
| idx := v_1 |
| if !(config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpAddPtr) |
| v0 := b.NewValue0(v.Pos, ssaop.OpMul64, typ.Int) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int) |
| v1.AuxInt = ssa.Int64ToAuxInt(t.Elem().Size()) |
| v0.AddArg2(idx, v1) |
| v.AddArg2(ptr, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRotateLeft16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (RotateLeft16 (Const16 [x]) (Const64 [y])) |
| // result: (Const16 [int16(bits.RotateLeft16(uint16(x), int(y)))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| x := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| y := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(int16(bits.RotateLeft16(uint16(x), int(y)))) |
| return true |
| } |
| // match: (RotateLeft16 (Const16 [x]) (Const32 [y])) |
| // result: (Const16 [int16(bits.RotateLeft16(uint16(x), int(y)))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| x := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| y := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(int16(bits.RotateLeft16(uint16(x), int(y)))) |
| return true |
| } |
| // match: (RotateLeft16 x (Const16 [c])) |
| // cond: c%16 == 0 |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(c%16 == 0) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (RotateLeft16 x (And64 y (Const64 [c]))) |
| // cond: c&15 == 15 |
| // result: (RotateLeft16 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c&15 == 15) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft16 x (And32 y (Const32 [c]))) |
| // cond: c&15 == 15 |
| // result: (RotateLeft16 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c&15 == 15) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft16 x (And16 y (Const16 [c]))) |
| // cond: c&15 == 15 |
| // result: (RotateLeft16 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c&15 == 15) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft16 x (And8 y (Const8 [c]))) |
| // cond: c&15 == 15 |
| // result: (RotateLeft16 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c&15 == 15) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft16 x (Neg64 (And64 y (Const64 [c])))) |
| // cond: c&15 == 15 |
| // result: (RotateLeft16 x (Neg64 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg64 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_0_1.AuxInt) |
| if !(c&15 == 15) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg64, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft16 x (Neg32 (And32 y (Const32 [c])))) |
| // cond: c&15 == 15 |
| // result: (RotateLeft16 x (Neg32 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg32 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_0_1.AuxInt) |
| if !(c&15 == 15) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg32, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft16 x (Neg16 (And16 y (Const16 [c])))) |
| // cond: c&15 == 15 |
| // result: (RotateLeft16 x (Neg16 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg16 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_0_1.AuxInt) |
| if !(c&15 == 15) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg16, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft16 x (Neg8 (And8 y (Const8 [c])))) |
| // cond: c&15 == 15 |
| // result: (RotateLeft16 x (Neg8 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg8 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_0_1.AuxInt) |
| if !(c&15 == 15) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg8, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft16 x (Add64 y (Const64 [c]))) |
| // cond: c&15 == 0 |
| // result: (RotateLeft16 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c&15 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft16 x (Add32 y (Const32 [c]))) |
| // cond: c&15 == 0 |
| // result: (RotateLeft16 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c&15 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft16 x (Add16 y (Const16 [c]))) |
| // cond: c&15 == 0 |
| // result: (RotateLeft16 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd16 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c&15 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft16 x (Add8 y (Const8 [c]))) |
| // cond: c&15 == 0 |
| // result: (RotateLeft16 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd8 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c&15 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft16 x (Sub64 (Const64 [c]) y)) |
| // cond: c&15 == 0 |
| // result: (RotateLeft16 x (Neg64 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub64 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1_0.AuxInt) |
| if !(c&15 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg64, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft16 x (Sub32 (Const32 [c]) y)) |
| // cond: c&15 == 0 |
| // result: (RotateLeft16 x (Neg32 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub32 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1_0.AuxInt) |
| if !(c&15 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg32, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft16 x (Sub16 (Const16 [c]) y)) |
| // cond: c&15 == 0 |
| // result: (RotateLeft16 x (Neg16 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub16 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1_0.AuxInt) |
| if !(c&15 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg16, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft16 x (Sub8 (Const8 [c]) y)) |
| // cond: c&15 == 0 |
| // result: (RotateLeft16 x (Neg8 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub8 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1_0.AuxInt) |
| if !(c&15 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg8, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft16 x (Const64 <t> [c])) |
| // cond: config.PtrSize == 4 |
| // result: (RotateLeft16 x (Const32 <t> [int32(c)])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(int32(c)) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft16 (RotateLeft16 x c) d) |
| // cond: c.Type.Size() == 8 && d.Type.Size() == 8 |
| // result: (RotateLeft16 x (Add64 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft16 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 8 && d.Type.Size() == 8) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd64, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft16 (RotateLeft16 x c) d) |
| // cond: c.Type.Size() == 4 && d.Type.Size() == 4 |
| // result: (RotateLeft16 x (Add32 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft16 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 4 && d.Type.Size() == 4) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd32, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft16 (RotateLeft16 x c) d) |
| // cond: c.Type.Size() == 2 && d.Type.Size() == 2 |
| // result: (RotateLeft16 x (Add16 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft16 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 2 && d.Type.Size() == 2) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd16, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft16 (RotateLeft16 x c) d) |
| // cond: c.Type.Size() == 1 && d.Type.Size() == 1 |
| // result: (RotateLeft16 x (Add8 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft16 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 1 && d.Type.Size() == 1) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd8, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRotateLeft32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (RotateLeft32 (Const32 [x]) (Const64 [y])) |
| // result: (Const32 [int32(bits.RotateLeft32(uint32(x), int(y)))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| x := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| y := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(bits.RotateLeft32(uint32(x), int(y)))) |
| return true |
| } |
| // match: (RotateLeft32 (Const32 [x]) (Const32 [y])) |
| // result: (Const32 [int32(bits.RotateLeft32(uint32(x), int(y)))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| x := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| y := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(bits.RotateLeft32(uint32(x), int(y)))) |
| return true |
| } |
| // match: (RotateLeft32 x (Const32 [c])) |
| // cond: c%32 == 0 |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(c%32 == 0) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (RotateLeft32 x (And64 y (Const64 [c]))) |
| // cond: c&31 == 31 |
| // result: (RotateLeft32 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c&31 == 31) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft32 x (And32 y (Const32 [c]))) |
| // cond: c&31 == 31 |
| // result: (RotateLeft32 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c&31 == 31) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft32 x (And16 y (Const16 [c]))) |
| // cond: c&31 == 31 |
| // result: (RotateLeft32 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c&31 == 31) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft32 x (And8 y (Const8 [c]))) |
| // cond: c&31 == 31 |
| // result: (RotateLeft32 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c&31 == 31) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft32 x (Neg64 (And64 y (Const64 [c])))) |
| // cond: c&31 == 31 |
| // result: (RotateLeft32 x (Neg64 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg64 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_0_1.AuxInt) |
| if !(c&31 == 31) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg64, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft32 x (Neg32 (And32 y (Const32 [c])))) |
| // cond: c&31 == 31 |
| // result: (RotateLeft32 x (Neg32 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg32 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_0_1.AuxInt) |
| if !(c&31 == 31) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg32, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft32 x (Neg16 (And16 y (Const16 [c])))) |
| // cond: c&31 == 31 |
| // result: (RotateLeft32 x (Neg16 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg16 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_0_1.AuxInt) |
| if !(c&31 == 31) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg16, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft32 x (Neg8 (And8 y (Const8 [c])))) |
| // cond: c&31 == 31 |
| // result: (RotateLeft32 x (Neg8 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg8 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_0_1.AuxInt) |
| if !(c&31 == 31) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg8, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft32 x (Add64 y (Const64 [c]))) |
| // cond: c&31 == 0 |
| // result: (RotateLeft32 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c&31 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft32 x (Add32 y (Const32 [c]))) |
| // cond: c&31 == 0 |
| // result: (RotateLeft32 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c&31 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft32 x (Add16 y (Const16 [c]))) |
| // cond: c&31 == 0 |
| // result: (RotateLeft32 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd16 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c&31 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft32 x (Add8 y (Const8 [c]))) |
| // cond: c&31 == 0 |
| // result: (RotateLeft32 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd8 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c&31 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft32 x (Sub64 (Const64 [c]) y)) |
| // cond: c&31 == 0 |
| // result: (RotateLeft32 x (Neg64 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub64 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1_0.AuxInt) |
| if !(c&31 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg64, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft32 x (Sub32 (Const32 [c]) y)) |
| // cond: c&31 == 0 |
| // result: (RotateLeft32 x (Neg32 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub32 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1_0.AuxInt) |
| if !(c&31 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg32, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft32 x (Sub16 (Const16 [c]) y)) |
| // cond: c&31 == 0 |
| // result: (RotateLeft32 x (Neg16 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub16 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1_0.AuxInt) |
| if !(c&31 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg16, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft32 x (Sub8 (Const8 [c]) y)) |
| // cond: c&31 == 0 |
| // result: (RotateLeft32 x (Neg8 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub8 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1_0.AuxInt) |
| if !(c&31 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg8, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft32 x (Const64 <t> [c])) |
| // cond: config.PtrSize == 4 |
| // result: (RotateLeft32 x (Const32 <t> [int32(c)])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(int32(c)) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft32 (RotateLeft32 x c) d) |
| // cond: c.Type.Size() == 8 && d.Type.Size() == 8 |
| // result: (RotateLeft32 x (Add64 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft32 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 8 && d.Type.Size() == 8) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd64, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft32 (RotateLeft32 x c) d) |
| // cond: c.Type.Size() == 4 && d.Type.Size() == 4 |
| // result: (RotateLeft32 x (Add32 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft32 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 4 && d.Type.Size() == 4) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd32, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft32 (RotateLeft32 x c) d) |
| // cond: c.Type.Size() == 2 && d.Type.Size() == 2 |
| // result: (RotateLeft32 x (Add16 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft32 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 2 && d.Type.Size() == 2) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd16, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft32 (RotateLeft32 x c) d) |
| // cond: c.Type.Size() == 1 && d.Type.Size() == 1 |
| // result: (RotateLeft32 x (Add8 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft32 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 1 && d.Type.Size() == 1) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd8, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRotateLeft64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (RotateLeft64 (Const64 [x]) (Const64 [y])) |
| // result: (Const64 [int64(bits.RotateLeft64(uint64(x), int(y)))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| x := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| y := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(bits.RotateLeft64(uint64(x), int(y)))) |
| return true |
| } |
| // match: (RotateLeft64 (Const64 [x]) (Const32 [y])) |
| // result: (Const64 [int64(bits.RotateLeft64(uint64(x), int(y)))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| x := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| y := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(bits.RotateLeft64(uint64(x), int(y)))) |
| return true |
| } |
| // match: (RotateLeft64 x (Const64 [c])) |
| // cond: c%64 == 0 |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c%64 == 0) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (RotateLeft64 x (And64 y (Const64 [c]))) |
| // cond: c&63 == 63 |
| // result: (RotateLeft64 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c&63 == 63) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft64 x (And32 y (Const32 [c]))) |
| // cond: c&63 == 63 |
| // result: (RotateLeft64 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c&63 == 63) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft64 x (And16 y (Const16 [c]))) |
| // cond: c&63 == 63 |
| // result: (RotateLeft64 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c&63 == 63) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft64 x (And8 y (Const8 [c]))) |
| // cond: c&63 == 63 |
| // result: (RotateLeft64 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c&63 == 63) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft64 x (Neg64 (And64 y (Const64 [c])))) |
| // cond: c&63 == 63 |
| // result: (RotateLeft64 x (Neg64 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg64 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_0_1.AuxInt) |
| if !(c&63 == 63) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg64, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft64 x (Neg32 (And32 y (Const32 [c])))) |
| // cond: c&63 == 63 |
| // result: (RotateLeft64 x (Neg32 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg32 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_0_1.AuxInt) |
| if !(c&63 == 63) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg32, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft64 x (Neg16 (And16 y (Const16 [c])))) |
| // cond: c&63 == 63 |
| // result: (RotateLeft64 x (Neg16 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg16 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_0_1.AuxInt) |
| if !(c&63 == 63) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg16, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft64 x (Neg8 (And8 y (Const8 [c])))) |
| // cond: c&63 == 63 |
| // result: (RotateLeft64 x (Neg8 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg8 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_0_1.AuxInt) |
| if !(c&63 == 63) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg8, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft64 x (Add64 y (Const64 [c]))) |
| // cond: c&63 == 0 |
| // result: (RotateLeft64 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c&63 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft64 x (Add32 y (Const32 [c]))) |
| // cond: c&63 == 0 |
| // result: (RotateLeft64 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c&63 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft64 x (Add16 y (Const16 [c]))) |
| // cond: c&63 == 0 |
| // result: (RotateLeft64 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd16 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c&63 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft64 x (Add8 y (Const8 [c]))) |
| // cond: c&63 == 0 |
| // result: (RotateLeft64 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd8 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c&63 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft64 x (Sub64 (Const64 [c]) y)) |
| // cond: c&63 == 0 |
| // result: (RotateLeft64 x (Neg64 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub64 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1_0.AuxInt) |
| if !(c&63 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg64, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft64 x (Sub32 (Const32 [c]) y)) |
| // cond: c&63 == 0 |
| // result: (RotateLeft64 x (Neg32 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub32 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1_0.AuxInt) |
| if !(c&63 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg32, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft64 x (Sub16 (Const16 [c]) y)) |
| // cond: c&63 == 0 |
| // result: (RotateLeft64 x (Neg16 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub16 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1_0.AuxInt) |
| if !(c&63 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg16, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft64 x (Sub8 (Const8 [c]) y)) |
| // cond: c&63 == 0 |
| // result: (RotateLeft64 x (Neg8 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub8 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1_0.AuxInt) |
| if !(c&63 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg8, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft64 x (Const64 <t> [c])) |
| // cond: config.PtrSize == 4 |
| // result: (RotateLeft64 x (Const32 <t> [int32(c)])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(int32(c)) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft64 (RotateLeft64 x c) d) |
| // cond: c.Type.Size() == 8 && d.Type.Size() == 8 |
| // result: (RotateLeft64 x (Add64 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft64 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 8 && d.Type.Size() == 8) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd64, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft64 (RotateLeft64 x c) d) |
| // cond: c.Type.Size() == 4 && d.Type.Size() == 4 |
| // result: (RotateLeft64 x (Add32 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft64 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 4 && d.Type.Size() == 4) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd32, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft64 (RotateLeft64 x c) d) |
| // cond: c.Type.Size() == 2 && d.Type.Size() == 2 |
| // result: (RotateLeft64 x (Add16 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft64 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 2 && d.Type.Size() == 2) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd16, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft64 (RotateLeft64 x c) d) |
| // cond: c.Type.Size() == 1 && d.Type.Size() == 1 |
| // result: (RotateLeft64 x (Add8 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft64 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 1 && d.Type.Size() == 1) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd8, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRotateLeft8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (RotateLeft8 (Const8 [x]) (Const64 [y])) |
| // result: (Const8 [int8(bits.RotateLeft8(uint8(x), int(y)))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| x := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| y := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(int8(bits.RotateLeft8(uint8(x), int(y)))) |
| return true |
| } |
| // match: (RotateLeft8 (Const8 [x]) (Const32 [y])) |
| // result: (Const8 [int8(bits.RotateLeft8(uint8(x), int(y)))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| x := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| y := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(int8(bits.RotateLeft8(uint8(x), int(y)))) |
| return true |
| } |
| // match: (RotateLeft8 x (Const8 [c])) |
| // cond: c%8 == 0 |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(c%8 == 0) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (RotateLeft8 x (And64 y (Const64 [c]))) |
| // cond: c&7 == 7 |
| // result: (RotateLeft8 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c&7 == 7) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft8 x (And32 y (Const32 [c]))) |
| // cond: c&7 == 7 |
| // result: (RotateLeft8 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c&7 == 7) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft8 x (And16 y (Const16 [c]))) |
| // cond: c&7 == 7 |
| // result: (RotateLeft8 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c&7 == 7) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft8 x (And8 y (Const8 [c]))) |
| // cond: c&7 == 7 |
| // result: (RotateLeft8 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c&7 == 7) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft8 x (Neg64 (And64 y (Const64 [c])))) |
| // cond: c&7 == 7 |
| // result: (RotateLeft8 x (Neg64 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg64 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_0_1.AuxInt) |
| if !(c&7 == 7) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg64, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft8 x (Neg32 (And32 y (Const32 [c])))) |
| // cond: c&7 == 7 |
| // result: (RotateLeft8 x (Neg32 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg32 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_0_1.AuxInt) |
| if !(c&7 == 7) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg32, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft8 x (Neg16 (And16 y (Const16 [c])))) |
| // cond: c&7 == 7 |
| // result: (RotateLeft8 x (Neg16 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg16 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_0_1.AuxInt) |
| if !(c&7 == 7) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg16, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft8 x (Neg8 (And8 y (Const8 [c])))) |
| // cond: c&7 == 7 |
| // result: (RotateLeft8 x (Neg8 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpNeg8 { |
| break |
| } |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpAnd8 { |
| break |
| } |
| _ = v_1_0.Args[1] |
| v_1_0_0 := v_1_0.Args[0] |
| v_1_0_1 := v_1_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 { |
| y := v_1_0_0 |
| if v_1_0_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_0_1.AuxInt) |
| if !(c&7 == 7) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg8, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft8 x (Add64 y (Const64 [c]))) |
| // cond: c&7 == 0 |
| // result: (RotateLeft8 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c&7 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft8 x (Add32 y (Const32 [c]))) |
| // cond: c&7 == 0 |
| // result: (RotateLeft8 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_1_1.AuxInt) |
| if !(c&7 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft8 x (Add16 y (Const16 [c]))) |
| // cond: c&7 == 0 |
| // result: (RotateLeft8 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd16 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_1_1.AuxInt) |
| if !(c&7 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft8 x (Add8 y (Const8 [c]))) |
| // cond: c&7 == 0 |
| // result: (RotateLeft8 x y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd8 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| y := v_1_0 |
| if v_1_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_1_1.AuxInt) |
| if !(c&7 == 0) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (RotateLeft8 x (Sub64 (Const64 [c]) y)) |
| // cond: c&7 == 0 |
| // result: (RotateLeft8 x (Neg64 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub64 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1_0.AuxInt) |
| if !(c&7 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg64, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft8 x (Sub32 (Const32 [c]) y)) |
| // cond: c&7 == 0 |
| // result: (RotateLeft8 x (Neg32 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub32 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1_0.AuxInt) |
| if !(c&7 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg32, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft8 x (Sub16 (Const16 [c]) y)) |
| // cond: c&7 == 0 |
| // result: (RotateLeft8 x (Neg16 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub16 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1_0.AuxInt) |
| if !(c&7 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg16, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft8 x (Sub8 (Const8 [c]) y)) |
| // cond: c&7 == 0 |
| // result: (RotateLeft8 x (Neg8 <y.Type> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub8 { |
| break |
| } |
| y := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1_0.AuxInt) |
| if !(c&7 == 0) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNeg8, y.Type) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft8 x (Const64 <t> [c])) |
| // cond: config.PtrSize == 4 |
| // result: (RotateLeft8 x (Const32 <t> [int32(c)])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(config.PtrSize == 4) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(int32(c)) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft8 (RotateLeft8 x c) d) |
| // cond: c.Type.Size() == 8 && d.Type.Size() == 8 |
| // result: (RotateLeft8 x (Add64 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft8 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 8 && d.Type.Size() == 8) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd64, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft8 (RotateLeft8 x c) d) |
| // cond: c.Type.Size() == 4 && d.Type.Size() == 4 |
| // result: (RotateLeft8 x (Add32 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft8 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 4 && d.Type.Size() == 4) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd32, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft8 (RotateLeft8 x c) d) |
| // cond: c.Type.Size() == 2 && d.Type.Size() == 2 |
| // result: (RotateLeft8 x (Add16 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft8 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 2 && d.Type.Size() == 2) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd16, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (RotateLeft8 (RotateLeft8 x c) d) |
| // cond: c.Type.Size() == 1 && d.Type.Size() == 1 |
| // result: (RotateLeft8 x (Add8 <c.Type> c d)) |
| for { |
| if v_0.Op != ssaop.OpRotateLeft8 { |
| break |
| } |
| c := v_0.Args[1] |
| x := v_0.Args[0] |
| d := v_1 |
| if !(c.Type.Size() == 1 && d.Type.Size() == 1) { |
| break |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd8, c.Type) |
| v0.AddArg2(c, d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRound32F(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Round32F x:(Const32F)) |
| // result: x |
| for { |
| x := v_0 |
| if x.Op != ssaop.OpConst32F { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRound64F(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Round64F x:(Const64F)) |
| // result: x |
| for { |
| x := v_0 |
| if x.Op != ssaop.OpConst64F { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRoundToEven(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (RoundToEven (Const64F [c])) |
| // result: (Const64F [math.RoundToEven(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(math.RoundToEven(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh16Ux16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh16Ux16 x (Const16 [c])) |
| // result: (Rsh16Ux64 x (Const64 <types.Types[types.TUINT64]> [int64(uint16(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh16Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh16Ux16 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh16Ux16 [false] x con:(Const16 [c])) |
| // cond: 0 < c && c < 16 |
| // result: (Rsh16Ux16 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(con.AuxInt) |
| if !(0 < c && c < 16) { |
| break |
| } |
| v.Reset(ssaop.OpRsh16Ux16) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh16Ux32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh16Ux32 x (Const32 [c])) |
| // result: (Rsh16Ux64 x (Const64 <types.Types[types.TUINT64]> [int64(uint32(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh16Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh16Ux32 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh16Ux32 [false] x con:(Const32 [c])) |
| // cond: 0 < c && c < 16 |
| // result: (Rsh16Ux32 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(con.AuxInt) |
| if !(0 < c && c < 16) { |
| break |
| } |
| v.Reset(ssaop.OpRsh16Ux32) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh16Ux64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Rsh16Ux64 (Const16 [c]) (Const64 [d])) |
| // result: (Const16 [int16(uint16(c) >> uint64(d))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(int16(uint16(c) >> uint64(d))) |
| return true |
| } |
| // match: (Rsh16Ux64 x (Const64 [0])) |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Rsh16Ux64 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh16Ux64 _ (Const64 [c])) |
| // cond: uint64(c) >= 16 |
| // result: (Const16 [0]) |
| for { |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c) >= 16) { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh16Ux64 <t> (Rsh16Ux64 x (Const64 [c])) (Const64 [d])) |
| // cond: !uaddOvf(c,d) |
| // result: (Rsh16Ux64 x (Const64 <t> [c+d])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpRsh16Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(!uaddOvf(c, d)) { |
| break |
| } |
| v.Reset(ssaop.OpRsh16Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh16Ux64 (Rsh16x64 x _) (Const64 <t> [15])) |
| // result: (Rsh16Ux64 x (Const64 <t> [15])) |
| for { |
| if v_0.Op != ssaop.OpRsh16x64 { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt64(v_1.AuxInt) != 15 { |
| break |
| } |
| v.Reset(ssaop.OpRsh16Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(15) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh16Ux64 i:(Lsh16x64 x (Const64 [c])) (Const64 [c])) |
| // cond: c >= 0 && c < 16 && i.Uses == 1 |
| // result: (And16 x (Const16 <v.Type> [int16(^uint16(0)>>c)])) |
| for { |
| i := v_0 |
| if i.Op != ssaop.OpLsh16x64 { |
| break |
| } |
| _ = i.Args[1] |
| x := i.Args[0] |
| i_1 := i.Args[1] |
| if i_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(i_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c || !(c >= 0 && c < 16 && i.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAnd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, v.Type) |
| v0.AuxInt = ssa.Int16ToAuxInt(int16(^uint16(0) >> c)) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh16Ux64 (Lsh16x64 (Rsh16Ux64 x (Const64 [c1])) (Const64 [c2])) (Const64 [c3])) |
| // cond: uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3) |
| // result: (Rsh16Ux64 x (Const64 <typ.UInt64> [c1-c2+c3])) |
| for { |
| if v_0.Op != ssaop.OpLsh16x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpRsh16Ux64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c1 := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c2 := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c3 := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3)) { |
| break |
| } |
| v.Reset(ssaop.OpRsh16Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(c1 - c2 + c3) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh16Ux64 (Lsh16x64 x (Const64 [8])) (Const64 [8])) |
| // result: (ZeroExt8to16 (Trunc16to8 <typ.UInt8> x)) |
| for { |
| if v_0.Op != ssaop.OpLsh16x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 8 || v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 8 { |
| break |
| } |
| v.Reset(ssaop.OpZeroExt8to16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpTrunc16to8, typ.UInt8) |
| v0.AddArg(x) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Rsh16Ux64 [false] x con:(Const64 [c])) |
| // cond: 0 < c && c < 16 |
| // result: (Rsh16Ux64 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(con.AuxInt) |
| if !(0 < c && c < 16) { |
| break |
| } |
| v.Reset(ssaop.OpRsh16Ux64) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh16Ux8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh16Ux8 x (Const8 [c])) |
| // result: (Rsh16Ux64 x (Const64 <types.Types[types.TUINT64]> [int64(uint8(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh16Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh16Ux8 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh16Ux8 [false] x con:(Const8 [c])) |
| // cond: 0 < c && c < 16 |
| // result: (Rsh16Ux8 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(con.AuxInt) |
| if !(0 < c && c < 16) { |
| break |
| } |
| v.Reset(ssaop.OpRsh16Ux8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh16x16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh16x16 x (Const16 [c])) |
| // result: (Rsh16x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint16(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh16x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh16x16 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh16x16 [false] x con:(Const16 [c])) |
| // cond: 0 < c && c < 16 |
| // result: (Rsh16x16 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(con.AuxInt) |
| if !(0 < c && c < 16) { |
| break |
| } |
| v.Reset(ssaop.OpRsh16x16) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh16x32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh16x32 x (Const32 [c])) |
| // result: (Rsh16x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint32(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh16x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh16x32 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh16x32 [false] x con:(Const32 [c])) |
| // cond: 0 < c && c < 16 |
| // result: (Rsh16x32 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(con.AuxInt) |
| if !(0 < c && c < 16) { |
| break |
| } |
| v.Reset(ssaop.OpRsh16x32) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh16x64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Rsh16x64 (Const16 [c]) (Const64 [d])) |
| // result: (Const16 [c >> uint64(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(c >> uint64(d)) |
| return true |
| } |
| // match: (Rsh16x64 x (Const64 [0])) |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Rsh16x64 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh16x64 <t> (Rsh16x64 x (Const64 [c])) (Const64 [d])) |
| // cond: !uaddOvf(c,d) |
| // result: (Rsh16x64 x (Const64 <t> [c+d])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpRsh16x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(!uaddOvf(c, d)) { |
| break |
| } |
| v.Reset(ssaop.OpRsh16x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh16x64 (Lsh16x64 x (Const64 [8])) (Const64 [8])) |
| // result: (SignExt8to16 (Trunc16to8 <typ.Int8> x)) |
| for { |
| if v_0.Op != ssaop.OpLsh16x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 8 || v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 8 { |
| break |
| } |
| v.Reset(ssaop.OpSignExt8to16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpTrunc16to8, typ.Int8) |
| v0.AddArg(x) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Rsh16x64 [false] x con:(Const64 [c])) |
| // cond: 0 < c && c < 16 |
| // result: (Rsh16x64 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(con.AuxInt) |
| if !(0 < c && c < 16) { |
| break |
| } |
| v.Reset(ssaop.OpRsh16x64) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh16x8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh16x8 x (Const8 [c])) |
| // result: (Rsh16x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint8(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh16x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh16x8 (Const16 [0]) _) |
| // result: (Const16 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh16x8 [false] x con:(Const8 [c])) |
| // cond: 0 < c && c < 16 |
| // result: (Rsh16x8 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(con.AuxInt) |
| if !(0 < c && c < 16) { |
| break |
| } |
| v.Reset(ssaop.OpRsh16x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh32Ux16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh32Ux16 x (Const16 [c])) |
| // result: (Rsh32Ux64 x (Const64 <types.Types[types.TUINT64]> [int64(uint16(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh32Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh32Ux16 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh32Ux16 [false] x con:(Const16 [c])) |
| // cond: 0 < c && c < 32 |
| // result: (Rsh32Ux16 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(con.AuxInt) |
| if !(0 < c && c < 32) { |
| break |
| } |
| v.Reset(ssaop.OpRsh32Ux16) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh32Ux32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh32Ux32 x (Const32 [c])) |
| // result: (Rsh32Ux64 x (Const64 <types.Types[types.TUINT64]> [int64(uint32(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh32Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh32Ux32 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh32Ux32 [false] x con:(Const32 [c])) |
| // cond: 0 < c && c < 32 |
| // result: (Rsh32Ux32 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(con.AuxInt) |
| if !(0 < c && c < 32) { |
| break |
| } |
| v.Reset(ssaop.OpRsh32Ux32) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh32Ux64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Rsh32Ux64 (Const32 [c]) (Const64 [d])) |
| // result: (Const32 [int32(uint32(c) >> uint64(d))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(uint32(c) >> uint64(d))) |
| return true |
| } |
| // match: (Rsh32Ux64 x (Const64 [0])) |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Rsh32Ux64 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh32Ux64 _ (Const64 [c])) |
| // cond: uint64(c) >= 32 |
| // result: (Const32 [0]) |
| for { |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c) >= 32) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh32Ux64 <t> (Rsh32Ux64 x (Const64 [c])) (Const64 [d])) |
| // cond: !uaddOvf(c,d) |
| // result: (Rsh32Ux64 x (Const64 <t> [c+d])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpRsh32Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(!uaddOvf(c, d)) { |
| break |
| } |
| v.Reset(ssaop.OpRsh32Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh32Ux64 (Rsh32x64 x _) (Const64 <t> [31])) |
| // result: (Rsh32Ux64 x (Const64 <t> [31])) |
| for { |
| if v_0.Op != ssaop.OpRsh32x64 { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt64(v_1.AuxInt) != 31 { |
| break |
| } |
| v.Reset(ssaop.OpRsh32Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(31) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh32Ux64 i:(Lsh32x64 x (Const64 [c])) (Const64 [c])) |
| // cond: c >= 0 && c < 32 && i.Uses == 1 |
| // result: (And32 x (Const32 <v.Type> [int32(^uint32(0)>>c)])) |
| for { |
| i := v_0 |
| if i.Op != ssaop.OpLsh32x64 { |
| break |
| } |
| _ = i.Args[1] |
| x := i.Args[0] |
| i_1 := i.Args[1] |
| if i_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(i_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c || !(c >= 0 && c < 32 && i.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAnd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, v.Type) |
| v0.AuxInt = ssa.Int32ToAuxInt(int32(^uint32(0) >> c)) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh32Ux64 (Lsh32x64 (Rsh32Ux64 x (Const64 [c1])) (Const64 [c2])) (Const64 [c3])) |
| // cond: uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3) |
| // result: (Rsh32Ux64 x (Const64 <typ.UInt64> [c1-c2+c3])) |
| for { |
| if v_0.Op != ssaop.OpLsh32x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpRsh32Ux64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c1 := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c2 := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c3 := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3)) { |
| break |
| } |
| v.Reset(ssaop.OpRsh32Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(c1 - c2 + c3) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh32Ux64 (Lsh32x64 x (Const64 [24])) (Const64 [24])) |
| // result: (ZeroExt8to32 (Trunc32to8 <typ.UInt8> x)) |
| for { |
| if v_0.Op != ssaop.OpLsh32x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 24 || v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 24 { |
| break |
| } |
| v.Reset(ssaop.OpZeroExt8to32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpTrunc32to8, typ.UInt8) |
| v0.AddArg(x) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Rsh32Ux64 (Lsh32x64 x (Const64 [16])) (Const64 [16])) |
| // result: (ZeroExt16to32 (Trunc32to16 <typ.UInt16> x)) |
| for { |
| if v_0.Op != ssaop.OpLsh32x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 16 || v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 16 { |
| break |
| } |
| v.Reset(ssaop.OpZeroExt16to32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpTrunc32to16, typ.UInt16) |
| v0.AddArg(x) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Rsh32Ux64 [false] x con:(Const64 [c])) |
| // cond: 0 < c && c < 32 |
| // result: (Rsh32Ux64 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(con.AuxInt) |
| if !(0 < c && c < 32) { |
| break |
| } |
| v.Reset(ssaop.OpRsh32Ux64) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh32Ux8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh32Ux8 x (Const8 [c])) |
| // result: (Rsh32Ux64 x (Const64 <types.Types[types.TUINT64]> [int64(uint8(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh32Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh32Ux8 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh32Ux8 [false] x con:(Const8 [c])) |
| // cond: 0 < c && c < 32 |
| // result: (Rsh32Ux8 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(con.AuxInt) |
| if !(0 < c && c < 32) { |
| break |
| } |
| v.Reset(ssaop.OpRsh32Ux8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh32x16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh32x16 x (Const16 [c])) |
| // result: (Rsh32x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint16(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh32x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh32x16 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh32x16 [false] x con:(Const16 [c])) |
| // cond: 0 < c && c < 32 |
| // result: (Rsh32x16 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(con.AuxInt) |
| if !(0 < c && c < 32) { |
| break |
| } |
| v.Reset(ssaop.OpRsh32x16) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh32x32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh32x32 x (Const32 [c])) |
| // result: (Rsh32x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint32(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh32x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh32x32 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh32x32 [false] x con:(Const32 [c])) |
| // cond: 0 < c && c < 32 |
| // result: (Rsh32x32 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(con.AuxInt) |
| if !(0 < c && c < 32) { |
| break |
| } |
| v.Reset(ssaop.OpRsh32x32) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh32x64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Rsh32x64 (Const32 [c]) (Const64 [d])) |
| // result: (Const32 [c >> uint64(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(c >> uint64(d)) |
| return true |
| } |
| // match: (Rsh32x64 x (Const64 [0])) |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Rsh32x64 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh32x64 <t> (Rsh32x64 x (Const64 [c])) (Const64 [d])) |
| // cond: !uaddOvf(c,d) |
| // result: (Rsh32x64 x (Const64 <t> [c+d])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpRsh32x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(!uaddOvf(c, d)) { |
| break |
| } |
| v.Reset(ssaop.OpRsh32x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh32x64 (Lsh32x64 x (Const64 [24])) (Const64 [24])) |
| // result: (SignExt8to32 (Trunc32to8 <typ.Int8> x)) |
| for { |
| if v_0.Op != ssaop.OpLsh32x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 24 || v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 24 { |
| break |
| } |
| v.Reset(ssaop.OpSignExt8to32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpTrunc32to8, typ.Int8) |
| v0.AddArg(x) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Rsh32x64 (Lsh32x64 x (Const64 [16])) (Const64 [16])) |
| // result: (SignExt16to32 (Trunc32to16 <typ.Int16> x)) |
| for { |
| if v_0.Op != ssaop.OpLsh32x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 16 || v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 16 { |
| break |
| } |
| v.Reset(ssaop.OpSignExt16to32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpTrunc32to16, typ.Int16) |
| v0.AddArg(x) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Rsh32x64 [false] x con:(Const64 [c])) |
| // cond: 0 < c && c < 32 |
| // result: (Rsh32x64 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(con.AuxInt) |
| if !(0 < c && c < 32) { |
| break |
| } |
| v.Reset(ssaop.OpRsh32x64) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh32x8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh32x8 x (Const8 [c])) |
| // result: (Rsh32x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint8(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh32x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh32x8 (Const32 [0]) _) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh32x8 [false] x con:(Const8 [c])) |
| // cond: 0 < c && c < 32 |
| // result: (Rsh32x8 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(con.AuxInt) |
| if !(0 < c && c < 32) { |
| break |
| } |
| v.Reset(ssaop.OpRsh32x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh64Ux16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh64Ux16 x (Const16 [c])) |
| // result: (Rsh64Ux64 x (Const64 <types.Types[types.TUINT64]> [int64(uint16(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh64Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh64Ux16 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh64Ux16 [false] x con:(Const16 [c])) |
| // cond: 0 < c && c < 64 |
| // result: (Rsh64Ux16 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(con.AuxInt) |
| if !(0 < c && c < 64) { |
| break |
| } |
| v.Reset(ssaop.OpRsh64Ux16) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh64Ux32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh64Ux32 x (Const32 [c])) |
| // result: (Rsh64Ux64 x (Const64 <types.Types[types.TUINT64]> [int64(uint32(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh64Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh64Ux32 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh64Ux32 [false] x con:(Const32 [c])) |
| // cond: 0 < c && c < 64 |
| // result: (Rsh64Ux32 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(con.AuxInt) |
| if !(0 < c && c < 64) { |
| break |
| } |
| v.Reset(ssaop.OpRsh64Ux32) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh64Ux64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Rsh64Ux64 (Const64 [c]) (Const64 [d])) |
| // result: (Const64 [int64(uint64(c) >> uint64(d))]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(uint64(c) >> uint64(d))) |
| return true |
| } |
| // match: (Rsh64Ux64 x (Const64 [0])) |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Rsh64Ux64 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh64Ux64 _ (Const64 [c])) |
| // cond: uint64(c) >= 64 |
| // result: (Const64 [0]) |
| for { |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c) >= 64) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh64Ux64 <t> (Rsh64Ux64 x (Const64 [c])) (Const64 [d])) |
| // cond: !uaddOvf(c,d) |
| // result: (Rsh64Ux64 x (Const64 <t> [c+d])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpRsh64Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(!uaddOvf(c, d)) { |
| break |
| } |
| v.Reset(ssaop.OpRsh64Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh64Ux64 (Rsh64x64 x _) (Const64 <t> [63])) |
| // result: (Rsh64Ux64 x (Const64 <t> [63])) |
| for { |
| if v_0.Op != ssaop.OpRsh64x64 { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt64(v_1.AuxInt) != 63 { |
| break |
| } |
| v.Reset(ssaop.OpRsh64Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(63) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh64Ux64 i:(Lsh64x64 x (Const64 [c])) (Const64 [c])) |
| // cond: c >= 0 && c < 64 && i.Uses == 1 |
| // result: (And64 x (Const64 <v.Type> [int64(^uint64(0)>>c)])) |
| for { |
| i := v_0 |
| if i.Op != ssaop.OpLsh64x64 { |
| break |
| } |
| _ = i.Args[1] |
| x := i.Args[0] |
| i_1 := i.Args[1] |
| if i_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(i_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c || !(c >= 0 && c < 64 && i.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAnd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, v.Type) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(^uint64(0) >> c)) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh64Ux64 (Lsh64x64 (Rsh64Ux64 x (Const64 [c1])) (Const64 [c2])) (Const64 [c3])) |
| // cond: uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3) |
| // result: (Rsh64Ux64 x (Const64 <typ.UInt64> [c1-c2+c3])) |
| for { |
| if v_0.Op != ssaop.OpLsh64x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpRsh64Ux64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c1 := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c2 := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c3 := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3)) { |
| break |
| } |
| v.Reset(ssaop.OpRsh64Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(c1 - c2 + c3) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh64Ux64 (Lsh64x64 x (Const64 [56])) (Const64 [56])) |
| // result: (ZeroExt8to64 (Trunc64to8 <typ.UInt8> x)) |
| for { |
| if v_0.Op != ssaop.OpLsh64x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 56 || v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 56 { |
| break |
| } |
| v.Reset(ssaop.OpZeroExt8to64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpTrunc64to8, typ.UInt8) |
| v0.AddArg(x) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Rsh64Ux64 (Lsh64x64 x (Const64 [48])) (Const64 [48])) |
| // result: (ZeroExt16to64 (Trunc64to16 <typ.UInt16> x)) |
| for { |
| if v_0.Op != ssaop.OpLsh64x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 48 || v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 48 { |
| break |
| } |
| v.Reset(ssaop.OpZeroExt16to64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpTrunc64to16, typ.UInt16) |
| v0.AddArg(x) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Rsh64Ux64 (Lsh64x64 x (Const64 [32])) (Const64 [32])) |
| // result: (ZeroExt32to64 (Trunc64to32 <typ.UInt32> x)) |
| for { |
| if v_0.Op != ssaop.OpLsh64x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 32 || v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 32 { |
| break |
| } |
| v.Reset(ssaop.OpZeroExt32to64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpTrunc64to32, typ.UInt32) |
| v0.AddArg(x) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Rsh64Ux64 [false] x con:(Const64 [c])) |
| // cond: 0 < c && c < 64 |
| // result: (Rsh64Ux64 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(con.AuxInt) |
| if !(0 < c && c < 64) { |
| break |
| } |
| v.Reset(ssaop.OpRsh64Ux64) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh64Ux8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh64Ux8 x (Const8 [c])) |
| // result: (Rsh64Ux64 x (Const64 <types.Types[types.TUINT64]> [int64(uint8(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh64Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh64Ux8 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh64Ux8 [false] x con:(Const8 [c])) |
| // cond: 0 < c && c < 64 |
| // result: (Rsh64Ux8 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(con.AuxInt) |
| if !(0 < c && c < 64) { |
| break |
| } |
| v.Reset(ssaop.OpRsh64Ux8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh64x16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh64x16 x (Const16 [c])) |
| // result: (Rsh64x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint16(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh64x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh64x16 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh64x16 [false] x con:(Const16 [c])) |
| // cond: 0 < c && c < 64 |
| // result: (Rsh64x16 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(con.AuxInt) |
| if !(0 < c && c < 64) { |
| break |
| } |
| v.Reset(ssaop.OpRsh64x16) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh64x32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh64x32 x (Const32 [c])) |
| // result: (Rsh64x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint32(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh64x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh64x32 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh64x32 [false] x con:(Const32 [c])) |
| // cond: 0 < c && c < 64 |
| // result: (Rsh64x32 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(con.AuxInt) |
| if !(0 < c && c < 64) { |
| break |
| } |
| v.Reset(ssaop.OpRsh64x32) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh64x64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Rsh64x64 (Const64 [c]) (Const64 [d])) |
| // result: (Const64 [c >> uint64(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(c >> uint64(d)) |
| return true |
| } |
| // match: (Rsh64x64 x (Const64 [0])) |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Rsh64x64 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh64x64 <t> (Rsh64x64 x (Const64 [c])) (Const64 [d])) |
| // cond: !uaddOvf(c,d) |
| // result: (Rsh64x64 x (Const64 <t> [c+d])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpRsh64x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(!uaddOvf(c, d)) { |
| break |
| } |
| v.Reset(ssaop.OpRsh64x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh64x64 (Lsh64x64 x (Const64 [56])) (Const64 [56])) |
| // result: (SignExt8to64 (Trunc64to8 <typ.Int8> x)) |
| for { |
| if v_0.Op != ssaop.OpLsh64x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 56 || v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 56 { |
| break |
| } |
| v.Reset(ssaop.OpSignExt8to64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpTrunc64to8, typ.Int8) |
| v0.AddArg(x) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Rsh64x64 (Lsh64x64 x (Const64 [48])) (Const64 [48])) |
| // result: (SignExt16to64 (Trunc64to16 <typ.Int16> x)) |
| for { |
| if v_0.Op != ssaop.OpLsh64x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 48 || v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 48 { |
| break |
| } |
| v.Reset(ssaop.OpSignExt16to64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpTrunc64to16, typ.Int16) |
| v0.AddArg(x) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Rsh64x64 (Lsh64x64 x (Const64 [32])) (Const64 [32])) |
| // result: (SignExt32to64 (Trunc64to32 <typ.Int32> x)) |
| for { |
| if v_0.Op != ssaop.OpLsh64x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0_1.AuxInt) != 32 || v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 32 { |
| break |
| } |
| v.Reset(ssaop.OpSignExt32to64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpTrunc64to32, typ.Int32) |
| v0.AddArg(x) |
| v.AddArg(v0) |
| return true |
| } |
| // match: (Rsh64x64 [false] x con:(Const64 [c])) |
| // cond: 0 < c && c < 64 |
| // result: (Rsh64x64 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(con.AuxInt) |
| if !(0 < c && c < 64) { |
| break |
| } |
| v.Reset(ssaop.OpRsh64x64) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh64x8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh64x8 x (Const8 [c])) |
| // result: (Rsh64x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint8(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh64x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh64x8 (Const64 [0]) _) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh64x8 [false] x con:(Const8 [c])) |
| // cond: 0 < c && c < 64 |
| // result: (Rsh64x8 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(con.AuxInt) |
| if !(0 < c && c < 64) { |
| break |
| } |
| v.Reset(ssaop.OpRsh64x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh8Ux16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh8Ux16 x (Const16 [c])) |
| // result: (Rsh8Ux64 x (Const64 <types.Types[types.TUINT64]> [int64(uint16(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh8Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh8Ux16 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh8Ux16 [false] x con:(Const16 [c])) |
| // cond: 0 < c && c < 8 |
| // result: (Rsh8Ux16 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(con.AuxInt) |
| if !(0 < c && c < 8) { |
| break |
| } |
| v.Reset(ssaop.OpRsh8Ux16) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh8Ux32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh8Ux32 x (Const32 [c])) |
| // result: (Rsh8Ux64 x (Const64 <types.Types[types.TUINT64]> [int64(uint32(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh8Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh8Ux32 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh8Ux32 [false] x con:(Const32 [c])) |
| // cond: 0 < c && c < 8 |
| // result: (Rsh8Ux32 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(con.AuxInt) |
| if !(0 < c && c < 8) { |
| break |
| } |
| v.Reset(ssaop.OpRsh8Ux32) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh8Ux64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (Rsh8Ux64 (Const8 [c]) (Const64 [d])) |
| // result: (Const8 [int8(uint8(c) >> uint64(d))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(int8(uint8(c) >> uint64(d))) |
| return true |
| } |
| // match: (Rsh8Ux64 x (Const64 [0])) |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Rsh8Ux64 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh8Ux64 _ (Const64 [c])) |
| // cond: uint64(c) >= 8 |
| // result: (Const8 [0]) |
| for { |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c) >= 8) { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh8Ux64 <t> (Rsh8Ux64 x (Const64 [c])) (Const64 [d])) |
| // cond: !uaddOvf(c,d) |
| // result: (Rsh8Ux64 x (Const64 <t> [c+d])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpRsh8Ux64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(!uaddOvf(c, d)) { |
| break |
| } |
| v.Reset(ssaop.OpRsh8Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh8Ux64 (Rsh8x64 x _) (Const64 <t> [7] )) |
| // result: (Rsh8Ux64 x (Const64 <t> [7] )) |
| for { |
| if v_0.Op != ssaop.OpRsh8x64 { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| if ssa.AuxIntToInt64(v_1.AuxInt) != 7 { |
| break |
| } |
| v.Reset(ssaop.OpRsh8Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(7) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh8Ux64 i:(Lsh8x64 x (Const64 [c])) (Const64 [c])) |
| // cond: c >= 0 && c < 8 && i.Uses == 1 |
| // result: (And8 x (Const8 <v.Type> [int8 (^uint8 (0)>>c)])) |
| for { |
| i := v_0 |
| if i.Op != ssaop.OpLsh8x64 { |
| break |
| } |
| _ = i.Args[1] |
| x := i.Args[0] |
| i_1 := i.Args[1] |
| if i_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(i_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != c || !(c >= 0 && c < 8 && i.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAnd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, v.Type) |
| v0.AuxInt = ssa.Int8ToAuxInt(int8(^uint8(0) >> c)) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh8Ux64 (Lsh8x64 (Rsh8Ux64 x (Const64 [c1])) (Const64 [c2])) (Const64 [c3])) |
| // cond: uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3) |
| // result: (Rsh8Ux64 x (Const64 <typ.UInt64> [c1-c2+c3])) |
| for { |
| if v_0.Op != ssaop.OpLsh8x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpRsh8Ux64 { |
| break |
| } |
| _ = v_0_0.Args[1] |
| x := v_0_0.Args[0] |
| v_0_0_1 := v_0_0.Args[1] |
| if v_0_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c1 := ssa.AuxIntToInt64(v_0_0_1.AuxInt) |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c2 := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c3 := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(uint64(c1) >= uint64(c2) && uint64(c3) >= uint64(c2) && !uaddOvf(c1-c2, c3)) { |
| break |
| } |
| v.Reset(ssaop.OpRsh8Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.UInt64) |
| v0.AuxInt = ssa.Int64ToAuxInt(c1 - c2 + c3) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh8Ux64 [false] x con:(Const64 [c])) |
| // cond: 0 < c && c < 8 |
| // result: (Rsh8Ux64 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(con.AuxInt) |
| if !(0 < c && c < 8) { |
| break |
| } |
| v.Reset(ssaop.OpRsh8Ux64) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh8Ux8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh8Ux8 x (Const8 [c])) |
| // result: (Rsh8Ux64 x (Const64 <types.Types[types.TUINT64]> [int64(uint8(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh8Ux64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh8Ux8 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh8Ux8 [false] x con:(Const8 [c])) |
| // cond: 0 < c && c < 8 |
| // result: (Rsh8Ux8 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(con.AuxInt) |
| if !(0 < c && c < 8) { |
| break |
| } |
| v.Reset(ssaop.OpRsh8Ux8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh8x16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh8x16 x (Const16 [c])) |
| // result: (Rsh8x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint16(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh8x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh8x16 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh8x16 [false] x con:(Const16 [c])) |
| // cond: 0 < c && c < 8 |
| // result: (Rsh8x16 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(con.AuxInt) |
| if !(0 < c && c < 8) { |
| break |
| } |
| v.Reset(ssaop.OpRsh8x16) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh8x32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh8x32 x (Const32 [c])) |
| // result: (Rsh8x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint32(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh8x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh8x32 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh8x32 [false] x con:(Const32 [c])) |
| // cond: 0 < c && c < 8 |
| // result: (Rsh8x32 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(con.AuxInt) |
| if !(0 < c && c < 8) { |
| break |
| } |
| v.Reset(ssaop.OpRsh8x32) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh8x64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh8x64 (Const8 [c]) (Const64 [d])) |
| // result: (Const8 [c >> uint64(d)]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(c >> uint64(d)) |
| return true |
| } |
| // match: (Rsh8x64 x (Const64 [0])) |
| // result: x |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Rsh8x64 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh8x64 <t> (Rsh8x64 x (Const64 [c])) (Const64 [d])) |
| // cond: !uaddOvf(c,d) |
| // result: (Rsh8x64 x (Const64 <t> [c+d])) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpRsh8x64 { |
| break |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(!uaddOvf(c, d)) { |
| break |
| } |
| v.Reset(ssaop.OpRsh8x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c + d) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh8x64 [false] x con:(Const64 [c])) |
| // cond: 0 < c && c < 8 |
| // result: (Rsh8x64 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(con.AuxInt) |
| if !(0 < c && c < 8) { |
| break |
| } |
| v.Reset(ssaop.OpRsh8x64) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpRsh8x8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Rsh8x8 x (Const8 [c])) |
| // result: (Rsh8x64 x (Const64 <types.Types[types.TUINT64]> [int64(uint8(c))])) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpRsh8x64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, types.Types[types.TUINT64]) |
| v0.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| v.AddArg2(x, v0) |
| return true |
| } |
| // match: (Rsh8x8 (Const8 [0]) _) |
| // result: (Const8 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Rsh8x8 [false] x con:(Const8 [c])) |
| // cond: 0 < c && c < 8 |
| // result: (Rsh8x8 [true] x con) |
| for { |
| if ssa.AuxIntToBool(v.AuxInt) != false { |
| break |
| } |
| x := v_0 |
| con := v_1 |
| if con.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(con.AuxInt) |
| if !(0 < c && c < 8) { |
| break |
| } |
| v.Reset(ssaop.OpRsh8x8) |
| v.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(x, con) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSelect0(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Select0 a:(Add64carry x y (Const64 [0]))) |
| // cond: a.Uses == 1 |
| // result: (Add64 x y) |
| for { |
| a := v_0 |
| if a.Op != ssaop.OpAdd64carry { |
| break |
| } |
| _ = a.Args[2] |
| x := a.Args[0] |
| y := a.Args[1] |
| a_2 := a.Args[2] |
| if a_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(a_2.AuxInt) != 0 || !(a.Uses == 1) { |
| break |
| } |
| v.Reset(ssaop.OpAdd64) |
| v.AddArg2(x, y) |
| return true |
| } |
| // match: (Select0 (MakeTuple x y)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpMakeTuple { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSelect1(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Select1 (MakeTuple x y)) |
| // result: y |
| for { |
| if v_0.Op != ssaop.OpMakeTuple { |
| break |
| } |
| y := v_0.Args[1] |
| v.CopyOf(y) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSelectN(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| typ := &b.Func.Config.Types |
| // match: (SelectN [n] m:(MakeResult ___)) |
| // result: m.Args[n] |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| m := v_0 |
| if m.Op != ssaop.OpMakeResult { |
| break |
| } |
| v.CopyOf(m.Args[n]) |
| return true |
| } |
| // match: (SelectN [0] call:(StaticCall {sym} sptr (Const64 [c]) mem)) |
| // cond: isInlinableMemclr(config, int64(c)) && ssa.IsSameCall(sym, "runtime.memclrNoHeapPointers") && call.Uses == 1 && ssa.Clobber(call) |
| // result: (Zero {types.Types[types.TUINT8]} [int64(c)] sptr mem) |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 { |
| break |
| } |
| call := v_0 |
| if call.Op != ssaop.OpStaticCall || len(call.Args) != 3 { |
| break |
| } |
| sym := ssa.AuxToCall(call.Aux) |
| mem := call.Args[2] |
| sptr := call.Args[0] |
| call_1 := call.Args[1] |
| if call_1.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(call_1.AuxInt) |
| if !(isInlinableMemclr(config, int64(c)) && ssa.IsSameCall(sym, "runtime.memclrNoHeapPointers") && call.Uses == 1 && ssa.Clobber(call)) { |
| break |
| } |
| v.Reset(ssaop.OpZero) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(c)) |
| v.Aux = ssa.TypeToAux(types.Types[types.TUINT8]) |
| v.AddArg2(sptr, mem) |
| return true |
| } |
| // match: (SelectN [0] call:(StaticCall {sym} sptr (Const32 [c]) mem)) |
| // cond: isInlinableMemclr(config, int64(c)) && ssa.IsSameCall(sym, "runtime.memclrNoHeapPointers") && call.Uses == 1 && ssa.Clobber(call) |
| // result: (Zero {types.Types[types.TUINT8]} [int64(c)] sptr mem) |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 { |
| break |
| } |
| call := v_0 |
| if call.Op != ssaop.OpStaticCall || len(call.Args) != 3 { |
| break |
| } |
| sym := ssa.AuxToCall(call.Aux) |
| mem := call.Args[2] |
| sptr := call.Args[0] |
| call_1 := call.Args[1] |
| if call_1.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(call_1.AuxInt) |
| if !(isInlinableMemclr(config, int64(c)) && ssa.IsSameCall(sym, "runtime.memclrNoHeapPointers") && call.Uses == 1 && ssa.Clobber(call)) { |
| break |
| } |
| v.Reset(ssaop.OpZero) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(c)) |
| v.Aux = ssa.TypeToAux(types.Types[types.TUINT8]) |
| v.AddArg2(sptr, mem) |
| return true |
| } |
| // match: (SelectN [0] call:(StaticCall {sym} s1:(Store _ (Const64 [sz]) s2:(Store _ src s3:(Store {t} _ dst mem))))) |
| // cond: sz >= 0 && ssa.IsSameCall(sym, "runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && ssa.IsInlinableMemmove(dst, src, int64(sz), config) && ssa.Clobber(s1, s2, s3, call) |
| // result: (Move {types.Types[types.TUINT8]} [int64(sz)] dst src mem) |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 { |
| break |
| } |
| call := v_0 |
| if call.Op != ssaop.OpStaticCall || len(call.Args) != 1 { |
| break |
| } |
| sym := ssa.AuxToCall(call.Aux) |
| s1 := call.Args[0] |
| if s1.Op != ssaop.OpStore { |
| break |
| } |
| _ = s1.Args[2] |
| s1_1 := s1.Args[1] |
| if s1_1.Op != ssaop.OpConst64 { |
| break |
| } |
| sz := ssa.AuxIntToInt64(s1_1.AuxInt) |
| s2 := s1.Args[2] |
| if s2.Op != ssaop.OpStore { |
| break |
| } |
| _ = s2.Args[2] |
| src := s2.Args[1] |
| s3 := s2.Args[2] |
| if s3.Op != ssaop.OpStore { |
| break |
| } |
| mem := s3.Args[2] |
| dst := s3.Args[1] |
| if !(sz >= 0 && ssa.IsSameCall(sym, "runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && ssa.IsInlinableMemmove(dst, src, int64(sz), config) && ssa.Clobber(s1, s2, s3, call)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(sz)) |
| v.Aux = ssa.TypeToAux(types.Types[types.TUINT8]) |
| v.AddArg3(dst, src, mem) |
| return true |
| } |
| // match: (SelectN [0] call:(StaticCall {sym} s1:(Store _ (Const32 [sz]) s2:(Store _ src s3:(Store {t} _ dst mem))))) |
| // cond: sz >= 0 && ssa.IsSameCall(sym, "runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && ssa.IsInlinableMemmove(dst, src, int64(sz), config) && ssa.Clobber(s1, s2, s3, call) |
| // result: (Move {types.Types[types.TUINT8]} [int64(sz)] dst src mem) |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 { |
| break |
| } |
| call := v_0 |
| if call.Op != ssaop.OpStaticCall || len(call.Args) != 1 { |
| break |
| } |
| sym := ssa.AuxToCall(call.Aux) |
| s1 := call.Args[0] |
| if s1.Op != ssaop.OpStore { |
| break |
| } |
| _ = s1.Args[2] |
| s1_1 := s1.Args[1] |
| if s1_1.Op != ssaop.OpConst32 { |
| break |
| } |
| sz := ssa.AuxIntToInt32(s1_1.AuxInt) |
| s2 := s1.Args[2] |
| if s2.Op != ssaop.OpStore { |
| break |
| } |
| _ = s2.Args[2] |
| src := s2.Args[1] |
| s3 := s2.Args[2] |
| if s3.Op != ssaop.OpStore { |
| break |
| } |
| mem := s3.Args[2] |
| dst := s3.Args[1] |
| if !(sz >= 0 && ssa.IsSameCall(sym, "runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && ssa.IsInlinableMemmove(dst, src, int64(sz), config) && ssa.Clobber(s1, s2, s3, call)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(sz)) |
| v.Aux = ssa.TypeToAux(types.Types[types.TUINT8]) |
| v.AddArg3(dst, src, mem) |
| return true |
| } |
| // match: (SelectN [0] call:(StaticCall {sym} dst src (Const64 [sz]) mem)) |
| // cond: sz >= 0 && call.Uses == 1 && ssa.IsSameCall(sym, "runtime.memmove") && ssa.IsInlinableMemmove(dst, src, int64(sz), config) && ssa.Clobber(call) |
| // result: (Move {types.Types[types.TUINT8]} [int64(sz)] dst src mem) |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 { |
| break |
| } |
| call := v_0 |
| if call.Op != ssaop.OpStaticCall || len(call.Args) != 4 { |
| break |
| } |
| sym := ssa.AuxToCall(call.Aux) |
| mem := call.Args[3] |
| dst := call.Args[0] |
| src := call.Args[1] |
| call_2 := call.Args[2] |
| if call_2.Op != ssaop.OpConst64 { |
| break |
| } |
| sz := ssa.AuxIntToInt64(call_2.AuxInt) |
| if !(sz >= 0 && call.Uses == 1 && ssa.IsSameCall(sym, "runtime.memmove") && ssa.IsInlinableMemmove(dst, src, int64(sz), config) && ssa.Clobber(call)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(sz)) |
| v.Aux = ssa.TypeToAux(types.Types[types.TUINT8]) |
| v.AddArg3(dst, src, mem) |
| return true |
| } |
| // match: (SelectN [0] call:(StaticCall {sym} dst src (Const32 [sz]) mem)) |
| // cond: sz >= 0 && call.Uses == 1 && ssa.IsSameCall(sym, "runtime.memmove") && ssa.IsInlinableMemmove(dst, src, int64(sz), config) && ssa.Clobber(call) |
| // result: (Move {types.Types[types.TUINT8]} [int64(sz)] dst src mem) |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 { |
| break |
| } |
| call := v_0 |
| if call.Op != ssaop.OpStaticCall || len(call.Args) != 4 { |
| break |
| } |
| sym := ssa.AuxToCall(call.Aux) |
| mem := call.Args[3] |
| dst := call.Args[0] |
| src := call.Args[1] |
| call_2 := call.Args[2] |
| if call_2.Op != ssaop.OpConst32 { |
| break |
| } |
| sz := ssa.AuxIntToInt32(call_2.AuxInt) |
| if !(sz >= 0 && call.Uses == 1 && ssa.IsSameCall(sym, "runtime.memmove") && ssa.IsInlinableMemmove(dst, src, int64(sz), config) && ssa.Clobber(call)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(sz)) |
| v.Aux = ssa.TypeToAux(types.Types[types.TUINT8]) |
| v.AddArg3(dst, src, mem) |
| return true |
| } |
| // match: (SelectN [0] call:(StaticLECall {sym} dst src (Const64 [sz]) mem)) |
| // cond: sz >= 0 && call.Uses == 1 && ssa.IsSameCall(sym, "runtime.memmove") && ssa.IsInlinableMemmove(dst, src, int64(sz), config) && ssa.Clobber(call) |
| // result: (Move {types.Types[types.TUINT8]} [int64(sz)] dst src mem) |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 { |
| break |
| } |
| call := v_0 |
| if call.Op != ssaop.OpStaticLECall || len(call.Args) != 4 { |
| break |
| } |
| sym := ssa.AuxToCall(call.Aux) |
| mem := call.Args[3] |
| dst := call.Args[0] |
| src := call.Args[1] |
| call_2 := call.Args[2] |
| if call_2.Op != ssaop.OpConst64 { |
| break |
| } |
| sz := ssa.AuxIntToInt64(call_2.AuxInt) |
| if !(sz >= 0 && call.Uses == 1 && ssa.IsSameCall(sym, "runtime.memmove") && ssa.IsInlinableMemmove(dst, src, int64(sz), config) && ssa.Clobber(call)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(sz)) |
| v.Aux = ssa.TypeToAux(types.Types[types.TUINT8]) |
| v.AddArg3(dst, src, mem) |
| return true |
| } |
| // match: (SelectN [0] call:(StaticLECall {sym} dst src (Const32 [sz]) mem)) |
| // cond: sz >= 0 && call.Uses == 1 && ssa.IsSameCall(sym, "runtime.memmove") && ssa.IsInlinableMemmove(dst, src, int64(sz), config) && ssa.Clobber(call) |
| // result: (Move {types.Types[types.TUINT8]} [int64(sz)] dst src mem) |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 { |
| break |
| } |
| call := v_0 |
| if call.Op != ssaop.OpStaticLECall || len(call.Args) != 4 { |
| break |
| } |
| sym := ssa.AuxToCall(call.Aux) |
| mem := call.Args[3] |
| dst := call.Args[0] |
| src := call.Args[1] |
| call_2 := call.Args[2] |
| if call_2.Op != ssaop.OpConst32 { |
| break |
| } |
| sz := ssa.AuxIntToInt32(call_2.AuxInt) |
| if !(sz >= 0 && call.Uses == 1 && ssa.IsSameCall(sym, "runtime.memmove") && ssa.IsInlinableMemmove(dst, src, int64(sz), config) && ssa.Clobber(call)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(sz)) |
| v.Aux = ssa.TypeToAux(types.Types[types.TUINT8]) |
| v.AddArg3(dst, src, mem) |
| return true |
| } |
| // match: (SelectN [0] call:(StaticLECall {sym} a x)) |
| // cond: needRaceCleanup(sym, call) && ssa.Clobber(call) |
| // result: x |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 { |
| break |
| } |
| call := v_0 |
| if call.Op != ssaop.OpStaticLECall || len(call.Args) != 2 { |
| break |
| } |
| sym := ssa.AuxToCall(call.Aux) |
| x := call.Args[1] |
| if !(needRaceCleanup(sym, call) && ssa.Clobber(call)) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (SelectN [0] call:(StaticLECall {sym} x)) |
| // cond: needRaceCleanup(sym, call) && ssa.Clobber(call) |
| // result: x |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 { |
| break |
| } |
| call := v_0 |
| if call.Op != ssaop.OpStaticLECall || len(call.Args) != 1 { |
| break |
| } |
| sym := ssa.AuxToCall(call.Aux) |
| x := call.Args[0] |
| if !(needRaceCleanup(sym, call) && ssa.Clobber(call)) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (SelectN [1] (StaticCall {sym} _ newLen:(Const64) _ _ _ _)) |
| // cond: v.Type.IsInteger() && (ssa.IsSameCall(sym, "runtime.growslice") || ssa.IsSameCall(sym, "runtime.growsliceNoAlias")) |
| // result: newLen |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 1 || v_0.Op != ssaop.OpStaticCall || len(v_0.Args) != 6 { |
| break |
| } |
| sym := ssa.AuxToCall(v_0.Aux) |
| _ = v_0.Args[1] |
| newLen := v_0.Args[1] |
| if newLen.Op != ssaop.OpConst64 || !(v.Type.IsInteger() && (ssa.IsSameCall(sym, "runtime.growslice") || ssa.IsSameCall(sym, "runtime.growsliceNoAlias"))) { |
| break |
| } |
| v.CopyOf(newLen) |
| return true |
| } |
| // match: (SelectN [1] (StaticCall {sym} _ newLen:(Const32) _ _ _ _)) |
| // cond: v.Type.IsInteger() && (ssa.IsSameCall(sym, "runtime.growslice") || ssa.IsSameCall(sym, "runtime.growsliceNoAlias")) |
| // result: newLen |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 1 || v_0.Op != ssaop.OpStaticCall || len(v_0.Args) != 6 { |
| break |
| } |
| sym := ssa.AuxToCall(v_0.Aux) |
| _ = v_0.Args[1] |
| newLen := v_0.Args[1] |
| if newLen.Op != ssaop.OpConst32 || !(v.Type.IsInteger() && (ssa.IsSameCall(sym, "runtime.growslice") || ssa.IsSameCall(sym, "runtime.growsliceNoAlias"))) { |
| break |
| } |
| v.CopyOf(newLen) |
| return true |
| } |
| // match: (SelectN [0] (StaticLECall {f} x y (SelectN [1] c:(StaticLECall {g} x y mem)))) |
| // cond: ssa.IsSameCall(f, "runtime.cmpstring") && ssa.IsSameCall(g, "runtime.cmpstring") |
| // result: @c.Block (SelectN [0] <typ.Int> c) |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 0 || v_0.Op != ssaop.OpStaticLECall || len(v_0.Args) != 3 { |
| break |
| } |
| f := ssa.AuxToCall(v_0.Aux) |
| _ = v_0.Args[2] |
| x := v_0.Args[0] |
| y := v_0.Args[1] |
| v_0_2 := v_0.Args[2] |
| if v_0_2.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(v_0_2.AuxInt) != 1 { |
| break |
| } |
| c := v_0_2.Args[0] |
| if c.Op != ssaop.OpStaticLECall || len(c.Args) != 3 { |
| break |
| } |
| g := ssa.AuxToCall(c.Aux) |
| if x != c.Args[0] || y != c.Args[1] || !(ssa.IsSameCall(f, "runtime.cmpstring") && ssa.IsSameCall(g, "runtime.cmpstring")) { |
| break |
| } |
| b = c.Block |
| v0 := b.NewValue0(v.Pos, ssaop.OpSelectN, typ.Int) |
| v.CopyOf(v0) |
| v0.AuxInt = ssa.Int64ToAuxInt(0) |
| v0.AddArg(c) |
| return true |
| } |
| // match: (SelectN [1] c:(StaticLECall {f} _ _ mem)) |
| // cond: c.Uses == 1 && ssa.IsSameCall(f, "runtime.cmpstring") && ssa.Clobber(c) |
| // result: mem |
| for { |
| if ssa.AuxIntToInt64(v.AuxInt) != 1 { |
| break |
| } |
| c := v_0 |
| if c.Op != ssaop.OpStaticLECall || len(c.Args) != 3 { |
| break |
| } |
| f := ssa.AuxToCall(c.Aux) |
| mem := c.Args[2] |
| if !(c.Uses == 1 && ssa.IsSameCall(f, "runtime.cmpstring") && ssa.Clobber(c)) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSignExt16to32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (SignExt16to32 (Const16 [c])) |
| // result: (Const32 [int32(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(c)) |
| return true |
| } |
| // match: (SignExt16to32 (Trunc32to16 x:(Rsh32x64 _ (Const64 [s])))) |
| // cond: s >= 16 |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpTrunc32to16 { |
| break |
| } |
| x := v_0.Args[0] |
| if x.Op != ssaop.OpRsh32x64 { |
| break |
| } |
| _ = x.Args[1] |
| x_1 := x.Args[1] |
| if x_1.Op != ssaop.OpConst64 { |
| break |
| } |
| s := ssa.AuxIntToInt64(x_1.AuxInt) |
| if !(s >= 16) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSignExt16to64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (SignExt16to64 (Const16 [c])) |
| // result: (Const64 [int64(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(c)) |
| return true |
| } |
| // match: (SignExt16to64 (Trunc64to16 x:(Rsh64x64 _ (Const64 [s])))) |
| // cond: s >= 48 |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpTrunc64to16 { |
| break |
| } |
| x := v_0.Args[0] |
| if x.Op != ssaop.OpRsh64x64 { |
| break |
| } |
| _ = x.Args[1] |
| x_1 := x.Args[1] |
| if x_1.Op != ssaop.OpConst64 { |
| break |
| } |
| s := ssa.AuxIntToInt64(x_1.AuxInt) |
| if !(s >= 48) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSignExt32to64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (SignExt32to64 (Const32 [c])) |
| // result: (Const64 [int64(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(c)) |
| return true |
| } |
| // match: (SignExt32to64 (Trunc64to32 x:(Rsh64x64 _ (Const64 [s])))) |
| // cond: s >= 32 |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpTrunc64to32 { |
| break |
| } |
| x := v_0.Args[0] |
| if x.Op != ssaop.OpRsh64x64 { |
| break |
| } |
| _ = x.Args[1] |
| x_1 := x.Args[1] |
| if x_1.Op != ssaop.OpConst64 { |
| break |
| } |
| s := ssa.AuxIntToInt64(x_1.AuxInt) |
| if !(s >= 32) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSignExt8to16(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (SignExt8to16 (Const8 [c])) |
| // result: (Const16 [int16(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(int16(c)) |
| return true |
| } |
| // match: (SignExt8to16 (Trunc16to8 x:(Rsh16x64 _ (Const64 [s])))) |
| // cond: s >= 8 |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpTrunc16to8 { |
| break |
| } |
| x := v_0.Args[0] |
| if x.Op != ssaop.OpRsh16x64 { |
| break |
| } |
| _ = x.Args[1] |
| x_1 := x.Args[1] |
| if x_1.Op != ssaop.OpConst64 { |
| break |
| } |
| s := ssa.AuxIntToInt64(x_1.AuxInt) |
| if !(s >= 8) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (SignExt8to16 cvt:(CvtBoolToUint8 bool)) |
| // result: (ZeroExt8to16 cvt) |
| for { |
| cvt := v_0 |
| if cvt.Op != ssaop.OpCvtBoolToUint8 { |
| break |
| } |
| v.Reset(ssaop.OpZeroExt8to16) |
| v.AddArg(cvt) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSignExt8to32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (SignExt8to32 (Const8 [c])) |
| // result: (Const32 [int32(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(c)) |
| return true |
| } |
| // match: (SignExt8to32 (Trunc32to8 x:(Rsh32x64 _ (Const64 [s])))) |
| // cond: s >= 24 |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpTrunc32to8 { |
| break |
| } |
| x := v_0.Args[0] |
| if x.Op != ssaop.OpRsh32x64 { |
| break |
| } |
| _ = x.Args[1] |
| x_1 := x.Args[1] |
| if x_1.Op != ssaop.OpConst64 { |
| break |
| } |
| s := ssa.AuxIntToInt64(x_1.AuxInt) |
| if !(s >= 24) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (SignExt8to32 cvt:(CvtBoolToUint8 bool)) |
| // result: (ZeroExt8to32 cvt) |
| for { |
| cvt := v_0 |
| if cvt.Op != ssaop.OpCvtBoolToUint8 { |
| break |
| } |
| v.Reset(ssaop.OpZeroExt8to32) |
| v.AddArg(cvt) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSignExt8to64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (SignExt8to64 (Const8 [c])) |
| // result: (Const64 [int64(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(c)) |
| return true |
| } |
| // match: (SignExt8to64 (Trunc64to8 x:(Rsh64x64 _ (Const64 [s])))) |
| // cond: s >= 56 |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpTrunc64to8 { |
| break |
| } |
| x := v_0.Args[0] |
| if x.Op != ssaop.OpRsh64x64 { |
| break |
| } |
| _ = x.Args[1] |
| x_1 := x.Args[1] |
| if x_1.Op != ssaop.OpConst64 { |
| break |
| } |
| s := ssa.AuxIntToInt64(x_1.AuxInt) |
| if !(s >= 56) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (SignExt8to64 cvt:(CvtBoolToUint8 bool)) |
| // result: (ZeroExt8to64 cvt) |
| for { |
| cvt := v_0 |
| if cvt.Op != ssaop.OpCvtBoolToUint8 { |
| break |
| } |
| v.Reset(ssaop.OpZeroExt8to64) |
| v.AddArg(cvt) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSliceCap(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (SliceCap (SliceMake _ _ (Const64 <t> [c]))) |
| // result: (Const64 <t> [c]) |
| for { |
| if v_0.Op != ssaop.OpSliceMake { |
| break |
| } |
| _ = v_0.Args[2] |
| v_0_2 := v_0.Args[2] |
| if v_0_2.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0_2.Type |
| c := ssa.AuxIntToInt64(v_0_2.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.Type = t |
| v.AuxInt = ssa.Int64ToAuxInt(c) |
| return true |
| } |
| // match: (SliceCap (SliceMake _ _ (Const32 <t> [c]))) |
| // result: (Const32 <t> [c]) |
| for { |
| if v_0.Op != ssaop.OpSliceMake { |
| break |
| } |
| _ = v_0.Args[2] |
| v_0_2 := v_0.Args[2] |
| if v_0_2.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_0_2.Type |
| c := ssa.AuxIntToInt32(v_0_2.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.Type = t |
| v.AuxInt = ssa.Int32ToAuxInt(c) |
| return true |
| } |
| // match: (SliceCap (SliceMake _ _ (SliceCap x))) |
| // result: (SliceCap x) |
| for { |
| if v_0.Op != ssaop.OpSliceMake { |
| break |
| } |
| _ = v_0.Args[2] |
| v_0_2 := v_0.Args[2] |
| if v_0_2.Op != ssaop.OpSliceCap { |
| break |
| } |
| x := v_0_2.Args[0] |
| v.Reset(ssaop.OpSliceCap) |
| v.AddArg(x) |
| return true |
| } |
| // match: (SliceCap (SliceMake _ _ (SliceLen x))) |
| // result: (SliceLen x) |
| for { |
| if v_0.Op != ssaop.OpSliceMake { |
| break |
| } |
| _ = v_0.Args[2] |
| v_0_2 := v_0.Args[2] |
| if v_0_2.Op != ssaop.OpSliceLen { |
| break |
| } |
| x := v_0_2.Args[0] |
| v.Reset(ssaop.OpSliceLen) |
| v.AddArg(x) |
| return true |
| } |
| // match: (SliceCap (Phi (SliceMake _ _ x) (SliceMake _ _ x))) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpPhi || len(v_0.Args) != 2 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSliceMake { |
| break |
| } |
| x := v_0_0.Args[2] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpSliceMake { |
| break |
| } |
| _ = v_0_1.Args[2] |
| if x != v_0_1.Args[2] { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSliceLen(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (SliceLen (SliceMake _ (Const64 <t> [c]) _)) |
| // result: (Const64 <t> [c]) |
| for { |
| if v_0.Op != ssaop.OpSliceMake { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.Type = t |
| v.AuxInt = ssa.Int64ToAuxInt(c) |
| return true |
| } |
| // match: (SliceLen (SliceMake _ (Const32 <t> [c]) _)) |
| // result: (Const32 <t> [c]) |
| for { |
| if v_0.Op != ssaop.OpSliceMake { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_0_1.Type |
| c := ssa.AuxIntToInt32(v_0_1.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.Type = t |
| v.AuxInt = ssa.Int32ToAuxInt(c) |
| return true |
| } |
| // match: (SliceLen (SliceMake _ (SliceLen x) _)) |
| // result: (SliceLen x) |
| for { |
| if v_0.Op != ssaop.OpSliceMake { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpSliceLen { |
| break |
| } |
| x := v_0_1.Args[0] |
| v.Reset(ssaop.OpSliceLen) |
| v.AddArg(x) |
| return true |
| } |
| // match: (SliceLen (Phi (SliceMake _ x _) (SliceMake _ x _))) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpPhi || len(v_0.Args) != 2 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSliceMake { |
| break |
| } |
| x := v_0_0.Args[1] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpSliceMake { |
| break |
| } |
| _ = v_0_1.Args[1] |
| if x != v_0_1.Args[1] { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| // match: (SliceLen (SelectN [0] (StaticLECall {sym} _ newLen:(Const64) _ _ _ _))) |
| // cond: (ssa.IsSameCall(sym, "runtime.growslice") || ssa.IsSameCall(sym, "runtime.growsliceNoAlias")) |
| // result: newLen |
| for { |
| if v_0.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpStaticLECall || len(v_0_0.Args) != 6 { |
| break |
| } |
| sym := ssa.AuxToCall(v_0_0.Aux) |
| _ = v_0_0.Args[1] |
| newLen := v_0_0.Args[1] |
| if newLen.Op != ssaop.OpConst64 || !(ssa.IsSameCall(sym, "runtime.growslice") || ssa.IsSameCall(sym, "runtime.growsliceNoAlias")) { |
| break |
| } |
| v.CopyOf(newLen) |
| return true |
| } |
| // match: (SliceLen (SelectN [0] (StaticLECall {sym} _ newLen:(Const32) _ _ _ _))) |
| // cond: (ssa.IsSameCall(sym, "runtime.growslice") || ssa.IsSameCall(sym, "runtime.growsliceNoAlias")) |
| // result: newLen |
| for { |
| if v_0.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpStaticLECall || len(v_0_0.Args) != 6 { |
| break |
| } |
| sym := ssa.AuxToCall(v_0_0.Aux) |
| _ = v_0_0.Args[1] |
| newLen := v_0_0.Args[1] |
| if newLen.Op != ssaop.OpConst32 || !(ssa.IsSameCall(sym, "runtime.growslice") || ssa.IsSameCall(sym, "runtime.growsliceNoAlias")) { |
| break |
| } |
| v.CopyOf(newLen) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSliceMake(v *ssa.Value) bool { |
| v_2 := v.Args[2] |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (SliceMake (AddPtr <t> x (And64 y (Slicemask _))) w:(Const64 [c]) z) |
| // cond: c > 0 |
| // result: (SliceMake (AddPtr <t> x y) w z) |
| for { |
| if v_0.Op != ssaop.OpAddPtr { |
| break |
| } |
| t := v_0.Type |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_0_1.Args[1] |
| v_0_1_0 := v_0_1.Args[0] |
| v_0_1_1 := v_0_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_1_0, v_0_1_1 = _i0+1, v_0_1_1, v_0_1_0 { |
| y := v_0_1_0 |
| if v_0_1_1.Op != ssaop.OpSlicemask { |
| continue |
| } |
| w := v_1 |
| if w.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(w.AuxInt) |
| z := v_2 |
| if !(c > 0) { |
| continue |
| } |
| v.Reset(ssaop.OpSliceMake) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAddPtr, t) |
| v0.AddArg2(x, y) |
| v.AddArg3(v0, w, z) |
| return true |
| } |
| break |
| } |
| // match: (SliceMake (AddPtr <t> x (And32 y (Slicemask _))) w:(Const32 [c]) z) |
| // cond: c > 0 |
| // result: (SliceMake (AddPtr <t> x y) w z) |
| for { |
| if v_0.Op != ssaop.OpAddPtr { |
| break |
| } |
| t := v_0.Type |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_0_1.Args[1] |
| v_0_1_0 := v_0_1.Args[0] |
| v_0_1_1 := v_0_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_1_0, v_0_1_1 = _i0+1, v_0_1_1, v_0_1_0 { |
| y := v_0_1_0 |
| if v_0_1_1.Op != ssaop.OpSlicemask { |
| continue |
| } |
| w := v_1 |
| if w.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(w.AuxInt) |
| z := v_2 |
| if !(c > 0) { |
| continue |
| } |
| v.Reset(ssaop.OpSliceMake) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAddPtr, t) |
| v0.AddArg2(x, y) |
| v.AddArg3(v0, w, z) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpSlicePtr(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (SlicePtr (SliceMake (SlicePtr x) _ _)) |
| // result: (SlicePtr x) |
| for { |
| if v_0.Op != ssaop.OpSliceMake { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSlicePtr { |
| break |
| } |
| x := v_0_0.Args[0] |
| v.Reset(ssaop.OpSlicePtr) |
| v.AddArg(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSlicemask(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Slicemask (Const32 [x])) |
| // cond: x > 0 |
| // result: (Const32 [-1]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| x := ssa.AuxIntToInt32(v_0.AuxInt) |
| if !(x > 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(-1) |
| return true |
| } |
| // match: (Slicemask (Const32 [0])) |
| // result: (Const32 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Slicemask (Const64 [x])) |
| // cond: x > 0 |
| // result: (Const64 [-1]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| x := ssa.AuxIntToInt64(v_0.AuxInt) |
| if !(x > 0) { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(-1) |
| return true |
| } |
| // match: (Slicemask (Const64 [0])) |
| // result: (Const64 [0]) |
| for { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSqrt(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Sqrt (Const64F [c])) |
| // cond: !math.IsNaN(math.Sqrt(c)) |
| // result: (Const64F [math.Sqrt(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| if !(!math.IsNaN(math.Sqrt(c))) { |
| break |
| } |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(math.Sqrt(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpStaticCall(v *ssa.Value) bool { |
| b := v.Block |
| typ := &b.Func.Config.Types |
| // match: (StaticCall {callAux} p q _ mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.IsSamePtr(p, q) |
| // result: (MakeResult (ConstBool <typ.Bool> [true]) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| p := v.Args[0] |
| q := v.Args[1] |
| if !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.IsSamePtr(p, q)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConstBool, typ.Bool) |
| v0.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpStaticLECall(v *ssa.Value) bool { |
| b := v.Block |
| config := b.Func.Config |
| typ := &b.Func.Config.Types |
| // match: (StaticLECall {callAux} sptr (Addr {scon} (SB)) (Const64 [1]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) |
| // result: (MakeResult (Eq8 (Load <typ.Int8> sptr mem) (Const8 <typ.Int8> [int8(ssa.Read8(scon,0))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| sptr := v.Args[0] |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_1.Aux) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpSB { |
| break |
| } |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 1 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq8, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int8) |
| v1.AddArg2(sptr, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, typ.Int8) |
| v2.AuxInt = ssa.Int8ToAuxInt(int8(ssa.Read8(scon, 0))) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} (Addr {scon} (SB)) sptr (Const64 [1]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) |
| // result: (MakeResult (Eq8 (Load <typ.Int8> sptr mem) (Const8 <typ.Int8> [int8(ssa.Read8(scon,0))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_0.Aux) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSB { |
| break |
| } |
| sptr := v.Args[1] |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 1 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq8, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int8) |
| v1.AddArg2(sptr, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst8, typ.Int8) |
| v2.AuxInt = ssa.Int8ToAuxInt(int8(ssa.Read8(scon, 0))) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} sptr (Addr {scon} (SB)) (Const64 [2]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) |
| // result: (MakeResult (Eq16 (Load <typ.Int16> sptr mem) (Const16 <typ.Int16> [int16(ssa.Read16(scon,0,config.Ctxt.Arch.ByteOrder))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| sptr := v.Args[0] |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_1.Aux) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpSB { |
| break |
| } |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 2 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq16, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int16) |
| v1.AddArg2(sptr, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, typ.Int16) |
| v2.AuxInt = ssa.Int16ToAuxInt(int16(ssa.Read16(scon, 0, config.Ctxt.Arch.ByteOrder))) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} (Addr {scon} (SB)) sptr (Const64 [2]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) |
| // result: (MakeResult (Eq16 (Load <typ.Int16> sptr mem) (Const16 <typ.Int16> [int16(ssa.Read16(scon,0,config.Ctxt.Arch.ByteOrder))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_0.Aux) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSB { |
| break |
| } |
| sptr := v.Args[1] |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 2 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq16, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int16) |
| v1.AddArg2(sptr, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, typ.Int16) |
| v2.AuxInt = ssa.Int16ToAuxInt(int16(ssa.Read16(scon, 0, config.Ctxt.Arch.ByteOrder))) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} sptr (Addr {scon} (SB)) (Const64 [4]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) |
| // result: (MakeResult (Eq32 (Load <typ.Int32> sptr mem) (Const32 <typ.Int32> [int32(ssa.Read32(scon,0,config.Ctxt.Arch.ByteOrder))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| sptr := v.Args[0] |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_1.Aux) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpSB { |
| break |
| } |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 4 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq32, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v1.AddArg2(sptr, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int32) |
| v2.AuxInt = ssa.Int32ToAuxInt(int32(ssa.Read32(scon, 0, config.Ctxt.Arch.ByteOrder))) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} (Addr {scon} (SB)) sptr (Const64 [4]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) |
| // result: (MakeResult (Eq32 (Load <typ.Int32> sptr mem) (Const32 <typ.Int32> [int32(ssa.Read32(scon,0,config.Ctxt.Arch.ByteOrder))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_0.Aux) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSB { |
| break |
| } |
| sptr := v.Args[1] |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 4 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq32, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v1.AddArg2(sptr, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int32) |
| v2.AuxInt = ssa.Int32ToAuxInt(int32(ssa.Read32(scon, 0, config.Ctxt.Arch.ByteOrder))) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} sptr (Addr {scon} (SB)) (Const64 [8]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8 |
| // result: (MakeResult (Eq64 (Load <typ.Int64> sptr mem) (Const64 <typ.Int64> [int64(ssa.Read64(scon,0,config.Ctxt.Arch.ByteOrder))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| sptr := v.Args[0] |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_1.Aux) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpSB { |
| break |
| } |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 8 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq64, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int64) |
| v1.AddArg2(sptr, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v2.AuxInt = ssa.Int64ToAuxInt(int64(ssa.Read64(scon, 0, config.Ctxt.Arch.ByteOrder))) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} (Addr {scon} (SB)) sptr (Const64 [8]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8 |
| // result: (MakeResult (Eq64 (Load <typ.Int64> sptr mem) (Const64 <typ.Int64> [int64(ssa.Read64(scon,0,config.Ctxt.Arch.ByteOrder))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_0.Aux) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSB { |
| break |
| } |
| sptr := v.Args[1] |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 8 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq64, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int64) |
| v1.AddArg2(sptr, mem) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v2.AuxInt = ssa.Int64ToAuxInt(int64(ssa.Read64(scon, 0, config.Ctxt.Arch.ByteOrder))) |
| v0.AddArg2(v1, v2) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} sptr (Addr {scon} (SB)) (Const64 [3]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) |
| // result: (MakeResult (Eq32 (Or32 <typ.Int32> (ZeroExt16to32 <typ.Int32> (Load <typ.Int16> sptr mem)) (Lsh32x32 <typ.Int32> (ZeroExt8to32 <typ.Int32> (Load <typ.Int8> (OffPtr <typ.BytePtr> [2] sptr) mem)) (Const32 <typ.Int32> [16]))) (Const32 <typ.Int32> [int32(uint32(ssa.Read16(scon,0,config.Ctxt.Arch.ByteOrder))|(uint32(ssa.Read8(scon,2))<<16))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| sptr := v.Args[0] |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_1.Aux) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpSB { |
| break |
| } |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 3 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq32, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOr32, typ.Int32) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to32, typ.Int32) |
| v3 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int16) |
| v3.AddArg2(sptr, mem) |
| v2.AddArg(v3) |
| v4 := b.NewValue0(v.Pos, ssaop.OpLsh32x32, typ.Int32) |
| v5 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, typ.Int32) |
| v6 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int8) |
| v7 := b.NewValue0(v.Pos, ssaop.OpOffPtr, typ.BytePtr) |
| v7.AuxInt = ssa.Int64ToAuxInt(2) |
| v7.AddArg(sptr) |
| v6.AddArg2(v7, mem) |
| v5.AddArg(v6) |
| v8 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int32) |
| v8.AuxInt = ssa.Int32ToAuxInt(16) |
| v4.AddArg2(v5, v8) |
| v1.AddArg2(v2, v4) |
| v9 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int32) |
| v9.AuxInt = ssa.Int32ToAuxInt(int32(uint32(ssa.Read16(scon, 0, config.Ctxt.Arch.ByteOrder)) | (uint32(ssa.Read8(scon, 2)) << 16))) |
| v0.AddArg2(v1, v9) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} (Addr {scon} (SB)) sptr (Const64 [3]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) |
| // result: (MakeResult (Eq32 (Or32 <typ.Int32> (ZeroExt16to32 <typ.Int32> (Load <typ.Int16> sptr mem)) (Lsh32x32 <typ.Int32> (ZeroExt8to32 <typ.Int32> (Load <typ.Int8> (OffPtr <typ.BytePtr> [2] sptr) mem)) (Const32 <typ.Int32> [16]))) (Const32 <typ.Int32> [int32(uint32(ssa.Read16(scon,0,config.Ctxt.Arch.ByteOrder))|(uint32(ssa.Read8(scon,2))<<16))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_0.Aux) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSB { |
| break |
| } |
| sptr := v.Args[1] |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 3 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq32, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOr32, typ.Int32) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to32, typ.Int32) |
| v3 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int16) |
| v3.AddArg2(sptr, mem) |
| v2.AddArg(v3) |
| v4 := b.NewValue0(v.Pos, ssaop.OpLsh32x32, typ.Int32) |
| v5 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, typ.Int32) |
| v6 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int8) |
| v7 := b.NewValue0(v.Pos, ssaop.OpOffPtr, typ.BytePtr) |
| v7.AuxInt = ssa.Int64ToAuxInt(2) |
| v7.AddArg(sptr) |
| v6.AddArg2(v7, mem) |
| v5.AddArg(v6) |
| v8 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int32) |
| v8.AuxInt = ssa.Int32ToAuxInt(16) |
| v4.AddArg2(v5, v8) |
| v1.AddArg2(v2, v4) |
| v9 := b.NewValue0(v.Pos, ssaop.OpConst32, typ.Int32) |
| v9.AuxInt = ssa.Int32ToAuxInt(int32(uint32(ssa.Read16(scon, 0, config.Ctxt.Arch.ByteOrder)) | (uint32(ssa.Read8(scon, 2)) << 16))) |
| v0.AddArg2(v1, v9) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} sptr (Addr {scon} (SB)) (Const64 [5]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8 |
| // result: (MakeResult (Eq64 (Or64 <typ.Int64> (ZeroExt32to64 <typ.Int64> (Load <typ.Int32> sptr mem)) (Lsh64x64 <typ.Int64> (ZeroExt8to64 <typ.Int64> (Load <typ.Int8> (OffPtr <typ.BytePtr> [4] sptr) mem)) (Const64 <typ.Int64> [32]))) (Const64 <typ.Int64> [int64(uint64(ssa.Read32(scon,0,config.Ctxt.Arch.ByteOrder))|(uint64(ssa.Read8(scon,4))<<32))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| sptr := v.Args[0] |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_1.Aux) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpSB { |
| break |
| } |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 5 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq64, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOr64, typ.Int64) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.Int64) |
| v3 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v3.AddArg2(sptr, mem) |
| v2.AddArg(v3) |
| v4 := b.NewValue0(v.Pos, ssaop.OpLsh64x64, typ.Int64) |
| v5 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.Int64) |
| v6 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int8) |
| v7 := b.NewValue0(v.Pos, ssaop.OpOffPtr, typ.BytePtr) |
| v7.AuxInt = ssa.Int64ToAuxInt(4) |
| v7.AddArg(sptr) |
| v6.AddArg2(v7, mem) |
| v5.AddArg(v6) |
| v8 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v8.AuxInt = ssa.Int64ToAuxInt(32) |
| v4.AddArg2(v5, v8) |
| v1.AddArg2(v2, v4) |
| v9 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v9.AuxInt = ssa.Int64ToAuxInt(int64(uint64(ssa.Read32(scon, 0, config.Ctxt.Arch.ByteOrder)) | (uint64(ssa.Read8(scon, 4)) << 32))) |
| v0.AddArg2(v1, v9) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} (Addr {scon} (SB)) sptr (Const64 [5]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8 |
| // result: (MakeResult (Eq64 (Or64 <typ.Int64> (ZeroExt32to64 <typ.Int64> (Load <typ.Int32> sptr mem)) (Lsh64x64 <typ.Int64> (ZeroExt8to64 <typ.Int64> (Load <typ.Int8> (OffPtr <typ.BytePtr> [4] sptr) mem)) (Const64 <typ.Int64> [32]))) (Const64 <typ.Int64> [int64(uint64(ssa.Read32(scon,0,config.Ctxt.Arch.ByteOrder))|(uint64(ssa.Read8(scon,4))<<32))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_0.Aux) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSB { |
| break |
| } |
| sptr := v.Args[1] |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 5 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq64, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOr64, typ.Int64) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.Int64) |
| v3 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v3.AddArg2(sptr, mem) |
| v2.AddArg(v3) |
| v4 := b.NewValue0(v.Pos, ssaop.OpLsh64x64, typ.Int64) |
| v5 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.Int64) |
| v6 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int8) |
| v7 := b.NewValue0(v.Pos, ssaop.OpOffPtr, typ.BytePtr) |
| v7.AuxInt = ssa.Int64ToAuxInt(4) |
| v7.AddArg(sptr) |
| v6.AddArg2(v7, mem) |
| v5.AddArg(v6) |
| v8 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v8.AuxInt = ssa.Int64ToAuxInt(32) |
| v4.AddArg2(v5, v8) |
| v1.AddArg2(v2, v4) |
| v9 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v9.AuxInt = ssa.Int64ToAuxInt(int64(uint64(ssa.Read32(scon, 0, config.Ctxt.Arch.ByteOrder)) | (uint64(ssa.Read8(scon, 4)) << 32))) |
| v0.AddArg2(v1, v9) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} sptr (Addr {scon} (SB)) (Const64 [6]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8 |
| // result: (MakeResult (Eq64 (Or64 <typ.Int64> (ZeroExt32to64 <typ.Int64> (Load <typ.Int32> sptr mem)) (Lsh64x64 <typ.Int64> (ZeroExt16to64 <typ.Int64> (Load <typ.Int16> (OffPtr <typ.BytePtr> [4] sptr) mem)) (Const64 <typ.Int64> [32]))) (Const64 <typ.Int64> [int64(uint64(ssa.Read32(scon,0,config.Ctxt.Arch.ByteOrder))|(uint64(ssa.Read16(scon,4,config.Ctxt.Arch.ByteOrder))<<32))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| sptr := v.Args[0] |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_1.Aux) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpSB { |
| break |
| } |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 6 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq64, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOr64, typ.Int64) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.Int64) |
| v3 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v3.AddArg2(sptr, mem) |
| v2.AddArg(v3) |
| v4 := b.NewValue0(v.Pos, ssaop.OpLsh64x64, typ.Int64) |
| v5 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.Int64) |
| v6 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int16) |
| v7 := b.NewValue0(v.Pos, ssaop.OpOffPtr, typ.BytePtr) |
| v7.AuxInt = ssa.Int64ToAuxInt(4) |
| v7.AddArg(sptr) |
| v6.AddArg2(v7, mem) |
| v5.AddArg(v6) |
| v8 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v8.AuxInt = ssa.Int64ToAuxInt(32) |
| v4.AddArg2(v5, v8) |
| v1.AddArg2(v2, v4) |
| v9 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v9.AuxInt = ssa.Int64ToAuxInt(int64(uint64(ssa.Read32(scon, 0, config.Ctxt.Arch.ByteOrder)) | (uint64(ssa.Read16(scon, 4, config.Ctxt.Arch.ByteOrder)) << 32))) |
| v0.AddArg2(v1, v9) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} (Addr {scon} (SB)) sptr (Const64 [6]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8 |
| // result: (MakeResult (Eq64 (Or64 <typ.Int64> (ZeroExt32to64 <typ.Int64> (Load <typ.Int32> sptr mem)) (Lsh64x64 <typ.Int64> (ZeroExt16to64 <typ.Int64> (Load <typ.Int16> (OffPtr <typ.BytePtr> [4] sptr) mem)) (Const64 <typ.Int64> [32]))) (Const64 <typ.Int64> [int64(uint64(ssa.Read32(scon,0,config.Ctxt.Arch.ByteOrder))|(uint64(ssa.Read16(scon,4,config.Ctxt.Arch.ByteOrder))<<32))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_0.Aux) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSB { |
| break |
| } |
| sptr := v.Args[1] |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 6 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq64, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOr64, typ.Int64) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.Int64) |
| v3 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v3.AddArg2(sptr, mem) |
| v2.AddArg(v3) |
| v4 := b.NewValue0(v.Pos, ssaop.OpLsh64x64, typ.Int64) |
| v5 := b.NewValue0(v.Pos, ssaop.OpZeroExt16to64, typ.Int64) |
| v6 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int16) |
| v7 := b.NewValue0(v.Pos, ssaop.OpOffPtr, typ.BytePtr) |
| v7.AuxInt = ssa.Int64ToAuxInt(4) |
| v7.AddArg(sptr) |
| v6.AddArg2(v7, mem) |
| v5.AddArg(v6) |
| v8 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v8.AuxInt = ssa.Int64ToAuxInt(32) |
| v4.AddArg2(v5, v8) |
| v1.AddArg2(v2, v4) |
| v9 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v9.AuxInt = ssa.Int64ToAuxInt(int64(uint64(ssa.Read32(scon, 0, config.Ctxt.Arch.ByteOrder)) | (uint64(ssa.Read16(scon, 4, config.Ctxt.Arch.ByteOrder)) << 32))) |
| v0.AddArg2(v1, v9) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} sptr (Addr {scon} (SB)) (Const64 [7]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8 |
| // result: (MakeResult (Eq64 (Or64 <typ.Int64> (ZeroExt32to64 <typ.Int64> (Load <typ.Int32> sptr mem)) (Lsh64x64 <typ.Int64> (ZeroExt32to64 <typ.Int64> (Load <typ.Int32> (OffPtr <typ.BytePtr> [3] sptr) mem)) (Const64 <typ.Int64> [32]))) (Const64 <typ.Int64> [int64(uint64(ssa.Read32(scon,0,config.Ctxt.Arch.ByteOrder))|(uint64(ssa.Read32(scon,3,config.Ctxt.Arch.ByteOrder))<<32))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| sptr := v.Args[0] |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_1.Aux) |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpSB { |
| break |
| } |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 7 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq64, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOr64, typ.Int64) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.Int64) |
| v3 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v3.AddArg2(sptr, mem) |
| v2.AddArg(v3) |
| v4 := b.NewValue0(v.Pos, ssaop.OpLsh64x64, typ.Int64) |
| v5 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.Int64) |
| v6 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v7 := b.NewValue0(v.Pos, ssaop.OpOffPtr, typ.BytePtr) |
| v7.AuxInt = ssa.Int64ToAuxInt(3) |
| v7.AddArg(sptr) |
| v6.AddArg2(v7, mem) |
| v5.AddArg(v6) |
| v8 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v8.AuxInt = ssa.Int64ToAuxInt(32) |
| v4.AddArg2(v5, v8) |
| v1.AddArg2(v2, v4) |
| v9 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v9.AuxInt = ssa.Int64ToAuxInt(int64(uint64(ssa.Read32(scon, 0, config.Ctxt.Arch.ByteOrder)) | (uint64(ssa.Read32(scon, 3, config.Ctxt.Arch.ByteOrder)) << 32))) |
| v0.AddArg2(v1, v9) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} (Addr {scon} (SB)) sptr (Const64 [7]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8 |
| // result: (MakeResult (Eq64 (Or64 <typ.Int64> (ZeroExt32to64 <typ.Int64> (Load <typ.Int32> sptr mem)) (Lsh64x64 <typ.Int64> (ZeroExt32to64 <typ.Int64> (Load <typ.Int32> (OffPtr <typ.BytePtr> [3] sptr) mem)) (Const64 <typ.Int64> [32]))) (Const64 <typ.Int64> [int64(uint64(ssa.Read32(scon,0,config.Ctxt.Arch.ByteOrder))|(uint64(ssa.Read32(scon,3,config.Ctxt.Arch.ByteOrder))<<32))])) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| v_0 := v.Args[0] |
| if v_0.Op != ssaop.OpAddr { |
| break |
| } |
| scon := ssa.AuxToSym(v_0.Aux) |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSB { |
| break |
| } |
| sptr := v.Args[1] |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 7 || !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.SymIsRO(scon) && canLoadUnaligned(config) && config.PtrSize == 8) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEq64, typ.Bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOr64, typ.Int64) |
| v2 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.Int64) |
| v3 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v3.AddArg2(sptr, mem) |
| v2.AddArg(v3) |
| v4 := b.NewValue0(v.Pos, ssaop.OpLsh64x64, typ.Int64) |
| v5 := b.NewValue0(v.Pos, ssaop.OpZeroExt32to64, typ.Int64) |
| v6 := b.NewValue0(v.Pos, ssaop.OpLoad, typ.Int32) |
| v7 := b.NewValue0(v.Pos, ssaop.OpOffPtr, typ.BytePtr) |
| v7.AuxInt = ssa.Int64ToAuxInt(3) |
| v7.AddArg(sptr) |
| v6.AddArg2(v7, mem) |
| v5.AddArg(v6) |
| v8 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v8.AuxInt = ssa.Int64ToAuxInt(32) |
| v4.AddArg2(v5, v8) |
| v1.AddArg2(v2, v4) |
| v9 := b.NewValue0(v.Pos, ssaop.OpConst64, typ.Int64) |
| v9.AuxInt = ssa.Int64ToAuxInt(int64(uint64(ssa.Read32(scon, 0, config.Ctxt.Arch.ByteOrder)) | (uint64(ssa.Read32(scon, 3, config.Ctxt.Arch.ByteOrder)) << 32))) |
| v0.AddArg2(v1, v9) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} _ _ (Const64 [0]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") |
| // result: (MakeResult (ConstBool <typ.Bool> [true]) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 0 || !(ssa.IsSameCall(callAux, "runtime.memequal")) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConstBool, typ.Bool) |
| v0.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} p q _ mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.memequal") && ssa.IsSamePtr(p, q) |
| // result: (MakeResult (ConstBool <typ.Bool> [true]) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| p := v.Args[0] |
| q := v.Args[1] |
| if !(ssa.IsSameCall(callAux, "runtime.memequal") && ssa.IsSamePtr(p, q)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConstBool, typ.Bool) |
| v0.AuxInt = ssa.BoolToAuxInt(true) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} _ (Const64 [0]) (Const64 [0]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.makeslice") |
| // result: (MakeResult (Addr <v.Type.FieldType(0)> {ir.Syms.Zerobase} (SB)) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 0 { |
| break |
| } |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_2.AuxInt) != 0 || !(ssa.IsSameCall(callAux, "runtime.makeslice")) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAddr, v.Type.FieldType(0)) |
| v0.Aux = ssa.SymToAux(ir.Syms.Zerobase) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSB, typ.Uintptr) |
| v0.AddArg(v1) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {callAux} _ (Const32 [0]) (Const32 [0]) mem) |
| // cond: ssa.IsSameCall(callAux, "runtime.makeslice") |
| // result: (MakeResult (Addr <v.Type.FieldType(0)> {ir.Syms.Zerobase} (SB)) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| callAux := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| v_1 := v.Args[1] |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != 0 { |
| break |
| } |
| v_2 := v.Args[2] |
| if v_2.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_2.AuxInt) != 0 || !(ssa.IsSameCall(callAux, "runtime.makeslice")) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAddr, v.Type.FieldType(0)) |
| v0.Aux = ssa.SymToAux(ir.Syms.Zerobase) |
| v1 := b.NewValue0(v.Pos, ssaop.OpSB, typ.Uintptr) |
| v0.AddArg(v1) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {f} typ_ x y mem) |
| // cond: ssa.IsSameCall(f, "runtime.efaceeq") && isDirectAndComparableType(typ_) && ssa.Clobber(v) |
| // result: (MakeResult (EqPtr x y) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| f := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| typ_ := v.Args[0] |
| x := v.Args[1] |
| y := v.Args[2] |
| if !(ssa.IsSameCall(f, "runtime.efaceeq") && isDirectAndComparableType(typ_) && ssa.Clobber(v)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEqPtr, typ.Bool) |
| v0.AddArg2(x, y) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {f} itab x y mem) |
| // cond: ssa.IsSameCall(f, "runtime.ifaceeq") && isDirectAndComparableIface(itab) && ssa.Clobber(v) |
| // result: (MakeResult (EqPtr x y) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| f := ssa.AuxToCall(v.Aux) |
| mem := v.Args[3] |
| itab := v.Args[0] |
| x := v.Args[1] |
| y := v.Args[2] |
| if !(ssa.IsSameCall(f, "runtime.ifaceeq") && isDirectAndComparableIface(itab) && ssa.Clobber(v)) { |
| break |
| } |
| v.Reset(ssaop.OpMakeResult) |
| v0 := b.NewValue0(v.Pos, ssaop.OpEqPtr, typ.Bool) |
| v0.AddArg2(x, y) |
| v.AddArg2(v0, mem) |
| return true |
| } |
| // match: (StaticLECall {f} [argsize] typ_ map_ key:(SelectN [0] sbts:(StaticLECall {g} _ ptr len mem)) m:(SelectN [1] sbts)) |
| // cond: (ssa.IsSameCall(f, "runtime.mapaccess1_faststr") || ssa.IsSameCall(f, "runtime.mapaccess2_faststr") || ssa.IsSameCall(f, "runtime.mapdelete_faststr")) && ssa.IsSameCall(g, "runtime.slicebytetostring") && key.Uses == 1 && sbts.Uses == 2 && resetCopy(m, mem) && ssa.Clobber(sbts) && ssa.Clobber(key) |
| // result: (StaticLECall {f} [argsize] typ_ map_ (StringMake <typ.String> ptr len) mem) |
| for { |
| if len(v.Args) != 4 { |
| break |
| } |
| argsize := ssa.AuxIntToInt32(v.AuxInt) |
| f := ssa.AuxToCall(v.Aux) |
| _ = v.Args[3] |
| typ_ := v.Args[0] |
| map_ := v.Args[1] |
| key := v.Args[2] |
| if key.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(key.AuxInt) != 0 { |
| break |
| } |
| sbts := key.Args[0] |
| if sbts.Op != ssaop.OpStaticLECall || len(sbts.Args) != 4 { |
| break |
| } |
| g := ssa.AuxToCall(sbts.Aux) |
| mem := sbts.Args[3] |
| ptr := sbts.Args[1] |
| len := sbts.Args[2] |
| m := v.Args[3] |
| if m.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(m.AuxInt) != 1 || sbts != m.Args[0] || !((ssa.IsSameCall(f, "runtime.mapaccess1_faststr") || ssa.IsSameCall(f, "runtime.mapaccess2_faststr") || ssa.IsSameCall(f, "runtime.mapdelete_faststr")) && ssa.IsSameCall(g, "runtime.slicebytetostring") && key.Uses == 1 && sbts.Uses == 2 && resetCopy(m, mem) && ssa.Clobber(sbts) && ssa.Clobber(key)) { |
| break |
| } |
| v.Reset(ssaop.OpStaticLECall) |
| v.AuxInt = ssa.Int32ToAuxInt(argsize) |
| v.Aux = ssa.CallToAux(f) |
| v0 := b.NewValue0(v.Pos, ssaop.OpStringMake, typ.String) |
| v0.AddArg2(ptr, len) |
| v.AddArg4(typ_, map_, v0, mem) |
| return true |
| } |
| // match: (StaticLECall {f} [argsize] dict_ key:(SelectN [0] sbts:(StaticLECall {g} _ ptr len mem)) m:(SelectN [1] sbts)) |
| // cond: ssa.IsSameCall(f, "unique.Make[go.shape.string]") && ssa.IsSameCall(g, "runtime.slicebytetostring") && key.Uses == 1 && sbts.Uses == 2 && resetCopy(m, mem) && ssa.Clobber(sbts) && ssa.Clobber(key) |
| // result: (StaticLECall {f} [argsize] dict_ (StringMake <typ.String> ptr len) mem) |
| for { |
| if len(v.Args) != 3 { |
| break |
| } |
| argsize := ssa.AuxIntToInt32(v.AuxInt) |
| f := ssa.AuxToCall(v.Aux) |
| _ = v.Args[2] |
| dict_ := v.Args[0] |
| key := v.Args[1] |
| if key.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(key.AuxInt) != 0 { |
| break |
| } |
| sbts := key.Args[0] |
| if sbts.Op != ssaop.OpStaticLECall || len(sbts.Args) != 4 { |
| break |
| } |
| g := ssa.AuxToCall(sbts.Aux) |
| mem := sbts.Args[3] |
| ptr := sbts.Args[1] |
| len := sbts.Args[2] |
| m := v.Args[2] |
| if m.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(m.AuxInt) != 1 || sbts != m.Args[0] || !(ssa.IsSameCall(f, "unique.Make[go.shape.string]") && ssa.IsSameCall(g, "runtime.slicebytetostring") && key.Uses == 1 && sbts.Uses == 2 && resetCopy(m, mem) && ssa.Clobber(sbts) && ssa.Clobber(key)) { |
| break |
| } |
| v.Reset(ssaop.OpStaticLECall) |
| v.AuxInt = ssa.Int32ToAuxInt(argsize) |
| v.Aux = ssa.CallToAux(f) |
| v0 := b.NewValue0(v.Pos, ssaop.OpStringMake, typ.String) |
| v0.AddArg2(ptr, len) |
| v.AddArg3(dict_, v0, mem) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpStore(v *ssa.Value) bool { |
| v_2 := v.Args[2] |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Store {t1} p1 (Load <t2> p2 mem) mem) |
| // cond: ssa.IsSamePtr(p1, p2) && t2.Size() == t1.Size() |
| // result: mem |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| p1 := v_0 |
| if v_1.Op != ssaop.OpLoad { |
| break |
| } |
| t2 := v_1.Type |
| mem := v_1.Args[1] |
| p2 := v_1.Args[0] |
| if mem != v_2 || !(ssa.IsSamePtr(p1, p2) && t2.Size() == t1.Size()) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| // match: (Store {t1} p1 (Load <t2> p2 oldmem) mem:(Store {t3} p3 _ oldmem)) |
| // cond: ssa.IsSamePtr(p1, p2) && t2.Size() == t1.Size() && ssa.Disjoint(p1, t1, p3, t3) |
| // result: mem |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| p1 := v_0 |
| if v_1.Op != ssaop.OpLoad { |
| break |
| } |
| t2 := v_1.Type |
| oldmem := v_1.Args[1] |
| p2 := v_1.Args[0] |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| p3 := mem.Args[0] |
| if oldmem != mem.Args[2] || !(ssa.IsSamePtr(p1, p2) && t2.Size() == t1.Size() && ssa.Disjoint(p1, t1, p3, t3)) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| // match: (Store {t1} p1 (Load <t2> p2 oldmem) mem:(Store {t3} p3 _ (Store {t4} p4 _ oldmem))) |
| // cond: ssa.IsSamePtr(p1, p2) && t2.Size() == t1.Size() && ssa.Disjoint(p1, t1, p3, t3) && ssa.Disjoint(p1, t1, p4, t4) |
| // result: mem |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| p1 := v_0 |
| if v_1.Op != ssaop.OpLoad { |
| break |
| } |
| t2 := v_1.Type |
| oldmem := v_1.Args[1] |
| p2 := v_1.Args[0] |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| p3 := mem.Args[0] |
| mem_2 := mem.Args[2] |
| if mem_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(mem_2.Aux) |
| _ = mem_2.Args[2] |
| p4 := mem_2.Args[0] |
| if oldmem != mem_2.Args[2] || !(ssa.IsSamePtr(p1, p2) && t2.Size() == t1.Size() && ssa.Disjoint(p1, t1, p3, t3) && ssa.Disjoint(p1, t1, p4, t4)) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| // match: (Store {t1} p1 (Load <t2> p2 oldmem) mem:(Store {t3} p3 _ (Store {t4} p4 _ (Store {t5} p5 _ oldmem)))) |
| // cond: ssa.IsSamePtr(p1, p2) && t2.Size() == t1.Size() && ssa.Disjoint(p1, t1, p3, t3) && ssa.Disjoint(p1, t1, p4, t4) && ssa.Disjoint(p1, t1, p5, t5) |
| // result: mem |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| p1 := v_0 |
| if v_1.Op != ssaop.OpLoad { |
| break |
| } |
| t2 := v_1.Type |
| oldmem := v_1.Args[1] |
| p2 := v_1.Args[0] |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| p3 := mem.Args[0] |
| mem_2 := mem.Args[2] |
| if mem_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(mem_2.Aux) |
| _ = mem_2.Args[2] |
| p4 := mem_2.Args[0] |
| mem_2_2 := mem_2.Args[2] |
| if mem_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t5 := ssa.AuxToType(mem_2_2.Aux) |
| _ = mem_2_2.Args[2] |
| p5 := mem_2_2.Args[0] |
| if oldmem != mem_2_2.Args[2] || !(ssa.IsSamePtr(p1, p2) && t2.Size() == t1.Size() && ssa.Disjoint(p1, t1, p3, t3) && ssa.Disjoint(p1, t1, p4, t4) && ssa.Disjoint(p1, t1, p5, t5)) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| // match: (Store {t} (OffPtr [o] p1) x mem:(Zero [n] p2 _)) |
| // cond: ssa.IsConstZero(x) && o >= 0 && t.Size() + o <= n && ssa.IsSamePtr(p1, p2) |
| // result: mem |
| for { |
| t := ssa.AuxToType(v.Aux) |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| o := ssa.AuxIntToInt64(v_0.AuxInt) |
| p1 := v_0.Args[0] |
| x := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(mem.AuxInt) |
| p2 := mem.Args[0] |
| if !(ssa.IsConstZero(x) && o >= 0 && t.Size()+o <= n && ssa.IsSamePtr(p1, p2)) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| // match: (Store {t1} op1:(OffPtr [o1] p1) x mem:(Store {t2} p2 _ (Zero [n] p3 _))) |
| // cond: ssa.IsConstZero(x) && o1 >= 0 && t1.Size() + o1 <= n && ssa.IsSamePtr(p1, p3) && ssa.Disjoint(op1, t1, p2, t2) |
| // result: mem |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| x := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| p2 := mem.Args[0] |
| mem_2 := mem.Args[2] |
| if mem_2.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(mem_2.AuxInt) |
| p3 := mem_2.Args[0] |
| if !(ssa.IsConstZero(x) && o1 >= 0 && t1.Size()+o1 <= n && ssa.IsSamePtr(p1, p3) && ssa.Disjoint(op1, t1, p2, t2)) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| // match: (Store {t1} op1:(OffPtr [o1] p1) x mem:(Store {t2} p2 _ (Store {t3} p3 _ (Zero [n] p4 _)))) |
| // cond: ssa.IsConstZero(x) && o1 >= 0 && t1.Size() + o1 <= n && ssa.IsSamePtr(p1, p4) && ssa.Disjoint(op1, t1, p2, t2) && ssa.Disjoint(op1, t1, p3, t3) |
| // result: mem |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| x := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| p2 := mem.Args[0] |
| mem_2 := mem.Args[2] |
| if mem_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_2.Aux) |
| _ = mem_2.Args[2] |
| p3 := mem_2.Args[0] |
| mem_2_2 := mem_2.Args[2] |
| if mem_2_2.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(mem_2_2.AuxInt) |
| p4 := mem_2_2.Args[0] |
| if !(ssa.IsConstZero(x) && o1 >= 0 && t1.Size()+o1 <= n && ssa.IsSamePtr(p1, p4) && ssa.Disjoint(op1, t1, p2, t2) && ssa.Disjoint(op1, t1, p3, t3)) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| // match: (Store {t1} op1:(OffPtr [o1] p1) x mem:(Store {t2} p2 _ (Store {t3} p3 _ (Store {t4} p4 _ (Zero [n] p5 _))))) |
| // cond: ssa.IsConstZero(x) && o1 >= 0 && t1.Size() + o1 <= n && ssa.IsSamePtr(p1, p5) && ssa.Disjoint(op1, t1, p2, t2) && ssa.Disjoint(op1, t1, p3, t3) && ssa.Disjoint(op1, t1, p4, t4) |
| // result: mem |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| x := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(mem.Aux) |
| _ = mem.Args[2] |
| p2 := mem.Args[0] |
| mem_2 := mem.Args[2] |
| if mem_2.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(mem_2.Aux) |
| _ = mem_2.Args[2] |
| p3 := mem_2.Args[0] |
| mem_2_2 := mem_2.Args[2] |
| if mem_2_2.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(mem_2_2.Aux) |
| _ = mem_2_2.Args[2] |
| p4 := mem_2_2.Args[0] |
| mem_2_2_2 := mem_2_2.Args[2] |
| if mem_2_2_2.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(mem_2_2_2.AuxInt) |
| p5 := mem_2_2_2.Args[0] |
| if !(ssa.IsConstZero(x) && o1 >= 0 && t1.Size()+o1 <= n && ssa.IsSamePtr(p1, p5) && ssa.Disjoint(op1, t1, p2, t2) && ssa.Disjoint(op1, t1, p3, t3) && ssa.Disjoint(op1, t1, p4, t4)) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| // match: (Store _ (StructMake ___) _) |
| // result: ssa.RewriteStructStore(v) |
| for { |
| if v_1.Op != ssaop.OpStructMake { |
| break |
| } |
| v.CopyOf(ssa.RewriteStructStore(v)) |
| return true |
| } |
| // match: (Store {t} dst (Load src mem) mem) |
| // cond: !ssa.CanSSA(t) |
| // result: (Move {t} [t.Size()] dst src mem) |
| for { |
| t := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| if v_1.Op != ssaop.OpLoad { |
| break |
| } |
| mem := v_1.Args[1] |
| src := v_1.Args[0] |
| if mem != v_2 || !(!ssa.CanSSA(t)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(t.Size()) |
| v.Aux = ssa.TypeToAux(t) |
| v.AddArg3(dst, src, mem) |
| return true |
| } |
| // match: (Store {t} dst (Load src mem) (VarDef {x} mem)) |
| // cond: !ssa.CanSSA(t) |
| // result: (Move {t} [t.Size()] dst src (VarDef {x} mem)) |
| for { |
| t := ssa.AuxToType(v.Aux) |
| dst := v_0 |
| if v_1.Op != ssaop.OpLoad { |
| break |
| } |
| mem := v_1.Args[1] |
| src := v_1.Args[0] |
| if v_2.Op != ssaop.OpVarDef { |
| break |
| } |
| x := ssa.AuxToSym(v_2.Aux) |
| if mem != v_2.Args[0] || !(!ssa.CanSSA(t)) { |
| break |
| } |
| v.Reset(ssaop.OpMove) |
| v.AuxInt = ssa.Int64ToAuxInt(t.Size()) |
| v.Aux = ssa.TypeToAux(t) |
| v0 := b.NewValue0(v.Pos, ssaop.OpVarDef, types.TypeMem) |
| v0.Aux = ssa.SymToAux(x) |
| v0.AddArg(mem) |
| v.AddArg3(dst, src, v0) |
| return true |
| } |
| // match: (Store dst (ArrayMake1 e) mem) |
| // result: (Store {e.Type} dst e mem) |
| for { |
| dst := v_0 |
| if v_1.Op != ssaop.OpArrayMake1 { |
| break |
| } |
| e := v_1.Args[0] |
| mem := v_2 |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(e.Type) |
| v.AddArg3(dst, e, mem) |
| return true |
| } |
| // match: (Store _ (Empty) mem) |
| // result: mem |
| for { |
| if v_1.Op != ssaop.OpEmpty { |
| break |
| } |
| mem := v_2 |
| v.CopyOf(mem) |
| return true |
| } |
| // match: (Store (SelectN [0] call:(StaticLECall ___)) x mem:(SelectN [1] call)) |
| // cond: ssa.IsConstZero(x) && isMalloc(call.Aux) |
| // result: mem |
| for { |
| if v_0.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| call := v_0.Args[0] |
| if call.Op != ssaop.OpStaticLECall { |
| break |
| } |
| x := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(mem.AuxInt) != 1 || call != mem.Args[0] || !(ssa.IsConstZero(x) && isMalloc(call.Aux)) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| // match: (Store (OffPtr (SelectN [0] call:(StaticLECall ___))) x mem:(SelectN [1] call)) |
| // cond: ssa.IsConstZero(x) && isMalloc(call.Aux) |
| // result: mem |
| for { |
| if v_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(v_0_0.AuxInt) != 0 { |
| break |
| } |
| call := v_0_0.Args[0] |
| if call.Op != ssaop.OpStaticLECall { |
| break |
| } |
| x := v_1 |
| mem := v_2 |
| if mem.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(mem.AuxInt) != 1 || call != mem.Args[0] || !(ssa.IsConstZero(x) && isMalloc(call.Aux)) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| // match: (Store {t1} op1:(OffPtr [o1] p1) d1 m2:(Store {t2} op2:(OffPtr [0] p2) d2 m3:(Move [n] p3 _ mem))) |
| // cond: m2.Uses == 1 && m3.Uses == 1 && o1 == t2.Size() && n == t2.Size() + t1.Size() && ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.Clobber(m2, m3) |
| // result: (Store {t1} op1 d1 (Store {t2} op2 d2 mem)) |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| d1 := v_1 |
| m2 := v_2 |
| if m2.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(m2.Aux) |
| _ = m2.Args[2] |
| op2 := m2.Args[0] |
| if op2.Op != ssaop.OpOffPtr || ssa.AuxIntToInt64(op2.AuxInt) != 0 { |
| break |
| } |
| p2 := op2.Args[0] |
| d2 := m2.Args[1] |
| m3 := m2.Args[2] |
| if m3.Op != ssaop.OpMove { |
| break |
| } |
| n := ssa.AuxIntToInt64(m3.AuxInt) |
| mem := m3.Args[2] |
| p3 := m3.Args[0] |
| if !(m2.Uses == 1 && m3.Uses == 1 && o1 == t2.Size() && n == t2.Size()+t1.Size() && ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.Clobber(m2, m3)) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t1) |
| v0 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v0.Aux = ssa.TypeToAux(t2) |
| v0.AddArg3(op2, d2, mem) |
| v.AddArg3(op1, d1, v0) |
| return true |
| } |
| // match: (Store {t1} op1:(OffPtr [o1] p1) d1 m2:(Store {t2} op2:(OffPtr [o2] p2) d2 m3:(Store {t3} op3:(OffPtr [0] p3) d3 m4:(Move [n] p4 _ mem)))) |
| // cond: m2.Uses == 1 && m3.Uses == 1 && m4.Uses == 1 && o2 == t3.Size() && o1-o2 == t2.Size() && n == t3.Size() + t2.Size() + t1.Size() && ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.Clobber(m2, m3, m4) |
| // result: (Store {t1} op1 d1 (Store {t2} op2 d2 (Store {t3} op3 d3 mem))) |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| d1 := v_1 |
| m2 := v_2 |
| if m2.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(m2.Aux) |
| _ = m2.Args[2] |
| op2 := m2.Args[0] |
| if op2.Op != ssaop.OpOffPtr { |
| break |
| } |
| o2 := ssa.AuxIntToInt64(op2.AuxInt) |
| p2 := op2.Args[0] |
| d2 := m2.Args[1] |
| m3 := m2.Args[2] |
| if m3.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(m3.Aux) |
| _ = m3.Args[2] |
| op3 := m3.Args[0] |
| if op3.Op != ssaop.OpOffPtr || ssa.AuxIntToInt64(op3.AuxInt) != 0 { |
| break |
| } |
| p3 := op3.Args[0] |
| d3 := m3.Args[1] |
| m4 := m3.Args[2] |
| if m4.Op != ssaop.OpMove { |
| break |
| } |
| n := ssa.AuxIntToInt64(m4.AuxInt) |
| mem := m4.Args[2] |
| p4 := m4.Args[0] |
| if !(m2.Uses == 1 && m3.Uses == 1 && m4.Uses == 1 && o2 == t3.Size() && o1-o2 == t2.Size() && n == t3.Size()+t2.Size()+t1.Size() && ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.Clobber(m2, m3, m4)) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t1) |
| v0 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v0.Aux = ssa.TypeToAux(t2) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v1.AddArg3(op3, d3, mem) |
| v0.AddArg3(op2, d2, v1) |
| v.AddArg3(op1, d1, v0) |
| return true |
| } |
| // match: (Store {t1} op1:(OffPtr [o1] p1) d1 m2:(Store {t2} op2:(OffPtr [o2] p2) d2 m3:(Store {t3} op3:(OffPtr [o3] p3) d3 m4:(Store {t4} op4:(OffPtr [0] p4) d4 m5:(Move [n] p5 _ mem))))) |
| // cond: m2.Uses == 1 && m3.Uses == 1 && m4.Uses == 1 && m5.Uses == 1 && o3 == t4.Size() && o2-o3 == t3.Size() && o1-o2 == t2.Size() && n == t4.Size() + t3.Size() + t2.Size() + t1.Size() && ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && ssa.Clobber(m2, m3, m4, m5) |
| // result: (Store {t1} op1 d1 (Store {t2} op2 d2 (Store {t3} op3 d3 (Store {t4} op4 d4 mem)))) |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| d1 := v_1 |
| m2 := v_2 |
| if m2.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(m2.Aux) |
| _ = m2.Args[2] |
| op2 := m2.Args[0] |
| if op2.Op != ssaop.OpOffPtr { |
| break |
| } |
| o2 := ssa.AuxIntToInt64(op2.AuxInt) |
| p2 := op2.Args[0] |
| d2 := m2.Args[1] |
| m3 := m2.Args[2] |
| if m3.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(m3.Aux) |
| _ = m3.Args[2] |
| op3 := m3.Args[0] |
| if op3.Op != ssaop.OpOffPtr { |
| break |
| } |
| o3 := ssa.AuxIntToInt64(op3.AuxInt) |
| p3 := op3.Args[0] |
| d3 := m3.Args[1] |
| m4 := m3.Args[2] |
| if m4.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(m4.Aux) |
| _ = m4.Args[2] |
| op4 := m4.Args[0] |
| if op4.Op != ssaop.OpOffPtr || ssa.AuxIntToInt64(op4.AuxInt) != 0 { |
| break |
| } |
| p4 := op4.Args[0] |
| d4 := m4.Args[1] |
| m5 := m4.Args[2] |
| if m5.Op != ssaop.OpMove { |
| break |
| } |
| n := ssa.AuxIntToInt64(m5.AuxInt) |
| mem := m5.Args[2] |
| p5 := m5.Args[0] |
| if !(m2.Uses == 1 && m3.Uses == 1 && m4.Uses == 1 && m5.Uses == 1 && o3 == t4.Size() && o2-o3 == t3.Size() && o1-o2 == t2.Size() && n == t4.Size()+t3.Size()+t2.Size()+t1.Size() && ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && ssa.Clobber(m2, m3, m4, m5)) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t1) |
| v0 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v0.Aux = ssa.TypeToAux(t2) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v2.Aux = ssa.TypeToAux(t4) |
| v2.AddArg3(op4, d4, mem) |
| v1.AddArg3(op3, d3, v2) |
| v0.AddArg3(op2, d2, v1) |
| v.AddArg3(op1, d1, v0) |
| return true |
| } |
| // match: (Store {t1} op1:(OffPtr [o1] p1) d1 m2:(Store {t2} op2:(OffPtr [0] p2) d2 m3:(Zero [n] p3 mem))) |
| // cond: m2.Uses == 1 && m3.Uses == 1 && o1 == t2.Size() && n == t2.Size() + t1.Size() && ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.Clobber(m2, m3) |
| // result: (Store {t1} op1 d1 (Store {t2} op2 d2 mem)) |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| d1 := v_1 |
| m2 := v_2 |
| if m2.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(m2.Aux) |
| _ = m2.Args[2] |
| op2 := m2.Args[0] |
| if op2.Op != ssaop.OpOffPtr || ssa.AuxIntToInt64(op2.AuxInt) != 0 { |
| break |
| } |
| p2 := op2.Args[0] |
| d2 := m2.Args[1] |
| m3 := m2.Args[2] |
| if m3.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(m3.AuxInt) |
| mem := m3.Args[1] |
| p3 := m3.Args[0] |
| if !(m2.Uses == 1 && m3.Uses == 1 && o1 == t2.Size() && n == t2.Size()+t1.Size() && ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.Clobber(m2, m3)) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t1) |
| v0 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v0.Aux = ssa.TypeToAux(t2) |
| v0.AddArg3(op2, d2, mem) |
| v.AddArg3(op1, d1, v0) |
| return true |
| } |
| // match: (Store {t1} op1:(OffPtr [o1] p1) d1 m2:(Store {t2} op2:(OffPtr [o2] p2) d2 m3:(Store {t3} op3:(OffPtr [0] p3) d3 m4:(Zero [n] p4 mem)))) |
| // cond: m2.Uses == 1 && m3.Uses == 1 && m4.Uses == 1 && o2 == t3.Size() && o1-o2 == t2.Size() && n == t3.Size() + t2.Size() + t1.Size() && ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.Clobber(m2, m3, m4) |
| // result: (Store {t1} op1 d1 (Store {t2} op2 d2 (Store {t3} op3 d3 mem))) |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| d1 := v_1 |
| m2 := v_2 |
| if m2.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(m2.Aux) |
| _ = m2.Args[2] |
| op2 := m2.Args[0] |
| if op2.Op != ssaop.OpOffPtr { |
| break |
| } |
| o2 := ssa.AuxIntToInt64(op2.AuxInt) |
| p2 := op2.Args[0] |
| d2 := m2.Args[1] |
| m3 := m2.Args[2] |
| if m3.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(m3.Aux) |
| _ = m3.Args[2] |
| op3 := m3.Args[0] |
| if op3.Op != ssaop.OpOffPtr || ssa.AuxIntToInt64(op3.AuxInt) != 0 { |
| break |
| } |
| p3 := op3.Args[0] |
| d3 := m3.Args[1] |
| m4 := m3.Args[2] |
| if m4.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(m4.AuxInt) |
| mem := m4.Args[1] |
| p4 := m4.Args[0] |
| if !(m2.Uses == 1 && m3.Uses == 1 && m4.Uses == 1 && o2 == t3.Size() && o1-o2 == t2.Size() && n == t3.Size()+t2.Size()+t1.Size() && ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.Clobber(m2, m3, m4)) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t1) |
| v0 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v0.Aux = ssa.TypeToAux(t2) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v1.AddArg3(op3, d3, mem) |
| v0.AddArg3(op2, d2, v1) |
| v.AddArg3(op1, d1, v0) |
| return true |
| } |
| // match: (Store {t1} op1:(OffPtr [o1] p1) d1 m2:(Store {t2} op2:(OffPtr [o2] p2) d2 m3:(Store {t3} op3:(OffPtr [o3] p3) d3 m4:(Store {t4} op4:(OffPtr [0] p4) d4 m5:(Zero [n] p5 mem))))) |
| // cond: m2.Uses == 1 && m3.Uses == 1 && m4.Uses == 1 && m5.Uses == 1 && o3 == t4.Size() && o2-o3 == t3.Size() && o1-o2 == t2.Size() && n == t4.Size() + t3.Size() + t2.Size() + t1.Size() && ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && ssa.Clobber(m2, m3, m4, m5) |
| // result: (Store {t1} op1 d1 (Store {t2} op2 d2 (Store {t3} op3 d3 (Store {t4} op4 d4 mem)))) |
| for { |
| t1 := ssa.AuxToType(v.Aux) |
| op1 := v_0 |
| if op1.Op != ssaop.OpOffPtr { |
| break |
| } |
| o1 := ssa.AuxIntToInt64(op1.AuxInt) |
| p1 := op1.Args[0] |
| d1 := v_1 |
| m2 := v_2 |
| if m2.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(m2.Aux) |
| _ = m2.Args[2] |
| op2 := m2.Args[0] |
| if op2.Op != ssaop.OpOffPtr { |
| break |
| } |
| o2 := ssa.AuxIntToInt64(op2.AuxInt) |
| p2 := op2.Args[0] |
| d2 := m2.Args[1] |
| m3 := m2.Args[2] |
| if m3.Op != ssaop.OpStore { |
| break |
| } |
| t3 := ssa.AuxToType(m3.Aux) |
| _ = m3.Args[2] |
| op3 := m3.Args[0] |
| if op3.Op != ssaop.OpOffPtr { |
| break |
| } |
| o3 := ssa.AuxIntToInt64(op3.AuxInt) |
| p3 := op3.Args[0] |
| d3 := m3.Args[1] |
| m4 := m3.Args[2] |
| if m4.Op != ssaop.OpStore { |
| break |
| } |
| t4 := ssa.AuxToType(m4.Aux) |
| _ = m4.Args[2] |
| op4 := m4.Args[0] |
| if op4.Op != ssaop.OpOffPtr || ssa.AuxIntToInt64(op4.AuxInt) != 0 { |
| break |
| } |
| p4 := op4.Args[0] |
| d4 := m4.Args[1] |
| m5 := m4.Args[2] |
| if m5.Op != ssaop.OpZero { |
| break |
| } |
| n := ssa.AuxIntToInt64(m5.AuxInt) |
| mem := m5.Args[1] |
| p5 := m5.Args[0] |
| if !(m2.Uses == 1 && m3.Uses == 1 && m4.Uses == 1 && m5.Uses == 1 && o3 == t4.Size() && o2-o3 == t3.Size() && o1-o2 == t2.Size() && n == t4.Size()+t3.Size()+t2.Size()+t1.Size() && ssa.IsSamePtr(p1, p2) && ssa.IsSamePtr(p2, p3) && ssa.IsSamePtr(p3, p4) && ssa.IsSamePtr(p4, p5) && ssa.Clobber(m2, m3, m4, m5)) { |
| break |
| } |
| v.Reset(ssaop.OpStore) |
| v.Aux = ssa.TypeToAux(t1) |
| v0 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v0.Aux = ssa.TypeToAux(t2) |
| v1 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v1.Aux = ssa.TypeToAux(t3) |
| v2 := b.NewValue0(v.Pos, ssaop.OpStore, types.TypeMem) |
| v2.Aux = ssa.TypeToAux(t4) |
| v2.AddArg3(op4, d4, mem) |
| v1.AddArg3(op3, d3, v2) |
| v0.AddArg3(op2, d2, v1) |
| v.AddArg3(op1, d1, v0) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpStringLen(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (StringLen (StringMake _ (Const64 <t> [c]))) |
| // result: (Const64 <t> [c]) |
| for { |
| if v_0.Op != ssaop.OpStringMake { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_1 := v_0.Args[1] |
| if v_0_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0_1.Type |
| c := ssa.AuxIntToInt64(v_0_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.Type = t |
| v.AuxInt = ssa.Int64ToAuxInt(c) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpStringPtr(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (StringPtr (StringMake (Addr <t> {s} base) _)) |
| // result: (Addr <t> {s} base) |
| for { |
| if v_0.Op != ssaop.OpStringMake { |
| break |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpAddr { |
| break |
| } |
| t := v_0_0.Type |
| s := ssa.AuxToSym(v_0_0.Aux) |
| base := v_0_0.Args[0] |
| v.Reset(ssaop.OpAddr) |
| v.Type = t |
| v.Aux = ssa.SymToAux(s) |
| v.AddArg(base) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpStructSelect(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (StructSelect [i] x:(StructMake ___)) |
| // result: x.Args[i] |
| for { |
| i := ssa.AuxIntToInt64(v.AuxInt) |
| x := v_0 |
| if x.Op != ssaop.OpStructMake { |
| break |
| } |
| v.CopyOf(x.Args[i]) |
| return true |
| } |
| // match: (StructSelect [i] x:(Load <t> ptr mem)) |
| // cond: !ssa.CanSSA(t) |
| // result: @x.Block (Load <v.Type> (OffPtr <v.Type.PtrTo()> [t.FieldOff(int(i))] ptr) mem) |
| for { |
| i := ssa.AuxIntToInt64(v.AuxInt) |
| x := v_0 |
| if x.Op != ssaop.OpLoad { |
| break |
| } |
| t := x.Type |
| mem := x.Args[1] |
| ptr := x.Args[0] |
| if !(!ssa.CanSSA(t)) { |
| break |
| } |
| b = x.Block |
| v0 := b.NewValue0(v.Pos, ssaop.OpLoad, v.Type) |
| v.CopyOf(v0) |
| v1 := b.NewValue0(v.Pos, ssaop.OpOffPtr, v.Type.PtrTo()) |
| v1.AuxInt = ssa.Int64ToAuxInt(t.FieldOff(int(i))) |
| v1.AddArg(ptr) |
| v0.AddArg2(v1, mem) |
| return true |
| } |
| // match: (StructSelect (IData x)) |
| // cond: v.Type.Size() > 0 |
| // result: (IData x) |
| for { |
| if v_0.Op != ssaop.OpIData { |
| break |
| } |
| x := v_0.Args[0] |
| if !(v.Type.Size() > 0) { |
| break |
| } |
| v.Reset(ssaop.OpIData) |
| v.AddArg(x) |
| return true |
| } |
| // match: (StructSelect (IData x)) |
| // cond: v.Type.Size() == 0 |
| // result: (Empty) |
| for { |
| if v_0.Op != ssaop.OpIData { |
| break |
| } |
| if !(v.Type.Size() == 0) { |
| break |
| } |
| v.Reset(ssaop.OpEmpty) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSub16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Sub16 (Const16 [c]) (Const16 [d])) |
| // result: (Const16 [c-d]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(c - d) |
| return true |
| } |
| // match: (Sub16 x (Const16 <t> [c])) |
| // cond: x.Op != ssaop.OpConst16 |
| // result: (Add16 (Const16 <t> [-c]) x) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_1.Type |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(x.Op != ssaop.OpConst16) { |
| break |
| } |
| v.Reset(ssaop.OpAdd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(-c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Sub16 <t> (Mul16 x y) (Mul16 x z)) |
| // result: (Mul16 x (Sub16 <t> y z)) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpMul16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if v_1.Op != ssaop.OpMul16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| z := v_1_1 |
| v.Reset(ssaop.OpMul16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, t) |
| v0.AddArg2(y, z) |
| v.AddArg2(x, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Sub16 x x) |
| // result: (Const16 [0]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Sub16 (Neg16 x) (Com16 x)) |
| // result: (Const16 [1]) |
| for { |
| if v_0.Op != ssaop.OpNeg16 { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpCom16 || x != v_1.Args[0] { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(1) |
| return true |
| } |
| // match: (Sub16 (Com16 x) (Neg16 x)) |
| // result: (Const16 [-1]) |
| for { |
| if v_0.Op != ssaop.OpCom16 { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpNeg16 || x != v_1.Args[0] { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(-1) |
| return true |
| } |
| // match: (Sub16 (Add16 t x) (Add16 t y)) |
| // result: (Sub16 x y) |
| for { |
| if v_0.Op != ssaop.OpAdd16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| t := v_0_0 |
| x := v_0_1 |
| if v_1.Op != ssaop.OpAdd16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if t != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpSub16) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Sub16 x (And16 <t> x y)) |
| // result: (And16 x (Com16 <t> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd16 { |
| break |
| } |
| t := v_1.Type |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpAnd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCom16, t) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Sub16 (Add16 x y) x) |
| // result: y |
| for { |
| if v_0.Op != ssaop.OpAdd16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if x != v_1 { |
| continue |
| } |
| v.CopyOf(y) |
| return true |
| } |
| break |
| } |
| // match: (Sub16 (Add16 x y) y) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpAdd16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if y != v_1 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Sub16 (Sub16 x y) x) |
| // result: (Neg16 y) |
| for { |
| if v_0.Op != ssaop.OpSub16 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpNeg16) |
| v.AddArg(y) |
| return true |
| } |
| // match: (Sub16 x (Add16 x y)) |
| // result: (Neg16 y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd16 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpNeg16) |
| v.AddArg(y) |
| return true |
| } |
| break |
| } |
| // match: (Sub16 x (Sub16 i:(Const16 <t>) z)) |
| // cond: (z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) |
| // result: (Sub16 (Add16 <t> x z) i) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub16 { |
| break |
| } |
| z := v_1.Args[1] |
| i := v_1.Args[0] |
| if i.Op != ssaop.OpConst16 { |
| break |
| } |
| t := i.Type |
| if !(z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) { |
| break |
| } |
| v.Reset(ssaop.OpSub16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd16, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(v0, i) |
| return true |
| } |
| // match: (Sub16 x (Add16 z i:(Const16 <t>))) |
| // cond: (z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) |
| // result: (Sub16 (Sub16 <t> x z) i) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd16 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| z := v_1_0 |
| i := v_1_1 |
| if i.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := i.Type |
| if !(z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) { |
| continue |
| } |
| v.Reset(ssaop.OpSub16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(v0, i) |
| return true |
| } |
| break |
| } |
| // match: (Sub16 (Sub16 i:(Const16 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) |
| // result: (Sub16 i (Add16 <t> z x)) |
| for { |
| if v_0.Op != ssaop.OpSub16 { |
| break |
| } |
| z := v_0.Args[1] |
| i := v_0.Args[0] |
| if i.Op != ssaop.OpConst16 { |
| break |
| } |
| t := i.Type |
| x := v_1 |
| if !(z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) { |
| break |
| } |
| v.Reset(ssaop.OpSub16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd16, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| // match: (Sub16 (Add16 z i:(Const16 <t>)) x) |
| // cond: (z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) |
| // result: (Add16 i (Sub16 <t> z x)) |
| for { |
| if v_0.Op != ssaop.OpAdd16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| z := v_0_0 |
| i := v_0_1 |
| if i.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := i.Type |
| x := v_1 |
| if !(z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub16, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| break |
| } |
| // match: (Sub16 (Const16 <t> [c]) (Sub16 (Const16 <t> [d]) x)) |
| // result: (Add16 (Const16 <t> [c-d]) x) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpSub16 { |
| break |
| } |
| x := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst16 || v_1_0.Type != t { |
| break |
| } |
| d := ssa.AuxIntToInt16(v_1_0.AuxInt) |
| v.Reset(ssaop.OpAdd16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Sub16 (Const16 <t> [c]) (Add16 (Const16 <t> [d]) x)) |
| // result: (Sub16 (Const16 <t> [c-d]) x) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAdd16 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst16 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpSub16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpSub32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Sub32 (Const32 [c]) (Const32 [d])) |
| // result: (Const32 [c-d]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(c - d) |
| return true |
| } |
| // match: (Sub32 x (Const32 <t> [c])) |
| // cond: x.Op != ssaop.OpConst32 |
| // result: (Add32 (Const32 <t> [-c]) x) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_1.Type |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(x.Op != ssaop.OpConst32) { |
| break |
| } |
| v.Reset(ssaop.OpAdd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(-c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Sub32 <t> (Mul32 x y) (Mul32 x z)) |
| // result: (Mul32 x (Sub32 <t> y z)) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpMul32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if v_1.Op != ssaop.OpMul32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| z := v_1_1 |
| v.Reset(ssaop.OpMul32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, t) |
| v0.AddArg2(y, z) |
| v.AddArg2(x, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Sub32 x x) |
| // result: (Const32 [0]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Sub32 (Neg32 x) (Com32 x)) |
| // result: (Const32 [1]) |
| for { |
| if v_0.Op != ssaop.OpNeg32 { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpCom32 || x != v_1.Args[0] { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(1) |
| return true |
| } |
| // match: (Sub32 (Com32 x) (Neg32 x)) |
| // result: (Const32 [-1]) |
| for { |
| if v_0.Op != ssaop.OpCom32 { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpNeg32 || x != v_1.Args[0] { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(-1) |
| return true |
| } |
| // match: (Sub32 (Add32 t x) (Add32 t y)) |
| // result: (Sub32 x y) |
| for { |
| if v_0.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| t := v_0_0 |
| x := v_0_1 |
| if v_1.Op != ssaop.OpAdd32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if t != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpSub32) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Sub32 x (And32 <t> x y)) |
| // result: (And32 x (Com32 <t> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd32 { |
| break |
| } |
| t := v_1.Type |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpAnd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCom32, t) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Sub32 (Add32 x y) x) |
| // result: y |
| for { |
| if v_0.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if x != v_1 { |
| continue |
| } |
| v.CopyOf(y) |
| return true |
| } |
| break |
| } |
| // match: (Sub32 (Add32 x y) y) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if y != v_1 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Sub32 (Sub32 x y) x) |
| // result: (Neg32 y) |
| for { |
| if v_0.Op != ssaop.OpSub32 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpNeg32) |
| v.AddArg(y) |
| return true |
| } |
| // match: (Sub32 x (Add32 x y)) |
| // result: (Neg32 y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpNeg32) |
| v.AddArg(y) |
| return true |
| } |
| break |
| } |
| // match: (Sub32 x (Sub32 i:(Const32 <t>) z)) |
| // cond: (z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) |
| // result: (Sub32 (Add32 <t> x z) i) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub32 { |
| break |
| } |
| z := v_1.Args[1] |
| i := v_1.Args[0] |
| if i.Op != ssaop.OpConst32 { |
| break |
| } |
| t := i.Type |
| if !(z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) { |
| break |
| } |
| v.Reset(ssaop.OpSub32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd32, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(v0, i) |
| return true |
| } |
| // match: (Sub32 x (Add32 z i:(Const32 <t>))) |
| // cond: (z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) |
| // result: (Sub32 (Sub32 <t> x z) i) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| z := v_1_0 |
| i := v_1_1 |
| if i.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := i.Type |
| if !(z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) { |
| continue |
| } |
| v.Reset(ssaop.OpSub32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(v0, i) |
| return true |
| } |
| break |
| } |
| // match: (Sub32 (Sub32 i:(Const32 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) |
| // result: (Sub32 i (Add32 <t> z x)) |
| for { |
| if v_0.Op != ssaop.OpSub32 { |
| break |
| } |
| z := v_0.Args[1] |
| i := v_0.Args[0] |
| if i.Op != ssaop.OpConst32 { |
| break |
| } |
| t := i.Type |
| x := v_1 |
| if !(z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) { |
| break |
| } |
| v.Reset(ssaop.OpSub32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd32, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| // match: (Sub32 (Add32 z i:(Const32 <t>)) x) |
| // cond: (z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) |
| // result: (Add32 i (Sub32 <t> z x)) |
| for { |
| if v_0.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| z := v_0_0 |
| i := v_0_1 |
| if i.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := i.Type |
| x := v_1 |
| if !(z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub32, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| break |
| } |
| // match: (Sub32 (Const32 <t> [c]) (Sub32 (Const32 <t> [d]) x)) |
| // result: (Add32 (Const32 <t> [c-d]) x) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpSub32 { |
| break |
| } |
| x := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst32 || v_1_0.Type != t { |
| break |
| } |
| d := ssa.AuxIntToInt32(v_1_0.AuxInt) |
| v.Reset(ssaop.OpAdd32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Sub32 (Const32 <t> [c]) (Add32 (Const32 <t> [d]) x)) |
| // result: (Sub32 (Const32 <t> [c-d]) x) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAdd32 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst32 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpSub32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpSub32F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Sub32F (Const32F [c]) (Const32F [d])) |
| // cond: c-d == c-d |
| // result: (Const32F [c-d]) |
| for { |
| if v_0.Op != ssaop.OpConst32F { |
| break |
| } |
| c := ssa.AuxIntToFloat32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32F { |
| break |
| } |
| d := ssa.AuxIntToFloat32(v_1.AuxInt) |
| if !(c-d == c-d) { |
| break |
| } |
| v.Reset(ssaop.OpConst32F) |
| v.AuxInt = ssa.Float32ToAuxInt(c - d) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSub64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Sub64 (Const64 [c]) (Const64 [d])) |
| // result: (Const64 [c-d]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(c - d) |
| return true |
| } |
| // match: (Sub64 x (Const64 <t> [c])) |
| // cond: x.Op != ssaop.OpConst64 |
| // result: (Add64 (Const64 <t> [-c]) x) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_1.Type |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(x.Op != ssaop.OpConst64) { |
| break |
| } |
| v.Reset(ssaop.OpAdd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(-c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Sub64 <t> (Mul64 x y) (Mul64 x z)) |
| // result: (Mul64 x (Sub64 <t> y z)) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpMul64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if v_1.Op != ssaop.OpMul64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| z := v_1_1 |
| v.Reset(ssaop.OpMul64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, t) |
| v0.AddArg2(y, z) |
| v.AddArg2(x, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Sub64 x x) |
| // result: (Const64 [0]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Sub64 (Neg64 x) (Com64 x)) |
| // result: (Const64 [1]) |
| for { |
| if v_0.Op != ssaop.OpNeg64 { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpCom64 || x != v_1.Args[0] { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(1) |
| return true |
| } |
| // match: (Sub64 (Com64 x) (Neg64 x)) |
| // result: (Const64 [-1]) |
| for { |
| if v_0.Op != ssaop.OpCom64 { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpNeg64 || x != v_1.Args[0] { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(-1) |
| return true |
| } |
| // match: (Sub64 (Add64 t x) (Add64 t y)) |
| // result: (Sub64 x y) |
| for { |
| if v_0.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| t := v_0_0 |
| x := v_0_1 |
| if v_1.Op != ssaop.OpAdd64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if t != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpSub64) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Sub64 x (And64 <t> x y)) |
| // result: (And64 x (Com64 <t> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd64 { |
| break |
| } |
| t := v_1.Type |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpAnd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCom64, t) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Sub64 (Add64 x y) x) |
| // result: y |
| for { |
| if v_0.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if x != v_1 { |
| continue |
| } |
| v.CopyOf(y) |
| return true |
| } |
| break |
| } |
| // match: (Sub64 (Add64 x y) y) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if y != v_1 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Sub64 (Sub64 x y) x) |
| // result: (Neg64 y) |
| for { |
| if v_0.Op != ssaop.OpSub64 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpNeg64) |
| v.AddArg(y) |
| return true |
| } |
| // match: (Sub64 x (Add64 x y)) |
| // result: (Neg64 y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpNeg64) |
| v.AddArg(y) |
| return true |
| } |
| break |
| } |
| // match: (Sub64 x (Sub64 i:(Const64 <t>) z)) |
| // cond: (z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) |
| // result: (Sub64 (Add64 <t> x z) i) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub64 { |
| break |
| } |
| z := v_1.Args[1] |
| i := v_1.Args[0] |
| if i.Op != ssaop.OpConst64 { |
| break |
| } |
| t := i.Type |
| if !(z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) { |
| break |
| } |
| v.Reset(ssaop.OpSub64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd64, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(v0, i) |
| return true |
| } |
| // match: (Sub64 x (Add64 z i:(Const64 <t>))) |
| // cond: (z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) |
| // result: (Sub64 (Sub64 <t> x z) i) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| z := v_1_0 |
| i := v_1_1 |
| if i.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := i.Type |
| if !(z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) { |
| continue |
| } |
| v.Reset(ssaop.OpSub64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(v0, i) |
| return true |
| } |
| break |
| } |
| // match: (Sub64 (Sub64 i:(Const64 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) |
| // result: (Sub64 i (Add64 <t> z x)) |
| for { |
| if v_0.Op != ssaop.OpSub64 { |
| break |
| } |
| z := v_0.Args[1] |
| i := v_0.Args[0] |
| if i.Op != ssaop.OpConst64 { |
| break |
| } |
| t := i.Type |
| x := v_1 |
| if !(z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) { |
| break |
| } |
| v.Reset(ssaop.OpSub64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd64, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| // match: (Sub64 (Add64 z i:(Const64 <t>)) x) |
| // cond: (z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) |
| // result: (Add64 i (Sub64 <t> z x)) |
| for { |
| if v_0.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| z := v_0_0 |
| i := v_0_1 |
| if i.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := i.Type |
| x := v_1 |
| if !(z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub64, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| break |
| } |
| // match: (Sub64 (Const64 <t> [c]) (Sub64 (Const64 <t> [d]) x)) |
| // result: (Add64 (Const64 <t> [c-d]) x) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpSub64 { |
| break |
| } |
| x := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst64 || v_1_0.Type != t { |
| break |
| } |
| d := ssa.AuxIntToInt64(v_1_0.AuxInt) |
| v.Reset(ssaop.OpAdd64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Sub64 (Const64 <t> [c]) (Add64 (Const64 <t> [d]) x)) |
| // result: (Sub64 (Const64 <t> [c-d]) x) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAdd64 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst64 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpSub64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpSub64F(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| // match: (Sub64F (Const64F [c]) (Const64F [d])) |
| // cond: c-d == c-d |
| // result: (Const64F [c-d]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64F { |
| break |
| } |
| d := ssa.AuxIntToFloat64(v_1.AuxInt) |
| if !(c-d == c-d) { |
| break |
| } |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(c - d) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSub64borrow(v *ssa.Value) bool { |
| v_2 := v.Args[2] |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Sub64borrow (Const64 <t> [x]) (Const64 [y]) (Const64 [borrowVal])) |
| // cond: borrowVal >= 0 && borrowVal <= 1 |
| // result: (MakeTuple (Const64 <t> [bitsSub64(x, y, borrowVal).diff]) (Const64 <t> [bitsSub64(x, y, borrowVal).borrow])) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| t := v_0.Type |
| x := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| break |
| } |
| y := ssa.AuxIntToInt64(v_1.AuxInt) |
| if v_2.Op != ssaop.OpConst64 { |
| break |
| } |
| borrowVal := ssa.AuxIntToInt64(v_2.AuxInt) |
| if !(borrowVal >= 0 && borrowVal <= 1) { |
| break |
| } |
| v.Reset(ssaop.OpMakeTuple) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(bitsSub64(x, y, borrowVal).diff) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v1.AuxInt = ssa.Int64ToAuxInt(bitsSub64(x, y, borrowVal).borrow) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpSub8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Sub8 (Const8 [c]) (Const8 [d])) |
| // result: (Const8 [c-d]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(c - d) |
| return true |
| } |
| // match: (Sub8 x (Const8 <t> [c])) |
| // cond: x.Op != ssaop.OpConst8 |
| // result: (Add8 (Const8 <t> [-c]) x) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_1.Type |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(x.Op != ssaop.OpConst8) { |
| break |
| } |
| v.Reset(ssaop.OpAdd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(-c) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Sub8 <t> (Mul8 x y) (Mul8 x z)) |
| // result: (Mul8 x (Sub8 <t> y z)) |
| for { |
| t := v.Type |
| if v_0.Op != ssaop.OpMul8 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if v_1.Op != ssaop.OpMul8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| z := v_1_1 |
| v.Reset(ssaop.OpMul8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, t) |
| v0.AddArg2(y, z) |
| v.AddArg2(x, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Sub8 x x) |
| // result: (Const8 [0]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Sub8 (Neg8 x) (Com8 x)) |
| // result: (Const8 [1]) |
| for { |
| if v_0.Op != ssaop.OpNeg8 { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpCom8 || x != v_1.Args[0] { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(1) |
| return true |
| } |
| // match: (Sub8 (Com8 x) (Neg8 x)) |
| // result: (Const8 [-1]) |
| for { |
| if v_0.Op != ssaop.OpCom8 { |
| break |
| } |
| x := v_0.Args[0] |
| if v_1.Op != ssaop.OpNeg8 || x != v_1.Args[0] { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(-1) |
| return true |
| } |
| // match: (Sub8 (Add8 t x) (Add8 t y)) |
| // result: (Sub8 x y) |
| for { |
| if v_0.Op != ssaop.OpAdd8 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| t := v_0_0 |
| x := v_0_1 |
| if v_1.Op != ssaop.OpAdd8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if t != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpSub8) |
| v.AddArg2(x, y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Sub8 x (And8 <t> x y)) |
| // result: (And8 x (Com8 <t> y)) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAnd8 { |
| break |
| } |
| t := v_1.Type |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpAnd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCom8, t) |
| v0.AddArg(y) |
| v.AddArg2(x, v0) |
| return true |
| } |
| break |
| } |
| // match: (Sub8 (Add8 x y) x) |
| // result: y |
| for { |
| if v_0.Op != ssaop.OpAdd8 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if x != v_1 { |
| continue |
| } |
| v.CopyOf(y) |
| return true |
| } |
| break |
| } |
| // match: (Sub8 (Add8 x y) y) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpAdd8 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| x := v_0_0 |
| y := v_0_1 |
| if y != v_1 { |
| continue |
| } |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Sub8 (Sub8 x y) x) |
| // result: (Neg8 y) |
| for { |
| if v_0.Op != ssaop.OpSub8 { |
| break |
| } |
| y := v_0.Args[1] |
| x := v_0.Args[0] |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpNeg8) |
| v.AddArg(y) |
| return true |
| } |
| // match: (Sub8 x (Add8 x y)) |
| // result: (Neg8 y) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd8 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.Reset(ssaop.OpNeg8) |
| v.AddArg(y) |
| return true |
| } |
| break |
| } |
| // match: (Sub8 x (Sub8 i:(Const8 <t>) z)) |
| // cond: (z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) |
| // result: (Sub8 (Add8 <t> x z) i) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpSub8 { |
| break |
| } |
| z := v_1.Args[1] |
| i := v_1.Args[0] |
| if i.Op != ssaop.OpConst8 { |
| break |
| } |
| t := i.Type |
| if !(z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) { |
| break |
| } |
| v.Reset(ssaop.OpSub8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd8, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(v0, i) |
| return true |
| } |
| // match: (Sub8 x (Add8 z i:(Const8 <t>))) |
| // cond: (z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) |
| // result: (Sub8 (Sub8 <t> x z) i) |
| for { |
| x := v_0 |
| if v_1.Op != ssaop.OpAdd8 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| z := v_1_0 |
| i := v_1_1 |
| if i.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := i.Type |
| if !(z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) { |
| continue |
| } |
| v.Reset(ssaop.OpSub8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, t) |
| v0.AddArg2(x, z) |
| v.AddArg2(v0, i) |
| return true |
| } |
| break |
| } |
| // match: (Sub8 (Sub8 i:(Const8 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) |
| // result: (Sub8 i (Add8 <t> z x)) |
| for { |
| if v_0.Op != ssaop.OpSub8 { |
| break |
| } |
| z := v_0.Args[1] |
| i := v_0.Args[0] |
| if i.Op != ssaop.OpConst8 { |
| break |
| } |
| t := i.Type |
| x := v_1 |
| if !(z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) { |
| break |
| } |
| v.Reset(ssaop.OpSub8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpAdd8, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| // match: (Sub8 (Add8 z i:(Const8 <t>)) x) |
| // cond: (z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) |
| // result: (Add8 i (Sub8 <t> z x)) |
| for { |
| if v_0.Op != ssaop.OpAdd8 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| z := v_0_0 |
| i := v_0_1 |
| if i.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := i.Type |
| x := v_1 |
| if !(z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) { |
| continue |
| } |
| v.Reset(ssaop.OpAdd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpSub8, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| break |
| } |
| // match: (Sub8 (Const8 <t> [c]) (Sub8 (Const8 <t> [d]) x)) |
| // result: (Add8 (Const8 <t> [c-d]) x) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpSub8 { |
| break |
| } |
| x := v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| if v_1_0.Op != ssaop.OpConst8 || v_1_0.Type != t { |
| break |
| } |
| d := ssa.AuxIntToInt8(v_1_0.AuxInt) |
| v.Reset(ssaop.OpAdd8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| // match: (Sub8 (Const8 <t> [c]) (Add8 (Const8 <t> [d]) x)) |
| // result: (Sub8 (Const8 <t> [c-d]) x) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpAdd8 { |
| break |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst8 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpSub8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c - d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpTrunc(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Trunc (Const64F [c])) |
| // result: (Const64F [math.Trunc(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64F { |
| break |
| } |
| c := ssa.AuxIntToFloat64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64F) |
| v.AuxInt = ssa.Float64ToAuxInt(math.Trunc(c)) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpTrunc16to8(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Trunc16to8 (Const16 [c])) |
| // result: (Const8 [int8(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(int8(c)) |
| return true |
| } |
| // match: (Trunc16to8 (ZeroExt8to16 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to16 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Trunc16to8 (SignExt8to16 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpSignExt8to16 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Trunc16to8 (And16 (Const16 [y]) x)) |
| // cond: y&0xFF == 0xFF |
| // result: (Trunc16to8 x) |
| for { |
| if v_0.Op != ssaop.OpAnd16 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| y := ssa.AuxIntToInt16(v_0_0.AuxInt) |
| x := v_0_1 |
| if !(y&0xFF == 0xFF) { |
| continue |
| } |
| v.Reset(ssaop.OpTrunc16to8) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpTrunc32to16(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Trunc32to16 (Const32 [c])) |
| // result: (Const16 [int16(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(int16(c)) |
| return true |
| } |
| // match: (Trunc32to16 (ZeroExt8to32 x)) |
| // result: (ZeroExt8to16 x) |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to32 { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpZeroExt8to16) |
| v.AddArg(x) |
| return true |
| } |
| // match: (Trunc32to16 (ZeroExt16to32 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpZeroExt16to32 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Trunc32to16 (SignExt8to32 x)) |
| // result: (SignExt8to16 x) |
| for { |
| if v_0.Op != ssaop.OpSignExt8to32 { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpSignExt8to16) |
| v.AddArg(x) |
| return true |
| } |
| // match: (Trunc32to16 (SignExt16to32 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpSignExt16to32 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Trunc32to16 (And32 (Const32 [y]) x)) |
| // cond: y&0xFFFF == 0xFFFF |
| // result: (Trunc32to16 x) |
| for { |
| if v_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| y := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| x := v_0_1 |
| if !(y&0xFFFF == 0xFFFF) { |
| continue |
| } |
| v.Reset(ssaop.OpTrunc32to16) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpTrunc32to8(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Trunc32to8 (Const32 [c])) |
| // result: (Const8 [int8(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(int8(c)) |
| return true |
| } |
| // match: (Trunc32to8 (ZeroExt8to32 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to32 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Trunc32to8 (SignExt8to32 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpSignExt8to32 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Trunc32to8 (And32 (Const32 [y]) x)) |
| // cond: y&0xFF == 0xFF |
| // result: (Trunc32to8 x) |
| for { |
| if v_0.Op != ssaop.OpAnd32 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| y := ssa.AuxIntToInt32(v_0_0.AuxInt) |
| x := v_0_1 |
| if !(y&0xFF == 0xFF) { |
| continue |
| } |
| v.Reset(ssaop.OpTrunc32to8) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpTrunc64to16(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Trunc64to16 (Const64 [c])) |
| // result: (Const16 [int16(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(int16(c)) |
| return true |
| } |
| // match: (Trunc64to16 (ZeroExt8to64 x)) |
| // result: (ZeroExt8to16 x) |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpZeroExt8to16) |
| v.AddArg(x) |
| return true |
| } |
| // match: (Trunc64to16 (ZeroExt16to64 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpZeroExt16to64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Trunc64to16 (SignExt8to64 x)) |
| // result: (SignExt8to16 x) |
| for { |
| if v_0.Op != ssaop.OpSignExt8to64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpSignExt8to16) |
| v.AddArg(x) |
| return true |
| } |
| // match: (Trunc64to16 (SignExt16to64 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpSignExt16to64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Trunc64to16 (And64 (Const64 [y]) x)) |
| // cond: y&0xFFFF == 0xFFFF |
| // result: (Trunc64to16 x) |
| for { |
| if v_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| y := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| x := v_0_1 |
| if !(y&0xFFFF == 0xFFFF) { |
| continue |
| } |
| v.Reset(ssaop.OpTrunc64to16) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpTrunc64to32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Trunc64to32 (Const64 [c])) |
| // result: (Const32 [int32(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(c)) |
| return true |
| } |
| // match: (Trunc64to32 (ZeroExt8to64 x)) |
| // result: (ZeroExt8to32 x) |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpZeroExt8to32) |
| v.AddArg(x) |
| return true |
| } |
| // match: (Trunc64to32 (ZeroExt16to64 x)) |
| // result: (ZeroExt16to32 x) |
| for { |
| if v_0.Op != ssaop.OpZeroExt16to64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpZeroExt16to32) |
| v.AddArg(x) |
| return true |
| } |
| // match: (Trunc64to32 (ZeroExt32to64 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpZeroExt32to64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Trunc64to32 (SignExt8to64 x)) |
| // result: (SignExt8to32 x) |
| for { |
| if v_0.Op != ssaop.OpSignExt8to64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpSignExt8to32) |
| v.AddArg(x) |
| return true |
| } |
| // match: (Trunc64to32 (SignExt16to64 x)) |
| // result: (SignExt16to32 x) |
| for { |
| if v_0.Op != ssaop.OpSignExt16to64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.Reset(ssaop.OpSignExt16to32) |
| v.AddArg(x) |
| return true |
| } |
| // match: (Trunc64to32 (SignExt32to64 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpSignExt32to64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Trunc64to32 (And64 (Const64 [y]) x)) |
| // cond: y&0xFFFFFFFF == 0xFFFFFFFF |
| // result: (Trunc64to32 x) |
| for { |
| if v_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| y := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| x := v_0_1 |
| if !(y&0xFFFFFFFF == 0xFFFFFFFF) { |
| continue |
| } |
| v.Reset(ssaop.OpTrunc64to32) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpTrunc64to8(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (Trunc64to8 (Const64 [c])) |
| // result: (Const8 [int8(c)]) |
| for { |
| if v_0.Op != ssaop.OpConst64 { |
| break |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(int8(c)) |
| return true |
| } |
| // match: (Trunc64to8 (ZeroExt8to64 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpZeroExt8to64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Trunc64to8 (SignExt8to64 x)) |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpSignExt8to64 { |
| break |
| } |
| x := v_0.Args[0] |
| v.CopyOf(x) |
| return true |
| } |
| // match: (Trunc64to8 (And64 (Const64 [y]) x)) |
| // cond: y&0xFF == 0xFF |
| // result: (Trunc64to8 x) |
| for { |
| if v_0.Op != ssaop.OpAnd64 { |
| break |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 { |
| if v_0_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| y := ssa.AuxIntToInt64(v_0_0.AuxInt) |
| x := v_0_1 |
| if !(y&0xFF == 0xFF) { |
| continue |
| } |
| v.Reset(ssaop.OpTrunc64to8) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpXor16(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| typ := &b.Func.Config.Types |
| // match: (Xor16 (Const16 [c]) (Const16 [d])) |
| // result: (Const16 [c^d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(c ^ d) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 x x) |
| // result: (Const16 [0]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(0) |
| return true |
| } |
| // match: (Xor16 (Const16 [0]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != 0 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 (Com16 x) x) |
| // result: (Const16 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom16 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 (Const16 [-1]) x) |
| // result: (Com16 x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_1 |
| v.Reset(ssaop.OpCom16) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 x (Xor16 x y)) |
| // result: y |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpXor16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.CopyOf(y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Xor16 (Xor16 i:(Const16 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) |
| // result: (Xor16 i (Xor16 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpXor16 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst16 && x.Op != ssaop.OpConst16) { |
| continue |
| } |
| v.Reset(ssaop.OpXor16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpXor16, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Xor16 (Const16 <t> [c]) (Xor16 (Const16 <t> [d]) x)) |
| // result: (Xor16 (Const16 <t> [c^d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst16 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| if v_1.Op != ssaop.OpXor16 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst16 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt16(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpXor16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst16, t) |
| v0.AuxInt = ssa.Int16ToAuxInt(c ^ d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Xor16 (Lsh16x64 x z:(Const64 <t> [c])) (Rsh16Ux64 x (Const64 [d]))) |
| // cond: c < 16 && d == 16-c && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLsh16x64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| z := v_0.Args[1] |
| if z.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(z.AuxInt) |
| if v_1.Op != ssaop.OpRsh16Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c < 16 && d == 16-c && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 left:(Lsh16x64 x y) right:(Rsh16Ux64 x (Sub64 (Const64 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh16x64 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh16Ux64 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 left:(Lsh16x32 x y) right:(Rsh16Ux32 x (Sub32 (Const32 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh16x32 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh16Ux32 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 left:(Lsh16x16 x y) right:(Rsh16Ux16 x (Sub16 (Const16 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh16x16 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh16Ux16 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 left:(Lsh16x8 x y) right:(Rsh16Ux8 x (Sub8 (Const8 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh16x8 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh16Ux8 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 right:(Rsh16Ux64 x y) left:(Lsh16x64 x z:(Sub64 (Const64 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh16Ux64 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh16x64 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(z_0.AuxInt) != 16 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 right:(Rsh16Ux32 x y) left:(Lsh16x32 x z:(Sub32 (Const32 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh16Ux32 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh16x32 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(z_0.AuxInt) != 16 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 right:(Rsh16Ux16 x y) left:(Lsh16x16 x z:(Sub16 (Const16 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh16Ux16 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh16x16 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(z_0.AuxInt) != 16 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 right:(Rsh16Ux8 x y) left:(Lsh16x8 x z:(Sub8 (Const8 [16]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16) |
| // result: (RotateLeft16 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh16Ux8 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh16x8 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(z_0.AuxInt) != 16 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 16)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft16) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 (ZeroExt8to16 (CvtBoolToUint8 <cvtT> bool)) (Const16 [1])) |
| // cond: invertibleBool(bool.Op) |
| // result: (ZeroExt8to16 (CvtBoolToUint8 <cvtT> (Not <bool.Type> bool))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to16 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| cvtT := v_0_0.Type |
| bool := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(v_1.AuxInt) != 1 || !(invertibleBool(bool.Op)) { |
| continue |
| } |
| v.Reset(ssaop.OpZeroExt8to16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, cvtT) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (Xor16 (ZeroExt8to16 (CvtBoolToUint8 <cvtT> (Not bool))) (Const16 <constT> [c])) |
| // cond: c != 1 |
| // result: (Xor16 (ZeroExt8to16 (CvtBoolToUint8 <cvtT> bool)) (Const16 <constT> [c^1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to16 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| cvtT := v_0_0.Type |
| v_0_0_0 := v_0_0.Args[0] |
| if v_0_0_0.Op != ssaop.OpNot { |
| continue |
| } |
| bool := v_0_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst16 { |
| continue |
| } |
| constT := v_1.Type |
| c := ssa.AuxIntToInt16(v_1.AuxInt) |
| if !(c != 1) { |
| continue |
| } |
| v.Reset(ssaop.OpXor16) |
| v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to16, typ.UInt16) |
| v1 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, cvtT) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst16, constT) |
| v2.AuxInt = ssa.Int16ToAuxInt(c ^ 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpXor32(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| typ := &b.Func.Config.Types |
| // match: (Xor32 (Const32 [c]) (Const32 [d])) |
| // result: (Const32 [c^d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(c ^ d) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 x x) |
| // result: (Const32 [0]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(0) |
| return true |
| } |
| // match: (Xor32 (Const32 [0]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != 0 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 (Com32 x) x) |
| // result: (Const32 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom32 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 (Const32 [-1]) x) |
| // result: (Com32 x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_1 |
| v.Reset(ssaop.OpCom32) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 x (Xor32 x y)) |
| // result: y |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpXor32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.CopyOf(y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Xor32 (Xor32 i:(Const32 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) |
| // result: (Xor32 i (Xor32 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpXor32 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst32 && x.Op != ssaop.OpConst32) { |
| continue |
| } |
| v.Reset(ssaop.OpXor32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpXor32, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Xor32 (Const32 <t> [c]) (Xor32 (Const32 <t> [d]) x)) |
| // result: (Xor32 (Const32 <t> [c^d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst32 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| if v_1.Op != ssaop.OpXor32 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst32 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt32(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpXor32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst32, t) |
| v0.AuxInt = ssa.Int32ToAuxInt(c ^ d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Xor32 (Lsh32x64 x z:(Const64 <t> [c])) (Rsh32Ux64 x (Const64 [d]))) |
| // cond: c < 32 && d == 32-c && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLsh32x64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| z := v_0.Args[1] |
| if z.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(z.AuxInt) |
| if v_1.Op != ssaop.OpRsh32Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c < 32 && d == 32-c && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 left:(Lsh32x64 x y) right:(Rsh32Ux64 x (Sub64 (Const64 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh32x64 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh32Ux64 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 left:(Lsh32x32 x y) right:(Rsh32Ux32 x (Sub32 (Const32 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh32x32 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh32Ux32 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 left:(Lsh32x16 x y) right:(Rsh32Ux16 x (Sub16 (Const16 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh32x16 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh32Ux16 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 left:(Lsh32x8 x y) right:(Rsh32Ux8 x (Sub8 (Const8 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh32x8 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh32Ux8 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 right:(Rsh32Ux64 x y) left:(Lsh32x64 x z:(Sub64 (Const64 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh32Ux64 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh32x64 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(z_0.AuxInt) != 32 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 right:(Rsh32Ux32 x y) left:(Lsh32x32 x z:(Sub32 (Const32 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh32Ux32 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh32x32 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(z_0.AuxInt) != 32 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 right:(Rsh32Ux16 x y) left:(Lsh32x16 x z:(Sub16 (Const16 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh32Ux16 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh32x16 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(z_0.AuxInt) != 32 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 right:(Rsh32Ux8 x y) left:(Lsh32x8 x z:(Sub8 (Const8 [32]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32) |
| // result: (RotateLeft32 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh32Ux8 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh32x8 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(z_0.AuxInt) != 32 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 32)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft32) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 (ZeroExt8to32 (CvtBoolToUint8 <cvtT> bool)) (Const32 [1])) |
| // cond: invertibleBool(bool.Op) |
| // result: (ZeroExt8to32 (CvtBoolToUint8 <cvtT> (Not <bool.Type> bool))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to32 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| cvtT := v_0_0.Type |
| bool := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(v_1.AuxInt) != 1 || !(invertibleBool(bool.Op)) { |
| continue |
| } |
| v.Reset(ssaop.OpZeroExt8to32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, cvtT) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (Xor32 (ZeroExt8to32 (CvtBoolToUint8 <cvtT> (Not bool))) (Const32 <constT> [c])) |
| // cond: c != 1 |
| // result: (Xor32 (ZeroExt8to32 (CvtBoolToUint8 <cvtT> bool)) (Const32 <constT> [c^1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to32 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| cvtT := v_0_0.Type |
| v_0_0_0 := v_0_0.Args[0] |
| if v_0_0_0.Op != ssaop.OpNot { |
| continue |
| } |
| bool := v_0_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst32 { |
| continue |
| } |
| constT := v_1.Type |
| c := ssa.AuxIntToInt32(v_1.AuxInt) |
| if !(c != 1) { |
| continue |
| } |
| v.Reset(ssaop.OpXor32) |
| v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to32, typ.UInt32) |
| v1 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, cvtT) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst32, constT) |
| v2.AuxInt = ssa.Int32ToAuxInt(c ^ 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpXor64(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| typ := &b.Func.Config.Types |
| // match: (Xor64 (Const64 [c]) (Const64 [d])) |
| // result: (Const64 [c^d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(c ^ d) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 x x) |
| // result: (Const64 [0]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(0) |
| return true |
| } |
| // match: (Xor64 (Const64 [0]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 (Com64 x) x) |
| // result: (Const64 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom64 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 (Const64 [-1]) x) |
| // result: (Com64 x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_1 |
| v.Reset(ssaop.OpCom64) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 x (Xor64 x y)) |
| // result: y |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpXor64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.CopyOf(y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Xor64 (Xor64 i:(Const64 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) |
| // result: (Xor64 i (Xor64 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpXor64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst64 && x.Op != ssaop.OpConst64) { |
| continue |
| } |
| v.Reset(ssaop.OpXor64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpXor64, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Xor64 (Const64 <t> [c]) (Xor64 (Const64 <t> [d]) x)) |
| // result: (Xor64 (Const64 <t> [c^d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst64 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt64(v_0.AuxInt) |
| if v_1.Op != ssaop.OpXor64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst64 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpXor64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst64, t) |
| v0.AuxInt = ssa.Int64ToAuxInt(c ^ d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Xor64 (Lsh64x64 x z:(Const64 <t> [c])) (Rsh64Ux64 x (Const64 [d]))) |
| // cond: c < 64 && d == 64-c && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLsh64x64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| z := v_0.Args[1] |
| if z.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(z.AuxInt) |
| if v_1.Op != ssaop.OpRsh64Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c < 64 && d == 64-c && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 left:(Lsh64x64 x y) right:(Rsh64Ux64 x (Sub64 (Const64 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh64x64 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh64Ux64 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(right_1_0.AuxInt) != 64 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 left:(Lsh64x32 x y) right:(Rsh64Ux32 x (Sub32 (Const32 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh64x32 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh64Ux32 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(right_1_0.AuxInt) != 64 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 left:(Lsh64x16 x y) right:(Rsh64Ux16 x (Sub16 (Const16 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh64x16 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh64Ux16 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(right_1_0.AuxInt) != 64 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 left:(Lsh64x8 x y) right:(Rsh64Ux8 x (Sub8 (Const8 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh64x8 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh64Ux8 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(right_1_0.AuxInt) != 64 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 right:(Rsh64Ux64 x y) left:(Lsh64x64 x z:(Sub64 (Const64 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh64Ux64 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh64x64 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(z_0.AuxInt) != 64 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 right:(Rsh64Ux32 x y) left:(Lsh64x32 x z:(Sub32 (Const32 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh64Ux32 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh64x32 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(z_0.AuxInt) != 64 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 right:(Rsh64Ux16 x y) left:(Lsh64x16 x z:(Sub16 (Const16 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh64Ux16 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh64x16 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(z_0.AuxInt) != 64 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 right:(Rsh64Ux8 x y) left:(Lsh64x8 x z:(Sub8 (Const8 [64]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64) |
| // result: (RotateLeft64 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh64Ux8 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh64x8 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(z_0.AuxInt) != 64 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 64)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft64) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 (ZeroExt8to64 (CvtBoolToUint8 <cvtT> bool)) (Const64 [1])) |
| // cond: invertibleBool(bool.Op) |
| // result: (ZeroExt8to64 (CvtBoolToUint8 <cvtT> (Not <bool.Type> bool))) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to64 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| cvtT := v_0_0.Type |
| bool := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(v_1.AuxInt) != 1 || !(invertibleBool(bool.Op)) { |
| continue |
| } |
| v.Reset(ssaop.OpZeroExt8to64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, cvtT) |
| v1 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (Xor64 (ZeroExt8to64 (CvtBoolToUint8 <cvtT> (Not bool))) (Const64 <constT> [c])) |
| // cond: c != 1 |
| // result: (Xor64 (ZeroExt8to64 (CvtBoolToUint8 <cvtT> bool)) (Const64 <constT> [c^1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpZeroExt8to64 { |
| continue |
| } |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| cvtT := v_0_0.Type |
| v_0_0_0 := v_0_0.Args[0] |
| if v_0_0_0.Op != ssaop.OpNot { |
| continue |
| } |
| bool := v_0_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| constT := v_1.Type |
| c := ssa.AuxIntToInt64(v_1.AuxInt) |
| if !(c != 1) { |
| continue |
| } |
| v.Reset(ssaop.OpXor64) |
| v0 := b.NewValue0(v.Pos, ssaop.OpZeroExt8to64, typ.UInt64) |
| v1 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, cvtT) |
| v1.AddArg(bool) |
| v0.AddArg(v1) |
| v2 := b.NewValue0(v.Pos, ssaop.OpConst64, constT) |
| v2.AuxInt = ssa.Int64ToAuxInt(c ^ 1) |
| v.AddArg2(v0, v2) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpXor8(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| config := b.Func.Config |
| // match: (Xor8 (Const8 [c]) (Const8 [d])) |
| // result: (Const8 [c^d]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1.AuxInt) |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(c ^ d) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 x x) |
| // result: (Const8 [0]) |
| for { |
| x := v_0 |
| if x != v_1 { |
| break |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(0) |
| return true |
| } |
| // match: (Xor8 (Const8 [0]) x) |
| // result: x |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != 0 { |
| continue |
| } |
| x := v_1 |
| v.CopyOf(x) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 (Com8 x) x) |
| // result: (Const8 [-1]) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCom8 { |
| continue |
| } |
| x := v_0.Args[0] |
| if x != v_1 { |
| continue |
| } |
| v.Reset(ssaop.OpConst8) |
| v.AuxInt = ssa.Int8ToAuxInt(-1) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 (Const8 [-1]) x) |
| // result: (Com8 x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_0.AuxInt) != -1 { |
| continue |
| } |
| x := v_1 |
| v.Reset(ssaop.OpCom8) |
| v.AddArg(x) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 x (Xor8 x y)) |
| // result: y |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| x := v_0 |
| if v_1.Op != ssaop.OpXor8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if x != v_1_0 { |
| continue |
| } |
| y := v_1_1 |
| v.CopyOf(y) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Xor8 (Xor8 i:(Const8 <t>) z) x) |
| // cond: (z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) |
| // result: (Xor8 i (Xor8 <t> z x)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpXor8 { |
| continue |
| } |
| _ = v_0.Args[1] |
| v_0_0 := v_0.Args[0] |
| v_0_1 := v_0.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 { |
| i := v_0_0 |
| if i.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := i.Type |
| z := v_0_1 |
| x := v_1 |
| if !(z.Op != ssaop.OpConst8 && x.Op != ssaop.OpConst8) { |
| continue |
| } |
| v.Reset(ssaop.OpXor8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpXor8, t) |
| v0.AddArg2(z, x) |
| v.AddArg2(i, v0) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Xor8 (Const8 <t> [c]) (Xor8 (Const8 <t> [d]) x)) |
| // result: (Xor8 (Const8 <t> [c^d]) x) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpConst8 { |
| continue |
| } |
| t := v_0.Type |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| if v_1.Op != ssaop.OpXor8 { |
| continue |
| } |
| _ = v_1.Args[1] |
| v_1_0 := v_1.Args[0] |
| v_1_1 := v_1.Args[1] |
| for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 { |
| if v_1_0.Op != ssaop.OpConst8 || v_1_0.Type != t { |
| continue |
| } |
| d := ssa.AuxIntToInt8(v_1_0.AuxInt) |
| x := v_1_1 |
| v.Reset(ssaop.OpXor8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpConst8, t) |
| v0.AuxInt = ssa.Int8ToAuxInt(c ^ d) |
| v.AddArg2(v0, x) |
| return true |
| } |
| } |
| break |
| } |
| // match: (Xor8 (Lsh8x64 x z:(Const64 <t> [c])) (Rsh8Ux64 x (Const64 [d]))) |
| // cond: c < 8 && d == 8-c && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpLsh8x64 { |
| continue |
| } |
| _ = v_0.Args[1] |
| x := v_0.Args[0] |
| z := v_0.Args[1] |
| if z.Op != ssaop.OpConst64 { |
| continue |
| } |
| c := ssa.AuxIntToInt64(z.AuxInt) |
| if v_1.Op != ssaop.OpRsh8Ux64 { |
| continue |
| } |
| _ = v_1.Args[1] |
| if x != v_1.Args[0] { |
| continue |
| } |
| v_1_1 := v_1.Args[1] |
| if v_1_1.Op != ssaop.OpConst64 { |
| continue |
| } |
| d := ssa.AuxIntToInt64(v_1_1.AuxInt) |
| if !(c < 8 && d == 8-c && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 left:(Lsh8x64 x y) right:(Rsh8Ux64 x (Sub64 (Const64 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh8x64 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh8Ux64 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(right_1_0.AuxInt) != 8 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 left:(Lsh8x32 x y) right:(Rsh8Ux32 x (Sub32 (Const32 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh8x32 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh8Ux32 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(right_1_0.AuxInt) != 8 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 left:(Lsh8x16 x y) right:(Rsh8Ux16 x (Sub16 (Const16 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh8x16 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh8Ux16 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(right_1_0.AuxInt) != 8 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 left:(Lsh8x8 x y) right:(Rsh8Ux8 x (Sub8 (Const8 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x y) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| left := v_0 |
| if left.Op != ssaop.OpLsh8x8 { |
| continue |
| } |
| y := left.Args[1] |
| x := left.Args[0] |
| right := v_1 |
| if right.Op != ssaop.OpRsh8Ux8 { |
| continue |
| } |
| _ = right.Args[1] |
| if x != right.Args[0] { |
| continue |
| } |
| right_1 := right.Args[1] |
| if right_1.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = right_1.Args[1] |
| right_1_0 := right_1.Args[0] |
| if right_1_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(right_1_0.AuxInt) != 8 || y != right_1.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, y) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 right:(Rsh8Ux64 x y) left:(Lsh8x64 x z:(Sub64 (Const64 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh8Ux64 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh8x64 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub64 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst64 || ssa.AuxIntToInt64(z_0.AuxInt) != 8 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 right:(Rsh8Ux32 x y) left:(Lsh8x32 x z:(Sub32 (Const32 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh8Ux32 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh8x32 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub32 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst32 || ssa.AuxIntToInt32(z_0.AuxInt) != 8 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 right:(Rsh8Ux16 x y) left:(Lsh8x16 x z:(Sub16 (Const16 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh8Ux16 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh8x16 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub16 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst16 || ssa.AuxIntToInt16(z_0.AuxInt) != 8 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 right:(Rsh8Ux8 x y) left:(Lsh8x8 x z:(Sub8 (Const8 [8]) y))) |
| // cond: (ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8) |
| // result: (RotateLeft8 x z) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| right := v_0 |
| if right.Op != ssaop.OpRsh8Ux8 { |
| continue |
| } |
| y := right.Args[1] |
| x := right.Args[0] |
| left := v_1 |
| if left.Op != ssaop.OpLsh8x8 { |
| continue |
| } |
| _ = left.Args[1] |
| if x != left.Args[0] { |
| continue |
| } |
| z := left.Args[1] |
| if z.Op != ssaop.OpSub8 { |
| continue |
| } |
| _ = z.Args[1] |
| z_0 := z.Args[0] |
| if z_0.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(z_0.AuxInt) != 8 || y != z.Args[1] || !((ssa.ShiftIsBounded(left) || ssa.ShiftIsBounded(right)) && canRotate(config, 8)) { |
| continue |
| } |
| v.Reset(ssaop.OpRotateLeft8) |
| v.AddArg2(x, z) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 (CvtBoolToUint8 bool) (Const8 [1])) |
| // cond: invertibleBool(bool.Op) |
| // result: (CvtBoolToUint8 (Not <bool.Type> bool)) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| bool := v_0.Args[0] |
| if v_1.Op != ssaop.OpConst8 || ssa.AuxIntToInt8(v_1.AuxInt) != 1 || !(invertibleBool(bool.Op)) { |
| continue |
| } |
| v.Reset(ssaop.OpCvtBoolToUint8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpNot, bool.Type) |
| v0.AddArg(bool) |
| v.AddArg(v0) |
| return true |
| } |
| break |
| } |
| // match: (Xor8 (CvtBoolToUint8 <cvtT> (Not bool)) (Const8 <constT> [c])) |
| // cond: c != 1 |
| // result: (Xor8 (CvtBoolToUint8 <cvtT> bool) (Const8 <constT> [c^1])) |
| for { |
| for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 { |
| if v_0.Op != ssaop.OpCvtBoolToUint8 { |
| continue |
| } |
| cvtT := v_0.Type |
| v_0_0 := v_0.Args[0] |
| if v_0_0.Op != ssaop.OpNot { |
| continue |
| } |
| bool := v_0_0.Args[0] |
| if v_1.Op != ssaop.OpConst8 { |
| continue |
| } |
| constT := v_1.Type |
| c := ssa.AuxIntToInt8(v_1.AuxInt) |
| if !(c != 1) { |
| continue |
| } |
| v.Reset(ssaop.OpXor8) |
| v0 := b.NewValue0(v.Pos, ssaop.OpCvtBoolToUint8, cvtT) |
| v0.AddArg(bool) |
| v1 := b.NewValue0(v.Pos, ssaop.OpConst8, constT) |
| v1.AuxInt = ssa.Int8ToAuxInt(c ^ 1) |
| v.AddArg2(v0, v1) |
| return true |
| } |
| break |
| } |
| return false |
| } |
| func rewriteValue_OpZero(v *ssa.Value) bool { |
| v_1 := v.Args[1] |
| v_0 := v.Args[0] |
| b := v.Block |
| // match: (Zero (SelectN [0] call:(StaticLECall ___)) mem:(SelectN [1] call)) |
| // cond: isMalloc(call.Aux) |
| // result: mem |
| for { |
| if v_0.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(v_0.AuxInt) != 0 { |
| break |
| } |
| call := v_0.Args[0] |
| if call.Op != ssaop.OpStaticLECall { |
| break |
| } |
| mem := v_1 |
| if mem.Op != ssaop.OpSelectN || ssa.AuxIntToInt64(mem.AuxInt) != 1 || call != mem.Args[0] || !(isMalloc(call.Aux)) { |
| break |
| } |
| v.CopyOf(mem) |
| return true |
| } |
| // match: (Zero {t1} [n] p1 store:(Store {t2} (OffPtr [o2] p2) _ mem)) |
| // cond: ssa.IsSamePtr(p1, p2) && store.Uses == 1 && n >= o2 + t2.Size() && ssa.Clobber(store) |
| // result: (Zero {t1} [n] p1 mem) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t1 := ssa.AuxToType(v.Aux) |
| p1 := v_0 |
| store := v_1 |
| if store.Op != ssaop.OpStore { |
| break |
| } |
| t2 := ssa.AuxToType(store.Aux) |
| mem := store.Args[2] |
| store_0 := store.Args[0] |
| if store_0.Op != ssaop.OpOffPtr { |
| break |
| } |
| o2 := ssa.AuxIntToInt64(store_0.AuxInt) |
| p2 := store_0.Args[0] |
| if !(ssa.IsSamePtr(p1, p2) && store.Uses == 1 && n >= o2+t2.Size() && ssa.Clobber(store)) { |
| break |
| } |
| v.Reset(ssaop.OpZero) |
| v.AuxInt = ssa.Int64ToAuxInt(n) |
| v.Aux = ssa.TypeToAux(t1) |
| v.AddArg2(p1, mem) |
| return true |
| } |
| // match: (Zero {t} [n] dst1 move:(Move {t} [n] dst2 _ mem)) |
| // cond: move.Uses == 1 && ssa.IsSamePtr(dst1, dst2) && ssa.Clobber(move) |
| // result: (Zero {t} [n] dst1 mem) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t := ssa.AuxToType(v.Aux) |
| dst1 := v_0 |
| move := v_1 |
| if move.Op != ssaop.OpMove || ssa.AuxIntToInt64(move.AuxInt) != n || ssa.AuxToType(move.Aux) != t { |
| break |
| } |
| mem := move.Args[2] |
| dst2 := move.Args[0] |
| if !(move.Uses == 1 && ssa.IsSamePtr(dst1, dst2) && ssa.Clobber(move)) { |
| break |
| } |
| v.Reset(ssaop.OpZero) |
| v.AuxInt = ssa.Int64ToAuxInt(n) |
| v.Aux = ssa.TypeToAux(t) |
| v.AddArg2(dst1, mem) |
| return true |
| } |
| // match: (Zero {t} [n] dst1 vardef:(VarDef {x} move:(Move {t} [n] dst2 _ mem))) |
| // cond: move.Uses == 1 && vardef.Uses == 1 && ssa.IsSamePtr(dst1, dst2) && ssa.Clobber(move, vardef) |
| // result: (Zero {t} [n] dst1 (VarDef {x} mem)) |
| for { |
| n := ssa.AuxIntToInt64(v.AuxInt) |
| t := ssa.AuxToType(v.Aux) |
| dst1 := v_0 |
| vardef := v_1 |
| if vardef.Op != ssaop.OpVarDef { |
| break |
| } |
| x := ssa.AuxToSym(vardef.Aux) |
| move := vardef.Args[0] |
| if move.Op != ssaop.OpMove || ssa.AuxIntToInt64(move.AuxInt) != n || ssa.AuxToType(move.Aux) != t { |
| break |
| } |
| mem := move.Args[2] |
| dst2 := move.Args[0] |
| if !(move.Uses == 1 && vardef.Uses == 1 && ssa.IsSamePtr(dst1, dst2) && ssa.Clobber(move, vardef)) { |
| break |
| } |
| v.Reset(ssaop.OpZero) |
| v.AuxInt = ssa.Int64ToAuxInt(n) |
| v.Aux = ssa.TypeToAux(t) |
| v0 := b.NewValue0(v.Pos, ssaop.OpVarDef, types.TypeMem) |
| v0.Aux = ssa.SymToAux(x) |
| v0.AddArg(mem) |
| v.AddArg2(dst1, v0) |
| return true |
| } |
| // match: (Zero {t} [s] dst1 zero:(Zero {t} [s] dst2 _)) |
| // cond: ssa.IsSamePtr(dst1, dst2) |
| // result: zero |
| for { |
| s := ssa.AuxIntToInt64(v.AuxInt) |
| t := ssa.AuxToType(v.Aux) |
| dst1 := v_0 |
| zero := v_1 |
| if zero.Op != ssaop.OpZero || ssa.AuxIntToInt64(zero.AuxInt) != s || ssa.AuxToType(zero.Aux) != t { |
| break |
| } |
| dst2 := zero.Args[0] |
| if !(ssa.IsSamePtr(dst1, dst2)) { |
| break |
| } |
| v.CopyOf(zero) |
| return true |
| } |
| // match: (Zero {t} [s] dst1 vardef:(VarDef (Zero {t} [s] dst2 _))) |
| // cond: ssa.IsSamePtr(dst1, dst2) |
| // result: vardef |
| for { |
| s := ssa.AuxIntToInt64(v.AuxInt) |
| t := ssa.AuxToType(v.Aux) |
| dst1 := v_0 |
| vardef := v_1 |
| if vardef.Op != ssaop.OpVarDef { |
| break |
| } |
| vardef_0 := vardef.Args[0] |
| if vardef_0.Op != ssaop.OpZero || ssa.AuxIntToInt64(vardef_0.AuxInt) != s || ssa.AuxToType(vardef_0.Aux) != t { |
| break |
| } |
| dst2 := vardef_0.Args[0] |
| if !(ssa.IsSamePtr(dst1, dst2)) { |
| break |
| } |
| v.CopyOf(vardef) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpZeroExt16to32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (ZeroExt16to32 (Const16 [c])) |
| // result: (Const32 [int32(uint16(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(uint16(c))) |
| return true |
| } |
| // match: (ZeroExt16to32 (Trunc32to16 x:(Rsh32Ux64 _ (Const64 [s])))) |
| // cond: s >= 16 |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpTrunc32to16 { |
| break |
| } |
| x := v_0.Args[0] |
| if x.Op != ssaop.OpRsh32Ux64 { |
| break |
| } |
| _ = x.Args[1] |
| x_1 := x.Args[1] |
| if x_1.Op != ssaop.OpConst64 { |
| break |
| } |
| s := ssa.AuxIntToInt64(x_1.AuxInt) |
| if !(s >= 16) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpZeroExt16to64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (ZeroExt16to64 (Const16 [c])) |
| // result: (Const64 [int64(uint16(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst16 { |
| break |
| } |
| c := ssa.AuxIntToInt16(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(uint16(c))) |
| return true |
| } |
| // match: (ZeroExt16to64 (Trunc64to16 x:(Rsh64Ux64 _ (Const64 [s])))) |
| // cond: s >= 48 |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpTrunc64to16 { |
| break |
| } |
| x := v_0.Args[0] |
| if x.Op != ssaop.OpRsh64Ux64 { |
| break |
| } |
| _ = x.Args[1] |
| x_1 := x.Args[1] |
| if x_1.Op != ssaop.OpConst64 { |
| break |
| } |
| s := ssa.AuxIntToInt64(x_1.AuxInt) |
| if !(s >= 48) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpZeroExt32to64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (ZeroExt32to64 (Const32 [c])) |
| // result: (Const64 [int64(uint32(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst32 { |
| break |
| } |
| c := ssa.AuxIntToInt32(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(uint32(c))) |
| return true |
| } |
| // match: (ZeroExt32to64 (Trunc64to32 x:(Rsh64Ux64 _ (Const64 [s])))) |
| // cond: s >= 32 |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpTrunc64to32 { |
| break |
| } |
| x := v_0.Args[0] |
| if x.Op != ssaop.OpRsh64Ux64 { |
| break |
| } |
| _ = x.Args[1] |
| x_1 := x.Args[1] |
| if x_1.Op != ssaop.OpConst64 { |
| break |
| } |
| s := ssa.AuxIntToInt64(x_1.AuxInt) |
| if !(s >= 32) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpZeroExt8to16(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (ZeroExt8to16 (Const8 [c])) |
| // result: (Const16 [int16( uint8(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| v.Reset(ssaop.OpConst16) |
| v.AuxInt = ssa.Int16ToAuxInt(int16(uint8(c))) |
| return true |
| } |
| // match: (ZeroExt8to16 (Trunc16to8 x:(Rsh16Ux64 _ (Const64 [s])))) |
| // cond: s >= 8 |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpTrunc16to8 { |
| break |
| } |
| x := v_0.Args[0] |
| if x.Op != ssaop.OpRsh16Ux64 { |
| break |
| } |
| _ = x.Args[1] |
| x_1 := x.Args[1] |
| if x_1.Op != ssaop.OpConst64 { |
| break |
| } |
| s := ssa.AuxIntToInt64(x_1.AuxInt) |
| if !(s >= 8) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpZeroExt8to32(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (ZeroExt8to32 (Const8 [c])) |
| // result: (Const32 [int32( uint8(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| v.Reset(ssaop.OpConst32) |
| v.AuxInt = ssa.Int32ToAuxInt(int32(uint8(c))) |
| return true |
| } |
| // match: (ZeroExt8to32 (Trunc32to8 x:(Rsh32Ux64 _ (Const64 [s])))) |
| // cond: s >= 24 |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpTrunc32to8 { |
| break |
| } |
| x := v_0.Args[0] |
| if x.Op != ssaop.OpRsh32Ux64 { |
| break |
| } |
| _ = x.Args[1] |
| x_1 := x.Args[1] |
| if x_1.Op != ssaop.OpConst64 { |
| break |
| } |
| s := ssa.AuxIntToInt64(x_1.AuxInt) |
| if !(s >= 24) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func rewriteValue_OpZeroExt8to64(v *ssa.Value) bool { |
| v_0 := v.Args[0] |
| // match: (ZeroExt8to64 (Const8 [c])) |
| // result: (Const64 [int64( uint8(c))]) |
| for { |
| if v_0.Op != ssaop.OpConst8 { |
| break |
| } |
| c := ssa.AuxIntToInt8(v_0.AuxInt) |
| v.Reset(ssaop.OpConst64) |
| v.AuxInt = ssa.Int64ToAuxInt(int64(uint8(c))) |
| return true |
| } |
| // match: (ZeroExt8to64 (Trunc64to8 x:(Rsh64Ux64 _ (Const64 [s])))) |
| // cond: s >= 56 |
| // result: x |
| for { |
| if v_0.Op != ssaop.OpTrunc64to8 { |
| break |
| } |
| x := v_0.Args[0] |
| if x.Op != ssaop.OpRsh64Ux64 { |
| break |
| } |
| _ = x.Args[1] |
| x_1 := x.Args[1] |
| if x_1.Op != ssaop.OpConst64 { |
| break |
| } |
| s := ssa.AuxIntToInt64(x_1.AuxInt) |
| if !(s >= 56) { |
| break |
| } |
| v.CopyOf(x) |
| return true |
| } |
| return false |
| } |
| func RewriteBlock(b *ssa.Block) bool { |
| switch b.Kind { |
| case block.BlockIf: |
| // match: (If (Not cond) yes no) |
| // result: (If cond no yes) |
| for b.Controls[0].Op == ssaop.OpNot { |
| v_0 := b.Controls[0] |
| cond := v_0.Args[0] |
| b.ResetWithControl(block.BlockIf, cond) |
| b.SwapSuccessors() |
| return true |
| } |
| // match: (If (ConstBool [c]) yes no) |
| // cond: c |
| // result: (First yes no) |
| for b.Controls[0].Op == ssaop.OpConstBool { |
| v_0 := b.Controls[0] |
| c := ssa.AuxIntToBool(v_0.AuxInt) |
| if !(c) { |
| break |
| } |
| b.Reset(block.BlockFirst) |
| return true |
| } |
| // match: (If (ConstBool [c]) yes no) |
| // cond: !c |
| // result: (First no yes) |
| for b.Controls[0].Op == ssaop.OpConstBool { |
| v_0 := b.Controls[0] |
| c := ssa.AuxIntToBool(v_0.AuxInt) |
| if !(!c) { |
| break |
| } |
| b.Reset(block.BlockFirst) |
| b.SwapSuccessors() |
| return true |
| } |
| } |
| return false |
| } |