blob: eda37e787ed36ba188060a5b0a5bd3c7af905dc3 [file] [log] [blame]
// autogenerated from gen/386.rules: do not edit!
// generated with: cd gen; go run *.go
package ssa
import "math"
var _ = math.MinInt8 // in case not otherwise used
func rewriteValue386(v *Value, config *Config) bool {
switch v.Op {
case Op386ADCL:
return rewriteValue386_Op386ADCL(v, config)
case Op386ADDL:
return rewriteValue386_Op386ADDL(v, config)
case Op386ADDLcarry:
return rewriteValue386_Op386ADDLcarry(v, config)
case Op386ADDLconst:
return rewriteValue386_Op386ADDLconst(v, config)
case Op386ANDL:
return rewriteValue386_Op386ANDL(v, config)
case Op386ANDLconst:
return rewriteValue386_Op386ANDLconst(v, config)
case Op386CMPB:
return rewriteValue386_Op386CMPB(v, config)
case Op386CMPBconst:
return rewriteValue386_Op386CMPBconst(v, config)
case Op386CMPL:
return rewriteValue386_Op386CMPL(v, config)
case Op386CMPLconst:
return rewriteValue386_Op386CMPLconst(v, config)
case Op386CMPW:
return rewriteValue386_Op386CMPW(v, config)
case Op386CMPWconst:
return rewriteValue386_Op386CMPWconst(v, config)
case Op386LEAL:
return rewriteValue386_Op386LEAL(v, config)
case Op386LEAL1:
return rewriteValue386_Op386LEAL1(v, config)
case Op386LEAL2:
return rewriteValue386_Op386LEAL2(v, config)
case Op386LEAL4:
return rewriteValue386_Op386LEAL4(v, config)
case Op386LEAL8:
return rewriteValue386_Op386LEAL8(v, config)
case Op386MOVBLSX:
return rewriteValue386_Op386MOVBLSX(v, config)
case Op386MOVBLSXload:
return rewriteValue386_Op386MOVBLSXload(v, config)
case Op386MOVBLZX:
return rewriteValue386_Op386MOVBLZX(v, config)
case Op386MOVBload:
return rewriteValue386_Op386MOVBload(v, config)
case Op386MOVBloadidx1:
return rewriteValue386_Op386MOVBloadidx1(v, config)
case Op386MOVBstore:
return rewriteValue386_Op386MOVBstore(v, config)
case Op386MOVBstoreconst:
return rewriteValue386_Op386MOVBstoreconst(v, config)
case Op386MOVBstoreconstidx1:
return rewriteValue386_Op386MOVBstoreconstidx1(v, config)
case Op386MOVBstoreidx1:
return rewriteValue386_Op386MOVBstoreidx1(v, config)
case Op386MOVLload:
return rewriteValue386_Op386MOVLload(v, config)
case Op386MOVLloadidx1:
return rewriteValue386_Op386MOVLloadidx1(v, config)
case Op386MOVLloadidx4:
return rewriteValue386_Op386MOVLloadidx4(v, config)
case Op386MOVLstore:
return rewriteValue386_Op386MOVLstore(v, config)
case Op386MOVLstoreconst:
return rewriteValue386_Op386MOVLstoreconst(v, config)
case Op386MOVLstoreconstidx1:
return rewriteValue386_Op386MOVLstoreconstidx1(v, config)
case Op386MOVLstoreconstidx4:
return rewriteValue386_Op386MOVLstoreconstidx4(v, config)
case Op386MOVLstoreidx1:
return rewriteValue386_Op386MOVLstoreidx1(v, config)
case Op386MOVLstoreidx4:
return rewriteValue386_Op386MOVLstoreidx4(v, config)
case Op386MOVSDconst:
return rewriteValue386_Op386MOVSDconst(v, config)
case Op386MOVSDload:
return rewriteValue386_Op386MOVSDload(v, config)
case Op386MOVSDloadidx1:
return rewriteValue386_Op386MOVSDloadidx1(v, config)
case Op386MOVSDloadidx8:
return rewriteValue386_Op386MOVSDloadidx8(v, config)
case Op386MOVSDstore:
return rewriteValue386_Op386MOVSDstore(v, config)
case Op386MOVSDstoreidx1:
return rewriteValue386_Op386MOVSDstoreidx1(v, config)
case Op386MOVSDstoreidx8:
return rewriteValue386_Op386MOVSDstoreidx8(v, config)
case Op386MOVSSconst:
return rewriteValue386_Op386MOVSSconst(v, config)
case Op386MOVSSload:
return rewriteValue386_Op386MOVSSload(v, config)
case Op386MOVSSloadidx1:
return rewriteValue386_Op386MOVSSloadidx1(v, config)
case Op386MOVSSloadidx4:
return rewriteValue386_Op386MOVSSloadidx4(v, config)
case Op386MOVSSstore:
return rewriteValue386_Op386MOVSSstore(v, config)
case Op386MOVSSstoreidx1:
return rewriteValue386_Op386MOVSSstoreidx1(v, config)
case Op386MOVSSstoreidx4:
return rewriteValue386_Op386MOVSSstoreidx4(v, config)
case Op386MOVWLSX:
return rewriteValue386_Op386MOVWLSX(v, config)
case Op386MOVWLSXload:
return rewriteValue386_Op386MOVWLSXload(v, config)
case Op386MOVWLZX:
return rewriteValue386_Op386MOVWLZX(v, config)
case Op386MOVWload:
return rewriteValue386_Op386MOVWload(v, config)
case Op386MOVWloadidx1:
return rewriteValue386_Op386MOVWloadidx1(v, config)
case Op386MOVWloadidx2:
return rewriteValue386_Op386MOVWloadidx2(v, config)
case Op386MOVWstore:
return rewriteValue386_Op386MOVWstore(v, config)
case Op386MOVWstoreconst:
return rewriteValue386_Op386MOVWstoreconst(v, config)
case Op386MOVWstoreconstidx1:
return rewriteValue386_Op386MOVWstoreconstidx1(v, config)
case Op386MOVWstoreconstidx2:
return rewriteValue386_Op386MOVWstoreconstidx2(v, config)
case Op386MOVWstoreidx1:
return rewriteValue386_Op386MOVWstoreidx1(v, config)
case Op386MOVWstoreidx2:
return rewriteValue386_Op386MOVWstoreidx2(v, config)
case Op386MULL:
return rewriteValue386_Op386MULL(v, config)
case Op386MULLconst:
return rewriteValue386_Op386MULLconst(v, config)
case Op386NEGL:
return rewriteValue386_Op386NEGL(v, config)
case Op386NOTL:
return rewriteValue386_Op386NOTL(v, config)
case Op386ORL:
return rewriteValue386_Op386ORL(v, config)
case Op386ORLconst:
return rewriteValue386_Op386ORLconst(v, config)
case Op386ROLBconst:
return rewriteValue386_Op386ROLBconst(v, config)
case Op386ROLLconst:
return rewriteValue386_Op386ROLLconst(v, config)
case Op386ROLWconst:
return rewriteValue386_Op386ROLWconst(v, config)
case Op386SARB:
return rewriteValue386_Op386SARB(v, config)
case Op386SARBconst:
return rewriteValue386_Op386SARBconst(v, config)
case Op386SARL:
return rewriteValue386_Op386SARL(v, config)
case Op386SARLconst:
return rewriteValue386_Op386SARLconst(v, config)
case Op386SARW:
return rewriteValue386_Op386SARW(v, config)
case Op386SARWconst:
return rewriteValue386_Op386SARWconst(v, config)
case Op386SBBL:
return rewriteValue386_Op386SBBL(v, config)
case Op386SBBLcarrymask:
return rewriteValue386_Op386SBBLcarrymask(v, config)
case Op386SETA:
return rewriteValue386_Op386SETA(v, config)
case Op386SETAE:
return rewriteValue386_Op386SETAE(v, config)
case Op386SETB:
return rewriteValue386_Op386SETB(v, config)
case Op386SETBE:
return rewriteValue386_Op386SETBE(v, config)
case Op386SETEQ:
return rewriteValue386_Op386SETEQ(v, config)
case Op386SETG:
return rewriteValue386_Op386SETG(v, config)
case Op386SETGE:
return rewriteValue386_Op386SETGE(v, config)
case Op386SETL:
return rewriteValue386_Op386SETL(v, config)
case Op386SETLE:
return rewriteValue386_Op386SETLE(v, config)
case Op386SETNE:
return rewriteValue386_Op386SETNE(v, config)
case Op386SHLL:
return rewriteValue386_Op386SHLL(v, config)
case Op386SHRB:
return rewriteValue386_Op386SHRB(v, config)
case Op386SHRL:
return rewriteValue386_Op386SHRL(v, config)
case Op386SHRW:
return rewriteValue386_Op386SHRW(v, config)
case Op386SUBL:
return rewriteValue386_Op386SUBL(v, config)
case Op386SUBLcarry:
return rewriteValue386_Op386SUBLcarry(v, config)
case Op386SUBLconst:
return rewriteValue386_Op386SUBLconst(v, config)
case Op386XORL:
return rewriteValue386_Op386XORL(v, config)
case Op386XORLconst:
return rewriteValue386_Op386XORLconst(v, config)
case OpAdd16:
return rewriteValue386_OpAdd16(v, config)
case OpAdd32:
return rewriteValue386_OpAdd32(v, config)
case OpAdd32F:
return rewriteValue386_OpAdd32F(v, config)
case OpAdd32carry:
return rewriteValue386_OpAdd32carry(v, config)
case OpAdd32withcarry:
return rewriteValue386_OpAdd32withcarry(v, config)
case OpAdd64F:
return rewriteValue386_OpAdd64F(v, config)
case OpAdd8:
return rewriteValue386_OpAdd8(v, config)
case OpAddPtr:
return rewriteValue386_OpAddPtr(v, config)
case OpAddr:
return rewriteValue386_OpAddr(v, config)
case OpAnd16:
return rewriteValue386_OpAnd16(v, config)
case OpAnd32:
return rewriteValue386_OpAnd32(v, config)
case OpAnd8:
return rewriteValue386_OpAnd8(v, config)
case OpAndB:
return rewriteValue386_OpAndB(v, config)
case OpBswap32:
return rewriteValue386_OpBswap32(v, config)
case OpClosureCall:
return rewriteValue386_OpClosureCall(v, config)
case OpCom16:
return rewriteValue386_OpCom16(v, config)
case OpCom32:
return rewriteValue386_OpCom32(v, config)
case OpCom8:
return rewriteValue386_OpCom8(v, config)
case OpConst16:
return rewriteValue386_OpConst16(v, config)
case OpConst32:
return rewriteValue386_OpConst32(v, config)
case OpConst32F:
return rewriteValue386_OpConst32F(v, config)
case OpConst64F:
return rewriteValue386_OpConst64F(v, config)
case OpConst8:
return rewriteValue386_OpConst8(v, config)
case OpConstBool:
return rewriteValue386_OpConstBool(v, config)
case OpConstNil:
return rewriteValue386_OpConstNil(v, config)
case OpConvert:
return rewriteValue386_OpConvert(v, config)
case OpCvt32Fto32:
return rewriteValue386_OpCvt32Fto32(v, config)
case OpCvt32Fto64F:
return rewriteValue386_OpCvt32Fto64F(v, config)
case OpCvt32to32F:
return rewriteValue386_OpCvt32to32F(v, config)
case OpCvt32to64F:
return rewriteValue386_OpCvt32to64F(v, config)
case OpCvt64Fto32:
return rewriteValue386_OpCvt64Fto32(v, config)
case OpCvt64Fto32F:
return rewriteValue386_OpCvt64Fto32F(v, config)
case OpDeferCall:
return rewriteValue386_OpDeferCall(v, config)
case OpDiv16:
return rewriteValue386_OpDiv16(v, config)
case OpDiv16u:
return rewriteValue386_OpDiv16u(v, config)
case OpDiv32:
return rewriteValue386_OpDiv32(v, config)
case OpDiv32F:
return rewriteValue386_OpDiv32F(v, config)
case OpDiv32u:
return rewriteValue386_OpDiv32u(v, config)
case OpDiv64F:
return rewriteValue386_OpDiv64F(v, config)
case OpDiv8:
return rewriteValue386_OpDiv8(v, config)
case OpDiv8u:
return rewriteValue386_OpDiv8u(v, config)
case OpEq16:
return rewriteValue386_OpEq16(v, config)
case OpEq32:
return rewriteValue386_OpEq32(v, config)
case OpEq32F:
return rewriteValue386_OpEq32F(v, config)
case OpEq64F:
return rewriteValue386_OpEq64F(v, config)
case OpEq8:
return rewriteValue386_OpEq8(v, config)
case OpEqB:
return rewriteValue386_OpEqB(v, config)
case OpEqPtr:
return rewriteValue386_OpEqPtr(v, config)
case OpGeq16:
return rewriteValue386_OpGeq16(v, config)
case OpGeq16U:
return rewriteValue386_OpGeq16U(v, config)
case OpGeq32:
return rewriteValue386_OpGeq32(v, config)
case OpGeq32F:
return rewriteValue386_OpGeq32F(v, config)
case OpGeq32U:
return rewriteValue386_OpGeq32U(v, config)
case OpGeq64F:
return rewriteValue386_OpGeq64F(v, config)
case OpGeq8:
return rewriteValue386_OpGeq8(v, config)
case OpGeq8U:
return rewriteValue386_OpGeq8U(v, config)
case OpGetClosurePtr:
return rewriteValue386_OpGetClosurePtr(v, config)
case OpGetG:
return rewriteValue386_OpGetG(v, config)
case OpGoCall:
return rewriteValue386_OpGoCall(v, config)
case OpGreater16:
return rewriteValue386_OpGreater16(v, config)
case OpGreater16U:
return rewriteValue386_OpGreater16U(v, config)
case OpGreater32:
return rewriteValue386_OpGreater32(v, config)
case OpGreater32F:
return rewriteValue386_OpGreater32F(v, config)
case OpGreater32U:
return rewriteValue386_OpGreater32U(v, config)
case OpGreater64F:
return rewriteValue386_OpGreater64F(v, config)
case OpGreater8:
return rewriteValue386_OpGreater8(v, config)
case OpGreater8U:
return rewriteValue386_OpGreater8U(v, config)
case OpHmul16:
return rewriteValue386_OpHmul16(v, config)
case OpHmul16u:
return rewriteValue386_OpHmul16u(v, config)
case OpHmul32:
return rewriteValue386_OpHmul32(v, config)
case OpHmul32u:
return rewriteValue386_OpHmul32u(v, config)
case OpHmul8:
return rewriteValue386_OpHmul8(v, config)
case OpHmul8u:
return rewriteValue386_OpHmul8u(v, config)
case OpInterCall:
return rewriteValue386_OpInterCall(v, config)
case OpIsInBounds:
return rewriteValue386_OpIsInBounds(v, config)
case OpIsNonNil:
return rewriteValue386_OpIsNonNil(v, config)
case OpIsSliceInBounds:
return rewriteValue386_OpIsSliceInBounds(v, config)
case OpLeq16:
return rewriteValue386_OpLeq16(v, config)
case OpLeq16U:
return rewriteValue386_OpLeq16U(v, config)
case OpLeq32:
return rewriteValue386_OpLeq32(v, config)
case OpLeq32F:
return rewriteValue386_OpLeq32F(v, config)
case OpLeq32U:
return rewriteValue386_OpLeq32U(v, config)
case OpLeq64F:
return rewriteValue386_OpLeq64F(v, config)
case OpLeq8:
return rewriteValue386_OpLeq8(v, config)
case OpLeq8U:
return rewriteValue386_OpLeq8U(v, config)
case OpLess16:
return rewriteValue386_OpLess16(v, config)
case OpLess16U:
return rewriteValue386_OpLess16U(v, config)
case OpLess32:
return rewriteValue386_OpLess32(v, config)
case OpLess32F:
return rewriteValue386_OpLess32F(v, config)
case OpLess32U:
return rewriteValue386_OpLess32U(v, config)
case OpLess64F:
return rewriteValue386_OpLess64F(v, config)
case OpLess8:
return rewriteValue386_OpLess8(v, config)
case OpLess8U:
return rewriteValue386_OpLess8U(v, config)
case OpLoad:
return rewriteValue386_OpLoad(v, config)
case OpLrot16:
return rewriteValue386_OpLrot16(v, config)
case OpLrot32:
return rewriteValue386_OpLrot32(v, config)
case OpLrot8:
return rewriteValue386_OpLrot8(v, config)
case OpLsh16x16:
return rewriteValue386_OpLsh16x16(v, config)
case OpLsh16x32:
return rewriteValue386_OpLsh16x32(v, config)
case OpLsh16x64:
return rewriteValue386_OpLsh16x64(v, config)
case OpLsh16x8:
return rewriteValue386_OpLsh16x8(v, config)
case OpLsh32x16:
return rewriteValue386_OpLsh32x16(v, config)
case OpLsh32x32:
return rewriteValue386_OpLsh32x32(v, config)
case OpLsh32x64:
return rewriteValue386_OpLsh32x64(v, config)
case OpLsh32x8:
return rewriteValue386_OpLsh32x8(v, config)
case OpLsh8x16:
return rewriteValue386_OpLsh8x16(v, config)
case OpLsh8x32:
return rewriteValue386_OpLsh8x32(v, config)
case OpLsh8x64:
return rewriteValue386_OpLsh8x64(v, config)
case OpLsh8x8:
return rewriteValue386_OpLsh8x8(v, config)
case OpMod16:
return rewriteValue386_OpMod16(v, config)
case OpMod16u:
return rewriteValue386_OpMod16u(v, config)
case OpMod32:
return rewriteValue386_OpMod32(v, config)
case OpMod32u:
return rewriteValue386_OpMod32u(v, config)
case OpMod8:
return rewriteValue386_OpMod8(v, config)
case OpMod8u:
return rewriteValue386_OpMod8u(v, config)
case OpMove:
return rewriteValue386_OpMove(v, config)
case OpMul16:
return rewriteValue386_OpMul16(v, config)
case OpMul32:
return rewriteValue386_OpMul32(v, config)
case OpMul32F:
return rewriteValue386_OpMul32F(v, config)
case OpMul32uhilo:
return rewriteValue386_OpMul32uhilo(v, config)
case OpMul64F:
return rewriteValue386_OpMul64F(v, config)
case OpMul8:
return rewriteValue386_OpMul8(v, config)
case OpNeg16:
return rewriteValue386_OpNeg16(v, config)
case OpNeg32:
return rewriteValue386_OpNeg32(v, config)
case OpNeg32F:
return rewriteValue386_OpNeg32F(v, config)
case OpNeg64F:
return rewriteValue386_OpNeg64F(v, config)
case OpNeg8:
return rewriteValue386_OpNeg8(v, config)
case OpNeq16:
return rewriteValue386_OpNeq16(v, config)
case OpNeq32:
return rewriteValue386_OpNeq32(v, config)
case OpNeq32F:
return rewriteValue386_OpNeq32F(v, config)
case OpNeq64F:
return rewriteValue386_OpNeq64F(v, config)
case OpNeq8:
return rewriteValue386_OpNeq8(v, config)
case OpNeqB:
return rewriteValue386_OpNeqB(v, config)
case OpNeqPtr:
return rewriteValue386_OpNeqPtr(v, config)
case OpNilCheck:
return rewriteValue386_OpNilCheck(v, config)
case OpNot:
return rewriteValue386_OpNot(v, config)
case OpOffPtr:
return rewriteValue386_OpOffPtr(v, config)
case OpOr16:
return rewriteValue386_OpOr16(v, config)
case OpOr32:
return rewriteValue386_OpOr32(v, config)
case OpOr8:
return rewriteValue386_OpOr8(v, config)
case OpOrB:
return rewriteValue386_OpOrB(v, config)
case OpRsh16Ux16:
return rewriteValue386_OpRsh16Ux16(v, config)
case OpRsh16Ux32:
return rewriteValue386_OpRsh16Ux32(v, config)
case OpRsh16Ux64:
return rewriteValue386_OpRsh16Ux64(v, config)
case OpRsh16Ux8:
return rewriteValue386_OpRsh16Ux8(v, config)
case OpRsh16x16:
return rewriteValue386_OpRsh16x16(v, config)
case OpRsh16x32:
return rewriteValue386_OpRsh16x32(v, config)
case OpRsh16x64:
return rewriteValue386_OpRsh16x64(v, config)
case OpRsh16x8:
return rewriteValue386_OpRsh16x8(v, config)
case OpRsh32Ux16:
return rewriteValue386_OpRsh32Ux16(v, config)
case OpRsh32Ux32:
return rewriteValue386_OpRsh32Ux32(v, config)
case OpRsh32Ux64:
return rewriteValue386_OpRsh32Ux64(v, config)
case OpRsh32Ux8:
return rewriteValue386_OpRsh32Ux8(v, config)
case OpRsh32x16:
return rewriteValue386_OpRsh32x16(v, config)
case OpRsh32x32:
return rewriteValue386_OpRsh32x32(v, config)
case OpRsh32x64:
return rewriteValue386_OpRsh32x64(v, config)
case OpRsh32x8:
return rewriteValue386_OpRsh32x8(v, config)
case OpRsh8Ux16:
return rewriteValue386_OpRsh8Ux16(v, config)
case OpRsh8Ux32:
return rewriteValue386_OpRsh8Ux32(v, config)
case OpRsh8Ux64:
return rewriteValue386_OpRsh8Ux64(v, config)
case OpRsh8Ux8:
return rewriteValue386_OpRsh8Ux8(v, config)
case OpRsh8x16:
return rewriteValue386_OpRsh8x16(v, config)
case OpRsh8x32:
return rewriteValue386_OpRsh8x32(v, config)
case OpRsh8x64:
return rewriteValue386_OpRsh8x64(v, config)
case OpRsh8x8:
return rewriteValue386_OpRsh8x8(v, config)
case OpSignExt16to32:
return rewriteValue386_OpSignExt16to32(v, config)
case OpSignExt8to16:
return rewriteValue386_OpSignExt8to16(v, config)
case OpSignExt8to32:
return rewriteValue386_OpSignExt8to32(v, config)
case OpSignmask:
return rewriteValue386_OpSignmask(v, config)
case OpSqrt:
return rewriteValue386_OpSqrt(v, config)
case OpStaticCall:
return rewriteValue386_OpStaticCall(v, config)
case OpStore:
return rewriteValue386_OpStore(v, config)
case OpSub16:
return rewriteValue386_OpSub16(v, config)
case OpSub32:
return rewriteValue386_OpSub32(v, config)
case OpSub32F:
return rewriteValue386_OpSub32F(v, config)
case OpSub32carry:
return rewriteValue386_OpSub32carry(v, config)
case OpSub32withcarry:
return rewriteValue386_OpSub32withcarry(v, config)
case OpSub64F:
return rewriteValue386_OpSub64F(v, config)
case OpSub8:
return rewriteValue386_OpSub8(v, config)
case OpSubPtr:
return rewriteValue386_OpSubPtr(v, config)
case OpTrunc16to8:
return rewriteValue386_OpTrunc16to8(v, config)
case OpTrunc32to16:
return rewriteValue386_OpTrunc32to16(v, config)
case OpTrunc32to8:
return rewriteValue386_OpTrunc32to8(v, config)
case OpXor16:
return rewriteValue386_OpXor16(v, config)
case OpXor32:
return rewriteValue386_OpXor32(v, config)
case OpXor8:
return rewriteValue386_OpXor8(v, config)
case OpZero:
return rewriteValue386_OpZero(v, config)
case OpZeroExt16to32:
return rewriteValue386_OpZeroExt16to32(v, config)
case OpZeroExt8to16:
return rewriteValue386_OpZeroExt8to16(v, config)
case OpZeroExt8to32:
return rewriteValue386_OpZeroExt8to32(v, config)
case OpZeromask:
return rewriteValue386_OpZeromask(v, config)
}
return false
}
func rewriteValue386_Op386ADCL(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (ADCL x (MOVLconst [c]) f)
// cond:
// result: (ADCLconst [c] x f)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVLconst {
break
}
c := v_1.AuxInt
f := v.Args[2]
v.reset(Op386ADCLconst)
v.AuxInt = c
v.AddArg(x)
v.AddArg(f)
return true
}
// match: (ADCL (MOVLconst [c]) x f)
// cond:
// result: (ADCLconst [c] x f)
for {
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
c := v_0.AuxInt
x := v.Args[1]
f := v.Args[2]
v.reset(Op386ADCLconst)
v.AuxInt = c
v.AddArg(x)
v.AddArg(f)
return true
}
return false
}
func rewriteValue386_Op386ADDL(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (ADDL x (MOVLconst [c]))
// cond:
// result: (ADDLconst [c] x)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVLconst {
break
}
c := v_1.AuxInt
v.reset(Op386ADDLconst)
v.AuxInt = c
v.AddArg(x)
return true
}
// match: (ADDL (MOVLconst [c]) x)
// cond:
// result: (ADDLconst [c] x)
for {
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
c := v_0.AuxInt
x := v.Args[1]
v.reset(Op386ADDLconst)
v.AuxInt = c
v.AddArg(x)
return true
}
// match: (ADDL x (SHLLconst [3] y))
// cond:
// result: (LEAL8 x y)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386SHLLconst {
break
}
if v_1.AuxInt != 3 {
break
}
y := v_1.Args[0]
v.reset(Op386LEAL8)
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDL x (SHLLconst [2] y))
// cond:
// result: (LEAL4 x y)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386SHLLconst {
break
}
if v_1.AuxInt != 2 {
break
}
y := v_1.Args[0]
v.reset(Op386LEAL4)
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDL x (SHLLconst [1] y))
// cond:
// result: (LEAL2 x y)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386SHLLconst {
break
}
if v_1.AuxInt != 1 {
break
}
y := v_1.Args[0]
v.reset(Op386LEAL2)
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDL x (ADDL y y))
// cond:
// result: (LEAL2 x y)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDL {
break
}
y := v_1.Args[0]
if y != v_1.Args[1] {
break
}
v.reset(Op386LEAL2)
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDL x (ADDL x y))
// cond:
// result: (LEAL2 y x)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDL {
break
}
if x != v_1.Args[0] {
break
}
y := v_1.Args[1]
v.reset(Op386LEAL2)
v.AddArg(y)
v.AddArg(x)
return true
}
// match: (ADDL x (ADDL y x))
// cond:
// result: (LEAL2 y x)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDL {
break
}
y := v_1.Args[0]
if x != v_1.Args[1] {
break
}
v.reset(Op386LEAL2)
v.AddArg(y)
v.AddArg(x)
return true
}
// match: (ADDL (ADDLconst [c] x) y)
// cond:
// result: (LEAL1 [c] x y)
for {
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
c := v_0.AuxInt
x := v_0.Args[0]
y := v.Args[1]
v.reset(Op386LEAL1)
v.AuxInt = c
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDL x (ADDLconst [c] y))
// cond:
// result: (LEAL1 [c] x y)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDLconst {
break
}
c := v_1.AuxInt
y := v_1.Args[0]
v.reset(Op386LEAL1)
v.AuxInt = c
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDL x (LEAL [c] {s} y))
// cond: x.Op != OpSB && y.Op != OpSB
// result: (LEAL1 [c] {s} x y)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386LEAL {
break
}
c := v_1.AuxInt
s := v_1.Aux
y := v_1.Args[0]
if !(x.Op != OpSB && y.Op != OpSB) {
break
}
v.reset(Op386LEAL1)
v.AuxInt = c
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDL (LEAL [c] {s} x) y)
// cond: x.Op != OpSB && y.Op != OpSB
// result: (LEAL1 [c] {s} x y)
for {
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
c := v_0.AuxInt
s := v_0.Aux
x := v_0.Args[0]
y := v.Args[1]
if !(x.Op != OpSB && y.Op != OpSB) {
break
}
v.reset(Op386LEAL1)
v.AuxInt = c
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDL x (NEGL y))
// cond:
// result: (SUBL x y)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386NEGL {
break
}
y := v_1.Args[0]
v.reset(Op386SUBL)
v.AddArg(x)
v.AddArg(y)
return true
}
return false
}
func rewriteValue386_Op386ADDLcarry(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (ADDLcarry x (MOVLconst [c]))
// cond:
// result: (ADDLconstcarry [c] x)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVLconst {
break
}
c := v_1.AuxInt
v.reset(Op386ADDLconstcarry)
v.AuxInt = c
v.AddArg(x)
return true
}
// match: (ADDLcarry (MOVLconst [c]) x)
// cond:
// result: (ADDLconstcarry [c] x)
for {
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
c := v_0.AuxInt
x := v.Args[1]
v.reset(Op386ADDLconstcarry)
v.AuxInt = c
v.AddArg(x)
return true
}
return false
}
func rewriteValue386_Op386ADDLconst(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (ADDLconst [c] (ADDL x y))
// cond:
// result: (LEAL1 [c] x y)
for {
c := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386ADDL {
break
}
x := v_0.Args[0]
y := v_0.Args[1]
v.reset(Op386LEAL1)
v.AuxInt = c
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDLconst [c] (LEAL [d] {s} x))
// cond: is32Bit(c+d)
// result: (LEAL [c+d] {s} x)
for {
c := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
d := v_0.AuxInt
s := v_0.Aux
x := v_0.Args[0]
if !(is32Bit(c + d)) {
break
}
v.reset(Op386LEAL)
v.AuxInt = c + d
v.Aux = s
v.AddArg(x)
return true
}
// match: (ADDLconst [c] (LEAL1 [d] {s} x y))
// cond: is32Bit(c+d)
// result: (LEAL1 [c+d] {s} x y)
for {
c := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386LEAL1 {
break
}
d := v_0.AuxInt
s := v_0.Aux
x := v_0.Args[0]
y := v_0.Args[1]
if !(is32Bit(c + d)) {
break
}
v.reset(Op386LEAL1)
v.AuxInt = c + d
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDLconst [c] (LEAL2 [d] {s} x y))
// cond: is32Bit(c+d)
// result: (LEAL2 [c+d] {s} x y)
for {
c := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386LEAL2 {
break
}
d := v_0.AuxInt
s := v_0.Aux
x := v_0.Args[0]
y := v_0.Args[1]
if !(is32Bit(c + d)) {
break
}
v.reset(Op386LEAL2)
v.AuxInt = c + d
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDLconst [c] (LEAL4 [d] {s} x y))
// cond: is32Bit(c+d)
// result: (LEAL4 [c+d] {s} x y)
for {
c := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386LEAL4 {
break
}
d := v_0.AuxInt
s := v_0.Aux
x := v_0.Args[0]
y := v_0.Args[1]
if !(is32Bit(c + d)) {
break
}
v.reset(Op386LEAL4)
v.AuxInt = c + d
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDLconst [c] (LEAL8 [d] {s} x y))
// cond: is32Bit(c+d)
// result: (LEAL8 [c+d] {s} x y)
for {
c := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386LEAL8 {
break
}
d := v_0.AuxInt
s := v_0.Aux
x := v_0.Args[0]
y := v_0.Args[1]
if !(is32Bit(c + d)) {
break
}
v.reset(Op386LEAL8)
v.AuxInt = c + d
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (ADDLconst [c] x)
// cond: int32(c)==0
// result: x
for {
c := v.AuxInt
x := v.Args[0]
if !(int32(c) == 0) {
break
}
v.reset(OpCopy)
v.Type = x.Type
v.AddArg(x)
return true
}
// match: (ADDLconst [c] (MOVLconst [d]))
// cond:
// result: (MOVLconst [int64(int32(c+d))])
for {
c := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
d := v_0.AuxInt
v.reset(Op386MOVLconst)
v.AuxInt = int64(int32(c + d))
return true
}
// match: (ADDLconst [c] (ADDLconst [d] x))
// cond:
// result: (ADDLconst [int64(int32(c+d))] x)
for {
c := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
d := v_0.AuxInt
x := v_0.Args[0]
v.reset(Op386ADDLconst)
v.AuxInt = int64(int32(c + d))
v.AddArg(x)
return true
}
return false
}
func rewriteValue386_Op386ANDL(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (ANDL x (MOVLconst [c]))
// cond:
// result: (ANDLconst [c] x)
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVLconst {
break
}
c := v_1.AuxInt
v.reset(Op386ANDLconst)
v.AuxInt = c
v.AddArg(x)
return true
}
// match: (ANDL (MOVLconst [c]) x)
// cond:
// result: (ANDLconst [c] x)
for {
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
c := v_0.AuxInt
x := v.Args[1]
v.reset(Op386ANDLconst)
v.AuxInt = c
v.AddArg(x)
return true
}
// match: (ANDL x x)
// cond:
// result: x
for {
x := v.Args[0]
if x != v.Args[1] {
break
}
v.reset(OpCopy)
v.Type = x.Type
v.AddArg(x)
return true
}
return false
}
func rewriteValue386_Op386ANDLconst(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (ANDLconst [c] (ANDLconst [d] x))
// cond:
// result: (ANDLconst [c & d] x)
for {
c := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386ANDLconst {
break
}
d := v_0.AuxInt
x := v_0.Args[0]
v.reset(Op386ANDLconst)
v.AuxInt = c & d
v.AddArg(x)
return true
}
// match: (ANDLconst [c] _)
// cond: int32(c)==0
// result: (MOVLconst [0])
for {
c := v.AuxInt
if !(int32(c) == 0) {
break
}
v.reset(Op386MOVLconst)
v.AuxInt = 0
return true
}
// match: (ANDLconst [c] x)
// cond: int32(c)==-1
// result: x
for {
c := v.AuxInt
x := v.Args[0]
if !(int32(c) == -1) {
break
}
v.reset(OpCopy)
v.Type = x.Type
v.AddArg(x)
return true
}
// match: (ANDLconst [c] (MOVLconst [d]))
// cond:
// result: (MOVLconst [c&d])
for {
c := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
d := v_0.AuxInt
v.reset(Op386MOVLconst)
v.AuxInt = c & d
return true
}
return false
}
func rewriteValue386_Op386CMPB(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (CMPB x (MOVLconst [c]))
// cond:
// result: (CMPBconst x [int64(int8(c))])
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVLconst {
break
}
c := v_1.AuxInt
v.reset(Op386CMPBconst)
v.AuxInt = int64(int8(c))
v.AddArg(x)
return true
}
// match: (CMPB (MOVLconst [c]) x)
// cond:
// result: (InvertFlags (CMPBconst x [int64(int8(c))]))
for {
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
c := v_0.AuxInt
x := v.Args[1]
v.reset(Op386InvertFlags)
v0 := b.NewValue0(v.Line, Op386CMPBconst, TypeFlags)
v0.AuxInt = int64(int8(c))
v0.AddArg(x)
v.AddArg(v0)
return true
}
return false
}
func rewriteValue386_Op386CMPBconst(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (CMPBconst (MOVLconst [x]) [y])
// cond: int8(x)==int8(y)
// result: (FlagEQ)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int8(x) == int8(y)) {
break
}
v.reset(Op386FlagEQ)
return true
}
// match: (CMPBconst (MOVLconst [x]) [y])
// cond: int8(x)<int8(y) && uint8(x)<uint8(y)
// result: (FlagLT_ULT)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int8(x) < int8(y) && uint8(x) < uint8(y)) {
break
}
v.reset(Op386FlagLT_ULT)
return true
}
// match: (CMPBconst (MOVLconst [x]) [y])
// cond: int8(x)<int8(y) && uint8(x)>uint8(y)
// result: (FlagLT_UGT)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int8(x) < int8(y) && uint8(x) > uint8(y)) {
break
}
v.reset(Op386FlagLT_UGT)
return true
}
// match: (CMPBconst (MOVLconst [x]) [y])
// cond: int8(x)>int8(y) && uint8(x)<uint8(y)
// result: (FlagGT_ULT)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int8(x) > int8(y) && uint8(x) < uint8(y)) {
break
}
v.reset(Op386FlagGT_ULT)
return true
}
// match: (CMPBconst (MOVLconst [x]) [y])
// cond: int8(x)>int8(y) && uint8(x)>uint8(y)
// result: (FlagGT_UGT)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int8(x) > int8(y) && uint8(x) > uint8(y)) {
break
}
v.reset(Op386FlagGT_UGT)
return true
}
// match: (CMPBconst (ANDLconst _ [m]) [n])
// cond: 0 <= int8(m) && int8(m) < int8(n)
// result: (FlagLT_ULT)
for {
n := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386ANDLconst {
break
}
m := v_0.AuxInt
if !(0 <= int8(m) && int8(m) < int8(n)) {
break
}
v.reset(Op386FlagLT_ULT)
return true
}
// match: (CMPBconst (ANDL x y) [0])
// cond:
// result: (TESTB x y)
for {
if v.AuxInt != 0 {
break
}
v_0 := v.Args[0]
if v_0.Op != Op386ANDL {
break
}
x := v_0.Args[0]
y := v_0.Args[1]
v.reset(Op386TESTB)
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (CMPBconst (ANDLconst [c] x) [0])
// cond:
// result: (TESTBconst [int64(int8(c))] x)
for {
if v.AuxInt != 0 {
break
}
v_0 := v.Args[0]
if v_0.Op != Op386ANDLconst {
break
}
c := v_0.AuxInt
x := v_0.Args[0]
v.reset(Op386TESTBconst)
v.AuxInt = int64(int8(c))
v.AddArg(x)
return true
}
// match: (CMPBconst x [0])
// cond:
// result: (TESTB x x)
for {
if v.AuxInt != 0 {
break
}
x := v.Args[0]
v.reset(Op386TESTB)
v.AddArg(x)
v.AddArg(x)
return true
}
return false
}
func rewriteValue386_Op386CMPL(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (CMPL x (MOVLconst [c]))
// cond:
// result: (CMPLconst x [c])
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVLconst {
break
}
c := v_1.AuxInt
v.reset(Op386CMPLconst)
v.AuxInt = c
v.AddArg(x)
return true
}
// match: (CMPL (MOVLconst [c]) x)
// cond:
// result: (InvertFlags (CMPLconst x [c]))
for {
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
c := v_0.AuxInt
x := v.Args[1]
v.reset(Op386InvertFlags)
v0 := b.NewValue0(v.Line, Op386CMPLconst, TypeFlags)
v0.AuxInt = c
v0.AddArg(x)
v.AddArg(v0)
return true
}
return false
}
func rewriteValue386_Op386CMPLconst(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (CMPLconst (MOVLconst [x]) [y])
// cond: int32(x)==int32(y)
// result: (FlagEQ)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int32(x) == int32(y)) {
break
}
v.reset(Op386FlagEQ)
return true
}
// match: (CMPLconst (MOVLconst [x]) [y])
// cond: int32(x)<int32(y) && uint32(x)<uint32(y)
// result: (FlagLT_ULT)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int32(x) < int32(y) && uint32(x) < uint32(y)) {
break
}
v.reset(Op386FlagLT_ULT)
return true
}
// match: (CMPLconst (MOVLconst [x]) [y])
// cond: int32(x)<int32(y) && uint32(x)>uint32(y)
// result: (FlagLT_UGT)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int32(x) < int32(y) && uint32(x) > uint32(y)) {
break
}
v.reset(Op386FlagLT_UGT)
return true
}
// match: (CMPLconst (MOVLconst [x]) [y])
// cond: int32(x)>int32(y) && uint32(x)<uint32(y)
// result: (FlagGT_ULT)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int32(x) > int32(y) && uint32(x) < uint32(y)) {
break
}
v.reset(Op386FlagGT_ULT)
return true
}
// match: (CMPLconst (MOVLconst [x]) [y])
// cond: int32(x)>int32(y) && uint32(x)>uint32(y)
// result: (FlagGT_UGT)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int32(x) > int32(y) && uint32(x) > uint32(y)) {
break
}
v.reset(Op386FlagGT_UGT)
return true
}
// match: (CMPLconst (SHRLconst _ [c]) [n])
// cond: 0 <= n && 0 < c && c <= 32 && (1<<uint64(32-c)) <= uint64(n)
// result: (FlagLT_ULT)
for {
n := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386SHRLconst {
break
}
c := v_0.AuxInt
if !(0 <= n && 0 < c && c <= 32 && (1<<uint64(32-c)) <= uint64(n)) {
break
}
v.reset(Op386FlagLT_ULT)
return true
}
// match: (CMPLconst (ANDLconst _ [m]) [n])
// cond: 0 <= int32(m) && int32(m) < int32(n)
// result: (FlagLT_ULT)
for {
n := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386ANDLconst {
break
}
m := v_0.AuxInt
if !(0 <= int32(m) && int32(m) < int32(n)) {
break
}
v.reset(Op386FlagLT_ULT)
return true
}
// match: (CMPLconst (ANDL x y) [0])
// cond:
// result: (TESTL x y)
for {
if v.AuxInt != 0 {
break
}
v_0 := v.Args[0]
if v_0.Op != Op386ANDL {
break
}
x := v_0.Args[0]
y := v_0.Args[1]
v.reset(Op386TESTL)
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (CMPLconst (ANDLconst [c] x) [0])
// cond:
// result: (TESTLconst [c] x)
for {
if v.AuxInt != 0 {
break
}
v_0 := v.Args[0]
if v_0.Op != Op386ANDLconst {
break
}
c := v_0.AuxInt
x := v_0.Args[0]
v.reset(Op386TESTLconst)
v.AuxInt = c
v.AddArg(x)
return true
}
// match: (CMPLconst x [0])
// cond:
// result: (TESTL x x)
for {
if v.AuxInt != 0 {
break
}
x := v.Args[0]
v.reset(Op386TESTL)
v.AddArg(x)
v.AddArg(x)
return true
}
return false
}
func rewriteValue386_Op386CMPW(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (CMPW x (MOVLconst [c]))
// cond:
// result: (CMPWconst x [int64(int16(c))])
for {
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVLconst {
break
}
c := v_1.AuxInt
v.reset(Op386CMPWconst)
v.AuxInt = int64(int16(c))
v.AddArg(x)
return true
}
// match: (CMPW (MOVLconst [c]) x)
// cond:
// result: (InvertFlags (CMPWconst x [int64(int16(c))]))
for {
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
c := v_0.AuxInt
x := v.Args[1]
v.reset(Op386InvertFlags)
v0 := b.NewValue0(v.Line, Op386CMPWconst, TypeFlags)
v0.AuxInt = int64(int16(c))
v0.AddArg(x)
v.AddArg(v0)
return true
}
return false
}
func rewriteValue386_Op386CMPWconst(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (CMPWconst (MOVLconst [x]) [y])
// cond: int16(x)==int16(y)
// result: (FlagEQ)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int16(x) == int16(y)) {
break
}
v.reset(Op386FlagEQ)
return true
}
// match: (CMPWconst (MOVLconst [x]) [y])
// cond: int16(x)<int16(y) && uint16(x)<uint16(y)
// result: (FlagLT_ULT)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int16(x) < int16(y) && uint16(x) < uint16(y)) {
break
}
v.reset(Op386FlagLT_ULT)
return true
}
// match: (CMPWconst (MOVLconst [x]) [y])
// cond: int16(x)<int16(y) && uint16(x)>uint16(y)
// result: (FlagLT_UGT)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int16(x) < int16(y) && uint16(x) > uint16(y)) {
break
}
v.reset(Op386FlagLT_UGT)
return true
}
// match: (CMPWconst (MOVLconst [x]) [y])
// cond: int16(x)>int16(y) && uint16(x)<uint16(y)
// result: (FlagGT_ULT)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int16(x) > int16(y) && uint16(x) < uint16(y)) {
break
}
v.reset(Op386FlagGT_ULT)
return true
}
// match: (CMPWconst (MOVLconst [x]) [y])
// cond: int16(x)>int16(y) && uint16(x)>uint16(y)
// result: (FlagGT_UGT)
for {
y := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386MOVLconst {
break
}
x := v_0.AuxInt
if !(int16(x) > int16(y) && uint16(x) > uint16(y)) {
break
}
v.reset(Op386FlagGT_UGT)
return true
}
// match: (CMPWconst (ANDLconst _ [m]) [n])
// cond: 0 <= int16(m) && int16(m) < int16(n)
// result: (FlagLT_ULT)
for {
n := v.AuxInt
v_0 := v.Args[0]
if v_0.Op != Op386ANDLconst {
break
}
m := v_0.AuxInt
if !(0 <= int16(m) && int16(m) < int16(n)) {
break
}
v.reset(Op386FlagLT_ULT)
return true
}
// match: (CMPWconst (ANDL x y) [0])
// cond:
// result: (TESTW x y)
for {
if v.AuxInt != 0 {
break
}
v_0 := v.Args[0]
if v_0.Op != Op386ANDL {
break
}
x := v_0.Args[0]
y := v_0.Args[1]
v.reset(Op386TESTW)
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (CMPWconst (ANDLconst [c] x) [0])
// cond:
// result: (TESTWconst [int64(int16(c))] x)
for {
if v.AuxInt != 0 {
break
}
v_0 := v.Args[0]
if v_0.Op != Op386ANDLconst {
break
}
c := v_0.AuxInt
x := v_0.Args[0]
v.reset(Op386TESTWconst)
v.AuxInt = int64(int16(c))
v.AddArg(x)
return true
}
// match: (CMPWconst x [0])
// cond:
// result: (TESTW x x)
for {
if v.AuxInt != 0 {
break
}
x := v.Args[0]
v.reset(Op386TESTW)
v.AddArg(x)
v.AddArg(x)
return true
}
return false
}
func rewriteValue386_Op386LEAL(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (LEAL [c] {s} (ADDLconst [d] x))
// cond: is32Bit(c+d)
// result: (LEAL [c+d] {s} x)
for {
c := v.AuxInt
s := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
d := v_0.AuxInt
x := v_0.Args[0]
if !(is32Bit(c + d)) {
break
}
v.reset(Op386LEAL)
v.AuxInt = c + d
v.Aux = s
v.AddArg(x)
return true
}
// match: (LEAL [c] {s} (ADDL x y))
// cond: x.Op != OpSB && y.Op != OpSB
// result: (LEAL1 [c] {s} x y)
for {
c := v.AuxInt
s := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDL {
break
}
x := v_0.Args[0]
y := v_0.Args[1]
if !(x.Op != OpSB && y.Op != OpSB) {
break
}
v.reset(Op386LEAL1)
v.AuxInt = c
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL [off1] {sym1} (LEAL [off2] {sym2} x))
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2)
// result: (LEAL [off1+off2] {mergeSym(sym1,sym2)} x)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
x := v_0.Args[0]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) {
break
}
v.reset(Op386LEAL)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(x)
return true
}
// match: (LEAL [off1] {sym1} (LEAL1 [off2] {sym2} x y))
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2)
// result: (LEAL1 [off1+off2] {mergeSym(sym1,sym2)} x y)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL1 {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
x := v_0.Args[0]
y := v_0.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) {
break
}
v.reset(Op386LEAL1)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL [off1] {sym1} (LEAL2 [off2] {sym2} x y))
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2)
// result: (LEAL2 [off1+off2] {mergeSym(sym1,sym2)} x y)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL2 {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
x := v_0.Args[0]
y := v_0.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) {
break
}
v.reset(Op386LEAL2)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL [off1] {sym1} (LEAL4 [off2] {sym2} x y))
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2)
// result: (LEAL4 [off1+off2] {mergeSym(sym1,sym2)} x y)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL4 {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
x := v_0.Args[0]
y := v_0.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) {
break
}
v.reset(Op386LEAL4)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL [off1] {sym1} (LEAL8 [off2] {sym2} x y))
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2)
// result: (LEAL8 [off1+off2] {mergeSym(sym1,sym2)} x y)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL8 {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
x := v_0.Args[0]
y := v_0.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) {
break
}
v.reset(Op386LEAL8)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(x)
v.AddArg(y)
return true
}
return false
}
func rewriteValue386_Op386LEAL1(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (LEAL1 [c] {s} (ADDLconst [d] x) y)
// cond: is32Bit(c+d) && x.Op != OpSB
// result: (LEAL1 [c+d] {s} x y)
for {
c := v.AuxInt
s := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
d := v_0.AuxInt
x := v_0.Args[0]
y := v.Args[1]
if !(is32Bit(c+d) && x.Op != OpSB) {
break
}
v.reset(Op386LEAL1)
v.AuxInt = c + d
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL1 [c] {s} x (ADDLconst [d] y))
// cond: is32Bit(c+d) && y.Op != OpSB
// result: (LEAL1 [c+d] {s} x y)
for {
c := v.AuxInt
s := v.Aux
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDLconst {
break
}
d := v_1.AuxInt
y := v_1.Args[0]
if !(is32Bit(c+d) && y.Op != OpSB) {
break
}
v.reset(Op386LEAL1)
v.AuxInt = c + d
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL1 [c] {s} x (SHLLconst [1] y))
// cond:
// result: (LEAL2 [c] {s} x y)
for {
c := v.AuxInt
s := v.Aux
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386SHLLconst {
break
}
if v_1.AuxInt != 1 {
break
}
y := v_1.Args[0]
v.reset(Op386LEAL2)
v.AuxInt = c
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL1 [c] {s} (SHLLconst [1] x) y)
// cond:
// result: (LEAL2 [c] {s} y x)
for {
c := v.AuxInt
s := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386SHLLconst {
break
}
if v_0.AuxInt != 1 {
break
}
x := v_0.Args[0]
y := v.Args[1]
v.reset(Op386LEAL2)
v.AuxInt = c
v.Aux = s
v.AddArg(y)
v.AddArg(x)
return true
}
// match: (LEAL1 [c] {s} x (SHLLconst [2] y))
// cond:
// result: (LEAL4 [c] {s} x y)
for {
c := v.AuxInt
s := v.Aux
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386SHLLconst {
break
}
if v_1.AuxInt != 2 {
break
}
y := v_1.Args[0]
v.reset(Op386LEAL4)
v.AuxInt = c
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL1 [c] {s} (SHLLconst [2] x) y)
// cond:
// result: (LEAL4 [c] {s} y x)
for {
c := v.AuxInt
s := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386SHLLconst {
break
}
if v_0.AuxInt != 2 {
break
}
x := v_0.Args[0]
y := v.Args[1]
v.reset(Op386LEAL4)
v.AuxInt = c
v.Aux = s
v.AddArg(y)
v.AddArg(x)
return true
}
// match: (LEAL1 [c] {s} x (SHLLconst [3] y))
// cond:
// result: (LEAL8 [c] {s} x y)
for {
c := v.AuxInt
s := v.Aux
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386SHLLconst {
break
}
if v_1.AuxInt != 3 {
break
}
y := v_1.Args[0]
v.reset(Op386LEAL8)
v.AuxInt = c
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL1 [c] {s} (SHLLconst [3] x) y)
// cond:
// result: (LEAL8 [c] {s} y x)
for {
c := v.AuxInt
s := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386SHLLconst {
break
}
if v_0.AuxInt != 3 {
break
}
x := v_0.Args[0]
y := v.Args[1]
v.reset(Op386LEAL8)
v.AuxInt = c
v.Aux = s
v.AddArg(y)
v.AddArg(x)
return true
}
// match: (LEAL1 [off1] {sym1} (LEAL [off2] {sym2} x) y)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB
// result: (LEAL1 [off1+off2] {mergeSym(sym1,sym2)} x y)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
x := v_0.Args[0]
y := v.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
break
}
v.reset(Op386LEAL1)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL1 [off1] {sym1} x (LEAL [off2] {sym2} y))
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && y.Op != OpSB
// result: (LEAL1 [off1+off2] {mergeSym(sym1,sym2)} x y)
for {
off1 := v.AuxInt
sym1 := v.Aux
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386LEAL {
break
}
off2 := v_1.AuxInt
sym2 := v_1.Aux
y := v_1.Args[0]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && y.Op != OpSB) {
break
}
v.reset(Op386LEAL1)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(x)
v.AddArg(y)
return true
}
return false
}
func rewriteValue386_Op386LEAL2(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (LEAL2 [c] {s} (ADDLconst [d] x) y)
// cond: is32Bit(c+d) && x.Op != OpSB
// result: (LEAL2 [c+d] {s} x y)
for {
c := v.AuxInt
s := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
d := v_0.AuxInt
x := v_0.Args[0]
y := v.Args[1]
if !(is32Bit(c+d) && x.Op != OpSB) {
break
}
v.reset(Op386LEAL2)
v.AuxInt = c + d
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL2 [c] {s} x (ADDLconst [d] y))
// cond: is32Bit(c+2*d) && y.Op != OpSB
// result: (LEAL2 [c+2*d] {s} x y)
for {
c := v.AuxInt
s := v.Aux
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDLconst {
break
}
d := v_1.AuxInt
y := v_1.Args[0]
if !(is32Bit(c+2*d) && y.Op != OpSB) {
break
}
v.reset(Op386LEAL2)
v.AuxInt = c + 2*d
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL2 [c] {s} x (SHLLconst [1] y))
// cond:
// result: (LEAL4 [c] {s} x y)
for {
c := v.AuxInt
s := v.Aux
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386SHLLconst {
break
}
if v_1.AuxInt != 1 {
break
}
y := v_1.Args[0]
v.reset(Op386LEAL4)
v.AuxInt = c
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL2 [c] {s} x (SHLLconst [2] y))
// cond:
// result: (LEAL8 [c] {s} x y)
for {
c := v.AuxInt
s := v.Aux
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386SHLLconst {
break
}
if v_1.AuxInt != 2 {
break
}
y := v_1.Args[0]
v.reset(Op386LEAL8)
v.AuxInt = c
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL2 [off1] {sym1} (LEAL [off2] {sym2} x) y)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB
// result: (LEAL2 [off1+off2] {mergeSym(sym1,sym2)} x y)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
x := v_0.Args[0]
y := v.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
break
}
v.reset(Op386LEAL2)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(x)
v.AddArg(y)
return true
}
return false
}
func rewriteValue386_Op386LEAL4(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (LEAL4 [c] {s} (ADDLconst [d] x) y)
// cond: is32Bit(c+d) && x.Op != OpSB
// result: (LEAL4 [c+d] {s} x y)
for {
c := v.AuxInt
s := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
d := v_0.AuxInt
x := v_0.Args[0]
y := v.Args[1]
if !(is32Bit(c+d) && x.Op != OpSB) {
break
}
v.reset(Op386LEAL4)
v.AuxInt = c + d
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL4 [c] {s} x (ADDLconst [d] y))
// cond: is32Bit(c+4*d) && y.Op != OpSB
// result: (LEAL4 [c+4*d] {s} x y)
for {
c := v.AuxInt
s := v.Aux
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDLconst {
break
}
d := v_1.AuxInt
y := v_1.Args[0]
if !(is32Bit(c+4*d) && y.Op != OpSB) {
break
}
v.reset(Op386LEAL4)
v.AuxInt = c + 4*d
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL4 [c] {s} x (SHLLconst [1] y))
// cond:
// result: (LEAL8 [c] {s} x y)
for {
c := v.AuxInt
s := v.Aux
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386SHLLconst {
break
}
if v_1.AuxInt != 1 {
break
}
y := v_1.Args[0]
v.reset(Op386LEAL8)
v.AuxInt = c
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL4 [off1] {sym1} (LEAL [off2] {sym2} x) y)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB
// result: (LEAL4 [off1+off2] {mergeSym(sym1,sym2)} x y)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
x := v_0.Args[0]
y := v.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
break
}
v.reset(Op386LEAL4)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(x)
v.AddArg(y)
return true
}
return false
}
func rewriteValue386_Op386LEAL8(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (LEAL8 [c] {s} (ADDLconst [d] x) y)
// cond: is32Bit(c+d) && x.Op != OpSB
// result: (LEAL8 [c+d] {s} x y)
for {
c := v.AuxInt
s := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
d := v_0.AuxInt
x := v_0.Args[0]
y := v.Args[1]
if !(is32Bit(c+d) && x.Op != OpSB) {
break
}
v.reset(Op386LEAL8)
v.AuxInt = c + d
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL8 [c] {s} x (ADDLconst [d] y))
// cond: is32Bit(c+8*d) && y.Op != OpSB
// result: (LEAL8 [c+8*d] {s} x y)
for {
c := v.AuxInt
s := v.Aux
x := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDLconst {
break
}
d := v_1.AuxInt
y := v_1.Args[0]
if !(is32Bit(c+8*d) && y.Op != OpSB) {
break
}
v.reset(Op386LEAL8)
v.AuxInt = c + 8*d
v.Aux = s
v.AddArg(x)
v.AddArg(y)
return true
}
// match: (LEAL8 [off1] {sym1} (LEAL [off2] {sym2} x) y)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB
// result: (LEAL8 [off1+off2] {mergeSym(sym1,sym2)} x y)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
x := v_0.Args[0]
y := v.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
break
}
v.reset(Op386LEAL8)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(x)
v.AddArg(y)
return true
}
return false
}
func rewriteValue386_Op386MOVBLSX(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVBLSX x:(MOVBload [off] {sym} ptr mem))
// cond: x.Uses == 1 && clobber(x)
// result: @x.Block (MOVBLSXload <v.Type> [off] {sym} ptr mem)
for {
x := v.Args[0]
if x.Op != Op386MOVBload {
break
}
off := x.AuxInt
sym := x.Aux
ptr := x.Args[0]
mem := x.Args[1]
if !(x.Uses == 1 && clobber(x)) {
break
}
b = x.Block
v0 := b.NewValue0(v.Line, Op386MOVBLSXload, v.Type)
v.reset(OpCopy)
v.AddArg(v0)
v0.AuxInt = off
v0.Aux = sym
v0.AddArg(ptr)
v0.AddArg(mem)
return true
}
// match: (MOVBLSX (ANDLconst [c] x))
// cond: c & 0x80 == 0
// result: (ANDLconst [c & 0x7f] x)
for {
v_0 := v.Args[0]
if v_0.Op != Op386ANDLconst {
break
}
c := v_0.AuxInt
x := v_0.Args[0]
if !(c&0x80 == 0) {
break
}
v.reset(Op386ANDLconst)
v.AuxInt = c & 0x7f
v.AddArg(x)
return true
}
return false
}
func rewriteValue386_Op386MOVBLSXload(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVBLSXload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
// result: (MOVBLSXload [off1+off2] {mergeSym(sym1,sym2)} base mem)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
base := v_0.Args[0]
mem := v.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
break
}
v.reset(Op386MOVBLSXload)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(base)
v.AddArg(mem)
return true
}
return false
}
func rewriteValue386_Op386MOVBLZX(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVBLZX x:(MOVBload [off] {sym} ptr mem))
// cond: x.Uses == 1 && clobber(x)
// result: @x.Block (MOVBload <v.Type> [off] {sym} ptr mem)
for {
x := v.Args[0]
if x.Op != Op386MOVBload {
break
}
off := x.AuxInt
sym := x.Aux
ptr := x.Args[0]
mem := x.Args[1]
if !(x.Uses == 1 && clobber(x)) {
break
}
b = x.Block
v0 := b.NewValue0(v.Line, Op386MOVBload, v.Type)
v.reset(OpCopy)
v.AddArg(v0)
v0.AuxInt = off
v0.Aux = sym
v0.AddArg(ptr)
v0.AddArg(mem)
return true
}
// match: (MOVBLZX x:(MOVBloadidx1 [off] {sym} ptr idx mem))
// cond: x.Uses == 1 && clobber(x)
// result: @x.Block (MOVBloadidx1 <v.Type> [off] {sym} ptr idx mem)
for {
x := v.Args[0]
if x.Op != Op386MOVBloadidx1 {
break
}
off := x.AuxInt
sym := x.Aux
ptr := x.Args[0]
idx := x.Args[1]
mem := x.Args[2]
if !(x.Uses == 1 && clobber(x)) {
break
}
b = x.Block
v0 := b.NewValue0(v.Line, Op386MOVBloadidx1, v.Type)
v.reset(OpCopy)
v.AddArg(v0)
v0.AuxInt = off
v0.Aux = sym
v0.AddArg(ptr)
v0.AddArg(idx)
v0.AddArg(mem)
return true
}
// match: (MOVBLZX (ANDLconst [c] x))
// cond:
// result: (ANDLconst [c & 0xff] x)
for {
v_0 := v.Args[0]
if v_0.Op != Op386ANDLconst {
break
}
c := v_0.AuxInt
x := v_0.Args[0]
v.reset(Op386ANDLconst)
v.AuxInt = c & 0xff
v.AddArg(x)
return true
}
return false
}
func rewriteValue386_Op386MOVBload(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVBload [off] {sym} ptr (MOVBstore [off2] {sym2} ptr2 x _))
// cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
// result: x
for {
off := v.AuxInt
sym := v.Aux
ptr := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVBstore {
break
}
off2 := v_1.AuxInt
sym2 := v_1.Aux
ptr2 := v_1.Args[0]
x := v_1.Args[1]
if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
break
}
v.reset(OpCopy)
v.Type = x.Type
v.AddArg(x)
return true
}
// match: (MOVBload [off1] {sym} (ADDLconst [off2] ptr) mem)
// cond: is32Bit(off1+off2)
// result: (MOVBload [off1+off2] {sym} ptr mem)
for {
off1 := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
off2 := v_0.AuxInt
ptr := v_0.Args[0]
mem := v.Args[1]
if !(is32Bit(off1 + off2)) {
break
}
v.reset(Op386MOVBload)
v.AuxInt = off1 + off2
v.Aux = sym
v.AddArg(ptr)
v.AddArg(mem)
return true
}
// match: (MOVBload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
// result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
base := v_0.Args[0]
mem := v.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
break
}
v.reset(Op386MOVBload)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(base)
v.AddArg(mem)
return true
}
// match: (MOVBload [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) mem)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2)
// result: (MOVBloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL1 {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
ptr := v_0.Args[0]
idx := v_0.Args[1]
mem := v.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) {
break
}
v.reset(Op386MOVBloadidx1)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
// match: (MOVBload [off] {sym} (ADDL ptr idx) mem)
// cond: ptr.Op != OpSB
// result: (MOVBloadidx1 [off] {sym} ptr idx mem)
for {
off := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDL {
break
}
ptr := v_0.Args[0]
idx := v_0.Args[1]
mem := v.Args[1]
if !(ptr.Op != OpSB) {
break
}
v.reset(Op386MOVBloadidx1)
v.AuxInt = off
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
return false
}
func rewriteValue386_Op386MOVBloadidx1(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVBloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem)
// cond:
// result: (MOVBloadidx1 [c+d] {sym} ptr idx mem)
for {
c := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
d := v_0.AuxInt
ptr := v_0.Args[0]
idx := v.Args[1]
mem := v.Args[2]
v.reset(Op386MOVBloadidx1)
v.AuxInt = c + d
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
// match: (MOVBloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem)
// cond:
// result: (MOVBloadidx1 [c+d] {sym} ptr idx mem)
for {
c := v.AuxInt
sym := v.Aux
ptr := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDLconst {
break
}
d := v_1.AuxInt
idx := v_1.Args[0]
mem := v.Args[2]
v.reset(Op386MOVBloadidx1)
v.AuxInt = c + d
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
return false
}
func rewriteValue386_Op386MOVBstore(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVBstore [off] {sym} ptr (MOVBLSX x) mem)
// cond:
// result: (MOVBstore [off] {sym} ptr x mem)
for {
off := v.AuxInt
sym := v.Aux
ptr := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVBLSX {
break
}
x := v_1.Args[0]
mem := v.Args[2]
v.reset(Op386MOVBstore)
v.AuxInt = off
v.Aux = sym
v.AddArg(ptr)
v.AddArg(x)
v.AddArg(mem)
return true
}
// match: (MOVBstore [off] {sym} ptr (MOVBLZX x) mem)
// cond:
// result: (MOVBstore [off] {sym} ptr x mem)
for {
off := v.AuxInt
sym := v.Aux
ptr := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVBLZX {
break
}
x := v_1.Args[0]
mem := v.Args[2]
v.reset(Op386MOVBstore)
v.AuxInt = off
v.Aux = sym
v.AddArg(ptr)
v.AddArg(x)
v.AddArg(mem)
return true
}
// match: (MOVBstore [off1] {sym} (ADDLconst [off2] ptr) val mem)
// cond: is32Bit(off1+off2)
// result: (MOVBstore [off1+off2] {sym} ptr val mem)
for {
off1 := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
off2 := v_0.AuxInt
ptr := v_0.Args[0]
val := v.Args[1]
mem := v.Args[2]
if !(is32Bit(off1 + off2)) {
break
}
v.reset(Op386MOVBstore)
v.AuxInt = off1 + off2
v.Aux = sym
v.AddArg(ptr)
v.AddArg(val)
v.AddArg(mem)
return true
}
// match: (MOVBstore [off] {sym} ptr (MOVLconst [c]) mem)
// cond: validOff(off)
// result: (MOVBstoreconst [makeValAndOff(int64(int8(c)),off)] {sym} ptr mem)
for {
off := v.AuxInt
sym := v.Aux
ptr := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVLconst {
break
}
c := v_1.AuxInt
mem := v.Args[2]
if !(validOff(off)) {
break
}
v.reset(Op386MOVBstoreconst)
v.AuxInt = makeValAndOff(int64(int8(c)), off)
v.Aux = sym
v.AddArg(ptr)
v.AddArg(mem)
return true
}
// match: (MOVBstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
// result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
base := v_0.Args[0]
val := v.Args[1]
mem := v.Args[2]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
break
}
v.reset(Op386MOVBstore)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(base)
v.AddArg(val)
v.AddArg(mem)
return true
}
// match: (MOVBstore [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) val mem)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2)
// result: (MOVBstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL1 {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
ptr := v_0.Args[0]
idx := v_0.Args[1]
val := v.Args[1]
mem := v.Args[2]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) {
break
}
v.reset(Op386MOVBstoreidx1)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(val)
v.AddArg(mem)
return true
}
// match: (MOVBstore [off] {sym} (ADDL ptr idx) val mem)
// cond: ptr.Op != OpSB
// result: (MOVBstoreidx1 [off] {sym} ptr idx val mem)
for {
off := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDL {
break
}
ptr := v_0.Args[0]
idx := v_0.Args[1]
val := v.Args[1]
mem := v.Args[2]
if !(ptr.Op != OpSB) {
break
}
v.reset(Op386MOVBstoreidx1)
v.AuxInt = off
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(val)
v.AddArg(mem)
return true
}
// match: (MOVBstore [i] {s} p (SHRLconst [8] w) x:(MOVBstore [i-1] {s} p w mem))
// cond: x.Uses == 1 && clobber(x)
// result: (MOVWstore [i-1] {s} p w mem)
for {
i := v.AuxInt
s := v.Aux
p := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386SHRLconst {
break
}
if v_1.AuxInt != 8 {
break
}
w := v_1.Args[0]
x := v.Args[2]
if x.Op != Op386MOVBstore {
break
}
if x.AuxInt != i-1 {
break
}
if x.Aux != s {
break
}
if p != x.Args[0] {
break
}
if w != x.Args[1] {
break
}
mem := x.Args[2]
if !(x.Uses == 1 && clobber(x)) {
break
}
v.reset(Op386MOVWstore)
v.AuxInt = i - 1
v.Aux = s
v.AddArg(p)
v.AddArg(w)
v.AddArg(mem)
return true
}
// match: (MOVBstore [i] {s} p (SHRLconst [j] w) x:(MOVBstore [i-1] {s} p w0:(SHRLconst [j-8] w) mem))
// cond: x.Uses == 1 && clobber(x)
// result: (MOVWstore [i-1] {s} p w0 mem)
for {
i := v.AuxInt
s := v.Aux
p := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386SHRLconst {
break
}
j := v_1.AuxInt
w := v_1.Args[0]
x := v.Args[2]
if x.Op != Op386MOVBstore {
break
}
if x.AuxInt != i-1 {
break
}
if x.Aux != s {
break
}
if p != x.Args[0] {
break
}
w0 := x.Args[1]
if w0.Op != Op386SHRLconst {
break
}
if w0.AuxInt != j-8 {
break
}
if w != w0.Args[0] {
break
}
mem := x.Args[2]
if !(x.Uses == 1 && clobber(x)) {
break
}
v.reset(Op386MOVWstore)
v.AuxInt = i - 1
v.Aux = s
v.AddArg(p)
v.AddArg(w0)
v.AddArg(mem)
return true
}
return false
}
func rewriteValue386_Op386MOVBstoreconst(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVBstoreconst [sc] {s} (ADDLconst [off] ptr) mem)
// cond: ValAndOff(sc).canAdd(off)
// result: (MOVBstoreconst [ValAndOff(sc).add(off)] {s} ptr mem)
for {
sc := v.AuxInt
s := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
off := v_0.AuxInt
ptr := v_0.Args[0]
mem := v.Args[1]
if !(ValAndOff(sc).canAdd(off)) {
break
}
v.reset(Op386MOVBstoreconst)
v.AuxInt = ValAndOff(sc).add(off)
v.Aux = s
v.AddArg(ptr)
v.AddArg(mem)
return true
}
// match: (MOVBstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem)
// cond: canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)
// result: (MOVBstoreconst [ValAndOff(sc).add(off)] {mergeSym(sym1, sym2)} ptr mem)
for {
sc := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
off := v_0.AuxInt
sym2 := v_0.Aux
ptr := v_0.Args[0]
mem := v.Args[1]
if !(canMergeSym(sym1, sym2) && ValAndOff(sc).canAdd(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)) {
break
}
v.reset(Op386MOVBstoreconst)
v.AuxInt = ValAndOff(sc).add(off)
v.Aux = mergeSym(sym1, sym2)
v.AddArg(ptr)
v.AddArg(mem)
return true
}
// match: (MOVBstoreconst [x] {sym1} (LEAL1 [off] {sym2} ptr idx) mem)
// cond: canMergeSym(sym1, sym2)
// result: (MOVBstoreconstidx1 [ValAndOff(x).add(off)] {mergeSym(sym1,sym2)} ptr idx mem)
for {
x := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL1 {
break
}
off := v_0.AuxInt
sym2 := v_0.Aux
ptr := v_0.Args[0]
idx := v_0.Args[1]
mem := v.Args[1]
if !(canMergeSym(sym1, sym2)) {
break
}
v.reset(Op386MOVBstoreconstidx1)
v.AuxInt = ValAndOff(x).add(off)
v.Aux = mergeSym(sym1, sym2)
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
// match: (MOVBstoreconst [x] {sym} (ADDL ptr idx) mem)
// cond:
// result: (MOVBstoreconstidx1 [x] {sym} ptr idx mem)
for {
x := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDL {
break
}
ptr := v_0.Args[0]
idx := v_0.Args[1]
mem := v.Args[1]
v.reset(Op386MOVBstoreconstidx1)
v.AuxInt = x
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
// match: (MOVBstoreconst [c] {s} p x:(MOVBstoreconst [a] {s} p mem))
// cond: x.Uses == 1 && ValAndOff(a).Off() + 1 == ValAndOff(c).Off() && clobber(x)
// result: (MOVWstoreconst [makeValAndOff(ValAndOff(a).Val()&0xff | ValAndOff(c).Val()<<8, ValAndOff(a).Off())] {s} p mem)
for {
c := v.AuxInt
s := v.Aux
p := v.Args[0]
x := v.Args[1]
if x.Op != Op386MOVBstoreconst {
break
}
a := x.AuxInt
if x.Aux != s {
break
}
if p != x.Args[0] {
break
}
mem := x.Args[1]
if !(x.Uses == 1 && ValAndOff(a).Off()+1 == ValAndOff(c).Off() && clobber(x)) {
break
}
v.reset(Op386MOVWstoreconst)
v.AuxInt = makeValAndOff(ValAndOff(a).Val()&0xff|ValAndOff(c).Val()<<8, ValAndOff(a).Off())
v.Aux = s
v.AddArg(p)
v.AddArg(mem)
return true
}
return false
}
func rewriteValue386_Op386MOVBstoreconstidx1(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVBstoreconstidx1 [x] {sym} (ADDLconst [c] ptr) idx mem)
// cond:
// result: (MOVBstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem)
for {
x := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
c := v_0.AuxInt
ptr := v_0.Args[0]
idx := v.Args[1]
mem := v.Args[2]
v.reset(Op386MOVBstoreconstidx1)
v.AuxInt = ValAndOff(x).add(c)
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
// match: (MOVBstoreconstidx1 [x] {sym} ptr (ADDLconst [c] idx) mem)
// cond:
// result: (MOVBstoreconstidx1 [ValAndOff(x).add(c)] {sym} ptr idx mem)
for {
x := v.AuxInt
sym := v.Aux
ptr := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDLconst {
break
}
c := v_1.AuxInt
idx := v_1.Args[0]
mem := v.Args[2]
v.reset(Op386MOVBstoreconstidx1)
v.AuxInt = ValAndOff(x).add(c)
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
// match: (MOVBstoreconstidx1 [c] {s} p i x:(MOVBstoreconstidx1 [a] {s} p i mem))
// cond: x.Uses == 1 && ValAndOff(a).Off() + 1 == ValAndOff(c).Off() && clobber(x)
// result: (MOVWstoreconstidx1 [makeValAndOff(ValAndOff(a).Val()&0xff | ValAndOff(c).Val()<<8, ValAndOff(a).Off())] {s} p i mem)
for {
c := v.AuxInt
s := v.Aux
p := v.Args[0]
i := v.Args[1]
x := v.Args[2]
if x.Op != Op386MOVBstoreconstidx1 {
break
}
a := x.AuxInt
if x.Aux != s {
break
}
if p != x.Args[0] {
break
}
if i != x.Args[1] {
break
}
mem := x.Args[2]
if !(x.Uses == 1 && ValAndOff(a).Off()+1 == ValAndOff(c).Off() && clobber(x)) {
break
}
v.reset(Op386MOVWstoreconstidx1)
v.AuxInt = makeValAndOff(ValAndOff(a).Val()&0xff|ValAndOff(c).Val()<<8, ValAndOff(a).Off())
v.Aux = s
v.AddArg(p)
v.AddArg(i)
v.AddArg(mem)
return true
}
return false
}
func rewriteValue386_Op386MOVBstoreidx1(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVBstoreidx1 [c] {sym} (ADDLconst [d] ptr) idx val mem)
// cond:
// result: (MOVBstoreidx1 [c+d] {sym} ptr idx val mem)
for {
c := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
d := v_0.AuxInt
ptr := v_0.Args[0]
idx := v.Args[1]
val := v.Args[2]
mem := v.Args[3]
v.reset(Op386MOVBstoreidx1)
v.AuxInt = c + d
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(val)
v.AddArg(mem)
return true
}
// match: (MOVBstoreidx1 [c] {sym} ptr (ADDLconst [d] idx) val mem)
// cond:
// result: (MOVBstoreidx1 [c+d] {sym} ptr idx val mem)
for {
c := v.AuxInt
sym := v.Aux
ptr := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDLconst {
break
}
d := v_1.AuxInt
idx := v_1.Args[0]
val := v.Args[2]
mem := v.Args[3]
v.reset(Op386MOVBstoreidx1)
v.AuxInt = c + d
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(val)
v.AddArg(mem)
return true
}
// match: (MOVBstoreidx1 [i] {s} p idx (SHRLconst [8] w) x:(MOVBstoreidx1 [i-1] {s} p idx w mem))
// cond: x.Uses == 1 && clobber(x)
// result: (MOVWstoreidx1 [i-1] {s} p idx w mem)
for {
i := v.AuxInt
s := v.Aux
p := v.Args[0]
idx := v.Args[1]
v_2 := v.Args[2]
if v_2.Op != Op386SHRLconst {
break
}
if v_2.AuxInt != 8 {
break
}
w := v_2.Args[0]
x := v.Args[3]
if x.Op != Op386MOVBstoreidx1 {
break
}
if x.AuxInt != i-1 {
break
}
if x.Aux != s {
break
}
if p != x.Args[0] {
break
}
if idx != x.Args[1] {
break
}
if w != x.Args[2] {
break
}
mem := x.Args[3]
if !(x.Uses == 1 && clobber(x)) {
break
}
v.reset(Op386MOVWstoreidx1)
v.AuxInt = i - 1
v.Aux = s
v.AddArg(p)
v.AddArg(idx)
v.AddArg(w)
v.AddArg(mem)
return true
}
// match: (MOVBstoreidx1 [i] {s} p idx (SHRLconst [j] w) x:(MOVBstoreidx1 [i-1] {s} p idx w0:(SHRLconst [j-8] w) mem))
// cond: x.Uses == 1 && clobber(x)
// result: (MOVWstoreidx1 [i-1] {s} p idx w0 mem)
for {
i := v.AuxInt
s := v.Aux
p := v.Args[0]
idx := v.Args[1]
v_2 := v.Args[2]
if v_2.Op != Op386SHRLconst {
break
}
j := v_2.AuxInt
w := v_2.Args[0]
x := v.Args[3]
if x.Op != Op386MOVBstoreidx1 {
break
}
if x.AuxInt != i-1 {
break
}
if x.Aux != s {
break
}
if p != x.Args[0] {
break
}
if idx != x.Args[1] {
break
}
w0 := x.Args[2]
if w0.Op != Op386SHRLconst {
break
}
if w0.AuxInt != j-8 {
break
}
if w != w0.Args[0] {
break
}
mem := x.Args[3]
if !(x.Uses == 1 && clobber(x)) {
break
}
v.reset(Op386MOVWstoreidx1)
v.AuxInt = i - 1
v.Aux = s
v.AddArg(p)
v.AddArg(idx)
v.AddArg(w0)
v.AddArg(mem)
return true
}
return false
}
func rewriteValue386_Op386MOVLload(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVLload [off] {sym} ptr (MOVLstore [off2] {sym2} ptr2 x _))
// cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
// result: x
for {
off := v.AuxInt
sym := v.Aux
ptr := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVLstore {
break
}
off2 := v_1.AuxInt
sym2 := v_1.Aux
ptr2 := v_1.Args[0]
x := v_1.Args[1]
if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
break
}
v.reset(OpCopy)
v.Type = x.Type
v.AddArg(x)
return true
}
// match: (MOVLload [off1] {sym} (ADDLconst [off2] ptr) mem)
// cond: is32Bit(off1+off2)
// result: (MOVLload [off1+off2] {sym} ptr mem)
for {
off1 := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
off2 := v_0.AuxInt
ptr := v_0.Args[0]
mem := v.Args[1]
if !(is32Bit(off1 + off2)) {
break
}
v.reset(Op386MOVLload)
v.AuxInt = off1 + off2
v.Aux = sym
v.AddArg(ptr)
v.AddArg(mem)
return true
}
// match: (MOVLload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
// result: (MOVLload [off1+off2] {mergeSym(sym1,sym2)} base mem)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
base := v_0.Args[0]
mem := v.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
break
}
v.reset(Op386MOVLload)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(base)
v.AddArg(mem)
return true
}
// match: (MOVLload [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) mem)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2)
// result: (MOVLloadidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL1 {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
ptr := v_0.Args[0]
idx := v_0.Args[1]
mem := v.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) {
break
}
v.reset(Op386MOVLloadidx1)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
// match: (MOVLload [off1] {sym1} (LEAL4 [off2] {sym2} ptr idx) mem)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2)
// result: (MOVLloadidx4 [off1+off2] {mergeSym(sym1,sym2)} ptr idx mem)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL4 {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
ptr := v_0.Args[0]
idx := v_0.Args[1]
mem := v.Args[1]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) {
break
}
v.reset(Op386MOVLloadidx4)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
// match: (MOVLload [off] {sym} (ADDL ptr idx) mem)
// cond: ptr.Op != OpSB
// result: (MOVLloadidx1 [off] {sym} ptr idx mem)
for {
off := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDL {
break
}
ptr := v_0.Args[0]
idx := v_0.Args[1]
mem := v.Args[1]
if !(ptr.Op != OpSB) {
break
}
v.reset(Op386MOVLloadidx1)
v.AuxInt = off
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
return false
}
func rewriteValue386_Op386MOVLloadidx1(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVLloadidx1 [c] {sym} ptr (SHLLconst [2] idx) mem)
// cond:
// result: (MOVLloadidx4 [c] {sym} ptr idx mem)
for {
c := v.AuxInt
sym := v.Aux
ptr := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386SHLLconst {
break
}
if v_1.AuxInt != 2 {
break
}
idx := v_1.Args[0]
mem := v.Args[2]
v.reset(Op386MOVLloadidx4)
v.AuxInt = c
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
// match: (MOVLloadidx1 [c] {sym} (ADDLconst [d] ptr) idx mem)
// cond:
// result: (MOVLloadidx1 [c+d] {sym} ptr idx mem)
for {
c := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
d := v_0.AuxInt
ptr := v_0.Args[0]
idx := v.Args[1]
mem := v.Args[2]
v.reset(Op386MOVLloadidx1)
v.AuxInt = c + d
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
// match: (MOVLloadidx1 [c] {sym} ptr (ADDLconst [d] idx) mem)
// cond:
// result: (MOVLloadidx1 [c+d] {sym} ptr idx mem)
for {
c := v.AuxInt
sym := v.Aux
ptr := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDLconst {
break
}
d := v_1.AuxInt
idx := v_1.Args[0]
mem := v.Args[2]
v.reset(Op386MOVLloadidx1)
v.AuxInt = c + d
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
return false
}
func rewriteValue386_Op386MOVLloadidx4(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVLloadidx4 [c] {sym} (ADDLconst [d] ptr) idx mem)
// cond:
// result: (MOVLloadidx4 [c+d] {sym} ptr idx mem)
for {
c := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
d := v_0.AuxInt
ptr := v_0.Args[0]
idx := v.Args[1]
mem := v.Args[2]
v.reset(Op386MOVLloadidx4)
v.AuxInt = c + d
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
// match: (MOVLloadidx4 [c] {sym} ptr (ADDLconst [d] idx) mem)
// cond:
// result: (MOVLloadidx4 [c+4*d] {sym} ptr idx mem)
for {
c := v.AuxInt
sym := v.Aux
ptr := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386ADDLconst {
break
}
d := v_1.AuxInt
idx := v_1.Args[0]
mem := v.Args[2]
v.reset(Op386MOVLloadidx4)
v.AuxInt = c + 4*d
v.Aux = sym
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(mem)
return true
}
return false
}
func rewriteValue386_Op386MOVLstore(v *Value, config *Config) bool {
b := v.Block
_ = b
// match: (MOVLstore [off1] {sym} (ADDLconst [off2] ptr) val mem)
// cond: is32Bit(off1+off2)
// result: (MOVLstore [off1+off2] {sym} ptr val mem)
for {
off1 := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDLconst {
break
}
off2 := v_0.AuxInt
ptr := v_0.Args[0]
val := v.Args[1]
mem := v.Args[2]
if !(is32Bit(off1 + off2)) {
break
}
v.reset(Op386MOVLstore)
v.AuxInt = off1 + off2
v.Aux = sym
v.AddArg(ptr)
v.AddArg(val)
v.AddArg(mem)
return true
}
// match: (MOVLstore [off] {sym} ptr (MOVLconst [c]) mem)
// cond: validOff(off)
// result: (MOVLstoreconst [makeValAndOff(int64(int32(c)),off)] {sym} ptr mem)
for {
off := v.AuxInt
sym := v.Aux
ptr := v.Args[0]
v_1 := v.Args[1]
if v_1.Op != Op386MOVLconst {
break
}
c := v_1.AuxInt
mem := v.Args[2]
if !(validOff(off)) {
break
}
v.reset(Op386MOVLstoreconst)
v.AuxInt = makeValAndOff(int64(int32(c)), off)
v.Aux = sym
v.AddArg(ptr)
v.AddArg(mem)
return true
}
// match: (MOVLstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
// result: (MOVLstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
base := v_0.Args[0]
val := v.Args[1]
mem := v.Args[2]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
break
}
v.reset(Op386MOVLstore)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(base)
v.AddArg(val)
v.AddArg(mem)
return true
}
// match: (MOVLstore [off1] {sym1} (LEAL1 [off2] {sym2} ptr idx) val mem)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2)
// result: (MOVLstoreidx1 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL1 {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
ptr := v_0.Args[0]
idx := v_0.Args[1]
val := v.Args[1]
mem := v.Args[2]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) {
break
}
v.reset(Op386MOVLstoreidx1)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(val)
v.AddArg(mem)
return true
}
// match: (MOVLstore [off1] {sym1} (LEAL4 [off2] {sym2} ptr idx) val mem)
// cond: is32Bit(off1+off2) && canMergeSym(sym1, sym2)
// result: (MOVLstoreidx4 [off1+off2] {mergeSym(sym1,sym2)} ptr idx val mem)
for {
off1 := v.AuxInt
sym1 := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386LEAL4 {
break
}
off2 := v_0.AuxInt
sym2 := v_0.Aux
ptr := v_0.Args[0]
idx := v_0.Args[1]
val := v.Args[1]
mem := v.Args[2]
if !(is32Bit(off1+off2) && canMergeSym(sym1, sym2)) {
break
}
v.reset(Op386MOVLstoreidx4)
v.AuxInt = off1 + off2
v.Aux = mergeSym(sym1, sym2)
v.AddArg(ptr)
v.AddArg(idx)
v.AddArg(val)
v.AddArg(mem)
return true
}
// match: (MOVLstore [off] {sym} (ADDL ptr idx) val mem)
// cond: ptr.Op != OpSB
// result: (MOVLstoreidx1 [off] {sym} ptr idx val mem)
for {
off := v.AuxInt
sym := v.Aux
v_0 := v.Args[0]
if v_0.Op != Op386ADDL {
break
}
ptr := v_0.Args[0]
idx := v_0.Args[1]
val := v.Args[1]
mem := v.Args[2]
if !(ptr.Op != OpSB) {
break
}