]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/compile/internal/ssa/rewrite386.go
1ec2d26f750f6b7998933fca8cbeb668d9188f1a
[gostls13.git] / src / cmd / compile / internal / ssa / rewrite386.go
1 // Code generated from gen/386.rules; DO NOT EDIT.
2 // generated with: cd gen; go run *.go
3
4 package ssa
5
6 import "math"
7 import "cmd/compile/internal/types"
8
9 func rewriteValue386(v *Value) bool {
10         switch v.Op {
11         case Op386ADCL:
12                 return rewriteValue386_Op386ADCL(v)
13         case Op386ADDL:
14                 return rewriteValue386_Op386ADDL(v)
15         case Op386ADDLcarry:
16                 return rewriteValue386_Op386ADDLcarry(v)
17         case Op386ADDLconst:
18                 return rewriteValue386_Op386ADDLconst(v)
19         case Op386ADDLconstmodify:
20                 return rewriteValue386_Op386ADDLconstmodify(v)
21         case Op386ADDLload:
22                 return rewriteValue386_Op386ADDLload(v)
23         case Op386ADDLmodify:
24                 return rewriteValue386_Op386ADDLmodify(v)
25         case Op386ADDSD:
26                 return rewriteValue386_Op386ADDSD(v)
27         case Op386ADDSDload:
28                 return rewriteValue386_Op386ADDSDload(v)
29         case Op386ADDSS:
30                 return rewriteValue386_Op386ADDSS(v)
31         case Op386ADDSSload:
32                 return rewriteValue386_Op386ADDSSload(v)
33         case Op386ANDL:
34                 return rewriteValue386_Op386ANDL(v)
35         case Op386ANDLconst:
36                 return rewriteValue386_Op386ANDLconst(v)
37         case Op386ANDLconstmodify:
38                 return rewriteValue386_Op386ANDLconstmodify(v)
39         case Op386ANDLload:
40                 return rewriteValue386_Op386ANDLload(v)
41         case Op386ANDLmodify:
42                 return rewriteValue386_Op386ANDLmodify(v)
43         case Op386CMPB:
44                 return rewriteValue386_Op386CMPB(v)
45         case Op386CMPBconst:
46                 return rewriteValue386_Op386CMPBconst(v)
47         case Op386CMPBload:
48                 return rewriteValue386_Op386CMPBload(v)
49         case Op386CMPL:
50                 return rewriteValue386_Op386CMPL(v)
51         case Op386CMPLconst:
52                 return rewriteValue386_Op386CMPLconst(v)
53         case Op386CMPLload:
54                 return rewriteValue386_Op386CMPLload(v)
55         case Op386CMPW:
56                 return rewriteValue386_Op386CMPW(v)
57         case Op386CMPWconst:
58                 return rewriteValue386_Op386CMPWconst(v)
59         case Op386CMPWload:
60                 return rewriteValue386_Op386CMPWload(v)
61         case Op386DIVSD:
62                 return rewriteValue386_Op386DIVSD(v)
63         case Op386DIVSDload:
64                 return rewriteValue386_Op386DIVSDload(v)
65         case Op386DIVSS:
66                 return rewriteValue386_Op386DIVSS(v)
67         case Op386DIVSSload:
68                 return rewriteValue386_Op386DIVSSload(v)
69         case Op386LEAL:
70                 return rewriteValue386_Op386LEAL(v)
71         case Op386LEAL1:
72                 return rewriteValue386_Op386LEAL1(v)
73         case Op386LEAL2:
74                 return rewriteValue386_Op386LEAL2(v)
75         case Op386LEAL4:
76                 return rewriteValue386_Op386LEAL4(v)
77         case Op386LEAL8:
78                 return rewriteValue386_Op386LEAL8(v)
79         case Op386MOVBLSX:
80                 return rewriteValue386_Op386MOVBLSX(v)
81         case Op386MOVBLSXload:
82                 return rewriteValue386_Op386MOVBLSXload(v)
83         case Op386MOVBLZX:
84                 return rewriteValue386_Op386MOVBLZX(v)
85         case Op386MOVBload:
86                 return rewriteValue386_Op386MOVBload(v)
87         case Op386MOVBstore:
88                 return rewriteValue386_Op386MOVBstore(v)
89         case Op386MOVBstoreconst:
90                 return rewriteValue386_Op386MOVBstoreconst(v)
91         case Op386MOVLload:
92                 return rewriteValue386_Op386MOVLload(v)
93         case Op386MOVLstore:
94                 return rewriteValue386_Op386MOVLstore(v)
95         case Op386MOVLstoreconst:
96                 return rewriteValue386_Op386MOVLstoreconst(v)
97         case Op386MOVSDconst:
98                 return rewriteValue386_Op386MOVSDconst(v)
99         case Op386MOVSDload:
100                 return rewriteValue386_Op386MOVSDload(v)
101         case Op386MOVSDstore:
102                 return rewriteValue386_Op386MOVSDstore(v)
103         case Op386MOVSSconst:
104                 return rewriteValue386_Op386MOVSSconst(v)
105         case Op386MOVSSload:
106                 return rewriteValue386_Op386MOVSSload(v)
107         case Op386MOVSSstore:
108                 return rewriteValue386_Op386MOVSSstore(v)
109         case Op386MOVWLSX:
110                 return rewriteValue386_Op386MOVWLSX(v)
111         case Op386MOVWLSXload:
112                 return rewriteValue386_Op386MOVWLSXload(v)
113         case Op386MOVWLZX:
114                 return rewriteValue386_Op386MOVWLZX(v)
115         case Op386MOVWload:
116                 return rewriteValue386_Op386MOVWload(v)
117         case Op386MOVWstore:
118                 return rewriteValue386_Op386MOVWstore(v)
119         case Op386MOVWstoreconst:
120                 return rewriteValue386_Op386MOVWstoreconst(v)
121         case Op386MULL:
122                 return rewriteValue386_Op386MULL(v)
123         case Op386MULLconst:
124                 return rewriteValue386_Op386MULLconst(v)
125         case Op386MULLload:
126                 return rewriteValue386_Op386MULLload(v)
127         case Op386MULSD:
128                 return rewriteValue386_Op386MULSD(v)
129         case Op386MULSDload:
130                 return rewriteValue386_Op386MULSDload(v)
131         case Op386MULSS:
132                 return rewriteValue386_Op386MULSS(v)
133         case Op386MULSSload:
134                 return rewriteValue386_Op386MULSSload(v)
135         case Op386NEGL:
136                 return rewriteValue386_Op386NEGL(v)
137         case Op386NOTL:
138                 return rewriteValue386_Op386NOTL(v)
139         case Op386ORL:
140                 return rewriteValue386_Op386ORL(v)
141         case Op386ORLconst:
142                 return rewriteValue386_Op386ORLconst(v)
143         case Op386ORLconstmodify:
144                 return rewriteValue386_Op386ORLconstmodify(v)
145         case Op386ORLload:
146                 return rewriteValue386_Op386ORLload(v)
147         case Op386ORLmodify:
148                 return rewriteValue386_Op386ORLmodify(v)
149         case Op386ROLBconst:
150                 return rewriteValue386_Op386ROLBconst(v)
151         case Op386ROLLconst:
152                 return rewriteValue386_Op386ROLLconst(v)
153         case Op386ROLWconst:
154                 return rewriteValue386_Op386ROLWconst(v)
155         case Op386SARB:
156                 return rewriteValue386_Op386SARB(v)
157         case Op386SARBconst:
158                 return rewriteValue386_Op386SARBconst(v)
159         case Op386SARL:
160                 return rewriteValue386_Op386SARL(v)
161         case Op386SARLconst:
162                 return rewriteValue386_Op386SARLconst(v)
163         case Op386SARW:
164                 return rewriteValue386_Op386SARW(v)
165         case Op386SARWconst:
166                 return rewriteValue386_Op386SARWconst(v)
167         case Op386SBBL:
168                 return rewriteValue386_Op386SBBL(v)
169         case Op386SBBLcarrymask:
170                 return rewriteValue386_Op386SBBLcarrymask(v)
171         case Op386SETA:
172                 return rewriteValue386_Op386SETA(v)
173         case Op386SETAE:
174                 return rewriteValue386_Op386SETAE(v)
175         case Op386SETB:
176                 return rewriteValue386_Op386SETB(v)
177         case Op386SETBE:
178                 return rewriteValue386_Op386SETBE(v)
179         case Op386SETEQ:
180                 return rewriteValue386_Op386SETEQ(v)
181         case Op386SETG:
182                 return rewriteValue386_Op386SETG(v)
183         case Op386SETGE:
184                 return rewriteValue386_Op386SETGE(v)
185         case Op386SETL:
186                 return rewriteValue386_Op386SETL(v)
187         case Op386SETLE:
188                 return rewriteValue386_Op386SETLE(v)
189         case Op386SETNE:
190                 return rewriteValue386_Op386SETNE(v)
191         case Op386SHLL:
192                 return rewriteValue386_Op386SHLL(v)
193         case Op386SHLLconst:
194                 return rewriteValue386_Op386SHLLconst(v)
195         case Op386SHRB:
196                 return rewriteValue386_Op386SHRB(v)
197         case Op386SHRBconst:
198                 return rewriteValue386_Op386SHRBconst(v)
199         case Op386SHRL:
200                 return rewriteValue386_Op386SHRL(v)
201         case Op386SHRLconst:
202                 return rewriteValue386_Op386SHRLconst(v)
203         case Op386SHRW:
204                 return rewriteValue386_Op386SHRW(v)
205         case Op386SHRWconst:
206                 return rewriteValue386_Op386SHRWconst(v)
207         case Op386SUBL:
208                 return rewriteValue386_Op386SUBL(v)
209         case Op386SUBLcarry:
210                 return rewriteValue386_Op386SUBLcarry(v)
211         case Op386SUBLconst:
212                 return rewriteValue386_Op386SUBLconst(v)
213         case Op386SUBLload:
214                 return rewriteValue386_Op386SUBLload(v)
215         case Op386SUBLmodify:
216                 return rewriteValue386_Op386SUBLmodify(v)
217         case Op386SUBSD:
218                 return rewriteValue386_Op386SUBSD(v)
219         case Op386SUBSDload:
220                 return rewriteValue386_Op386SUBSDload(v)
221         case Op386SUBSS:
222                 return rewriteValue386_Op386SUBSS(v)
223         case Op386SUBSSload:
224                 return rewriteValue386_Op386SUBSSload(v)
225         case Op386XORL:
226                 return rewriteValue386_Op386XORL(v)
227         case Op386XORLconst:
228                 return rewriteValue386_Op386XORLconst(v)
229         case Op386XORLconstmodify:
230                 return rewriteValue386_Op386XORLconstmodify(v)
231         case Op386XORLload:
232                 return rewriteValue386_Op386XORLload(v)
233         case Op386XORLmodify:
234                 return rewriteValue386_Op386XORLmodify(v)
235         case OpAdd16:
236                 v.Op = Op386ADDL
237                 return true
238         case OpAdd32:
239                 v.Op = Op386ADDL
240                 return true
241         case OpAdd32F:
242                 v.Op = Op386ADDSS
243                 return true
244         case OpAdd32carry:
245                 v.Op = Op386ADDLcarry
246                 return true
247         case OpAdd32withcarry:
248                 v.Op = Op386ADCL
249                 return true
250         case OpAdd64F:
251                 v.Op = Op386ADDSD
252                 return true
253         case OpAdd8:
254                 v.Op = Op386ADDL
255                 return true
256         case OpAddPtr:
257                 v.Op = Op386ADDL
258                 return true
259         case OpAddr:
260                 return rewriteValue386_OpAddr(v)
261         case OpAnd16:
262                 v.Op = Op386ANDL
263                 return true
264         case OpAnd32:
265                 v.Op = Op386ANDL
266                 return true
267         case OpAnd8:
268                 v.Op = Op386ANDL
269                 return true
270         case OpAndB:
271                 v.Op = Op386ANDL
272                 return true
273         case OpAvg32u:
274                 v.Op = Op386AVGLU
275                 return true
276         case OpBswap32:
277                 v.Op = Op386BSWAPL
278                 return true
279         case OpClosureCall:
280                 v.Op = Op386CALLclosure
281                 return true
282         case OpCom16:
283                 v.Op = Op386NOTL
284                 return true
285         case OpCom32:
286                 v.Op = Op386NOTL
287                 return true
288         case OpCom8:
289                 v.Op = Op386NOTL
290                 return true
291         case OpConst16:
292                 return rewriteValue386_OpConst16(v)
293         case OpConst32:
294                 v.Op = Op386MOVLconst
295                 return true
296         case OpConst32F:
297                 v.Op = Op386MOVSSconst
298                 return true
299         case OpConst64F:
300                 v.Op = Op386MOVSDconst
301                 return true
302         case OpConst8:
303                 return rewriteValue386_OpConst8(v)
304         case OpConstBool:
305                 return rewriteValue386_OpConstBool(v)
306         case OpConstNil:
307                 return rewriteValue386_OpConstNil(v)
308         case OpCtz16:
309                 return rewriteValue386_OpCtz16(v)
310         case OpCtz16NonZero:
311                 v.Op = Op386BSFL
312                 return true
313         case OpCvt32Fto32:
314                 v.Op = Op386CVTTSS2SL
315                 return true
316         case OpCvt32Fto64F:
317                 v.Op = Op386CVTSS2SD
318                 return true
319         case OpCvt32to32F:
320                 v.Op = Op386CVTSL2SS
321                 return true
322         case OpCvt32to64F:
323                 v.Op = Op386CVTSL2SD
324                 return true
325         case OpCvt64Fto32:
326                 v.Op = Op386CVTTSD2SL
327                 return true
328         case OpCvt64Fto32F:
329                 v.Op = Op386CVTSD2SS
330                 return true
331         case OpCvtBoolToUint8:
332                 v.Op = OpCopy
333                 return true
334         case OpDiv16:
335                 v.Op = Op386DIVW
336                 return true
337         case OpDiv16u:
338                 v.Op = Op386DIVWU
339                 return true
340         case OpDiv32:
341                 v.Op = Op386DIVL
342                 return true
343         case OpDiv32F:
344                 v.Op = Op386DIVSS
345                 return true
346         case OpDiv32u:
347                 v.Op = Op386DIVLU
348                 return true
349         case OpDiv64F:
350                 v.Op = Op386DIVSD
351                 return true
352         case OpDiv8:
353                 return rewriteValue386_OpDiv8(v)
354         case OpDiv8u:
355                 return rewriteValue386_OpDiv8u(v)
356         case OpEq16:
357                 return rewriteValue386_OpEq16(v)
358         case OpEq32:
359                 return rewriteValue386_OpEq32(v)
360         case OpEq32F:
361                 return rewriteValue386_OpEq32F(v)
362         case OpEq64F:
363                 return rewriteValue386_OpEq64F(v)
364         case OpEq8:
365                 return rewriteValue386_OpEq8(v)
366         case OpEqB:
367                 return rewriteValue386_OpEqB(v)
368         case OpEqPtr:
369                 return rewriteValue386_OpEqPtr(v)
370         case OpGetCallerPC:
371                 v.Op = Op386LoweredGetCallerPC
372                 return true
373         case OpGetCallerSP:
374                 v.Op = Op386LoweredGetCallerSP
375                 return true
376         case OpGetClosurePtr:
377                 v.Op = Op386LoweredGetClosurePtr
378                 return true
379         case OpGetG:
380                 v.Op = Op386LoweredGetG
381                 return true
382         case OpHmul32:
383                 v.Op = Op386HMULL
384                 return true
385         case OpHmul32u:
386                 v.Op = Op386HMULLU
387                 return true
388         case OpInterCall:
389                 v.Op = Op386CALLinter
390                 return true
391         case OpIsInBounds:
392                 return rewriteValue386_OpIsInBounds(v)
393         case OpIsNonNil:
394                 return rewriteValue386_OpIsNonNil(v)
395         case OpIsSliceInBounds:
396                 return rewriteValue386_OpIsSliceInBounds(v)
397         case OpLeq16:
398                 return rewriteValue386_OpLeq16(v)
399         case OpLeq16U:
400                 return rewriteValue386_OpLeq16U(v)
401         case OpLeq32:
402                 return rewriteValue386_OpLeq32(v)
403         case OpLeq32F:
404                 return rewriteValue386_OpLeq32F(v)
405         case OpLeq32U:
406                 return rewriteValue386_OpLeq32U(v)
407         case OpLeq64F:
408                 return rewriteValue386_OpLeq64F(v)
409         case OpLeq8:
410                 return rewriteValue386_OpLeq8(v)
411         case OpLeq8U:
412                 return rewriteValue386_OpLeq8U(v)
413         case OpLess16:
414                 return rewriteValue386_OpLess16(v)
415         case OpLess16U:
416                 return rewriteValue386_OpLess16U(v)
417         case OpLess32:
418                 return rewriteValue386_OpLess32(v)
419         case OpLess32F:
420                 return rewriteValue386_OpLess32F(v)
421         case OpLess32U:
422                 return rewriteValue386_OpLess32U(v)
423         case OpLess64F:
424                 return rewriteValue386_OpLess64F(v)
425         case OpLess8:
426                 return rewriteValue386_OpLess8(v)
427         case OpLess8U:
428                 return rewriteValue386_OpLess8U(v)
429         case OpLoad:
430                 return rewriteValue386_OpLoad(v)
431         case OpLocalAddr:
432                 return rewriteValue386_OpLocalAddr(v)
433         case OpLsh16x16:
434                 return rewriteValue386_OpLsh16x16(v)
435         case OpLsh16x32:
436                 return rewriteValue386_OpLsh16x32(v)
437         case OpLsh16x64:
438                 return rewriteValue386_OpLsh16x64(v)
439         case OpLsh16x8:
440                 return rewriteValue386_OpLsh16x8(v)
441         case OpLsh32x16:
442                 return rewriteValue386_OpLsh32x16(v)
443         case OpLsh32x32:
444                 return rewriteValue386_OpLsh32x32(v)
445         case OpLsh32x64:
446                 return rewriteValue386_OpLsh32x64(v)
447         case OpLsh32x8:
448                 return rewriteValue386_OpLsh32x8(v)
449         case OpLsh8x16:
450                 return rewriteValue386_OpLsh8x16(v)
451         case OpLsh8x32:
452                 return rewriteValue386_OpLsh8x32(v)
453         case OpLsh8x64:
454                 return rewriteValue386_OpLsh8x64(v)
455         case OpLsh8x8:
456                 return rewriteValue386_OpLsh8x8(v)
457         case OpMod16:
458                 v.Op = Op386MODW
459                 return true
460         case OpMod16u:
461                 v.Op = Op386MODWU
462                 return true
463         case OpMod32:
464                 v.Op = Op386MODL
465                 return true
466         case OpMod32u:
467                 v.Op = Op386MODLU
468                 return true
469         case OpMod8:
470                 return rewriteValue386_OpMod8(v)
471         case OpMod8u:
472                 return rewriteValue386_OpMod8u(v)
473         case OpMove:
474                 return rewriteValue386_OpMove(v)
475         case OpMul16:
476                 v.Op = Op386MULL
477                 return true
478         case OpMul32:
479                 v.Op = Op386MULL
480                 return true
481         case OpMul32F:
482                 v.Op = Op386MULSS
483                 return true
484         case OpMul32uhilo:
485                 v.Op = Op386MULLQU
486                 return true
487         case OpMul64F:
488                 v.Op = Op386MULSD
489                 return true
490         case OpMul8:
491                 v.Op = Op386MULL
492                 return true
493         case OpNeg16:
494                 v.Op = Op386NEGL
495                 return true
496         case OpNeg32:
497                 v.Op = Op386NEGL
498                 return true
499         case OpNeg32F:
500                 return rewriteValue386_OpNeg32F(v)
501         case OpNeg64F:
502                 return rewriteValue386_OpNeg64F(v)
503         case OpNeg8:
504                 v.Op = Op386NEGL
505                 return true
506         case OpNeq16:
507                 return rewriteValue386_OpNeq16(v)
508         case OpNeq32:
509                 return rewriteValue386_OpNeq32(v)
510         case OpNeq32F:
511                 return rewriteValue386_OpNeq32F(v)
512         case OpNeq64F:
513                 return rewriteValue386_OpNeq64F(v)
514         case OpNeq8:
515                 return rewriteValue386_OpNeq8(v)
516         case OpNeqB:
517                 return rewriteValue386_OpNeqB(v)
518         case OpNeqPtr:
519                 return rewriteValue386_OpNeqPtr(v)
520         case OpNilCheck:
521                 v.Op = Op386LoweredNilCheck
522                 return true
523         case OpNot:
524                 return rewriteValue386_OpNot(v)
525         case OpOffPtr:
526                 return rewriteValue386_OpOffPtr(v)
527         case OpOr16:
528                 v.Op = Op386ORL
529                 return true
530         case OpOr32:
531                 v.Op = Op386ORL
532                 return true
533         case OpOr8:
534                 v.Op = Op386ORL
535                 return true
536         case OpOrB:
537                 v.Op = Op386ORL
538                 return true
539         case OpPanicBounds:
540                 return rewriteValue386_OpPanicBounds(v)
541         case OpPanicExtend:
542                 return rewriteValue386_OpPanicExtend(v)
543         case OpRotateLeft16:
544                 return rewriteValue386_OpRotateLeft16(v)
545         case OpRotateLeft32:
546                 return rewriteValue386_OpRotateLeft32(v)
547         case OpRotateLeft8:
548                 return rewriteValue386_OpRotateLeft8(v)
549         case OpRound32F:
550                 v.Op = OpCopy
551                 return true
552         case OpRound64F:
553                 v.Op = OpCopy
554                 return true
555         case OpRsh16Ux16:
556                 return rewriteValue386_OpRsh16Ux16(v)
557         case OpRsh16Ux32:
558                 return rewriteValue386_OpRsh16Ux32(v)
559         case OpRsh16Ux64:
560                 return rewriteValue386_OpRsh16Ux64(v)
561         case OpRsh16Ux8:
562                 return rewriteValue386_OpRsh16Ux8(v)
563         case OpRsh16x16:
564                 return rewriteValue386_OpRsh16x16(v)
565         case OpRsh16x32:
566                 return rewriteValue386_OpRsh16x32(v)
567         case OpRsh16x64:
568                 return rewriteValue386_OpRsh16x64(v)
569         case OpRsh16x8:
570                 return rewriteValue386_OpRsh16x8(v)
571         case OpRsh32Ux16:
572                 return rewriteValue386_OpRsh32Ux16(v)
573         case OpRsh32Ux32:
574                 return rewriteValue386_OpRsh32Ux32(v)
575         case OpRsh32Ux64:
576                 return rewriteValue386_OpRsh32Ux64(v)
577         case OpRsh32Ux8:
578                 return rewriteValue386_OpRsh32Ux8(v)
579         case OpRsh32x16:
580                 return rewriteValue386_OpRsh32x16(v)
581         case OpRsh32x32:
582                 return rewriteValue386_OpRsh32x32(v)
583         case OpRsh32x64:
584                 return rewriteValue386_OpRsh32x64(v)
585         case OpRsh32x8:
586                 return rewriteValue386_OpRsh32x8(v)
587         case OpRsh8Ux16:
588                 return rewriteValue386_OpRsh8Ux16(v)
589         case OpRsh8Ux32:
590                 return rewriteValue386_OpRsh8Ux32(v)
591         case OpRsh8Ux64:
592                 return rewriteValue386_OpRsh8Ux64(v)
593         case OpRsh8Ux8:
594                 return rewriteValue386_OpRsh8Ux8(v)
595         case OpRsh8x16:
596                 return rewriteValue386_OpRsh8x16(v)
597         case OpRsh8x32:
598                 return rewriteValue386_OpRsh8x32(v)
599         case OpRsh8x64:
600                 return rewriteValue386_OpRsh8x64(v)
601         case OpRsh8x8:
602                 return rewriteValue386_OpRsh8x8(v)
603         case OpSelect0:
604                 return rewriteValue386_OpSelect0(v)
605         case OpSelect1:
606                 return rewriteValue386_OpSelect1(v)
607         case OpSignExt16to32:
608                 v.Op = Op386MOVWLSX
609                 return true
610         case OpSignExt8to16:
611                 v.Op = Op386MOVBLSX
612                 return true
613         case OpSignExt8to32:
614                 v.Op = Op386MOVBLSX
615                 return true
616         case OpSignmask:
617                 return rewriteValue386_OpSignmask(v)
618         case OpSlicemask:
619                 return rewriteValue386_OpSlicemask(v)
620         case OpSqrt:
621                 v.Op = Op386SQRTSD
622                 return true
623         case OpSqrt32:
624                 v.Op = Op386SQRTSS
625                 return true
626         case OpStaticCall:
627                 v.Op = Op386CALLstatic
628                 return true
629         case OpStore:
630                 return rewriteValue386_OpStore(v)
631         case OpSub16:
632                 v.Op = Op386SUBL
633                 return true
634         case OpSub32:
635                 v.Op = Op386SUBL
636                 return true
637         case OpSub32F:
638                 v.Op = Op386SUBSS
639                 return true
640         case OpSub32carry:
641                 v.Op = Op386SUBLcarry
642                 return true
643         case OpSub32withcarry:
644                 v.Op = Op386SBBL
645                 return true
646         case OpSub64F:
647                 v.Op = Op386SUBSD
648                 return true
649         case OpSub8:
650                 v.Op = Op386SUBL
651                 return true
652         case OpSubPtr:
653                 v.Op = Op386SUBL
654                 return true
655         case OpTrunc16to8:
656                 v.Op = OpCopy
657                 return true
658         case OpTrunc32to16:
659                 v.Op = OpCopy
660                 return true
661         case OpTrunc32to8:
662                 v.Op = OpCopy
663                 return true
664         case OpWB:
665                 v.Op = Op386LoweredWB
666                 return true
667         case OpXor16:
668                 v.Op = Op386XORL
669                 return true
670         case OpXor32:
671                 v.Op = Op386XORL
672                 return true
673         case OpXor8:
674                 v.Op = Op386XORL
675                 return true
676         case OpZero:
677                 return rewriteValue386_OpZero(v)
678         case OpZeroExt16to32:
679                 v.Op = Op386MOVWLZX
680                 return true
681         case OpZeroExt8to16:
682                 v.Op = Op386MOVBLZX
683                 return true
684         case OpZeroExt8to32:
685                 v.Op = Op386MOVBLZX
686                 return true
687         case OpZeromask:
688                 return rewriteValue386_OpZeromask(v)
689         }
690         return false
691 }
692 func rewriteValue386_Op386ADCL(v *Value) bool {
693         v_2 := v.Args[2]
694         v_1 := v.Args[1]
695         v_0 := v.Args[0]
696         // match: (ADCL x (MOVLconst [c]) f)
697         // result: (ADCLconst [c] x f)
698         for {
699                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
700                         x := v_0
701                         if v_1.Op != Op386MOVLconst {
702                                 continue
703                         }
704                         c := auxIntToInt32(v_1.AuxInt)
705                         f := v_2
706                         v.reset(Op386ADCLconst)
707                         v.AuxInt = int32ToAuxInt(c)
708                         v.AddArg2(x, f)
709                         return true
710                 }
711                 break
712         }
713         return false
714 }
715 func rewriteValue386_Op386ADDL(v *Value) bool {
716         v_1 := v.Args[1]
717         v_0 := v.Args[0]
718         // match: (ADDL x (MOVLconst [c]))
719         // result: (ADDLconst [c] x)
720         for {
721                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
722                         x := v_0
723                         if v_1.Op != Op386MOVLconst {
724                                 continue
725                         }
726                         c := auxIntToInt32(v_1.AuxInt)
727                         v.reset(Op386ADDLconst)
728                         v.AuxInt = int32ToAuxInt(c)
729                         v.AddArg(x)
730                         return true
731                 }
732                 break
733         }
734         // match: (ADDL (SHLLconst [c] x) (SHRLconst [d] x))
735         // cond: d == 32-c
736         // result: (ROLLconst [c] x)
737         for {
738                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
739                         if v_0.Op != Op386SHLLconst {
740                                 continue
741                         }
742                         c := auxIntToInt32(v_0.AuxInt)
743                         x := v_0.Args[0]
744                         if v_1.Op != Op386SHRLconst {
745                                 continue
746                         }
747                         d := auxIntToInt32(v_1.AuxInt)
748                         if x != v_1.Args[0] || !(d == 32-c) {
749                                 continue
750                         }
751                         v.reset(Op386ROLLconst)
752                         v.AuxInt = int32ToAuxInt(c)
753                         v.AddArg(x)
754                         return true
755                 }
756                 break
757         }
758         // match: (ADDL <t> (SHLLconst x [c]) (SHRWconst x [d]))
759         // cond: c < 16 && d == int16(16-c) && t.Size() == 2
760         // result: (ROLWconst x [int16(c)])
761         for {
762                 t := v.Type
763                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
764                         if v_0.Op != Op386SHLLconst {
765                                 continue
766                         }
767                         c := auxIntToInt32(v_0.AuxInt)
768                         x := v_0.Args[0]
769                         if v_1.Op != Op386SHRWconst {
770                                 continue
771                         }
772                         d := auxIntToInt16(v_1.AuxInt)
773                         if x != v_1.Args[0] || !(c < 16 && d == int16(16-c) && t.Size() == 2) {
774                                 continue
775                         }
776                         v.reset(Op386ROLWconst)
777                         v.AuxInt = int16ToAuxInt(int16(c))
778                         v.AddArg(x)
779                         return true
780                 }
781                 break
782         }
783         // match: (ADDL <t> (SHLLconst x [c]) (SHRBconst x [d]))
784         // cond: c < 8 && d == int8(8-c) && t.Size() == 1
785         // result: (ROLBconst x [int8(c)])
786         for {
787                 t := v.Type
788                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
789                         if v_0.Op != Op386SHLLconst {
790                                 continue
791                         }
792                         c := auxIntToInt32(v_0.AuxInt)
793                         x := v_0.Args[0]
794                         if v_1.Op != Op386SHRBconst {
795                                 continue
796                         }
797                         d := auxIntToInt8(v_1.AuxInt)
798                         if x != v_1.Args[0] || !(c < 8 && d == int8(8-c) && t.Size() == 1) {
799                                 continue
800                         }
801                         v.reset(Op386ROLBconst)
802                         v.AuxInt = int8ToAuxInt(int8(c))
803                         v.AddArg(x)
804                         return true
805                 }
806                 break
807         }
808         // match: (ADDL x (SHLLconst [3] y))
809         // result: (LEAL8 x y)
810         for {
811                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
812                         x := v_0
813                         if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 3 {
814                                 continue
815                         }
816                         y := v_1.Args[0]
817                         v.reset(Op386LEAL8)
818                         v.AddArg2(x, y)
819                         return true
820                 }
821                 break
822         }
823         // match: (ADDL x (SHLLconst [2] y))
824         // result: (LEAL4 x y)
825         for {
826                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
827                         x := v_0
828                         if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 2 {
829                                 continue
830                         }
831                         y := v_1.Args[0]
832                         v.reset(Op386LEAL4)
833                         v.AddArg2(x, y)
834                         return true
835                 }
836                 break
837         }
838         // match: (ADDL x (SHLLconst [1] y))
839         // result: (LEAL2 x y)
840         for {
841                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
842                         x := v_0
843                         if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 1 {
844                                 continue
845                         }
846                         y := v_1.Args[0]
847                         v.reset(Op386LEAL2)
848                         v.AddArg2(x, y)
849                         return true
850                 }
851                 break
852         }
853         // match: (ADDL x (ADDL y y))
854         // result: (LEAL2 x y)
855         for {
856                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
857                         x := v_0
858                         if v_1.Op != Op386ADDL {
859                                 continue
860                         }
861                         y := v_1.Args[1]
862                         if y != v_1.Args[0] {
863                                 continue
864                         }
865                         v.reset(Op386LEAL2)
866                         v.AddArg2(x, y)
867                         return true
868                 }
869                 break
870         }
871         // match: (ADDL x (ADDL x y))
872         // result: (LEAL2 y x)
873         for {
874                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
875                         x := v_0
876                         if v_1.Op != Op386ADDL {
877                                 continue
878                         }
879                         _ = v_1.Args[1]
880                         v_1_0 := v_1.Args[0]
881                         v_1_1 := v_1.Args[1]
882                         for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 {
883                                 if x != v_1_0 {
884                                         continue
885                                 }
886                                 y := v_1_1
887                                 v.reset(Op386LEAL2)
888                                 v.AddArg2(y, x)
889                                 return true
890                         }
891                 }
892                 break
893         }
894         // match: (ADDL (ADDLconst [c] x) y)
895         // result: (LEAL1 [c] x y)
896         for {
897                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
898                         if v_0.Op != Op386ADDLconst {
899                                 continue
900                         }
901                         c := auxIntToInt32(v_0.AuxInt)
902                         x := v_0.Args[0]
903                         y := v_1
904                         v.reset(Op386LEAL1)
905                         v.AuxInt = int32ToAuxInt(c)
906                         v.AddArg2(x, y)
907                         return true
908                 }
909                 break
910         }
911         // match: (ADDL x (LEAL [c] {s} y))
912         // cond: x.Op != OpSB && y.Op != OpSB
913         // result: (LEAL1 [c] {s} x y)
914         for {
915                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
916                         x := v_0
917                         if v_1.Op != Op386LEAL {
918                                 continue
919                         }
920                         c := auxIntToInt32(v_1.AuxInt)
921                         s := auxToSym(v_1.Aux)
922                         y := v_1.Args[0]
923                         if !(x.Op != OpSB && y.Op != OpSB) {
924                                 continue
925                         }
926                         v.reset(Op386LEAL1)
927                         v.AuxInt = int32ToAuxInt(c)
928                         v.Aux = symToAux(s)
929                         v.AddArg2(x, y)
930                         return true
931                 }
932                 break
933         }
934         // match: (ADDL x l:(MOVLload [off] {sym} ptr mem))
935         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
936         // result: (ADDLload x [off] {sym} ptr mem)
937         for {
938                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
939                         x := v_0
940                         l := v_1
941                         if l.Op != Op386MOVLload {
942                                 continue
943                         }
944                         off := auxIntToInt32(l.AuxInt)
945                         sym := auxToSym(l.Aux)
946                         mem := l.Args[1]
947                         ptr := l.Args[0]
948                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
949                                 continue
950                         }
951                         v.reset(Op386ADDLload)
952                         v.AuxInt = int32ToAuxInt(off)
953                         v.Aux = symToAux(sym)
954                         v.AddArg3(x, ptr, mem)
955                         return true
956                 }
957                 break
958         }
959         // match: (ADDL x (NEGL y))
960         // result: (SUBL x y)
961         for {
962                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
963                         x := v_0
964                         if v_1.Op != Op386NEGL {
965                                 continue
966                         }
967                         y := v_1.Args[0]
968                         v.reset(Op386SUBL)
969                         v.AddArg2(x, y)
970                         return true
971                 }
972                 break
973         }
974         return false
975 }
976 func rewriteValue386_Op386ADDLcarry(v *Value) bool {
977         v_1 := v.Args[1]
978         v_0 := v.Args[0]
979         // match: (ADDLcarry x (MOVLconst [c]))
980         // result: (ADDLconstcarry [c] x)
981         for {
982                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
983                         x := v_0
984                         if v_1.Op != Op386MOVLconst {
985                                 continue
986                         }
987                         c := auxIntToInt32(v_1.AuxInt)
988                         v.reset(Op386ADDLconstcarry)
989                         v.AuxInt = int32ToAuxInt(c)
990                         v.AddArg(x)
991                         return true
992                 }
993                 break
994         }
995         return false
996 }
997 func rewriteValue386_Op386ADDLconst(v *Value) bool {
998         v_0 := v.Args[0]
999         // match: (ADDLconst [c] (ADDL x y))
1000         // result: (LEAL1 [c] x y)
1001         for {
1002                 c := auxIntToInt32(v.AuxInt)
1003                 if v_0.Op != Op386ADDL {
1004                         break
1005                 }
1006                 y := v_0.Args[1]
1007                 x := v_0.Args[0]
1008                 v.reset(Op386LEAL1)
1009                 v.AuxInt = int32ToAuxInt(c)
1010                 v.AddArg2(x, y)
1011                 return true
1012         }
1013         // match: (ADDLconst [c] (LEAL [d] {s} x))
1014         // cond: is32Bit(int64(c)+int64(d))
1015         // result: (LEAL [c+d] {s} x)
1016         for {
1017                 c := auxIntToInt32(v.AuxInt)
1018                 if v_0.Op != Op386LEAL {
1019                         break
1020                 }
1021                 d := auxIntToInt32(v_0.AuxInt)
1022                 s := auxToSym(v_0.Aux)
1023                 x := v_0.Args[0]
1024                 if !(is32Bit(int64(c) + int64(d))) {
1025                         break
1026                 }
1027                 v.reset(Op386LEAL)
1028                 v.AuxInt = int32ToAuxInt(c + d)
1029                 v.Aux = symToAux(s)
1030                 v.AddArg(x)
1031                 return true
1032         }
1033         // match: (ADDLconst [c] x:(SP))
1034         // result: (LEAL [c] x)
1035         for {
1036                 c := auxIntToInt32(v.AuxInt)
1037                 x := v_0
1038                 if x.Op != OpSP {
1039                         break
1040                 }
1041                 v.reset(Op386LEAL)
1042                 v.AuxInt = int32ToAuxInt(c)
1043                 v.AddArg(x)
1044                 return true
1045         }
1046         // match: (ADDLconst [c] (LEAL1 [d] {s} x y))
1047         // cond: is32Bit(int64(c)+int64(d))
1048         // result: (LEAL1 [c+d] {s} x y)
1049         for {
1050                 c := auxIntToInt32(v.AuxInt)
1051                 if v_0.Op != Op386LEAL1 {
1052                         break
1053                 }
1054                 d := auxIntToInt32(v_0.AuxInt)
1055                 s := auxToSym(v_0.Aux)
1056                 y := v_0.Args[1]
1057                 x := v_0.Args[0]
1058                 if !(is32Bit(int64(c) + int64(d))) {
1059                         break
1060                 }
1061                 v.reset(Op386LEAL1)
1062                 v.AuxInt = int32ToAuxInt(c + d)
1063                 v.Aux = symToAux(s)
1064                 v.AddArg2(x, y)
1065                 return true
1066         }
1067         // match: (ADDLconst [c] (LEAL2 [d] {s} x y))
1068         // cond: is32Bit(int64(c)+int64(d))
1069         // result: (LEAL2 [c+d] {s} x y)
1070         for {
1071                 c := auxIntToInt32(v.AuxInt)
1072                 if v_0.Op != Op386LEAL2 {
1073                         break
1074                 }
1075                 d := auxIntToInt32(v_0.AuxInt)
1076                 s := auxToSym(v_0.Aux)
1077                 y := v_0.Args[1]
1078                 x := v_0.Args[0]
1079                 if !(is32Bit(int64(c) + int64(d))) {
1080                         break
1081                 }
1082                 v.reset(Op386LEAL2)
1083                 v.AuxInt = int32ToAuxInt(c + d)
1084                 v.Aux = symToAux(s)
1085                 v.AddArg2(x, y)
1086                 return true
1087         }
1088         // match: (ADDLconst [c] (LEAL4 [d] {s} x y))
1089         // cond: is32Bit(int64(c)+int64(d))
1090         // result: (LEAL4 [c+d] {s} x y)
1091         for {
1092                 c := auxIntToInt32(v.AuxInt)
1093                 if v_0.Op != Op386LEAL4 {
1094                         break
1095                 }
1096                 d := auxIntToInt32(v_0.AuxInt)
1097                 s := auxToSym(v_0.Aux)
1098                 y := v_0.Args[1]
1099                 x := v_0.Args[0]
1100                 if !(is32Bit(int64(c) + int64(d))) {
1101                         break
1102                 }
1103                 v.reset(Op386LEAL4)
1104                 v.AuxInt = int32ToAuxInt(c + d)
1105                 v.Aux = symToAux(s)
1106                 v.AddArg2(x, y)
1107                 return true
1108         }
1109         // match: (ADDLconst [c] (LEAL8 [d] {s} x y))
1110         // cond: is32Bit(int64(c)+int64(d))
1111         // result: (LEAL8 [c+d] {s} x y)
1112         for {
1113                 c := auxIntToInt32(v.AuxInt)
1114                 if v_0.Op != Op386LEAL8 {
1115                         break
1116                 }
1117                 d := auxIntToInt32(v_0.AuxInt)
1118                 s := auxToSym(v_0.Aux)
1119                 y := v_0.Args[1]
1120                 x := v_0.Args[0]
1121                 if !(is32Bit(int64(c) + int64(d))) {
1122                         break
1123                 }
1124                 v.reset(Op386LEAL8)
1125                 v.AuxInt = int32ToAuxInt(c + d)
1126                 v.Aux = symToAux(s)
1127                 v.AddArg2(x, y)
1128                 return true
1129         }
1130         // match: (ADDLconst [c] x)
1131         // cond: c==0
1132         // result: x
1133         for {
1134                 c := auxIntToInt32(v.AuxInt)
1135                 x := v_0
1136                 if !(c == 0) {
1137                         break
1138                 }
1139                 v.copyOf(x)
1140                 return true
1141         }
1142         // match: (ADDLconst [c] (MOVLconst [d]))
1143         // result: (MOVLconst [c+d])
1144         for {
1145                 c := auxIntToInt32(v.AuxInt)
1146                 if v_0.Op != Op386MOVLconst {
1147                         break
1148                 }
1149                 d := auxIntToInt32(v_0.AuxInt)
1150                 v.reset(Op386MOVLconst)
1151                 v.AuxInt = int32ToAuxInt(c + d)
1152                 return true
1153         }
1154         // match: (ADDLconst [c] (ADDLconst [d] x))
1155         // result: (ADDLconst [c+d] x)
1156         for {
1157                 c := auxIntToInt32(v.AuxInt)
1158                 if v_0.Op != Op386ADDLconst {
1159                         break
1160                 }
1161                 d := auxIntToInt32(v_0.AuxInt)
1162                 x := v_0.Args[0]
1163                 v.reset(Op386ADDLconst)
1164                 v.AuxInt = int32ToAuxInt(c + d)
1165                 v.AddArg(x)
1166                 return true
1167         }
1168         return false
1169 }
1170 func rewriteValue386_Op386ADDLconstmodify(v *Value) bool {
1171         v_1 := v.Args[1]
1172         v_0 := v.Args[0]
1173         b := v.Block
1174         config := b.Func.Config
1175         // match: (ADDLconstmodify [valoff1] {sym} (ADDLconst [off2] base) mem)
1176         // cond: valoff1.canAdd32(off2)
1177         // result: (ADDLconstmodify [valoff1.addOffset32(off2)] {sym} base mem)
1178         for {
1179                 valoff1 := auxIntToValAndOff(v.AuxInt)
1180                 sym := auxToSym(v.Aux)
1181                 if v_0.Op != Op386ADDLconst {
1182                         break
1183                 }
1184                 off2 := auxIntToInt32(v_0.AuxInt)
1185                 base := v_0.Args[0]
1186                 mem := v_1
1187                 if !(valoff1.canAdd32(off2)) {
1188                         break
1189                 }
1190                 v.reset(Op386ADDLconstmodify)
1191                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
1192                 v.Aux = symToAux(sym)
1193                 v.AddArg2(base, mem)
1194                 return true
1195         }
1196         // match: (ADDLconstmodify [valoff1] {sym1} (LEAL [off2] {sym2} base) mem)
1197         // cond: valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1198         // result: (ADDLconstmodify [valoff1.addOffset32(off2)] {mergeSym(sym1,sym2)} base mem)
1199         for {
1200                 valoff1 := auxIntToValAndOff(v.AuxInt)
1201                 sym1 := auxToSym(v.Aux)
1202                 if v_0.Op != Op386LEAL {
1203                         break
1204                 }
1205                 off2 := auxIntToInt32(v_0.AuxInt)
1206                 sym2 := auxToSym(v_0.Aux)
1207                 base := v_0.Args[0]
1208                 mem := v_1
1209                 if !(valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1210                         break
1211                 }
1212                 v.reset(Op386ADDLconstmodify)
1213                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
1214                 v.Aux = symToAux(mergeSym(sym1, sym2))
1215                 v.AddArg2(base, mem)
1216                 return true
1217         }
1218         return false
1219 }
1220 func rewriteValue386_Op386ADDLload(v *Value) bool {
1221         v_2 := v.Args[2]
1222         v_1 := v.Args[1]
1223         v_0 := v.Args[0]
1224         b := v.Block
1225         config := b.Func.Config
1226         // match: (ADDLload [off1] {sym} val (ADDLconst [off2] base) mem)
1227         // cond: is32Bit(int64(off1)+int64(off2))
1228         // result: (ADDLload [off1+off2] {sym} val base mem)
1229         for {
1230                 off1 := auxIntToInt32(v.AuxInt)
1231                 sym := auxToSym(v.Aux)
1232                 val := v_0
1233                 if v_1.Op != Op386ADDLconst {
1234                         break
1235                 }
1236                 off2 := auxIntToInt32(v_1.AuxInt)
1237                 base := v_1.Args[0]
1238                 mem := v_2
1239                 if !(is32Bit(int64(off1) + int64(off2))) {
1240                         break
1241                 }
1242                 v.reset(Op386ADDLload)
1243                 v.AuxInt = int32ToAuxInt(off1 + off2)
1244                 v.Aux = symToAux(sym)
1245                 v.AddArg3(val, base, mem)
1246                 return true
1247         }
1248         // match: (ADDLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
1249         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1250         // result: (ADDLload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
1251         for {
1252                 off1 := auxIntToInt32(v.AuxInt)
1253                 sym1 := auxToSym(v.Aux)
1254                 val := v_0
1255                 if v_1.Op != Op386LEAL {
1256                         break
1257                 }
1258                 off2 := auxIntToInt32(v_1.AuxInt)
1259                 sym2 := auxToSym(v_1.Aux)
1260                 base := v_1.Args[0]
1261                 mem := v_2
1262                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1263                         break
1264                 }
1265                 v.reset(Op386ADDLload)
1266                 v.AuxInt = int32ToAuxInt(off1 + off2)
1267                 v.Aux = symToAux(mergeSym(sym1, sym2))
1268                 v.AddArg3(val, base, mem)
1269                 return true
1270         }
1271         return false
1272 }
1273 func rewriteValue386_Op386ADDLmodify(v *Value) bool {
1274         v_2 := v.Args[2]
1275         v_1 := v.Args[1]
1276         v_0 := v.Args[0]
1277         b := v.Block
1278         config := b.Func.Config
1279         // match: (ADDLmodify [off1] {sym} (ADDLconst [off2] base) val mem)
1280         // cond: is32Bit(int64(off1)+int64(off2))
1281         // result: (ADDLmodify [off1+off2] {sym} base val mem)
1282         for {
1283                 off1 := auxIntToInt32(v.AuxInt)
1284                 sym := auxToSym(v.Aux)
1285                 if v_0.Op != Op386ADDLconst {
1286                         break
1287                 }
1288                 off2 := auxIntToInt32(v_0.AuxInt)
1289                 base := v_0.Args[0]
1290                 val := v_1
1291                 mem := v_2
1292                 if !(is32Bit(int64(off1) + int64(off2))) {
1293                         break
1294                 }
1295                 v.reset(Op386ADDLmodify)
1296                 v.AuxInt = int32ToAuxInt(off1 + off2)
1297                 v.Aux = symToAux(sym)
1298                 v.AddArg3(base, val, mem)
1299                 return true
1300         }
1301         // match: (ADDLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
1302         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1303         // result: (ADDLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem)
1304         for {
1305                 off1 := auxIntToInt32(v.AuxInt)
1306                 sym1 := auxToSym(v.Aux)
1307                 if v_0.Op != Op386LEAL {
1308                         break
1309                 }
1310                 off2 := auxIntToInt32(v_0.AuxInt)
1311                 sym2 := auxToSym(v_0.Aux)
1312                 base := v_0.Args[0]
1313                 val := v_1
1314                 mem := v_2
1315                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1316                         break
1317                 }
1318                 v.reset(Op386ADDLmodify)
1319                 v.AuxInt = int32ToAuxInt(off1 + off2)
1320                 v.Aux = symToAux(mergeSym(sym1, sym2))
1321                 v.AddArg3(base, val, mem)
1322                 return true
1323         }
1324         return false
1325 }
1326 func rewriteValue386_Op386ADDSD(v *Value) bool {
1327         v_1 := v.Args[1]
1328         v_0 := v.Args[0]
1329         // match: (ADDSD x l:(MOVSDload [off] {sym} ptr mem))
1330         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
1331         // result: (ADDSDload x [off] {sym} ptr mem)
1332         for {
1333                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1334                         x := v_0
1335                         l := v_1
1336                         if l.Op != Op386MOVSDload {
1337                                 continue
1338                         }
1339                         off := auxIntToInt32(l.AuxInt)
1340                         sym := auxToSym(l.Aux)
1341                         mem := l.Args[1]
1342                         ptr := l.Args[0]
1343                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
1344                                 continue
1345                         }
1346                         v.reset(Op386ADDSDload)
1347                         v.AuxInt = int32ToAuxInt(off)
1348                         v.Aux = symToAux(sym)
1349                         v.AddArg3(x, ptr, mem)
1350                         return true
1351                 }
1352                 break
1353         }
1354         return false
1355 }
1356 func rewriteValue386_Op386ADDSDload(v *Value) bool {
1357         v_2 := v.Args[2]
1358         v_1 := v.Args[1]
1359         v_0 := v.Args[0]
1360         b := v.Block
1361         config := b.Func.Config
1362         // match: (ADDSDload [off1] {sym} val (ADDLconst [off2] base) mem)
1363         // cond: is32Bit(int64(off1)+int64(off2))
1364         // result: (ADDSDload [off1+off2] {sym} val base mem)
1365         for {
1366                 off1 := auxIntToInt32(v.AuxInt)
1367                 sym := auxToSym(v.Aux)
1368                 val := v_0
1369                 if v_1.Op != Op386ADDLconst {
1370                         break
1371                 }
1372                 off2 := auxIntToInt32(v_1.AuxInt)
1373                 base := v_1.Args[0]
1374                 mem := v_2
1375                 if !(is32Bit(int64(off1) + int64(off2))) {
1376                         break
1377                 }
1378                 v.reset(Op386ADDSDload)
1379                 v.AuxInt = int32ToAuxInt(off1 + off2)
1380                 v.Aux = symToAux(sym)
1381                 v.AddArg3(val, base, mem)
1382                 return true
1383         }
1384         // match: (ADDSDload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
1385         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1386         // result: (ADDSDload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
1387         for {
1388                 off1 := auxIntToInt32(v.AuxInt)
1389                 sym1 := auxToSym(v.Aux)
1390                 val := v_0
1391                 if v_1.Op != Op386LEAL {
1392                         break
1393                 }
1394                 off2 := auxIntToInt32(v_1.AuxInt)
1395                 sym2 := auxToSym(v_1.Aux)
1396                 base := v_1.Args[0]
1397                 mem := v_2
1398                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1399                         break
1400                 }
1401                 v.reset(Op386ADDSDload)
1402                 v.AuxInt = int32ToAuxInt(off1 + off2)
1403                 v.Aux = symToAux(mergeSym(sym1, sym2))
1404                 v.AddArg3(val, base, mem)
1405                 return true
1406         }
1407         return false
1408 }
1409 func rewriteValue386_Op386ADDSS(v *Value) bool {
1410         v_1 := v.Args[1]
1411         v_0 := v.Args[0]
1412         // match: (ADDSS x l:(MOVSSload [off] {sym} ptr mem))
1413         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
1414         // result: (ADDSSload x [off] {sym} ptr mem)
1415         for {
1416                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1417                         x := v_0
1418                         l := v_1
1419                         if l.Op != Op386MOVSSload {
1420                                 continue
1421                         }
1422                         off := auxIntToInt32(l.AuxInt)
1423                         sym := auxToSym(l.Aux)
1424                         mem := l.Args[1]
1425                         ptr := l.Args[0]
1426                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
1427                                 continue
1428                         }
1429                         v.reset(Op386ADDSSload)
1430                         v.AuxInt = int32ToAuxInt(off)
1431                         v.Aux = symToAux(sym)
1432                         v.AddArg3(x, ptr, mem)
1433                         return true
1434                 }
1435                 break
1436         }
1437         return false
1438 }
1439 func rewriteValue386_Op386ADDSSload(v *Value) bool {
1440         v_2 := v.Args[2]
1441         v_1 := v.Args[1]
1442         v_0 := v.Args[0]
1443         b := v.Block
1444         config := b.Func.Config
1445         // match: (ADDSSload [off1] {sym} val (ADDLconst [off2] base) mem)
1446         // cond: is32Bit(int64(off1)+int64(off2))
1447         // result: (ADDSSload [off1+off2] {sym} val base mem)
1448         for {
1449                 off1 := auxIntToInt32(v.AuxInt)
1450                 sym := auxToSym(v.Aux)
1451                 val := v_0
1452                 if v_1.Op != Op386ADDLconst {
1453                         break
1454                 }
1455                 off2 := auxIntToInt32(v_1.AuxInt)
1456                 base := v_1.Args[0]
1457                 mem := v_2
1458                 if !(is32Bit(int64(off1) + int64(off2))) {
1459                         break
1460                 }
1461                 v.reset(Op386ADDSSload)
1462                 v.AuxInt = int32ToAuxInt(off1 + off2)
1463                 v.Aux = symToAux(sym)
1464                 v.AddArg3(val, base, mem)
1465                 return true
1466         }
1467         // match: (ADDSSload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
1468         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1469         // result: (ADDSSload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
1470         for {
1471                 off1 := auxIntToInt32(v.AuxInt)
1472                 sym1 := auxToSym(v.Aux)
1473                 val := v_0
1474                 if v_1.Op != Op386LEAL {
1475                         break
1476                 }
1477                 off2 := auxIntToInt32(v_1.AuxInt)
1478                 sym2 := auxToSym(v_1.Aux)
1479                 base := v_1.Args[0]
1480                 mem := v_2
1481                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1482                         break
1483                 }
1484                 v.reset(Op386ADDSSload)
1485                 v.AuxInt = int32ToAuxInt(off1 + off2)
1486                 v.Aux = symToAux(mergeSym(sym1, sym2))
1487                 v.AddArg3(val, base, mem)
1488                 return true
1489         }
1490         return false
1491 }
1492 func rewriteValue386_Op386ANDL(v *Value) bool {
1493         v_1 := v.Args[1]
1494         v_0 := v.Args[0]
1495         // match: (ANDL x (MOVLconst [c]))
1496         // result: (ANDLconst [c] x)
1497         for {
1498                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1499                         x := v_0
1500                         if v_1.Op != Op386MOVLconst {
1501                                 continue
1502                         }
1503                         c := auxIntToInt32(v_1.AuxInt)
1504                         v.reset(Op386ANDLconst)
1505                         v.AuxInt = int32ToAuxInt(c)
1506                         v.AddArg(x)
1507                         return true
1508                 }
1509                 break
1510         }
1511         // match: (ANDL x l:(MOVLload [off] {sym} ptr mem))
1512         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
1513         // result: (ANDLload x [off] {sym} ptr mem)
1514         for {
1515                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1516                         x := v_0
1517                         l := v_1
1518                         if l.Op != Op386MOVLload {
1519                                 continue
1520                         }
1521                         off := auxIntToInt32(l.AuxInt)
1522                         sym := auxToSym(l.Aux)
1523                         mem := l.Args[1]
1524                         ptr := l.Args[0]
1525                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
1526                                 continue
1527                         }
1528                         v.reset(Op386ANDLload)
1529                         v.AuxInt = int32ToAuxInt(off)
1530                         v.Aux = symToAux(sym)
1531                         v.AddArg3(x, ptr, mem)
1532                         return true
1533                 }
1534                 break
1535         }
1536         // match: (ANDL x x)
1537         // result: x
1538         for {
1539                 x := v_0
1540                 if x != v_1 {
1541                         break
1542                 }
1543                 v.copyOf(x)
1544                 return true
1545         }
1546         return false
1547 }
1548 func rewriteValue386_Op386ANDLconst(v *Value) bool {
1549         v_0 := v.Args[0]
1550         // match: (ANDLconst [c] (ANDLconst [d] x))
1551         // result: (ANDLconst [c & d] x)
1552         for {
1553                 c := auxIntToInt32(v.AuxInt)
1554                 if v_0.Op != Op386ANDLconst {
1555                         break
1556                 }
1557                 d := auxIntToInt32(v_0.AuxInt)
1558                 x := v_0.Args[0]
1559                 v.reset(Op386ANDLconst)
1560                 v.AuxInt = int32ToAuxInt(c & d)
1561                 v.AddArg(x)
1562                 return true
1563         }
1564         // match: (ANDLconst [c] _)
1565         // cond: c==0
1566         // result: (MOVLconst [0])
1567         for {
1568                 c := auxIntToInt32(v.AuxInt)
1569                 if !(c == 0) {
1570                         break
1571                 }
1572                 v.reset(Op386MOVLconst)
1573                 v.AuxInt = int32ToAuxInt(0)
1574                 return true
1575         }
1576         // match: (ANDLconst [c] x)
1577         // cond: c==-1
1578         // result: x
1579         for {
1580                 c := auxIntToInt32(v.AuxInt)
1581                 x := v_0
1582                 if !(c == -1) {
1583                         break
1584                 }
1585                 v.copyOf(x)
1586                 return true
1587         }
1588         // match: (ANDLconst [c] (MOVLconst [d]))
1589         // result: (MOVLconst [c&d])
1590         for {
1591                 c := auxIntToInt32(v.AuxInt)
1592                 if v_0.Op != Op386MOVLconst {
1593                         break
1594                 }
1595                 d := auxIntToInt32(v_0.AuxInt)
1596                 v.reset(Op386MOVLconst)
1597                 v.AuxInt = int32ToAuxInt(c & d)
1598                 return true
1599         }
1600         return false
1601 }
1602 func rewriteValue386_Op386ANDLconstmodify(v *Value) bool {
1603         v_1 := v.Args[1]
1604         v_0 := v.Args[0]
1605         b := v.Block
1606         config := b.Func.Config
1607         // match: (ANDLconstmodify [valoff1] {sym} (ADDLconst [off2] base) mem)
1608         // cond: valoff1.canAdd32(off2)
1609         // result: (ANDLconstmodify [valoff1.addOffset32(off2)] {sym} base mem)
1610         for {
1611                 valoff1 := auxIntToValAndOff(v.AuxInt)
1612                 sym := auxToSym(v.Aux)
1613                 if v_0.Op != Op386ADDLconst {
1614                         break
1615                 }
1616                 off2 := auxIntToInt32(v_0.AuxInt)
1617                 base := v_0.Args[0]
1618                 mem := v_1
1619                 if !(valoff1.canAdd32(off2)) {
1620                         break
1621                 }
1622                 v.reset(Op386ANDLconstmodify)
1623                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
1624                 v.Aux = symToAux(sym)
1625                 v.AddArg2(base, mem)
1626                 return true
1627         }
1628         // match: (ANDLconstmodify [valoff1] {sym1} (LEAL [off2] {sym2} base) mem)
1629         // cond: valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1630         // result: (ANDLconstmodify [valoff1.addOffset32(off2)] {mergeSym(sym1,sym2)} base mem)
1631         for {
1632                 valoff1 := auxIntToValAndOff(v.AuxInt)
1633                 sym1 := auxToSym(v.Aux)
1634                 if v_0.Op != Op386LEAL {
1635                         break
1636                 }
1637                 off2 := auxIntToInt32(v_0.AuxInt)
1638                 sym2 := auxToSym(v_0.Aux)
1639                 base := v_0.Args[0]
1640                 mem := v_1
1641                 if !(valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1642                         break
1643                 }
1644                 v.reset(Op386ANDLconstmodify)
1645                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
1646                 v.Aux = symToAux(mergeSym(sym1, sym2))
1647                 v.AddArg2(base, mem)
1648                 return true
1649         }
1650         return false
1651 }
1652 func rewriteValue386_Op386ANDLload(v *Value) bool {
1653         v_2 := v.Args[2]
1654         v_1 := v.Args[1]
1655         v_0 := v.Args[0]
1656         b := v.Block
1657         config := b.Func.Config
1658         // match: (ANDLload [off1] {sym} val (ADDLconst [off2] base) mem)
1659         // cond: is32Bit(int64(off1)+int64(off2))
1660         // result: (ANDLload [off1+off2] {sym} val base mem)
1661         for {
1662                 off1 := auxIntToInt32(v.AuxInt)
1663                 sym := auxToSym(v.Aux)
1664                 val := v_0
1665                 if v_1.Op != Op386ADDLconst {
1666                         break
1667                 }
1668                 off2 := auxIntToInt32(v_1.AuxInt)
1669                 base := v_1.Args[0]
1670                 mem := v_2
1671                 if !(is32Bit(int64(off1) + int64(off2))) {
1672                         break
1673                 }
1674                 v.reset(Op386ANDLload)
1675                 v.AuxInt = int32ToAuxInt(off1 + off2)
1676                 v.Aux = symToAux(sym)
1677                 v.AddArg3(val, base, mem)
1678                 return true
1679         }
1680         // match: (ANDLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
1681         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1682         // result: (ANDLload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
1683         for {
1684                 off1 := auxIntToInt32(v.AuxInt)
1685                 sym1 := auxToSym(v.Aux)
1686                 val := v_0
1687                 if v_1.Op != Op386LEAL {
1688                         break
1689                 }
1690                 off2 := auxIntToInt32(v_1.AuxInt)
1691                 sym2 := auxToSym(v_1.Aux)
1692                 base := v_1.Args[0]
1693                 mem := v_2
1694                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1695                         break
1696                 }
1697                 v.reset(Op386ANDLload)
1698                 v.AuxInt = int32ToAuxInt(off1 + off2)
1699                 v.Aux = symToAux(mergeSym(sym1, sym2))
1700                 v.AddArg3(val, base, mem)
1701                 return true
1702         }
1703         return false
1704 }
1705 func rewriteValue386_Op386ANDLmodify(v *Value) bool {
1706         v_2 := v.Args[2]
1707         v_1 := v.Args[1]
1708         v_0 := v.Args[0]
1709         b := v.Block
1710         config := b.Func.Config
1711         // match: (ANDLmodify [off1] {sym} (ADDLconst [off2] base) val mem)
1712         // cond: is32Bit(int64(off1)+int64(off2))
1713         // result: (ANDLmodify [off1+off2] {sym} base val mem)
1714         for {
1715                 off1 := auxIntToInt32(v.AuxInt)
1716                 sym := auxToSym(v.Aux)
1717                 if v_0.Op != Op386ADDLconst {
1718                         break
1719                 }
1720                 off2 := auxIntToInt32(v_0.AuxInt)
1721                 base := v_0.Args[0]
1722                 val := v_1
1723                 mem := v_2
1724                 if !(is32Bit(int64(off1) + int64(off2))) {
1725                         break
1726                 }
1727                 v.reset(Op386ANDLmodify)
1728                 v.AuxInt = int32ToAuxInt(off1 + off2)
1729                 v.Aux = symToAux(sym)
1730                 v.AddArg3(base, val, mem)
1731                 return true
1732         }
1733         // match: (ANDLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
1734         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1735         // result: (ANDLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem)
1736         for {
1737                 off1 := auxIntToInt32(v.AuxInt)
1738                 sym1 := auxToSym(v.Aux)
1739                 if v_0.Op != Op386LEAL {
1740                         break
1741                 }
1742                 off2 := auxIntToInt32(v_0.AuxInt)
1743                 sym2 := auxToSym(v_0.Aux)
1744                 base := v_0.Args[0]
1745                 val := v_1
1746                 mem := v_2
1747                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1748                         break
1749                 }
1750                 v.reset(Op386ANDLmodify)
1751                 v.AuxInt = int32ToAuxInt(off1 + off2)
1752                 v.Aux = symToAux(mergeSym(sym1, sym2))
1753                 v.AddArg3(base, val, mem)
1754                 return true
1755         }
1756         return false
1757 }
1758 func rewriteValue386_Op386CMPB(v *Value) bool {
1759         v_1 := v.Args[1]
1760         v_0 := v.Args[0]
1761         b := v.Block
1762         // match: (CMPB x (MOVLconst [c]))
1763         // result: (CMPBconst x [int8(c)])
1764         for {
1765                 x := v_0
1766                 if v_1.Op != Op386MOVLconst {
1767                         break
1768                 }
1769                 c := auxIntToInt32(v_1.AuxInt)
1770                 v.reset(Op386CMPBconst)
1771                 v.AuxInt = int8ToAuxInt(int8(c))
1772                 v.AddArg(x)
1773                 return true
1774         }
1775         // match: (CMPB (MOVLconst [c]) x)
1776         // result: (InvertFlags (CMPBconst x [int8(c)]))
1777         for {
1778                 if v_0.Op != Op386MOVLconst {
1779                         break
1780                 }
1781                 c := auxIntToInt32(v_0.AuxInt)
1782                 x := v_1
1783                 v.reset(Op386InvertFlags)
1784                 v0 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
1785                 v0.AuxInt = int8ToAuxInt(int8(c))
1786                 v0.AddArg(x)
1787                 v.AddArg(v0)
1788                 return true
1789         }
1790         // match: (CMPB x y)
1791         // cond: canonLessThan(x,y)
1792         // result: (InvertFlags (CMPB y x))
1793         for {
1794                 x := v_0
1795                 y := v_1
1796                 if !(canonLessThan(x, y)) {
1797                         break
1798                 }
1799                 v.reset(Op386InvertFlags)
1800                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
1801                 v0.AddArg2(y, x)
1802                 v.AddArg(v0)
1803                 return true
1804         }
1805         // match: (CMPB l:(MOVBload {sym} [off] ptr mem) x)
1806         // cond: canMergeLoad(v, l) && clobber(l)
1807         // result: (CMPBload {sym} [off] ptr x mem)
1808         for {
1809                 l := v_0
1810                 if l.Op != Op386MOVBload {
1811                         break
1812                 }
1813                 off := auxIntToInt32(l.AuxInt)
1814                 sym := auxToSym(l.Aux)
1815                 mem := l.Args[1]
1816                 ptr := l.Args[0]
1817                 x := v_1
1818                 if !(canMergeLoad(v, l) && clobber(l)) {
1819                         break
1820                 }
1821                 v.reset(Op386CMPBload)
1822                 v.AuxInt = int32ToAuxInt(off)
1823                 v.Aux = symToAux(sym)
1824                 v.AddArg3(ptr, x, mem)
1825                 return true
1826         }
1827         // match: (CMPB x l:(MOVBload {sym} [off] ptr mem))
1828         // cond: canMergeLoad(v, l) && clobber(l)
1829         // result: (InvertFlags (CMPBload {sym} [off] ptr x mem))
1830         for {
1831                 x := v_0
1832                 l := v_1
1833                 if l.Op != Op386MOVBload {
1834                         break
1835                 }
1836                 off := auxIntToInt32(l.AuxInt)
1837                 sym := auxToSym(l.Aux)
1838                 mem := l.Args[1]
1839                 ptr := l.Args[0]
1840                 if !(canMergeLoad(v, l) && clobber(l)) {
1841                         break
1842                 }
1843                 v.reset(Op386InvertFlags)
1844                 v0 := b.NewValue0(l.Pos, Op386CMPBload, types.TypeFlags)
1845                 v0.AuxInt = int32ToAuxInt(off)
1846                 v0.Aux = symToAux(sym)
1847                 v0.AddArg3(ptr, x, mem)
1848                 v.AddArg(v0)
1849                 return true
1850         }
1851         return false
1852 }
1853 func rewriteValue386_Op386CMPBconst(v *Value) bool {
1854         v_0 := v.Args[0]
1855         b := v.Block
1856         // match: (CMPBconst (MOVLconst [x]) [y])
1857         // cond: int8(x)==y
1858         // result: (FlagEQ)
1859         for {
1860                 y := auxIntToInt8(v.AuxInt)
1861                 if v_0.Op != Op386MOVLconst {
1862                         break
1863                 }
1864                 x := auxIntToInt32(v_0.AuxInt)
1865                 if !(int8(x) == y) {
1866                         break
1867                 }
1868                 v.reset(Op386FlagEQ)
1869                 return true
1870         }
1871         // match: (CMPBconst (MOVLconst [x]) [y])
1872         // cond: int8(x)<y && uint8(x)<uint8(y)
1873         // result: (FlagLT_ULT)
1874         for {
1875                 y := auxIntToInt8(v.AuxInt)
1876                 if v_0.Op != Op386MOVLconst {
1877                         break
1878                 }
1879                 x := auxIntToInt32(v_0.AuxInt)
1880                 if !(int8(x) < y && uint8(x) < uint8(y)) {
1881                         break
1882                 }
1883                 v.reset(Op386FlagLT_ULT)
1884                 return true
1885         }
1886         // match: (CMPBconst (MOVLconst [x]) [y])
1887         // cond: int8(x)<y && uint8(x)>uint8(y)
1888         // result: (FlagLT_UGT)
1889         for {
1890                 y := auxIntToInt8(v.AuxInt)
1891                 if v_0.Op != Op386MOVLconst {
1892                         break
1893                 }
1894                 x := auxIntToInt32(v_0.AuxInt)
1895                 if !(int8(x) < y && uint8(x) > uint8(y)) {
1896                         break
1897                 }
1898                 v.reset(Op386FlagLT_UGT)
1899                 return true
1900         }
1901         // match: (CMPBconst (MOVLconst [x]) [y])
1902         // cond: int8(x)>y && uint8(x)<uint8(y)
1903         // result: (FlagGT_ULT)
1904         for {
1905                 y := auxIntToInt8(v.AuxInt)
1906                 if v_0.Op != Op386MOVLconst {
1907                         break
1908                 }
1909                 x := auxIntToInt32(v_0.AuxInt)
1910                 if !(int8(x) > y && uint8(x) < uint8(y)) {
1911                         break
1912                 }
1913                 v.reset(Op386FlagGT_ULT)
1914                 return true
1915         }
1916         // match: (CMPBconst (MOVLconst [x]) [y])
1917         // cond: int8(x)>y && uint8(x)>uint8(y)
1918         // result: (FlagGT_UGT)
1919         for {
1920                 y := auxIntToInt8(v.AuxInt)
1921                 if v_0.Op != Op386MOVLconst {
1922                         break
1923                 }
1924                 x := auxIntToInt32(v_0.AuxInt)
1925                 if !(int8(x) > y && uint8(x) > uint8(y)) {
1926                         break
1927                 }
1928                 v.reset(Op386FlagGT_UGT)
1929                 return true
1930         }
1931         // match: (CMPBconst (ANDLconst _ [m]) [n])
1932         // cond: 0 <= int8(m) && int8(m) < n
1933         // result: (FlagLT_ULT)
1934         for {
1935                 n := auxIntToInt8(v.AuxInt)
1936                 if v_0.Op != Op386ANDLconst {
1937                         break
1938                 }
1939                 m := auxIntToInt32(v_0.AuxInt)
1940                 if !(0 <= int8(m) && int8(m) < n) {
1941                         break
1942                 }
1943                 v.reset(Op386FlagLT_ULT)
1944                 return true
1945         }
1946         // match: (CMPBconst l:(ANDL x y) [0])
1947         // cond: l.Uses==1
1948         // result: (TESTB x y)
1949         for {
1950                 if auxIntToInt8(v.AuxInt) != 0 {
1951                         break
1952                 }
1953                 l := v_0
1954                 if l.Op != Op386ANDL {
1955                         break
1956                 }
1957                 y := l.Args[1]
1958                 x := l.Args[0]
1959                 if !(l.Uses == 1) {
1960                         break
1961                 }
1962                 v.reset(Op386TESTB)
1963                 v.AddArg2(x, y)
1964                 return true
1965         }
1966         // match: (CMPBconst l:(ANDLconst [c] x) [0])
1967         // cond: l.Uses==1
1968         // result: (TESTBconst [int8(c)] x)
1969         for {
1970                 if auxIntToInt8(v.AuxInt) != 0 {
1971                         break
1972                 }
1973                 l := v_0
1974                 if l.Op != Op386ANDLconst {
1975                         break
1976                 }
1977                 c := auxIntToInt32(l.AuxInt)
1978                 x := l.Args[0]
1979                 if !(l.Uses == 1) {
1980                         break
1981                 }
1982                 v.reset(Op386TESTBconst)
1983                 v.AuxInt = int8ToAuxInt(int8(c))
1984                 v.AddArg(x)
1985                 return true
1986         }
1987         // match: (CMPBconst x [0])
1988         // result: (TESTB x x)
1989         for {
1990                 if auxIntToInt8(v.AuxInt) != 0 {
1991                         break
1992                 }
1993                 x := v_0
1994                 v.reset(Op386TESTB)
1995                 v.AddArg2(x, x)
1996                 return true
1997         }
1998         // match: (CMPBconst l:(MOVBload {sym} [off] ptr mem) [c])
1999         // cond: l.Uses == 1 && clobber(l)
2000         // result: @l.Block (CMPBconstload {sym} [makeValAndOff(int32(c),off)] ptr mem)
2001         for {
2002                 c := auxIntToInt8(v.AuxInt)
2003                 l := v_0
2004                 if l.Op != Op386MOVBload {
2005                         break
2006                 }
2007                 off := auxIntToInt32(l.AuxInt)
2008                 sym := auxToSym(l.Aux)
2009                 mem := l.Args[1]
2010                 ptr := l.Args[0]
2011                 if !(l.Uses == 1 && clobber(l)) {
2012                         break
2013                 }
2014                 b = l.Block
2015                 v0 := b.NewValue0(l.Pos, Op386CMPBconstload, types.TypeFlags)
2016                 v.copyOf(v0)
2017                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off))
2018                 v0.Aux = symToAux(sym)
2019                 v0.AddArg2(ptr, mem)
2020                 return true
2021         }
2022         return false
2023 }
2024 func rewriteValue386_Op386CMPBload(v *Value) bool {
2025         v_2 := v.Args[2]
2026         v_1 := v.Args[1]
2027         v_0 := v.Args[0]
2028         // match: (CMPBload {sym} [off] ptr (MOVLconst [c]) mem)
2029         // result: (CMPBconstload {sym} [makeValAndOff(int32(int8(c)),off)] ptr mem)
2030         for {
2031                 off := auxIntToInt32(v.AuxInt)
2032                 sym := auxToSym(v.Aux)
2033                 ptr := v_0
2034                 if v_1.Op != Op386MOVLconst {
2035                         break
2036                 }
2037                 c := auxIntToInt32(v_1.AuxInt)
2038                 mem := v_2
2039                 v.reset(Op386CMPBconstload)
2040                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int8(c)), off))
2041                 v.Aux = symToAux(sym)
2042                 v.AddArg2(ptr, mem)
2043                 return true
2044         }
2045         return false
2046 }
2047 func rewriteValue386_Op386CMPL(v *Value) bool {
2048         v_1 := v.Args[1]
2049         v_0 := v.Args[0]
2050         b := v.Block
2051         // match: (CMPL x (MOVLconst [c]))
2052         // result: (CMPLconst x [c])
2053         for {
2054                 x := v_0
2055                 if v_1.Op != Op386MOVLconst {
2056                         break
2057                 }
2058                 c := auxIntToInt32(v_1.AuxInt)
2059                 v.reset(Op386CMPLconst)
2060                 v.AuxInt = int32ToAuxInt(c)
2061                 v.AddArg(x)
2062                 return true
2063         }
2064         // match: (CMPL (MOVLconst [c]) x)
2065         // result: (InvertFlags (CMPLconst x [c]))
2066         for {
2067                 if v_0.Op != Op386MOVLconst {
2068                         break
2069                 }
2070                 c := auxIntToInt32(v_0.AuxInt)
2071                 x := v_1
2072                 v.reset(Op386InvertFlags)
2073                 v0 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
2074                 v0.AuxInt = int32ToAuxInt(c)
2075                 v0.AddArg(x)
2076                 v.AddArg(v0)
2077                 return true
2078         }
2079         // match: (CMPL x y)
2080         // cond: canonLessThan(x,y)
2081         // result: (InvertFlags (CMPL y x))
2082         for {
2083                 x := v_0
2084                 y := v_1
2085                 if !(canonLessThan(x, y)) {
2086                         break
2087                 }
2088                 v.reset(Op386InvertFlags)
2089                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
2090                 v0.AddArg2(y, x)
2091                 v.AddArg(v0)
2092                 return true
2093         }
2094         // match: (CMPL l:(MOVLload {sym} [off] ptr mem) x)
2095         // cond: canMergeLoad(v, l) && clobber(l)
2096         // result: (CMPLload {sym} [off] ptr x mem)
2097         for {
2098                 l := v_0
2099                 if l.Op != Op386MOVLload {
2100                         break
2101                 }
2102                 off := auxIntToInt32(l.AuxInt)
2103                 sym := auxToSym(l.Aux)
2104                 mem := l.Args[1]
2105                 ptr := l.Args[0]
2106                 x := v_1
2107                 if !(canMergeLoad(v, l) && clobber(l)) {
2108                         break
2109                 }
2110                 v.reset(Op386CMPLload)
2111                 v.AuxInt = int32ToAuxInt(off)
2112                 v.Aux = symToAux(sym)
2113                 v.AddArg3(ptr, x, mem)
2114                 return true
2115         }
2116         // match: (CMPL x l:(MOVLload {sym} [off] ptr mem))
2117         // cond: canMergeLoad(v, l) && clobber(l)
2118         // result: (InvertFlags (CMPLload {sym} [off] ptr x mem))
2119         for {
2120                 x := v_0
2121                 l := v_1
2122                 if l.Op != Op386MOVLload {
2123                         break
2124                 }
2125                 off := auxIntToInt32(l.AuxInt)
2126                 sym := auxToSym(l.Aux)
2127                 mem := l.Args[1]
2128                 ptr := l.Args[0]
2129                 if !(canMergeLoad(v, l) && clobber(l)) {
2130                         break
2131                 }
2132                 v.reset(Op386InvertFlags)
2133                 v0 := b.NewValue0(l.Pos, Op386CMPLload, types.TypeFlags)
2134                 v0.AuxInt = int32ToAuxInt(off)
2135                 v0.Aux = symToAux(sym)
2136                 v0.AddArg3(ptr, x, mem)
2137                 v.AddArg(v0)
2138                 return true
2139         }
2140         return false
2141 }
2142 func rewriteValue386_Op386CMPLconst(v *Value) bool {
2143         v_0 := v.Args[0]
2144         b := v.Block
2145         // match: (CMPLconst (MOVLconst [x]) [y])
2146         // cond: x==y
2147         // result: (FlagEQ)
2148         for {
2149                 y := auxIntToInt32(v.AuxInt)
2150                 if v_0.Op != Op386MOVLconst {
2151                         break
2152                 }
2153                 x := auxIntToInt32(v_0.AuxInt)
2154                 if !(x == y) {
2155                         break
2156                 }
2157                 v.reset(Op386FlagEQ)
2158                 return true
2159         }
2160         // match: (CMPLconst (MOVLconst [x]) [y])
2161         // cond: x<y && uint32(x)<uint32(y)
2162         // result: (FlagLT_ULT)
2163         for {
2164                 y := auxIntToInt32(v.AuxInt)
2165                 if v_0.Op != Op386MOVLconst {
2166                         break
2167                 }
2168                 x := auxIntToInt32(v_0.AuxInt)
2169                 if !(x < y && uint32(x) < uint32(y)) {
2170                         break
2171                 }
2172                 v.reset(Op386FlagLT_ULT)
2173                 return true
2174         }
2175         // match: (CMPLconst (MOVLconst [x]) [y])
2176         // cond: x<y && uint32(x)>uint32(y)
2177         // result: (FlagLT_UGT)
2178         for {
2179                 y := auxIntToInt32(v.AuxInt)
2180                 if v_0.Op != Op386MOVLconst {
2181                         break
2182                 }
2183                 x := auxIntToInt32(v_0.AuxInt)
2184                 if !(x < y && uint32(x) > uint32(y)) {
2185                         break
2186                 }
2187                 v.reset(Op386FlagLT_UGT)
2188                 return true
2189         }
2190         // match: (CMPLconst (MOVLconst [x]) [y])
2191         // cond: x>y && uint32(x)<uint32(y)
2192         // result: (FlagGT_ULT)
2193         for {
2194                 y := auxIntToInt32(v.AuxInt)
2195                 if v_0.Op != Op386MOVLconst {
2196                         break
2197                 }
2198                 x := auxIntToInt32(v_0.AuxInt)
2199                 if !(x > y && uint32(x) < uint32(y)) {
2200                         break
2201                 }
2202                 v.reset(Op386FlagGT_ULT)
2203                 return true
2204         }
2205         // match: (CMPLconst (MOVLconst [x]) [y])
2206         // cond: x>y && uint32(x)>uint32(y)
2207         // result: (FlagGT_UGT)
2208         for {
2209                 y := auxIntToInt32(v.AuxInt)
2210                 if v_0.Op != Op386MOVLconst {
2211                         break
2212                 }
2213                 x := auxIntToInt32(v_0.AuxInt)
2214                 if !(x > y && uint32(x) > uint32(y)) {
2215                         break
2216                 }
2217                 v.reset(Op386FlagGT_UGT)
2218                 return true
2219         }
2220         // match: (CMPLconst (SHRLconst _ [c]) [n])
2221         // cond: 0 <= n && 0 < c && c <= 32 && (1<<uint64(32-c)) <= uint64(n)
2222         // result: (FlagLT_ULT)
2223         for {
2224                 n := auxIntToInt32(v.AuxInt)
2225                 if v_0.Op != Op386SHRLconst {
2226                         break
2227                 }
2228                 c := auxIntToInt32(v_0.AuxInt)
2229                 if !(0 <= n && 0 < c && c <= 32 && (1<<uint64(32-c)) <= uint64(n)) {
2230                         break
2231                 }
2232                 v.reset(Op386FlagLT_ULT)
2233                 return true
2234         }
2235         // match: (CMPLconst (ANDLconst _ [m]) [n])
2236         // cond: 0 <= m && m < n
2237         // result: (FlagLT_ULT)
2238         for {
2239                 n := auxIntToInt32(v.AuxInt)
2240                 if v_0.Op != Op386ANDLconst {
2241                         break
2242                 }
2243                 m := auxIntToInt32(v_0.AuxInt)
2244                 if !(0 <= m && m < n) {
2245                         break
2246                 }
2247                 v.reset(Op386FlagLT_ULT)
2248                 return true
2249         }
2250         // match: (CMPLconst l:(ANDL x y) [0])
2251         // cond: l.Uses==1
2252         // result: (TESTL x y)
2253         for {
2254                 if auxIntToInt32(v.AuxInt) != 0 {
2255                         break
2256                 }
2257                 l := v_0
2258                 if l.Op != Op386ANDL {
2259                         break
2260                 }
2261                 y := l.Args[1]
2262                 x := l.Args[0]
2263                 if !(l.Uses == 1) {
2264                         break
2265                 }
2266                 v.reset(Op386TESTL)
2267                 v.AddArg2(x, y)
2268                 return true
2269         }
2270         // match: (CMPLconst l:(ANDLconst [c] x) [0])
2271         // cond: l.Uses==1
2272         // result: (TESTLconst [c] x)
2273         for {
2274                 if auxIntToInt32(v.AuxInt) != 0 {
2275                         break
2276                 }
2277                 l := v_0
2278                 if l.Op != Op386ANDLconst {
2279                         break
2280                 }
2281                 c := auxIntToInt32(l.AuxInt)
2282                 x := l.Args[0]
2283                 if !(l.Uses == 1) {
2284                         break
2285                 }
2286                 v.reset(Op386TESTLconst)
2287                 v.AuxInt = int32ToAuxInt(c)
2288                 v.AddArg(x)
2289                 return true
2290         }
2291         // match: (CMPLconst x [0])
2292         // result: (TESTL x x)
2293         for {
2294                 if auxIntToInt32(v.AuxInt) != 0 {
2295                         break
2296                 }
2297                 x := v_0
2298                 v.reset(Op386TESTL)
2299                 v.AddArg2(x, x)
2300                 return true
2301         }
2302         // match: (CMPLconst l:(MOVLload {sym} [off] ptr mem) [c])
2303         // cond: l.Uses == 1 && clobber(l)
2304         // result: @l.Block (CMPLconstload {sym} [makeValAndOff(int32(c),off)] ptr mem)
2305         for {
2306                 c := auxIntToInt32(v.AuxInt)
2307                 l := v_0
2308                 if l.Op != Op386MOVLload {
2309                         break
2310                 }
2311                 off := auxIntToInt32(l.AuxInt)
2312                 sym := auxToSym(l.Aux)
2313                 mem := l.Args[1]
2314                 ptr := l.Args[0]
2315                 if !(l.Uses == 1 && clobber(l)) {
2316                         break
2317                 }
2318                 b = l.Block
2319                 v0 := b.NewValue0(l.Pos, Op386CMPLconstload, types.TypeFlags)
2320                 v.copyOf(v0)
2321                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off))
2322                 v0.Aux = symToAux(sym)
2323                 v0.AddArg2(ptr, mem)
2324                 return true
2325         }
2326         return false
2327 }
2328 func rewriteValue386_Op386CMPLload(v *Value) bool {
2329         v_2 := v.Args[2]
2330         v_1 := v.Args[1]
2331         v_0 := v.Args[0]
2332         // match: (CMPLload {sym} [off] ptr (MOVLconst [c]) mem)
2333         // result: (CMPLconstload {sym} [makeValAndOff(c,off)] ptr mem)
2334         for {
2335                 off := auxIntToInt32(v.AuxInt)
2336                 sym := auxToSym(v.Aux)
2337                 ptr := v_0
2338                 if v_1.Op != Op386MOVLconst {
2339                         break
2340                 }
2341                 c := auxIntToInt32(v_1.AuxInt)
2342                 mem := v_2
2343                 v.reset(Op386CMPLconstload)
2344                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
2345                 v.Aux = symToAux(sym)
2346                 v.AddArg2(ptr, mem)
2347                 return true
2348         }
2349         return false
2350 }
2351 func rewriteValue386_Op386CMPW(v *Value) bool {
2352         v_1 := v.Args[1]
2353         v_0 := v.Args[0]
2354         b := v.Block
2355         // match: (CMPW x (MOVLconst [c]))
2356         // result: (CMPWconst x [int16(c)])
2357         for {
2358                 x := v_0
2359                 if v_1.Op != Op386MOVLconst {
2360                         break
2361                 }
2362                 c := auxIntToInt32(v_1.AuxInt)
2363                 v.reset(Op386CMPWconst)
2364                 v.AuxInt = int16ToAuxInt(int16(c))
2365                 v.AddArg(x)
2366                 return true
2367         }
2368         // match: (CMPW (MOVLconst [c]) x)
2369         // result: (InvertFlags (CMPWconst x [int16(c)]))
2370         for {
2371                 if v_0.Op != Op386MOVLconst {
2372                         break
2373                 }
2374                 c := auxIntToInt32(v_0.AuxInt)
2375                 x := v_1
2376                 v.reset(Op386InvertFlags)
2377                 v0 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
2378                 v0.AuxInt = int16ToAuxInt(int16(c))
2379                 v0.AddArg(x)
2380                 v.AddArg(v0)
2381                 return true
2382         }
2383         // match: (CMPW x y)
2384         // cond: canonLessThan(x,y)
2385         // result: (InvertFlags (CMPW y x))
2386         for {
2387                 x := v_0
2388                 y := v_1
2389                 if !(canonLessThan(x, y)) {
2390                         break
2391                 }
2392                 v.reset(Op386InvertFlags)
2393                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
2394                 v0.AddArg2(y, x)
2395                 v.AddArg(v0)
2396                 return true
2397         }
2398         // match: (CMPW l:(MOVWload {sym} [off] ptr mem) x)
2399         // cond: canMergeLoad(v, l) && clobber(l)
2400         // result: (CMPWload {sym} [off] ptr x mem)
2401         for {
2402                 l := v_0
2403                 if l.Op != Op386MOVWload {
2404                         break
2405                 }
2406                 off := auxIntToInt32(l.AuxInt)
2407                 sym := auxToSym(l.Aux)
2408                 mem := l.Args[1]
2409                 ptr := l.Args[0]
2410                 x := v_1
2411                 if !(canMergeLoad(v, l) && clobber(l)) {
2412                         break
2413                 }
2414                 v.reset(Op386CMPWload)
2415                 v.AuxInt = int32ToAuxInt(off)
2416                 v.Aux = symToAux(sym)
2417                 v.AddArg3(ptr, x, mem)
2418                 return true
2419         }
2420         // match: (CMPW x l:(MOVWload {sym} [off] ptr mem))
2421         // cond: canMergeLoad(v, l) && clobber(l)
2422         // result: (InvertFlags (CMPWload {sym} [off] ptr x mem))
2423         for {
2424                 x := v_0
2425                 l := v_1
2426                 if l.Op != Op386MOVWload {
2427                         break
2428                 }
2429                 off := auxIntToInt32(l.AuxInt)
2430                 sym := auxToSym(l.Aux)
2431                 mem := l.Args[1]
2432                 ptr := l.Args[0]
2433                 if !(canMergeLoad(v, l) && clobber(l)) {
2434                         break
2435                 }
2436                 v.reset(Op386InvertFlags)
2437                 v0 := b.NewValue0(l.Pos, Op386CMPWload, types.TypeFlags)
2438                 v0.AuxInt = int32ToAuxInt(off)
2439                 v0.Aux = symToAux(sym)
2440                 v0.AddArg3(ptr, x, mem)
2441                 v.AddArg(v0)
2442                 return true
2443         }
2444         return false
2445 }
2446 func rewriteValue386_Op386CMPWconst(v *Value) bool {
2447         v_0 := v.Args[0]
2448         b := v.Block
2449         // match: (CMPWconst (MOVLconst [x]) [y])
2450         // cond: int16(x)==y
2451         // result: (FlagEQ)
2452         for {
2453                 y := auxIntToInt16(v.AuxInt)
2454                 if v_0.Op != Op386MOVLconst {
2455                         break
2456                 }
2457                 x := auxIntToInt32(v_0.AuxInt)
2458                 if !(int16(x) == y) {
2459                         break
2460                 }
2461                 v.reset(Op386FlagEQ)
2462                 return true
2463         }
2464         // match: (CMPWconst (MOVLconst [x]) [y])
2465         // cond: int16(x)<y && uint16(x)<uint16(y)
2466         // result: (FlagLT_ULT)
2467         for {
2468                 y := auxIntToInt16(v.AuxInt)
2469                 if v_0.Op != Op386MOVLconst {
2470                         break
2471                 }
2472                 x := auxIntToInt32(v_0.AuxInt)
2473                 if !(int16(x) < y && uint16(x) < uint16(y)) {
2474                         break
2475                 }
2476                 v.reset(Op386FlagLT_ULT)
2477                 return true
2478         }
2479         // match: (CMPWconst (MOVLconst [x]) [y])
2480         // cond: int16(x)<y && uint16(x)>uint16(y)
2481         // result: (FlagLT_UGT)
2482         for {
2483                 y := auxIntToInt16(v.AuxInt)
2484                 if v_0.Op != Op386MOVLconst {
2485                         break
2486                 }
2487                 x := auxIntToInt32(v_0.AuxInt)
2488                 if !(int16(x) < y && uint16(x) > uint16(y)) {
2489                         break
2490                 }
2491                 v.reset(Op386FlagLT_UGT)
2492                 return true
2493         }
2494         // match: (CMPWconst (MOVLconst [x]) [y])
2495         // cond: int16(x)>y && uint16(x)<uint16(y)
2496         // result: (FlagGT_ULT)
2497         for {
2498                 y := auxIntToInt16(v.AuxInt)
2499                 if v_0.Op != Op386MOVLconst {
2500                         break
2501                 }
2502                 x := auxIntToInt32(v_0.AuxInt)
2503                 if !(int16(x) > y && uint16(x) < uint16(y)) {
2504                         break
2505                 }
2506                 v.reset(Op386FlagGT_ULT)
2507                 return true
2508         }
2509         // match: (CMPWconst (MOVLconst [x]) [y])
2510         // cond: int16(x)>y && uint16(x)>uint16(y)
2511         // result: (FlagGT_UGT)
2512         for {
2513                 y := auxIntToInt16(v.AuxInt)
2514                 if v_0.Op != Op386MOVLconst {
2515                         break
2516                 }
2517                 x := auxIntToInt32(v_0.AuxInt)
2518                 if !(int16(x) > y && uint16(x) > uint16(y)) {
2519                         break
2520                 }
2521                 v.reset(Op386FlagGT_UGT)
2522                 return true
2523         }
2524         // match: (CMPWconst (ANDLconst _ [m]) [n])
2525         // cond: 0 <= int16(m) && int16(m) < n
2526         // result: (FlagLT_ULT)
2527         for {
2528                 n := auxIntToInt16(v.AuxInt)
2529                 if v_0.Op != Op386ANDLconst {
2530                         break
2531                 }
2532                 m := auxIntToInt32(v_0.AuxInt)
2533                 if !(0 <= int16(m) && int16(m) < n) {
2534                         break
2535                 }
2536                 v.reset(Op386FlagLT_ULT)
2537                 return true
2538         }
2539         // match: (CMPWconst l:(ANDL x y) [0])
2540         // cond: l.Uses==1
2541         // result: (TESTW x y)
2542         for {
2543                 if auxIntToInt16(v.AuxInt) != 0 {
2544                         break
2545                 }
2546                 l := v_0
2547                 if l.Op != Op386ANDL {
2548                         break
2549                 }
2550                 y := l.Args[1]
2551                 x := l.Args[0]
2552                 if !(l.Uses == 1) {
2553                         break
2554                 }
2555                 v.reset(Op386TESTW)
2556                 v.AddArg2(x, y)
2557                 return true
2558         }
2559         // match: (CMPWconst l:(ANDLconst [c] x) [0])
2560         // cond: l.Uses==1
2561         // result: (TESTWconst [int16(c)] x)
2562         for {
2563                 if auxIntToInt16(v.AuxInt) != 0 {
2564                         break
2565                 }
2566                 l := v_0
2567                 if l.Op != Op386ANDLconst {
2568                         break
2569                 }
2570                 c := auxIntToInt32(l.AuxInt)
2571                 x := l.Args[0]
2572                 if !(l.Uses == 1) {
2573                         break
2574                 }
2575                 v.reset(Op386TESTWconst)
2576                 v.AuxInt = int16ToAuxInt(int16(c))
2577                 v.AddArg(x)
2578                 return true
2579         }
2580         // match: (CMPWconst x [0])
2581         // result: (TESTW x x)
2582         for {
2583                 if auxIntToInt16(v.AuxInt) != 0 {
2584                         break
2585                 }
2586                 x := v_0
2587                 v.reset(Op386TESTW)
2588                 v.AddArg2(x, x)
2589                 return true
2590         }
2591         // match: (CMPWconst l:(MOVWload {sym} [off] ptr mem) [c])
2592         // cond: l.Uses == 1 && clobber(l)
2593         // result: @l.Block (CMPWconstload {sym} [makeValAndOff(int32(c),off)] ptr mem)
2594         for {
2595                 c := auxIntToInt16(v.AuxInt)
2596                 l := v_0
2597                 if l.Op != Op386MOVWload {
2598                         break
2599                 }
2600                 off := auxIntToInt32(l.AuxInt)
2601                 sym := auxToSym(l.Aux)
2602                 mem := l.Args[1]
2603                 ptr := l.Args[0]
2604                 if !(l.Uses == 1 && clobber(l)) {
2605                         break
2606                 }
2607                 b = l.Block
2608                 v0 := b.NewValue0(l.Pos, Op386CMPWconstload, types.TypeFlags)
2609                 v.copyOf(v0)
2610                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off))
2611                 v0.Aux = symToAux(sym)
2612                 v0.AddArg2(ptr, mem)
2613                 return true
2614         }
2615         return false
2616 }
2617 func rewriteValue386_Op386CMPWload(v *Value) bool {
2618         v_2 := v.Args[2]
2619         v_1 := v.Args[1]
2620         v_0 := v.Args[0]
2621         // match: (CMPWload {sym} [off] ptr (MOVLconst [c]) mem)
2622         // result: (CMPWconstload {sym} [makeValAndOff(int32(int16(c)),off)] ptr mem)
2623         for {
2624                 off := auxIntToInt32(v.AuxInt)
2625                 sym := auxToSym(v.Aux)
2626                 ptr := v_0
2627                 if v_1.Op != Op386MOVLconst {
2628                         break
2629                 }
2630                 c := auxIntToInt32(v_1.AuxInt)
2631                 mem := v_2
2632                 v.reset(Op386CMPWconstload)
2633                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int16(c)), off))
2634                 v.Aux = symToAux(sym)
2635                 v.AddArg2(ptr, mem)
2636                 return true
2637         }
2638         return false
2639 }
2640 func rewriteValue386_Op386DIVSD(v *Value) bool {
2641         v_1 := v.Args[1]
2642         v_0 := v.Args[0]
2643         // match: (DIVSD x l:(MOVSDload [off] {sym} ptr mem))
2644         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
2645         // result: (DIVSDload x [off] {sym} ptr mem)
2646         for {
2647                 x := v_0
2648                 l := v_1
2649                 if l.Op != Op386MOVSDload {
2650                         break
2651                 }
2652                 off := auxIntToInt32(l.AuxInt)
2653                 sym := auxToSym(l.Aux)
2654                 mem := l.Args[1]
2655                 ptr := l.Args[0]
2656                 if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
2657                         break
2658                 }
2659                 v.reset(Op386DIVSDload)
2660                 v.AuxInt = int32ToAuxInt(off)
2661                 v.Aux = symToAux(sym)
2662                 v.AddArg3(x, ptr, mem)
2663                 return true
2664         }
2665         return false
2666 }
2667 func rewriteValue386_Op386DIVSDload(v *Value) bool {
2668         v_2 := v.Args[2]
2669         v_1 := v.Args[1]
2670         v_0 := v.Args[0]
2671         b := v.Block
2672         config := b.Func.Config
2673         // match: (DIVSDload [off1] {sym} val (ADDLconst [off2] base) mem)
2674         // cond: is32Bit(int64(off1)+int64(off2))
2675         // result: (DIVSDload [off1+off2] {sym} val base mem)
2676         for {
2677                 off1 := auxIntToInt32(v.AuxInt)
2678                 sym := auxToSym(v.Aux)
2679                 val := v_0
2680                 if v_1.Op != Op386ADDLconst {
2681                         break
2682                 }
2683                 off2 := auxIntToInt32(v_1.AuxInt)
2684                 base := v_1.Args[0]
2685                 mem := v_2
2686                 if !(is32Bit(int64(off1) + int64(off2))) {
2687                         break
2688                 }
2689                 v.reset(Op386DIVSDload)
2690                 v.AuxInt = int32ToAuxInt(off1 + off2)
2691                 v.Aux = symToAux(sym)
2692                 v.AddArg3(val, base, mem)
2693                 return true
2694         }
2695         // match: (DIVSDload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
2696         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
2697         // result: (DIVSDload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
2698         for {
2699                 off1 := auxIntToInt32(v.AuxInt)
2700                 sym1 := auxToSym(v.Aux)
2701                 val := v_0
2702                 if v_1.Op != Op386LEAL {
2703                         break
2704                 }
2705                 off2 := auxIntToInt32(v_1.AuxInt)
2706                 sym2 := auxToSym(v_1.Aux)
2707                 base := v_1.Args[0]
2708                 mem := v_2
2709                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
2710                         break
2711                 }
2712                 v.reset(Op386DIVSDload)
2713                 v.AuxInt = int32ToAuxInt(off1 + off2)
2714                 v.Aux = symToAux(mergeSym(sym1, sym2))
2715                 v.AddArg3(val, base, mem)
2716                 return true
2717         }
2718         return false
2719 }
2720 func rewriteValue386_Op386DIVSS(v *Value) bool {
2721         v_1 := v.Args[1]
2722         v_0 := v.Args[0]
2723         // match: (DIVSS x l:(MOVSSload [off] {sym} ptr mem))
2724         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
2725         // result: (DIVSSload x [off] {sym} ptr mem)
2726         for {
2727                 x := v_0
2728                 l := v_1
2729                 if l.Op != Op386MOVSSload {
2730                         break
2731                 }
2732                 off := auxIntToInt32(l.AuxInt)
2733                 sym := auxToSym(l.Aux)
2734                 mem := l.Args[1]
2735                 ptr := l.Args[0]
2736                 if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
2737                         break
2738                 }
2739                 v.reset(Op386DIVSSload)
2740                 v.AuxInt = int32ToAuxInt(off)
2741                 v.Aux = symToAux(sym)
2742                 v.AddArg3(x, ptr, mem)
2743                 return true
2744         }
2745         return false
2746 }
2747 func rewriteValue386_Op386DIVSSload(v *Value) bool {
2748         v_2 := v.Args[2]
2749         v_1 := v.Args[1]
2750         v_0 := v.Args[0]
2751         b := v.Block
2752         config := b.Func.Config
2753         // match: (DIVSSload [off1] {sym} val (ADDLconst [off2] base) mem)
2754         // cond: is32Bit(int64(off1)+int64(off2))
2755         // result: (DIVSSload [off1+off2] {sym} val base mem)
2756         for {
2757                 off1 := auxIntToInt32(v.AuxInt)
2758                 sym := auxToSym(v.Aux)
2759                 val := v_0
2760                 if v_1.Op != Op386ADDLconst {
2761                         break
2762                 }
2763                 off2 := auxIntToInt32(v_1.AuxInt)
2764                 base := v_1.Args[0]
2765                 mem := v_2
2766                 if !(is32Bit(int64(off1) + int64(off2))) {
2767                         break
2768                 }
2769                 v.reset(Op386DIVSSload)
2770                 v.AuxInt = int32ToAuxInt(off1 + off2)
2771                 v.Aux = symToAux(sym)
2772                 v.AddArg3(val, base, mem)
2773                 return true
2774         }
2775         // match: (DIVSSload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
2776         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
2777         // result: (DIVSSload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
2778         for {
2779                 off1 := auxIntToInt32(v.AuxInt)
2780                 sym1 := auxToSym(v.Aux)
2781                 val := v_0
2782                 if v_1.Op != Op386LEAL {
2783                         break
2784                 }
2785                 off2 := auxIntToInt32(v_1.AuxInt)
2786                 sym2 := auxToSym(v_1.Aux)
2787                 base := v_1.Args[0]
2788                 mem := v_2
2789                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
2790                         break
2791                 }
2792                 v.reset(Op386DIVSSload)
2793                 v.AuxInt = int32ToAuxInt(off1 + off2)
2794                 v.Aux = symToAux(mergeSym(sym1, sym2))
2795                 v.AddArg3(val, base, mem)
2796                 return true
2797         }
2798         return false
2799 }
2800 func rewriteValue386_Op386LEAL(v *Value) bool {
2801         v_0 := v.Args[0]
2802         // match: (LEAL [c] {s} (ADDLconst [d] x))
2803         // cond: is32Bit(int64(c)+int64(d))
2804         // result: (LEAL [c+d] {s} x)
2805         for {
2806                 c := auxIntToInt32(v.AuxInt)
2807                 s := auxToSym(v.Aux)
2808                 if v_0.Op != Op386ADDLconst {
2809                         break
2810                 }
2811                 d := auxIntToInt32(v_0.AuxInt)
2812                 x := v_0.Args[0]
2813                 if !(is32Bit(int64(c) + int64(d))) {
2814                         break
2815                 }
2816                 v.reset(Op386LEAL)
2817                 v.AuxInt = int32ToAuxInt(c + d)
2818                 v.Aux = symToAux(s)
2819                 v.AddArg(x)
2820                 return true
2821         }
2822         // match: (LEAL [c] {s} (ADDL x y))
2823         // cond: x.Op != OpSB && y.Op != OpSB
2824         // result: (LEAL1 [c] {s} x y)
2825         for {
2826                 c := auxIntToInt32(v.AuxInt)
2827                 s := auxToSym(v.Aux)
2828                 if v_0.Op != Op386ADDL {
2829                         break
2830                 }
2831                 _ = v_0.Args[1]
2832                 v_0_0 := v_0.Args[0]
2833                 v_0_1 := v_0.Args[1]
2834                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
2835                         x := v_0_0
2836                         y := v_0_1
2837                         if !(x.Op != OpSB && y.Op != OpSB) {
2838                                 continue
2839                         }
2840                         v.reset(Op386LEAL1)
2841                         v.AuxInt = int32ToAuxInt(c)
2842                         v.Aux = symToAux(s)
2843                         v.AddArg2(x, y)
2844                         return true
2845                 }
2846                 break
2847         }
2848         // match: (LEAL [off1] {sym1} (LEAL [off2] {sym2} x))
2849         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
2850         // result: (LEAL [off1+off2] {mergeSym(sym1,sym2)} x)
2851         for {
2852                 off1 := auxIntToInt32(v.AuxInt)
2853                 sym1 := auxToSym(v.Aux)
2854                 if v_0.Op != Op386LEAL {
2855                         break
2856                 }
2857                 off2 := auxIntToInt32(v_0.AuxInt)
2858                 sym2 := auxToSym(v_0.Aux)
2859                 x := v_0.Args[0]
2860                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
2861                         break
2862                 }
2863                 v.reset(Op386LEAL)
2864                 v.AuxInt = int32ToAuxInt(off1 + off2)
2865                 v.Aux = symToAux(mergeSym(sym1, sym2))
2866                 v.AddArg(x)
2867                 return true
2868         }
2869         // match: (LEAL [off1] {sym1} (LEAL1 [off2] {sym2} x y))
2870         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
2871         // result: (LEAL1 [off1+off2] {mergeSym(sym1,sym2)} x y)
2872         for {
2873                 off1 := auxIntToInt32(v.AuxInt)
2874                 sym1 := auxToSym(v.Aux)
2875                 if v_0.Op != Op386LEAL1 {
2876                         break
2877                 }
2878                 off2 := auxIntToInt32(v_0.AuxInt)
2879                 sym2 := auxToSym(v_0.Aux)
2880                 y := v_0.Args[1]
2881                 x := v_0.Args[0]
2882                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
2883                         break
2884                 }
2885                 v.reset(Op386LEAL1)
2886                 v.AuxInt = int32ToAuxInt(off1 + off2)
2887                 v.Aux = symToAux(mergeSym(sym1, sym2))
2888                 v.AddArg2(x, y)
2889                 return true
2890         }
2891         // match: (LEAL [off1] {sym1} (LEAL2 [off2] {sym2} x y))
2892         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
2893         // result: (LEAL2 [off1+off2] {mergeSym(sym1,sym2)} x y)
2894         for {
2895                 off1 := auxIntToInt32(v.AuxInt)
2896                 sym1 := auxToSym(v.Aux)
2897                 if v_0.Op != Op386LEAL2 {
2898                         break
2899                 }
2900                 off2 := auxIntToInt32(v_0.AuxInt)
2901                 sym2 := auxToSym(v_0.Aux)
2902                 y := v_0.Args[1]
2903                 x := v_0.Args[0]
2904                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
2905                         break
2906                 }
2907                 v.reset(Op386LEAL2)
2908                 v.AuxInt = int32ToAuxInt(off1 + off2)
2909                 v.Aux = symToAux(mergeSym(sym1, sym2))
2910                 v.AddArg2(x, y)
2911                 return true
2912         }
2913         // match: (LEAL [off1] {sym1} (LEAL4 [off2] {sym2} x y))
2914         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
2915         // result: (LEAL4 [off1+off2] {mergeSym(sym1,sym2)} x y)
2916         for {
2917                 off1 := auxIntToInt32(v.AuxInt)
2918                 sym1 := auxToSym(v.Aux)
2919                 if v_0.Op != Op386LEAL4 {
2920                         break
2921                 }
2922                 off2 := auxIntToInt32(v_0.AuxInt)
2923                 sym2 := auxToSym(v_0.Aux)
2924                 y := v_0.Args[1]
2925                 x := v_0.Args[0]
2926                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
2927                         break
2928                 }
2929                 v.reset(Op386LEAL4)
2930                 v.AuxInt = int32ToAuxInt(off1 + off2)
2931                 v.Aux = symToAux(mergeSym(sym1, sym2))
2932                 v.AddArg2(x, y)
2933                 return true
2934         }
2935         // match: (LEAL [off1] {sym1} (LEAL8 [off2] {sym2} x y))
2936         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
2937         // result: (LEAL8 [off1+off2] {mergeSym(sym1,sym2)} x y)
2938         for {
2939                 off1 := auxIntToInt32(v.AuxInt)
2940                 sym1 := auxToSym(v.Aux)
2941                 if v_0.Op != Op386LEAL8 {
2942                         break
2943                 }
2944                 off2 := auxIntToInt32(v_0.AuxInt)
2945                 sym2 := auxToSym(v_0.Aux)
2946                 y := v_0.Args[1]
2947                 x := v_0.Args[0]
2948                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
2949                         break
2950                 }
2951                 v.reset(Op386LEAL8)
2952                 v.AuxInt = int32ToAuxInt(off1 + off2)
2953                 v.Aux = symToAux(mergeSym(sym1, sym2))
2954                 v.AddArg2(x, y)
2955                 return true
2956         }
2957         return false
2958 }
2959 func rewriteValue386_Op386LEAL1(v *Value) bool {
2960         v_1 := v.Args[1]
2961         v_0 := v.Args[0]
2962         // match: (LEAL1 [c] {s} (ADDLconst [d] x) y)
2963         // cond: is32Bit(int64(c)+int64(d)) && x.Op != OpSB
2964         // result: (LEAL1 [c+d] {s} x y)
2965         for {
2966                 c := auxIntToInt32(v.AuxInt)
2967                 s := auxToSym(v.Aux)
2968                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
2969                         if v_0.Op != Op386ADDLconst {
2970                                 continue
2971                         }
2972                         d := auxIntToInt32(v_0.AuxInt)
2973                         x := v_0.Args[0]
2974                         y := v_1
2975                         if !(is32Bit(int64(c)+int64(d)) && x.Op != OpSB) {
2976                                 continue
2977                         }
2978                         v.reset(Op386LEAL1)
2979                         v.AuxInt = int32ToAuxInt(c + d)
2980                         v.Aux = symToAux(s)
2981                         v.AddArg2(x, y)
2982                         return true
2983                 }
2984                 break
2985         }
2986         // match: (LEAL1 [c] {s} x (SHLLconst [1] y))
2987         // result: (LEAL2 [c] {s} x y)
2988         for {
2989                 c := auxIntToInt32(v.AuxInt)
2990                 s := auxToSym(v.Aux)
2991                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
2992                         x := v_0
2993                         if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 1 {
2994                                 continue
2995                         }
2996                         y := v_1.Args[0]
2997                         v.reset(Op386LEAL2)
2998                         v.AuxInt = int32ToAuxInt(c)
2999                         v.Aux = symToAux(s)
3000                         v.AddArg2(x, y)
3001                         return true
3002                 }
3003                 break
3004         }
3005         // match: (LEAL1 [c] {s} x (SHLLconst [2] y))
3006         // result: (LEAL4 [c] {s} x y)
3007         for {
3008                 c := auxIntToInt32(v.AuxInt)
3009                 s := auxToSym(v.Aux)
3010                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3011                         x := v_0
3012                         if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 2 {
3013                                 continue
3014                         }
3015                         y := v_1.Args[0]
3016                         v.reset(Op386LEAL4)
3017                         v.AuxInt = int32ToAuxInt(c)
3018                         v.Aux = symToAux(s)
3019                         v.AddArg2(x, y)
3020                         return true
3021                 }
3022                 break
3023         }
3024         // match: (LEAL1 [c] {s} x (SHLLconst [3] y))
3025         // result: (LEAL8 [c] {s} x y)
3026         for {
3027                 c := auxIntToInt32(v.AuxInt)
3028                 s := auxToSym(v.Aux)
3029                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3030                         x := v_0
3031                         if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 3 {
3032                                 continue
3033                         }
3034                         y := v_1.Args[0]
3035                         v.reset(Op386LEAL8)
3036                         v.AuxInt = int32ToAuxInt(c)
3037                         v.Aux = symToAux(s)
3038                         v.AddArg2(x, y)
3039                         return true
3040                 }
3041                 break
3042         }
3043         // match: (LEAL1 [off1] {sym1} (LEAL [off2] {sym2} x) y)
3044         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB
3045         // result: (LEAL1 [off1+off2] {mergeSym(sym1,sym2)} x y)
3046         for {
3047                 off1 := auxIntToInt32(v.AuxInt)
3048                 sym1 := auxToSym(v.Aux)
3049                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3050                         if v_0.Op != Op386LEAL {
3051                                 continue
3052                         }
3053                         off2 := auxIntToInt32(v_0.AuxInt)
3054                         sym2 := auxToSym(v_0.Aux)
3055                         x := v_0.Args[0]
3056                         y := v_1
3057                         if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
3058                                 continue
3059                         }
3060                         v.reset(Op386LEAL1)
3061                         v.AuxInt = int32ToAuxInt(off1 + off2)
3062                         v.Aux = symToAux(mergeSym(sym1, sym2))
3063                         v.AddArg2(x, y)
3064                         return true
3065                 }
3066                 break
3067         }
3068         // match: (LEAL1 [off1] {sym1} x (LEAL1 [off2] {sym2} y y))
3069         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
3070         // result: (LEAL2 [off1+off2] {mergeSym(sym1, sym2)} x y)
3071         for {
3072                 off1 := auxIntToInt32(v.AuxInt)
3073                 sym1 := auxToSym(v.Aux)
3074                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3075                         x := v_0
3076                         if v_1.Op != Op386LEAL1 {
3077                                 continue
3078                         }
3079                         off2 := auxIntToInt32(v_1.AuxInt)
3080                         sym2 := auxToSym(v_1.Aux)
3081                         y := v_1.Args[1]
3082                         if y != v_1.Args[0] || !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
3083                                 continue
3084                         }
3085                         v.reset(Op386LEAL2)
3086                         v.AuxInt = int32ToAuxInt(off1 + off2)
3087                         v.Aux = symToAux(mergeSym(sym1, sym2))
3088                         v.AddArg2(x, y)
3089                         return true
3090                 }
3091                 break
3092         }
3093         // match: (LEAL1 [off1] {sym1} x (LEAL1 [off2] {sym2} x y))
3094         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
3095         // result: (LEAL2 [off1+off2] {mergeSym(sym1, sym2)} y x)
3096         for {
3097                 off1 := auxIntToInt32(v.AuxInt)
3098                 sym1 := auxToSym(v.Aux)
3099                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3100                         x := v_0
3101                         if v_1.Op != Op386LEAL1 {
3102                                 continue
3103                         }
3104                         off2 := auxIntToInt32(v_1.AuxInt)
3105                         sym2 := auxToSym(v_1.Aux)
3106                         _ = v_1.Args[1]
3107                         v_1_0 := v_1.Args[0]
3108                         v_1_1 := v_1.Args[1]
3109                         for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 {
3110                                 if x != v_1_0 {
3111                                         continue
3112                                 }
3113                                 y := v_1_1
3114                                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
3115                                         continue
3116                                 }
3117                                 v.reset(Op386LEAL2)
3118                                 v.AuxInt = int32ToAuxInt(off1 + off2)
3119                                 v.Aux = symToAux(mergeSym(sym1, sym2))
3120                                 v.AddArg2(y, x)
3121                                 return true
3122                         }
3123                 }
3124                 break
3125         }
3126         // match: (LEAL1 [0] {nil} x y)
3127         // result: (ADDL x y)
3128         for {
3129                 if auxIntToInt32(v.AuxInt) != 0 || auxToSym(v.Aux) != nil {
3130                         break
3131                 }
3132                 x := v_0
3133                 y := v_1
3134                 v.reset(Op386ADDL)
3135                 v.AddArg2(x, y)
3136                 return true
3137         }
3138         return false
3139 }
3140 func rewriteValue386_Op386LEAL2(v *Value) bool {
3141         v_1 := v.Args[1]
3142         v_0 := v.Args[0]
3143         // match: (LEAL2 [c] {s} (ADDLconst [d] x) y)
3144         // cond: is32Bit(int64(c)+int64(d)) && x.Op != OpSB
3145         // result: (LEAL2 [c+d] {s} x y)
3146         for {
3147                 c := auxIntToInt32(v.AuxInt)
3148                 s := auxToSym(v.Aux)
3149                 if v_0.Op != Op386ADDLconst {
3150                         break
3151                 }
3152                 d := auxIntToInt32(v_0.AuxInt)
3153                 x := v_0.Args[0]
3154                 y := v_1
3155                 if !(is32Bit(int64(c)+int64(d)) && x.Op != OpSB) {
3156                         break
3157                 }
3158                 v.reset(Op386LEAL2)
3159                 v.AuxInt = int32ToAuxInt(c + d)
3160                 v.Aux = symToAux(s)
3161                 v.AddArg2(x, y)
3162                 return true
3163         }
3164         // match: (LEAL2 [c] {s} x (ADDLconst [d] y))
3165         // cond: is32Bit(int64(c)+2*int64(d)) && y.Op != OpSB
3166         // result: (LEAL2 [c+2*d] {s} x y)
3167         for {
3168                 c := auxIntToInt32(v.AuxInt)
3169                 s := auxToSym(v.Aux)
3170                 x := v_0
3171                 if v_1.Op != Op386ADDLconst {
3172                         break
3173                 }
3174                 d := auxIntToInt32(v_1.AuxInt)
3175                 y := v_1.Args[0]
3176                 if !(is32Bit(int64(c)+2*int64(d)) && y.Op != OpSB) {
3177                         break
3178                 }
3179                 v.reset(Op386LEAL2)
3180                 v.AuxInt = int32ToAuxInt(c + 2*d)
3181                 v.Aux = symToAux(s)
3182                 v.AddArg2(x, y)
3183                 return true
3184         }
3185         // match: (LEAL2 [c] {s} x (SHLLconst [1] y))
3186         // result: (LEAL4 [c] {s} x y)
3187         for {
3188                 c := auxIntToInt32(v.AuxInt)
3189                 s := auxToSym(v.Aux)
3190                 x := v_0
3191                 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 1 {
3192                         break
3193                 }
3194                 y := v_1.Args[0]
3195                 v.reset(Op386LEAL4)
3196                 v.AuxInt = int32ToAuxInt(c)
3197                 v.Aux = symToAux(s)
3198                 v.AddArg2(x, y)
3199                 return true
3200         }
3201         // match: (LEAL2 [c] {s} x (SHLLconst [2] y))
3202         // result: (LEAL8 [c] {s} x y)
3203         for {
3204                 c := auxIntToInt32(v.AuxInt)
3205                 s := auxToSym(v.Aux)
3206                 x := v_0
3207                 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 2 {
3208                         break
3209                 }
3210                 y := v_1.Args[0]
3211                 v.reset(Op386LEAL8)
3212                 v.AuxInt = int32ToAuxInt(c)
3213                 v.Aux = symToAux(s)
3214                 v.AddArg2(x, y)
3215                 return true
3216         }
3217         // match: (LEAL2 [off1] {sym1} (LEAL [off2] {sym2} x) y)
3218         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB
3219         // result: (LEAL2 [off1+off2] {mergeSym(sym1,sym2)} x y)
3220         for {
3221                 off1 := auxIntToInt32(v.AuxInt)
3222                 sym1 := auxToSym(v.Aux)
3223                 if v_0.Op != Op386LEAL {
3224                         break
3225                 }
3226                 off2 := auxIntToInt32(v_0.AuxInt)
3227                 sym2 := auxToSym(v_0.Aux)
3228                 x := v_0.Args[0]
3229                 y := v_1
3230                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
3231                         break
3232                 }
3233                 v.reset(Op386LEAL2)
3234                 v.AuxInt = int32ToAuxInt(off1 + off2)
3235                 v.Aux = symToAux(mergeSym(sym1, sym2))
3236                 v.AddArg2(x, y)
3237                 return true
3238         }
3239         // match: (LEAL2 [off1] {sym} x (LEAL1 [off2] {nil} y y))
3240         // cond: is32Bit(int64(off1)+2*int64(off2))
3241         // result: (LEAL4 [off1+2*off2] {sym} x y)
3242         for {
3243                 off1 := auxIntToInt32(v.AuxInt)
3244                 sym := auxToSym(v.Aux)
3245                 x := v_0
3246                 if v_1.Op != Op386LEAL1 {
3247                         break
3248                 }
3249                 off2 := auxIntToInt32(v_1.AuxInt)
3250                 if auxToSym(v_1.Aux) != nil {
3251                         break
3252                 }
3253                 y := v_1.Args[1]
3254                 if y != v_1.Args[0] || !(is32Bit(int64(off1) + 2*int64(off2))) {
3255                         break
3256                 }
3257                 v.reset(Op386LEAL4)
3258                 v.AuxInt = int32ToAuxInt(off1 + 2*off2)
3259                 v.Aux = symToAux(sym)
3260                 v.AddArg2(x, y)
3261                 return true
3262         }
3263         return false
3264 }
3265 func rewriteValue386_Op386LEAL4(v *Value) bool {
3266         v_1 := v.Args[1]
3267         v_0 := v.Args[0]
3268         // match: (LEAL4 [c] {s} (ADDLconst [d] x) y)
3269         // cond: is32Bit(int64(c)+int64(d)) && x.Op != OpSB
3270         // result: (LEAL4 [c+d] {s} x y)
3271         for {
3272                 c := auxIntToInt32(v.AuxInt)
3273                 s := auxToSym(v.Aux)
3274                 if v_0.Op != Op386ADDLconst {
3275                         break
3276                 }
3277                 d := auxIntToInt32(v_0.AuxInt)
3278                 x := v_0.Args[0]
3279                 y := v_1
3280                 if !(is32Bit(int64(c)+int64(d)) && x.Op != OpSB) {
3281                         break
3282                 }
3283                 v.reset(Op386LEAL4)
3284                 v.AuxInt = int32ToAuxInt(c + d)
3285                 v.Aux = symToAux(s)
3286                 v.AddArg2(x, y)
3287                 return true
3288         }
3289         // match: (LEAL4 [c] {s} x (ADDLconst [d] y))
3290         // cond: is32Bit(int64(c)+4*int64(d)) && y.Op != OpSB
3291         // result: (LEAL4 [c+4*d] {s} x y)
3292         for {
3293                 c := auxIntToInt32(v.AuxInt)
3294                 s := auxToSym(v.Aux)
3295                 x := v_0
3296                 if v_1.Op != Op386ADDLconst {
3297                         break
3298                 }
3299                 d := auxIntToInt32(v_1.AuxInt)
3300                 y := v_1.Args[0]
3301                 if !(is32Bit(int64(c)+4*int64(d)) && y.Op != OpSB) {
3302                         break
3303                 }
3304                 v.reset(Op386LEAL4)
3305                 v.AuxInt = int32ToAuxInt(c + 4*d)
3306                 v.Aux = symToAux(s)
3307                 v.AddArg2(x, y)
3308                 return true
3309         }
3310         // match: (LEAL4 [c] {s} x (SHLLconst [1] y))
3311         // result: (LEAL8 [c] {s} x y)
3312         for {
3313                 c := auxIntToInt32(v.AuxInt)
3314                 s := auxToSym(v.Aux)
3315                 x := v_0
3316                 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 1 {
3317                         break
3318                 }
3319                 y := v_1.Args[0]
3320                 v.reset(Op386LEAL8)
3321                 v.AuxInt = int32ToAuxInt(c)
3322                 v.Aux = symToAux(s)
3323                 v.AddArg2(x, y)
3324                 return true
3325         }
3326         // match: (LEAL4 [off1] {sym1} (LEAL [off2] {sym2} x) y)
3327         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB
3328         // result: (LEAL4 [off1+off2] {mergeSym(sym1,sym2)} x y)
3329         for {
3330                 off1 := auxIntToInt32(v.AuxInt)
3331                 sym1 := auxToSym(v.Aux)
3332                 if v_0.Op != Op386LEAL {
3333                         break
3334                 }
3335                 off2 := auxIntToInt32(v_0.AuxInt)
3336                 sym2 := auxToSym(v_0.Aux)
3337                 x := v_0.Args[0]
3338                 y := v_1
3339                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
3340                         break
3341                 }
3342                 v.reset(Op386LEAL4)
3343                 v.AuxInt = int32ToAuxInt(off1 + off2)
3344                 v.Aux = symToAux(mergeSym(sym1, sym2))
3345                 v.AddArg2(x, y)
3346                 return true
3347         }
3348         // match: (LEAL4 [off1] {sym} x (LEAL1 [off2] {nil} y y))
3349         // cond: is32Bit(int64(off1)+4*int64(off2))
3350         // result: (LEAL8 [off1+4*off2] {sym} x y)
3351         for {
3352                 off1 := auxIntToInt32(v.AuxInt)
3353                 sym := auxToSym(v.Aux)
3354                 x := v_0
3355                 if v_1.Op != Op386LEAL1 {
3356                         break
3357                 }
3358                 off2 := auxIntToInt32(v_1.AuxInt)
3359                 if auxToSym(v_1.Aux) != nil {
3360                         break
3361                 }
3362                 y := v_1.Args[1]
3363                 if y != v_1.Args[0] || !(is32Bit(int64(off1) + 4*int64(off2))) {
3364                         break
3365                 }
3366                 v.reset(Op386LEAL8)
3367                 v.AuxInt = int32ToAuxInt(off1 + 4*off2)
3368                 v.Aux = symToAux(sym)
3369                 v.AddArg2(x, y)
3370                 return true
3371         }
3372         return false
3373 }
3374 func rewriteValue386_Op386LEAL8(v *Value) bool {
3375         v_1 := v.Args[1]
3376         v_0 := v.Args[0]
3377         // match: (LEAL8 [c] {s} (ADDLconst [d] x) y)
3378         // cond: is32Bit(int64(c)+int64(d)) && x.Op != OpSB
3379         // result: (LEAL8 [c+d] {s} x y)
3380         for {
3381                 c := auxIntToInt32(v.AuxInt)
3382                 s := auxToSym(v.Aux)
3383                 if v_0.Op != Op386ADDLconst {
3384                         break
3385                 }
3386                 d := auxIntToInt32(v_0.AuxInt)
3387                 x := v_0.Args[0]
3388                 y := v_1
3389                 if !(is32Bit(int64(c)+int64(d)) && x.Op != OpSB) {
3390                         break
3391                 }
3392                 v.reset(Op386LEAL8)
3393                 v.AuxInt = int32ToAuxInt(c + d)
3394                 v.Aux = symToAux(s)
3395                 v.AddArg2(x, y)
3396                 return true
3397         }
3398         // match: (LEAL8 [c] {s} x (ADDLconst [d] y))
3399         // cond: is32Bit(int64(c)+8*int64(d)) && y.Op != OpSB
3400         // result: (LEAL8 [c+8*d] {s} x y)
3401         for {
3402                 c := auxIntToInt32(v.AuxInt)
3403                 s := auxToSym(v.Aux)
3404                 x := v_0
3405                 if v_1.Op != Op386ADDLconst {
3406                         break
3407                 }
3408                 d := auxIntToInt32(v_1.AuxInt)
3409                 y := v_1.Args[0]
3410                 if !(is32Bit(int64(c)+8*int64(d)) && y.Op != OpSB) {
3411                         break
3412                 }
3413                 v.reset(Op386LEAL8)
3414                 v.AuxInt = int32ToAuxInt(c + 8*d)
3415                 v.Aux = symToAux(s)
3416                 v.AddArg2(x, y)
3417                 return true
3418         }
3419         // match: (LEAL8 [off1] {sym1} (LEAL [off2] {sym2} x) y)
3420         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB
3421         // result: (LEAL8 [off1+off2] {mergeSym(sym1,sym2)} x y)
3422         for {
3423                 off1 := auxIntToInt32(v.AuxInt)
3424                 sym1 := auxToSym(v.Aux)
3425                 if v_0.Op != Op386LEAL {
3426                         break
3427                 }
3428                 off2 := auxIntToInt32(v_0.AuxInt)
3429                 sym2 := auxToSym(v_0.Aux)
3430                 x := v_0.Args[0]
3431                 y := v_1
3432                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
3433                         break
3434                 }
3435                 v.reset(Op386LEAL8)
3436                 v.AuxInt = int32ToAuxInt(off1 + off2)
3437                 v.Aux = symToAux(mergeSym(sym1, sym2))
3438                 v.AddArg2(x, y)
3439                 return true
3440         }
3441         return false
3442 }
3443 func rewriteValue386_Op386MOVBLSX(v *Value) bool {
3444         v_0 := v.Args[0]
3445         b := v.Block
3446         // match: (MOVBLSX x:(MOVBload [off] {sym} ptr mem))
3447         // cond: x.Uses == 1 && clobber(x)
3448         // result: @x.Block (MOVBLSXload <v.Type> [off] {sym} ptr mem)
3449         for {
3450                 x := v_0
3451                 if x.Op != Op386MOVBload {
3452                         break
3453                 }
3454                 off := auxIntToInt32(x.AuxInt)
3455                 sym := auxToSym(x.Aux)
3456                 mem := x.Args[1]
3457                 ptr := x.Args[0]
3458                 if !(x.Uses == 1 && clobber(x)) {
3459                         break
3460                 }
3461                 b = x.Block
3462                 v0 := b.NewValue0(x.Pos, Op386MOVBLSXload, v.Type)
3463                 v.copyOf(v0)
3464                 v0.AuxInt = int32ToAuxInt(off)
3465                 v0.Aux = symToAux(sym)
3466                 v0.AddArg2(ptr, mem)
3467                 return true
3468         }
3469         // match: (MOVBLSX (ANDLconst [c] x))
3470         // cond: c & 0x80 == 0
3471         // result: (ANDLconst [c & 0x7f] x)
3472         for {
3473                 if v_0.Op != Op386ANDLconst {
3474                         break
3475                 }
3476                 c := auxIntToInt32(v_0.AuxInt)
3477                 x := v_0.Args[0]
3478                 if !(c&0x80 == 0) {
3479                         break
3480                 }
3481                 v.reset(Op386ANDLconst)
3482                 v.AuxInt = int32ToAuxInt(c & 0x7f)
3483                 v.AddArg(x)
3484                 return true
3485         }
3486         return false
3487 }
3488 func rewriteValue386_Op386MOVBLSXload(v *Value) bool {
3489         v_1 := v.Args[1]
3490         v_0 := v.Args[0]
3491         b := v.Block
3492         config := b.Func.Config
3493         // match: (MOVBLSXload [off] {sym} ptr (MOVBstore [off2] {sym2} ptr2 x _))
3494         // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
3495         // result: (MOVBLSX x)
3496         for {
3497                 off := auxIntToInt32(v.AuxInt)
3498                 sym := auxToSym(v.Aux)
3499                 ptr := v_0
3500                 if v_1.Op != Op386MOVBstore {
3501                         break
3502                 }
3503                 off2 := auxIntToInt32(v_1.AuxInt)
3504                 sym2 := auxToSym(v_1.Aux)
3505                 x := v_1.Args[1]
3506                 ptr2 := v_1.Args[0]
3507                 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
3508                         break
3509                 }
3510                 v.reset(Op386MOVBLSX)
3511                 v.AddArg(x)
3512                 return true
3513         }
3514         // match: (MOVBLSXload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
3515         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
3516         // result: (MOVBLSXload [off1+off2] {mergeSym(sym1,sym2)} base mem)
3517         for {
3518                 off1 := auxIntToInt32(v.AuxInt)
3519                 sym1 := auxToSym(v.Aux)
3520                 if v_0.Op != Op386LEAL {
3521                         break
3522                 }
3523                 off2 := auxIntToInt32(v_0.AuxInt)
3524                 sym2 := auxToSym(v_0.Aux)
3525                 base := v_0.Args[0]
3526                 mem := v_1
3527                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
3528                         break
3529                 }
3530                 v.reset(Op386MOVBLSXload)
3531                 v.AuxInt = int32ToAuxInt(off1 + off2)
3532                 v.Aux = symToAux(mergeSym(sym1, sym2))
3533                 v.AddArg2(base, mem)
3534                 return true
3535         }
3536         return false
3537 }
3538 func rewriteValue386_Op386MOVBLZX(v *Value) bool {
3539         v_0 := v.Args[0]
3540         b := v.Block
3541         // match: (MOVBLZX x:(MOVBload [off] {sym} ptr mem))
3542         // cond: x.Uses == 1 && clobber(x)
3543         // result: @x.Block (MOVBload <v.Type> [off] {sym} ptr mem)
3544         for {
3545                 x := v_0
3546                 if x.Op != Op386MOVBload {
3547                         break
3548                 }
3549                 off := auxIntToInt32(x.AuxInt)
3550                 sym := auxToSym(x.Aux)
3551                 mem := x.Args[1]
3552                 ptr := x.Args[0]
3553                 if !(x.Uses == 1 && clobber(x)) {
3554                         break
3555                 }
3556                 b = x.Block
3557                 v0 := b.NewValue0(x.Pos, Op386MOVBload, v.Type)
3558                 v.copyOf(v0)
3559                 v0.AuxInt = int32ToAuxInt(off)
3560                 v0.Aux = symToAux(sym)
3561                 v0.AddArg2(ptr, mem)
3562                 return true
3563         }
3564         // match: (MOVBLZX (ANDLconst [c] x))
3565         // result: (ANDLconst [c & 0xff] x)
3566         for {
3567                 if v_0.Op != Op386ANDLconst {
3568                         break
3569                 }
3570                 c := auxIntToInt32(v_0.AuxInt)
3571                 x := v_0.Args[0]
3572                 v.reset(Op386ANDLconst)
3573                 v.AuxInt = int32ToAuxInt(c & 0xff)
3574                 v.AddArg(x)
3575                 return true
3576         }
3577         return false
3578 }
3579 func rewriteValue386_Op386MOVBload(v *Value) bool {
3580         v_1 := v.Args[1]
3581         v_0 := v.Args[0]
3582         b := v.Block
3583         config := b.Func.Config
3584         // match: (MOVBload [off] {sym} ptr (MOVBstore [off2] {sym2} ptr2 x _))
3585         // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
3586         // result: (MOVBLZX x)
3587         for {
3588                 off := auxIntToInt32(v.AuxInt)
3589                 sym := auxToSym(v.Aux)
3590                 ptr := v_0
3591                 if v_1.Op != Op386MOVBstore {
3592                         break
3593                 }
3594                 off2 := auxIntToInt32(v_1.AuxInt)
3595                 sym2 := auxToSym(v_1.Aux)
3596                 x := v_1.Args[1]
3597                 ptr2 := v_1.Args[0]
3598                 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
3599                         break
3600                 }
3601                 v.reset(Op386MOVBLZX)
3602                 v.AddArg(x)
3603                 return true
3604         }
3605         // match: (MOVBload [off1] {sym} (ADDLconst [off2] ptr) mem)
3606         // cond: is32Bit(int64(off1)+int64(off2))
3607         // result: (MOVBload [off1+off2] {sym} ptr mem)
3608         for {
3609                 off1 := auxIntToInt32(v.AuxInt)
3610                 sym := auxToSym(v.Aux)
3611                 if v_0.Op != Op386ADDLconst {
3612                         break
3613                 }
3614                 off2 := auxIntToInt32(v_0.AuxInt)
3615                 ptr := v_0.Args[0]
3616                 mem := v_1
3617                 if !(is32Bit(int64(off1) + int64(off2))) {
3618                         break
3619                 }
3620                 v.reset(Op386MOVBload)
3621                 v.AuxInt = int32ToAuxInt(off1 + off2)
3622                 v.Aux = symToAux(sym)
3623                 v.AddArg2(ptr, mem)
3624                 return true
3625         }
3626         // match: (MOVBload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
3627         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
3628         // result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem)
3629         for {
3630                 off1 := auxIntToInt32(v.AuxInt)
3631                 sym1 := auxToSym(v.Aux)
3632                 if v_0.Op != Op386LEAL {
3633                         break
3634                 }
3635                 off2 := auxIntToInt32(v_0.AuxInt)
3636                 sym2 := auxToSym(v_0.Aux)
3637                 base := v_0.Args[0]
3638                 mem := v_1
3639                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
3640                         break
3641                 }
3642                 v.reset(Op386MOVBload)
3643                 v.AuxInt = int32ToAuxInt(off1 + off2)
3644                 v.Aux = symToAux(mergeSym(sym1, sym2))
3645                 v.AddArg2(base, mem)
3646                 return true
3647         }
3648         // match: (MOVBload [off] {sym} (SB) _)
3649         // cond: symIsRO(sym)
3650         // result: (MOVLconst [int32(read8(sym, int64(off)))])
3651         for {
3652                 off := auxIntToInt32(v.AuxInt)
3653                 sym := auxToSym(v.Aux)
3654                 if v_0.Op != OpSB || !(symIsRO(sym)) {
3655                         break
3656                 }
3657                 v.reset(Op386MOVLconst)
3658                 v.AuxInt = int32ToAuxInt(int32(read8(sym, int64(off))))
3659                 return true
3660         }
3661         return false
3662 }
3663 func rewriteValue386_Op386MOVBstore(v *Value) bool {
3664         v_2 := v.Args[2]
3665         v_1 := v.Args[1]
3666         v_0 := v.Args[0]
3667         b := v.Block
3668         config := b.Func.Config
3669         // match: (MOVBstore [off] {sym} ptr (MOVBLSX x) mem)
3670         // result: (MOVBstore [off] {sym} ptr x mem)
3671         for {
3672                 off := auxIntToInt32(v.AuxInt)
3673                 sym := auxToSym(v.Aux)
3674                 ptr := v_0
3675                 if v_1.Op != Op386MOVBLSX {
3676                         break
3677                 }
3678                 x := v_1.Args[0]
3679                 mem := v_2
3680                 v.reset(Op386MOVBstore)
3681                 v.AuxInt = int32ToAuxInt(off)
3682                 v.Aux = symToAux(sym)
3683                 v.AddArg3(ptr, x, mem)
3684                 return true
3685         }
3686         // match: (MOVBstore [off] {sym} ptr (MOVBLZX x) mem)
3687         // result: (MOVBstore [off] {sym} ptr x mem)
3688         for {
3689                 off := auxIntToInt32(v.AuxInt)
3690                 sym := auxToSym(v.Aux)
3691                 ptr := v_0
3692                 if v_1.Op != Op386MOVBLZX {
3693                         break
3694                 }
3695                 x := v_1.Args[0]
3696                 mem := v_2
3697                 v.reset(Op386MOVBstore)
3698                 v.AuxInt = int32ToAuxInt(off)
3699                 v.Aux = symToAux(sym)
3700                 v.AddArg3(ptr, x, mem)
3701                 return true
3702         }
3703         // match: (MOVBstore [off1] {sym} (ADDLconst [off2] ptr) val mem)
3704         // cond: is32Bit(int64(off1)+int64(off2))
3705         // result: (MOVBstore [off1+off2] {sym} ptr val mem)
3706         for {
3707                 off1 := auxIntToInt32(v.AuxInt)
3708                 sym := auxToSym(v.Aux)
3709                 if v_0.Op != Op386ADDLconst {
3710                         break
3711                 }
3712                 off2 := auxIntToInt32(v_0.AuxInt)
3713                 ptr := v_0.Args[0]
3714                 val := v_1
3715                 mem := v_2
3716                 if !(is32Bit(int64(off1) + int64(off2))) {
3717                         break
3718                 }
3719                 v.reset(Op386MOVBstore)
3720                 v.AuxInt = int32ToAuxInt(off1 + off2)
3721                 v.Aux = symToAux(sym)
3722                 v.AddArg3(ptr, val, mem)
3723                 return true
3724         }
3725         // match: (MOVBstore [off] {sym} ptr (MOVLconst [c]) mem)
3726         // result: (MOVBstoreconst [makeValAndOff(c,off)] {sym} ptr mem)
3727         for {
3728                 off := auxIntToInt32(v.AuxInt)
3729                 sym := auxToSym(v.Aux)
3730                 ptr := v_0
3731                 if v_1.Op != Op386MOVLconst {
3732                         break
3733                 }
3734                 c := auxIntToInt32(v_1.AuxInt)
3735                 mem := v_2
3736                 v.reset(Op386MOVBstoreconst)
3737                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
3738                 v.Aux = symToAux(sym)
3739                 v.AddArg2(ptr, mem)
3740                 return true
3741         }
3742         // match: (MOVBstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
3743         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
3744         // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
3745         for {
3746                 off1 := auxIntToInt32(v.AuxInt)
3747                 sym1 := auxToSym(v.Aux)
3748                 if v_0.Op != Op386LEAL {
3749                         break
3750                 }
3751                 off2 := auxIntToInt32(v_0.AuxInt)
3752                 sym2 := auxToSym(v_0.Aux)
3753                 base := v_0.Args[0]
3754                 val := v_1
3755                 mem := v_2
3756                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
3757                         break
3758                 }
3759                 v.reset(Op386MOVBstore)
3760                 v.AuxInt = int32ToAuxInt(off1 + off2)
3761                 v.Aux = symToAux(mergeSym(sym1, sym2))
3762                 v.AddArg3(base, val, mem)
3763                 return true
3764         }
3765         // match: (MOVBstore [i] {s} p (SHRWconst [8] w) x:(MOVBstore [i-1] {s} p w mem))
3766         // cond: x.Uses == 1 && clobber(x)
3767         // result: (MOVWstore [i-1] {s} p w mem)
3768         for {
3769                 i := auxIntToInt32(v.AuxInt)
3770                 s := auxToSym(v.Aux)
3771                 p := v_0
3772                 if v_1.Op != Op386SHRWconst || auxIntToInt16(v_1.AuxInt) != 8 {
3773                         break
3774                 }
3775                 w := v_1.Args[0]
3776                 x := v_2
3777                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s {
3778                         break
3779                 }
3780                 mem := x.Args[2]
3781                 if p != x.Args[0] || w != x.Args[1] || !(x.Uses == 1 && clobber(x)) {
3782                         break
3783                 }
3784                 v.reset(Op386MOVWstore)
3785                 v.AuxInt = int32ToAuxInt(i - 1)
3786                 v.Aux = symToAux(s)
3787                 v.AddArg3(p, w, mem)
3788                 return true
3789         }
3790         // match: (MOVBstore [i] {s} p (SHRLconst [8] w) x:(MOVBstore [i-1] {s} p w mem))
3791         // cond: x.Uses == 1 && clobber(x)
3792         // result: (MOVWstore [i-1] {s} p w mem)
3793         for {
3794                 i := auxIntToInt32(v.AuxInt)
3795                 s := auxToSym(v.Aux)
3796                 p := v_0
3797                 if v_1.Op != Op386SHRLconst || auxIntToInt32(v_1.AuxInt) != 8 {
3798                         break
3799                 }
3800                 w := v_1.Args[0]
3801                 x := v_2
3802                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s {
3803                         break
3804                 }
3805                 mem := x.Args[2]
3806                 if p != x.Args[0] || w != x.Args[1] || !(x.Uses == 1 && clobber(x)) {
3807                         break
3808                 }
3809                 v.reset(Op386MOVWstore)
3810                 v.AuxInt = int32ToAuxInt(i - 1)
3811                 v.Aux = symToAux(s)
3812                 v.AddArg3(p, w, mem)
3813                 return true
3814         }
3815         // match: (MOVBstore [i] {s} p w x:(MOVBstore {s} [i+1] p (SHRWconst [8] w) mem))
3816         // cond: x.Uses == 1 && clobber(x)
3817         // result: (MOVWstore [i] {s} p w mem)
3818         for {
3819                 i := auxIntToInt32(v.AuxInt)
3820                 s := auxToSym(v.Aux)
3821                 p := v_0
3822                 w := v_1
3823                 x := v_2
3824                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i+1 || auxToSym(x.Aux) != s {
3825                         break
3826                 }
3827                 mem := x.Args[2]
3828                 if p != x.Args[0] {
3829                         break
3830                 }
3831                 x_1 := x.Args[1]
3832                 if x_1.Op != Op386SHRWconst || auxIntToInt16(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(x.Uses == 1 && clobber(x)) {
3833                         break
3834                 }
3835                 v.reset(Op386MOVWstore)
3836                 v.AuxInt = int32ToAuxInt(i)
3837                 v.Aux = symToAux(s)
3838                 v.AddArg3(p, w, mem)
3839                 return true
3840         }
3841         // match: (MOVBstore [i] {s} p w x:(MOVBstore {s} [i+1] p (SHRLconst [8] w) mem))
3842         // cond: x.Uses == 1 && clobber(x)
3843         // result: (MOVWstore [i] {s} p w mem)
3844         for {
3845                 i := auxIntToInt32(v.AuxInt)
3846                 s := auxToSym(v.Aux)
3847                 p := v_0
3848                 w := v_1
3849                 x := v_2
3850                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i+1 || auxToSym(x.Aux) != s {
3851                         break
3852                 }
3853                 mem := x.Args[2]
3854                 if p != x.Args[0] {
3855                         break
3856                 }
3857                 x_1 := x.Args[1]
3858                 if x_1.Op != Op386SHRLconst || auxIntToInt32(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(x.Uses == 1 && clobber(x)) {
3859                         break
3860                 }
3861                 v.reset(Op386MOVWstore)
3862                 v.AuxInt = int32ToAuxInt(i)
3863                 v.Aux = symToAux(s)
3864                 v.AddArg3(p, w, mem)
3865                 return true
3866         }
3867         // match: (MOVBstore [i] {s} p (SHRLconst [j] w) x:(MOVBstore [i-1] {s} p w0:(SHRLconst [j-8] w) mem))
3868         // cond: x.Uses == 1 && clobber(x)
3869         // result: (MOVWstore [i-1] {s} p w0 mem)
3870         for {
3871                 i := auxIntToInt32(v.AuxInt)
3872                 s := auxToSym(v.Aux)
3873                 p := v_0
3874                 if v_1.Op != Op386SHRLconst {
3875                         break
3876                 }
3877                 j := auxIntToInt32(v_1.AuxInt)
3878                 w := v_1.Args[0]
3879                 x := v_2
3880                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s {
3881                         break
3882                 }
3883                 mem := x.Args[2]
3884                 if p != x.Args[0] {
3885                         break
3886                 }
3887                 w0 := x.Args[1]
3888                 if w0.Op != Op386SHRLconst || auxIntToInt32(w0.AuxInt) != j-8 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) {
3889                         break
3890                 }
3891                 v.reset(Op386MOVWstore)
3892                 v.AuxInt = int32ToAuxInt(i - 1)
3893                 v.Aux = symToAux(s)
3894                 v.AddArg3(p, w0, mem)
3895                 return true
3896         }
3897         // match: (MOVBstore [i] {s} p1 (SHRWconst [8] w) x:(MOVBstore [i] {s} p0 w mem))
3898         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)
3899         // result: (MOVWstore [i] {s} p0 w mem)
3900         for {
3901                 i := auxIntToInt32(v.AuxInt)
3902                 s := auxToSym(v.Aux)
3903                 p1 := v_0
3904                 if v_1.Op != Op386SHRWconst || auxIntToInt16(v_1.AuxInt) != 8 {
3905                         break
3906                 }
3907                 w := v_1.Args[0]
3908                 x := v_2
3909                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
3910                         break
3911                 }
3912                 mem := x.Args[2]
3913                 p0 := x.Args[0]
3914                 if w != x.Args[1] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) {
3915                         break
3916                 }
3917                 v.reset(Op386MOVWstore)
3918                 v.AuxInt = int32ToAuxInt(i)
3919                 v.Aux = symToAux(s)
3920                 v.AddArg3(p0, w, mem)
3921                 return true
3922         }
3923         // match: (MOVBstore [i] {s} p1 (SHRLconst [8] w) x:(MOVBstore [i] {s} p0 w mem))
3924         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)
3925         // result: (MOVWstore [i] {s} p0 w mem)
3926         for {
3927                 i := auxIntToInt32(v.AuxInt)
3928                 s := auxToSym(v.Aux)
3929                 p1 := v_0
3930                 if v_1.Op != Op386SHRLconst || auxIntToInt32(v_1.AuxInt) != 8 {
3931                         break
3932                 }
3933                 w := v_1.Args[0]
3934                 x := v_2
3935                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
3936                         break
3937                 }
3938                 mem := x.Args[2]
3939                 p0 := x.Args[0]
3940                 if w != x.Args[1] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) {
3941                         break
3942                 }
3943                 v.reset(Op386MOVWstore)
3944                 v.AuxInt = int32ToAuxInt(i)
3945                 v.Aux = symToAux(s)
3946                 v.AddArg3(p0, w, mem)
3947                 return true
3948         }
3949         // match: (MOVBstore [i] {s} p0 w x:(MOVBstore {s} [i] p1 (SHRWconst [8] w) mem))
3950         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)
3951         // result: (MOVWstore [i] {s} p0 w mem)
3952         for {
3953                 i := auxIntToInt32(v.AuxInt)
3954                 s := auxToSym(v.Aux)
3955                 p0 := v_0
3956                 w := v_1
3957                 x := v_2
3958                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
3959                         break
3960                 }
3961                 mem := x.Args[2]
3962                 p1 := x.Args[0]
3963                 x_1 := x.Args[1]
3964                 if x_1.Op != Op386SHRWconst || auxIntToInt16(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) {
3965                         break
3966                 }
3967                 v.reset(Op386MOVWstore)
3968                 v.AuxInt = int32ToAuxInt(i)
3969                 v.Aux = symToAux(s)
3970                 v.AddArg3(p0, w, mem)
3971                 return true
3972         }
3973         // match: (MOVBstore [i] {s} p0 w x:(MOVBstore {s} [i] p1 (SHRLconst [8] w) mem))
3974         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)
3975         // result: (MOVWstore [i] {s} p0 w mem)
3976         for {
3977                 i := auxIntToInt32(v.AuxInt)
3978                 s := auxToSym(v.Aux)
3979                 p0 := v_0
3980                 w := v_1
3981                 x := v_2
3982                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
3983                         break
3984                 }
3985                 mem := x.Args[2]
3986                 p1 := x.Args[0]
3987                 x_1 := x.Args[1]
3988                 if x_1.Op != Op386SHRLconst || auxIntToInt32(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) {
3989                         break
3990                 }
3991                 v.reset(Op386MOVWstore)
3992                 v.AuxInt = int32ToAuxInt(i)
3993                 v.Aux = symToAux(s)
3994                 v.AddArg3(p0, w, mem)
3995                 return true
3996         }
3997         // match: (MOVBstore [i] {s} p1 (SHRLconst [j] w) x:(MOVBstore [i] {s} p0 w0:(SHRLconst [j-8] w) mem))
3998         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)
3999         // result: (MOVWstore [i] {s} p0 w0 mem)
4000         for {
4001                 i := auxIntToInt32(v.AuxInt)
4002                 s := auxToSym(v.Aux)
4003                 p1 := v_0
4004                 if v_1.Op != Op386SHRLconst {
4005                         break
4006                 }
4007                 j := auxIntToInt32(v_1.AuxInt)
4008                 w := v_1.Args[0]
4009                 x := v_2
4010                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
4011                         break
4012                 }
4013                 mem := x.Args[2]
4014                 p0 := x.Args[0]
4015                 w0 := x.Args[1]
4016                 if w0.Op != Op386SHRLconst || auxIntToInt32(w0.AuxInt) != j-8 || w != w0.Args[0] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) {
4017                         break
4018                 }
4019                 v.reset(Op386MOVWstore)
4020                 v.AuxInt = int32ToAuxInt(i)
4021                 v.Aux = symToAux(s)
4022                 v.AddArg3(p0, w0, mem)
4023                 return true
4024         }
4025         return false
4026 }
4027 func rewriteValue386_Op386MOVBstoreconst(v *Value) bool {
4028         v_1 := v.Args[1]
4029         v_0 := v.Args[0]
4030         b := v.Block
4031         config := b.Func.Config
4032         // match: (MOVBstoreconst [sc] {s} (ADDLconst [off] ptr) mem)
4033         // cond: sc.canAdd32(off)
4034         // result: (MOVBstoreconst [sc.addOffset32(off)] {s} ptr mem)
4035         for {
4036                 sc := auxIntToValAndOff(v.AuxInt)
4037                 s := auxToSym(v.Aux)
4038                 if v_0.Op != Op386ADDLconst {
4039                         break
4040                 }
4041                 off := auxIntToInt32(v_0.AuxInt)
4042                 ptr := v_0.Args[0]
4043                 mem := v_1
4044                 if !(sc.canAdd32(off)) {
4045                         break
4046                 }
4047                 v.reset(Op386MOVBstoreconst)
4048                 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
4049                 v.Aux = symToAux(s)
4050                 v.AddArg2(ptr, mem)
4051                 return true
4052         }
4053         // match: (MOVBstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem)
4054         // cond: canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)
4055         // result: (MOVBstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
4056         for {
4057                 sc := auxIntToValAndOff(v.AuxInt)
4058                 sym1 := auxToSym(v.Aux)
4059                 if v_0.Op != Op386LEAL {
4060                         break
4061                 }
4062                 off := auxIntToInt32(v_0.AuxInt)
4063                 sym2 := auxToSym(v_0.Aux)
4064                 ptr := v_0.Args[0]
4065                 mem := v_1
4066                 if !(canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)) {
4067                         break
4068                 }
4069                 v.reset(Op386MOVBstoreconst)
4070                 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
4071                 v.Aux = symToAux(mergeSym(sym1, sym2))
4072                 v.AddArg2(ptr, mem)
4073                 return true
4074         }
4075         // match: (MOVBstoreconst [c] {s} p x:(MOVBstoreconst [a] {s} p mem))
4076         // cond: x.Uses == 1 && a.Off() + 1 == c.Off() && clobber(x)
4077         // result: (MOVWstoreconst [makeValAndOff(a.Val()&0xff | c.Val()<<8, a.Off())] {s} p mem)
4078         for {
4079                 c := auxIntToValAndOff(v.AuxInt)
4080                 s := auxToSym(v.Aux)
4081                 p := v_0
4082                 x := v_1
4083                 if x.Op != Op386MOVBstoreconst {
4084                         break
4085                 }
4086                 a := auxIntToValAndOff(x.AuxInt)
4087                 if auxToSym(x.Aux) != s {
4088                         break
4089                 }
4090                 mem := x.Args[1]
4091                 if p != x.Args[0] || !(x.Uses == 1 && a.Off()+1 == c.Off() && clobber(x)) {
4092                         break
4093                 }
4094                 v.reset(Op386MOVWstoreconst)
4095                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xff|c.Val()<<8, a.Off()))
4096                 v.Aux = symToAux(s)
4097                 v.AddArg2(p, mem)
4098                 return true
4099         }
4100         // match: (MOVBstoreconst [a] {s} p x:(MOVBstoreconst [c] {s} p mem))
4101         // cond: x.Uses == 1 && a.Off() + 1 == c.Off() && clobber(x)
4102         // result: (MOVWstoreconst [makeValAndOff(a.Val()&0xff | c.Val()<<8, a.Off())] {s} p mem)
4103         for {
4104                 a := auxIntToValAndOff(v.AuxInt)
4105                 s := auxToSym(v.Aux)
4106                 p := v_0
4107                 x := v_1
4108                 if x.Op != Op386MOVBstoreconst {
4109                         break
4110                 }
4111                 c := auxIntToValAndOff(x.AuxInt)
4112                 if auxToSym(x.Aux) != s {
4113                         break
4114                 }
4115                 mem := x.Args[1]
4116                 if p != x.Args[0] || !(x.Uses == 1 && a.Off()+1 == c.Off() && clobber(x)) {
4117                         break
4118                 }
4119                 v.reset(Op386MOVWstoreconst)
4120                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xff|c.Val()<<8, a.Off()))
4121                 v.Aux = symToAux(s)
4122                 v.AddArg2(p, mem)
4123                 return true
4124         }
4125         // match: (MOVBstoreconst [c] {s} p1 x:(MOVBstoreconst [a] {s} p0 mem))
4126         // cond: x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 1) && clobber(x)
4127         // result: (MOVWstoreconst [makeValAndOff(a.Val()&0xff | c.Val()<<8, a.Off())] {s} p0 mem)
4128         for {
4129                 c := auxIntToValAndOff(v.AuxInt)
4130                 s := auxToSym(v.Aux)
4131                 p1 := v_0
4132                 x := v_1
4133                 if x.Op != Op386MOVBstoreconst {
4134                         break
4135                 }
4136                 a := auxIntToValAndOff(x.AuxInt)
4137                 if auxToSym(x.Aux) != s {
4138                         break
4139                 }
4140                 mem := x.Args[1]
4141                 p0 := x.Args[0]
4142                 if !(x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 1) && clobber(x)) {
4143                         break
4144                 }
4145                 v.reset(Op386MOVWstoreconst)
4146                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xff|c.Val()<<8, a.Off()))
4147                 v.Aux = symToAux(s)
4148                 v.AddArg2(p0, mem)
4149                 return true
4150         }
4151         // match: (MOVBstoreconst [a] {s} p0 x:(MOVBstoreconst [c] {s} p1 mem))
4152         // cond: x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 1) && clobber(x)
4153         // result: (MOVWstoreconst [makeValAndOff(a.Val()&0xff | c.Val()<<8, a.Off())] {s} p0 mem)
4154         for {
4155                 a := auxIntToValAndOff(v.AuxInt)
4156                 s := auxToSym(v.Aux)
4157                 p0 := v_0
4158                 x := v_1
4159                 if x.Op != Op386MOVBstoreconst {
4160                         break
4161                 }
4162                 c := auxIntToValAndOff(x.AuxInt)
4163                 if auxToSym(x.Aux) != s {
4164                         break
4165                 }
4166                 mem := x.Args[1]
4167                 p1 := x.Args[0]
4168                 if !(x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 1) && clobber(x)) {
4169                         break
4170                 }
4171                 v.reset(Op386MOVWstoreconst)
4172                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xff|c.Val()<<8, a.Off()))
4173                 v.Aux = symToAux(s)
4174                 v.AddArg2(p0, mem)
4175                 return true
4176         }
4177         return false
4178 }
4179 func rewriteValue386_Op386MOVLload(v *Value) bool {
4180         v_1 := v.Args[1]
4181         v_0 := v.Args[0]
4182         b := v.Block
4183         config := b.Func.Config
4184         // match: (MOVLload [off] {sym} ptr (MOVLstore [off2] {sym2} ptr2 x _))
4185         // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
4186         // result: x
4187         for {
4188                 off := auxIntToInt32(v.AuxInt)
4189                 sym := auxToSym(v.Aux)
4190                 ptr := v_0
4191                 if v_1.Op != Op386MOVLstore {
4192                         break
4193                 }
4194                 off2 := auxIntToInt32(v_1.AuxInt)
4195                 sym2 := auxToSym(v_1.Aux)
4196                 x := v_1.Args[1]
4197                 ptr2 := v_1.Args[0]
4198                 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
4199                         break
4200                 }
4201                 v.copyOf(x)
4202                 return true
4203         }
4204         // match: (MOVLload [off1] {sym} (ADDLconst [off2] ptr) mem)
4205         // cond: is32Bit(int64(off1)+int64(off2))
4206         // result: (MOVLload [off1+off2] {sym} ptr mem)
4207         for {
4208                 off1 := auxIntToInt32(v.AuxInt)
4209                 sym := auxToSym(v.Aux)
4210                 if v_0.Op != Op386ADDLconst {
4211                         break
4212                 }
4213                 off2 := auxIntToInt32(v_0.AuxInt)
4214                 ptr := v_0.Args[0]
4215                 mem := v_1
4216                 if !(is32Bit(int64(off1) + int64(off2))) {
4217                         break
4218                 }
4219                 v.reset(Op386MOVLload)
4220                 v.AuxInt = int32ToAuxInt(off1 + off2)
4221                 v.Aux = symToAux(sym)
4222                 v.AddArg2(ptr, mem)
4223                 return true
4224         }
4225         // match: (MOVLload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
4226         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
4227         // result: (MOVLload [off1+off2] {mergeSym(sym1,sym2)} base mem)
4228         for {
4229                 off1 := auxIntToInt32(v.AuxInt)
4230                 sym1 := auxToSym(v.Aux)
4231                 if v_0.Op != Op386LEAL {
4232                         break
4233                 }
4234                 off2 := auxIntToInt32(v_0.AuxInt)
4235                 sym2 := auxToSym(v_0.Aux)
4236                 base := v_0.Args[0]
4237                 mem := v_1
4238                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
4239                         break
4240                 }
4241                 v.reset(Op386MOVLload)
4242                 v.AuxInt = int32ToAuxInt(off1 + off2)
4243                 v.Aux = symToAux(mergeSym(sym1, sym2))
4244                 v.AddArg2(base, mem)
4245                 return true
4246         }
4247         // match: (MOVLload [off] {sym} (SB) _)
4248         // cond: symIsRO(sym)
4249         // result: (MOVLconst [int32(read32(sym, int64(off), config.ctxt.Arch.ByteOrder))])
4250         for {
4251                 off := auxIntToInt32(v.AuxInt)
4252                 sym := auxToSym(v.Aux)
4253                 if v_0.Op != OpSB || !(symIsRO(sym)) {
4254                         break
4255                 }
4256                 v.reset(Op386MOVLconst)
4257                 v.AuxInt = int32ToAuxInt(int32(read32(sym, int64(off), config.ctxt.Arch.ByteOrder)))
4258                 return true
4259         }
4260         return false
4261 }
4262 func rewriteValue386_Op386MOVLstore(v *Value) bool {
4263         v_2 := v.Args[2]
4264         v_1 := v.Args[1]
4265         v_0 := v.Args[0]
4266         b := v.Block
4267         config := b.Func.Config
4268         // match: (MOVLstore [off1] {sym} (ADDLconst [off2] ptr) val mem)
4269         // cond: is32Bit(int64(off1)+int64(off2))
4270         // result: (MOVLstore [off1+off2] {sym} ptr val mem)
4271         for {
4272                 off1 := auxIntToInt32(v.AuxInt)
4273                 sym := auxToSym(v.Aux)
4274                 if v_0.Op != Op386ADDLconst {
4275                         break
4276                 }
4277                 off2 := auxIntToInt32(v_0.AuxInt)
4278                 ptr := v_0.Args[0]
4279                 val := v_1
4280                 mem := v_2
4281                 if !(is32Bit(int64(off1) + int64(off2))) {
4282                         break
4283                 }
4284                 v.reset(Op386MOVLstore)
4285                 v.AuxInt = int32ToAuxInt(off1 + off2)
4286                 v.Aux = symToAux(sym)
4287                 v.AddArg3(ptr, val, mem)
4288                 return true
4289         }
4290         // match: (MOVLstore [off] {sym} ptr (MOVLconst [c]) mem)
4291         // result: (MOVLstoreconst [makeValAndOff(c,off)] {sym} ptr mem)
4292         for {
4293                 off := auxIntToInt32(v.AuxInt)
4294                 sym := auxToSym(v.Aux)
4295                 ptr := v_0
4296                 if v_1.Op != Op386MOVLconst {
4297                         break
4298                 }
4299                 c := auxIntToInt32(v_1.AuxInt)
4300                 mem := v_2
4301                 v.reset(Op386MOVLstoreconst)
4302                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
4303                 v.Aux = symToAux(sym)
4304                 v.AddArg2(ptr, mem)
4305                 return true
4306         }
4307         // match: (MOVLstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
4308         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
4309         // result: (MOVLstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
4310         for {
4311                 off1 := auxIntToInt32(v.AuxInt)
4312                 sym1 := auxToSym(v.Aux)
4313                 if v_0.Op != Op386LEAL {
4314                         break
4315                 }
4316                 off2 := auxIntToInt32(v_0.AuxInt)
4317                 sym2 := auxToSym(v_0.Aux)
4318                 base := v_0.Args[0]
4319                 val := v_1
4320                 mem := v_2
4321                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
4322                         break
4323                 }
4324                 v.reset(Op386MOVLstore)
4325                 v.AuxInt = int32ToAuxInt(off1 + off2)
4326                 v.Aux = symToAux(mergeSym(sym1, sym2))
4327                 v.AddArg3(base, val, mem)
4328                 return true
4329         }
4330         // match: (MOVLstore {sym} [off] ptr y:(ADDLload x [off] {sym} ptr mem) mem)
4331         // cond: y.Uses==1 && clobber(y)
4332         // result: (ADDLmodify [off] {sym} ptr x mem)
4333         for {
4334                 off := auxIntToInt32(v.AuxInt)
4335                 sym := auxToSym(v.Aux)
4336                 ptr := v_0
4337                 y := v_1
4338                 if y.Op != Op386ADDLload || auxIntToInt32(y.AuxInt) != off || auxToSym(y.Aux) != sym {
4339                         break
4340                 }
4341                 mem := y.Args[2]
4342                 x := y.Args[0]
4343                 if ptr != y.Args[1] || mem != v_2 || !(y.Uses == 1 && clobber(y)) {
4344                         break
4345                 }
4346                 v.reset(Op386ADDLmodify)
4347                 v.AuxInt = int32ToAuxInt(off)
4348                 v.Aux = symToAux(sym)
4349                 v.AddArg3(ptr, x, mem)
4350                 return true
4351         }
4352         // match: (MOVLstore {sym} [off] ptr y:(ANDLload x [off] {sym} ptr mem) mem)
4353         // cond: y.Uses==1 && clobber(y)
4354         // result: (ANDLmodify [off] {sym} ptr x mem)
4355         for {
4356                 off := auxIntToInt32(v.AuxInt)
4357                 sym := auxToSym(v.Aux)
4358                 ptr := v_0
4359                 y := v_1
4360                 if y.Op != Op386ANDLload || auxIntToInt32(y.AuxInt) != off || auxToSym(y.Aux) != sym {
4361                         break
4362                 }
4363                 mem := y.Args[2]
4364                 x := y.Args[0]
4365                 if ptr != y.Args[1] || mem != v_2 || !(y.Uses == 1 && clobber(y)) {
4366                         break
4367                 }
4368                 v.reset(Op386ANDLmodify)
4369                 v.AuxInt = int32ToAuxInt(off)
4370                 v.Aux = symToAux(sym)
4371                 v.AddArg3(ptr, x, mem)
4372                 return true
4373         }
4374         // match: (MOVLstore {sym} [off] ptr y:(ORLload x [off] {sym} ptr mem) mem)
4375         // cond: y.Uses==1 && clobber(y)
4376         // result: (ORLmodify [off] {sym} ptr x mem)
4377         for {
4378                 off := auxIntToInt32(v.AuxInt)
4379                 sym := auxToSym(v.Aux)
4380                 ptr := v_0
4381                 y := v_1
4382                 if y.Op != Op386ORLload || auxIntToInt32(y.AuxInt) != off || auxToSym(y.Aux) != sym {
4383                         break
4384                 }
4385                 mem := y.Args[2]
4386                 x := y.Args[0]
4387                 if ptr != y.Args[1] || mem != v_2 || !(y.Uses == 1 && clobber(y)) {
4388                         break
4389                 }
4390                 v.reset(Op386ORLmodify)
4391                 v.AuxInt = int32ToAuxInt(off)
4392                 v.Aux = symToAux(sym)
4393                 v.AddArg3(ptr, x, mem)
4394                 return true
4395         }
4396         // match: (MOVLstore {sym} [off] ptr y:(XORLload x [off] {sym} ptr mem) mem)
4397         // cond: y.Uses==1 && clobber(y)
4398         // result: (XORLmodify [off] {sym} ptr x mem)
4399         for {
4400                 off := auxIntToInt32(v.AuxInt)
4401                 sym := auxToSym(v.Aux)
4402                 ptr := v_0
4403                 y := v_1
4404                 if y.Op != Op386XORLload || auxIntToInt32(y.AuxInt) != off || auxToSym(y.Aux) != sym {
4405                         break
4406                 }
4407                 mem := y.Args[2]
4408                 x := y.Args[0]
4409                 if ptr != y.Args[1] || mem != v_2 || !(y.Uses == 1 && clobber(y)) {
4410                         break
4411                 }
4412                 v.reset(Op386XORLmodify)
4413                 v.AuxInt = int32ToAuxInt(off)
4414                 v.Aux = symToAux(sym)
4415                 v.AddArg3(ptr, x, mem)
4416                 return true
4417         }
4418         // match: (MOVLstore {sym} [off] ptr y:(ADDL l:(MOVLload [off] {sym} ptr mem) x) mem)
4419         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4420         // result: (ADDLmodify [off] {sym} ptr x mem)
4421         for {
4422                 off := auxIntToInt32(v.AuxInt)
4423                 sym := auxToSym(v.Aux)
4424                 ptr := v_0
4425                 y := v_1
4426                 if y.Op != Op386ADDL {
4427                         break
4428                 }
4429                 _ = y.Args[1]
4430                 y_0 := y.Args[0]
4431                 y_1 := y.Args[1]
4432                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
4433                         l := y_0
4434                         if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4435                                 continue
4436                         }
4437                         mem := l.Args[1]
4438                         if ptr != l.Args[0] {
4439                                 continue
4440                         }
4441                         x := y_1
4442                         if mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4443                                 continue
4444                         }
4445                         v.reset(Op386ADDLmodify)
4446                         v.AuxInt = int32ToAuxInt(off)
4447                         v.Aux = symToAux(sym)
4448                         v.AddArg3(ptr, x, mem)
4449                         return true
4450                 }
4451                 break
4452         }
4453         // match: (MOVLstore {sym} [off] ptr y:(SUBL l:(MOVLload [off] {sym} ptr mem) x) mem)
4454         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4455         // result: (SUBLmodify [off] {sym} ptr x mem)
4456         for {
4457                 off := auxIntToInt32(v.AuxInt)
4458                 sym := auxToSym(v.Aux)
4459                 ptr := v_0
4460                 y := v_1
4461                 if y.Op != Op386SUBL {
4462                         break
4463                 }
4464                 x := y.Args[1]
4465                 l := y.Args[0]
4466                 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4467                         break
4468                 }
4469                 mem := l.Args[1]
4470                 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4471                         break
4472                 }
4473                 v.reset(Op386SUBLmodify)
4474                 v.AuxInt = int32ToAuxInt(off)
4475                 v.Aux = symToAux(sym)
4476                 v.AddArg3(ptr, x, mem)
4477                 return true
4478         }
4479         // match: (MOVLstore {sym} [off] ptr y:(ANDL l:(MOVLload [off] {sym} ptr mem) x) mem)
4480         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4481         // result: (ANDLmodify [off] {sym} ptr x mem)
4482         for {
4483                 off := auxIntToInt32(v.AuxInt)
4484                 sym := auxToSym(v.Aux)
4485                 ptr := v_0
4486                 y := v_1
4487                 if y.Op != Op386ANDL {
4488                         break
4489                 }
4490                 _ = y.Args[1]
4491                 y_0 := y.Args[0]
4492                 y_1 := y.Args[1]
4493                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
4494                         l := y_0
4495                         if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4496                                 continue
4497                         }
4498                         mem := l.Args[1]
4499                         if ptr != l.Args[0] {
4500                                 continue
4501                         }
4502                         x := y_1
4503                         if mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4504                                 continue
4505                         }
4506                         v.reset(Op386ANDLmodify)
4507                         v.AuxInt = int32ToAuxInt(off)
4508                         v.Aux = symToAux(sym)
4509                         v.AddArg3(ptr, x, mem)
4510                         return true
4511                 }
4512                 break
4513         }
4514         // match: (MOVLstore {sym} [off] ptr y:(ORL l:(MOVLload [off] {sym} ptr mem) x) mem)
4515         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4516         // result: (ORLmodify [off] {sym} ptr x mem)
4517         for {
4518                 off := auxIntToInt32(v.AuxInt)
4519                 sym := auxToSym(v.Aux)
4520                 ptr := v_0
4521                 y := v_1
4522                 if y.Op != Op386ORL {
4523                         break
4524                 }
4525                 _ = y.Args[1]
4526                 y_0 := y.Args[0]
4527                 y_1 := y.Args[1]
4528                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
4529                         l := y_0
4530                         if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4531                                 continue
4532                         }
4533                         mem := l.Args[1]
4534                         if ptr != l.Args[0] {
4535                                 continue
4536                         }
4537                         x := y_1
4538                         if mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4539                                 continue
4540                         }
4541                         v.reset(Op386ORLmodify)
4542                         v.AuxInt = int32ToAuxInt(off)
4543                         v.Aux = symToAux(sym)
4544                         v.AddArg3(ptr, x, mem)
4545                         return true
4546                 }
4547                 break
4548         }
4549         // match: (MOVLstore {sym} [off] ptr y:(XORL l:(MOVLload [off] {sym} ptr mem) x) mem)
4550         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4551         // result: (XORLmodify [off] {sym} ptr x mem)
4552         for {
4553                 off := auxIntToInt32(v.AuxInt)
4554                 sym := auxToSym(v.Aux)
4555                 ptr := v_0
4556                 y := v_1
4557                 if y.Op != Op386XORL {
4558                         break
4559                 }
4560                 _ = y.Args[1]
4561                 y_0 := y.Args[0]
4562                 y_1 := y.Args[1]
4563                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
4564                         l := y_0
4565                         if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4566                                 continue
4567                         }
4568                         mem := l.Args[1]
4569                         if ptr != l.Args[0] {
4570                                 continue
4571                         }
4572                         x := y_1
4573                         if mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4574                                 continue
4575                         }
4576                         v.reset(Op386XORLmodify)
4577                         v.AuxInt = int32ToAuxInt(off)
4578                         v.Aux = symToAux(sym)
4579                         v.AddArg3(ptr, x, mem)
4580                         return true
4581                 }
4582                 break
4583         }
4584         // match: (MOVLstore {sym} [off] ptr y:(ADDLconst [c] l:(MOVLload [off] {sym} ptr mem)) mem)
4585         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4586         // result: (ADDLconstmodify [makeValAndOff(c,off)] {sym} ptr mem)
4587         for {
4588                 off := auxIntToInt32(v.AuxInt)
4589                 sym := auxToSym(v.Aux)
4590                 ptr := v_0
4591                 y := v_1
4592                 if y.Op != Op386ADDLconst {
4593                         break
4594                 }
4595                 c := auxIntToInt32(y.AuxInt)
4596                 l := y.Args[0]
4597                 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4598                         break
4599                 }
4600                 mem := l.Args[1]
4601                 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4602                         break
4603                 }
4604                 v.reset(Op386ADDLconstmodify)
4605                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
4606                 v.Aux = symToAux(sym)
4607                 v.AddArg2(ptr, mem)
4608                 return true
4609         }
4610         // match: (MOVLstore {sym} [off] ptr y:(ANDLconst [c] l:(MOVLload [off] {sym} ptr mem)) mem)
4611         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4612         // result: (ANDLconstmodify [makeValAndOff(c,off)] {sym} ptr mem)
4613         for {
4614                 off := auxIntToInt32(v.AuxInt)
4615                 sym := auxToSym(v.Aux)
4616                 ptr := v_0
4617                 y := v_1
4618                 if y.Op != Op386ANDLconst {
4619                         break
4620                 }
4621                 c := auxIntToInt32(y.AuxInt)
4622                 l := y.Args[0]
4623                 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4624                         break
4625                 }
4626                 mem := l.Args[1]
4627                 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4628                         break
4629                 }
4630                 v.reset(Op386ANDLconstmodify)
4631                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
4632                 v.Aux = symToAux(sym)
4633                 v.AddArg2(ptr, mem)
4634                 return true
4635         }
4636         // match: (MOVLstore {sym} [off] ptr y:(ORLconst [c] l:(MOVLload [off] {sym} ptr mem)) mem)
4637         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4638         // result: (ORLconstmodify [makeValAndOff(c,off)] {sym} ptr mem)
4639         for {
4640                 off := auxIntToInt32(v.AuxInt)
4641                 sym := auxToSym(v.Aux)
4642                 ptr := v_0
4643                 y := v_1
4644                 if y.Op != Op386ORLconst {
4645                         break
4646                 }
4647                 c := auxIntToInt32(y.AuxInt)
4648                 l := y.Args[0]
4649                 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4650                         break
4651                 }
4652                 mem := l.Args[1]
4653                 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4654                         break
4655                 }
4656                 v.reset(Op386ORLconstmodify)
4657                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
4658                 v.Aux = symToAux(sym)
4659                 v.AddArg2(ptr, mem)
4660                 return true
4661         }
4662         // match: (MOVLstore {sym} [off] ptr y:(XORLconst [c] l:(MOVLload [off] {sym} ptr mem)) mem)
4663         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4664         // result: (XORLconstmodify [makeValAndOff(c,off)] {sym} ptr mem)
4665         for {
4666                 off := auxIntToInt32(v.AuxInt)
4667                 sym := auxToSym(v.Aux)
4668                 ptr := v_0
4669                 y := v_1
4670                 if y.Op != Op386XORLconst {
4671                         break
4672                 }
4673                 c := auxIntToInt32(y.AuxInt)
4674                 l := y.Args[0]
4675                 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4676                         break
4677                 }
4678                 mem := l.Args[1]
4679                 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4680                         break
4681                 }
4682                 v.reset(Op386XORLconstmodify)
4683                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
4684                 v.Aux = symToAux(sym)
4685                 v.AddArg2(ptr, mem)
4686                 return true
4687         }
4688         return false
4689 }
4690 func rewriteValue386_Op386MOVLstoreconst(v *Value) bool {
4691         v_1 := v.Args[1]
4692         v_0 := v.Args[0]
4693         b := v.Block
4694         config := b.Func.Config
4695         // match: (MOVLstoreconst [sc] {s} (ADDLconst [off] ptr) mem)
4696         // cond: sc.canAdd32(off)
4697         // result: (MOVLstoreconst [sc.addOffset32(off)] {s} ptr mem)
4698         for {
4699                 sc := auxIntToValAndOff(v.AuxInt)
4700                 s := auxToSym(v.Aux)
4701                 if v_0.Op != Op386ADDLconst {
4702                         break
4703                 }
4704                 off := auxIntToInt32(v_0.AuxInt)
4705                 ptr := v_0.Args[0]
4706                 mem := v_1
4707                 if !(sc.canAdd32(off)) {
4708                         break
4709                 }
4710                 v.reset(Op386MOVLstoreconst)
4711                 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
4712                 v.Aux = symToAux(s)
4713                 v.AddArg2(ptr, mem)
4714                 return true
4715         }
4716         // match: (MOVLstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem)
4717         // cond: canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)
4718         // result: (MOVLstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
4719         for {
4720                 sc := auxIntToValAndOff(v.AuxInt)
4721                 sym1 := auxToSym(v.Aux)
4722                 if v_0.Op != Op386LEAL {
4723                         break
4724                 }
4725                 off := auxIntToInt32(v_0.AuxInt)
4726                 sym2 := auxToSym(v_0.Aux)
4727                 ptr := v_0.Args[0]
4728                 mem := v_1
4729                 if !(canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)) {
4730                         break
4731                 }
4732                 v.reset(Op386MOVLstoreconst)
4733                 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
4734                 v.Aux = symToAux(mergeSym(sym1, sym2))
4735                 v.AddArg2(ptr, mem)
4736                 return true
4737         }
4738         return false
4739 }
4740 func rewriteValue386_Op386MOVSDconst(v *Value) bool {
4741         b := v.Block
4742         config := b.Func.Config
4743         typ := &b.Func.Config.Types
4744         // match: (MOVSDconst [c])
4745         // cond: config.ctxt.Flag_shared
4746         // result: (MOVSDconst2 (MOVSDconst1 [c]))
4747         for {
4748                 c := auxIntToFloat64(v.AuxInt)
4749                 if !(config.ctxt.Flag_shared) {
4750                         break
4751                 }
4752                 v.reset(Op386MOVSDconst2)
4753                 v0 := b.NewValue0(v.Pos, Op386MOVSDconst1, typ.UInt32)
4754                 v0.AuxInt = float64ToAuxInt(c)
4755                 v.AddArg(v0)
4756                 return true
4757         }
4758         return false
4759 }
4760 func rewriteValue386_Op386MOVSDload(v *Value) bool {
4761         v_1 := v.Args[1]
4762         v_0 := v.Args[0]
4763         b := v.Block
4764         config := b.Func.Config
4765         // match: (MOVSDload [off1] {sym} (ADDLconst [off2] ptr) mem)
4766         // cond: is32Bit(int64(off1)+int64(off2))
4767         // result: (MOVSDload [off1+off2] {sym} ptr mem)
4768         for {
4769                 off1 := auxIntToInt32(v.AuxInt)
4770                 sym := auxToSym(v.Aux)
4771                 if v_0.Op != Op386ADDLconst {
4772                         break
4773                 }
4774                 off2 := auxIntToInt32(v_0.AuxInt)
4775                 ptr := v_0.Args[0]
4776                 mem := v_1
4777                 if !(is32Bit(int64(off1) + int64(off2))) {
4778                         break
4779                 }
4780                 v.reset(Op386MOVSDload)
4781                 v.AuxInt = int32ToAuxInt(off1 + off2)
4782                 v.Aux = symToAux(sym)
4783                 v.AddArg2(ptr, mem)
4784                 return true
4785         }
4786         // match: (MOVSDload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
4787         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
4788         // result: (MOVSDload [off1+off2] {mergeSym(sym1,sym2)} base mem)
4789         for {
4790                 off1 := auxIntToInt32(v.AuxInt)
4791                 sym1 := auxToSym(v.Aux)
4792                 if v_0.Op != Op386LEAL {
4793                         break
4794                 }
4795                 off2 := auxIntToInt32(v_0.AuxInt)
4796                 sym2 := auxToSym(v_0.Aux)
4797                 base := v_0.Args[0]
4798                 mem := v_1
4799                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
4800                         break
4801                 }
4802                 v.reset(Op386MOVSDload)
4803                 v.AuxInt = int32ToAuxInt(off1 + off2)
4804                 v.Aux = symToAux(mergeSym(sym1, sym2))
4805                 v.AddArg2(base, mem)
4806                 return true
4807         }
4808         return false
4809 }
4810 func rewriteValue386_Op386MOVSDstore(v *Value) bool {
4811         v_2 := v.Args[2]
4812         v_1 := v.Args[1]
4813         v_0 := v.Args[0]
4814         b := v.Block
4815         config := b.Func.Config
4816         // match: (MOVSDstore [off1] {sym} (ADDLconst [off2] ptr) val mem)
4817         // cond: is32Bit(int64(off1)+int64(off2))
4818         // result: (MOVSDstore [off1+off2] {sym} ptr val mem)
4819         for {
4820                 off1 := auxIntToInt32(v.AuxInt)
4821                 sym := auxToSym(v.Aux)
4822                 if v_0.Op != Op386ADDLconst {
4823                         break
4824                 }
4825                 off2 := auxIntToInt32(v_0.AuxInt)
4826                 ptr := v_0.Args[0]
4827                 val := v_1
4828                 mem := v_2
4829                 if !(is32Bit(int64(off1) + int64(off2))) {
4830                         break
4831                 }
4832                 v.reset(Op386MOVSDstore)
4833                 v.AuxInt = int32ToAuxInt(off1 + off2)
4834                 v.Aux = symToAux(sym)
4835                 v.AddArg3(ptr, val, mem)
4836                 return true
4837         }
4838         // match: (MOVSDstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
4839         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
4840         // result: (MOVSDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
4841         for {
4842                 off1 := auxIntToInt32(v.AuxInt)
4843                 sym1 := auxToSym(v.Aux)
4844                 if v_0.Op != Op386LEAL {
4845                         break
4846                 }
4847                 off2 := auxIntToInt32(v_0.AuxInt)
4848                 sym2 := auxToSym(v_0.Aux)
4849                 base := v_0.Args[0]
4850                 val := v_1
4851                 mem := v_2
4852                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
4853                         break
4854                 }
4855                 v.reset(Op386MOVSDstore)
4856                 v.AuxInt = int32ToAuxInt(off1 + off2)
4857                 v.Aux = symToAux(mergeSym(sym1, sym2))
4858                 v.AddArg3(base, val, mem)
4859                 return true
4860         }
4861         return false
4862 }
4863 func rewriteValue386_Op386MOVSSconst(v *Value) bool {
4864         b := v.Block
4865         config := b.Func.Config
4866         typ := &b.Func.Config.Types
4867         // match: (MOVSSconst [c])
4868         // cond: config.ctxt.Flag_shared
4869         // result: (MOVSSconst2 (MOVSSconst1 [c]))
4870         for {
4871                 c := auxIntToFloat32(v.AuxInt)
4872                 if !(config.ctxt.Flag_shared) {
4873                         break
4874                 }
4875                 v.reset(Op386MOVSSconst2)
4876                 v0 := b.NewValue0(v.Pos, Op386MOVSSconst1, typ.UInt32)
4877                 v0.AuxInt = float32ToAuxInt(c)
4878                 v.AddArg(v0)
4879                 return true
4880         }
4881         return false
4882 }
4883 func rewriteValue386_Op386MOVSSload(v *Value) bool {
4884         v_1 := v.Args[1]
4885         v_0 := v.Args[0]
4886         b := v.Block
4887         config := b.Func.Config
4888         // match: (MOVSSload [off1] {sym} (ADDLconst [off2] ptr) mem)
4889         // cond: is32Bit(int64(off1)+int64(off2))
4890         // result: (MOVSSload [off1+off2] {sym} ptr mem)
4891         for {
4892                 off1 := auxIntToInt32(v.AuxInt)
4893                 sym := auxToSym(v.Aux)
4894                 if v_0.Op != Op386ADDLconst {
4895                         break
4896                 }
4897                 off2 := auxIntToInt32(v_0.AuxInt)
4898                 ptr := v_0.Args[0]
4899                 mem := v_1
4900                 if !(is32Bit(int64(off1) + int64(off2))) {
4901                         break
4902                 }
4903                 v.reset(Op386MOVSSload)
4904                 v.AuxInt = int32ToAuxInt(off1 + off2)
4905                 v.Aux = symToAux(sym)
4906                 v.AddArg2(ptr, mem)
4907                 return true
4908         }
4909         // match: (MOVSSload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
4910         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
4911         // result: (MOVSSload [off1+off2] {mergeSym(sym1,sym2)} base mem)
4912         for {
4913                 off1 := auxIntToInt32(v.AuxInt)
4914                 sym1 := auxToSym(v.Aux)
4915                 if v_0.Op != Op386LEAL {
4916                         break
4917                 }
4918                 off2 := auxIntToInt32(v_0.AuxInt)
4919                 sym2 := auxToSym(v_0.Aux)
4920                 base := v_0.Args[0]
4921                 mem := v_1
4922                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
4923                         break
4924                 }
4925                 v.reset(Op386MOVSSload)
4926                 v.AuxInt = int32ToAuxInt(off1 + off2)
4927                 v.Aux = symToAux(mergeSym(sym1, sym2))
4928                 v.AddArg2(base, mem)
4929                 return true
4930         }
4931         return false
4932 }
4933 func rewriteValue386_Op386MOVSSstore(v *Value) bool {
4934         v_2 := v.Args[2]
4935         v_1 := v.Args[1]
4936         v_0 := v.Args[0]
4937         b := v.Block
4938         config := b.Func.Config
4939         // match: (MOVSSstore [off1] {sym} (ADDLconst [off2] ptr) val mem)
4940         // cond: is32Bit(int64(off1)+int64(off2))
4941         // result: (MOVSSstore [off1+off2] {sym} ptr val mem)
4942         for {
4943                 off1 := auxIntToInt32(v.AuxInt)
4944                 sym := auxToSym(v.Aux)
4945                 if v_0.Op != Op386ADDLconst {
4946                         break
4947                 }
4948                 off2 := auxIntToInt32(v_0.AuxInt)
4949                 ptr := v_0.Args[0]
4950                 val := v_1
4951                 mem := v_2
4952                 if !(is32Bit(int64(off1) + int64(off2))) {
4953                         break
4954                 }
4955                 v.reset(Op386MOVSSstore)
4956                 v.AuxInt = int32ToAuxInt(off1 + off2)
4957                 v.Aux = symToAux(sym)
4958                 v.AddArg3(ptr, val, mem)
4959                 return true
4960         }
4961         // match: (MOVSSstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
4962         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
4963         // result: (MOVSSstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
4964         for {
4965                 off1 := auxIntToInt32(v.AuxInt)
4966                 sym1 := auxToSym(v.Aux)
4967                 if v_0.Op != Op386LEAL {
4968                         break
4969                 }
4970                 off2 := auxIntToInt32(v_0.AuxInt)
4971                 sym2 := auxToSym(v_0.Aux)
4972                 base := v_0.Args[0]
4973                 val := v_1
4974                 mem := v_2
4975                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
4976                         break
4977                 }
4978                 v.reset(Op386MOVSSstore)
4979                 v.AuxInt = int32ToAuxInt(off1 + off2)
4980                 v.Aux = symToAux(mergeSym(sym1, sym2))
4981                 v.AddArg3(base, val, mem)
4982                 return true
4983         }
4984         return false
4985 }
4986 func rewriteValue386_Op386MOVWLSX(v *Value) bool {
4987         v_0 := v.Args[0]
4988         b := v.Block
4989         // match: (MOVWLSX x:(MOVWload [off] {sym} ptr mem))
4990         // cond: x.Uses == 1 && clobber(x)
4991         // result: @x.Block (MOVWLSXload <v.Type> [off] {sym} ptr mem)
4992         for {
4993                 x := v_0
4994                 if x.Op != Op386MOVWload {
4995                         break
4996                 }
4997                 off := auxIntToInt32(x.AuxInt)
4998                 sym := auxToSym(x.Aux)
4999                 mem := x.Args[1]
5000                 ptr := x.Args[0]
5001                 if !(x.Uses == 1 && clobber(x)) {
5002                         break
5003                 }
5004                 b = x.Block
5005                 v0 := b.NewValue0(x.Pos, Op386MOVWLSXload, v.Type)
5006                 v.copyOf(v0)
5007                 v0.AuxInt = int32ToAuxInt(off)
5008                 v0.Aux = symToAux(sym)
5009                 v0.AddArg2(ptr, mem)
5010                 return true
5011         }
5012         // match: (MOVWLSX (ANDLconst [c] x))
5013         // cond: c & 0x8000 == 0
5014         // result: (ANDLconst [c & 0x7fff] x)
5015         for {
5016                 if v_0.Op != Op386ANDLconst {
5017                         break
5018                 }
5019                 c := auxIntToInt32(v_0.AuxInt)
5020                 x := v_0.Args[0]
5021                 if !(c&0x8000 == 0) {
5022                         break
5023                 }
5024                 v.reset(Op386ANDLconst)
5025                 v.AuxInt = int32ToAuxInt(c & 0x7fff)
5026                 v.AddArg(x)
5027                 return true
5028         }
5029         return false
5030 }
5031 func rewriteValue386_Op386MOVWLSXload(v *Value) bool {
5032         v_1 := v.Args[1]
5033         v_0 := v.Args[0]
5034         b := v.Block
5035         config := b.Func.Config
5036         // match: (MOVWLSXload [off] {sym} ptr (MOVWstore [off2] {sym2} ptr2 x _))
5037         // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
5038         // result: (MOVWLSX x)
5039         for {
5040                 off := auxIntToInt32(v.AuxInt)
5041                 sym := auxToSym(v.Aux)
5042                 ptr := v_0
5043                 if v_1.Op != Op386MOVWstore {
5044                         break
5045                 }
5046                 off2 := auxIntToInt32(v_1.AuxInt)
5047                 sym2 := auxToSym(v_1.Aux)
5048                 x := v_1.Args[1]
5049                 ptr2 := v_1.Args[0]
5050                 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
5051                         break
5052                 }
5053                 v.reset(Op386MOVWLSX)
5054                 v.AddArg(x)
5055                 return true
5056         }
5057         // match: (MOVWLSXload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
5058         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
5059         // result: (MOVWLSXload [off1+off2] {mergeSym(sym1,sym2)} base mem)
5060         for {
5061                 off1 := auxIntToInt32(v.AuxInt)
5062                 sym1 := auxToSym(v.Aux)
5063                 if v_0.Op != Op386LEAL {
5064                         break
5065                 }
5066                 off2 := auxIntToInt32(v_0.AuxInt)
5067                 sym2 := auxToSym(v_0.Aux)
5068                 base := v_0.Args[0]
5069                 mem := v_1
5070                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
5071                         break
5072                 }
5073                 v.reset(Op386MOVWLSXload)
5074                 v.AuxInt = int32ToAuxInt(off1 + off2)
5075                 v.Aux = symToAux(mergeSym(sym1, sym2))
5076                 v.AddArg2(base, mem)
5077                 return true
5078         }
5079         return false
5080 }
5081 func rewriteValue386_Op386MOVWLZX(v *Value) bool {
5082         v_0 := v.Args[0]
5083         b := v.Block
5084         // match: (MOVWLZX x:(MOVWload [off] {sym} ptr mem))
5085         // cond: x.Uses == 1 && clobber(x)
5086         // result: @x.Block (MOVWload <v.Type> [off] {sym} ptr mem)
5087         for {
5088                 x := v_0
5089                 if x.Op != Op386MOVWload {
5090                         break
5091                 }
5092                 off := auxIntToInt32(x.AuxInt)
5093                 sym := auxToSym(x.Aux)
5094                 mem := x.Args[1]
5095                 ptr := x.Args[0]
5096                 if !(x.Uses == 1 && clobber(x)) {
5097                         break
5098                 }
5099                 b = x.Block
5100                 v0 := b.NewValue0(x.Pos, Op386MOVWload, v.Type)
5101                 v.copyOf(v0)
5102                 v0.AuxInt = int32ToAuxInt(off)
5103                 v0.Aux = symToAux(sym)
5104                 v0.AddArg2(ptr, mem)
5105                 return true
5106         }
5107         // match: (MOVWLZX (ANDLconst [c] x))
5108         // result: (ANDLconst [c & 0xffff] x)
5109         for {
5110                 if v_0.Op != Op386ANDLconst {
5111                         break
5112                 }
5113                 c := auxIntToInt32(v_0.AuxInt)
5114                 x := v_0.Args[0]
5115                 v.reset(Op386ANDLconst)
5116                 v.AuxInt = int32ToAuxInt(c & 0xffff)
5117                 v.AddArg(x)
5118                 return true
5119         }
5120         return false
5121 }
5122 func rewriteValue386_Op386MOVWload(v *Value) bool {
5123         v_1 := v.Args[1]
5124         v_0 := v.Args[0]
5125         b := v.Block
5126         config := b.Func.Config
5127         // match: (MOVWload [off] {sym} ptr (MOVWstore [off2] {sym2} ptr2 x _))
5128         // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
5129         // result: (MOVWLZX x)
5130         for {
5131                 off := auxIntToInt32(v.AuxInt)
5132                 sym := auxToSym(v.Aux)
5133                 ptr := v_0
5134                 if v_1.Op != Op386MOVWstore {
5135                         break
5136                 }
5137                 off2 := auxIntToInt32(v_1.AuxInt)
5138                 sym2 := auxToSym(v_1.Aux)
5139                 x := v_1.Args[1]
5140                 ptr2 := v_1.Args[0]
5141                 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
5142                         break
5143                 }
5144                 v.reset(Op386MOVWLZX)
5145                 v.AddArg(x)
5146                 return true
5147         }
5148         // match: (MOVWload [off1] {sym} (ADDLconst [off2] ptr) mem)
5149         // cond: is32Bit(int64(off1)+int64(off2))
5150         // result: (MOVWload [off1+off2] {sym} ptr mem)
5151         for {
5152                 off1 := auxIntToInt32(v.AuxInt)
5153                 sym := auxToSym(v.Aux)
5154                 if v_0.Op != Op386ADDLconst {
5155                         break
5156                 }
5157                 off2 := auxIntToInt32(v_0.AuxInt)
5158                 ptr := v_0.Args[0]
5159                 mem := v_1
5160                 if !(is32Bit(int64(off1) + int64(off2))) {
5161                         break
5162                 }
5163                 v.reset(Op386MOVWload)
5164                 v.AuxInt = int32ToAuxInt(off1 + off2)
5165                 v.Aux = symToAux(sym)
5166                 v.AddArg2(ptr, mem)
5167                 return true
5168         }
5169         // match: (MOVWload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
5170         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
5171         // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} base mem)
5172         for {
5173                 off1 := auxIntToInt32(v.AuxInt)
5174                 sym1 := auxToSym(v.Aux)
5175                 if v_0.Op != Op386LEAL {
5176                         break
5177                 }
5178                 off2 := auxIntToInt32(v_0.AuxInt)
5179                 sym2 := auxToSym(v_0.Aux)
5180                 base := v_0.Args[0]
5181                 mem := v_1
5182                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
5183                         break
5184                 }
5185                 v.reset(Op386MOVWload)
5186                 v.AuxInt = int32ToAuxInt(off1 + off2)
5187                 v.Aux = symToAux(mergeSym(sym1, sym2))
5188                 v.AddArg2(base, mem)
5189                 return true
5190         }
5191         // match: (MOVWload [off] {sym} (SB) _)
5192         // cond: symIsRO(sym)
5193         // result: (MOVLconst [int32(read16(sym, int64(off), config.ctxt.Arch.ByteOrder))])
5194         for {
5195                 off := auxIntToInt32(v.AuxInt)
5196                 sym := auxToSym(v.Aux)
5197                 if v_0.Op != OpSB || !(symIsRO(sym)) {
5198                         break
5199                 }
5200                 v.reset(Op386MOVLconst)
5201                 v.AuxInt = int32ToAuxInt(int32(read16(sym, int64(off), config.ctxt.Arch.ByteOrder)))
5202                 return true
5203         }
5204         return false
5205 }
5206 func rewriteValue386_Op386MOVWstore(v *Value) bool {
5207         v_2 := v.Args[2]
5208         v_1 := v.Args[1]
5209         v_0 := v.Args[0]
5210         b := v.Block
5211         config := b.Func.Config
5212         // match: (MOVWstore [off] {sym} ptr (MOVWLSX x) mem)
5213         // result: (MOVWstore [off] {sym} ptr x mem)
5214         for {
5215                 off := auxIntToInt32(v.AuxInt)
5216                 sym := auxToSym(v.Aux)
5217                 ptr := v_0
5218                 if v_1.Op != Op386MOVWLSX {
5219                         break
5220                 }
5221                 x := v_1.Args[0]
5222                 mem := v_2
5223                 v.reset(Op386MOVWstore)
5224                 v.AuxInt = int32ToAuxInt(off)
5225                 v.Aux = symToAux(sym)
5226                 v.AddArg3(ptr, x, mem)
5227                 return true
5228         }
5229         // match: (MOVWstore [off] {sym} ptr (MOVWLZX x) mem)
5230         // result: (MOVWstore [off] {sym} ptr x mem)
5231         for {
5232                 off := auxIntToInt32(v.AuxInt)
5233                 sym := auxToSym(v.Aux)
5234                 ptr := v_0
5235                 if v_1.Op != Op386MOVWLZX {
5236                         break
5237                 }
5238                 x := v_1.Args[0]
5239                 mem := v_2
5240                 v.reset(Op386MOVWstore)
5241                 v.AuxInt = int32ToAuxInt(off)
5242                 v.Aux = symToAux(sym)
5243                 v.AddArg3(ptr, x, mem)
5244                 return true
5245         }
5246         // match: (MOVWstore [off1] {sym} (ADDLconst [off2] ptr) val mem)
5247         // cond: is32Bit(int64(off1)+int64(off2))
5248         // result: (MOVWstore [off1+off2] {sym} ptr val mem)
5249         for {
5250                 off1 := auxIntToInt32(v.AuxInt)
5251                 sym := auxToSym(v.Aux)
5252                 if v_0.Op != Op386ADDLconst {
5253                         break
5254                 }
5255                 off2 := auxIntToInt32(v_0.AuxInt)
5256                 ptr := v_0.Args[0]
5257                 val := v_1
5258                 mem := v_2
5259                 if !(is32Bit(int64(off1) + int64(off2))) {
5260                         break
5261                 }
5262                 v.reset(Op386MOVWstore)
5263                 v.AuxInt = int32ToAuxInt(off1 + off2)
5264                 v.Aux = symToAux(sym)
5265                 v.AddArg3(ptr, val, mem)
5266                 return true
5267         }
5268         // match: (MOVWstore [off] {sym} ptr (MOVLconst [c]) mem)
5269         // result: (MOVWstoreconst [makeValAndOff(c,off)] {sym} ptr mem)
5270         for {
5271                 off := auxIntToInt32(v.AuxInt)
5272                 sym := auxToSym(v.Aux)
5273                 ptr := v_0
5274                 if v_1.Op != Op386MOVLconst {
5275                         break
5276                 }
5277                 c := auxIntToInt32(v_1.AuxInt)
5278                 mem := v_2
5279                 v.reset(Op386MOVWstoreconst)
5280                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
5281                 v.Aux = symToAux(sym)
5282                 v.AddArg2(ptr, mem)
5283                 return true
5284         }
5285         // match: (MOVWstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
5286         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
5287         // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
5288         for {
5289                 off1 := auxIntToInt32(v.AuxInt)
5290                 sym1 := auxToSym(v.Aux)
5291                 if v_0.Op != Op386LEAL {
5292                         break
5293                 }
5294                 off2 := auxIntToInt32(v_0.AuxInt)
5295                 sym2 := auxToSym(v_0.Aux)
5296                 base := v_0.Args[0]
5297                 val := v_1
5298                 mem := v_2
5299                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
5300                         break
5301                 }
5302                 v.reset(Op386MOVWstore)
5303                 v.AuxInt = int32ToAuxInt(off1 + off2)
5304                 v.Aux = symToAux(mergeSym(sym1, sym2))
5305                 v.AddArg3(base, val, mem)
5306                 return true
5307         }
5308         // match: (MOVWstore [i] {s} p (SHRLconst [16] w) x:(MOVWstore [i-2] {s} p w mem))
5309         // cond: x.Uses == 1 && clobber(x)
5310         // result: (MOVLstore [i-2] {s} p w mem)
5311         for {
5312                 i := auxIntToInt32(v.AuxInt)
5313                 s := auxToSym(v.Aux)
5314                 p := v_0
5315                 if v_1.Op != Op386SHRLconst || auxIntToInt32(v_1.AuxInt) != 16 {
5316                         break
5317                 }
5318                 w := v_1.Args[0]
5319                 x := v_2
5320                 if x.Op != Op386MOVWstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s {
5321                         break
5322                 }
5323                 mem := x.Args[2]
5324                 if p != x.Args[0] || w != x.Args[1] || !(x.Uses == 1 && clobber(x)) {
5325                         break
5326                 }
5327                 v.reset(Op386MOVLstore)
5328                 v.AuxInt = int32ToAuxInt(i - 2)
5329                 v.Aux = symToAux(s)
5330                 v.AddArg3(p, w, mem)
5331                 return true
5332         }
5333         // match: (MOVWstore [i] {s} p (SHRLconst [j] w) x:(MOVWstore [i-2] {s} p w0:(SHRLconst [j-16] w) mem))
5334         // cond: x.Uses == 1 && clobber(x)
5335         // result: (MOVLstore [i-2] {s} p w0 mem)
5336         for {
5337                 i := auxIntToInt32(v.AuxInt)
5338                 s := auxToSym(v.Aux)
5339                 p := v_0
5340                 if v_1.Op != Op386SHRLconst {
5341                         break
5342                 }
5343                 j := auxIntToInt32(v_1.AuxInt)
5344                 w := v_1.Args[0]
5345                 x := v_2
5346                 if x.Op != Op386MOVWstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s {
5347                         break
5348                 }
5349                 mem := x.Args[2]
5350                 if p != x.Args[0] {
5351                         break
5352                 }
5353                 w0 := x.Args[1]
5354                 if w0.Op != Op386SHRLconst || auxIntToInt32(w0.AuxInt) != j-16 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) {
5355                         break
5356                 }
5357                 v.reset(Op386MOVLstore)
5358                 v.AuxInt = int32ToAuxInt(i - 2)
5359                 v.Aux = symToAux(s)
5360                 v.AddArg3(p, w0, mem)
5361                 return true
5362         }
5363         // match: (MOVWstore [i] {s} p1 (SHRLconst [16] w) x:(MOVWstore [i] {s} p0 w mem))
5364         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 2) && clobber(x)
5365         // result: (MOVLstore [i] {s} p0 w mem)
5366         for {
5367                 i := auxIntToInt32(v.AuxInt)
5368                 s := auxToSym(v.Aux)
5369                 p1 := v_0
5370                 if v_1.Op != Op386SHRLconst || auxIntToInt32(v_1.AuxInt) != 16 {
5371                         break
5372                 }
5373                 w := v_1.Args[0]
5374                 x := v_2
5375                 if x.Op != Op386MOVWstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
5376                         break
5377                 }
5378                 mem := x.Args[2]
5379                 p0 := x.Args[0]
5380                 if w != x.Args[1] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 2) && clobber(x)) {
5381                         break
5382                 }
5383                 v.reset(Op386MOVLstore)
5384                 v.AuxInt = int32ToAuxInt(i)
5385                 v.Aux = symToAux(s)
5386                 v.AddArg3(p0, w, mem)
5387                 return true
5388         }
5389         // match: (MOVWstore [i] {s} p1 (SHRLconst [j] w) x:(MOVWstore [i] {s} p0 w0:(SHRLconst [j-16] w) mem))
5390         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 2) && clobber(x)
5391         // result: (MOVLstore [i] {s} p0 w0 mem)
5392         for {
5393                 i := auxIntToInt32(v.AuxInt)
5394                 s := auxToSym(v.Aux)
5395                 p1 := v_0
5396                 if v_1.Op != Op386SHRLconst {
5397                         break
5398                 }
5399                 j := auxIntToInt32(v_1.AuxInt)
5400                 w := v_1.Args[0]
5401                 x := v_2
5402                 if x.Op != Op386MOVWstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
5403                         break
5404                 }
5405                 mem := x.Args[2]
5406                 p0 := x.Args[0]
5407                 w0 := x.Args[1]
5408                 if w0.Op != Op386SHRLconst || auxIntToInt32(w0.AuxInt) != j-16 || w != w0.Args[0] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 2) && clobber(x)) {
5409                         break
5410                 }
5411                 v.reset(Op386MOVLstore)
5412                 v.AuxInt = int32ToAuxInt(i)
5413                 v.Aux = symToAux(s)
5414                 v.AddArg3(p0, w0, mem)
5415                 return true
5416         }
5417         return false
5418 }
5419 func rewriteValue386_Op386MOVWstoreconst(v *Value) bool {
5420         v_1 := v.Args[1]
5421         v_0 := v.Args[0]
5422         b := v.Block
5423         config := b.Func.Config
5424         // match: (MOVWstoreconst [sc] {s} (ADDLconst [off] ptr) mem)
5425         // cond: sc.canAdd32(off)
5426         // result: (MOVWstoreconst [sc.addOffset32(off)] {s} ptr mem)
5427         for {
5428                 sc := auxIntToValAndOff(v.AuxInt)
5429                 s := auxToSym(v.Aux)
5430                 if v_0.Op != Op386ADDLconst {
5431                         break
5432                 }
5433                 off := auxIntToInt32(v_0.AuxInt)
5434                 ptr := v_0.Args[0]
5435                 mem := v_1
5436                 if !(sc.canAdd32(off)) {
5437                         break
5438                 }
5439                 v.reset(Op386MOVWstoreconst)
5440                 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
5441                 v.Aux = symToAux(s)
5442                 v.AddArg2(ptr, mem)
5443                 return true
5444         }
5445         // match: (MOVWstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem)
5446         // cond: canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)
5447         // result: (MOVWstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
5448         for {
5449                 sc := auxIntToValAndOff(v.AuxInt)
5450                 sym1 := auxToSym(v.Aux)
5451                 if v_0.Op != Op386LEAL {
5452                         break
5453                 }
5454                 off := auxIntToInt32(v_0.AuxInt)
5455                 sym2 := auxToSym(v_0.Aux)
5456                 ptr := v_0.Args[0]
5457                 mem := v_1
5458                 if !(canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)) {
5459                         break
5460                 }
5461                 v.reset(Op386MOVWstoreconst)
5462                 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
5463                 v.Aux = symToAux(mergeSym(sym1, sym2))
5464                 v.AddArg2(ptr, mem)
5465                 return true
5466         }
5467         // match: (MOVWstoreconst [c] {s} p x:(MOVWstoreconst [a] {s} p mem))
5468         // cond: x.Uses == 1 && a.Off() + 2 == c.Off() && clobber(x)
5469         // result: (MOVLstoreconst [makeValAndOff(a.Val()&0xffff | c.Val()<<16, a.Off())] {s} p mem)
5470         for {
5471                 c := auxIntToValAndOff(v.AuxInt)
5472                 s := auxToSym(v.Aux)
5473                 p := v_0
5474                 x := v_1
5475                 if x.Op != Op386MOVWstoreconst {
5476                         break
5477                 }
5478                 a := auxIntToValAndOff(x.AuxInt)
5479                 if auxToSym(x.Aux) != s {
5480                         break
5481                 }
5482                 mem := x.Args[1]
5483                 if p != x.Args[0] || !(x.Uses == 1 && a.Off()+2 == c.Off() && clobber(x)) {
5484                         break
5485                 }
5486                 v.reset(Op386MOVLstoreconst)
5487                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xffff|c.Val()<<16, a.Off()))
5488                 v.Aux = symToAux(s)
5489                 v.AddArg2(p, mem)
5490                 return true
5491         }
5492         // match: (MOVWstoreconst [a] {s} p x:(MOVWstoreconst [c] {s} p mem))
5493         // cond: x.Uses == 1 && ValAndOff(a).Off() + 2 == ValAndOff(c).Off() && clobber(x)
5494         // result: (MOVLstoreconst [makeValAndOff(a.Val()&0xffff | c.Val()<<16, a.Off())] {s} p mem)
5495         for {
5496                 a := auxIntToValAndOff(v.AuxInt)
5497                 s := auxToSym(v.Aux)
5498                 p := v_0
5499                 x := v_1
5500                 if x.Op != Op386MOVWstoreconst {
5501                         break
5502                 }
5503                 c := auxIntToValAndOff(x.AuxInt)
5504                 if auxToSym(x.Aux) != s {
5505                         break
5506                 }
5507                 mem := x.Args[1]
5508                 if p != x.Args[0] || !(x.Uses == 1 && ValAndOff(a).Off()+2 == ValAndOff(c).Off() && clobber(x)) {
5509                         break
5510                 }
5511                 v.reset(Op386MOVLstoreconst)
5512                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xffff|c.Val()<<16, a.Off()))
5513                 v.Aux = symToAux(s)
5514                 v.AddArg2(p, mem)
5515                 return true
5516         }
5517         // match: (MOVWstoreconst [c] {s} p1 x:(MOVWstoreconst [a] {s} p0 mem))
5518         // cond: x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 2) && clobber(x)
5519         // result: (MOVLstoreconst [makeValAndOff(a.Val()&0xffff | c.Val()<<16, a.Off())] {s} p0 mem)
5520         for {
5521                 c := auxIntToValAndOff(v.AuxInt)
5522                 s := auxToSym(v.Aux)
5523                 p1 := v_0
5524                 x := v_1
5525                 if x.Op != Op386MOVWstoreconst {
5526                         break
5527                 }
5528                 a := auxIntToValAndOff(x.AuxInt)
5529                 if auxToSym(x.Aux) != s {
5530                         break
5531                 }
5532                 mem := x.Args[1]
5533                 p0 := x.Args[0]
5534                 if !(x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 2) && clobber(x)) {
5535                         break
5536                 }
5537                 v.reset(Op386MOVLstoreconst)
5538                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xffff|c.Val()<<16, a.Off()))
5539                 v.Aux = symToAux(s)
5540                 v.AddArg2(p0, mem)
5541                 return true
5542         }
5543         // match: (MOVWstoreconst [a] {s} p0 x:(MOVWstoreconst [c] {s} p1 mem))
5544         // cond: x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 2) && clobber(x)
5545         // result: (MOVLstoreconst [makeValAndOff(a.Val()&0xffff | c.Val()<<16, a.Off())] {s} p0 mem)
5546         for {
5547                 a := auxIntToValAndOff(v.AuxInt)
5548                 s := auxToSym(v.Aux)
5549                 p0 := v_0
5550                 x := v_1
5551                 if x.Op != Op386MOVWstoreconst {
5552                         break
5553                 }
5554                 c := auxIntToValAndOff(x.AuxInt)
5555                 if auxToSym(x.Aux) != s {
5556                         break
5557                 }
5558                 mem := x.Args[1]
5559                 p1 := x.Args[0]
5560                 if !(x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 2) && clobber(x)) {
5561                         break
5562                 }
5563                 v.reset(Op386MOVLstoreconst)
5564                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xffff|c.Val()<<16, a.Off()))
5565                 v.Aux = symToAux(s)
5566                 v.AddArg2(p0, mem)
5567                 return true
5568         }
5569         return false
5570 }
5571 func rewriteValue386_Op386MULL(v *Value) bool {
5572         v_1 := v.Args[1]
5573         v_0 := v.Args[0]
5574         // match: (MULL x (MOVLconst [c]))
5575         // result: (MULLconst [c] x)
5576         for {
5577                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5578                         x := v_0
5579                         if v_1.Op != Op386MOVLconst {
5580                                 continue
5581                         }
5582                         c := auxIntToInt32(v_1.AuxInt)
5583                         v.reset(Op386MULLconst)
5584                         v.AuxInt = int32ToAuxInt(c)
5585                         v.AddArg(x)
5586                         return true
5587                 }
5588                 break
5589         }
5590         // match: (MULL x l:(MOVLload [off] {sym} ptr mem))
5591         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
5592         // result: (MULLload x [off] {sym} ptr mem)
5593         for {
5594                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5595                         x := v_0
5596                         l := v_1
5597                         if l.Op != Op386MOVLload {
5598                                 continue
5599                         }
5600                         off := auxIntToInt32(l.AuxInt)
5601                         sym := auxToSym(l.Aux)
5602                         mem := l.Args[1]
5603                         ptr := l.Args[0]
5604                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
5605                                 continue
5606                         }
5607                         v.reset(Op386MULLload)
5608                         v.AuxInt = int32ToAuxInt(off)
5609                         v.Aux = symToAux(sym)
5610                         v.AddArg3(x, ptr, mem)
5611                         return true
5612                 }
5613                 break
5614         }
5615         return false
5616 }
5617 func rewriteValue386_Op386MULLconst(v *Value) bool {
5618         v_0 := v.Args[0]
5619         b := v.Block
5620         // match: (MULLconst [c] (MULLconst [d] x))
5621         // result: (MULLconst [c * d] x)
5622         for {
5623                 c := auxIntToInt32(v.AuxInt)
5624                 if v_0.Op != Op386MULLconst {
5625                         break
5626                 }
5627                 d := auxIntToInt32(v_0.AuxInt)
5628                 x := v_0.Args[0]
5629                 v.reset(Op386MULLconst)
5630                 v.AuxInt = int32ToAuxInt(c * d)
5631                 v.AddArg(x)
5632                 return true
5633         }
5634         // match: (MULLconst [-9] x)
5635         // result: (NEGL (LEAL8 <v.Type> x x))
5636         for {
5637                 if auxIntToInt32(v.AuxInt) != -9 {
5638                         break
5639                 }
5640                 x := v_0
5641                 v.reset(Op386NEGL)
5642                 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type)
5643                 v0.AddArg2(x, x)
5644                 v.AddArg(v0)
5645                 return true
5646         }
5647         // match: (MULLconst [-5] x)
5648         // result: (NEGL (LEAL4 <v.Type> x x))
5649         for {
5650                 if auxIntToInt32(v.AuxInt) != -5 {
5651                         break
5652                 }
5653                 x := v_0
5654                 v.reset(Op386NEGL)
5655                 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type)
5656                 v0.AddArg2(x, x)
5657                 v.AddArg(v0)
5658                 return true
5659         }
5660         // match: (MULLconst [-3] x)
5661         // result: (NEGL (LEAL2 <v.Type> x x))
5662         for {
5663                 if auxIntToInt32(v.AuxInt) != -3 {
5664                         break
5665                 }
5666                 x := v_0
5667                 v.reset(Op386NEGL)
5668                 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type)
5669                 v0.AddArg2(x, x)
5670                 v.AddArg(v0)
5671                 return true
5672         }
5673         // match: (MULLconst [-1] x)
5674         // result: (NEGL x)
5675         for {
5676                 if auxIntToInt32(v.AuxInt) != -1 {
5677                         break
5678                 }
5679                 x := v_0
5680                 v.reset(Op386NEGL)
5681                 v.AddArg(x)
5682                 return true
5683         }
5684         // match: (MULLconst [0] _)
5685         // result: (MOVLconst [0])
5686         for {
5687                 if auxIntToInt32(v.AuxInt) != 0 {
5688                         break
5689                 }
5690                 v.reset(Op386MOVLconst)
5691                 v.AuxInt = int32ToAuxInt(0)
5692                 return true
5693         }
5694         // match: (MULLconst [1] x)
5695         // result: x
5696         for {
5697                 if auxIntToInt32(v.AuxInt) != 1 {
5698                         break
5699                 }
5700                 x := v_0
5701                 v.copyOf(x)
5702                 return true
5703         }
5704         // match: (MULLconst [3] x)
5705         // result: (LEAL2 x x)
5706         for {
5707                 if auxIntToInt32(v.AuxInt) != 3 {
5708                         break
5709                 }
5710                 x := v_0
5711                 v.reset(Op386LEAL2)
5712                 v.AddArg2(x, x)
5713                 return true
5714         }
5715         // match: (MULLconst [5] x)
5716         // result: (LEAL4 x x)
5717         for {
5718                 if auxIntToInt32(v.AuxInt) != 5 {
5719                         break
5720                 }
5721                 x := v_0
5722                 v.reset(Op386LEAL4)
5723                 v.AddArg2(x, x)
5724                 return true
5725         }
5726         // match: (MULLconst [7] x)
5727         // result: (LEAL2 x (LEAL2 <v.Type> x x))
5728         for {
5729                 if auxIntToInt32(v.AuxInt) != 7 {
5730                         break
5731                 }
5732                 x := v_0
5733                 v.reset(Op386LEAL2)
5734                 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type)
5735                 v0.AddArg2(x, x)
5736                 v.AddArg2(x, v0)
5737                 return true
5738         }
5739         // match: (MULLconst [9] x)
5740         // result: (LEAL8 x x)
5741         for {
5742                 if auxIntToInt32(v.AuxInt) != 9 {
5743                         break
5744                 }
5745                 x := v_0
5746                 v.reset(Op386LEAL8)
5747                 v.AddArg2(x, x)
5748                 return true
5749         }
5750         // match: (MULLconst [11] x)
5751         // result: (LEAL2 x (LEAL4 <v.Type> x x))
5752         for {
5753                 if auxIntToInt32(v.AuxInt) != 11 {
5754                         break
5755                 }
5756                 x := v_0
5757                 v.reset(Op386LEAL2)
5758                 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type)
5759                 v0.AddArg2(x, x)
5760                 v.AddArg2(x, v0)
5761                 return true
5762         }
5763         // match: (MULLconst [13] x)
5764         // result: (LEAL4 x (LEAL2 <v.Type> x x))
5765         for {
5766                 if auxIntToInt32(v.AuxInt) != 13 {
5767                         break
5768                 }
5769                 x := v_0
5770                 v.reset(Op386LEAL4)
5771                 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type)
5772                 v0.AddArg2(x, x)
5773                 v.AddArg2(x, v0)
5774                 return true
5775         }
5776         // match: (MULLconst [19] x)
5777         // result: (LEAL2 x (LEAL8 <v.Type> x x))
5778         for {
5779                 if auxIntToInt32(v.AuxInt) != 19 {
5780                         break
5781                 }
5782                 x := v_0
5783                 v.reset(Op386LEAL2)
5784                 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type)
5785                 v0.AddArg2(x, x)
5786                 v.AddArg2(x, v0)
5787                 return true
5788         }
5789         // match: (MULLconst [21] x)
5790         // result: (LEAL4 x (LEAL4 <v.Type> x x))
5791         for {
5792                 if auxIntToInt32(v.AuxInt) != 21 {
5793                         break
5794                 }
5795                 x := v_0
5796                 v.reset(Op386LEAL4)
5797                 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type)
5798                 v0.AddArg2(x, x)
5799                 v.AddArg2(x, v0)
5800                 return true
5801         }
5802         // match: (MULLconst [25] x)
5803         // result: (LEAL8 x (LEAL2 <v.Type> x x))
5804         for {
5805                 if auxIntToInt32(v.AuxInt) != 25 {
5806                         break
5807                 }
5808                 x := v_0
5809                 v.reset(Op386LEAL8)
5810                 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type)
5811                 v0.AddArg2(x, x)
5812                 v.AddArg2(x, v0)
5813                 return true
5814         }
5815         // match: (MULLconst [27] x)
5816         // result: (LEAL8 (LEAL2 <v.Type> x x) (LEAL2 <v.Type> x x))
5817         for {
5818                 if auxIntToInt32(v.AuxInt) != 27 {
5819                         break
5820                 }
5821                 x := v_0
5822                 v.reset(Op386LEAL8)
5823                 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type)
5824                 v0.AddArg2(x, x)
5825                 v.AddArg2(v0, v0)
5826                 return true
5827         }
5828         // match: (MULLconst [37] x)
5829         // result: (LEAL4 x (LEAL8 <v.Type> x x))
5830         for {
5831                 if auxIntToInt32(v.AuxInt) != 37 {
5832                         break
5833                 }
5834                 x := v_0
5835                 v.reset(Op386LEAL4)
5836                 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type)
5837                 v0.AddArg2(x, x)
5838                 v.AddArg2(x, v0)
5839                 return true
5840         }
5841         // match: (MULLconst [41] x)
5842         // result: (LEAL8 x (LEAL4 <v.Type> x x))
5843         for {
5844                 if auxIntToInt32(v.AuxInt) != 41 {
5845                         break
5846                 }
5847                 x := v_0
5848                 v.reset(Op386LEAL8)
5849                 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type)
5850                 v0.AddArg2(x, x)
5851                 v.AddArg2(x, v0)
5852                 return true
5853         }
5854         // match: (MULLconst [45] x)
5855         // result: (LEAL8 (LEAL4 <v.Type> x x) (LEAL4 <v.Type> x x))
5856         for {
5857                 if auxIntToInt32(v.AuxInt) != 45 {
5858                         break
5859                 }
5860                 x := v_0
5861                 v.reset(Op386LEAL8)
5862                 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type)
5863                 v0.AddArg2(x, x)
5864                 v.AddArg2(v0, v0)
5865                 return true
5866         }
5867         // match: (MULLconst [73] x)
5868         // result: (LEAL8 x (LEAL8 <v.Type> x x))
5869         for {
5870                 if auxIntToInt32(v.AuxInt) != 73 {
5871                         break
5872                 }
5873                 x := v_0
5874                 v.reset(Op386LEAL8)
5875                 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type)
5876                 v0.AddArg2(x, x)
5877                 v.AddArg2(x, v0)
5878                 return true
5879         }
5880         // match: (MULLconst [81] x)
5881         // result: (LEAL8 (LEAL8 <v.Type> x x) (LEAL8 <v.Type> x x))
5882         for {
5883                 if auxIntToInt32(v.AuxInt) != 81 {
5884                         break
5885                 }
5886                 x := v_0
5887                 v.reset(Op386LEAL8)
5888                 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type)
5889                 v0.AddArg2(x, x)
5890                 v.AddArg2(v0, v0)
5891                 return true
5892         }
5893         // match: (MULLconst [c] x)
5894         // cond: isPowerOfTwo32(c+1) && c >= 15
5895         // result: (SUBL (SHLLconst <v.Type> [int32(log32(c+1))] x) x)
5896         for {
5897                 c := auxIntToInt32(v.AuxInt)
5898                 x := v_0
5899                 if !(isPowerOfTwo32(c+1) && c >= 15) {
5900                         break
5901                 }
5902                 v.reset(Op386SUBL)
5903                 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type)
5904                 v0.AuxInt = int32ToAuxInt(int32(log32(c + 1)))
5905                 v0.AddArg(x)
5906                 v.AddArg2(v0, x)
5907                 return true
5908         }
5909         // match: (MULLconst [c] x)
5910         // cond: isPowerOfTwo32(c-1) && c >= 17
5911         // result: (LEAL1 (SHLLconst <v.Type> [int32(log32(c-1))] x) x)
5912         for {
5913                 c := auxIntToInt32(v.AuxInt)
5914                 x := v_0
5915                 if !(isPowerOfTwo32(c-1) && c >= 17) {
5916                         break
5917                 }
5918                 v.reset(Op386LEAL1)
5919                 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type)
5920                 v0.AuxInt = int32ToAuxInt(int32(log32(c - 1)))
5921                 v0.AddArg(x)
5922                 v.AddArg2(v0, x)
5923                 return true
5924         }
5925         // match: (MULLconst [c] x)
5926         // cond: isPowerOfTwo32(c-2) && c >= 34
5927         // result: (LEAL2 (SHLLconst <v.Type> [int32(log32(c-2))] x) x)
5928         for {
5929                 c := auxIntToInt32(v.AuxInt)
5930                 x := v_0
5931                 if !(isPowerOfTwo32(c-2) && c >= 34) {
5932                         break
5933                 }
5934                 v.reset(Op386LEAL2)
5935                 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type)
5936                 v0.AuxInt = int32ToAuxInt(int32(log32(c - 2)))
5937                 v0.AddArg(x)
5938                 v.AddArg2(v0, x)
5939                 return true
5940         }
5941         // match: (MULLconst [c] x)
5942         // cond: isPowerOfTwo32(c-4) && c >= 68
5943         // result: (LEAL4 (SHLLconst <v.Type> [int32(log32(c-4))] x) x)
5944         for {
5945                 c := auxIntToInt32(v.AuxInt)
5946                 x := v_0
5947                 if !(isPowerOfTwo32(c-4) && c >= 68) {
5948                         break
5949                 }
5950                 v.reset(Op386LEAL4)
5951                 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type)
5952                 v0.AuxInt = int32ToAuxInt(int32(log32(c - 4)))
5953                 v0.AddArg(x)
5954                 v.AddArg2(v0, x)
5955                 return true
5956         }
5957         // match: (MULLconst [c] x)
5958         // cond: isPowerOfTwo32(c-8) && c >= 136
5959         // result: (LEAL8 (SHLLconst <v.Type> [int32(log32(c-8))] x) x)
5960         for {
5961                 c := auxIntToInt32(v.AuxInt)
5962                 x := v_0
5963                 if !(isPowerOfTwo32(c-8) && c >= 136) {
5964                         break
5965                 }
5966                 v.reset(Op386LEAL8)
5967                 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type)
5968                 v0.AuxInt = int32ToAuxInt(int32(log32(c - 8)))
5969                 v0.AddArg(x)
5970                 v.AddArg2(v0, x)
5971                 return true
5972         }
5973         // match: (MULLconst [c] x)
5974         // cond: c%3 == 0 && isPowerOfTwo32(c/3)
5975         // result: (SHLLconst [int32(log32(c/3))] (LEAL2 <v.Type> x x))
5976         for {
5977                 c := auxIntToInt32(v.AuxInt)
5978                 x := v_0
5979                 if !(c%3 == 0 && isPowerOfTwo32(c/3)) {
5980                         break
5981                 }
5982                 v.reset(Op386SHLLconst)
5983                 v.AuxInt = int32ToAuxInt(int32(log32(c / 3)))
5984                 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type)
5985                 v0.AddArg2(x, x)
5986                 v.AddArg(v0)
5987                 return true
5988         }
5989         // match: (MULLconst [c] x)
5990         // cond: c%5 == 0 && isPowerOfTwo32(c/5)
5991         // result: (SHLLconst [int32(log32(c/5))] (LEAL4 <v.Type> x x))
5992         for {
5993                 c := auxIntToInt32(v.AuxInt)
5994                 x := v_0
5995                 if !(c%5 == 0 && isPowerOfTwo32(c/5)) {
5996                         break
5997                 }
5998                 v.reset(Op386SHLLconst)
5999                 v.AuxInt = int32ToAuxInt(int32(log32(c / 5)))
6000                 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type)
6001                 v0.AddArg2(x, x)
6002                 v.AddArg(v0)
6003                 return true
6004         }
6005         // match: (MULLconst [c] x)
6006         // cond: c%9 == 0 && isPowerOfTwo32(c/9)
6007         // result: (SHLLconst [int32(log32(c/9))] (LEAL8 <v.Type> x x))
6008         for {
6009                 c := auxIntToInt32(v.AuxInt)
6010                 x := v_0
6011                 if !(c%9 == 0 && isPowerOfTwo32(c/9)) {
6012                         break
6013                 }
6014                 v.reset(Op386SHLLconst)
6015                 v.AuxInt = int32ToAuxInt(int32(log32(c / 9)))
6016                 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type)
6017                 v0.AddArg2(x, x)
6018                 v.AddArg(v0)
6019                 return true
6020         }
6021         // match: (MULLconst [c] (MOVLconst [d]))
6022         // result: (MOVLconst [c*d])
6023         for {
6024                 c := auxIntToInt32(v.AuxInt)
6025                 if v_0.Op != Op386MOVLconst {
6026                         break
6027                 }
6028                 d := auxIntToInt32(v_0.AuxInt)
6029                 v.reset(Op386MOVLconst)
6030                 v.AuxInt = int32ToAuxInt(c * d)
6031                 return true
6032         }
6033         return false
6034 }
6035 func rewriteValue386_Op386MULLload(v *Value) bool {
6036         v_2 := v.Args[2]
6037         v_1 := v.Args[1]
6038         v_0 := v.Args[0]
6039         b := v.Block
6040         config := b.Func.Config
6041         // match: (MULLload [off1] {sym} val (ADDLconst [off2] base) mem)
6042         // cond: is32Bit(int64(off1)+int64(off2))
6043         // result: (MULLload [off1+off2] {sym} val base mem)
6044         for {
6045                 off1 := auxIntToInt32(v.AuxInt)
6046                 sym := auxToSym(v.Aux)
6047                 val := v_0
6048                 if v_1.Op != Op386ADDLconst {
6049                         break
6050                 }
6051                 off2 := auxIntToInt32(v_1.AuxInt)
6052                 base := v_1.Args[0]
6053                 mem := v_2
6054                 if !(is32Bit(int64(off1) + int64(off2))) {
6055                         break
6056                 }
6057                 v.reset(Op386MULLload)
6058                 v.AuxInt = int32ToAuxInt(off1 + off2)
6059                 v.Aux = symToAux(sym)
6060                 v.AddArg3(val, base, mem)
6061                 return true
6062         }
6063         // match: (MULLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
6064         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
6065         // result: (MULLload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
6066         for {
6067                 off1 := auxIntToInt32(v.AuxInt)
6068                 sym1 := auxToSym(v.Aux)
6069                 val := v_0
6070                 if v_1.Op != Op386LEAL {
6071                         break
6072                 }
6073                 off2 := auxIntToInt32(v_1.AuxInt)
6074                 sym2 := auxToSym(v_1.Aux)
6075                 base := v_1.Args[0]
6076                 mem := v_2
6077                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
6078                         break
6079                 }
6080                 v.reset(Op386MULLload)
6081                 v.AuxInt = int32ToAuxInt(off1 + off2)
6082                 v.Aux = symToAux(mergeSym(sym1, sym2))
6083                 v.AddArg3(val, base, mem)
6084                 return true
6085         }
6086         return false
6087 }
6088 func rewriteValue386_Op386MULSD(v *Value) bool {
6089         v_1 := v.Args[1]
6090         v_0 := v.Args[0]
6091         // match: (MULSD x l:(MOVSDload [off] {sym} ptr mem))
6092         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
6093         // result: (MULSDload x [off] {sym} ptr mem)
6094         for {
6095                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6096                         x := v_0
6097                         l := v_1
6098                         if l.Op != Op386MOVSDload {
6099                                 continue
6100                         }
6101                         off := auxIntToInt32(l.AuxInt)
6102                         sym := auxToSym(l.Aux)
6103                         mem := l.Args[1]
6104                         ptr := l.Args[0]
6105                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
6106                                 continue
6107                         }
6108                         v.reset(Op386MULSDload)
6109                         v.AuxInt = int32ToAuxInt(off)
6110                         v.Aux = symToAux(sym)
6111                         v.AddArg3(x, ptr, mem)
6112                         return true
6113                 }
6114                 break
6115         }
6116         return false
6117 }
6118 func rewriteValue386_Op386MULSDload(v *Value) bool {
6119         v_2 := v.Args[2]
6120         v_1 := v.Args[1]
6121         v_0 := v.Args[0]
6122         b := v.Block
6123         config := b.Func.Config
6124         // match: (MULSDload [off1] {sym} val (ADDLconst [off2] base) mem)
6125         // cond: is32Bit(int64(off1)+int64(off2))
6126         // result: (MULSDload [off1+off2] {sym} val base mem)
6127         for {
6128                 off1 := auxIntToInt32(v.AuxInt)
6129                 sym := auxToSym(v.Aux)
6130                 val := v_0
6131                 if v_1.Op != Op386ADDLconst {
6132                         break
6133                 }
6134                 off2 := auxIntToInt32(v_1.AuxInt)
6135                 base := v_1.Args[0]
6136                 mem := v_2
6137                 if !(is32Bit(int64(off1) + int64(off2))) {
6138                         break
6139                 }
6140                 v.reset(Op386MULSDload)
6141                 v.AuxInt = int32ToAuxInt(off1 + off2)
6142                 v.Aux = symToAux(sym)
6143                 v.AddArg3(val, base, mem)
6144                 return true
6145         }
6146         // match: (MULSDload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
6147         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
6148         // result: (MULSDload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
6149         for {
6150                 off1 := auxIntToInt32(v.AuxInt)
6151                 sym1 := auxToSym(v.Aux)
6152                 val := v_0
6153                 if v_1.Op != Op386LEAL {
6154                         break
6155                 }
6156                 off2 := auxIntToInt32(v_1.AuxInt)
6157                 sym2 := auxToSym(v_1.Aux)
6158                 base := v_1.Args[0]
6159                 mem := v_2
6160                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
6161                         break
6162                 }
6163                 v.reset(Op386MULSDload)
6164                 v.AuxInt = int32ToAuxInt(off1 + off2)
6165                 v.Aux = symToAux(mergeSym(sym1, sym2))
6166                 v.AddArg3(val, base, mem)
6167                 return true
6168         }
6169         return false
6170 }
6171 func rewriteValue386_Op386MULSS(v *Value) bool {
6172         v_1 := v.Args[1]
6173         v_0 := v.Args[0]
6174         // match: (MULSS x l:(MOVSSload [off] {sym} ptr mem))
6175         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
6176         // result: (MULSSload x [off] {sym} ptr mem)
6177         for {
6178                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6179                         x := v_0
6180                         l := v_1
6181                         if l.Op != Op386MOVSSload {
6182                                 continue
6183                         }
6184                         off := auxIntToInt32(l.AuxInt)
6185                         sym := auxToSym(l.Aux)
6186                         mem := l.Args[1]
6187                         ptr := l.Args[0]
6188                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
6189                                 continue
6190                         }
6191                         v.reset(Op386MULSSload)
6192                         v.AuxInt = int32ToAuxInt(off)
6193                         v.Aux = symToAux(sym)
6194                         v.AddArg3(x, ptr, mem)
6195                         return true
6196                 }
6197                 break
6198         }
6199         return false
6200 }
6201 func rewriteValue386_Op386MULSSload(v *Value) bool {
6202         v_2 := v.Args[2]
6203         v_1 := v.Args[1]
6204         v_0 := v.Args[0]
6205         b := v.Block
6206         config := b.Func.Config
6207         // match: (MULSSload [off1] {sym} val (ADDLconst [off2] base) mem)
6208         // cond: is32Bit(int64(off1)+int64(off2))
6209         // result: (MULSSload [off1+off2] {sym} val base mem)
6210         for {
6211                 off1 := auxIntToInt32(v.AuxInt)
6212                 sym := auxToSym(v.Aux)
6213                 val := v_0
6214                 if v_1.Op != Op386ADDLconst {
6215                         break
6216                 }
6217                 off2 := auxIntToInt32(v_1.AuxInt)
6218                 base := v_1.Args[0]
6219                 mem := v_2
6220                 if !(is32Bit(int64(off1) + int64(off2))) {
6221                         break
6222                 }
6223                 v.reset(Op386MULSSload)
6224                 v.AuxInt = int32ToAuxInt(off1 + off2)
6225                 v.Aux = symToAux(sym)
6226                 v.AddArg3(val, base, mem)
6227                 return true
6228         }
6229         // match: (MULSSload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
6230         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
6231         // result: (MULSSload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
6232         for {
6233                 off1 := auxIntToInt32(v.AuxInt)
6234                 sym1 := auxToSym(v.Aux)
6235                 val := v_0
6236                 if v_1.Op != Op386LEAL {
6237                         break
6238                 }
6239                 off2 := auxIntToInt32(v_1.AuxInt)
6240                 sym2 := auxToSym(v_1.Aux)
6241                 base := v_1.Args[0]
6242                 mem := v_2
6243                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
6244                         break
6245                 }
6246                 v.reset(Op386MULSSload)
6247                 v.AuxInt = int32ToAuxInt(off1 + off2)
6248                 v.Aux = symToAux(mergeSym(sym1, sym2))
6249                 v.AddArg3(val, base, mem)
6250                 return true
6251         }
6252         return false
6253 }
6254 func rewriteValue386_Op386NEGL(v *Value) bool {
6255         v_0 := v.Args[0]
6256         // match: (NEGL (MOVLconst [c]))
6257         // result: (MOVLconst [-c])
6258         for {
6259                 if v_0.Op != Op386MOVLconst {
6260                         break
6261                 }
6262                 c := auxIntToInt32(v_0.AuxInt)
6263                 v.reset(Op386MOVLconst)
6264                 v.AuxInt = int32ToAuxInt(-c)
6265                 return true
6266         }
6267         return false
6268 }
6269 func rewriteValue386_Op386NOTL(v *Value) bool {
6270         v_0 := v.Args[0]
6271         // match: (NOTL (MOVLconst [c]))
6272         // result: (MOVLconst [^c])
6273         for {
6274                 if v_0.Op != Op386MOVLconst {
6275                         break
6276                 }
6277                 c := auxIntToInt32(v_0.AuxInt)
6278                 v.reset(Op386MOVLconst)
6279                 v.AuxInt = int32ToAuxInt(^c)
6280                 return true
6281         }
6282         return false
6283 }
6284 func rewriteValue386_Op386ORL(v *Value) bool {
6285         v_1 := v.Args[1]
6286         v_0 := v.Args[0]
6287         b := v.Block
6288         typ := &b.Func.Config.Types
6289         // match: (ORL x (MOVLconst [c]))
6290         // result: (ORLconst [c] x)
6291         for {
6292                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6293                         x := v_0
6294                         if v_1.Op != Op386MOVLconst {
6295                                 continue
6296                         }
6297                         c := auxIntToInt32(v_1.AuxInt)
6298                         v.reset(Op386ORLconst)
6299                         v.AuxInt = int32ToAuxInt(c)
6300                         v.AddArg(x)
6301                         return true
6302                 }
6303                 break
6304         }
6305         // match: ( ORL (SHLLconst [c] x) (SHRLconst [d] x))
6306         // cond: d == 32-c
6307         // result: (ROLLconst [c] x)
6308         for {
6309                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6310                         if v_0.Op != Op386SHLLconst {
6311                                 continue
6312                         }
6313                         c := auxIntToInt32(v_0.AuxInt)
6314                         x := v_0.Args[0]
6315                         if v_1.Op != Op386SHRLconst {
6316                                 continue
6317                         }
6318                         d := auxIntToInt32(v_1.AuxInt)
6319                         if x != v_1.Args[0] || !(d == 32-c) {
6320                                 continue
6321                         }
6322                         v.reset(Op386ROLLconst)
6323                         v.AuxInt = int32ToAuxInt(c)
6324                         v.AddArg(x)
6325                         return true
6326                 }
6327                 break
6328         }
6329         // match: ( ORL <t> (SHLLconst x [c]) (SHRWconst x [d]))
6330         // cond: c < 16 && d == int16(16-c) && t.Size() == 2
6331         // result: (ROLWconst x [int16(c)])
6332         for {
6333                 t := v.Type
6334                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6335                         if v_0.Op != Op386SHLLconst {
6336                                 continue
6337                         }
6338                         c := auxIntToInt32(v_0.AuxInt)
6339                         x := v_0.Args[0]
6340                         if v_1.Op != Op386SHRWconst {
6341                                 continue
6342                         }
6343                         d := auxIntToInt16(v_1.AuxInt)
6344                         if x != v_1.Args[0] || !(c < 16 && d == int16(16-c) && t.Size() == 2) {
6345                                 continue
6346                         }
6347                         v.reset(Op386ROLWconst)
6348                         v.AuxInt = int16ToAuxInt(int16(c))
6349                         v.AddArg(x)
6350                         return true
6351                 }
6352                 break
6353         }
6354         // match: ( ORL <t> (SHLLconst x [c]) (SHRBconst x [d]))
6355         // cond: c < 8 && d == int8(8-c) && t.Size() == 1
6356         // result: (ROLBconst x [int8(c)])
6357         for {
6358                 t := v.Type
6359                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6360                         if v_0.Op != Op386SHLLconst {
6361                                 continue
6362                         }
6363                         c := auxIntToInt32(v_0.AuxInt)
6364                         x := v_0.Args[0]
6365                         if v_1.Op != Op386SHRBconst {
6366                                 continue
6367                         }
6368                         d := auxIntToInt8(v_1.AuxInt)
6369                         if x != v_1.Args[0] || !(c < 8 && d == int8(8-c) && t.Size() == 1) {
6370                                 continue
6371                         }
6372                         v.reset(Op386ROLBconst)
6373                         v.AuxInt = int8ToAuxInt(int8(c))
6374                         v.AddArg(x)
6375                         return true
6376                 }
6377                 break
6378         }
6379         // match: (ORL x l:(MOVLload [off] {sym} ptr mem))
6380         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
6381         // result: (ORLload x [off] {sym} ptr mem)
6382         for {
6383                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6384                         x := v_0
6385                         l := v_1
6386                         if l.Op != Op386MOVLload {
6387                                 continue
6388                         }
6389                         off := auxIntToInt32(l.AuxInt)
6390                         sym := auxToSym(l.Aux)
6391                         mem := l.Args[1]
6392                         ptr := l.Args[0]
6393                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
6394                                 continue
6395                         }
6396                         v.reset(Op386ORLload)
6397                         v.AuxInt = int32ToAuxInt(off)
6398                         v.Aux = symToAux(sym)
6399                         v.AddArg3(x, ptr, mem)
6400                         return true
6401                 }
6402                 break
6403         }
6404         // match: (ORL x x)
6405         // result: x
6406         for {
6407                 x := v_0
6408                 if x != v_1 {
6409                         break
6410                 }
6411                 v.copyOf(x)
6412                 return true
6413         }
6414         // match: (ORL x0:(MOVBload [i0] {s} p mem) s0:(SHLLconst [8] x1:(MOVBload [i1] {s} p mem)))
6415         // cond: i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, s0)
6416         // result: @mergePoint(b,x0,x1) (MOVWload [i0] {s} p mem)
6417         for {
6418                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6419                         x0 := v_0
6420                         if x0.Op != Op386MOVBload {
6421                                 continue
6422                         }
6423                         i0 := auxIntToInt32(x0.AuxInt)
6424                         s := auxToSym(x0.Aux)
6425                         mem := x0.Args[1]
6426                         p := x0.Args[0]
6427                         s0 := v_1
6428                         if s0.Op != Op386SHLLconst || auxIntToInt32(s0.AuxInt) != 8 {
6429                                 continue
6430                         }
6431                         x1 := s0.Args[0]
6432                         if x1.Op != Op386MOVBload {
6433                                 continue
6434                         }
6435                         i1 := auxIntToInt32(x1.AuxInt)
6436                         if auxToSym(x1.Aux) != s {
6437                                 continue
6438                         }
6439                         _ = x1.Args[1]
6440                         if p != x1.Args[0] || mem != x1.Args[1] || !(i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, s0)) {
6441                                 continue
6442                         }
6443                         b = mergePoint(b, x0, x1)
6444                         v0 := b.NewValue0(x1.Pos, Op386MOVWload, typ.UInt16)
6445                         v.copyOf(v0)
6446                         v0.AuxInt = int32ToAuxInt(i0)
6447                         v0.Aux = symToAux(s)
6448                         v0.AddArg2(p, mem)
6449                         return true
6450                 }
6451                 break
6452         }
6453         // match: (ORL x0:(MOVBload [i] {s} p0 mem) s0:(SHLLconst [8] x1:(MOVBload [i] {s} p1 mem)))
6454         // cond: x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && sequentialAddresses(p0, p1, 1) && mergePoint(b,x0,x1) != nil && clobber(x0, x1, s0)
6455         // result: @mergePoint(b,x0,x1) (MOVWload [i] {s} p0 mem)
6456         for {
6457                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6458                         x0 := v_0
6459                         if x0.Op != Op386MOVBload {
6460                                 continue
6461                         }
6462                         i := auxIntToInt32(x0.AuxInt)
6463                         s := auxToSym(x0.Aux)
6464                         mem := x0.Args[1]
6465                         p0 := x0.Args[0]
6466                         s0 := v_1
6467                         if s0.Op != Op386SHLLconst || auxIntToInt32(s0.AuxInt) != 8 {
6468                                 continue
6469                         }
6470                         x1 := s0.Args[0]
6471                         if x1.Op != Op386MOVBload || auxIntToInt32(x1.AuxInt) != i || auxToSym(x1.Aux) != s {
6472                                 continue
6473                         }
6474                         _ = x1.Args[1]
6475                         p1 := x1.Args[0]
6476                         if mem != x1.Args[1] || !(x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && sequentialAddresses(p0, p1, 1) && mergePoint(b, x0, x1) != nil && clobber(x0, x1, s0)) {
6477                                 continue
6478                         }
6479                         b = mergePoint(b, x0, x1)
6480                         v0 := b.NewValue0(x1.Pos, Op386MOVWload, typ.UInt16)
6481                         v.copyOf(v0)
6482                         v0.AuxInt = int32ToAuxInt(i)
6483                         v0.Aux = symToAux(s)
6484                         v0.AddArg2(p0, mem)
6485                         return true
6486                 }
6487                 break
6488         }
6489         // match: (ORL o0:(ORL x0:(MOVWload [i0] {s} p mem) s0:(SHLLconst [16] x1:(MOVBload [i2] {s} p mem))) s1:(SHLLconst [24] x2:(MOVBload [i3] {s} p mem)))
6490         // cond: i2 == i0+2 && i3 == i0+3 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && o0.Uses == 1 && mergePoint(b,x0,x1,x2) != nil && clobber(x0, x1, x2, s0, s1, o0)
6491         // result: @mergePoint(b,x0,x1,x2) (MOVLload [i0] {s} p mem)
6492         for {
6493                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6494                         o0 := v_0
6495                         if o0.Op != Op386ORL {
6496                                 continue
6497                         }
6498                         _ = o0.Args[1]
6499                         o0_0 := o0.Args[0]
6500                         o0_1 := o0.Args[1]
6501                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
6502                                 x0 := o0_0
6503                                 if x0.Op != Op386MOVWload {
6504                                         continue
6505                                 }
6506                                 i0 := auxIntToInt32(x0.AuxInt)
6507                                 s := auxToSym(x0.Aux)
6508                                 mem := x0.Args[1]
6509                                 p := x0.Args[0]
6510                                 s0 := o0_1
6511                                 if s0.Op != Op386SHLLconst || auxIntToInt32(s0.AuxInt) != 16 {
6512                                         continue
6513                                 }
6514                                 x1 := s0.Args[0]
6515                                 if x1.Op != Op386MOVBload {
6516                                         continue
6517                                 }
6518                                 i2 := auxIntToInt32(x1.AuxInt)
6519                                 if auxToSym(x1.Aux) != s {
6520                                         continue
6521                                 }
6522                                 _ = x1.Args[1]
6523                                 if p != x1.Args[0] || mem != x1.Args[1] {
6524                                         continue
6525                                 }
6526                                 s1 := v_1
6527                                 if s1.Op != Op386SHLLconst || auxIntToInt32(s1.AuxInt) != 24 {
6528                                         continue
6529                                 }
6530                                 x2 := s1.Args[0]
6531                                 if x2.Op != Op386MOVBload {
6532                                         continue
6533                                 }
6534                                 i3 := auxIntToInt32(x2.AuxInt)
6535                                 if auxToSym(x2.Aux) != s {
6536                                         continue
6537                                 }
6538                                 _ = x2.Args[1]
6539                                 if p != x2.Args[0] || mem != x2.Args[1] || !(i2 == i0+2 && i3 == i0+3 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && o0.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)) {
6540                                         continue
6541                                 }
6542                                 b = mergePoint(b, x0, x1, x2)
6543                                 v0 := b.NewValue0(x2.Pos, Op386MOVLload, typ.UInt32)
6544                                 v.copyOf(v0)
6545                                 v0.AuxInt = int32ToAuxInt(i0)
6546                                 v0.Aux = symToAux(s)
6547                                 v0.AddArg2(p, mem)
6548                                 return true
6549                         }
6550                 }
6551                 break
6552         }
6553         // match: (ORL o0:(ORL x0:(MOVWload [i] {s} p0 mem) s0:(SHLLconst [16] x1:(MOVBload [i] {s} p1 mem))) s1:(SHLLconst [24] x2:(MOVBload [i] {s} p2 mem)))
6554         // cond: x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && o0.Uses == 1 && sequentialAddresses(p0, p1, 2) && sequentialAddresses(p1, p2, 1) && mergePoint(b,x0,x1,x2) != nil && clobber(x0, x1, x2, s0, s1, o0)
6555         // result: @mergePoint(b,x0,x1,x2) (MOVLload [i] {s} p0 mem)
6556         for {
6557                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6558                         o0 := v_0
6559                         if o0.Op != Op386ORL {
6560                                 continue
6561                         }
6562                         _ = o0.Args[1]
6563                         o0_0 := o0.Args[0]
6564                         o0_1 := o0.Args[1]
6565                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
6566                                 x0 := o0_0
6567                                 if x0.Op != Op386MOVWload {
6568                                         continue
6569                                 }
6570                                 i := auxIntToInt32(x0.AuxInt)
6571                                 s := auxToSym(x0.Aux)
6572                                 mem := x0.Args[1]
6573                                 p0 := x0.Args[0]
6574                                 s0 := o0_1
6575                                 if s0.Op != Op386SHLLconst || auxIntToInt32(s0.AuxInt) != 16 {
6576                                         continue
6577                                 }
6578                                 x1 := s0.Args[0]
6579                                 if x1.Op != Op386MOVBload || auxIntToInt32(x1.AuxInt) != i || auxToSym(x1.Aux) != s {
6580                                         continue
6581                                 }
6582                                 _ = x1.Args[1]
6583                                 p1 := x1.Args[0]
6584                                 if mem != x1.Args[1] {
6585                                         continue
6586                                 }
6587                                 s1 := v_1
6588                                 if s1.Op != Op386SHLLconst || auxIntToInt32(s1.AuxInt) != 24 {
6589                                         continue
6590                                 }
6591                                 x2 := s1.Args[0]
6592                                 if x2.Op != Op386MOVBload || auxIntToInt32(x2.AuxInt) != i || auxToSym(x2.Aux) != s {
6593                                         continue
6594                                 }
6595                                 _ = x2.Args[1]
6596                                 p2 := x2.Args[0]
6597                                 if mem != x2.Args[1] || !(x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && o0.Uses == 1 && sequentialAddresses(p0, p1, 2) && sequentialAddresses(p1, p2, 1) && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)) {
6598                                         continue
6599                                 }
6600                                 b = mergePoint(b, x0, x1, x2)
6601                                 v0 := b.NewValue0(x2.Pos, Op386MOVLload, typ.UInt32)
6602                                 v.copyOf(v0)
6603                                 v0.AuxInt = int32ToAuxInt(i)
6604                                 v0.Aux = symToAux(s)
6605                                 v0.AddArg2(p0, mem)
6606                                 return true
6607                         }
6608                 }
6609                 break
6610         }
6611         return false
6612 }
6613 func rewriteValue386_Op386ORLconst(v *Value) bool {
6614         v_0 := v.Args[0]
6615         // match: (ORLconst [c] x)
6616         // cond: c==0
6617         // result: x
6618         for {
6619                 c := auxIntToInt32(v.AuxInt)
6620                 x := v_0
6621                 if !(c == 0) {
6622                         break
6623                 }
6624                 v.copyOf(x)
6625                 return true
6626         }
6627         // match: (ORLconst [c] _)
6628         // cond: c==-1
6629         // result: (MOVLconst [-1])
6630         for {
6631                 c := auxIntToInt32(v.AuxInt)
6632                 if !(c == -1) {
6633                         break
6634                 }
6635                 v.reset(Op386MOVLconst)
6636                 v.AuxInt = int32ToAuxInt(-1)
6637                 return true
6638         }
6639         // match: (ORLconst [c] (MOVLconst [d]))
6640         // result: (MOVLconst [c|d])
6641         for {
6642                 c := auxIntToInt32(v.AuxInt)
6643                 if v_0.Op != Op386MOVLconst {
6644                         break
6645                 }
6646                 d := auxIntToInt32(v_0.AuxInt)
6647                 v.reset(Op386MOVLconst)
6648                 v.AuxInt = int32ToAuxInt(c | d)
6649                 return true
6650         }
6651         return false
6652 }
6653 func rewriteValue386_Op386ORLconstmodify(v *Value) bool {
6654         v_1 := v.Args[1]
6655         v_0 := v.Args[0]
6656         b := v.Block
6657         config := b.Func.Config
6658         // match: (ORLconstmodify [valoff1] {sym} (ADDLconst [off2] base) mem)
6659         // cond: valoff1.canAdd32(off2)
6660         // result: (ORLconstmodify [valoff1.addOffset32(off2)] {sym} base mem)
6661         for {
6662                 valoff1 := auxIntToValAndOff(v.AuxInt)
6663                 sym := auxToSym(v.Aux)
6664                 if v_0.Op != Op386ADDLconst {
6665                         break
6666                 }
6667                 off2 := auxIntToInt32(v_0.AuxInt)
6668                 base := v_0.Args[0]
6669                 mem := v_1
6670                 if !(valoff1.canAdd32(off2)) {
6671                         break
6672                 }
6673                 v.reset(Op386ORLconstmodify)
6674                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
6675                 v.Aux = symToAux(sym)
6676                 v.AddArg2(base, mem)
6677                 return true
6678         }
6679         // match: (ORLconstmodify [valoff1] {sym1} (LEAL [off2] {sym2} base) mem)
6680         // cond: valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
6681         // result: (ORLconstmodify [valoff1.addOffset32(off2)] {mergeSym(sym1,sym2)} base mem)
6682         for {
6683                 valoff1 := auxIntToValAndOff(v.AuxInt)
6684                 sym1 := auxToSym(v.Aux)
6685                 if v_0.Op != Op386LEAL {
6686                         break
6687                 }
6688                 off2 := auxIntToInt32(v_0.AuxInt)
6689                 sym2 := auxToSym(v_0.Aux)
6690                 base := v_0.Args[0]
6691                 mem := v_1
6692                 if !(valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
6693                         break
6694                 }
6695                 v.reset(Op386ORLconstmodify)
6696                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
6697                 v.Aux = symToAux(mergeSym(sym1, sym2))
6698                 v.AddArg2(base, mem)
6699                 return true
6700         }
6701         return false
6702 }
6703 func rewriteValue386_Op386ORLload(v *Value) bool {
6704         v_2 := v.Args[2]
6705         v_1 := v.Args[1]
6706         v_0 := v.Args[0]
6707         b := v.Block
6708         config := b.Func.Config
6709         // match: (ORLload [off1] {sym} val (ADDLconst [off2] base) mem)
6710         // cond: is32Bit(int64(off1)+int64(off2))
6711         // result: (ORLload [off1+off2] {sym} val base mem)
6712         for {
6713                 off1 := auxIntToInt32(v.AuxInt)
6714                 sym := auxToSym(v.Aux)
6715                 val := v_0
6716                 if v_1.Op != Op386ADDLconst {
6717                         break
6718                 }
6719                 off2 := auxIntToInt32(v_1.AuxInt)
6720                 base := v_1.Args[0]
6721                 mem := v_2
6722                 if !(is32Bit(int64(off1) + int64(off2))) {
6723                         break
6724                 }
6725                 v.reset(Op386ORLload)
6726                 v.AuxInt = int32ToAuxInt(off1 + off2)
6727                 v.Aux = symToAux(sym)
6728                 v.AddArg3(val, base, mem)
6729                 return true
6730         }
6731         // match: (ORLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
6732         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
6733         // result: (ORLload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
6734         for {
6735                 off1 := auxIntToInt32(v.AuxInt)
6736                 sym1 := auxToSym(v.Aux)
6737                 val := v_0
6738                 if v_1.Op != Op386LEAL {
6739                         break
6740                 }
6741                 off2 := auxIntToInt32(v_1.AuxInt)
6742                 sym2 := auxToSym(v_1.Aux)
6743                 base := v_1.Args[0]
6744                 mem := v_2
6745                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
6746                         break
6747                 }
6748                 v.reset(Op386ORLload)
6749                 v.AuxInt = int32ToAuxInt(off1 + off2)
6750                 v.Aux = symToAux(mergeSym(sym1, sym2))
6751                 v.AddArg3(val, base, mem)
6752                 return true
6753         }
6754         return false
6755 }
6756 func rewriteValue386_Op386ORLmodify(v *Value) bool {
6757         v_2 := v.Args[2]
6758         v_1 := v.Args[1]
6759         v_0 := v.Args[0]
6760         b := v.Block
6761         config := b.Func.Config
6762         // match: (ORLmodify [off1] {sym} (ADDLconst [off2] base) val mem)
6763         // cond: is32Bit(int64(off1)+int64(off2))
6764         // result: (ORLmodify [off1+off2] {sym} base val mem)
6765         for {
6766                 off1 := auxIntToInt32(v.AuxInt)
6767                 sym := auxToSym(v.Aux)
6768                 if v_0.Op != Op386ADDLconst {
6769                         break
6770                 }
6771                 off2 := auxIntToInt32(v_0.AuxInt)
6772                 base := v_0.Args[0]
6773                 val := v_1
6774                 mem := v_2
6775                 if !(is32Bit(int64(off1) + int64(off2))) {
6776                         break
6777                 }
6778                 v.reset(Op386ORLmodify)
6779                 v.AuxInt = int32ToAuxInt(off1 + off2)
6780                 v.Aux = symToAux(sym)
6781                 v.AddArg3(base, val, mem)
6782                 return true
6783         }
6784         // match: (ORLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
6785         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
6786         // result: (ORLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem)
6787         for {
6788                 off1 := auxIntToInt32(v.AuxInt)
6789                 sym1 := auxToSym(v.Aux)
6790                 if v_0.Op != Op386LEAL {
6791                         break
6792                 }
6793                 off2 := auxIntToInt32(v_0.AuxInt)
6794                 sym2 := auxToSym(v_0.Aux)
6795                 base := v_0.Args[0]
6796                 val := v_1
6797                 mem := v_2
6798                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
6799                         break
6800                 }
6801                 v.reset(Op386ORLmodify)
6802                 v.AuxInt = int32ToAuxInt(off1 + off2)
6803                 v.Aux = symToAux(mergeSym(sym1, sym2))
6804                 v.AddArg3(base, val, mem)
6805                 return true
6806         }
6807         return false
6808 }
6809 func rewriteValue386_Op386ROLBconst(v *Value) bool {
6810         v_0 := v.Args[0]
6811         // match: (ROLBconst [c] (ROLBconst [d] x))
6812         // result: (ROLBconst [(c+d)& 7] x)
6813         for {
6814                 c := auxIntToInt8(v.AuxInt)
6815                 if v_0.Op != Op386ROLBconst {
6816                         break
6817                 }
6818                 d := auxIntToInt8(v_0.AuxInt)
6819                 x := v_0.Args[0]
6820                 v.reset(Op386ROLBconst)
6821                 v.AuxInt = int8ToAuxInt((c + d) & 7)
6822                 v.AddArg(x)
6823                 return true
6824         }
6825         // match: (ROLBconst [0] x)
6826         // result: x
6827         for {
6828                 if auxIntToInt8(v.AuxInt) != 0 {
6829                         break
6830                 }
6831                 x := v_0
6832                 v.copyOf(x)
6833                 return true
6834         }
6835         return false
6836 }
6837 func rewriteValue386_Op386ROLLconst(v *Value) bool {
6838         v_0 := v.Args[0]
6839         // match: (ROLLconst [c] (ROLLconst [d] x))
6840         // result: (ROLLconst [(c+d)&31] x)
6841         for {
6842                 c := auxIntToInt32(v.AuxInt)
6843                 if v_0.Op != Op386ROLLconst {
6844                         break
6845                 }
6846                 d := auxIntToInt32(v_0.AuxInt)
6847                 x := v_0.Args[0]
6848                 v.reset(Op386ROLLconst)
6849                 v.AuxInt = int32ToAuxInt((c + d) & 31)
6850                 v.AddArg(x)
6851                 return true
6852         }
6853         // match: (ROLLconst [0] x)
6854         // result: x
6855         for {
6856                 if auxIntToInt32(v.AuxInt) != 0 {
6857                         break
6858                 }
6859                 x := v_0
6860                 v.copyOf(x)
6861                 return true
6862         }
6863         return false
6864 }
6865 func rewriteValue386_Op386ROLWconst(v *Value) bool {
6866         v_0 := v.Args[0]
6867         // match: (ROLWconst [c] (ROLWconst [d] x))
6868         // result: (ROLWconst [(c+d)&15] x)
6869         for {
6870                 c := auxIntToInt16(v.AuxInt)
6871                 if v_0.Op != Op386ROLWconst {
6872                         break
6873                 }
6874                 d := auxIntToInt16(v_0.AuxInt)
6875                 x := v_0.Args[0]
6876                 v.reset(Op386ROLWconst)
6877                 v.AuxInt = int16ToAuxInt((c + d) & 15)
6878                 v.AddArg(x)
6879                 return true
6880         }
6881         // match: (ROLWconst [0] x)
6882         // result: x
6883         for {
6884                 if auxIntToInt16(v.AuxInt) != 0 {
6885                         break
6886                 }
6887                 x := v_0
6888                 v.copyOf(x)
6889                 return true
6890         }
6891         return false
6892 }
6893 func rewriteValue386_Op386SARB(v *Value) bool {
6894         v_1 := v.Args[1]
6895         v_0 := v.Args[0]
6896         // match: (SARB x (MOVLconst [c]))
6897         // result: (SARBconst [int8(min(int64(c&31),7))] x)
6898         for {
6899                 x := v_0
6900                 if v_1.Op != Op386MOVLconst {
6901                         break
6902                 }
6903                 c := auxIntToInt32(v_1.AuxInt)
6904                 v.reset(Op386SARBconst)
6905                 v.AuxInt = int8ToAuxInt(int8(min(int64(c&31), 7)))
6906                 v.AddArg(x)
6907                 return true
6908         }
6909         return false
6910 }
6911 func rewriteValue386_Op386SARBconst(v *Value) bool {
6912         v_0 := v.Args[0]
6913         // match: (SARBconst x [0])
6914         // result: x
6915         for {
6916                 if auxIntToInt8(v.AuxInt) != 0 {
6917                         break
6918                 }
6919                 x := v_0
6920                 v.copyOf(x)
6921                 return true
6922         }
6923         // match: (SARBconst [c] (MOVLconst [d]))
6924         // result: (MOVLconst [d>>uint64(c)])
6925         for {
6926                 c := auxIntToInt8(v.AuxInt)
6927                 if v_0.Op != Op386MOVLconst {
6928                         break
6929                 }
6930                 d := auxIntToInt32(v_0.AuxInt)
6931                 v.reset(Op386MOVLconst)
6932                 v.AuxInt = int32ToAuxInt(d >> uint64(c))
6933                 return true
6934         }
6935         return false
6936 }
6937 func rewriteValue386_Op386SARL(v *Value) bool {
6938         v_1 := v.Args[1]
6939         v_0 := v.Args[0]
6940         // match: (SARL x (MOVLconst [c]))
6941         // result: (SARLconst [c&31] x)
6942         for {
6943                 x := v_0
6944                 if v_1.Op != Op386MOVLconst {
6945                         break
6946                 }
6947                 c := auxIntToInt32(v_1.AuxInt)
6948                 v.reset(Op386SARLconst)
6949                 v.AuxInt = int32ToAuxInt(c & 31)
6950                 v.AddArg(x)
6951                 return true
6952         }
6953         // match: (SARL x (ANDLconst [31] y))
6954         // result: (SARL x y)
6955         for {
6956                 x := v_0
6957                 if v_1.Op != Op386ANDLconst || auxIntToInt32(v_1.AuxInt) != 31 {
6958                         break
6959                 }
6960                 y := v_1.Args[0]
6961                 v.reset(Op386SARL)
6962                 v.AddArg2(x, y)
6963                 return true
6964         }
6965         return false
6966 }
6967 func rewriteValue386_Op386SARLconst(v *Value) bool {
6968         v_0 := v.Args[0]
6969         // match: (SARLconst x [0])
6970         // result: x
6971         for {
6972                 if auxIntToInt32(v.AuxInt) != 0 {
6973                         break
6974                 }
6975                 x := v_0
6976                 v.copyOf(x)
6977                 return true
6978         }
6979         // match: (SARLconst [c] (MOVLconst [d]))
6980         // result: (MOVLconst [d>>uint64(c)])
6981         for {
6982                 c := auxIntToInt32(v.AuxInt)
6983                 if v_0.Op != Op386MOVLconst {
6984                         break
6985                 }
6986                 d := auxIntToInt32(v_0.AuxInt)
6987                 v.reset(Op386MOVLconst)
6988                 v.AuxInt = int32ToAuxInt(d >> uint64(c))
6989                 return true
6990         }
6991         return false
6992 }
6993 func rewriteValue386_Op386SARW(v *Value) bool {
6994         v_1 := v.Args[1]
6995         v_0 := v.Args[0]
6996         // match: (SARW x (MOVLconst [c]))
6997         // result: (SARWconst [int16(min(int64(c&31),15))] x)
6998         for {
6999                 x := v_0
7000                 if v_1.Op != Op386MOVLconst {
7001                         break
7002                 }
7003                 c := auxIntToInt32(v_1.AuxInt)
7004                 v.reset(Op386SARWconst)
7005                 v.AuxInt = int16ToAuxInt(int16(min(int64(c&31), 15)))
7006                 v.AddArg(x)
7007                 return true
7008         }
7009         return false
7010 }
7011 func rewriteValue386_Op386SARWconst(v *Value) bool {
7012         v_0 := v.Args[0]
7013         // match: (SARWconst x [0])
7014         // result: x
7015         for {
7016                 if auxIntToInt16(v.AuxInt) != 0 {
7017                         break
7018                 }
7019                 x := v_0
7020                 v.copyOf(x)
7021                 return true
7022         }
7023         // match: (SARWconst [c] (MOVLconst [d]))
7024         // result: (MOVLconst [d>>uint64(c)])
7025         for {
7026                 c := auxIntToInt16(v.AuxInt)
7027                 if v_0.Op != Op386MOVLconst {
7028                         break
7029                 }
7030                 d := auxIntToInt32(v_0.AuxInt)
7031                 v.reset(Op386MOVLconst)
7032                 v.AuxInt = int32ToAuxInt(d >> uint64(c))
7033                 return true
7034         }
7035         return false
7036 }
7037 func rewriteValue386_Op386SBBL(v *Value) bool {
7038         v_2 := v.Args[2]
7039         v_1 := v.Args[1]
7040         v_0 := v.Args[0]
7041         // match: (SBBL x (MOVLconst [c]) f)
7042         // result: (SBBLconst [c] x f)
7043         for {
7044                 x := v_0
7045                 if v_1.Op != Op386MOVLconst {
7046                         break
7047                 }
7048                 c := auxIntToInt32(v_1.AuxInt)
7049                 f := v_2
7050                 v.reset(Op386SBBLconst)
7051                 v.AuxInt = int32ToAuxInt(c)
7052                 v.AddArg2(x, f)
7053                 return true
7054         }
7055         return false
7056 }
7057 func rewriteValue386_Op386SBBLcarrymask(v *Value) bool {
7058         v_0 := v.Args[0]
7059         // match: (SBBLcarrymask (FlagEQ))
7060         // result: (MOVLconst [0])
7061         for {
7062                 if v_0.Op != Op386FlagEQ {
7063                         break
7064                 }
7065                 v.reset(Op386MOVLconst)
7066                 v.AuxInt = int32ToAuxInt(0)
7067                 return true
7068         }
7069         // match: (SBBLcarrymask (FlagLT_ULT))
7070         // result: (MOVLconst [-1])
7071         for {
7072                 if v_0.Op != Op386FlagLT_ULT {
7073                         break
7074                 }
7075                 v.reset(Op386MOVLconst)
7076                 v.AuxInt = int32ToAuxInt(-1)
7077                 return true
7078         }
7079         // match: (SBBLcarrymask (FlagLT_UGT))
7080         // result: (MOVLconst [0])
7081         for {
7082                 if v_0.Op != Op386FlagLT_UGT {
7083                         break
7084                 }
7085                 v.reset(Op386MOVLconst)
7086                 v.AuxInt = int32ToAuxInt(0)
7087                 return true
7088         }
7089         // match: (SBBLcarrymask (FlagGT_ULT))
7090         // result: (MOVLconst [-1])
7091         for {
7092                 if v_0.Op != Op386FlagGT_ULT {
7093                         break
7094                 }
7095                 v.reset(Op386MOVLconst)
7096                 v.AuxInt = int32ToAuxInt(-1)
7097                 return true
7098         }
7099         // match: (SBBLcarrymask (FlagGT_UGT))
7100         // result: (MOVLconst [0])
7101         for {
7102                 if v_0.Op != Op386FlagGT_UGT {
7103                         break
7104                 }
7105                 v.reset(Op386MOVLconst)
7106                 v.AuxInt = int32ToAuxInt(0)
7107                 return true
7108         }
7109         return false
7110 }
7111 func rewriteValue386_Op386SETA(v *Value) bool {
7112         v_0 := v.Args[0]
7113         // match: (SETA (InvertFlags x))
7114         // result: (SETB x)
7115         for {
7116                 if v_0.Op != Op386InvertFlags {
7117                         break
7118                 }
7119                 x := v_0.Args[0]
7120                 v.reset(Op386SETB)
7121                 v.AddArg(x)
7122                 return true
7123         }
7124         // match: (SETA (FlagEQ))
7125         // result: (MOVLconst [0])
7126         for {
7127                 if v_0.Op != Op386FlagEQ {
7128                         break
7129                 }
7130                 v.reset(Op386MOVLconst)
7131                 v.AuxInt = int32ToAuxInt(0)
7132                 return true
7133         }
7134         // match: (SETA (FlagLT_ULT))
7135         // result: (MOVLconst [0])
7136         for {
7137                 if v_0.Op != Op386FlagLT_ULT {
7138                         break
7139                 }
7140                 v.reset(Op386MOVLconst)
7141                 v.AuxInt = int32ToAuxInt(0)
7142                 return true
7143         }
7144         // match: (SETA (FlagLT_UGT))
7145         // result: (MOVLconst [1])
7146         for {
7147                 if v_0.Op != Op386FlagLT_UGT {
7148                         break
7149                 }
7150                 v.reset(Op386MOVLconst)
7151                 v.AuxInt = int32ToAuxInt(1)
7152                 return true
7153         }
7154         // match: (SETA (FlagGT_ULT))
7155         // result: (MOVLconst [0])
7156         for {
7157                 if v_0.Op != Op386FlagGT_ULT {
7158                         break
7159                 }
7160                 v.reset(Op386MOVLconst)
7161                 v.AuxInt = int32ToAuxInt(0)
7162                 return true
7163         }
7164         // match: (SETA (FlagGT_UGT))
7165         // result: (MOVLconst [1])
7166         for {
7167                 if v_0.Op != Op386FlagGT_UGT {
7168                         break
7169                 }
7170                 v.reset(Op386MOVLconst)
7171                 v.AuxInt = int32ToAuxInt(1)
7172                 return true
7173         }
7174         return false
7175 }
7176 func rewriteValue386_Op386SETAE(v *Value) bool {
7177         v_0 := v.Args[0]
7178         // match: (SETAE (InvertFlags x))
7179         // result: (SETBE x)
7180         for {
7181                 if v_0.Op != Op386InvertFlags {
7182                         break
7183                 }
7184                 x := v_0.Args[0]
7185                 v.reset(Op386SETBE)
7186                 v.AddArg(x)
7187                 return true
7188         }
7189         // match: (SETAE (FlagEQ))
7190         // result: (MOVLconst [1])
7191         for {
7192                 if v_0.Op != Op386FlagEQ {
7193                         break
7194                 }
7195                 v.reset(Op386MOVLconst)
7196                 v.AuxInt = int32ToAuxInt(1)
7197                 return true
7198         }
7199         // match: (SETAE (FlagLT_ULT))
7200         // result: (MOVLconst [0])
7201         for {
7202                 if v_0.Op != Op386FlagLT_ULT {
7203                         break
7204                 }
7205                 v.reset(Op386MOVLconst)
7206                 v.AuxInt = int32ToAuxInt(0)
7207                 return true
7208         }
7209         // match: (SETAE (FlagLT_UGT))
7210         // result: (MOVLconst [1])
7211         for {
7212                 if v_0.Op != Op386FlagLT_UGT {
7213                         break
7214                 }
7215                 v.reset(Op386MOVLconst)
7216                 v.AuxInt = int32ToAuxInt(1)
7217                 return true
7218         }
7219         // match: (SETAE (FlagGT_ULT))
7220         // result: (MOVLconst [0])
7221         for {
7222                 if v_0.Op != Op386FlagGT_ULT {
7223                         break
7224                 }
7225                 v.reset(Op386MOVLconst)
7226                 v.AuxInt = int32ToAuxInt(0)
7227                 return true
7228         }
7229         // match: (SETAE (FlagGT_UGT))
7230         // result: (MOVLconst [1])
7231         for {
7232                 if v_0.Op != Op386FlagGT_UGT {
7233                         break
7234                 }
7235                 v.reset(Op386MOVLconst)
7236                 v.AuxInt = int32ToAuxInt(1)
7237                 return true
7238         }
7239         return false
7240 }
7241 func rewriteValue386_Op386SETB(v *Value) bool {
7242         v_0 := v.Args[0]
7243         // match: (SETB (InvertFlags x))
7244         // result: (SETA x)
7245         for {
7246                 if v_0.Op != Op386InvertFlags {
7247                         break
7248                 }
7249                 x := v_0.Args[0]
7250                 v.reset(Op386SETA)
7251                 v.AddArg(x)
7252                 return true
7253         }
7254         // match: (SETB (FlagEQ))
7255         // result: (MOVLconst [0])
7256         for {
7257                 if v_0.Op != Op386FlagEQ {
7258                         break
7259                 }
7260                 v.reset(Op386MOVLconst)
7261                 v.AuxInt = int32ToAuxInt(0)
7262                 return true
7263         }
7264         // match: (SETB (FlagLT_ULT))
7265         // result: (MOVLconst [1])
7266         for {
7267                 if v_0.Op != Op386FlagLT_ULT {
7268                         break
7269                 }
7270                 v.reset(Op386MOVLconst)
7271                 v.AuxInt = int32ToAuxInt(1)
7272                 return true
7273         }
7274         // match: (SETB (FlagLT_UGT))
7275         // result: (MOVLconst [0])
7276         for {
7277                 if v_0.Op != Op386FlagLT_UGT {
7278                         break
7279                 }
7280                 v.reset(Op386MOVLconst)
7281                 v.AuxInt = int32ToAuxInt(0)
7282                 return true
7283         }
7284         // match: (SETB (FlagGT_ULT))
7285         // result: (MOVLconst [1])
7286         for {
7287                 if v_0.Op != Op386FlagGT_ULT {
7288                         break
7289                 }
7290                 v.reset(Op386MOVLconst)
7291                 v.AuxInt = int32ToAuxInt(1)
7292                 return true
7293         }
7294         // match: (SETB (FlagGT_UGT))
7295         // result: (MOVLconst [0])
7296         for {
7297                 if v_0.Op != Op386FlagGT_UGT {
7298                         break
7299                 }
7300                 v.reset(Op386MOVLconst)
7301                 v.AuxInt = int32ToAuxInt(0)
7302                 return true
7303         }
7304         return false
7305 }
7306 func rewriteValue386_Op386SETBE(v *Value) bool {
7307         v_0 := v.Args[0]
7308         // match: (SETBE (InvertFlags x))
7309         // result: (SETAE x)
7310         for {
7311                 if v_0.Op != Op386InvertFlags {
7312                         break
7313                 }
7314                 x := v_0.Args[0]
7315                 v.reset(Op386SETAE)
7316                 v.AddArg(x)
7317                 return true
7318         }
7319         // match: (SETBE (FlagEQ))
7320         // result: (MOVLconst [1])
7321         for {
7322                 if v_0.Op != Op386FlagEQ {
7323                         break
7324                 }
7325                 v.reset(Op386MOVLconst)
7326                 v.AuxInt = int32ToAuxInt(1)
7327                 return true
7328         }
7329         // match: (SETBE (FlagLT_ULT))
7330         // result: (MOVLconst [1])
7331         for {
7332                 if v_0.Op != Op386FlagLT_ULT {
7333                         break
7334                 }
7335                 v.reset(Op386MOVLconst)
7336                 v.AuxInt = int32ToAuxInt(1)
7337                 return true
7338         }
7339         // match: (SETBE (FlagLT_UGT))
7340         // result: (MOVLconst [0])
7341         for {
7342                 if v_0.Op != Op386FlagLT_UGT {
7343                         break
7344                 }
7345                 v.reset(Op386MOVLconst)
7346                 v.AuxInt = int32ToAuxInt(0)
7347                 return true
7348         }
7349         // match: (SETBE (FlagGT_ULT))
7350         // result: (MOVLconst [1])
7351         for {
7352                 if v_0.Op != Op386FlagGT_ULT {
7353                         break
7354                 }
7355                 v.reset(Op386MOVLconst)
7356                 v.AuxInt = int32ToAuxInt(1)
7357                 return true
7358         }
7359         // match: (SETBE (FlagGT_UGT))
7360         // result: (MOVLconst [0])
7361         for {
7362                 if v_0.Op != Op386FlagGT_UGT {
7363                         break
7364                 }
7365                 v.reset(Op386MOVLconst)
7366                 v.AuxInt = int32ToAuxInt(0)
7367                 return true
7368         }
7369         return false
7370 }
7371 func rewriteValue386_Op386SETEQ(v *Value) bool {
7372         v_0 := v.Args[0]
7373         // match: (SETEQ (InvertFlags x))
7374         // result: (SETEQ x)
7375         for {
7376                 if v_0.Op != Op386InvertFlags {
7377                         break
7378                 }
7379                 x := v_0.Args[0]
7380                 v.reset(Op386SETEQ)
7381                 v.AddArg(x)
7382                 return true
7383         }
7384         // match: (SETEQ (FlagEQ))
7385         // result: (MOVLconst [1])
7386         for {
7387                 if v_0.Op != Op386FlagEQ {
7388                         break
7389                 }
7390                 v.reset(Op386MOVLconst)
7391                 v.AuxInt = int32ToAuxInt(1)
7392                 return true
7393         }
7394         // match: (SETEQ (FlagLT_ULT))
7395         // result: (MOVLconst [0])
7396         for {
7397                 if v_0.Op != Op386FlagLT_ULT {
7398                         break
7399                 }
7400                 v.reset(Op386MOVLconst)
7401                 v.AuxInt = int32ToAuxInt(0)
7402                 return true
7403         }
7404         // match: (SETEQ (FlagLT_UGT))
7405         // result: (MOVLconst [0])
7406         for {
7407                 if v_0.Op != Op386FlagLT_UGT {
7408                         break
7409                 }
7410                 v.reset(Op386MOVLconst)
7411                 v.AuxInt = int32ToAuxInt(0)
7412                 return true
7413         }
7414         // match: (SETEQ (FlagGT_ULT))
7415         // result: (MOVLconst [0])
7416         for {
7417                 if v_0.Op != Op386FlagGT_ULT {
7418                         break
7419                 }
7420                 v.reset(Op386MOVLconst)
7421                 v.AuxInt = int32ToAuxInt(0)
7422                 return true
7423         }
7424         // match: (SETEQ (FlagGT_UGT))
7425         // result: (MOVLconst [0])
7426         for {
7427                 if v_0.Op != Op386FlagGT_UGT {
7428                         break
7429                 }
7430                 v.reset(Op386MOVLconst)
7431                 v.AuxInt = int32ToAuxInt(0)
7432                 return true
7433         }
7434         return false
7435 }
7436 func rewriteValue386_Op386SETG(v *Value) bool {
7437         v_0 := v.Args[0]
7438         // match: (SETG (InvertFlags x))
7439         // result: (SETL x)
7440         for {
7441                 if v_0.Op != Op386InvertFlags {
7442                         break
7443                 }
7444                 x := v_0.Args[0]
7445                 v.reset(Op386SETL)
7446                 v.AddArg(x)
7447                 return true
7448         }
7449         // match: (SETG (FlagEQ))
7450         // result: (MOVLconst [0])
7451         for {
7452                 if v_0.Op != Op386FlagEQ {
7453                         break
7454                 }
7455                 v.reset(Op386MOVLconst)
7456                 v.AuxInt = int32ToAuxInt(0)
7457                 return true
7458         }
7459         // match: (SETG (FlagLT_ULT))
7460         // result: (MOVLconst [0])
7461         for {
7462                 if v_0.Op != Op386FlagLT_ULT {
7463                         break
7464                 }
7465                 v.reset(Op386MOVLconst)
7466                 v.AuxInt = int32ToAuxInt(0)
7467                 return true
7468         }
7469         // match: (SETG (FlagLT_UGT))
7470         // result: (MOVLconst [0])
7471         for {
7472                 if v_0.Op != Op386FlagLT_UGT {
7473                         break
7474                 }
7475                 v.reset(Op386MOVLconst)
7476                 v.AuxInt = int32ToAuxInt(0)
7477                 return true
7478         }
7479         // match: (SETG (FlagGT_ULT))
7480         // result: (MOVLconst [1])
7481         for {
7482                 if v_0.Op != Op386FlagGT_ULT {
7483                         break
7484                 }
7485                 v.reset(Op386MOVLconst)
7486                 v.AuxInt = int32ToAuxInt(1)
7487                 return true
7488         }
7489         // match: (SETG (FlagGT_UGT))
7490         // result: (MOVLconst [1])
7491         for {
7492                 if v_0.Op != Op386FlagGT_UGT {
7493                         break
7494                 }
7495                 v.reset(Op386MOVLconst)
7496                 v.AuxInt = int32ToAuxInt(1)
7497                 return true
7498         }
7499         return false
7500 }
7501 func rewriteValue386_Op386SETGE(v *Value) bool {
7502         v_0 := v.Args[0]
7503         // match: (SETGE (InvertFlags x))
7504         // result: (SETLE x)
7505         for {
7506                 if v_0.Op != Op386InvertFlags {
7507                         break
7508                 }
7509                 x := v_0.Args[0]
7510                 v.reset(Op386SETLE)
7511                 v.AddArg(x)
7512                 return true
7513         }
7514         // match: (SETGE (FlagEQ))
7515         // result: (MOVLconst [1])
7516         for {
7517                 if v_0.Op != Op386FlagEQ {
7518                         break
7519                 }
7520                 v.reset(Op386MOVLconst)
7521                 v.AuxInt = int32ToAuxInt(1)
7522                 return true
7523         }
7524         // match: (SETGE (FlagLT_ULT))
7525         // result: (MOVLconst [0])
7526         for {
7527                 if v_0.Op != Op386FlagLT_ULT {
7528                         break
7529                 }
7530                 v.reset(Op386MOVLconst)
7531                 v.AuxInt = int32ToAuxInt(0)
7532                 return true
7533         }
7534         // match: (SETGE (FlagLT_UGT))
7535         // result: (MOVLconst [0])
7536         for {
7537                 if v_0.Op != Op386FlagLT_UGT {
7538                         break
7539                 }
7540                 v.reset(Op386MOVLconst)
7541                 v.AuxInt = int32ToAuxInt(0)
7542                 return true
7543         }
7544         // match: (SETGE (FlagGT_ULT))
7545         // result: (MOVLconst [1])
7546         for {
7547                 if v_0.Op != Op386FlagGT_ULT {
7548                         break
7549                 }
7550                 v.reset(Op386MOVLconst)
7551                 v.AuxInt = int32ToAuxInt(1)
7552                 return true
7553         }
7554         // match: (SETGE (FlagGT_UGT))
7555         // result: (MOVLconst [1])
7556         for {
7557                 if v_0.Op != Op386FlagGT_UGT {
7558                         break
7559                 }
7560                 v.reset(Op386MOVLconst)
7561                 v.AuxInt = int32ToAuxInt(1)
7562                 return true
7563         }
7564         return false
7565 }
7566 func rewriteValue386_Op386SETL(v *Value) bool {
7567         v_0 := v.Args[0]
7568         // match: (SETL (InvertFlags x))
7569         // result: (SETG x)
7570         for {
7571                 if v_0.Op != Op386InvertFlags {
7572                         break
7573                 }
7574                 x := v_0.Args[0]
7575                 v.reset(Op386SETG)
7576                 v.AddArg(x)
7577                 return true
7578         }
7579         // match: (SETL (FlagEQ))
7580         // result: (MOVLconst [0])
7581         for {
7582                 if v_0.Op != Op386FlagEQ {
7583                         break
7584                 }
7585                 v.reset(Op386MOVLconst)
7586                 v.AuxInt = int32ToAuxInt(0)
7587                 return true
7588         }
7589         // match: (SETL (FlagLT_ULT))
7590         // result: (MOVLconst [1])
7591         for {
7592                 if v_0.Op != Op386FlagLT_ULT {
7593                         break
7594                 }
7595                 v.reset(Op386MOVLconst)
7596                 v.AuxInt = int32ToAuxInt(1)
7597                 return true
7598         }
7599         // match: (SETL (FlagLT_UGT))
7600         // result: (MOVLconst [1])
7601         for {
7602                 if v_0.Op != Op386FlagLT_UGT {
7603                         break
7604                 }
7605                 v.reset(Op386MOVLconst)
7606                 v.AuxInt = int32ToAuxInt(1)
7607                 return true
7608         }
7609         // match: (SETL (FlagGT_ULT))
7610         // result: (MOVLconst [0])
7611         for {
7612                 if v_0.Op != Op386FlagGT_ULT {
7613                         break
7614                 }
7615                 v.reset(Op386MOVLconst)
7616                 v.AuxInt = int32ToAuxInt(0)
7617                 return true
7618         }
7619         // match: (SETL (FlagGT_UGT))
7620         // result: (MOVLconst [0])
7621         for {
7622                 if v_0.Op != Op386FlagGT_UGT {
7623                         break
7624                 }
7625                 v.reset(Op386MOVLconst)
7626                 v.AuxInt = int32ToAuxInt(0)
7627                 return true
7628         }
7629         return false
7630 }
7631 func rewriteValue386_Op386SETLE(v *Value) bool {
7632         v_0 := v.Args[0]
7633         // match: (SETLE (InvertFlags x))
7634         // result: (SETGE x)
7635         for {
7636                 if v_0.Op != Op386InvertFlags {
7637                         break
7638                 }
7639                 x := v_0.Args[0]
7640                 v.reset(Op386SETGE)
7641                 v.AddArg(x)
7642                 return true
7643         }
7644         // match: (SETLE (FlagEQ))
7645         // result: (MOVLconst [1])
7646         for {
7647                 if v_0.Op != Op386FlagEQ {
7648                         break
7649                 }
7650                 v.reset(Op386MOVLconst)
7651                 v.AuxInt = int32ToAuxInt(1)
7652                 return true
7653         }
7654         // match: (SETLE (FlagLT_ULT))
7655         // result: (MOVLconst [1])
7656         for {
7657                 if v_0.Op != Op386FlagLT_ULT {
7658                         break
7659                 }
7660                 v.reset(Op386MOVLconst)
7661                 v.AuxInt = int32ToAuxInt(1)
7662                 return true
7663         }
7664         // match: (SETLE (FlagLT_UGT))
7665         // result: (MOVLconst [1])
7666         for {
7667                 if v_0.Op != Op386FlagLT_UGT {
7668                         break
7669                 }
7670                 v.reset(Op386MOVLconst)
7671                 v.AuxInt = int32ToAuxInt(1)
7672                 return true
7673         }
7674         // match: (SETLE (FlagGT_ULT))
7675         // result: (MOVLconst [0])
7676         for {
7677                 if v_0.Op != Op386FlagGT_ULT {
7678                         break
7679                 }
7680                 v.reset(Op386MOVLconst)
7681                 v.AuxInt = int32ToAuxInt(0)
7682                 return true
7683         }
7684         // match: (SETLE (FlagGT_UGT))
7685         // result: (MOVLconst [0])
7686         for {
7687                 if v_0.Op != Op386FlagGT_UGT {
7688                         break
7689                 }
7690                 v.reset(Op386MOVLconst)
7691                 v.AuxInt = int32ToAuxInt(0)
7692                 return true
7693         }
7694         return false
7695 }
7696 func rewriteValue386_Op386SETNE(v *Value) bool {
7697         v_0 := v.Args[0]
7698         // match: (SETNE (InvertFlags x))
7699         // result: (SETNE x)
7700         for {
7701                 if v_0.Op != Op386InvertFlags {
7702                         break
7703                 }
7704                 x := v_0.Args[0]
7705                 v.reset(Op386SETNE)
7706                 v.AddArg(x)
7707                 return true
7708         }
7709         // match: (SETNE (FlagEQ))
7710         // result: (MOVLconst [0])
7711         for {
7712                 if v_0.Op != Op386FlagEQ {
7713                         break
7714                 }
7715                 v.reset(Op386MOVLconst)
7716                 v.AuxInt = int32ToAuxInt(0)
7717                 return true
7718         }
7719         // match: (SETNE (FlagLT_ULT))
7720         // result: (MOVLconst [1])
7721         for {
7722                 if v_0.Op != Op386FlagLT_ULT {
7723                         break
7724                 }
7725                 v.reset(Op386MOVLconst)
7726                 v.AuxInt = int32ToAuxInt(1)
7727                 return true
7728         }
7729         // match: (SETNE (FlagLT_UGT))
7730         // result: (MOVLconst [1])
7731         for {
7732                 if v_0.Op != Op386FlagLT_UGT {
7733                         break
7734                 }
7735                 v.reset(Op386MOVLconst)
7736                 v.AuxInt = int32ToAuxInt(1)
7737                 return true
7738         }
7739         // match: (SETNE (FlagGT_ULT))
7740         // result: (MOVLconst [1])
7741         for {
7742                 if v_0.Op != Op386FlagGT_ULT {
7743                         break
7744                 }
7745                 v.reset(Op386MOVLconst)
7746                 v.AuxInt = int32ToAuxInt(1)
7747                 return true
7748         }
7749         // match: (SETNE (FlagGT_UGT))
7750         // result: (MOVLconst [1])
7751         for {
7752                 if v_0.Op != Op386FlagGT_UGT {
7753                         break
7754                 }
7755                 v.reset(Op386MOVLconst)
7756                 v.AuxInt = int32ToAuxInt(1)
7757                 return true
7758         }
7759         return false
7760 }
7761 func rewriteValue386_Op386SHLL(v *Value) bool {
7762         v_1 := v.Args[1]
7763         v_0 := v.Args[0]
7764         // match: (SHLL x (MOVLconst [c]))
7765         // result: (SHLLconst [c&31] x)
7766         for {
7767                 x := v_0
7768                 if v_1.Op != Op386MOVLconst {
7769                         break
7770                 }
7771                 c := auxIntToInt32(v_1.AuxInt)
7772                 v.reset(Op386SHLLconst)
7773                 v.AuxInt = int32ToAuxInt(c & 31)
7774                 v.AddArg(x)
7775                 return true
7776         }
7777         // match: (SHLL x (ANDLconst [31] y))
7778         // result: (SHLL x y)
7779         for {
7780                 x := v_0
7781                 if v_1.Op != Op386ANDLconst || auxIntToInt32(v_1.AuxInt) != 31 {
7782                         break
7783                 }
7784                 y := v_1.Args[0]
7785                 v.reset(Op386SHLL)
7786                 v.AddArg2(x, y)
7787                 return true
7788         }
7789         return false
7790 }
7791 func rewriteValue386_Op386SHLLconst(v *Value) bool {
7792         v_0 := v.Args[0]
7793         // match: (SHLLconst x [0])
7794         // result: x
7795         for {
7796                 if auxIntToInt32(v.AuxInt) != 0 {
7797                         break
7798                 }
7799                 x := v_0
7800                 v.copyOf(x)
7801                 return true
7802         }
7803         return false
7804 }
7805 func rewriteValue386_Op386SHRB(v *Value) bool {
7806         v_1 := v.Args[1]
7807         v_0 := v.Args[0]
7808         // match: (SHRB x (MOVLconst [c]))
7809         // cond: c&31 < 8
7810         // result: (SHRBconst [int8(c&31)] x)
7811         for {
7812                 x := v_0
7813                 if v_1.Op != Op386MOVLconst {
7814                         break
7815                 }
7816                 c := auxIntToInt32(v_1.AuxInt)
7817                 if !(c&31 < 8) {
7818                         break
7819                 }
7820                 v.reset(Op386SHRBconst)
7821                 v.AuxInt = int8ToAuxInt(int8(c & 31))
7822                 v.AddArg(x)
7823                 return true
7824         }
7825         // match: (SHRB _ (MOVLconst [c]))
7826         // cond: c&31 >= 8
7827         // result: (MOVLconst [0])
7828         for {
7829                 if v_1.Op != Op386MOVLconst {
7830                         break
7831                 }
7832                 c := auxIntToInt32(v_1.AuxInt)
7833                 if !(c&31 >= 8) {
7834                         break
7835                 }
7836                 v.reset(Op386MOVLconst)
7837                 v.AuxInt = int32ToAuxInt(0)
7838                 return true
7839         }
7840         return false
7841 }
7842 func rewriteValue386_Op386SHRBconst(v *Value) bool {
7843         v_0 := v.Args[0]
7844         // match: (SHRBconst x [0])
7845         // result: x
7846         for {
7847                 if auxIntToInt8(v.AuxInt) != 0 {
7848                         break
7849                 }
7850                 x := v_0
7851                 v.copyOf(x)
7852                 return true
7853         }
7854         return false
7855 }
7856 func rewriteValue386_Op386SHRL(v *Value) bool {
7857         v_1 := v.Args[1]
7858         v_0 := v.Args[0]
7859         // match: (SHRL x (MOVLconst [c]))
7860         // result: (SHRLconst [c&31] x)
7861         for {
7862                 x := v_0
7863                 if v_1.Op != Op386MOVLconst {
7864                         break
7865                 }
7866                 c := auxIntToInt32(v_1.AuxInt)
7867                 v.reset(Op386SHRLconst)
7868                 v.AuxInt = int32ToAuxInt(c & 31)
7869                 v.AddArg(x)
7870                 return true
7871         }
7872         // match: (SHRL x (ANDLconst [31] y))
7873         // result: (SHRL x y)
7874         for {
7875                 x := v_0
7876                 if v_1.Op != Op386ANDLconst || auxIntToInt32(v_1.AuxInt) != 31 {
7877                         break
7878                 }
7879                 y := v_1.Args[0]
7880                 v.reset(Op386SHRL)
7881                 v.AddArg2(x, y)
7882                 return true
7883         }
7884         return false
7885 }
7886 func rewriteValue386_Op386SHRLconst(v *Value) bool {
7887         v_0 := v.Args[0]
7888         // match: (SHRLconst x [0])
7889         // result: x
7890         for {
7891                 if auxIntToInt32(v.AuxInt) != 0 {
7892                         break
7893                 }
7894                 x := v_0
7895                 v.copyOf(x)
7896                 return true
7897         }
7898         return false
7899 }
7900 func rewriteValue386_Op386SHRW(v *Value) bool {
7901         v_1 := v.Args[1]
7902         v_0 := v.Args[0]
7903         // match: (SHRW x (MOVLconst [c]))
7904         // cond: c&31 < 16
7905         // result: (SHRWconst [int16(c&31)] x)
7906         for {
7907                 x := v_0
7908                 if v_1.Op != Op386MOVLconst {
7909                         break
7910                 }
7911                 c := auxIntToInt32(v_1.AuxInt)
7912                 if !(c&31 < 16) {
7913                         break
7914                 }
7915                 v.reset(Op386SHRWconst)
7916                 v.AuxInt = int16ToAuxInt(int16(c & 31))
7917                 v.AddArg(x)
7918                 return true
7919         }
7920         // match: (SHRW _ (MOVLconst [c]))
7921         // cond: c&31 >= 16
7922         // result: (MOVLconst [0])
7923         for {
7924                 if v_1.Op != Op386MOVLconst {
7925                         break
7926                 }
7927                 c := auxIntToInt32(v_1.AuxInt)
7928                 if !(c&31 >= 16) {
7929                         break
7930                 }
7931                 v.reset(Op386MOVLconst)
7932                 v.AuxInt = int32ToAuxInt(0)
7933                 return true
7934         }
7935         return false
7936 }
7937 func rewriteValue386_Op386SHRWconst(v *Value) bool {
7938         v_0 := v.Args[0]
7939         // match: (SHRWconst x [0])
7940         // result: x
7941         for {
7942                 if auxIntToInt16(v.AuxInt) != 0 {
7943                         break
7944                 }
7945                 x := v_0
7946                 v.copyOf(x)
7947                 return true
7948         }
7949         return false
7950 }
7951 func rewriteValue386_Op386SUBL(v *Value) bool {
7952         v_1 := v.Args[1]
7953         v_0 := v.Args[0]
7954         b := v.Block
7955         // match: (SUBL x (MOVLconst [c]))
7956         // result: (SUBLconst x [c])
7957         for {
7958                 x := v_0
7959                 if v_1.Op != Op386MOVLconst {
7960                         break
7961                 }
7962                 c := auxIntToInt32(v_1.AuxInt)
7963                 v.reset(Op386SUBLconst)
7964                 v.AuxInt = int32ToAuxInt(c)
7965                 v.AddArg(x)
7966                 return true
7967         }
7968         // match: (SUBL (MOVLconst [c]) x)
7969         // result: (NEGL (SUBLconst <v.Type> x [c]))
7970         for {
7971                 if v_0.Op != Op386MOVLconst {
7972                         break
7973                 }
7974                 c := auxIntToInt32(v_0.AuxInt)
7975                 x := v_1
7976                 v.reset(Op386NEGL)
7977                 v0 := b.NewValue0(v.Pos, Op386SUBLconst, v.Type)
7978                 v0.AuxInt = int32ToAuxInt(c)
7979                 v0.AddArg(x)
7980                 v.AddArg(v0)
7981                 return true
7982         }
7983         // match: (SUBL x l:(MOVLload [off] {sym} ptr mem))
7984         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
7985         // result: (SUBLload x [off] {sym} ptr mem)
7986         for {
7987                 x := v_0
7988                 l := v_1
7989                 if l.Op != Op386MOVLload {
7990                         break
7991                 }
7992                 off := auxIntToInt32(l.AuxInt)
7993                 sym := auxToSym(l.Aux)
7994                 mem := l.Args[1]
7995                 ptr := l.Args[0]
7996                 if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
7997                         break
7998                 }
7999                 v.reset(Op386SUBLload)
8000                 v.AuxInt = int32ToAuxInt(off)
8001                 v.Aux = symToAux(sym)
8002                 v.AddArg3(x, ptr, mem)
8003                 return true
8004         }
8005         // match: (SUBL x x)
8006         // result: (MOVLconst [0])
8007         for {
8008                 x := v_0
8009                 if x != v_1 {
8010                         break
8011                 }
8012                 v.reset(Op386MOVLconst)
8013                 v.AuxInt = int32ToAuxInt(0)
8014                 return true
8015         }
8016         return false
8017 }
8018 func rewriteValue386_Op386SUBLcarry(v *Value) bool {
8019         v_1 := v.Args[1]
8020         v_0 := v.Args[0]
8021         // match: (SUBLcarry x (MOVLconst [c]))
8022         // result: (SUBLconstcarry [c] x)
8023         for {
8024                 x := v_0
8025                 if v_1.Op != Op386MOVLconst {
8026                         break
8027                 }
8028                 c := auxIntToInt32(v_1.AuxInt)
8029                 v.reset(Op386SUBLconstcarry)
8030                 v.AuxInt = int32ToAuxInt(c)
8031                 v.AddArg(x)
8032                 return true
8033         }
8034         return false
8035 }
8036 func rewriteValue386_Op386SUBLconst(v *Value) bool {
8037         v_0 := v.Args[0]
8038         // match: (SUBLconst [c] x)
8039         // cond: c==0
8040         // result: x
8041         for {
8042                 c := auxIntToInt32(v.AuxInt)
8043                 x := v_0
8044                 if !(c == 0) {
8045                         break
8046                 }
8047                 v.copyOf(x)
8048                 return true
8049         }
8050         // match: (SUBLconst [c] x)
8051         // result: (ADDLconst [-c] x)
8052         for {
8053                 c := auxIntToInt32(v.AuxInt)
8054                 x := v_0
8055                 v.reset(Op386ADDLconst)
8056                 v.AuxInt = int32ToAuxInt(-c)
8057                 v.AddArg(x)
8058                 return true
8059         }
8060 }
8061 func rewriteValue386_Op386SUBLload(v *Value) bool {
8062         v_2 := v.Args[2]
8063         v_1 := v.Args[1]
8064         v_0 := v.Args[0]
8065         b := v.Block
8066         config := b.Func.Config
8067         // match: (SUBLload [off1] {sym} val (ADDLconst [off2] base) mem)
8068         // cond: is32Bit(int64(off1)+int64(off2))
8069         // result: (SUBLload [off1+off2] {sym} val base mem)
8070         for {
8071                 off1 := auxIntToInt32(v.AuxInt)
8072                 sym := auxToSym(v.Aux)
8073                 val := v_0
8074                 if v_1.Op != Op386ADDLconst {
8075                         break
8076                 }
8077                 off2 := auxIntToInt32(v_1.AuxInt)
8078                 base := v_1.Args[0]
8079                 mem := v_2
8080                 if !(is32Bit(int64(off1) + int64(off2))) {
8081                         break
8082                 }
8083                 v.reset(Op386SUBLload)
8084                 v.AuxInt = int32ToAuxInt(off1 + off2)
8085                 v.Aux = symToAux(sym)
8086                 v.AddArg3(val, base, mem)
8087                 return true
8088         }
8089         // match: (SUBLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
8090         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8091         // result: (SUBLload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
8092         for {
8093                 off1 := auxIntToInt32(v.AuxInt)
8094                 sym1 := auxToSym(v.Aux)
8095                 val := v_0
8096                 if v_1.Op != Op386LEAL {
8097                         break
8098                 }
8099                 off2 := auxIntToInt32(v_1.AuxInt)
8100                 sym2 := auxToSym(v_1.Aux)
8101                 base := v_1.Args[0]
8102                 mem := v_2
8103                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8104                         break
8105                 }
8106                 v.reset(Op386SUBLload)
8107                 v.AuxInt = int32ToAuxInt(off1 + off2)
8108                 v.Aux = symToAux(mergeSym(sym1, sym2))
8109                 v.AddArg3(val, base, mem)
8110                 return true
8111         }
8112         return false
8113 }
8114 func rewriteValue386_Op386SUBLmodify(v *Value) bool {
8115         v_2 := v.Args[2]
8116         v_1 := v.Args[1]
8117         v_0 := v.Args[0]
8118         b := v.Block
8119         config := b.Func.Config
8120         // match: (SUBLmodify [off1] {sym} (ADDLconst [off2] base) val mem)
8121         // cond: is32Bit(int64(off1)+int64(off2))
8122         // result: (SUBLmodify [off1+off2] {sym} base val mem)
8123         for {
8124                 off1 := auxIntToInt32(v.AuxInt)
8125                 sym := auxToSym(v.Aux)
8126                 if v_0.Op != Op386ADDLconst {
8127                         break
8128                 }
8129                 off2 := auxIntToInt32(v_0.AuxInt)
8130                 base := v_0.Args[0]
8131                 val := v_1
8132                 mem := v_2
8133                 if !(is32Bit(int64(off1) + int64(off2))) {
8134                         break
8135                 }
8136                 v.reset(Op386SUBLmodify)
8137                 v.AuxInt = int32ToAuxInt(off1 + off2)
8138                 v.Aux = symToAux(sym)
8139                 v.AddArg3(base, val, mem)
8140                 return true
8141         }
8142         // match: (SUBLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
8143         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8144         // result: (SUBLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem)
8145         for {
8146                 off1 := auxIntToInt32(v.AuxInt)
8147                 sym1 := auxToSym(v.Aux)
8148                 if v_0.Op != Op386LEAL {
8149                         break
8150                 }
8151                 off2 := auxIntToInt32(v_0.AuxInt)
8152                 sym2 := auxToSym(v_0.Aux)
8153                 base := v_0.Args[0]
8154                 val := v_1
8155                 mem := v_2
8156                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8157                         break
8158                 }
8159                 v.reset(Op386SUBLmodify)
8160                 v.AuxInt = int32ToAuxInt(off1 + off2)
8161                 v.Aux = symToAux(mergeSym(sym1, sym2))
8162                 v.AddArg3(base, val, mem)
8163                 return true
8164         }
8165         return false
8166 }
8167 func rewriteValue386_Op386SUBSD(v *Value) bool {
8168         v_1 := v.Args[1]
8169         v_0 := v.Args[0]
8170         // match: (SUBSD x l:(MOVSDload [off] {sym} ptr mem))
8171         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
8172         // result: (SUBSDload x [off] {sym} ptr mem)
8173         for {
8174                 x := v_0
8175                 l := v_1
8176                 if l.Op != Op386MOVSDload {
8177                         break
8178                 }
8179                 off := auxIntToInt32(l.AuxInt)
8180                 sym := auxToSym(l.Aux)
8181                 mem := l.Args[1]
8182                 ptr := l.Args[0]
8183                 if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
8184                         break
8185                 }
8186                 v.reset(Op386SUBSDload)
8187                 v.AuxInt = int32ToAuxInt(off)
8188                 v.Aux = symToAux(sym)
8189                 v.AddArg3(x, ptr, mem)
8190                 return true
8191         }
8192         return false
8193 }
8194 func rewriteValue386_Op386SUBSDload(v *Value) bool {
8195         v_2 := v.Args[2]
8196         v_1 := v.Args[1]
8197         v_0 := v.Args[0]
8198         b := v.Block
8199         config := b.Func.Config
8200         // match: (SUBSDload [off1] {sym} val (ADDLconst [off2] base) mem)
8201         // cond: is32Bit(int64(off1)+int64(off2))
8202         // result: (SUBSDload [off1+off2] {sym} val base mem)
8203         for {
8204                 off1 := auxIntToInt32(v.AuxInt)
8205                 sym := auxToSym(v.Aux)
8206                 val := v_0
8207                 if v_1.Op != Op386ADDLconst {
8208                         break
8209                 }
8210                 off2 := auxIntToInt32(v_1.AuxInt)
8211                 base := v_1.Args[0]
8212                 mem := v_2
8213                 if !(is32Bit(int64(off1) + int64(off2))) {
8214                         break
8215                 }
8216                 v.reset(Op386SUBSDload)
8217                 v.AuxInt = int32ToAuxInt(off1 + off2)
8218                 v.Aux = symToAux(sym)
8219                 v.AddArg3(val, base, mem)
8220                 return true
8221         }
8222         // match: (SUBSDload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
8223         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8224         // result: (SUBSDload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
8225         for {
8226                 off1 := auxIntToInt32(v.AuxInt)
8227                 sym1 := auxToSym(v.Aux)
8228                 val := v_0
8229                 if v_1.Op != Op386LEAL {
8230                         break
8231                 }
8232                 off2 := auxIntToInt32(v_1.AuxInt)
8233                 sym2 := auxToSym(v_1.Aux)
8234                 base := v_1.Args[0]
8235                 mem := v_2
8236                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8237                         break
8238                 }
8239                 v.reset(Op386SUBSDload)
8240                 v.AuxInt = int32ToAuxInt(off1 + off2)
8241                 v.Aux = symToAux(mergeSym(sym1, sym2))
8242                 v.AddArg3(val, base, mem)
8243                 return true
8244         }
8245         return false
8246 }
8247 func rewriteValue386_Op386SUBSS(v *Value) bool {
8248         v_1 := v.Args[1]
8249         v_0 := v.Args[0]
8250         // match: (SUBSS x l:(MOVSSload [off] {sym} ptr mem))
8251         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
8252         // result: (SUBSSload x [off] {sym} ptr mem)
8253         for {
8254                 x := v_0
8255                 l := v_1
8256                 if l.Op != Op386MOVSSload {
8257                         break
8258                 }
8259                 off := auxIntToInt32(l.AuxInt)
8260                 sym := auxToSym(l.Aux)
8261                 mem := l.Args[1]
8262                 ptr := l.Args[0]
8263                 if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
8264                         break
8265                 }
8266                 v.reset(Op386SUBSSload)
8267                 v.AuxInt = int32ToAuxInt(off)
8268                 v.Aux = symToAux(sym)
8269                 v.AddArg3(x, ptr, mem)
8270                 return true
8271         }
8272         return false
8273 }
8274 func rewriteValue386_Op386SUBSSload(v *Value) bool {
8275         v_2 := v.Args[2]
8276         v_1 := v.Args[1]
8277         v_0 := v.Args[0]
8278         b := v.Block
8279         config := b.Func.Config
8280         // match: (SUBSSload [off1] {sym} val (ADDLconst [off2] base) mem)
8281         // cond: is32Bit(int64(off1)+int64(off2))
8282         // result: (SUBSSload [off1+off2] {sym} val base mem)
8283         for {
8284                 off1 := auxIntToInt32(v.AuxInt)
8285                 sym := auxToSym(v.Aux)
8286                 val := v_0
8287                 if v_1.Op != Op386ADDLconst {
8288                         break
8289                 }
8290                 off2 := auxIntToInt32(v_1.AuxInt)
8291                 base := v_1.Args[0]
8292                 mem := v_2
8293                 if !(is32Bit(int64(off1) + int64(off2))) {
8294                         break
8295                 }
8296                 v.reset(Op386SUBSSload)
8297                 v.AuxInt = int32ToAuxInt(off1 + off2)
8298                 v.Aux = symToAux(sym)
8299                 v.AddArg3(val, base, mem)
8300                 return true
8301         }
8302         // match: (SUBSSload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
8303         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8304         // result: (SUBSSload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
8305         for {
8306                 off1 := auxIntToInt32(v.AuxInt)
8307                 sym1 := auxToSym(v.Aux)
8308                 val := v_0
8309                 if v_1.Op != Op386LEAL {
8310                         break
8311                 }
8312                 off2 := auxIntToInt32(v_1.AuxInt)
8313                 sym2 := auxToSym(v_1.Aux)
8314                 base := v_1.Args[0]
8315                 mem := v_2
8316                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8317                         break
8318                 }
8319                 v.reset(Op386SUBSSload)
8320                 v.AuxInt = int32ToAuxInt(off1 + off2)
8321                 v.Aux = symToAux(mergeSym(sym1, sym2))
8322                 v.AddArg3(val, base, mem)
8323                 return true
8324         }
8325         return false
8326 }
8327 func rewriteValue386_Op386XORL(v *Value) bool {
8328         v_1 := v.Args[1]
8329         v_0 := v.Args[0]
8330         // match: (XORL x (MOVLconst [c]))
8331         // result: (XORLconst [c] x)
8332         for {
8333                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8334                         x := v_0
8335                         if v_1.Op != Op386MOVLconst {
8336                                 continue
8337                         }
8338                         c := auxIntToInt32(v_1.AuxInt)
8339                         v.reset(Op386XORLconst)
8340                         v.AuxInt = int32ToAuxInt(c)
8341                         v.AddArg(x)
8342                         return true
8343                 }
8344                 break
8345         }
8346         // match: (XORL (SHLLconst [c] x) (SHRLconst [d] x))
8347         // cond: d == 32-c
8348         // result: (ROLLconst [c] x)
8349         for {
8350                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8351                         if v_0.Op != Op386SHLLconst {
8352                                 continue
8353                         }
8354                         c := auxIntToInt32(v_0.AuxInt)
8355                         x := v_0.Args[0]
8356                         if v_1.Op != Op386SHRLconst {
8357                                 continue
8358                         }
8359                         d := auxIntToInt32(v_1.AuxInt)
8360                         if x != v_1.Args[0] || !(d == 32-c) {
8361                                 continue
8362                         }
8363                         v.reset(Op386ROLLconst)
8364                         v.AuxInt = int32ToAuxInt(c)
8365                         v.AddArg(x)
8366                         return true
8367                 }
8368                 break
8369         }
8370         // match: (XORL <t> (SHLLconst x [c]) (SHRWconst x [d]))
8371         // cond: c < 16 && d == int16(16-c) && t.Size() == 2
8372         // result: (ROLWconst x [int16(c)])
8373         for {
8374                 t := v.Type
8375                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8376                         if v_0.Op != Op386SHLLconst {
8377                                 continue
8378                         }
8379                         c := auxIntToInt32(v_0.AuxInt)
8380                         x := v_0.Args[0]
8381                         if v_1.Op != Op386SHRWconst {
8382                                 continue
8383                         }
8384                         d := auxIntToInt16(v_1.AuxInt)
8385                         if x != v_1.Args[0] || !(c < 16 && d == int16(16-c) && t.Size() == 2) {
8386                                 continue
8387                         }
8388                         v.reset(Op386ROLWconst)
8389                         v.AuxInt = int16ToAuxInt(int16(c))
8390                         v.AddArg(x)
8391                         return true
8392                 }
8393                 break
8394         }
8395         // match: (XORL <t> (SHLLconst x [c]) (SHRBconst x [d]))
8396         // cond: c < 8 && d == int8(8-c) && t.Size() == 1
8397         // result: (ROLBconst x [int8(c)])
8398         for {
8399                 t := v.Type
8400                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8401                         if v_0.Op != Op386SHLLconst {
8402                                 continue
8403                         }
8404                         c := auxIntToInt32(v_0.AuxInt)
8405                         x := v_0.Args[0]
8406                         if v_1.Op != Op386SHRBconst {
8407                                 continue
8408                         }
8409                         d := auxIntToInt8(v_1.AuxInt)
8410                         if x != v_1.Args[0] || !(c < 8 && d == int8(8-c) && t.Size() == 1) {
8411                                 continue
8412                         }
8413                         v.reset(Op386ROLBconst)
8414                         v.AuxInt = int8ToAuxInt(int8(c))
8415                         v.AddArg(x)
8416                         return true
8417                 }
8418                 break
8419         }
8420         // match: (XORL x l:(MOVLload [off] {sym} ptr mem))
8421         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
8422         // result: (XORLload x [off] {sym} ptr mem)
8423         for {
8424                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8425                         x := v_0
8426                         l := v_1
8427                         if l.Op != Op386MOVLload {
8428                                 continue
8429                         }
8430                         off := auxIntToInt32(l.AuxInt)
8431                         sym := auxToSym(l.Aux)
8432                         mem := l.Args[1]
8433                         ptr := l.Args[0]
8434                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
8435                                 continue
8436                         }
8437                         v.reset(Op386XORLload)
8438                         v.AuxInt = int32ToAuxInt(off)
8439                         v.Aux = symToAux(sym)
8440                         v.AddArg3(x, ptr, mem)
8441                         return true
8442                 }
8443                 break
8444         }
8445         // match: (XORL x x)
8446         // result: (MOVLconst [0])
8447         for {
8448                 x := v_0
8449                 if x != v_1 {
8450                         break
8451                 }
8452                 v.reset(Op386MOVLconst)
8453                 v.AuxInt = int32ToAuxInt(0)
8454                 return true
8455         }
8456         return false
8457 }
8458 func rewriteValue386_Op386XORLconst(v *Value) bool {
8459         v_0 := v.Args[0]
8460         // match: (XORLconst [c] (XORLconst [d] x))
8461         // result: (XORLconst [c ^ d] x)
8462         for {
8463                 c := auxIntToInt32(v.AuxInt)
8464                 if v_0.Op != Op386XORLconst {
8465                         break
8466                 }
8467                 d := auxIntToInt32(v_0.AuxInt)
8468                 x := v_0.Args[0]
8469                 v.reset(Op386XORLconst)
8470                 v.AuxInt = int32ToAuxInt(c ^ d)
8471                 v.AddArg(x)
8472                 return true
8473         }
8474         // match: (XORLconst [c] x)
8475         // cond: c==0
8476         // result: x
8477         for {
8478                 c := auxIntToInt32(v.AuxInt)
8479                 x := v_0
8480                 if !(c == 0) {
8481                         break
8482                 }
8483                 v.copyOf(x)
8484                 return true
8485         }
8486         // match: (XORLconst [c] (MOVLconst [d]))
8487         // result: (MOVLconst [c^d])
8488         for {
8489                 c := auxIntToInt32(v.AuxInt)
8490                 if v_0.Op != Op386MOVLconst {
8491                         break
8492                 }
8493                 d := auxIntToInt32(v_0.AuxInt)
8494                 v.reset(Op386MOVLconst)
8495                 v.AuxInt = int32ToAuxInt(c ^ d)
8496                 return true
8497         }
8498         return false
8499 }
8500 func rewriteValue386_Op386XORLconstmodify(v *Value) bool {
8501         v_1 := v.Args[1]
8502         v_0 := v.Args[0]
8503         b := v.Block
8504         config := b.Func.Config
8505         // match: (XORLconstmodify [valoff1] {sym} (ADDLconst [off2] base) mem)
8506         // cond: valoff1.canAdd32(off2)
8507         // result: (XORLconstmodify [valoff1.addOffset32(off2)] {sym} base mem)
8508         for {
8509                 valoff1 := auxIntToValAndOff(v.AuxInt)
8510                 sym := auxToSym(v.Aux)
8511                 if v_0.Op != Op386ADDLconst {
8512                         break
8513                 }
8514                 off2 := auxIntToInt32(v_0.AuxInt)
8515                 base := v_0.Args[0]
8516                 mem := v_1
8517                 if !(valoff1.canAdd32(off2)) {
8518                         break
8519                 }
8520                 v.reset(Op386XORLconstmodify)
8521                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
8522                 v.Aux = symToAux(sym)
8523                 v.AddArg2(base, mem)
8524                 return true
8525         }
8526         // match: (XORLconstmodify [valoff1] {sym1} (LEAL [off2] {sym2} base) mem)
8527         // cond: valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8528         // result: (XORLconstmodify [valoff1.addOffset32(off2)] {mergeSym(sym1,sym2)} base mem)
8529         for {
8530                 valoff1 := auxIntToValAndOff(v.AuxInt)
8531                 sym1 := auxToSym(v.Aux)
8532                 if v_0.Op != Op386LEAL {
8533                         break
8534                 }
8535                 off2 := auxIntToInt32(v_0.AuxInt)
8536                 sym2 := auxToSym(v_0.Aux)
8537                 base := v_0.Args[0]
8538                 mem := v_1
8539                 if !(valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8540                         break
8541                 }
8542                 v.reset(Op386XORLconstmodify)
8543                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
8544                 v.Aux = symToAux(mergeSym(sym1, sym2))
8545                 v.AddArg2(base, mem)
8546                 return true
8547         }
8548         return false
8549 }
8550 func rewriteValue386_Op386XORLload(v *Value) bool {
8551         v_2 := v.Args[2]
8552         v_1 := v.Args[1]
8553         v_0 := v.Args[0]
8554         b := v.Block
8555         config := b.Func.Config
8556         // match: (XORLload [off1] {sym} val (ADDLconst [off2] base) mem)
8557         // cond: is32Bit(int64(off1)+int64(off2))
8558         // result: (XORLload [off1+off2] {sym} val base mem)
8559         for {
8560                 off1 := auxIntToInt32(v.AuxInt)
8561                 sym := auxToSym(v.Aux)
8562                 val := v_0
8563                 if v_1.Op != Op386ADDLconst {
8564                         break
8565                 }
8566                 off2 := auxIntToInt32(v_1.AuxInt)
8567                 base := v_1.Args[0]
8568                 mem := v_2
8569                 if !(is32Bit(int64(off1) + int64(off2))) {
8570                         break
8571                 }
8572                 v.reset(Op386XORLload)
8573                 v.AuxInt = int32ToAuxInt(off1 + off2)
8574                 v.Aux = symToAux(sym)
8575                 v.AddArg3(val, base, mem)
8576                 return true
8577         }
8578         // match: (XORLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
8579         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8580         // result: (XORLload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
8581         for {
8582                 off1 := auxIntToInt32(v.AuxInt)
8583                 sym1 := auxToSym(v.Aux)
8584                 val := v_0
8585                 if v_1.Op != Op386LEAL {
8586                         break
8587                 }
8588                 off2 := auxIntToInt32(v_1.AuxInt)
8589                 sym2 := auxToSym(v_1.Aux)
8590                 base := v_1.Args[0]
8591                 mem := v_2
8592                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8593                         break
8594                 }
8595                 v.reset(Op386XORLload)
8596                 v.AuxInt = int32ToAuxInt(off1 + off2)
8597                 v.Aux = symToAux(mergeSym(sym1, sym2))
8598                 v.AddArg3(val, base, mem)
8599                 return true
8600         }
8601         return false
8602 }
8603 func rewriteValue386_Op386XORLmodify(v *Value) bool {
8604         v_2 := v.Args[2]
8605         v_1 := v.Args[1]
8606         v_0 := v.Args[0]
8607         b := v.Block
8608         config := b.Func.Config
8609         // match: (XORLmodify [off1] {sym} (ADDLconst [off2] base) val mem)
8610         // cond: is32Bit(int64(off1)+int64(off2))
8611         // result: (XORLmodify [off1+off2] {sym} base val mem)
8612         for {
8613                 off1 := auxIntToInt32(v.AuxInt)
8614                 sym := auxToSym(v.Aux)
8615                 if v_0.Op != Op386ADDLconst {
8616                         break
8617                 }
8618                 off2 := auxIntToInt32(v_0.AuxInt)
8619                 base := v_0.Args[0]
8620                 val := v_1
8621                 mem := v_2
8622                 if !(is32Bit(int64(off1) + int64(off2))) {
8623                         break
8624                 }
8625                 v.reset(Op386XORLmodify)
8626                 v.AuxInt = int32ToAuxInt(off1 + off2)
8627                 v.Aux = symToAux(sym)
8628                 v.AddArg3(base, val, mem)
8629                 return true
8630         }
8631         // match: (XORLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
8632         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8633         // result: (XORLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem)
8634         for {
8635                 off1 := auxIntToInt32(v.AuxInt)
8636                 sym1 := auxToSym(v.Aux)
8637                 if v_0.Op != Op386LEAL {
8638                         break
8639                 }
8640                 off2 := auxIntToInt32(v_0.AuxInt)
8641                 sym2 := auxToSym(v_0.Aux)
8642                 base := v_0.Args[0]
8643                 val := v_1
8644                 mem := v_2
8645                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8646                         break
8647                 }
8648                 v.reset(Op386XORLmodify)
8649                 v.AuxInt = int32ToAuxInt(off1 + off2)
8650                 v.Aux = symToAux(mergeSym(sym1, sym2))
8651                 v.AddArg3(base, val, mem)
8652                 return true
8653         }
8654         return false
8655 }
8656 func rewriteValue386_OpAddr(v *Value) bool {
8657         v_0 := v.Args[0]
8658         // match: (Addr {sym} base)
8659         // result: (LEAL {sym} base)
8660         for {
8661                 sym := auxToSym(v.Aux)
8662                 base := v_0
8663                 v.reset(Op386LEAL)
8664                 v.Aux = symToAux(sym)
8665                 v.AddArg(base)
8666                 return true
8667         }
8668 }
8669 func rewriteValue386_OpConst16(v *Value) bool {
8670         // match: (Const16 [c])
8671         // result: (MOVLconst [int32(c)])
8672         for {
8673                 c := auxIntToInt16(v.AuxInt)
8674                 v.reset(Op386MOVLconst)
8675                 v.AuxInt = int32ToAuxInt(int32(c))
8676                 return true
8677         }
8678 }
8679 func rewriteValue386_OpConst8(v *Value) bool {
8680         // match: (Const8 [c])
8681         // result: (MOVLconst [int32(c)])
8682         for {
8683                 c := auxIntToInt8(v.AuxInt)
8684                 v.reset(Op386MOVLconst)
8685                 v.AuxInt = int32ToAuxInt(int32(c))
8686                 return true
8687         }
8688 }
8689 func rewriteValue386_OpConstBool(v *Value) bool {
8690         // match: (ConstBool [c])
8691         // result: (MOVLconst [b2i32(c)])
8692         for {
8693                 c := auxIntToBool(v.AuxInt)
8694                 v.reset(Op386MOVLconst)
8695                 v.AuxInt = int32ToAuxInt(b2i32(c))
8696                 return true
8697         }
8698 }
8699 func rewriteValue386_OpConstNil(v *Value) bool {
8700         // match: (ConstNil)
8701         // result: (MOVLconst [0])
8702         for {
8703                 v.reset(Op386MOVLconst)
8704                 v.AuxInt = int32ToAuxInt(0)
8705                 return true
8706         }
8707 }
8708 func rewriteValue386_OpCtz16(v *Value) bool {
8709         v_0 := v.Args[0]
8710         b := v.Block
8711         typ := &b.Func.Config.Types
8712         // match: (Ctz16 x)
8713         // result: (BSFL (ORLconst <typ.UInt32> [0x10000] x))
8714         for {
8715                 x := v_0
8716                 v.reset(Op386BSFL)
8717                 v0 := b.NewValue0(v.Pos, Op386ORLconst, typ.UInt32)
8718                 v0.AuxInt = int32ToAuxInt(0x10000)
8719                 v0.AddArg(x)
8720                 v.AddArg(v0)
8721                 return true
8722         }
8723 }
8724 func rewriteValue386_OpDiv8(v *Value) bool {
8725         v_1 := v.Args[1]
8726         v_0 := v.Args[0]
8727         b := v.Block
8728         typ := &b.Func.Config.Types
8729         // match: (Div8 x y)
8730         // result: (DIVW (SignExt8to16 x) (SignExt8to16 y))
8731         for {
8732                 x := v_0
8733                 y := v_1
8734                 v.reset(Op386DIVW)
8735                 v0 := b.NewValue0(v.Pos, OpSignExt8to16, typ.Int16)
8736                 v0.AddArg(x)
8737                 v1 := b.NewValue0(v.Pos, OpSignExt8to16, typ.Int16)
8738                 v1.AddArg(y)
8739                 v.AddArg2(v0, v1)
8740                 return true
8741         }
8742 }
8743 func rewriteValue386_OpDiv8u(v *Value) bool {
8744         v_1 := v.Args[1]
8745         v_0 := v.Args[0]
8746         b := v.Block
8747         typ := &b.Func.Config.Types
8748         // match: (Div8u x y)
8749         // result: (DIVWU (ZeroExt8to16 x) (ZeroExt8to16 y))
8750         for {
8751                 x := v_0
8752                 y := v_1
8753                 v.reset(Op386DIVWU)
8754                 v0 := b.NewValue0(v.Pos, OpZeroExt8to16, typ.UInt16)
8755                 v0.AddArg(x)
8756                 v1 := b.NewValue0(v.Pos, OpZeroExt8to16, typ.UInt16)
8757                 v1.AddArg(y)
8758                 v.AddArg2(v0, v1)
8759                 return true
8760         }
8761 }
8762 func rewriteValue386_OpEq16(v *Value) bool {
8763         v_1 := v.Args[1]
8764         v_0 := v.Args[0]
8765         b := v.Block
8766         // match: (Eq16 x y)
8767         // result: (SETEQ (CMPW x y))
8768         for {
8769                 x := v_0
8770                 y := v_1
8771                 v.reset(Op386SETEQ)
8772                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
8773                 v0.AddArg2(x, y)
8774                 v.AddArg(v0)
8775                 return true
8776         }
8777 }
8778 func rewriteValue386_OpEq32(v *Value) bool {
8779         v_1 := v.Args[1]
8780         v_0 := v.Args[0]
8781         b := v.Block
8782         // match: (Eq32 x y)
8783         // result: (SETEQ (CMPL x y))
8784         for {
8785                 x := v_0
8786                 y := v_1
8787                 v.reset(Op386SETEQ)
8788                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
8789                 v0.AddArg2(x, y)
8790                 v.AddArg(v0)
8791                 return true
8792         }
8793 }
8794 func rewriteValue386_OpEq32F(v *Value) bool {
8795         v_1 := v.Args[1]
8796         v_0 := v.Args[0]
8797         b := v.Block
8798         // match: (Eq32F x y)
8799         // result: (SETEQF (UCOMISS x y))
8800         for {
8801                 x := v_0
8802                 y := v_1
8803                 v.reset(Op386SETEQF)
8804                 v0 := b.NewValue0(v.Pos, Op386UCOMISS, types.TypeFlags)
8805                 v0.AddArg2(x, y)
8806                 v.AddArg(v0)
8807                 return true
8808         }
8809 }
8810 func rewriteValue386_OpEq64F(v *Value) bool {
8811         v_1 := v.Args[1]
8812         v_0 := v.Args[0]
8813         b := v.Block
8814         // match: (Eq64F x y)
8815         // result: (SETEQF (UCOMISD x y))
8816         for {
8817                 x := v_0
8818                 y := v_1
8819                 v.reset(Op386SETEQF)
8820                 v0 := b.NewValue0(v.Pos, Op386UCOMISD, types.TypeFlags)
8821                 v0.AddArg2(x, y)
8822                 v.AddArg(v0)
8823                 return true
8824         }
8825 }
8826 func rewriteValue386_OpEq8(v *Value) bool {
8827         v_1 := v.Args[1]
8828         v_0 := v.Args[0]
8829         b := v.Block
8830         // match: (Eq8 x y)
8831         // result: (SETEQ (CMPB x y))
8832         for {
8833                 x := v_0
8834                 y := v_1
8835                 v.reset(Op386SETEQ)
8836                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
8837                 v0.AddArg2(x, y)
8838                 v.AddArg(v0)
8839                 return true
8840         }
8841 }
8842 func rewriteValue386_OpEqB(v *Value) bool {
8843         v_1 := v.Args[1]
8844         v_0 := v.Args[0]
8845         b := v.Block
8846         // match: (EqB x y)
8847         // result: (SETEQ (CMPB x y))
8848         for {
8849                 x := v_0
8850                 y := v_1
8851                 v.reset(Op386SETEQ)
8852                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
8853                 v0.AddArg2(x, y)
8854                 v.AddArg(v0)
8855                 return true
8856         }
8857 }
8858 func rewriteValue386_OpEqPtr(v *Value) bool {
8859         v_1 := v.Args[1]
8860         v_0 := v.Args[0]
8861         b := v.Block
8862         // match: (EqPtr x y)
8863         // result: (SETEQ (CMPL x y))
8864         for {
8865                 x := v_0
8866                 y := v_1
8867                 v.reset(Op386SETEQ)
8868                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
8869                 v0.AddArg2(x, y)
8870                 v.AddArg(v0)
8871                 return true
8872         }
8873 }
8874 func rewriteValue386_OpIsInBounds(v *Value) bool {
8875         v_1 := v.Args[1]
8876         v_0 := v.Args[0]
8877         b := v.Block
8878         // match: (IsInBounds idx len)
8879         // result: (SETB (CMPL idx len))
8880         for {
8881                 idx := v_0
8882                 len := v_1
8883                 v.reset(Op386SETB)
8884                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
8885                 v0.AddArg2(idx, len)
8886                 v.AddArg(v0)
8887                 return true
8888         }
8889 }
8890 func rewriteValue386_OpIsNonNil(v *Value) bool {
8891         v_0 := v.Args[0]
8892         b := v.Block
8893         // match: (IsNonNil p)
8894         // result: (SETNE (TESTL p p))
8895         for {
8896                 p := v_0
8897                 v.reset(Op386SETNE)
8898                 v0 := b.NewValue0(v.Pos, Op386TESTL, types.TypeFlags)
8899                 v0.AddArg2(p, p)
8900                 v.AddArg(v0)
8901                 return true
8902         }
8903 }
8904 func rewriteValue386_OpIsSliceInBounds(v *Value) bool {
8905         v_1 := v.Args[1]
8906         v_0 := v.Args[0]
8907         b := v.Block
8908         // match: (IsSliceInBounds idx len)
8909         // result: (SETBE (CMPL idx len))
8910         for {
8911                 idx := v_0
8912                 len := v_1
8913                 v.reset(Op386SETBE)
8914                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
8915                 v0.AddArg2(idx, len)
8916                 v.AddArg(v0)
8917                 return true
8918         }
8919 }
8920 func rewriteValue386_OpLeq16(v *Value) bool {
8921         v_1 := v.Args[1]
8922         v_0 := v.Args[0]
8923         b := v.Block
8924         // match: (Leq16 x y)
8925         // result: (SETLE (CMPW x y))
8926         for {
8927                 x := v_0
8928                 y := v_1
8929                 v.reset(Op386SETLE)
8930                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
8931                 v0.AddArg2(x, y)
8932                 v.AddArg(v0)
8933                 return true
8934         }
8935 }
8936 func rewriteValue386_OpLeq16U(v *Value) bool {
8937         v_1 := v.Args[1]
8938         v_0 := v.Args[0]
8939         b := v.Block
8940         // match: (Leq16U x y)
8941         // result: (SETBE (CMPW x y))
8942         for {
8943                 x := v_0
8944                 y := v_1
8945                 v.reset(Op386SETBE)
8946                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
8947                 v0.AddArg2(x, y)
8948                 v.AddArg(v0)
8949                 return true
8950         }
8951 }
8952 func rewriteValue386_OpLeq32(v *Value) bool {
8953         v_1 := v.Args[1]
8954         v_0 := v.Args[0]
8955         b := v.Block
8956         // match: (Leq32 x y)
8957         // result: (SETLE (CMPL x y))
8958         for {
8959                 x := v_0
8960                 y := v_1
8961                 v.reset(Op386SETLE)
8962                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
8963                 v0.AddArg2(x, y)
8964                 v.AddArg(v0)
8965                 return true
8966         }
8967 }
8968 func rewriteValue386_OpLeq32F(v *Value) bool {
8969         v_1 := v.Args[1]
8970         v_0 := v.Args[0]
8971         b := v.Block
8972         // match: (Leq32F x y)
8973         // result: (SETGEF (UCOMISS y x))
8974         for {
8975                 x := v_0
8976                 y := v_1
8977                 v.reset(Op386SETGEF)
8978                 v0 := b.NewValue0(v.Pos, Op386UCOMISS, types.TypeFlags)
8979                 v0.AddArg2(y, x)
8980                 v.AddArg(v0)
8981                 return true
8982         }
8983 }
8984 func rewriteValue386_OpLeq32U(v *Value) bool {
8985         v_1 := v.Args[1]
8986         v_0 := v.Args[0]
8987         b := v.Block
8988         // match: (Leq32U x y)
8989         // result: (SETBE (CMPL x y))
8990         for {
8991                 x := v_0
8992                 y := v_1
8993                 v.reset(Op386SETBE)
8994                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
8995                 v0.AddArg2(x, y)
8996                 v.AddArg(v0)
8997                 return true
8998         }
8999 }
9000 func rewriteValue386_OpLeq64F(v *Value) bool {
9001         v_1 := v.Args[1]
9002         v_0 := v.Args[0]
9003         b := v.Block
9004         // match: (Leq64F x y)
9005         // result: (SETGEF (UCOMISD y x))
9006         for {
9007                 x := v_0
9008                 y := v_1
9009                 v.reset(Op386SETGEF)
9010                 v0 := b.NewValue0(v.Pos, Op386UCOMISD, types.TypeFlags)
9011                 v0.AddArg2(y, x)
9012                 v.AddArg(v0)
9013                 return true
9014         }
9015 }
9016 func rewriteValue386_OpLeq8(v *Value) bool {
9017         v_1 := v.Args[1]
9018         v_0 := v.Args[0]
9019         b := v.Block
9020         // match: (Leq8 x y)
9021         // result: (SETLE (CMPB x y))
9022         for {
9023                 x := v_0
9024                 y := v_1
9025                 v.reset(Op386SETLE)
9026                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
9027                 v0.AddArg2(x, y)
9028                 v.AddArg(v0)
9029                 return true
9030         }
9031 }
9032 func rewriteValue386_OpLeq8U(v *Value) bool {
9033         v_1 := v.Args[1]
9034         v_0 := v.Args[0]
9035         b := v.Block
9036         // match: (Leq8U x y)
9037         // result: (SETBE (CMPB x y))
9038         for {
9039                 x := v_0
9040                 y := v_1
9041                 v.reset(Op386SETBE)
9042                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
9043                 v0.AddArg2(x, y)
9044                 v.AddArg(v0)
9045                 return true
9046         }
9047 }
9048 func rewriteValue386_OpLess16(v *Value) bool {
9049         v_1 := v.Args[1]
9050         v_0 := v.Args[0]
9051         b := v.Block
9052         // match: (Less16 x y)
9053         // result: (SETL (CMPW x y))
9054         for {
9055                 x := v_0
9056                 y := v_1
9057                 v.reset(Op386SETL)
9058                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
9059                 v0.AddArg2(x, y)
9060                 v.AddArg(v0)
9061                 return true
9062         }
9063 }
9064 func rewriteValue386_OpLess16U(v *Value) bool {
9065         v_1 := v.Args[1]
9066         v_0 := v.Args[0]
9067         b := v.Block
9068         // match: (Less16U x y)
9069         // result: (SETB (CMPW x y))
9070         for {
9071                 x := v_0
9072                 y := v_1
9073                 v.reset(Op386SETB)
9074                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
9075                 v0.AddArg2(x, y)
9076                 v.AddArg(v0)
9077                 return true
9078         }
9079 }
9080 func rewriteValue386_OpLess32(v *Value) bool {
9081         v_1 := v.Args[1]
9082         v_0 := v.Args[0]
9083         b := v.Block
9084         // match: (Less32 x y)
9085         // result: (SETL (CMPL x y))
9086         for {
9087                 x := v_0
9088                 y := v_1
9089                 v.reset(Op386SETL)
9090                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
9091                 v0.AddArg2(x, y)
9092                 v.AddArg(v0)
9093                 return true
9094         }
9095 }
9096 func rewriteValue386_OpLess32F(v *Value) bool {
9097         v_1 := v.Args[1]
9098         v_0 := v.Args[0]
9099         b := v.Block
9100         // match: (Less32F x y)
9101         // result: (SETGF (UCOMISS y x))
9102         for {
9103                 x := v_0
9104                 y := v_1
9105                 v.reset(Op386SETGF)
9106                 v0 := b.NewValue0(v.Pos, Op386UCOMISS, types.TypeFlags)
9107                 v0.AddArg2(y, x)
9108                 v.AddArg(v0)
9109                 return true
9110         }
9111 }
9112 func rewriteValue386_OpLess32U(v *Value) bool {
9113         v_1 := v.Args[1]
9114         v_0 := v.Args[0]
9115         b := v.Block
9116         // match: (Less32U x y)
9117         // result: (SETB (CMPL x y))
9118         for {
9119                 x := v_0
9120                 y := v_1
9121                 v.reset(Op386SETB)
9122                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
9123                 v0.AddArg2(x, y)
9124                 v.AddArg(v0)
9125                 return true
9126         }
9127 }
9128 func rewriteValue386_OpLess64F(v *Value) bool {
9129         v_1 := v.Args[1]
9130         v_0 := v.Args[0]
9131         b := v.Block
9132         // match: (Less64F x y)
9133         // result: (SETGF (UCOMISD y x))
9134         for {
9135                 x := v_0
9136                 y := v_1
9137                 v.reset(Op386SETGF)
9138                 v0 := b.NewValue0(v.Pos, Op386UCOMISD, types.TypeFlags)
9139                 v0.AddArg2(y, x)
9140                 v.AddArg(v0)
9141                 return true
9142         }
9143 }
9144 func rewriteValue386_OpLess8(v *Value) bool {
9145         v_1 := v.Args[1]
9146         v_0 := v.Args[0]
9147         b := v.Block
9148         // match: (Less8 x y)
9149         // result: (SETL (CMPB x y))
9150         for {
9151                 x := v_0
9152                 y := v_1
9153                 v.reset(Op386SETL)
9154                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
9155                 v0.AddArg2(x, y)
9156                 v.AddArg(v0)
9157                 return true
9158         }
9159 }
9160 func rewriteValue386_OpLess8U(v *Value) bool {
9161         v_1 := v.Args[1]
9162         v_0 := v.Args[0]
9163         b := v.Block
9164         // match: (Less8U x y)
9165         // result: (SETB (CMPB x y))
9166         for {
9167                 x := v_0
9168                 y := v_1
9169                 v.reset(Op386SETB)
9170                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
9171                 v0.AddArg2(x, y)
9172                 v.AddArg(v0)
9173                 return true
9174         }
9175 }
9176 func rewriteValue386_OpLoad(v *Value) bool {
9177         v_1 := v.Args[1]
9178         v_0 := v.Args[0]
9179         // match: (Load <t> ptr mem)
9180         // cond: (is32BitInt(t) || isPtr(t))
9181         // result: (MOVLload ptr mem)
9182         for {
9183                 t := v.Type
9184                 ptr := v_0
9185                 mem := v_1
9186                 if !(is32BitInt(t) || isPtr(t)) {
9187                         break
9188                 }
9189                 v.reset(Op386MOVLload)
9190                 v.AddArg2(ptr, mem)
9191                 return true
9192         }
9193         // match: (Load <t> ptr mem)
9194         // cond: is16BitInt(t)
9195         // result: (MOVWload ptr mem)
9196         for {
9197                 t := v.Type
9198                 ptr := v_0
9199                 mem := v_1
9200                 if !(is16BitInt(t)) {
9201                         break
9202                 }
9203                 v.reset(Op386MOVWload)
9204                 v.AddArg2(ptr, mem)
9205                 return true
9206         }
9207         // match: (Load <t> ptr mem)
9208         // cond: (t.IsBoolean() || is8BitInt(t))
9209         // result: (MOVBload ptr mem)
9210         for {
9211                 t := v.Type
9212                 ptr := v_0
9213                 mem := v_1
9214                 if !(t.IsBoolean() || is8BitInt(t)) {
9215                         break
9216                 }
9217                 v.reset(Op386MOVBload)
9218                 v.AddArg2(ptr, mem)
9219                 return true
9220         }
9221         // match: (Load <t> ptr mem)
9222         // cond: is32BitFloat(t)
9223         // result: (MOVSSload ptr mem)
9224         for {
9225                 t := v.Type
9226                 ptr := v_0
9227                 mem := v_1
9228                 if !(is32BitFloat(t)) {
9229                         break
9230                 }
9231                 v.reset(Op386MOVSSload)
9232                 v.AddArg2(ptr, mem)
9233                 return true
9234         }
9235         // match: (Load <t> ptr mem)
9236         // cond: is64BitFloat(t)
9237         // result: (MOVSDload ptr mem)
9238         for {
9239                 t := v.Type
9240                 ptr := v_0
9241                 mem := v_1
9242                 if !(is64BitFloat(t)) {
9243                         break
9244                 }
9245                 v.reset(Op386MOVSDload)
9246                 v.AddArg2(ptr, mem)
9247                 return true
9248         }
9249         return false
9250 }
9251 func rewriteValue386_OpLocalAddr(v *Value) bool {
9252         v_0 := v.Args[0]
9253         // match: (LocalAddr {sym} base _)
9254         // result: (LEAL {sym} base)
9255         for {
9256                 sym := auxToSym(v.Aux)
9257                 base := v_0
9258                 v.reset(Op386LEAL)
9259                 v.Aux = symToAux(sym)
9260                 v.AddArg(base)
9261                 return true
9262         }
9263 }
9264 func rewriteValue386_OpLsh16x16(v *Value) bool {
9265         v_1 := v.Args[1]
9266         v_0 := v.Args[0]
9267         b := v.Block
9268         // match: (Lsh16x16 <t> x y)
9269         // cond: !shiftIsBounded(v)
9270         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32])))
9271         for {
9272                 t := v.Type
9273                 x := v_0
9274                 y := v_1
9275                 if !(!shiftIsBounded(v)) {
9276                         break
9277                 }
9278                 v.reset(Op386ANDL)
9279                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9280                 v0.AddArg2(x, y)
9281                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9282                 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
9283                 v2.AuxInt = int16ToAuxInt(32)
9284                 v2.AddArg(y)
9285                 v1.AddArg(v2)
9286                 v.AddArg2(v0, v1)
9287                 return true
9288         }
9289         // match: (Lsh16x16 <t> x y)
9290         // cond: shiftIsBounded(v)
9291         // result: (SHLL <t> x y)
9292         for {
9293                 t := v.Type
9294                 x := v_0
9295                 y := v_1
9296                 if !(shiftIsBounded(v)) {
9297                         break
9298                 }
9299                 v.reset(Op386SHLL)
9300                 v.Type = t
9301                 v.AddArg2(x, y)
9302                 return true
9303         }
9304         return false
9305 }
9306 func rewriteValue386_OpLsh16x32(v *Value) bool {
9307         v_1 := v.Args[1]
9308         v_0 := v.Args[0]
9309         b := v.Block
9310         // match: (Lsh16x32 <t> x y)
9311         // cond: !shiftIsBounded(v)
9312         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32])))
9313         for {
9314                 t := v.Type
9315                 x := v_0
9316                 y := v_1
9317                 if !(!shiftIsBounded(v)) {
9318                         break
9319                 }
9320                 v.reset(Op386ANDL)
9321                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9322                 v0.AddArg2(x, y)
9323                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9324                 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
9325                 v2.AuxInt = int32ToAuxInt(32)
9326                 v2.AddArg(y)
9327                 v1.AddArg(v2)
9328                 v.AddArg2(v0, v1)
9329                 return true
9330         }
9331         // match: (Lsh16x32 <t> x y)
9332         // cond: shiftIsBounded(v)
9333         // result: (SHLL <t> x y)
9334         for {
9335                 t := v.Type
9336                 x := v_0
9337                 y := v_1
9338                 if !(shiftIsBounded(v)) {
9339                         break
9340                 }
9341                 v.reset(Op386SHLL)
9342                 v.Type = t
9343                 v.AddArg2(x, y)
9344                 return true
9345         }
9346         return false
9347 }
9348 func rewriteValue386_OpLsh16x64(v *Value) bool {
9349         v_1 := v.Args[1]
9350         v_0 := v.Args[0]
9351         // match: (Lsh16x64 x (Const64 [c]))
9352         // cond: uint64(c) < 16
9353         // result: (SHLLconst x [int32(c)])
9354         for {
9355                 x := v_0
9356                 if v_1.Op != OpConst64 {
9357                         break
9358                 }
9359                 c := auxIntToInt64(v_1.AuxInt)
9360                 if !(uint64(c) < 16) {
9361                         break
9362                 }
9363                 v.reset(Op386SHLLconst)
9364                 v.AuxInt = int32ToAuxInt(int32(c))
9365                 v.AddArg(x)
9366                 return true
9367         }
9368         // match: (Lsh16x64 _ (Const64 [c]))
9369         // cond: uint64(c) >= 16
9370         // result: (Const16 [0])
9371         for {
9372                 if v_1.Op != OpConst64 {
9373                         break
9374                 }
9375                 c := auxIntToInt64(v_1.AuxInt)
9376                 if !(uint64(c) >= 16) {
9377                         break
9378                 }
9379                 v.reset(OpConst16)
9380                 v.AuxInt = int16ToAuxInt(0)
9381                 return true
9382         }
9383         return false
9384 }
9385 func rewriteValue386_OpLsh16x8(v *Value) bool {
9386         v_1 := v.Args[1]
9387         v_0 := v.Args[0]
9388         b := v.Block
9389         // match: (Lsh16x8 <t> x y)
9390         // cond: !shiftIsBounded(v)
9391         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32])))
9392         for {
9393                 t := v.Type
9394                 x := v_0
9395                 y := v_1
9396                 if !(!shiftIsBounded(v)) {
9397                         break
9398                 }
9399                 v.reset(Op386ANDL)
9400                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9401                 v0.AddArg2(x, y)
9402                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9403                 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
9404                 v2.AuxInt = int8ToAuxInt(32)
9405                 v2.AddArg(y)
9406                 v1.AddArg(v2)
9407                 v.AddArg2(v0, v1)
9408                 return true
9409         }
9410         // match: (Lsh16x8 <t> x y)
9411         // cond: shiftIsBounded(v)
9412         // result: (SHLL <t> x y)
9413         for {
9414                 t := v.Type
9415                 x := v_0
9416                 y := v_1
9417                 if !(shiftIsBounded(v)) {
9418                         break
9419                 }
9420                 v.reset(Op386SHLL)
9421                 v.Type = t
9422                 v.AddArg2(x, y)
9423                 return true
9424         }
9425         return false
9426 }
9427 func rewriteValue386_OpLsh32x16(v *Value) bool {
9428         v_1 := v.Args[1]
9429         v_0 := v.Args[0]
9430         b := v.Block
9431         // match: (Lsh32x16 <t> x y)
9432         // cond: !shiftIsBounded(v)
9433         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32])))
9434         for {
9435                 t := v.Type
9436                 x := v_0
9437                 y := v_1
9438                 if !(!shiftIsBounded(v)) {
9439                         break
9440                 }
9441                 v.reset(Op386ANDL)
9442                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9443                 v0.AddArg2(x, y)
9444                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9445                 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
9446                 v2.AuxInt = int16ToAuxInt(32)
9447                 v2.AddArg(y)
9448                 v1.AddArg(v2)
9449                 v.AddArg2(v0, v1)
9450                 return true
9451         }
9452         // match: (Lsh32x16 <t> x y)
9453         // cond: shiftIsBounded(v)
9454         // result: (SHLL <t> x y)
9455         for {
9456                 t := v.Type
9457                 x := v_0
9458                 y := v_1
9459                 if !(shiftIsBounded(v)) {
9460                         break
9461                 }
9462                 v.reset(Op386SHLL)
9463                 v.Type = t
9464                 v.AddArg2(x, y)
9465                 return true
9466         }
9467         return false
9468 }
9469 func rewriteValue386_OpLsh32x32(v *Value) bool {
9470         v_1 := v.Args[1]
9471         v_0 := v.Args[0]
9472         b := v.Block
9473         // match: (Lsh32x32 <t> x y)
9474         // cond: !shiftIsBounded(v)
9475         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32])))
9476         for {
9477                 t := v.Type
9478                 x := v_0
9479                 y := v_1
9480                 if !(!shiftIsBounded(v)) {
9481                         break
9482                 }
9483                 v.reset(Op386ANDL)
9484                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9485                 v0.AddArg2(x, y)
9486                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9487                 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
9488                 v2.AuxInt = int32ToAuxInt(32)
9489                 v2.AddArg(y)
9490                 v1.AddArg(v2)
9491                 v.AddArg2(v0, v1)
9492                 return true
9493         }
9494         // match: (Lsh32x32 <t> x y)
9495         // cond: shiftIsBounded(v)
9496         // result: (SHLL <t> x y)
9497         for {
9498                 t := v.Type
9499                 x := v_0
9500                 y := v_1
9501                 if !(shiftIsBounded(v)) {
9502                         break
9503                 }
9504                 v.reset(Op386SHLL)
9505                 v.Type = t
9506                 v.AddArg2(x, y)
9507                 return true
9508         }
9509         return false
9510 }
9511 func rewriteValue386_OpLsh32x64(v *Value) bool {
9512         v_1 := v.Args[1]
9513         v_0 := v.Args[0]
9514         // match: (Lsh32x64 x (Const64 [c]))
9515         // cond: uint64(c) < 32
9516         // result: (SHLLconst x [int32(c)])
9517         for {
9518                 x := v_0
9519                 if v_1.Op != OpConst64 {
9520                         break
9521                 }
9522                 c := auxIntToInt64(v_1.AuxInt)
9523                 if !(uint64(c) < 32) {
9524                         break
9525                 }
9526                 v.reset(Op386SHLLconst)
9527                 v.AuxInt = int32ToAuxInt(int32(c))
9528                 v.AddArg(x)
9529                 return true
9530         }
9531         // match: (Lsh32x64 _ (Const64 [c]))
9532         // cond: uint64(c) >= 32
9533         // result: (Const32 [0])
9534         for {
9535                 if v_1.Op != OpConst64 {
9536                         break
9537                 }
9538                 c := auxIntToInt64(v_1.AuxInt)
9539                 if !(uint64(c) >= 32) {
9540                         break
9541                 }
9542                 v.reset(OpConst32)
9543                 v.AuxInt = int32ToAuxInt(0)
9544                 return true
9545         }
9546         return false
9547 }
9548 func rewriteValue386_OpLsh32x8(v *Value) bool {
9549         v_1 := v.Args[1]
9550         v_0 := v.Args[0]
9551         b := v.Block
9552         // match: (Lsh32x8 <t> x y)
9553         // cond: !shiftIsBounded(v)
9554         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32])))
9555         for {
9556                 t := v.Type
9557                 x := v_0
9558                 y := v_1
9559                 if !(!shiftIsBounded(v)) {
9560                         break
9561                 }
9562                 v.reset(Op386ANDL)
9563                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9564                 v0.AddArg2(x, y)
9565                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9566                 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
9567                 v2.AuxInt = int8ToAuxInt(32)
9568                 v2.AddArg(y)
9569                 v1.AddArg(v2)
9570                 v.AddArg2(v0, v1)
9571                 return true
9572         }
9573         // match: (Lsh32x8 <t> x y)
9574         // cond: shiftIsBounded(v)
9575         // result: (SHLL <t> x y)
9576         for {
9577                 t := v.Type
9578                 x := v_0
9579                 y := v_1
9580                 if !(shiftIsBounded(v)) {
9581                         break
9582                 }
9583                 v.reset(Op386SHLL)
9584                 v.Type = t
9585                 v.AddArg2(x, y)
9586                 return true
9587         }
9588         return false
9589 }
9590 func rewriteValue386_OpLsh8x16(v *Value) bool {
9591         v_1 := v.Args[1]
9592         v_0 := v.Args[0]
9593         b := v.Block
9594         // match: (Lsh8x16 <t> x y)
9595         // cond: !shiftIsBounded(v)
9596         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32])))
9597         for {
9598                 t := v.Type
9599                 x := v_0
9600                 y := v_1
9601                 if !(!shiftIsBounded(v)) {
9602                         break
9603                 }
9604                 v.reset(Op386ANDL)
9605                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9606                 v0.AddArg2(x, y)
9607                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9608                 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
9609                 v2.AuxInt = int16ToAuxInt(32)
9610                 v2.AddArg(y)
9611                 v1.AddArg(v2)
9612                 v.AddArg2(v0, v1)
9613                 return true
9614         }
9615         // match: (Lsh8x16 <t> x y)
9616         // cond: shiftIsBounded(v)
9617         // result: (SHLL <t> x y)
9618         for {
9619                 t := v.Type
9620                 x := v_0
9621                 y := v_1
9622                 if !(shiftIsBounded(v)) {
9623                         break
9624                 }
9625                 v.reset(Op386SHLL)
9626                 v.Type = t
9627                 v.AddArg2(x, y)
9628                 return true
9629         }
9630         return false
9631 }
9632 func rewriteValue386_OpLsh8x32(v *Value) bool {
9633         v_1 := v.Args[1]
9634         v_0 := v.Args[0]
9635         b := v.Block
9636         // match: (Lsh8x32 <t> x y)
9637         // cond: !shiftIsBounded(v)
9638         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32])))
9639         for {
9640                 t := v.Type
9641                 x := v_0
9642                 y := v_1
9643                 if !(!shiftIsBounded(v)) {
9644                         break
9645                 }
9646                 v.reset(Op386ANDL)
9647                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9648                 v0.AddArg2(x, y)
9649                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9650                 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
9651                 v2.AuxInt = int32ToAuxInt(32)
9652                 v2.AddArg(y)
9653                 v1.AddArg(v2)
9654                 v.AddArg2(v0, v1)
9655                 return true
9656         }
9657         // match: (Lsh8x32 <t> x y)
9658         // cond: shiftIsBounded(v)
9659         // result: (SHLL <t> x y)
9660         for {
9661                 t := v.Type
9662                 x := v_0
9663                 y := v_1
9664                 if !(shiftIsBounded(v)) {
9665                         break
9666                 }
9667                 v.reset(Op386SHLL)
9668                 v.Type = t
9669                 v.AddArg2(x, y)
9670                 return true
9671         }
9672         return false
9673 }
9674 func rewriteValue386_OpLsh8x64(v *Value) bool {
9675         v_1 := v.Args[1]
9676         v_0 := v.Args[0]
9677         // match: (Lsh8x64 x (Const64 [c]))
9678         // cond: uint64(c) < 8
9679         // result: (SHLLconst x [int32(c)])
9680         for {
9681                 x := v_0
9682                 if v_1.Op != OpConst64 {
9683                         break
9684                 }
9685                 c := auxIntToInt64(v_1.AuxInt)
9686                 if !(uint64(c) < 8) {
9687                         break
9688                 }
9689                 v.reset(Op386SHLLconst)
9690                 v.AuxInt = int32ToAuxInt(int32(c))
9691                 v.AddArg(x)
9692                 return true
9693         }
9694         // match: (Lsh8x64 _ (Const64 [c]))
9695         // cond: uint64(c) >= 8
9696         // result: (Const8 [0])
9697         for {
9698                 if v_1.Op != OpConst64 {
9699                         break
9700                 }
9701                 c := auxIntToInt64(v_1.AuxInt)
9702                 if !(uint64(c) >= 8) {
9703                         break
9704                 }
9705                 v.reset(OpConst8)
9706                 v.AuxInt = int8ToAuxInt(0)
9707                 return true
9708         }
9709         return false
9710 }
9711 func rewriteValue386_OpLsh8x8(v *Value) bool {
9712         v_1 := v.Args[1]
9713         v_0 := v.Args[0]
9714         b := v.Block
9715         // match: (Lsh8x8 <t> x y)
9716         // cond: !shiftIsBounded(v)
9717         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32])))
9718         for {
9719                 t := v.Type
9720                 x := v_0
9721                 y := v_1
9722                 if !(!shiftIsBounded(v)) {
9723                         break
9724                 }
9725                 v.reset(Op386ANDL)
9726                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9727                 v0.AddArg2(x, y)
9728                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9729                 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
9730                 v2.AuxInt = int8ToAuxInt(32)
9731                 v2.AddArg(y)
9732                 v1.AddArg(v2)
9733                 v.AddArg2(v0, v1)
9734                 return true
9735         }
9736         // match: (Lsh8x8 <t> x y)
9737         // cond: shiftIsBounded(v)
9738         // result: (SHLL <t> x y)
9739         for {
9740                 t := v.Type
9741                 x := v_0
9742                 y := v_1
9743                 if !(shiftIsBounded(v)) {
9744                         break
9745                 }
9746                 v.reset(Op386SHLL)
9747                 v.Type = t
9748                 v.AddArg2(x, y)
9749                 return true
9750         }
9751         return false
9752 }
9753 func rewriteValue386_OpMod8(v *Value) bool {
9754         v_1 := v.Args[1]
9755         v_0 := v.Args[0]
9756         b := v.Block
9757         typ := &b.Func.Config.Types
9758         // match: (Mod8 x y)
9759         // result: (MODW (SignExt8to16 x) (SignExt8to16 y))
9760         for {
9761                 x := v_0
9762                 y := v_1
9763                 v.reset(Op386MODW)
9764                 v0 := b.NewValue0(v.Pos, OpSignExt8to16, typ.Int16)
9765                 v0.AddArg(x)
9766                 v1 := b.NewValue0(v.Pos, OpSignExt8to16, typ.Int16)
9767                 v1.AddArg(y)
9768                 v.AddArg2(v0, v1)
9769                 return true
9770         }
9771 }
9772 func rewriteValue386_OpMod8u(v *Value) bool {
9773         v_1 := v.Args[1]
9774         v_0 := v.Args[0]
9775         b := v.Block
9776         typ := &b.Func.Config.Types
9777         // match: (Mod8u x y)
9778         // result: (MODWU (ZeroExt8to16 x) (ZeroExt8to16 y))
9779         for {
9780                 x := v_0
9781                 y := v_1
9782                 v.reset(Op386MODWU)
9783                 v0 := b.NewValue0(v.Pos, OpZeroExt8to16, typ.UInt16)
9784                 v0.AddArg(x)
9785                 v1 := b.NewValue0(v.Pos, OpZeroExt8to16, typ.UInt16)
9786                 v1.AddArg(y)
9787                 v.AddArg2(v0, v1)
9788                 return true
9789         }
9790 }
9791 func rewriteValue386_OpMove(v *Value) bool {
9792         v_2 := v.Args[2]
9793         v_1 := v.Args[1]
9794         v_0 := v.Args[0]
9795         b := v.Block
9796         config := b.Func.Config
9797         typ := &b.Func.Config.Types
9798         // match: (Move [0] _ _ mem)
9799         // result: mem
9800         for {
9801                 if auxIntToInt64(v.AuxInt) != 0 {
9802                         break
9803                 }
9804                 mem := v_2
9805                 v.copyOf(mem)
9806                 return true
9807         }
9808         // match: (Move [1] dst src mem)
9809         // result: (MOVBstore dst (MOVBload src mem) mem)
9810         for {
9811                 if auxIntToInt64(v.AuxInt) != 1 {
9812                         break
9813                 }
9814                 dst := v_0
9815                 src := v_1
9816                 mem := v_2
9817                 v.reset(Op386MOVBstore)
9818                 v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8)
9819                 v0.AddArg2(src, mem)
9820                 v.AddArg3(dst, v0, mem)
9821                 return true
9822         }
9823         // match: (Move [2] dst src mem)
9824         // result: (MOVWstore dst (MOVWload src mem) mem)
9825         for {
9826                 if auxIntToInt64(v.AuxInt) != 2 {
9827                         break
9828                 }
9829                 dst := v_0
9830                 src := v_1
9831                 mem := v_2
9832                 v.reset(Op386MOVWstore)
9833                 v0 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16)
9834                 v0.AddArg2(src, mem)
9835                 v.AddArg3(dst, v0, mem)
9836                 return true
9837         }
9838         // match: (Move [4] dst src mem)
9839         // result: (MOVLstore dst (MOVLload src mem) mem)
9840         for {
9841                 if auxIntToInt64(v.AuxInt) != 4 {
9842                         break
9843                 }
9844                 dst := v_0
9845                 src := v_1
9846                 mem := v_2
9847                 v.reset(Op386MOVLstore)
9848                 v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9849                 v0.AddArg2(src, mem)
9850                 v.AddArg3(dst, v0, mem)
9851                 return true
9852         }
9853         // match: (Move [3] dst src mem)
9854         // result: (MOVBstore [2] dst (MOVBload [2] src mem) (MOVWstore dst (MOVWload src mem) mem))
9855         for {
9856                 if auxIntToInt64(v.AuxInt) != 3 {
9857                         break
9858                 }
9859                 dst := v_0
9860                 src := v_1
9861                 mem := v_2
9862                 v.reset(Op386MOVBstore)
9863                 v.AuxInt = int32ToAuxInt(2)
9864                 v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8)
9865                 v0.AuxInt = int32ToAuxInt(2)
9866                 v0.AddArg2(src, mem)
9867                 v1 := b.NewValue0(v.Pos, Op386MOVWstore, types.TypeMem)
9868                 v2 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16)
9869                 v2.AddArg2(src, mem)
9870                 v1.AddArg3(dst, v2, mem)
9871                 v.AddArg3(dst, v0, v1)
9872                 return true
9873         }
9874         // match: (Move [5] dst src mem)
9875         // result: (MOVBstore [4] dst (MOVBload [4] src mem) (MOVLstore dst (MOVLload src mem) mem))
9876         for {
9877                 if auxIntToInt64(v.AuxInt) != 5 {
9878                         break
9879                 }
9880                 dst := v_0
9881                 src := v_1
9882                 mem := v_2
9883                 v.reset(Op386MOVBstore)
9884                 v.AuxInt = int32ToAuxInt(4)
9885                 v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8)
9886                 v0.AuxInt = int32ToAuxInt(4)
9887                 v0.AddArg2(src, mem)
9888                 v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem)
9889                 v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9890                 v2.AddArg2(src, mem)
9891                 v1.AddArg3(dst, v2, mem)
9892                 v.AddArg3(dst, v0, v1)
9893                 return true
9894         }
9895         // match: (Move [6] dst src mem)
9896         // result: (MOVWstore [4] dst (MOVWload [4] src mem) (MOVLstore dst (MOVLload src mem) mem))
9897         for {
9898                 if auxIntToInt64(v.AuxInt) != 6 {
9899                         break
9900                 }
9901                 dst := v_0
9902                 src := v_1
9903                 mem := v_2
9904                 v.reset(Op386MOVWstore)
9905                 v.AuxInt = int32ToAuxInt(4)
9906                 v0 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16)
9907                 v0.AuxInt = int32ToAuxInt(4)
9908                 v0.AddArg2(src, mem)
9909                 v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem)
9910                 v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9911                 v2.AddArg2(src, mem)
9912                 v1.AddArg3(dst, v2, mem)
9913                 v.AddArg3(dst, v0, v1)
9914                 return true
9915         }
9916         // match: (Move [7] dst src mem)
9917         // result: (MOVLstore [3] dst (MOVLload [3] src mem) (MOVLstore dst (MOVLload src mem) mem))
9918         for {
9919                 if auxIntToInt64(v.AuxInt) != 7 {
9920                         break
9921                 }
9922                 dst := v_0
9923                 src := v_1
9924                 mem := v_2
9925                 v.reset(Op386MOVLstore)
9926                 v.AuxInt = int32ToAuxInt(3)
9927                 v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9928                 v0.AuxInt = int32ToAuxInt(3)
9929                 v0.AddArg2(src, mem)
9930                 v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem)
9931                 v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9932                 v2.AddArg2(src, mem)
9933                 v1.AddArg3(dst, v2, mem)
9934                 v.AddArg3(dst, v0, v1)
9935                 return true
9936         }
9937         // match: (Move [8] dst src mem)
9938         // result: (MOVLstore [4] dst (MOVLload [4] src mem) (MOVLstore dst (MOVLload src mem) mem))
9939         for {
9940                 if auxIntToInt64(v.AuxInt) != 8 {
9941                         break
9942                 }
9943                 dst := v_0
9944                 src := v_1
9945                 mem := v_2
9946                 v.reset(Op386MOVLstore)
9947                 v.AuxInt = int32ToAuxInt(4)
9948                 v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9949                 v0.AuxInt = int32ToAuxInt(4)
9950                 v0.AddArg2(src, mem)
9951                 v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem)
9952                 v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9953                 v2.AddArg2(src, mem)
9954                 v1.AddArg3(dst, v2, mem)
9955                 v.AddArg3(dst, v0, v1)
9956                 return true
9957         }
9958         // match: (Move [s] dst src mem)
9959         // cond: s > 8 && s%4 != 0
9960         // result: (Move [s-s%4] (ADDLconst <dst.Type> dst [int32(s%4)]) (ADDLconst <src.Type> src [int32(s%4)]) (MOVLstore dst (MOVLload src mem) mem))
9961         for {
9962                 s := auxIntToInt64(v.AuxInt)
9963                 dst := v_0
9964                 src := v_1
9965                 mem := v_2
9966                 if !(s > 8 && s%4 != 0) {
9967                         break
9968                 }
9969                 v.reset(OpMove)
9970                 v.AuxInt = int64ToAuxInt(s - s%4)
9971                 v0 := b.NewValue0(v.Pos, Op386ADDLconst, dst.Type)
9972                 v0.AuxInt = int32ToAuxInt(int32(s % 4))
9973                 v0.AddArg(dst)
9974                 v1 := b.NewValue0(v.Pos, Op386ADDLconst, src.Type)
9975                 v1.AuxInt = int32ToAuxInt(int32(s % 4))
9976                 v1.AddArg(src)
9977                 v2 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem)
9978                 v3 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9979                 v3.AddArg2(src, mem)
9980                 v2.AddArg3(dst, v3, mem)
9981                 v.AddArg3(v0, v1, v2)
9982                 return true
9983         }
9984         // match: (Move [s] dst src mem)
9985         // cond: s > 8 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice && logLargeCopy(v, s)
9986         // result: (DUFFCOPY [10*(128-s/4)] dst src mem)
9987         for {
9988                 s := auxIntToInt64(v.AuxInt)
9989                 dst := v_0
9990                 src := v_1
9991                 mem := v_2
9992                 if !(s > 8 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice && logLargeCopy(v, s)) {
9993                         break
9994                 }
9995                 v.reset(Op386DUFFCOPY)
9996                 v.AuxInt = int64ToAuxInt(10 * (128 - s/4))
9997                 v.AddArg3(dst, src, mem)
9998                 return true
9999         }
10000         // match: (Move [s] dst src mem)
10001         // cond: (s > 4*128 || config.noDuffDevice) && s%4 == 0 && logLargeCopy(v, s)
10002         // result: (REPMOVSL dst src (MOVLconst [int32(s/4)]) mem)
10003         for {
10004                 s := auxIntToInt64(v.AuxInt)
10005                 dst := v_0
10006                 src := v_1
10007                 mem := v_2
10008                 if !((s > 4*128 || config.noDuffDevice) && s%4 == 0 && logLargeCopy(v, s)) {
10009                         break
10010                 }
10011                 v.reset(Op386REPMOVSL)
10012                 v0 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32)
10013                 v0.AuxInt = int32ToAuxInt(int32(s / 4))
10014                 v.AddArg4(dst, src, v0, mem)
10015                 return true
10016         }
10017         return false
10018 }
10019 func rewriteValue386_OpNeg32F(v *Value) bool {
10020         v_0 := v.Args[0]
10021         b := v.Block
10022         typ := &b.Func.Config.Types
10023         // match: (Neg32F x)
10024         // result: (PXOR x (MOVSSconst <typ.Float32> [float32(math.Copysign(0, -1))]))
10025         for {
10026                 x := v_0
10027                 v.reset(Op386PXOR)
10028                 v0 := b.NewValue0(v.Pos, Op386MOVSSconst, typ.Float32)
10029                 v0.AuxInt = float32ToAuxInt(float32(math.Copysign(0, -1)))
10030                 v.AddArg2(x, v0)
10031                 return true
10032         }
10033 }
10034 func rewriteValue386_OpNeg64F(v *Value) bool {
10035         v_0 := v.Args[0]
10036         b := v.Block
10037         typ := &b.Func.Config.Types
10038         // match: (Neg64F x)
10039         // result: (PXOR x (MOVSDconst <typ.Float64> [math.Copysign(0, -1)]))
10040         for {
10041                 x := v_0
10042                 v.reset(Op386PXOR)
10043                 v0 := b.NewValue0(v.Pos, Op386MOVSDconst, typ.Float64)
10044                 v0.AuxInt = float64ToAuxInt(math.Copysign(0, -1))
10045                 v.AddArg2(x, v0)
10046                 return true
10047         }
10048 }
10049 func rewriteValue386_OpNeq16(v *Value) bool {
10050         v_1 := v.Args[1]
10051         v_0 := v.Args[0]
10052         b := v.Block
10053         // match: (Neq16 x y)
10054         // result: (SETNE (CMPW x y))
10055         for {
10056                 x := v_0
10057                 y := v_1
10058                 v.reset(Op386SETNE)
10059                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
10060                 v0.AddArg2(x, y)
10061                 v.AddArg(v0)
10062                 return true
10063         }
10064 }
10065 func rewriteValue386_OpNeq32(v *Value) bool {
10066         v_1 := v.Args[1]
10067         v_0 := v.Args[0]
10068         b := v.Block
10069         // match: (Neq32 x y)
10070         // result: (SETNE (CMPL x y))
10071         for {
10072                 x := v_0
10073                 y := v_1
10074                 v.reset(Op386SETNE)
10075                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
10076                 v0.AddArg2(x, y)
10077                 v.AddArg(v0)
10078                 return true
10079         }
10080 }
10081 func rewriteValue386_OpNeq32F(v *Value) bool {
10082         v_1 := v.Args[1]
10083         v_0 := v.Args[0]
10084         b := v.Block
10085         // match: (Neq32F x y)
10086         // result: (SETNEF (UCOMISS x y))
10087         for {
10088                 x := v_0
10089                 y := v_1
10090                 v.reset(Op386SETNEF)
10091                 v0 := b.NewValue0(v.Pos, Op386UCOMISS, types.TypeFlags)
10092                 v0.AddArg2(x, y)
10093                 v.AddArg(v0)
10094                 return true
10095         }
10096 }
10097 func rewriteValue386_OpNeq64F(v *Value) bool {
10098         v_1 := v.Args[1]
10099         v_0 := v.Args[0]
10100         b := v.Block
10101         // match: (Neq64F x y)
10102         // result: (SETNEF (UCOMISD x y))
10103         for {
10104                 x := v_0
10105                 y := v_1
10106                 v.reset(Op386SETNEF)
10107                 v0 := b.NewValue0(v.Pos, Op386UCOMISD, types.TypeFlags)
10108                 v0.AddArg2(x, y)
10109                 v.AddArg(v0)
10110                 return true
10111         }
10112 }
10113 func rewriteValue386_OpNeq8(v *Value) bool {
10114         v_1 := v.Args[1]
10115         v_0 := v.Args[0]
10116         b := v.Block
10117         // match: (Neq8 x y)
10118         // result: (SETNE (CMPB x y))
10119         for {
10120                 x := v_0
10121                 y := v_1
10122                 v.reset(Op386SETNE)
10123                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
10124                 v0.AddArg2(x, y)
10125                 v.AddArg(v0)
10126                 return true
10127         }
10128 }
10129 func rewriteValue386_OpNeqB(v *Value) bool {
10130         v_1 := v.Args[1]
10131         v_0 := v.Args[0]
10132         b := v.Block
10133         // match: (NeqB x y)
10134         // result: (SETNE (CMPB x y))
10135         for {
10136                 x := v_0
10137                 y := v_1
10138                 v.reset(Op386SETNE)
10139                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
10140                 v0.AddArg2(x, y)
10141                 v.AddArg(v0)
10142                 return true
10143         }
10144 }
10145 func rewriteValue386_OpNeqPtr(v *Value) bool {
10146         v_1 := v.Args[1]
10147         v_0 := v.Args[0]
10148         b := v.Block
10149         // match: (NeqPtr x y)
10150         // result: (SETNE (CMPL x y))
10151         for {
10152                 x := v_0
10153                 y := v_1
10154                 v.reset(Op386SETNE)
10155                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
10156                 v0.AddArg2(x, y)
10157                 v.AddArg(v0)
10158                 return true
10159         }
10160 }
10161 func rewriteValue386_OpNot(v *Value) bool {
10162         v_0 := v.Args[0]
10163         // match: (Not x)
10164         // result: (XORLconst [1] x)
10165         for {
10166                 x := v_0
10167                 v.reset(Op386XORLconst)
10168                 v.AuxInt = int32ToAuxInt(1)
10169                 v.AddArg(x)
10170                 return true
10171         }
10172 }
10173 func rewriteValue386_OpOffPtr(v *Value) bool {
10174         v_0 := v.Args[0]
10175         // match: (OffPtr [off] ptr)
10176         // result: (ADDLconst [int32(off)] ptr)
10177         for {
10178                 off := auxIntToInt64(v.AuxInt)
10179                 ptr := v_0
10180                 v.reset(Op386ADDLconst)
10181                 v.AuxInt = int32ToAuxInt(int32(off))
10182                 v.AddArg(ptr)
10183                 return true
10184         }
10185 }
10186 func rewriteValue386_OpPanicBounds(v *Value) bool {
10187         v_2 := v.Args[2]
10188         v_1 := v.Args[1]
10189         v_0 := v.Args[0]
10190         // match: (PanicBounds [kind] x y mem)
10191         // cond: boundsABI(kind) == 0
10192         // result: (LoweredPanicBoundsA [kind] x y mem)
10193         for {
10194                 kind := auxIntToInt64(v.AuxInt)
10195                 x := v_0
10196                 y := v_1
10197                 mem := v_2
10198                 if !(boundsABI(kind) == 0) {
10199                         break
10200                 }
10201                 v.reset(Op386LoweredPanicBoundsA)
10202                 v.AuxInt = int64ToAuxInt(kind)
10203                 v.AddArg3(x, y, mem)
10204                 return true
10205         }
10206         // match: (PanicBounds [kind] x y mem)
10207         // cond: boundsABI(kind) == 1
10208         // result: (LoweredPanicBoundsB [kind] x y mem)
10209         for {
10210                 kind := auxIntToInt64(v.AuxInt)
10211                 x := v_0
10212                 y := v_1
10213                 mem := v_2
10214                 if !(boundsABI(kind) == 1) {
10215                         break
10216                 }
10217                 v.reset(Op386LoweredPanicBoundsB)
10218                 v.AuxInt = int64ToAuxInt(kind)
10219                 v.AddArg3(x, y, mem)
10220                 return true
10221         }
10222         // match: (PanicBounds [kind] x y mem)
10223         // cond: boundsABI(kind) == 2
10224         // result: (LoweredPanicBoundsC [kind] x y mem)
10225         for {
10226                 kind := auxIntToInt64(v.AuxInt)
10227                 x := v_0
10228                 y := v_1
10229                 mem := v_2
10230                 if !(boundsABI(kind) == 2) {
10231                         break
10232                 }
10233                 v.reset(Op386LoweredPanicBoundsC)
10234                 v.AuxInt = int64ToAuxInt(kind)
10235                 v.AddArg3(x, y, mem)
10236                 return true
10237         }
10238         return false
10239 }
10240 func rewriteValue386_OpPanicExtend(v *Value) bool {
10241         v_3 := v.Args[3]
10242         v_2 := v.Args[2]
10243         v_1 := v.Args[1]
10244         v_0 := v.Args[0]
10245         // match: (PanicExtend [kind] hi lo y mem)
10246         // cond: boundsABI(kind) == 0
10247         // result: (LoweredPanicExtendA [kind] hi lo y mem)
10248         for {
10249                 kind := auxIntToInt64(v.AuxInt)
10250                 hi := v_0
10251                 lo := v_1
10252                 y := v_2
10253                 mem := v_3
10254                 if !(boundsABI(kind) == 0) {
10255                         break
10256                 }
10257                 v.reset(Op386LoweredPanicExtendA)
10258                 v.AuxInt = int64ToAuxInt(kind)
10259                 v.AddArg4(hi, lo, y, mem)
10260                 return true
10261         }
10262         // match: (PanicExtend [kind] hi lo y mem)
10263         // cond: boundsABI(kind) == 1
10264         // result: (LoweredPanicExtendB [kind] hi lo y mem)
10265         for {
10266                 kind := auxIntToInt64(v.AuxInt)
10267                 hi := v_0
10268                 lo := v_1
10269                 y := v_2
10270                 mem := v_3
10271                 if !(boundsABI(kind) == 1) {
10272                         break
10273                 }
10274                 v.reset(Op386LoweredPanicExtendB)
10275                 v.AuxInt = int64ToAuxInt(kind)
10276                 v.AddArg4(hi, lo, y, mem)
10277                 return true
10278         }
10279         // match: (PanicExtend [kind] hi lo y mem)
10280         // cond: boundsABI(kind) == 2
10281         // result: (LoweredPanicExtendC [kind] hi lo y mem)
10282         for {
10283                 kind := auxIntToInt64(v.AuxInt)
10284                 hi := v_0
10285                 lo := v_1
10286                 y := v_2
10287                 mem := v_3
10288                 if !(boundsABI(kind) == 2) {
10289                         break
10290                 }
10291                 v.reset(Op386LoweredPanicExtendC)
10292                 v.AuxInt = int64ToAuxInt(kind)
10293                 v.AddArg4(hi, lo, y, mem)
10294                 return true
10295         }
10296         return false
10297 }
10298 func rewriteValue386_OpRotateLeft16(v *Value) bool {
10299         v_1 := v.Args[1]
10300         v_0 := v.Args[0]
10301         // match: (RotateLeft16 x (MOVLconst [c]))
10302         // result: (ROLWconst [int16(c&15)] x)
10303         for {
10304                 x := v_0
10305                 if v_1.Op != Op386MOVLconst {
10306                         break
10307                 }
10308                 c := auxIntToInt32(v_1.AuxInt)
10309                 v.reset(Op386ROLWconst)
10310                 v.AuxInt = int16ToAuxInt(int16(c & 15))
10311                 v.AddArg(x)
10312                 return true
10313         }
10314         return false
10315 }
10316 func rewriteValue386_OpRotateLeft32(v *Value) bool {
10317         v_1 := v.Args[1]
10318         v_0 := v.Args[0]
10319         // match: (RotateLeft32 x (MOVLconst [c]))
10320         // result: (ROLLconst [c&31] x)
10321         for {
10322                 x := v_0
10323                 if v_1.Op != Op386MOVLconst {
10324                         break
10325                 }
10326                 c := auxIntToInt32(v_1.AuxInt)
10327                 v.reset(Op386ROLLconst)
10328                 v.AuxInt = int32ToAuxInt(c & 31)
10329                 v.AddArg(x)
10330                 return true
10331         }
10332         return false
10333 }
10334 func rewriteValue386_OpRotateLeft8(v *Value) bool {
10335         v_1 := v.Args[1]
10336         v_0 := v.Args[0]
10337         // match: (RotateLeft8 x (MOVLconst [c]))
10338         // result: (ROLBconst [int8(c&7)] x)
10339         for {
10340                 x := v_0
10341                 if v_1.Op != Op386MOVLconst {
10342                         break
10343                 }
10344                 c := auxIntToInt32(v_1.AuxInt)
10345                 v.reset(Op386ROLBconst)
10346                 v.AuxInt = int8ToAuxInt(int8(c & 7))
10347                 v.AddArg(x)
10348                 return true
10349         }
10350         return false
10351 }
10352 func rewriteValue386_OpRsh16Ux16(v *Value) bool {
10353         v_1 := v.Args[1]
10354         v_0 := v.Args[0]
10355         b := v.Block
10356         // match: (Rsh16Ux16 <t> x y)
10357         // cond: !shiftIsBounded(v)
10358         // result: (ANDL (SHRW <t> x y) (SBBLcarrymask <t> (CMPWconst y [16])))
10359         for {
10360                 t := v.Type
10361                 x := v_0
10362                 y := v_1
10363                 if !(!shiftIsBounded(v)) {
10364                         break
10365                 }
10366                 v.reset(Op386ANDL)
10367                 v0 := b.NewValue0(v.Pos, Op386SHRW, t)
10368                 v0.AddArg2(x, y)
10369                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
10370                 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
10371                 v2.AuxInt = int16ToAuxInt(16)
10372                 v2.AddArg(y)
10373                 v1.AddArg(v2)
10374                 v.AddArg2(v0, v1)
10375                 return true
10376         }
10377         // match: (Rsh16Ux16 <t> x y)
10378         // cond: shiftIsBounded(v)
10379         // result: (SHRW <t> x y)
10380         for {
10381                 t := v.Type
10382                 x := v_0
10383                 y := v_1
10384                 if !(shiftIsBounded(v)) {
10385                         break
10386                 }
10387                 v.reset(Op386SHRW)
10388                 v.Type = t
10389                 v.AddArg2(x, y)
10390                 return true
10391         }
10392         return false
10393 }
10394 func rewriteValue386_OpRsh16Ux32(v *Value) bool {
10395         v_1 := v.Args[1]
10396         v_0 := v.Args[0]
10397         b := v.Block
10398         // match: (Rsh16Ux32 <t> x y)
10399         // cond: !shiftIsBounded(v)
10400         // result: (ANDL (SHRW <t> x y) (SBBLcarrymask <t> (CMPLconst y [16])))
10401         for {
10402                 t := v.Type
10403                 x := v_0
10404                 y := v_1
10405                 if !(!shiftIsBounded(v)) {
10406                         break
10407                 }
10408                 v.reset(Op386ANDL)
10409                 v0 := b.NewValue0(v.Pos, Op386SHRW, t)
10410                 v0.AddArg2(x, y)
10411                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
10412                 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
10413                 v2.AuxInt = int32ToAuxInt(16)
10414                 v2.AddArg(y)
10415                 v1.AddArg(v2)
10416                 v.AddArg2(v0, v1)
10417                 return true
10418         }
10419         // match: (Rsh16Ux32 <t> x y)
10420         // cond: shiftIsBounded(v)
10421         // result: (SHRW <t> x y)
10422         for {
10423                 t := v.Type
10424                 x := v_0
10425                 y := v_1
10426                 if !(shiftIsBounded(v)) {
10427                         break
10428                 }
10429                 v.reset(Op386SHRW)
10430                 v.Type = t
10431                 v.AddArg2(x, y)
10432                 return true
10433         }
10434         return false
10435 }
10436 func rewriteValue386_OpRsh16Ux64(v *Value) bool {
10437         v_1 := v.Args[1]
10438         v_0 := v.Args[0]
10439         // match: (Rsh16Ux64 x (Const64 [c]))
10440         // cond: uint64(c) < 16
10441         // result: (SHRWconst x [int16(c)])
10442         for {
10443                 x := v_0
10444                 if v_1.Op != OpConst64 {
10445                         break
10446                 }
10447                 c := auxIntToInt64(v_1.AuxInt)
10448                 if !(uint64(c) < 16) {
10449                         break
10450                 }
10451                 v.reset(Op386SHRWconst)
10452                 v.AuxInt = int16ToAuxInt(int16(c))
10453                 v.AddArg(x)
10454                 return true
10455         }
10456         // match: (Rsh16Ux64 _ (Const64 [c]))
10457         // cond: uint64(c) >= 16
10458         // result: (Const16 [0])
10459         for {
10460                 if v_1.Op != OpConst64 {
10461                         break
10462                 }
10463                 c := auxIntToInt64(v_1.AuxInt)
10464                 if !(uint64(c) >= 16) {
10465                         break
10466                 }
10467                 v.reset(OpConst16)
10468                 v.AuxInt = int16ToAuxInt(0)
10469                 return true
10470         }
10471         return false
10472 }
10473 func rewriteValue386_OpRsh16Ux8(v *Value) bool {
10474         v_1 := v.Args[1]
10475         v_0 := v.Args[0]
10476         b := v.Block
10477         // match: (Rsh16Ux8 <t> x y)
10478         // cond: !shiftIsBounded(v)
10479         // result: (ANDL (SHRW <t> x y) (SBBLcarrymask <t> (CMPBconst y [16])))
10480         for {
10481                 t := v.Type
10482                 x := v_0
10483                 y := v_1
10484                 if !(!shiftIsBounded(v)) {
10485                         break
10486                 }
10487                 v.reset(Op386ANDL)
10488                 v0 := b.NewValue0(v.Pos, Op386SHRW, t)
10489                 v0.AddArg2(x, y)
10490                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
10491                 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
10492                 v2.AuxInt = int8ToAuxInt(16)
10493                 v2.AddArg(y)
10494                 v1.AddArg(v2)
10495                 v.AddArg2(v0, v1)
10496                 return true
10497         }
10498         // match: (Rsh16Ux8 <t> x y)
10499         // cond: shiftIsBounded(v)
10500         // result: (SHRW <t> x y)
10501         for {
10502                 t := v.Type
10503                 x := v_0
10504                 y := v_1
10505                 if !(shiftIsBounded(v)) {
10506                         break
10507                 }
10508                 v.reset(Op386SHRW)
10509                 v.Type = t
10510                 v.AddArg2(x, y)
10511                 return true
10512         }
10513         return false
10514 }
10515 func rewriteValue386_OpRsh16x16(v *Value) bool {
10516         v_1 := v.Args[1]
10517         v_0 := v.Args[0]
10518         b := v.Block
10519         // match: (Rsh16x16 <t> x y)
10520         // cond: !shiftIsBounded(v)
10521         // result: (SARW <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPWconst y [16])))))
10522         for {
10523                 t := v.Type
10524                 x := v_0
10525                 y := v_1
10526                 if !(!shiftIsBounded(v)) {
10527                         break
10528                 }
10529                 v.reset(Op386SARW)
10530                 v.Type = t
10531                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
10532                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
10533                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
10534                 v3 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
10535                 v3.AuxInt = int16ToAuxInt(16)
10536                 v3.AddArg(y)
10537                 v2.AddArg(v3)
10538                 v1.AddArg(v2)
10539                 v0.AddArg2(y, v1)
10540                 v.AddArg2(x, v0)
10541                 return true
10542         }
10543         // match: (Rsh16x16 <t> x y)
10544         // cond: shiftIsBounded(v)
10545         // result: (SARW x y)
10546         for {
10547                 x := v_0
10548                 y := v_1
10549                 if !(shiftIsBounded(v)) {
10550                         break
10551                 }
10552                 v.reset(Op386SARW)
10553                 v.AddArg2(x, y)
10554                 return true
10555         }
10556         return false
10557 }
10558 func rewriteValue386_OpRsh16x32(v *Value) bool {
10559         v_1 := v.Args[1]
10560         v_0 := v.Args[0]
10561         b := v.Block
10562         // match: (Rsh16x32 <t> x y)
10563         // cond: !shiftIsBounded(v)
10564         // result: (SARW <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPLconst y [16])))))
10565         for {
10566                 t := v.Type
10567                 x := v_0
10568                 y := v_1
10569                 if !(!shiftIsBounded(v)) {
10570                         break
10571                 }
10572                 v.reset(Op386SARW)
10573                 v.Type = t
10574                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
10575                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
10576                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
10577                 v3 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
10578                 v3.AuxInt = int32ToAuxInt(16)
10579                 v3.AddArg(y)
10580                 v2.AddArg(v3)
10581                 v1.AddArg(v2)
10582                 v0.AddArg2(y, v1)
10583                 v.AddArg2(x, v0)
10584                 return true
10585         }
10586         // match: (Rsh16x32 <t> x y)
10587         // cond: shiftIsBounded(v)
10588         // result: (SARW x y)
10589         for {
10590                 x := v_0
10591                 y := v_1
10592                 if !(shiftIsBounded(v)) {
10593                         break
10594                 }
10595                 v.reset(Op386SARW)
10596                 v.AddArg2(x, y)
10597                 return true
10598         }
10599         return false
10600 }
10601 func rewriteValue386_OpRsh16x64(v *Value) bool {
10602         v_1 := v.Args[1]
10603         v_0 := v.Args[0]
10604         // match: (Rsh16x64 x (Const64 [c]))
10605         // cond: uint64(c) < 16
10606         // result: (SARWconst x [int16(c)])
10607         for {
10608                 x := v_0
10609                 if v_1.Op != OpConst64 {
10610                         break
10611                 }
10612                 c := auxIntToInt64(v_1.AuxInt)
10613                 if !(uint64(c) < 16) {
10614                         break
10615                 }
10616                 v.reset(Op386SARWconst)
10617                 v.AuxInt = int16ToAuxInt(int16(c))
10618                 v.AddArg(x)
10619                 return true
10620         }
10621         // match: (Rsh16x64 x (Const64 [c]))
10622         // cond: uint64(c) >= 16
10623         // result: (SARWconst x [15])
10624         for {
10625                 x := v_0
10626                 if v_1.Op != OpConst64 {
10627                         break
10628                 }
10629                 c := auxIntToInt64(v_1.AuxInt)
10630                 if !(uint64(c) >= 16) {
10631                         break
10632                 }
10633                 v.reset(Op386SARWconst)
10634                 v.AuxInt = int16ToAuxInt(15)
10635                 v.AddArg(x)
10636                 return true
10637         }
10638         return false
10639 }
10640 func rewriteValue386_OpRsh16x8(v *Value) bool {
10641         v_1 := v.Args[1]
10642         v_0 := v.Args[0]
10643         b := v.Block
10644         // match: (Rsh16x8 <t> x y)
10645         // cond: !shiftIsBounded(v)
10646         // result: (SARW <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPBconst y [16])))))
10647         for {
10648                 t := v.Type
10649                 x := v_0
10650                 y := v_1
10651                 if !(!shiftIsBounded(v)) {
10652                         break
10653                 }
10654                 v.reset(Op386SARW)
10655                 v.Type = t
10656                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
10657                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
10658                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
10659                 v3 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
10660                 v3.AuxInt = int8ToAuxInt(16)
10661                 v3.AddArg(y)
10662                 v2.AddArg(v3)
10663                 v1.AddArg(v2)
10664                 v0.AddArg2(y, v1)
10665                 v.AddArg2(x, v0)
10666                 return true
10667         }
10668         // match: (Rsh16x8 <t> x y)
10669         // cond: shiftIsBounded(v)
10670         // result: (SARW x y)
10671         for {
10672                 x := v_0
10673                 y := v_1
10674                 if !(shiftIsBounded(v)) {
10675                         break
10676                 }
10677                 v.reset(Op386SARW)
10678                 v.AddArg2(x, y)
10679                 return true
10680         }
10681         return false
10682 }
10683 func rewriteValue386_OpRsh32Ux16(v *Value) bool {
10684         v_1 := v.Args[1]
10685         v_0 := v.Args[0]
10686         b := v.Block
10687         // match: (Rsh32Ux16 <t> x y)
10688         // cond: !shiftIsBounded(v)
10689         // result: (ANDL (SHRL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32])))
10690         for {
10691                 t := v.Type
10692                 x := v_0
10693                 y := v_1
10694                 if !(!shiftIsBounded(v)) {
10695                         break
10696                 }
10697                 v.reset(Op386ANDL)
10698                 v0 := b.NewValue0(v.Pos, Op386SHRL, t)
10699                 v0.AddArg2(x, y)
10700                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
10701                 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
10702                 v2.AuxInt = int16ToAuxInt(32)
10703                 v2.AddArg(y)
10704                 v1.AddArg(v2)
10705                 v.AddArg2(v0, v1)
10706                 return true
10707         }
10708         // match: (Rsh32Ux16 <t> x y)
10709         // cond: shiftIsBounded(v)
10710         // result: (SHRL <t> x y)
10711         for {
10712                 t := v.Type
10713                 x := v_0
10714                 y := v_1
10715                 if !(shiftIsBounded(v)) {
10716                         break
10717                 }
10718                 v.reset(Op386SHRL)
10719                 v.Type = t
10720                 v.AddArg2(x, y)
10721                 return true
10722         }
10723         return false
10724 }
10725 func rewriteValue386_OpRsh32Ux32(v *Value) bool {
10726         v_1 := v.Args[1]
10727         v_0 := v.Args[0]
10728         b := v.Block
10729         // match: (Rsh32Ux32 <t> x y)
10730         // cond: !shiftIsBounded(v)
10731         // result: (ANDL (SHRL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32])))
10732         for {
10733                 t := v.Type
10734                 x := v_0
10735                 y := v_1
10736                 if !(!shiftIsBounded(v)) {
10737                         break
10738                 }
10739                 v.reset(Op386ANDL)
10740                 v0 := b.NewValue0(v.Pos, Op386SHRL, t)
10741                 v0.AddArg2(x, y)
10742                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
10743                 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
10744                 v2.AuxInt = int32ToAuxInt(32)
10745                 v2.AddArg(y)
10746                 v1.AddArg(v2)
10747                 v.AddArg2(v0, v1)
10748                 return true
10749         }
10750         // match: (Rsh32Ux32 <t> x y)
10751         // cond: shiftIsBounded(v)
10752         // result: (SHRL <t> x y)
10753         for {
10754                 t := v.Type
10755                 x := v_0
10756                 y := v_1
10757                 if !(shiftIsBounded(v)) {
10758                         break
10759                 }
10760                 v.reset(Op386SHRL)
10761                 v.Type = t
10762                 v.AddArg2(x, y)
10763                 return true
10764         }
10765         return false
10766 }
10767 func rewriteValue386_OpRsh32Ux64(v *Value) bool {
10768         v_1 := v.Args[1]
10769         v_0 := v.Args[0]
10770         // match: (Rsh32Ux64 x (Const64 [c]))
10771         // cond: uint64(c) < 32
10772         // result: (SHRLconst x [int32(c)])
10773         for {
10774                 x := v_0
10775                 if v_1.Op != OpConst64 {
10776                         break
10777                 }
10778                 c := auxIntToInt64(v_1.AuxInt)
10779                 if !(uint64(c) < 32) {
10780                         break
10781                 }
10782                 v.reset(Op386SHRLconst)
10783                 v.AuxInt = int32ToAuxInt(int32(c))
10784                 v.AddArg(x)
10785                 return true
10786         }
10787         // match: (Rsh32Ux64 _ (Const64 [c]))
10788         // cond: uint64(c) >= 32
10789         // result: (Const32 [0])
10790         for {
10791                 if v_1.Op != OpConst64 {
10792                         break
10793                 }
10794                 c := auxIntToInt64(v_1.AuxInt)
10795                 if !(uint64(c) >= 32) {
10796                         break
10797                 }
10798                 v.reset(OpConst32)
10799                 v.AuxInt = int32ToAuxInt(0)
10800                 return true
10801         }
10802         return false
10803 }
10804 func rewriteValue386_OpRsh32Ux8(v *Value) bool {
10805         v_1 := v.Args[1]
10806         v_0 := v.Args[0]
10807         b := v.Block
10808         // match: (Rsh32Ux8 <t> x y)
10809         // cond: !shiftIsBounded(v)
10810         // result: (ANDL (SHRL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32])))
10811         for {
10812                 t := v.Type
10813                 x := v_0
10814                 y := v_1
10815                 if !(!shiftIsBounded(v)) {
10816                         break
10817                 }
10818                 v.reset(Op386ANDL)
10819                 v0 := b.NewValue0(v.Pos, Op386SHRL, t)
10820                 v0.AddArg2(x, y)
10821                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
10822                 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
10823                 v2.AuxInt = int8ToAuxInt(32)
10824                 v2.AddArg(y)
10825                 v1.AddArg(v2)
10826                 v.AddArg2(v0, v1)
10827                 return true
10828         }
10829         // match: (Rsh32Ux8 <t> x y)
10830         // cond: shiftIsBounded(v)
10831         // result: (SHRL <t> x y)
10832         for {
10833                 t := v.Type
10834                 x := v_0
10835                 y := v_1
10836                 if !(shiftIsBounded(v)) {
10837                         break
10838                 }
10839                 v.reset(Op386SHRL)
10840                 v.Type = t
10841                 v.AddArg2(x, y)
10842                 return true
10843         }
10844         return false
10845 }
10846 func rewriteValue386_OpRsh32x16(v *Value) bool {
10847         v_1 := v.Args[1]
10848         v_0 := v.Args[0]
10849         b := v.Block
10850         // match: (Rsh32x16 <t> x y)
10851         // cond: !shiftIsBounded(v)
10852         // result: (SARL <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPWconst y [32])))))
10853         for {
10854                 t := v.Type
10855                 x := v_0
10856                 y := v_1
10857                 if !(!shiftIsBounded(v)) {
10858                         break
10859                 }
10860                 v.reset(Op386SARL)
10861                 v.Type = t
10862                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
10863                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
10864                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
10865                 v3 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
10866                 v3.AuxInt = int16ToAuxInt(32)
10867                 v3.AddArg(y)
10868                 v2.AddArg(v3)
10869                 v1.AddArg(v2)
10870                 v0.AddArg2(y, v1)
10871                 v.AddArg2(x, v0)
10872                 return true
10873         }
10874         // match: (Rsh32x16 <t> x y)
10875         // cond: shiftIsBounded(v)
10876         // result: (SARL x y)
10877         for {
10878                 x := v_0
10879                 y := v_1
10880                 if !(shiftIsBounded(v)) {
10881                         break
10882                 }
10883                 v.reset(Op386SARL)
10884                 v.AddArg2(x, y)
10885                 return true
10886         }
10887         return false
10888 }
10889 func rewriteValue386_OpRsh32x32(v *Value) bool {
10890         v_1 := v.Args[1]
10891         v_0 := v.Args[0]
10892         b := v.Block
10893         // match: (Rsh32x32 <t> x y)
10894         // cond: !shiftIsBounded(v)
10895         // result: (SARL <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPLconst y [32])))))
10896         for {
10897                 t := v.Type
10898                 x := v_0
10899                 y := v_1
10900                 if !(!shiftIsBounded(v)) {
10901                         break
10902                 }
10903                 v.reset(Op386SARL)
10904                 v.Type = t
10905                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
10906                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
10907                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
10908                 v3 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
10909                 v3.AuxInt = int32ToAuxInt(32)
10910                 v3.AddArg(y)
10911                 v2.AddArg(v3)
10912                 v1.AddArg(v2)
10913                 v0.AddArg2(y, v1)
10914                 v.AddArg2(x, v0)
10915                 return true
10916         }
10917         // match: (Rsh32x32 <t> x y)
10918         // cond: shiftIsBounded(v)
10919         // result: (SARL x y)
10920         for {
10921                 x := v_0
10922                 y := v_1
10923                 if !(shiftIsBounded(v)) {
10924                         break
10925                 }
10926                 v.reset(Op386SARL)
10927                 v.AddArg2(x, y)
10928                 return true
10929         }
10930         return false
10931 }
10932 func rewriteValue386_OpRsh32x64(v *Value) bool {
10933         v_1 := v.Args[1]
10934         v_0 := v.Args[0]
10935         // match: (Rsh32x64 x (Const64 [c]))
10936         // cond: uint64(c) < 32
10937         // result: (SARLconst x [int32(c)])
10938         for {
10939                 x := v_0
10940                 if v_1.Op != OpConst64 {
10941                         break
10942                 }
10943                 c := auxIntToInt64(v_1.AuxInt)
10944                 if !(uint64(c) < 32) {
10945                         break
10946                 }
10947                 v.reset(Op386SARLconst)
10948                 v.AuxInt = int32ToAuxInt(int32(c))
10949                 v.AddArg(x)
10950                 return true
10951         }
10952         // match: (Rsh32x64 x (Const64 [c]))
10953         // cond: uint64(c) >= 32
10954         // result: (SARLconst x [31])
10955         for {
10956                 x := v_0
10957                 if v_1.Op != OpConst64 {
10958                         break
10959                 }
10960                 c := auxIntToInt64(v_1.AuxInt)
10961                 if !(uint64(c) >= 32) {
10962                         break
10963                 }
10964                 v.reset(Op386SARLconst)
10965                 v.AuxInt = int32ToAuxInt(31)
10966                 v.AddArg(x)
10967                 return true
10968         }
10969         return false
10970 }
10971 func rewriteValue386_OpRsh32x8(v *Value) bool {
10972         v_1 := v.Args[1]
10973         v_0 := v.Args[0]
10974         b := v.Block
10975         // match: (Rsh32x8 <t> x y)
10976         // cond: !shiftIsBounded(v)
10977         // result: (SARL <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPBconst y [32])))))
10978         for {
10979                 t := v.Type
10980                 x := v_0
10981                 y := v_1
10982                 if !(!shiftIsBounded(v)) {
10983                         break
10984                 }
10985                 v.reset(Op386SARL)
10986                 v.Type = t
10987                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
10988                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
10989                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
10990                 v3 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
10991                 v3.AuxInt = int8ToAuxInt(32)
10992                 v3.AddArg(y)
10993                 v2.AddArg(v3)
10994                 v1.AddArg(v2)
10995                 v0.AddArg2(y, v1)
10996                 v.AddArg2(x, v0)
10997                 return true
10998         }
10999         // match: (Rsh32x8 <t> x y)
11000         // cond: shiftIsBounded(v)
11001         // result: (SARL x y)
11002         for {
11003                 x := v_0
11004                 y := v_1
11005                 if !(shiftIsBounded(v)) {
11006                         break
11007                 }
11008                 v.reset(Op386SARL)
11009                 v.AddArg2(x, y)
11010                 return true
11011         }
11012         return false
11013 }
11014 func rewriteValue386_OpRsh8Ux16(v *Value) bool {
11015         v_1 := v.Args[1]
11016         v_0 := v.Args[0]
11017         b := v.Block
11018         // match: (Rsh8Ux16 <t> x y)
11019         // cond: !shiftIsBounded(v)
11020         // result: (ANDL (SHRB <t> x y) (SBBLcarrymask <t> (CMPWconst y [8])))
11021         for {
11022                 t := v.Type
11023                 x := v_0
11024                 y := v_1
11025                 if !(!shiftIsBounded(v)) {
11026                         break
11027                 }
11028                 v.reset(Op386ANDL)
11029                 v0 := b.NewValue0(v.Pos, Op386SHRB, t)
11030                 v0.AddArg2(x, y)
11031                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
11032                 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
11033                 v2.AuxInt = int16ToAuxInt(8)
11034                 v2.AddArg(y)
11035                 v1.AddArg(v2)
11036                 v.AddArg2(v0, v1)
11037                 return true
11038         }
11039         // match: (Rsh8Ux16 <t> x y)
11040         // cond: shiftIsBounded(v)
11041         // result: (SHRB <t> x y)
11042         for {
11043                 t := v.Type
11044                 x := v_0
11045                 y := v_1
11046                 if !(shiftIsBounded(v)) {
11047                         break
11048                 }
11049                 v.reset(Op386SHRB)
11050                 v.Type = t
11051                 v.AddArg2(x, y)
11052                 return true
11053         }
11054         return false
11055 }
11056 func rewriteValue386_OpRsh8Ux32(v *Value) bool {
11057         v_1 := v.Args[1]
11058         v_0 := v.Args[0]
11059         b := v.Block
11060         // match: (Rsh8Ux32 <t> x y)
11061         // cond: !shiftIsBounded(v)
11062         // result: (ANDL (SHRB <t> x y) (SBBLcarrymask <t> (CMPLconst y [8])))
11063         for {
11064                 t := v.Type
11065                 x := v_0
11066                 y := v_1
11067                 if !(!shiftIsBounded(v)) {
11068                         break
11069                 }
11070                 v.reset(Op386ANDL)
11071                 v0 := b.NewValue0(v.Pos, Op386SHRB, t)
11072                 v0.AddArg2(x, y)
11073                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
11074                 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
11075                 v2.AuxInt = int32ToAuxInt(8)
11076                 v2.AddArg(y)
11077                 v1.AddArg(v2)
11078                 v.AddArg2(v0, v1)
11079                 return true
11080         }
11081         // match: (Rsh8Ux32 <t> x y)
11082         // cond: shiftIsBounded(v)
11083         // result: (SHRB <t> x y)
11084         for {
11085                 t := v.Type
11086                 x := v_0
11087                 y := v_1
11088                 if !(shiftIsBounded(v)) {
11089                         break
11090                 }
11091                 v.reset(Op386SHRB)
11092                 v.Type = t
11093                 v.AddArg2(x, y)
11094                 return true
11095         }
11096         return false
11097 }
11098 func rewriteValue386_OpRsh8Ux64(v *Value) bool {
11099         v_1 := v.Args[1]
11100         v_0 := v.Args[0]
11101         // match: (Rsh8Ux64 x (Const64 [c]))
11102         // cond: uint64(c) < 8
11103         // result: (SHRBconst x [int8(c)])
11104         for {
11105                 x := v_0
11106                 if v_1.Op != OpConst64 {
11107                         break
11108                 }
11109                 c := auxIntToInt64(v_1.AuxInt)
11110                 if !(uint64(c) < 8) {
11111                         break
11112                 }
11113                 v.reset(Op386SHRBconst)
11114                 v.AuxInt = int8ToAuxInt(int8(c))
11115                 v.AddArg(x)
11116                 return true
11117         }
11118         // match: (Rsh8Ux64 _ (Const64 [c]))
11119         // cond: uint64(c) >= 8
11120         // result: (Const8 [0])
11121         for {
11122                 if v_1.Op != OpConst64 {
11123                         break
11124                 }
11125                 c := auxIntToInt64(v_1.AuxInt)
11126                 if !(uint64(c) >= 8) {
11127                         break
11128                 }
11129                 v.reset(OpConst8)
11130                 v.AuxInt = int8ToAuxInt(0)
11131                 return true
11132         }
11133         return false
11134 }
11135 func rewriteValue386_OpRsh8Ux8(v *Value) bool {
11136         v_1 := v.Args[1]
11137         v_0 := v.Args[0]
11138         b := v.Block
11139         // match: (Rsh8Ux8 <t> x y)
11140         // cond: !shiftIsBounded(v)
11141         // result: (ANDL (SHRB <t> x y) (SBBLcarrymask <t> (CMPBconst y [8])))
11142         for {
11143                 t := v.Type
11144                 x := v_0
11145                 y := v_1
11146                 if !(!shiftIsBounded(v)) {
11147                         break
11148                 }
11149                 v.reset(Op386ANDL)
11150                 v0 := b.NewValue0(v.Pos, Op386SHRB, t)
11151                 v0.AddArg2(x, y)
11152                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
11153                 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
11154                 v2.AuxInt = int8ToAuxInt(8)
11155                 v2.AddArg(y)
11156                 v1.AddArg(v2)
11157                 v.AddArg2(v0, v1)
11158                 return true
11159         }
11160         // match: (Rsh8Ux8 <t> x y)
11161         // cond: shiftIsBounded(v)
11162         // result: (SHRB <t> x y)
11163         for {
11164                 t := v.Type
11165                 x := v_0
11166                 y := v_1
11167                 if !(shiftIsBounded(v)) {
11168                         break
11169                 }
11170                 v.reset(Op386SHRB)
11171                 v.Type = t
11172                 v.AddArg2(x, y)
11173                 return true
11174         }
11175         return false
11176 }
11177 func rewriteValue386_OpRsh8x16(v *Value) bool {
11178         v_1 := v.Args[1]
11179         v_0 := v.Args[0]
11180         b := v.Block
11181         // match: (Rsh8x16 <t> x y)
11182         // cond: !shiftIsBounded(v)
11183         // result: (SARB <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPWconst y [8])))))
11184         for {
11185                 t := v.Type
11186                 x := v_0
11187                 y := v_1
11188                 if !(!shiftIsBounded(v)) {
11189                         break
11190                 }
11191                 v.reset(Op386SARB)
11192                 v.Type = t
11193                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
11194                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
11195                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
11196                 v3 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
11197                 v3.AuxInt = int16ToAuxInt(8)
11198                 v3.AddArg(y)
11199                 v2.AddArg(v3)
11200                 v1.AddArg(v2)
11201                 v0.AddArg2(y, v1)
11202                 v.AddArg2(x, v0)
11203                 return true
11204         }
11205         // match: (Rsh8x16 <t> x y)
11206         // cond: shiftIsBounded(v)
11207         // result: (SARB x y)
11208         for {
11209                 x := v_0
11210                 y := v_1
11211                 if !(shiftIsBounded(v)) {
11212                         break
11213                 }
11214                 v.reset(Op386SARB)
11215                 v.AddArg2(x, y)
11216                 return true
11217         }
11218         return false
11219 }
11220 func rewriteValue386_OpRsh8x32(v *Value) bool {
11221         v_1 := v.Args[1]
11222         v_0 := v.Args[0]
11223         b := v.Block
11224         // match: (Rsh8x32 <t> x y)
11225         // cond: !shiftIsBounded(v)
11226         // result: (SARB <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPLconst y [8])))))
11227         for {
11228                 t := v.Type
11229                 x := v_0
11230                 y := v_1
11231                 if !(!shiftIsBounded(v)) {
11232                         break
11233                 }
11234                 v.reset(Op386SARB)
11235                 v.Type = t
11236                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
11237                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
11238                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
11239                 v3 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
11240                 v3.AuxInt = int32ToAuxInt(8)
11241                 v3.AddArg(y)
11242                 v2.AddArg(v3)
11243                 v1.AddArg(v2)
11244                 v0.AddArg2(y, v1)
11245                 v.AddArg2(x, v0)
11246                 return true
11247         }
11248         // match: (Rsh8x32 <t> x y)
11249         // cond: shiftIsBounded(v)
11250         // result: (SARB x y)
11251         for {
11252                 x := v_0
11253                 y := v_1
11254                 if !(shiftIsBounded(v)) {
11255                         break
11256                 }
11257                 v.reset(Op386SARB)
11258                 v.AddArg2(x, y)
11259                 return true
11260         }
11261         return false
11262 }
11263 func rewriteValue386_OpRsh8x64(v *Value) bool {
11264         v_1 := v.Args[1]
11265         v_0 := v.Args[0]
11266         // match: (Rsh8x64 x (Const64 [c]))
11267         // cond: uint64(c) < 8
11268         // result: (SARBconst x [int8(c)])
11269         for {
11270                 x := v_0
11271                 if v_1.Op != OpConst64 {
11272                         break
11273                 }
11274                 c := auxIntToInt64(v_1.AuxInt)
11275                 if !(uint64(c) < 8) {
11276                         break
11277                 }
11278                 v.reset(Op386SARBconst)
11279                 v.AuxInt = int8ToAuxInt(int8(c))
11280                 v.AddArg(x)
11281                 return true
11282         }
11283         // match: (Rsh8x64 x (Const64 [c]))
11284         // cond: uint64(c) >= 8
11285         // result: (SARBconst x [7])
11286         for {
11287                 x := v_0
11288                 if v_1.Op != OpConst64 {
11289                         break
11290                 }
11291                 c := auxIntToInt64(v_1.AuxInt)
11292                 if !(uint64(c) >= 8) {
11293                         break
11294                 }
11295                 v.reset(Op386SARBconst)
11296                 v.AuxInt = int8ToAuxInt(7)
11297                 v.AddArg(x)
11298                 return true
11299         }
11300         return false
11301 }
11302 func rewriteValue386_OpRsh8x8(v *Value) bool {
11303         v_1 := v.Args[1]
11304         v_0 := v.Args[0]
11305         b := v.Block
11306         // match: (Rsh8x8 <t> x y)
11307         // cond: !shiftIsBounded(v)
11308         // result: (SARB <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPBconst y [8])))))
11309         for {
11310                 t := v.Type
11311                 x := v_0
11312                 y := v_1
11313                 if !(!shiftIsBounded(v)) {
11314                         break
11315                 }
11316                 v.reset(Op386SARB)
11317                 v.Type = t
11318                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
11319                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
11320                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
11321                 v3 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
11322                 v3.AuxInt = int8ToAuxInt(8)
11323                 v3.AddArg(y)
11324                 v2.AddArg(v3)
11325                 v1.AddArg(v2)
11326                 v0.AddArg2(y, v1)
11327                 v.AddArg2(x, v0)
11328                 return true
11329         }
11330         // match: (Rsh8x8 <t> x y)
11331         // cond: shiftIsBounded(v)
11332         // result: (SARB x y)
11333         for {
11334                 x := v_0
11335                 y := v_1
11336                 if !(shiftIsBounded(v)) {
11337                         break
11338                 }
11339                 v.reset(Op386SARB)
11340                 v.AddArg2(x, y)
11341                 return true
11342         }
11343         return false
11344 }
11345 func rewriteValue386_OpSelect0(v *Value) bool {
11346         v_0 := v.Args[0]
11347         b := v.Block
11348         typ := &b.Func.Config.Types
11349         // match: (Select0 (Mul32uover x y))
11350         // result: (Select0 <typ.UInt32> (MULLU x y))
11351         for {
11352                 if v_0.Op != OpMul32uover {
11353                         break
11354                 }
11355                 y := v_0.Args[1]
11356                 x := v_0.Args[0]
11357                 v.reset(OpSelect0)
11358                 v.Type = typ.UInt32
11359                 v0 := b.NewValue0(v.Pos, Op386MULLU, types.NewTuple(typ.UInt32, types.TypeFlags))
11360                 v0.AddArg2(x, y)
11361                 v.AddArg(v0)
11362                 return true
11363         }
11364         return false
11365 }
11366 func rewriteValue386_OpSelect1(v *Value) bool {
11367         v_0 := v.Args[0]
11368         b := v.Block
11369         typ := &b.Func.Config.Types
11370         // match: (Select1 (Mul32uover x y))
11371         // result: (SETO (Select1 <types.TypeFlags> (MULLU x y)))
11372         for {
11373                 if v_0.Op != OpMul32uover {
11374                         break
11375                 }
11376                 y := v_0.Args[1]
11377                 x := v_0.Args[0]
11378                 v.reset(Op386SETO)
11379                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11380                 v1 := b.NewValue0(v.Pos, Op386MULLU, types.NewTuple(typ.UInt32, types.TypeFlags))
11381                 v1.AddArg2(x, y)
11382                 v0.AddArg(v1)
11383                 v.AddArg(v0)
11384                 return true
11385         }
11386         return false
11387 }
11388 func rewriteValue386_OpSignmask(v *Value) bool {
11389         v_0 := v.Args[0]
11390         // match: (Signmask x)
11391         // result: (SARLconst x [31])
11392         for {
11393                 x := v_0
11394                 v.reset(Op386SARLconst)
11395                 v.AuxInt = int32ToAuxInt(31)
11396                 v.AddArg(x)
11397                 return true
11398         }
11399 }
11400 func rewriteValue386_OpSlicemask(v *Value) bool {
11401         v_0 := v.Args[0]
11402         b := v.Block
11403         // match: (Slicemask <t> x)
11404         // result: (SARLconst (NEGL <t> x) [31])
11405         for {
11406                 t := v.Type
11407                 x := v_0
11408                 v.reset(Op386SARLconst)
11409                 v.AuxInt = int32ToAuxInt(31)
11410                 v0 := b.NewValue0(v.Pos, Op386NEGL, t)
11411                 v0.AddArg(x)
11412                 v.AddArg(v0)
11413                 return true
11414         }
11415 }
11416 func rewriteValue386_OpStore(v *Value) bool {
11417         v_2 := v.Args[2]
11418         v_1 := v.Args[1]
11419         v_0 := v.Args[0]
11420         // match: (Store {t} ptr val mem)
11421         // cond: t.Size() == 8 && is64BitFloat(val.Type)
11422         // result: (MOVSDstore ptr val mem)
11423         for {
11424                 t := auxToType(v.Aux)
11425                 ptr := v_0
11426                 val := v_1
11427                 mem := v_2
11428                 if !(t.Size() == 8 && is64BitFloat(val.Type)) {
11429                         break
11430                 }
11431                 v.reset(Op386MOVSDstore)
11432                 v.AddArg3(ptr, val, mem)
11433                 return true
11434         }
11435         // match: (Store {t} ptr val mem)
11436         // cond: t.Size() == 4 && is32BitFloat(val.Type)
11437         // result: (MOVSSstore ptr val mem)
11438         for {
11439                 t := auxToType(v.Aux)
11440                 ptr := v_0
11441                 val := v_1
11442                 mem := v_2
11443                 if !(t.Size() == 4 && is32BitFloat(val.Type)) {
11444                         break
11445                 }
11446                 v.reset(Op386MOVSSstore)
11447                 v.AddArg3(ptr, val, mem)
11448                 return true
11449         }
11450         // match: (Store {t} ptr val mem)
11451         // cond: t.Size() == 4
11452         // result: (MOVLstore ptr val mem)
11453         for {
11454                 t := auxToType(v.Aux)
11455                 ptr := v_0
11456                 val := v_1
11457                 mem := v_2
11458                 if !(t.Size() == 4) {
11459                         break
11460                 }
11461                 v.reset(Op386MOVLstore)
11462                 v.AddArg3(ptr, val, mem)
11463                 return true
11464         }
11465         // match: (Store {t} ptr val mem)
11466         // cond: t.Size() == 2
11467         // result: (MOVWstore ptr val mem)
11468         for {
11469                 t := auxToType(v.Aux)
11470                 ptr := v_0
11471                 val := v_1
11472                 mem := v_2
11473                 if !(t.Size() == 2) {
11474                         break
11475                 }
11476                 v.reset(Op386MOVWstore)
11477                 v.AddArg3(ptr, val, mem)
11478                 return true
11479         }
11480         // match: (Store {t} ptr val mem)
11481         // cond: t.Size() == 1
11482         // result: (MOVBstore ptr val mem)
11483         for {
11484                 t := auxToType(v.Aux)
11485                 ptr := v_0
11486                 val := v_1
11487                 mem := v_2
11488                 if !(t.Size() == 1) {
11489                         break
11490                 }
11491                 v.reset(Op386MOVBstore)
11492                 v.AddArg3(ptr, val, mem)
11493                 return true
11494         }
11495         return false
11496 }
11497 func rewriteValue386_OpZero(v *Value) bool {
11498         v_1 := v.Args[1]
11499         v_0 := v.Args[0]
11500         b := v.Block
11501         config := b.Func.Config
11502         typ := &b.Func.Config.Types
11503         // match: (Zero [0] _ mem)
11504         // result: mem
11505         for {
11506                 if auxIntToInt64(v.AuxInt) != 0 {
11507                         break
11508                 }
11509                 mem := v_1
11510                 v.copyOf(mem)
11511                 return true
11512         }
11513         // match: (Zero [1] destptr mem)
11514         // result: (MOVBstoreconst [0] destptr mem)
11515         for {
11516                 if auxIntToInt64(v.AuxInt) != 1 {
11517                         break
11518                 }
11519                 destptr := v_0
11520                 mem := v_1
11521                 v.reset(Op386MOVBstoreconst)
11522                 v.AuxInt = valAndOffToAuxInt(0)
11523                 v.AddArg2(destptr, mem)
11524                 return true
11525         }
11526         // match: (Zero [2] destptr mem)
11527         // result: (MOVWstoreconst [0] destptr mem)
11528         for {
11529                 if auxIntToInt64(v.AuxInt) != 2 {
11530                         break
11531                 }
11532                 destptr := v_0
11533                 mem := v_1
11534                 v.reset(Op386MOVWstoreconst)
11535                 v.AuxInt = valAndOffToAuxInt(0)
11536                 v.AddArg2(destptr, mem)
11537                 return true
11538         }
11539         // match: (Zero [4] destptr mem)
11540         // result: (MOVLstoreconst [0] destptr mem)
11541         for {
11542                 if auxIntToInt64(v.AuxInt) != 4 {
11543                         break
11544                 }
11545                 destptr := v_0
11546                 mem := v_1
11547                 v.reset(Op386MOVLstoreconst)
11548                 v.AuxInt = valAndOffToAuxInt(0)
11549                 v.AddArg2(destptr, mem)
11550                 return true
11551         }
11552         // match: (Zero [3] destptr mem)
11553         // result: (MOVBstoreconst [makeValAndOff(0,2)] destptr (MOVWstoreconst [makeValAndOff(0,0)] destptr mem))
11554         for {
11555                 if auxIntToInt64(v.AuxInt) != 3 {
11556                         break
11557                 }
11558                 destptr := v_0
11559                 mem := v_1
11560                 v.reset(Op386MOVBstoreconst)
11561                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 2))
11562                 v0 := b.NewValue0(v.Pos, Op386MOVWstoreconst, types.TypeMem)
11563                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11564                 v0.AddArg2(destptr, mem)
11565                 v.AddArg2(destptr, v0)
11566                 return true
11567         }
11568         // match: (Zero [5] destptr mem)
11569         // result: (MOVBstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem))
11570         for {
11571                 if auxIntToInt64(v.AuxInt) != 5 {
11572                         break
11573                 }
11574                 destptr := v_0
11575                 mem := v_1
11576                 v.reset(Op386MOVBstoreconst)
11577                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
11578                 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11579                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11580                 v0.AddArg2(destptr, mem)
11581                 v.AddArg2(destptr, v0)
11582                 return true
11583         }
11584         // match: (Zero [6] destptr mem)
11585         // result: (MOVWstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem))
11586         for {
11587                 if auxIntToInt64(v.AuxInt) != 6 {
11588                         break
11589                 }
11590                 destptr := v_0
11591                 mem := v_1
11592                 v.reset(Op386MOVWstoreconst)
11593                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
11594                 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11595                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11596                 v0.AddArg2(destptr, mem)
11597                 v.AddArg2(destptr, v0)
11598                 return true
11599         }
11600         // match: (Zero [7] destptr mem)
11601         // result: (MOVLstoreconst [makeValAndOff(0,3)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem))
11602         for {
11603                 if auxIntToInt64(v.AuxInt) != 7 {
11604                         break
11605                 }
11606                 destptr := v_0
11607                 mem := v_1
11608                 v.reset(Op386MOVLstoreconst)
11609                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 3))
11610                 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11611                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11612                 v0.AddArg2(destptr, mem)
11613                 v.AddArg2(destptr, v0)
11614                 return true
11615         }
11616         // match: (Zero [s] destptr mem)
11617         // cond: s%4 != 0 && s > 4
11618         // result: (Zero [s-s%4] (ADDLconst destptr [int32(s%4)]) (MOVLstoreconst [0] destptr mem))
11619         for {
11620                 s := auxIntToInt64(v.AuxInt)
11621                 destptr := v_0
11622                 mem := v_1
11623                 if !(s%4 != 0 && s > 4) {
11624                         break
11625                 }
11626                 v.reset(OpZero)
11627                 v.AuxInt = int64ToAuxInt(s - s%4)
11628                 v0 := b.NewValue0(v.Pos, Op386ADDLconst, typ.UInt32)
11629                 v0.AuxInt = int32ToAuxInt(int32(s % 4))
11630                 v0.AddArg(destptr)
11631                 v1 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11632                 v1.AuxInt = valAndOffToAuxInt(0)
11633                 v1.AddArg2(destptr, mem)
11634                 v.AddArg2(v0, v1)
11635                 return true
11636         }
11637         // match: (Zero [8] destptr mem)
11638         // result: (MOVLstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem))
11639         for {
11640                 if auxIntToInt64(v.AuxInt) != 8 {
11641                         break
11642                 }
11643                 destptr := v_0
11644                 mem := v_1
11645                 v.reset(Op386MOVLstoreconst)
11646                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
11647                 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11648                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11649                 v0.AddArg2(destptr, mem)
11650                 v.AddArg2(destptr, v0)
11651                 return true
11652         }
11653         // match: (Zero [12] destptr mem)
11654         // result: (MOVLstoreconst [makeValAndOff(0,8)] destptr (MOVLstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem)))
11655         for {
11656                 if auxIntToInt64(v.AuxInt) != 12 {
11657                         break
11658                 }
11659                 destptr := v_0
11660                 mem := v_1
11661                 v.reset(Op386MOVLstoreconst)
11662                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 8))
11663                 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11664                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
11665                 v1 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11666                 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11667                 v1.AddArg2(destptr, mem)
11668                 v0.AddArg2(destptr, v1)
11669                 v.AddArg2(destptr, v0)
11670                 return true
11671         }
11672         // match: (Zero [16] destptr mem)
11673         // result: (MOVLstoreconst [makeValAndOff(0,12)] destptr (MOVLstoreconst [makeValAndOff(0,8)] destptr (MOVLstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem))))
11674         for {
11675                 if auxIntToInt64(v.AuxInt) != 16 {
11676                         break
11677                 }
11678                 destptr := v_0
11679                 mem := v_1
11680                 v.reset(Op386MOVLstoreconst)
11681                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 12))
11682                 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11683                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 8))
11684                 v1 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11685                 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
11686                 v2 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11687                 v2.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11688                 v2.AddArg2(destptr, mem)
11689                 v1.AddArg2(destptr, v2)
11690                 v0.AddArg2(destptr, v1)
11691                 v.AddArg2(destptr, v0)
11692                 return true
11693         }
11694         // match: (Zero [s] destptr mem)
11695         // cond: s > 16 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice
11696         // result: (DUFFZERO [1*(128-s/4)] destptr (MOVLconst [0]) mem)
11697         for {
11698                 s := auxIntToInt64(v.AuxInt)
11699                 destptr := v_0
11700                 mem := v_1
11701                 if !(s > 16 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice) {
11702                         break
11703                 }
11704                 v.reset(Op386DUFFZERO)
11705                 v.AuxInt = int64ToAuxInt(1 * (128 - s/4))
11706                 v0 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32)
11707                 v0.AuxInt = int32ToAuxInt(0)
11708                 v.AddArg3(destptr, v0, mem)
11709                 return true
11710         }
11711         // match: (Zero [s] destptr mem)
11712         // cond: (s > 4*128 || (config.noDuffDevice && s > 16)) && s%4 == 0
11713         // result: (REPSTOSL destptr (MOVLconst [int32(s/4)]) (MOVLconst [0]) mem)
11714         for {
11715                 s := auxIntToInt64(v.AuxInt)
11716                 destptr := v_0
11717                 mem := v_1
11718                 if !((s > 4*128 || (config.noDuffDevice && s > 16)) && s%4 == 0) {
11719                         break
11720                 }
11721                 v.reset(Op386REPSTOSL)
11722                 v0 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32)
11723                 v0.AuxInt = int32ToAuxInt(int32(s / 4))
11724                 v1 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32)
11725                 v1.AuxInt = int32ToAuxInt(0)
11726                 v.AddArg4(destptr, v0, v1, mem)
11727                 return true
11728         }
11729         return false
11730 }
11731 func rewriteValue386_OpZeromask(v *Value) bool {
11732         v_0 := v.Args[0]
11733         b := v.Block
11734         // match: (Zeromask <t> x)
11735         // result: (XORLconst [-1] (SBBLcarrymask <t> (CMPLconst x [1])))
11736         for {
11737                 t := v.Type
11738                 x := v_0
11739                 v.reset(Op386XORLconst)
11740                 v.AuxInt = int32ToAuxInt(-1)
11741                 v0 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
11742                 v1 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
11743                 v1.AuxInt = int32ToAuxInt(1)
11744                 v1.AddArg(x)
11745                 v0.AddArg(v1)
11746                 v.AddArg(v0)
11747                 return true
11748         }
11749 }
11750 func rewriteBlock386(b *Block) bool {
11751         switch b.Kind {
11752         case Block386EQ:
11753                 // match: (EQ (InvertFlags cmp) yes no)
11754                 // result: (EQ cmp yes no)
11755                 for b.Controls[0].Op == Op386InvertFlags {
11756                         v_0 := b.Controls[0]
11757                         cmp := v_0.Args[0]
11758                         b.resetWithControl(Block386EQ, cmp)
11759                         return true
11760                 }
11761                 // match: (EQ (FlagEQ) yes no)
11762                 // result: (First yes no)
11763                 for b.Controls[0].Op == Op386FlagEQ {
11764                         b.Reset(BlockFirst)
11765                         return true
11766                 }
11767                 // match: (EQ (FlagLT_ULT) yes no)
11768                 // result: (First no yes)
11769                 for b.Controls[0].Op == Op386FlagLT_ULT {
11770                         b.Reset(BlockFirst)
11771                         b.swapSuccessors()
11772                         return true
11773                 }
11774                 // match: (EQ (FlagLT_UGT) yes no)
11775                 // result: (First no yes)
11776                 for b.Controls[0].Op == Op386FlagLT_UGT {
11777                         b.Reset(BlockFirst)
11778                         b.swapSuccessors()
11779                         return true
11780                 }
11781                 // match: (EQ (FlagGT_ULT) yes no)
11782                 // result: (First no yes)
11783                 for b.Controls[0].Op == Op386FlagGT_ULT {
11784                         b.Reset(BlockFirst)
11785                         b.swapSuccessors()
11786                         return true
11787                 }
11788                 // match: (EQ (FlagGT_UGT) yes no)
11789                 // result: (First no yes)
11790                 for b.Controls[0].Op == Op386FlagGT_UGT {
11791                         b.Reset(BlockFirst)
11792                         b.swapSuccessors()
11793                         return true
11794                 }
11795         case Block386GE:
11796                 // match: (GE (InvertFlags cmp) yes no)
11797                 // result: (LE cmp yes no)
11798                 for b.Controls[0].Op == Op386InvertFlags {
11799                         v_0 := b.Controls[0]
11800                         cmp := v_0.Args[0]
11801                         b.resetWithControl(Block386LE, cmp)
11802                         return true
11803                 }
11804                 // match: (GE (FlagEQ) yes no)
11805                 // result: (First yes no)
11806                 for b.Controls[0].Op == Op386FlagEQ {
11807                         b.Reset(BlockFirst)
11808                         return true
11809                 }
11810                 // match: (GE (FlagLT_ULT) yes no)
11811                 // result: (First no yes)
11812                 for b.Controls[0].Op == Op386FlagLT_ULT {
11813                         b.Reset(BlockFirst)
11814                         b.swapSuccessors()
11815                         return true
11816                 }
11817                 // match: (GE (FlagLT_UGT) yes no)
11818                 // result: (First no yes)
11819                 for b.Controls[0].Op == Op386FlagLT_UGT {
11820                         b.Reset(BlockFirst)
11821                         b.swapSuccessors()
11822                         return true
11823                 }
11824                 // match: (GE (FlagGT_ULT) yes no)
11825                 // result: (First yes no)
11826                 for b.Controls[0].Op == Op386FlagGT_ULT {
11827                         b.Reset(BlockFirst)
11828                         return true
11829                 }
11830                 // match: (GE (FlagGT_UGT) yes no)
11831                 // result: (First yes no)
11832                 for b.Controls[0].Op == Op386FlagGT_UGT {
11833                         b.Reset(BlockFirst)
11834                         return true
11835                 }
11836         case Block386GT:
11837                 // match: (GT (InvertFlags cmp) yes no)
11838                 // result: (LT cmp yes no)
11839                 for b.Controls[0].Op == Op386InvertFlags {
11840                         v_0 := b.Controls[0]
11841                         cmp := v_0.Args[0]
11842                         b.resetWithControl(Block386LT, cmp)
11843                         return true
11844                 }
11845                 // match: (GT (FlagEQ) yes no)
11846                 // result: (First no yes)
11847                 for b.Controls[0].Op == Op386FlagEQ {
11848                         b.Reset(BlockFirst)
11849                         b.swapSuccessors()
11850                         return true
11851                 }
11852                 // match: (GT (FlagLT_ULT) yes no)
11853                 // result: (First no yes)
11854                 for b.Controls[0].Op == Op386FlagLT_ULT {
11855                         b.Reset(BlockFirst)
11856                         b.swapSuccessors()
11857                         return true
11858                 }
11859                 // match: (GT (FlagLT_UGT) yes no)
11860                 // result: (First no yes)
11861                 for b.Controls[0].Op == Op386FlagLT_UGT {
11862                         b.Reset(BlockFirst)
11863                         b.swapSuccessors()
11864                         return true
11865                 }
11866                 // match: (GT (FlagGT_ULT) yes no)
11867                 // result: (First yes no)
11868                 for b.Controls[0].Op == Op386FlagGT_ULT {
11869                         b.Reset(BlockFirst)
11870                         return true
11871                 }
11872                 // match: (GT (FlagGT_UGT) yes no)
11873                 // result: (First yes no)
11874                 for b.Controls[0].Op == Op386FlagGT_UGT {
11875                         b.Reset(BlockFirst)
11876                         return true
11877                 }
11878         case BlockIf:
11879                 // match: (If (SETL cmp) yes no)
11880                 // result: (LT cmp yes no)
11881                 for b.Controls[0].Op == Op386SETL {
11882                         v_0 := b.Controls[0]
11883                         cmp := v_0.Args[0]
11884                         b.resetWithControl(Block386LT, cmp)
11885                         return true
11886                 }
11887                 // match: (If (SETLE cmp) yes no)
11888                 // result: (LE cmp yes no)
11889                 for b.Controls[0].Op == Op386SETLE {
11890                         v_0 := b.Controls[0]
11891                         cmp := v_0.Args[0]
11892                         b.resetWithControl(Block386LE, cmp)
11893                         return true
11894                 }
11895                 // match: (If (SETG cmp) yes no)
11896                 // result: (GT cmp yes no)
11897                 for b.Controls[0].Op == Op386SETG {
11898                         v_0 := b.Controls[0]
11899                         cmp := v_0.Args[0]
11900                         b.resetWithControl(Block386GT, cmp)
11901                         return true
11902                 }
11903                 // match: (If (SETGE cmp) yes no)
11904                 // result: (GE cmp yes no)
11905                 for b.Controls[0].Op == Op386SETGE {
11906                         v_0 := b.Controls[0]
11907                         cmp := v_0.Args[0]
11908                         b.resetWithControl(Block386GE, cmp)
11909                         return true
11910                 }
11911                 // match: (If (SETEQ cmp) yes no)
11912                 // result: (EQ cmp yes no)
11913                 for b.Controls[0].Op == Op386SETEQ {
11914                         v_0 := b.Controls[0]
11915                         cmp := v_0.Args[0]
11916                         b.resetWithControl(Block386EQ, cmp)
11917                         return true
11918                 }
11919                 // match: (If (SETNE cmp) yes no)
11920                 // result: (NE cmp yes no)
11921                 for b.Controls[0].Op == Op386SETNE {
11922                         v_0 := b.Controls[0]
11923                         cmp := v_0.Args[0]
11924                         b.resetWithControl(Block386NE, cmp)
11925                         return true
11926                 }
11927                 // match: (If (SETB cmp) yes no)
11928                 // result: (ULT cmp yes no)
11929                 for b.Controls[0].Op == Op386SETB {
11930                         v_0 := b.Controls[0]
11931                         cmp := v_0.Args[0]
11932                         b.resetWithControl(Block386ULT, cmp)
11933                         return true
11934                 }
11935                 // match: (If (SETBE cmp) yes no)
11936                 // result: (ULE cmp yes no)
11937                 for b.Controls[0].Op == Op386SETBE {
11938                         v_0 := b.Controls[0]
11939                         cmp := v_0.Args[0]
11940                         b.resetWithControl(Block386ULE, cmp)
11941                         return true
11942                 }
11943                 // match: (If (SETA cmp) yes no)
11944                 // result: (UGT cmp yes no)
11945                 for b.Controls[0].Op == Op386SETA {
11946                         v_0 := b.Controls[0]
11947                         cmp := v_0.Args[0]
11948                         b.resetWithControl(Block386UGT, cmp)
11949                         return true
11950                 }
11951                 // match: (If (SETAE cmp) yes no)
11952                 // result: (UGE cmp yes no)
11953                 for b.Controls[0].Op == Op386SETAE {
11954                         v_0 := b.Controls[0]
11955                         cmp := v_0.Args[0]
11956                         b.resetWithControl(Block386UGE, cmp)
11957                         return true
11958                 }
11959                 // match: (If (SETO cmp) yes no)
11960                 // result: (OS cmp yes no)
11961                 for b.Controls[0].Op == Op386SETO {
11962                         v_0 := b.Controls[0]
11963                         cmp := v_0.Args[0]
11964                         b.resetWithControl(Block386OS, cmp)
11965                         return true
11966                 }
11967                 // match: (If (SETGF cmp) yes no)
11968                 // result: (UGT cmp yes no)
11969                 for b.Controls[0].Op == Op386SETGF {
11970                         v_0 := b.Controls[0]
11971                         cmp := v_0.Args[0]
11972                         b.resetWithControl(Block386UGT, cmp)
11973                         return true
11974                 }
11975                 // match: (If (SETGEF cmp) yes no)
11976                 // result: (UGE cmp yes no)
11977                 for b.Controls[0].Op == Op386SETGEF {
11978                         v_0 := b.Controls[0]
11979                         cmp := v_0.Args[0]
11980                         b.resetWithControl(Block386UGE, cmp)
11981                         return true
11982                 }
11983                 // match: (If (SETEQF cmp) yes no)
11984                 // result: (EQF cmp yes no)
11985                 for b.Controls[0].Op == Op386SETEQF {
11986                         v_0 := b.Controls[0]
11987                         cmp := v_0.Args[0]
11988                         b.resetWithControl(Block386EQF, cmp)
11989                         return true
11990                 }
11991                 // match: (If (SETNEF cmp) yes no)
11992                 // result: (NEF cmp yes no)
11993                 for b.Controls[0].Op == Op386SETNEF {
11994                         v_0 := b.Controls[0]
11995                         cmp := v_0.Args[0]
11996                         b.resetWithControl(Block386NEF, cmp)
11997                         return true
11998                 }
11999                 // match: (If cond yes no)
12000                 // result: (NE (TESTB cond cond) yes no)
12001                 for {
12002                         cond := b.Controls[0]
12003                         v0 := b.NewValue0(cond.Pos, Op386TESTB, types.TypeFlags)
12004                         v0.AddArg2(cond, cond)
12005                         b.resetWithControl(Block386NE, v0)
12006                         return true
12007                 }
12008         case Block386LE:
12009                 // match: (LE (InvertFlags cmp) yes no)
12010                 // result: (GE cmp yes no)
12011                 for b.Controls[0].Op == Op386InvertFlags {
12012                         v_0 := b.Controls[0]
12013                         cmp := v_0.Args[0]
12014                         b.resetWithControl(Block386GE, cmp)
12015                         return true
12016                 }
12017                 // match: (LE (FlagEQ) yes no)
12018                 // result: (First yes no)
12019                 for b.Controls[0].Op == Op386FlagEQ {
12020                         b.Reset(BlockFirst)
12021                         return true
12022                 }
12023                 // match: (LE (FlagLT_ULT) yes no)
12024                 // result: (First yes no)
12025                 for b.Controls[0].Op == Op386FlagLT_ULT {
12026                         b.Reset(BlockFirst)
12027                         return true
12028                 }
12029                 // match: (LE (FlagLT_UGT) yes no)
12030                 // result: (First yes no)
12031                 for b.Controls[0].Op == Op386FlagLT_UGT {
12032                         b.Reset(BlockFirst)
12033                         return true
12034                 }
12035                 // match: (LE (FlagGT_ULT) yes no)
12036                 // result: (First no yes)
12037                 for b.Controls[0].Op == Op386FlagGT_ULT {
12038                         b.Reset(BlockFirst)
12039                         b.swapSuccessors()
12040                         return true
12041                 }
12042                 // match: (LE (FlagGT_UGT) yes no)
12043                 // result: (First no yes)
12044                 for b.Controls[0].Op == Op386FlagGT_UGT {
12045                         b.Reset(BlockFirst)
12046                         b.swapSuccessors()
12047                         return true
12048                 }
12049         case Block386LT:
12050                 // match: (LT (InvertFlags cmp) yes no)
12051                 // result: (GT cmp yes no)
12052                 for b.Controls[0].Op == Op386InvertFlags {
12053                         v_0 := b.Controls[0]
12054                         cmp := v_0.Args[0]
12055                         b.resetWithControl(Block386GT, cmp)
12056                         return true
12057                 }
12058                 // match: (LT (FlagEQ) yes no)
12059                 // result: (First no yes)
12060                 for b.Controls[0].Op == Op386FlagEQ {
12061                         b.Reset(BlockFirst)
12062                         b.swapSuccessors()
12063                         return true
12064                 }
12065                 // match: (LT (FlagLT_ULT) yes no)
12066                 // result: (First yes no)
12067                 for b.Controls[0].Op == Op386FlagLT_ULT {
12068                         b.Reset(BlockFirst)
12069                         return true
12070                 }
12071                 // match: (LT (FlagLT_UGT) yes no)
12072                 // result: (First yes no)
12073                 for b.Controls[0].Op == Op386FlagLT_UGT {
12074                         b.Reset(BlockFirst)
12075                         return true
12076                 }
12077                 // match: (LT (FlagGT_ULT) yes no)
12078                 // result: (First no yes)
12079                 for b.Controls[0].Op == Op386FlagGT_ULT {
12080                         b.Reset(BlockFirst)
12081                         b.swapSuccessors()
12082                         return true
12083                 }
12084                 // match: (LT (FlagGT_UGT) yes no)
12085                 // result: (First no yes)
12086                 for b.Controls[0].Op == Op386FlagGT_UGT {
12087                         b.Reset(BlockFirst)
12088                         b.swapSuccessors()
12089                         return true
12090                 }
12091         case Block386NE:
12092                 // match: (NE (TESTB (SETL cmp) (SETL cmp)) yes no)
12093                 // result: (LT cmp yes no)
12094                 for b.Controls[0].Op == Op386TESTB {
12095                         v_0 := b.Controls[0]
12096                         _ = v_0.Args[1]
12097                         v_0_0 := v_0.Args[0]
12098                         if v_0_0.Op != Op386SETL {
12099                                 break
12100                         }
12101                         cmp := v_0_0.Args[0]
12102                         v_0_1 := v_0.Args[1]
12103                         if v_0_1.Op != Op386SETL || cmp != v_0_1.Args[0] {
12104                                 break
12105                         }
12106                         b.resetWithControl(Block386LT, cmp)
12107                         return true
12108                 }
12109                 // match: (NE (TESTB (SETLE cmp) (SETLE cmp)) yes no)
12110                 // result: (LE cmp yes no)
12111                 for b.Controls[0].Op == Op386TESTB {
12112                         v_0 := b.Controls[0]
12113                         _ = v_0.Args[1]
12114                         v_0_0 := v_0.Args[0]
12115                         if v_0_0.Op != Op386SETLE {
12116                                 break
12117                         }
12118                         cmp := v_0_0.Args[0]
12119                         v_0_1 := v_0.Args[1]
12120                         if v_0_1.Op != Op386SETLE || cmp != v_0_1.Args[0] {
12121                                 break
12122                         }
12123                         b.resetWithControl(Block386LE, cmp)
12124                         return true
12125                 }
12126                 // match: (NE (TESTB (SETG cmp) (SETG cmp)) yes no)
12127                 // result: (GT cmp yes no)
12128                 for b.Controls[0].Op == Op386TESTB {
12129                         v_0 := b.Controls[0]
12130                         _ = v_0.Args[1]
12131                         v_0_0 := v_0.Args[0]
12132                         if v_0_0.Op != Op386SETG {
12133                                 break
12134                         }
12135                         cmp := v_0_0.Args[0]
12136                         v_0_1 := v_0.Args[1]
12137                         if v_0_1.Op != Op386SETG || cmp != v_0_1.Args[0] {
12138                                 break
12139                         }
12140                         b.resetWithControl(Block386GT, cmp)
12141                         return true
12142                 }
12143                 // match: (NE (TESTB (SETGE cmp) (SETGE cmp)) yes no)
12144                 // result: (GE cmp yes no)
12145                 for b.Controls[0].Op == Op386TESTB {
12146                         v_0 := b.Controls[0]
12147                         _ = v_0.Args[1]
12148                         v_0_0 := v_0.Args[0]
12149                         if v_0_0.Op != Op386SETGE {
12150                                 break
12151                         }
12152                         cmp := v_0_0.Args[0]
12153                         v_0_1 := v_0.Args[1]
12154                         if v_0_1.Op != Op386SETGE || cmp != v_0_1.Args[0] {
12155                                 break
12156                         }
12157                         b.resetWithControl(Block386GE, cmp)
12158                         return true
12159                 }
12160                 // match: (NE (TESTB (SETEQ cmp) (SETEQ cmp)) yes no)
12161                 // result: (EQ cmp yes no)
12162                 for b.Controls[0].Op == Op386TESTB {
12163                         v_0 := b.Controls[0]
12164                         _ = v_0.Args[1]
12165                         v_0_0 := v_0.Args[0]
12166                         if v_0_0.Op != Op386SETEQ {
12167                                 break
12168                         }
12169                         cmp := v_0_0.Args[0]
12170                         v_0_1 := v_0.Args[1]
12171                         if v_0_1.Op != Op386SETEQ || cmp != v_0_1.Args[0] {
12172                                 break
12173                         }
12174                         b.resetWithControl(Block386EQ, cmp)
12175                         return true
12176                 }
12177                 // match: (NE (TESTB (SETNE cmp) (SETNE cmp)) yes no)
12178                 // result: (NE cmp yes no)
12179                 for b.Controls[0].Op == Op386TESTB {
12180                         v_0 := b.Controls[0]
12181                         _ = v_0.Args[1]
12182                         v_0_0 := v_0.Args[0]
12183                         if v_0_0.Op != Op386SETNE {
12184                                 break
12185                         }
12186                         cmp := v_0_0.Args[0]
12187                         v_0_1 := v_0.Args[1]
12188                         if v_0_1.Op != Op386SETNE || cmp != v_0_1.Args[0] {
12189                                 break
12190                         }
12191                         b.resetWithControl(Block386NE, cmp)
12192                         return true
12193                 }
12194                 // match: (NE (TESTB (SETB cmp) (SETB cmp)) yes no)
12195                 // result: (ULT cmp yes no)
12196                 for b.Controls[0].Op == Op386TESTB {
12197                         v_0 := b.Controls[0]
12198                         _ = v_0.Args[1]
12199                         v_0_0 := v_0.Args[0]
12200                         if v_0_0.Op != Op386SETB {
12201                                 break
12202                         }
12203                         cmp := v_0_0.Args[0]
12204                         v_0_1 := v_0.Args[1]
12205                         if v_0_1.Op != Op386SETB || cmp != v_0_1.Args[0] {
12206                                 break
12207                         }
12208                         b.resetWithControl(Block386ULT, cmp)
12209                         return true
12210                 }
12211                 // match: (NE (TESTB (SETBE cmp) (SETBE cmp)) yes no)
12212                 // result: (ULE cmp yes no)
12213                 for b.Controls[0].Op == Op386TESTB {
12214                         v_0 := b.Controls[0]
12215                         _ = v_0.Args[1]
12216                         v_0_0 := v_0.Args[0]
12217                         if v_0_0.Op != Op386SETBE {
12218                                 break
12219                         }
12220                         cmp := v_0_0.Args[0]
12221                         v_0_1 := v_0.Args[1]
12222                         if v_0_1.Op != Op386SETBE || cmp != v_0_1.Args[0] {
12223                                 break
12224                         }
12225                         b.resetWithControl(Block386ULE, cmp)
12226                         return true
12227                 }
12228                 // match: (NE (TESTB (SETA cmp) (SETA cmp)) yes no)
12229                 // result: (UGT cmp yes no)
12230                 for b.Controls[0].Op == Op386TESTB {
12231                         v_0 := b.Controls[0]
12232                         _ = v_0.Args[1]
12233                         v_0_0 := v_0.Args[0]
12234                         if v_0_0.Op != Op386SETA {
12235                                 break
12236                         }
12237                         cmp := v_0_0.Args[0]
12238                         v_0_1 := v_0.Args[1]
12239                         if v_0_1.Op != Op386SETA || cmp != v_0_1.Args[0] {
12240                                 break
12241                         }
12242                         b.resetWithControl(Block386UGT, cmp)
12243                         return true
12244                 }
12245                 // match: (NE (TESTB (SETAE cmp) (SETAE cmp)) yes no)
12246                 // result: (UGE cmp yes no)
12247                 for b.Controls[0].Op == Op386TESTB {
12248                         v_0 := b.Controls[0]
12249                         _ = v_0.Args[1]
12250                         v_0_0 := v_0.Args[0]
12251                         if v_0_0.Op != Op386SETAE {
12252                                 break
12253                         }
12254                         cmp := v_0_0.Args[0]
12255                         v_0_1 := v_0.Args[1]
12256                         if v_0_1.Op != Op386SETAE || cmp != v_0_1.Args[0] {
12257                                 break
12258                         }
12259                         b.resetWithControl(Block386UGE, cmp)
12260                         return true
12261                 }
12262                 // match: (NE (TESTB (SETO cmp) (SETO cmp)) yes no)
12263                 // result: (OS cmp yes no)
12264                 for b.Controls[0].Op == Op386TESTB {
12265                         v_0 := b.Controls[0]
12266                         _ = v_0.Args[1]
12267                         v_0_0 := v_0.Args[0]
12268                         if v_0_0.Op != Op386SETO {
12269                                 break
12270                         }
12271                         cmp := v_0_0.Args[0]
12272                         v_0_1 := v_0.Args[1]
12273                         if v_0_1.Op != Op386SETO || cmp != v_0_1.Args[0] {
12274                                 break
12275                         }
12276                         b.resetWithControl(Block386OS, cmp)
12277                         return true
12278                 }
12279                 // match: (NE (TESTB (SETGF cmp) (SETGF cmp)) yes no)
12280                 // result: (UGT cmp yes no)
12281                 for b.Controls[0].Op == Op386TESTB {
12282                         v_0 := b.Controls[0]
12283                         _ = v_0.Args[1]
12284                         v_0_0 := v_0.Args[0]
12285                         if v_0_0.Op != Op386SETGF {
12286                                 break
12287                         }
12288                         cmp := v_0_0.Args[0]
12289                         v_0_1 := v_0.Args[1]
12290                         if v_0_1.Op != Op386SETGF || cmp != v_0_1.Args[0] {
12291                                 break
12292                         }
12293                         b.resetWithControl(Block386UGT, cmp)
12294                         return true
12295                 }
12296                 // match: (NE (TESTB (SETGEF cmp) (SETGEF cmp)) yes no)
12297                 // result: (UGE cmp yes no)
12298                 for b.Controls[0].Op == Op386TESTB {
12299                         v_0 := b.Controls[0]
12300                         _ = v_0.Args[1]
12301                         v_0_0 := v_0.Args[0]
12302                         if v_0_0.Op != Op386SETGEF {
12303                                 break
12304                         }
12305                         cmp := v_0_0.Args[0]
12306                         v_0_1 := v_0.Args[1]
12307                         if v_0_1.Op != Op386SETGEF || cmp != v_0_1.Args[0] {
12308                                 break
12309                         }
12310                         b.resetWithControl(Block386UGE, cmp)
12311                         return true
12312                 }
12313                 // match: (NE (TESTB (SETEQF cmp) (SETEQF cmp)) yes no)
12314                 // result: (EQF cmp yes no)
12315                 for b.Controls[0].Op == Op386TESTB {
12316                         v_0 := b.Controls[0]
12317                         _ = v_0.Args[1]
12318                         v_0_0 := v_0.Args[0]
12319                         if v_0_0.Op != Op386SETEQF {
12320                                 break
12321                         }
12322                         cmp := v_0_0.Args[0]
12323                         v_0_1 := v_0.Args[1]
12324                         if v_0_1.Op != Op386SETEQF || cmp != v_0_1.Args[0] {
12325                                 break
12326                         }
12327                         b.resetWithControl(Block386EQF, cmp)
12328                         return true
12329                 }
12330                 // match: (NE (TESTB (SETNEF cmp) (SETNEF cmp)) yes no)
12331                 // result: (NEF cmp yes no)
12332                 for b.Controls[0].Op == Op386TESTB {
12333                         v_0 := b.Controls[0]
12334                         _ = v_0.Args[1]
12335                         v_0_0 := v_0.Args[0]
12336                         if v_0_0.Op != Op386SETNEF {
12337                                 break
12338                         }
12339                         cmp := v_0_0.Args[0]
12340                         v_0_1 := v_0.Args[1]
12341                         if v_0_1.Op != Op386SETNEF || cmp != v_0_1.Args[0] {
12342                                 break
12343                         }
12344                         b.resetWithControl(Block386NEF, cmp)
12345                         return true
12346                 }
12347                 // match: (NE (InvertFlags cmp) yes no)
12348                 // result: (NE cmp yes no)
12349                 for b.Controls[0].Op == Op386InvertFlags {
12350                         v_0 := b.Controls[0]
12351                         cmp := v_0.Args[0]
12352                         b.resetWithControl(Block386NE, cmp)
12353                         return true
12354                 }
12355                 // match: (NE (FlagEQ) yes no)
12356                 // result: (First no yes)
12357                 for b.Controls[0].Op == Op386FlagEQ {
12358                         b.Reset(BlockFirst)
12359                         b.swapSuccessors()
12360                         return true
12361                 }
12362                 // match: (NE (FlagLT_ULT) yes no)
12363                 // result: (First yes no)
12364                 for b.Controls[0].Op == Op386FlagLT_ULT {
12365                         b.Reset(BlockFirst)
12366                         return true
12367                 }
12368                 // match: (NE (FlagLT_UGT) yes no)
12369                 // result: (First yes no)
12370                 for b.Controls[0].Op == Op386FlagLT_UGT {
12371                         b.Reset(BlockFirst)
12372                         return true
12373                 }
12374                 // match: (NE (FlagGT_ULT) yes no)
12375                 // result: (First yes no)
12376                 for b.Controls[0].Op == Op386FlagGT_ULT {
12377                         b.Reset(BlockFirst)
12378                         return true
12379                 }
12380                 // match: (NE (FlagGT_UGT) yes no)
12381                 // result: (First yes no)
12382                 for b.Controls[0].Op == Op386FlagGT_UGT {
12383                         b.Reset(BlockFirst)
12384                         return true
12385                 }
12386         case Block386UGE:
12387                 // match: (UGE (InvertFlags cmp) yes no)
12388                 // result: (ULE cmp yes no)
12389                 for b.Controls[0].Op == Op386InvertFlags {
12390                         v_0 := b.Controls[0]
12391                         cmp := v_0.Args[0]
12392                         b.resetWithControl(Block386ULE, cmp)
12393                         return true
12394                 }
12395                 // match: (UGE (FlagEQ) yes no)
12396                 // result: (First yes no)
12397                 for b.Controls[0].Op == Op386FlagEQ {
12398                         b.Reset(BlockFirst)
12399                         return true
12400                 }
12401                 // match: (UGE (FlagLT_ULT) yes no)
12402                 // result: (First no yes)
12403                 for b.Controls[0].Op == Op386FlagLT_ULT {
12404                         b.Reset(BlockFirst)
12405                         b.swapSuccessors()
12406                         return true
12407                 }
12408                 // match: (UGE (FlagLT_UGT) yes no)
12409                 // result: (First yes no)
12410                 for b.Controls[0].Op == Op386FlagLT_UGT {
12411                         b.Reset(BlockFirst)
12412                         return true
12413                 }
12414                 // match: (UGE (FlagGT_ULT) yes no)
12415                 // result: (First no yes)
12416                 for b.Controls[0].Op == Op386FlagGT_ULT {
12417                         b.Reset(BlockFirst)
12418                         b.swapSuccessors()
12419                         return true
12420                 }
12421                 // match: (UGE (FlagGT_UGT) yes no)
12422                 // result: (First yes no)
12423                 for b.Controls[0].Op == Op386FlagGT_UGT {
12424                         b.Reset(BlockFirst)
12425                         return true
12426                 }
12427         case Block386UGT:
12428                 // match: (UGT (InvertFlags cmp) yes no)
12429                 // result: (ULT cmp yes no)
12430                 for b.Controls[0].Op == Op386InvertFlags {
12431                         v_0 := b.Controls[0]
12432                         cmp := v_0.Args[0]
12433                         b.resetWithControl(Block386ULT, cmp)
12434                         return true
12435                 }
12436                 // match: (UGT (FlagEQ) yes no)
12437                 // result: (First no yes)
12438                 for b.Controls[0].Op == Op386FlagEQ {
12439                         b.Reset(BlockFirst)
12440                         b.swapSuccessors()
12441                         return true
12442                 }
12443                 // match: (UGT (FlagLT_ULT) yes no)
12444                 // result: (First no yes)
12445                 for b.Controls[0].Op == Op386FlagLT_ULT {
12446                         b.Reset(BlockFirst)
12447                         b.swapSuccessors()
12448                         return true
12449                 }
12450                 // match: (UGT (FlagLT_UGT) yes no)
12451                 // result: (First yes no)
12452                 for b.Controls[0].Op == Op386FlagLT_UGT {
12453                         b.Reset(BlockFirst)
12454                         return true
12455                 }
12456                 // match: (UGT (FlagGT_ULT) yes no)
12457                 // result: (First no yes)
12458                 for b.Controls[0].Op == Op386FlagGT_ULT {
12459                         b.Reset(BlockFirst)
12460                         b.swapSuccessors()
12461                         return true
12462                 }
12463                 // match: (UGT (FlagGT_UGT) yes no)
12464                 // result: (First yes no)
12465                 for b.Controls[0].Op == Op386FlagGT_UGT {
12466                         b.Reset(BlockFirst)
12467                         return true
12468                 }
12469         case Block386ULE:
12470                 // match: (ULE (InvertFlags cmp) yes no)
12471                 // result: (UGE cmp yes no)
12472                 for b.Controls[0].Op == Op386InvertFlags {
12473                         v_0 := b.Controls[0]
12474                         cmp := v_0.Args[0]
12475                         b.resetWithControl(Block386UGE, cmp)
12476                         return true
12477                 }
12478                 // match: (ULE (FlagEQ) yes no)
12479                 // result: (First yes no)
12480                 for b.Controls[0].Op == Op386FlagEQ {
12481                         b.Reset(BlockFirst)
12482                         return true
12483                 }
12484                 // match: (ULE (FlagLT_ULT) yes no)
12485                 // result: (First yes no)
12486                 for b.Controls[0].Op == Op386FlagLT_ULT {
12487                         b.Reset(BlockFirst)
12488                         return true
12489                 }
12490                 // match: (ULE (FlagLT_UGT) yes no)
12491                 // result: (First no yes)
12492                 for b.Controls[0].Op == Op386FlagLT_UGT {
12493                         b.Reset(BlockFirst)
12494                         b.swapSuccessors()
12495                         return true
12496                 }
12497                 // match: (ULE (FlagGT_ULT) yes no)
12498                 // result: (First yes no)
12499                 for b.Controls[0].Op == Op386FlagGT_ULT {
12500                         b.Reset(BlockFirst)
12501                         return true
12502                 }
12503                 // match: (ULE (FlagGT_UGT) yes no)
12504                 // result: (First no yes)
12505                 for b.Controls[0].Op == Op386FlagGT_UGT {
12506                         b.Reset(BlockFirst)
12507                         b.swapSuccessors()
12508                         return true
12509                 }
12510         case Block386ULT:
12511                 // match: (ULT (InvertFlags cmp) yes no)
12512                 // result: (UGT cmp yes no)
12513                 for b.Controls[0].Op == Op386InvertFlags {
12514                         v_0 := b.Controls[0]
12515                         cmp := v_0.Args[0]
12516                         b.resetWithControl(Block386UGT, cmp)
12517                         return true
12518                 }
12519                 // match: (ULT (FlagEQ) yes no)
12520                 // result: (First no yes)
12521                 for b.Controls[0].Op == Op386FlagEQ {
12522                         b.Reset(BlockFirst)
12523                         b.swapSuccessors()
12524                         return true
12525                 }
12526                 // match: (ULT (FlagLT_ULT) yes no)
12527                 // result: (First yes no)
12528                 for b.Controls[0].Op == Op386FlagLT_ULT {
12529                         b.Reset(BlockFirst)
12530                         return true
12531                 }
12532                 // match: (ULT (FlagLT_UGT) yes no)
12533                 // result: (First no yes)
12534                 for b.Controls[0].Op == Op386FlagLT_UGT {
12535                         b.Reset(BlockFirst)
12536                         b.swapSuccessors()
12537                         return true
12538                 }
12539                 // match: (ULT (FlagGT_ULT) yes no)
12540                 // result: (First yes no)
12541                 for b.Controls[0].Op == Op386FlagGT_ULT {
12542                         b.Reset(BlockFirst)
12543                         return true
12544                 }
12545                 // match: (ULT (FlagGT_UGT) yes no)
12546                 // result: (First no yes)
12547                 for b.Controls[0].Op == Op386FlagGT_UGT {
12548                         b.Reset(BlockFirst)
12549                         b.swapSuccessors()
12550                         return true
12551                 }
12552         }
12553         return false
12554 }