]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/compile/internal/ssa/rewrite386.go
internal/buildcfg: move build configuration out of cmd/internal/objabi
[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 (
7         "cmd/compile/internal/types"
8         "math"
9 )
10
11 func rewriteValue386(v *Value) bool {
12         switch v.Op {
13         case Op386ADCL:
14                 return rewriteValue386_Op386ADCL(v)
15         case Op386ADDL:
16                 return rewriteValue386_Op386ADDL(v)
17         case Op386ADDLcarry:
18                 return rewriteValue386_Op386ADDLcarry(v)
19         case Op386ADDLconst:
20                 return rewriteValue386_Op386ADDLconst(v)
21         case Op386ADDLconstmodify:
22                 return rewriteValue386_Op386ADDLconstmodify(v)
23         case Op386ADDLload:
24                 return rewriteValue386_Op386ADDLload(v)
25         case Op386ADDLmodify:
26                 return rewriteValue386_Op386ADDLmodify(v)
27         case Op386ADDSD:
28                 return rewriteValue386_Op386ADDSD(v)
29         case Op386ADDSDload:
30                 return rewriteValue386_Op386ADDSDload(v)
31         case Op386ADDSS:
32                 return rewriteValue386_Op386ADDSS(v)
33         case Op386ADDSSload:
34                 return rewriteValue386_Op386ADDSSload(v)
35         case Op386ANDL:
36                 return rewriteValue386_Op386ANDL(v)
37         case Op386ANDLconst:
38                 return rewriteValue386_Op386ANDLconst(v)
39         case Op386ANDLconstmodify:
40                 return rewriteValue386_Op386ANDLconstmodify(v)
41         case Op386ANDLload:
42                 return rewriteValue386_Op386ANDLload(v)
43         case Op386ANDLmodify:
44                 return rewriteValue386_Op386ANDLmodify(v)
45         case Op386CMPB:
46                 return rewriteValue386_Op386CMPB(v)
47         case Op386CMPBconst:
48                 return rewriteValue386_Op386CMPBconst(v)
49         case Op386CMPBload:
50                 return rewriteValue386_Op386CMPBload(v)
51         case Op386CMPL:
52                 return rewriteValue386_Op386CMPL(v)
53         case Op386CMPLconst:
54                 return rewriteValue386_Op386CMPLconst(v)
55         case Op386CMPLload:
56                 return rewriteValue386_Op386CMPLload(v)
57         case Op386CMPW:
58                 return rewriteValue386_Op386CMPW(v)
59         case Op386CMPWconst:
60                 return rewriteValue386_Op386CMPWconst(v)
61         case Op386CMPWload:
62                 return rewriteValue386_Op386CMPWload(v)
63         case Op386DIVSD:
64                 return rewriteValue386_Op386DIVSD(v)
65         case Op386DIVSDload:
66                 return rewriteValue386_Op386DIVSDload(v)
67         case Op386DIVSS:
68                 return rewriteValue386_Op386DIVSS(v)
69         case Op386DIVSSload:
70                 return rewriteValue386_Op386DIVSSload(v)
71         case Op386LEAL:
72                 return rewriteValue386_Op386LEAL(v)
73         case Op386LEAL1:
74                 return rewriteValue386_Op386LEAL1(v)
75         case Op386LEAL2:
76                 return rewriteValue386_Op386LEAL2(v)
77         case Op386LEAL4:
78                 return rewriteValue386_Op386LEAL4(v)
79         case Op386LEAL8:
80                 return rewriteValue386_Op386LEAL8(v)
81         case Op386MOVBLSX:
82                 return rewriteValue386_Op386MOVBLSX(v)
83         case Op386MOVBLSXload:
84                 return rewriteValue386_Op386MOVBLSXload(v)
85         case Op386MOVBLZX:
86                 return rewriteValue386_Op386MOVBLZX(v)
87         case Op386MOVBload:
88                 return rewriteValue386_Op386MOVBload(v)
89         case Op386MOVBstore:
90                 return rewriteValue386_Op386MOVBstore(v)
91         case Op386MOVBstoreconst:
92                 return rewriteValue386_Op386MOVBstoreconst(v)
93         case Op386MOVLload:
94                 return rewriteValue386_Op386MOVLload(v)
95         case Op386MOVLstore:
96                 return rewriteValue386_Op386MOVLstore(v)
97         case Op386MOVLstoreconst:
98                 return rewriteValue386_Op386MOVLstoreconst(v)
99         case Op386MOVSDconst:
100                 return rewriteValue386_Op386MOVSDconst(v)
101         case Op386MOVSDload:
102                 return rewriteValue386_Op386MOVSDload(v)
103         case Op386MOVSDstore:
104                 return rewriteValue386_Op386MOVSDstore(v)
105         case Op386MOVSSconst:
106                 return rewriteValue386_Op386MOVSSconst(v)
107         case Op386MOVSSload:
108                 return rewriteValue386_Op386MOVSSload(v)
109         case Op386MOVSSstore:
110                 return rewriteValue386_Op386MOVSSstore(v)
111         case Op386MOVWLSX:
112                 return rewriteValue386_Op386MOVWLSX(v)
113         case Op386MOVWLSXload:
114                 return rewriteValue386_Op386MOVWLSXload(v)
115         case Op386MOVWLZX:
116                 return rewriteValue386_Op386MOVWLZX(v)
117         case Op386MOVWload:
118                 return rewriteValue386_Op386MOVWload(v)
119         case Op386MOVWstore:
120                 return rewriteValue386_Op386MOVWstore(v)
121         case Op386MOVWstoreconst:
122                 return rewriteValue386_Op386MOVWstoreconst(v)
123         case Op386MULL:
124                 return rewriteValue386_Op386MULL(v)
125         case Op386MULLconst:
126                 return rewriteValue386_Op386MULLconst(v)
127         case Op386MULLload:
128                 return rewriteValue386_Op386MULLload(v)
129         case Op386MULSD:
130                 return rewriteValue386_Op386MULSD(v)
131         case Op386MULSDload:
132                 return rewriteValue386_Op386MULSDload(v)
133         case Op386MULSS:
134                 return rewriteValue386_Op386MULSS(v)
135         case Op386MULSSload:
136                 return rewriteValue386_Op386MULSSload(v)
137         case Op386NEGL:
138                 return rewriteValue386_Op386NEGL(v)
139         case Op386NOTL:
140                 return rewriteValue386_Op386NOTL(v)
141         case Op386ORL:
142                 return rewriteValue386_Op386ORL(v)
143         case Op386ORLconst:
144                 return rewriteValue386_Op386ORLconst(v)
145         case Op386ORLconstmodify:
146                 return rewriteValue386_Op386ORLconstmodify(v)
147         case Op386ORLload:
148                 return rewriteValue386_Op386ORLload(v)
149         case Op386ORLmodify:
150                 return rewriteValue386_Op386ORLmodify(v)
151         case Op386ROLBconst:
152                 return rewriteValue386_Op386ROLBconst(v)
153         case Op386ROLLconst:
154                 return rewriteValue386_Op386ROLLconst(v)
155         case Op386ROLWconst:
156                 return rewriteValue386_Op386ROLWconst(v)
157         case Op386SARB:
158                 return rewriteValue386_Op386SARB(v)
159         case Op386SARBconst:
160                 return rewriteValue386_Op386SARBconst(v)
161         case Op386SARL:
162                 return rewriteValue386_Op386SARL(v)
163         case Op386SARLconst:
164                 return rewriteValue386_Op386SARLconst(v)
165         case Op386SARW:
166                 return rewriteValue386_Op386SARW(v)
167         case Op386SARWconst:
168                 return rewriteValue386_Op386SARWconst(v)
169         case Op386SBBL:
170                 return rewriteValue386_Op386SBBL(v)
171         case Op386SBBLcarrymask:
172                 return rewriteValue386_Op386SBBLcarrymask(v)
173         case Op386SETA:
174                 return rewriteValue386_Op386SETA(v)
175         case Op386SETAE:
176                 return rewriteValue386_Op386SETAE(v)
177         case Op386SETB:
178                 return rewriteValue386_Op386SETB(v)
179         case Op386SETBE:
180                 return rewriteValue386_Op386SETBE(v)
181         case Op386SETEQ:
182                 return rewriteValue386_Op386SETEQ(v)
183         case Op386SETG:
184                 return rewriteValue386_Op386SETG(v)
185         case Op386SETGE:
186                 return rewriteValue386_Op386SETGE(v)
187         case Op386SETL:
188                 return rewriteValue386_Op386SETL(v)
189         case Op386SETLE:
190                 return rewriteValue386_Op386SETLE(v)
191         case Op386SETNE:
192                 return rewriteValue386_Op386SETNE(v)
193         case Op386SHLL:
194                 return rewriteValue386_Op386SHLL(v)
195         case Op386SHLLconst:
196                 return rewriteValue386_Op386SHLLconst(v)
197         case Op386SHRB:
198                 return rewriteValue386_Op386SHRB(v)
199         case Op386SHRBconst:
200                 return rewriteValue386_Op386SHRBconst(v)
201         case Op386SHRL:
202                 return rewriteValue386_Op386SHRL(v)
203         case Op386SHRLconst:
204                 return rewriteValue386_Op386SHRLconst(v)
205         case Op386SHRW:
206                 return rewriteValue386_Op386SHRW(v)
207         case Op386SHRWconst:
208                 return rewriteValue386_Op386SHRWconst(v)
209         case Op386SUBL:
210                 return rewriteValue386_Op386SUBL(v)
211         case Op386SUBLcarry:
212                 return rewriteValue386_Op386SUBLcarry(v)
213         case Op386SUBLconst:
214                 return rewriteValue386_Op386SUBLconst(v)
215         case Op386SUBLload:
216                 return rewriteValue386_Op386SUBLload(v)
217         case Op386SUBLmodify:
218                 return rewriteValue386_Op386SUBLmodify(v)
219         case Op386SUBSD:
220                 return rewriteValue386_Op386SUBSD(v)
221         case Op386SUBSDload:
222                 return rewriteValue386_Op386SUBSDload(v)
223         case Op386SUBSS:
224                 return rewriteValue386_Op386SUBSS(v)
225         case Op386SUBSSload:
226                 return rewriteValue386_Op386SUBSSload(v)
227         case Op386XORL:
228                 return rewriteValue386_Op386XORL(v)
229         case Op386XORLconst:
230                 return rewriteValue386_Op386XORLconst(v)
231         case Op386XORLconstmodify:
232                 return rewriteValue386_Op386XORLconstmodify(v)
233         case Op386XORLload:
234                 return rewriteValue386_Op386XORLload(v)
235         case Op386XORLmodify:
236                 return rewriteValue386_Op386XORLmodify(v)
237         case OpAdd16:
238                 v.Op = Op386ADDL
239                 return true
240         case OpAdd32:
241                 v.Op = Op386ADDL
242                 return true
243         case OpAdd32F:
244                 v.Op = Op386ADDSS
245                 return true
246         case OpAdd32carry:
247                 v.Op = Op386ADDLcarry
248                 return true
249         case OpAdd32withcarry:
250                 v.Op = Op386ADCL
251                 return true
252         case OpAdd64F:
253                 v.Op = Op386ADDSD
254                 return true
255         case OpAdd8:
256                 v.Op = Op386ADDL
257                 return true
258         case OpAddPtr:
259                 v.Op = Op386ADDL
260                 return true
261         case OpAddr:
262                 return rewriteValue386_OpAddr(v)
263         case OpAnd16:
264                 v.Op = Op386ANDL
265                 return true
266         case OpAnd32:
267                 v.Op = Op386ANDL
268                 return true
269         case OpAnd8:
270                 v.Op = Op386ANDL
271                 return true
272         case OpAndB:
273                 v.Op = Op386ANDL
274                 return true
275         case OpAvg32u:
276                 v.Op = Op386AVGLU
277                 return true
278         case OpBswap32:
279                 v.Op = Op386BSWAPL
280                 return true
281         case OpClosureCall:
282                 v.Op = Op386CALLclosure
283                 return true
284         case OpCom16:
285                 v.Op = Op386NOTL
286                 return true
287         case OpCom32:
288                 v.Op = Op386NOTL
289                 return true
290         case OpCom8:
291                 v.Op = Op386NOTL
292                 return true
293         case OpConst16:
294                 return rewriteValue386_OpConst16(v)
295         case OpConst32:
296                 v.Op = Op386MOVLconst
297                 return true
298         case OpConst32F:
299                 v.Op = Op386MOVSSconst
300                 return true
301         case OpConst64F:
302                 v.Op = Op386MOVSDconst
303                 return true
304         case OpConst8:
305                 return rewriteValue386_OpConst8(v)
306         case OpConstBool:
307                 return rewriteValue386_OpConstBool(v)
308         case OpConstNil:
309                 return rewriteValue386_OpConstNil(v)
310         case OpCtz16:
311                 return rewriteValue386_OpCtz16(v)
312         case OpCtz16NonZero:
313                 v.Op = Op386BSFL
314                 return true
315         case OpCvt32Fto32:
316                 v.Op = Op386CVTTSS2SL
317                 return true
318         case OpCvt32Fto64F:
319                 v.Op = Op386CVTSS2SD
320                 return true
321         case OpCvt32to32F:
322                 v.Op = Op386CVTSL2SS
323                 return true
324         case OpCvt32to64F:
325                 v.Op = Op386CVTSL2SD
326                 return true
327         case OpCvt64Fto32:
328                 v.Op = Op386CVTTSD2SL
329                 return true
330         case OpCvt64Fto32F:
331                 v.Op = Op386CVTSD2SS
332                 return true
333         case OpCvtBoolToUint8:
334                 v.Op = OpCopy
335                 return true
336         case OpDiv16:
337                 v.Op = Op386DIVW
338                 return true
339         case OpDiv16u:
340                 v.Op = Op386DIVWU
341                 return true
342         case OpDiv32:
343                 v.Op = Op386DIVL
344                 return true
345         case OpDiv32F:
346                 v.Op = Op386DIVSS
347                 return true
348         case OpDiv32u:
349                 v.Op = Op386DIVLU
350                 return true
351         case OpDiv64F:
352                 v.Op = Op386DIVSD
353                 return true
354         case OpDiv8:
355                 return rewriteValue386_OpDiv8(v)
356         case OpDiv8u:
357                 return rewriteValue386_OpDiv8u(v)
358         case OpEq16:
359                 return rewriteValue386_OpEq16(v)
360         case OpEq32:
361                 return rewriteValue386_OpEq32(v)
362         case OpEq32F:
363                 return rewriteValue386_OpEq32F(v)
364         case OpEq64F:
365                 return rewriteValue386_OpEq64F(v)
366         case OpEq8:
367                 return rewriteValue386_OpEq8(v)
368         case OpEqB:
369                 return rewriteValue386_OpEqB(v)
370         case OpEqPtr:
371                 return rewriteValue386_OpEqPtr(v)
372         case OpGetCallerPC:
373                 v.Op = Op386LoweredGetCallerPC
374                 return true
375         case OpGetCallerSP:
376                 v.Op = Op386LoweredGetCallerSP
377                 return true
378         case OpGetClosurePtr:
379                 v.Op = Op386LoweredGetClosurePtr
380                 return true
381         case OpGetG:
382                 v.Op = Op386LoweredGetG
383                 return true
384         case OpHmul32:
385                 v.Op = Op386HMULL
386                 return true
387         case OpHmul32u:
388                 v.Op = Op386HMULLU
389                 return true
390         case OpInterCall:
391                 v.Op = Op386CALLinter
392                 return true
393         case OpIsInBounds:
394                 return rewriteValue386_OpIsInBounds(v)
395         case OpIsNonNil:
396                 return rewriteValue386_OpIsNonNil(v)
397         case OpIsSliceInBounds:
398                 return rewriteValue386_OpIsSliceInBounds(v)
399         case OpLeq16:
400                 return rewriteValue386_OpLeq16(v)
401         case OpLeq16U:
402                 return rewriteValue386_OpLeq16U(v)
403         case OpLeq32:
404                 return rewriteValue386_OpLeq32(v)
405         case OpLeq32F:
406                 return rewriteValue386_OpLeq32F(v)
407         case OpLeq32U:
408                 return rewriteValue386_OpLeq32U(v)
409         case OpLeq64F:
410                 return rewriteValue386_OpLeq64F(v)
411         case OpLeq8:
412                 return rewriteValue386_OpLeq8(v)
413         case OpLeq8U:
414                 return rewriteValue386_OpLeq8U(v)
415         case OpLess16:
416                 return rewriteValue386_OpLess16(v)
417         case OpLess16U:
418                 return rewriteValue386_OpLess16U(v)
419         case OpLess32:
420                 return rewriteValue386_OpLess32(v)
421         case OpLess32F:
422                 return rewriteValue386_OpLess32F(v)
423         case OpLess32U:
424                 return rewriteValue386_OpLess32U(v)
425         case OpLess64F:
426                 return rewriteValue386_OpLess64F(v)
427         case OpLess8:
428                 return rewriteValue386_OpLess8(v)
429         case OpLess8U:
430                 return rewriteValue386_OpLess8U(v)
431         case OpLoad:
432                 return rewriteValue386_OpLoad(v)
433         case OpLocalAddr:
434                 return rewriteValue386_OpLocalAddr(v)
435         case OpLsh16x16:
436                 return rewriteValue386_OpLsh16x16(v)
437         case OpLsh16x32:
438                 return rewriteValue386_OpLsh16x32(v)
439         case OpLsh16x64:
440                 return rewriteValue386_OpLsh16x64(v)
441         case OpLsh16x8:
442                 return rewriteValue386_OpLsh16x8(v)
443         case OpLsh32x16:
444                 return rewriteValue386_OpLsh32x16(v)
445         case OpLsh32x32:
446                 return rewriteValue386_OpLsh32x32(v)
447         case OpLsh32x64:
448                 return rewriteValue386_OpLsh32x64(v)
449         case OpLsh32x8:
450                 return rewriteValue386_OpLsh32x8(v)
451         case OpLsh8x16:
452                 return rewriteValue386_OpLsh8x16(v)
453         case OpLsh8x32:
454                 return rewriteValue386_OpLsh8x32(v)
455         case OpLsh8x64:
456                 return rewriteValue386_OpLsh8x64(v)
457         case OpLsh8x8:
458                 return rewriteValue386_OpLsh8x8(v)
459         case OpMod16:
460                 v.Op = Op386MODW
461                 return true
462         case OpMod16u:
463                 v.Op = Op386MODWU
464                 return true
465         case OpMod32:
466                 v.Op = Op386MODL
467                 return true
468         case OpMod32u:
469                 v.Op = Op386MODLU
470                 return true
471         case OpMod8:
472                 return rewriteValue386_OpMod8(v)
473         case OpMod8u:
474                 return rewriteValue386_OpMod8u(v)
475         case OpMove:
476                 return rewriteValue386_OpMove(v)
477         case OpMul16:
478                 v.Op = Op386MULL
479                 return true
480         case OpMul32:
481                 v.Op = Op386MULL
482                 return true
483         case OpMul32F:
484                 v.Op = Op386MULSS
485                 return true
486         case OpMul32uhilo:
487                 v.Op = Op386MULLQU
488                 return true
489         case OpMul64F:
490                 v.Op = Op386MULSD
491                 return true
492         case OpMul8:
493                 v.Op = Op386MULL
494                 return true
495         case OpNeg16:
496                 v.Op = Op386NEGL
497                 return true
498         case OpNeg32:
499                 v.Op = Op386NEGL
500                 return true
501         case OpNeg32F:
502                 return rewriteValue386_OpNeg32F(v)
503         case OpNeg64F:
504                 return rewriteValue386_OpNeg64F(v)
505         case OpNeg8:
506                 v.Op = Op386NEGL
507                 return true
508         case OpNeq16:
509                 return rewriteValue386_OpNeq16(v)
510         case OpNeq32:
511                 return rewriteValue386_OpNeq32(v)
512         case OpNeq32F:
513                 return rewriteValue386_OpNeq32F(v)
514         case OpNeq64F:
515                 return rewriteValue386_OpNeq64F(v)
516         case OpNeq8:
517                 return rewriteValue386_OpNeq8(v)
518         case OpNeqB:
519                 return rewriteValue386_OpNeqB(v)
520         case OpNeqPtr:
521                 return rewriteValue386_OpNeqPtr(v)
522         case OpNilCheck:
523                 v.Op = Op386LoweredNilCheck
524                 return true
525         case OpNot:
526                 return rewriteValue386_OpNot(v)
527         case OpOffPtr:
528                 return rewriteValue386_OpOffPtr(v)
529         case OpOr16:
530                 v.Op = Op386ORL
531                 return true
532         case OpOr32:
533                 v.Op = Op386ORL
534                 return true
535         case OpOr8:
536                 v.Op = Op386ORL
537                 return true
538         case OpOrB:
539                 v.Op = Op386ORL
540                 return true
541         case OpPanicBounds:
542                 return rewriteValue386_OpPanicBounds(v)
543         case OpPanicExtend:
544                 return rewriteValue386_OpPanicExtend(v)
545         case OpRotateLeft16:
546                 return rewriteValue386_OpRotateLeft16(v)
547         case OpRotateLeft32:
548                 return rewriteValue386_OpRotateLeft32(v)
549         case OpRotateLeft8:
550                 return rewriteValue386_OpRotateLeft8(v)
551         case OpRound32F:
552                 v.Op = OpCopy
553                 return true
554         case OpRound64F:
555                 v.Op = OpCopy
556                 return true
557         case OpRsh16Ux16:
558                 return rewriteValue386_OpRsh16Ux16(v)
559         case OpRsh16Ux32:
560                 return rewriteValue386_OpRsh16Ux32(v)
561         case OpRsh16Ux64:
562                 return rewriteValue386_OpRsh16Ux64(v)
563         case OpRsh16Ux8:
564                 return rewriteValue386_OpRsh16Ux8(v)
565         case OpRsh16x16:
566                 return rewriteValue386_OpRsh16x16(v)
567         case OpRsh16x32:
568                 return rewriteValue386_OpRsh16x32(v)
569         case OpRsh16x64:
570                 return rewriteValue386_OpRsh16x64(v)
571         case OpRsh16x8:
572                 return rewriteValue386_OpRsh16x8(v)
573         case OpRsh32Ux16:
574                 return rewriteValue386_OpRsh32Ux16(v)
575         case OpRsh32Ux32:
576                 return rewriteValue386_OpRsh32Ux32(v)
577         case OpRsh32Ux64:
578                 return rewriteValue386_OpRsh32Ux64(v)
579         case OpRsh32Ux8:
580                 return rewriteValue386_OpRsh32Ux8(v)
581         case OpRsh32x16:
582                 return rewriteValue386_OpRsh32x16(v)
583         case OpRsh32x32:
584                 return rewriteValue386_OpRsh32x32(v)
585         case OpRsh32x64:
586                 return rewriteValue386_OpRsh32x64(v)
587         case OpRsh32x8:
588                 return rewriteValue386_OpRsh32x8(v)
589         case OpRsh8Ux16:
590                 return rewriteValue386_OpRsh8Ux16(v)
591         case OpRsh8Ux32:
592                 return rewriteValue386_OpRsh8Ux32(v)
593         case OpRsh8Ux64:
594                 return rewriteValue386_OpRsh8Ux64(v)
595         case OpRsh8Ux8:
596                 return rewriteValue386_OpRsh8Ux8(v)
597         case OpRsh8x16:
598                 return rewriteValue386_OpRsh8x16(v)
599         case OpRsh8x32:
600                 return rewriteValue386_OpRsh8x32(v)
601         case OpRsh8x64:
602                 return rewriteValue386_OpRsh8x64(v)
603         case OpRsh8x8:
604                 return rewriteValue386_OpRsh8x8(v)
605         case OpSelect0:
606                 return rewriteValue386_OpSelect0(v)
607         case OpSelect1:
608                 return rewriteValue386_OpSelect1(v)
609         case OpSignExt16to32:
610                 v.Op = Op386MOVWLSX
611                 return true
612         case OpSignExt8to16:
613                 v.Op = Op386MOVBLSX
614                 return true
615         case OpSignExt8to32:
616                 v.Op = Op386MOVBLSX
617                 return true
618         case OpSignmask:
619                 return rewriteValue386_OpSignmask(v)
620         case OpSlicemask:
621                 return rewriteValue386_OpSlicemask(v)
622         case OpSqrt:
623                 v.Op = Op386SQRTSD
624                 return true
625         case OpSqrt32:
626                 v.Op = Op386SQRTSS
627                 return true
628         case OpStaticCall:
629                 v.Op = Op386CALLstatic
630                 return true
631         case OpStore:
632                 return rewriteValue386_OpStore(v)
633         case OpSub16:
634                 v.Op = Op386SUBL
635                 return true
636         case OpSub32:
637                 v.Op = Op386SUBL
638                 return true
639         case OpSub32F:
640                 v.Op = Op386SUBSS
641                 return true
642         case OpSub32carry:
643                 v.Op = Op386SUBLcarry
644                 return true
645         case OpSub32withcarry:
646                 v.Op = Op386SBBL
647                 return true
648         case OpSub64F:
649                 v.Op = Op386SUBSD
650                 return true
651         case OpSub8:
652                 v.Op = Op386SUBL
653                 return true
654         case OpSubPtr:
655                 v.Op = Op386SUBL
656                 return true
657         case OpTrunc16to8:
658                 v.Op = OpCopy
659                 return true
660         case OpTrunc32to16:
661                 v.Op = OpCopy
662                 return true
663         case OpTrunc32to8:
664                 v.Op = OpCopy
665                 return true
666         case OpWB:
667                 v.Op = Op386LoweredWB
668                 return true
669         case OpXor16:
670                 v.Op = Op386XORL
671                 return true
672         case OpXor32:
673                 v.Op = Op386XORL
674                 return true
675         case OpXor8:
676                 v.Op = Op386XORL
677                 return true
678         case OpZero:
679                 return rewriteValue386_OpZero(v)
680         case OpZeroExt16to32:
681                 v.Op = Op386MOVWLZX
682                 return true
683         case OpZeroExt8to16:
684                 v.Op = Op386MOVBLZX
685                 return true
686         case OpZeroExt8to32:
687                 v.Op = Op386MOVBLZX
688                 return true
689         case OpZeromask:
690                 return rewriteValue386_OpZeromask(v)
691         }
692         return false
693 }
694 func rewriteValue386_Op386ADCL(v *Value) bool {
695         v_2 := v.Args[2]
696         v_1 := v.Args[1]
697         v_0 := v.Args[0]
698         // match: (ADCL x (MOVLconst [c]) f)
699         // result: (ADCLconst [c] x f)
700         for {
701                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
702                         x := v_0
703                         if v_1.Op != Op386MOVLconst {
704                                 continue
705                         }
706                         c := auxIntToInt32(v_1.AuxInt)
707                         f := v_2
708                         v.reset(Op386ADCLconst)
709                         v.AuxInt = int32ToAuxInt(c)
710                         v.AddArg2(x, f)
711                         return true
712                 }
713                 break
714         }
715         return false
716 }
717 func rewriteValue386_Op386ADDL(v *Value) bool {
718         v_1 := v.Args[1]
719         v_0 := v.Args[0]
720         // match: (ADDL x (MOVLconst [c]))
721         // result: (ADDLconst [c] x)
722         for {
723                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
724                         x := v_0
725                         if v_1.Op != Op386MOVLconst {
726                                 continue
727                         }
728                         c := auxIntToInt32(v_1.AuxInt)
729                         v.reset(Op386ADDLconst)
730                         v.AuxInt = int32ToAuxInt(c)
731                         v.AddArg(x)
732                         return true
733                 }
734                 break
735         }
736         // match: (ADDL (SHLLconst [c] x) (SHRLconst [d] x))
737         // cond: d == 32-c
738         // result: (ROLLconst [c] x)
739         for {
740                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
741                         if v_0.Op != Op386SHLLconst {
742                                 continue
743                         }
744                         c := auxIntToInt32(v_0.AuxInt)
745                         x := v_0.Args[0]
746                         if v_1.Op != Op386SHRLconst {
747                                 continue
748                         }
749                         d := auxIntToInt32(v_1.AuxInt)
750                         if x != v_1.Args[0] || !(d == 32-c) {
751                                 continue
752                         }
753                         v.reset(Op386ROLLconst)
754                         v.AuxInt = int32ToAuxInt(c)
755                         v.AddArg(x)
756                         return true
757                 }
758                 break
759         }
760         // match: (ADDL <t> (SHLLconst x [c]) (SHRWconst x [d]))
761         // cond: c < 16 && d == int16(16-c) && t.Size() == 2
762         // result: (ROLWconst x [int16(c)])
763         for {
764                 t := v.Type
765                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
766                         if v_0.Op != Op386SHLLconst {
767                                 continue
768                         }
769                         c := auxIntToInt32(v_0.AuxInt)
770                         x := v_0.Args[0]
771                         if v_1.Op != Op386SHRWconst {
772                                 continue
773                         }
774                         d := auxIntToInt16(v_1.AuxInt)
775                         if x != v_1.Args[0] || !(c < 16 && d == int16(16-c) && t.Size() == 2) {
776                                 continue
777                         }
778                         v.reset(Op386ROLWconst)
779                         v.AuxInt = int16ToAuxInt(int16(c))
780                         v.AddArg(x)
781                         return true
782                 }
783                 break
784         }
785         // match: (ADDL <t> (SHLLconst x [c]) (SHRBconst x [d]))
786         // cond: c < 8 && d == int8(8-c) && t.Size() == 1
787         // result: (ROLBconst x [int8(c)])
788         for {
789                 t := v.Type
790                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
791                         if v_0.Op != Op386SHLLconst {
792                                 continue
793                         }
794                         c := auxIntToInt32(v_0.AuxInt)
795                         x := v_0.Args[0]
796                         if v_1.Op != Op386SHRBconst {
797                                 continue
798                         }
799                         d := auxIntToInt8(v_1.AuxInt)
800                         if x != v_1.Args[0] || !(c < 8 && d == int8(8-c) && t.Size() == 1) {
801                                 continue
802                         }
803                         v.reset(Op386ROLBconst)
804                         v.AuxInt = int8ToAuxInt(int8(c))
805                         v.AddArg(x)
806                         return true
807                 }
808                 break
809         }
810         // match: (ADDL x (SHLLconst [3] y))
811         // result: (LEAL8 x y)
812         for {
813                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
814                         x := v_0
815                         if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 3 {
816                                 continue
817                         }
818                         y := v_1.Args[0]
819                         v.reset(Op386LEAL8)
820                         v.AddArg2(x, y)
821                         return true
822                 }
823                 break
824         }
825         // match: (ADDL x (SHLLconst [2] y))
826         // result: (LEAL4 x y)
827         for {
828                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
829                         x := v_0
830                         if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 2 {
831                                 continue
832                         }
833                         y := v_1.Args[0]
834                         v.reset(Op386LEAL4)
835                         v.AddArg2(x, y)
836                         return true
837                 }
838                 break
839         }
840         // match: (ADDL x (SHLLconst [1] y))
841         // result: (LEAL2 x y)
842         for {
843                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
844                         x := v_0
845                         if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 1 {
846                                 continue
847                         }
848                         y := v_1.Args[0]
849                         v.reset(Op386LEAL2)
850                         v.AddArg2(x, y)
851                         return true
852                 }
853                 break
854         }
855         // match: (ADDL x (ADDL y y))
856         // result: (LEAL2 x y)
857         for {
858                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
859                         x := v_0
860                         if v_1.Op != Op386ADDL {
861                                 continue
862                         }
863                         y := v_1.Args[1]
864                         if y != v_1.Args[0] {
865                                 continue
866                         }
867                         v.reset(Op386LEAL2)
868                         v.AddArg2(x, y)
869                         return true
870                 }
871                 break
872         }
873         // match: (ADDL x (ADDL x y))
874         // result: (LEAL2 y x)
875         for {
876                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
877                         x := v_0
878                         if v_1.Op != Op386ADDL {
879                                 continue
880                         }
881                         _ = v_1.Args[1]
882                         v_1_0 := v_1.Args[0]
883                         v_1_1 := v_1.Args[1]
884                         for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 {
885                                 if x != v_1_0 {
886                                         continue
887                                 }
888                                 y := v_1_1
889                                 v.reset(Op386LEAL2)
890                                 v.AddArg2(y, x)
891                                 return true
892                         }
893                 }
894                 break
895         }
896         // match: (ADDL (ADDLconst [c] x) y)
897         // result: (LEAL1 [c] x y)
898         for {
899                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
900                         if v_0.Op != Op386ADDLconst {
901                                 continue
902                         }
903                         c := auxIntToInt32(v_0.AuxInt)
904                         x := v_0.Args[0]
905                         y := v_1
906                         v.reset(Op386LEAL1)
907                         v.AuxInt = int32ToAuxInt(c)
908                         v.AddArg2(x, y)
909                         return true
910                 }
911                 break
912         }
913         // match: (ADDL x (LEAL [c] {s} y))
914         // cond: x.Op != OpSB && y.Op != OpSB
915         // result: (LEAL1 [c] {s} x y)
916         for {
917                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
918                         x := v_0
919                         if v_1.Op != Op386LEAL {
920                                 continue
921                         }
922                         c := auxIntToInt32(v_1.AuxInt)
923                         s := auxToSym(v_1.Aux)
924                         y := v_1.Args[0]
925                         if !(x.Op != OpSB && y.Op != OpSB) {
926                                 continue
927                         }
928                         v.reset(Op386LEAL1)
929                         v.AuxInt = int32ToAuxInt(c)
930                         v.Aux = symToAux(s)
931                         v.AddArg2(x, y)
932                         return true
933                 }
934                 break
935         }
936         // match: (ADDL x l:(MOVLload [off] {sym} ptr mem))
937         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
938         // result: (ADDLload x [off] {sym} ptr mem)
939         for {
940                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
941                         x := v_0
942                         l := v_1
943                         if l.Op != Op386MOVLload {
944                                 continue
945                         }
946                         off := auxIntToInt32(l.AuxInt)
947                         sym := auxToSym(l.Aux)
948                         mem := l.Args[1]
949                         ptr := l.Args[0]
950                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
951                                 continue
952                         }
953                         v.reset(Op386ADDLload)
954                         v.AuxInt = int32ToAuxInt(off)
955                         v.Aux = symToAux(sym)
956                         v.AddArg3(x, ptr, mem)
957                         return true
958                 }
959                 break
960         }
961         // match: (ADDL x (NEGL y))
962         // result: (SUBL x y)
963         for {
964                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
965                         x := v_0
966                         if v_1.Op != Op386NEGL {
967                                 continue
968                         }
969                         y := v_1.Args[0]
970                         v.reset(Op386SUBL)
971                         v.AddArg2(x, y)
972                         return true
973                 }
974                 break
975         }
976         return false
977 }
978 func rewriteValue386_Op386ADDLcarry(v *Value) bool {
979         v_1 := v.Args[1]
980         v_0 := v.Args[0]
981         // match: (ADDLcarry x (MOVLconst [c]))
982         // result: (ADDLconstcarry [c] x)
983         for {
984                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
985                         x := v_0
986                         if v_1.Op != Op386MOVLconst {
987                                 continue
988                         }
989                         c := auxIntToInt32(v_1.AuxInt)
990                         v.reset(Op386ADDLconstcarry)
991                         v.AuxInt = int32ToAuxInt(c)
992                         v.AddArg(x)
993                         return true
994                 }
995                 break
996         }
997         return false
998 }
999 func rewriteValue386_Op386ADDLconst(v *Value) bool {
1000         v_0 := v.Args[0]
1001         // match: (ADDLconst [c] (ADDL x y))
1002         // result: (LEAL1 [c] x y)
1003         for {
1004                 c := auxIntToInt32(v.AuxInt)
1005                 if v_0.Op != Op386ADDL {
1006                         break
1007                 }
1008                 y := v_0.Args[1]
1009                 x := v_0.Args[0]
1010                 v.reset(Op386LEAL1)
1011                 v.AuxInt = int32ToAuxInt(c)
1012                 v.AddArg2(x, y)
1013                 return true
1014         }
1015         // match: (ADDLconst [c] (LEAL [d] {s} x))
1016         // cond: is32Bit(int64(c)+int64(d))
1017         // result: (LEAL [c+d] {s} x)
1018         for {
1019                 c := auxIntToInt32(v.AuxInt)
1020                 if v_0.Op != Op386LEAL {
1021                         break
1022                 }
1023                 d := auxIntToInt32(v_0.AuxInt)
1024                 s := auxToSym(v_0.Aux)
1025                 x := v_0.Args[0]
1026                 if !(is32Bit(int64(c) + int64(d))) {
1027                         break
1028                 }
1029                 v.reset(Op386LEAL)
1030                 v.AuxInt = int32ToAuxInt(c + d)
1031                 v.Aux = symToAux(s)
1032                 v.AddArg(x)
1033                 return true
1034         }
1035         // match: (ADDLconst [c] x:(SP))
1036         // result: (LEAL [c] x)
1037         for {
1038                 c := auxIntToInt32(v.AuxInt)
1039                 x := v_0
1040                 if x.Op != OpSP {
1041                         break
1042                 }
1043                 v.reset(Op386LEAL)
1044                 v.AuxInt = int32ToAuxInt(c)
1045                 v.AddArg(x)
1046                 return true
1047         }
1048         // match: (ADDLconst [c] (LEAL1 [d] {s} x y))
1049         // cond: is32Bit(int64(c)+int64(d))
1050         // result: (LEAL1 [c+d] {s} x y)
1051         for {
1052                 c := auxIntToInt32(v.AuxInt)
1053                 if v_0.Op != Op386LEAL1 {
1054                         break
1055                 }
1056                 d := auxIntToInt32(v_0.AuxInt)
1057                 s := auxToSym(v_0.Aux)
1058                 y := v_0.Args[1]
1059                 x := v_0.Args[0]
1060                 if !(is32Bit(int64(c) + int64(d))) {
1061                         break
1062                 }
1063                 v.reset(Op386LEAL1)
1064                 v.AuxInt = int32ToAuxInt(c + d)
1065                 v.Aux = symToAux(s)
1066                 v.AddArg2(x, y)
1067                 return true
1068         }
1069         // match: (ADDLconst [c] (LEAL2 [d] {s} x y))
1070         // cond: is32Bit(int64(c)+int64(d))
1071         // result: (LEAL2 [c+d] {s} x y)
1072         for {
1073                 c := auxIntToInt32(v.AuxInt)
1074                 if v_0.Op != Op386LEAL2 {
1075                         break
1076                 }
1077                 d := auxIntToInt32(v_0.AuxInt)
1078                 s := auxToSym(v_0.Aux)
1079                 y := v_0.Args[1]
1080                 x := v_0.Args[0]
1081                 if !(is32Bit(int64(c) + int64(d))) {
1082                         break
1083                 }
1084                 v.reset(Op386LEAL2)
1085                 v.AuxInt = int32ToAuxInt(c + d)
1086                 v.Aux = symToAux(s)
1087                 v.AddArg2(x, y)
1088                 return true
1089         }
1090         // match: (ADDLconst [c] (LEAL4 [d] {s} x y))
1091         // cond: is32Bit(int64(c)+int64(d))
1092         // result: (LEAL4 [c+d] {s} x y)
1093         for {
1094                 c := auxIntToInt32(v.AuxInt)
1095                 if v_0.Op != Op386LEAL4 {
1096                         break
1097                 }
1098                 d := auxIntToInt32(v_0.AuxInt)
1099                 s := auxToSym(v_0.Aux)
1100                 y := v_0.Args[1]
1101                 x := v_0.Args[0]
1102                 if !(is32Bit(int64(c) + int64(d))) {
1103                         break
1104                 }
1105                 v.reset(Op386LEAL4)
1106                 v.AuxInt = int32ToAuxInt(c + d)
1107                 v.Aux = symToAux(s)
1108                 v.AddArg2(x, y)
1109                 return true
1110         }
1111         // match: (ADDLconst [c] (LEAL8 [d] {s} x y))
1112         // cond: is32Bit(int64(c)+int64(d))
1113         // result: (LEAL8 [c+d] {s} x y)
1114         for {
1115                 c := auxIntToInt32(v.AuxInt)
1116                 if v_0.Op != Op386LEAL8 {
1117                         break
1118                 }
1119                 d := auxIntToInt32(v_0.AuxInt)
1120                 s := auxToSym(v_0.Aux)
1121                 y := v_0.Args[1]
1122                 x := v_0.Args[0]
1123                 if !(is32Bit(int64(c) + int64(d))) {
1124                         break
1125                 }
1126                 v.reset(Op386LEAL8)
1127                 v.AuxInt = int32ToAuxInt(c + d)
1128                 v.Aux = symToAux(s)
1129                 v.AddArg2(x, y)
1130                 return true
1131         }
1132         // match: (ADDLconst [c] x)
1133         // cond: c==0
1134         // result: x
1135         for {
1136                 c := auxIntToInt32(v.AuxInt)
1137                 x := v_0
1138                 if !(c == 0) {
1139                         break
1140                 }
1141                 v.copyOf(x)
1142                 return true
1143         }
1144         // match: (ADDLconst [c] (MOVLconst [d]))
1145         // result: (MOVLconst [c+d])
1146         for {
1147                 c := auxIntToInt32(v.AuxInt)
1148                 if v_0.Op != Op386MOVLconst {
1149                         break
1150                 }
1151                 d := auxIntToInt32(v_0.AuxInt)
1152                 v.reset(Op386MOVLconst)
1153                 v.AuxInt = int32ToAuxInt(c + d)
1154                 return true
1155         }
1156         // match: (ADDLconst [c] (ADDLconst [d] x))
1157         // result: (ADDLconst [c+d] x)
1158         for {
1159                 c := auxIntToInt32(v.AuxInt)
1160                 if v_0.Op != Op386ADDLconst {
1161                         break
1162                 }
1163                 d := auxIntToInt32(v_0.AuxInt)
1164                 x := v_0.Args[0]
1165                 v.reset(Op386ADDLconst)
1166                 v.AuxInt = int32ToAuxInt(c + d)
1167                 v.AddArg(x)
1168                 return true
1169         }
1170         return false
1171 }
1172 func rewriteValue386_Op386ADDLconstmodify(v *Value) bool {
1173         v_1 := v.Args[1]
1174         v_0 := v.Args[0]
1175         b := v.Block
1176         config := b.Func.Config
1177         // match: (ADDLconstmodify [valoff1] {sym} (ADDLconst [off2] base) mem)
1178         // cond: valoff1.canAdd32(off2)
1179         // result: (ADDLconstmodify [valoff1.addOffset32(off2)] {sym} base mem)
1180         for {
1181                 valoff1 := auxIntToValAndOff(v.AuxInt)
1182                 sym := auxToSym(v.Aux)
1183                 if v_0.Op != Op386ADDLconst {
1184                         break
1185                 }
1186                 off2 := auxIntToInt32(v_0.AuxInt)
1187                 base := v_0.Args[0]
1188                 mem := v_1
1189                 if !(valoff1.canAdd32(off2)) {
1190                         break
1191                 }
1192                 v.reset(Op386ADDLconstmodify)
1193                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
1194                 v.Aux = symToAux(sym)
1195                 v.AddArg2(base, mem)
1196                 return true
1197         }
1198         // match: (ADDLconstmodify [valoff1] {sym1} (LEAL [off2] {sym2} base) mem)
1199         // cond: valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1200         // result: (ADDLconstmodify [valoff1.addOffset32(off2)] {mergeSym(sym1,sym2)} base mem)
1201         for {
1202                 valoff1 := auxIntToValAndOff(v.AuxInt)
1203                 sym1 := auxToSym(v.Aux)
1204                 if v_0.Op != Op386LEAL {
1205                         break
1206                 }
1207                 off2 := auxIntToInt32(v_0.AuxInt)
1208                 sym2 := auxToSym(v_0.Aux)
1209                 base := v_0.Args[0]
1210                 mem := v_1
1211                 if !(valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1212                         break
1213                 }
1214                 v.reset(Op386ADDLconstmodify)
1215                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
1216                 v.Aux = symToAux(mergeSym(sym1, sym2))
1217                 v.AddArg2(base, mem)
1218                 return true
1219         }
1220         return false
1221 }
1222 func rewriteValue386_Op386ADDLload(v *Value) bool {
1223         v_2 := v.Args[2]
1224         v_1 := v.Args[1]
1225         v_0 := v.Args[0]
1226         b := v.Block
1227         config := b.Func.Config
1228         // match: (ADDLload [off1] {sym} val (ADDLconst [off2] base) mem)
1229         // cond: is32Bit(int64(off1)+int64(off2))
1230         // result: (ADDLload [off1+off2] {sym} val base mem)
1231         for {
1232                 off1 := auxIntToInt32(v.AuxInt)
1233                 sym := auxToSym(v.Aux)
1234                 val := v_0
1235                 if v_1.Op != Op386ADDLconst {
1236                         break
1237                 }
1238                 off2 := auxIntToInt32(v_1.AuxInt)
1239                 base := v_1.Args[0]
1240                 mem := v_2
1241                 if !(is32Bit(int64(off1) + int64(off2))) {
1242                         break
1243                 }
1244                 v.reset(Op386ADDLload)
1245                 v.AuxInt = int32ToAuxInt(off1 + off2)
1246                 v.Aux = symToAux(sym)
1247                 v.AddArg3(val, base, mem)
1248                 return true
1249         }
1250         // match: (ADDLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
1251         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1252         // result: (ADDLload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
1253         for {
1254                 off1 := auxIntToInt32(v.AuxInt)
1255                 sym1 := auxToSym(v.Aux)
1256                 val := v_0
1257                 if v_1.Op != Op386LEAL {
1258                         break
1259                 }
1260                 off2 := auxIntToInt32(v_1.AuxInt)
1261                 sym2 := auxToSym(v_1.Aux)
1262                 base := v_1.Args[0]
1263                 mem := v_2
1264                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1265                         break
1266                 }
1267                 v.reset(Op386ADDLload)
1268                 v.AuxInt = int32ToAuxInt(off1 + off2)
1269                 v.Aux = symToAux(mergeSym(sym1, sym2))
1270                 v.AddArg3(val, base, mem)
1271                 return true
1272         }
1273         return false
1274 }
1275 func rewriteValue386_Op386ADDLmodify(v *Value) bool {
1276         v_2 := v.Args[2]
1277         v_1 := v.Args[1]
1278         v_0 := v.Args[0]
1279         b := v.Block
1280         config := b.Func.Config
1281         // match: (ADDLmodify [off1] {sym} (ADDLconst [off2] base) val mem)
1282         // cond: is32Bit(int64(off1)+int64(off2))
1283         // result: (ADDLmodify [off1+off2] {sym} base val mem)
1284         for {
1285                 off1 := auxIntToInt32(v.AuxInt)
1286                 sym := auxToSym(v.Aux)
1287                 if v_0.Op != Op386ADDLconst {
1288                         break
1289                 }
1290                 off2 := auxIntToInt32(v_0.AuxInt)
1291                 base := v_0.Args[0]
1292                 val := v_1
1293                 mem := v_2
1294                 if !(is32Bit(int64(off1) + int64(off2))) {
1295                         break
1296                 }
1297                 v.reset(Op386ADDLmodify)
1298                 v.AuxInt = int32ToAuxInt(off1 + off2)
1299                 v.Aux = symToAux(sym)
1300                 v.AddArg3(base, val, mem)
1301                 return true
1302         }
1303         // match: (ADDLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
1304         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1305         // result: (ADDLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem)
1306         for {
1307                 off1 := auxIntToInt32(v.AuxInt)
1308                 sym1 := auxToSym(v.Aux)
1309                 if v_0.Op != Op386LEAL {
1310                         break
1311                 }
1312                 off2 := auxIntToInt32(v_0.AuxInt)
1313                 sym2 := auxToSym(v_0.Aux)
1314                 base := v_0.Args[0]
1315                 val := v_1
1316                 mem := v_2
1317                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1318                         break
1319                 }
1320                 v.reset(Op386ADDLmodify)
1321                 v.AuxInt = int32ToAuxInt(off1 + off2)
1322                 v.Aux = symToAux(mergeSym(sym1, sym2))
1323                 v.AddArg3(base, val, mem)
1324                 return true
1325         }
1326         return false
1327 }
1328 func rewriteValue386_Op386ADDSD(v *Value) bool {
1329         v_1 := v.Args[1]
1330         v_0 := v.Args[0]
1331         // match: (ADDSD x l:(MOVSDload [off] {sym} ptr mem))
1332         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
1333         // result: (ADDSDload x [off] {sym} ptr mem)
1334         for {
1335                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1336                         x := v_0
1337                         l := v_1
1338                         if l.Op != Op386MOVSDload {
1339                                 continue
1340                         }
1341                         off := auxIntToInt32(l.AuxInt)
1342                         sym := auxToSym(l.Aux)
1343                         mem := l.Args[1]
1344                         ptr := l.Args[0]
1345                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
1346                                 continue
1347                         }
1348                         v.reset(Op386ADDSDload)
1349                         v.AuxInt = int32ToAuxInt(off)
1350                         v.Aux = symToAux(sym)
1351                         v.AddArg3(x, ptr, mem)
1352                         return true
1353                 }
1354                 break
1355         }
1356         return false
1357 }
1358 func rewriteValue386_Op386ADDSDload(v *Value) bool {
1359         v_2 := v.Args[2]
1360         v_1 := v.Args[1]
1361         v_0 := v.Args[0]
1362         b := v.Block
1363         config := b.Func.Config
1364         // match: (ADDSDload [off1] {sym} val (ADDLconst [off2] base) mem)
1365         // cond: is32Bit(int64(off1)+int64(off2))
1366         // result: (ADDSDload [off1+off2] {sym} val base mem)
1367         for {
1368                 off1 := auxIntToInt32(v.AuxInt)
1369                 sym := auxToSym(v.Aux)
1370                 val := v_0
1371                 if v_1.Op != Op386ADDLconst {
1372                         break
1373                 }
1374                 off2 := auxIntToInt32(v_1.AuxInt)
1375                 base := v_1.Args[0]
1376                 mem := v_2
1377                 if !(is32Bit(int64(off1) + int64(off2))) {
1378                         break
1379                 }
1380                 v.reset(Op386ADDSDload)
1381                 v.AuxInt = int32ToAuxInt(off1 + off2)
1382                 v.Aux = symToAux(sym)
1383                 v.AddArg3(val, base, mem)
1384                 return true
1385         }
1386         // match: (ADDSDload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
1387         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1388         // result: (ADDSDload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
1389         for {
1390                 off1 := auxIntToInt32(v.AuxInt)
1391                 sym1 := auxToSym(v.Aux)
1392                 val := v_0
1393                 if v_1.Op != Op386LEAL {
1394                         break
1395                 }
1396                 off2 := auxIntToInt32(v_1.AuxInt)
1397                 sym2 := auxToSym(v_1.Aux)
1398                 base := v_1.Args[0]
1399                 mem := v_2
1400                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1401                         break
1402                 }
1403                 v.reset(Op386ADDSDload)
1404                 v.AuxInt = int32ToAuxInt(off1 + off2)
1405                 v.Aux = symToAux(mergeSym(sym1, sym2))
1406                 v.AddArg3(val, base, mem)
1407                 return true
1408         }
1409         return false
1410 }
1411 func rewriteValue386_Op386ADDSS(v *Value) bool {
1412         v_1 := v.Args[1]
1413         v_0 := v.Args[0]
1414         // match: (ADDSS x l:(MOVSSload [off] {sym} ptr mem))
1415         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
1416         // result: (ADDSSload x [off] {sym} ptr mem)
1417         for {
1418                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1419                         x := v_0
1420                         l := v_1
1421                         if l.Op != Op386MOVSSload {
1422                                 continue
1423                         }
1424                         off := auxIntToInt32(l.AuxInt)
1425                         sym := auxToSym(l.Aux)
1426                         mem := l.Args[1]
1427                         ptr := l.Args[0]
1428                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
1429                                 continue
1430                         }
1431                         v.reset(Op386ADDSSload)
1432                         v.AuxInt = int32ToAuxInt(off)
1433                         v.Aux = symToAux(sym)
1434                         v.AddArg3(x, ptr, mem)
1435                         return true
1436                 }
1437                 break
1438         }
1439         return false
1440 }
1441 func rewriteValue386_Op386ADDSSload(v *Value) bool {
1442         v_2 := v.Args[2]
1443         v_1 := v.Args[1]
1444         v_0 := v.Args[0]
1445         b := v.Block
1446         config := b.Func.Config
1447         // match: (ADDSSload [off1] {sym} val (ADDLconst [off2] base) mem)
1448         // cond: is32Bit(int64(off1)+int64(off2))
1449         // result: (ADDSSload [off1+off2] {sym} val base mem)
1450         for {
1451                 off1 := auxIntToInt32(v.AuxInt)
1452                 sym := auxToSym(v.Aux)
1453                 val := v_0
1454                 if v_1.Op != Op386ADDLconst {
1455                         break
1456                 }
1457                 off2 := auxIntToInt32(v_1.AuxInt)
1458                 base := v_1.Args[0]
1459                 mem := v_2
1460                 if !(is32Bit(int64(off1) + int64(off2))) {
1461                         break
1462                 }
1463                 v.reset(Op386ADDSSload)
1464                 v.AuxInt = int32ToAuxInt(off1 + off2)
1465                 v.Aux = symToAux(sym)
1466                 v.AddArg3(val, base, mem)
1467                 return true
1468         }
1469         // match: (ADDSSload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
1470         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1471         // result: (ADDSSload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
1472         for {
1473                 off1 := auxIntToInt32(v.AuxInt)
1474                 sym1 := auxToSym(v.Aux)
1475                 val := v_0
1476                 if v_1.Op != Op386LEAL {
1477                         break
1478                 }
1479                 off2 := auxIntToInt32(v_1.AuxInt)
1480                 sym2 := auxToSym(v_1.Aux)
1481                 base := v_1.Args[0]
1482                 mem := v_2
1483                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1484                         break
1485                 }
1486                 v.reset(Op386ADDSSload)
1487                 v.AuxInt = int32ToAuxInt(off1 + off2)
1488                 v.Aux = symToAux(mergeSym(sym1, sym2))
1489                 v.AddArg3(val, base, mem)
1490                 return true
1491         }
1492         return false
1493 }
1494 func rewriteValue386_Op386ANDL(v *Value) bool {
1495         v_1 := v.Args[1]
1496         v_0 := v.Args[0]
1497         // match: (ANDL x (MOVLconst [c]))
1498         // result: (ANDLconst [c] x)
1499         for {
1500                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1501                         x := v_0
1502                         if v_1.Op != Op386MOVLconst {
1503                                 continue
1504                         }
1505                         c := auxIntToInt32(v_1.AuxInt)
1506                         v.reset(Op386ANDLconst)
1507                         v.AuxInt = int32ToAuxInt(c)
1508                         v.AddArg(x)
1509                         return true
1510                 }
1511                 break
1512         }
1513         // match: (ANDL x l:(MOVLload [off] {sym} ptr mem))
1514         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
1515         // result: (ANDLload x [off] {sym} ptr mem)
1516         for {
1517                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1518                         x := v_0
1519                         l := v_1
1520                         if l.Op != Op386MOVLload {
1521                                 continue
1522                         }
1523                         off := auxIntToInt32(l.AuxInt)
1524                         sym := auxToSym(l.Aux)
1525                         mem := l.Args[1]
1526                         ptr := l.Args[0]
1527                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
1528                                 continue
1529                         }
1530                         v.reset(Op386ANDLload)
1531                         v.AuxInt = int32ToAuxInt(off)
1532                         v.Aux = symToAux(sym)
1533                         v.AddArg3(x, ptr, mem)
1534                         return true
1535                 }
1536                 break
1537         }
1538         // match: (ANDL x x)
1539         // result: x
1540         for {
1541                 x := v_0
1542                 if x != v_1 {
1543                         break
1544                 }
1545                 v.copyOf(x)
1546                 return true
1547         }
1548         return false
1549 }
1550 func rewriteValue386_Op386ANDLconst(v *Value) bool {
1551         v_0 := v.Args[0]
1552         // match: (ANDLconst [c] (ANDLconst [d] x))
1553         // result: (ANDLconst [c & d] x)
1554         for {
1555                 c := auxIntToInt32(v.AuxInt)
1556                 if v_0.Op != Op386ANDLconst {
1557                         break
1558                 }
1559                 d := auxIntToInt32(v_0.AuxInt)
1560                 x := v_0.Args[0]
1561                 v.reset(Op386ANDLconst)
1562                 v.AuxInt = int32ToAuxInt(c & d)
1563                 v.AddArg(x)
1564                 return true
1565         }
1566         // match: (ANDLconst [c] _)
1567         // cond: c==0
1568         // result: (MOVLconst [0])
1569         for {
1570                 c := auxIntToInt32(v.AuxInt)
1571                 if !(c == 0) {
1572                         break
1573                 }
1574                 v.reset(Op386MOVLconst)
1575                 v.AuxInt = int32ToAuxInt(0)
1576                 return true
1577         }
1578         // match: (ANDLconst [c] x)
1579         // cond: c==-1
1580         // result: x
1581         for {
1582                 c := auxIntToInt32(v.AuxInt)
1583                 x := v_0
1584                 if !(c == -1) {
1585                         break
1586                 }
1587                 v.copyOf(x)
1588                 return true
1589         }
1590         // match: (ANDLconst [c] (MOVLconst [d]))
1591         // result: (MOVLconst [c&d])
1592         for {
1593                 c := auxIntToInt32(v.AuxInt)
1594                 if v_0.Op != Op386MOVLconst {
1595                         break
1596                 }
1597                 d := auxIntToInt32(v_0.AuxInt)
1598                 v.reset(Op386MOVLconst)
1599                 v.AuxInt = int32ToAuxInt(c & d)
1600                 return true
1601         }
1602         return false
1603 }
1604 func rewriteValue386_Op386ANDLconstmodify(v *Value) bool {
1605         v_1 := v.Args[1]
1606         v_0 := v.Args[0]
1607         b := v.Block
1608         config := b.Func.Config
1609         // match: (ANDLconstmodify [valoff1] {sym} (ADDLconst [off2] base) mem)
1610         // cond: valoff1.canAdd32(off2)
1611         // result: (ANDLconstmodify [valoff1.addOffset32(off2)] {sym} base mem)
1612         for {
1613                 valoff1 := auxIntToValAndOff(v.AuxInt)
1614                 sym := auxToSym(v.Aux)
1615                 if v_0.Op != Op386ADDLconst {
1616                         break
1617                 }
1618                 off2 := auxIntToInt32(v_0.AuxInt)
1619                 base := v_0.Args[0]
1620                 mem := v_1
1621                 if !(valoff1.canAdd32(off2)) {
1622                         break
1623                 }
1624                 v.reset(Op386ANDLconstmodify)
1625                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
1626                 v.Aux = symToAux(sym)
1627                 v.AddArg2(base, mem)
1628                 return true
1629         }
1630         // match: (ANDLconstmodify [valoff1] {sym1} (LEAL [off2] {sym2} base) mem)
1631         // cond: valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1632         // result: (ANDLconstmodify [valoff1.addOffset32(off2)] {mergeSym(sym1,sym2)} base mem)
1633         for {
1634                 valoff1 := auxIntToValAndOff(v.AuxInt)
1635                 sym1 := auxToSym(v.Aux)
1636                 if v_0.Op != Op386LEAL {
1637                         break
1638                 }
1639                 off2 := auxIntToInt32(v_0.AuxInt)
1640                 sym2 := auxToSym(v_0.Aux)
1641                 base := v_0.Args[0]
1642                 mem := v_1
1643                 if !(valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1644                         break
1645                 }
1646                 v.reset(Op386ANDLconstmodify)
1647                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
1648                 v.Aux = symToAux(mergeSym(sym1, sym2))
1649                 v.AddArg2(base, mem)
1650                 return true
1651         }
1652         return false
1653 }
1654 func rewriteValue386_Op386ANDLload(v *Value) bool {
1655         v_2 := v.Args[2]
1656         v_1 := v.Args[1]
1657         v_0 := v.Args[0]
1658         b := v.Block
1659         config := b.Func.Config
1660         // match: (ANDLload [off1] {sym} val (ADDLconst [off2] base) mem)
1661         // cond: is32Bit(int64(off1)+int64(off2))
1662         // result: (ANDLload [off1+off2] {sym} val base mem)
1663         for {
1664                 off1 := auxIntToInt32(v.AuxInt)
1665                 sym := auxToSym(v.Aux)
1666                 val := v_0
1667                 if v_1.Op != Op386ADDLconst {
1668                         break
1669                 }
1670                 off2 := auxIntToInt32(v_1.AuxInt)
1671                 base := v_1.Args[0]
1672                 mem := v_2
1673                 if !(is32Bit(int64(off1) + int64(off2))) {
1674                         break
1675                 }
1676                 v.reset(Op386ANDLload)
1677                 v.AuxInt = int32ToAuxInt(off1 + off2)
1678                 v.Aux = symToAux(sym)
1679                 v.AddArg3(val, base, mem)
1680                 return true
1681         }
1682         // match: (ANDLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
1683         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1684         // result: (ANDLload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
1685         for {
1686                 off1 := auxIntToInt32(v.AuxInt)
1687                 sym1 := auxToSym(v.Aux)
1688                 val := v_0
1689                 if v_1.Op != Op386LEAL {
1690                         break
1691                 }
1692                 off2 := auxIntToInt32(v_1.AuxInt)
1693                 sym2 := auxToSym(v_1.Aux)
1694                 base := v_1.Args[0]
1695                 mem := v_2
1696                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1697                         break
1698                 }
1699                 v.reset(Op386ANDLload)
1700                 v.AuxInt = int32ToAuxInt(off1 + off2)
1701                 v.Aux = symToAux(mergeSym(sym1, sym2))
1702                 v.AddArg3(val, base, mem)
1703                 return true
1704         }
1705         return false
1706 }
1707 func rewriteValue386_Op386ANDLmodify(v *Value) bool {
1708         v_2 := v.Args[2]
1709         v_1 := v.Args[1]
1710         v_0 := v.Args[0]
1711         b := v.Block
1712         config := b.Func.Config
1713         // match: (ANDLmodify [off1] {sym} (ADDLconst [off2] base) val mem)
1714         // cond: is32Bit(int64(off1)+int64(off2))
1715         // result: (ANDLmodify [off1+off2] {sym} base val mem)
1716         for {
1717                 off1 := auxIntToInt32(v.AuxInt)
1718                 sym := auxToSym(v.Aux)
1719                 if v_0.Op != Op386ADDLconst {
1720                         break
1721                 }
1722                 off2 := auxIntToInt32(v_0.AuxInt)
1723                 base := v_0.Args[0]
1724                 val := v_1
1725                 mem := v_2
1726                 if !(is32Bit(int64(off1) + int64(off2))) {
1727                         break
1728                 }
1729                 v.reset(Op386ANDLmodify)
1730                 v.AuxInt = int32ToAuxInt(off1 + off2)
1731                 v.Aux = symToAux(sym)
1732                 v.AddArg3(base, val, mem)
1733                 return true
1734         }
1735         // match: (ANDLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
1736         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
1737         // result: (ANDLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem)
1738         for {
1739                 off1 := auxIntToInt32(v.AuxInt)
1740                 sym1 := auxToSym(v.Aux)
1741                 if v_0.Op != Op386LEAL {
1742                         break
1743                 }
1744                 off2 := auxIntToInt32(v_0.AuxInt)
1745                 sym2 := auxToSym(v_0.Aux)
1746                 base := v_0.Args[0]
1747                 val := v_1
1748                 mem := v_2
1749                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
1750                         break
1751                 }
1752                 v.reset(Op386ANDLmodify)
1753                 v.AuxInt = int32ToAuxInt(off1 + off2)
1754                 v.Aux = symToAux(mergeSym(sym1, sym2))
1755                 v.AddArg3(base, val, mem)
1756                 return true
1757         }
1758         return false
1759 }
1760 func rewriteValue386_Op386CMPB(v *Value) bool {
1761         v_1 := v.Args[1]
1762         v_0 := v.Args[0]
1763         b := v.Block
1764         // match: (CMPB x (MOVLconst [c]))
1765         // result: (CMPBconst x [int8(c)])
1766         for {
1767                 x := v_0
1768                 if v_1.Op != Op386MOVLconst {
1769                         break
1770                 }
1771                 c := auxIntToInt32(v_1.AuxInt)
1772                 v.reset(Op386CMPBconst)
1773                 v.AuxInt = int8ToAuxInt(int8(c))
1774                 v.AddArg(x)
1775                 return true
1776         }
1777         // match: (CMPB (MOVLconst [c]) x)
1778         // result: (InvertFlags (CMPBconst x [int8(c)]))
1779         for {
1780                 if v_0.Op != Op386MOVLconst {
1781                         break
1782                 }
1783                 c := auxIntToInt32(v_0.AuxInt)
1784                 x := v_1
1785                 v.reset(Op386InvertFlags)
1786                 v0 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
1787                 v0.AuxInt = int8ToAuxInt(int8(c))
1788                 v0.AddArg(x)
1789                 v.AddArg(v0)
1790                 return true
1791         }
1792         // match: (CMPB x y)
1793         // cond: canonLessThan(x,y)
1794         // result: (InvertFlags (CMPB y x))
1795         for {
1796                 x := v_0
1797                 y := v_1
1798                 if !(canonLessThan(x, y)) {
1799                         break
1800                 }
1801                 v.reset(Op386InvertFlags)
1802                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
1803                 v0.AddArg2(y, x)
1804                 v.AddArg(v0)
1805                 return true
1806         }
1807         // match: (CMPB l:(MOVBload {sym} [off] ptr mem) x)
1808         // cond: canMergeLoad(v, l) && clobber(l)
1809         // result: (CMPBload {sym} [off] ptr x mem)
1810         for {
1811                 l := v_0
1812                 if l.Op != Op386MOVBload {
1813                         break
1814                 }
1815                 off := auxIntToInt32(l.AuxInt)
1816                 sym := auxToSym(l.Aux)
1817                 mem := l.Args[1]
1818                 ptr := l.Args[0]
1819                 x := v_1
1820                 if !(canMergeLoad(v, l) && clobber(l)) {
1821                         break
1822                 }
1823                 v.reset(Op386CMPBload)
1824                 v.AuxInt = int32ToAuxInt(off)
1825                 v.Aux = symToAux(sym)
1826                 v.AddArg3(ptr, x, mem)
1827                 return true
1828         }
1829         // match: (CMPB x l:(MOVBload {sym} [off] ptr mem))
1830         // cond: canMergeLoad(v, l) && clobber(l)
1831         // result: (InvertFlags (CMPBload {sym} [off] ptr x mem))
1832         for {
1833                 x := v_0
1834                 l := v_1
1835                 if l.Op != Op386MOVBload {
1836                         break
1837                 }
1838                 off := auxIntToInt32(l.AuxInt)
1839                 sym := auxToSym(l.Aux)
1840                 mem := l.Args[1]
1841                 ptr := l.Args[0]
1842                 if !(canMergeLoad(v, l) && clobber(l)) {
1843                         break
1844                 }
1845                 v.reset(Op386InvertFlags)
1846                 v0 := b.NewValue0(l.Pos, Op386CMPBload, types.TypeFlags)
1847                 v0.AuxInt = int32ToAuxInt(off)
1848                 v0.Aux = symToAux(sym)
1849                 v0.AddArg3(ptr, x, mem)
1850                 v.AddArg(v0)
1851                 return true
1852         }
1853         return false
1854 }
1855 func rewriteValue386_Op386CMPBconst(v *Value) bool {
1856         v_0 := v.Args[0]
1857         b := v.Block
1858         // match: (CMPBconst (MOVLconst [x]) [y])
1859         // cond: int8(x)==y
1860         // result: (FlagEQ)
1861         for {
1862                 y := auxIntToInt8(v.AuxInt)
1863                 if v_0.Op != Op386MOVLconst {
1864                         break
1865                 }
1866                 x := auxIntToInt32(v_0.AuxInt)
1867                 if !(int8(x) == y) {
1868                         break
1869                 }
1870                 v.reset(Op386FlagEQ)
1871                 return true
1872         }
1873         // match: (CMPBconst (MOVLconst [x]) [y])
1874         // cond: int8(x)<y && uint8(x)<uint8(y)
1875         // result: (FlagLT_ULT)
1876         for {
1877                 y := auxIntToInt8(v.AuxInt)
1878                 if v_0.Op != Op386MOVLconst {
1879                         break
1880                 }
1881                 x := auxIntToInt32(v_0.AuxInt)
1882                 if !(int8(x) < y && uint8(x) < uint8(y)) {
1883                         break
1884                 }
1885                 v.reset(Op386FlagLT_ULT)
1886                 return true
1887         }
1888         // match: (CMPBconst (MOVLconst [x]) [y])
1889         // cond: int8(x)<y && uint8(x)>uint8(y)
1890         // result: (FlagLT_UGT)
1891         for {
1892                 y := auxIntToInt8(v.AuxInt)
1893                 if v_0.Op != Op386MOVLconst {
1894                         break
1895                 }
1896                 x := auxIntToInt32(v_0.AuxInt)
1897                 if !(int8(x) < y && uint8(x) > uint8(y)) {
1898                         break
1899                 }
1900                 v.reset(Op386FlagLT_UGT)
1901                 return true
1902         }
1903         // match: (CMPBconst (MOVLconst [x]) [y])
1904         // cond: int8(x)>y && uint8(x)<uint8(y)
1905         // result: (FlagGT_ULT)
1906         for {
1907                 y := auxIntToInt8(v.AuxInt)
1908                 if v_0.Op != Op386MOVLconst {
1909                         break
1910                 }
1911                 x := auxIntToInt32(v_0.AuxInt)
1912                 if !(int8(x) > y && uint8(x) < uint8(y)) {
1913                         break
1914                 }
1915                 v.reset(Op386FlagGT_ULT)
1916                 return true
1917         }
1918         // match: (CMPBconst (MOVLconst [x]) [y])
1919         // cond: int8(x)>y && uint8(x)>uint8(y)
1920         // result: (FlagGT_UGT)
1921         for {
1922                 y := auxIntToInt8(v.AuxInt)
1923                 if v_0.Op != Op386MOVLconst {
1924                         break
1925                 }
1926                 x := auxIntToInt32(v_0.AuxInt)
1927                 if !(int8(x) > y && uint8(x) > uint8(y)) {
1928                         break
1929                 }
1930                 v.reset(Op386FlagGT_UGT)
1931                 return true
1932         }
1933         // match: (CMPBconst (ANDLconst _ [m]) [n])
1934         // cond: 0 <= int8(m) && int8(m) < n
1935         // result: (FlagLT_ULT)
1936         for {
1937                 n := auxIntToInt8(v.AuxInt)
1938                 if v_0.Op != Op386ANDLconst {
1939                         break
1940                 }
1941                 m := auxIntToInt32(v_0.AuxInt)
1942                 if !(0 <= int8(m) && int8(m) < n) {
1943                         break
1944                 }
1945                 v.reset(Op386FlagLT_ULT)
1946                 return true
1947         }
1948         // match: (CMPBconst l:(ANDL x y) [0])
1949         // cond: l.Uses==1
1950         // result: (TESTB x y)
1951         for {
1952                 if auxIntToInt8(v.AuxInt) != 0 {
1953                         break
1954                 }
1955                 l := v_0
1956                 if l.Op != Op386ANDL {
1957                         break
1958                 }
1959                 y := l.Args[1]
1960                 x := l.Args[0]
1961                 if !(l.Uses == 1) {
1962                         break
1963                 }
1964                 v.reset(Op386TESTB)
1965                 v.AddArg2(x, y)
1966                 return true
1967         }
1968         // match: (CMPBconst l:(ANDLconst [c] x) [0])
1969         // cond: l.Uses==1
1970         // result: (TESTBconst [int8(c)] x)
1971         for {
1972                 if auxIntToInt8(v.AuxInt) != 0 {
1973                         break
1974                 }
1975                 l := v_0
1976                 if l.Op != Op386ANDLconst {
1977                         break
1978                 }
1979                 c := auxIntToInt32(l.AuxInt)
1980                 x := l.Args[0]
1981                 if !(l.Uses == 1) {
1982                         break
1983                 }
1984                 v.reset(Op386TESTBconst)
1985                 v.AuxInt = int8ToAuxInt(int8(c))
1986                 v.AddArg(x)
1987                 return true
1988         }
1989         // match: (CMPBconst x [0])
1990         // result: (TESTB x x)
1991         for {
1992                 if auxIntToInt8(v.AuxInt) != 0 {
1993                         break
1994                 }
1995                 x := v_0
1996                 v.reset(Op386TESTB)
1997                 v.AddArg2(x, x)
1998                 return true
1999         }
2000         // match: (CMPBconst l:(MOVBload {sym} [off] ptr mem) [c])
2001         // cond: l.Uses == 1 && clobber(l)
2002         // result: @l.Block (CMPBconstload {sym} [makeValAndOff(int32(c),off)] ptr mem)
2003         for {
2004                 c := auxIntToInt8(v.AuxInt)
2005                 l := v_0
2006                 if l.Op != Op386MOVBload {
2007                         break
2008                 }
2009                 off := auxIntToInt32(l.AuxInt)
2010                 sym := auxToSym(l.Aux)
2011                 mem := l.Args[1]
2012                 ptr := l.Args[0]
2013                 if !(l.Uses == 1 && clobber(l)) {
2014                         break
2015                 }
2016                 b = l.Block
2017                 v0 := b.NewValue0(l.Pos, Op386CMPBconstload, types.TypeFlags)
2018                 v.copyOf(v0)
2019                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off))
2020                 v0.Aux = symToAux(sym)
2021                 v0.AddArg2(ptr, mem)
2022                 return true
2023         }
2024         return false
2025 }
2026 func rewriteValue386_Op386CMPBload(v *Value) bool {
2027         v_2 := v.Args[2]
2028         v_1 := v.Args[1]
2029         v_0 := v.Args[0]
2030         // match: (CMPBload {sym} [off] ptr (MOVLconst [c]) mem)
2031         // result: (CMPBconstload {sym} [makeValAndOff(int32(int8(c)),off)] ptr mem)
2032         for {
2033                 off := auxIntToInt32(v.AuxInt)
2034                 sym := auxToSym(v.Aux)
2035                 ptr := v_0
2036                 if v_1.Op != Op386MOVLconst {
2037                         break
2038                 }
2039                 c := auxIntToInt32(v_1.AuxInt)
2040                 mem := v_2
2041                 v.reset(Op386CMPBconstload)
2042                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int8(c)), off))
2043                 v.Aux = symToAux(sym)
2044                 v.AddArg2(ptr, mem)
2045                 return true
2046         }
2047         return false
2048 }
2049 func rewriteValue386_Op386CMPL(v *Value) bool {
2050         v_1 := v.Args[1]
2051         v_0 := v.Args[0]
2052         b := v.Block
2053         // match: (CMPL x (MOVLconst [c]))
2054         // result: (CMPLconst x [c])
2055         for {
2056                 x := v_0
2057                 if v_1.Op != Op386MOVLconst {
2058                         break
2059                 }
2060                 c := auxIntToInt32(v_1.AuxInt)
2061                 v.reset(Op386CMPLconst)
2062                 v.AuxInt = int32ToAuxInt(c)
2063                 v.AddArg(x)
2064                 return true
2065         }
2066         // match: (CMPL (MOVLconst [c]) x)
2067         // result: (InvertFlags (CMPLconst x [c]))
2068         for {
2069                 if v_0.Op != Op386MOVLconst {
2070                         break
2071                 }
2072                 c := auxIntToInt32(v_0.AuxInt)
2073                 x := v_1
2074                 v.reset(Op386InvertFlags)
2075                 v0 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
2076                 v0.AuxInt = int32ToAuxInt(c)
2077                 v0.AddArg(x)
2078                 v.AddArg(v0)
2079                 return true
2080         }
2081         // match: (CMPL x y)
2082         // cond: canonLessThan(x,y)
2083         // result: (InvertFlags (CMPL y x))
2084         for {
2085                 x := v_0
2086                 y := v_1
2087                 if !(canonLessThan(x, y)) {
2088                         break
2089                 }
2090                 v.reset(Op386InvertFlags)
2091                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
2092                 v0.AddArg2(y, x)
2093                 v.AddArg(v0)
2094                 return true
2095         }
2096         // match: (CMPL l:(MOVLload {sym} [off] ptr mem) x)
2097         // cond: canMergeLoad(v, l) && clobber(l)
2098         // result: (CMPLload {sym} [off] ptr x mem)
2099         for {
2100                 l := v_0
2101                 if l.Op != Op386MOVLload {
2102                         break
2103                 }
2104                 off := auxIntToInt32(l.AuxInt)
2105                 sym := auxToSym(l.Aux)
2106                 mem := l.Args[1]
2107                 ptr := l.Args[0]
2108                 x := v_1
2109                 if !(canMergeLoad(v, l) && clobber(l)) {
2110                         break
2111                 }
2112                 v.reset(Op386CMPLload)
2113                 v.AuxInt = int32ToAuxInt(off)
2114                 v.Aux = symToAux(sym)
2115                 v.AddArg3(ptr, x, mem)
2116                 return true
2117         }
2118         // match: (CMPL x l:(MOVLload {sym} [off] ptr mem))
2119         // cond: canMergeLoad(v, l) && clobber(l)
2120         // result: (InvertFlags (CMPLload {sym} [off] ptr x mem))
2121         for {
2122                 x := v_0
2123                 l := v_1
2124                 if l.Op != Op386MOVLload {
2125                         break
2126                 }
2127                 off := auxIntToInt32(l.AuxInt)
2128                 sym := auxToSym(l.Aux)
2129                 mem := l.Args[1]
2130                 ptr := l.Args[0]
2131                 if !(canMergeLoad(v, l) && clobber(l)) {
2132                         break
2133                 }
2134                 v.reset(Op386InvertFlags)
2135                 v0 := b.NewValue0(l.Pos, Op386CMPLload, types.TypeFlags)
2136                 v0.AuxInt = int32ToAuxInt(off)
2137                 v0.Aux = symToAux(sym)
2138                 v0.AddArg3(ptr, x, mem)
2139                 v.AddArg(v0)
2140                 return true
2141         }
2142         return false
2143 }
2144 func rewriteValue386_Op386CMPLconst(v *Value) bool {
2145         v_0 := v.Args[0]
2146         b := v.Block
2147         // match: (CMPLconst (MOVLconst [x]) [y])
2148         // cond: x==y
2149         // result: (FlagEQ)
2150         for {
2151                 y := auxIntToInt32(v.AuxInt)
2152                 if v_0.Op != Op386MOVLconst {
2153                         break
2154                 }
2155                 x := auxIntToInt32(v_0.AuxInt)
2156                 if !(x == y) {
2157                         break
2158                 }
2159                 v.reset(Op386FlagEQ)
2160                 return true
2161         }
2162         // match: (CMPLconst (MOVLconst [x]) [y])
2163         // cond: x<y && uint32(x)<uint32(y)
2164         // result: (FlagLT_ULT)
2165         for {
2166                 y := auxIntToInt32(v.AuxInt)
2167                 if v_0.Op != Op386MOVLconst {
2168                         break
2169                 }
2170                 x := auxIntToInt32(v_0.AuxInt)
2171                 if !(x < y && uint32(x) < uint32(y)) {
2172                         break
2173                 }
2174                 v.reset(Op386FlagLT_ULT)
2175                 return true
2176         }
2177         // match: (CMPLconst (MOVLconst [x]) [y])
2178         // cond: x<y && uint32(x)>uint32(y)
2179         // result: (FlagLT_UGT)
2180         for {
2181                 y := auxIntToInt32(v.AuxInt)
2182                 if v_0.Op != Op386MOVLconst {
2183                         break
2184                 }
2185                 x := auxIntToInt32(v_0.AuxInt)
2186                 if !(x < y && uint32(x) > uint32(y)) {
2187                         break
2188                 }
2189                 v.reset(Op386FlagLT_UGT)
2190                 return true
2191         }
2192         // match: (CMPLconst (MOVLconst [x]) [y])
2193         // cond: x>y && uint32(x)<uint32(y)
2194         // result: (FlagGT_ULT)
2195         for {
2196                 y := auxIntToInt32(v.AuxInt)
2197                 if v_0.Op != Op386MOVLconst {
2198                         break
2199                 }
2200                 x := auxIntToInt32(v_0.AuxInt)
2201                 if !(x > y && uint32(x) < uint32(y)) {
2202                         break
2203                 }
2204                 v.reset(Op386FlagGT_ULT)
2205                 return true
2206         }
2207         // match: (CMPLconst (MOVLconst [x]) [y])
2208         // cond: x>y && uint32(x)>uint32(y)
2209         // result: (FlagGT_UGT)
2210         for {
2211                 y := auxIntToInt32(v.AuxInt)
2212                 if v_0.Op != Op386MOVLconst {
2213                         break
2214                 }
2215                 x := auxIntToInt32(v_0.AuxInt)
2216                 if !(x > y && uint32(x) > uint32(y)) {
2217                         break
2218                 }
2219                 v.reset(Op386FlagGT_UGT)
2220                 return true
2221         }
2222         // match: (CMPLconst (SHRLconst _ [c]) [n])
2223         // cond: 0 <= n && 0 < c && c <= 32 && (1<<uint64(32-c)) <= uint64(n)
2224         // result: (FlagLT_ULT)
2225         for {
2226                 n := auxIntToInt32(v.AuxInt)
2227                 if v_0.Op != Op386SHRLconst {
2228                         break
2229                 }
2230                 c := auxIntToInt32(v_0.AuxInt)
2231                 if !(0 <= n && 0 < c && c <= 32 && (1<<uint64(32-c)) <= uint64(n)) {
2232                         break
2233                 }
2234                 v.reset(Op386FlagLT_ULT)
2235                 return true
2236         }
2237         // match: (CMPLconst (ANDLconst _ [m]) [n])
2238         // cond: 0 <= m && m < n
2239         // result: (FlagLT_ULT)
2240         for {
2241                 n := auxIntToInt32(v.AuxInt)
2242                 if v_0.Op != Op386ANDLconst {
2243                         break
2244                 }
2245                 m := auxIntToInt32(v_0.AuxInt)
2246                 if !(0 <= m && m < n) {
2247                         break
2248                 }
2249                 v.reset(Op386FlagLT_ULT)
2250                 return true
2251         }
2252         // match: (CMPLconst l:(ANDL x y) [0])
2253         // cond: l.Uses==1
2254         // result: (TESTL x y)
2255         for {
2256                 if auxIntToInt32(v.AuxInt) != 0 {
2257                         break
2258                 }
2259                 l := v_0
2260                 if l.Op != Op386ANDL {
2261                         break
2262                 }
2263                 y := l.Args[1]
2264                 x := l.Args[0]
2265                 if !(l.Uses == 1) {
2266                         break
2267                 }
2268                 v.reset(Op386TESTL)
2269                 v.AddArg2(x, y)
2270                 return true
2271         }
2272         // match: (CMPLconst l:(ANDLconst [c] x) [0])
2273         // cond: l.Uses==1
2274         // result: (TESTLconst [c] x)
2275         for {
2276                 if auxIntToInt32(v.AuxInt) != 0 {
2277                         break
2278                 }
2279                 l := v_0
2280                 if l.Op != Op386ANDLconst {
2281                         break
2282                 }
2283                 c := auxIntToInt32(l.AuxInt)
2284                 x := l.Args[0]
2285                 if !(l.Uses == 1) {
2286                         break
2287                 }
2288                 v.reset(Op386TESTLconst)
2289                 v.AuxInt = int32ToAuxInt(c)
2290                 v.AddArg(x)
2291                 return true
2292         }
2293         // match: (CMPLconst x [0])
2294         // result: (TESTL x x)
2295         for {
2296                 if auxIntToInt32(v.AuxInt) != 0 {
2297                         break
2298                 }
2299                 x := v_0
2300                 v.reset(Op386TESTL)
2301                 v.AddArg2(x, x)
2302                 return true
2303         }
2304         // match: (CMPLconst l:(MOVLload {sym} [off] ptr mem) [c])
2305         // cond: l.Uses == 1 && clobber(l)
2306         // result: @l.Block (CMPLconstload {sym} [makeValAndOff(int32(c),off)] ptr mem)
2307         for {
2308                 c := auxIntToInt32(v.AuxInt)
2309                 l := v_0
2310                 if l.Op != Op386MOVLload {
2311                         break
2312                 }
2313                 off := auxIntToInt32(l.AuxInt)
2314                 sym := auxToSym(l.Aux)
2315                 mem := l.Args[1]
2316                 ptr := l.Args[0]
2317                 if !(l.Uses == 1 && clobber(l)) {
2318                         break
2319                 }
2320                 b = l.Block
2321                 v0 := b.NewValue0(l.Pos, Op386CMPLconstload, types.TypeFlags)
2322                 v.copyOf(v0)
2323                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off))
2324                 v0.Aux = symToAux(sym)
2325                 v0.AddArg2(ptr, mem)
2326                 return true
2327         }
2328         return false
2329 }
2330 func rewriteValue386_Op386CMPLload(v *Value) bool {
2331         v_2 := v.Args[2]
2332         v_1 := v.Args[1]
2333         v_0 := v.Args[0]
2334         // match: (CMPLload {sym} [off] ptr (MOVLconst [c]) mem)
2335         // result: (CMPLconstload {sym} [makeValAndOff(c,off)] ptr mem)
2336         for {
2337                 off := auxIntToInt32(v.AuxInt)
2338                 sym := auxToSym(v.Aux)
2339                 ptr := v_0
2340                 if v_1.Op != Op386MOVLconst {
2341                         break
2342                 }
2343                 c := auxIntToInt32(v_1.AuxInt)
2344                 mem := v_2
2345                 v.reset(Op386CMPLconstload)
2346                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
2347                 v.Aux = symToAux(sym)
2348                 v.AddArg2(ptr, mem)
2349                 return true
2350         }
2351         return false
2352 }
2353 func rewriteValue386_Op386CMPW(v *Value) bool {
2354         v_1 := v.Args[1]
2355         v_0 := v.Args[0]
2356         b := v.Block
2357         // match: (CMPW x (MOVLconst [c]))
2358         // result: (CMPWconst x [int16(c)])
2359         for {
2360                 x := v_0
2361                 if v_1.Op != Op386MOVLconst {
2362                         break
2363                 }
2364                 c := auxIntToInt32(v_1.AuxInt)
2365                 v.reset(Op386CMPWconst)
2366                 v.AuxInt = int16ToAuxInt(int16(c))
2367                 v.AddArg(x)
2368                 return true
2369         }
2370         // match: (CMPW (MOVLconst [c]) x)
2371         // result: (InvertFlags (CMPWconst x [int16(c)]))
2372         for {
2373                 if v_0.Op != Op386MOVLconst {
2374                         break
2375                 }
2376                 c := auxIntToInt32(v_0.AuxInt)
2377                 x := v_1
2378                 v.reset(Op386InvertFlags)
2379                 v0 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
2380                 v0.AuxInt = int16ToAuxInt(int16(c))
2381                 v0.AddArg(x)
2382                 v.AddArg(v0)
2383                 return true
2384         }
2385         // match: (CMPW x y)
2386         // cond: canonLessThan(x,y)
2387         // result: (InvertFlags (CMPW y x))
2388         for {
2389                 x := v_0
2390                 y := v_1
2391                 if !(canonLessThan(x, y)) {
2392                         break
2393                 }
2394                 v.reset(Op386InvertFlags)
2395                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
2396                 v0.AddArg2(y, x)
2397                 v.AddArg(v0)
2398                 return true
2399         }
2400         // match: (CMPW l:(MOVWload {sym} [off] ptr mem) x)
2401         // cond: canMergeLoad(v, l) && clobber(l)
2402         // result: (CMPWload {sym} [off] ptr x mem)
2403         for {
2404                 l := v_0
2405                 if l.Op != Op386MOVWload {
2406                         break
2407                 }
2408                 off := auxIntToInt32(l.AuxInt)
2409                 sym := auxToSym(l.Aux)
2410                 mem := l.Args[1]
2411                 ptr := l.Args[0]
2412                 x := v_1
2413                 if !(canMergeLoad(v, l) && clobber(l)) {
2414                         break
2415                 }
2416                 v.reset(Op386CMPWload)
2417                 v.AuxInt = int32ToAuxInt(off)
2418                 v.Aux = symToAux(sym)
2419                 v.AddArg3(ptr, x, mem)
2420                 return true
2421         }
2422         // match: (CMPW x l:(MOVWload {sym} [off] ptr mem))
2423         // cond: canMergeLoad(v, l) && clobber(l)
2424         // result: (InvertFlags (CMPWload {sym} [off] ptr x mem))
2425         for {
2426                 x := v_0
2427                 l := v_1
2428                 if l.Op != Op386MOVWload {
2429                         break
2430                 }
2431                 off := auxIntToInt32(l.AuxInt)
2432                 sym := auxToSym(l.Aux)
2433                 mem := l.Args[1]
2434                 ptr := l.Args[0]
2435                 if !(canMergeLoad(v, l) && clobber(l)) {
2436                         break
2437                 }
2438                 v.reset(Op386InvertFlags)
2439                 v0 := b.NewValue0(l.Pos, Op386CMPWload, types.TypeFlags)
2440                 v0.AuxInt = int32ToAuxInt(off)
2441                 v0.Aux = symToAux(sym)
2442                 v0.AddArg3(ptr, x, mem)
2443                 v.AddArg(v0)
2444                 return true
2445         }
2446         return false
2447 }
2448 func rewriteValue386_Op386CMPWconst(v *Value) bool {
2449         v_0 := v.Args[0]
2450         b := v.Block
2451         // match: (CMPWconst (MOVLconst [x]) [y])
2452         // cond: int16(x)==y
2453         // result: (FlagEQ)
2454         for {
2455                 y := auxIntToInt16(v.AuxInt)
2456                 if v_0.Op != Op386MOVLconst {
2457                         break
2458                 }
2459                 x := auxIntToInt32(v_0.AuxInt)
2460                 if !(int16(x) == y) {
2461                         break
2462                 }
2463                 v.reset(Op386FlagEQ)
2464                 return true
2465         }
2466         // match: (CMPWconst (MOVLconst [x]) [y])
2467         // cond: int16(x)<y && uint16(x)<uint16(y)
2468         // result: (FlagLT_ULT)
2469         for {
2470                 y := auxIntToInt16(v.AuxInt)
2471                 if v_0.Op != Op386MOVLconst {
2472                         break
2473                 }
2474                 x := auxIntToInt32(v_0.AuxInt)
2475                 if !(int16(x) < y && uint16(x) < uint16(y)) {
2476                         break
2477                 }
2478                 v.reset(Op386FlagLT_ULT)
2479                 return true
2480         }
2481         // match: (CMPWconst (MOVLconst [x]) [y])
2482         // cond: int16(x)<y && uint16(x)>uint16(y)
2483         // result: (FlagLT_UGT)
2484         for {
2485                 y := auxIntToInt16(v.AuxInt)
2486                 if v_0.Op != Op386MOVLconst {
2487                         break
2488                 }
2489                 x := auxIntToInt32(v_0.AuxInt)
2490                 if !(int16(x) < y && uint16(x) > uint16(y)) {
2491                         break
2492                 }
2493                 v.reset(Op386FlagLT_UGT)
2494                 return true
2495         }
2496         // match: (CMPWconst (MOVLconst [x]) [y])
2497         // cond: int16(x)>y && uint16(x)<uint16(y)
2498         // result: (FlagGT_ULT)
2499         for {
2500                 y := auxIntToInt16(v.AuxInt)
2501                 if v_0.Op != Op386MOVLconst {
2502                         break
2503                 }
2504                 x := auxIntToInt32(v_0.AuxInt)
2505                 if !(int16(x) > y && uint16(x) < uint16(y)) {
2506                         break
2507                 }
2508                 v.reset(Op386FlagGT_ULT)
2509                 return true
2510         }
2511         // match: (CMPWconst (MOVLconst [x]) [y])
2512         // cond: int16(x)>y && uint16(x)>uint16(y)
2513         // result: (FlagGT_UGT)
2514         for {
2515                 y := auxIntToInt16(v.AuxInt)
2516                 if v_0.Op != Op386MOVLconst {
2517                         break
2518                 }
2519                 x := auxIntToInt32(v_0.AuxInt)
2520                 if !(int16(x) > y && uint16(x) > uint16(y)) {
2521                         break
2522                 }
2523                 v.reset(Op386FlagGT_UGT)
2524                 return true
2525         }
2526         // match: (CMPWconst (ANDLconst _ [m]) [n])
2527         // cond: 0 <= int16(m) && int16(m) < n
2528         // result: (FlagLT_ULT)
2529         for {
2530                 n := auxIntToInt16(v.AuxInt)
2531                 if v_0.Op != Op386ANDLconst {
2532                         break
2533                 }
2534                 m := auxIntToInt32(v_0.AuxInt)
2535                 if !(0 <= int16(m) && int16(m) < n) {
2536                         break
2537                 }
2538                 v.reset(Op386FlagLT_ULT)
2539                 return true
2540         }
2541         // match: (CMPWconst l:(ANDL x y) [0])
2542         // cond: l.Uses==1
2543         // result: (TESTW x y)
2544         for {
2545                 if auxIntToInt16(v.AuxInt) != 0 {
2546                         break
2547                 }
2548                 l := v_0
2549                 if l.Op != Op386ANDL {
2550                         break
2551                 }
2552                 y := l.Args[1]
2553                 x := l.Args[0]
2554                 if !(l.Uses == 1) {
2555                         break
2556                 }
2557                 v.reset(Op386TESTW)
2558                 v.AddArg2(x, y)
2559                 return true
2560         }
2561         // match: (CMPWconst l:(ANDLconst [c] x) [0])
2562         // cond: l.Uses==1
2563         // result: (TESTWconst [int16(c)] x)
2564         for {
2565                 if auxIntToInt16(v.AuxInt) != 0 {
2566                         break
2567                 }
2568                 l := v_0
2569                 if l.Op != Op386ANDLconst {
2570                         break
2571                 }
2572                 c := auxIntToInt32(l.AuxInt)
2573                 x := l.Args[0]
2574                 if !(l.Uses == 1) {
2575                         break
2576                 }
2577                 v.reset(Op386TESTWconst)
2578                 v.AuxInt = int16ToAuxInt(int16(c))
2579                 v.AddArg(x)
2580                 return true
2581         }
2582         // match: (CMPWconst x [0])
2583         // result: (TESTW x x)
2584         for {
2585                 if auxIntToInt16(v.AuxInt) != 0 {
2586                         break
2587                 }
2588                 x := v_0
2589                 v.reset(Op386TESTW)
2590                 v.AddArg2(x, x)
2591                 return true
2592         }
2593         // match: (CMPWconst l:(MOVWload {sym} [off] ptr mem) [c])
2594         // cond: l.Uses == 1 && clobber(l)
2595         // result: @l.Block (CMPWconstload {sym} [makeValAndOff(int32(c),off)] ptr mem)
2596         for {
2597                 c := auxIntToInt16(v.AuxInt)
2598                 l := v_0
2599                 if l.Op != Op386MOVWload {
2600                         break
2601                 }
2602                 off := auxIntToInt32(l.AuxInt)
2603                 sym := auxToSym(l.Aux)
2604                 mem := l.Args[1]
2605                 ptr := l.Args[0]
2606                 if !(l.Uses == 1 && clobber(l)) {
2607                         break
2608                 }
2609                 b = l.Block
2610                 v0 := b.NewValue0(l.Pos, Op386CMPWconstload, types.TypeFlags)
2611                 v.copyOf(v0)
2612                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(c), off))
2613                 v0.Aux = symToAux(sym)
2614                 v0.AddArg2(ptr, mem)
2615                 return true
2616         }
2617         return false
2618 }
2619 func rewriteValue386_Op386CMPWload(v *Value) bool {
2620         v_2 := v.Args[2]
2621         v_1 := v.Args[1]
2622         v_0 := v.Args[0]
2623         // match: (CMPWload {sym} [off] ptr (MOVLconst [c]) mem)
2624         // result: (CMPWconstload {sym} [makeValAndOff(int32(int16(c)),off)] ptr mem)
2625         for {
2626                 off := auxIntToInt32(v.AuxInt)
2627                 sym := auxToSym(v.Aux)
2628                 ptr := v_0
2629                 if v_1.Op != Op386MOVLconst {
2630                         break
2631                 }
2632                 c := auxIntToInt32(v_1.AuxInt)
2633                 mem := v_2
2634                 v.reset(Op386CMPWconstload)
2635                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(int32(int16(c)), off))
2636                 v.Aux = symToAux(sym)
2637                 v.AddArg2(ptr, mem)
2638                 return true
2639         }
2640         return false
2641 }
2642 func rewriteValue386_Op386DIVSD(v *Value) bool {
2643         v_1 := v.Args[1]
2644         v_0 := v.Args[0]
2645         // match: (DIVSD x l:(MOVSDload [off] {sym} ptr mem))
2646         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
2647         // result: (DIVSDload x [off] {sym} ptr mem)
2648         for {
2649                 x := v_0
2650                 l := v_1
2651                 if l.Op != Op386MOVSDload {
2652                         break
2653                 }
2654                 off := auxIntToInt32(l.AuxInt)
2655                 sym := auxToSym(l.Aux)
2656                 mem := l.Args[1]
2657                 ptr := l.Args[0]
2658                 if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
2659                         break
2660                 }
2661                 v.reset(Op386DIVSDload)
2662                 v.AuxInt = int32ToAuxInt(off)
2663                 v.Aux = symToAux(sym)
2664                 v.AddArg3(x, ptr, mem)
2665                 return true
2666         }
2667         return false
2668 }
2669 func rewriteValue386_Op386DIVSDload(v *Value) bool {
2670         v_2 := v.Args[2]
2671         v_1 := v.Args[1]
2672         v_0 := v.Args[0]
2673         b := v.Block
2674         config := b.Func.Config
2675         // match: (DIVSDload [off1] {sym} val (ADDLconst [off2] base) mem)
2676         // cond: is32Bit(int64(off1)+int64(off2))
2677         // result: (DIVSDload [off1+off2] {sym} val base mem)
2678         for {
2679                 off1 := auxIntToInt32(v.AuxInt)
2680                 sym := auxToSym(v.Aux)
2681                 val := v_0
2682                 if v_1.Op != Op386ADDLconst {
2683                         break
2684                 }
2685                 off2 := auxIntToInt32(v_1.AuxInt)
2686                 base := v_1.Args[0]
2687                 mem := v_2
2688                 if !(is32Bit(int64(off1) + int64(off2))) {
2689                         break
2690                 }
2691                 v.reset(Op386DIVSDload)
2692                 v.AuxInt = int32ToAuxInt(off1 + off2)
2693                 v.Aux = symToAux(sym)
2694                 v.AddArg3(val, base, mem)
2695                 return true
2696         }
2697         // match: (DIVSDload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
2698         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
2699         // result: (DIVSDload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
2700         for {
2701                 off1 := auxIntToInt32(v.AuxInt)
2702                 sym1 := auxToSym(v.Aux)
2703                 val := v_0
2704                 if v_1.Op != Op386LEAL {
2705                         break
2706                 }
2707                 off2 := auxIntToInt32(v_1.AuxInt)
2708                 sym2 := auxToSym(v_1.Aux)
2709                 base := v_1.Args[0]
2710                 mem := v_2
2711                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
2712                         break
2713                 }
2714                 v.reset(Op386DIVSDload)
2715                 v.AuxInt = int32ToAuxInt(off1 + off2)
2716                 v.Aux = symToAux(mergeSym(sym1, sym2))
2717                 v.AddArg3(val, base, mem)
2718                 return true
2719         }
2720         return false
2721 }
2722 func rewriteValue386_Op386DIVSS(v *Value) bool {
2723         v_1 := v.Args[1]
2724         v_0 := v.Args[0]
2725         // match: (DIVSS x l:(MOVSSload [off] {sym} ptr mem))
2726         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
2727         // result: (DIVSSload x [off] {sym} ptr mem)
2728         for {
2729                 x := v_0
2730                 l := v_1
2731                 if l.Op != Op386MOVSSload {
2732                         break
2733                 }
2734                 off := auxIntToInt32(l.AuxInt)
2735                 sym := auxToSym(l.Aux)
2736                 mem := l.Args[1]
2737                 ptr := l.Args[0]
2738                 if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
2739                         break
2740                 }
2741                 v.reset(Op386DIVSSload)
2742                 v.AuxInt = int32ToAuxInt(off)
2743                 v.Aux = symToAux(sym)
2744                 v.AddArg3(x, ptr, mem)
2745                 return true
2746         }
2747         return false
2748 }
2749 func rewriteValue386_Op386DIVSSload(v *Value) bool {
2750         v_2 := v.Args[2]
2751         v_1 := v.Args[1]
2752         v_0 := v.Args[0]
2753         b := v.Block
2754         config := b.Func.Config
2755         // match: (DIVSSload [off1] {sym} val (ADDLconst [off2] base) mem)
2756         // cond: is32Bit(int64(off1)+int64(off2))
2757         // result: (DIVSSload [off1+off2] {sym} val base mem)
2758         for {
2759                 off1 := auxIntToInt32(v.AuxInt)
2760                 sym := auxToSym(v.Aux)
2761                 val := v_0
2762                 if v_1.Op != Op386ADDLconst {
2763                         break
2764                 }
2765                 off2 := auxIntToInt32(v_1.AuxInt)
2766                 base := v_1.Args[0]
2767                 mem := v_2
2768                 if !(is32Bit(int64(off1) + int64(off2))) {
2769                         break
2770                 }
2771                 v.reset(Op386DIVSSload)
2772                 v.AuxInt = int32ToAuxInt(off1 + off2)
2773                 v.Aux = symToAux(sym)
2774                 v.AddArg3(val, base, mem)
2775                 return true
2776         }
2777         // match: (DIVSSload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
2778         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
2779         // result: (DIVSSload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
2780         for {
2781                 off1 := auxIntToInt32(v.AuxInt)
2782                 sym1 := auxToSym(v.Aux)
2783                 val := v_0
2784                 if v_1.Op != Op386LEAL {
2785                         break
2786                 }
2787                 off2 := auxIntToInt32(v_1.AuxInt)
2788                 sym2 := auxToSym(v_1.Aux)
2789                 base := v_1.Args[0]
2790                 mem := v_2
2791                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
2792                         break
2793                 }
2794                 v.reset(Op386DIVSSload)
2795                 v.AuxInt = int32ToAuxInt(off1 + off2)
2796                 v.Aux = symToAux(mergeSym(sym1, sym2))
2797                 v.AddArg3(val, base, mem)
2798                 return true
2799         }
2800         return false
2801 }
2802 func rewriteValue386_Op386LEAL(v *Value) bool {
2803         v_0 := v.Args[0]
2804         // match: (LEAL [c] {s} (ADDLconst [d] x))
2805         // cond: is32Bit(int64(c)+int64(d))
2806         // result: (LEAL [c+d] {s} x)
2807         for {
2808                 c := auxIntToInt32(v.AuxInt)
2809                 s := auxToSym(v.Aux)
2810                 if v_0.Op != Op386ADDLconst {
2811                         break
2812                 }
2813                 d := auxIntToInt32(v_0.AuxInt)
2814                 x := v_0.Args[0]
2815                 if !(is32Bit(int64(c) + int64(d))) {
2816                         break
2817                 }
2818                 v.reset(Op386LEAL)
2819                 v.AuxInt = int32ToAuxInt(c + d)
2820                 v.Aux = symToAux(s)
2821                 v.AddArg(x)
2822                 return true
2823         }
2824         // match: (LEAL [c] {s} (ADDL x y))
2825         // cond: x.Op != OpSB && y.Op != OpSB
2826         // result: (LEAL1 [c] {s} x y)
2827         for {
2828                 c := auxIntToInt32(v.AuxInt)
2829                 s := auxToSym(v.Aux)
2830                 if v_0.Op != Op386ADDL {
2831                         break
2832                 }
2833                 _ = v_0.Args[1]
2834                 v_0_0 := v_0.Args[0]
2835                 v_0_1 := v_0.Args[1]
2836                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
2837                         x := v_0_0
2838                         y := v_0_1
2839                         if !(x.Op != OpSB && y.Op != OpSB) {
2840                                 continue
2841                         }
2842                         v.reset(Op386LEAL1)
2843                         v.AuxInt = int32ToAuxInt(c)
2844                         v.Aux = symToAux(s)
2845                         v.AddArg2(x, y)
2846                         return true
2847                 }
2848                 break
2849         }
2850         // match: (LEAL [off1] {sym1} (LEAL [off2] {sym2} x))
2851         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
2852         // result: (LEAL [off1+off2] {mergeSym(sym1,sym2)} x)
2853         for {
2854                 off1 := auxIntToInt32(v.AuxInt)
2855                 sym1 := auxToSym(v.Aux)
2856                 if v_0.Op != Op386LEAL {
2857                         break
2858                 }
2859                 off2 := auxIntToInt32(v_0.AuxInt)
2860                 sym2 := auxToSym(v_0.Aux)
2861                 x := v_0.Args[0]
2862                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
2863                         break
2864                 }
2865                 v.reset(Op386LEAL)
2866                 v.AuxInt = int32ToAuxInt(off1 + off2)
2867                 v.Aux = symToAux(mergeSym(sym1, sym2))
2868                 v.AddArg(x)
2869                 return true
2870         }
2871         // match: (LEAL [off1] {sym1} (LEAL1 [off2] {sym2} x y))
2872         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
2873         // result: (LEAL1 [off1+off2] {mergeSym(sym1,sym2)} x y)
2874         for {
2875                 off1 := auxIntToInt32(v.AuxInt)
2876                 sym1 := auxToSym(v.Aux)
2877                 if v_0.Op != Op386LEAL1 {
2878                         break
2879                 }
2880                 off2 := auxIntToInt32(v_0.AuxInt)
2881                 sym2 := auxToSym(v_0.Aux)
2882                 y := v_0.Args[1]
2883                 x := v_0.Args[0]
2884                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
2885                         break
2886                 }
2887                 v.reset(Op386LEAL1)
2888                 v.AuxInt = int32ToAuxInt(off1 + off2)
2889                 v.Aux = symToAux(mergeSym(sym1, sym2))
2890                 v.AddArg2(x, y)
2891                 return true
2892         }
2893         // match: (LEAL [off1] {sym1} (LEAL2 [off2] {sym2} x y))
2894         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
2895         // result: (LEAL2 [off1+off2] {mergeSym(sym1,sym2)} x y)
2896         for {
2897                 off1 := auxIntToInt32(v.AuxInt)
2898                 sym1 := auxToSym(v.Aux)
2899                 if v_0.Op != Op386LEAL2 {
2900                         break
2901                 }
2902                 off2 := auxIntToInt32(v_0.AuxInt)
2903                 sym2 := auxToSym(v_0.Aux)
2904                 y := v_0.Args[1]
2905                 x := v_0.Args[0]
2906                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
2907                         break
2908                 }
2909                 v.reset(Op386LEAL2)
2910                 v.AuxInt = int32ToAuxInt(off1 + off2)
2911                 v.Aux = symToAux(mergeSym(sym1, sym2))
2912                 v.AddArg2(x, y)
2913                 return true
2914         }
2915         // match: (LEAL [off1] {sym1} (LEAL4 [off2] {sym2} x y))
2916         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
2917         // result: (LEAL4 [off1+off2] {mergeSym(sym1,sym2)} x y)
2918         for {
2919                 off1 := auxIntToInt32(v.AuxInt)
2920                 sym1 := auxToSym(v.Aux)
2921                 if v_0.Op != Op386LEAL4 {
2922                         break
2923                 }
2924                 off2 := auxIntToInt32(v_0.AuxInt)
2925                 sym2 := auxToSym(v_0.Aux)
2926                 y := v_0.Args[1]
2927                 x := v_0.Args[0]
2928                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
2929                         break
2930                 }
2931                 v.reset(Op386LEAL4)
2932                 v.AuxInt = int32ToAuxInt(off1 + off2)
2933                 v.Aux = symToAux(mergeSym(sym1, sym2))
2934                 v.AddArg2(x, y)
2935                 return true
2936         }
2937         // match: (LEAL [off1] {sym1} (LEAL8 [off2] {sym2} x y))
2938         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
2939         // result: (LEAL8 [off1+off2] {mergeSym(sym1,sym2)} x y)
2940         for {
2941                 off1 := auxIntToInt32(v.AuxInt)
2942                 sym1 := auxToSym(v.Aux)
2943                 if v_0.Op != Op386LEAL8 {
2944                         break
2945                 }
2946                 off2 := auxIntToInt32(v_0.AuxInt)
2947                 sym2 := auxToSym(v_0.Aux)
2948                 y := v_0.Args[1]
2949                 x := v_0.Args[0]
2950                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
2951                         break
2952                 }
2953                 v.reset(Op386LEAL8)
2954                 v.AuxInt = int32ToAuxInt(off1 + off2)
2955                 v.Aux = symToAux(mergeSym(sym1, sym2))
2956                 v.AddArg2(x, y)
2957                 return true
2958         }
2959         return false
2960 }
2961 func rewriteValue386_Op386LEAL1(v *Value) bool {
2962         v_1 := v.Args[1]
2963         v_0 := v.Args[0]
2964         // match: (LEAL1 [c] {s} (ADDLconst [d] x) y)
2965         // cond: is32Bit(int64(c)+int64(d)) && x.Op != OpSB
2966         // result: (LEAL1 [c+d] {s} x y)
2967         for {
2968                 c := auxIntToInt32(v.AuxInt)
2969                 s := auxToSym(v.Aux)
2970                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
2971                         if v_0.Op != Op386ADDLconst {
2972                                 continue
2973                         }
2974                         d := auxIntToInt32(v_0.AuxInt)
2975                         x := v_0.Args[0]
2976                         y := v_1
2977                         if !(is32Bit(int64(c)+int64(d)) && x.Op != OpSB) {
2978                                 continue
2979                         }
2980                         v.reset(Op386LEAL1)
2981                         v.AuxInt = int32ToAuxInt(c + d)
2982                         v.Aux = symToAux(s)
2983                         v.AddArg2(x, y)
2984                         return true
2985                 }
2986                 break
2987         }
2988         // match: (LEAL1 [c] {s} x (SHLLconst [1] y))
2989         // result: (LEAL2 [c] {s} x y)
2990         for {
2991                 c := auxIntToInt32(v.AuxInt)
2992                 s := auxToSym(v.Aux)
2993                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
2994                         x := v_0
2995                         if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 1 {
2996                                 continue
2997                         }
2998                         y := v_1.Args[0]
2999                         v.reset(Op386LEAL2)
3000                         v.AuxInt = int32ToAuxInt(c)
3001                         v.Aux = symToAux(s)
3002                         v.AddArg2(x, y)
3003                         return true
3004                 }
3005                 break
3006         }
3007         // match: (LEAL1 [c] {s} x (SHLLconst [2] y))
3008         // result: (LEAL4 [c] {s} x y)
3009         for {
3010                 c := auxIntToInt32(v.AuxInt)
3011                 s := auxToSym(v.Aux)
3012                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3013                         x := v_0
3014                         if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 2 {
3015                                 continue
3016                         }
3017                         y := v_1.Args[0]
3018                         v.reset(Op386LEAL4)
3019                         v.AuxInt = int32ToAuxInt(c)
3020                         v.Aux = symToAux(s)
3021                         v.AddArg2(x, y)
3022                         return true
3023                 }
3024                 break
3025         }
3026         // match: (LEAL1 [c] {s} x (SHLLconst [3] y))
3027         // result: (LEAL8 [c] {s} x y)
3028         for {
3029                 c := auxIntToInt32(v.AuxInt)
3030                 s := auxToSym(v.Aux)
3031                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3032                         x := v_0
3033                         if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 3 {
3034                                 continue
3035                         }
3036                         y := v_1.Args[0]
3037                         v.reset(Op386LEAL8)
3038                         v.AuxInt = int32ToAuxInt(c)
3039                         v.Aux = symToAux(s)
3040                         v.AddArg2(x, y)
3041                         return true
3042                 }
3043                 break
3044         }
3045         // match: (LEAL1 [off1] {sym1} (LEAL [off2] {sym2} x) y)
3046         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB
3047         // result: (LEAL1 [off1+off2] {mergeSym(sym1,sym2)} x y)
3048         for {
3049                 off1 := auxIntToInt32(v.AuxInt)
3050                 sym1 := auxToSym(v.Aux)
3051                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3052                         if v_0.Op != Op386LEAL {
3053                                 continue
3054                         }
3055                         off2 := auxIntToInt32(v_0.AuxInt)
3056                         sym2 := auxToSym(v_0.Aux)
3057                         x := v_0.Args[0]
3058                         y := v_1
3059                         if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
3060                                 continue
3061                         }
3062                         v.reset(Op386LEAL1)
3063                         v.AuxInt = int32ToAuxInt(off1 + off2)
3064                         v.Aux = symToAux(mergeSym(sym1, sym2))
3065                         v.AddArg2(x, y)
3066                         return true
3067                 }
3068                 break
3069         }
3070         // match: (LEAL1 [off1] {sym1} x (LEAL1 [off2] {sym2} y y))
3071         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
3072         // result: (LEAL2 [off1+off2] {mergeSym(sym1, sym2)} x y)
3073         for {
3074                 off1 := auxIntToInt32(v.AuxInt)
3075                 sym1 := auxToSym(v.Aux)
3076                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3077                         x := v_0
3078                         if v_1.Op != Op386LEAL1 {
3079                                 continue
3080                         }
3081                         off2 := auxIntToInt32(v_1.AuxInt)
3082                         sym2 := auxToSym(v_1.Aux)
3083                         y := v_1.Args[1]
3084                         if y != v_1.Args[0] || !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
3085                                 continue
3086                         }
3087                         v.reset(Op386LEAL2)
3088                         v.AuxInt = int32ToAuxInt(off1 + off2)
3089                         v.Aux = symToAux(mergeSym(sym1, sym2))
3090                         v.AddArg2(x, y)
3091                         return true
3092                 }
3093                 break
3094         }
3095         // match: (LEAL1 [off1] {sym1} x (LEAL1 [off2] {sym2} x y))
3096         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)
3097         // result: (LEAL2 [off1+off2] {mergeSym(sym1, sym2)} y x)
3098         for {
3099                 off1 := auxIntToInt32(v.AuxInt)
3100                 sym1 := auxToSym(v.Aux)
3101                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3102                         x := v_0
3103                         if v_1.Op != Op386LEAL1 {
3104                                 continue
3105                         }
3106                         off2 := auxIntToInt32(v_1.AuxInt)
3107                         sym2 := auxToSym(v_1.Aux)
3108                         _ = v_1.Args[1]
3109                         v_1_0 := v_1.Args[0]
3110                         v_1_1 := v_1.Args[1]
3111                         for _i1 := 0; _i1 <= 1; _i1, v_1_0, v_1_1 = _i1+1, v_1_1, v_1_0 {
3112                                 if x != v_1_0 {
3113                                         continue
3114                                 }
3115                                 y := v_1_1
3116                                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2)) {
3117                                         continue
3118                                 }
3119                                 v.reset(Op386LEAL2)
3120                                 v.AuxInt = int32ToAuxInt(off1 + off2)
3121                                 v.Aux = symToAux(mergeSym(sym1, sym2))
3122                                 v.AddArg2(y, x)
3123                                 return true
3124                         }
3125                 }
3126                 break
3127         }
3128         // match: (LEAL1 [0] {nil} x y)
3129         // result: (ADDL x y)
3130         for {
3131                 if auxIntToInt32(v.AuxInt) != 0 || auxToSym(v.Aux) != nil {
3132                         break
3133                 }
3134                 x := v_0
3135                 y := v_1
3136                 v.reset(Op386ADDL)
3137                 v.AddArg2(x, y)
3138                 return true
3139         }
3140         return false
3141 }
3142 func rewriteValue386_Op386LEAL2(v *Value) bool {
3143         v_1 := v.Args[1]
3144         v_0 := v.Args[0]
3145         // match: (LEAL2 [c] {s} (ADDLconst [d] x) y)
3146         // cond: is32Bit(int64(c)+int64(d)) && x.Op != OpSB
3147         // result: (LEAL2 [c+d] {s} x y)
3148         for {
3149                 c := auxIntToInt32(v.AuxInt)
3150                 s := auxToSym(v.Aux)
3151                 if v_0.Op != Op386ADDLconst {
3152                         break
3153                 }
3154                 d := auxIntToInt32(v_0.AuxInt)
3155                 x := v_0.Args[0]
3156                 y := v_1
3157                 if !(is32Bit(int64(c)+int64(d)) && x.Op != OpSB) {
3158                         break
3159                 }
3160                 v.reset(Op386LEAL2)
3161                 v.AuxInt = int32ToAuxInt(c + d)
3162                 v.Aux = symToAux(s)
3163                 v.AddArg2(x, y)
3164                 return true
3165         }
3166         // match: (LEAL2 [c] {s} x (ADDLconst [d] y))
3167         // cond: is32Bit(int64(c)+2*int64(d)) && y.Op != OpSB
3168         // result: (LEAL2 [c+2*d] {s} x y)
3169         for {
3170                 c := auxIntToInt32(v.AuxInt)
3171                 s := auxToSym(v.Aux)
3172                 x := v_0
3173                 if v_1.Op != Op386ADDLconst {
3174                         break
3175                 }
3176                 d := auxIntToInt32(v_1.AuxInt)
3177                 y := v_1.Args[0]
3178                 if !(is32Bit(int64(c)+2*int64(d)) && y.Op != OpSB) {
3179                         break
3180                 }
3181                 v.reset(Op386LEAL2)
3182                 v.AuxInt = int32ToAuxInt(c + 2*d)
3183                 v.Aux = symToAux(s)
3184                 v.AddArg2(x, y)
3185                 return true
3186         }
3187         // match: (LEAL2 [c] {s} x (SHLLconst [1] y))
3188         // result: (LEAL4 [c] {s} x y)
3189         for {
3190                 c := auxIntToInt32(v.AuxInt)
3191                 s := auxToSym(v.Aux)
3192                 x := v_0
3193                 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 1 {
3194                         break
3195                 }
3196                 y := v_1.Args[0]
3197                 v.reset(Op386LEAL4)
3198                 v.AuxInt = int32ToAuxInt(c)
3199                 v.Aux = symToAux(s)
3200                 v.AddArg2(x, y)
3201                 return true
3202         }
3203         // match: (LEAL2 [c] {s} x (SHLLconst [2] y))
3204         // result: (LEAL8 [c] {s} x y)
3205         for {
3206                 c := auxIntToInt32(v.AuxInt)
3207                 s := auxToSym(v.Aux)
3208                 x := v_0
3209                 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 2 {
3210                         break
3211                 }
3212                 y := v_1.Args[0]
3213                 v.reset(Op386LEAL8)
3214                 v.AuxInt = int32ToAuxInt(c)
3215                 v.Aux = symToAux(s)
3216                 v.AddArg2(x, y)
3217                 return true
3218         }
3219         // match: (LEAL2 [off1] {sym1} (LEAL [off2] {sym2} x) y)
3220         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB
3221         // result: (LEAL2 [off1+off2] {mergeSym(sym1,sym2)} x y)
3222         for {
3223                 off1 := auxIntToInt32(v.AuxInt)
3224                 sym1 := auxToSym(v.Aux)
3225                 if v_0.Op != Op386LEAL {
3226                         break
3227                 }
3228                 off2 := auxIntToInt32(v_0.AuxInt)
3229                 sym2 := auxToSym(v_0.Aux)
3230                 x := v_0.Args[0]
3231                 y := v_1
3232                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
3233                         break
3234                 }
3235                 v.reset(Op386LEAL2)
3236                 v.AuxInt = int32ToAuxInt(off1 + off2)
3237                 v.Aux = symToAux(mergeSym(sym1, sym2))
3238                 v.AddArg2(x, y)
3239                 return true
3240         }
3241         // match: (LEAL2 [off1] {sym} x (LEAL1 [off2] {nil} y y))
3242         // cond: is32Bit(int64(off1)+2*int64(off2))
3243         // result: (LEAL4 [off1+2*off2] {sym} x y)
3244         for {
3245                 off1 := auxIntToInt32(v.AuxInt)
3246                 sym := auxToSym(v.Aux)
3247                 x := v_0
3248                 if v_1.Op != Op386LEAL1 {
3249                         break
3250                 }
3251                 off2 := auxIntToInt32(v_1.AuxInt)
3252                 if auxToSym(v_1.Aux) != nil {
3253                         break
3254                 }
3255                 y := v_1.Args[1]
3256                 if y != v_1.Args[0] || !(is32Bit(int64(off1) + 2*int64(off2))) {
3257                         break
3258                 }
3259                 v.reset(Op386LEAL4)
3260                 v.AuxInt = int32ToAuxInt(off1 + 2*off2)
3261                 v.Aux = symToAux(sym)
3262                 v.AddArg2(x, y)
3263                 return true
3264         }
3265         return false
3266 }
3267 func rewriteValue386_Op386LEAL4(v *Value) bool {
3268         v_1 := v.Args[1]
3269         v_0 := v.Args[0]
3270         // match: (LEAL4 [c] {s} (ADDLconst [d] x) y)
3271         // cond: is32Bit(int64(c)+int64(d)) && x.Op != OpSB
3272         // result: (LEAL4 [c+d] {s} x y)
3273         for {
3274                 c := auxIntToInt32(v.AuxInt)
3275                 s := auxToSym(v.Aux)
3276                 if v_0.Op != Op386ADDLconst {
3277                         break
3278                 }
3279                 d := auxIntToInt32(v_0.AuxInt)
3280                 x := v_0.Args[0]
3281                 y := v_1
3282                 if !(is32Bit(int64(c)+int64(d)) && x.Op != OpSB) {
3283                         break
3284                 }
3285                 v.reset(Op386LEAL4)
3286                 v.AuxInt = int32ToAuxInt(c + d)
3287                 v.Aux = symToAux(s)
3288                 v.AddArg2(x, y)
3289                 return true
3290         }
3291         // match: (LEAL4 [c] {s} x (ADDLconst [d] y))
3292         // cond: is32Bit(int64(c)+4*int64(d)) && y.Op != OpSB
3293         // result: (LEAL4 [c+4*d] {s} x y)
3294         for {
3295                 c := auxIntToInt32(v.AuxInt)
3296                 s := auxToSym(v.Aux)
3297                 x := v_0
3298                 if v_1.Op != Op386ADDLconst {
3299                         break
3300                 }
3301                 d := auxIntToInt32(v_1.AuxInt)
3302                 y := v_1.Args[0]
3303                 if !(is32Bit(int64(c)+4*int64(d)) && y.Op != OpSB) {
3304                         break
3305                 }
3306                 v.reset(Op386LEAL4)
3307                 v.AuxInt = int32ToAuxInt(c + 4*d)
3308                 v.Aux = symToAux(s)
3309                 v.AddArg2(x, y)
3310                 return true
3311         }
3312         // match: (LEAL4 [c] {s} x (SHLLconst [1] y))
3313         // result: (LEAL8 [c] {s} x y)
3314         for {
3315                 c := auxIntToInt32(v.AuxInt)
3316                 s := auxToSym(v.Aux)
3317                 x := v_0
3318                 if v_1.Op != Op386SHLLconst || auxIntToInt32(v_1.AuxInt) != 1 {
3319                         break
3320                 }
3321                 y := v_1.Args[0]
3322                 v.reset(Op386LEAL8)
3323                 v.AuxInt = int32ToAuxInt(c)
3324                 v.Aux = symToAux(s)
3325                 v.AddArg2(x, y)
3326                 return true
3327         }
3328         // match: (LEAL4 [off1] {sym1} (LEAL [off2] {sym2} x) y)
3329         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB
3330         // result: (LEAL4 [off1+off2] {mergeSym(sym1,sym2)} x y)
3331         for {
3332                 off1 := auxIntToInt32(v.AuxInt)
3333                 sym1 := auxToSym(v.Aux)
3334                 if v_0.Op != Op386LEAL {
3335                         break
3336                 }
3337                 off2 := auxIntToInt32(v_0.AuxInt)
3338                 sym2 := auxToSym(v_0.Aux)
3339                 x := v_0.Args[0]
3340                 y := v_1
3341                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
3342                         break
3343                 }
3344                 v.reset(Op386LEAL4)
3345                 v.AuxInt = int32ToAuxInt(off1 + off2)
3346                 v.Aux = symToAux(mergeSym(sym1, sym2))
3347                 v.AddArg2(x, y)
3348                 return true
3349         }
3350         // match: (LEAL4 [off1] {sym} x (LEAL1 [off2] {nil} y y))
3351         // cond: is32Bit(int64(off1)+4*int64(off2))
3352         // result: (LEAL8 [off1+4*off2] {sym} x y)
3353         for {
3354                 off1 := auxIntToInt32(v.AuxInt)
3355                 sym := auxToSym(v.Aux)
3356                 x := v_0
3357                 if v_1.Op != Op386LEAL1 {
3358                         break
3359                 }
3360                 off2 := auxIntToInt32(v_1.AuxInt)
3361                 if auxToSym(v_1.Aux) != nil {
3362                         break
3363                 }
3364                 y := v_1.Args[1]
3365                 if y != v_1.Args[0] || !(is32Bit(int64(off1) + 4*int64(off2))) {
3366                         break
3367                 }
3368                 v.reset(Op386LEAL8)
3369                 v.AuxInt = int32ToAuxInt(off1 + 4*off2)
3370                 v.Aux = symToAux(sym)
3371                 v.AddArg2(x, y)
3372                 return true
3373         }
3374         return false
3375 }
3376 func rewriteValue386_Op386LEAL8(v *Value) bool {
3377         v_1 := v.Args[1]
3378         v_0 := v.Args[0]
3379         // match: (LEAL8 [c] {s} (ADDLconst [d] x) y)
3380         // cond: is32Bit(int64(c)+int64(d)) && x.Op != OpSB
3381         // result: (LEAL8 [c+d] {s} x y)
3382         for {
3383                 c := auxIntToInt32(v.AuxInt)
3384                 s := auxToSym(v.Aux)
3385                 if v_0.Op != Op386ADDLconst {
3386                         break
3387                 }
3388                 d := auxIntToInt32(v_0.AuxInt)
3389                 x := v_0.Args[0]
3390                 y := v_1
3391                 if !(is32Bit(int64(c)+int64(d)) && x.Op != OpSB) {
3392                         break
3393                 }
3394                 v.reset(Op386LEAL8)
3395                 v.AuxInt = int32ToAuxInt(c + d)
3396                 v.Aux = symToAux(s)
3397                 v.AddArg2(x, y)
3398                 return true
3399         }
3400         // match: (LEAL8 [c] {s} x (ADDLconst [d] y))
3401         // cond: is32Bit(int64(c)+8*int64(d)) && y.Op != OpSB
3402         // result: (LEAL8 [c+8*d] {s} x y)
3403         for {
3404                 c := auxIntToInt32(v.AuxInt)
3405                 s := auxToSym(v.Aux)
3406                 x := v_0
3407                 if v_1.Op != Op386ADDLconst {
3408                         break
3409                 }
3410                 d := auxIntToInt32(v_1.AuxInt)
3411                 y := v_1.Args[0]
3412                 if !(is32Bit(int64(c)+8*int64(d)) && y.Op != OpSB) {
3413                         break
3414                 }
3415                 v.reset(Op386LEAL8)
3416                 v.AuxInt = int32ToAuxInt(c + 8*d)
3417                 v.Aux = symToAux(s)
3418                 v.AddArg2(x, y)
3419                 return true
3420         }
3421         // match: (LEAL8 [off1] {sym1} (LEAL [off2] {sym2} x) y)
3422         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB
3423         // result: (LEAL8 [off1+off2] {mergeSym(sym1,sym2)} x y)
3424         for {
3425                 off1 := auxIntToInt32(v.AuxInt)
3426                 sym1 := auxToSym(v.Aux)
3427                 if v_0.Op != Op386LEAL {
3428                         break
3429                 }
3430                 off2 := auxIntToInt32(v_0.AuxInt)
3431                 sym2 := auxToSym(v_0.Aux)
3432                 x := v_0.Args[0]
3433                 y := v_1
3434                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && x.Op != OpSB) {
3435                         break
3436                 }
3437                 v.reset(Op386LEAL8)
3438                 v.AuxInt = int32ToAuxInt(off1 + off2)
3439                 v.Aux = symToAux(mergeSym(sym1, sym2))
3440                 v.AddArg2(x, y)
3441                 return true
3442         }
3443         return false
3444 }
3445 func rewriteValue386_Op386MOVBLSX(v *Value) bool {
3446         v_0 := v.Args[0]
3447         b := v.Block
3448         // match: (MOVBLSX x:(MOVBload [off] {sym} ptr mem))
3449         // cond: x.Uses == 1 && clobber(x)
3450         // result: @x.Block (MOVBLSXload <v.Type> [off] {sym} ptr mem)
3451         for {
3452                 x := v_0
3453                 if x.Op != Op386MOVBload {
3454                         break
3455                 }
3456                 off := auxIntToInt32(x.AuxInt)
3457                 sym := auxToSym(x.Aux)
3458                 mem := x.Args[1]
3459                 ptr := x.Args[0]
3460                 if !(x.Uses == 1 && clobber(x)) {
3461                         break
3462                 }
3463                 b = x.Block
3464                 v0 := b.NewValue0(x.Pos, Op386MOVBLSXload, v.Type)
3465                 v.copyOf(v0)
3466                 v0.AuxInt = int32ToAuxInt(off)
3467                 v0.Aux = symToAux(sym)
3468                 v0.AddArg2(ptr, mem)
3469                 return true
3470         }
3471         // match: (MOVBLSX (ANDLconst [c] x))
3472         // cond: c & 0x80 == 0
3473         // result: (ANDLconst [c & 0x7f] x)
3474         for {
3475                 if v_0.Op != Op386ANDLconst {
3476                         break
3477                 }
3478                 c := auxIntToInt32(v_0.AuxInt)
3479                 x := v_0.Args[0]
3480                 if !(c&0x80 == 0) {
3481                         break
3482                 }
3483                 v.reset(Op386ANDLconst)
3484                 v.AuxInt = int32ToAuxInt(c & 0x7f)
3485                 v.AddArg(x)
3486                 return true
3487         }
3488         return false
3489 }
3490 func rewriteValue386_Op386MOVBLSXload(v *Value) bool {
3491         v_1 := v.Args[1]
3492         v_0 := v.Args[0]
3493         b := v.Block
3494         config := b.Func.Config
3495         // match: (MOVBLSXload [off] {sym} ptr (MOVBstore [off2] {sym2} ptr2 x _))
3496         // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
3497         // result: (MOVBLSX x)
3498         for {
3499                 off := auxIntToInt32(v.AuxInt)
3500                 sym := auxToSym(v.Aux)
3501                 ptr := v_0
3502                 if v_1.Op != Op386MOVBstore {
3503                         break
3504                 }
3505                 off2 := auxIntToInt32(v_1.AuxInt)
3506                 sym2 := auxToSym(v_1.Aux)
3507                 x := v_1.Args[1]
3508                 ptr2 := v_1.Args[0]
3509                 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
3510                         break
3511                 }
3512                 v.reset(Op386MOVBLSX)
3513                 v.AddArg(x)
3514                 return true
3515         }
3516         // match: (MOVBLSXload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
3517         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
3518         // result: (MOVBLSXload [off1+off2] {mergeSym(sym1,sym2)} base mem)
3519         for {
3520                 off1 := auxIntToInt32(v.AuxInt)
3521                 sym1 := auxToSym(v.Aux)
3522                 if v_0.Op != Op386LEAL {
3523                         break
3524                 }
3525                 off2 := auxIntToInt32(v_0.AuxInt)
3526                 sym2 := auxToSym(v_0.Aux)
3527                 base := v_0.Args[0]
3528                 mem := v_1
3529                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
3530                         break
3531                 }
3532                 v.reset(Op386MOVBLSXload)
3533                 v.AuxInt = int32ToAuxInt(off1 + off2)
3534                 v.Aux = symToAux(mergeSym(sym1, sym2))
3535                 v.AddArg2(base, mem)
3536                 return true
3537         }
3538         return false
3539 }
3540 func rewriteValue386_Op386MOVBLZX(v *Value) bool {
3541         v_0 := v.Args[0]
3542         b := v.Block
3543         // match: (MOVBLZX x:(MOVBload [off] {sym} ptr mem))
3544         // cond: x.Uses == 1 && clobber(x)
3545         // result: @x.Block (MOVBload <v.Type> [off] {sym} ptr mem)
3546         for {
3547                 x := v_0
3548                 if x.Op != Op386MOVBload {
3549                         break
3550                 }
3551                 off := auxIntToInt32(x.AuxInt)
3552                 sym := auxToSym(x.Aux)
3553                 mem := x.Args[1]
3554                 ptr := x.Args[0]
3555                 if !(x.Uses == 1 && clobber(x)) {
3556                         break
3557                 }
3558                 b = x.Block
3559                 v0 := b.NewValue0(x.Pos, Op386MOVBload, v.Type)
3560                 v.copyOf(v0)
3561                 v0.AuxInt = int32ToAuxInt(off)
3562                 v0.Aux = symToAux(sym)
3563                 v0.AddArg2(ptr, mem)
3564                 return true
3565         }
3566         // match: (MOVBLZX (ANDLconst [c] x))
3567         // result: (ANDLconst [c & 0xff] x)
3568         for {
3569                 if v_0.Op != Op386ANDLconst {
3570                         break
3571                 }
3572                 c := auxIntToInt32(v_0.AuxInt)
3573                 x := v_0.Args[0]
3574                 v.reset(Op386ANDLconst)
3575                 v.AuxInt = int32ToAuxInt(c & 0xff)
3576                 v.AddArg(x)
3577                 return true
3578         }
3579         return false
3580 }
3581 func rewriteValue386_Op386MOVBload(v *Value) bool {
3582         v_1 := v.Args[1]
3583         v_0 := v.Args[0]
3584         b := v.Block
3585         config := b.Func.Config
3586         // match: (MOVBload [off] {sym} ptr (MOVBstore [off2] {sym2} ptr2 x _))
3587         // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
3588         // result: (MOVBLZX x)
3589         for {
3590                 off := auxIntToInt32(v.AuxInt)
3591                 sym := auxToSym(v.Aux)
3592                 ptr := v_0
3593                 if v_1.Op != Op386MOVBstore {
3594                         break
3595                 }
3596                 off2 := auxIntToInt32(v_1.AuxInt)
3597                 sym2 := auxToSym(v_1.Aux)
3598                 x := v_1.Args[1]
3599                 ptr2 := v_1.Args[0]
3600                 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
3601                         break
3602                 }
3603                 v.reset(Op386MOVBLZX)
3604                 v.AddArg(x)
3605                 return true
3606         }
3607         // match: (MOVBload [off1] {sym} (ADDLconst [off2] ptr) mem)
3608         // cond: is32Bit(int64(off1)+int64(off2))
3609         // result: (MOVBload [off1+off2] {sym} ptr mem)
3610         for {
3611                 off1 := auxIntToInt32(v.AuxInt)
3612                 sym := auxToSym(v.Aux)
3613                 if v_0.Op != Op386ADDLconst {
3614                         break
3615                 }
3616                 off2 := auxIntToInt32(v_0.AuxInt)
3617                 ptr := v_0.Args[0]
3618                 mem := v_1
3619                 if !(is32Bit(int64(off1) + int64(off2))) {
3620                         break
3621                 }
3622                 v.reset(Op386MOVBload)
3623                 v.AuxInt = int32ToAuxInt(off1 + off2)
3624                 v.Aux = symToAux(sym)
3625                 v.AddArg2(ptr, mem)
3626                 return true
3627         }
3628         // match: (MOVBload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
3629         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
3630         // result: (MOVBload [off1+off2] {mergeSym(sym1,sym2)} base mem)
3631         for {
3632                 off1 := auxIntToInt32(v.AuxInt)
3633                 sym1 := auxToSym(v.Aux)
3634                 if v_0.Op != Op386LEAL {
3635                         break
3636                 }
3637                 off2 := auxIntToInt32(v_0.AuxInt)
3638                 sym2 := auxToSym(v_0.Aux)
3639                 base := v_0.Args[0]
3640                 mem := v_1
3641                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
3642                         break
3643                 }
3644                 v.reset(Op386MOVBload)
3645                 v.AuxInt = int32ToAuxInt(off1 + off2)
3646                 v.Aux = symToAux(mergeSym(sym1, sym2))
3647                 v.AddArg2(base, mem)
3648                 return true
3649         }
3650         // match: (MOVBload [off] {sym} (SB) _)
3651         // cond: symIsRO(sym)
3652         // result: (MOVLconst [int32(read8(sym, int64(off)))])
3653         for {
3654                 off := auxIntToInt32(v.AuxInt)
3655                 sym := auxToSym(v.Aux)
3656                 if v_0.Op != OpSB || !(symIsRO(sym)) {
3657                         break
3658                 }
3659                 v.reset(Op386MOVLconst)
3660                 v.AuxInt = int32ToAuxInt(int32(read8(sym, int64(off))))
3661                 return true
3662         }
3663         return false
3664 }
3665 func rewriteValue386_Op386MOVBstore(v *Value) bool {
3666         v_2 := v.Args[2]
3667         v_1 := v.Args[1]
3668         v_0 := v.Args[0]
3669         b := v.Block
3670         config := b.Func.Config
3671         // match: (MOVBstore [off] {sym} ptr (MOVBLSX x) mem)
3672         // result: (MOVBstore [off] {sym} ptr x mem)
3673         for {
3674                 off := auxIntToInt32(v.AuxInt)
3675                 sym := auxToSym(v.Aux)
3676                 ptr := v_0
3677                 if v_1.Op != Op386MOVBLSX {
3678                         break
3679                 }
3680                 x := v_1.Args[0]
3681                 mem := v_2
3682                 v.reset(Op386MOVBstore)
3683                 v.AuxInt = int32ToAuxInt(off)
3684                 v.Aux = symToAux(sym)
3685                 v.AddArg3(ptr, x, mem)
3686                 return true
3687         }
3688         // match: (MOVBstore [off] {sym} ptr (MOVBLZX x) mem)
3689         // result: (MOVBstore [off] {sym} ptr x mem)
3690         for {
3691                 off := auxIntToInt32(v.AuxInt)
3692                 sym := auxToSym(v.Aux)
3693                 ptr := v_0
3694                 if v_1.Op != Op386MOVBLZX {
3695                         break
3696                 }
3697                 x := v_1.Args[0]
3698                 mem := v_2
3699                 v.reset(Op386MOVBstore)
3700                 v.AuxInt = int32ToAuxInt(off)
3701                 v.Aux = symToAux(sym)
3702                 v.AddArg3(ptr, x, mem)
3703                 return true
3704         }
3705         // match: (MOVBstore [off1] {sym} (ADDLconst [off2] ptr) val mem)
3706         // cond: is32Bit(int64(off1)+int64(off2))
3707         // result: (MOVBstore [off1+off2] {sym} ptr val mem)
3708         for {
3709                 off1 := auxIntToInt32(v.AuxInt)
3710                 sym := auxToSym(v.Aux)
3711                 if v_0.Op != Op386ADDLconst {
3712                         break
3713                 }
3714                 off2 := auxIntToInt32(v_0.AuxInt)
3715                 ptr := v_0.Args[0]
3716                 val := v_1
3717                 mem := v_2
3718                 if !(is32Bit(int64(off1) + int64(off2))) {
3719                         break
3720                 }
3721                 v.reset(Op386MOVBstore)
3722                 v.AuxInt = int32ToAuxInt(off1 + off2)
3723                 v.Aux = symToAux(sym)
3724                 v.AddArg3(ptr, val, mem)
3725                 return true
3726         }
3727         // match: (MOVBstore [off] {sym} ptr (MOVLconst [c]) mem)
3728         // result: (MOVBstoreconst [makeValAndOff(c,off)] {sym} ptr mem)
3729         for {
3730                 off := auxIntToInt32(v.AuxInt)
3731                 sym := auxToSym(v.Aux)
3732                 ptr := v_0
3733                 if v_1.Op != Op386MOVLconst {
3734                         break
3735                 }
3736                 c := auxIntToInt32(v_1.AuxInt)
3737                 mem := v_2
3738                 v.reset(Op386MOVBstoreconst)
3739                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
3740                 v.Aux = symToAux(sym)
3741                 v.AddArg2(ptr, mem)
3742                 return true
3743         }
3744         // match: (MOVBstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
3745         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
3746         // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
3747         for {
3748                 off1 := auxIntToInt32(v.AuxInt)
3749                 sym1 := auxToSym(v.Aux)
3750                 if v_0.Op != Op386LEAL {
3751                         break
3752                 }
3753                 off2 := auxIntToInt32(v_0.AuxInt)
3754                 sym2 := auxToSym(v_0.Aux)
3755                 base := v_0.Args[0]
3756                 val := v_1
3757                 mem := v_2
3758                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
3759                         break
3760                 }
3761                 v.reset(Op386MOVBstore)
3762                 v.AuxInt = int32ToAuxInt(off1 + off2)
3763                 v.Aux = symToAux(mergeSym(sym1, sym2))
3764                 v.AddArg3(base, val, mem)
3765                 return true
3766         }
3767         // match: (MOVBstore [i] {s} p (SHRWconst [8] w) x:(MOVBstore [i-1] {s} p w mem))
3768         // cond: x.Uses == 1 && clobber(x)
3769         // result: (MOVWstore [i-1] {s} p w mem)
3770         for {
3771                 i := auxIntToInt32(v.AuxInt)
3772                 s := auxToSym(v.Aux)
3773                 p := v_0
3774                 if v_1.Op != Op386SHRWconst || auxIntToInt16(v_1.AuxInt) != 8 {
3775                         break
3776                 }
3777                 w := v_1.Args[0]
3778                 x := v_2
3779                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s {
3780                         break
3781                 }
3782                 mem := x.Args[2]
3783                 if p != x.Args[0] || w != x.Args[1] || !(x.Uses == 1 && clobber(x)) {
3784                         break
3785                 }
3786                 v.reset(Op386MOVWstore)
3787                 v.AuxInt = int32ToAuxInt(i - 1)
3788                 v.Aux = symToAux(s)
3789                 v.AddArg3(p, w, mem)
3790                 return true
3791         }
3792         // match: (MOVBstore [i] {s} p (SHRLconst [8] w) x:(MOVBstore [i-1] {s} p w mem))
3793         // cond: x.Uses == 1 && clobber(x)
3794         // result: (MOVWstore [i-1] {s} p w mem)
3795         for {
3796                 i := auxIntToInt32(v.AuxInt)
3797                 s := auxToSym(v.Aux)
3798                 p := v_0
3799                 if v_1.Op != Op386SHRLconst || auxIntToInt32(v_1.AuxInt) != 8 {
3800                         break
3801                 }
3802                 w := v_1.Args[0]
3803                 x := v_2
3804                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s {
3805                         break
3806                 }
3807                 mem := x.Args[2]
3808                 if p != x.Args[0] || w != x.Args[1] || !(x.Uses == 1 && clobber(x)) {
3809                         break
3810                 }
3811                 v.reset(Op386MOVWstore)
3812                 v.AuxInt = int32ToAuxInt(i - 1)
3813                 v.Aux = symToAux(s)
3814                 v.AddArg3(p, w, mem)
3815                 return true
3816         }
3817         // match: (MOVBstore [i] {s} p w x:(MOVBstore {s} [i+1] p (SHRWconst [8] w) mem))
3818         // cond: x.Uses == 1 && clobber(x)
3819         // result: (MOVWstore [i] {s} p w mem)
3820         for {
3821                 i := auxIntToInt32(v.AuxInt)
3822                 s := auxToSym(v.Aux)
3823                 p := v_0
3824                 w := v_1
3825                 x := v_2
3826                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i+1 || auxToSym(x.Aux) != s {
3827                         break
3828                 }
3829                 mem := x.Args[2]
3830                 if p != x.Args[0] {
3831                         break
3832                 }
3833                 x_1 := x.Args[1]
3834                 if x_1.Op != Op386SHRWconst || auxIntToInt16(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(x.Uses == 1 && clobber(x)) {
3835                         break
3836                 }
3837                 v.reset(Op386MOVWstore)
3838                 v.AuxInt = int32ToAuxInt(i)
3839                 v.Aux = symToAux(s)
3840                 v.AddArg3(p, w, mem)
3841                 return true
3842         }
3843         // match: (MOVBstore [i] {s} p w x:(MOVBstore {s} [i+1] p (SHRLconst [8] w) mem))
3844         // cond: x.Uses == 1 && clobber(x)
3845         // result: (MOVWstore [i] {s} p w mem)
3846         for {
3847                 i := auxIntToInt32(v.AuxInt)
3848                 s := auxToSym(v.Aux)
3849                 p := v_0
3850                 w := v_1
3851                 x := v_2
3852                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i+1 || auxToSym(x.Aux) != s {
3853                         break
3854                 }
3855                 mem := x.Args[2]
3856                 if p != x.Args[0] {
3857                         break
3858                 }
3859                 x_1 := x.Args[1]
3860                 if x_1.Op != Op386SHRLconst || auxIntToInt32(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(x.Uses == 1 && clobber(x)) {
3861                         break
3862                 }
3863                 v.reset(Op386MOVWstore)
3864                 v.AuxInt = int32ToAuxInt(i)
3865                 v.Aux = symToAux(s)
3866                 v.AddArg3(p, w, mem)
3867                 return true
3868         }
3869         // match: (MOVBstore [i] {s} p (SHRLconst [j] w) x:(MOVBstore [i-1] {s} p w0:(SHRLconst [j-8] w) mem))
3870         // cond: x.Uses == 1 && clobber(x)
3871         // result: (MOVWstore [i-1] {s} p w0 mem)
3872         for {
3873                 i := auxIntToInt32(v.AuxInt)
3874                 s := auxToSym(v.Aux)
3875                 p := v_0
3876                 if v_1.Op != Op386SHRLconst {
3877                         break
3878                 }
3879                 j := auxIntToInt32(v_1.AuxInt)
3880                 w := v_1.Args[0]
3881                 x := v_2
3882                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i-1 || auxToSym(x.Aux) != s {
3883                         break
3884                 }
3885                 mem := x.Args[2]
3886                 if p != x.Args[0] {
3887                         break
3888                 }
3889                 w0 := x.Args[1]
3890                 if w0.Op != Op386SHRLconst || auxIntToInt32(w0.AuxInt) != j-8 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) {
3891                         break
3892                 }
3893                 v.reset(Op386MOVWstore)
3894                 v.AuxInt = int32ToAuxInt(i - 1)
3895                 v.Aux = symToAux(s)
3896                 v.AddArg3(p, w0, mem)
3897                 return true
3898         }
3899         // match: (MOVBstore [i] {s} p1 (SHRWconst [8] w) x:(MOVBstore [i] {s} p0 w mem))
3900         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)
3901         // result: (MOVWstore [i] {s} p0 w mem)
3902         for {
3903                 i := auxIntToInt32(v.AuxInt)
3904                 s := auxToSym(v.Aux)
3905                 p1 := v_0
3906                 if v_1.Op != Op386SHRWconst || auxIntToInt16(v_1.AuxInt) != 8 {
3907                         break
3908                 }
3909                 w := v_1.Args[0]
3910                 x := v_2
3911                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
3912                         break
3913                 }
3914                 mem := x.Args[2]
3915                 p0 := x.Args[0]
3916                 if w != x.Args[1] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) {
3917                         break
3918                 }
3919                 v.reset(Op386MOVWstore)
3920                 v.AuxInt = int32ToAuxInt(i)
3921                 v.Aux = symToAux(s)
3922                 v.AddArg3(p0, w, mem)
3923                 return true
3924         }
3925         // match: (MOVBstore [i] {s} p1 (SHRLconst [8] w) x:(MOVBstore [i] {s} p0 w mem))
3926         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)
3927         // result: (MOVWstore [i] {s} p0 w mem)
3928         for {
3929                 i := auxIntToInt32(v.AuxInt)
3930                 s := auxToSym(v.Aux)
3931                 p1 := v_0
3932                 if v_1.Op != Op386SHRLconst || auxIntToInt32(v_1.AuxInt) != 8 {
3933                         break
3934                 }
3935                 w := v_1.Args[0]
3936                 x := v_2
3937                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
3938                         break
3939                 }
3940                 mem := x.Args[2]
3941                 p0 := x.Args[0]
3942                 if w != x.Args[1] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) {
3943                         break
3944                 }
3945                 v.reset(Op386MOVWstore)
3946                 v.AuxInt = int32ToAuxInt(i)
3947                 v.Aux = symToAux(s)
3948                 v.AddArg3(p0, w, mem)
3949                 return true
3950         }
3951         // match: (MOVBstore [i] {s} p0 w x:(MOVBstore {s} [i] p1 (SHRWconst [8] w) mem))
3952         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)
3953         // result: (MOVWstore [i] {s} p0 w mem)
3954         for {
3955                 i := auxIntToInt32(v.AuxInt)
3956                 s := auxToSym(v.Aux)
3957                 p0 := v_0
3958                 w := v_1
3959                 x := v_2
3960                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
3961                         break
3962                 }
3963                 mem := x.Args[2]
3964                 p1 := x.Args[0]
3965                 x_1 := x.Args[1]
3966                 if x_1.Op != Op386SHRWconst || auxIntToInt16(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) {
3967                         break
3968                 }
3969                 v.reset(Op386MOVWstore)
3970                 v.AuxInt = int32ToAuxInt(i)
3971                 v.Aux = symToAux(s)
3972                 v.AddArg3(p0, w, mem)
3973                 return true
3974         }
3975         // match: (MOVBstore [i] {s} p0 w x:(MOVBstore {s} [i] p1 (SHRLconst [8] w) mem))
3976         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)
3977         // result: (MOVWstore [i] {s} p0 w mem)
3978         for {
3979                 i := auxIntToInt32(v.AuxInt)
3980                 s := auxToSym(v.Aux)
3981                 p0 := v_0
3982                 w := v_1
3983                 x := v_2
3984                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
3985                         break
3986                 }
3987                 mem := x.Args[2]
3988                 p1 := x.Args[0]
3989                 x_1 := x.Args[1]
3990                 if x_1.Op != Op386SHRLconst || auxIntToInt32(x_1.AuxInt) != 8 || w != x_1.Args[0] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) {
3991                         break
3992                 }
3993                 v.reset(Op386MOVWstore)
3994                 v.AuxInt = int32ToAuxInt(i)
3995                 v.Aux = symToAux(s)
3996                 v.AddArg3(p0, w, mem)
3997                 return true
3998         }
3999         // match: (MOVBstore [i] {s} p1 (SHRLconst [j] w) x:(MOVBstore [i] {s} p0 w0:(SHRLconst [j-8] w) mem))
4000         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)
4001         // result: (MOVWstore [i] {s} p0 w0 mem)
4002         for {
4003                 i := auxIntToInt32(v.AuxInt)
4004                 s := auxToSym(v.Aux)
4005                 p1 := v_0
4006                 if v_1.Op != Op386SHRLconst {
4007                         break
4008                 }
4009                 j := auxIntToInt32(v_1.AuxInt)
4010                 w := v_1.Args[0]
4011                 x := v_2
4012                 if x.Op != Op386MOVBstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
4013                         break
4014                 }
4015                 mem := x.Args[2]
4016                 p0 := x.Args[0]
4017                 w0 := x.Args[1]
4018                 if w0.Op != Op386SHRLconst || auxIntToInt32(w0.AuxInt) != j-8 || w != w0.Args[0] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 1) && clobber(x)) {
4019                         break
4020                 }
4021                 v.reset(Op386MOVWstore)
4022                 v.AuxInt = int32ToAuxInt(i)
4023                 v.Aux = symToAux(s)
4024                 v.AddArg3(p0, w0, mem)
4025                 return true
4026         }
4027         return false
4028 }
4029 func rewriteValue386_Op386MOVBstoreconst(v *Value) bool {
4030         v_1 := v.Args[1]
4031         v_0 := v.Args[0]
4032         b := v.Block
4033         config := b.Func.Config
4034         // match: (MOVBstoreconst [sc] {s} (ADDLconst [off] ptr) mem)
4035         // cond: sc.canAdd32(off)
4036         // result: (MOVBstoreconst [sc.addOffset32(off)] {s} ptr mem)
4037         for {
4038                 sc := auxIntToValAndOff(v.AuxInt)
4039                 s := auxToSym(v.Aux)
4040                 if v_0.Op != Op386ADDLconst {
4041                         break
4042                 }
4043                 off := auxIntToInt32(v_0.AuxInt)
4044                 ptr := v_0.Args[0]
4045                 mem := v_1
4046                 if !(sc.canAdd32(off)) {
4047                         break
4048                 }
4049                 v.reset(Op386MOVBstoreconst)
4050                 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
4051                 v.Aux = symToAux(s)
4052                 v.AddArg2(ptr, mem)
4053                 return true
4054         }
4055         // match: (MOVBstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem)
4056         // cond: canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)
4057         // result: (MOVBstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
4058         for {
4059                 sc := auxIntToValAndOff(v.AuxInt)
4060                 sym1 := auxToSym(v.Aux)
4061                 if v_0.Op != Op386LEAL {
4062                         break
4063                 }
4064                 off := auxIntToInt32(v_0.AuxInt)
4065                 sym2 := auxToSym(v_0.Aux)
4066                 ptr := v_0.Args[0]
4067                 mem := v_1
4068                 if !(canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)) {
4069                         break
4070                 }
4071                 v.reset(Op386MOVBstoreconst)
4072                 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
4073                 v.Aux = symToAux(mergeSym(sym1, sym2))
4074                 v.AddArg2(ptr, mem)
4075                 return true
4076         }
4077         // match: (MOVBstoreconst [c] {s} p x:(MOVBstoreconst [a] {s} p mem))
4078         // cond: x.Uses == 1 && a.Off() + 1 == c.Off() && clobber(x)
4079         // result: (MOVWstoreconst [makeValAndOff(a.Val()&0xff | c.Val()<<8, a.Off())] {s} p mem)
4080         for {
4081                 c := auxIntToValAndOff(v.AuxInt)
4082                 s := auxToSym(v.Aux)
4083                 p := v_0
4084                 x := v_1
4085                 if x.Op != Op386MOVBstoreconst {
4086                         break
4087                 }
4088                 a := auxIntToValAndOff(x.AuxInt)
4089                 if auxToSym(x.Aux) != s {
4090                         break
4091                 }
4092                 mem := x.Args[1]
4093                 if p != x.Args[0] || !(x.Uses == 1 && a.Off()+1 == c.Off() && clobber(x)) {
4094                         break
4095                 }
4096                 v.reset(Op386MOVWstoreconst)
4097                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xff|c.Val()<<8, a.Off()))
4098                 v.Aux = symToAux(s)
4099                 v.AddArg2(p, mem)
4100                 return true
4101         }
4102         // match: (MOVBstoreconst [a] {s} p x:(MOVBstoreconst [c] {s} p mem))
4103         // cond: x.Uses == 1 && a.Off() + 1 == c.Off() && clobber(x)
4104         // result: (MOVWstoreconst [makeValAndOff(a.Val()&0xff | c.Val()<<8, a.Off())] {s} p mem)
4105         for {
4106                 a := auxIntToValAndOff(v.AuxInt)
4107                 s := auxToSym(v.Aux)
4108                 p := v_0
4109                 x := v_1
4110                 if x.Op != Op386MOVBstoreconst {
4111                         break
4112                 }
4113                 c := auxIntToValAndOff(x.AuxInt)
4114                 if auxToSym(x.Aux) != s {
4115                         break
4116                 }
4117                 mem := x.Args[1]
4118                 if p != x.Args[0] || !(x.Uses == 1 && a.Off()+1 == c.Off() && clobber(x)) {
4119                         break
4120                 }
4121                 v.reset(Op386MOVWstoreconst)
4122                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xff|c.Val()<<8, a.Off()))
4123                 v.Aux = symToAux(s)
4124                 v.AddArg2(p, mem)
4125                 return true
4126         }
4127         // match: (MOVBstoreconst [c] {s} p1 x:(MOVBstoreconst [a] {s} p0 mem))
4128         // cond: x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 1) && clobber(x)
4129         // result: (MOVWstoreconst [makeValAndOff(a.Val()&0xff | c.Val()<<8, a.Off())] {s} p0 mem)
4130         for {
4131                 c := auxIntToValAndOff(v.AuxInt)
4132                 s := auxToSym(v.Aux)
4133                 p1 := v_0
4134                 x := v_1
4135                 if x.Op != Op386MOVBstoreconst {
4136                         break
4137                 }
4138                 a := auxIntToValAndOff(x.AuxInt)
4139                 if auxToSym(x.Aux) != s {
4140                         break
4141                 }
4142                 mem := x.Args[1]
4143                 p0 := x.Args[0]
4144                 if !(x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 1) && clobber(x)) {
4145                         break
4146                 }
4147                 v.reset(Op386MOVWstoreconst)
4148                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xff|c.Val()<<8, a.Off()))
4149                 v.Aux = symToAux(s)
4150                 v.AddArg2(p0, mem)
4151                 return true
4152         }
4153         // match: (MOVBstoreconst [a] {s} p0 x:(MOVBstoreconst [c] {s} p1 mem))
4154         // cond: x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 1) && clobber(x)
4155         // result: (MOVWstoreconst [makeValAndOff(a.Val()&0xff | c.Val()<<8, a.Off())] {s} p0 mem)
4156         for {
4157                 a := auxIntToValAndOff(v.AuxInt)
4158                 s := auxToSym(v.Aux)
4159                 p0 := v_0
4160                 x := v_1
4161                 if x.Op != Op386MOVBstoreconst {
4162                         break
4163                 }
4164                 c := auxIntToValAndOff(x.AuxInt)
4165                 if auxToSym(x.Aux) != s {
4166                         break
4167                 }
4168                 mem := x.Args[1]
4169                 p1 := x.Args[0]
4170                 if !(x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 1) && clobber(x)) {
4171                         break
4172                 }
4173                 v.reset(Op386MOVWstoreconst)
4174                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xff|c.Val()<<8, a.Off()))
4175                 v.Aux = symToAux(s)
4176                 v.AddArg2(p0, mem)
4177                 return true
4178         }
4179         return false
4180 }
4181 func rewriteValue386_Op386MOVLload(v *Value) bool {
4182         v_1 := v.Args[1]
4183         v_0 := v.Args[0]
4184         b := v.Block
4185         config := b.Func.Config
4186         // match: (MOVLload [off] {sym} ptr (MOVLstore [off2] {sym2} ptr2 x _))
4187         // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
4188         // result: x
4189         for {
4190                 off := auxIntToInt32(v.AuxInt)
4191                 sym := auxToSym(v.Aux)
4192                 ptr := v_0
4193                 if v_1.Op != Op386MOVLstore {
4194                         break
4195                 }
4196                 off2 := auxIntToInt32(v_1.AuxInt)
4197                 sym2 := auxToSym(v_1.Aux)
4198                 x := v_1.Args[1]
4199                 ptr2 := v_1.Args[0]
4200                 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
4201                         break
4202                 }
4203                 v.copyOf(x)
4204                 return true
4205         }
4206         // match: (MOVLload [off1] {sym} (ADDLconst [off2] ptr) mem)
4207         // cond: is32Bit(int64(off1)+int64(off2))
4208         // result: (MOVLload [off1+off2] {sym} ptr mem)
4209         for {
4210                 off1 := auxIntToInt32(v.AuxInt)
4211                 sym := auxToSym(v.Aux)
4212                 if v_0.Op != Op386ADDLconst {
4213                         break
4214                 }
4215                 off2 := auxIntToInt32(v_0.AuxInt)
4216                 ptr := v_0.Args[0]
4217                 mem := v_1
4218                 if !(is32Bit(int64(off1) + int64(off2))) {
4219                         break
4220                 }
4221                 v.reset(Op386MOVLload)
4222                 v.AuxInt = int32ToAuxInt(off1 + off2)
4223                 v.Aux = symToAux(sym)
4224                 v.AddArg2(ptr, mem)
4225                 return true
4226         }
4227         // match: (MOVLload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
4228         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
4229         // result: (MOVLload [off1+off2] {mergeSym(sym1,sym2)} base mem)
4230         for {
4231                 off1 := auxIntToInt32(v.AuxInt)
4232                 sym1 := auxToSym(v.Aux)
4233                 if v_0.Op != Op386LEAL {
4234                         break
4235                 }
4236                 off2 := auxIntToInt32(v_0.AuxInt)
4237                 sym2 := auxToSym(v_0.Aux)
4238                 base := v_0.Args[0]
4239                 mem := v_1
4240                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
4241                         break
4242                 }
4243                 v.reset(Op386MOVLload)
4244                 v.AuxInt = int32ToAuxInt(off1 + off2)
4245                 v.Aux = symToAux(mergeSym(sym1, sym2))
4246                 v.AddArg2(base, mem)
4247                 return true
4248         }
4249         // match: (MOVLload [off] {sym} (SB) _)
4250         // cond: symIsRO(sym)
4251         // result: (MOVLconst [int32(read32(sym, int64(off), config.ctxt.Arch.ByteOrder))])
4252         for {
4253                 off := auxIntToInt32(v.AuxInt)
4254                 sym := auxToSym(v.Aux)
4255                 if v_0.Op != OpSB || !(symIsRO(sym)) {
4256                         break
4257                 }
4258                 v.reset(Op386MOVLconst)
4259                 v.AuxInt = int32ToAuxInt(int32(read32(sym, int64(off), config.ctxt.Arch.ByteOrder)))
4260                 return true
4261         }
4262         return false
4263 }
4264 func rewriteValue386_Op386MOVLstore(v *Value) bool {
4265         v_2 := v.Args[2]
4266         v_1 := v.Args[1]
4267         v_0 := v.Args[0]
4268         b := v.Block
4269         config := b.Func.Config
4270         // match: (MOVLstore [off1] {sym} (ADDLconst [off2] ptr) val mem)
4271         // cond: is32Bit(int64(off1)+int64(off2))
4272         // result: (MOVLstore [off1+off2] {sym} ptr val mem)
4273         for {
4274                 off1 := auxIntToInt32(v.AuxInt)
4275                 sym := auxToSym(v.Aux)
4276                 if v_0.Op != Op386ADDLconst {
4277                         break
4278                 }
4279                 off2 := auxIntToInt32(v_0.AuxInt)
4280                 ptr := v_0.Args[0]
4281                 val := v_1
4282                 mem := v_2
4283                 if !(is32Bit(int64(off1) + int64(off2))) {
4284                         break
4285                 }
4286                 v.reset(Op386MOVLstore)
4287                 v.AuxInt = int32ToAuxInt(off1 + off2)
4288                 v.Aux = symToAux(sym)
4289                 v.AddArg3(ptr, val, mem)
4290                 return true
4291         }
4292         // match: (MOVLstore [off] {sym} ptr (MOVLconst [c]) mem)
4293         // result: (MOVLstoreconst [makeValAndOff(c,off)] {sym} ptr mem)
4294         for {
4295                 off := auxIntToInt32(v.AuxInt)
4296                 sym := auxToSym(v.Aux)
4297                 ptr := v_0
4298                 if v_1.Op != Op386MOVLconst {
4299                         break
4300                 }
4301                 c := auxIntToInt32(v_1.AuxInt)
4302                 mem := v_2
4303                 v.reset(Op386MOVLstoreconst)
4304                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
4305                 v.Aux = symToAux(sym)
4306                 v.AddArg2(ptr, mem)
4307                 return true
4308         }
4309         // match: (MOVLstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
4310         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
4311         // result: (MOVLstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
4312         for {
4313                 off1 := auxIntToInt32(v.AuxInt)
4314                 sym1 := auxToSym(v.Aux)
4315                 if v_0.Op != Op386LEAL {
4316                         break
4317                 }
4318                 off2 := auxIntToInt32(v_0.AuxInt)
4319                 sym2 := auxToSym(v_0.Aux)
4320                 base := v_0.Args[0]
4321                 val := v_1
4322                 mem := v_2
4323                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
4324                         break
4325                 }
4326                 v.reset(Op386MOVLstore)
4327                 v.AuxInt = int32ToAuxInt(off1 + off2)
4328                 v.Aux = symToAux(mergeSym(sym1, sym2))
4329                 v.AddArg3(base, val, mem)
4330                 return true
4331         }
4332         // match: (MOVLstore {sym} [off] ptr y:(ADDLload x [off] {sym} ptr mem) mem)
4333         // cond: y.Uses==1 && clobber(y)
4334         // result: (ADDLmodify [off] {sym} ptr x mem)
4335         for {
4336                 off := auxIntToInt32(v.AuxInt)
4337                 sym := auxToSym(v.Aux)
4338                 ptr := v_0
4339                 y := v_1
4340                 if y.Op != Op386ADDLload || auxIntToInt32(y.AuxInt) != off || auxToSym(y.Aux) != sym {
4341                         break
4342                 }
4343                 mem := y.Args[2]
4344                 x := y.Args[0]
4345                 if ptr != y.Args[1] || mem != v_2 || !(y.Uses == 1 && clobber(y)) {
4346                         break
4347                 }
4348                 v.reset(Op386ADDLmodify)
4349                 v.AuxInt = int32ToAuxInt(off)
4350                 v.Aux = symToAux(sym)
4351                 v.AddArg3(ptr, x, mem)
4352                 return true
4353         }
4354         // match: (MOVLstore {sym} [off] ptr y:(ANDLload x [off] {sym} ptr mem) mem)
4355         // cond: y.Uses==1 && clobber(y)
4356         // result: (ANDLmodify [off] {sym} ptr x mem)
4357         for {
4358                 off := auxIntToInt32(v.AuxInt)
4359                 sym := auxToSym(v.Aux)
4360                 ptr := v_0
4361                 y := v_1
4362                 if y.Op != Op386ANDLload || auxIntToInt32(y.AuxInt) != off || auxToSym(y.Aux) != sym {
4363                         break
4364                 }
4365                 mem := y.Args[2]
4366                 x := y.Args[0]
4367                 if ptr != y.Args[1] || mem != v_2 || !(y.Uses == 1 && clobber(y)) {
4368                         break
4369                 }
4370                 v.reset(Op386ANDLmodify)
4371                 v.AuxInt = int32ToAuxInt(off)
4372                 v.Aux = symToAux(sym)
4373                 v.AddArg3(ptr, x, mem)
4374                 return true
4375         }
4376         // match: (MOVLstore {sym} [off] ptr y:(ORLload x [off] {sym} ptr mem) mem)
4377         // cond: y.Uses==1 && clobber(y)
4378         // result: (ORLmodify [off] {sym} ptr x mem)
4379         for {
4380                 off := auxIntToInt32(v.AuxInt)
4381                 sym := auxToSym(v.Aux)
4382                 ptr := v_0
4383                 y := v_1
4384                 if y.Op != Op386ORLload || auxIntToInt32(y.AuxInt) != off || auxToSym(y.Aux) != sym {
4385                         break
4386                 }
4387                 mem := y.Args[2]
4388                 x := y.Args[0]
4389                 if ptr != y.Args[1] || mem != v_2 || !(y.Uses == 1 && clobber(y)) {
4390                         break
4391                 }
4392                 v.reset(Op386ORLmodify)
4393                 v.AuxInt = int32ToAuxInt(off)
4394                 v.Aux = symToAux(sym)
4395                 v.AddArg3(ptr, x, mem)
4396                 return true
4397         }
4398         // match: (MOVLstore {sym} [off] ptr y:(XORLload x [off] {sym} ptr mem) mem)
4399         // cond: y.Uses==1 && clobber(y)
4400         // result: (XORLmodify [off] {sym} ptr x mem)
4401         for {
4402                 off := auxIntToInt32(v.AuxInt)
4403                 sym := auxToSym(v.Aux)
4404                 ptr := v_0
4405                 y := v_1
4406                 if y.Op != Op386XORLload || auxIntToInt32(y.AuxInt) != off || auxToSym(y.Aux) != sym {
4407                         break
4408                 }
4409                 mem := y.Args[2]
4410                 x := y.Args[0]
4411                 if ptr != y.Args[1] || mem != v_2 || !(y.Uses == 1 && clobber(y)) {
4412                         break
4413                 }
4414                 v.reset(Op386XORLmodify)
4415                 v.AuxInt = int32ToAuxInt(off)
4416                 v.Aux = symToAux(sym)
4417                 v.AddArg3(ptr, x, mem)
4418                 return true
4419         }
4420         // match: (MOVLstore {sym} [off] ptr y:(ADDL l:(MOVLload [off] {sym} ptr mem) x) mem)
4421         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4422         // result: (ADDLmodify [off] {sym} ptr x mem)
4423         for {
4424                 off := auxIntToInt32(v.AuxInt)
4425                 sym := auxToSym(v.Aux)
4426                 ptr := v_0
4427                 y := v_1
4428                 if y.Op != Op386ADDL {
4429                         break
4430                 }
4431                 _ = y.Args[1]
4432                 y_0 := y.Args[0]
4433                 y_1 := y.Args[1]
4434                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
4435                         l := y_0
4436                         if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4437                                 continue
4438                         }
4439                         mem := l.Args[1]
4440                         if ptr != l.Args[0] {
4441                                 continue
4442                         }
4443                         x := y_1
4444                         if mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4445                                 continue
4446                         }
4447                         v.reset(Op386ADDLmodify)
4448                         v.AuxInt = int32ToAuxInt(off)
4449                         v.Aux = symToAux(sym)
4450                         v.AddArg3(ptr, x, mem)
4451                         return true
4452                 }
4453                 break
4454         }
4455         // match: (MOVLstore {sym} [off] ptr y:(SUBL l:(MOVLload [off] {sym} ptr mem) x) mem)
4456         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4457         // result: (SUBLmodify [off] {sym} ptr x mem)
4458         for {
4459                 off := auxIntToInt32(v.AuxInt)
4460                 sym := auxToSym(v.Aux)
4461                 ptr := v_0
4462                 y := v_1
4463                 if y.Op != Op386SUBL {
4464                         break
4465                 }
4466                 x := y.Args[1]
4467                 l := y.Args[0]
4468                 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4469                         break
4470                 }
4471                 mem := l.Args[1]
4472                 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4473                         break
4474                 }
4475                 v.reset(Op386SUBLmodify)
4476                 v.AuxInt = int32ToAuxInt(off)
4477                 v.Aux = symToAux(sym)
4478                 v.AddArg3(ptr, x, mem)
4479                 return true
4480         }
4481         // match: (MOVLstore {sym} [off] ptr y:(ANDL l:(MOVLload [off] {sym} ptr mem) x) mem)
4482         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4483         // result: (ANDLmodify [off] {sym} ptr x mem)
4484         for {
4485                 off := auxIntToInt32(v.AuxInt)
4486                 sym := auxToSym(v.Aux)
4487                 ptr := v_0
4488                 y := v_1
4489                 if y.Op != Op386ANDL {
4490                         break
4491                 }
4492                 _ = y.Args[1]
4493                 y_0 := y.Args[0]
4494                 y_1 := y.Args[1]
4495                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
4496                         l := y_0
4497                         if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4498                                 continue
4499                         }
4500                         mem := l.Args[1]
4501                         if ptr != l.Args[0] {
4502                                 continue
4503                         }
4504                         x := y_1
4505                         if mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4506                                 continue
4507                         }
4508                         v.reset(Op386ANDLmodify)
4509                         v.AuxInt = int32ToAuxInt(off)
4510                         v.Aux = symToAux(sym)
4511                         v.AddArg3(ptr, x, mem)
4512                         return true
4513                 }
4514                 break
4515         }
4516         // match: (MOVLstore {sym} [off] ptr y:(ORL l:(MOVLload [off] {sym} ptr mem) x) mem)
4517         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4518         // result: (ORLmodify [off] {sym} ptr x mem)
4519         for {
4520                 off := auxIntToInt32(v.AuxInt)
4521                 sym := auxToSym(v.Aux)
4522                 ptr := v_0
4523                 y := v_1
4524                 if y.Op != Op386ORL {
4525                         break
4526                 }
4527                 _ = y.Args[1]
4528                 y_0 := y.Args[0]
4529                 y_1 := y.Args[1]
4530                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
4531                         l := y_0
4532                         if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4533                                 continue
4534                         }
4535                         mem := l.Args[1]
4536                         if ptr != l.Args[0] {
4537                                 continue
4538                         }
4539                         x := y_1
4540                         if mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4541                                 continue
4542                         }
4543                         v.reset(Op386ORLmodify)
4544                         v.AuxInt = int32ToAuxInt(off)
4545                         v.Aux = symToAux(sym)
4546                         v.AddArg3(ptr, x, mem)
4547                         return true
4548                 }
4549                 break
4550         }
4551         // match: (MOVLstore {sym} [off] ptr y:(XORL l:(MOVLload [off] {sym} ptr mem) x) mem)
4552         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4553         // result: (XORLmodify [off] {sym} ptr x mem)
4554         for {
4555                 off := auxIntToInt32(v.AuxInt)
4556                 sym := auxToSym(v.Aux)
4557                 ptr := v_0
4558                 y := v_1
4559                 if y.Op != Op386XORL {
4560                         break
4561                 }
4562                 _ = y.Args[1]
4563                 y_0 := y.Args[0]
4564                 y_1 := y.Args[1]
4565                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
4566                         l := y_0
4567                         if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4568                                 continue
4569                         }
4570                         mem := l.Args[1]
4571                         if ptr != l.Args[0] {
4572                                 continue
4573                         }
4574                         x := y_1
4575                         if mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4576                                 continue
4577                         }
4578                         v.reset(Op386XORLmodify)
4579                         v.AuxInt = int32ToAuxInt(off)
4580                         v.Aux = symToAux(sym)
4581                         v.AddArg3(ptr, x, mem)
4582                         return true
4583                 }
4584                 break
4585         }
4586         // match: (MOVLstore {sym} [off] ptr y:(ADDLconst [c] l:(MOVLload [off] {sym} ptr mem)) mem)
4587         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4588         // result: (ADDLconstmodify [makeValAndOff(c,off)] {sym} ptr mem)
4589         for {
4590                 off := auxIntToInt32(v.AuxInt)
4591                 sym := auxToSym(v.Aux)
4592                 ptr := v_0
4593                 y := v_1
4594                 if y.Op != Op386ADDLconst {
4595                         break
4596                 }
4597                 c := auxIntToInt32(y.AuxInt)
4598                 l := y.Args[0]
4599                 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4600                         break
4601                 }
4602                 mem := l.Args[1]
4603                 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4604                         break
4605                 }
4606                 v.reset(Op386ADDLconstmodify)
4607                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
4608                 v.Aux = symToAux(sym)
4609                 v.AddArg2(ptr, mem)
4610                 return true
4611         }
4612         // match: (MOVLstore {sym} [off] ptr y:(ANDLconst [c] l:(MOVLload [off] {sym} ptr mem)) mem)
4613         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4614         // result: (ANDLconstmodify [makeValAndOff(c,off)] {sym} ptr mem)
4615         for {
4616                 off := auxIntToInt32(v.AuxInt)
4617                 sym := auxToSym(v.Aux)
4618                 ptr := v_0
4619                 y := v_1
4620                 if y.Op != Op386ANDLconst {
4621                         break
4622                 }
4623                 c := auxIntToInt32(y.AuxInt)
4624                 l := y.Args[0]
4625                 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4626                         break
4627                 }
4628                 mem := l.Args[1]
4629                 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4630                         break
4631                 }
4632                 v.reset(Op386ANDLconstmodify)
4633                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
4634                 v.Aux = symToAux(sym)
4635                 v.AddArg2(ptr, mem)
4636                 return true
4637         }
4638         // match: (MOVLstore {sym} [off] ptr y:(ORLconst [c] l:(MOVLload [off] {sym} ptr mem)) mem)
4639         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4640         // result: (ORLconstmodify [makeValAndOff(c,off)] {sym} ptr mem)
4641         for {
4642                 off := auxIntToInt32(v.AuxInt)
4643                 sym := auxToSym(v.Aux)
4644                 ptr := v_0
4645                 y := v_1
4646                 if y.Op != Op386ORLconst {
4647                         break
4648                 }
4649                 c := auxIntToInt32(y.AuxInt)
4650                 l := y.Args[0]
4651                 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4652                         break
4653                 }
4654                 mem := l.Args[1]
4655                 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4656                         break
4657                 }
4658                 v.reset(Op386ORLconstmodify)
4659                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
4660                 v.Aux = symToAux(sym)
4661                 v.AddArg2(ptr, mem)
4662                 return true
4663         }
4664         // match: (MOVLstore {sym} [off] ptr y:(XORLconst [c] l:(MOVLload [off] {sym} ptr mem)) mem)
4665         // cond: y.Uses==1 && l.Uses==1 && clobber(y, l)
4666         // result: (XORLconstmodify [makeValAndOff(c,off)] {sym} ptr mem)
4667         for {
4668                 off := auxIntToInt32(v.AuxInt)
4669                 sym := auxToSym(v.Aux)
4670                 ptr := v_0
4671                 y := v_1
4672                 if y.Op != Op386XORLconst {
4673                         break
4674                 }
4675                 c := auxIntToInt32(y.AuxInt)
4676                 l := y.Args[0]
4677                 if l.Op != Op386MOVLload || auxIntToInt32(l.AuxInt) != off || auxToSym(l.Aux) != sym {
4678                         break
4679                 }
4680                 mem := l.Args[1]
4681                 if ptr != l.Args[0] || mem != v_2 || !(y.Uses == 1 && l.Uses == 1 && clobber(y, l)) {
4682                         break
4683                 }
4684                 v.reset(Op386XORLconstmodify)
4685                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
4686                 v.Aux = symToAux(sym)
4687                 v.AddArg2(ptr, mem)
4688                 return true
4689         }
4690         return false
4691 }
4692 func rewriteValue386_Op386MOVLstoreconst(v *Value) bool {
4693         v_1 := v.Args[1]
4694         v_0 := v.Args[0]
4695         b := v.Block
4696         config := b.Func.Config
4697         // match: (MOVLstoreconst [sc] {s} (ADDLconst [off] ptr) mem)
4698         // cond: sc.canAdd32(off)
4699         // result: (MOVLstoreconst [sc.addOffset32(off)] {s} ptr mem)
4700         for {
4701                 sc := auxIntToValAndOff(v.AuxInt)
4702                 s := auxToSym(v.Aux)
4703                 if v_0.Op != Op386ADDLconst {
4704                         break
4705                 }
4706                 off := auxIntToInt32(v_0.AuxInt)
4707                 ptr := v_0.Args[0]
4708                 mem := v_1
4709                 if !(sc.canAdd32(off)) {
4710                         break
4711                 }
4712                 v.reset(Op386MOVLstoreconst)
4713                 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
4714                 v.Aux = symToAux(s)
4715                 v.AddArg2(ptr, mem)
4716                 return true
4717         }
4718         // match: (MOVLstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem)
4719         // cond: canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)
4720         // result: (MOVLstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
4721         for {
4722                 sc := auxIntToValAndOff(v.AuxInt)
4723                 sym1 := auxToSym(v.Aux)
4724                 if v_0.Op != Op386LEAL {
4725                         break
4726                 }
4727                 off := auxIntToInt32(v_0.AuxInt)
4728                 sym2 := auxToSym(v_0.Aux)
4729                 ptr := v_0.Args[0]
4730                 mem := v_1
4731                 if !(canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)) {
4732                         break
4733                 }
4734                 v.reset(Op386MOVLstoreconst)
4735                 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
4736                 v.Aux = symToAux(mergeSym(sym1, sym2))
4737                 v.AddArg2(ptr, mem)
4738                 return true
4739         }
4740         return false
4741 }
4742 func rewriteValue386_Op386MOVSDconst(v *Value) bool {
4743         b := v.Block
4744         config := b.Func.Config
4745         typ := &b.Func.Config.Types
4746         // match: (MOVSDconst [c])
4747         // cond: config.ctxt.Flag_shared
4748         // result: (MOVSDconst2 (MOVSDconst1 [c]))
4749         for {
4750                 c := auxIntToFloat64(v.AuxInt)
4751                 if !(config.ctxt.Flag_shared) {
4752                         break
4753                 }
4754                 v.reset(Op386MOVSDconst2)
4755                 v0 := b.NewValue0(v.Pos, Op386MOVSDconst1, typ.UInt32)
4756                 v0.AuxInt = float64ToAuxInt(c)
4757                 v.AddArg(v0)
4758                 return true
4759         }
4760         return false
4761 }
4762 func rewriteValue386_Op386MOVSDload(v *Value) bool {
4763         v_1 := v.Args[1]
4764         v_0 := v.Args[0]
4765         b := v.Block
4766         config := b.Func.Config
4767         // match: (MOVSDload [off1] {sym} (ADDLconst [off2] ptr) mem)
4768         // cond: is32Bit(int64(off1)+int64(off2))
4769         // result: (MOVSDload [off1+off2] {sym} ptr mem)
4770         for {
4771                 off1 := auxIntToInt32(v.AuxInt)
4772                 sym := auxToSym(v.Aux)
4773                 if v_0.Op != Op386ADDLconst {
4774                         break
4775                 }
4776                 off2 := auxIntToInt32(v_0.AuxInt)
4777                 ptr := v_0.Args[0]
4778                 mem := v_1
4779                 if !(is32Bit(int64(off1) + int64(off2))) {
4780                         break
4781                 }
4782                 v.reset(Op386MOVSDload)
4783                 v.AuxInt = int32ToAuxInt(off1 + off2)
4784                 v.Aux = symToAux(sym)
4785                 v.AddArg2(ptr, mem)
4786                 return true
4787         }
4788         // match: (MOVSDload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
4789         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
4790         // result: (MOVSDload [off1+off2] {mergeSym(sym1,sym2)} base mem)
4791         for {
4792                 off1 := auxIntToInt32(v.AuxInt)
4793                 sym1 := auxToSym(v.Aux)
4794                 if v_0.Op != Op386LEAL {
4795                         break
4796                 }
4797                 off2 := auxIntToInt32(v_0.AuxInt)
4798                 sym2 := auxToSym(v_0.Aux)
4799                 base := v_0.Args[0]
4800                 mem := v_1
4801                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
4802                         break
4803                 }
4804                 v.reset(Op386MOVSDload)
4805                 v.AuxInt = int32ToAuxInt(off1 + off2)
4806                 v.Aux = symToAux(mergeSym(sym1, sym2))
4807                 v.AddArg2(base, mem)
4808                 return true
4809         }
4810         return false
4811 }
4812 func rewriteValue386_Op386MOVSDstore(v *Value) bool {
4813         v_2 := v.Args[2]
4814         v_1 := v.Args[1]
4815         v_0 := v.Args[0]
4816         b := v.Block
4817         config := b.Func.Config
4818         // match: (MOVSDstore [off1] {sym} (ADDLconst [off2] ptr) val mem)
4819         // cond: is32Bit(int64(off1)+int64(off2))
4820         // result: (MOVSDstore [off1+off2] {sym} ptr val mem)
4821         for {
4822                 off1 := auxIntToInt32(v.AuxInt)
4823                 sym := auxToSym(v.Aux)
4824                 if v_0.Op != Op386ADDLconst {
4825                         break
4826                 }
4827                 off2 := auxIntToInt32(v_0.AuxInt)
4828                 ptr := v_0.Args[0]
4829                 val := v_1
4830                 mem := v_2
4831                 if !(is32Bit(int64(off1) + int64(off2))) {
4832                         break
4833                 }
4834                 v.reset(Op386MOVSDstore)
4835                 v.AuxInt = int32ToAuxInt(off1 + off2)
4836                 v.Aux = symToAux(sym)
4837                 v.AddArg3(ptr, val, mem)
4838                 return true
4839         }
4840         // match: (MOVSDstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
4841         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
4842         // result: (MOVSDstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
4843         for {
4844                 off1 := auxIntToInt32(v.AuxInt)
4845                 sym1 := auxToSym(v.Aux)
4846                 if v_0.Op != Op386LEAL {
4847                         break
4848                 }
4849                 off2 := auxIntToInt32(v_0.AuxInt)
4850                 sym2 := auxToSym(v_0.Aux)
4851                 base := v_0.Args[0]
4852                 val := v_1
4853                 mem := v_2
4854                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
4855                         break
4856                 }
4857                 v.reset(Op386MOVSDstore)
4858                 v.AuxInt = int32ToAuxInt(off1 + off2)
4859                 v.Aux = symToAux(mergeSym(sym1, sym2))
4860                 v.AddArg3(base, val, mem)
4861                 return true
4862         }
4863         return false
4864 }
4865 func rewriteValue386_Op386MOVSSconst(v *Value) bool {
4866         b := v.Block
4867         config := b.Func.Config
4868         typ := &b.Func.Config.Types
4869         // match: (MOVSSconst [c])
4870         // cond: config.ctxt.Flag_shared
4871         // result: (MOVSSconst2 (MOVSSconst1 [c]))
4872         for {
4873                 c := auxIntToFloat32(v.AuxInt)
4874                 if !(config.ctxt.Flag_shared) {
4875                         break
4876                 }
4877                 v.reset(Op386MOVSSconst2)
4878                 v0 := b.NewValue0(v.Pos, Op386MOVSSconst1, typ.UInt32)
4879                 v0.AuxInt = float32ToAuxInt(c)
4880                 v.AddArg(v0)
4881                 return true
4882         }
4883         return false
4884 }
4885 func rewriteValue386_Op386MOVSSload(v *Value) bool {
4886         v_1 := v.Args[1]
4887         v_0 := v.Args[0]
4888         b := v.Block
4889         config := b.Func.Config
4890         // match: (MOVSSload [off1] {sym} (ADDLconst [off2] ptr) mem)
4891         // cond: is32Bit(int64(off1)+int64(off2))
4892         // result: (MOVSSload [off1+off2] {sym} ptr mem)
4893         for {
4894                 off1 := auxIntToInt32(v.AuxInt)
4895                 sym := auxToSym(v.Aux)
4896                 if v_0.Op != Op386ADDLconst {
4897                         break
4898                 }
4899                 off2 := auxIntToInt32(v_0.AuxInt)
4900                 ptr := v_0.Args[0]
4901                 mem := v_1
4902                 if !(is32Bit(int64(off1) + int64(off2))) {
4903                         break
4904                 }
4905                 v.reset(Op386MOVSSload)
4906                 v.AuxInt = int32ToAuxInt(off1 + off2)
4907                 v.Aux = symToAux(sym)
4908                 v.AddArg2(ptr, mem)
4909                 return true
4910         }
4911         // match: (MOVSSload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
4912         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
4913         // result: (MOVSSload [off1+off2] {mergeSym(sym1,sym2)} base mem)
4914         for {
4915                 off1 := auxIntToInt32(v.AuxInt)
4916                 sym1 := auxToSym(v.Aux)
4917                 if v_0.Op != Op386LEAL {
4918                         break
4919                 }
4920                 off2 := auxIntToInt32(v_0.AuxInt)
4921                 sym2 := auxToSym(v_0.Aux)
4922                 base := v_0.Args[0]
4923                 mem := v_1
4924                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
4925                         break
4926                 }
4927                 v.reset(Op386MOVSSload)
4928                 v.AuxInt = int32ToAuxInt(off1 + off2)
4929                 v.Aux = symToAux(mergeSym(sym1, sym2))
4930                 v.AddArg2(base, mem)
4931                 return true
4932         }
4933         return false
4934 }
4935 func rewriteValue386_Op386MOVSSstore(v *Value) bool {
4936         v_2 := v.Args[2]
4937         v_1 := v.Args[1]
4938         v_0 := v.Args[0]
4939         b := v.Block
4940         config := b.Func.Config
4941         // match: (MOVSSstore [off1] {sym} (ADDLconst [off2] ptr) val mem)
4942         // cond: is32Bit(int64(off1)+int64(off2))
4943         // result: (MOVSSstore [off1+off2] {sym} ptr val mem)
4944         for {
4945                 off1 := auxIntToInt32(v.AuxInt)
4946                 sym := auxToSym(v.Aux)
4947                 if v_0.Op != Op386ADDLconst {
4948                         break
4949                 }
4950                 off2 := auxIntToInt32(v_0.AuxInt)
4951                 ptr := v_0.Args[0]
4952                 val := v_1
4953                 mem := v_2
4954                 if !(is32Bit(int64(off1) + int64(off2))) {
4955                         break
4956                 }
4957                 v.reset(Op386MOVSSstore)
4958                 v.AuxInt = int32ToAuxInt(off1 + off2)
4959                 v.Aux = symToAux(sym)
4960                 v.AddArg3(ptr, val, mem)
4961                 return true
4962         }
4963         // match: (MOVSSstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
4964         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
4965         // result: (MOVSSstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
4966         for {
4967                 off1 := auxIntToInt32(v.AuxInt)
4968                 sym1 := auxToSym(v.Aux)
4969                 if v_0.Op != Op386LEAL {
4970                         break
4971                 }
4972                 off2 := auxIntToInt32(v_0.AuxInt)
4973                 sym2 := auxToSym(v_0.Aux)
4974                 base := v_0.Args[0]
4975                 val := v_1
4976                 mem := v_2
4977                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
4978                         break
4979                 }
4980                 v.reset(Op386MOVSSstore)
4981                 v.AuxInt = int32ToAuxInt(off1 + off2)
4982                 v.Aux = symToAux(mergeSym(sym1, sym2))
4983                 v.AddArg3(base, val, mem)
4984                 return true
4985         }
4986         return false
4987 }
4988 func rewriteValue386_Op386MOVWLSX(v *Value) bool {
4989         v_0 := v.Args[0]
4990         b := v.Block
4991         // match: (MOVWLSX x:(MOVWload [off] {sym} ptr mem))
4992         // cond: x.Uses == 1 && clobber(x)
4993         // result: @x.Block (MOVWLSXload <v.Type> [off] {sym} ptr mem)
4994         for {
4995                 x := v_0
4996                 if x.Op != Op386MOVWload {
4997                         break
4998                 }
4999                 off := auxIntToInt32(x.AuxInt)
5000                 sym := auxToSym(x.Aux)
5001                 mem := x.Args[1]
5002                 ptr := x.Args[0]
5003                 if !(x.Uses == 1 && clobber(x)) {
5004                         break
5005                 }
5006                 b = x.Block
5007                 v0 := b.NewValue0(x.Pos, Op386MOVWLSXload, v.Type)
5008                 v.copyOf(v0)
5009                 v0.AuxInt = int32ToAuxInt(off)
5010                 v0.Aux = symToAux(sym)
5011                 v0.AddArg2(ptr, mem)
5012                 return true
5013         }
5014         // match: (MOVWLSX (ANDLconst [c] x))
5015         // cond: c & 0x8000 == 0
5016         // result: (ANDLconst [c & 0x7fff] x)
5017         for {
5018                 if v_0.Op != Op386ANDLconst {
5019                         break
5020                 }
5021                 c := auxIntToInt32(v_0.AuxInt)
5022                 x := v_0.Args[0]
5023                 if !(c&0x8000 == 0) {
5024                         break
5025                 }
5026                 v.reset(Op386ANDLconst)
5027                 v.AuxInt = int32ToAuxInt(c & 0x7fff)
5028                 v.AddArg(x)
5029                 return true
5030         }
5031         return false
5032 }
5033 func rewriteValue386_Op386MOVWLSXload(v *Value) bool {
5034         v_1 := v.Args[1]
5035         v_0 := v.Args[0]
5036         b := v.Block
5037         config := b.Func.Config
5038         // match: (MOVWLSXload [off] {sym} ptr (MOVWstore [off2] {sym2} ptr2 x _))
5039         // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
5040         // result: (MOVWLSX x)
5041         for {
5042                 off := auxIntToInt32(v.AuxInt)
5043                 sym := auxToSym(v.Aux)
5044                 ptr := v_0
5045                 if v_1.Op != Op386MOVWstore {
5046                         break
5047                 }
5048                 off2 := auxIntToInt32(v_1.AuxInt)
5049                 sym2 := auxToSym(v_1.Aux)
5050                 x := v_1.Args[1]
5051                 ptr2 := v_1.Args[0]
5052                 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
5053                         break
5054                 }
5055                 v.reset(Op386MOVWLSX)
5056                 v.AddArg(x)
5057                 return true
5058         }
5059         // match: (MOVWLSXload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
5060         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
5061         // result: (MOVWLSXload [off1+off2] {mergeSym(sym1,sym2)} base mem)
5062         for {
5063                 off1 := auxIntToInt32(v.AuxInt)
5064                 sym1 := auxToSym(v.Aux)
5065                 if v_0.Op != Op386LEAL {
5066                         break
5067                 }
5068                 off2 := auxIntToInt32(v_0.AuxInt)
5069                 sym2 := auxToSym(v_0.Aux)
5070                 base := v_0.Args[0]
5071                 mem := v_1
5072                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
5073                         break
5074                 }
5075                 v.reset(Op386MOVWLSXload)
5076                 v.AuxInt = int32ToAuxInt(off1 + off2)
5077                 v.Aux = symToAux(mergeSym(sym1, sym2))
5078                 v.AddArg2(base, mem)
5079                 return true
5080         }
5081         return false
5082 }
5083 func rewriteValue386_Op386MOVWLZX(v *Value) bool {
5084         v_0 := v.Args[0]
5085         b := v.Block
5086         // match: (MOVWLZX x:(MOVWload [off] {sym} ptr mem))
5087         // cond: x.Uses == 1 && clobber(x)
5088         // result: @x.Block (MOVWload <v.Type> [off] {sym} ptr mem)
5089         for {
5090                 x := v_0
5091                 if x.Op != Op386MOVWload {
5092                         break
5093                 }
5094                 off := auxIntToInt32(x.AuxInt)
5095                 sym := auxToSym(x.Aux)
5096                 mem := x.Args[1]
5097                 ptr := x.Args[0]
5098                 if !(x.Uses == 1 && clobber(x)) {
5099                         break
5100                 }
5101                 b = x.Block
5102                 v0 := b.NewValue0(x.Pos, Op386MOVWload, v.Type)
5103                 v.copyOf(v0)
5104                 v0.AuxInt = int32ToAuxInt(off)
5105                 v0.Aux = symToAux(sym)
5106                 v0.AddArg2(ptr, mem)
5107                 return true
5108         }
5109         // match: (MOVWLZX (ANDLconst [c] x))
5110         // result: (ANDLconst [c & 0xffff] x)
5111         for {
5112                 if v_0.Op != Op386ANDLconst {
5113                         break
5114                 }
5115                 c := auxIntToInt32(v_0.AuxInt)
5116                 x := v_0.Args[0]
5117                 v.reset(Op386ANDLconst)
5118                 v.AuxInt = int32ToAuxInt(c & 0xffff)
5119                 v.AddArg(x)
5120                 return true
5121         }
5122         return false
5123 }
5124 func rewriteValue386_Op386MOVWload(v *Value) bool {
5125         v_1 := v.Args[1]
5126         v_0 := v.Args[0]
5127         b := v.Block
5128         config := b.Func.Config
5129         // match: (MOVWload [off] {sym} ptr (MOVWstore [off2] {sym2} ptr2 x _))
5130         // cond: sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)
5131         // result: (MOVWLZX x)
5132         for {
5133                 off := auxIntToInt32(v.AuxInt)
5134                 sym := auxToSym(v.Aux)
5135                 ptr := v_0
5136                 if v_1.Op != Op386MOVWstore {
5137                         break
5138                 }
5139                 off2 := auxIntToInt32(v_1.AuxInt)
5140                 sym2 := auxToSym(v_1.Aux)
5141                 x := v_1.Args[1]
5142                 ptr2 := v_1.Args[0]
5143                 if !(sym == sym2 && off == off2 && isSamePtr(ptr, ptr2)) {
5144                         break
5145                 }
5146                 v.reset(Op386MOVWLZX)
5147                 v.AddArg(x)
5148                 return true
5149         }
5150         // match: (MOVWload [off1] {sym} (ADDLconst [off2] ptr) mem)
5151         // cond: is32Bit(int64(off1)+int64(off2))
5152         // result: (MOVWload [off1+off2] {sym} ptr mem)
5153         for {
5154                 off1 := auxIntToInt32(v.AuxInt)
5155                 sym := auxToSym(v.Aux)
5156                 if v_0.Op != Op386ADDLconst {
5157                         break
5158                 }
5159                 off2 := auxIntToInt32(v_0.AuxInt)
5160                 ptr := v_0.Args[0]
5161                 mem := v_1
5162                 if !(is32Bit(int64(off1) + int64(off2))) {
5163                         break
5164                 }
5165                 v.reset(Op386MOVWload)
5166                 v.AuxInt = int32ToAuxInt(off1 + off2)
5167                 v.Aux = symToAux(sym)
5168                 v.AddArg2(ptr, mem)
5169                 return true
5170         }
5171         // match: (MOVWload [off1] {sym1} (LEAL [off2] {sym2} base) mem)
5172         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
5173         // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} base mem)
5174         for {
5175                 off1 := auxIntToInt32(v.AuxInt)
5176                 sym1 := auxToSym(v.Aux)
5177                 if v_0.Op != Op386LEAL {
5178                         break
5179                 }
5180                 off2 := auxIntToInt32(v_0.AuxInt)
5181                 sym2 := auxToSym(v_0.Aux)
5182                 base := v_0.Args[0]
5183                 mem := v_1
5184                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
5185                         break
5186                 }
5187                 v.reset(Op386MOVWload)
5188                 v.AuxInt = int32ToAuxInt(off1 + off2)
5189                 v.Aux = symToAux(mergeSym(sym1, sym2))
5190                 v.AddArg2(base, mem)
5191                 return true
5192         }
5193         // match: (MOVWload [off] {sym} (SB) _)
5194         // cond: symIsRO(sym)
5195         // result: (MOVLconst [int32(read16(sym, int64(off), config.ctxt.Arch.ByteOrder))])
5196         for {
5197                 off := auxIntToInt32(v.AuxInt)
5198                 sym := auxToSym(v.Aux)
5199                 if v_0.Op != OpSB || !(symIsRO(sym)) {
5200                         break
5201                 }
5202                 v.reset(Op386MOVLconst)
5203                 v.AuxInt = int32ToAuxInt(int32(read16(sym, int64(off), config.ctxt.Arch.ByteOrder)))
5204                 return true
5205         }
5206         return false
5207 }
5208 func rewriteValue386_Op386MOVWstore(v *Value) bool {
5209         v_2 := v.Args[2]
5210         v_1 := v.Args[1]
5211         v_0 := v.Args[0]
5212         b := v.Block
5213         config := b.Func.Config
5214         // match: (MOVWstore [off] {sym} ptr (MOVWLSX x) mem)
5215         // result: (MOVWstore [off] {sym} ptr x mem)
5216         for {
5217                 off := auxIntToInt32(v.AuxInt)
5218                 sym := auxToSym(v.Aux)
5219                 ptr := v_0
5220                 if v_1.Op != Op386MOVWLSX {
5221                         break
5222                 }
5223                 x := v_1.Args[0]
5224                 mem := v_2
5225                 v.reset(Op386MOVWstore)
5226                 v.AuxInt = int32ToAuxInt(off)
5227                 v.Aux = symToAux(sym)
5228                 v.AddArg3(ptr, x, mem)
5229                 return true
5230         }
5231         // match: (MOVWstore [off] {sym} ptr (MOVWLZX x) mem)
5232         // result: (MOVWstore [off] {sym} ptr x mem)
5233         for {
5234                 off := auxIntToInt32(v.AuxInt)
5235                 sym := auxToSym(v.Aux)
5236                 ptr := v_0
5237                 if v_1.Op != Op386MOVWLZX {
5238                         break
5239                 }
5240                 x := v_1.Args[0]
5241                 mem := v_2
5242                 v.reset(Op386MOVWstore)
5243                 v.AuxInt = int32ToAuxInt(off)
5244                 v.Aux = symToAux(sym)
5245                 v.AddArg3(ptr, x, mem)
5246                 return true
5247         }
5248         // match: (MOVWstore [off1] {sym} (ADDLconst [off2] ptr) val mem)
5249         // cond: is32Bit(int64(off1)+int64(off2))
5250         // result: (MOVWstore [off1+off2] {sym} ptr val mem)
5251         for {
5252                 off1 := auxIntToInt32(v.AuxInt)
5253                 sym := auxToSym(v.Aux)
5254                 if v_0.Op != Op386ADDLconst {
5255                         break
5256                 }
5257                 off2 := auxIntToInt32(v_0.AuxInt)
5258                 ptr := v_0.Args[0]
5259                 val := v_1
5260                 mem := v_2
5261                 if !(is32Bit(int64(off1) + int64(off2))) {
5262                         break
5263                 }
5264                 v.reset(Op386MOVWstore)
5265                 v.AuxInt = int32ToAuxInt(off1 + off2)
5266                 v.Aux = symToAux(sym)
5267                 v.AddArg3(ptr, val, mem)
5268                 return true
5269         }
5270         // match: (MOVWstore [off] {sym} ptr (MOVLconst [c]) mem)
5271         // result: (MOVWstoreconst [makeValAndOff(c,off)] {sym} ptr mem)
5272         for {
5273                 off := auxIntToInt32(v.AuxInt)
5274                 sym := auxToSym(v.Aux)
5275                 ptr := v_0
5276                 if v_1.Op != Op386MOVLconst {
5277                         break
5278                 }
5279                 c := auxIntToInt32(v_1.AuxInt)
5280                 mem := v_2
5281                 v.reset(Op386MOVWstoreconst)
5282                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(c, off))
5283                 v.Aux = symToAux(sym)
5284                 v.AddArg2(ptr, mem)
5285                 return true
5286         }
5287         // match: (MOVWstore [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
5288         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
5289         // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} base val mem)
5290         for {
5291                 off1 := auxIntToInt32(v.AuxInt)
5292                 sym1 := auxToSym(v.Aux)
5293                 if v_0.Op != Op386LEAL {
5294                         break
5295                 }
5296                 off2 := auxIntToInt32(v_0.AuxInt)
5297                 sym2 := auxToSym(v_0.Aux)
5298                 base := v_0.Args[0]
5299                 val := v_1
5300                 mem := v_2
5301                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
5302                         break
5303                 }
5304                 v.reset(Op386MOVWstore)
5305                 v.AuxInt = int32ToAuxInt(off1 + off2)
5306                 v.Aux = symToAux(mergeSym(sym1, sym2))
5307                 v.AddArg3(base, val, mem)
5308                 return true
5309         }
5310         // match: (MOVWstore [i] {s} p (SHRLconst [16] w) x:(MOVWstore [i-2] {s} p w mem))
5311         // cond: x.Uses == 1 && clobber(x)
5312         // result: (MOVLstore [i-2] {s} p w mem)
5313         for {
5314                 i := auxIntToInt32(v.AuxInt)
5315                 s := auxToSym(v.Aux)
5316                 p := v_0
5317                 if v_1.Op != Op386SHRLconst || auxIntToInt32(v_1.AuxInt) != 16 {
5318                         break
5319                 }
5320                 w := v_1.Args[0]
5321                 x := v_2
5322                 if x.Op != Op386MOVWstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s {
5323                         break
5324                 }
5325                 mem := x.Args[2]
5326                 if p != x.Args[0] || w != x.Args[1] || !(x.Uses == 1 && clobber(x)) {
5327                         break
5328                 }
5329                 v.reset(Op386MOVLstore)
5330                 v.AuxInt = int32ToAuxInt(i - 2)
5331                 v.Aux = symToAux(s)
5332                 v.AddArg3(p, w, mem)
5333                 return true
5334         }
5335         // match: (MOVWstore [i] {s} p (SHRLconst [j] w) x:(MOVWstore [i-2] {s} p w0:(SHRLconst [j-16] w) mem))
5336         // cond: x.Uses == 1 && clobber(x)
5337         // result: (MOVLstore [i-2] {s} p w0 mem)
5338         for {
5339                 i := auxIntToInt32(v.AuxInt)
5340                 s := auxToSym(v.Aux)
5341                 p := v_0
5342                 if v_1.Op != Op386SHRLconst {
5343                         break
5344                 }
5345                 j := auxIntToInt32(v_1.AuxInt)
5346                 w := v_1.Args[0]
5347                 x := v_2
5348                 if x.Op != Op386MOVWstore || auxIntToInt32(x.AuxInt) != i-2 || auxToSym(x.Aux) != s {
5349                         break
5350                 }
5351                 mem := x.Args[2]
5352                 if p != x.Args[0] {
5353                         break
5354                 }
5355                 w0 := x.Args[1]
5356                 if w0.Op != Op386SHRLconst || auxIntToInt32(w0.AuxInt) != j-16 || w != w0.Args[0] || !(x.Uses == 1 && clobber(x)) {
5357                         break
5358                 }
5359                 v.reset(Op386MOVLstore)
5360                 v.AuxInt = int32ToAuxInt(i - 2)
5361                 v.Aux = symToAux(s)
5362                 v.AddArg3(p, w0, mem)
5363                 return true
5364         }
5365         // match: (MOVWstore [i] {s} p1 (SHRLconst [16] w) x:(MOVWstore [i] {s} p0 w mem))
5366         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 2) && clobber(x)
5367         // result: (MOVLstore [i] {s} p0 w mem)
5368         for {
5369                 i := auxIntToInt32(v.AuxInt)
5370                 s := auxToSym(v.Aux)
5371                 p1 := v_0
5372                 if v_1.Op != Op386SHRLconst || auxIntToInt32(v_1.AuxInt) != 16 {
5373                         break
5374                 }
5375                 w := v_1.Args[0]
5376                 x := v_2
5377                 if x.Op != Op386MOVWstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
5378                         break
5379                 }
5380                 mem := x.Args[2]
5381                 p0 := x.Args[0]
5382                 if w != x.Args[1] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 2) && clobber(x)) {
5383                         break
5384                 }
5385                 v.reset(Op386MOVLstore)
5386                 v.AuxInt = int32ToAuxInt(i)
5387                 v.Aux = symToAux(s)
5388                 v.AddArg3(p0, w, mem)
5389                 return true
5390         }
5391         // match: (MOVWstore [i] {s} p1 (SHRLconst [j] w) x:(MOVWstore [i] {s} p0 w0:(SHRLconst [j-16] w) mem))
5392         // cond: x.Uses == 1 && sequentialAddresses(p0, p1, 2) && clobber(x)
5393         // result: (MOVLstore [i] {s} p0 w0 mem)
5394         for {
5395                 i := auxIntToInt32(v.AuxInt)
5396                 s := auxToSym(v.Aux)
5397                 p1 := v_0
5398                 if v_1.Op != Op386SHRLconst {
5399                         break
5400                 }
5401                 j := auxIntToInt32(v_1.AuxInt)
5402                 w := v_1.Args[0]
5403                 x := v_2
5404                 if x.Op != Op386MOVWstore || auxIntToInt32(x.AuxInt) != i || auxToSym(x.Aux) != s {
5405                         break
5406                 }
5407                 mem := x.Args[2]
5408                 p0 := x.Args[0]
5409                 w0 := x.Args[1]
5410                 if w0.Op != Op386SHRLconst || auxIntToInt32(w0.AuxInt) != j-16 || w != w0.Args[0] || !(x.Uses == 1 && sequentialAddresses(p0, p1, 2) && clobber(x)) {
5411                         break
5412                 }
5413                 v.reset(Op386MOVLstore)
5414                 v.AuxInt = int32ToAuxInt(i)
5415                 v.Aux = symToAux(s)
5416                 v.AddArg3(p0, w0, mem)
5417                 return true
5418         }
5419         return false
5420 }
5421 func rewriteValue386_Op386MOVWstoreconst(v *Value) bool {
5422         v_1 := v.Args[1]
5423         v_0 := v.Args[0]
5424         b := v.Block
5425         config := b.Func.Config
5426         // match: (MOVWstoreconst [sc] {s} (ADDLconst [off] ptr) mem)
5427         // cond: sc.canAdd32(off)
5428         // result: (MOVWstoreconst [sc.addOffset32(off)] {s} ptr mem)
5429         for {
5430                 sc := auxIntToValAndOff(v.AuxInt)
5431                 s := auxToSym(v.Aux)
5432                 if v_0.Op != Op386ADDLconst {
5433                         break
5434                 }
5435                 off := auxIntToInt32(v_0.AuxInt)
5436                 ptr := v_0.Args[0]
5437                 mem := v_1
5438                 if !(sc.canAdd32(off)) {
5439                         break
5440                 }
5441                 v.reset(Op386MOVWstoreconst)
5442                 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
5443                 v.Aux = symToAux(s)
5444                 v.AddArg2(ptr, mem)
5445                 return true
5446         }
5447         // match: (MOVWstoreconst [sc] {sym1} (LEAL [off] {sym2} ptr) mem)
5448         // cond: canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)
5449         // result: (MOVWstoreconst [sc.addOffset32(off)] {mergeSym(sym1, sym2)} ptr mem)
5450         for {
5451                 sc := auxIntToValAndOff(v.AuxInt)
5452                 sym1 := auxToSym(v.Aux)
5453                 if v_0.Op != Op386LEAL {
5454                         break
5455                 }
5456                 off := auxIntToInt32(v_0.AuxInt)
5457                 sym2 := auxToSym(v_0.Aux)
5458                 ptr := v_0.Args[0]
5459                 mem := v_1
5460                 if !(canMergeSym(sym1, sym2) && sc.canAdd32(off) && (ptr.Op != OpSB || !config.ctxt.Flag_shared)) {
5461                         break
5462                 }
5463                 v.reset(Op386MOVWstoreconst)
5464                 v.AuxInt = valAndOffToAuxInt(sc.addOffset32(off))
5465                 v.Aux = symToAux(mergeSym(sym1, sym2))
5466                 v.AddArg2(ptr, mem)
5467                 return true
5468         }
5469         // match: (MOVWstoreconst [c] {s} p x:(MOVWstoreconst [a] {s} p mem))
5470         // cond: x.Uses == 1 && a.Off() + 2 == c.Off() && clobber(x)
5471         // result: (MOVLstoreconst [makeValAndOff(a.Val()&0xffff | c.Val()<<16, a.Off())] {s} p mem)
5472         for {
5473                 c := auxIntToValAndOff(v.AuxInt)
5474                 s := auxToSym(v.Aux)
5475                 p := v_0
5476                 x := v_1
5477                 if x.Op != Op386MOVWstoreconst {
5478                         break
5479                 }
5480                 a := auxIntToValAndOff(x.AuxInt)
5481                 if auxToSym(x.Aux) != s {
5482                         break
5483                 }
5484                 mem := x.Args[1]
5485                 if p != x.Args[0] || !(x.Uses == 1 && a.Off()+2 == c.Off() && clobber(x)) {
5486                         break
5487                 }
5488                 v.reset(Op386MOVLstoreconst)
5489                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xffff|c.Val()<<16, a.Off()))
5490                 v.Aux = symToAux(s)
5491                 v.AddArg2(p, mem)
5492                 return true
5493         }
5494         // match: (MOVWstoreconst [a] {s} p x:(MOVWstoreconst [c] {s} p mem))
5495         // cond: x.Uses == 1 && ValAndOff(a).Off() + 2 == ValAndOff(c).Off() && clobber(x)
5496         // result: (MOVLstoreconst [makeValAndOff(a.Val()&0xffff | c.Val()<<16, a.Off())] {s} p mem)
5497         for {
5498                 a := auxIntToValAndOff(v.AuxInt)
5499                 s := auxToSym(v.Aux)
5500                 p := v_0
5501                 x := v_1
5502                 if x.Op != Op386MOVWstoreconst {
5503                         break
5504                 }
5505                 c := auxIntToValAndOff(x.AuxInt)
5506                 if auxToSym(x.Aux) != s {
5507                         break
5508                 }
5509                 mem := x.Args[1]
5510                 if p != x.Args[0] || !(x.Uses == 1 && ValAndOff(a).Off()+2 == ValAndOff(c).Off() && clobber(x)) {
5511                         break
5512                 }
5513                 v.reset(Op386MOVLstoreconst)
5514                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xffff|c.Val()<<16, a.Off()))
5515                 v.Aux = symToAux(s)
5516                 v.AddArg2(p, mem)
5517                 return true
5518         }
5519         // match: (MOVWstoreconst [c] {s} p1 x:(MOVWstoreconst [a] {s} p0 mem))
5520         // cond: x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 2) && clobber(x)
5521         // result: (MOVLstoreconst [makeValAndOff(a.Val()&0xffff | c.Val()<<16, a.Off())] {s} p0 mem)
5522         for {
5523                 c := auxIntToValAndOff(v.AuxInt)
5524                 s := auxToSym(v.Aux)
5525                 p1 := v_0
5526                 x := v_1
5527                 if x.Op != Op386MOVWstoreconst {
5528                         break
5529                 }
5530                 a := auxIntToValAndOff(x.AuxInt)
5531                 if auxToSym(x.Aux) != s {
5532                         break
5533                 }
5534                 mem := x.Args[1]
5535                 p0 := x.Args[0]
5536                 if !(x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 2) && clobber(x)) {
5537                         break
5538                 }
5539                 v.reset(Op386MOVLstoreconst)
5540                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xffff|c.Val()<<16, a.Off()))
5541                 v.Aux = symToAux(s)
5542                 v.AddArg2(p0, mem)
5543                 return true
5544         }
5545         // match: (MOVWstoreconst [a] {s} p0 x:(MOVWstoreconst [c] {s} p1 mem))
5546         // cond: x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 2) && clobber(x)
5547         // result: (MOVLstoreconst [makeValAndOff(a.Val()&0xffff | c.Val()<<16, a.Off())] {s} p0 mem)
5548         for {
5549                 a := auxIntToValAndOff(v.AuxInt)
5550                 s := auxToSym(v.Aux)
5551                 p0 := v_0
5552                 x := v_1
5553                 if x.Op != Op386MOVWstoreconst {
5554                         break
5555                 }
5556                 c := auxIntToValAndOff(x.AuxInt)
5557                 if auxToSym(x.Aux) != s {
5558                         break
5559                 }
5560                 mem := x.Args[1]
5561                 p1 := x.Args[0]
5562                 if !(x.Uses == 1 && a.Off() == c.Off() && sequentialAddresses(p0, p1, 2) && clobber(x)) {
5563                         break
5564                 }
5565                 v.reset(Op386MOVLstoreconst)
5566                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(a.Val()&0xffff|c.Val()<<16, a.Off()))
5567                 v.Aux = symToAux(s)
5568                 v.AddArg2(p0, mem)
5569                 return true
5570         }
5571         return false
5572 }
5573 func rewriteValue386_Op386MULL(v *Value) bool {
5574         v_1 := v.Args[1]
5575         v_0 := v.Args[0]
5576         // match: (MULL x (MOVLconst [c]))
5577         // result: (MULLconst [c] x)
5578         for {
5579                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5580                         x := v_0
5581                         if v_1.Op != Op386MOVLconst {
5582                                 continue
5583                         }
5584                         c := auxIntToInt32(v_1.AuxInt)
5585                         v.reset(Op386MULLconst)
5586                         v.AuxInt = int32ToAuxInt(c)
5587                         v.AddArg(x)
5588                         return true
5589                 }
5590                 break
5591         }
5592         // match: (MULL x l:(MOVLload [off] {sym} ptr mem))
5593         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
5594         // result: (MULLload x [off] {sym} ptr mem)
5595         for {
5596                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5597                         x := v_0
5598                         l := v_1
5599                         if l.Op != Op386MOVLload {
5600                                 continue
5601                         }
5602                         off := auxIntToInt32(l.AuxInt)
5603                         sym := auxToSym(l.Aux)
5604                         mem := l.Args[1]
5605                         ptr := l.Args[0]
5606                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
5607                                 continue
5608                         }
5609                         v.reset(Op386MULLload)
5610                         v.AuxInt = int32ToAuxInt(off)
5611                         v.Aux = symToAux(sym)
5612                         v.AddArg3(x, ptr, mem)
5613                         return true
5614                 }
5615                 break
5616         }
5617         return false
5618 }
5619 func rewriteValue386_Op386MULLconst(v *Value) bool {
5620         v_0 := v.Args[0]
5621         b := v.Block
5622         // match: (MULLconst [c] (MULLconst [d] x))
5623         // result: (MULLconst [c * d] x)
5624         for {
5625                 c := auxIntToInt32(v.AuxInt)
5626                 if v_0.Op != Op386MULLconst {
5627                         break
5628                 }
5629                 d := auxIntToInt32(v_0.AuxInt)
5630                 x := v_0.Args[0]
5631                 v.reset(Op386MULLconst)
5632                 v.AuxInt = int32ToAuxInt(c * d)
5633                 v.AddArg(x)
5634                 return true
5635         }
5636         // match: (MULLconst [-9] x)
5637         // result: (NEGL (LEAL8 <v.Type> x x))
5638         for {
5639                 if auxIntToInt32(v.AuxInt) != -9 {
5640                         break
5641                 }
5642                 x := v_0
5643                 v.reset(Op386NEGL)
5644                 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type)
5645                 v0.AddArg2(x, x)
5646                 v.AddArg(v0)
5647                 return true
5648         }
5649         // match: (MULLconst [-5] x)
5650         // result: (NEGL (LEAL4 <v.Type> x x))
5651         for {
5652                 if auxIntToInt32(v.AuxInt) != -5 {
5653                         break
5654                 }
5655                 x := v_0
5656                 v.reset(Op386NEGL)
5657                 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type)
5658                 v0.AddArg2(x, x)
5659                 v.AddArg(v0)
5660                 return true
5661         }
5662         // match: (MULLconst [-3] x)
5663         // result: (NEGL (LEAL2 <v.Type> x x))
5664         for {
5665                 if auxIntToInt32(v.AuxInt) != -3 {
5666                         break
5667                 }
5668                 x := v_0
5669                 v.reset(Op386NEGL)
5670                 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type)
5671                 v0.AddArg2(x, x)
5672                 v.AddArg(v0)
5673                 return true
5674         }
5675         // match: (MULLconst [-1] x)
5676         // result: (NEGL x)
5677         for {
5678                 if auxIntToInt32(v.AuxInt) != -1 {
5679                         break
5680                 }
5681                 x := v_0
5682                 v.reset(Op386NEGL)
5683                 v.AddArg(x)
5684                 return true
5685         }
5686         // match: (MULLconst [0] _)
5687         // result: (MOVLconst [0])
5688         for {
5689                 if auxIntToInt32(v.AuxInt) != 0 {
5690                         break
5691                 }
5692                 v.reset(Op386MOVLconst)
5693                 v.AuxInt = int32ToAuxInt(0)
5694                 return true
5695         }
5696         // match: (MULLconst [1] x)
5697         // result: x
5698         for {
5699                 if auxIntToInt32(v.AuxInt) != 1 {
5700                         break
5701                 }
5702                 x := v_0
5703                 v.copyOf(x)
5704                 return true
5705         }
5706         // match: (MULLconst [3] x)
5707         // result: (LEAL2 x x)
5708         for {
5709                 if auxIntToInt32(v.AuxInt) != 3 {
5710                         break
5711                 }
5712                 x := v_0
5713                 v.reset(Op386LEAL2)
5714                 v.AddArg2(x, x)
5715                 return true
5716         }
5717         // match: (MULLconst [5] x)
5718         // result: (LEAL4 x x)
5719         for {
5720                 if auxIntToInt32(v.AuxInt) != 5 {
5721                         break
5722                 }
5723                 x := v_0
5724                 v.reset(Op386LEAL4)
5725                 v.AddArg2(x, x)
5726                 return true
5727         }
5728         // match: (MULLconst [7] x)
5729         // result: (LEAL2 x (LEAL2 <v.Type> x x))
5730         for {
5731                 if auxIntToInt32(v.AuxInt) != 7 {
5732                         break
5733                 }
5734                 x := v_0
5735                 v.reset(Op386LEAL2)
5736                 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type)
5737                 v0.AddArg2(x, x)
5738                 v.AddArg2(x, v0)
5739                 return true
5740         }
5741         // match: (MULLconst [9] x)
5742         // result: (LEAL8 x x)
5743         for {
5744                 if auxIntToInt32(v.AuxInt) != 9 {
5745                         break
5746                 }
5747                 x := v_0
5748                 v.reset(Op386LEAL8)
5749                 v.AddArg2(x, x)
5750                 return true
5751         }
5752         // match: (MULLconst [11] x)
5753         // result: (LEAL2 x (LEAL4 <v.Type> x x))
5754         for {
5755                 if auxIntToInt32(v.AuxInt) != 11 {
5756                         break
5757                 }
5758                 x := v_0
5759                 v.reset(Op386LEAL2)
5760                 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type)
5761                 v0.AddArg2(x, x)
5762                 v.AddArg2(x, v0)
5763                 return true
5764         }
5765         // match: (MULLconst [13] x)
5766         // result: (LEAL4 x (LEAL2 <v.Type> x x))
5767         for {
5768                 if auxIntToInt32(v.AuxInt) != 13 {
5769                         break
5770                 }
5771                 x := v_0
5772                 v.reset(Op386LEAL4)
5773                 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type)
5774                 v0.AddArg2(x, x)
5775                 v.AddArg2(x, v0)
5776                 return true
5777         }
5778         // match: (MULLconst [19] x)
5779         // result: (LEAL2 x (LEAL8 <v.Type> x x))
5780         for {
5781                 if auxIntToInt32(v.AuxInt) != 19 {
5782                         break
5783                 }
5784                 x := v_0
5785                 v.reset(Op386LEAL2)
5786                 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type)
5787                 v0.AddArg2(x, x)
5788                 v.AddArg2(x, v0)
5789                 return true
5790         }
5791         // match: (MULLconst [21] x)
5792         // result: (LEAL4 x (LEAL4 <v.Type> x x))
5793         for {
5794                 if auxIntToInt32(v.AuxInt) != 21 {
5795                         break
5796                 }
5797                 x := v_0
5798                 v.reset(Op386LEAL4)
5799                 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type)
5800                 v0.AddArg2(x, x)
5801                 v.AddArg2(x, v0)
5802                 return true
5803         }
5804         // match: (MULLconst [25] x)
5805         // result: (LEAL8 x (LEAL2 <v.Type> x x))
5806         for {
5807                 if auxIntToInt32(v.AuxInt) != 25 {
5808                         break
5809                 }
5810                 x := v_0
5811                 v.reset(Op386LEAL8)
5812                 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type)
5813                 v0.AddArg2(x, x)
5814                 v.AddArg2(x, v0)
5815                 return true
5816         }
5817         // match: (MULLconst [27] x)
5818         // result: (LEAL8 (LEAL2 <v.Type> x x) (LEAL2 <v.Type> x x))
5819         for {
5820                 if auxIntToInt32(v.AuxInt) != 27 {
5821                         break
5822                 }
5823                 x := v_0
5824                 v.reset(Op386LEAL8)
5825                 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type)
5826                 v0.AddArg2(x, x)
5827                 v.AddArg2(v0, v0)
5828                 return true
5829         }
5830         // match: (MULLconst [37] x)
5831         // result: (LEAL4 x (LEAL8 <v.Type> x x))
5832         for {
5833                 if auxIntToInt32(v.AuxInt) != 37 {
5834                         break
5835                 }
5836                 x := v_0
5837                 v.reset(Op386LEAL4)
5838                 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type)
5839                 v0.AddArg2(x, x)
5840                 v.AddArg2(x, v0)
5841                 return true
5842         }
5843         // match: (MULLconst [41] x)
5844         // result: (LEAL8 x (LEAL4 <v.Type> x x))
5845         for {
5846                 if auxIntToInt32(v.AuxInt) != 41 {
5847                         break
5848                 }
5849                 x := v_0
5850                 v.reset(Op386LEAL8)
5851                 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type)
5852                 v0.AddArg2(x, x)
5853                 v.AddArg2(x, v0)
5854                 return true
5855         }
5856         // match: (MULLconst [45] x)
5857         // result: (LEAL8 (LEAL4 <v.Type> x x) (LEAL4 <v.Type> x x))
5858         for {
5859                 if auxIntToInt32(v.AuxInt) != 45 {
5860                         break
5861                 }
5862                 x := v_0
5863                 v.reset(Op386LEAL8)
5864                 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type)
5865                 v0.AddArg2(x, x)
5866                 v.AddArg2(v0, v0)
5867                 return true
5868         }
5869         // match: (MULLconst [73] x)
5870         // result: (LEAL8 x (LEAL8 <v.Type> x x))
5871         for {
5872                 if auxIntToInt32(v.AuxInt) != 73 {
5873                         break
5874                 }
5875                 x := v_0
5876                 v.reset(Op386LEAL8)
5877                 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type)
5878                 v0.AddArg2(x, x)
5879                 v.AddArg2(x, v0)
5880                 return true
5881         }
5882         // match: (MULLconst [81] x)
5883         // result: (LEAL8 (LEAL8 <v.Type> x x) (LEAL8 <v.Type> x x))
5884         for {
5885                 if auxIntToInt32(v.AuxInt) != 81 {
5886                         break
5887                 }
5888                 x := v_0
5889                 v.reset(Op386LEAL8)
5890                 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type)
5891                 v0.AddArg2(x, x)
5892                 v.AddArg2(v0, v0)
5893                 return true
5894         }
5895         // match: (MULLconst [c] x)
5896         // cond: isPowerOfTwo32(c+1) && c >= 15
5897         // result: (SUBL (SHLLconst <v.Type> [int32(log32(c+1))] x) x)
5898         for {
5899                 c := auxIntToInt32(v.AuxInt)
5900                 x := v_0
5901                 if !(isPowerOfTwo32(c+1) && c >= 15) {
5902                         break
5903                 }
5904                 v.reset(Op386SUBL)
5905                 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type)
5906                 v0.AuxInt = int32ToAuxInt(int32(log32(c + 1)))
5907                 v0.AddArg(x)
5908                 v.AddArg2(v0, x)
5909                 return true
5910         }
5911         // match: (MULLconst [c] x)
5912         // cond: isPowerOfTwo32(c-1) && c >= 17
5913         // result: (LEAL1 (SHLLconst <v.Type> [int32(log32(c-1))] x) x)
5914         for {
5915                 c := auxIntToInt32(v.AuxInt)
5916                 x := v_0
5917                 if !(isPowerOfTwo32(c-1) && c >= 17) {
5918                         break
5919                 }
5920                 v.reset(Op386LEAL1)
5921                 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type)
5922                 v0.AuxInt = int32ToAuxInt(int32(log32(c - 1)))
5923                 v0.AddArg(x)
5924                 v.AddArg2(v0, x)
5925                 return true
5926         }
5927         // match: (MULLconst [c] x)
5928         // cond: isPowerOfTwo32(c-2) && c >= 34
5929         // result: (LEAL2 (SHLLconst <v.Type> [int32(log32(c-2))] x) x)
5930         for {
5931                 c := auxIntToInt32(v.AuxInt)
5932                 x := v_0
5933                 if !(isPowerOfTwo32(c-2) && c >= 34) {
5934                         break
5935                 }
5936                 v.reset(Op386LEAL2)
5937                 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type)
5938                 v0.AuxInt = int32ToAuxInt(int32(log32(c - 2)))
5939                 v0.AddArg(x)
5940                 v.AddArg2(v0, x)
5941                 return true
5942         }
5943         // match: (MULLconst [c] x)
5944         // cond: isPowerOfTwo32(c-4) && c >= 68
5945         // result: (LEAL4 (SHLLconst <v.Type> [int32(log32(c-4))] x) x)
5946         for {
5947                 c := auxIntToInt32(v.AuxInt)
5948                 x := v_0
5949                 if !(isPowerOfTwo32(c-4) && c >= 68) {
5950                         break
5951                 }
5952                 v.reset(Op386LEAL4)
5953                 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type)
5954                 v0.AuxInt = int32ToAuxInt(int32(log32(c - 4)))
5955                 v0.AddArg(x)
5956                 v.AddArg2(v0, x)
5957                 return true
5958         }
5959         // match: (MULLconst [c] x)
5960         // cond: isPowerOfTwo32(c-8) && c >= 136
5961         // result: (LEAL8 (SHLLconst <v.Type> [int32(log32(c-8))] x) x)
5962         for {
5963                 c := auxIntToInt32(v.AuxInt)
5964                 x := v_0
5965                 if !(isPowerOfTwo32(c-8) && c >= 136) {
5966                         break
5967                 }
5968                 v.reset(Op386LEAL8)
5969                 v0 := b.NewValue0(v.Pos, Op386SHLLconst, v.Type)
5970                 v0.AuxInt = int32ToAuxInt(int32(log32(c - 8)))
5971                 v0.AddArg(x)
5972                 v.AddArg2(v0, x)
5973                 return true
5974         }
5975         // match: (MULLconst [c] x)
5976         // cond: c%3 == 0 && isPowerOfTwo32(c/3)
5977         // result: (SHLLconst [int32(log32(c/3))] (LEAL2 <v.Type> x x))
5978         for {
5979                 c := auxIntToInt32(v.AuxInt)
5980                 x := v_0
5981                 if !(c%3 == 0 && isPowerOfTwo32(c/3)) {
5982                         break
5983                 }
5984                 v.reset(Op386SHLLconst)
5985                 v.AuxInt = int32ToAuxInt(int32(log32(c / 3)))
5986                 v0 := b.NewValue0(v.Pos, Op386LEAL2, v.Type)
5987                 v0.AddArg2(x, x)
5988                 v.AddArg(v0)
5989                 return true
5990         }
5991         // match: (MULLconst [c] x)
5992         // cond: c%5 == 0 && isPowerOfTwo32(c/5)
5993         // result: (SHLLconst [int32(log32(c/5))] (LEAL4 <v.Type> x x))
5994         for {
5995                 c := auxIntToInt32(v.AuxInt)
5996                 x := v_0
5997                 if !(c%5 == 0 && isPowerOfTwo32(c/5)) {
5998                         break
5999                 }
6000                 v.reset(Op386SHLLconst)
6001                 v.AuxInt = int32ToAuxInt(int32(log32(c / 5)))
6002                 v0 := b.NewValue0(v.Pos, Op386LEAL4, v.Type)
6003                 v0.AddArg2(x, x)
6004                 v.AddArg(v0)
6005                 return true
6006         }
6007         // match: (MULLconst [c] x)
6008         // cond: c%9 == 0 && isPowerOfTwo32(c/9)
6009         // result: (SHLLconst [int32(log32(c/9))] (LEAL8 <v.Type> x x))
6010         for {
6011                 c := auxIntToInt32(v.AuxInt)
6012                 x := v_0
6013                 if !(c%9 == 0 && isPowerOfTwo32(c/9)) {
6014                         break
6015                 }
6016                 v.reset(Op386SHLLconst)
6017                 v.AuxInt = int32ToAuxInt(int32(log32(c / 9)))
6018                 v0 := b.NewValue0(v.Pos, Op386LEAL8, v.Type)
6019                 v0.AddArg2(x, x)
6020                 v.AddArg(v0)
6021                 return true
6022         }
6023         // match: (MULLconst [c] (MOVLconst [d]))
6024         // result: (MOVLconst [c*d])
6025         for {
6026                 c := auxIntToInt32(v.AuxInt)
6027                 if v_0.Op != Op386MOVLconst {
6028                         break
6029                 }
6030                 d := auxIntToInt32(v_0.AuxInt)
6031                 v.reset(Op386MOVLconst)
6032                 v.AuxInt = int32ToAuxInt(c * d)
6033                 return true
6034         }
6035         return false
6036 }
6037 func rewriteValue386_Op386MULLload(v *Value) bool {
6038         v_2 := v.Args[2]
6039         v_1 := v.Args[1]
6040         v_0 := v.Args[0]
6041         b := v.Block
6042         config := b.Func.Config
6043         // match: (MULLload [off1] {sym} val (ADDLconst [off2] base) mem)
6044         // cond: is32Bit(int64(off1)+int64(off2))
6045         // result: (MULLload [off1+off2] {sym} val base mem)
6046         for {
6047                 off1 := auxIntToInt32(v.AuxInt)
6048                 sym := auxToSym(v.Aux)
6049                 val := v_0
6050                 if v_1.Op != Op386ADDLconst {
6051                         break
6052                 }
6053                 off2 := auxIntToInt32(v_1.AuxInt)
6054                 base := v_1.Args[0]
6055                 mem := v_2
6056                 if !(is32Bit(int64(off1) + int64(off2))) {
6057                         break
6058                 }
6059                 v.reset(Op386MULLload)
6060                 v.AuxInt = int32ToAuxInt(off1 + off2)
6061                 v.Aux = symToAux(sym)
6062                 v.AddArg3(val, base, mem)
6063                 return true
6064         }
6065         // match: (MULLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
6066         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
6067         // result: (MULLload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
6068         for {
6069                 off1 := auxIntToInt32(v.AuxInt)
6070                 sym1 := auxToSym(v.Aux)
6071                 val := v_0
6072                 if v_1.Op != Op386LEAL {
6073                         break
6074                 }
6075                 off2 := auxIntToInt32(v_1.AuxInt)
6076                 sym2 := auxToSym(v_1.Aux)
6077                 base := v_1.Args[0]
6078                 mem := v_2
6079                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
6080                         break
6081                 }
6082                 v.reset(Op386MULLload)
6083                 v.AuxInt = int32ToAuxInt(off1 + off2)
6084                 v.Aux = symToAux(mergeSym(sym1, sym2))
6085                 v.AddArg3(val, base, mem)
6086                 return true
6087         }
6088         return false
6089 }
6090 func rewriteValue386_Op386MULSD(v *Value) bool {
6091         v_1 := v.Args[1]
6092         v_0 := v.Args[0]
6093         // match: (MULSD x l:(MOVSDload [off] {sym} ptr mem))
6094         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
6095         // result: (MULSDload x [off] {sym} ptr mem)
6096         for {
6097                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6098                         x := v_0
6099                         l := v_1
6100                         if l.Op != Op386MOVSDload {
6101                                 continue
6102                         }
6103                         off := auxIntToInt32(l.AuxInt)
6104                         sym := auxToSym(l.Aux)
6105                         mem := l.Args[1]
6106                         ptr := l.Args[0]
6107                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
6108                                 continue
6109                         }
6110                         v.reset(Op386MULSDload)
6111                         v.AuxInt = int32ToAuxInt(off)
6112                         v.Aux = symToAux(sym)
6113                         v.AddArg3(x, ptr, mem)
6114                         return true
6115                 }
6116                 break
6117         }
6118         return false
6119 }
6120 func rewriteValue386_Op386MULSDload(v *Value) bool {
6121         v_2 := v.Args[2]
6122         v_1 := v.Args[1]
6123         v_0 := v.Args[0]
6124         b := v.Block
6125         config := b.Func.Config
6126         // match: (MULSDload [off1] {sym} val (ADDLconst [off2] base) mem)
6127         // cond: is32Bit(int64(off1)+int64(off2))
6128         // result: (MULSDload [off1+off2] {sym} val base mem)
6129         for {
6130                 off1 := auxIntToInt32(v.AuxInt)
6131                 sym := auxToSym(v.Aux)
6132                 val := v_0
6133                 if v_1.Op != Op386ADDLconst {
6134                         break
6135                 }
6136                 off2 := auxIntToInt32(v_1.AuxInt)
6137                 base := v_1.Args[0]
6138                 mem := v_2
6139                 if !(is32Bit(int64(off1) + int64(off2))) {
6140                         break
6141                 }
6142                 v.reset(Op386MULSDload)
6143                 v.AuxInt = int32ToAuxInt(off1 + off2)
6144                 v.Aux = symToAux(sym)
6145                 v.AddArg3(val, base, mem)
6146                 return true
6147         }
6148         // match: (MULSDload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
6149         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
6150         // result: (MULSDload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
6151         for {
6152                 off1 := auxIntToInt32(v.AuxInt)
6153                 sym1 := auxToSym(v.Aux)
6154                 val := v_0
6155                 if v_1.Op != Op386LEAL {
6156                         break
6157                 }
6158                 off2 := auxIntToInt32(v_1.AuxInt)
6159                 sym2 := auxToSym(v_1.Aux)
6160                 base := v_1.Args[0]
6161                 mem := v_2
6162                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
6163                         break
6164                 }
6165                 v.reset(Op386MULSDload)
6166                 v.AuxInt = int32ToAuxInt(off1 + off2)
6167                 v.Aux = symToAux(mergeSym(sym1, sym2))
6168                 v.AddArg3(val, base, mem)
6169                 return true
6170         }
6171         return false
6172 }
6173 func rewriteValue386_Op386MULSS(v *Value) bool {
6174         v_1 := v.Args[1]
6175         v_0 := v.Args[0]
6176         // match: (MULSS x l:(MOVSSload [off] {sym} ptr mem))
6177         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
6178         // result: (MULSSload x [off] {sym} ptr mem)
6179         for {
6180                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6181                         x := v_0
6182                         l := v_1
6183                         if l.Op != Op386MOVSSload {
6184                                 continue
6185                         }
6186                         off := auxIntToInt32(l.AuxInt)
6187                         sym := auxToSym(l.Aux)
6188                         mem := l.Args[1]
6189                         ptr := l.Args[0]
6190                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
6191                                 continue
6192                         }
6193                         v.reset(Op386MULSSload)
6194                         v.AuxInt = int32ToAuxInt(off)
6195                         v.Aux = symToAux(sym)
6196                         v.AddArg3(x, ptr, mem)
6197                         return true
6198                 }
6199                 break
6200         }
6201         return false
6202 }
6203 func rewriteValue386_Op386MULSSload(v *Value) bool {
6204         v_2 := v.Args[2]
6205         v_1 := v.Args[1]
6206         v_0 := v.Args[0]
6207         b := v.Block
6208         config := b.Func.Config
6209         // match: (MULSSload [off1] {sym} val (ADDLconst [off2] base) mem)
6210         // cond: is32Bit(int64(off1)+int64(off2))
6211         // result: (MULSSload [off1+off2] {sym} val base mem)
6212         for {
6213                 off1 := auxIntToInt32(v.AuxInt)
6214                 sym := auxToSym(v.Aux)
6215                 val := v_0
6216                 if v_1.Op != Op386ADDLconst {
6217                         break
6218                 }
6219                 off2 := auxIntToInt32(v_1.AuxInt)
6220                 base := v_1.Args[0]
6221                 mem := v_2
6222                 if !(is32Bit(int64(off1) + int64(off2))) {
6223                         break
6224                 }
6225                 v.reset(Op386MULSSload)
6226                 v.AuxInt = int32ToAuxInt(off1 + off2)
6227                 v.Aux = symToAux(sym)
6228                 v.AddArg3(val, base, mem)
6229                 return true
6230         }
6231         // match: (MULSSload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
6232         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
6233         // result: (MULSSload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
6234         for {
6235                 off1 := auxIntToInt32(v.AuxInt)
6236                 sym1 := auxToSym(v.Aux)
6237                 val := v_0
6238                 if v_1.Op != Op386LEAL {
6239                         break
6240                 }
6241                 off2 := auxIntToInt32(v_1.AuxInt)
6242                 sym2 := auxToSym(v_1.Aux)
6243                 base := v_1.Args[0]
6244                 mem := v_2
6245                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
6246                         break
6247                 }
6248                 v.reset(Op386MULSSload)
6249                 v.AuxInt = int32ToAuxInt(off1 + off2)
6250                 v.Aux = symToAux(mergeSym(sym1, sym2))
6251                 v.AddArg3(val, base, mem)
6252                 return true
6253         }
6254         return false
6255 }
6256 func rewriteValue386_Op386NEGL(v *Value) bool {
6257         v_0 := v.Args[0]
6258         // match: (NEGL (MOVLconst [c]))
6259         // result: (MOVLconst [-c])
6260         for {
6261                 if v_0.Op != Op386MOVLconst {
6262                         break
6263                 }
6264                 c := auxIntToInt32(v_0.AuxInt)
6265                 v.reset(Op386MOVLconst)
6266                 v.AuxInt = int32ToAuxInt(-c)
6267                 return true
6268         }
6269         return false
6270 }
6271 func rewriteValue386_Op386NOTL(v *Value) bool {
6272         v_0 := v.Args[0]
6273         // match: (NOTL (MOVLconst [c]))
6274         // result: (MOVLconst [^c])
6275         for {
6276                 if v_0.Op != Op386MOVLconst {
6277                         break
6278                 }
6279                 c := auxIntToInt32(v_0.AuxInt)
6280                 v.reset(Op386MOVLconst)
6281                 v.AuxInt = int32ToAuxInt(^c)
6282                 return true
6283         }
6284         return false
6285 }
6286 func rewriteValue386_Op386ORL(v *Value) bool {
6287         v_1 := v.Args[1]
6288         v_0 := v.Args[0]
6289         b := v.Block
6290         typ := &b.Func.Config.Types
6291         // match: (ORL x (MOVLconst [c]))
6292         // result: (ORLconst [c] x)
6293         for {
6294                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6295                         x := v_0
6296                         if v_1.Op != Op386MOVLconst {
6297                                 continue
6298                         }
6299                         c := auxIntToInt32(v_1.AuxInt)
6300                         v.reset(Op386ORLconst)
6301                         v.AuxInt = int32ToAuxInt(c)
6302                         v.AddArg(x)
6303                         return true
6304                 }
6305                 break
6306         }
6307         // match: ( ORL (SHLLconst [c] x) (SHRLconst [d] x))
6308         // cond: d == 32-c
6309         // result: (ROLLconst [c] x)
6310         for {
6311                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6312                         if v_0.Op != Op386SHLLconst {
6313                                 continue
6314                         }
6315                         c := auxIntToInt32(v_0.AuxInt)
6316                         x := v_0.Args[0]
6317                         if v_1.Op != Op386SHRLconst {
6318                                 continue
6319                         }
6320                         d := auxIntToInt32(v_1.AuxInt)
6321                         if x != v_1.Args[0] || !(d == 32-c) {
6322                                 continue
6323                         }
6324                         v.reset(Op386ROLLconst)
6325                         v.AuxInt = int32ToAuxInt(c)
6326                         v.AddArg(x)
6327                         return true
6328                 }
6329                 break
6330         }
6331         // match: ( ORL <t> (SHLLconst x [c]) (SHRWconst x [d]))
6332         // cond: c < 16 && d == int16(16-c) && t.Size() == 2
6333         // result: (ROLWconst x [int16(c)])
6334         for {
6335                 t := v.Type
6336                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6337                         if v_0.Op != Op386SHLLconst {
6338                                 continue
6339                         }
6340                         c := auxIntToInt32(v_0.AuxInt)
6341                         x := v_0.Args[0]
6342                         if v_1.Op != Op386SHRWconst {
6343                                 continue
6344                         }
6345                         d := auxIntToInt16(v_1.AuxInt)
6346                         if x != v_1.Args[0] || !(c < 16 && d == int16(16-c) && t.Size() == 2) {
6347                                 continue
6348                         }
6349                         v.reset(Op386ROLWconst)
6350                         v.AuxInt = int16ToAuxInt(int16(c))
6351                         v.AddArg(x)
6352                         return true
6353                 }
6354                 break
6355         }
6356         // match: ( ORL <t> (SHLLconst x [c]) (SHRBconst x [d]))
6357         // cond: c < 8 && d == int8(8-c) && t.Size() == 1
6358         // result: (ROLBconst x [int8(c)])
6359         for {
6360                 t := v.Type
6361                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6362                         if v_0.Op != Op386SHLLconst {
6363                                 continue
6364                         }
6365                         c := auxIntToInt32(v_0.AuxInt)
6366                         x := v_0.Args[0]
6367                         if v_1.Op != Op386SHRBconst {
6368                                 continue
6369                         }
6370                         d := auxIntToInt8(v_1.AuxInt)
6371                         if x != v_1.Args[0] || !(c < 8 && d == int8(8-c) && t.Size() == 1) {
6372                                 continue
6373                         }
6374                         v.reset(Op386ROLBconst)
6375                         v.AuxInt = int8ToAuxInt(int8(c))
6376                         v.AddArg(x)
6377                         return true
6378                 }
6379                 break
6380         }
6381         // match: (ORL x l:(MOVLload [off] {sym} ptr mem))
6382         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
6383         // result: (ORLload x [off] {sym} ptr mem)
6384         for {
6385                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6386                         x := v_0
6387                         l := v_1
6388                         if l.Op != Op386MOVLload {
6389                                 continue
6390                         }
6391                         off := auxIntToInt32(l.AuxInt)
6392                         sym := auxToSym(l.Aux)
6393                         mem := l.Args[1]
6394                         ptr := l.Args[0]
6395                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
6396                                 continue
6397                         }
6398                         v.reset(Op386ORLload)
6399                         v.AuxInt = int32ToAuxInt(off)
6400                         v.Aux = symToAux(sym)
6401                         v.AddArg3(x, ptr, mem)
6402                         return true
6403                 }
6404                 break
6405         }
6406         // match: (ORL x x)
6407         // result: x
6408         for {
6409                 x := v_0
6410                 if x != v_1 {
6411                         break
6412                 }
6413                 v.copyOf(x)
6414                 return true
6415         }
6416         // match: (ORL x0:(MOVBload [i0] {s} p mem) s0:(SHLLconst [8] x1:(MOVBload [i1] {s} p mem)))
6417         // cond: i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && mergePoint(b,x0,x1) != nil && clobber(x0, x1, s0)
6418         // result: @mergePoint(b,x0,x1) (MOVWload [i0] {s} p mem)
6419         for {
6420                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6421                         x0 := v_0
6422                         if x0.Op != Op386MOVBload {
6423                                 continue
6424                         }
6425                         i0 := auxIntToInt32(x0.AuxInt)
6426                         s := auxToSym(x0.Aux)
6427                         mem := x0.Args[1]
6428                         p := x0.Args[0]
6429                         s0 := v_1
6430                         if s0.Op != Op386SHLLconst || auxIntToInt32(s0.AuxInt) != 8 {
6431                                 continue
6432                         }
6433                         x1 := s0.Args[0]
6434                         if x1.Op != Op386MOVBload {
6435                                 continue
6436                         }
6437                         i1 := auxIntToInt32(x1.AuxInt)
6438                         if auxToSym(x1.Aux) != s {
6439                                 continue
6440                         }
6441                         _ = x1.Args[1]
6442                         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)) {
6443                                 continue
6444                         }
6445                         b = mergePoint(b, x0, x1)
6446                         v0 := b.NewValue0(x1.Pos, Op386MOVWload, typ.UInt16)
6447                         v.copyOf(v0)
6448                         v0.AuxInt = int32ToAuxInt(i0)
6449                         v0.Aux = symToAux(s)
6450                         v0.AddArg2(p, mem)
6451                         return true
6452                 }
6453                 break
6454         }
6455         // match: (ORL x0:(MOVBload [i] {s} p0 mem) s0:(SHLLconst [8] x1:(MOVBload [i] {s} p1 mem)))
6456         // cond: x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && sequentialAddresses(p0, p1, 1) && mergePoint(b,x0,x1) != nil && clobber(x0, x1, s0)
6457         // result: @mergePoint(b,x0,x1) (MOVWload [i] {s} p0 mem)
6458         for {
6459                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6460                         x0 := v_0
6461                         if x0.Op != Op386MOVBload {
6462                                 continue
6463                         }
6464                         i := auxIntToInt32(x0.AuxInt)
6465                         s := auxToSym(x0.Aux)
6466                         mem := x0.Args[1]
6467                         p0 := x0.Args[0]
6468                         s0 := v_1
6469                         if s0.Op != Op386SHLLconst || auxIntToInt32(s0.AuxInt) != 8 {
6470                                 continue
6471                         }
6472                         x1 := s0.Args[0]
6473                         if x1.Op != Op386MOVBload || auxIntToInt32(x1.AuxInt) != i || auxToSym(x1.Aux) != s {
6474                                 continue
6475                         }
6476                         _ = x1.Args[1]
6477                         p1 := x1.Args[0]
6478                         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)) {
6479                                 continue
6480                         }
6481                         b = mergePoint(b, x0, x1)
6482                         v0 := b.NewValue0(x1.Pos, Op386MOVWload, typ.UInt16)
6483                         v.copyOf(v0)
6484                         v0.AuxInt = int32ToAuxInt(i)
6485                         v0.Aux = symToAux(s)
6486                         v0.AddArg2(p0, mem)
6487                         return true
6488                 }
6489                 break
6490         }
6491         // 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)))
6492         // 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)
6493         // result: @mergePoint(b,x0,x1,x2) (MOVLload [i0] {s} p mem)
6494         for {
6495                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6496                         o0 := v_0
6497                         if o0.Op != Op386ORL {
6498                                 continue
6499                         }
6500                         _ = o0.Args[1]
6501                         o0_0 := o0.Args[0]
6502                         o0_1 := o0.Args[1]
6503                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
6504                                 x0 := o0_0
6505                                 if x0.Op != Op386MOVWload {
6506                                         continue
6507                                 }
6508                                 i0 := auxIntToInt32(x0.AuxInt)
6509                                 s := auxToSym(x0.Aux)
6510                                 mem := x0.Args[1]
6511                                 p := x0.Args[0]
6512                                 s0 := o0_1
6513                                 if s0.Op != Op386SHLLconst || auxIntToInt32(s0.AuxInt) != 16 {
6514                                         continue
6515                                 }
6516                                 x1 := s0.Args[0]
6517                                 if x1.Op != Op386MOVBload {
6518                                         continue
6519                                 }
6520                                 i2 := auxIntToInt32(x1.AuxInt)
6521                                 if auxToSym(x1.Aux) != s {
6522                                         continue
6523                                 }
6524                                 _ = x1.Args[1]
6525                                 if p != x1.Args[0] || mem != x1.Args[1] {
6526                                         continue
6527                                 }
6528                                 s1 := v_1
6529                                 if s1.Op != Op386SHLLconst || auxIntToInt32(s1.AuxInt) != 24 {
6530                                         continue
6531                                 }
6532                                 x2 := s1.Args[0]
6533                                 if x2.Op != Op386MOVBload {
6534                                         continue
6535                                 }
6536                                 i3 := auxIntToInt32(x2.AuxInt)
6537                                 if auxToSym(x2.Aux) != s {
6538                                         continue
6539                                 }
6540                                 _ = x2.Args[1]
6541                                 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)) {
6542                                         continue
6543                                 }
6544                                 b = mergePoint(b, x0, x1, x2)
6545                                 v0 := b.NewValue0(x2.Pos, Op386MOVLload, typ.UInt32)
6546                                 v.copyOf(v0)
6547                                 v0.AuxInt = int32ToAuxInt(i0)
6548                                 v0.Aux = symToAux(s)
6549                                 v0.AddArg2(p, mem)
6550                                 return true
6551                         }
6552                 }
6553                 break
6554         }
6555         // 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)))
6556         // 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)
6557         // result: @mergePoint(b,x0,x1,x2) (MOVLload [i] {s} p0 mem)
6558         for {
6559                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
6560                         o0 := v_0
6561                         if o0.Op != Op386ORL {
6562                                 continue
6563                         }
6564                         _ = o0.Args[1]
6565                         o0_0 := o0.Args[0]
6566                         o0_1 := o0.Args[1]
6567                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
6568                                 x0 := o0_0
6569                                 if x0.Op != Op386MOVWload {
6570                                         continue
6571                                 }
6572                                 i := auxIntToInt32(x0.AuxInt)
6573                                 s := auxToSym(x0.Aux)
6574                                 mem := x0.Args[1]
6575                                 p0 := x0.Args[0]
6576                                 s0 := o0_1
6577                                 if s0.Op != Op386SHLLconst || auxIntToInt32(s0.AuxInt) != 16 {
6578                                         continue
6579                                 }
6580                                 x1 := s0.Args[0]
6581                                 if x1.Op != Op386MOVBload || auxIntToInt32(x1.AuxInt) != i || auxToSym(x1.Aux) != s {
6582                                         continue
6583                                 }
6584                                 _ = x1.Args[1]
6585                                 p1 := x1.Args[0]
6586                                 if mem != x1.Args[1] {
6587                                         continue
6588                                 }
6589                                 s1 := v_1
6590                                 if s1.Op != Op386SHLLconst || auxIntToInt32(s1.AuxInt) != 24 {
6591                                         continue
6592                                 }
6593                                 x2 := s1.Args[0]
6594                                 if x2.Op != Op386MOVBload || auxIntToInt32(x2.AuxInt) != i || auxToSym(x2.Aux) != s {
6595                                         continue
6596                                 }
6597                                 _ = x2.Args[1]
6598                                 p2 := x2.Args[0]
6599                                 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)) {
6600                                         continue
6601                                 }
6602                                 b = mergePoint(b, x0, x1, x2)
6603                                 v0 := b.NewValue0(x2.Pos, Op386MOVLload, typ.UInt32)
6604                                 v.copyOf(v0)
6605                                 v0.AuxInt = int32ToAuxInt(i)
6606                                 v0.Aux = symToAux(s)
6607                                 v0.AddArg2(p0, mem)
6608                                 return true
6609                         }
6610                 }
6611                 break
6612         }
6613         return false
6614 }
6615 func rewriteValue386_Op386ORLconst(v *Value) bool {
6616         v_0 := v.Args[0]
6617         // match: (ORLconst [c] x)
6618         // cond: c==0
6619         // result: x
6620         for {
6621                 c := auxIntToInt32(v.AuxInt)
6622                 x := v_0
6623                 if !(c == 0) {
6624                         break
6625                 }
6626                 v.copyOf(x)
6627                 return true
6628         }
6629         // match: (ORLconst [c] _)
6630         // cond: c==-1
6631         // result: (MOVLconst [-1])
6632         for {
6633                 c := auxIntToInt32(v.AuxInt)
6634                 if !(c == -1) {
6635                         break
6636                 }
6637                 v.reset(Op386MOVLconst)
6638                 v.AuxInt = int32ToAuxInt(-1)
6639                 return true
6640         }
6641         // match: (ORLconst [c] (MOVLconst [d]))
6642         // result: (MOVLconst [c|d])
6643         for {
6644                 c := auxIntToInt32(v.AuxInt)
6645                 if v_0.Op != Op386MOVLconst {
6646                         break
6647                 }
6648                 d := auxIntToInt32(v_0.AuxInt)
6649                 v.reset(Op386MOVLconst)
6650                 v.AuxInt = int32ToAuxInt(c | d)
6651                 return true
6652         }
6653         return false
6654 }
6655 func rewriteValue386_Op386ORLconstmodify(v *Value) bool {
6656         v_1 := v.Args[1]
6657         v_0 := v.Args[0]
6658         b := v.Block
6659         config := b.Func.Config
6660         // match: (ORLconstmodify [valoff1] {sym} (ADDLconst [off2] base) mem)
6661         // cond: valoff1.canAdd32(off2)
6662         // result: (ORLconstmodify [valoff1.addOffset32(off2)] {sym} base mem)
6663         for {
6664                 valoff1 := auxIntToValAndOff(v.AuxInt)
6665                 sym := auxToSym(v.Aux)
6666                 if v_0.Op != Op386ADDLconst {
6667                         break
6668                 }
6669                 off2 := auxIntToInt32(v_0.AuxInt)
6670                 base := v_0.Args[0]
6671                 mem := v_1
6672                 if !(valoff1.canAdd32(off2)) {
6673                         break
6674                 }
6675                 v.reset(Op386ORLconstmodify)
6676                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
6677                 v.Aux = symToAux(sym)
6678                 v.AddArg2(base, mem)
6679                 return true
6680         }
6681         // match: (ORLconstmodify [valoff1] {sym1} (LEAL [off2] {sym2} base) mem)
6682         // cond: valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
6683         // result: (ORLconstmodify [valoff1.addOffset32(off2)] {mergeSym(sym1,sym2)} base mem)
6684         for {
6685                 valoff1 := auxIntToValAndOff(v.AuxInt)
6686                 sym1 := auxToSym(v.Aux)
6687                 if v_0.Op != Op386LEAL {
6688                         break
6689                 }
6690                 off2 := auxIntToInt32(v_0.AuxInt)
6691                 sym2 := auxToSym(v_0.Aux)
6692                 base := v_0.Args[0]
6693                 mem := v_1
6694                 if !(valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
6695                         break
6696                 }
6697                 v.reset(Op386ORLconstmodify)
6698                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
6699                 v.Aux = symToAux(mergeSym(sym1, sym2))
6700                 v.AddArg2(base, mem)
6701                 return true
6702         }
6703         return false
6704 }
6705 func rewriteValue386_Op386ORLload(v *Value) bool {
6706         v_2 := v.Args[2]
6707         v_1 := v.Args[1]
6708         v_0 := v.Args[0]
6709         b := v.Block
6710         config := b.Func.Config
6711         // match: (ORLload [off1] {sym} val (ADDLconst [off2] base) mem)
6712         // cond: is32Bit(int64(off1)+int64(off2))
6713         // result: (ORLload [off1+off2] {sym} val base mem)
6714         for {
6715                 off1 := auxIntToInt32(v.AuxInt)
6716                 sym := auxToSym(v.Aux)
6717                 val := v_0
6718                 if v_1.Op != Op386ADDLconst {
6719                         break
6720                 }
6721                 off2 := auxIntToInt32(v_1.AuxInt)
6722                 base := v_1.Args[0]
6723                 mem := v_2
6724                 if !(is32Bit(int64(off1) + int64(off2))) {
6725                         break
6726                 }
6727                 v.reset(Op386ORLload)
6728                 v.AuxInt = int32ToAuxInt(off1 + off2)
6729                 v.Aux = symToAux(sym)
6730                 v.AddArg3(val, base, mem)
6731                 return true
6732         }
6733         // match: (ORLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
6734         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
6735         // result: (ORLload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
6736         for {
6737                 off1 := auxIntToInt32(v.AuxInt)
6738                 sym1 := auxToSym(v.Aux)
6739                 val := v_0
6740                 if v_1.Op != Op386LEAL {
6741                         break
6742                 }
6743                 off2 := auxIntToInt32(v_1.AuxInt)
6744                 sym2 := auxToSym(v_1.Aux)
6745                 base := v_1.Args[0]
6746                 mem := v_2
6747                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
6748                         break
6749                 }
6750                 v.reset(Op386ORLload)
6751                 v.AuxInt = int32ToAuxInt(off1 + off2)
6752                 v.Aux = symToAux(mergeSym(sym1, sym2))
6753                 v.AddArg3(val, base, mem)
6754                 return true
6755         }
6756         return false
6757 }
6758 func rewriteValue386_Op386ORLmodify(v *Value) bool {
6759         v_2 := v.Args[2]
6760         v_1 := v.Args[1]
6761         v_0 := v.Args[0]
6762         b := v.Block
6763         config := b.Func.Config
6764         // match: (ORLmodify [off1] {sym} (ADDLconst [off2] base) val mem)
6765         // cond: is32Bit(int64(off1)+int64(off2))
6766         // result: (ORLmodify [off1+off2] {sym} base val mem)
6767         for {
6768                 off1 := auxIntToInt32(v.AuxInt)
6769                 sym := auxToSym(v.Aux)
6770                 if v_0.Op != Op386ADDLconst {
6771                         break
6772                 }
6773                 off2 := auxIntToInt32(v_0.AuxInt)
6774                 base := v_0.Args[0]
6775                 val := v_1
6776                 mem := v_2
6777                 if !(is32Bit(int64(off1) + int64(off2))) {
6778                         break
6779                 }
6780                 v.reset(Op386ORLmodify)
6781                 v.AuxInt = int32ToAuxInt(off1 + off2)
6782                 v.Aux = symToAux(sym)
6783                 v.AddArg3(base, val, mem)
6784                 return true
6785         }
6786         // match: (ORLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
6787         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
6788         // result: (ORLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem)
6789         for {
6790                 off1 := auxIntToInt32(v.AuxInt)
6791                 sym1 := auxToSym(v.Aux)
6792                 if v_0.Op != Op386LEAL {
6793                         break
6794                 }
6795                 off2 := auxIntToInt32(v_0.AuxInt)
6796                 sym2 := auxToSym(v_0.Aux)
6797                 base := v_0.Args[0]
6798                 val := v_1
6799                 mem := v_2
6800                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
6801                         break
6802                 }
6803                 v.reset(Op386ORLmodify)
6804                 v.AuxInt = int32ToAuxInt(off1 + off2)
6805                 v.Aux = symToAux(mergeSym(sym1, sym2))
6806                 v.AddArg3(base, val, mem)
6807                 return true
6808         }
6809         return false
6810 }
6811 func rewriteValue386_Op386ROLBconst(v *Value) bool {
6812         v_0 := v.Args[0]
6813         // match: (ROLBconst [c] (ROLBconst [d] x))
6814         // result: (ROLBconst [(c+d)& 7] x)
6815         for {
6816                 c := auxIntToInt8(v.AuxInt)
6817                 if v_0.Op != Op386ROLBconst {
6818                         break
6819                 }
6820                 d := auxIntToInt8(v_0.AuxInt)
6821                 x := v_0.Args[0]
6822                 v.reset(Op386ROLBconst)
6823                 v.AuxInt = int8ToAuxInt((c + d) & 7)
6824                 v.AddArg(x)
6825                 return true
6826         }
6827         // match: (ROLBconst [0] x)
6828         // result: x
6829         for {
6830                 if auxIntToInt8(v.AuxInt) != 0 {
6831                         break
6832                 }
6833                 x := v_0
6834                 v.copyOf(x)
6835                 return true
6836         }
6837         return false
6838 }
6839 func rewriteValue386_Op386ROLLconst(v *Value) bool {
6840         v_0 := v.Args[0]
6841         // match: (ROLLconst [c] (ROLLconst [d] x))
6842         // result: (ROLLconst [(c+d)&31] x)
6843         for {
6844                 c := auxIntToInt32(v.AuxInt)
6845                 if v_0.Op != Op386ROLLconst {
6846                         break
6847                 }
6848                 d := auxIntToInt32(v_0.AuxInt)
6849                 x := v_0.Args[0]
6850                 v.reset(Op386ROLLconst)
6851                 v.AuxInt = int32ToAuxInt((c + d) & 31)
6852                 v.AddArg(x)
6853                 return true
6854         }
6855         // match: (ROLLconst [0] x)
6856         // result: x
6857         for {
6858                 if auxIntToInt32(v.AuxInt) != 0 {
6859                         break
6860                 }
6861                 x := v_0
6862                 v.copyOf(x)
6863                 return true
6864         }
6865         return false
6866 }
6867 func rewriteValue386_Op386ROLWconst(v *Value) bool {
6868         v_0 := v.Args[0]
6869         // match: (ROLWconst [c] (ROLWconst [d] x))
6870         // result: (ROLWconst [(c+d)&15] x)
6871         for {
6872                 c := auxIntToInt16(v.AuxInt)
6873                 if v_0.Op != Op386ROLWconst {
6874                         break
6875                 }
6876                 d := auxIntToInt16(v_0.AuxInt)
6877                 x := v_0.Args[0]
6878                 v.reset(Op386ROLWconst)
6879                 v.AuxInt = int16ToAuxInt((c + d) & 15)
6880                 v.AddArg(x)
6881                 return true
6882         }
6883         // match: (ROLWconst [0] x)
6884         // result: x
6885         for {
6886                 if auxIntToInt16(v.AuxInt) != 0 {
6887                         break
6888                 }
6889                 x := v_0
6890                 v.copyOf(x)
6891                 return true
6892         }
6893         return false
6894 }
6895 func rewriteValue386_Op386SARB(v *Value) bool {
6896         v_1 := v.Args[1]
6897         v_0 := v.Args[0]
6898         // match: (SARB x (MOVLconst [c]))
6899         // result: (SARBconst [int8(min(int64(c&31),7))] x)
6900         for {
6901                 x := v_0
6902                 if v_1.Op != Op386MOVLconst {
6903                         break
6904                 }
6905                 c := auxIntToInt32(v_1.AuxInt)
6906                 v.reset(Op386SARBconst)
6907                 v.AuxInt = int8ToAuxInt(int8(min(int64(c&31), 7)))
6908                 v.AddArg(x)
6909                 return true
6910         }
6911         return false
6912 }
6913 func rewriteValue386_Op386SARBconst(v *Value) bool {
6914         v_0 := v.Args[0]
6915         // match: (SARBconst x [0])
6916         // result: x
6917         for {
6918                 if auxIntToInt8(v.AuxInt) != 0 {
6919                         break
6920                 }
6921                 x := v_0
6922                 v.copyOf(x)
6923                 return true
6924         }
6925         // match: (SARBconst [c] (MOVLconst [d]))
6926         // result: (MOVLconst [d>>uint64(c)])
6927         for {
6928                 c := auxIntToInt8(v.AuxInt)
6929                 if v_0.Op != Op386MOVLconst {
6930                         break
6931                 }
6932                 d := auxIntToInt32(v_0.AuxInt)
6933                 v.reset(Op386MOVLconst)
6934                 v.AuxInt = int32ToAuxInt(d >> uint64(c))
6935                 return true
6936         }
6937         return false
6938 }
6939 func rewriteValue386_Op386SARL(v *Value) bool {
6940         v_1 := v.Args[1]
6941         v_0 := v.Args[0]
6942         // match: (SARL x (MOVLconst [c]))
6943         // result: (SARLconst [c&31] x)
6944         for {
6945                 x := v_0
6946                 if v_1.Op != Op386MOVLconst {
6947                         break
6948                 }
6949                 c := auxIntToInt32(v_1.AuxInt)
6950                 v.reset(Op386SARLconst)
6951                 v.AuxInt = int32ToAuxInt(c & 31)
6952                 v.AddArg(x)
6953                 return true
6954         }
6955         // match: (SARL x (ANDLconst [31] y))
6956         // result: (SARL x y)
6957         for {
6958                 x := v_0
6959                 if v_1.Op != Op386ANDLconst || auxIntToInt32(v_1.AuxInt) != 31 {
6960                         break
6961                 }
6962                 y := v_1.Args[0]
6963                 v.reset(Op386SARL)
6964                 v.AddArg2(x, y)
6965                 return true
6966         }
6967         return false
6968 }
6969 func rewriteValue386_Op386SARLconst(v *Value) bool {
6970         v_0 := v.Args[0]
6971         // match: (SARLconst x [0])
6972         // result: x
6973         for {
6974                 if auxIntToInt32(v.AuxInt) != 0 {
6975                         break
6976                 }
6977                 x := v_0
6978                 v.copyOf(x)
6979                 return true
6980         }
6981         // match: (SARLconst [c] (MOVLconst [d]))
6982         // result: (MOVLconst [d>>uint64(c)])
6983         for {
6984                 c := auxIntToInt32(v.AuxInt)
6985                 if v_0.Op != Op386MOVLconst {
6986                         break
6987                 }
6988                 d := auxIntToInt32(v_0.AuxInt)
6989                 v.reset(Op386MOVLconst)
6990                 v.AuxInt = int32ToAuxInt(d >> uint64(c))
6991                 return true
6992         }
6993         return false
6994 }
6995 func rewriteValue386_Op386SARW(v *Value) bool {
6996         v_1 := v.Args[1]
6997         v_0 := v.Args[0]
6998         // match: (SARW x (MOVLconst [c]))
6999         // result: (SARWconst [int16(min(int64(c&31),15))] x)
7000         for {
7001                 x := v_0
7002                 if v_1.Op != Op386MOVLconst {
7003                         break
7004                 }
7005                 c := auxIntToInt32(v_1.AuxInt)
7006                 v.reset(Op386SARWconst)
7007                 v.AuxInt = int16ToAuxInt(int16(min(int64(c&31), 15)))
7008                 v.AddArg(x)
7009                 return true
7010         }
7011         return false
7012 }
7013 func rewriteValue386_Op386SARWconst(v *Value) bool {
7014         v_0 := v.Args[0]
7015         // match: (SARWconst x [0])
7016         // result: x
7017         for {
7018                 if auxIntToInt16(v.AuxInt) != 0 {
7019                         break
7020                 }
7021                 x := v_0
7022                 v.copyOf(x)
7023                 return true
7024         }
7025         // match: (SARWconst [c] (MOVLconst [d]))
7026         // result: (MOVLconst [d>>uint64(c)])
7027         for {
7028                 c := auxIntToInt16(v.AuxInt)
7029                 if v_0.Op != Op386MOVLconst {
7030                         break
7031                 }
7032                 d := auxIntToInt32(v_0.AuxInt)
7033                 v.reset(Op386MOVLconst)
7034                 v.AuxInt = int32ToAuxInt(d >> uint64(c))
7035                 return true
7036         }
7037         return false
7038 }
7039 func rewriteValue386_Op386SBBL(v *Value) bool {
7040         v_2 := v.Args[2]
7041         v_1 := v.Args[1]
7042         v_0 := v.Args[0]
7043         // match: (SBBL x (MOVLconst [c]) f)
7044         // result: (SBBLconst [c] x f)
7045         for {
7046                 x := v_0
7047                 if v_1.Op != Op386MOVLconst {
7048                         break
7049                 }
7050                 c := auxIntToInt32(v_1.AuxInt)
7051                 f := v_2
7052                 v.reset(Op386SBBLconst)
7053                 v.AuxInt = int32ToAuxInt(c)
7054                 v.AddArg2(x, f)
7055                 return true
7056         }
7057         return false
7058 }
7059 func rewriteValue386_Op386SBBLcarrymask(v *Value) bool {
7060         v_0 := v.Args[0]
7061         // match: (SBBLcarrymask (FlagEQ))
7062         // result: (MOVLconst [0])
7063         for {
7064                 if v_0.Op != Op386FlagEQ {
7065                         break
7066                 }
7067                 v.reset(Op386MOVLconst)
7068                 v.AuxInt = int32ToAuxInt(0)
7069                 return true
7070         }
7071         // match: (SBBLcarrymask (FlagLT_ULT))
7072         // result: (MOVLconst [-1])
7073         for {
7074                 if v_0.Op != Op386FlagLT_ULT {
7075                         break
7076                 }
7077                 v.reset(Op386MOVLconst)
7078                 v.AuxInt = int32ToAuxInt(-1)
7079                 return true
7080         }
7081         // match: (SBBLcarrymask (FlagLT_UGT))
7082         // result: (MOVLconst [0])
7083         for {
7084                 if v_0.Op != Op386FlagLT_UGT {
7085                         break
7086                 }
7087                 v.reset(Op386MOVLconst)
7088                 v.AuxInt = int32ToAuxInt(0)
7089                 return true
7090         }
7091         // match: (SBBLcarrymask (FlagGT_ULT))
7092         // result: (MOVLconst [-1])
7093         for {
7094                 if v_0.Op != Op386FlagGT_ULT {
7095                         break
7096                 }
7097                 v.reset(Op386MOVLconst)
7098                 v.AuxInt = int32ToAuxInt(-1)
7099                 return true
7100         }
7101         // match: (SBBLcarrymask (FlagGT_UGT))
7102         // result: (MOVLconst [0])
7103         for {
7104                 if v_0.Op != Op386FlagGT_UGT {
7105                         break
7106                 }
7107                 v.reset(Op386MOVLconst)
7108                 v.AuxInt = int32ToAuxInt(0)
7109                 return true
7110         }
7111         return false
7112 }
7113 func rewriteValue386_Op386SETA(v *Value) bool {
7114         v_0 := v.Args[0]
7115         // match: (SETA (InvertFlags x))
7116         // result: (SETB x)
7117         for {
7118                 if v_0.Op != Op386InvertFlags {
7119                         break
7120                 }
7121                 x := v_0.Args[0]
7122                 v.reset(Op386SETB)
7123                 v.AddArg(x)
7124                 return true
7125         }
7126         // match: (SETA (FlagEQ))
7127         // result: (MOVLconst [0])
7128         for {
7129                 if v_0.Op != Op386FlagEQ {
7130                         break
7131                 }
7132                 v.reset(Op386MOVLconst)
7133                 v.AuxInt = int32ToAuxInt(0)
7134                 return true
7135         }
7136         // match: (SETA (FlagLT_ULT))
7137         // result: (MOVLconst [0])
7138         for {
7139                 if v_0.Op != Op386FlagLT_ULT {
7140                         break
7141                 }
7142                 v.reset(Op386MOVLconst)
7143                 v.AuxInt = int32ToAuxInt(0)
7144                 return true
7145         }
7146         // match: (SETA (FlagLT_UGT))
7147         // result: (MOVLconst [1])
7148         for {
7149                 if v_0.Op != Op386FlagLT_UGT {
7150                         break
7151                 }
7152                 v.reset(Op386MOVLconst)
7153                 v.AuxInt = int32ToAuxInt(1)
7154                 return true
7155         }
7156         // match: (SETA (FlagGT_ULT))
7157         // result: (MOVLconst [0])
7158         for {
7159                 if v_0.Op != Op386FlagGT_ULT {
7160                         break
7161                 }
7162                 v.reset(Op386MOVLconst)
7163                 v.AuxInt = int32ToAuxInt(0)
7164                 return true
7165         }
7166         // match: (SETA (FlagGT_UGT))
7167         // result: (MOVLconst [1])
7168         for {
7169                 if v_0.Op != Op386FlagGT_UGT {
7170                         break
7171                 }
7172                 v.reset(Op386MOVLconst)
7173                 v.AuxInt = int32ToAuxInt(1)
7174                 return true
7175         }
7176         return false
7177 }
7178 func rewriteValue386_Op386SETAE(v *Value) bool {
7179         v_0 := v.Args[0]
7180         // match: (SETAE (InvertFlags x))
7181         // result: (SETBE x)
7182         for {
7183                 if v_0.Op != Op386InvertFlags {
7184                         break
7185                 }
7186                 x := v_0.Args[0]
7187                 v.reset(Op386SETBE)
7188                 v.AddArg(x)
7189                 return true
7190         }
7191         // match: (SETAE (FlagEQ))
7192         // result: (MOVLconst [1])
7193         for {
7194                 if v_0.Op != Op386FlagEQ {
7195                         break
7196                 }
7197                 v.reset(Op386MOVLconst)
7198                 v.AuxInt = int32ToAuxInt(1)
7199                 return true
7200         }
7201         // match: (SETAE (FlagLT_ULT))
7202         // result: (MOVLconst [0])
7203         for {
7204                 if v_0.Op != Op386FlagLT_ULT {
7205                         break
7206                 }
7207                 v.reset(Op386MOVLconst)
7208                 v.AuxInt = int32ToAuxInt(0)
7209                 return true
7210         }
7211         // match: (SETAE (FlagLT_UGT))
7212         // result: (MOVLconst [1])
7213         for {
7214                 if v_0.Op != Op386FlagLT_UGT {
7215                         break
7216                 }
7217                 v.reset(Op386MOVLconst)
7218                 v.AuxInt = int32ToAuxInt(1)
7219                 return true
7220         }
7221         // match: (SETAE (FlagGT_ULT))
7222         // result: (MOVLconst [0])
7223         for {
7224                 if v_0.Op != Op386FlagGT_ULT {
7225                         break
7226                 }
7227                 v.reset(Op386MOVLconst)
7228                 v.AuxInt = int32ToAuxInt(0)
7229                 return true
7230         }
7231         // match: (SETAE (FlagGT_UGT))
7232         // result: (MOVLconst [1])
7233         for {
7234                 if v_0.Op != Op386FlagGT_UGT {
7235                         break
7236                 }
7237                 v.reset(Op386MOVLconst)
7238                 v.AuxInt = int32ToAuxInt(1)
7239                 return true
7240         }
7241         return false
7242 }
7243 func rewriteValue386_Op386SETB(v *Value) bool {
7244         v_0 := v.Args[0]
7245         // match: (SETB (InvertFlags x))
7246         // result: (SETA x)
7247         for {
7248                 if v_0.Op != Op386InvertFlags {
7249                         break
7250                 }
7251                 x := v_0.Args[0]
7252                 v.reset(Op386SETA)
7253                 v.AddArg(x)
7254                 return true
7255         }
7256         // match: (SETB (FlagEQ))
7257         // result: (MOVLconst [0])
7258         for {
7259                 if v_0.Op != Op386FlagEQ {
7260                         break
7261                 }
7262                 v.reset(Op386MOVLconst)
7263                 v.AuxInt = int32ToAuxInt(0)
7264                 return true
7265         }
7266         // match: (SETB (FlagLT_ULT))
7267         // result: (MOVLconst [1])
7268         for {
7269                 if v_0.Op != Op386FlagLT_ULT {
7270                         break
7271                 }
7272                 v.reset(Op386MOVLconst)
7273                 v.AuxInt = int32ToAuxInt(1)
7274                 return true
7275         }
7276         // match: (SETB (FlagLT_UGT))
7277         // result: (MOVLconst [0])
7278         for {
7279                 if v_0.Op != Op386FlagLT_UGT {
7280                         break
7281                 }
7282                 v.reset(Op386MOVLconst)
7283                 v.AuxInt = int32ToAuxInt(0)
7284                 return true
7285         }
7286         // match: (SETB (FlagGT_ULT))
7287         // result: (MOVLconst [1])
7288         for {
7289                 if v_0.Op != Op386FlagGT_ULT {
7290                         break
7291                 }
7292                 v.reset(Op386MOVLconst)
7293                 v.AuxInt = int32ToAuxInt(1)
7294                 return true
7295         }
7296         // match: (SETB (FlagGT_UGT))
7297         // result: (MOVLconst [0])
7298         for {
7299                 if v_0.Op != Op386FlagGT_UGT {
7300                         break
7301                 }
7302                 v.reset(Op386MOVLconst)
7303                 v.AuxInt = int32ToAuxInt(0)
7304                 return true
7305         }
7306         return false
7307 }
7308 func rewriteValue386_Op386SETBE(v *Value) bool {
7309         v_0 := v.Args[0]
7310         // match: (SETBE (InvertFlags x))
7311         // result: (SETAE x)
7312         for {
7313                 if v_0.Op != Op386InvertFlags {
7314                         break
7315                 }
7316                 x := v_0.Args[0]
7317                 v.reset(Op386SETAE)
7318                 v.AddArg(x)
7319                 return true
7320         }
7321         // match: (SETBE (FlagEQ))
7322         // result: (MOVLconst [1])
7323         for {
7324                 if v_0.Op != Op386FlagEQ {
7325                         break
7326                 }
7327                 v.reset(Op386MOVLconst)
7328                 v.AuxInt = int32ToAuxInt(1)
7329                 return true
7330         }
7331         // match: (SETBE (FlagLT_ULT))
7332         // result: (MOVLconst [1])
7333         for {
7334                 if v_0.Op != Op386FlagLT_ULT {
7335                         break
7336                 }
7337                 v.reset(Op386MOVLconst)
7338                 v.AuxInt = int32ToAuxInt(1)
7339                 return true
7340         }
7341         // match: (SETBE (FlagLT_UGT))
7342         // result: (MOVLconst [0])
7343         for {
7344                 if v_0.Op != Op386FlagLT_UGT {
7345                         break
7346                 }
7347                 v.reset(Op386MOVLconst)
7348                 v.AuxInt = int32ToAuxInt(0)
7349                 return true
7350         }
7351         // match: (SETBE (FlagGT_ULT))
7352         // result: (MOVLconst [1])
7353         for {
7354                 if v_0.Op != Op386FlagGT_ULT {
7355                         break
7356                 }
7357                 v.reset(Op386MOVLconst)
7358                 v.AuxInt = int32ToAuxInt(1)
7359                 return true
7360         }
7361         // match: (SETBE (FlagGT_UGT))
7362         // result: (MOVLconst [0])
7363         for {
7364                 if v_0.Op != Op386FlagGT_UGT {
7365                         break
7366                 }
7367                 v.reset(Op386MOVLconst)
7368                 v.AuxInt = int32ToAuxInt(0)
7369                 return true
7370         }
7371         return false
7372 }
7373 func rewriteValue386_Op386SETEQ(v *Value) bool {
7374         v_0 := v.Args[0]
7375         // match: (SETEQ (InvertFlags x))
7376         // result: (SETEQ x)
7377         for {
7378                 if v_0.Op != Op386InvertFlags {
7379                         break
7380                 }
7381                 x := v_0.Args[0]
7382                 v.reset(Op386SETEQ)
7383                 v.AddArg(x)
7384                 return true
7385         }
7386         // match: (SETEQ (FlagEQ))
7387         // result: (MOVLconst [1])
7388         for {
7389                 if v_0.Op != Op386FlagEQ {
7390                         break
7391                 }
7392                 v.reset(Op386MOVLconst)
7393                 v.AuxInt = int32ToAuxInt(1)
7394                 return true
7395         }
7396         // match: (SETEQ (FlagLT_ULT))
7397         // result: (MOVLconst [0])
7398         for {
7399                 if v_0.Op != Op386FlagLT_ULT {
7400                         break
7401                 }
7402                 v.reset(Op386MOVLconst)
7403                 v.AuxInt = int32ToAuxInt(0)
7404                 return true
7405         }
7406         // match: (SETEQ (FlagLT_UGT))
7407         // result: (MOVLconst [0])
7408         for {
7409                 if v_0.Op != Op386FlagLT_UGT {
7410                         break
7411                 }
7412                 v.reset(Op386MOVLconst)
7413                 v.AuxInt = int32ToAuxInt(0)
7414                 return true
7415         }
7416         // match: (SETEQ (FlagGT_ULT))
7417         // result: (MOVLconst [0])
7418         for {
7419                 if v_0.Op != Op386FlagGT_ULT {
7420                         break
7421                 }
7422                 v.reset(Op386MOVLconst)
7423                 v.AuxInt = int32ToAuxInt(0)
7424                 return true
7425         }
7426         // match: (SETEQ (FlagGT_UGT))
7427         // result: (MOVLconst [0])
7428         for {
7429                 if v_0.Op != Op386FlagGT_UGT {
7430                         break
7431                 }
7432                 v.reset(Op386MOVLconst)
7433                 v.AuxInt = int32ToAuxInt(0)
7434                 return true
7435         }
7436         return false
7437 }
7438 func rewriteValue386_Op386SETG(v *Value) bool {
7439         v_0 := v.Args[0]
7440         // match: (SETG (InvertFlags x))
7441         // result: (SETL x)
7442         for {
7443                 if v_0.Op != Op386InvertFlags {
7444                         break
7445                 }
7446                 x := v_0.Args[0]
7447                 v.reset(Op386SETL)
7448                 v.AddArg(x)
7449                 return true
7450         }
7451         // match: (SETG (FlagEQ))
7452         // result: (MOVLconst [0])
7453         for {
7454                 if v_0.Op != Op386FlagEQ {
7455                         break
7456                 }
7457                 v.reset(Op386MOVLconst)
7458                 v.AuxInt = int32ToAuxInt(0)
7459                 return true
7460         }
7461         // match: (SETG (FlagLT_ULT))
7462         // result: (MOVLconst [0])
7463         for {
7464                 if v_0.Op != Op386FlagLT_ULT {
7465                         break
7466                 }
7467                 v.reset(Op386MOVLconst)
7468                 v.AuxInt = int32ToAuxInt(0)
7469                 return true
7470         }
7471         // match: (SETG (FlagLT_UGT))
7472         // result: (MOVLconst [0])
7473         for {
7474                 if v_0.Op != Op386FlagLT_UGT {
7475                         break
7476                 }
7477                 v.reset(Op386MOVLconst)
7478                 v.AuxInt = int32ToAuxInt(0)
7479                 return true
7480         }
7481         // match: (SETG (FlagGT_ULT))
7482         // result: (MOVLconst [1])
7483         for {
7484                 if v_0.Op != Op386FlagGT_ULT {
7485                         break
7486                 }
7487                 v.reset(Op386MOVLconst)
7488                 v.AuxInt = int32ToAuxInt(1)
7489                 return true
7490         }
7491         // match: (SETG (FlagGT_UGT))
7492         // result: (MOVLconst [1])
7493         for {
7494                 if v_0.Op != Op386FlagGT_UGT {
7495                         break
7496                 }
7497                 v.reset(Op386MOVLconst)
7498                 v.AuxInt = int32ToAuxInt(1)
7499                 return true
7500         }
7501         return false
7502 }
7503 func rewriteValue386_Op386SETGE(v *Value) bool {
7504         v_0 := v.Args[0]
7505         // match: (SETGE (InvertFlags x))
7506         // result: (SETLE x)
7507         for {
7508                 if v_0.Op != Op386InvertFlags {
7509                         break
7510                 }
7511                 x := v_0.Args[0]
7512                 v.reset(Op386SETLE)
7513                 v.AddArg(x)
7514                 return true
7515         }
7516         // match: (SETGE (FlagEQ))
7517         // result: (MOVLconst [1])
7518         for {
7519                 if v_0.Op != Op386FlagEQ {
7520                         break
7521                 }
7522                 v.reset(Op386MOVLconst)
7523                 v.AuxInt = int32ToAuxInt(1)
7524                 return true
7525         }
7526         // match: (SETGE (FlagLT_ULT))
7527         // result: (MOVLconst [0])
7528         for {
7529                 if v_0.Op != Op386FlagLT_ULT {
7530                         break
7531                 }
7532                 v.reset(Op386MOVLconst)
7533                 v.AuxInt = int32ToAuxInt(0)
7534                 return true
7535         }
7536         // match: (SETGE (FlagLT_UGT))
7537         // result: (MOVLconst [0])
7538         for {
7539                 if v_0.Op != Op386FlagLT_UGT {
7540                         break
7541                 }
7542                 v.reset(Op386MOVLconst)
7543                 v.AuxInt = int32ToAuxInt(0)
7544                 return true
7545         }
7546         // match: (SETGE (FlagGT_ULT))
7547         // result: (MOVLconst [1])
7548         for {
7549                 if v_0.Op != Op386FlagGT_ULT {
7550                         break
7551                 }
7552                 v.reset(Op386MOVLconst)
7553                 v.AuxInt = int32ToAuxInt(1)
7554                 return true
7555         }
7556         // match: (SETGE (FlagGT_UGT))
7557         // result: (MOVLconst [1])
7558         for {
7559                 if v_0.Op != Op386FlagGT_UGT {
7560                         break
7561                 }
7562                 v.reset(Op386MOVLconst)
7563                 v.AuxInt = int32ToAuxInt(1)
7564                 return true
7565         }
7566         return false
7567 }
7568 func rewriteValue386_Op386SETL(v *Value) bool {
7569         v_0 := v.Args[0]
7570         // match: (SETL (InvertFlags x))
7571         // result: (SETG x)
7572         for {
7573                 if v_0.Op != Op386InvertFlags {
7574                         break
7575                 }
7576                 x := v_0.Args[0]
7577                 v.reset(Op386SETG)
7578                 v.AddArg(x)
7579                 return true
7580         }
7581         // match: (SETL (FlagEQ))
7582         // result: (MOVLconst [0])
7583         for {
7584                 if v_0.Op != Op386FlagEQ {
7585                         break
7586                 }
7587                 v.reset(Op386MOVLconst)
7588                 v.AuxInt = int32ToAuxInt(0)
7589                 return true
7590         }
7591         // match: (SETL (FlagLT_ULT))
7592         // result: (MOVLconst [1])
7593         for {
7594                 if v_0.Op != Op386FlagLT_ULT {
7595                         break
7596                 }
7597                 v.reset(Op386MOVLconst)
7598                 v.AuxInt = int32ToAuxInt(1)
7599                 return true
7600         }
7601         // match: (SETL (FlagLT_UGT))
7602         // result: (MOVLconst [1])
7603         for {
7604                 if v_0.Op != Op386FlagLT_UGT {
7605                         break
7606                 }
7607                 v.reset(Op386MOVLconst)
7608                 v.AuxInt = int32ToAuxInt(1)
7609                 return true
7610         }
7611         // match: (SETL (FlagGT_ULT))
7612         // result: (MOVLconst [0])
7613         for {
7614                 if v_0.Op != Op386FlagGT_ULT {
7615                         break
7616                 }
7617                 v.reset(Op386MOVLconst)
7618                 v.AuxInt = int32ToAuxInt(0)
7619                 return true
7620         }
7621         // match: (SETL (FlagGT_UGT))
7622         // result: (MOVLconst [0])
7623         for {
7624                 if v_0.Op != Op386FlagGT_UGT {
7625                         break
7626                 }
7627                 v.reset(Op386MOVLconst)
7628                 v.AuxInt = int32ToAuxInt(0)
7629                 return true
7630         }
7631         return false
7632 }
7633 func rewriteValue386_Op386SETLE(v *Value) bool {
7634         v_0 := v.Args[0]
7635         // match: (SETLE (InvertFlags x))
7636         // result: (SETGE x)
7637         for {
7638                 if v_0.Op != Op386InvertFlags {
7639                         break
7640                 }
7641                 x := v_0.Args[0]
7642                 v.reset(Op386SETGE)
7643                 v.AddArg(x)
7644                 return true
7645         }
7646         // match: (SETLE (FlagEQ))
7647         // result: (MOVLconst [1])
7648         for {
7649                 if v_0.Op != Op386FlagEQ {
7650                         break
7651                 }
7652                 v.reset(Op386MOVLconst)
7653                 v.AuxInt = int32ToAuxInt(1)
7654                 return true
7655         }
7656         // match: (SETLE (FlagLT_ULT))
7657         // result: (MOVLconst [1])
7658         for {
7659                 if v_0.Op != Op386FlagLT_ULT {
7660                         break
7661                 }
7662                 v.reset(Op386MOVLconst)
7663                 v.AuxInt = int32ToAuxInt(1)
7664                 return true
7665         }
7666         // match: (SETLE (FlagLT_UGT))
7667         // result: (MOVLconst [1])
7668         for {
7669                 if v_0.Op != Op386FlagLT_UGT {
7670                         break
7671                 }
7672                 v.reset(Op386MOVLconst)
7673                 v.AuxInt = int32ToAuxInt(1)
7674                 return true
7675         }
7676         // match: (SETLE (FlagGT_ULT))
7677         // result: (MOVLconst [0])
7678         for {
7679                 if v_0.Op != Op386FlagGT_ULT {
7680                         break
7681                 }
7682                 v.reset(Op386MOVLconst)
7683                 v.AuxInt = int32ToAuxInt(0)
7684                 return true
7685         }
7686         // match: (SETLE (FlagGT_UGT))
7687         // result: (MOVLconst [0])
7688         for {
7689                 if v_0.Op != Op386FlagGT_UGT {
7690                         break
7691                 }
7692                 v.reset(Op386MOVLconst)
7693                 v.AuxInt = int32ToAuxInt(0)
7694                 return true
7695         }
7696         return false
7697 }
7698 func rewriteValue386_Op386SETNE(v *Value) bool {
7699         v_0 := v.Args[0]
7700         // match: (SETNE (InvertFlags x))
7701         // result: (SETNE x)
7702         for {
7703                 if v_0.Op != Op386InvertFlags {
7704                         break
7705                 }
7706                 x := v_0.Args[0]
7707                 v.reset(Op386SETNE)
7708                 v.AddArg(x)
7709                 return true
7710         }
7711         // match: (SETNE (FlagEQ))
7712         // result: (MOVLconst [0])
7713         for {
7714                 if v_0.Op != Op386FlagEQ {
7715                         break
7716                 }
7717                 v.reset(Op386MOVLconst)
7718                 v.AuxInt = int32ToAuxInt(0)
7719                 return true
7720         }
7721         // match: (SETNE (FlagLT_ULT))
7722         // result: (MOVLconst [1])
7723         for {
7724                 if v_0.Op != Op386FlagLT_ULT {
7725                         break
7726                 }
7727                 v.reset(Op386MOVLconst)
7728                 v.AuxInt = int32ToAuxInt(1)
7729                 return true
7730         }
7731         // match: (SETNE (FlagLT_UGT))
7732         // result: (MOVLconst [1])
7733         for {
7734                 if v_0.Op != Op386FlagLT_UGT {
7735                         break
7736                 }
7737                 v.reset(Op386MOVLconst)
7738                 v.AuxInt = int32ToAuxInt(1)
7739                 return true
7740         }
7741         // match: (SETNE (FlagGT_ULT))
7742         // result: (MOVLconst [1])
7743         for {
7744                 if v_0.Op != Op386FlagGT_ULT {
7745                         break
7746                 }
7747                 v.reset(Op386MOVLconst)
7748                 v.AuxInt = int32ToAuxInt(1)
7749                 return true
7750         }
7751         // match: (SETNE (FlagGT_UGT))
7752         // result: (MOVLconst [1])
7753         for {
7754                 if v_0.Op != Op386FlagGT_UGT {
7755                         break
7756                 }
7757                 v.reset(Op386MOVLconst)
7758                 v.AuxInt = int32ToAuxInt(1)
7759                 return true
7760         }
7761         return false
7762 }
7763 func rewriteValue386_Op386SHLL(v *Value) bool {
7764         v_1 := v.Args[1]
7765         v_0 := v.Args[0]
7766         // match: (SHLL x (MOVLconst [c]))
7767         // result: (SHLLconst [c&31] x)
7768         for {
7769                 x := v_0
7770                 if v_1.Op != Op386MOVLconst {
7771                         break
7772                 }
7773                 c := auxIntToInt32(v_1.AuxInt)
7774                 v.reset(Op386SHLLconst)
7775                 v.AuxInt = int32ToAuxInt(c & 31)
7776                 v.AddArg(x)
7777                 return true
7778         }
7779         // match: (SHLL x (ANDLconst [31] y))
7780         // result: (SHLL x y)
7781         for {
7782                 x := v_0
7783                 if v_1.Op != Op386ANDLconst || auxIntToInt32(v_1.AuxInt) != 31 {
7784                         break
7785                 }
7786                 y := v_1.Args[0]
7787                 v.reset(Op386SHLL)
7788                 v.AddArg2(x, y)
7789                 return true
7790         }
7791         return false
7792 }
7793 func rewriteValue386_Op386SHLLconst(v *Value) bool {
7794         v_0 := v.Args[0]
7795         // match: (SHLLconst x [0])
7796         // result: x
7797         for {
7798                 if auxIntToInt32(v.AuxInt) != 0 {
7799                         break
7800                 }
7801                 x := v_0
7802                 v.copyOf(x)
7803                 return true
7804         }
7805         return false
7806 }
7807 func rewriteValue386_Op386SHRB(v *Value) bool {
7808         v_1 := v.Args[1]
7809         v_0 := v.Args[0]
7810         // match: (SHRB x (MOVLconst [c]))
7811         // cond: c&31 < 8
7812         // result: (SHRBconst [int8(c&31)] x)
7813         for {
7814                 x := v_0
7815                 if v_1.Op != Op386MOVLconst {
7816                         break
7817                 }
7818                 c := auxIntToInt32(v_1.AuxInt)
7819                 if !(c&31 < 8) {
7820                         break
7821                 }
7822                 v.reset(Op386SHRBconst)
7823                 v.AuxInt = int8ToAuxInt(int8(c & 31))
7824                 v.AddArg(x)
7825                 return true
7826         }
7827         // match: (SHRB _ (MOVLconst [c]))
7828         // cond: c&31 >= 8
7829         // result: (MOVLconst [0])
7830         for {
7831                 if v_1.Op != Op386MOVLconst {
7832                         break
7833                 }
7834                 c := auxIntToInt32(v_1.AuxInt)
7835                 if !(c&31 >= 8) {
7836                         break
7837                 }
7838                 v.reset(Op386MOVLconst)
7839                 v.AuxInt = int32ToAuxInt(0)
7840                 return true
7841         }
7842         return false
7843 }
7844 func rewriteValue386_Op386SHRBconst(v *Value) bool {
7845         v_0 := v.Args[0]
7846         // match: (SHRBconst x [0])
7847         // result: x
7848         for {
7849                 if auxIntToInt8(v.AuxInt) != 0 {
7850                         break
7851                 }
7852                 x := v_0
7853                 v.copyOf(x)
7854                 return true
7855         }
7856         return false
7857 }
7858 func rewriteValue386_Op386SHRL(v *Value) bool {
7859         v_1 := v.Args[1]
7860         v_0 := v.Args[0]
7861         // match: (SHRL x (MOVLconst [c]))
7862         // result: (SHRLconst [c&31] x)
7863         for {
7864                 x := v_0
7865                 if v_1.Op != Op386MOVLconst {
7866                         break
7867                 }
7868                 c := auxIntToInt32(v_1.AuxInt)
7869                 v.reset(Op386SHRLconst)
7870                 v.AuxInt = int32ToAuxInt(c & 31)
7871                 v.AddArg(x)
7872                 return true
7873         }
7874         // match: (SHRL x (ANDLconst [31] y))
7875         // result: (SHRL x y)
7876         for {
7877                 x := v_0
7878                 if v_1.Op != Op386ANDLconst || auxIntToInt32(v_1.AuxInt) != 31 {
7879                         break
7880                 }
7881                 y := v_1.Args[0]
7882                 v.reset(Op386SHRL)
7883                 v.AddArg2(x, y)
7884                 return true
7885         }
7886         return false
7887 }
7888 func rewriteValue386_Op386SHRLconst(v *Value) bool {
7889         v_0 := v.Args[0]
7890         // match: (SHRLconst x [0])
7891         // result: x
7892         for {
7893                 if auxIntToInt32(v.AuxInt) != 0 {
7894                         break
7895                 }
7896                 x := v_0
7897                 v.copyOf(x)
7898                 return true
7899         }
7900         return false
7901 }
7902 func rewriteValue386_Op386SHRW(v *Value) bool {
7903         v_1 := v.Args[1]
7904         v_0 := v.Args[0]
7905         // match: (SHRW x (MOVLconst [c]))
7906         // cond: c&31 < 16
7907         // result: (SHRWconst [int16(c&31)] x)
7908         for {
7909                 x := v_0
7910                 if v_1.Op != Op386MOVLconst {
7911                         break
7912                 }
7913                 c := auxIntToInt32(v_1.AuxInt)
7914                 if !(c&31 < 16) {
7915                         break
7916                 }
7917                 v.reset(Op386SHRWconst)
7918                 v.AuxInt = int16ToAuxInt(int16(c & 31))
7919                 v.AddArg(x)
7920                 return true
7921         }
7922         // match: (SHRW _ (MOVLconst [c]))
7923         // cond: c&31 >= 16
7924         // result: (MOVLconst [0])
7925         for {
7926                 if v_1.Op != Op386MOVLconst {
7927                         break
7928                 }
7929                 c := auxIntToInt32(v_1.AuxInt)
7930                 if !(c&31 >= 16) {
7931                         break
7932                 }
7933                 v.reset(Op386MOVLconst)
7934                 v.AuxInt = int32ToAuxInt(0)
7935                 return true
7936         }
7937         return false
7938 }
7939 func rewriteValue386_Op386SHRWconst(v *Value) bool {
7940         v_0 := v.Args[0]
7941         // match: (SHRWconst x [0])
7942         // result: x
7943         for {
7944                 if auxIntToInt16(v.AuxInt) != 0 {
7945                         break
7946                 }
7947                 x := v_0
7948                 v.copyOf(x)
7949                 return true
7950         }
7951         return false
7952 }
7953 func rewriteValue386_Op386SUBL(v *Value) bool {
7954         v_1 := v.Args[1]
7955         v_0 := v.Args[0]
7956         b := v.Block
7957         // match: (SUBL x (MOVLconst [c]))
7958         // result: (SUBLconst x [c])
7959         for {
7960                 x := v_0
7961                 if v_1.Op != Op386MOVLconst {
7962                         break
7963                 }
7964                 c := auxIntToInt32(v_1.AuxInt)
7965                 v.reset(Op386SUBLconst)
7966                 v.AuxInt = int32ToAuxInt(c)
7967                 v.AddArg(x)
7968                 return true
7969         }
7970         // match: (SUBL (MOVLconst [c]) x)
7971         // result: (NEGL (SUBLconst <v.Type> x [c]))
7972         for {
7973                 if v_0.Op != Op386MOVLconst {
7974                         break
7975                 }
7976                 c := auxIntToInt32(v_0.AuxInt)
7977                 x := v_1
7978                 v.reset(Op386NEGL)
7979                 v0 := b.NewValue0(v.Pos, Op386SUBLconst, v.Type)
7980                 v0.AuxInt = int32ToAuxInt(c)
7981                 v0.AddArg(x)
7982                 v.AddArg(v0)
7983                 return true
7984         }
7985         // match: (SUBL x l:(MOVLload [off] {sym} ptr mem))
7986         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
7987         // result: (SUBLload x [off] {sym} ptr mem)
7988         for {
7989                 x := v_0
7990                 l := v_1
7991                 if l.Op != Op386MOVLload {
7992                         break
7993                 }
7994                 off := auxIntToInt32(l.AuxInt)
7995                 sym := auxToSym(l.Aux)
7996                 mem := l.Args[1]
7997                 ptr := l.Args[0]
7998                 if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
7999                         break
8000                 }
8001                 v.reset(Op386SUBLload)
8002                 v.AuxInt = int32ToAuxInt(off)
8003                 v.Aux = symToAux(sym)
8004                 v.AddArg3(x, ptr, mem)
8005                 return true
8006         }
8007         // match: (SUBL x x)
8008         // result: (MOVLconst [0])
8009         for {
8010                 x := v_0
8011                 if x != v_1 {
8012                         break
8013                 }
8014                 v.reset(Op386MOVLconst)
8015                 v.AuxInt = int32ToAuxInt(0)
8016                 return true
8017         }
8018         return false
8019 }
8020 func rewriteValue386_Op386SUBLcarry(v *Value) bool {
8021         v_1 := v.Args[1]
8022         v_0 := v.Args[0]
8023         // match: (SUBLcarry x (MOVLconst [c]))
8024         // result: (SUBLconstcarry [c] x)
8025         for {
8026                 x := v_0
8027                 if v_1.Op != Op386MOVLconst {
8028                         break
8029                 }
8030                 c := auxIntToInt32(v_1.AuxInt)
8031                 v.reset(Op386SUBLconstcarry)
8032                 v.AuxInt = int32ToAuxInt(c)
8033                 v.AddArg(x)
8034                 return true
8035         }
8036         return false
8037 }
8038 func rewriteValue386_Op386SUBLconst(v *Value) bool {
8039         v_0 := v.Args[0]
8040         // match: (SUBLconst [c] x)
8041         // cond: c==0
8042         // result: x
8043         for {
8044                 c := auxIntToInt32(v.AuxInt)
8045                 x := v_0
8046                 if !(c == 0) {
8047                         break
8048                 }
8049                 v.copyOf(x)
8050                 return true
8051         }
8052         // match: (SUBLconst [c] x)
8053         // result: (ADDLconst [-c] x)
8054         for {
8055                 c := auxIntToInt32(v.AuxInt)
8056                 x := v_0
8057                 v.reset(Op386ADDLconst)
8058                 v.AuxInt = int32ToAuxInt(-c)
8059                 v.AddArg(x)
8060                 return true
8061         }
8062 }
8063 func rewriteValue386_Op386SUBLload(v *Value) bool {
8064         v_2 := v.Args[2]
8065         v_1 := v.Args[1]
8066         v_0 := v.Args[0]
8067         b := v.Block
8068         config := b.Func.Config
8069         // match: (SUBLload [off1] {sym} val (ADDLconst [off2] base) mem)
8070         // cond: is32Bit(int64(off1)+int64(off2))
8071         // result: (SUBLload [off1+off2] {sym} val base mem)
8072         for {
8073                 off1 := auxIntToInt32(v.AuxInt)
8074                 sym := auxToSym(v.Aux)
8075                 val := v_0
8076                 if v_1.Op != Op386ADDLconst {
8077                         break
8078                 }
8079                 off2 := auxIntToInt32(v_1.AuxInt)
8080                 base := v_1.Args[0]
8081                 mem := v_2
8082                 if !(is32Bit(int64(off1) + int64(off2))) {
8083                         break
8084                 }
8085                 v.reset(Op386SUBLload)
8086                 v.AuxInt = int32ToAuxInt(off1 + off2)
8087                 v.Aux = symToAux(sym)
8088                 v.AddArg3(val, base, mem)
8089                 return true
8090         }
8091         // match: (SUBLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
8092         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8093         // result: (SUBLload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
8094         for {
8095                 off1 := auxIntToInt32(v.AuxInt)
8096                 sym1 := auxToSym(v.Aux)
8097                 val := v_0
8098                 if v_1.Op != Op386LEAL {
8099                         break
8100                 }
8101                 off2 := auxIntToInt32(v_1.AuxInt)
8102                 sym2 := auxToSym(v_1.Aux)
8103                 base := v_1.Args[0]
8104                 mem := v_2
8105                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8106                         break
8107                 }
8108                 v.reset(Op386SUBLload)
8109                 v.AuxInt = int32ToAuxInt(off1 + off2)
8110                 v.Aux = symToAux(mergeSym(sym1, sym2))
8111                 v.AddArg3(val, base, mem)
8112                 return true
8113         }
8114         return false
8115 }
8116 func rewriteValue386_Op386SUBLmodify(v *Value) bool {
8117         v_2 := v.Args[2]
8118         v_1 := v.Args[1]
8119         v_0 := v.Args[0]
8120         b := v.Block
8121         config := b.Func.Config
8122         // match: (SUBLmodify [off1] {sym} (ADDLconst [off2] base) val mem)
8123         // cond: is32Bit(int64(off1)+int64(off2))
8124         // result: (SUBLmodify [off1+off2] {sym} base val mem)
8125         for {
8126                 off1 := auxIntToInt32(v.AuxInt)
8127                 sym := auxToSym(v.Aux)
8128                 if v_0.Op != Op386ADDLconst {
8129                         break
8130                 }
8131                 off2 := auxIntToInt32(v_0.AuxInt)
8132                 base := v_0.Args[0]
8133                 val := v_1
8134                 mem := v_2
8135                 if !(is32Bit(int64(off1) + int64(off2))) {
8136                         break
8137                 }
8138                 v.reset(Op386SUBLmodify)
8139                 v.AuxInt = int32ToAuxInt(off1 + off2)
8140                 v.Aux = symToAux(sym)
8141                 v.AddArg3(base, val, mem)
8142                 return true
8143         }
8144         // match: (SUBLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
8145         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8146         // result: (SUBLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem)
8147         for {
8148                 off1 := auxIntToInt32(v.AuxInt)
8149                 sym1 := auxToSym(v.Aux)
8150                 if v_0.Op != Op386LEAL {
8151                         break
8152                 }
8153                 off2 := auxIntToInt32(v_0.AuxInt)
8154                 sym2 := auxToSym(v_0.Aux)
8155                 base := v_0.Args[0]
8156                 val := v_1
8157                 mem := v_2
8158                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8159                         break
8160                 }
8161                 v.reset(Op386SUBLmodify)
8162                 v.AuxInt = int32ToAuxInt(off1 + off2)
8163                 v.Aux = symToAux(mergeSym(sym1, sym2))
8164                 v.AddArg3(base, val, mem)
8165                 return true
8166         }
8167         return false
8168 }
8169 func rewriteValue386_Op386SUBSD(v *Value) bool {
8170         v_1 := v.Args[1]
8171         v_0 := v.Args[0]
8172         // match: (SUBSD x l:(MOVSDload [off] {sym} ptr mem))
8173         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
8174         // result: (SUBSDload x [off] {sym} ptr mem)
8175         for {
8176                 x := v_0
8177                 l := v_1
8178                 if l.Op != Op386MOVSDload {
8179                         break
8180                 }
8181                 off := auxIntToInt32(l.AuxInt)
8182                 sym := auxToSym(l.Aux)
8183                 mem := l.Args[1]
8184                 ptr := l.Args[0]
8185                 if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
8186                         break
8187                 }
8188                 v.reset(Op386SUBSDload)
8189                 v.AuxInt = int32ToAuxInt(off)
8190                 v.Aux = symToAux(sym)
8191                 v.AddArg3(x, ptr, mem)
8192                 return true
8193         }
8194         return false
8195 }
8196 func rewriteValue386_Op386SUBSDload(v *Value) bool {
8197         v_2 := v.Args[2]
8198         v_1 := v.Args[1]
8199         v_0 := v.Args[0]
8200         b := v.Block
8201         config := b.Func.Config
8202         // match: (SUBSDload [off1] {sym} val (ADDLconst [off2] base) mem)
8203         // cond: is32Bit(int64(off1)+int64(off2))
8204         // result: (SUBSDload [off1+off2] {sym} val base mem)
8205         for {
8206                 off1 := auxIntToInt32(v.AuxInt)
8207                 sym := auxToSym(v.Aux)
8208                 val := v_0
8209                 if v_1.Op != Op386ADDLconst {
8210                         break
8211                 }
8212                 off2 := auxIntToInt32(v_1.AuxInt)
8213                 base := v_1.Args[0]
8214                 mem := v_2
8215                 if !(is32Bit(int64(off1) + int64(off2))) {
8216                         break
8217                 }
8218                 v.reset(Op386SUBSDload)
8219                 v.AuxInt = int32ToAuxInt(off1 + off2)
8220                 v.Aux = symToAux(sym)
8221                 v.AddArg3(val, base, mem)
8222                 return true
8223         }
8224         // match: (SUBSDload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
8225         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8226         // result: (SUBSDload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
8227         for {
8228                 off1 := auxIntToInt32(v.AuxInt)
8229                 sym1 := auxToSym(v.Aux)
8230                 val := v_0
8231                 if v_1.Op != Op386LEAL {
8232                         break
8233                 }
8234                 off2 := auxIntToInt32(v_1.AuxInt)
8235                 sym2 := auxToSym(v_1.Aux)
8236                 base := v_1.Args[0]
8237                 mem := v_2
8238                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8239                         break
8240                 }
8241                 v.reset(Op386SUBSDload)
8242                 v.AuxInt = int32ToAuxInt(off1 + off2)
8243                 v.Aux = symToAux(mergeSym(sym1, sym2))
8244                 v.AddArg3(val, base, mem)
8245                 return true
8246         }
8247         return false
8248 }
8249 func rewriteValue386_Op386SUBSS(v *Value) bool {
8250         v_1 := v.Args[1]
8251         v_0 := v.Args[0]
8252         // match: (SUBSS x l:(MOVSSload [off] {sym} ptr mem))
8253         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
8254         // result: (SUBSSload x [off] {sym} ptr mem)
8255         for {
8256                 x := v_0
8257                 l := v_1
8258                 if l.Op != Op386MOVSSload {
8259                         break
8260                 }
8261                 off := auxIntToInt32(l.AuxInt)
8262                 sym := auxToSym(l.Aux)
8263                 mem := l.Args[1]
8264                 ptr := l.Args[0]
8265                 if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
8266                         break
8267                 }
8268                 v.reset(Op386SUBSSload)
8269                 v.AuxInt = int32ToAuxInt(off)
8270                 v.Aux = symToAux(sym)
8271                 v.AddArg3(x, ptr, mem)
8272                 return true
8273         }
8274         return false
8275 }
8276 func rewriteValue386_Op386SUBSSload(v *Value) bool {
8277         v_2 := v.Args[2]
8278         v_1 := v.Args[1]
8279         v_0 := v.Args[0]
8280         b := v.Block
8281         config := b.Func.Config
8282         // match: (SUBSSload [off1] {sym} val (ADDLconst [off2] base) mem)
8283         // cond: is32Bit(int64(off1)+int64(off2))
8284         // result: (SUBSSload [off1+off2] {sym} val base mem)
8285         for {
8286                 off1 := auxIntToInt32(v.AuxInt)
8287                 sym := auxToSym(v.Aux)
8288                 val := v_0
8289                 if v_1.Op != Op386ADDLconst {
8290                         break
8291                 }
8292                 off2 := auxIntToInt32(v_1.AuxInt)
8293                 base := v_1.Args[0]
8294                 mem := v_2
8295                 if !(is32Bit(int64(off1) + int64(off2))) {
8296                         break
8297                 }
8298                 v.reset(Op386SUBSSload)
8299                 v.AuxInt = int32ToAuxInt(off1 + off2)
8300                 v.Aux = symToAux(sym)
8301                 v.AddArg3(val, base, mem)
8302                 return true
8303         }
8304         // match: (SUBSSload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
8305         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8306         // result: (SUBSSload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
8307         for {
8308                 off1 := auxIntToInt32(v.AuxInt)
8309                 sym1 := auxToSym(v.Aux)
8310                 val := v_0
8311                 if v_1.Op != Op386LEAL {
8312                         break
8313                 }
8314                 off2 := auxIntToInt32(v_1.AuxInt)
8315                 sym2 := auxToSym(v_1.Aux)
8316                 base := v_1.Args[0]
8317                 mem := v_2
8318                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8319                         break
8320                 }
8321                 v.reset(Op386SUBSSload)
8322                 v.AuxInt = int32ToAuxInt(off1 + off2)
8323                 v.Aux = symToAux(mergeSym(sym1, sym2))
8324                 v.AddArg3(val, base, mem)
8325                 return true
8326         }
8327         return false
8328 }
8329 func rewriteValue386_Op386XORL(v *Value) bool {
8330         v_1 := v.Args[1]
8331         v_0 := v.Args[0]
8332         // match: (XORL x (MOVLconst [c]))
8333         // result: (XORLconst [c] x)
8334         for {
8335                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8336                         x := v_0
8337                         if v_1.Op != Op386MOVLconst {
8338                                 continue
8339                         }
8340                         c := auxIntToInt32(v_1.AuxInt)
8341                         v.reset(Op386XORLconst)
8342                         v.AuxInt = int32ToAuxInt(c)
8343                         v.AddArg(x)
8344                         return true
8345                 }
8346                 break
8347         }
8348         // match: (XORL (SHLLconst [c] x) (SHRLconst [d] x))
8349         // cond: d == 32-c
8350         // result: (ROLLconst [c] x)
8351         for {
8352                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8353                         if v_0.Op != Op386SHLLconst {
8354                                 continue
8355                         }
8356                         c := auxIntToInt32(v_0.AuxInt)
8357                         x := v_0.Args[0]
8358                         if v_1.Op != Op386SHRLconst {
8359                                 continue
8360                         }
8361                         d := auxIntToInt32(v_1.AuxInt)
8362                         if x != v_1.Args[0] || !(d == 32-c) {
8363                                 continue
8364                         }
8365                         v.reset(Op386ROLLconst)
8366                         v.AuxInt = int32ToAuxInt(c)
8367                         v.AddArg(x)
8368                         return true
8369                 }
8370                 break
8371         }
8372         // match: (XORL <t> (SHLLconst x [c]) (SHRWconst x [d]))
8373         // cond: c < 16 && d == int16(16-c) && t.Size() == 2
8374         // result: (ROLWconst x [int16(c)])
8375         for {
8376                 t := v.Type
8377                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8378                         if v_0.Op != Op386SHLLconst {
8379                                 continue
8380                         }
8381                         c := auxIntToInt32(v_0.AuxInt)
8382                         x := v_0.Args[0]
8383                         if v_1.Op != Op386SHRWconst {
8384                                 continue
8385                         }
8386                         d := auxIntToInt16(v_1.AuxInt)
8387                         if x != v_1.Args[0] || !(c < 16 && d == int16(16-c) && t.Size() == 2) {
8388                                 continue
8389                         }
8390                         v.reset(Op386ROLWconst)
8391                         v.AuxInt = int16ToAuxInt(int16(c))
8392                         v.AddArg(x)
8393                         return true
8394                 }
8395                 break
8396         }
8397         // match: (XORL <t> (SHLLconst x [c]) (SHRBconst x [d]))
8398         // cond: c < 8 && d == int8(8-c) && t.Size() == 1
8399         // result: (ROLBconst x [int8(c)])
8400         for {
8401                 t := v.Type
8402                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8403                         if v_0.Op != Op386SHLLconst {
8404                                 continue
8405                         }
8406                         c := auxIntToInt32(v_0.AuxInt)
8407                         x := v_0.Args[0]
8408                         if v_1.Op != Op386SHRBconst {
8409                                 continue
8410                         }
8411                         d := auxIntToInt8(v_1.AuxInt)
8412                         if x != v_1.Args[0] || !(c < 8 && d == int8(8-c) && t.Size() == 1) {
8413                                 continue
8414                         }
8415                         v.reset(Op386ROLBconst)
8416                         v.AuxInt = int8ToAuxInt(int8(c))
8417                         v.AddArg(x)
8418                         return true
8419                 }
8420                 break
8421         }
8422         // match: (XORL x l:(MOVLload [off] {sym} ptr mem))
8423         // cond: canMergeLoadClobber(v, l, x) && clobber(l)
8424         // result: (XORLload x [off] {sym} ptr mem)
8425         for {
8426                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
8427                         x := v_0
8428                         l := v_1
8429                         if l.Op != Op386MOVLload {
8430                                 continue
8431                         }
8432                         off := auxIntToInt32(l.AuxInt)
8433                         sym := auxToSym(l.Aux)
8434                         mem := l.Args[1]
8435                         ptr := l.Args[0]
8436                         if !(canMergeLoadClobber(v, l, x) && clobber(l)) {
8437                                 continue
8438                         }
8439                         v.reset(Op386XORLload)
8440                         v.AuxInt = int32ToAuxInt(off)
8441                         v.Aux = symToAux(sym)
8442                         v.AddArg3(x, ptr, mem)
8443                         return true
8444                 }
8445                 break
8446         }
8447         // match: (XORL x x)
8448         // result: (MOVLconst [0])
8449         for {
8450                 x := v_0
8451                 if x != v_1 {
8452                         break
8453                 }
8454                 v.reset(Op386MOVLconst)
8455                 v.AuxInt = int32ToAuxInt(0)
8456                 return true
8457         }
8458         return false
8459 }
8460 func rewriteValue386_Op386XORLconst(v *Value) bool {
8461         v_0 := v.Args[0]
8462         // match: (XORLconst [c] (XORLconst [d] x))
8463         // result: (XORLconst [c ^ d] x)
8464         for {
8465                 c := auxIntToInt32(v.AuxInt)
8466                 if v_0.Op != Op386XORLconst {
8467                         break
8468                 }
8469                 d := auxIntToInt32(v_0.AuxInt)
8470                 x := v_0.Args[0]
8471                 v.reset(Op386XORLconst)
8472                 v.AuxInt = int32ToAuxInt(c ^ d)
8473                 v.AddArg(x)
8474                 return true
8475         }
8476         // match: (XORLconst [c] x)
8477         // cond: c==0
8478         // result: x
8479         for {
8480                 c := auxIntToInt32(v.AuxInt)
8481                 x := v_0
8482                 if !(c == 0) {
8483                         break
8484                 }
8485                 v.copyOf(x)
8486                 return true
8487         }
8488         // match: (XORLconst [c] (MOVLconst [d]))
8489         // result: (MOVLconst [c^d])
8490         for {
8491                 c := auxIntToInt32(v.AuxInt)
8492                 if v_0.Op != Op386MOVLconst {
8493                         break
8494                 }
8495                 d := auxIntToInt32(v_0.AuxInt)
8496                 v.reset(Op386MOVLconst)
8497                 v.AuxInt = int32ToAuxInt(c ^ d)
8498                 return true
8499         }
8500         return false
8501 }
8502 func rewriteValue386_Op386XORLconstmodify(v *Value) bool {
8503         v_1 := v.Args[1]
8504         v_0 := v.Args[0]
8505         b := v.Block
8506         config := b.Func.Config
8507         // match: (XORLconstmodify [valoff1] {sym} (ADDLconst [off2] base) mem)
8508         // cond: valoff1.canAdd32(off2)
8509         // result: (XORLconstmodify [valoff1.addOffset32(off2)] {sym} base mem)
8510         for {
8511                 valoff1 := auxIntToValAndOff(v.AuxInt)
8512                 sym := auxToSym(v.Aux)
8513                 if v_0.Op != Op386ADDLconst {
8514                         break
8515                 }
8516                 off2 := auxIntToInt32(v_0.AuxInt)
8517                 base := v_0.Args[0]
8518                 mem := v_1
8519                 if !(valoff1.canAdd32(off2)) {
8520                         break
8521                 }
8522                 v.reset(Op386XORLconstmodify)
8523                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
8524                 v.Aux = symToAux(sym)
8525                 v.AddArg2(base, mem)
8526                 return true
8527         }
8528         // match: (XORLconstmodify [valoff1] {sym1} (LEAL [off2] {sym2} base) mem)
8529         // cond: valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8530         // result: (XORLconstmodify [valoff1.addOffset32(off2)] {mergeSym(sym1,sym2)} base mem)
8531         for {
8532                 valoff1 := auxIntToValAndOff(v.AuxInt)
8533                 sym1 := auxToSym(v.Aux)
8534                 if v_0.Op != Op386LEAL {
8535                         break
8536                 }
8537                 off2 := auxIntToInt32(v_0.AuxInt)
8538                 sym2 := auxToSym(v_0.Aux)
8539                 base := v_0.Args[0]
8540                 mem := v_1
8541                 if !(valoff1.canAdd32(off2) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8542                         break
8543                 }
8544                 v.reset(Op386XORLconstmodify)
8545                 v.AuxInt = valAndOffToAuxInt(valoff1.addOffset32(off2))
8546                 v.Aux = symToAux(mergeSym(sym1, sym2))
8547                 v.AddArg2(base, mem)
8548                 return true
8549         }
8550         return false
8551 }
8552 func rewriteValue386_Op386XORLload(v *Value) bool {
8553         v_2 := v.Args[2]
8554         v_1 := v.Args[1]
8555         v_0 := v.Args[0]
8556         b := v.Block
8557         config := b.Func.Config
8558         // match: (XORLload [off1] {sym} val (ADDLconst [off2] base) mem)
8559         // cond: is32Bit(int64(off1)+int64(off2))
8560         // result: (XORLload [off1+off2] {sym} val base mem)
8561         for {
8562                 off1 := auxIntToInt32(v.AuxInt)
8563                 sym := auxToSym(v.Aux)
8564                 val := v_0
8565                 if v_1.Op != Op386ADDLconst {
8566                         break
8567                 }
8568                 off2 := auxIntToInt32(v_1.AuxInt)
8569                 base := v_1.Args[0]
8570                 mem := v_2
8571                 if !(is32Bit(int64(off1) + int64(off2))) {
8572                         break
8573                 }
8574                 v.reset(Op386XORLload)
8575                 v.AuxInt = int32ToAuxInt(off1 + off2)
8576                 v.Aux = symToAux(sym)
8577                 v.AddArg3(val, base, mem)
8578                 return true
8579         }
8580         // match: (XORLload [off1] {sym1} val (LEAL [off2] {sym2} base) mem)
8581         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8582         // result: (XORLload [off1+off2] {mergeSym(sym1,sym2)} val base mem)
8583         for {
8584                 off1 := auxIntToInt32(v.AuxInt)
8585                 sym1 := auxToSym(v.Aux)
8586                 val := v_0
8587                 if v_1.Op != Op386LEAL {
8588                         break
8589                 }
8590                 off2 := auxIntToInt32(v_1.AuxInt)
8591                 sym2 := auxToSym(v_1.Aux)
8592                 base := v_1.Args[0]
8593                 mem := v_2
8594                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8595                         break
8596                 }
8597                 v.reset(Op386XORLload)
8598                 v.AuxInt = int32ToAuxInt(off1 + off2)
8599                 v.Aux = symToAux(mergeSym(sym1, sym2))
8600                 v.AddArg3(val, base, mem)
8601                 return true
8602         }
8603         return false
8604 }
8605 func rewriteValue386_Op386XORLmodify(v *Value) bool {
8606         v_2 := v.Args[2]
8607         v_1 := v.Args[1]
8608         v_0 := v.Args[0]
8609         b := v.Block
8610         config := b.Func.Config
8611         // match: (XORLmodify [off1] {sym} (ADDLconst [off2] base) val mem)
8612         // cond: is32Bit(int64(off1)+int64(off2))
8613         // result: (XORLmodify [off1+off2] {sym} base val mem)
8614         for {
8615                 off1 := auxIntToInt32(v.AuxInt)
8616                 sym := auxToSym(v.Aux)
8617                 if v_0.Op != Op386ADDLconst {
8618                         break
8619                 }
8620                 off2 := auxIntToInt32(v_0.AuxInt)
8621                 base := v_0.Args[0]
8622                 val := v_1
8623                 mem := v_2
8624                 if !(is32Bit(int64(off1) + int64(off2))) {
8625                         break
8626                 }
8627                 v.reset(Op386XORLmodify)
8628                 v.AuxInt = int32ToAuxInt(off1 + off2)
8629                 v.Aux = symToAux(sym)
8630                 v.AddArg3(base, val, mem)
8631                 return true
8632         }
8633         // match: (XORLmodify [off1] {sym1} (LEAL [off2] {sym2} base) val mem)
8634         // cond: is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)
8635         // result: (XORLmodify [off1+off2] {mergeSym(sym1,sym2)} base val mem)
8636         for {
8637                 off1 := auxIntToInt32(v.AuxInt)
8638                 sym1 := auxToSym(v.Aux)
8639                 if v_0.Op != Op386LEAL {
8640                         break
8641                 }
8642                 off2 := auxIntToInt32(v_0.AuxInt)
8643                 sym2 := auxToSym(v_0.Aux)
8644                 base := v_0.Args[0]
8645                 val := v_1
8646                 mem := v_2
8647                 if !(is32Bit(int64(off1)+int64(off2)) && canMergeSym(sym1, sym2) && (base.Op != OpSB || !config.ctxt.Flag_shared)) {
8648                         break
8649                 }
8650                 v.reset(Op386XORLmodify)
8651                 v.AuxInt = int32ToAuxInt(off1 + off2)
8652                 v.Aux = symToAux(mergeSym(sym1, sym2))
8653                 v.AddArg3(base, val, mem)
8654                 return true
8655         }
8656         return false
8657 }
8658 func rewriteValue386_OpAddr(v *Value) bool {
8659         v_0 := v.Args[0]
8660         // match: (Addr {sym} base)
8661         // result: (LEAL {sym} base)
8662         for {
8663                 sym := auxToSym(v.Aux)
8664                 base := v_0
8665                 v.reset(Op386LEAL)
8666                 v.Aux = symToAux(sym)
8667                 v.AddArg(base)
8668                 return true
8669         }
8670 }
8671 func rewriteValue386_OpConst16(v *Value) bool {
8672         // match: (Const16 [c])
8673         // result: (MOVLconst [int32(c)])
8674         for {
8675                 c := auxIntToInt16(v.AuxInt)
8676                 v.reset(Op386MOVLconst)
8677                 v.AuxInt = int32ToAuxInt(int32(c))
8678                 return true
8679         }
8680 }
8681 func rewriteValue386_OpConst8(v *Value) bool {
8682         // match: (Const8 [c])
8683         // result: (MOVLconst [int32(c)])
8684         for {
8685                 c := auxIntToInt8(v.AuxInt)
8686                 v.reset(Op386MOVLconst)
8687                 v.AuxInt = int32ToAuxInt(int32(c))
8688                 return true
8689         }
8690 }
8691 func rewriteValue386_OpConstBool(v *Value) bool {
8692         // match: (ConstBool [c])
8693         // result: (MOVLconst [b2i32(c)])
8694         for {
8695                 c := auxIntToBool(v.AuxInt)
8696                 v.reset(Op386MOVLconst)
8697                 v.AuxInt = int32ToAuxInt(b2i32(c))
8698                 return true
8699         }
8700 }
8701 func rewriteValue386_OpConstNil(v *Value) bool {
8702         // match: (ConstNil)
8703         // result: (MOVLconst [0])
8704         for {
8705                 v.reset(Op386MOVLconst)
8706                 v.AuxInt = int32ToAuxInt(0)
8707                 return true
8708         }
8709 }
8710 func rewriteValue386_OpCtz16(v *Value) bool {
8711         v_0 := v.Args[0]
8712         b := v.Block
8713         typ := &b.Func.Config.Types
8714         // match: (Ctz16 x)
8715         // result: (BSFL (ORLconst <typ.UInt32> [0x10000] x))
8716         for {
8717                 x := v_0
8718                 v.reset(Op386BSFL)
8719                 v0 := b.NewValue0(v.Pos, Op386ORLconst, typ.UInt32)
8720                 v0.AuxInt = int32ToAuxInt(0x10000)
8721                 v0.AddArg(x)
8722                 v.AddArg(v0)
8723                 return true
8724         }
8725 }
8726 func rewriteValue386_OpDiv8(v *Value) bool {
8727         v_1 := v.Args[1]
8728         v_0 := v.Args[0]
8729         b := v.Block
8730         typ := &b.Func.Config.Types
8731         // match: (Div8 x y)
8732         // result: (DIVW (SignExt8to16 x) (SignExt8to16 y))
8733         for {
8734                 x := v_0
8735                 y := v_1
8736                 v.reset(Op386DIVW)
8737                 v0 := b.NewValue0(v.Pos, OpSignExt8to16, typ.Int16)
8738                 v0.AddArg(x)
8739                 v1 := b.NewValue0(v.Pos, OpSignExt8to16, typ.Int16)
8740                 v1.AddArg(y)
8741                 v.AddArg2(v0, v1)
8742                 return true
8743         }
8744 }
8745 func rewriteValue386_OpDiv8u(v *Value) bool {
8746         v_1 := v.Args[1]
8747         v_0 := v.Args[0]
8748         b := v.Block
8749         typ := &b.Func.Config.Types
8750         // match: (Div8u x y)
8751         // result: (DIVWU (ZeroExt8to16 x) (ZeroExt8to16 y))
8752         for {
8753                 x := v_0
8754                 y := v_1
8755                 v.reset(Op386DIVWU)
8756                 v0 := b.NewValue0(v.Pos, OpZeroExt8to16, typ.UInt16)
8757                 v0.AddArg(x)
8758                 v1 := b.NewValue0(v.Pos, OpZeroExt8to16, typ.UInt16)
8759                 v1.AddArg(y)
8760                 v.AddArg2(v0, v1)
8761                 return true
8762         }
8763 }
8764 func rewriteValue386_OpEq16(v *Value) bool {
8765         v_1 := v.Args[1]
8766         v_0 := v.Args[0]
8767         b := v.Block
8768         // match: (Eq16 x y)
8769         // result: (SETEQ (CMPW x y))
8770         for {
8771                 x := v_0
8772                 y := v_1
8773                 v.reset(Op386SETEQ)
8774                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
8775                 v0.AddArg2(x, y)
8776                 v.AddArg(v0)
8777                 return true
8778         }
8779 }
8780 func rewriteValue386_OpEq32(v *Value) bool {
8781         v_1 := v.Args[1]
8782         v_0 := v.Args[0]
8783         b := v.Block
8784         // match: (Eq32 x y)
8785         // result: (SETEQ (CMPL x y))
8786         for {
8787                 x := v_0
8788                 y := v_1
8789                 v.reset(Op386SETEQ)
8790                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
8791                 v0.AddArg2(x, y)
8792                 v.AddArg(v0)
8793                 return true
8794         }
8795 }
8796 func rewriteValue386_OpEq32F(v *Value) bool {
8797         v_1 := v.Args[1]
8798         v_0 := v.Args[0]
8799         b := v.Block
8800         // match: (Eq32F x y)
8801         // result: (SETEQF (UCOMISS x y))
8802         for {
8803                 x := v_0
8804                 y := v_1
8805                 v.reset(Op386SETEQF)
8806                 v0 := b.NewValue0(v.Pos, Op386UCOMISS, types.TypeFlags)
8807                 v0.AddArg2(x, y)
8808                 v.AddArg(v0)
8809                 return true
8810         }
8811 }
8812 func rewriteValue386_OpEq64F(v *Value) bool {
8813         v_1 := v.Args[1]
8814         v_0 := v.Args[0]
8815         b := v.Block
8816         // match: (Eq64F x y)
8817         // result: (SETEQF (UCOMISD x y))
8818         for {
8819                 x := v_0
8820                 y := v_1
8821                 v.reset(Op386SETEQF)
8822                 v0 := b.NewValue0(v.Pos, Op386UCOMISD, types.TypeFlags)
8823                 v0.AddArg2(x, y)
8824                 v.AddArg(v0)
8825                 return true
8826         }
8827 }
8828 func rewriteValue386_OpEq8(v *Value) bool {
8829         v_1 := v.Args[1]
8830         v_0 := v.Args[0]
8831         b := v.Block
8832         // match: (Eq8 x y)
8833         // result: (SETEQ (CMPB x y))
8834         for {
8835                 x := v_0
8836                 y := v_1
8837                 v.reset(Op386SETEQ)
8838                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
8839                 v0.AddArg2(x, y)
8840                 v.AddArg(v0)
8841                 return true
8842         }
8843 }
8844 func rewriteValue386_OpEqB(v *Value) bool {
8845         v_1 := v.Args[1]
8846         v_0 := v.Args[0]
8847         b := v.Block
8848         // match: (EqB x y)
8849         // result: (SETEQ (CMPB x y))
8850         for {
8851                 x := v_0
8852                 y := v_1
8853                 v.reset(Op386SETEQ)
8854                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
8855                 v0.AddArg2(x, y)
8856                 v.AddArg(v0)
8857                 return true
8858         }
8859 }
8860 func rewriteValue386_OpEqPtr(v *Value) bool {
8861         v_1 := v.Args[1]
8862         v_0 := v.Args[0]
8863         b := v.Block
8864         // match: (EqPtr x y)
8865         // result: (SETEQ (CMPL x y))
8866         for {
8867                 x := v_0
8868                 y := v_1
8869                 v.reset(Op386SETEQ)
8870                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
8871                 v0.AddArg2(x, y)
8872                 v.AddArg(v0)
8873                 return true
8874         }
8875 }
8876 func rewriteValue386_OpIsInBounds(v *Value) bool {
8877         v_1 := v.Args[1]
8878         v_0 := v.Args[0]
8879         b := v.Block
8880         // match: (IsInBounds idx len)
8881         // result: (SETB (CMPL idx len))
8882         for {
8883                 idx := v_0
8884                 len := v_1
8885                 v.reset(Op386SETB)
8886                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
8887                 v0.AddArg2(idx, len)
8888                 v.AddArg(v0)
8889                 return true
8890         }
8891 }
8892 func rewriteValue386_OpIsNonNil(v *Value) bool {
8893         v_0 := v.Args[0]
8894         b := v.Block
8895         // match: (IsNonNil p)
8896         // result: (SETNE (TESTL p p))
8897         for {
8898                 p := v_0
8899                 v.reset(Op386SETNE)
8900                 v0 := b.NewValue0(v.Pos, Op386TESTL, types.TypeFlags)
8901                 v0.AddArg2(p, p)
8902                 v.AddArg(v0)
8903                 return true
8904         }
8905 }
8906 func rewriteValue386_OpIsSliceInBounds(v *Value) bool {
8907         v_1 := v.Args[1]
8908         v_0 := v.Args[0]
8909         b := v.Block
8910         // match: (IsSliceInBounds idx len)
8911         // result: (SETBE (CMPL idx len))
8912         for {
8913                 idx := v_0
8914                 len := v_1
8915                 v.reset(Op386SETBE)
8916                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
8917                 v0.AddArg2(idx, len)
8918                 v.AddArg(v0)
8919                 return true
8920         }
8921 }
8922 func rewriteValue386_OpLeq16(v *Value) bool {
8923         v_1 := v.Args[1]
8924         v_0 := v.Args[0]
8925         b := v.Block
8926         // match: (Leq16 x y)
8927         // result: (SETLE (CMPW x y))
8928         for {
8929                 x := v_0
8930                 y := v_1
8931                 v.reset(Op386SETLE)
8932                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
8933                 v0.AddArg2(x, y)
8934                 v.AddArg(v0)
8935                 return true
8936         }
8937 }
8938 func rewriteValue386_OpLeq16U(v *Value) bool {
8939         v_1 := v.Args[1]
8940         v_0 := v.Args[0]
8941         b := v.Block
8942         // match: (Leq16U x y)
8943         // result: (SETBE (CMPW x y))
8944         for {
8945                 x := v_0
8946                 y := v_1
8947                 v.reset(Op386SETBE)
8948                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
8949                 v0.AddArg2(x, y)
8950                 v.AddArg(v0)
8951                 return true
8952         }
8953 }
8954 func rewriteValue386_OpLeq32(v *Value) bool {
8955         v_1 := v.Args[1]
8956         v_0 := v.Args[0]
8957         b := v.Block
8958         // match: (Leq32 x y)
8959         // result: (SETLE (CMPL x y))
8960         for {
8961                 x := v_0
8962                 y := v_1
8963                 v.reset(Op386SETLE)
8964                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
8965                 v0.AddArg2(x, y)
8966                 v.AddArg(v0)
8967                 return true
8968         }
8969 }
8970 func rewriteValue386_OpLeq32F(v *Value) bool {
8971         v_1 := v.Args[1]
8972         v_0 := v.Args[0]
8973         b := v.Block
8974         // match: (Leq32F x y)
8975         // result: (SETGEF (UCOMISS y x))
8976         for {
8977                 x := v_0
8978                 y := v_1
8979                 v.reset(Op386SETGEF)
8980                 v0 := b.NewValue0(v.Pos, Op386UCOMISS, types.TypeFlags)
8981                 v0.AddArg2(y, x)
8982                 v.AddArg(v0)
8983                 return true
8984         }
8985 }
8986 func rewriteValue386_OpLeq32U(v *Value) bool {
8987         v_1 := v.Args[1]
8988         v_0 := v.Args[0]
8989         b := v.Block
8990         // match: (Leq32U x y)
8991         // result: (SETBE (CMPL x y))
8992         for {
8993                 x := v_0
8994                 y := v_1
8995                 v.reset(Op386SETBE)
8996                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
8997                 v0.AddArg2(x, y)
8998                 v.AddArg(v0)
8999                 return true
9000         }
9001 }
9002 func rewriteValue386_OpLeq64F(v *Value) bool {
9003         v_1 := v.Args[1]
9004         v_0 := v.Args[0]
9005         b := v.Block
9006         // match: (Leq64F x y)
9007         // result: (SETGEF (UCOMISD y x))
9008         for {
9009                 x := v_0
9010                 y := v_1
9011                 v.reset(Op386SETGEF)
9012                 v0 := b.NewValue0(v.Pos, Op386UCOMISD, types.TypeFlags)
9013                 v0.AddArg2(y, x)
9014                 v.AddArg(v0)
9015                 return true
9016         }
9017 }
9018 func rewriteValue386_OpLeq8(v *Value) bool {
9019         v_1 := v.Args[1]
9020         v_0 := v.Args[0]
9021         b := v.Block
9022         // match: (Leq8 x y)
9023         // result: (SETLE (CMPB x y))
9024         for {
9025                 x := v_0
9026                 y := v_1
9027                 v.reset(Op386SETLE)
9028                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
9029                 v0.AddArg2(x, y)
9030                 v.AddArg(v0)
9031                 return true
9032         }
9033 }
9034 func rewriteValue386_OpLeq8U(v *Value) bool {
9035         v_1 := v.Args[1]
9036         v_0 := v.Args[0]
9037         b := v.Block
9038         // match: (Leq8U x y)
9039         // result: (SETBE (CMPB x y))
9040         for {
9041                 x := v_0
9042                 y := v_1
9043                 v.reset(Op386SETBE)
9044                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
9045                 v0.AddArg2(x, y)
9046                 v.AddArg(v0)
9047                 return true
9048         }
9049 }
9050 func rewriteValue386_OpLess16(v *Value) bool {
9051         v_1 := v.Args[1]
9052         v_0 := v.Args[0]
9053         b := v.Block
9054         // match: (Less16 x y)
9055         // result: (SETL (CMPW x y))
9056         for {
9057                 x := v_0
9058                 y := v_1
9059                 v.reset(Op386SETL)
9060                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
9061                 v0.AddArg2(x, y)
9062                 v.AddArg(v0)
9063                 return true
9064         }
9065 }
9066 func rewriteValue386_OpLess16U(v *Value) bool {
9067         v_1 := v.Args[1]
9068         v_0 := v.Args[0]
9069         b := v.Block
9070         // match: (Less16U x y)
9071         // result: (SETB (CMPW x y))
9072         for {
9073                 x := v_0
9074                 y := v_1
9075                 v.reset(Op386SETB)
9076                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
9077                 v0.AddArg2(x, y)
9078                 v.AddArg(v0)
9079                 return true
9080         }
9081 }
9082 func rewriteValue386_OpLess32(v *Value) bool {
9083         v_1 := v.Args[1]
9084         v_0 := v.Args[0]
9085         b := v.Block
9086         // match: (Less32 x y)
9087         // result: (SETL (CMPL x y))
9088         for {
9089                 x := v_0
9090                 y := v_1
9091                 v.reset(Op386SETL)
9092                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
9093                 v0.AddArg2(x, y)
9094                 v.AddArg(v0)
9095                 return true
9096         }
9097 }
9098 func rewriteValue386_OpLess32F(v *Value) bool {
9099         v_1 := v.Args[1]
9100         v_0 := v.Args[0]
9101         b := v.Block
9102         // match: (Less32F x y)
9103         // result: (SETGF (UCOMISS y x))
9104         for {
9105                 x := v_0
9106                 y := v_1
9107                 v.reset(Op386SETGF)
9108                 v0 := b.NewValue0(v.Pos, Op386UCOMISS, types.TypeFlags)
9109                 v0.AddArg2(y, x)
9110                 v.AddArg(v0)
9111                 return true
9112         }
9113 }
9114 func rewriteValue386_OpLess32U(v *Value) bool {
9115         v_1 := v.Args[1]
9116         v_0 := v.Args[0]
9117         b := v.Block
9118         // match: (Less32U x y)
9119         // result: (SETB (CMPL x y))
9120         for {
9121                 x := v_0
9122                 y := v_1
9123                 v.reset(Op386SETB)
9124                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
9125                 v0.AddArg2(x, y)
9126                 v.AddArg(v0)
9127                 return true
9128         }
9129 }
9130 func rewriteValue386_OpLess64F(v *Value) bool {
9131         v_1 := v.Args[1]
9132         v_0 := v.Args[0]
9133         b := v.Block
9134         // match: (Less64F x y)
9135         // result: (SETGF (UCOMISD y x))
9136         for {
9137                 x := v_0
9138                 y := v_1
9139                 v.reset(Op386SETGF)
9140                 v0 := b.NewValue0(v.Pos, Op386UCOMISD, types.TypeFlags)
9141                 v0.AddArg2(y, x)
9142                 v.AddArg(v0)
9143                 return true
9144         }
9145 }
9146 func rewriteValue386_OpLess8(v *Value) bool {
9147         v_1 := v.Args[1]
9148         v_0 := v.Args[0]
9149         b := v.Block
9150         // match: (Less8 x y)
9151         // result: (SETL (CMPB x y))
9152         for {
9153                 x := v_0
9154                 y := v_1
9155                 v.reset(Op386SETL)
9156                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
9157                 v0.AddArg2(x, y)
9158                 v.AddArg(v0)
9159                 return true
9160         }
9161 }
9162 func rewriteValue386_OpLess8U(v *Value) bool {
9163         v_1 := v.Args[1]
9164         v_0 := v.Args[0]
9165         b := v.Block
9166         // match: (Less8U x y)
9167         // result: (SETB (CMPB x y))
9168         for {
9169                 x := v_0
9170                 y := v_1
9171                 v.reset(Op386SETB)
9172                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
9173                 v0.AddArg2(x, y)
9174                 v.AddArg(v0)
9175                 return true
9176         }
9177 }
9178 func rewriteValue386_OpLoad(v *Value) bool {
9179         v_1 := v.Args[1]
9180         v_0 := v.Args[0]
9181         // match: (Load <t> ptr mem)
9182         // cond: (is32BitInt(t) || isPtr(t))
9183         // result: (MOVLload ptr mem)
9184         for {
9185                 t := v.Type
9186                 ptr := v_0
9187                 mem := v_1
9188                 if !(is32BitInt(t) || isPtr(t)) {
9189                         break
9190                 }
9191                 v.reset(Op386MOVLload)
9192                 v.AddArg2(ptr, mem)
9193                 return true
9194         }
9195         // match: (Load <t> ptr mem)
9196         // cond: is16BitInt(t)
9197         // result: (MOVWload ptr mem)
9198         for {
9199                 t := v.Type
9200                 ptr := v_0
9201                 mem := v_1
9202                 if !(is16BitInt(t)) {
9203                         break
9204                 }
9205                 v.reset(Op386MOVWload)
9206                 v.AddArg2(ptr, mem)
9207                 return true
9208         }
9209         // match: (Load <t> ptr mem)
9210         // cond: (t.IsBoolean() || is8BitInt(t))
9211         // result: (MOVBload ptr mem)
9212         for {
9213                 t := v.Type
9214                 ptr := v_0
9215                 mem := v_1
9216                 if !(t.IsBoolean() || is8BitInt(t)) {
9217                         break
9218                 }
9219                 v.reset(Op386MOVBload)
9220                 v.AddArg2(ptr, mem)
9221                 return true
9222         }
9223         // match: (Load <t> ptr mem)
9224         // cond: is32BitFloat(t)
9225         // result: (MOVSSload ptr mem)
9226         for {
9227                 t := v.Type
9228                 ptr := v_0
9229                 mem := v_1
9230                 if !(is32BitFloat(t)) {
9231                         break
9232                 }
9233                 v.reset(Op386MOVSSload)
9234                 v.AddArg2(ptr, mem)
9235                 return true
9236         }
9237         // match: (Load <t> ptr mem)
9238         // cond: is64BitFloat(t)
9239         // result: (MOVSDload ptr mem)
9240         for {
9241                 t := v.Type
9242                 ptr := v_0
9243                 mem := v_1
9244                 if !(is64BitFloat(t)) {
9245                         break
9246                 }
9247                 v.reset(Op386MOVSDload)
9248                 v.AddArg2(ptr, mem)
9249                 return true
9250         }
9251         return false
9252 }
9253 func rewriteValue386_OpLocalAddr(v *Value) bool {
9254         v_0 := v.Args[0]
9255         // match: (LocalAddr {sym} base _)
9256         // result: (LEAL {sym} base)
9257         for {
9258                 sym := auxToSym(v.Aux)
9259                 base := v_0
9260                 v.reset(Op386LEAL)
9261                 v.Aux = symToAux(sym)
9262                 v.AddArg(base)
9263                 return true
9264         }
9265 }
9266 func rewriteValue386_OpLsh16x16(v *Value) bool {
9267         v_1 := v.Args[1]
9268         v_0 := v.Args[0]
9269         b := v.Block
9270         // match: (Lsh16x16 <t> x y)
9271         // cond: !shiftIsBounded(v)
9272         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32])))
9273         for {
9274                 t := v.Type
9275                 x := v_0
9276                 y := v_1
9277                 if !(!shiftIsBounded(v)) {
9278                         break
9279                 }
9280                 v.reset(Op386ANDL)
9281                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9282                 v0.AddArg2(x, y)
9283                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9284                 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
9285                 v2.AuxInt = int16ToAuxInt(32)
9286                 v2.AddArg(y)
9287                 v1.AddArg(v2)
9288                 v.AddArg2(v0, v1)
9289                 return true
9290         }
9291         // match: (Lsh16x16 <t> x y)
9292         // cond: shiftIsBounded(v)
9293         // result: (SHLL <t> x y)
9294         for {
9295                 t := v.Type
9296                 x := v_0
9297                 y := v_1
9298                 if !(shiftIsBounded(v)) {
9299                         break
9300                 }
9301                 v.reset(Op386SHLL)
9302                 v.Type = t
9303                 v.AddArg2(x, y)
9304                 return true
9305         }
9306         return false
9307 }
9308 func rewriteValue386_OpLsh16x32(v *Value) bool {
9309         v_1 := v.Args[1]
9310         v_0 := v.Args[0]
9311         b := v.Block
9312         // match: (Lsh16x32 <t> x y)
9313         // cond: !shiftIsBounded(v)
9314         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32])))
9315         for {
9316                 t := v.Type
9317                 x := v_0
9318                 y := v_1
9319                 if !(!shiftIsBounded(v)) {
9320                         break
9321                 }
9322                 v.reset(Op386ANDL)
9323                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9324                 v0.AddArg2(x, y)
9325                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9326                 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
9327                 v2.AuxInt = int32ToAuxInt(32)
9328                 v2.AddArg(y)
9329                 v1.AddArg(v2)
9330                 v.AddArg2(v0, v1)
9331                 return true
9332         }
9333         // match: (Lsh16x32 <t> x y)
9334         // cond: shiftIsBounded(v)
9335         // result: (SHLL <t> x y)
9336         for {
9337                 t := v.Type
9338                 x := v_0
9339                 y := v_1
9340                 if !(shiftIsBounded(v)) {
9341                         break
9342                 }
9343                 v.reset(Op386SHLL)
9344                 v.Type = t
9345                 v.AddArg2(x, y)
9346                 return true
9347         }
9348         return false
9349 }
9350 func rewriteValue386_OpLsh16x64(v *Value) bool {
9351         v_1 := v.Args[1]
9352         v_0 := v.Args[0]
9353         // match: (Lsh16x64 x (Const64 [c]))
9354         // cond: uint64(c) < 16
9355         // result: (SHLLconst x [int32(c)])
9356         for {
9357                 x := v_0
9358                 if v_1.Op != OpConst64 {
9359                         break
9360                 }
9361                 c := auxIntToInt64(v_1.AuxInt)
9362                 if !(uint64(c) < 16) {
9363                         break
9364                 }
9365                 v.reset(Op386SHLLconst)
9366                 v.AuxInt = int32ToAuxInt(int32(c))
9367                 v.AddArg(x)
9368                 return true
9369         }
9370         // match: (Lsh16x64 _ (Const64 [c]))
9371         // cond: uint64(c) >= 16
9372         // result: (Const16 [0])
9373         for {
9374                 if v_1.Op != OpConst64 {
9375                         break
9376                 }
9377                 c := auxIntToInt64(v_1.AuxInt)
9378                 if !(uint64(c) >= 16) {
9379                         break
9380                 }
9381                 v.reset(OpConst16)
9382                 v.AuxInt = int16ToAuxInt(0)
9383                 return true
9384         }
9385         return false
9386 }
9387 func rewriteValue386_OpLsh16x8(v *Value) bool {
9388         v_1 := v.Args[1]
9389         v_0 := v.Args[0]
9390         b := v.Block
9391         // match: (Lsh16x8 <t> x y)
9392         // cond: !shiftIsBounded(v)
9393         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32])))
9394         for {
9395                 t := v.Type
9396                 x := v_0
9397                 y := v_1
9398                 if !(!shiftIsBounded(v)) {
9399                         break
9400                 }
9401                 v.reset(Op386ANDL)
9402                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9403                 v0.AddArg2(x, y)
9404                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9405                 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
9406                 v2.AuxInt = int8ToAuxInt(32)
9407                 v2.AddArg(y)
9408                 v1.AddArg(v2)
9409                 v.AddArg2(v0, v1)
9410                 return true
9411         }
9412         // match: (Lsh16x8 <t> x y)
9413         // cond: shiftIsBounded(v)
9414         // result: (SHLL <t> x y)
9415         for {
9416                 t := v.Type
9417                 x := v_0
9418                 y := v_1
9419                 if !(shiftIsBounded(v)) {
9420                         break
9421                 }
9422                 v.reset(Op386SHLL)
9423                 v.Type = t
9424                 v.AddArg2(x, y)
9425                 return true
9426         }
9427         return false
9428 }
9429 func rewriteValue386_OpLsh32x16(v *Value) bool {
9430         v_1 := v.Args[1]
9431         v_0 := v.Args[0]
9432         b := v.Block
9433         // match: (Lsh32x16 <t> x y)
9434         // cond: !shiftIsBounded(v)
9435         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32])))
9436         for {
9437                 t := v.Type
9438                 x := v_0
9439                 y := v_1
9440                 if !(!shiftIsBounded(v)) {
9441                         break
9442                 }
9443                 v.reset(Op386ANDL)
9444                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9445                 v0.AddArg2(x, y)
9446                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9447                 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
9448                 v2.AuxInt = int16ToAuxInt(32)
9449                 v2.AddArg(y)
9450                 v1.AddArg(v2)
9451                 v.AddArg2(v0, v1)
9452                 return true
9453         }
9454         // match: (Lsh32x16 <t> x y)
9455         // cond: shiftIsBounded(v)
9456         // result: (SHLL <t> x y)
9457         for {
9458                 t := v.Type
9459                 x := v_0
9460                 y := v_1
9461                 if !(shiftIsBounded(v)) {
9462                         break
9463                 }
9464                 v.reset(Op386SHLL)
9465                 v.Type = t
9466                 v.AddArg2(x, y)
9467                 return true
9468         }
9469         return false
9470 }
9471 func rewriteValue386_OpLsh32x32(v *Value) bool {
9472         v_1 := v.Args[1]
9473         v_0 := v.Args[0]
9474         b := v.Block
9475         // match: (Lsh32x32 <t> x y)
9476         // cond: !shiftIsBounded(v)
9477         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32])))
9478         for {
9479                 t := v.Type
9480                 x := v_0
9481                 y := v_1
9482                 if !(!shiftIsBounded(v)) {
9483                         break
9484                 }
9485                 v.reset(Op386ANDL)
9486                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9487                 v0.AddArg2(x, y)
9488                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9489                 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
9490                 v2.AuxInt = int32ToAuxInt(32)
9491                 v2.AddArg(y)
9492                 v1.AddArg(v2)
9493                 v.AddArg2(v0, v1)
9494                 return true
9495         }
9496         // match: (Lsh32x32 <t> x y)
9497         // cond: shiftIsBounded(v)
9498         // result: (SHLL <t> x y)
9499         for {
9500                 t := v.Type
9501                 x := v_0
9502                 y := v_1
9503                 if !(shiftIsBounded(v)) {
9504                         break
9505                 }
9506                 v.reset(Op386SHLL)
9507                 v.Type = t
9508                 v.AddArg2(x, y)
9509                 return true
9510         }
9511         return false
9512 }
9513 func rewriteValue386_OpLsh32x64(v *Value) bool {
9514         v_1 := v.Args[1]
9515         v_0 := v.Args[0]
9516         // match: (Lsh32x64 x (Const64 [c]))
9517         // cond: uint64(c) < 32
9518         // result: (SHLLconst x [int32(c)])
9519         for {
9520                 x := v_0
9521                 if v_1.Op != OpConst64 {
9522                         break
9523                 }
9524                 c := auxIntToInt64(v_1.AuxInt)
9525                 if !(uint64(c) < 32) {
9526                         break
9527                 }
9528                 v.reset(Op386SHLLconst)
9529                 v.AuxInt = int32ToAuxInt(int32(c))
9530                 v.AddArg(x)
9531                 return true
9532         }
9533         // match: (Lsh32x64 _ (Const64 [c]))
9534         // cond: uint64(c) >= 32
9535         // result: (Const32 [0])
9536         for {
9537                 if v_1.Op != OpConst64 {
9538                         break
9539                 }
9540                 c := auxIntToInt64(v_1.AuxInt)
9541                 if !(uint64(c) >= 32) {
9542                         break
9543                 }
9544                 v.reset(OpConst32)
9545                 v.AuxInt = int32ToAuxInt(0)
9546                 return true
9547         }
9548         return false
9549 }
9550 func rewriteValue386_OpLsh32x8(v *Value) bool {
9551         v_1 := v.Args[1]
9552         v_0 := v.Args[0]
9553         b := v.Block
9554         // match: (Lsh32x8 <t> x y)
9555         // cond: !shiftIsBounded(v)
9556         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32])))
9557         for {
9558                 t := v.Type
9559                 x := v_0
9560                 y := v_1
9561                 if !(!shiftIsBounded(v)) {
9562                         break
9563                 }
9564                 v.reset(Op386ANDL)
9565                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9566                 v0.AddArg2(x, y)
9567                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9568                 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
9569                 v2.AuxInt = int8ToAuxInt(32)
9570                 v2.AddArg(y)
9571                 v1.AddArg(v2)
9572                 v.AddArg2(v0, v1)
9573                 return true
9574         }
9575         // match: (Lsh32x8 <t> x y)
9576         // cond: shiftIsBounded(v)
9577         // result: (SHLL <t> x y)
9578         for {
9579                 t := v.Type
9580                 x := v_0
9581                 y := v_1
9582                 if !(shiftIsBounded(v)) {
9583                         break
9584                 }
9585                 v.reset(Op386SHLL)
9586                 v.Type = t
9587                 v.AddArg2(x, y)
9588                 return true
9589         }
9590         return false
9591 }
9592 func rewriteValue386_OpLsh8x16(v *Value) bool {
9593         v_1 := v.Args[1]
9594         v_0 := v.Args[0]
9595         b := v.Block
9596         // match: (Lsh8x16 <t> x y)
9597         // cond: !shiftIsBounded(v)
9598         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32])))
9599         for {
9600                 t := v.Type
9601                 x := v_0
9602                 y := v_1
9603                 if !(!shiftIsBounded(v)) {
9604                         break
9605                 }
9606                 v.reset(Op386ANDL)
9607                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9608                 v0.AddArg2(x, y)
9609                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9610                 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
9611                 v2.AuxInt = int16ToAuxInt(32)
9612                 v2.AddArg(y)
9613                 v1.AddArg(v2)
9614                 v.AddArg2(v0, v1)
9615                 return true
9616         }
9617         // match: (Lsh8x16 <t> x y)
9618         // cond: shiftIsBounded(v)
9619         // result: (SHLL <t> x y)
9620         for {
9621                 t := v.Type
9622                 x := v_0
9623                 y := v_1
9624                 if !(shiftIsBounded(v)) {
9625                         break
9626                 }
9627                 v.reset(Op386SHLL)
9628                 v.Type = t
9629                 v.AddArg2(x, y)
9630                 return true
9631         }
9632         return false
9633 }
9634 func rewriteValue386_OpLsh8x32(v *Value) bool {
9635         v_1 := v.Args[1]
9636         v_0 := v.Args[0]
9637         b := v.Block
9638         // match: (Lsh8x32 <t> x y)
9639         // cond: !shiftIsBounded(v)
9640         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32])))
9641         for {
9642                 t := v.Type
9643                 x := v_0
9644                 y := v_1
9645                 if !(!shiftIsBounded(v)) {
9646                         break
9647                 }
9648                 v.reset(Op386ANDL)
9649                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9650                 v0.AddArg2(x, y)
9651                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9652                 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
9653                 v2.AuxInt = int32ToAuxInt(32)
9654                 v2.AddArg(y)
9655                 v1.AddArg(v2)
9656                 v.AddArg2(v0, v1)
9657                 return true
9658         }
9659         // match: (Lsh8x32 <t> x y)
9660         // cond: shiftIsBounded(v)
9661         // result: (SHLL <t> x y)
9662         for {
9663                 t := v.Type
9664                 x := v_0
9665                 y := v_1
9666                 if !(shiftIsBounded(v)) {
9667                         break
9668                 }
9669                 v.reset(Op386SHLL)
9670                 v.Type = t
9671                 v.AddArg2(x, y)
9672                 return true
9673         }
9674         return false
9675 }
9676 func rewriteValue386_OpLsh8x64(v *Value) bool {
9677         v_1 := v.Args[1]
9678         v_0 := v.Args[0]
9679         // match: (Lsh8x64 x (Const64 [c]))
9680         // cond: uint64(c) < 8
9681         // result: (SHLLconst x [int32(c)])
9682         for {
9683                 x := v_0
9684                 if v_1.Op != OpConst64 {
9685                         break
9686                 }
9687                 c := auxIntToInt64(v_1.AuxInt)
9688                 if !(uint64(c) < 8) {
9689                         break
9690                 }
9691                 v.reset(Op386SHLLconst)
9692                 v.AuxInt = int32ToAuxInt(int32(c))
9693                 v.AddArg(x)
9694                 return true
9695         }
9696         // match: (Lsh8x64 _ (Const64 [c]))
9697         // cond: uint64(c) >= 8
9698         // result: (Const8 [0])
9699         for {
9700                 if v_1.Op != OpConst64 {
9701                         break
9702                 }
9703                 c := auxIntToInt64(v_1.AuxInt)
9704                 if !(uint64(c) >= 8) {
9705                         break
9706                 }
9707                 v.reset(OpConst8)
9708                 v.AuxInt = int8ToAuxInt(0)
9709                 return true
9710         }
9711         return false
9712 }
9713 func rewriteValue386_OpLsh8x8(v *Value) bool {
9714         v_1 := v.Args[1]
9715         v_0 := v.Args[0]
9716         b := v.Block
9717         // match: (Lsh8x8 <t> x y)
9718         // cond: !shiftIsBounded(v)
9719         // result: (ANDL (SHLL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32])))
9720         for {
9721                 t := v.Type
9722                 x := v_0
9723                 y := v_1
9724                 if !(!shiftIsBounded(v)) {
9725                         break
9726                 }
9727                 v.reset(Op386ANDL)
9728                 v0 := b.NewValue0(v.Pos, Op386SHLL, t)
9729                 v0.AddArg2(x, y)
9730                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
9731                 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
9732                 v2.AuxInt = int8ToAuxInt(32)
9733                 v2.AddArg(y)
9734                 v1.AddArg(v2)
9735                 v.AddArg2(v0, v1)
9736                 return true
9737         }
9738         // match: (Lsh8x8 <t> x y)
9739         // cond: shiftIsBounded(v)
9740         // result: (SHLL <t> x y)
9741         for {
9742                 t := v.Type
9743                 x := v_0
9744                 y := v_1
9745                 if !(shiftIsBounded(v)) {
9746                         break
9747                 }
9748                 v.reset(Op386SHLL)
9749                 v.Type = t
9750                 v.AddArg2(x, y)
9751                 return true
9752         }
9753         return false
9754 }
9755 func rewriteValue386_OpMod8(v *Value) bool {
9756         v_1 := v.Args[1]
9757         v_0 := v.Args[0]
9758         b := v.Block
9759         typ := &b.Func.Config.Types
9760         // match: (Mod8 x y)
9761         // result: (MODW (SignExt8to16 x) (SignExt8to16 y))
9762         for {
9763                 x := v_0
9764                 y := v_1
9765                 v.reset(Op386MODW)
9766                 v0 := b.NewValue0(v.Pos, OpSignExt8to16, typ.Int16)
9767                 v0.AddArg(x)
9768                 v1 := b.NewValue0(v.Pos, OpSignExt8to16, typ.Int16)
9769                 v1.AddArg(y)
9770                 v.AddArg2(v0, v1)
9771                 return true
9772         }
9773 }
9774 func rewriteValue386_OpMod8u(v *Value) bool {
9775         v_1 := v.Args[1]
9776         v_0 := v.Args[0]
9777         b := v.Block
9778         typ := &b.Func.Config.Types
9779         // match: (Mod8u x y)
9780         // result: (MODWU (ZeroExt8to16 x) (ZeroExt8to16 y))
9781         for {
9782                 x := v_0
9783                 y := v_1
9784                 v.reset(Op386MODWU)
9785                 v0 := b.NewValue0(v.Pos, OpZeroExt8to16, typ.UInt16)
9786                 v0.AddArg(x)
9787                 v1 := b.NewValue0(v.Pos, OpZeroExt8to16, typ.UInt16)
9788                 v1.AddArg(y)
9789                 v.AddArg2(v0, v1)
9790                 return true
9791         }
9792 }
9793 func rewriteValue386_OpMove(v *Value) bool {
9794         v_2 := v.Args[2]
9795         v_1 := v.Args[1]
9796         v_0 := v.Args[0]
9797         b := v.Block
9798         config := b.Func.Config
9799         typ := &b.Func.Config.Types
9800         // match: (Move [0] _ _ mem)
9801         // result: mem
9802         for {
9803                 if auxIntToInt64(v.AuxInt) != 0 {
9804                         break
9805                 }
9806                 mem := v_2
9807                 v.copyOf(mem)
9808                 return true
9809         }
9810         // match: (Move [1] dst src mem)
9811         // result: (MOVBstore dst (MOVBload src mem) mem)
9812         for {
9813                 if auxIntToInt64(v.AuxInt) != 1 {
9814                         break
9815                 }
9816                 dst := v_0
9817                 src := v_1
9818                 mem := v_2
9819                 v.reset(Op386MOVBstore)
9820                 v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8)
9821                 v0.AddArg2(src, mem)
9822                 v.AddArg3(dst, v0, mem)
9823                 return true
9824         }
9825         // match: (Move [2] dst src mem)
9826         // result: (MOVWstore dst (MOVWload src mem) mem)
9827         for {
9828                 if auxIntToInt64(v.AuxInt) != 2 {
9829                         break
9830                 }
9831                 dst := v_0
9832                 src := v_1
9833                 mem := v_2
9834                 v.reset(Op386MOVWstore)
9835                 v0 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16)
9836                 v0.AddArg2(src, mem)
9837                 v.AddArg3(dst, v0, mem)
9838                 return true
9839         }
9840         // match: (Move [4] dst src mem)
9841         // result: (MOVLstore dst (MOVLload src mem) mem)
9842         for {
9843                 if auxIntToInt64(v.AuxInt) != 4 {
9844                         break
9845                 }
9846                 dst := v_0
9847                 src := v_1
9848                 mem := v_2
9849                 v.reset(Op386MOVLstore)
9850                 v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9851                 v0.AddArg2(src, mem)
9852                 v.AddArg3(dst, v0, mem)
9853                 return true
9854         }
9855         // match: (Move [3] dst src mem)
9856         // result: (MOVBstore [2] dst (MOVBload [2] src mem) (MOVWstore dst (MOVWload src mem) mem))
9857         for {
9858                 if auxIntToInt64(v.AuxInt) != 3 {
9859                         break
9860                 }
9861                 dst := v_0
9862                 src := v_1
9863                 mem := v_2
9864                 v.reset(Op386MOVBstore)
9865                 v.AuxInt = int32ToAuxInt(2)
9866                 v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8)
9867                 v0.AuxInt = int32ToAuxInt(2)
9868                 v0.AddArg2(src, mem)
9869                 v1 := b.NewValue0(v.Pos, Op386MOVWstore, types.TypeMem)
9870                 v2 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16)
9871                 v2.AddArg2(src, mem)
9872                 v1.AddArg3(dst, v2, mem)
9873                 v.AddArg3(dst, v0, v1)
9874                 return true
9875         }
9876         // match: (Move [5] dst src mem)
9877         // result: (MOVBstore [4] dst (MOVBload [4] src mem) (MOVLstore dst (MOVLload src mem) mem))
9878         for {
9879                 if auxIntToInt64(v.AuxInt) != 5 {
9880                         break
9881                 }
9882                 dst := v_0
9883                 src := v_1
9884                 mem := v_2
9885                 v.reset(Op386MOVBstore)
9886                 v.AuxInt = int32ToAuxInt(4)
9887                 v0 := b.NewValue0(v.Pos, Op386MOVBload, typ.UInt8)
9888                 v0.AuxInt = int32ToAuxInt(4)
9889                 v0.AddArg2(src, mem)
9890                 v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem)
9891                 v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9892                 v2.AddArg2(src, mem)
9893                 v1.AddArg3(dst, v2, mem)
9894                 v.AddArg3(dst, v0, v1)
9895                 return true
9896         }
9897         // match: (Move [6] dst src mem)
9898         // result: (MOVWstore [4] dst (MOVWload [4] src mem) (MOVLstore dst (MOVLload src mem) mem))
9899         for {
9900                 if auxIntToInt64(v.AuxInt) != 6 {
9901                         break
9902                 }
9903                 dst := v_0
9904                 src := v_1
9905                 mem := v_2
9906                 v.reset(Op386MOVWstore)
9907                 v.AuxInt = int32ToAuxInt(4)
9908                 v0 := b.NewValue0(v.Pos, Op386MOVWload, typ.UInt16)
9909                 v0.AuxInt = int32ToAuxInt(4)
9910                 v0.AddArg2(src, mem)
9911                 v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem)
9912                 v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9913                 v2.AddArg2(src, mem)
9914                 v1.AddArg3(dst, v2, mem)
9915                 v.AddArg3(dst, v0, v1)
9916                 return true
9917         }
9918         // match: (Move [7] dst src mem)
9919         // result: (MOVLstore [3] dst (MOVLload [3] src mem) (MOVLstore dst (MOVLload src mem) mem))
9920         for {
9921                 if auxIntToInt64(v.AuxInt) != 7 {
9922                         break
9923                 }
9924                 dst := v_0
9925                 src := v_1
9926                 mem := v_2
9927                 v.reset(Op386MOVLstore)
9928                 v.AuxInt = int32ToAuxInt(3)
9929                 v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9930                 v0.AuxInt = int32ToAuxInt(3)
9931                 v0.AddArg2(src, mem)
9932                 v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem)
9933                 v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9934                 v2.AddArg2(src, mem)
9935                 v1.AddArg3(dst, v2, mem)
9936                 v.AddArg3(dst, v0, v1)
9937                 return true
9938         }
9939         // match: (Move [8] dst src mem)
9940         // result: (MOVLstore [4] dst (MOVLload [4] src mem) (MOVLstore dst (MOVLload src mem) mem))
9941         for {
9942                 if auxIntToInt64(v.AuxInt) != 8 {
9943                         break
9944                 }
9945                 dst := v_0
9946                 src := v_1
9947                 mem := v_2
9948                 v.reset(Op386MOVLstore)
9949                 v.AuxInt = int32ToAuxInt(4)
9950                 v0 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9951                 v0.AuxInt = int32ToAuxInt(4)
9952                 v0.AddArg2(src, mem)
9953                 v1 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem)
9954                 v2 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9955                 v2.AddArg2(src, mem)
9956                 v1.AddArg3(dst, v2, mem)
9957                 v.AddArg3(dst, v0, v1)
9958                 return true
9959         }
9960         // match: (Move [s] dst src mem)
9961         // cond: s > 8 && s%4 != 0
9962         // 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))
9963         for {
9964                 s := auxIntToInt64(v.AuxInt)
9965                 dst := v_0
9966                 src := v_1
9967                 mem := v_2
9968                 if !(s > 8 && s%4 != 0) {
9969                         break
9970                 }
9971                 v.reset(OpMove)
9972                 v.AuxInt = int64ToAuxInt(s - s%4)
9973                 v0 := b.NewValue0(v.Pos, Op386ADDLconst, dst.Type)
9974                 v0.AuxInt = int32ToAuxInt(int32(s % 4))
9975                 v0.AddArg(dst)
9976                 v1 := b.NewValue0(v.Pos, Op386ADDLconst, src.Type)
9977                 v1.AuxInt = int32ToAuxInt(int32(s % 4))
9978                 v1.AddArg(src)
9979                 v2 := b.NewValue0(v.Pos, Op386MOVLstore, types.TypeMem)
9980                 v3 := b.NewValue0(v.Pos, Op386MOVLload, typ.UInt32)
9981                 v3.AddArg2(src, mem)
9982                 v2.AddArg3(dst, v3, mem)
9983                 v.AddArg3(v0, v1, v2)
9984                 return true
9985         }
9986         // match: (Move [s] dst src mem)
9987         // cond: s > 8 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice && logLargeCopy(v, s)
9988         // result: (DUFFCOPY [10*(128-s/4)] dst src mem)
9989         for {
9990                 s := auxIntToInt64(v.AuxInt)
9991                 dst := v_0
9992                 src := v_1
9993                 mem := v_2
9994                 if !(s > 8 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice && logLargeCopy(v, s)) {
9995                         break
9996                 }
9997                 v.reset(Op386DUFFCOPY)
9998                 v.AuxInt = int64ToAuxInt(10 * (128 - s/4))
9999                 v.AddArg3(dst, src, mem)
10000                 return true
10001         }
10002         // match: (Move [s] dst src mem)
10003         // cond: (s > 4*128 || config.noDuffDevice) && s%4 == 0 && logLargeCopy(v, s)
10004         // result: (REPMOVSL dst src (MOVLconst [int32(s/4)]) mem)
10005         for {
10006                 s := auxIntToInt64(v.AuxInt)
10007                 dst := v_0
10008                 src := v_1
10009                 mem := v_2
10010                 if !((s > 4*128 || config.noDuffDevice) && s%4 == 0 && logLargeCopy(v, s)) {
10011                         break
10012                 }
10013                 v.reset(Op386REPMOVSL)
10014                 v0 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32)
10015                 v0.AuxInt = int32ToAuxInt(int32(s / 4))
10016                 v.AddArg4(dst, src, v0, mem)
10017                 return true
10018         }
10019         return false
10020 }
10021 func rewriteValue386_OpNeg32F(v *Value) bool {
10022         v_0 := v.Args[0]
10023         b := v.Block
10024         typ := &b.Func.Config.Types
10025         // match: (Neg32F x)
10026         // result: (PXOR x (MOVSSconst <typ.Float32> [float32(math.Copysign(0, -1))]))
10027         for {
10028                 x := v_0
10029                 v.reset(Op386PXOR)
10030                 v0 := b.NewValue0(v.Pos, Op386MOVSSconst, typ.Float32)
10031                 v0.AuxInt = float32ToAuxInt(float32(math.Copysign(0, -1)))
10032                 v.AddArg2(x, v0)
10033                 return true
10034         }
10035 }
10036 func rewriteValue386_OpNeg64F(v *Value) bool {
10037         v_0 := v.Args[0]
10038         b := v.Block
10039         typ := &b.Func.Config.Types
10040         // match: (Neg64F x)
10041         // result: (PXOR x (MOVSDconst <typ.Float64> [math.Copysign(0, -1)]))
10042         for {
10043                 x := v_0
10044                 v.reset(Op386PXOR)
10045                 v0 := b.NewValue0(v.Pos, Op386MOVSDconst, typ.Float64)
10046                 v0.AuxInt = float64ToAuxInt(math.Copysign(0, -1))
10047                 v.AddArg2(x, v0)
10048                 return true
10049         }
10050 }
10051 func rewriteValue386_OpNeq16(v *Value) bool {
10052         v_1 := v.Args[1]
10053         v_0 := v.Args[0]
10054         b := v.Block
10055         // match: (Neq16 x y)
10056         // result: (SETNE (CMPW x y))
10057         for {
10058                 x := v_0
10059                 y := v_1
10060                 v.reset(Op386SETNE)
10061                 v0 := b.NewValue0(v.Pos, Op386CMPW, types.TypeFlags)
10062                 v0.AddArg2(x, y)
10063                 v.AddArg(v0)
10064                 return true
10065         }
10066 }
10067 func rewriteValue386_OpNeq32(v *Value) bool {
10068         v_1 := v.Args[1]
10069         v_0 := v.Args[0]
10070         b := v.Block
10071         // match: (Neq32 x y)
10072         // result: (SETNE (CMPL x y))
10073         for {
10074                 x := v_0
10075                 y := v_1
10076                 v.reset(Op386SETNE)
10077                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
10078                 v0.AddArg2(x, y)
10079                 v.AddArg(v0)
10080                 return true
10081         }
10082 }
10083 func rewriteValue386_OpNeq32F(v *Value) bool {
10084         v_1 := v.Args[1]
10085         v_0 := v.Args[0]
10086         b := v.Block
10087         // match: (Neq32F x y)
10088         // result: (SETNEF (UCOMISS x y))
10089         for {
10090                 x := v_0
10091                 y := v_1
10092                 v.reset(Op386SETNEF)
10093                 v0 := b.NewValue0(v.Pos, Op386UCOMISS, types.TypeFlags)
10094                 v0.AddArg2(x, y)
10095                 v.AddArg(v0)
10096                 return true
10097         }
10098 }
10099 func rewriteValue386_OpNeq64F(v *Value) bool {
10100         v_1 := v.Args[1]
10101         v_0 := v.Args[0]
10102         b := v.Block
10103         // match: (Neq64F x y)
10104         // result: (SETNEF (UCOMISD x y))
10105         for {
10106                 x := v_0
10107                 y := v_1
10108                 v.reset(Op386SETNEF)
10109                 v0 := b.NewValue0(v.Pos, Op386UCOMISD, types.TypeFlags)
10110                 v0.AddArg2(x, y)
10111                 v.AddArg(v0)
10112                 return true
10113         }
10114 }
10115 func rewriteValue386_OpNeq8(v *Value) bool {
10116         v_1 := v.Args[1]
10117         v_0 := v.Args[0]
10118         b := v.Block
10119         // match: (Neq8 x y)
10120         // result: (SETNE (CMPB x y))
10121         for {
10122                 x := v_0
10123                 y := v_1
10124                 v.reset(Op386SETNE)
10125                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
10126                 v0.AddArg2(x, y)
10127                 v.AddArg(v0)
10128                 return true
10129         }
10130 }
10131 func rewriteValue386_OpNeqB(v *Value) bool {
10132         v_1 := v.Args[1]
10133         v_0 := v.Args[0]
10134         b := v.Block
10135         // match: (NeqB x y)
10136         // result: (SETNE (CMPB x y))
10137         for {
10138                 x := v_0
10139                 y := v_1
10140                 v.reset(Op386SETNE)
10141                 v0 := b.NewValue0(v.Pos, Op386CMPB, types.TypeFlags)
10142                 v0.AddArg2(x, y)
10143                 v.AddArg(v0)
10144                 return true
10145         }
10146 }
10147 func rewriteValue386_OpNeqPtr(v *Value) bool {
10148         v_1 := v.Args[1]
10149         v_0 := v.Args[0]
10150         b := v.Block
10151         // match: (NeqPtr x y)
10152         // result: (SETNE (CMPL x y))
10153         for {
10154                 x := v_0
10155                 y := v_1
10156                 v.reset(Op386SETNE)
10157                 v0 := b.NewValue0(v.Pos, Op386CMPL, types.TypeFlags)
10158                 v0.AddArg2(x, y)
10159                 v.AddArg(v0)
10160                 return true
10161         }
10162 }
10163 func rewriteValue386_OpNot(v *Value) bool {
10164         v_0 := v.Args[0]
10165         // match: (Not x)
10166         // result: (XORLconst [1] x)
10167         for {
10168                 x := v_0
10169                 v.reset(Op386XORLconst)
10170                 v.AuxInt = int32ToAuxInt(1)
10171                 v.AddArg(x)
10172                 return true
10173         }
10174 }
10175 func rewriteValue386_OpOffPtr(v *Value) bool {
10176         v_0 := v.Args[0]
10177         // match: (OffPtr [off] ptr)
10178         // result: (ADDLconst [int32(off)] ptr)
10179         for {
10180                 off := auxIntToInt64(v.AuxInt)
10181                 ptr := v_0
10182                 v.reset(Op386ADDLconst)
10183                 v.AuxInt = int32ToAuxInt(int32(off))
10184                 v.AddArg(ptr)
10185                 return true
10186         }
10187 }
10188 func rewriteValue386_OpPanicBounds(v *Value) bool {
10189         v_2 := v.Args[2]
10190         v_1 := v.Args[1]
10191         v_0 := v.Args[0]
10192         // match: (PanicBounds [kind] x y mem)
10193         // cond: boundsABI(kind) == 0
10194         // result: (LoweredPanicBoundsA [kind] x y mem)
10195         for {
10196                 kind := auxIntToInt64(v.AuxInt)
10197                 x := v_0
10198                 y := v_1
10199                 mem := v_2
10200                 if !(boundsABI(kind) == 0) {
10201                         break
10202                 }
10203                 v.reset(Op386LoweredPanicBoundsA)
10204                 v.AuxInt = int64ToAuxInt(kind)
10205                 v.AddArg3(x, y, mem)
10206                 return true
10207         }
10208         // match: (PanicBounds [kind] x y mem)
10209         // cond: boundsABI(kind) == 1
10210         // result: (LoweredPanicBoundsB [kind] x y mem)
10211         for {
10212                 kind := auxIntToInt64(v.AuxInt)
10213                 x := v_0
10214                 y := v_1
10215                 mem := v_2
10216                 if !(boundsABI(kind) == 1) {
10217                         break
10218                 }
10219                 v.reset(Op386LoweredPanicBoundsB)
10220                 v.AuxInt = int64ToAuxInt(kind)
10221                 v.AddArg3(x, y, mem)
10222                 return true
10223         }
10224         // match: (PanicBounds [kind] x y mem)
10225         // cond: boundsABI(kind) == 2
10226         // result: (LoweredPanicBoundsC [kind] x y mem)
10227         for {
10228                 kind := auxIntToInt64(v.AuxInt)
10229                 x := v_0
10230                 y := v_1
10231                 mem := v_2
10232                 if !(boundsABI(kind) == 2) {
10233                         break
10234                 }
10235                 v.reset(Op386LoweredPanicBoundsC)
10236                 v.AuxInt = int64ToAuxInt(kind)
10237                 v.AddArg3(x, y, mem)
10238                 return true
10239         }
10240         return false
10241 }
10242 func rewriteValue386_OpPanicExtend(v *Value) bool {
10243         v_3 := v.Args[3]
10244         v_2 := v.Args[2]
10245         v_1 := v.Args[1]
10246         v_0 := v.Args[0]
10247         // match: (PanicExtend [kind] hi lo y mem)
10248         // cond: boundsABI(kind) == 0
10249         // result: (LoweredPanicExtendA [kind] hi lo y mem)
10250         for {
10251                 kind := auxIntToInt64(v.AuxInt)
10252                 hi := v_0
10253                 lo := v_1
10254                 y := v_2
10255                 mem := v_3
10256                 if !(boundsABI(kind) == 0) {
10257                         break
10258                 }
10259                 v.reset(Op386LoweredPanicExtendA)
10260                 v.AuxInt = int64ToAuxInt(kind)
10261                 v.AddArg4(hi, lo, y, mem)
10262                 return true
10263         }
10264         // match: (PanicExtend [kind] hi lo y mem)
10265         // cond: boundsABI(kind) == 1
10266         // result: (LoweredPanicExtendB [kind] hi lo y mem)
10267         for {
10268                 kind := auxIntToInt64(v.AuxInt)
10269                 hi := v_0
10270                 lo := v_1
10271                 y := v_2
10272                 mem := v_3
10273                 if !(boundsABI(kind) == 1) {
10274                         break
10275                 }
10276                 v.reset(Op386LoweredPanicExtendB)
10277                 v.AuxInt = int64ToAuxInt(kind)
10278                 v.AddArg4(hi, lo, y, mem)
10279                 return true
10280         }
10281         // match: (PanicExtend [kind] hi lo y mem)
10282         // cond: boundsABI(kind) == 2
10283         // result: (LoweredPanicExtendC [kind] hi lo y mem)
10284         for {
10285                 kind := auxIntToInt64(v.AuxInt)
10286                 hi := v_0
10287                 lo := v_1
10288                 y := v_2
10289                 mem := v_3
10290                 if !(boundsABI(kind) == 2) {
10291                         break
10292                 }
10293                 v.reset(Op386LoweredPanicExtendC)
10294                 v.AuxInt = int64ToAuxInt(kind)
10295                 v.AddArg4(hi, lo, y, mem)
10296                 return true
10297         }
10298         return false
10299 }
10300 func rewriteValue386_OpRotateLeft16(v *Value) bool {
10301         v_1 := v.Args[1]
10302         v_0 := v.Args[0]
10303         // match: (RotateLeft16 x (MOVLconst [c]))
10304         // result: (ROLWconst [int16(c&15)] x)
10305         for {
10306                 x := v_0
10307                 if v_1.Op != Op386MOVLconst {
10308                         break
10309                 }
10310                 c := auxIntToInt32(v_1.AuxInt)
10311                 v.reset(Op386ROLWconst)
10312                 v.AuxInt = int16ToAuxInt(int16(c & 15))
10313                 v.AddArg(x)
10314                 return true
10315         }
10316         return false
10317 }
10318 func rewriteValue386_OpRotateLeft32(v *Value) bool {
10319         v_1 := v.Args[1]
10320         v_0 := v.Args[0]
10321         // match: (RotateLeft32 x (MOVLconst [c]))
10322         // result: (ROLLconst [c&31] x)
10323         for {
10324                 x := v_0
10325                 if v_1.Op != Op386MOVLconst {
10326                         break
10327                 }
10328                 c := auxIntToInt32(v_1.AuxInt)
10329                 v.reset(Op386ROLLconst)
10330                 v.AuxInt = int32ToAuxInt(c & 31)
10331                 v.AddArg(x)
10332                 return true
10333         }
10334         return false
10335 }
10336 func rewriteValue386_OpRotateLeft8(v *Value) bool {
10337         v_1 := v.Args[1]
10338         v_0 := v.Args[0]
10339         // match: (RotateLeft8 x (MOVLconst [c]))
10340         // result: (ROLBconst [int8(c&7)] x)
10341         for {
10342                 x := v_0
10343                 if v_1.Op != Op386MOVLconst {
10344                         break
10345                 }
10346                 c := auxIntToInt32(v_1.AuxInt)
10347                 v.reset(Op386ROLBconst)
10348                 v.AuxInt = int8ToAuxInt(int8(c & 7))
10349                 v.AddArg(x)
10350                 return true
10351         }
10352         return false
10353 }
10354 func rewriteValue386_OpRsh16Ux16(v *Value) bool {
10355         v_1 := v.Args[1]
10356         v_0 := v.Args[0]
10357         b := v.Block
10358         // match: (Rsh16Ux16 <t> x y)
10359         // cond: !shiftIsBounded(v)
10360         // result: (ANDL (SHRW <t> x y) (SBBLcarrymask <t> (CMPWconst y [16])))
10361         for {
10362                 t := v.Type
10363                 x := v_0
10364                 y := v_1
10365                 if !(!shiftIsBounded(v)) {
10366                         break
10367                 }
10368                 v.reset(Op386ANDL)
10369                 v0 := b.NewValue0(v.Pos, Op386SHRW, t)
10370                 v0.AddArg2(x, y)
10371                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
10372                 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
10373                 v2.AuxInt = int16ToAuxInt(16)
10374                 v2.AddArg(y)
10375                 v1.AddArg(v2)
10376                 v.AddArg2(v0, v1)
10377                 return true
10378         }
10379         // match: (Rsh16Ux16 <t> x y)
10380         // cond: shiftIsBounded(v)
10381         // result: (SHRW <t> x y)
10382         for {
10383                 t := v.Type
10384                 x := v_0
10385                 y := v_1
10386                 if !(shiftIsBounded(v)) {
10387                         break
10388                 }
10389                 v.reset(Op386SHRW)
10390                 v.Type = t
10391                 v.AddArg2(x, y)
10392                 return true
10393         }
10394         return false
10395 }
10396 func rewriteValue386_OpRsh16Ux32(v *Value) bool {
10397         v_1 := v.Args[1]
10398         v_0 := v.Args[0]
10399         b := v.Block
10400         // match: (Rsh16Ux32 <t> x y)
10401         // cond: !shiftIsBounded(v)
10402         // result: (ANDL (SHRW <t> x y) (SBBLcarrymask <t> (CMPLconst y [16])))
10403         for {
10404                 t := v.Type
10405                 x := v_0
10406                 y := v_1
10407                 if !(!shiftIsBounded(v)) {
10408                         break
10409                 }
10410                 v.reset(Op386ANDL)
10411                 v0 := b.NewValue0(v.Pos, Op386SHRW, t)
10412                 v0.AddArg2(x, y)
10413                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
10414                 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
10415                 v2.AuxInt = int32ToAuxInt(16)
10416                 v2.AddArg(y)
10417                 v1.AddArg(v2)
10418                 v.AddArg2(v0, v1)
10419                 return true
10420         }
10421         // match: (Rsh16Ux32 <t> x y)
10422         // cond: shiftIsBounded(v)
10423         // result: (SHRW <t> x y)
10424         for {
10425                 t := v.Type
10426                 x := v_0
10427                 y := v_1
10428                 if !(shiftIsBounded(v)) {
10429                         break
10430                 }
10431                 v.reset(Op386SHRW)
10432                 v.Type = t
10433                 v.AddArg2(x, y)
10434                 return true
10435         }
10436         return false
10437 }
10438 func rewriteValue386_OpRsh16Ux64(v *Value) bool {
10439         v_1 := v.Args[1]
10440         v_0 := v.Args[0]
10441         // match: (Rsh16Ux64 x (Const64 [c]))
10442         // cond: uint64(c) < 16
10443         // result: (SHRWconst x [int16(c)])
10444         for {
10445                 x := v_0
10446                 if v_1.Op != OpConst64 {
10447                         break
10448                 }
10449                 c := auxIntToInt64(v_1.AuxInt)
10450                 if !(uint64(c) < 16) {
10451                         break
10452                 }
10453                 v.reset(Op386SHRWconst)
10454                 v.AuxInt = int16ToAuxInt(int16(c))
10455                 v.AddArg(x)
10456                 return true
10457         }
10458         // match: (Rsh16Ux64 _ (Const64 [c]))
10459         // cond: uint64(c) >= 16
10460         // result: (Const16 [0])
10461         for {
10462                 if v_1.Op != OpConst64 {
10463                         break
10464                 }
10465                 c := auxIntToInt64(v_1.AuxInt)
10466                 if !(uint64(c) >= 16) {
10467                         break
10468                 }
10469                 v.reset(OpConst16)
10470                 v.AuxInt = int16ToAuxInt(0)
10471                 return true
10472         }
10473         return false
10474 }
10475 func rewriteValue386_OpRsh16Ux8(v *Value) bool {
10476         v_1 := v.Args[1]
10477         v_0 := v.Args[0]
10478         b := v.Block
10479         // match: (Rsh16Ux8 <t> x y)
10480         // cond: !shiftIsBounded(v)
10481         // result: (ANDL (SHRW <t> x y) (SBBLcarrymask <t> (CMPBconst y [16])))
10482         for {
10483                 t := v.Type
10484                 x := v_0
10485                 y := v_1
10486                 if !(!shiftIsBounded(v)) {
10487                         break
10488                 }
10489                 v.reset(Op386ANDL)
10490                 v0 := b.NewValue0(v.Pos, Op386SHRW, t)
10491                 v0.AddArg2(x, y)
10492                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
10493                 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
10494                 v2.AuxInt = int8ToAuxInt(16)
10495                 v2.AddArg(y)
10496                 v1.AddArg(v2)
10497                 v.AddArg2(v0, v1)
10498                 return true
10499         }
10500         // match: (Rsh16Ux8 <t> x y)
10501         // cond: shiftIsBounded(v)
10502         // result: (SHRW <t> x y)
10503         for {
10504                 t := v.Type
10505                 x := v_0
10506                 y := v_1
10507                 if !(shiftIsBounded(v)) {
10508                         break
10509                 }
10510                 v.reset(Op386SHRW)
10511                 v.Type = t
10512                 v.AddArg2(x, y)
10513                 return true
10514         }
10515         return false
10516 }
10517 func rewriteValue386_OpRsh16x16(v *Value) bool {
10518         v_1 := v.Args[1]
10519         v_0 := v.Args[0]
10520         b := v.Block
10521         // match: (Rsh16x16 <t> x y)
10522         // cond: !shiftIsBounded(v)
10523         // result: (SARW <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPWconst y [16])))))
10524         for {
10525                 t := v.Type
10526                 x := v_0
10527                 y := v_1
10528                 if !(!shiftIsBounded(v)) {
10529                         break
10530                 }
10531                 v.reset(Op386SARW)
10532                 v.Type = t
10533                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
10534                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
10535                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
10536                 v3 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
10537                 v3.AuxInt = int16ToAuxInt(16)
10538                 v3.AddArg(y)
10539                 v2.AddArg(v3)
10540                 v1.AddArg(v2)
10541                 v0.AddArg2(y, v1)
10542                 v.AddArg2(x, v0)
10543                 return true
10544         }
10545         // match: (Rsh16x16 <t> x y)
10546         // cond: shiftIsBounded(v)
10547         // result: (SARW x y)
10548         for {
10549                 x := v_0
10550                 y := v_1
10551                 if !(shiftIsBounded(v)) {
10552                         break
10553                 }
10554                 v.reset(Op386SARW)
10555                 v.AddArg2(x, y)
10556                 return true
10557         }
10558         return false
10559 }
10560 func rewriteValue386_OpRsh16x32(v *Value) bool {
10561         v_1 := v.Args[1]
10562         v_0 := v.Args[0]
10563         b := v.Block
10564         // match: (Rsh16x32 <t> x y)
10565         // cond: !shiftIsBounded(v)
10566         // result: (SARW <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPLconst y [16])))))
10567         for {
10568                 t := v.Type
10569                 x := v_0
10570                 y := v_1
10571                 if !(!shiftIsBounded(v)) {
10572                         break
10573                 }
10574                 v.reset(Op386SARW)
10575                 v.Type = t
10576                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
10577                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
10578                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
10579                 v3 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
10580                 v3.AuxInt = int32ToAuxInt(16)
10581                 v3.AddArg(y)
10582                 v2.AddArg(v3)
10583                 v1.AddArg(v2)
10584                 v0.AddArg2(y, v1)
10585                 v.AddArg2(x, v0)
10586                 return true
10587         }
10588         // match: (Rsh16x32 <t> x y)
10589         // cond: shiftIsBounded(v)
10590         // result: (SARW x y)
10591         for {
10592                 x := v_0
10593                 y := v_1
10594                 if !(shiftIsBounded(v)) {
10595                         break
10596                 }
10597                 v.reset(Op386SARW)
10598                 v.AddArg2(x, y)
10599                 return true
10600         }
10601         return false
10602 }
10603 func rewriteValue386_OpRsh16x64(v *Value) bool {
10604         v_1 := v.Args[1]
10605         v_0 := v.Args[0]
10606         // match: (Rsh16x64 x (Const64 [c]))
10607         // cond: uint64(c) < 16
10608         // result: (SARWconst x [int16(c)])
10609         for {
10610                 x := v_0
10611                 if v_1.Op != OpConst64 {
10612                         break
10613                 }
10614                 c := auxIntToInt64(v_1.AuxInt)
10615                 if !(uint64(c) < 16) {
10616                         break
10617                 }
10618                 v.reset(Op386SARWconst)
10619                 v.AuxInt = int16ToAuxInt(int16(c))
10620                 v.AddArg(x)
10621                 return true
10622         }
10623         // match: (Rsh16x64 x (Const64 [c]))
10624         // cond: uint64(c) >= 16
10625         // result: (SARWconst x [15])
10626         for {
10627                 x := v_0
10628                 if v_1.Op != OpConst64 {
10629                         break
10630                 }
10631                 c := auxIntToInt64(v_1.AuxInt)
10632                 if !(uint64(c) >= 16) {
10633                         break
10634                 }
10635                 v.reset(Op386SARWconst)
10636                 v.AuxInt = int16ToAuxInt(15)
10637                 v.AddArg(x)
10638                 return true
10639         }
10640         return false
10641 }
10642 func rewriteValue386_OpRsh16x8(v *Value) bool {
10643         v_1 := v.Args[1]
10644         v_0 := v.Args[0]
10645         b := v.Block
10646         // match: (Rsh16x8 <t> x y)
10647         // cond: !shiftIsBounded(v)
10648         // result: (SARW <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPBconst y [16])))))
10649         for {
10650                 t := v.Type
10651                 x := v_0
10652                 y := v_1
10653                 if !(!shiftIsBounded(v)) {
10654                         break
10655                 }
10656                 v.reset(Op386SARW)
10657                 v.Type = t
10658                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
10659                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
10660                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
10661                 v3 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
10662                 v3.AuxInt = int8ToAuxInt(16)
10663                 v3.AddArg(y)
10664                 v2.AddArg(v3)
10665                 v1.AddArg(v2)
10666                 v0.AddArg2(y, v1)
10667                 v.AddArg2(x, v0)
10668                 return true
10669         }
10670         // match: (Rsh16x8 <t> x y)
10671         // cond: shiftIsBounded(v)
10672         // result: (SARW x y)
10673         for {
10674                 x := v_0
10675                 y := v_1
10676                 if !(shiftIsBounded(v)) {
10677                         break
10678                 }
10679                 v.reset(Op386SARW)
10680                 v.AddArg2(x, y)
10681                 return true
10682         }
10683         return false
10684 }
10685 func rewriteValue386_OpRsh32Ux16(v *Value) bool {
10686         v_1 := v.Args[1]
10687         v_0 := v.Args[0]
10688         b := v.Block
10689         // match: (Rsh32Ux16 <t> x y)
10690         // cond: !shiftIsBounded(v)
10691         // result: (ANDL (SHRL <t> x y) (SBBLcarrymask <t> (CMPWconst y [32])))
10692         for {
10693                 t := v.Type
10694                 x := v_0
10695                 y := v_1
10696                 if !(!shiftIsBounded(v)) {
10697                         break
10698                 }
10699                 v.reset(Op386ANDL)
10700                 v0 := b.NewValue0(v.Pos, Op386SHRL, t)
10701                 v0.AddArg2(x, y)
10702                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
10703                 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
10704                 v2.AuxInt = int16ToAuxInt(32)
10705                 v2.AddArg(y)
10706                 v1.AddArg(v2)
10707                 v.AddArg2(v0, v1)
10708                 return true
10709         }
10710         // match: (Rsh32Ux16 <t> x y)
10711         // cond: shiftIsBounded(v)
10712         // result: (SHRL <t> x y)
10713         for {
10714                 t := v.Type
10715                 x := v_0
10716                 y := v_1
10717                 if !(shiftIsBounded(v)) {
10718                         break
10719                 }
10720                 v.reset(Op386SHRL)
10721                 v.Type = t
10722                 v.AddArg2(x, y)
10723                 return true
10724         }
10725         return false
10726 }
10727 func rewriteValue386_OpRsh32Ux32(v *Value) bool {
10728         v_1 := v.Args[1]
10729         v_0 := v.Args[0]
10730         b := v.Block
10731         // match: (Rsh32Ux32 <t> x y)
10732         // cond: !shiftIsBounded(v)
10733         // result: (ANDL (SHRL <t> x y) (SBBLcarrymask <t> (CMPLconst y [32])))
10734         for {
10735                 t := v.Type
10736                 x := v_0
10737                 y := v_1
10738                 if !(!shiftIsBounded(v)) {
10739                         break
10740                 }
10741                 v.reset(Op386ANDL)
10742                 v0 := b.NewValue0(v.Pos, Op386SHRL, t)
10743                 v0.AddArg2(x, y)
10744                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
10745                 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
10746                 v2.AuxInt = int32ToAuxInt(32)
10747                 v2.AddArg(y)
10748                 v1.AddArg(v2)
10749                 v.AddArg2(v0, v1)
10750                 return true
10751         }
10752         // match: (Rsh32Ux32 <t> x y)
10753         // cond: shiftIsBounded(v)
10754         // result: (SHRL <t> x y)
10755         for {
10756                 t := v.Type
10757                 x := v_0
10758                 y := v_1
10759                 if !(shiftIsBounded(v)) {
10760                         break
10761                 }
10762                 v.reset(Op386SHRL)
10763                 v.Type = t
10764                 v.AddArg2(x, y)
10765                 return true
10766         }
10767         return false
10768 }
10769 func rewriteValue386_OpRsh32Ux64(v *Value) bool {
10770         v_1 := v.Args[1]
10771         v_0 := v.Args[0]
10772         // match: (Rsh32Ux64 x (Const64 [c]))
10773         // cond: uint64(c) < 32
10774         // result: (SHRLconst x [int32(c)])
10775         for {
10776                 x := v_0
10777                 if v_1.Op != OpConst64 {
10778                         break
10779                 }
10780                 c := auxIntToInt64(v_1.AuxInt)
10781                 if !(uint64(c) < 32) {
10782                         break
10783                 }
10784                 v.reset(Op386SHRLconst)
10785                 v.AuxInt = int32ToAuxInt(int32(c))
10786                 v.AddArg(x)
10787                 return true
10788         }
10789         // match: (Rsh32Ux64 _ (Const64 [c]))
10790         // cond: uint64(c) >= 32
10791         // result: (Const32 [0])
10792         for {
10793                 if v_1.Op != OpConst64 {
10794                         break
10795                 }
10796                 c := auxIntToInt64(v_1.AuxInt)
10797                 if !(uint64(c) >= 32) {
10798                         break
10799                 }
10800                 v.reset(OpConst32)
10801                 v.AuxInt = int32ToAuxInt(0)
10802                 return true
10803         }
10804         return false
10805 }
10806 func rewriteValue386_OpRsh32Ux8(v *Value) bool {
10807         v_1 := v.Args[1]
10808         v_0 := v.Args[0]
10809         b := v.Block
10810         // match: (Rsh32Ux8 <t> x y)
10811         // cond: !shiftIsBounded(v)
10812         // result: (ANDL (SHRL <t> x y) (SBBLcarrymask <t> (CMPBconst y [32])))
10813         for {
10814                 t := v.Type
10815                 x := v_0
10816                 y := v_1
10817                 if !(!shiftIsBounded(v)) {
10818                         break
10819                 }
10820                 v.reset(Op386ANDL)
10821                 v0 := b.NewValue0(v.Pos, Op386SHRL, t)
10822                 v0.AddArg2(x, y)
10823                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
10824                 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
10825                 v2.AuxInt = int8ToAuxInt(32)
10826                 v2.AddArg(y)
10827                 v1.AddArg(v2)
10828                 v.AddArg2(v0, v1)
10829                 return true
10830         }
10831         // match: (Rsh32Ux8 <t> x y)
10832         // cond: shiftIsBounded(v)
10833         // result: (SHRL <t> x y)
10834         for {
10835                 t := v.Type
10836                 x := v_0
10837                 y := v_1
10838                 if !(shiftIsBounded(v)) {
10839                         break
10840                 }
10841                 v.reset(Op386SHRL)
10842                 v.Type = t
10843                 v.AddArg2(x, y)
10844                 return true
10845         }
10846         return false
10847 }
10848 func rewriteValue386_OpRsh32x16(v *Value) bool {
10849         v_1 := v.Args[1]
10850         v_0 := v.Args[0]
10851         b := v.Block
10852         // match: (Rsh32x16 <t> x y)
10853         // cond: !shiftIsBounded(v)
10854         // result: (SARL <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPWconst y [32])))))
10855         for {
10856                 t := v.Type
10857                 x := v_0
10858                 y := v_1
10859                 if !(!shiftIsBounded(v)) {
10860                         break
10861                 }
10862                 v.reset(Op386SARL)
10863                 v.Type = t
10864                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
10865                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
10866                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
10867                 v3 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
10868                 v3.AuxInt = int16ToAuxInt(32)
10869                 v3.AddArg(y)
10870                 v2.AddArg(v3)
10871                 v1.AddArg(v2)
10872                 v0.AddArg2(y, v1)
10873                 v.AddArg2(x, v0)
10874                 return true
10875         }
10876         // match: (Rsh32x16 <t> x y)
10877         // cond: shiftIsBounded(v)
10878         // result: (SARL x y)
10879         for {
10880                 x := v_0
10881                 y := v_1
10882                 if !(shiftIsBounded(v)) {
10883                         break
10884                 }
10885                 v.reset(Op386SARL)
10886                 v.AddArg2(x, y)
10887                 return true
10888         }
10889         return false
10890 }
10891 func rewriteValue386_OpRsh32x32(v *Value) bool {
10892         v_1 := v.Args[1]
10893         v_0 := v.Args[0]
10894         b := v.Block
10895         // match: (Rsh32x32 <t> x y)
10896         // cond: !shiftIsBounded(v)
10897         // result: (SARL <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPLconst y [32])))))
10898         for {
10899                 t := v.Type
10900                 x := v_0
10901                 y := v_1
10902                 if !(!shiftIsBounded(v)) {
10903                         break
10904                 }
10905                 v.reset(Op386SARL)
10906                 v.Type = t
10907                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
10908                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
10909                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
10910                 v3 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
10911                 v3.AuxInt = int32ToAuxInt(32)
10912                 v3.AddArg(y)
10913                 v2.AddArg(v3)
10914                 v1.AddArg(v2)
10915                 v0.AddArg2(y, v1)
10916                 v.AddArg2(x, v0)
10917                 return true
10918         }
10919         // match: (Rsh32x32 <t> x y)
10920         // cond: shiftIsBounded(v)
10921         // result: (SARL x y)
10922         for {
10923                 x := v_0
10924                 y := v_1
10925                 if !(shiftIsBounded(v)) {
10926                         break
10927                 }
10928                 v.reset(Op386SARL)
10929                 v.AddArg2(x, y)
10930                 return true
10931         }
10932         return false
10933 }
10934 func rewriteValue386_OpRsh32x64(v *Value) bool {
10935         v_1 := v.Args[1]
10936         v_0 := v.Args[0]
10937         // match: (Rsh32x64 x (Const64 [c]))
10938         // cond: uint64(c) < 32
10939         // result: (SARLconst x [int32(c)])
10940         for {
10941                 x := v_0
10942                 if v_1.Op != OpConst64 {
10943                         break
10944                 }
10945                 c := auxIntToInt64(v_1.AuxInt)
10946                 if !(uint64(c) < 32) {
10947                         break
10948                 }
10949                 v.reset(Op386SARLconst)
10950                 v.AuxInt = int32ToAuxInt(int32(c))
10951                 v.AddArg(x)
10952                 return true
10953         }
10954         // match: (Rsh32x64 x (Const64 [c]))
10955         // cond: uint64(c) >= 32
10956         // result: (SARLconst x [31])
10957         for {
10958                 x := v_0
10959                 if v_1.Op != OpConst64 {
10960                         break
10961                 }
10962                 c := auxIntToInt64(v_1.AuxInt)
10963                 if !(uint64(c) >= 32) {
10964                         break
10965                 }
10966                 v.reset(Op386SARLconst)
10967                 v.AuxInt = int32ToAuxInt(31)
10968                 v.AddArg(x)
10969                 return true
10970         }
10971         return false
10972 }
10973 func rewriteValue386_OpRsh32x8(v *Value) bool {
10974         v_1 := v.Args[1]
10975         v_0 := v.Args[0]
10976         b := v.Block
10977         // match: (Rsh32x8 <t> x y)
10978         // cond: !shiftIsBounded(v)
10979         // result: (SARL <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPBconst y [32])))))
10980         for {
10981                 t := v.Type
10982                 x := v_0
10983                 y := v_1
10984                 if !(!shiftIsBounded(v)) {
10985                         break
10986                 }
10987                 v.reset(Op386SARL)
10988                 v.Type = t
10989                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
10990                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
10991                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
10992                 v3 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
10993                 v3.AuxInt = int8ToAuxInt(32)
10994                 v3.AddArg(y)
10995                 v2.AddArg(v3)
10996                 v1.AddArg(v2)
10997                 v0.AddArg2(y, v1)
10998                 v.AddArg2(x, v0)
10999                 return true
11000         }
11001         // match: (Rsh32x8 <t> x y)
11002         // cond: shiftIsBounded(v)
11003         // result: (SARL x y)
11004         for {
11005                 x := v_0
11006                 y := v_1
11007                 if !(shiftIsBounded(v)) {
11008                         break
11009                 }
11010                 v.reset(Op386SARL)
11011                 v.AddArg2(x, y)
11012                 return true
11013         }
11014         return false
11015 }
11016 func rewriteValue386_OpRsh8Ux16(v *Value) bool {
11017         v_1 := v.Args[1]
11018         v_0 := v.Args[0]
11019         b := v.Block
11020         // match: (Rsh8Ux16 <t> x y)
11021         // cond: !shiftIsBounded(v)
11022         // result: (ANDL (SHRB <t> x y) (SBBLcarrymask <t> (CMPWconst y [8])))
11023         for {
11024                 t := v.Type
11025                 x := v_0
11026                 y := v_1
11027                 if !(!shiftIsBounded(v)) {
11028                         break
11029                 }
11030                 v.reset(Op386ANDL)
11031                 v0 := b.NewValue0(v.Pos, Op386SHRB, t)
11032                 v0.AddArg2(x, y)
11033                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
11034                 v2 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
11035                 v2.AuxInt = int16ToAuxInt(8)
11036                 v2.AddArg(y)
11037                 v1.AddArg(v2)
11038                 v.AddArg2(v0, v1)
11039                 return true
11040         }
11041         // match: (Rsh8Ux16 <t> x y)
11042         // cond: shiftIsBounded(v)
11043         // result: (SHRB <t> x y)
11044         for {
11045                 t := v.Type
11046                 x := v_0
11047                 y := v_1
11048                 if !(shiftIsBounded(v)) {
11049                         break
11050                 }
11051                 v.reset(Op386SHRB)
11052                 v.Type = t
11053                 v.AddArg2(x, y)
11054                 return true
11055         }
11056         return false
11057 }
11058 func rewriteValue386_OpRsh8Ux32(v *Value) bool {
11059         v_1 := v.Args[1]
11060         v_0 := v.Args[0]
11061         b := v.Block
11062         // match: (Rsh8Ux32 <t> x y)
11063         // cond: !shiftIsBounded(v)
11064         // result: (ANDL (SHRB <t> x y) (SBBLcarrymask <t> (CMPLconst y [8])))
11065         for {
11066                 t := v.Type
11067                 x := v_0
11068                 y := v_1
11069                 if !(!shiftIsBounded(v)) {
11070                         break
11071                 }
11072                 v.reset(Op386ANDL)
11073                 v0 := b.NewValue0(v.Pos, Op386SHRB, t)
11074                 v0.AddArg2(x, y)
11075                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
11076                 v2 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
11077                 v2.AuxInt = int32ToAuxInt(8)
11078                 v2.AddArg(y)
11079                 v1.AddArg(v2)
11080                 v.AddArg2(v0, v1)
11081                 return true
11082         }
11083         // match: (Rsh8Ux32 <t> x y)
11084         // cond: shiftIsBounded(v)
11085         // result: (SHRB <t> x y)
11086         for {
11087                 t := v.Type
11088                 x := v_0
11089                 y := v_1
11090                 if !(shiftIsBounded(v)) {
11091                         break
11092                 }
11093                 v.reset(Op386SHRB)
11094                 v.Type = t
11095                 v.AddArg2(x, y)
11096                 return true
11097         }
11098         return false
11099 }
11100 func rewriteValue386_OpRsh8Ux64(v *Value) bool {
11101         v_1 := v.Args[1]
11102         v_0 := v.Args[0]
11103         // match: (Rsh8Ux64 x (Const64 [c]))
11104         // cond: uint64(c) < 8
11105         // result: (SHRBconst x [int8(c)])
11106         for {
11107                 x := v_0
11108                 if v_1.Op != OpConst64 {
11109                         break
11110                 }
11111                 c := auxIntToInt64(v_1.AuxInt)
11112                 if !(uint64(c) < 8) {
11113                         break
11114                 }
11115                 v.reset(Op386SHRBconst)
11116                 v.AuxInt = int8ToAuxInt(int8(c))
11117                 v.AddArg(x)
11118                 return true
11119         }
11120         // match: (Rsh8Ux64 _ (Const64 [c]))
11121         // cond: uint64(c) >= 8
11122         // result: (Const8 [0])
11123         for {
11124                 if v_1.Op != OpConst64 {
11125                         break
11126                 }
11127                 c := auxIntToInt64(v_1.AuxInt)
11128                 if !(uint64(c) >= 8) {
11129                         break
11130                 }
11131                 v.reset(OpConst8)
11132                 v.AuxInt = int8ToAuxInt(0)
11133                 return true
11134         }
11135         return false
11136 }
11137 func rewriteValue386_OpRsh8Ux8(v *Value) bool {
11138         v_1 := v.Args[1]
11139         v_0 := v.Args[0]
11140         b := v.Block
11141         // match: (Rsh8Ux8 <t> x y)
11142         // cond: !shiftIsBounded(v)
11143         // result: (ANDL (SHRB <t> x y) (SBBLcarrymask <t> (CMPBconst y [8])))
11144         for {
11145                 t := v.Type
11146                 x := v_0
11147                 y := v_1
11148                 if !(!shiftIsBounded(v)) {
11149                         break
11150                 }
11151                 v.reset(Op386ANDL)
11152                 v0 := b.NewValue0(v.Pos, Op386SHRB, t)
11153                 v0.AddArg2(x, y)
11154                 v1 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
11155                 v2 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
11156                 v2.AuxInt = int8ToAuxInt(8)
11157                 v2.AddArg(y)
11158                 v1.AddArg(v2)
11159                 v.AddArg2(v0, v1)
11160                 return true
11161         }
11162         // match: (Rsh8Ux8 <t> x y)
11163         // cond: shiftIsBounded(v)
11164         // result: (SHRB <t> x y)
11165         for {
11166                 t := v.Type
11167                 x := v_0
11168                 y := v_1
11169                 if !(shiftIsBounded(v)) {
11170                         break
11171                 }
11172                 v.reset(Op386SHRB)
11173                 v.Type = t
11174                 v.AddArg2(x, y)
11175                 return true
11176         }
11177         return false
11178 }
11179 func rewriteValue386_OpRsh8x16(v *Value) bool {
11180         v_1 := v.Args[1]
11181         v_0 := v.Args[0]
11182         b := v.Block
11183         // match: (Rsh8x16 <t> x y)
11184         // cond: !shiftIsBounded(v)
11185         // result: (SARB <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPWconst y [8])))))
11186         for {
11187                 t := v.Type
11188                 x := v_0
11189                 y := v_1
11190                 if !(!shiftIsBounded(v)) {
11191                         break
11192                 }
11193                 v.reset(Op386SARB)
11194                 v.Type = t
11195                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
11196                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
11197                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
11198                 v3 := b.NewValue0(v.Pos, Op386CMPWconst, types.TypeFlags)
11199                 v3.AuxInt = int16ToAuxInt(8)
11200                 v3.AddArg(y)
11201                 v2.AddArg(v3)
11202                 v1.AddArg(v2)
11203                 v0.AddArg2(y, v1)
11204                 v.AddArg2(x, v0)
11205                 return true
11206         }
11207         // match: (Rsh8x16 <t> x y)
11208         // cond: shiftIsBounded(v)
11209         // result: (SARB x y)
11210         for {
11211                 x := v_0
11212                 y := v_1
11213                 if !(shiftIsBounded(v)) {
11214                         break
11215                 }
11216                 v.reset(Op386SARB)
11217                 v.AddArg2(x, y)
11218                 return true
11219         }
11220         return false
11221 }
11222 func rewriteValue386_OpRsh8x32(v *Value) bool {
11223         v_1 := v.Args[1]
11224         v_0 := v.Args[0]
11225         b := v.Block
11226         // match: (Rsh8x32 <t> x y)
11227         // cond: !shiftIsBounded(v)
11228         // result: (SARB <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPLconst y [8])))))
11229         for {
11230                 t := v.Type
11231                 x := v_0
11232                 y := v_1
11233                 if !(!shiftIsBounded(v)) {
11234                         break
11235                 }
11236                 v.reset(Op386SARB)
11237                 v.Type = t
11238                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
11239                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
11240                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
11241                 v3 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
11242                 v3.AuxInt = int32ToAuxInt(8)
11243                 v3.AddArg(y)
11244                 v2.AddArg(v3)
11245                 v1.AddArg(v2)
11246                 v0.AddArg2(y, v1)
11247                 v.AddArg2(x, v0)
11248                 return true
11249         }
11250         // match: (Rsh8x32 <t> x y)
11251         // cond: shiftIsBounded(v)
11252         // result: (SARB x y)
11253         for {
11254                 x := v_0
11255                 y := v_1
11256                 if !(shiftIsBounded(v)) {
11257                         break
11258                 }
11259                 v.reset(Op386SARB)
11260                 v.AddArg2(x, y)
11261                 return true
11262         }
11263         return false
11264 }
11265 func rewriteValue386_OpRsh8x64(v *Value) bool {
11266         v_1 := v.Args[1]
11267         v_0 := v.Args[0]
11268         // match: (Rsh8x64 x (Const64 [c]))
11269         // cond: uint64(c) < 8
11270         // result: (SARBconst x [int8(c)])
11271         for {
11272                 x := v_0
11273                 if v_1.Op != OpConst64 {
11274                         break
11275                 }
11276                 c := auxIntToInt64(v_1.AuxInt)
11277                 if !(uint64(c) < 8) {
11278                         break
11279                 }
11280                 v.reset(Op386SARBconst)
11281                 v.AuxInt = int8ToAuxInt(int8(c))
11282                 v.AddArg(x)
11283                 return true
11284         }
11285         // match: (Rsh8x64 x (Const64 [c]))
11286         // cond: uint64(c) >= 8
11287         // result: (SARBconst x [7])
11288         for {
11289                 x := v_0
11290                 if v_1.Op != OpConst64 {
11291                         break
11292                 }
11293                 c := auxIntToInt64(v_1.AuxInt)
11294                 if !(uint64(c) >= 8) {
11295                         break
11296                 }
11297                 v.reset(Op386SARBconst)
11298                 v.AuxInt = int8ToAuxInt(7)
11299                 v.AddArg(x)
11300                 return true
11301         }
11302         return false
11303 }
11304 func rewriteValue386_OpRsh8x8(v *Value) bool {
11305         v_1 := v.Args[1]
11306         v_0 := v.Args[0]
11307         b := v.Block
11308         // match: (Rsh8x8 <t> x y)
11309         // cond: !shiftIsBounded(v)
11310         // result: (SARB <t> x (ORL <y.Type> y (NOTL <y.Type> (SBBLcarrymask <y.Type> (CMPBconst y [8])))))
11311         for {
11312                 t := v.Type
11313                 x := v_0
11314                 y := v_1
11315                 if !(!shiftIsBounded(v)) {
11316                         break
11317                 }
11318                 v.reset(Op386SARB)
11319                 v.Type = t
11320                 v0 := b.NewValue0(v.Pos, Op386ORL, y.Type)
11321                 v1 := b.NewValue0(v.Pos, Op386NOTL, y.Type)
11322                 v2 := b.NewValue0(v.Pos, Op386SBBLcarrymask, y.Type)
11323                 v3 := b.NewValue0(v.Pos, Op386CMPBconst, types.TypeFlags)
11324                 v3.AuxInt = int8ToAuxInt(8)
11325                 v3.AddArg(y)
11326                 v2.AddArg(v3)
11327                 v1.AddArg(v2)
11328                 v0.AddArg2(y, v1)
11329                 v.AddArg2(x, v0)
11330                 return true
11331         }
11332         // match: (Rsh8x8 <t> x y)
11333         // cond: shiftIsBounded(v)
11334         // result: (SARB x y)
11335         for {
11336                 x := v_0
11337                 y := v_1
11338                 if !(shiftIsBounded(v)) {
11339                         break
11340                 }
11341                 v.reset(Op386SARB)
11342                 v.AddArg2(x, y)
11343                 return true
11344         }
11345         return false
11346 }
11347 func rewriteValue386_OpSelect0(v *Value) bool {
11348         v_0 := v.Args[0]
11349         b := v.Block
11350         typ := &b.Func.Config.Types
11351         // match: (Select0 (Mul32uover x y))
11352         // result: (Select0 <typ.UInt32> (MULLU x y))
11353         for {
11354                 if v_0.Op != OpMul32uover {
11355                         break
11356                 }
11357                 y := v_0.Args[1]
11358                 x := v_0.Args[0]
11359                 v.reset(OpSelect0)
11360                 v.Type = typ.UInt32
11361                 v0 := b.NewValue0(v.Pos, Op386MULLU, types.NewTuple(typ.UInt32, types.TypeFlags))
11362                 v0.AddArg2(x, y)
11363                 v.AddArg(v0)
11364                 return true
11365         }
11366         return false
11367 }
11368 func rewriteValue386_OpSelect1(v *Value) bool {
11369         v_0 := v.Args[0]
11370         b := v.Block
11371         typ := &b.Func.Config.Types
11372         // match: (Select1 (Mul32uover x y))
11373         // result: (SETO (Select1 <types.TypeFlags> (MULLU x y)))
11374         for {
11375                 if v_0.Op != OpMul32uover {
11376                         break
11377                 }
11378                 y := v_0.Args[1]
11379                 x := v_0.Args[0]
11380                 v.reset(Op386SETO)
11381                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11382                 v1 := b.NewValue0(v.Pos, Op386MULLU, types.NewTuple(typ.UInt32, types.TypeFlags))
11383                 v1.AddArg2(x, y)
11384                 v0.AddArg(v1)
11385                 v.AddArg(v0)
11386                 return true
11387         }
11388         return false
11389 }
11390 func rewriteValue386_OpSignmask(v *Value) bool {
11391         v_0 := v.Args[0]
11392         // match: (Signmask x)
11393         // result: (SARLconst x [31])
11394         for {
11395                 x := v_0
11396                 v.reset(Op386SARLconst)
11397                 v.AuxInt = int32ToAuxInt(31)
11398                 v.AddArg(x)
11399                 return true
11400         }
11401 }
11402 func rewriteValue386_OpSlicemask(v *Value) bool {
11403         v_0 := v.Args[0]
11404         b := v.Block
11405         // match: (Slicemask <t> x)
11406         // result: (SARLconst (NEGL <t> x) [31])
11407         for {
11408                 t := v.Type
11409                 x := v_0
11410                 v.reset(Op386SARLconst)
11411                 v.AuxInt = int32ToAuxInt(31)
11412                 v0 := b.NewValue0(v.Pos, Op386NEGL, t)
11413                 v0.AddArg(x)
11414                 v.AddArg(v0)
11415                 return true
11416         }
11417 }
11418 func rewriteValue386_OpStore(v *Value) bool {
11419         v_2 := v.Args[2]
11420         v_1 := v.Args[1]
11421         v_0 := v.Args[0]
11422         // match: (Store {t} ptr val mem)
11423         // cond: t.Size() == 8 && is64BitFloat(val.Type)
11424         // result: (MOVSDstore ptr val mem)
11425         for {
11426                 t := auxToType(v.Aux)
11427                 ptr := v_0
11428                 val := v_1
11429                 mem := v_2
11430                 if !(t.Size() == 8 && is64BitFloat(val.Type)) {
11431                         break
11432                 }
11433                 v.reset(Op386MOVSDstore)
11434                 v.AddArg3(ptr, val, mem)
11435                 return true
11436         }
11437         // match: (Store {t} ptr val mem)
11438         // cond: t.Size() == 4 && is32BitFloat(val.Type)
11439         // result: (MOVSSstore ptr val mem)
11440         for {
11441                 t := auxToType(v.Aux)
11442                 ptr := v_0
11443                 val := v_1
11444                 mem := v_2
11445                 if !(t.Size() == 4 && is32BitFloat(val.Type)) {
11446                         break
11447                 }
11448                 v.reset(Op386MOVSSstore)
11449                 v.AddArg3(ptr, val, mem)
11450                 return true
11451         }
11452         // match: (Store {t} ptr val mem)
11453         // cond: t.Size() == 4
11454         // result: (MOVLstore ptr val mem)
11455         for {
11456                 t := auxToType(v.Aux)
11457                 ptr := v_0
11458                 val := v_1
11459                 mem := v_2
11460                 if !(t.Size() == 4) {
11461                         break
11462                 }
11463                 v.reset(Op386MOVLstore)
11464                 v.AddArg3(ptr, val, mem)
11465                 return true
11466         }
11467         // match: (Store {t} ptr val mem)
11468         // cond: t.Size() == 2
11469         // result: (MOVWstore ptr val mem)
11470         for {
11471                 t := auxToType(v.Aux)
11472                 ptr := v_0
11473                 val := v_1
11474                 mem := v_2
11475                 if !(t.Size() == 2) {
11476                         break
11477                 }
11478                 v.reset(Op386MOVWstore)
11479                 v.AddArg3(ptr, val, mem)
11480                 return true
11481         }
11482         // match: (Store {t} ptr val mem)
11483         // cond: t.Size() == 1
11484         // result: (MOVBstore ptr val mem)
11485         for {
11486                 t := auxToType(v.Aux)
11487                 ptr := v_0
11488                 val := v_1
11489                 mem := v_2
11490                 if !(t.Size() == 1) {
11491                         break
11492                 }
11493                 v.reset(Op386MOVBstore)
11494                 v.AddArg3(ptr, val, mem)
11495                 return true
11496         }
11497         return false
11498 }
11499 func rewriteValue386_OpZero(v *Value) bool {
11500         v_1 := v.Args[1]
11501         v_0 := v.Args[0]
11502         b := v.Block
11503         config := b.Func.Config
11504         typ := &b.Func.Config.Types
11505         // match: (Zero [0] _ mem)
11506         // result: mem
11507         for {
11508                 if auxIntToInt64(v.AuxInt) != 0 {
11509                         break
11510                 }
11511                 mem := v_1
11512                 v.copyOf(mem)
11513                 return true
11514         }
11515         // match: (Zero [1] destptr mem)
11516         // result: (MOVBstoreconst [0] destptr mem)
11517         for {
11518                 if auxIntToInt64(v.AuxInt) != 1 {
11519                         break
11520                 }
11521                 destptr := v_0
11522                 mem := v_1
11523                 v.reset(Op386MOVBstoreconst)
11524                 v.AuxInt = valAndOffToAuxInt(0)
11525                 v.AddArg2(destptr, mem)
11526                 return true
11527         }
11528         // match: (Zero [2] destptr mem)
11529         // result: (MOVWstoreconst [0] destptr mem)
11530         for {
11531                 if auxIntToInt64(v.AuxInt) != 2 {
11532                         break
11533                 }
11534                 destptr := v_0
11535                 mem := v_1
11536                 v.reset(Op386MOVWstoreconst)
11537                 v.AuxInt = valAndOffToAuxInt(0)
11538                 v.AddArg2(destptr, mem)
11539                 return true
11540         }
11541         // match: (Zero [4] destptr mem)
11542         // result: (MOVLstoreconst [0] destptr mem)
11543         for {
11544                 if auxIntToInt64(v.AuxInt) != 4 {
11545                         break
11546                 }
11547                 destptr := v_0
11548                 mem := v_1
11549                 v.reset(Op386MOVLstoreconst)
11550                 v.AuxInt = valAndOffToAuxInt(0)
11551                 v.AddArg2(destptr, mem)
11552                 return true
11553         }
11554         // match: (Zero [3] destptr mem)
11555         // result: (MOVBstoreconst [makeValAndOff(0,2)] destptr (MOVWstoreconst [makeValAndOff(0,0)] destptr mem))
11556         for {
11557                 if auxIntToInt64(v.AuxInt) != 3 {
11558                         break
11559                 }
11560                 destptr := v_0
11561                 mem := v_1
11562                 v.reset(Op386MOVBstoreconst)
11563                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 2))
11564                 v0 := b.NewValue0(v.Pos, Op386MOVWstoreconst, types.TypeMem)
11565                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11566                 v0.AddArg2(destptr, mem)
11567                 v.AddArg2(destptr, v0)
11568                 return true
11569         }
11570         // match: (Zero [5] destptr mem)
11571         // result: (MOVBstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem))
11572         for {
11573                 if auxIntToInt64(v.AuxInt) != 5 {
11574                         break
11575                 }
11576                 destptr := v_0
11577                 mem := v_1
11578                 v.reset(Op386MOVBstoreconst)
11579                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
11580                 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11581                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11582                 v0.AddArg2(destptr, mem)
11583                 v.AddArg2(destptr, v0)
11584                 return true
11585         }
11586         // match: (Zero [6] destptr mem)
11587         // result: (MOVWstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem))
11588         for {
11589                 if auxIntToInt64(v.AuxInt) != 6 {
11590                         break
11591                 }
11592                 destptr := v_0
11593                 mem := v_1
11594                 v.reset(Op386MOVWstoreconst)
11595                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
11596                 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11597                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11598                 v0.AddArg2(destptr, mem)
11599                 v.AddArg2(destptr, v0)
11600                 return true
11601         }
11602         // match: (Zero [7] destptr mem)
11603         // result: (MOVLstoreconst [makeValAndOff(0,3)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem))
11604         for {
11605                 if auxIntToInt64(v.AuxInt) != 7 {
11606                         break
11607                 }
11608                 destptr := v_0
11609                 mem := v_1
11610                 v.reset(Op386MOVLstoreconst)
11611                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 3))
11612                 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11613                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11614                 v0.AddArg2(destptr, mem)
11615                 v.AddArg2(destptr, v0)
11616                 return true
11617         }
11618         // match: (Zero [s] destptr mem)
11619         // cond: s%4 != 0 && s > 4
11620         // result: (Zero [s-s%4] (ADDLconst destptr [int32(s%4)]) (MOVLstoreconst [0] destptr mem))
11621         for {
11622                 s := auxIntToInt64(v.AuxInt)
11623                 destptr := v_0
11624                 mem := v_1
11625                 if !(s%4 != 0 && s > 4) {
11626                         break
11627                 }
11628                 v.reset(OpZero)
11629                 v.AuxInt = int64ToAuxInt(s - s%4)
11630                 v0 := b.NewValue0(v.Pos, Op386ADDLconst, typ.UInt32)
11631                 v0.AuxInt = int32ToAuxInt(int32(s % 4))
11632                 v0.AddArg(destptr)
11633                 v1 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11634                 v1.AuxInt = valAndOffToAuxInt(0)
11635                 v1.AddArg2(destptr, mem)
11636                 v.AddArg2(v0, v1)
11637                 return true
11638         }
11639         // match: (Zero [8] destptr mem)
11640         // result: (MOVLstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem))
11641         for {
11642                 if auxIntToInt64(v.AuxInt) != 8 {
11643                         break
11644                 }
11645                 destptr := v_0
11646                 mem := v_1
11647                 v.reset(Op386MOVLstoreconst)
11648                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
11649                 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11650                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11651                 v0.AddArg2(destptr, mem)
11652                 v.AddArg2(destptr, v0)
11653                 return true
11654         }
11655         // match: (Zero [12] destptr mem)
11656         // result: (MOVLstoreconst [makeValAndOff(0,8)] destptr (MOVLstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem)))
11657         for {
11658                 if auxIntToInt64(v.AuxInt) != 12 {
11659                         break
11660                 }
11661                 destptr := v_0
11662                 mem := v_1
11663                 v.reset(Op386MOVLstoreconst)
11664                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 8))
11665                 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11666                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
11667                 v1 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11668                 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11669                 v1.AddArg2(destptr, mem)
11670                 v0.AddArg2(destptr, v1)
11671                 v.AddArg2(destptr, v0)
11672                 return true
11673         }
11674         // match: (Zero [16] destptr mem)
11675         // result: (MOVLstoreconst [makeValAndOff(0,12)] destptr (MOVLstoreconst [makeValAndOff(0,8)] destptr (MOVLstoreconst [makeValAndOff(0,4)] destptr (MOVLstoreconst [makeValAndOff(0,0)] destptr mem))))
11676         for {
11677                 if auxIntToInt64(v.AuxInt) != 16 {
11678                         break
11679                 }
11680                 destptr := v_0
11681                 mem := v_1
11682                 v.reset(Op386MOVLstoreconst)
11683                 v.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 12))
11684                 v0 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11685                 v0.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 8))
11686                 v1 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11687                 v1.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 4))
11688                 v2 := b.NewValue0(v.Pos, Op386MOVLstoreconst, types.TypeMem)
11689                 v2.AuxInt = valAndOffToAuxInt(makeValAndOff(0, 0))
11690                 v2.AddArg2(destptr, mem)
11691                 v1.AddArg2(destptr, v2)
11692                 v0.AddArg2(destptr, v1)
11693                 v.AddArg2(destptr, v0)
11694                 return true
11695         }
11696         // match: (Zero [s] destptr mem)
11697         // cond: s > 16 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice
11698         // result: (DUFFZERO [1*(128-s/4)] destptr (MOVLconst [0]) mem)
11699         for {
11700                 s := auxIntToInt64(v.AuxInt)
11701                 destptr := v_0
11702                 mem := v_1
11703                 if !(s > 16 && s <= 4*128 && s%4 == 0 && !config.noDuffDevice) {
11704                         break
11705                 }
11706                 v.reset(Op386DUFFZERO)
11707                 v.AuxInt = int64ToAuxInt(1 * (128 - s/4))
11708                 v0 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32)
11709                 v0.AuxInt = int32ToAuxInt(0)
11710                 v.AddArg3(destptr, v0, mem)
11711                 return true
11712         }
11713         // match: (Zero [s] destptr mem)
11714         // cond: (s > 4*128 || (config.noDuffDevice && s > 16)) && s%4 == 0
11715         // result: (REPSTOSL destptr (MOVLconst [int32(s/4)]) (MOVLconst [0]) mem)
11716         for {
11717                 s := auxIntToInt64(v.AuxInt)
11718                 destptr := v_0
11719                 mem := v_1
11720                 if !((s > 4*128 || (config.noDuffDevice && s > 16)) && s%4 == 0) {
11721                         break
11722                 }
11723                 v.reset(Op386REPSTOSL)
11724                 v0 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32)
11725                 v0.AuxInt = int32ToAuxInt(int32(s / 4))
11726                 v1 := b.NewValue0(v.Pos, Op386MOVLconst, typ.UInt32)
11727                 v1.AuxInt = int32ToAuxInt(0)
11728                 v.AddArg4(destptr, v0, v1, mem)
11729                 return true
11730         }
11731         return false
11732 }
11733 func rewriteValue386_OpZeromask(v *Value) bool {
11734         v_0 := v.Args[0]
11735         b := v.Block
11736         // match: (Zeromask <t> x)
11737         // result: (XORLconst [-1] (SBBLcarrymask <t> (CMPLconst x [1])))
11738         for {
11739                 t := v.Type
11740                 x := v_0
11741                 v.reset(Op386XORLconst)
11742                 v.AuxInt = int32ToAuxInt(-1)
11743                 v0 := b.NewValue0(v.Pos, Op386SBBLcarrymask, t)
11744                 v1 := b.NewValue0(v.Pos, Op386CMPLconst, types.TypeFlags)
11745                 v1.AuxInt = int32ToAuxInt(1)
11746                 v1.AddArg(x)
11747                 v0.AddArg(v1)
11748                 v.AddArg(v0)
11749                 return true
11750         }
11751 }
11752 func rewriteBlock386(b *Block) bool {
11753         switch b.Kind {
11754         case Block386EQ:
11755                 // match: (EQ (InvertFlags cmp) yes no)
11756                 // result: (EQ cmp yes no)
11757                 for b.Controls[0].Op == Op386InvertFlags {
11758                         v_0 := b.Controls[0]
11759                         cmp := v_0.Args[0]
11760                         b.resetWithControl(Block386EQ, cmp)
11761                         return true
11762                 }
11763                 // match: (EQ (FlagEQ) yes no)
11764                 // result: (First yes no)
11765                 for b.Controls[0].Op == Op386FlagEQ {
11766                         b.Reset(BlockFirst)
11767                         return true
11768                 }
11769                 // match: (EQ (FlagLT_ULT) yes no)
11770                 // result: (First no yes)
11771                 for b.Controls[0].Op == Op386FlagLT_ULT {
11772                         b.Reset(BlockFirst)
11773                         b.swapSuccessors()
11774                         return true
11775                 }
11776                 // match: (EQ (FlagLT_UGT) yes no)
11777                 // result: (First no yes)
11778                 for b.Controls[0].Op == Op386FlagLT_UGT {
11779                         b.Reset(BlockFirst)
11780                         b.swapSuccessors()
11781                         return true
11782                 }
11783                 // match: (EQ (FlagGT_ULT) yes no)
11784                 // result: (First no yes)
11785                 for b.Controls[0].Op == Op386FlagGT_ULT {
11786                         b.Reset(BlockFirst)
11787                         b.swapSuccessors()
11788                         return true
11789                 }
11790                 // match: (EQ (FlagGT_UGT) yes no)
11791                 // result: (First no yes)
11792                 for b.Controls[0].Op == Op386FlagGT_UGT {
11793                         b.Reset(BlockFirst)
11794                         b.swapSuccessors()
11795                         return true
11796                 }
11797         case Block386GE:
11798                 // match: (GE (InvertFlags cmp) yes no)
11799                 // result: (LE cmp yes no)
11800                 for b.Controls[0].Op == Op386InvertFlags {
11801                         v_0 := b.Controls[0]
11802                         cmp := v_0.Args[0]
11803                         b.resetWithControl(Block386LE, cmp)
11804                         return true
11805                 }
11806                 // match: (GE (FlagEQ) yes no)
11807                 // result: (First yes no)
11808                 for b.Controls[0].Op == Op386FlagEQ {
11809                         b.Reset(BlockFirst)
11810                         return true
11811                 }
11812                 // match: (GE (FlagLT_ULT) yes no)
11813                 // result: (First no yes)
11814                 for b.Controls[0].Op == Op386FlagLT_ULT {
11815                         b.Reset(BlockFirst)
11816                         b.swapSuccessors()
11817                         return true
11818                 }
11819                 // match: (GE (FlagLT_UGT) yes no)
11820                 // result: (First no yes)
11821                 for b.Controls[0].Op == Op386FlagLT_UGT {
11822                         b.Reset(BlockFirst)
11823                         b.swapSuccessors()
11824                         return true
11825                 }
11826                 // match: (GE (FlagGT_ULT) yes no)
11827                 // result: (First yes no)
11828                 for b.Controls[0].Op == Op386FlagGT_ULT {
11829                         b.Reset(BlockFirst)
11830                         return true
11831                 }
11832                 // match: (GE (FlagGT_UGT) yes no)
11833                 // result: (First yes no)
11834                 for b.Controls[0].Op == Op386FlagGT_UGT {
11835                         b.Reset(BlockFirst)
11836                         return true
11837                 }
11838         case Block386GT:
11839                 // match: (GT (InvertFlags cmp) yes no)
11840                 // result: (LT cmp yes no)
11841                 for b.Controls[0].Op == Op386InvertFlags {
11842                         v_0 := b.Controls[0]
11843                         cmp := v_0.Args[0]
11844                         b.resetWithControl(Block386LT, cmp)
11845                         return true
11846                 }
11847                 // match: (GT (FlagEQ) yes no)
11848                 // result: (First no yes)
11849                 for b.Controls[0].Op == Op386FlagEQ {
11850                         b.Reset(BlockFirst)
11851                         b.swapSuccessors()
11852                         return true
11853                 }
11854                 // match: (GT (FlagLT_ULT) yes no)
11855                 // result: (First no yes)
11856                 for b.Controls[0].Op == Op386FlagLT_ULT {
11857                         b.Reset(BlockFirst)
11858                         b.swapSuccessors()
11859                         return true
11860                 }
11861                 // match: (GT (FlagLT_UGT) yes no)
11862                 // result: (First no yes)
11863                 for b.Controls[0].Op == Op386FlagLT_UGT {
11864                         b.Reset(BlockFirst)
11865                         b.swapSuccessors()
11866                         return true
11867                 }
11868                 // match: (GT (FlagGT_ULT) yes no)
11869                 // result: (First yes no)
11870                 for b.Controls[0].Op == Op386FlagGT_ULT {
11871                         b.Reset(BlockFirst)
11872                         return true
11873                 }
11874                 // match: (GT (FlagGT_UGT) yes no)
11875                 // result: (First yes no)
11876                 for b.Controls[0].Op == Op386FlagGT_UGT {
11877                         b.Reset(BlockFirst)
11878                         return true
11879                 }
11880         case BlockIf:
11881                 // match: (If (SETL cmp) yes no)
11882                 // result: (LT cmp yes no)
11883                 for b.Controls[0].Op == Op386SETL {
11884                         v_0 := b.Controls[0]
11885                         cmp := v_0.Args[0]
11886                         b.resetWithControl(Block386LT, cmp)
11887                         return true
11888                 }
11889                 // match: (If (SETLE cmp) yes no)
11890                 // result: (LE cmp yes no)
11891                 for b.Controls[0].Op == Op386SETLE {
11892                         v_0 := b.Controls[0]
11893                         cmp := v_0.Args[0]
11894                         b.resetWithControl(Block386LE, cmp)
11895                         return true
11896                 }
11897                 // match: (If (SETG cmp) yes no)
11898                 // result: (GT cmp yes no)
11899                 for b.Controls[0].Op == Op386SETG {
11900                         v_0 := b.Controls[0]
11901                         cmp := v_0.Args[0]
11902                         b.resetWithControl(Block386GT, cmp)
11903                         return true
11904                 }
11905                 // match: (If (SETGE cmp) yes no)
11906                 // result: (GE cmp yes no)
11907                 for b.Controls[0].Op == Op386SETGE {
11908                         v_0 := b.Controls[0]
11909                         cmp := v_0.Args[0]
11910                         b.resetWithControl(Block386GE, cmp)
11911                         return true
11912                 }
11913                 // match: (If (SETEQ cmp) yes no)
11914                 // result: (EQ cmp yes no)
11915                 for b.Controls[0].Op == Op386SETEQ {
11916                         v_0 := b.Controls[0]
11917                         cmp := v_0.Args[0]
11918                         b.resetWithControl(Block386EQ, cmp)
11919                         return true
11920                 }
11921                 // match: (If (SETNE cmp) yes no)
11922                 // result: (NE cmp yes no)
11923                 for b.Controls[0].Op == Op386SETNE {
11924                         v_0 := b.Controls[0]
11925                         cmp := v_0.Args[0]
11926                         b.resetWithControl(Block386NE, cmp)
11927                         return true
11928                 }
11929                 // match: (If (SETB cmp) yes no)
11930                 // result: (ULT cmp yes no)
11931                 for b.Controls[0].Op == Op386SETB {
11932                         v_0 := b.Controls[0]
11933                         cmp := v_0.Args[0]
11934                         b.resetWithControl(Block386ULT, cmp)
11935                         return true
11936                 }
11937                 // match: (If (SETBE cmp) yes no)
11938                 // result: (ULE cmp yes no)
11939                 for b.Controls[0].Op == Op386SETBE {
11940                         v_0 := b.Controls[0]
11941                         cmp := v_0.Args[0]
11942                         b.resetWithControl(Block386ULE, cmp)
11943                         return true
11944                 }
11945                 // match: (If (SETA cmp) yes no)
11946                 // result: (UGT cmp yes no)
11947                 for b.Controls[0].Op == Op386SETA {
11948                         v_0 := b.Controls[0]
11949                         cmp := v_0.Args[0]
11950                         b.resetWithControl(Block386UGT, cmp)
11951                         return true
11952                 }
11953                 // match: (If (SETAE cmp) yes no)
11954                 // result: (UGE cmp yes no)
11955                 for b.Controls[0].Op == Op386SETAE {
11956                         v_0 := b.Controls[0]
11957                         cmp := v_0.Args[0]
11958                         b.resetWithControl(Block386UGE, cmp)
11959                         return true
11960                 }
11961                 // match: (If (SETO cmp) yes no)
11962                 // result: (OS cmp yes no)
11963                 for b.Controls[0].Op == Op386SETO {
11964                         v_0 := b.Controls[0]
11965                         cmp := v_0.Args[0]
11966                         b.resetWithControl(Block386OS, cmp)
11967                         return true
11968                 }
11969                 // match: (If (SETGF cmp) yes no)
11970                 // result: (UGT cmp yes no)
11971                 for b.Controls[0].Op == Op386SETGF {
11972                         v_0 := b.Controls[0]
11973                         cmp := v_0.Args[0]
11974                         b.resetWithControl(Block386UGT, cmp)
11975                         return true
11976                 }
11977                 // match: (If (SETGEF cmp) yes no)
11978                 // result: (UGE cmp yes no)
11979                 for b.Controls[0].Op == Op386SETGEF {
11980                         v_0 := b.Controls[0]
11981                         cmp := v_0.Args[0]
11982                         b.resetWithControl(Block386UGE, cmp)
11983                         return true
11984                 }
11985                 // match: (If (SETEQF cmp) yes no)
11986                 // result: (EQF cmp yes no)
11987                 for b.Controls[0].Op == Op386SETEQF {
11988                         v_0 := b.Controls[0]
11989                         cmp := v_0.Args[0]
11990                         b.resetWithControl(Block386EQF, cmp)
11991                         return true
11992                 }
11993                 // match: (If (SETNEF cmp) yes no)
11994                 // result: (NEF cmp yes no)
11995                 for b.Controls[0].Op == Op386SETNEF {
11996                         v_0 := b.Controls[0]
11997                         cmp := v_0.Args[0]
11998                         b.resetWithControl(Block386NEF, cmp)
11999                         return true
12000                 }
12001                 // match: (If cond yes no)
12002                 // result: (NE (TESTB cond cond) yes no)
12003                 for {
12004                         cond := b.Controls[0]
12005                         v0 := b.NewValue0(cond.Pos, Op386TESTB, types.TypeFlags)
12006                         v0.AddArg2(cond, cond)
12007                         b.resetWithControl(Block386NE, v0)
12008                         return true
12009                 }
12010         case Block386LE:
12011                 // match: (LE (InvertFlags cmp) yes no)
12012                 // result: (GE cmp yes no)
12013                 for b.Controls[0].Op == Op386InvertFlags {
12014                         v_0 := b.Controls[0]
12015                         cmp := v_0.Args[0]
12016                         b.resetWithControl(Block386GE, cmp)
12017                         return true
12018                 }
12019                 // match: (LE (FlagEQ) yes no)
12020                 // result: (First yes no)
12021                 for b.Controls[0].Op == Op386FlagEQ {
12022                         b.Reset(BlockFirst)
12023                         return true
12024                 }
12025                 // match: (LE (FlagLT_ULT) yes no)
12026                 // result: (First yes no)
12027                 for b.Controls[0].Op == Op386FlagLT_ULT {
12028                         b.Reset(BlockFirst)
12029                         return true
12030                 }
12031                 // match: (LE (FlagLT_UGT) yes no)
12032                 // result: (First yes no)
12033                 for b.Controls[0].Op == Op386FlagLT_UGT {
12034                         b.Reset(BlockFirst)
12035                         return true
12036                 }
12037                 // match: (LE (FlagGT_ULT) yes no)
12038                 // result: (First no yes)
12039                 for b.Controls[0].Op == Op386FlagGT_ULT {
12040                         b.Reset(BlockFirst)
12041                         b.swapSuccessors()
12042                         return true
12043                 }
12044                 // match: (LE (FlagGT_UGT) yes no)
12045                 // result: (First no yes)
12046                 for b.Controls[0].Op == Op386FlagGT_UGT {
12047                         b.Reset(BlockFirst)
12048                         b.swapSuccessors()
12049                         return true
12050                 }
12051         case Block386LT:
12052                 // match: (LT (InvertFlags cmp) yes no)
12053                 // result: (GT cmp yes no)
12054                 for b.Controls[0].Op == Op386InvertFlags {
12055                         v_0 := b.Controls[0]
12056                         cmp := v_0.Args[0]
12057                         b.resetWithControl(Block386GT, cmp)
12058                         return true
12059                 }
12060                 // match: (LT (FlagEQ) yes no)
12061                 // result: (First no yes)
12062                 for b.Controls[0].Op == Op386FlagEQ {
12063                         b.Reset(BlockFirst)
12064                         b.swapSuccessors()
12065                         return true
12066                 }
12067                 // match: (LT (FlagLT_ULT) yes no)
12068                 // result: (First yes no)
12069                 for b.Controls[0].Op == Op386FlagLT_ULT {
12070                         b.Reset(BlockFirst)
12071                         return true
12072                 }
12073                 // match: (LT (FlagLT_UGT) yes no)
12074                 // result: (First yes no)
12075                 for b.Controls[0].Op == Op386FlagLT_UGT {
12076                         b.Reset(BlockFirst)
12077                         return true
12078                 }
12079                 // match: (LT (FlagGT_ULT) yes no)
12080                 // result: (First no yes)
12081                 for b.Controls[0].Op == Op386FlagGT_ULT {
12082                         b.Reset(BlockFirst)
12083                         b.swapSuccessors()
12084                         return true
12085                 }
12086                 // match: (LT (FlagGT_UGT) yes no)
12087                 // result: (First no yes)
12088                 for b.Controls[0].Op == Op386FlagGT_UGT {
12089                         b.Reset(BlockFirst)
12090                         b.swapSuccessors()
12091                         return true
12092                 }
12093         case Block386NE:
12094                 // match: (NE (TESTB (SETL cmp) (SETL cmp)) yes no)
12095                 // result: (LT cmp yes no)
12096                 for b.Controls[0].Op == Op386TESTB {
12097                         v_0 := b.Controls[0]
12098                         _ = v_0.Args[1]
12099                         v_0_0 := v_0.Args[0]
12100                         if v_0_0.Op != Op386SETL {
12101                                 break
12102                         }
12103                         cmp := v_0_0.Args[0]
12104                         v_0_1 := v_0.Args[1]
12105                         if v_0_1.Op != Op386SETL || cmp != v_0_1.Args[0] {
12106                                 break
12107                         }
12108                         b.resetWithControl(Block386LT, cmp)
12109                         return true
12110                 }
12111                 // match: (NE (TESTB (SETLE cmp) (SETLE cmp)) yes no)
12112                 // result: (LE cmp yes no)
12113                 for b.Controls[0].Op == Op386TESTB {
12114                         v_0 := b.Controls[0]
12115                         _ = v_0.Args[1]
12116                         v_0_0 := v_0.Args[0]
12117                         if v_0_0.Op != Op386SETLE {
12118                                 break
12119                         }
12120                         cmp := v_0_0.Args[0]
12121                         v_0_1 := v_0.Args[1]
12122                         if v_0_1.Op != Op386SETLE || cmp != v_0_1.Args[0] {
12123                                 break
12124                         }
12125                         b.resetWithControl(Block386LE, cmp)
12126                         return true
12127                 }
12128                 // match: (NE (TESTB (SETG cmp) (SETG cmp)) yes no)
12129                 // result: (GT cmp yes no)
12130                 for b.Controls[0].Op == Op386TESTB {
12131                         v_0 := b.Controls[0]
12132                         _ = v_0.Args[1]
12133                         v_0_0 := v_0.Args[0]
12134                         if v_0_0.Op != Op386SETG {
12135                                 break
12136                         }
12137                         cmp := v_0_0.Args[0]
12138                         v_0_1 := v_0.Args[1]
12139                         if v_0_1.Op != Op386SETG || cmp != v_0_1.Args[0] {
12140                                 break
12141                         }
12142                         b.resetWithControl(Block386GT, cmp)
12143                         return true
12144                 }
12145                 // match: (NE (TESTB (SETGE cmp) (SETGE cmp)) yes no)
12146                 // result: (GE cmp yes no)
12147                 for b.Controls[0].Op == Op386TESTB {
12148                         v_0 := b.Controls[0]
12149                         _ = v_0.Args[1]
12150                         v_0_0 := v_0.Args[0]
12151                         if v_0_0.Op != Op386SETGE {
12152                                 break
12153                         }
12154                         cmp := v_0_0.Args[0]
12155                         v_0_1 := v_0.Args[1]
12156                         if v_0_1.Op != Op386SETGE || cmp != v_0_1.Args[0] {
12157                                 break
12158                         }
12159                         b.resetWithControl(Block386GE, cmp)
12160                         return true
12161                 }
12162                 // match: (NE (TESTB (SETEQ cmp) (SETEQ cmp)) yes no)
12163                 // result: (EQ cmp yes no)
12164                 for b.Controls[0].Op == Op386TESTB {
12165                         v_0 := b.Controls[0]
12166                         _ = v_0.Args[1]
12167                         v_0_0 := v_0.Args[0]
12168                         if v_0_0.Op != Op386SETEQ {
12169                                 break
12170                         }
12171                         cmp := v_0_0.Args[0]
12172                         v_0_1 := v_0.Args[1]
12173                         if v_0_1.Op != Op386SETEQ || cmp != v_0_1.Args[0] {
12174                                 break
12175                         }
12176                         b.resetWithControl(Block386EQ, cmp)
12177                         return true
12178                 }
12179                 // match: (NE (TESTB (SETNE cmp) (SETNE cmp)) yes no)
12180                 // result: (NE cmp yes no)
12181                 for b.Controls[0].Op == Op386TESTB {
12182                         v_0 := b.Controls[0]
12183                         _ = v_0.Args[1]
12184                         v_0_0 := v_0.Args[0]
12185                         if v_0_0.Op != Op386SETNE {
12186                                 break
12187                         }
12188                         cmp := v_0_0.Args[0]
12189                         v_0_1 := v_0.Args[1]
12190                         if v_0_1.Op != Op386SETNE || cmp != v_0_1.Args[0] {
12191                                 break
12192                         }
12193                         b.resetWithControl(Block386NE, cmp)
12194                         return true
12195                 }
12196                 // match: (NE (TESTB (SETB cmp) (SETB cmp)) yes no)
12197                 // result: (ULT cmp yes no)
12198                 for b.Controls[0].Op == Op386TESTB {
12199                         v_0 := b.Controls[0]
12200                         _ = v_0.Args[1]
12201                         v_0_0 := v_0.Args[0]
12202                         if v_0_0.Op != Op386SETB {
12203                                 break
12204                         }
12205                         cmp := v_0_0.Args[0]
12206                         v_0_1 := v_0.Args[1]
12207                         if v_0_1.Op != Op386SETB || cmp != v_0_1.Args[0] {
12208                                 break
12209                         }
12210                         b.resetWithControl(Block386ULT, cmp)
12211                         return true
12212                 }
12213                 // match: (NE (TESTB (SETBE cmp) (SETBE cmp)) yes no)
12214                 // result: (ULE cmp yes no)
12215                 for b.Controls[0].Op == Op386TESTB {
12216                         v_0 := b.Controls[0]
12217                         _ = v_0.Args[1]
12218                         v_0_0 := v_0.Args[0]
12219                         if v_0_0.Op != Op386SETBE {
12220                                 break
12221                         }
12222                         cmp := v_0_0.Args[0]
12223                         v_0_1 := v_0.Args[1]
12224                         if v_0_1.Op != Op386SETBE || cmp != v_0_1.Args[0] {
12225                                 break
12226                         }
12227                         b.resetWithControl(Block386ULE, cmp)
12228                         return true
12229                 }
12230                 // match: (NE (TESTB (SETA cmp) (SETA cmp)) yes no)
12231                 // result: (UGT cmp yes no)
12232                 for b.Controls[0].Op == Op386TESTB {
12233                         v_0 := b.Controls[0]
12234                         _ = v_0.Args[1]
12235                         v_0_0 := v_0.Args[0]
12236                         if v_0_0.Op != Op386SETA {
12237                                 break
12238                         }
12239                         cmp := v_0_0.Args[0]
12240                         v_0_1 := v_0.Args[1]
12241                         if v_0_1.Op != Op386SETA || cmp != v_0_1.Args[0] {
12242                                 break
12243                         }
12244                         b.resetWithControl(Block386UGT, cmp)
12245                         return true
12246                 }
12247                 // match: (NE (TESTB (SETAE cmp) (SETAE cmp)) yes no)
12248                 // result: (UGE cmp yes no)
12249                 for b.Controls[0].Op == Op386TESTB {
12250                         v_0 := b.Controls[0]
12251                         _ = v_0.Args[1]
12252                         v_0_0 := v_0.Args[0]
12253                         if v_0_0.Op != Op386SETAE {
12254                                 break
12255                         }
12256                         cmp := v_0_0.Args[0]
12257                         v_0_1 := v_0.Args[1]
12258                         if v_0_1.Op != Op386SETAE || cmp != v_0_1.Args[0] {
12259                                 break
12260                         }
12261                         b.resetWithControl(Block386UGE, cmp)
12262                         return true
12263                 }
12264                 // match: (NE (TESTB (SETO cmp) (SETO cmp)) yes no)
12265                 // result: (OS cmp yes no)
12266                 for b.Controls[0].Op == Op386TESTB {
12267                         v_0 := b.Controls[0]
12268                         _ = v_0.Args[1]
12269                         v_0_0 := v_0.Args[0]
12270                         if v_0_0.Op != Op386SETO {
12271                                 break
12272                         }
12273                         cmp := v_0_0.Args[0]
12274                         v_0_1 := v_0.Args[1]
12275                         if v_0_1.Op != Op386SETO || cmp != v_0_1.Args[0] {
12276                                 break
12277                         }
12278                         b.resetWithControl(Block386OS, cmp)
12279                         return true
12280                 }
12281                 // match: (NE (TESTB (SETGF cmp) (SETGF cmp)) yes no)
12282                 // result: (UGT cmp yes no)
12283                 for b.Controls[0].Op == Op386TESTB {
12284                         v_0 := b.Controls[0]
12285                         _ = v_0.Args[1]
12286                         v_0_0 := v_0.Args[0]
12287                         if v_0_0.Op != Op386SETGF {
12288                                 break
12289                         }
12290                         cmp := v_0_0.Args[0]
12291                         v_0_1 := v_0.Args[1]
12292                         if v_0_1.Op != Op386SETGF || cmp != v_0_1.Args[0] {
12293                                 break
12294                         }
12295                         b.resetWithControl(Block386UGT, cmp)
12296                         return true
12297                 }
12298                 // match: (NE (TESTB (SETGEF cmp) (SETGEF cmp)) yes no)
12299                 // result: (UGE cmp yes no)
12300                 for b.Controls[0].Op == Op386TESTB {
12301                         v_0 := b.Controls[0]
12302                         _ = v_0.Args[1]
12303                         v_0_0 := v_0.Args[0]
12304                         if v_0_0.Op != Op386SETGEF {
12305                                 break
12306                         }
12307                         cmp := v_0_0.Args[0]
12308                         v_0_1 := v_0.Args[1]
12309                         if v_0_1.Op != Op386SETGEF || cmp != v_0_1.Args[0] {
12310                                 break
12311                         }
12312                         b.resetWithControl(Block386UGE, cmp)
12313                         return true
12314                 }
12315                 // match: (NE (TESTB (SETEQF cmp) (SETEQF cmp)) yes no)
12316                 // result: (EQF cmp yes no)
12317                 for b.Controls[0].Op == Op386TESTB {
12318                         v_0 := b.Controls[0]
12319                         _ = v_0.Args[1]
12320                         v_0_0 := v_0.Args[0]
12321                         if v_0_0.Op != Op386SETEQF {
12322                                 break
12323                         }
12324                         cmp := v_0_0.Args[0]
12325                         v_0_1 := v_0.Args[1]
12326                         if v_0_1.Op != Op386SETEQF || cmp != v_0_1.Args[0] {
12327                                 break
12328                         }
12329                         b.resetWithControl(Block386EQF, cmp)
12330                         return true
12331                 }
12332                 // match: (NE (TESTB (SETNEF cmp) (SETNEF cmp)) yes no)
12333                 // result: (NEF cmp yes no)
12334                 for b.Controls[0].Op == Op386TESTB {
12335                         v_0 := b.Controls[0]
12336                         _ = v_0.Args[1]
12337                         v_0_0 := v_0.Args[0]
12338                         if v_0_0.Op != Op386SETNEF {
12339                                 break
12340                         }
12341                         cmp := v_0_0.Args[0]
12342                         v_0_1 := v_0.Args[1]
12343                         if v_0_1.Op != Op386SETNEF || cmp != v_0_1.Args[0] {
12344                                 break
12345                         }
12346                         b.resetWithControl(Block386NEF, cmp)
12347                         return true
12348                 }
12349                 // match: (NE (InvertFlags cmp) yes no)
12350                 // result: (NE cmp yes no)
12351                 for b.Controls[0].Op == Op386InvertFlags {
12352                         v_0 := b.Controls[0]
12353                         cmp := v_0.Args[0]
12354                         b.resetWithControl(Block386NE, cmp)
12355                         return true
12356                 }
12357                 // match: (NE (FlagEQ) yes no)
12358                 // result: (First no yes)
12359                 for b.Controls[0].Op == Op386FlagEQ {
12360                         b.Reset(BlockFirst)
12361                         b.swapSuccessors()
12362                         return true
12363                 }
12364                 // match: (NE (FlagLT_ULT) yes no)
12365                 // result: (First yes no)
12366                 for b.Controls[0].Op == Op386FlagLT_ULT {
12367                         b.Reset(BlockFirst)
12368                         return true
12369                 }
12370                 // match: (NE (FlagLT_UGT) yes no)
12371                 // result: (First yes no)
12372                 for b.Controls[0].Op == Op386FlagLT_UGT {
12373                         b.Reset(BlockFirst)
12374                         return true
12375                 }
12376                 // match: (NE (FlagGT_ULT) yes no)
12377                 // result: (First yes no)
12378                 for b.Controls[0].Op == Op386FlagGT_ULT {
12379                         b.Reset(BlockFirst)
12380                         return true
12381                 }
12382                 // match: (NE (FlagGT_UGT) yes no)
12383                 // result: (First yes no)
12384                 for b.Controls[0].Op == Op386FlagGT_UGT {
12385                         b.Reset(BlockFirst)
12386                         return true
12387                 }
12388         case Block386UGE:
12389                 // match: (UGE (InvertFlags cmp) yes no)
12390                 // result: (ULE cmp yes no)
12391                 for b.Controls[0].Op == Op386InvertFlags {
12392                         v_0 := b.Controls[0]
12393                         cmp := v_0.Args[0]
12394                         b.resetWithControl(Block386ULE, cmp)
12395                         return true
12396                 }
12397                 // match: (UGE (FlagEQ) yes no)
12398                 // result: (First yes no)
12399                 for b.Controls[0].Op == Op386FlagEQ {
12400                         b.Reset(BlockFirst)
12401                         return true
12402                 }
12403                 // match: (UGE (FlagLT_ULT) yes no)
12404                 // result: (First no yes)
12405                 for b.Controls[0].Op == Op386FlagLT_ULT {
12406                         b.Reset(BlockFirst)
12407                         b.swapSuccessors()
12408                         return true
12409                 }
12410                 // match: (UGE (FlagLT_UGT) yes no)
12411                 // result: (First yes no)
12412                 for b.Controls[0].Op == Op386FlagLT_UGT {
12413                         b.Reset(BlockFirst)
12414                         return true
12415                 }
12416                 // match: (UGE (FlagGT_ULT) yes no)
12417                 // result: (First no yes)
12418                 for b.Controls[0].Op == Op386FlagGT_ULT {
12419                         b.Reset(BlockFirst)
12420                         b.swapSuccessors()
12421                         return true
12422                 }
12423                 // match: (UGE (FlagGT_UGT) yes no)
12424                 // result: (First yes no)
12425                 for b.Controls[0].Op == Op386FlagGT_UGT {
12426                         b.Reset(BlockFirst)
12427                         return true
12428                 }
12429         case Block386UGT:
12430                 // match: (UGT (InvertFlags cmp) yes no)
12431                 // result: (ULT cmp yes no)
12432                 for b.Controls[0].Op == Op386InvertFlags {
12433                         v_0 := b.Controls[0]
12434                         cmp := v_0.Args[0]
12435                         b.resetWithControl(Block386ULT, cmp)
12436                         return true
12437                 }
12438                 // match: (UGT (FlagEQ) yes no)
12439                 // result: (First no yes)
12440                 for b.Controls[0].Op == Op386FlagEQ {
12441                         b.Reset(BlockFirst)
12442                         b.swapSuccessors()
12443                         return true
12444                 }
12445                 // match: (UGT (FlagLT_ULT) yes no)
12446                 // result: (First no yes)
12447                 for b.Controls[0].Op == Op386FlagLT_ULT {
12448                         b.Reset(BlockFirst)
12449                         b.swapSuccessors()
12450                         return true
12451                 }
12452                 // match: (UGT (FlagLT_UGT) yes no)
12453                 // result: (First yes no)
12454                 for b.Controls[0].Op == Op386FlagLT_UGT {
12455                         b.Reset(BlockFirst)
12456                         return true
12457                 }
12458                 // match: (UGT (FlagGT_ULT) yes no)
12459                 // result: (First no yes)
12460                 for b.Controls[0].Op == Op386FlagGT_ULT {
12461                         b.Reset(BlockFirst)
12462                         b.swapSuccessors()
12463                         return true
12464                 }
12465                 // match: (UGT (FlagGT_UGT) yes no)
12466                 // result: (First yes no)
12467                 for b.Controls[0].Op == Op386FlagGT_UGT {
12468                         b.Reset(BlockFirst)
12469                         return true
12470                 }
12471         case Block386ULE:
12472                 // match: (ULE (InvertFlags cmp) yes no)
12473                 // result: (UGE cmp yes no)
12474                 for b.Controls[0].Op == Op386InvertFlags {
12475                         v_0 := b.Controls[0]
12476                         cmp := v_0.Args[0]
12477                         b.resetWithControl(Block386UGE, cmp)
12478                         return true
12479                 }
12480                 // match: (ULE (FlagEQ) yes no)
12481                 // result: (First yes no)
12482                 for b.Controls[0].Op == Op386FlagEQ {
12483                         b.Reset(BlockFirst)
12484                         return true
12485                 }
12486                 // match: (ULE (FlagLT_ULT) yes no)
12487                 // result: (First yes no)
12488                 for b.Controls[0].Op == Op386FlagLT_ULT {
12489                         b.Reset(BlockFirst)
12490                         return true
12491                 }
12492                 // match: (ULE (FlagLT_UGT) yes no)
12493                 // result: (First no yes)
12494                 for b.Controls[0].Op == Op386FlagLT_UGT {
12495                         b.Reset(BlockFirst)
12496                         b.swapSuccessors()
12497                         return true
12498                 }
12499                 // match: (ULE (FlagGT_ULT) yes no)
12500                 // result: (First yes no)
12501                 for b.Controls[0].Op == Op386FlagGT_ULT {
12502                         b.Reset(BlockFirst)
12503                         return true
12504                 }
12505                 // match: (ULE (FlagGT_UGT) yes no)
12506                 // result: (First no yes)
12507                 for b.Controls[0].Op == Op386FlagGT_UGT {
12508                         b.Reset(BlockFirst)
12509                         b.swapSuccessors()
12510                         return true
12511                 }
12512         case Block386ULT:
12513                 // match: (ULT (InvertFlags cmp) yes no)
12514                 // result: (UGT cmp yes no)
12515                 for b.Controls[0].Op == Op386InvertFlags {
12516                         v_0 := b.Controls[0]
12517                         cmp := v_0.Args[0]
12518                         b.resetWithControl(Block386UGT, cmp)
12519                         return true
12520                 }
12521                 // match: (ULT (FlagEQ) yes no)
12522                 // result: (First no yes)
12523                 for b.Controls[0].Op == Op386FlagEQ {
12524                         b.Reset(BlockFirst)
12525                         b.swapSuccessors()
12526                         return true
12527                 }
12528                 // match: (ULT (FlagLT_ULT) yes no)
12529                 // result: (First yes no)
12530                 for b.Controls[0].Op == Op386FlagLT_ULT {
12531                         b.Reset(BlockFirst)
12532                         return true
12533                 }
12534                 // match: (ULT (FlagLT_UGT) yes no)
12535                 // result: (First no yes)
12536                 for b.Controls[0].Op == Op386FlagLT_UGT {
12537                         b.Reset(BlockFirst)
12538                         b.swapSuccessors()
12539                         return true
12540                 }
12541                 // match: (ULT (FlagGT_ULT) yes no)
12542                 // result: (First yes no)
12543                 for b.Controls[0].Op == Op386FlagGT_ULT {
12544                         b.Reset(BlockFirst)
12545                         return true
12546                 }
12547                 // match: (ULT (FlagGT_UGT) yes no)
12548                 // result: (First no yes)
12549                 for b.Controls[0].Op == Op386FlagGT_UGT {
12550                         b.Reset(BlockFirst)
12551                         b.swapSuccessors()
12552                         return true
12553                 }
12554         }
12555         return false
12556 }