src/cmd/compile/internal/ssa/rewritegeneric.go GO 39,910 lines View on github.com → Search inside
File is large — showing lines 1–2,000 of 39,910.
1// Code generated from _gen/generic.rules using 'go generate'; DO NOT EDIT.23package ssa45import "math"6import "math/bits"7import "cmd/internal/obj"8import "cmd/compile/internal/types"9import "cmd/compile/internal/ir"1011func rewriteValuegeneric(v *Value) bool {12	switch v.Op {13	case OpAdd16:14		return rewriteValuegeneric_OpAdd16(v)15	case OpAdd32:16		return rewriteValuegeneric_OpAdd32(v)17	case OpAdd32F:18		return rewriteValuegeneric_OpAdd32F(v)19	case OpAdd64:20		return rewriteValuegeneric_OpAdd64(v)21	case OpAdd64F:22		return rewriteValuegeneric_OpAdd64F(v)23	case OpAdd64carry:24		return rewriteValuegeneric_OpAdd64carry(v)25	case OpAdd8:26		return rewriteValuegeneric_OpAdd8(v)27	case OpAddPtr:28		return rewriteValuegeneric_OpAddPtr(v)29	case OpAnd16:30		return rewriteValuegeneric_OpAnd16(v)31	case OpAnd32:32		return rewriteValuegeneric_OpAnd32(v)33	case OpAnd64:34		return rewriteValuegeneric_OpAnd64(v)35	case OpAnd8:36		return rewriteValuegeneric_OpAnd8(v)37	case OpAndB:38		return rewriteValuegeneric_OpAndB(v)39	case OpArraySelect:40		return rewriteValuegeneric_OpArraySelect(v)41	case OpBitLen16:42		return rewriteValuegeneric_OpBitLen16(v)43	case OpBitLen32:44		return rewriteValuegeneric_OpBitLen32(v)45	case OpBitLen64:46		return rewriteValuegeneric_OpBitLen64(v)47	case OpBitLen8:48		return rewriteValuegeneric_OpBitLen8(v)49	case OpCeil:50		return rewriteValuegeneric_OpCeil(v)51	case OpCom16:52		return rewriteValuegeneric_OpCom16(v)53	case OpCom32:54		return rewriteValuegeneric_OpCom32(v)55	case OpCom64:56		return rewriteValuegeneric_OpCom64(v)57	case OpCom8:58		return rewriteValuegeneric_OpCom8(v)59	case OpCondSelect:60		return rewriteValuegeneric_OpCondSelect(v)61	case OpConstInterface:62		return rewriteValuegeneric_OpConstInterface(v)63	case OpConstSlice:64		return rewriteValuegeneric_OpConstSlice(v)65	case OpConstString:66		return rewriteValuegeneric_OpConstString(v)67	case OpConvert:68		return rewriteValuegeneric_OpConvert(v)69	case OpCtz16:70		return rewriteValuegeneric_OpCtz16(v)71	case OpCtz32:72		return rewriteValuegeneric_OpCtz32(v)73	case OpCtz64:74		return rewriteValuegeneric_OpCtz64(v)75	case OpCtz8:76		return rewriteValuegeneric_OpCtz8(v)77	case OpCvt32Fto32:78		return rewriteValuegeneric_OpCvt32Fto32(v)79	case OpCvt32Fto64:80		return rewriteValuegeneric_OpCvt32Fto64(v)81	case OpCvt32Fto64F:82		return rewriteValuegeneric_OpCvt32Fto64F(v)83	case OpCvt32to32F:84		return rewriteValuegeneric_OpCvt32to32F(v)85	case OpCvt32to64F:86		return rewriteValuegeneric_OpCvt32to64F(v)87	case OpCvt64Fto32:88		return rewriteValuegeneric_OpCvt64Fto32(v)89	case OpCvt64Fto32F:90		return rewriteValuegeneric_OpCvt64Fto32F(v)91	case OpCvt64Fto64:92		return rewriteValuegeneric_OpCvt64Fto64(v)93	case OpCvt64to32F:94		return rewriteValuegeneric_OpCvt64to32F(v)95	case OpCvt64to64F:96		return rewriteValuegeneric_OpCvt64to64F(v)97	case OpCvtBoolToUint8:98		return rewriteValuegeneric_OpCvtBoolToUint8(v)99	case OpDiv128u:100		return rewriteValuegeneric_OpDiv128u(v)101	case OpDiv16:102		return rewriteValuegeneric_OpDiv16(v)103	case OpDiv16u:104		return rewriteValuegeneric_OpDiv16u(v)105	case OpDiv32:106		return rewriteValuegeneric_OpDiv32(v)107	case OpDiv32F:108		return rewriteValuegeneric_OpDiv32F(v)109	case OpDiv32u:110		return rewriteValuegeneric_OpDiv32u(v)111	case OpDiv64:112		return rewriteValuegeneric_OpDiv64(v)113	case OpDiv64F:114		return rewriteValuegeneric_OpDiv64F(v)115	case OpDiv64u:116		return rewriteValuegeneric_OpDiv64u(v)117	case OpDiv8:118		return rewriteValuegeneric_OpDiv8(v)119	case OpDiv8u:120		return rewriteValuegeneric_OpDiv8u(v)121	case OpEq16:122		return rewriteValuegeneric_OpEq16(v)123	case OpEq32:124		return rewriteValuegeneric_OpEq32(v)125	case OpEq32F:126		return rewriteValuegeneric_OpEq32F(v)127	case OpEq64:128		return rewriteValuegeneric_OpEq64(v)129	case OpEq64F:130		return rewriteValuegeneric_OpEq64F(v)131	case OpEq8:132		return rewriteValuegeneric_OpEq8(v)133	case OpEqB:134		return rewriteValuegeneric_OpEqB(v)135	case OpEqInter:136		return rewriteValuegeneric_OpEqInter(v)137	case OpEqPtr:138		return rewriteValuegeneric_OpEqPtr(v)139	case OpEqSlice:140		return rewriteValuegeneric_OpEqSlice(v)141	case OpFloor:142		return rewriteValuegeneric_OpFloor(v)143	case OpIMake:144		return rewriteValuegeneric_OpIMake(v)145	case OpInterLECall:146		return rewriteValuegeneric_OpInterLECall(v)147	case OpIsInBounds:148		return rewriteValuegeneric_OpIsInBounds(v)149	case OpIsNonNil:150		return rewriteValuegeneric_OpIsNonNil(v)151	case OpIsSliceInBounds:152		return rewriteValuegeneric_OpIsSliceInBounds(v)153	case OpLeq16:154		return rewriteValuegeneric_OpLeq16(v)155	case OpLeq16U:156		return rewriteValuegeneric_OpLeq16U(v)157	case OpLeq32:158		return rewriteValuegeneric_OpLeq32(v)159	case OpLeq32F:160		return rewriteValuegeneric_OpLeq32F(v)161	case OpLeq32U:162		return rewriteValuegeneric_OpLeq32U(v)163	case OpLeq64:164		return rewriteValuegeneric_OpLeq64(v)165	case OpLeq64F:166		return rewriteValuegeneric_OpLeq64F(v)167	case OpLeq64U:168		return rewriteValuegeneric_OpLeq64U(v)169	case OpLeq8:170		return rewriteValuegeneric_OpLeq8(v)171	case OpLeq8U:172		return rewriteValuegeneric_OpLeq8U(v)173	case OpLess16:174		return rewriteValuegeneric_OpLess16(v)175	case OpLess16U:176		return rewriteValuegeneric_OpLess16U(v)177	case OpLess32:178		return rewriteValuegeneric_OpLess32(v)179	case OpLess32F:180		return rewriteValuegeneric_OpLess32F(v)181	case OpLess32U:182		return rewriteValuegeneric_OpLess32U(v)183	case OpLess64:184		return rewriteValuegeneric_OpLess64(v)185	case OpLess64F:186		return rewriteValuegeneric_OpLess64F(v)187	case OpLess64U:188		return rewriteValuegeneric_OpLess64U(v)189	case OpLess8:190		return rewriteValuegeneric_OpLess8(v)191	case OpLess8U:192		return rewriteValuegeneric_OpLess8U(v)193	case OpLoad:194		return rewriteValuegeneric_OpLoad(v)195	case OpLsh16x16:196		return rewriteValuegeneric_OpLsh16x16(v)197	case OpLsh16x32:198		return rewriteValuegeneric_OpLsh16x32(v)199	case OpLsh16x64:200		return rewriteValuegeneric_OpLsh16x64(v)201	case OpLsh16x8:202		return rewriteValuegeneric_OpLsh16x8(v)203	case OpLsh32x16:204		return rewriteValuegeneric_OpLsh32x16(v)205	case OpLsh32x32:206		return rewriteValuegeneric_OpLsh32x32(v)207	case OpLsh32x64:208		return rewriteValuegeneric_OpLsh32x64(v)209	case OpLsh32x8:210		return rewriteValuegeneric_OpLsh32x8(v)211	case OpLsh64x16:212		return rewriteValuegeneric_OpLsh64x16(v)213	case OpLsh64x32:214		return rewriteValuegeneric_OpLsh64x32(v)215	case OpLsh64x64:216		return rewriteValuegeneric_OpLsh64x64(v)217	case OpLsh64x8:218		return rewriteValuegeneric_OpLsh64x8(v)219	case OpLsh8x16:220		return rewriteValuegeneric_OpLsh8x16(v)221	case OpLsh8x32:222		return rewriteValuegeneric_OpLsh8x32(v)223	case OpLsh8x64:224		return rewriteValuegeneric_OpLsh8x64(v)225	case OpLsh8x8:226		return rewriteValuegeneric_OpLsh8x8(v)227	case OpMemEq:228		return rewriteValuegeneric_OpMemEq(v)229	case OpMod16:230		return rewriteValuegeneric_OpMod16(v)231	case OpMod16u:232		return rewriteValuegeneric_OpMod16u(v)233	case OpMod32:234		return rewriteValuegeneric_OpMod32(v)235	case OpMod32u:236		return rewriteValuegeneric_OpMod32u(v)237	case OpMod64:238		return rewriteValuegeneric_OpMod64(v)239	case OpMod64u:240		return rewriteValuegeneric_OpMod64u(v)241	case OpMod8:242		return rewriteValuegeneric_OpMod8(v)243	case OpMod8u:244		return rewriteValuegeneric_OpMod8u(v)245	case OpMove:246		return rewriteValuegeneric_OpMove(v)247	case OpMul16:248		return rewriteValuegeneric_OpMul16(v)249	case OpMul32:250		return rewriteValuegeneric_OpMul32(v)251	case OpMul32F:252		return rewriteValuegeneric_OpMul32F(v)253	case OpMul32uhilo:254		return rewriteValuegeneric_OpMul32uhilo(v)255	case OpMul32uover:256		return rewriteValuegeneric_OpMul32uover(v)257	case OpMul64:258		return rewriteValuegeneric_OpMul64(v)259	case OpMul64F:260		return rewriteValuegeneric_OpMul64F(v)261	case OpMul64uhilo:262		return rewriteValuegeneric_OpMul64uhilo(v)263	case OpMul64uover:264		return rewriteValuegeneric_OpMul64uover(v)265	case OpMul8:266		return rewriteValuegeneric_OpMul8(v)267	case OpNeg16:268		return rewriteValuegeneric_OpNeg16(v)269	case OpNeg32:270		return rewriteValuegeneric_OpNeg32(v)271	case OpNeg32F:272		return rewriteValuegeneric_OpNeg32F(v)273	case OpNeg64:274		return rewriteValuegeneric_OpNeg64(v)275	case OpNeg64F:276		return rewriteValuegeneric_OpNeg64F(v)277	case OpNeg8:278		return rewriteValuegeneric_OpNeg8(v)279	case OpNeq16:280		return rewriteValuegeneric_OpNeq16(v)281	case OpNeq32:282		return rewriteValuegeneric_OpNeq32(v)283	case OpNeq32F:284		return rewriteValuegeneric_OpNeq32F(v)285	case OpNeq64:286		return rewriteValuegeneric_OpNeq64(v)287	case OpNeq64F:288		return rewriteValuegeneric_OpNeq64F(v)289	case OpNeq8:290		return rewriteValuegeneric_OpNeq8(v)291	case OpNeqB:292		return rewriteValuegeneric_OpNeqB(v)293	case OpNeqInter:294		return rewriteValuegeneric_OpNeqInter(v)295	case OpNeqPtr:296		return rewriteValuegeneric_OpNeqPtr(v)297	case OpNeqSlice:298		return rewriteValuegeneric_OpNeqSlice(v)299	case OpNilCheck:300		return rewriteValuegeneric_OpNilCheck(v)301	case OpNot:302		return rewriteValuegeneric_OpNot(v)303	case OpOffPtr:304		return rewriteValuegeneric_OpOffPtr(v)305	case OpOr16:306		return rewriteValuegeneric_OpOr16(v)307	case OpOr32:308		return rewriteValuegeneric_OpOr32(v)309	case OpOr64:310		return rewriteValuegeneric_OpOr64(v)311	case OpOr8:312		return rewriteValuegeneric_OpOr8(v)313	case OpOrB:314		return rewriteValuegeneric_OpOrB(v)315	case OpPhi:316		return rewriteValuegeneric_OpPhi(v)317	case OpPopCount16:318		return rewriteValuegeneric_OpPopCount16(v)319	case OpPopCount32:320		return rewriteValuegeneric_OpPopCount32(v)321	case OpPopCount64:322		return rewriteValuegeneric_OpPopCount64(v)323	case OpPopCount8:324		return rewriteValuegeneric_OpPopCount8(v)325	case OpPtrIndex:326		return rewriteValuegeneric_OpPtrIndex(v)327	case OpRotateLeft16:328		return rewriteValuegeneric_OpRotateLeft16(v)329	case OpRotateLeft32:330		return rewriteValuegeneric_OpRotateLeft32(v)331	case OpRotateLeft64:332		return rewriteValuegeneric_OpRotateLeft64(v)333	case OpRotateLeft8:334		return rewriteValuegeneric_OpRotateLeft8(v)335	case OpRound32F:336		return rewriteValuegeneric_OpRound32F(v)337	case OpRound64F:338		return rewriteValuegeneric_OpRound64F(v)339	case OpRoundToEven:340		return rewriteValuegeneric_OpRoundToEven(v)341	case OpRsh16Ux16:342		return rewriteValuegeneric_OpRsh16Ux16(v)343	case OpRsh16Ux32:344		return rewriteValuegeneric_OpRsh16Ux32(v)345	case OpRsh16Ux64:346		return rewriteValuegeneric_OpRsh16Ux64(v)347	case OpRsh16Ux8:348		return rewriteValuegeneric_OpRsh16Ux8(v)349	case OpRsh16x16:350		return rewriteValuegeneric_OpRsh16x16(v)351	case OpRsh16x32:352		return rewriteValuegeneric_OpRsh16x32(v)353	case OpRsh16x64:354		return rewriteValuegeneric_OpRsh16x64(v)355	case OpRsh16x8:356		return rewriteValuegeneric_OpRsh16x8(v)357	case OpRsh32Ux16:358		return rewriteValuegeneric_OpRsh32Ux16(v)359	case OpRsh32Ux32:360		return rewriteValuegeneric_OpRsh32Ux32(v)361	case OpRsh32Ux64:362		return rewriteValuegeneric_OpRsh32Ux64(v)363	case OpRsh32Ux8:364		return rewriteValuegeneric_OpRsh32Ux8(v)365	case OpRsh32x16:366		return rewriteValuegeneric_OpRsh32x16(v)367	case OpRsh32x32:368		return rewriteValuegeneric_OpRsh32x32(v)369	case OpRsh32x64:370		return rewriteValuegeneric_OpRsh32x64(v)371	case OpRsh32x8:372		return rewriteValuegeneric_OpRsh32x8(v)373	case OpRsh64Ux16:374		return rewriteValuegeneric_OpRsh64Ux16(v)375	case OpRsh64Ux32:376		return rewriteValuegeneric_OpRsh64Ux32(v)377	case OpRsh64Ux64:378		return rewriteValuegeneric_OpRsh64Ux64(v)379	case OpRsh64Ux8:380		return rewriteValuegeneric_OpRsh64Ux8(v)381	case OpRsh64x16:382		return rewriteValuegeneric_OpRsh64x16(v)383	case OpRsh64x32:384		return rewriteValuegeneric_OpRsh64x32(v)385	case OpRsh64x64:386		return rewriteValuegeneric_OpRsh64x64(v)387	case OpRsh64x8:388		return rewriteValuegeneric_OpRsh64x8(v)389	case OpRsh8Ux16:390		return rewriteValuegeneric_OpRsh8Ux16(v)391	case OpRsh8Ux32:392		return rewriteValuegeneric_OpRsh8Ux32(v)393	case OpRsh8Ux64:394		return rewriteValuegeneric_OpRsh8Ux64(v)395	case OpRsh8Ux8:396		return rewriteValuegeneric_OpRsh8Ux8(v)397	case OpRsh8x16:398		return rewriteValuegeneric_OpRsh8x16(v)399	case OpRsh8x32:400		return rewriteValuegeneric_OpRsh8x32(v)401	case OpRsh8x64:402		return rewriteValuegeneric_OpRsh8x64(v)403	case OpRsh8x8:404		return rewriteValuegeneric_OpRsh8x8(v)405	case OpSelect0:406		return rewriteValuegeneric_OpSelect0(v)407	case OpSelect1:408		return rewriteValuegeneric_OpSelect1(v)409	case OpSelectN:410		return rewriteValuegeneric_OpSelectN(v)411	case OpSignExt16to32:412		return rewriteValuegeneric_OpSignExt16to32(v)413	case OpSignExt16to64:414		return rewriteValuegeneric_OpSignExt16to64(v)415	case OpSignExt32to64:416		return rewriteValuegeneric_OpSignExt32to64(v)417	case OpSignExt8to16:418		return rewriteValuegeneric_OpSignExt8to16(v)419	case OpSignExt8to32:420		return rewriteValuegeneric_OpSignExt8to32(v)421	case OpSignExt8to64:422		return rewriteValuegeneric_OpSignExt8to64(v)423	case OpSliceCap:424		return rewriteValuegeneric_OpSliceCap(v)425	case OpSliceLen:426		return rewriteValuegeneric_OpSliceLen(v)427	case OpSliceMake:428		return rewriteValuegeneric_OpSliceMake(v)429	case OpSlicePtr:430		return rewriteValuegeneric_OpSlicePtr(v)431	case OpSlicemask:432		return rewriteValuegeneric_OpSlicemask(v)433	case OpSqrt:434		return rewriteValuegeneric_OpSqrt(v)435	case OpStaticCall:436		return rewriteValuegeneric_OpStaticCall(v)437	case OpStaticLECall:438		return rewriteValuegeneric_OpStaticLECall(v)439	case OpStore:440		return rewriteValuegeneric_OpStore(v)441	case OpStringLen:442		return rewriteValuegeneric_OpStringLen(v)443	case OpStringPtr:444		return rewriteValuegeneric_OpStringPtr(v)445	case OpStructSelect:446		return rewriteValuegeneric_OpStructSelect(v)447	case OpSub16:448		return rewriteValuegeneric_OpSub16(v)449	case OpSub32:450		return rewriteValuegeneric_OpSub32(v)451	case OpSub32F:452		return rewriteValuegeneric_OpSub32F(v)453	case OpSub64:454		return rewriteValuegeneric_OpSub64(v)455	case OpSub64F:456		return rewriteValuegeneric_OpSub64F(v)457	case OpSub8:458		return rewriteValuegeneric_OpSub8(v)459	case OpTrunc:460		return rewriteValuegeneric_OpTrunc(v)461	case OpTrunc16to8:462		return rewriteValuegeneric_OpTrunc16to8(v)463	case OpTrunc32to16:464		return rewriteValuegeneric_OpTrunc32to16(v)465	case OpTrunc32to8:466		return rewriteValuegeneric_OpTrunc32to8(v)467	case OpTrunc64to16:468		return rewriteValuegeneric_OpTrunc64to16(v)469	case OpTrunc64to32:470		return rewriteValuegeneric_OpTrunc64to32(v)471	case OpTrunc64to8:472		return rewriteValuegeneric_OpTrunc64to8(v)473	case OpXor16:474		return rewriteValuegeneric_OpXor16(v)475	case OpXor32:476		return rewriteValuegeneric_OpXor32(v)477	case OpXor64:478		return rewriteValuegeneric_OpXor64(v)479	case OpXor8:480		return rewriteValuegeneric_OpXor8(v)481	case OpZero:482		return rewriteValuegeneric_OpZero(v)483	case OpZeroExt16to32:484		return rewriteValuegeneric_OpZeroExt16to32(v)485	case OpZeroExt16to64:486		return rewriteValuegeneric_OpZeroExt16to64(v)487	case OpZeroExt32to64:488		return rewriteValuegeneric_OpZeroExt32to64(v)489	case OpZeroExt8to16:490		return rewriteValuegeneric_OpZeroExt8to16(v)491	case OpZeroExt8to32:492		return rewriteValuegeneric_OpZeroExt8to32(v)493	case OpZeroExt8to64:494		return rewriteValuegeneric_OpZeroExt8to64(v)495	}496	return false497}498func rewriteValuegeneric_OpAdd16(v *Value) bool {499	v_1 := v.Args[1]500	v_0 := v.Args[0]501	b := v.Block502	config := b.Func.Config503	// match: (Add16 (Const16 [c]) (Const16 [d]))504	// result: (Const16 [c+d])505	for {506		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {507			if v_0.Op != OpConst16 {508				continue509			}510			c := auxIntToInt16(v_0.AuxInt)511			if v_1.Op != OpConst16 {512				continue513			}514			d := auxIntToInt16(v_1.AuxInt)515			v.reset(OpConst16)516			v.AuxInt = int16ToAuxInt(c + d)517			return true518		}519		break520	}521	// match: (Add16 <t> (Mul16 x y) (Mul16 x z))522	// result: (Mul16 x (Add16 <t> y z))523	for {524		t := v.Type525		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {526			if v_0.Op != OpMul16 {527				continue528			}529			_ = v_0.Args[1]530			v_0_0 := v_0.Args[0]531			v_0_1 := v_0.Args[1]532			for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 {533				x := v_0_0534				y := v_0_1535				if v_1.Op != OpMul16 {536					continue537				}538				_ = v_1.Args[1]539				v_1_0 := v_1.Args[0]540				v_1_1 := v_1.Args[1]541				for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 {542					if x != v_1_0 {543						continue544					}545					z := v_1_1546					v.reset(OpMul16)547					v0 := b.NewValue0(v.Pos, OpAdd16, t)548					v0.AddArg2(y, z)549					v.AddArg2(x, v0)550					return true551				}552			}553		}554		break555	}556	// match: (Add16 x x)557	// result: (Lsh16x64 x (Const64 <types.Types[types.TUINT64]> [1]))558	for {559		x := v_0560		if x != v_1 {561			break562		}563		v.reset(OpLsh16x64)564		v0 := b.NewValue0(v.Pos, OpConst64, types.Types[types.TUINT64])565		v0.AuxInt = int64ToAuxInt(1)566		v.AddArg2(x, v0)567		return true568	}569	// match: (Add16 (Const16 [0]) x)570	// result: x571	for {572		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {573			if v_0.Op != OpConst16 || auxIntToInt16(v_0.AuxInt) != 0 {574				continue575			}576			x := v_1577			v.copyOf(x)578			return true579		}580		break581	}582	// match: (Add16 x (Neg16 y))583	// result: (Sub16 x y)584	for {585		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {586			x := v_0587			if v_1.Op != OpNeg16 {588				continue589			}590			y := v_1.Args[0]591			v.reset(OpSub16)592			v.AddArg2(x, y)593			return true594		}595		break596	}597	// match: (Add16 (Com16 x) x)598	// result: (Const16 [-1])599	for {600		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {601			if v_0.Op != OpCom16 {602				continue603			}604			x := v_0.Args[0]605			if x != v_1 {606				continue607			}608			v.reset(OpConst16)609			v.AuxInt = int16ToAuxInt(-1)610			return true611		}612		break613	}614	// match: (Add16 (Sub16 x t) (Add16 t y))615	// result: (Add16 x y)616	for {617		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {618			if v_0.Op != OpSub16 {619				continue620			}621			t := v_0.Args[1]622			x := v_0.Args[0]623			if v_1.Op != OpAdd16 {624				continue625			}626			_ = v_1.Args[1]627			v_1_0 := v_1.Args[0]628			v_1_1 := v_1.Args[1]629			for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 {630				if t != v_1_0 {631					continue632				}633				y := v_1_1634				v.reset(OpAdd16)635				v.AddArg2(x, y)636				return true637			}638		}639		break640	}641	// match: (Add16 (Const16 [1]) (Com16 x))642	// result: (Neg16 x)643	for {644		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {645			if v_0.Op != OpConst16 || auxIntToInt16(v_0.AuxInt) != 1 || v_1.Op != OpCom16 {646				continue647			}648			x := v_1.Args[0]649			v.reset(OpNeg16)650			v.AddArg(x)651			return true652		}653		break654	}655	// match: (Add16 x (Sub16 y x))656	// result: y657	for {658		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {659			x := v_0660			if v_1.Op != OpSub16 {661				continue662			}663			_ = v_1.Args[1]664			y := v_1.Args[0]665			if x != v_1.Args[1] {666				continue667			}668			v.copyOf(y)669			return true670		}671		break672	}673	// match: (Add16 x (Add16 y (Sub16 z x)))674	// result: (Add16 y z)675	for {676		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {677			x := v_0678			if v_1.Op != OpAdd16 {679				continue680			}681			_ = v_1.Args[1]682			v_1_0 := v_1.Args[0]683			v_1_1 := v_1.Args[1]684			for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 {685				y := v_1_0686				if v_1_1.Op != OpSub16 {687					continue688				}689				_ = v_1_1.Args[1]690				z := v_1_1.Args[0]691				if x != v_1_1.Args[1] {692					continue693				}694				v.reset(OpAdd16)695				v.AddArg2(y, z)696				return true697			}698		}699		break700	}701	// match: (Add16 (Add16 i:(Const16 <t>) z) x)702	// cond: (z.Op != OpConst16 && x.Op != OpConst16)703	// result: (Add16 i (Add16 <t> z x))704	for {705		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {706			if v_0.Op != OpAdd16 {707				continue708			}709			_ = v_0.Args[1]710			v_0_0 := v_0.Args[0]711			v_0_1 := v_0.Args[1]712			for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 {713				i := v_0_0714				if i.Op != OpConst16 {715					continue716				}717				t := i.Type718				z := v_0_1719				x := v_1720				if !(z.Op != OpConst16 && x.Op != OpConst16) {721					continue722				}723				v.reset(OpAdd16)724				v0 := b.NewValue0(v.Pos, OpAdd16, t)725				v0.AddArg2(z, x)726				v.AddArg2(i, v0)727				return true728			}729		}730		break731	}732	// match: (Add16 (Sub16 i:(Const16 <t>) z) x)733	// cond: (z.Op != OpConst16 && x.Op != OpConst16)734	// result: (Add16 i (Sub16 <t> x z))735	for {736		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {737			if v_0.Op != OpSub16 {738				continue739			}740			z := v_0.Args[1]741			i := v_0.Args[0]742			if i.Op != OpConst16 {743				continue744			}745			t := i.Type746			x := v_1747			if !(z.Op != OpConst16 && x.Op != OpConst16) {748				continue749			}750			v.reset(OpAdd16)751			v0 := b.NewValue0(v.Pos, OpSub16, t)752			v0.AddArg2(x, z)753			v.AddArg2(i, v0)754			return true755		}756		break757	}758	// match: (Add16 (Const16 <t> [c]) (Add16 (Const16 <t> [d]) x))759	// result: (Add16 (Const16 <t> [c+d]) x)760	for {761		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {762			if v_0.Op != OpConst16 {763				continue764			}765			t := v_0.Type766			c := auxIntToInt16(v_0.AuxInt)767			if v_1.Op != OpAdd16 {768				continue769			}770			_ = v_1.Args[1]771			v_1_0 := v_1.Args[0]772			v_1_1 := v_1.Args[1]773			for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 {774				if v_1_0.Op != OpConst16 || v_1_0.Type != t {775					continue776				}777				d := auxIntToInt16(v_1_0.AuxInt)778				x := v_1_1779				v.reset(OpAdd16)780				v0 := b.NewValue0(v.Pos, OpConst16, t)781				v0.AuxInt = int16ToAuxInt(c + d)782				v.AddArg2(v0, x)783				return true784			}785		}786		break787	}788	// match: (Add16 (Const16 <t> [c]) (Sub16 (Const16 <t> [d]) x))789	// result: (Sub16 (Const16 <t> [c+d]) x)790	for {791		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {792			if v_0.Op != OpConst16 {793				continue794			}795			t := v_0.Type796			c := auxIntToInt16(v_0.AuxInt)797			if v_1.Op != OpSub16 {798				continue799			}800			x := v_1.Args[1]801			v_1_0 := v_1.Args[0]802			if v_1_0.Op != OpConst16 || v_1_0.Type != t {803				continue804			}805			d := auxIntToInt16(v_1_0.AuxInt)806			v.reset(OpSub16)807			v0 := b.NewValue0(v.Pos, OpConst16, t)808			v0.AuxInt = int16ToAuxInt(c + d)809			v.AddArg2(v0, x)810			return true811		}812		break813	}814	// match: (Add16 (Lsh16x64 x z:(Const64 <t> [c])) (Rsh16Ux64 x (Const64 [d])))815	// cond: c < 16 && d == 16-c && canRotate(config, 16)816	// result: (RotateLeft16 x z)817	for {818		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {819			if v_0.Op != OpLsh16x64 {820				continue821			}822			_ = v_0.Args[1]823			x := v_0.Args[0]824			z := v_0.Args[1]825			if z.Op != OpConst64 {826				continue827			}828			c := auxIntToInt64(z.AuxInt)829			if v_1.Op != OpRsh16Ux64 {830				continue831			}832			_ = v_1.Args[1]833			if x != v_1.Args[0] {834				continue835			}836			v_1_1 := v_1.Args[1]837			if v_1_1.Op != OpConst64 {838				continue839			}840			d := auxIntToInt64(v_1_1.AuxInt)841			if !(c < 16 && d == 16-c && canRotate(config, 16)) {842				continue843			}844			v.reset(OpRotateLeft16)845			v.AddArg2(x, z)846			return true847		}848		break849	}850	// match: (Add16 left:(Lsh16x64 x y) right:(Rsh16Ux64 x (Sub64 (Const64 [16]) y)))851	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)852	// result: (RotateLeft16 x y)853	for {854		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {855			left := v_0856			if left.Op != OpLsh16x64 {857				continue858			}859			y := left.Args[1]860			x := left.Args[0]861			right := v_1862			if right.Op != OpRsh16Ux64 {863				continue864			}865			_ = right.Args[1]866			if x != right.Args[0] {867				continue868			}869			right_1 := right.Args[1]870			if right_1.Op != OpSub64 {871				continue872			}873			_ = right_1.Args[1]874			right_1_0 := right_1.Args[0]875			if right_1_0.Op != OpConst64 || auxIntToInt64(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)) {876				continue877			}878			v.reset(OpRotateLeft16)879			v.AddArg2(x, y)880			return true881		}882		break883	}884	// match: (Add16 left:(Lsh16x32 x y) right:(Rsh16Ux32 x (Sub32 (Const32 [16]) y)))885	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)886	// result: (RotateLeft16 x y)887	for {888		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {889			left := v_0890			if left.Op != OpLsh16x32 {891				continue892			}893			y := left.Args[1]894			x := left.Args[0]895			right := v_1896			if right.Op != OpRsh16Ux32 {897				continue898			}899			_ = right.Args[1]900			if x != right.Args[0] {901				continue902			}903			right_1 := right.Args[1]904			if right_1.Op != OpSub32 {905				continue906			}907			_ = right_1.Args[1]908			right_1_0 := right_1.Args[0]909			if right_1_0.Op != OpConst32 || auxIntToInt32(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)) {910				continue911			}912			v.reset(OpRotateLeft16)913			v.AddArg2(x, y)914			return true915		}916		break917	}918	// match: (Add16 left:(Lsh16x16 x y) right:(Rsh16Ux16 x (Sub16 (Const16 [16]) y)))919	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)920	// result: (RotateLeft16 x y)921	for {922		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {923			left := v_0924			if left.Op != OpLsh16x16 {925				continue926			}927			y := left.Args[1]928			x := left.Args[0]929			right := v_1930			if right.Op != OpRsh16Ux16 {931				continue932			}933			_ = right.Args[1]934			if x != right.Args[0] {935				continue936			}937			right_1 := right.Args[1]938			if right_1.Op != OpSub16 {939				continue940			}941			_ = right_1.Args[1]942			right_1_0 := right_1.Args[0]943			if right_1_0.Op != OpConst16 || auxIntToInt16(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)) {944				continue945			}946			v.reset(OpRotateLeft16)947			v.AddArg2(x, y)948			return true949		}950		break951	}952	// match: (Add16 left:(Lsh16x8 x y) right:(Rsh16Ux8 x (Sub8 (Const8 [16]) y)))953	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)954	// result: (RotateLeft16 x y)955	for {956		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {957			left := v_0958			if left.Op != OpLsh16x8 {959				continue960			}961			y := left.Args[1]962			x := left.Args[0]963			right := v_1964			if right.Op != OpRsh16Ux8 {965				continue966			}967			_ = right.Args[1]968			if x != right.Args[0] {969				continue970			}971			right_1 := right.Args[1]972			if right_1.Op != OpSub8 {973				continue974			}975			_ = right_1.Args[1]976			right_1_0 := right_1.Args[0]977			if right_1_0.Op != OpConst8 || auxIntToInt8(right_1_0.AuxInt) != 16 || y != right_1.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)) {978				continue979			}980			v.reset(OpRotateLeft16)981			v.AddArg2(x, y)982			return true983		}984		break985	}986	// match: (Add16 right:(Rsh16Ux64 x y) left:(Lsh16x64 x z:(Sub64 (Const64 [16]) y)))987	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)988	// result: (RotateLeft16 x z)989	for {990		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {991			right := v_0992			if right.Op != OpRsh16Ux64 {993				continue994			}995			y := right.Args[1]996			x := right.Args[0]997			left := v_1998			if left.Op != OpLsh16x64 {999				continue1000			}1001			_ = left.Args[1]1002			if x != left.Args[0] {1003				continue1004			}1005			z := left.Args[1]1006			if z.Op != OpSub64 {1007				continue1008			}1009			_ = z.Args[1]1010			z_0 := z.Args[0]1011			if z_0.Op != OpConst64 || auxIntToInt64(z_0.AuxInt) != 16 || y != z.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)) {1012				continue1013			}1014			v.reset(OpRotateLeft16)1015			v.AddArg2(x, z)1016			return true1017		}1018		break1019	}1020	// match: (Add16 right:(Rsh16Ux32 x y) left:(Lsh16x32 x z:(Sub32 (Const32 [16]) y)))1021	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)1022	// result: (RotateLeft16 x z)1023	for {1024		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1025			right := v_01026			if right.Op != OpRsh16Ux32 {1027				continue1028			}1029			y := right.Args[1]1030			x := right.Args[0]1031			left := v_11032			if left.Op != OpLsh16x32 {1033				continue1034			}1035			_ = left.Args[1]1036			if x != left.Args[0] {1037				continue1038			}1039			z := left.Args[1]1040			if z.Op != OpSub32 {1041				continue1042			}1043			_ = z.Args[1]1044			z_0 := z.Args[0]1045			if z_0.Op != OpConst32 || auxIntToInt32(z_0.AuxInt) != 16 || y != z.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)) {1046				continue1047			}1048			v.reset(OpRotateLeft16)1049			v.AddArg2(x, z)1050			return true1051		}1052		break1053	}1054	// match: (Add16 right:(Rsh16Ux16 x y) left:(Lsh16x16 x z:(Sub16 (Const16 [16]) y)))1055	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)1056	// result: (RotateLeft16 x z)1057	for {1058		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1059			right := v_01060			if right.Op != OpRsh16Ux16 {1061				continue1062			}1063			y := right.Args[1]1064			x := right.Args[0]1065			left := v_11066			if left.Op != OpLsh16x16 {1067				continue1068			}1069			_ = left.Args[1]1070			if x != left.Args[0] {1071				continue1072			}1073			z := left.Args[1]1074			if z.Op != OpSub16 {1075				continue1076			}1077			_ = z.Args[1]1078			z_0 := z.Args[0]1079			if z_0.Op != OpConst16 || auxIntToInt16(z_0.AuxInt) != 16 || y != z.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)) {1080				continue1081			}1082			v.reset(OpRotateLeft16)1083			v.AddArg2(x, z)1084			return true1085		}1086		break1087	}1088	// match: (Add16 right:(Rsh16Ux8 x y) left:(Lsh16x8 x z:(Sub8 (Const8 [16]) y)))1089	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)1090	// result: (RotateLeft16 x z)1091	for {1092		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1093			right := v_01094			if right.Op != OpRsh16Ux8 {1095				continue1096			}1097			y := right.Args[1]1098			x := right.Args[0]1099			left := v_11100			if left.Op != OpLsh16x8 {1101				continue1102			}1103			_ = left.Args[1]1104			if x != left.Args[0] {1105				continue1106			}1107			z := left.Args[1]1108			if z.Op != OpSub8 {1109				continue1110			}1111			_ = z.Args[1]1112			z_0 := z.Args[0]1113			if z_0.Op != OpConst8 || auxIntToInt8(z_0.AuxInt) != 16 || y != z.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 16)) {1114				continue1115			}1116			v.reset(OpRotateLeft16)1117			v.AddArg2(x, z)1118			return true1119		}1120		break1121	}1122	return false1123}1124func rewriteValuegeneric_OpAdd32(v *Value) bool {1125	v_1 := v.Args[1]1126	v_0 := v.Args[0]1127	b := v.Block1128	config := b.Func.Config1129	// match: (Add32 (Const32 [c]) (Const32 [d]))1130	// result: (Const32 [c+d])1131	for {1132		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1133			if v_0.Op != OpConst32 {1134				continue1135			}1136			c := auxIntToInt32(v_0.AuxInt)1137			if v_1.Op != OpConst32 {1138				continue1139			}1140			d := auxIntToInt32(v_1.AuxInt)1141			v.reset(OpConst32)1142			v.AuxInt = int32ToAuxInt(c + d)1143			return true1144		}1145		break1146	}1147	// match: (Add32 <t> (Mul32 x y) (Mul32 x z))1148	// result: (Mul32 x (Add32 <t> y z))1149	for {1150		t := v.Type1151		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1152			if v_0.Op != OpMul32 {1153				continue1154			}1155			_ = v_0.Args[1]1156			v_0_0 := v_0.Args[0]1157			v_0_1 := v_0.Args[1]1158			for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 {1159				x := v_0_01160				y := v_0_11161				if v_1.Op != OpMul32 {1162					continue1163				}1164				_ = v_1.Args[1]1165				v_1_0 := v_1.Args[0]1166				v_1_1 := v_1.Args[1]1167				for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 {1168					if x != v_1_0 {1169						continue1170					}1171					z := v_1_11172					v.reset(OpMul32)1173					v0 := b.NewValue0(v.Pos, OpAdd32, t)1174					v0.AddArg2(y, z)1175					v.AddArg2(x, v0)1176					return true1177				}1178			}1179		}1180		break1181	}1182	// match: (Add32 x x)1183	// result: (Lsh32x64 x (Const64 <types.Types[types.TUINT64]> [1]))1184	for {1185		x := v_01186		if x != v_1 {1187			break1188		}1189		v.reset(OpLsh32x64)1190		v0 := b.NewValue0(v.Pos, OpConst64, types.Types[types.TUINT64])1191		v0.AuxInt = int64ToAuxInt(1)1192		v.AddArg2(x, v0)1193		return true1194	}1195	// match: (Add32 (Const32 [0]) x)1196	// result: x1197	for {1198		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1199			if v_0.Op != OpConst32 || auxIntToInt32(v_0.AuxInt) != 0 {1200				continue1201			}1202			x := v_11203			v.copyOf(x)1204			return true1205		}1206		break1207	}1208	// match: (Add32 x (Neg32 y))1209	// result: (Sub32 x y)1210	for {1211		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1212			x := v_01213			if v_1.Op != OpNeg32 {1214				continue1215			}1216			y := v_1.Args[0]1217			v.reset(OpSub32)1218			v.AddArg2(x, y)1219			return true1220		}1221		break1222	}1223	// match: (Add32 (Com32 x) x)1224	// result: (Const32 [-1])1225	for {1226		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1227			if v_0.Op != OpCom32 {1228				continue1229			}1230			x := v_0.Args[0]1231			if x != v_1 {1232				continue1233			}1234			v.reset(OpConst32)1235			v.AuxInt = int32ToAuxInt(-1)1236			return true1237		}1238		break1239	}1240	// match: (Add32 (Sub32 x t) (Add32 t y))1241	// result: (Add32 x y)1242	for {1243		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1244			if v_0.Op != OpSub32 {1245				continue1246			}1247			t := v_0.Args[1]1248			x := v_0.Args[0]1249			if v_1.Op != OpAdd32 {1250				continue1251			}1252			_ = v_1.Args[1]1253			v_1_0 := v_1.Args[0]1254			v_1_1 := v_1.Args[1]1255			for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 {1256				if t != v_1_0 {1257					continue1258				}1259				y := v_1_11260				v.reset(OpAdd32)1261				v.AddArg2(x, y)1262				return true1263			}1264		}1265		break1266	}1267	// match: (Add32 (Const32 [1]) (Com32 x))1268	// result: (Neg32 x)1269	for {1270		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1271			if v_0.Op != OpConst32 || auxIntToInt32(v_0.AuxInt) != 1 || v_1.Op != OpCom32 {1272				continue1273			}1274			x := v_1.Args[0]1275			v.reset(OpNeg32)1276			v.AddArg(x)1277			return true1278		}1279		break1280	}1281	// match: (Add32 x (Sub32 y x))1282	// result: y1283	for {1284		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1285			x := v_01286			if v_1.Op != OpSub32 {1287				continue1288			}1289			_ = v_1.Args[1]1290			y := v_1.Args[0]1291			if x != v_1.Args[1] {1292				continue1293			}1294			v.copyOf(y)1295			return true1296		}1297		break1298	}1299	// match: (Add32 x (Add32 y (Sub32 z x)))1300	// result: (Add32 y z)1301	for {1302		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1303			x := v_01304			if v_1.Op != OpAdd32 {1305				continue1306			}1307			_ = v_1.Args[1]1308			v_1_0 := v_1.Args[0]1309			v_1_1 := v_1.Args[1]1310			for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 {1311				y := v_1_01312				if v_1_1.Op != OpSub32 {1313					continue1314				}1315				_ = v_1_1.Args[1]1316				z := v_1_1.Args[0]1317				if x != v_1_1.Args[1] {1318					continue1319				}1320				v.reset(OpAdd32)1321				v.AddArg2(y, z)1322				return true1323			}1324		}1325		break1326	}1327	// match: (Add32 (Add32 i:(Const32 <t>) z) x)1328	// cond: (z.Op != OpConst32 && x.Op != OpConst32)1329	// result: (Add32 i (Add32 <t> z x))1330	for {1331		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1332			if v_0.Op != OpAdd32 {1333				continue1334			}1335			_ = v_0.Args[1]1336			v_0_0 := v_0.Args[0]1337			v_0_1 := v_0.Args[1]1338			for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 {1339				i := v_0_01340				if i.Op != OpConst32 {1341					continue1342				}1343				t := i.Type1344				z := v_0_11345				x := v_11346				if !(z.Op != OpConst32 && x.Op != OpConst32) {1347					continue1348				}1349				v.reset(OpAdd32)1350				v0 := b.NewValue0(v.Pos, OpAdd32, t)1351				v0.AddArg2(z, x)1352				v.AddArg2(i, v0)1353				return true1354			}1355		}1356		break1357	}1358	// match: (Add32 (Sub32 i:(Const32 <t>) z) x)1359	// cond: (z.Op != OpConst32 && x.Op != OpConst32)1360	// result: (Add32 i (Sub32 <t> x z))1361	for {1362		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1363			if v_0.Op != OpSub32 {1364				continue1365			}1366			z := v_0.Args[1]1367			i := v_0.Args[0]1368			if i.Op != OpConst32 {1369				continue1370			}1371			t := i.Type1372			x := v_11373			if !(z.Op != OpConst32 && x.Op != OpConst32) {1374				continue1375			}1376			v.reset(OpAdd32)1377			v0 := b.NewValue0(v.Pos, OpSub32, t)1378			v0.AddArg2(x, z)1379			v.AddArg2(i, v0)1380			return true1381		}1382		break1383	}1384	// match: (Add32 (Const32 <t> [c]) (Add32 (Const32 <t> [d]) x))1385	// result: (Add32 (Const32 <t> [c+d]) x)1386	for {1387		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1388			if v_0.Op != OpConst32 {1389				continue1390			}1391			t := v_0.Type1392			c := auxIntToInt32(v_0.AuxInt)1393			if v_1.Op != OpAdd32 {1394				continue1395			}1396			_ = v_1.Args[1]1397			v_1_0 := v_1.Args[0]1398			v_1_1 := v_1.Args[1]1399			for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 {1400				if v_1_0.Op != OpConst32 || v_1_0.Type != t {1401					continue1402				}1403				d := auxIntToInt32(v_1_0.AuxInt)1404				x := v_1_11405				v.reset(OpAdd32)1406				v0 := b.NewValue0(v.Pos, OpConst32, t)1407				v0.AuxInt = int32ToAuxInt(c + d)1408				v.AddArg2(v0, x)1409				return true1410			}1411		}1412		break1413	}1414	// match: (Add32 (Const32 <t> [c]) (Sub32 (Const32 <t> [d]) x))1415	// result: (Sub32 (Const32 <t> [c+d]) x)1416	for {1417		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1418			if v_0.Op != OpConst32 {1419				continue1420			}1421			t := v_0.Type1422			c := auxIntToInt32(v_0.AuxInt)1423			if v_1.Op != OpSub32 {1424				continue1425			}1426			x := v_1.Args[1]1427			v_1_0 := v_1.Args[0]1428			if v_1_0.Op != OpConst32 || v_1_0.Type != t {1429				continue1430			}1431			d := auxIntToInt32(v_1_0.AuxInt)1432			v.reset(OpSub32)1433			v0 := b.NewValue0(v.Pos, OpConst32, t)1434			v0.AuxInt = int32ToAuxInt(c + d)1435			v.AddArg2(v0, x)1436			return true1437		}1438		break1439	}1440	// match: (Add32 (Lsh32x64 x z:(Const64 <t> [c])) (Rsh32Ux64 x (Const64 [d])))1441	// cond: c < 32 && d == 32-c && canRotate(config, 32)1442	// result: (RotateLeft32 x z)1443	for {1444		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1445			if v_0.Op != OpLsh32x64 {1446				continue1447			}1448			_ = v_0.Args[1]1449			x := v_0.Args[0]1450			z := v_0.Args[1]1451			if z.Op != OpConst64 {1452				continue1453			}1454			c := auxIntToInt64(z.AuxInt)1455			if v_1.Op != OpRsh32Ux64 {1456				continue1457			}1458			_ = v_1.Args[1]1459			if x != v_1.Args[0] {1460				continue1461			}1462			v_1_1 := v_1.Args[1]1463			if v_1_1.Op != OpConst64 {1464				continue1465			}1466			d := auxIntToInt64(v_1_1.AuxInt)1467			if !(c < 32 && d == 32-c && canRotate(config, 32)) {1468				continue1469			}1470			v.reset(OpRotateLeft32)1471			v.AddArg2(x, z)1472			return true1473		}1474		break1475	}1476	// match: (Add32 left:(Lsh32x64 x y) right:(Rsh32Ux64 x (Sub64 (Const64 [32]) y)))1477	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)1478	// result: (RotateLeft32 x y)1479	for {1480		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1481			left := v_01482			if left.Op != OpLsh32x64 {1483				continue1484			}1485			y := left.Args[1]1486			x := left.Args[0]1487			right := v_11488			if right.Op != OpRsh32Ux64 {1489				continue1490			}1491			_ = right.Args[1]1492			if x != right.Args[0] {1493				continue1494			}1495			right_1 := right.Args[1]1496			if right_1.Op != OpSub64 {1497				continue1498			}1499			_ = right_1.Args[1]1500			right_1_0 := right_1.Args[0]1501			if right_1_0.Op != OpConst64 || auxIntToInt64(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)) {1502				continue1503			}1504			v.reset(OpRotateLeft32)1505			v.AddArg2(x, y)1506			return true1507		}1508		break1509	}1510	// match: (Add32 left:(Lsh32x32 x y) right:(Rsh32Ux32 x (Sub32 (Const32 [32]) y)))1511	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)1512	// result: (RotateLeft32 x y)1513	for {1514		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1515			left := v_01516			if left.Op != OpLsh32x32 {1517				continue1518			}1519			y := left.Args[1]1520			x := left.Args[0]1521			right := v_11522			if right.Op != OpRsh32Ux32 {1523				continue1524			}1525			_ = right.Args[1]1526			if x != right.Args[0] {1527				continue1528			}1529			right_1 := right.Args[1]1530			if right_1.Op != OpSub32 {1531				continue1532			}1533			_ = right_1.Args[1]1534			right_1_0 := right_1.Args[0]1535			if right_1_0.Op != OpConst32 || auxIntToInt32(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)) {1536				continue1537			}1538			v.reset(OpRotateLeft32)1539			v.AddArg2(x, y)1540			return true1541		}1542		break1543	}1544	// match: (Add32 left:(Lsh32x16 x y) right:(Rsh32Ux16 x (Sub16 (Const16 [32]) y)))1545	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)1546	// result: (RotateLeft32 x y)1547	for {1548		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1549			left := v_01550			if left.Op != OpLsh32x16 {1551				continue1552			}1553			y := left.Args[1]1554			x := left.Args[0]1555			right := v_11556			if right.Op != OpRsh32Ux16 {1557				continue1558			}1559			_ = right.Args[1]1560			if x != right.Args[0] {1561				continue1562			}1563			right_1 := right.Args[1]1564			if right_1.Op != OpSub16 {1565				continue1566			}1567			_ = right_1.Args[1]1568			right_1_0 := right_1.Args[0]1569			if right_1_0.Op != OpConst16 || auxIntToInt16(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)) {1570				continue1571			}1572			v.reset(OpRotateLeft32)1573			v.AddArg2(x, y)1574			return true1575		}1576		break1577	}1578	// match: (Add32 left:(Lsh32x8 x y) right:(Rsh32Ux8 x (Sub8 (Const8 [32]) y)))1579	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)1580	// result: (RotateLeft32 x y)1581	for {1582		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1583			left := v_01584			if left.Op != OpLsh32x8 {1585				continue1586			}1587			y := left.Args[1]1588			x := left.Args[0]1589			right := v_11590			if right.Op != OpRsh32Ux8 {1591				continue1592			}1593			_ = right.Args[1]1594			if x != right.Args[0] {1595				continue1596			}1597			right_1 := right.Args[1]1598			if right_1.Op != OpSub8 {1599				continue1600			}1601			_ = right_1.Args[1]1602			right_1_0 := right_1.Args[0]1603			if right_1_0.Op != OpConst8 || auxIntToInt8(right_1_0.AuxInt) != 32 || y != right_1.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)) {1604				continue1605			}1606			v.reset(OpRotateLeft32)1607			v.AddArg2(x, y)1608			return true1609		}1610		break1611	}1612	// match: (Add32 right:(Rsh32Ux64 x y) left:(Lsh32x64 x z:(Sub64 (Const64 [32]) y)))1613	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)1614	// result: (RotateLeft32 x z)1615	for {1616		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1617			right := v_01618			if right.Op != OpRsh32Ux64 {1619				continue1620			}1621			y := right.Args[1]1622			x := right.Args[0]1623			left := v_11624			if left.Op != OpLsh32x64 {1625				continue1626			}1627			_ = left.Args[1]1628			if x != left.Args[0] {1629				continue1630			}1631			z := left.Args[1]1632			if z.Op != OpSub64 {1633				continue1634			}1635			_ = z.Args[1]1636			z_0 := z.Args[0]1637			if z_0.Op != OpConst64 || auxIntToInt64(z_0.AuxInt) != 32 || y != z.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)) {1638				continue1639			}1640			v.reset(OpRotateLeft32)1641			v.AddArg2(x, z)1642			return true1643		}1644		break1645	}1646	// match: (Add32 right:(Rsh32Ux32 x y) left:(Lsh32x32 x z:(Sub32 (Const32 [32]) y)))1647	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)1648	// result: (RotateLeft32 x z)1649	for {1650		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1651			right := v_01652			if right.Op != OpRsh32Ux32 {1653				continue1654			}1655			y := right.Args[1]1656			x := right.Args[0]1657			left := v_11658			if left.Op != OpLsh32x32 {1659				continue1660			}1661			_ = left.Args[1]1662			if x != left.Args[0] {1663				continue1664			}1665			z := left.Args[1]1666			if z.Op != OpSub32 {1667				continue1668			}1669			_ = z.Args[1]1670			z_0 := z.Args[0]1671			if z_0.Op != OpConst32 || auxIntToInt32(z_0.AuxInt) != 32 || y != z.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)) {1672				continue1673			}1674			v.reset(OpRotateLeft32)1675			v.AddArg2(x, z)1676			return true1677		}1678		break1679	}1680	// match: (Add32 right:(Rsh32Ux16 x y) left:(Lsh32x16 x z:(Sub16 (Const16 [32]) y)))1681	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)1682	// result: (RotateLeft32 x z)1683	for {1684		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1685			right := v_01686			if right.Op != OpRsh32Ux16 {1687				continue1688			}1689			y := right.Args[1]1690			x := right.Args[0]1691			left := v_11692			if left.Op != OpLsh32x16 {1693				continue1694			}1695			_ = left.Args[1]1696			if x != left.Args[0] {1697				continue1698			}1699			z := left.Args[1]1700			if z.Op != OpSub16 {1701				continue1702			}1703			_ = z.Args[1]1704			z_0 := z.Args[0]1705			if z_0.Op != OpConst16 || auxIntToInt16(z_0.AuxInt) != 32 || y != z.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)) {1706				continue1707			}1708			v.reset(OpRotateLeft32)1709			v.AddArg2(x, z)1710			return true1711		}1712		break1713	}1714	// match: (Add32 right:(Rsh32Ux8 x y) left:(Lsh32x8 x z:(Sub8 (Const8 [32]) y)))1715	// cond: (shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)1716	// result: (RotateLeft32 x z)1717	for {1718		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1719			right := v_01720			if right.Op != OpRsh32Ux8 {1721				continue1722			}1723			y := right.Args[1]1724			x := right.Args[0]1725			left := v_11726			if left.Op != OpLsh32x8 {1727				continue1728			}1729			_ = left.Args[1]1730			if x != left.Args[0] {1731				continue1732			}1733			z := left.Args[1]1734			if z.Op != OpSub8 {1735				continue1736			}1737			_ = z.Args[1]1738			z_0 := z.Args[0]1739			if z_0.Op != OpConst8 || auxIntToInt8(z_0.AuxInt) != 32 || y != z.Args[1] || !((shiftIsBounded(left) || shiftIsBounded(right)) && canRotate(config, 32)) {1740				continue1741			}1742			v.reset(OpRotateLeft32)1743			v.AddArg2(x, z)1744			return true1745		}1746		break1747	}1748	return false1749}1750func rewriteValuegeneric_OpAdd32F(v *Value) bool {1751	v_1 := v.Args[1]1752	v_0 := v.Args[0]1753	// match: (Add32F (Const32F [c]) (Const32F [d]))1754	// cond: c+d == c+d1755	// result: (Const32F [c+d])1756	for {1757		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1758			if v_0.Op != OpConst32F {1759				continue1760			}1761			c := auxIntToFloat32(v_0.AuxInt)1762			if v_1.Op != OpConst32F {1763				continue1764			}1765			d := auxIntToFloat32(v_1.AuxInt)1766			if !(c+d == c+d) {1767				continue1768			}1769			v.reset(OpConst32F)1770			v.AuxInt = float32ToAuxInt(c + d)1771			return true1772		}1773		break1774	}1775	return false1776}1777func rewriteValuegeneric_OpAdd64(v *Value) bool {1778	v_1 := v.Args[1]1779	v_0 := v.Args[0]1780	b := v.Block1781	config := b.Func.Config1782	// match: (Add64 (Const64 [c]) (Const64 [d]))1783	// result: (Const64 [c+d])1784	for {1785		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1786			if v_0.Op != OpConst64 {1787				continue1788			}1789			c := auxIntToInt64(v_0.AuxInt)1790			if v_1.Op != OpConst64 {1791				continue1792			}1793			d := auxIntToInt64(v_1.AuxInt)1794			v.reset(OpConst64)1795			v.AuxInt = int64ToAuxInt(c + d)1796			return true1797		}1798		break1799	}1800	// match: (Add64 <t> (Mul64 x y) (Mul64 x z))1801	// result: (Mul64 x (Add64 <t> y z))1802	for {1803		t := v.Type1804		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1805			if v_0.Op != OpMul64 {1806				continue1807			}1808			_ = v_0.Args[1]1809			v_0_0 := v_0.Args[0]1810			v_0_1 := v_0.Args[1]1811			for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 {1812				x := v_0_01813				y := v_0_11814				if v_1.Op != OpMul64 {1815					continue1816				}1817				_ = v_1.Args[1]1818				v_1_0 := v_1.Args[0]1819				v_1_1 := v_1.Args[1]1820				for _i2 := 0; _i2 <= 1; _i2, v_1_0, v_1_1 = _i2+1, v_1_1, v_1_0 {1821					if x != v_1_0 {1822						continue1823					}1824					z := v_1_11825					v.reset(OpMul64)1826					v0 := b.NewValue0(v.Pos, OpAdd64, t)1827					v0.AddArg2(y, z)1828					v.AddArg2(x, v0)1829					return true1830				}1831			}1832		}1833		break1834	}1835	// match: (Add64 x x)1836	// result: (Lsh64x64 x (Const64 <types.Types[types.TUINT64]> [1]))1837	for {1838		x := v_01839		if x != v_1 {1840			break1841		}1842		v.reset(OpLsh64x64)1843		v0 := b.NewValue0(v.Pos, OpConst64, types.Types[types.TUINT64])1844		v0.AuxInt = int64ToAuxInt(1)1845		v.AddArg2(x, v0)1846		return true1847	}1848	// match: (Add64 (Const64 [0]) x)1849	// result: x1850	for {1851		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1852			if v_0.Op != OpConst64 || auxIntToInt64(v_0.AuxInt) != 0 {1853				continue1854			}1855			x := v_11856			v.copyOf(x)1857			return true1858		}1859		break1860	}1861	// match: (Add64 x (Neg64 y))1862	// result: (Sub64 x y)1863	for {1864		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1865			x := v_01866			if v_1.Op != OpNeg64 {1867				continue1868			}1869			y := v_1.Args[0]1870			v.reset(OpSub64)1871			v.AddArg2(x, y)1872			return true1873		}1874		break1875	}1876	// match: (Add64 (Com64 x) x)1877	// result: (Const64 [-1])1878	for {1879		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1880			if v_0.Op != OpCom64 {1881				continue1882			}1883			x := v_0.Args[0]1884			if x != v_1 {1885				continue1886			}1887			v.reset(OpConst64)1888			v.AuxInt = int64ToAuxInt(-1)1889			return true1890		}1891		break1892	}1893	// match: (Add64 (Sub64 x t) (Add64 t y))1894	// result: (Add64 x y)1895	for {1896		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1897			if v_0.Op != OpSub64 {1898				continue1899			}1900			t := v_0.Args[1]1901			x := v_0.Args[0]1902			if v_1.Op != OpAdd64 {1903				continue1904			}1905			_ = v_1.Args[1]1906			v_1_0 := v_1.Args[0]1907			v_1_1 := v_1.Args[1]1908			for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 {1909				if t != v_1_0 {1910					continue1911				}1912				y := v_1_11913				v.reset(OpAdd64)1914				v.AddArg2(x, y)1915				return true1916			}1917		}1918		break1919	}1920	// match: (Add64 (Const64 [1]) (Com64 x))1921	// result: (Neg64 x)1922	for {1923		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1924			if v_0.Op != OpConst64 || auxIntToInt64(v_0.AuxInt) != 1 || v_1.Op != OpCom64 {1925				continue1926			}1927			x := v_1.Args[0]1928			v.reset(OpNeg64)1929			v.AddArg(x)1930			return true1931		}1932		break1933	}1934	// match: (Add64 x (Sub64 y x))1935	// result: y1936	for {1937		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1938			x := v_01939			if v_1.Op != OpSub64 {1940				continue1941			}1942			_ = v_1.Args[1]1943			y := v_1.Args[0]1944			if x != v_1.Args[1] {1945				continue1946			}1947			v.copyOf(y)1948			return true1949		}1950		break1951	}1952	// match: (Add64 x (Add64 y (Sub64 z x)))1953	// result: (Add64 y z)1954	for {1955		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1956			x := v_01957			if v_1.Op != OpAdd64 {1958				continue1959			}1960			_ = v_1.Args[1]1961			v_1_0 := v_1.Args[0]1962			v_1_1 := v_1.Args[1]1963			for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 {1964				y := v_1_01965				if v_1_1.Op != OpSub64 {1966					continue1967				}1968				_ = v_1_1.Args[1]1969				z := v_1_1.Args[0]1970				if x != v_1_1.Args[1] {1971					continue1972				}1973				v.reset(OpAdd64)1974				v.AddArg2(y, z)1975				return true1976			}1977		}1978		break1979	}1980	// match: (Add64 (Add64 i:(Const64 <t>) z) x)1981	// cond: (z.Op != OpConst64 && x.Op != OpConst64)1982	// result: (Add64 i (Add64 <t> z x))1983	for {1984		for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {1985			if v_0.Op != OpAdd64 {1986				continue1987			}1988			_ = v_0.Args[1]1989			v_0_0 := v_0.Args[0]1990			v_0_1 := v_0.Args[1]1991			for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 {1992				i := v_0_01993				if i.Op != OpConst64 {1994					continue1995				}1996				t := i.Type1997				z := v_0_11998				x := v_11999				if !(z.Op != OpConst64 && x.Op != OpConst64) {2000					continue

Findings

✓ No findings reported for this file.

Get this view in your editor

Same data, no extra tab — call code_get_file + code_get_findings over MCP from Claude/Cursor/Copilot.