]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/compile/internal/ssa/rewritePPC64.go
f181d433cc042757b99f4145e5f73e8549f8bc6a
[gostls13.git] / src / cmd / compile / internal / ssa / rewritePPC64.go
1 // Code generated from gen/PPC64.rules; DO NOT EDIT.
2 // generated with: cd gen; go run *.go
3
4 package ssa
5
6 import "math"
7 import "cmd/internal/objabi"
8 import "cmd/compile/internal/types"
9
10 func rewriteValuePPC64(v *Value) bool {
11         switch v.Op {
12         case OpAbs:
13                 v.Op = OpPPC64FABS
14                 return true
15         case OpAdd16:
16                 v.Op = OpPPC64ADD
17                 return true
18         case OpAdd32:
19                 v.Op = OpPPC64ADD
20                 return true
21         case OpAdd32F:
22                 v.Op = OpPPC64FADDS
23                 return true
24         case OpAdd64:
25                 v.Op = OpPPC64ADD
26                 return true
27         case OpAdd64F:
28                 v.Op = OpPPC64FADD
29                 return true
30         case OpAdd64carry:
31                 v.Op = OpPPC64LoweredAdd64Carry
32                 return true
33         case OpAdd8:
34                 v.Op = OpPPC64ADD
35                 return true
36         case OpAddPtr:
37                 v.Op = OpPPC64ADD
38                 return true
39         case OpAddr:
40                 return rewriteValuePPC64_OpAddr(v)
41         case OpAnd16:
42                 v.Op = OpPPC64AND
43                 return true
44         case OpAnd32:
45                 v.Op = OpPPC64AND
46                 return true
47         case OpAnd64:
48                 v.Op = OpPPC64AND
49                 return true
50         case OpAnd8:
51                 v.Op = OpPPC64AND
52                 return true
53         case OpAndB:
54                 v.Op = OpPPC64AND
55                 return true
56         case OpAtomicAdd32:
57                 v.Op = OpPPC64LoweredAtomicAdd32
58                 return true
59         case OpAtomicAdd64:
60                 v.Op = OpPPC64LoweredAtomicAdd64
61                 return true
62         case OpAtomicAnd32:
63                 v.Op = OpPPC64LoweredAtomicAnd32
64                 return true
65         case OpAtomicAnd8:
66                 v.Op = OpPPC64LoweredAtomicAnd8
67                 return true
68         case OpAtomicCompareAndSwap32:
69                 return rewriteValuePPC64_OpAtomicCompareAndSwap32(v)
70         case OpAtomicCompareAndSwap64:
71                 return rewriteValuePPC64_OpAtomicCompareAndSwap64(v)
72         case OpAtomicCompareAndSwapRel32:
73                 return rewriteValuePPC64_OpAtomicCompareAndSwapRel32(v)
74         case OpAtomicExchange32:
75                 v.Op = OpPPC64LoweredAtomicExchange32
76                 return true
77         case OpAtomicExchange64:
78                 v.Op = OpPPC64LoweredAtomicExchange64
79                 return true
80         case OpAtomicLoad32:
81                 return rewriteValuePPC64_OpAtomicLoad32(v)
82         case OpAtomicLoad64:
83                 return rewriteValuePPC64_OpAtomicLoad64(v)
84         case OpAtomicLoad8:
85                 return rewriteValuePPC64_OpAtomicLoad8(v)
86         case OpAtomicLoadAcq32:
87                 return rewriteValuePPC64_OpAtomicLoadAcq32(v)
88         case OpAtomicLoadAcq64:
89                 return rewriteValuePPC64_OpAtomicLoadAcq64(v)
90         case OpAtomicLoadPtr:
91                 return rewriteValuePPC64_OpAtomicLoadPtr(v)
92         case OpAtomicOr32:
93                 v.Op = OpPPC64LoweredAtomicOr32
94                 return true
95         case OpAtomicOr8:
96                 v.Op = OpPPC64LoweredAtomicOr8
97                 return true
98         case OpAtomicStore32:
99                 return rewriteValuePPC64_OpAtomicStore32(v)
100         case OpAtomicStore64:
101                 return rewriteValuePPC64_OpAtomicStore64(v)
102         case OpAtomicStore8:
103                 return rewriteValuePPC64_OpAtomicStore8(v)
104         case OpAtomicStoreRel32:
105                 return rewriteValuePPC64_OpAtomicStoreRel32(v)
106         case OpAtomicStoreRel64:
107                 return rewriteValuePPC64_OpAtomicStoreRel64(v)
108         case OpAvg64u:
109                 return rewriteValuePPC64_OpAvg64u(v)
110         case OpBitLen32:
111                 return rewriteValuePPC64_OpBitLen32(v)
112         case OpBitLen64:
113                 return rewriteValuePPC64_OpBitLen64(v)
114         case OpCeil:
115                 v.Op = OpPPC64FCEIL
116                 return true
117         case OpClosureCall:
118                 v.Op = OpPPC64CALLclosure
119                 return true
120         case OpCom16:
121                 return rewriteValuePPC64_OpCom16(v)
122         case OpCom32:
123                 return rewriteValuePPC64_OpCom32(v)
124         case OpCom64:
125                 return rewriteValuePPC64_OpCom64(v)
126         case OpCom8:
127                 return rewriteValuePPC64_OpCom8(v)
128         case OpCondSelect:
129                 return rewriteValuePPC64_OpCondSelect(v)
130         case OpConst16:
131                 return rewriteValuePPC64_OpConst16(v)
132         case OpConst32:
133                 return rewriteValuePPC64_OpConst32(v)
134         case OpConst32F:
135                 v.Op = OpPPC64FMOVSconst
136                 return true
137         case OpConst64:
138                 return rewriteValuePPC64_OpConst64(v)
139         case OpConst64F:
140                 v.Op = OpPPC64FMOVDconst
141                 return true
142         case OpConst8:
143                 return rewriteValuePPC64_OpConst8(v)
144         case OpConstBool:
145                 return rewriteValuePPC64_OpConstBool(v)
146         case OpConstNil:
147                 return rewriteValuePPC64_OpConstNil(v)
148         case OpCopysign:
149                 return rewriteValuePPC64_OpCopysign(v)
150         case OpCtz16:
151                 return rewriteValuePPC64_OpCtz16(v)
152         case OpCtz32:
153                 return rewriteValuePPC64_OpCtz32(v)
154         case OpCtz32NonZero:
155                 v.Op = OpCtz32
156                 return true
157         case OpCtz64:
158                 return rewriteValuePPC64_OpCtz64(v)
159         case OpCtz64NonZero:
160                 v.Op = OpCtz64
161                 return true
162         case OpCtz8:
163                 return rewriteValuePPC64_OpCtz8(v)
164         case OpCvt32Fto32:
165                 return rewriteValuePPC64_OpCvt32Fto32(v)
166         case OpCvt32Fto64:
167                 return rewriteValuePPC64_OpCvt32Fto64(v)
168         case OpCvt32Fto64F:
169                 v.Op = OpCopy
170                 return true
171         case OpCvt32to32F:
172                 return rewriteValuePPC64_OpCvt32to32F(v)
173         case OpCvt32to64F:
174                 return rewriteValuePPC64_OpCvt32to64F(v)
175         case OpCvt64Fto32:
176                 return rewriteValuePPC64_OpCvt64Fto32(v)
177         case OpCvt64Fto32F:
178                 v.Op = OpPPC64FRSP
179                 return true
180         case OpCvt64Fto64:
181                 return rewriteValuePPC64_OpCvt64Fto64(v)
182         case OpCvt64to32F:
183                 return rewriteValuePPC64_OpCvt64to32F(v)
184         case OpCvt64to64F:
185                 return rewriteValuePPC64_OpCvt64to64F(v)
186         case OpCvtBoolToUint8:
187                 v.Op = OpCopy
188                 return true
189         case OpDiv16:
190                 return rewriteValuePPC64_OpDiv16(v)
191         case OpDiv16u:
192                 return rewriteValuePPC64_OpDiv16u(v)
193         case OpDiv32:
194                 return rewriteValuePPC64_OpDiv32(v)
195         case OpDiv32F:
196                 v.Op = OpPPC64FDIVS
197                 return true
198         case OpDiv32u:
199                 v.Op = OpPPC64DIVWU
200                 return true
201         case OpDiv64:
202                 return rewriteValuePPC64_OpDiv64(v)
203         case OpDiv64F:
204                 v.Op = OpPPC64FDIV
205                 return true
206         case OpDiv64u:
207                 v.Op = OpPPC64DIVDU
208                 return true
209         case OpDiv8:
210                 return rewriteValuePPC64_OpDiv8(v)
211         case OpDiv8u:
212                 return rewriteValuePPC64_OpDiv8u(v)
213         case OpEq16:
214                 return rewriteValuePPC64_OpEq16(v)
215         case OpEq32:
216                 return rewriteValuePPC64_OpEq32(v)
217         case OpEq32F:
218                 return rewriteValuePPC64_OpEq32F(v)
219         case OpEq64:
220                 return rewriteValuePPC64_OpEq64(v)
221         case OpEq64F:
222                 return rewriteValuePPC64_OpEq64F(v)
223         case OpEq8:
224                 return rewriteValuePPC64_OpEq8(v)
225         case OpEqB:
226                 return rewriteValuePPC64_OpEqB(v)
227         case OpEqPtr:
228                 return rewriteValuePPC64_OpEqPtr(v)
229         case OpFMA:
230                 v.Op = OpPPC64FMADD
231                 return true
232         case OpFloor:
233                 v.Op = OpPPC64FFLOOR
234                 return true
235         case OpGetCallerPC:
236                 v.Op = OpPPC64LoweredGetCallerPC
237                 return true
238         case OpGetCallerSP:
239                 v.Op = OpPPC64LoweredGetCallerSP
240                 return true
241         case OpGetClosurePtr:
242                 v.Op = OpPPC64LoweredGetClosurePtr
243                 return true
244         case OpHmul32:
245                 v.Op = OpPPC64MULHW
246                 return true
247         case OpHmul32u:
248                 v.Op = OpPPC64MULHWU
249                 return true
250         case OpHmul64:
251                 v.Op = OpPPC64MULHD
252                 return true
253         case OpHmul64u:
254                 v.Op = OpPPC64MULHDU
255                 return true
256         case OpInterCall:
257                 v.Op = OpPPC64CALLinter
258                 return true
259         case OpIsInBounds:
260                 return rewriteValuePPC64_OpIsInBounds(v)
261         case OpIsNonNil:
262                 return rewriteValuePPC64_OpIsNonNil(v)
263         case OpIsSliceInBounds:
264                 return rewriteValuePPC64_OpIsSliceInBounds(v)
265         case OpLeq16:
266                 return rewriteValuePPC64_OpLeq16(v)
267         case OpLeq16U:
268                 return rewriteValuePPC64_OpLeq16U(v)
269         case OpLeq32:
270                 return rewriteValuePPC64_OpLeq32(v)
271         case OpLeq32F:
272                 return rewriteValuePPC64_OpLeq32F(v)
273         case OpLeq32U:
274                 return rewriteValuePPC64_OpLeq32U(v)
275         case OpLeq64:
276                 return rewriteValuePPC64_OpLeq64(v)
277         case OpLeq64F:
278                 return rewriteValuePPC64_OpLeq64F(v)
279         case OpLeq64U:
280                 return rewriteValuePPC64_OpLeq64U(v)
281         case OpLeq8:
282                 return rewriteValuePPC64_OpLeq8(v)
283         case OpLeq8U:
284                 return rewriteValuePPC64_OpLeq8U(v)
285         case OpLess16:
286                 return rewriteValuePPC64_OpLess16(v)
287         case OpLess16U:
288                 return rewriteValuePPC64_OpLess16U(v)
289         case OpLess32:
290                 return rewriteValuePPC64_OpLess32(v)
291         case OpLess32F:
292                 return rewriteValuePPC64_OpLess32F(v)
293         case OpLess32U:
294                 return rewriteValuePPC64_OpLess32U(v)
295         case OpLess64:
296                 return rewriteValuePPC64_OpLess64(v)
297         case OpLess64F:
298                 return rewriteValuePPC64_OpLess64F(v)
299         case OpLess64U:
300                 return rewriteValuePPC64_OpLess64U(v)
301         case OpLess8:
302                 return rewriteValuePPC64_OpLess8(v)
303         case OpLess8U:
304                 return rewriteValuePPC64_OpLess8U(v)
305         case OpLoad:
306                 return rewriteValuePPC64_OpLoad(v)
307         case OpLocalAddr:
308                 return rewriteValuePPC64_OpLocalAddr(v)
309         case OpLsh16x16:
310                 return rewriteValuePPC64_OpLsh16x16(v)
311         case OpLsh16x32:
312                 return rewriteValuePPC64_OpLsh16x32(v)
313         case OpLsh16x64:
314                 return rewriteValuePPC64_OpLsh16x64(v)
315         case OpLsh16x8:
316                 return rewriteValuePPC64_OpLsh16x8(v)
317         case OpLsh32x16:
318                 return rewriteValuePPC64_OpLsh32x16(v)
319         case OpLsh32x32:
320                 return rewriteValuePPC64_OpLsh32x32(v)
321         case OpLsh32x64:
322                 return rewriteValuePPC64_OpLsh32x64(v)
323         case OpLsh32x8:
324                 return rewriteValuePPC64_OpLsh32x8(v)
325         case OpLsh64x16:
326                 return rewriteValuePPC64_OpLsh64x16(v)
327         case OpLsh64x32:
328                 return rewriteValuePPC64_OpLsh64x32(v)
329         case OpLsh64x64:
330                 return rewriteValuePPC64_OpLsh64x64(v)
331         case OpLsh64x8:
332                 return rewriteValuePPC64_OpLsh64x8(v)
333         case OpLsh8x16:
334                 return rewriteValuePPC64_OpLsh8x16(v)
335         case OpLsh8x32:
336                 return rewriteValuePPC64_OpLsh8x32(v)
337         case OpLsh8x64:
338                 return rewriteValuePPC64_OpLsh8x64(v)
339         case OpLsh8x8:
340                 return rewriteValuePPC64_OpLsh8x8(v)
341         case OpMod16:
342                 return rewriteValuePPC64_OpMod16(v)
343         case OpMod16u:
344                 return rewriteValuePPC64_OpMod16u(v)
345         case OpMod32:
346                 return rewriteValuePPC64_OpMod32(v)
347         case OpMod32u:
348                 return rewriteValuePPC64_OpMod32u(v)
349         case OpMod64:
350                 return rewriteValuePPC64_OpMod64(v)
351         case OpMod64u:
352                 return rewriteValuePPC64_OpMod64u(v)
353         case OpMod8:
354                 return rewriteValuePPC64_OpMod8(v)
355         case OpMod8u:
356                 return rewriteValuePPC64_OpMod8u(v)
357         case OpMove:
358                 return rewriteValuePPC64_OpMove(v)
359         case OpMul16:
360                 v.Op = OpPPC64MULLW
361                 return true
362         case OpMul32:
363                 v.Op = OpPPC64MULLW
364                 return true
365         case OpMul32F:
366                 v.Op = OpPPC64FMULS
367                 return true
368         case OpMul64:
369                 v.Op = OpPPC64MULLD
370                 return true
371         case OpMul64F:
372                 v.Op = OpPPC64FMUL
373                 return true
374         case OpMul64uhilo:
375                 v.Op = OpPPC64LoweredMuluhilo
376                 return true
377         case OpMul8:
378                 v.Op = OpPPC64MULLW
379                 return true
380         case OpNeg16:
381                 v.Op = OpPPC64NEG
382                 return true
383         case OpNeg32:
384                 v.Op = OpPPC64NEG
385                 return true
386         case OpNeg32F:
387                 v.Op = OpPPC64FNEG
388                 return true
389         case OpNeg64:
390                 v.Op = OpPPC64NEG
391                 return true
392         case OpNeg64F:
393                 v.Op = OpPPC64FNEG
394                 return true
395         case OpNeg8:
396                 v.Op = OpPPC64NEG
397                 return true
398         case OpNeq16:
399                 return rewriteValuePPC64_OpNeq16(v)
400         case OpNeq32:
401                 return rewriteValuePPC64_OpNeq32(v)
402         case OpNeq32F:
403                 return rewriteValuePPC64_OpNeq32F(v)
404         case OpNeq64:
405                 return rewriteValuePPC64_OpNeq64(v)
406         case OpNeq64F:
407                 return rewriteValuePPC64_OpNeq64F(v)
408         case OpNeq8:
409                 return rewriteValuePPC64_OpNeq8(v)
410         case OpNeqB:
411                 v.Op = OpPPC64XOR
412                 return true
413         case OpNeqPtr:
414                 return rewriteValuePPC64_OpNeqPtr(v)
415         case OpNilCheck:
416                 v.Op = OpPPC64LoweredNilCheck
417                 return true
418         case OpNot:
419                 return rewriteValuePPC64_OpNot(v)
420         case OpOffPtr:
421                 return rewriteValuePPC64_OpOffPtr(v)
422         case OpOr16:
423                 v.Op = OpPPC64OR
424                 return true
425         case OpOr32:
426                 v.Op = OpPPC64OR
427                 return true
428         case OpOr64:
429                 v.Op = OpPPC64OR
430                 return true
431         case OpOr8:
432                 v.Op = OpPPC64OR
433                 return true
434         case OpOrB:
435                 v.Op = OpPPC64OR
436                 return true
437         case OpPPC64ADD:
438                 return rewriteValuePPC64_OpPPC64ADD(v)
439         case OpPPC64ADDconst:
440                 return rewriteValuePPC64_OpPPC64ADDconst(v)
441         case OpPPC64AND:
442                 return rewriteValuePPC64_OpPPC64AND(v)
443         case OpPPC64ANDN:
444                 return rewriteValuePPC64_OpPPC64ANDN(v)
445         case OpPPC64ANDconst:
446                 return rewriteValuePPC64_OpPPC64ANDconst(v)
447         case OpPPC64CLRLSLDI:
448                 return rewriteValuePPC64_OpPPC64CLRLSLDI(v)
449         case OpPPC64CMP:
450                 return rewriteValuePPC64_OpPPC64CMP(v)
451         case OpPPC64CMPU:
452                 return rewriteValuePPC64_OpPPC64CMPU(v)
453         case OpPPC64CMPUconst:
454                 return rewriteValuePPC64_OpPPC64CMPUconst(v)
455         case OpPPC64CMPW:
456                 return rewriteValuePPC64_OpPPC64CMPW(v)
457         case OpPPC64CMPWU:
458                 return rewriteValuePPC64_OpPPC64CMPWU(v)
459         case OpPPC64CMPWUconst:
460                 return rewriteValuePPC64_OpPPC64CMPWUconst(v)
461         case OpPPC64CMPWconst:
462                 return rewriteValuePPC64_OpPPC64CMPWconst(v)
463         case OpPPC64CMPconst:
464                 return rewriteValuePPC64_OpPPC64CMPconst(v)
465         case OpPPC64Equal:
466                 return rewriteValuePPC64_OpPPC64Equal(v)
467         case OpPPC64FABS:
468                 return rewriteValuePPC64_OpPPC64FABS(v)
469         case OpPPC64FADD:
470                 return rewriteValuePPC64_OpPPC64FADD(v)
471         case OpPPC64FADDS:
472                 return rewriteValuePPC64_OpPPC64FADDS(v)
473         case OpPPC64FCEIL:
474                 return rewriteValuePPC64_OpPPC64FCEIL(v)
475         case OpPPC64FFLOOR:
476                 return rewriteValuePPC64_OpPPC64FFLOOR(v)
477         case OpPPC64FGreaterEqual:
478                 return rewriteValuePPC64_OpPPC64FGreaterEqual(v)
479         case OpPPC64FGreaterThan:
480                 return rewriteValuePPC64_OpPPC64FGreaterThan(v)
481         case OpPPC64FLessEqual:
482                 return rewriteValuePPC64_OpPPC64FLessEqual(v)
483         case OpPPC64FLessThan:
484                 return rewriteValuePPC64_OpPPC64FLessThan(v)
485         case OpPPC64FMOVDload:
486                 return rewriteValuePPC64_OpPPC64FMOVDload(v)
487         case OpPPC64FMOVDstore:
488                 return rewriteValuePPC64_OpPPC64FMOVDstore(v)
489         case OpPPC64FMOVSload:
490                 return rewriteValuePPC64_OpPPC64FMOVSload(v)
491         case OpPPC64FMOVSstore:
492                 return rewriteValuePPC64_OpPPC64FMOVSstore(v)
493         case OpPPC64FNEG:
494                 return rewriteValuePPC64_OpPPC64FNEG(v)
495         case OpPPC64FSQRT:
496                 return rewriteValuePPC64_OpPPC64FSQRT(v)
497         case OpPPC64FSUB:
498                 return rewriteValuePPC64_OpPPC64FSUB(v)
499         case OpPPC64FSUBS:
500                 return rewriteValuePPC64_OpPPC64FSUBS(v)
501         case OpPPC64FTRUNC:
502                 return rewriteValuePPC64_OpPPC64FTRUNC(v)
503         case OpPPC64GreaterEqual:
504                 return rewriteValuePPC64_OpPPC64GreaterEqual(v)
505         case OpPPC64GreaterThan:
506                 return rewriteValuePPC64_OpPPC64GreaterThan(v)
507         case OpPPC64ISEL:
508                 return rewriteValuePPC64_OpPPC64ISEL(v)
509         case OpPPC64ISELB:
510                 return rewriteValuePPC64_OpPPC64ISELB(v)
511         case OpPPC64LessEqual:
512                 return rewriteValuePPC64_OpPPC64LessEqual(v)
513         case OpPPC64LessThan:
514                 return rewriteValuePPC64_OpPPC64LessThan(v)
515         case OpPPC64MFVSRD:
516                 return rewriteValuePPC64_OpPPC64MFVSRD(v)
517         case OpPPC64MOVBZload:
518                 return rewriteValuePPC64_OpPPC64MOVBZload(v)
519         case OpPPC64MOVBZloadidx:
520                 return rewriteValuePPC64_OpPPC64MOVBZloadidx(v)
521         case OpPPC64MOVBZreg:
522                 return rewriteValuePPC64_OpPPC64MOVBZreg(v)
523         case OpPPC64MOVBreg:
524                 return rewriteValuePPC64_OpPPC64MOVBreg(v)
525         case OpPPC64MOVBstore:
526                 return rewriteValuePPC64_OpPPC64MOVBstore(v)
527         case OpPPC64MOVBstoreidx:
528                 return rewriteValuePPC64_OpPPC64MOVBstoreidx(v)
529         case OpPPC64MOVBstorezero:
530                 return rewriteValuePPC64_OpPPC64MOVBstorezero(v)
531         case OpPPC64MOVDload:
532                 return rewriteValuePPC64_OpPPC64MOVDload(v)
533         case OpPPC64MOVDloadidx:
534                 return rewriteValuePPC64_OpPPC64MOVDloadidx(v)
535         case OpPPC64MOVDstore:
536                 return rewriteValuePPC64_OpPPC64MOVDstore(v)
537         case OpPPC64MOVDstoreidx:
538                 return rewriteValuePPC64_OpPPC64MOVDstoreidx(v)
539         case OpPPC64MOVDstorezero:
540                 return rewriteValuePPC64_OpPPC64MOVDstorezero(v)
541         case OpPPC64MOVHBRstore:
542                 return rewriteValuePPC64_OpPPC64MOVHBRstore(v)
543         case OpPPC64MOVHZload:
544                 return rewriteValuePPC64_OpPPC64MOVHZload(v)
545         case OpPPC64MOVHZloadidx:
546                 return rewriteValuePPC64_OpPPC64MOVHZloadidx(v)
547         case OpPPC64MOVHZreg:
548                 return rewriteValuePPC64_OpPPC64MOVHZreg(v)
549         case OpPPC64MOVHload:
550                 return rewriteValuePPC64_OpPPC64MOVHload(v)
551         case OpPPC64MOVHloadidx:
552                 return rewriteValuePPC64_OpPPC64MOVHloadidx(v)
553         case OpPPC64MOVHreg:
554                 return rewriteValuePPC64_OpPPC64MOVHreg(v)
555         case OpPPC64MOVHstore:
556                 return rewriteValuePPC64_OpPPC64MOVHstore(v)
557         case OpPPC64MOVHstoreidx:
558                 return rewriteValuePPC64_OpPPC64MOVHstoreidx(v)
559         case OpPPC64MOVHstorezero:
560                 return rewriteValuePPC64_OpPPC64MOVHstorezero(v)
561         case OpPPC64MOVWBRstore:
562                 return rewriteValuePPC64_OpPPC64MOVWBRstore(v)
563         case OpPPC64MOVWZload:
564                 return rewriteValuePPC64_OpPPC64MOVWZload(v)
565         case OpPPC64MOVWZloadidx:
566                 return rewriteValuePPC64_OpPPC64MOVWZloadidx(v)
567         case OpPPC64MOVWZreg:
568                 return rewriteValuePPC64_OpPPC64MOVWZreg(v)
569         case OpPPC64MOVWload:
570                 return rewriteValuePPC64_OpPPC64MOVWload(v)
571         case OpPPC64MOVWloadidx:
572                 return rewriteValuePPC64_OpPPC64MOVWloadidx(v)
573         case OpPPC64MOVWreg:
574                 return rewriteValuePPC64_OpPPC64MOVWreg(v)
575         case OpPPC64MOVWstore:
576                 return rewriteValuePPC64_OpPPC64MOVWstore(v)
577         case OpPPC64MOVWstoreidx:
578                 return rewriteValuePPC64_OpPPC64MOVWstoreidx(v)
579         case OpPPC64MOVWstorezero:
580                 return rewriteValuePPC64_OpPPC64MOVWstorezero(v)
581         case OpPPC64MTVSRD:
582                 return rewriteValuePPC64_OpPPC64MTVSRD(v)
583         case OpPPC64MULLD:
584                 return rewriteValuePPC64_OpPPC64MULLD(v)
585         case OpPPC64MULLW:
586                 return rewriteValuePPC64_OpPPC64MULLW(v)
587         case OpPPC64NEG:
588                 return rewriteValuePPC64_OpPPC64NEG(v)
589         case OpPPC64NOR:
590                 return rewriteValuePPC64_OpPPC64NOR(v)
591         case OpPPC64NotEqual:
592                 return rewriteValuePPC64_OpPPC64NotEqual(v)
593         case OpPPC64OR:
594                 return rewriteValuePPC64_OpPPC64OR(v)
595         case OpPPC64ORN:
596                 return rewriteValuePPC64_OpPPC64ORN(v)
597         case OpPPC64ORconst:
598                 return rewriteValuePPC64_OpPPC64ORconst(v)
599         case OpPPC64ROTL:
600                 return rewriteValuePPC64_OpPPC64ROTL(v)
601         case OpPPC64ROTLW:
602                 return rewriteValuePPC64_OpPPC64ROTLW(v)
603         case OpPPC64ROTLWconst:
604                 return rewriteValuePPC64_OpPPC64ROTLWconst(v)
605         case OpPPC64SLD:
606                 return rewriteValuePPC64_OpPPC64SLD(v)
607         case OpPPC64SLDconst:
608                 return rewriteValuePPC64_OpPPC64SLDconst(v)
609         case OpPPC64SLW:
610                 return rewriteValuePPC64_OpPPC64SLW(v)
611         case OpPPC64SLWconst:
612                 return rewriteValuePPC64_OpPPC64SLWconst(v)
613         case OpPPC64SRAD:
614                 return rewriteValuePPC64_OpPPC64SRAD(v)
615         case OpPPC64SRAW:
616                 return rewriteValuePPC64_OpPPC64SRAW(v)
617         case OpPPC64SRD:
618                 return rewriteValuePPC64_OpPPC64SRD(v)
619         case OpPPC64SRW:
620                 return rewriteValuePPC64_OpPPC64SRW(v)
621         case OpPPC64SRWconst:
622                 return rewriteValuePPC64_OpPPC64SRWconst(v)
623         case OpPPC64SUB:
624                 return rewriteValuePPC64_OpPPC64SUB(v)
625         case OpPPC64SUBFCconst:
626                 return rewriteValuePPC64_OpPPC64SUBFCconst(v)
627         case OpPPC64XOR:
628                 return rewriteValuePPC64_OpPPC64XOR(v)
629         case OpPPC64XORconst:
630                 return rewriteValuePPC64_OpPPC64XORconst(v)
631         case OpPanicBounds:
632                 return rewriteValuePPC64_OpPanicBounds(v)
633         case OpPopCount16:
634                 return rewriteValuePPC64_OpPopCount16(v)
635         case OpPopCount32:
636                 return rewriteValuePPC64_OpPopCount32(v)
637         case OpPopCount64:
638                 v.Op = OpPPC64POPCNTD
639                 return true
640         case OpPopCount8:
641                 return rewriteValuePPC64_OpPopCount8(v)
642         case OpRotateLeft16:
643                 return rewriteValuePPC64_OpRotateLeft16(v)
644         case OpRotateLeft32:
645                 return rewriteValuePPC64_OpRotateLeft32(v)
646         case OpRotateLeft64:
647                 return rewriteValuePPC64_OpRotateLeft64(v)
648         case OpRotateLeft8:
649                 return rewriteValuePPC64_OpRotateLeft8(v)
650         case OpRound:
651                 v.Op = OpPPC64FROUND
652                 return true
653         case OpRound32F:
654                 v.Op = OpPPC64LoweredRound32F
655                 return true
656         case OpRound64F:
657                 v.Op = OpPPC64LoweredRound64F
658                 return true
659         case OpRsh16Ux16:
660                 return rewriteValuePPC64_OpRsh16Ux16(v)
661         case OpRsh16Ux32:
662                 return rewriteValuePPC64_OpRsh16Ux32(v)
663         case OpRsh16Ux64:
664                 return rewriteValuePPC64_OpRsh16Ux64(v)
665         case OpRsh16Ux8:
666                 return rewriteValuePPC64_OpRsh16Ux8(v)
667         case OpRsh16x16:
668                 return rewriteValuePPC64_OpRsh16x16(v)
669         case OpRsh16x32:
670                 return rewriteValuePPC64_OpRsh16x32(v)
671         case OpRsh16x64:
672                 return rewriteValuePPC64_OpRsh16x64(v)
673         case OpRsh16x8:
674                 return rewriteValuePPC64_OpRsh16x8(v)
675         case OpRsh32Ux16:
676                 return rewriteValuePPC64_OpRsh32Ux16(v)
677         case OpRsh32Ux32:
678                 return rewriteValuePPC64_OpRsh32Ux32(v)
679         case OpRsh32Ux64:
680                 return rewriteValuePPC64_OpRsh32Ux64(v)
681         case OpRsh32Ux8:
682                 return rewriteValuePPC64_OpRsh32Ux8(v)
683         case OpRsh32x16:
684                 return rewriteValuePPC64_OpRsh32x16(v)
685         case OpRsh32x32:
686                 return rewriteValuePPC64_OpRsh32x32(v)
687         case OpRsh32x64:
688                 return rewriteValuePPC64_OpRsh32x64(v)
689         case OpRsh32x8:
690                 return rewriteValuePPC64_OpRsh32x8(v)
691         case OpRsh64Ux16:
692                 return rewriteValuePPC64_OpRsh64Ux16(v)
693         case OpRsh64Ux32:
694                 return rewriteValuePPC64_OpRsh64Ux32(v)
695         case OpRsh64Ux64:
696                 return rewriteValuePPC64_OpRsh64Ux64(v)
697         case OpRsh64Ux8:
698                 return rewriteValuePPC64_OpRsh64Ux8(v)
699         case OpRsh64x16:
700                 return rewriteValuePPC64_OpRsh64x16(v)
701         case OpRsh64x32:
702                 return rewriteValuePPC64_OpRsh64x32(v)
703         case OpRsh64x64:
704                 return rewriteValuePPC64_OpRsh64x64(v)
705         case OpRsh64x8:
706                 return rewriteValuePPC64_OpRsh64x8(v)
707         case OpRsh8Ux16:
708                 return rewriteValuePPC64_OpRsh8Ux16(v)
709         case OpRsh8Ux32:
710                 return rewriteValuePPC64_OpRsh8Ux32(v)
711         case OpRsh8Ux64:
712                 return rewriteValuePPC64_OpRsh8Ux64(v)
713         case OpRsh8Ux8:
714                 return rewriteValuePPC64_OpRsh8Ux8(v)
715         case OpRsh8x16:
716                 return rewriteValuePPC64_OpRsh8x16(v)
717         case OpRsh8x32:
718                 return rewriteValuePPC64_OpRsh8x32(v)
719         case OpRsh8x64:
720                 return rewriteValuePPC64_OpRsh8x64(v)
721         case OpRsh8x8:
722                 return rewriteValuePPC64_OpRsh8x8(v)
723         case OpSignExt16to32:
724                 v.Op = OpPPC64MOVHreg
725                 return true
726         case OpSignExt16to64:
727                 v.Op = OpPPC64MOVHreg
728                 return true
729         case OpSignExt32to64:
730                 v.Op = OpPPC64MOVWreg
731                 return true
732         case OpSignExt8to16:
733                 v.Op = OpPPC64MOVBreg
734                 return true
735         case OpSignExt8to32:
736                 v.Op = OpPPC64MOVBreg
737                 return true
738         case OpSignExt8to64:
739                 v.Op = OpPPC64MOVBreg
740                 return true
741         case OpSlicemask:
742                 return rewriteValuePPC64_OpSlicemask(v)
743         case OpSqrt:
744                 v.Op = OpPPC64FSQRT
745                 return true
746         case OpSqrt32:
747                 v.Op = OpPPC64FSQRTS
748                 return true
749         case OpStaticCall:
750                 v.Op = OpPPC64CALLstatic
751                 return true
752         case OpStore:
753                 return rewriteValuePPC64_OpStore(v)
754         case OpSub16:
755                 v.Op = OpPPC64SUB
756                 return true
757         case OpSub32:
758                 v.Op = OpPPC64SUB
759                 return true
760         case OpSub32F:
761                 v.Op = OpPPC64FSUBS
762                 return true
763         case OpSub64:
764                 v.Op = OpPPC64SUB
765                 return true
766         case OpSub64F:
767                 v.Op = OpPPC64FSUB
768                 return true
769         case OpSub8:
770                 v.Op = OpPPC64SUB
771                 return true
772         case OpSubPtr:
773                 v.Op = OpPPC64SUB
774                 return true
775         case OpTrunc:
776                 v.Op = OpPPC64FTRUNC
777                 return true
778         case OpTrunc16to8:
779                 return rewriteValuePPC64_OpTrunc16to8(v)
780         case OpTrunc32to16:
781                 return rewriteValuePPC64_OpTrunc32to16(v)
782         case OpTrunc32to8:
783                 return rewriteValuePPC64_OpTrunc32to8(v)
784         case OpTrunc64to16:
785                 return rewriteValuePPC64_OpTrunc64to16(v)
786         case OpTrunc64to32:
787                 return rewriteValuePPC64_OpTrunc64to32(v)
788         case OpTrunc64to8:
789                 return rewriteValuePPC64_OpTrunc64to8(v)
790         case OpWB:
791                 v.Op = OpPPC64LoweredWB
792                 return true
793         case OpXor16:
794                 v.Op = OpPPC64XOR
795                 return true
796         case OpXor32:
797                 v.Op = OpPPC64XOR
798                 return true
799         case OpXor64:
800                 v.Op = OpPPC64XOR
801                 return true
802         case OpXor8:
803                 v.Op = OpPPC64XOR
804                 return true
805         case OpZero:
806                 return rewriteValuePPC64_OpZero(v)
807         case OpZeroExt16to32:
808                 v.Op = OpPPC64MOVHZreg
809                 return true
810         case OpZeroExt16to64:
811                 v.Op = OpPPC64MOVHZreg
812                 return true
813         case OpZeroExt32to64:
814                 v.Op = OpPPC64MOVWZreg
815                 return true
816         case OpZeroExt8to16:
817                 v.Op = OpPPC64MOVBZreg
818                 return true
819         case OpZeroExt8to32:
820                 v.Op = OpPPC64MOVBZreg
821                 return true
822         case OpZeroExt8to64:
823                 v.Op = OpPPC64MOVBZreg
824                 return true
825         }
826         return false
827 }
828 func rewriteValuePPC64_OpAddr(v *Value) bool {
829         v_0 := v.Args[0]
830         // match: (Addr {sym} base)
831         // result: (MOVDaddr {sym} [0] base)
832         for {
833                 sym := auxToSym(v.Aux)
834                 base := v_0
835                 v.reset(OpPPC64MOVDaddr)
836                 v.AuxInt = int32ToAuxInt(0)
837                 v.Aux = symToAux(sym)
838                 v.AddArg(base)
839                 return true
840         }
841 }
842 func rewriteValuePPC64_OpAtomicCompareAndSwap32(v *Value) bool {
843         v_3 := v.Args[3]
844         v_2 := v.Args[2]
845         v_1 := v.Args[1]
846         v_0 := v.Args[0]
847         // match: (AtomicCompareAndSwap32 ptr old new_ mem)
848         // result: (LoweredAtomicCas32 [1] ptr old new_ mem)
849         for {
850                 ptr := v_0
851                 old := v_1
852                 new_ := v_2
853                 mem := v_3
854                 v.reset(OpPPC64LoweredAtomicCas32)
855                 v.AuxInt = int64ToAuxInt(1)
856                 v.AddArg4(ptr, old, new_, mem)
857                 return true
858         }
859 }
860 func rewriteValuePPC64_OpAtomicCompareAndSwap64(v *Value) bool {
861         v_3 := v.Args[3]
862         v_2 := v.Args[2]
863         v_1 := v.Args[1]
864         v_0 := v.Args[0]
865         // match: (AtomicCompareAndSwap64 ptr old new_ mem)
866         // result: (LoweredAtomicCas64 [1] ptr old new_ mem)
867         for {
868                 ptr := v_0
869                 old := v_1
870                 new_ := v_2
871                 mem := v_3
872                 v.reset(OpPPC64LoweredAtomicCas64)
873                 v.AuxInt = int64ToAuxInt(1)
874                 v.AddArg4(ptr, old, new_, mem)
875                 return true
876         }
877 }
878 func rewriteValuePPC64_OpAtomicCompareAndSwapRel32(v *Value) bool {
879         v_3 := v.Args[3]
880         v_2 := v.Args[2]
881         v_1 := v.Args[1]
882         v_0 := v.Args[0]
883         // match: (AtomicCompareAndSwapRel32 ptr old new_ mem)
884         // result: (LoweredAtomicCas32 [0] ptr old new_ mem)
885         for {
886                 ptr := v_0
887                 old := v_1
888                 new_ := v_2
889                 mem := v_3
890                 v.reset(OpPPC64LoweredAtomicCas32)
891                 v.AuxInt = int64ToAuxInt(0)
892                 v.AddArg4(ptr, old, new_, mem)
893                 return true
894         }
895 }
896 func rewriteValuePPC64_OpAtomicLoad32(v *Value) bool {
897         v_1 := v.Args[1]
898         v_0 := v.Args[0]
899         // match: (AtomicLoad32 ptr mem)
900         // result: (LoweredAtomicLoad32 [1] ptr mem)
901         for {
902                 ptr := v_0
903                 mem := v_1
904                 v.reset(OpPPC64LoweredAtomicLoad32)
905                 v.AuxInt = int64ToAuxInt(1)
906                 v.AddArg2(ptr, mem)
907                 return true
908         }
909 }
910 func rewriteValuePPC64_OpAtomicLoad64(v *Value) bool {
911         v_1 := v.Args[1]
912         v_0 := v.Args[0]
913         // match: (AtomicLoad64 ptr mem)
914         // result: (LoweredAtomicLoad64 [1] ptr mem)
915         for {
916                 ptr := v_0
917                 mem := v_1
918                 v.reset(OpPPC64LoweredAtomicLoad64)
919                 v.AuxInt = int64ToAuxInt(1)
920                 v.AddArg2(ptr, mem)
921                 return true
922         }
923 }
924 func rewriteValuePPC64_OpAtomicLoad8(v *Value) bool {
925         v_1 := v.Args[1]
926         v_0 := v.Args[0]
927         // match: (AtomicLoad8 ptr mem)
928         // result: (LoweredAtomicLoad8 [1] ptr mem)
929         for {
930                 ptr := v_0
931                 mem := v_1
932                 v.reset(OpPPC64LoweredAtomicLoad8)
933                 v.AuxInt = int64ToAuxInt(1)
934                 v.AddArg2(ptr, mem)
935                 return true
936         }
937 }
938 func rewriteValuePPC64_OpAtomicLoadAcq32(v *Value) bool {
939         v_1 := v.Args[1]
940         v_0 := v.Args[0]
941         // match: (AtomicLoadAcq32 ptr mem)
942         // result: (LoweredAtomicLoad32 [0] ptr mem)
943         for {
944                 ptr := v_0
945                 mem := v_1
946                 v.reset(OpPPC64LoweredAtomicLoad32)
947                 v.AuxInt = int64ToAuxInt(0)
948                 v.AddArg2(ptr, mem)
949                 return true
950         }
951 }
952 func rewriteValuePPC64_OpAtomicLoadAcq64(v *Value) bool {
953         v_1 := v.Args[1]
954         v_0 := v.Args[0]
955         // match: (AtomicLoadAcq64 ptr mem)
956         // result: (LoweredAtomicLoad64 [0] ptr mem)
957         for {
958                 ptr := v_0
959                 mem := v_1
960                 v.reset(OpPPC64LoweredAtomicLoad64)
961                 v.AuxInt = int64ToAuxInt(0)
962                 v.AddArg2(ptr, mem)
963                 return true
964         }
965 }
966 func rewriteValuePPC64_OpAtomicLoadPtr(v *Value) bool {
967         v_1 := v.Args[1]
968         v_0 := v.Args[0]
969         // match: (AtomicLoadPtr ptr mem)
970         // result: (LoweredAtomicLoadPtr [1] ptr mem)
971         for {
972                 ptr := v_0
973                 mem := v_1
974                 v.reset(OpPPC64LoweredAtomicLoadPtr)
975                 v.AuxInt = int64ToAuxInt(1)
976                 v.AddArg2(ptr, mem)
977                 return true
978         }
979 }
980 func rewriteValuePPC64_OpAtomicStore32(v *Value) bool {
981         v_2 := v.Args[2]
982         v_1 := v.Args[1]
983         v_0 := v.Args[0]
984         // match: (AtomicStore32 ptr val mem)
985         // result: (LoweredAtomicStore32 [1] ptr val mem)
986         for {
987                 ptr := v_0
988                 val := v_1
989                 mem := v_2
990                 v.reset(OpPPC64LoweredAtomicStore32)
991                 v.AuxInt = int64ToAuxInt(1)
992                 v.AddArg3(ptr, val, mem)
993                 return true
994         }
995 }
996 func rewriteValuePPC64_OpAtomicStore64(v *Value) bool {
997         v_2 := v.Args[2]
998         v_1 := v.Args[1]
999         v_0 := v.Args[0]
1000         // match: (AtomicStore64 ptr val mem)
1001         // result: (LoweredAtomicStore64 [1] ptr val mem)
1002         for {
1003                 ptr := v_0
1004                 val := v_1
1005                 mem := v_2
1006                 v.reset(OpPPC64LoweredAtomicStore64)
1007                 v.AuxInt = int64ToAuxInt(1)
1008                 v.AddArg3(ptr, val, mem)
1009                 return true
1010         }
1011 }
1012 func rewriteValuePPC64_OpAtomicStore8(v *Value) bool {
1013         v_2 := v.Args[2]
1014         v_1 := v.Args[1]
1015         v_0 := v.Args[0]
1016         // match: (AtomicStore8 ptr val mem)
1017         // result: (LoweredAtomicStore8 [1] ptr val mem)
1018         for {
1019                 ptr := v_0
1020                 val := v_1
1021                 mem := v_2
1022                 v.reset(OpPPC64LoweredAtomicStore8)
1023                 v.AuxInt = int64ToAuxInt(1)
1024                 v.AddArg3(ptr, val, mem)
1025                 return true
1026         }
1027 }
1028 func rewriteValuePPC64_OpAtomicStoreRel32(v *Value) bool {
1029         v_2 := v.Args[2]
1030         v_1 := v.Args[1]
1031         v_0 := v.Args[0]
1032         // match: (AtomicStoreRel32 ptr val mem)
1033         // result: (LoweredAtomicStore32 [0] ptr val mem)
1034         for {
1035                 ptr := v_0
1036                 val := v_1
1037                 mem := v_2
1038                 v.reset(OpPPC64LoweredAtomicStore32)
1039                 v.AuxInt = int64ToAuxInt(0)
1040                 v.AddArg3(ptr, val, mem)
1041                 return true
1042         }
1043 }
1044 func rewriteValuePPC64_OpAtomicStoreRel64(v *Value) bool {
1045         v_2 := v.Args[2]
1046         v_1 := v.Args[1]
1047         v_0 := v.Args[0]
1048         // match: (AtomicStoreRel64 ptr val mem)
1049         // result: (LoweredAtomicStore64 [0] ptr val mem)
1050         for {
1051                 ptr := v_0
1052                 val := v_1
1053                 mem := v_2
1054                 v.reset(OpPPC64LoweredAtomicStore64)
1055                 v.AuxInt = int64ToAuxInt(0)
1056                 v.AddArg3(ptr, val, mem)
1057                 return true
1058         }
1059 }
1060 func rewriteValuePPC64_OpAvg64u(v *Value) bool {
1061         v_1 := v.Args[1]
1062         v_0 := v.Args[0]
1063         b := v.Block
1064         // match: (Avg64u <t> x y)
1065         // result: (ADD (SRDconst <t> (SUB <t> x y) [1]) y)
1066         for {
1067                 t := v.Type
1068                 x := v_0
1069                 y := v_1
1070                 v.reset(OpPPC64ADD)
1071                 v0 := b.NewValue0(v.Pos, OpPPC64SRDconst, t)
1072                 v0.AuxInt = int64ToAuxInt(1)
1073                 v1 := b.NewValue0(v.Pos, OpPPC64SUB, t)
1074                 v1.AddArg2(x, y)
1075                 v0.AddArg(v1)
1076                 v.AddArg2(v0, y)
1077                 return true
1078         }
1079 }
1080 func rewriteValuePPC64_OpBitLen32(v *Value) bool {
1081         v_0 := v.Args[0]
1082         b := v.Block
1083         typ := &b.Func.Config.Types
1084         // match: (BitLen32 x)
1085         // result: (SUBFCconst [32] (CNTLZW <typ.Int> x))
1086         for {
1087                 x := v_0
1088                 v.reset(OpPPC64SUBFCconst)
1089                 v.AuxInt = int64ToAuxInt(32)
1090                 v0 := b.NewValue0(v.Pos, OpPPC64CNTLZW, typ.Int)
1091                 v0.AddArg(x)
1092                 v.AddArg(v0)
1093                 return true
1094         }
1095 }
1096 func rewriteValuePPC64_OpBitLen64(v *Value) bool {
1097         v_0 := v.Args[0]
1098         b := v.Block
1099         typ := &b.Func.Config.Types
1100         // match: (BitLen64 x)
1101         // result: (SUBFCconst [64] (CNTLZD <typ.Int> x))
1102         for {
1103                 x := v_0
1104                 v.reset(OpPPC64SUBFCconst)
1105                 v.AuxInt = int64ToAuxInt(64)
1106                 v0 := b.NewValue0(v.Pos, OpPPC64CNTLZD, typ.Int)
1107                 v0.AddArg(x)
1108                 v.AddArg(v0)
1109                 return true
1110         }
1111 }
1112 func rewriteValuePPC64_OpCom16(v *Value) bool {
1113         v_0 := v.Args[0]
1114         // match: (Com16 x)
1115         // result: (NOR x x)
1116         for {
1117                 x := v_0
1118                 v.reset(OpPPC64NOR)
1119                 v.AddArg2(x, x)
1120                 return true
1121         }
1122 }
1123 func rewriteValuePPC64_OpCom32(v *Value) bool {
1124         v_0 := v.Args[0]
1125         // match: (Com32 x)
1126         // result: (NOR x x)
1127         for {
1128                 x := v_0
1129                 v.reset(OpPPC64NOR)
1130                 v.AddArg2(x, x)
1131                 return true
1132         }
1133 }
1134 func rewriteValuePPC64_OpCom64(v *Value) bool {
1135         v_0 := v.Args[0]
1136         // match: (Com64 x)
1137         // result: (NOR x x)
1138         for {
1139                 x := v_0
1140                 v.reset(OpPPC64NOR)
1141                 v.AddArg2(x, x)
1142                 return true
1143         }
1144 }
1145 func rewriteValuePPC64_OpCom8(v *Value) bool {
1146         v_0 := v.Args[0]
1147         // match: (Com8 x)
1148         // result: (NOR x x)
1149         for {
1150                 x := v_0
1151                 v.reset(OpPPC64NOR)
1152                 v.AddArg2(x, x)
1153                 return true
1154         }
1155 }
1156 func rewriteValuePPC64_OpCondSelect(v *Value) bool {
1157         v_2 := v.Args[2]
1158         v_1 := v.Args[1]
1159         v_0 := v.Args[0]
1160         b := v.Block
1161         // match: (CondSelect x y bool)
1162         // cond: flagArg(bool) != nil
1163         // result: (ISEL [2] x y bool)
1164         for {
1165                 x := v_0
1166                 y := v_1
1167                 bool := v_2
1168                 if !(flagArg(bool) != nil) {
1169                         break
1170                 }
1171                 v.reset(OpPPC64ISEL)
1172                 v.AuxInt = int32ToAuxInt(2)
1173                 v.AddArg3(x, y, bool)
1174                 return true
1175         }
1176         // match: (CondSelect x y bool)
1177         // cond: flagArg(bool) == nil
1178         // result: (ISEL [2] x y (CMPWconst [0] bool))
1179         for {
1180                 x := v_0
1181                 y := v_1
1182                 bool := v_2
1183                 if !(flagArg(bool) == nil) {
1184                         break
1185                 }
1186                 v.reset(OpPPC64ISEL)
1187                 v.AuxInt = int32ToAuxInt(2)
1188                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWconst, types.TypeFlags)
1189                 v0.AuxInt = int32ToAuxInt(0)
1190                 v0.AddArg(bool)
1191                 v.AddArg3(x, y, v0)
1192                 return true
1193         }
1194         return false
1195 }
1196 func rewriteValuePPC64_OpConst16(v *Value) bool {
1197         // match: (Const16 [val])
1198         // result: (MOVDconst [int64(val)])
1199         for {
1200                 val := auxIntToInt16(v.AuxInt)
1201                 v.reset(OpPPC64MOVDconst)
1202                 v.AuxInt = int64ToAuxInt(int64(val))
1203                 return true
1204         }
1205 }
1206 func rewriteValuePPC64_OpConst32(v *Value) bool {
1207         // match: (Const32 [val])
1208         // result: (MOVDconst [int64(val)])
1209         for {
1210                 val := auxIntToInt32(v.AuxInt)
1211                 v.reset(OpPPC64MOVDconst)
1212                 v.AuxInt = int64ToAuxInt(int64(val))
1213                 return true
1214         }
1215 }
1216 func rewriteValuePPC64_OpConst64(v *Value) bool {
1217         // match: (Const64 [val])
1218         // result: (MOVDconst [int64(val)])
1219         for {
1220                 val := auxIntToInt64(v.AuxInt)
1221                 v.reset(OpPPC64MOVDconst)
1222                 v.AuxInt = int64ToAuxInt(int64(val))
1223                 return true
1224         }
1225 }
1226 func rewriteValuePPC64_OpConst8(v *Value) bool {
1227         // match: (Const8 [val])
1228         // result: (MOVDconst [int64(val)])
1229         for {
1230                 val := auxIntToInt8(v.AuxInt)
1231                 v.reset(OpPPC64MOVDconst)
1232                 v.AuxInt = int64ToAuxInt(int64(val))
1233                 return true
1234         }
1235 }
1236 func rewriteValuePPC64_OpConstBool(v *Value) bool {
1237         // match: (ConstBool [t])
1238         // result: (MOVDconst [b2i(t)])
1239         for {
1240                 t := auxIntToBool(v.AuxInt)
1241                 v.reset(OpPPC64MOVDconst)
1242                 v.AuxInt = int64ToAuxInt(b2i(t))
1243                 return true
1244         }
1245 }
1246 func rewriteValuePPC64_OpConstNil(v *Value) bool {
1247         // match: (ConstNil)
1248         // result: (MOVDconst [0])
1249         for {
1250                 v.reset(OpPPC64MOVDconst)
1251                 v.AuxInt = int64ToAuxInt(0)
1252                 return true
1253         }
1254 }
1255 func rewriteValuePPC64_OpCopysign(v *Value) bool {
1256         v_1 := v.Args[1]
1257         v_0 := v.Args[0]
1258         // match: (Copysign x y)
1259         // result: (FCPSGN y x)
1260         for {
1261                 x := v_0
1262                 y := v_1
1263                 v.reset(OpPPC64FCPSGN)
1264                 v.AddArg2(y, x)
1265                 return true
1266         }
1267 }
1268 func rewriteValuePPC64_OpCtz16(v *Value) bool {
1269         v_0 := v.Args[0]
1270         b := v.Block
1271         typ := &b.Func.Config.Types
1272         // match: (Ctz16 x)
1273         // result: (POPCNTW (MOVHZreg (ANDN <typ.Int16> (ADDconst <typ.Int16> [-1] x) x)))
1274         for {
1275                 x := v_0
1276                 v.reset(OpPPC64POPCNTW)
1277                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
1278                 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int16)
1279                 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int16)
1280                 v2.AuxInt = int64ToAuxInt(-1)
1281                 v2.AddArg(x)
1282                 v1.AddArg2(v2, x)
1283                 v0.AddArg(v1)
1284                 v.AddArg(v0)
1285                 return true
1286         }
1287 }
1288 func rewriteValuePPC64_OpCtz32(v *Value) bool {
1289         v_0 := v.Args[0]
1290         b := v.Block
1291         typ := &b.Func.Config.Types
1292         // match: (Ctz32 x)
1293         // cond: objabi.GOPPC64<=8
1294         // result: (POPCNTW (MOVWZreg (ANDN <typ.Int> (ADDconst <typ.Int> [-1] x) x)))
1295         for {
1296                 x := v_0
1297                 if !(objabi.GOPPC64 <= 8) {
1298                         break
1299                 }
1300                 v.reset(OpPPC64POPCNTW)
1301                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
1302                 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int)
1303                 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int)
1304                 v2.AuxInt = int64ToAuxInt(-1)
1305                 v2.AddArg(x)
1306                 v1.AddArg2(v2, x)
1307                 v0.AddArg(v1)
1308                 v.AddArg(v0)
1309                 return true
1310         }
1311         // match: (Ctz32 x)
1312         // result: (CNTTZW (MOVWZreg x))
1313         for {
1314                 x := v_0
1315                 v.reset(OpPPC64CNTTZW)
1316                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
1317                 v0.AddArg(x)
1318                 v.AddArg(v0)
1319                 return true
1320         }
1321 }
1322 func rewriteValuePPC64_OpCtz64(v *Value) bool {
1323         v_0 := v.Args[0]
1324         b := v.Block
1325         typ := &b.Func.Config.Types
1326         // match: (Ctz64 x)
1327         // cond: objabi.GOPPC64<=8
1328         // result: (POPCNTD (ANDN <typ.Int64> (ADDconst <typ.Int64> [-1] x) x))
1329         for {
1330                 x := v_0
1331                 if !(objabi.GOPPC64 <= 8) {
1332                         break
1333                 }
1334                 v.reset(OpPPC64POPCNTD)
1335                 v0 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int64)
1336                 v1 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int64)
1337                 v1.AuxInt = int64ToAuxInt(-1)
1338                 v1.AddArg(x)
1339                 v0.AddArg2(v1, x)
1340                 v.AddArg(v0)
1341                 return true
1342         }
1343         // match: (Ctz64 x)
1344         // result: (CNTTZD x)
1345         for {
1346                 x := v_0
1347                 v.reset(OpPPC64CNTTZD)
1348                 v.AddArg(x)
1349                 return true
1350         }
1351 }
1352 func rewriteValuePPC64_OpCtz8(v *Value) bool {
1353         v_0 := v.Args[0]
1354         b := v.Block
1355         typ := &b.Func.Config.Types
1356         // match: (Ctz8 x)
1357         // result: (POPCNTB (MOVBZreg (ANDN <typ.UInt8> (ADDconst <typ.UInt8> [-1] x) x)))
1358         for {
1359                 x := v_0
1360                 v.reset(OpPPC64POPCNTB)
1361                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
1362                 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.UInt8)
1363                 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.UInt8)
1364                 v2.AuxInt = int64ToAuxInt(-1)
1365                 v2.AddArg(x)
1366                 v1.AddArg2(v2, x)
1367                 v0.AddArg(v1)
1368                 v.AddArg(v0)
1369                 return true
1370         }
1371 }
1372 func rewriteValuePPC64_OpCvt32Fto32(v *Value) bool {
1373         v_0 := v.Args[0]
1374         b := v.Block
1375         typ := &b.Func.Config.Types
1376         // match: (Cvt32Fto32 x)
1377         // result: (MFVSRD (FCTIWZ x))
1378         for {
1379                 x := v_0
1380                 v.reset(OpPPC64MFVSRD)
1381                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIWZ, typ.Float64)
1382                 v0.AddArg(x)
1383                 v.AddArg(v0)
1384                 return true
1385         }
1386 }
1387 func rewriteValuePPC64_OpCvt32Fto64(v *Value) bool {
1388         v_0 := v.Args[0]
1389         b := v.Block
1390         typ := &b.Func.Config.Types
1391         // match: (Cvt32Fto64 x)
1392         // result: (MFVSRD (FCTIDZ x))
1393         for {
1394                 x := v_0
1395                 v.reset(OpPPC64MFVSRD)
1396                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIDZ, typ.Float64)
1397                 v0.AddArg(x)
1398                 v.AddArg(v0)
1399                 return true
1400         }
1401 }
1402 func rewriteValuePPC64_OpCvt32to32F(v *Value) bool {
1403         v_0 := v.Args[0]
1404         b := v.Block
1405         typ := &b.Func.Config.Types
1406         // match: (Cvt32to32F x)
1407         // result: (FCFIDS (MTVSRD (SignExt32to64 x)))
1408         for {
1409                 x := v_0
1410                 v.reset(OpPPC64FCFIDS)
1411                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1412                 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
1413                 v1.AddArg(x)
1414                 v0.AddArg(v1)
1415                 v.AddArg(v0)
1416                 return true
1417         }
1418 }
1419 func rewriteValuePPC64_OpCvt32to64F(v *Value) bool {
1420         v_0 := v.Args[0]
1421         b := v.Block
1422         typ := &b.Func.Config.Types
1423         // match: (Cvt32to64F x)
1424         // result: (FCFID (MTVSRD (SignExt32to64 x)))
1425         for {
1426                 x := v_0
1427                 v.reset(OpPPC64FCFID)
1428                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1429                 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
1430                 v1.AddArg(x)
1431                 v0.AddArg(v1)
1432                 v.AddArg(v0)
1433                 return true
1434         }
1435 }
1436 func rewriteValuePPC64_OpCvt64Fto32(v *Value) bool {
1437         v_0 := v.Args[0]
1438         b := v.Block
1439         typ := &b.Func.Config.Types
1440         // match: (Cvt64Fto32 x)
1441         // result: (MFVSRD (FCTIWZ x))
1442         for {
1443                 x := v_0
1444                 v.reset(OpPPC64MFVSRD)
1445                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIWZ, typ.Float64)
1446                 v0.AddArg(x)
1447                 v.AddArg(v0)
1448                 return true
1449         }
1450 }
1451 func rewriteValuePPC64_OpCvt64Fto64(v *Value) bool {
1452         v_0 := v.Args[0]
1453         b := v.Block
1454         typ := &b.Func.Config.Types
1455         // match: (Cvt64Fto64 x)
1456         // result: (MFVSRD (FCTIDZ x))
1457         for {
1458                 x := v_0
1459                 v.reset(OpPPC64MFVSRD)
1460                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIDZ, typ.Float64)
1461                 v0.AddArg(x)
1462                 v.AddArg(v0)
1463                 return true
1464         }
1465 }
1466 func rewriteValuePPC64_OpCvt64to32F(v *Value) bool {
1467         v_0 := v.Args[0]
1468         b := v.Block
1469         typ := &b.Func.Config.Types
1470         // match: (Cvt64to32F x)
1471         // result: (FCFIDS (MTVSRD x))
1472         for {
1473                 x := v_0
1474                 v.reset(OpPPC64FCFIDS)
1475                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1476                 v0.AddArg(x)
1477                 v.AddArg(v0)
1478                 return true
1479         }
1480 }
1481 func rewriteValuePPC64_OpCvt64to64F(v *Value) bool {
1482         v_0 := v.Args[0]
1483         b := v.Block
1484         typ := &b.Func.Config.Types
1485         // match: (Cvt64to64F x)
1486         // result: (FCFID (MTVSRD x))
1487         for {
1488                 x := v_0
1489                 v.reset(OpPPC64FCFID)
1490                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1491                 v0.AddArg(x)
1492                 v.AddArg(v0)
1493                 return true
1494         }
1495 }
1496 func rewriteValuePPC64_OpDiv16(v *Value) bool {
1497         v_1 := v.Args[1]
1498         v_0 := v.Args[0]
1499         b := v.Block
1500         typ := &b.Func.Config.Types
1501         // match: (Div16 [false] x y)
1502         // result: (DIVW (SignExt16to32 x) (SignExt16to32 y))
1503         for {
1504                 if auxIntToBool(v.AuxInt) != false {
1505                         break
1506                 }
1507                 x := v_0
1508                 y := v_1
1509                 v.reset(OpPPC64DIVW)
1510                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1511                 v0.AddArg(x)
1512                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1513                 v1.AddArg(y)
1514                 v.AddArg2(v0, v1)
1515                 return true
1516         }
1517         return false
1518 }
1519 func rewriteValuePPC64_OpDiv16u(v *Value) bool {
1520         v_1 := v.Args[1]
1521         v_0 := v.Args[0]
1522         b := v.Block
1523         typ := &b.Func.Config.Types
1524         // match: (Div16u x y)
1525         // result: (DIVWU (ZeroExt16to32 x) (ZeroExt16to32 y))
1526         for {
1527                 x := v_0
1528                 y := v_1
1529                 v.reset(OpPPC64DIVWU)
1530                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1531                 v0.AddArg(x)
1532                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1533                 v1.AddArg(y)
1534                 v.AddArg2(v0, v1)
1535                 return true
1536         }
1537 }
1538 func rewriteValuePPC64_OpDiv32(v *Value) bool {
1539         v_1 := v.Args[1]
1540         v_0 := v.Args[0]
1541         // match: (Div32 [false] x y)
1542         // result: (DIVW x y)
1543         for {
1544                 if auxIntToBool(v.AuxInt) != false {
1545                         break
1546                 }
1547                 x := v_0
1548                 y := v_1
1549                 v.reset(OpPPC64DIVW)
1550                 v.AddArg2(x, y)
1551                 return true
1552         }
1553         return false
1554 }
1555 func rewriteValuePPC64_OpDiv64(v *Value) bool {
1556         v_1 := v.Args[1]
1557         v_0 := v.Args[0]
1558         // match: (Div64 [false] x y)
1559         // result: (DIVD x y)
1560         for {
1561                 if auxIntToBool(v.AuxInt) != false {
1562                         break
1563                 }
1564                 x := v_0
1565                 y := v_1
1566                 v.reset(OpPPC64DIVD)
1567                 v.AddArg2(x, y)
1568                 return true
1569         }
1570         return false
1571 }
1572 func rewriteValuePPC64_OpDiv8(v *Value) bool {
1573         v_1 := v.Args[1]
1574         v_0 := v.Args[0]
1575         b := v.Block
1576         typ := &b.Func.Config.Types
1577         // match: (Div8 x y)
1578         // result: (DIVW (SignExt8to32 x) (SignExt8to32 y))
1579         for {
1580                 x := v_0
1581                 y := v_1
1582                 v.reset(OpPPC64DIVW)
1583                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1584                 v0.AddArg(x)
1585                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1586                 v1.AddArg(y)
1587                 v.AddArg2(v0, v1)
1588                 return true
1589         }
1590 }
1591 func rewriteValuePPC64_OpDiv8u(v *Value) bool {
1592         v_1 := v.Args[1]
1593         v_0 := v.Args[0]
1594         b := v.Block
1595         typ := &b.Func.Config.Types
1596         // match: (Div8u x y)
1597         // result: (DIVWU (ZeroExt8to32 x) (ZeroExt8to32 y))
1598         for {
1599                 x := v_0
1600                 y := v_1
1601                 v.reset(OpPPC64DIVWU)
1602                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1603                 v0.AddArg(x)
1604                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1605                 v1.AddArg(y)
1606                 v.AddArg2(v0, v1)
1607                 return true
1608         }
1609 }
1610 func rewriteValuePPC64_OpEq16(v *Value) bool {
1611         v_1 := v.Args[1]
1612         v_0 := v.Args[0]
1613         b := v.Block
1614         typ := &b.Func.Config.Types
1615         // match: (Eq16 x y)
1616         // cond: isSigned(x.Type) && isSigned(y.Type)
1617         // result: (Equal (CMPW (SignExt16to32 x) (SignExt16to32 y)))
1618         for {
1619                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1620                         x := v_0
1621                         y := v_1
1622                         if !(isSigned(x.Type) && isSigned(y.Type)) {
1623                                 continue
1624                         }
1625                         v.reset(OpPPC64Equal)
1626                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1627                         v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1628                         v1.AddArg(x)
1629                         v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1630                         v2.AddArg(y)
1631                         v0.AddArg2(v1, v2)
1632                         v.AddArg(v0)
1633                         return true
1634                 }
1635                 break
1636         }
1637         // match: (Eq16 x y)
1638         // result: (Equal (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
1639         for {
1640                 x := v_0
1641                 y := v_1
1642                 v.reset(OpPPC64Equal)
1643                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1644                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1645                 v1.AddArg(x)
1646                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1647                 v2.AddArg(y)
1648                 v0.AddArg2(v1, v2)
1649                 v.AddArg(v0)
1650                 return true
1651         }
1652 }
1653 func rewriteValuePPC64_OpEq32(v *Value) bool {
1654         v_1 := v.Args[1]
1655         v_0 := v.Args[0]
1656         b := v.Block
1657         // match: (Eq32 x y)
1658         // result: (Equal (CMPW x y))
1659         for {
1660                 x := v_0
1661                 y := v_1
1662                 v.reset(OpPPC64Equal)
1663                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1664                 v0.AddArg2(x, y)
1665                 v.AddArg(v0)
1666                 return true
1667         }
1668 }
1669 func rewriteValuePPC64_OpEq32F(v *Value) bool {
1670         v_1 := v.Args[1]
1671         v_0 := v.Args[0]
1672         b := v.Block
1673         // match: (Eq32F x y)
1674         // result: (Equal (FCMPU x y))
1675         for {
1676                 x := v_0
1677                 y := v_1
1678                 v.reset(OpPPC64Equal)
1679                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
1680                 v0.AddArg2(x, y)
1681                 v.AddArg(v0)
1682                 return true
1683         }
1684 }
1685 func rewriteValuePPC64_OpEq64(v *Value) bool {
1686         v_1 := v.Args[1]
1687         v_0 := v.Args[0]
1688         b := v.Block
1689         // match: (Eq64 x y)
1690         // result: (Equal (CMP x y))
1691         for {
1692                 x := v_0
1693                 y := v_1
1694                 v.reset(OpPPC64Equal)
1695                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
1696                 v0.AddArg2(x, y)
1697                 v.AddArg(v0)
1698                 return true
1699         }
1700 }
1701 func rewriteValuePPC64_OpEq64F(v *Value) bool {
1702         v_1 := v.Args[1]
1703         v_0 := v.Args[0]
1704         b := v.Block
1705         // match: (Eq64F x y)
1706         // result: (Equal (FCMPU x y))
1707         for {
1708                 x := v_0
1709                 y := v_1
1710                 v.reset(OpPPC64Equal)
1711                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
1712                 v0.AddArg2(x, y)
1713                 v.AddArg(v0)
1714                 return true
1715         }
1716 }
1717 func rewriteValuePPC64_OpEq8(v *Value) bool {
1718         v_1 := v.Args[1]
1719         v_0 := v.Args[0]
1720         b := v.Block
1721         typ := &b.Func.Config.Types
1722         // match: (Eq8 x y)
1723         // cond: isSigned(x.Type) && isSigned(y.Type)
1724         // result: (Equal (CMPW (SignExt8to32 x) (SignExt8to32 y)))
1725         for {
1726                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1727                         x := v_0
1728                         y := v_1
1729                         if !(isSigned(x.Type) && isSigned(y.Type)) {
1730                                 continue
1731                         }
1732                         v.reset(OpPPC64Equal)
1733                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1734                         v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1735                         v1.AddArg(x)
1736                         v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1737                         v2.AddArg(y)
1738                         v0.AddArg2(v1, v2)
1739                         v.AddArg(v0)
1740                         return true
1741                 }
1742                 break
1743         }
1744         // match: (Eq8 x y)
1745         // result: (Equal (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
1746         for {
1747                 x := v_0
1748                 y := v_1
1749                 v.reset(OpPPC64Equal)
1750                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1751                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1752                 v1.AddArg(x)
1753                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1754                 v2.AddArg(y)
1755                 v0.AddArg2(v1, v2)
1756                 v.AddArg(v0)
1757                 return true
1758         }
1759 }
1760 func rewriteValuePPC64_OpEqB(v *Value) bool {
1761         v_1 := v.Args[1]
1762         v_0 := v.Args[0]
1763         b := v.Block
1764         typ := &b.Func.Config.Types
1765         // match: (EqB x y)
1766         // result: (ANDconst [1] (EQV x y))
1767         for {
1768                 x := v_0
1769                 y := v_1
1770                 v.reset(OpPPC64ANDconst)
1771                 v.AuxInt = int64ToAuxInt(1)
1772                 v0 := b.NewValue0(v.Pos, OpPPC64EQV, typ.Int64)
1773                 v0.AddArg2(x, y)
1774                 v.AddArg(v0)
1775                 return true
1776         }
1777 }
1778 func rewriteValuePPC64_OpEqPtr(v *Value) bool {
1779         v_1 := v.Args[1]
1780         v_0 := v.Args[0]
1781         b := v.Block
1782         // match: (EqPtr x y)
1783         // result: (Equal (CMP x y))
1784         for {
1785                 x := v_0
1786                 y := v_1
1787                 v.reset(OpPPC64Equal)
1788                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
1789                 v0.AddArg2(x, y)
1790                 v.AddArg(v0)
1791                 return true
1792         }
1793 }
1794 func rewriteValuePPC64_OpIsInBounds(v *Value) bool {
1795         v_1 := v.Args[1]
1796         v_0 := v.Args[0]
1797         b := v.Block
1798         // match: (IsInBounds idx len)
1799         // result: (LessThan (CMPU idx len))
1800         for {
1801                 idx := v_0
1802                 len := v_1
1803                 v.reset(OpPPC64LessThan)
1804                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
1805                 v0.AddArg2(idx, len)
1806                 v.AddArg(v0)
1807                 return true
1808         }
1809 }
1810 func rewriteValuePPC64_OpIsNonNil(v *Value) bool {
1811         v_0 := v.Args[0]
1812         b := v.Block
1813         // match: (IsNonNil ptr)
1814         // result: (NotEqual (CMPconst [0] ptr))
1815         for {
1816                 ptr := v_0
1817                 v.reset(OpPPC64NotEqual)
1818                 v0 := b.NewValue0(v.Pos, OpPPC64CMPconst, types.TypeFlags)
1819                 v0.AuxInt = int64ToAuxInt(0)
1820                 v0.AddArg(ptr)
1821                 v.AddArg(v0)
1822                 return true
1823         }
1824 }
1825 func rewriteValuePPC64_OpIsSliceInBounds(v *Value) bool {
1826         v_1 := v.Args[1]
1827         v_0 := v.Args[0]
1828         b := v.Block
1829         // match: (IsSliceInBounds idx len)
1830         // result: (LessEqual (CMPU idx len))
1831         for {
1832                 idx := v_0
1833                 len := v_1
1834                 v.reset(OpPPC64LessEqual)
1835                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
1836                 v0.AddArg2(idx, len)
1837                 v.AddArg(v0)
1838                 return true
1839         }
1840 }
1841 func rewriteValuePPC64_OpLeq16(v *Value) bool {
1842         v_1 := v.Args[1]
1843         v_0 := v.Args[0]
1844         b := v.Block
1845         typ := &b.Func.Config.Types
1846         // match: (Leq16 x y)
1847         // result: (LessEqual (CMPW (SignExt16to32 x) (SignExt16to32 y)))
1848         for {
1849                 x := v_0
1850                 y := v_1
1851                 v.reset(OpPPC64LessEqual)
1852                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1853                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1854                 v1.AddArg(x)
1855                 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1856                 v2.AddArg(y)
1857                 v0.AddArg2(v1, v2)
1858                 v.AddArg(v0)
1859                 return true
1860         }
1861 }
1862 func rewriteValuePPC64_OpLeq16U(v *Value) bool {
1863         v_1 := v.Args[1]
1864         v_0 := v.Args[0]
1865         b := v.Block
1866         typ := &b.Func.Config.Types
1867         // match: (Leq16U x y)
1868         // result: (LessEqual (CMPWU (ZeroExt16to32 x) (ZeroExt16to32 y)))
1869         for {
1870                 x := v_0
1871                 y := v_1
1872                 v.reset(OpPPC64LessEqual)
1873                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
1874                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1875                 v1.AddArg(x)
1876                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1877                 v2.AddArg(y)
1878                 v0.AddArg2(v1, v2)
1879                 v.AddArg(v0)
1880                 return true
1881         }
1882 }
1883 func rewriteValuePPC64_OpLeq32(v *Value) bool {
1884         v_1 := v.Args[1]
1885         v_0 := v.Args[0]
1886         b := v.Block
1887         // match: (Leq32 x y)
1888         // result: (LessEqual (CMPW x y))
1889         for {
1890                 x := v_0
1891                 y := v_1
1892                 v.reset(OpPPC64LessEqual)
1893                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1894                 v0.AddArg2(x, y)
1895                 v.AddArg(v0)
1896                 return true
1897         }
1898 }
1899 func rewriteValuePPC64_OpLeq32F(v *Value) bool {
1900         v_1 := v.Args[1]
1901         v_0 := v.Args[0]
1902         b := v.Block
1903         // match: (Leq32F x y)
1904         // result: (FLessEqual (FCMPU x y))
1905         for {
1906                 x := v_0
1907                 y := v_1
1908                 v.reset(OpPPC64FLessEqual)
1909                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
1910                 v0.AddArg2(x, y)
1911                 v.AddArg(v0)
1912                 return true
1913         }
1914 }
1915 func rewriteValuePPC64_OpLeq32U(v *Value) bool {
1916         v_1 := v.Args[1]
1917         v_0 := v.Args[0]
1918         b := v.Block
1919         // match: (Leq32U x y)
1920         // result: (LessEqual (CMPWU x y))
1921         for {
1922                 x := v_0
1923                 y := v_1
1924                 v.reset(OpPPC64LessEqual)
1925                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
1926                 v0.AddArg2(x, y)
1927                 v.AddArg(v0)
1928                 return true
1929         }
1930 }
1931 func rewriteValuePPC64_OpLeq64(v *Value) bool {
1932         v_1 := v.Args[1]
1933         v_0 := v.Args[0]
1934         b := v.Block
1935         // match: (Leq64 x y)
1936         // result: (LessEqual (CMP x y))
1937         for {
1938                 x := v_0
1939                 y := v_1
1940                 v.reset(OpPPC64LessEqual)
1941                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
1942                 v0.AddArg2(x, y)
1943                 v.AddArg(v0)
1944                 return true
1945         }
1946 }
1947 func rewriteValuePPC64_OpLeq64F(v *Value) bool {
1948         v_1 := v.Args[1]
1949         v_0 := v.Args[0]
1950         b := v.Block
1951         // match: (Leq64F x y)
1952         // result: (FLessEqual (FCMPU x y))
1953         for {
1954                 x := v_0
1955                 y := v_1
1956                 v.reset(OpPPC64FLessEqual)
1957                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
1958                 v0.AddArg2(x, y)
1959                 v.AddArg(v0)
1960                 return true
1961         }
1962 }
1963 func rewriteValuePPC64_OpLeq64U(v *Value) bool {
1964         v_1 := v.Args[1]
1965         v_0 := v.Args[0]
1966         b := v.Block
1967         // match: (Leq64U x y)
1968         // result: (LessEqual (CMPU x y))
1969         for {
1970                 x := v_0
1971                 y := v_1
1972                 v.reset(OpPPC64LessEqual)
1973                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
1974                 v0.AddArg2(x, y)
1975                 v.AddArg(v0)
1976                 return true
1977         }
1978 }
1979 func rewriteValuePPC64_OpLeq8(v *Value) bool {
1980         v_1 := v.Args[1]
1981         v_0 := v.Args[0]
1982         b := v.Block
1983         typ := &b.Func.Config.Types
1984         // match: (Leq8 x y)
1985         // result: (LessEqual (CMPW (SignExt8to32 x) (SignExt8to32 y)))
1986         for {
1987                 x := v_0
1988                 y := v_1
1989                 v.reset(OpPPC64LessEqual)
1990                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1991                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1992                 v1.AddArg(x)
1993                 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1994                 v2.AddArg(y)
1995                 v0.AddArg2(v1, v2)
1996                 v.AddArg(v0)
1997                 return true
1998         }
1999 }
2000 func rewriteValuePPC64_OpLeq8U(v *Value) bool {
2001         v_1 := v.Args[1]
2002         v_0 := v.Args[0]
2003         b := v.Block
2004         typ := &b.Func.Config.Types
2005         // match: (Leq8U x y)
2006         // result: (LessEqual (CMPWU (ZeroExt8to32 x) (ZeroExt8to32 y)))
2007         for {
2008                 x := v_0
2009                 y := v_1
2010                 v.reset(OpPPC64LessEqual)
2011                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2012                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2013                 v1.AddArg(x)
2014                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2015                 v2.AddArg(y)
2016                 v0.AddArg2(v1, v2)
2017                 v.AddArg(v0)
2018                 return true
2019         }
2020 }
2021 func rewriteValuePPC64_OpLess16(v *Value) bool {
2022         v_1 := v.Args[1]
2023         v_0 := v.Args[0]
2024         b := v.Block
2025         typ := &b.Func.Config.Types
2026         // match: (Less16 x y)
2027         // result: (LessThan (CMPW (SignExt16to32 x) (SignExt16to32 y)))
2028         for {
2029                 x := v_0
2030                 y := v_1
2031                 v.reset(OpPPC64LessThan)
2032                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2033                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2034                 v1.AddArg(x)
2035                 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2036                 v2.AddArg(y)
2037                 v0.AddArg2(v1, v2)
2038                 v.AddArg(v0)
2039                 return true
2040         }
2041 }
2042 func rewriteValuePPC64_OpLess16U(v *Value) bool {
2043         v_1 := v.Args[1]
2044         v_0 := v.Args[0]
2045         b := v.Block
2046         typ := &b.Func.Config.Types
2047         // match: (Less16U x y)
2048         // result: (LessThan (CMPWU (ZeroExt16to32 x) (ZeroExt16to32 y)))
2049         for {
2050                 x := v_0
2051                 y := v_1
2052                 v.reset(OpPPC64LessThan)
2053                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2054                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2055                 v1.AddArg(x)
2056                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2057                 v2.AddArg(y)
2058                 v0.AddArg2(v1, v2)
2059                 v.AddArg(v0)
2060                 return true
2061         }
2062 }
2063 func rewriteValuePPC64_OpLess32(v *Value) bool {
2064         v_1 := v.Args[1]
2065         v_0 := v.Args[0]
2066         b := v.Block
2067         // match: (Less32 x y)
2068         // result: (LessThan (CMPW x y))
2069         for {
2070                 x := v_0
2071                 y := v_1
2072                 v.reset(OpPPC64LessThan)
2073                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2074                 v0.AddArg2(x, y)
2075                 v.AddArg(v0)
2076                 return true
2077         }
2078 }
2079 func rewriteValuePPC64_OpLess32F(v *Value) bool {
2080         v_1 := v.Args[1]
2081         v_0 := v.Args[0]
2082         b := v.Block
2083         // match: (Less32F x y)
2084         // result: (FLessThan (FCMPU x y))
2085         for {
2086                 x := v_0
2087                 y := v_1
2088                 v.reset(OpPPC64FLessThan)
2089                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2090                 v0.AddArg2(x, y)
2091                 v.AddArg(v0)
2092                 return true
2093         }
2094 }
2095 func rewriteValuePPC64_OpLess32U(v *Value) bool {
2096         v_1 := v.Args[1]
2097         v_0 := v.Args[0]
2098         b := v.Block
2099         // match: (Less32U x y)
2100         // result: (LessThan (CMPWU x y))
2101         for {
2102                 x := v_0
2103                 y := v_1
2104                 v.reset(OpPPC64LessThan)
2105                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2106                 v0.AddArg2(x, y)
2107                 v.AddArg(v0)
2108                 return true
2109         }
2110 }
2111 func rewriteValuePPC64_OpLess64(v *Value) bool {
2112         v_1 := v.Args[1]
2113         v_0 := v.Args[0]
2114         b := v.Block
2115         // match: (Less64 x y)
2116         // result: (LessThan (CMP x y))
2117         for {
2118                 x := v_0
2119                 y := v_1
2120                 v.reset(OpPPC64LessThan)
2121                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2122                 v0.AddArg2(x, y)
2123                 v.AddArg(v0)
2124                 return true
2125         }
2126 }
2127 func rewriteValuePPC64_OpLess64F(v *Value) bool {
2128         v_1 := v.Args[1]
2129         v_0 := v.Args[0]
2130         b := v.Block
2131         // match: (Less64F x y)
2132         // result: (FLessThan (FCMPU x y))
2133         for {
2134                 x := v_0
2135                 y := v_1
2136                 v.reset(OpPPC64FLessThan)
2137                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2138                 v0.AddArg2(x, y)
2139                 v.AddArg(v0)
2140                 return true
2141         }
2142 }
2143 func rewriteValuePPC64_OpLess64U(v *Value) bool {
2144         v_1 := v.Args[1]
2145         v_0 := v.Args[0]
2146         b := v.Block
2147         // match: (Less64U x y)
2148         // result: (LessThan (CMPU x y))
2149         for {
2150                 x := v_0
2151                 y := v_1
2152                 v.reset(OpPPC64LessThan)
2153                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2154                 v0.AddArg2(x, y)
2155                 v.AddArg(v0)
2156                 return true
2157         }
2158 }
2159 func rewriteValuePPC64_OpLess8(v *Value) bool {
2160         v_1 := v.Args[1]
2161         v_0 := v.Args[0]
2162         b := v.Block
2163         typ := &b.Func.Config.Types
2164         // match: (Less8 x y)
2165         // result: (LessThan (CMPW (SignExt8to32 x) (SignExt8to32 y)))
2166         for {
2167                 x := v_0
2168                 y := v_1
2169                 v.reset(OpPPC64LessThan)
2170                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2171                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2172                 v1.AddArg(x)
2173                 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2174                 v2.AddArg(y)
2175                 v0.AddArg2(v1, v2)
2176                 v.AddArg(v0)
2177                 return true
2178         }
2179 }
2180 func rewriteValuePPC64_OpLess8U(v *Value) bool {
2181         v_1 := v.Args[1]
2182         v_0 := v.Args[0]
2183         b := v.Block
2184         typ := &b.Func.Config.Types
2185         // match: (Less8U x y)
2186         // result: (LessThan (CMPWU (ZeroExt8to32 x) (ZeroExt8to32 y)))
2187         for {
2188                 x := v_0
2189                 y := v_1
2190                 v.reset(OpPPC64LessThan)
2191                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2192                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2193                 v1.AddArg(x)
2194                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2195                 v2.AddArg(y)
2196                 v0.AddArg2(v1, v2)
2197                 v.AddArg(v0)
2198                 return true
2199         }
2200 }
2201 func rewriteValuePPC64_OpLoad(v *Value) bool {
2202         v_1 := v.Args[1]
2203         v_0 := v.Args[0]
2204         b := v.Block
2205         typ := &b.Func.Config.Types
2206         // match: (Load <t> ptr mem)
2207         // cond: (is64BitInt(t) || isPtr(t))
2208         // result: (MOVDload ptr mem)
2209         for {
2210                 t := v.Type
2211                 ptr := v_0
2212                 mem := v_1
2213                 if !(is64BitInt(t) || isPtr(t)) {
2214                         break
2215                 }
2216                 v.reset(OpPPC64MOVDload)
2217                 v.AddArg2(ptr, mem)
2218                 return true
2219         }
2220         // match: (Load <t> ptr mem)
2221         // cond: is32BitInt(t) && isSigned(t)
2222         // result: (MOVWload ptr mem)
2223         for {
2224                 t := v.Type
2225                 ptr := v_0
2226                 mem := v_1
2227                 if !(is32BitInt(t) && isSigned(t)) {
2228                         break
2229                 }
2230                 v.reset(OpPPC64MOVWload)
2231                 v.AddArg2(ptr, mem)
2232                 return true
2233         }
2234         // match: (Load <t> ptr mem)
2235         // cond: is32BitInt(t) && !isSigned(t)
2236         // result: (MOVWZload ptr mem)
2237         for {
2238                 t := v.Type
2239                 ptr := v_0
2240                 mem := v_1
2241                 if !(is32BitInt(t) && !isSigned(t)) {
2242                         break
2243                 }
2244                 v.reset(OpPPC64MOVWZload)
2245                 v.AddArg2(ptr, mem)
2246                 return true
2247         }
2248         // match: (Load <t> ptr mem)
2249         // cond: is16BitInt(t) && isSigned(t)
2250         // result: (MOVHload ptr mem)
2251         for {
2252                 t := v.Type
2253                 ptr := v_0
2254                 mem := v_1
2255                 if !(is16BitInt(t) && isSigned(t)) {
2256                         break
2257                 }
2258                 v.reset(OpPPC64MOVHload)
2259                 v.AddArg2(ptr, mem)
2260                 return true
2261         }
2262         // match: (Load <t> ptr mem)
2263         // cond: is16BitInt(t) && !isSigned(t)
2264         // result: (MOVHZload ptr mem)
2265         for {
2266                 t := v.Type
2267                 ptr := v_0
2268                 mem := v_1
2269                 if !(is16BitInt(t) && !isSigned(t)) {
2270                         break
2271                 }
2272                 v.reset(OpPPC64MOVHZload)
2273                 v.AddArg2(ptr, mem)
2274                 return true
2275         }
2276         // match: (Load <t> ptr mem)
2277         // cond: t.IsBoolean()
2278         // result: (MOVBZload ptr mem)
2279         for {
2280                 t := v.Type
2281                 ptr := v_0
2282                 mem := v_1
2283                 if !(t.IsBoolean()) {
2284                         break
2285                 }
2286                 v.reset(OpPPC64MOVBZload)
2287                 v.AddArg2(ptr, mem)
2288                 return true
2289         }
2290         // match: (Load <t> ptr mem)
2291         // cond: is8BitInt(t) && isSigned(t)
2292         // result: (MOVBreg (MOVBZload ptr mem))
2293         for {
2294                 t := v.Type
2295                 ptr := v_0
2296                 mem := v_1
2297                 if !(is8BitInt(t) && isSigned(t)) {
2298                         break
2299                 }
2300                 v.reset(OpPPC64MOVBreg)
2301                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
2302                 v0.AddArg2(ptr, mem)
2303                 v.AddArg(v0)
2304                 return true
2305         }
2306         // match: (Load <t> ptr mem)
2307         // cond: is8BitInt(t) && !isSigned(t)
2308         // result: (MOVBZload ptr mem)
2309         for {
2310                 t := v.Type
2311                 ptr := v_0
2312                 mem := v_1
2313                 if !(is8BitInt(t) && !isSigned(t)) {
2314                         break
2315                 }
2316                 v.reset(OpPPC64MOVBZload)
2317                 v.AddArg2(ptr, mem)
2318                 return true
2319         }
2320         // match: (Load <t> ptr mem)
2321         // cond: is32BitFloat(t)
2322         // result: (FMOVSload ptr mem)
2323         for {
2324                 t := v.Type
2325                 ptr := v_0
2326                 mem := v_1
2327                 if !(is32BitFloat(t)) {
2328                         break
2329                 }
2330                 v.reset(OpPPC64FMOVSload)
2331                 v.AddArg2(ptr, mem)
2332                 return true
2333         }
2334         // match: (Load <t> ptr mem)
2335         // cond: is64BitFloat(t)
2336         // result: (FMOVDload ptr mem)
2337         for {
2338                 t := v.Type
2339                 ptr := v_0
2340                 mem := v_1
2341                 if !(is64BitFloat(t)) {
2342                         break
2343                 }
2344                 v.reset(OpPPC64FMOVDload)
2345                 v.AddArg2(ptr, mem)
2346                 return true
2347         }
2348         return false
2349 }
2350 func rewriteValuePPC64_OpLocalAddr(v *Value) bool {
2351         v_0 := v.Args[0]
2352         // match: (LocalAddr {sym} base _)
2353         // result: (MOVDaddr {sym} base)
2354         for {
2355                 sym := auxToSym(v.Aux)
2356                 base := v_0
2357                 v.reset(OpPPC64MOVDaddr)
2358                 v.Aux = symToAux(sym)
2359                 v.AddArg(base)
2360                 return true
2361         }
2362 }
2363 func rewriteValuePPC64_OpLsh16x16(v *Value) bool {
2364         v_1 := v.Args[1]
2365         v_0 := v.Args[0]
2366         b := v.Block
2367         typ := &b.Func.Config.Types
2368         // match: (Lsh16x16 x y)
2369         // cond: shiftIsBounded(v)
2370         // result: (SLW x y)
2371         for {
2372                 x := v_0
2373                 y := v_1
2374                 if !(shiftIsBounded(v)) {
2375                         break
2376                 }
2377                 v.reset(OpPPC64SLW)
2378                 v.AddArg2(x, y)
2379                 return true
2380         }
2381         // match: (Lsh16x16 x y)
2382         // result: (SLW x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt16to64 y) (MOVDconst [16]))))
2383         for {
2384                 x := v_0
2385                 y := v_1
2386                 v.reset(OpPPC64SLW)
2387                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
2388                 v0.AuxInt = int32ToAuxInt(0)
2389                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2390                 v1.AuxInt = int64ToAuxInt(-1)
2391                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2392                 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
2393                 v3.AddArg(y)
2394                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2395                 v4.AuxInt = int64ToAuxInt(16)
2396                 v2.AddArg2(v3, v4)
2397                 v0.AddArg3(y, v1, v2)
2398                 v.AddArg2(x, v0)
2399                 return true
2400         }
2401 }
2402 func rewriteValuePPC64_OpLsh16x32(v *Value) bool {
2403         v_1 := v.Args[1]
2404         v_0 := v.Args[0]
2405         b := v.Block
2406         typ := &b.Func.Config.Types
2407         // match: (Lsh16x32 x (MOVDconst [c]))
2408         // cond: uint32(c) < 16
2409         // result: (SLWconst x [c&31])
2410         for {
2411                 x := v_0
2412                 if v_1.Op != OpPPC64MOVDconst {
2413                         break
2414                 }
2415                 c := auxIntToInt64(v_1.AuxInt)
2416                 if !(uint32(c) < 16) {
2417                         break
2418                 }
2419                 v.reset(OpPPC64SLWconst)
2420                 v.AuxInt = int64ToAuxInt(c & 31)
2421                 v.AddArg(x)
2422                 return true
2423         }
2424         // match: (Lsh16x32 x y)
2425         // cond: shiftIsBounded(v)
2426         // result: (SLW x y)
2427         for {
2428                 x := v_0
2429                 y := v_1
2430                 if !(shiftIsBounded(v)) {
2431                         break
2432                 }
2433                 v.reset(OpPPC64SLW)
2434                 v.AddArg2(x, y)
2435                 return true
2436         }
2437         // match: (Lsh16x32 x y)
2438         // result: (SLW x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [16]))))
2439         for {
2440                 x := v_0
2441                 y := v_1
2442                 v.reset(OpPPC64SLW)
2443                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
2444                 v0.AuxInt = int32ToAuxInt(0)
2445                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2446                 v1.AuxInt = int64ToAuxInt(-1)
2447                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2448                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2449                 v3.AuxInt = int64ToAuxInt(16)
2450                 v2.AddArg2(y, v3)
2451                 v0.AddArg3(y, v1, v2)
2452                 v.AddArg2(x, v0)
2453                 return true
2454         }
2455 }
2456 func rewriteValuePPC64_OpLsh16x64(v *Value) bool {
2457         v_1 := v.Args[1]
2458         v_0 := v.Args[0]
2459         b := v.Block
2460         typ := &b.Func.Config.Types
2461         // match: (Lsh16x64 _ (MOVDconst [c]))
2462         // cond: uint64(c) >= 16
2463         // result: (MOVDconst [0])
2464         for {
2465                 if v_1.Op != OpPPC64MOVDconst {
2466                         break
2467                 }
2468                 c := auxIntToInt64(v_1.AuxInt)
2469                 if !(uint64(c) >= 16) {
2470                         break
2471                 }
2472                 v.reset(OpPPC64MOVDconst)
2473                 v.AuxInt = int64ToAuxInt(0)
2474                 return true
2475         }
2476         // match: (Lsh16x64 x (MOVDconst [c]))
2477         // cond: uint64(c) < 16
2478         // result: (SLWconst x [c])
2479         for {
2480                 x := v_0
2481                 if v_1.Op != OpPPC64MOVDconst {
2482                         break
2483                 }
2484                 c := auxIntToInt64(v_1.AuxInt)
2485                 if !(uint64(c) < 16) {
2486                         break
2487                 }
2488                 v.reset(OpPPC64SLWconst)
2489                 v.AuxInt = int64ToAuxInt(c)
2490                 v.AddArg(x)
2491                 return true
2492         }
2493         // match: (Lsh16x64 x y)
2494         // cond: shiftIsBounded(v)
2495         // result: (SLW x y)
2496         for {
2497                 x := v_0
2498                 y := v_1
2499                 if !(shiftIsBounded(v)) {
2500                         break
2501                 }
2502                 v.reset(OpPPC64SLW)
2503                 v.AddArg2(x, y)
2504                 return true
2505         }
2506         // match: (Lsh16x64 x y)
2507         // result: (SLW x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [16]))))
2508         for {
2509                 x := v_0
2510                 y := v_1
2511                 v.reset(OpPPC64SLW)
2512                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
2513                 v0.AuxInt = int32ToAuxInt(0)
2514                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2515                 v1.AuxInt = int64ToAuxInt(-1)
2516                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2517                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2518                 v3.AuxInt = int64ToAuxInt(16)
2519                 v2.AddArg2(y, v3)
2520                 v0.AddArg3(y, v1, v2)
2521                 v.AddArg2(x, v0)
2522                 return true
2523         }
2524 }
2525 func rewriteValuePPC64_OpLsh16x8(v *Value) bool {
2526         v_1 := v.Args[1]
2527         v_0 := v.Args[0]
2528         b := v.Block
2529         typ := &b.Func.Config.Types
2530         // match: (Lsh16x8 x y)
2531         // cond: shiftIsBounded(v)
2532         // result: (SLW x y)
2533         for {
2534                 x := v_0
2535                 y := v_1
2536                 if !(shiftIsBounded(v)) {
2537                         break
2538                 }
2539                 v.reset(OpPPC64SLW)
2540                 v.AddArg2(x, y)
2541                 return true
2542         }
2543         // match: (Lsh16x8 x y)
2544         // result: (SLW x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt8to64 y) (MOVDconst [16]))))
2545         for {
2546                 x := v_0
2547                 y := v_1
2548                 v.reset(OpPPC64SLW)
2549                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
2550                 v0.AuxInt = int32ToAuxInt(0)
2551                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2552                 v1.AuxInt = int64ToAuxInt(-1)
2553                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2554                 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
2555                 v3.AddArg(y)
2556                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2557                 v4.AuxInt = int64ToAuxInt(16)
2558                 v2.AddArg2(v3, v4)
2559                 v0.AddArg3(y, v1, v2)
2560                 v.AddArg2(x, v0)
2561                 return true
2562         }
2563 }
2564 func rewriteValuePPC64_OpLsh32x16(v *Value) bool {
2565         v_1 := v.Args[1]
2566         v_0 := v.Args[0]
2567         b := v.Block
2568         typ := &b.Func.Config.Types
2569         // match: (Lsh32x16 x y)
2570         // cond: shiftIsBounded(v)
2571         // result: (SLW x y)
2572         for {
2573                 x := v_0
2574                 y := v_1
2575                 if !(shiftIsBounded(v)) {
2576                         break
2577                 }
2578                 v.reset(OpPPC64SLW)
2579                 v.AddArg2(x, y)
2580                 return true
2581         }
2582         // match: (Lsh32x16 x y)
2583         // result: (SLW x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt16to64 y) (MOVDconst [32]))))
2584         for {
2585                 x := v_0
2586                 y := v_1
2587                 v.reset(OpPPC64SLW)
2588                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
2589                 v0.AuxInt = int32ToAuxInt(0)
2590                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2591                 v1.AuxInt = int64ToAuxInt(-1)
2592                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2593                 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
2594                 v3.AddArg(y)
2595                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2596                 v4.AuxInt = int64ToAuxInt(32)
2597                 v2.AddArg2(v3, v4)
2598                 v0.AddArg3(y, v1, v2)
2599                 v.AddArg2(x, v0)
2600                 return true
2601         }
2602 }
2603 func rewriteValuePPC64_OpLsh32x32(v *Value) bool {
2604         v_1 := v.Args[1]
2605         v_0 := v.Args[0]
2606         b := v.Block
2607         typ := &b.Func.Config.Types
2608         // match: (Lsh32x32 x (MOVDconst [c]))
2609         // cond: uint32(c) < 32
2610         // result: (SLWconst x [c&31])
2611         for {
2612                 x := v_0
2613                 if v_1.Op != OpPPC64MOVDconst {
2614                         break
2615                 }
2616                 c := auxIntToInt64(v_1.AuxInt)
2617                 if !(uint32(c) < 32) {
2618                         break
2619                 }
2620                 v.reset(OpPPC64SLWconst)
2621                 v.AuxInt = int64ToAuxInt(c & 31)
2622                 v.AddArg(x)
2623                 return true
2624         }
2625         // match: (Lsh32x32 x y)
2626         // cond: shiftIsBounded(v)
2627         // result: (SLW x y)
2628         for {
2629                 x := v_0
2630                 y := v_1
2631                 if !(shiftIsBounded(v)) {
2632                         break
2633                 }
2634                 v.reset(OpPPC64SLW)
2635                 v.AddArg2(x, y)
2636                 return true
2637         }
2638         // match: (Lsh32x32 x y)
2639         // result: (SLW x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [32]))))
2640         for {
2641                 x := v_0
2642                 y := v_1
2643                 v.reset(OpPPC64SLW)
2644                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
2645                 v0.AuxInt = int32ToAuxInt(0)
2646                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2647                 v1.AuxInt = int64ToAuxInt(-1)
2648                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2649                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2650                 v3.AuxInt = int64ToAuxInt(32)
2651                 v2.AddArg2(y, v3)
2652                 v0.AddArg3(y, v1, v2)
2653                 v.AddArg2(x, v0)
2654                 return true
2655         }
2656 }
2657 func rewriteValuePPC64_OpLsh32x64(v *Value) bool {
2658         v_1 := v.Args[1]
2659         v_0 := v.Args[0]
2660         b := v.Block
2661         typ := &b.Func.Config.Types
2662         // match: (Lsh32x64 _ (MOVDconst [c]))
2663         // cond: uint64(c) >= 32
2664         // result: (MOVDconst [0])
2665         for {
2666                 if v_1.Op != OpPPC64MOVDconst {
2667                         break
2668                 }
2669                 c := auxIntToInt64(v_1.AuxInt)
2670                 if !(uint64(c) >= 32) {
2671                         break
2672                 }
2673                 v.reset(OpPPC64MOVDconst)
2674                 v.AuxInt = int64ToAuxInt(0)
2675                 return true
2676         }
2677         // match: (Lsh32x64 x (MOVDconst [c]))
2678         // cond: uint64(c) < 32
2679         // result: (SLWconst x [c])
2680         for {
2681                 x := v_0
2682                 if v_1.Op != OpPPC64MOVDconst {
2683                         break
2684                 }
2685                 c := auxIntToInt64(v_1.AuxInt)
2686                 if !(uint64(c) < 32) {
2687                         break
2688                 }
2689                 v.reset(OpPPC64SLWconst)
2690                 v.AuxInt = int64ToAuxInt(c)
2691                 v.AddArg(x)
2692                 return true
2693         }
2694         // match: (Lsh32x64 x y)
2695         // cond: shiftIsBounded(v)
2696         // result: (SLW x y)
2697         for {
2698                 x := v_0
2699                 y := v_1
2700                 if !(shiftIsBounded(v)) {
2701                         break
2702                 }
2703                 v.reset(OpPPC64SLW)
2704                 v.AddArg2(x, y)
2705                 return true
2706         }
2707         // match: (Lsh32x64 x (AND y (MOVDconst [31])))
2708         // result: (SLW x (ANDconst <typ.Int32> [31] y))
2709         for {
2710                 x := v_0
2711                 if v_1.Op != OpPPC64AND {
2712                         break
2713                 }
2714                 _ = v_1.Args[1]
2715                 v_1_0 := v_1.Args[0]
2716                 v_1_1 := v_1.Args[1]
2717                 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
2718                         y := v_1_0
2719                         if v_1_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1.AuxInt) != 31 {
2720                                 continue
2721                         }
2722                         v.reset(OpPPC64SLW)
2723                         v0 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.Int32)
2724                         v0.AuxInt = int64ToAuxInt(31)
2725                         v0.AddArg(y)
2726                         v.AddArg2(x, v0)
2727                         return true
2728                 }
2729                 break
2730         }
2731         // match: (Lsh32x64 x (ANDconst <typ.Int32> [31] y))
2732         // result: (SLW x (ANDconst <typ.Int32> [31] y))
2733         for {
2734                 x := v_0
2735                 if v_1.Op != OpPPC64ANDconst || v_1.Type != typ.Int32 || auxIntToInt64(v_1.AuxInt) != 31 {
2736                         break
2737                 }
2738                 y := v_1.Args[0]
2739                 v.reset(OpPPC64SLW)
2740                 v0 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.Int32)
2741                 v0.AuxInt = int64ToAuxInt(31)
2742                 v0.AddArg(y)
2743                 v.AddArg2(x, v0)
2744                 return true
2745         }
2746         // match: (Lsh32x64 x y)
2747         // result: (SLW x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [32]))))
2748         for {
2749                 x := v_0
2750                 y := v_1
2751                 v.reset(OpPPC64SLW)
2752                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
2753                 v0.AuxInt = int32ToAuxInt(0)
2754                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2755                 v1.AuxInt = int64ToAuxInt(-1)
2756                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2757                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2758                 v3.AuxInt = int64ToAuxInt(32)
2759                 v2.AddArg2(y, v3)
2760                 v0.AddArg3(y, v1, v2)
2761                 v.AddArg2(x, v0)
2762                 return true
2763         }
2764 }
2765 func rewriteValuePPC64_OpLsh32x8(v *Value) bool {
2766         v_1 := v.Args[1]
2767         v_0 := v.Args[0]
2768         b := v.Block
2769         typ := &b.Func.Config.Types
2770         // match: (Lsh32x8 x y)
2771         // cond: shiftIsBounded(v)
2772         // result: (SLW x y)
2773         for {
2774                 x := v_0
2775                 y := v_1
2776                 if !(shiftIsBounded(v)) {
2777                         break
2778                 }
2779                 v.reset(OpPPC64SLW)
2780                 v.AddArg2(x, y)
2781                 return true
2782         }
2783         // match: (Lsh32x8 x y)
2784         // result: (SLW x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt8to64 y) (MOVDconst [32]))))
2785         for {
2786                 x := v_0
2787                 y := v_1
2788                 v.reset(OpPPC64SLW)
2789                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
2790                 v0.AuxInt = int32ToAuxInt(0)
2791                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2792                 v1.AuxInt = int64ToAuxInt(-1)
2793                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2794                 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
2795                 v3.AddArg(y)
2796                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2797                 v4.AuxInt = int64ToAuxInt(32)
2798                 v2.AddArg2(v3, v4)
2799                 v0.AddArg3(y, v1, v2)
2800                 v.AddArg2(x, v0)
2801                 return true
2802         }
2803 }
2804 func rewriteValuePPC64_OpLsh64x16(v *Value) bool {
2805         v_1 := v.Args[1]
2806         v_0 := v.Args[0]
2807         b := v.Block
2808         typ := &b.Func.Config.Types
2809         // match: (Lsh64x16 x y)
2810         // cond: shiftIsBounded(v)
2811         // result: (SLD x y)
2812         for {
2813                 x := v_0
2814                 y := v_1
2815                 if !(shiftIsBounded(v)) {
2816                         break
2817                 }
2818                 v.reset(OpPPC64SLD)
2819                 v.AddArg2(x, y)
2820                 return true
2821         }
2822         // match: (Lsh64x16 x y)
2823         // result: (SLD x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt16to64 y) (MOVDconst [64]))))
2824         for {
2825                 x := v_0
2826                 y := v_1
2827                 v.reset(OpPPC64SLD)
2828                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
2829                 v0.AuxInt = int32ToAuxInt(0)
2830                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2831                 v1.AuxInt = int64ToAuxInt(-1)
2832                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2833                 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
2834                 v3.AddArg(y)
2835                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2836                 v4.AuxInt = int64ToAuxInt(64)
2837                 v2.AddArg2(v3, v4)
2838                 v0.AddArg3(y, v1, v2)
2839                 v.AddArg2(x, v0)
2840                 return true
2841         }
2842 }
2843 func rewriteValuePPC64_OpLsh64x32(v *Value) bool {
2844         v_1 := v.Args[1]
2845         v_0 := v.Args[0]
2846         b := v.Block
2847         typ := &b.Func.Config.Types
2848         // match: (Lsh64x32 x (MOVDconst [c]))
2849         // cond: uint32(c) < 64
2850         // result: (SLDconst x [c&63])
2851         for {
2852                 x := v_0
2853                 if v_1.Op != OpPPC64MOVDconst {
2854                         break
2855                 }
2856                 c := auxIntToInt64(v_1.AuxInt)
2857                 if !(uint32(c) < 64) {
2858                         break
2859                 }
2860                 v.reset(OpPPC64SLDconst)
2861                 v.AuxInt = int64ToAuxInt(c & 63)
2862                 v.AddArg(x)
2863                 return true
2864         }
2865         // match: (Lsh64x32 x y)
2866         // cond: shiftIsBounded(v)
2867         // result: (SLD x y)
2868         for {
2869                 x := v_0
2870                 y := v_1
2871                 if !(shiftIsBounded(v)) {
2872                         break
2873                 }
2874                 v.reset(OpPPC64SLD)
2875                 v.AddArg2(x, y)
2876                 return true
2877         }
2878         // match: (Lsh64x32 x y)
2879         // result: (SLD x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [64]))))
2880         for {
2881                 x := v_0
2882                 y := v_1
2883                 v.reset(OpPPC64SLD)
2884                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
2885                 v0.AuxInt = int32ToAuxInt(0)
2886                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2887                 v1.AuxInt = int64ToAuxInt(-1)
2888                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2889                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2890                 v3.AuxInt = int64ToAuxInt(64)
2891                 v2.AddArg2(y, v3)
2892                 v0.AddArg3(y, v1, v2)
2893                 v.AddArg2(x, v0)
2894                 return true
2895         }
2896 }
2897 func rewriteValuePPC64_OpLsh64x64(v *Value) bool {
2898         v_1 := v.Args[1]
2899         v_0 := v.Args[0]
2900         b := v.Block
2901         typ := &b.Func.Config.Types
2902         // match: (Lsh64x64 _ (MOVDconst [c]))
2903         // cond: uint64(c) >= 64
2904         // result: (MOVDconst [0])
2905         for {
2906                 if v_1.Op != OpPPC64MOVDconst {
2907                         break
2908                 }
2909                 c := auxIntToInt64(v_1.AuxInt)
2910                 if !(uint64(c) >= 64) {
2911                         break
2912                 }
2913                 v.reset(OpPPC64MOVDconst)
2914                 v.AuxInt = int64ToAuxInt(0)
2915                 return true
2916         }
2917         // match: (Lsh64x64 x (MOVDconst [c]))
2918         // cond: uint64(c) < 64
2919         // result: (SLDconst x [c])
2920         for {
2921                 x := v_0
2922                 if v_1.Op != OpPPC64MOVDconst {
2923                         break
2924                 }
2925                 c := auxIntToInt64(v_1.AuxInt)
2926                 if !(uint64(c) < 64) {
2927                         break
2928                 }
2929                 v.reset(OpPPC64SLDconst)
2930                 v.AuxInt = int64ToAuxInt(c)
2931                 v.AddArg(x)
2932                 return true
2933         }
2934         // match: (Lsh64x64 x y)
2935         // cond: shiftIsBounded(v)
2936         // result: (SLD x y)
2937         for {
2938                 x := v_0
2939                 y := v_1
2940                 if !(shiftIsBounded(v)) {
2941                         break
2942                 }
2943                 v.reset(OpPPC64SLD)
2944                 v.AddArg2(x, y)
2945                 return true
2946         }
2947         // match: (Lsh64x64 x (AND y (MOVDconst [63])))
2948         // result: (SLD x (ANDconst <typ.Int64> [63] y))
2949         for {
2950                 x := v_0
2951                 if v_1.Op != OpPPC64AND {
2952                         break
2953                 }
2954                 _ = v_1.Args[1]
2955                 v_1_0 := v_1.Args[0]
2956                 v_1_1 := v_1.Args[1]
2957                 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
2958                         y := v_1_0
2959                         if v_1_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1.AuxInt) != 63 {
2960                                 continue
2961                         }
2962                         v.reset(OpPPC64SLD)
2963                         v0 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.Int64)
2964                         v0.AuxInt = int64ToAuxInt(63)
2965                         v0.AddArg(y)
2966                         v.AddArg2(x, v0)
2967                         return true
2968                 }
2969                 break
2970         }
2971         // match: (Lsh64x64 x (ANDconst <typ.Int64> [63] y))
2972         // result: (SLD x (ANDconst <typ.Int64> [63] y))
2973         for {
2974                 x := v_0
2975                 if v_1.Op != OpPPC64ANDconst || v_1.Type != typ.Int64 || auxIntToInt64(v_1.AuxInt) != 63 {
2976                         break
2977                 }
2978                 y := v_1.Args[0]
2979                 v.reset(OpPPC64SLD)
2980                 v0 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.Int64)
2981                 v0.AuxInt = int64ToAuxInt(63)
2982                 v0.AddArg(y)
2983                 v.AddArg2(x, v0)
2984                 return true
2985         }
2986         // match: (Lsh64x64 x y)
2987         // result: (SLD x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [64]))))
2988         for {
2989                 x := v_0
2990                 y := v_1
2991                 v.reset(OpPPC64SLD)
2992                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
2993                 v0.AuxInt = int32ToAuxInt(0)
2994                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2995                 v1.AuxInt = int64ToAuxInt(-1)
2996                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2997                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2998                 v3.AuxInt = int64ToAuxInt(64)
2999                 v2.AddArg2(y, v3)
3000                 v0.AddArg3(y, v1, v2)
3001                 v.AddArg2(x, v0)
3002                 return true
3003         }
3004 }
3005 func rewriteValuePPC64_OpLsh64x8(v *Value) bool {
3006         v_1 := v.Args[1]
3007         v_0 := v.Args[0]
3008         b := v.Block
3009         typ := &b.Func.Config.Types
3010         // match: (Lsh64x8 x y)
3011         // cond: shiftIsBounded(v)
3012         // result: (SLD x y)
3013         for {
3014                 x := v_0
3015                 y := v_1
3016                 if !(shiftIsBounded(v)) {
3017                         break
3018                 }
3019                 v.reset(OpPPC64SLD)
3020                 v.AddArg2(x, y)
3021                 return true
3022         }
3023         // match: (Lsh64x8 x y)
3024         // result: (SLD x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt8to64 y) (MOVDconst [64]))))
3025         for {
3026                 x := v_0
3027                 y := v_1
3028                 v.reset(OpPPC64SLD)
3029                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
3030                 v0.AuxInt = int32ToAuxInt(0)
3031                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3032                 v1.AuxInt = int64ToAuxInt(-1)
3033                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
3034                 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
3035                 v3.AddArg(y)
3036                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3037                 v4.AuxInt = int64ToAuxInt(64)
3038                 v2.AddArg2(v3, v4)
3039                 v0.AddArg3(y, v1, v2)
3040                 v.AddArg2(x, v0)
3041                 return true
3042         }
3043 }
3044 func rewriteValuePPC64_OpLsh8x16(v *Value) bool {
3045         v_1 := v.Args[1]
3046         v_0 := v.Args[0]
3047         b := v.Block
3048         typ := &b.Func.Config.Types
3049         // match: (Lsh8x16 x y)
3050         // cond: shiftIsBounded(v)
3051         // result: (SLW x y)
3052         for {
3053                 x := v_0
3054                 y := v_1
3055                 if !(shiftIsBounded(v)) {
3056                         break
3057                 }
3058                 v.reset(OpPPC64SLW)
3059                 v.AddArg2(x, y)
3060                 return true
3061         }
3062         // match: (Lsh8x16 x y)
3063         // result: (SLW x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt16to64 y) (MOVDconst [8]))))
3064         for {
3065                 x := v_0
3066                 y := v_1
3067                 v.reset(OpPPC64SLW)
3068                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
3069                 v0.AuxInt = int32ToAuxInt(0)
3070                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3071                 v1.AuxInt = int64ToAuxInt(-1)
3072                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
3073                 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
3074                 v3.AddArg(y)
3075                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3076                 v4.AuxInt = int64ToAuxInt(8)
3077                 v2.AddArg2(v3, v4)
3078                 v0.AddArg3(y, v1, v2)
3079                 v.AddArg2(x, v0)
3080                 return true
3081         }
3082 }
3083 func rewriteValuePPC64_OpLsh8x32(v *Value) bool {
3084         v_1 := v.Args[1]
3085         v_0 := v.Args[0]
3086         b := v.Block
3087         typ := &b.Func.Config.Types
3088         // match: (Lsh8x32 x (MOVDconst [c]))
3089         // cond: uint32(c) < 8
3090         // result: (SLWconst x [c&7])
3091         for {
3092                 x := v_0
3093                 if v_1.Op != OpPPC64MOVDconst {
3094                         break
3095                 }
3096                 c := auxIntToInt64(v_1.AuxInt)
3097                 if !(uint32(c) < 8) {
3098                         break
3099                 }
3100                 v.reset(OpPPC64SLWconst)
3101                 v.AuxInt = int64ToAuxInt(c & 7)
3102                 v.AddArg(x)
3103                 return true
3104         }
3105         // match: (Lsh8x32 x y)
3106         // cond: shiftIsBounded(v)
3107         // result: (SLW x y)
3108         for {
3109                 x := v_0
3110                 y := v_1
3111                 if !(shiftIsBounded(v)) {
3112                         break
3113                 }
3114                 v.reset(OpPPC64SLW)
3115                 v.AddArg2(x, y)
3116                 return true
3117         }
3118         // match: (Lsh8x32 x y)
3119         // result: (SLW x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [8]))))
3120         for {
3121                 x := v_0
3122                 y := v_1
3123                 v.reset(OpPPC64SLW)
3124                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
3125                 v0.AuxInt = int32ToAuxInt(0)
3126                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3127                 v1.AuxInt = int64ToAuxInt(-1)
3128                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
3129                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3130                 v3.AuxInt = int64ToAuxInt(8)
3131                 v2.AddArg2(y, v3)
3132                 v0.AddArg3(y, v1, v2)
3133                 v.AddArg2(x, v0)
3134                 return true
3135         }
3136 }
3137 func rewriteValuePPC64_OpLsh8x64(v *Value) bool {
3138         v_1 := v.Args[1]
3139         v_0 := v.Args[0]
3140         b := v.Block
3141         typ := &b.Func.Config.Types
3142         // match: (Lsh8x64 _ (MOVDconst [c]))
3143         // cond: uint64(c) >= 8
3144         // result: (MOVDconst [0])
3145         for {
3146                 if v_1.Op != OpPPC64MOVDconst {
3147                         break
3148                 }
3149                 c := auxIntToInt64(v_1.AuxInt)
3150                 if !(uint64(c) >= 8) {
3151                         break
3152                 }
3153                 v.reset(OpPPC64MOVDconst)
3154                 v.AuxInt = int64ToAuxInt(0)
3155                 return true
3156         }
3157         // match: (Lsh8x64 x (MOVDconst [c]))
3158         // cond: uint64(c) < 8
3159         // result: (SLWconst x [c])
3160         for {
3161                 x := v_0
3162                 if v_1.Op != OpPPC64MOVDconst {
3163                         break
3164                 }
3165                 c := auxIntToInt64(v_1.AuxInt)
3166                 if !(uint64(c) < 8) {
3167                         break
3168                 }
3169                 v.reset(OpPPC64SLWconst)
3170                 v.AuxInt = int64ToAuxInt(c)
3171                 v.AddArg(x)
3172                 return true
3173         }
3174         // match: (Lsh8x64 x y)
3175         // cond: shiftIsBounded(v)
3176         // result: (SLW x y)
3177         for {
3178                 x := v_0
3179                 y := v_1
3180                 if !(shiftIsBounded(v)) {
3181                         break
3182                 }
3183                 v.reset(OpPPC64SLW)
3184                 v.AddArg2(x, y)
3185                 return true
3186         }
3187         // match: (Lsh8x64 x y)
3188         // result: (SLW x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [8]))))
3189         for {
3190                 x := v_0
3191                 y := v_1
3192                 v.reset(OpPPC64SLW)
3193                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
3194                 v0.AuxInt = int32ToAuxInt(0)
3195                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3196                 v1.AuxInt = int64ToAuxInt(-1)
3197                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
3198                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3199                 v3.AuxInt = int64ToAuxInt(8)
3200                 v2.AddArg2(y, v3)
3201                 v0.AddArg3(y, v1, v2)
3202                 v.AddArg2(x, v0)
3203                 return true
3204         }
3205 }
3206 func rewriteValuePPC64_OpLsh8x8(v *Value) bool {
3207         v_1 := v.Args[1]
3208         v_0 := v.Args[0]
3209         b := v.Block
3210         typ := &b.Func.Config.Types
3211         // match: (Lsh8x8 x y)
3212         // cond: shiftIsBounded(v)
3213         // result: (SLW x y)
3214         for {
3215                 x := v_0
3216                 y := v_1
3217                 if !(shiftIsBounded(v)) {
3218                         break
3219                 }
3220                 v.reset(OpPPC64SLW)
3221                 v.AddArg2(x, y)
3222                 return true
3223         }
3224         // match: (Lsh8x8 x y)
3225         // result: (SLW x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt8to64 y) (MOVDconst [8]))))
3226         for {
3227                 x := v_0
3228                 y := v_1
3229                 v.reset(OpPPC64SLW)
3230                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
3231                 v0.AuxInt = int32ToAuxInt(0)
3232                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3233                 v1.AuxInt = int64ToAuxInt(-1)
3234                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
3235                 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
3236                 v3.AddArg(y)
3237                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3238                 v4.AuxInt = int64ToAuxInt(8)
3239                 v2.AddArg2(v3, v4)
3240                 v0.AddArg3(y, v1, v2)
3241                 v.AddArg2(x, v0)
3242                 return true
3243         }
3244 }
3245 func rewriteValuePPC64_OpMod16(v *Value) bool {
3246         v_1 := v.Args[1]
3247         v_0 := v.Args[0]
3248         b := v.Block
3249         typ := &b.Func.Config.Types
3250         // match: (Mod16 x y)
3251         // result: (Mod32 (SignExt16to32 x) (SignExt16to32 y))
3252         for {
3253                 x := v_0
3254                 y := v_1
3255                 v.reset(OpMod32)
3256                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3257                 v0.AddArg(x)
3258                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3259                 v1.AddArg(y)
3260                 v.AddArg2(v0, v1)
3261                 return true
3262         }
3263 }
3264 func rewriteValuePPC64_OpMod16u(v *Value) bool {
3265         v_1 := v.Args[1]
3266         v_0 := v.Args[0]
3267         b := v.Block
3268         typ := &b.Func.Config.Types
3269         // match: (Mod16u x y)
3270         // result: (Mod32u (ZeroExt16to32 x) (ZeroExt16to32 y))
3271         for {
3272                 x := v_0
3273                 y := v_1
3274                 v.reset(OpMod32u)
3275                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3276                 v0.AddArg(x)
3277                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3278                 v1.AddArg(y)
3279                 v.AddArg2(v0, v1)
3280                 return true
3281         }
3282 }
3283 func rewriteValuePPC64_OpMod32(v *Value) bool {
3284         v_1 := v.Args[1]
3285         v_0 := v.Args[0]
3286         b := v.Block
3287         typ := &b.Func.Config.Types
3288         // match: (Mod32 x y)
3289         // cond: objabi.GOPPC64 >= 9
3290         // result: (MODSW x y)
3291         for {
3292                 x := v_0
3293                 y := v_1
3294                 if !(objabi.GOPPC64 >= 9) {
3295                         break
3296                 }
3297                 v.reset(OpPPC64MODSW)
3298                 v.AddArg2(x, y)
3299                 return true
3300         }
3301         // match: (Mod32 x y)
3302         // cond: objabi.GOPPC64 <= 8
3303         // result: (SUB x (MULLW y (DIVW x y)))
3304         for {
3305                 x := v_0
3306                 y := v_1
3307                 if !(objabi.GOPPC64 <= 8) {
3308                         break
3309                 }
3310                 v.reset(OpPPC64SUB)
3311                 v0 := b.NewValue0(v.Pos, OpPPC64MULLW, typ.Int32)
3312                 v1 := b.NewValue0(v.Pos, OpPPC64DIVW, typ.Int32)
3313                 v1.AddArg2(x, y)
3314                 v0.AddArg2(y, v1)
3315                 v.AddArg2(x, v0)
3316                 return true
3317         }
3318         return false
3319 }
3320 func rewriteValuePPC64_OpMod32u(v *Value) bool {
3321         v_1 := v.Args[1]
3322         v_0 := v.Args[0]
3323         b := v.Block
3324         typ := &b.Func.Config.Types
3325         // match: (Mod32u x y)
3326         // cond: objabi.GOPPC64 >= 9
3327         // result: (MODUW x y)
3328         for {
3329                 x := v_0
3330                 y := v_1
3331                 if !(objabi.GOPPC64 >= 9) {
3332                         break
3333                 }
3334                 v.reset(OpPPC64MODUW)
3335                 v.AddArg2(x, y)
3336                 return true
3337         }
3338         // match: (Mod32u x y)
3339         // cond: objabi.GOPPC64 <= 8
3340         // result: (SUB x (MULLW y (DIVWU x y)))
3341         for {
3342                 x := v_0
3343                 y := v_1
3344                 if !(objabi.GOPPC64 <= 8) {
3345                         break
3346                 }
3347                 v.reset(OpPPC64SUB)
3348                 v0 := b.NewValue0(v.Pos, OpPPC64MULLW, typ.Int32)
3349                 v1 := b.NewValue0(v.Pos, OpPPC64DIVWU, typ.Int32)
3350                 v1.AddArg2(x, y)
3351                 v0.AddArg2(y, v1)
3352                 v.AddArg2(x, v0)
3353                 return true
3354         }
3355         return false
3356 }
3357 func rewriteValuePPC64_OpMod64(v *Value) bool {
3358         v_1 := v.Args[1]
3359         v_0 := v.Args[0]
3360         b := v.Block
3361         typ := &b.Func.Config.Types
3362         // match: (Mod64 x y)
3363         // cond: objabi.GOPPC64 >=9
3364         // result: (MODSD x y)
3365         for {
3366                 x := v_0
3367                 y := v_1
3368                 if !(objabi.GOPPC64 >= 9) {
3369                         break
3370                 }
3371                 v.reset(OpPPC64MODSD)
3372                 v.AddArg2(x, y)
3373                 return true
3374         }
3375         // match: (Mod64 x y)
3376         // cond: objabi.GOPPC64 <=8
3377         // result: (SUB x (MULLD y (DIVD x y)))
3378         for {
3379                 x := v_0
3380                 y := v_1
3381                 if !(objabi.GOPPC64 <= 8) {
3382                         break
3383                 }
3384                 v.reset(OpPPC64SUB)
3385                 v0 := b.NewValue0(v.Pos, OpPPC64MULLD, typ.Int64)
3386                 v1 := b.NewValue0(v.Pos, OpPPC64DIVD, typ.Int64)
3387                 v1.AddArg2(x, y)
3388                 v0.AddArg2(y, v1)
3389                 v.AddArg2(x, v0)
3390                 return true
3391         }
3392         return false
3393 }
3394 func rewriteValuePPC64_OpMod64u(v *Value) bool {
3395         v_1 := v.Args[1]
3396         v_0 := v.Args[0]
3397         b := v.Block
3398         typ := &b.Func.Config.Types
3399         // match: (Mod64u x y)
3400         // cond: objabi.GOPPC64 >= 9
3401         // result: (MODUD x y)
3402         for {
3403                 x := v_0
3404                 y := v_1
3405                 if !(objabi.GOPPC64 >= 9) {
3406                         break
3407                 }
3408                 v.reset(OpPPC64MODUD)
3409                 v.AddArg2(x, y)
3410                 return true
3411         }
3412         // match: (Mod64u x y)
3413         // cond: objabi.GOPPC64 <= 8
3414         // result: (SUB x (MULLD y (DIVDU x y)))
3415         for {
3416                 x := v_0
3417                 y := v_1
3418                 if !(objabi.GOPPC64 <= 8) {
3419                         break
3420                 }
3421                 v.reset(OpPPC64SUB)
3422                 v0 := b.NewValue0(v.Pos, OpPPC64MULLD, typ.Int64)
3423                 v1 := b.NewValue0(v.Pos, OpPPC64DIVDU, typ.Int64)
3424                 v1.AddArg2(x, y)
3425                 v0.AddArg2(y, v1)
3426                 v.AddArg2(x, v0)
3427                 return true
3428         }
3429         return false
3430 }
3431 func rewriteValuePPC64_OpMod8(v *Value) bool {
3432         v_1 := v.Args[1]
3433         v_0 := v.Args[0]
3434         b := v.Block
3435         typ := &b.Func.Config.Types
3436         // match: (Mod8 x y)
3437         // result: (Mod32 (SignExt8to32 x) (SignExt8to32 y))
3438         for {
3439                 x := v_0
3440                 y := v_1
3441                 v.reset(OpMod32)
3442                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3443                 v0.AddArg(x)
3444                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3445                 v1.AddArg(y)
3446                 v.AddArg2(v0, v1)
3447                 return true
3448         }
3449 }
3450 func rewriteValuePPC64_OpMod8u(v *Value) bool {
3451         v_1 := v.Args[1]
3452         v_0 := v.Args[0]
3453         b := v.Block
3454         typ := &b.Func.Config.Types
3455         // match: (Mod8u x y)
3456         // result: (Mod32u (ZeroExt8to32 x) (ZeroExt8to32 y))
3457         for {
3458                 x := v_0
3459                 y := v_1
3460                 v.reset(OpMod32u)
3461                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3462                 v0.AddArg(x)
3463                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3464                 v1.AddArg(y)
3465                 v.AddArg2(v0, v1)
3466                 return true
3467         }
3468 }
3469 func rewriteValuePPC64_OpMove(v *Value) bool {
3470         v_2 := v.Args[2]
3471         v_1 := v.Args[1]
3472         v_0 := v.Args[0]
3473         b := v.Block
3474         typ := &b.Func.Config.Types
3475         // match: (Move [0] _ _ mem)
3476         // result: mem
3477         for {
3478                 if auxIntToInt64(v.AuxInt) != 0 {
3479                         break
3480                 }
3481                 mem := v_2
3482                 v.copyOf(mem)
3483                 return true
3484         }
3485         // match: (Move [1] dst src mem)
3486         // result: (MOVBstore dst (MOVBZload src mem) mem)
3487         for {
3488                 if auxIntToInt64(v.AuxInt) != 1 {
3489                         break
3490                 }
3491                 dst := v_0
3492                 src := v_1
3493                 mem := v_2
3494                 v.reset(OpPPC64MOVBstore)
3495                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3496                 v0.AddArg2(src, mem)
3497                 v.AddArg3(dst, v0, mem)
3498                 return true
3499         }
3500         // match: (Move [2] dst src mem)
3501         // result: (MOVHstore dst (MOVHZload src mem) mem)
3502         for {
3503                 if auxIntToInt64(v.AuxInt) != 2 {
3504                         break
3505                 }
3506                 dst := v_0
3507                 src := v_1
3508                 mem := v_2
3509                 v.reset(OpPPC64MOVHstore)
3510                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16)
3511                 v0.AddArg2(src, mem)
3512                 v.AddArg3(dst, v0, mem)
3513                 return true
3514         }
3515         // match: (Move [4] dst src mem)
3516         // result: (MOVWstore dst (MOVWZload src mem) mem)
3517         for {
3518                 if auxIntToInt64(v.AuxInt) != 4 {
3519                         break
3520                 }
3521                 dst := v_0
3522                 src := v_1
3523                 mem := v_2
3524                 v.reset(OpPPC64MOVWstore)
3525                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3526                 v0.AddArg2(src, mem)
3527                 v.AddArg3(dst, v0, mem)
3528                 return true
3529         }
3530         // match: (Move [8] {t} dst src mem)
3531         // result: (MOVDstore dst (MOVDload src mem) mem)
3532         for {
3533                 if auxIntToInt64(v.AuxInt) != 8 {
3534                         break
3535                 }
3536                 dst := v_0
3537                 src := v_1
3538                 mem := v_2
3539                 v.reset(OpPPC64MOVDstore)
3540                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, typ.Int64)
3541                 v0.AddArg2(src, mem)
3542                 v.AddArg3(dst, v0, mem)
3543                 return true
3544         }
3545         // match: (Move [3] dst src mem)
3546         // result: (MOVBstore [2] dst (MOVBZload [2] src mem) (MOVHstore dst (MOVHload src mem) mem))
3547         for {
3548                 if auxIntToInt64(v.AuxInt) != 3 {
3549                         break
3550                 }
3551                 dst := v_0
3552                 src := v_1
3553                 mem := v_2
3554                 v.reset(OpPPC64MOVBstore)
3555                 v.AuxInt = int32ToAuxInt(2)
3556                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3557                 v0.AuxInt = int32ToAuxInt(2)
3558                 v0.AddArg2(src, mem)
3559                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHstore, types.TypeMem)
3560                 v2 := b.NewValue0(v.Pos, OpPPC64MOVHload, typ.Int16)
3561                 v2.AddArg2(src, mem)
3562                 v1.AddArg3(dst, v2, mem)
3563                 v.AddArg3(dst, v0, v1)
3564                 return true
3565         }
3566         // match: (Move [5] dst src mem)
3567         // result: (MOVBstore [4] dst (MOVBZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3568         for {
3569                 if auxIntToInt64(v.AuxInt) != 5 {
3570                         break
3571                 }
3572                 dst := v_0
3573                 src := v_1
3574                 mem := v_2
3575                 v.reset(OpPPC64MOVBstore)
3576                 v.AuxInt = int32ToAuxInt(4)
3577                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3578                 v0.AuxInt = int32ToAuxInt(4)
3579                 v0.AddArg2(src, mem)
3580                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem)
3581                 v2 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3582                 v2.AddArg2(src, mem)
3583                 v1.AddArg3(dst, v2, mem)
3584                 v.AddArg3(dst, v0, v1)
3585                 return true
3586         }
3587         // match: (Move [6] dst src mem)
3588         // result: (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3589         for {
3590                 if auxIntToInt64(v.AuxInt) != 6 {
3591                         break
3592                 }
3593                 dst := v_0
3594                 src := v_1
3595                 mem := v_2
3596                 v.reset(OpPPC64MOVHstore)
3597                 v.AuxInt = int32ToAuxInt(4)
3598                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16)
3599                 v0.AuxInt = int32ToAuxInt(4)
3600                 v0.AddArg2(src, mem)
3601                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem)
3602                 v2 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3603                 v2.AddArg2(src, mem)
3604                 v1.AddArg3(dst, v2, mem)
3605                 v.AddArg3(dst, v0, v1)
3606                 return true
3607         }
3608         // match: (Move [7] dst src mem)
3609         // result: (MOVBstore [6] dst (MOVBZload [6] src mem) (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem)))
3610         for {
3611                 if auxIntToInt64(v.AuxInt) != 7 {
3612                         break
3613                 }
3614                 dst := v_0
3615                 src := v_1
3616                 mem := v_2
3617                 v.reset(OpPPC64MOVBstore)
3618                 v.AuxInt = int32ToAuxInt(6)
3619                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3620                 v0.AuxInt = int32ToAuxInt(6)
3621                 v0.AddArg2(src, mem)
3622                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHstore, types.TypeMem)
3623                 v1.AuxInt = int32ToAuxInt(4)
3624                 v2 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16)
3625                 v2.AuxInt = int32ToAuxInt(4)
3626                 v2.AddArg2(src, mem)
3627                 v3 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem)
3628                 v4 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3629                 v4.AddArg2(src, mem)
3630                 v3.AddArg3(dst, v4, mem)
3631                 v1.AddArg3(dst, v2, v3)
3632                 v.AddArg3(dst, v0, v1)
3633                 return true
3634         }
3635         // match: (Move [s] dst src mem)
3636         // cond: s > 8 && objabi.GOPPC64 <= 8 && logLargeCopy(v, s)
3637         // result: (LoweredMove [s] dst src mem)
3638         for {
3639                 s := auxIntToInt64(v.AuxInt)
3640                 dst := v_0
3641                 src := v_1
3642                 mem := v_2
3643                 if !(s > 8 && objabi.GOPPC64 <= 8 && logLargeCopy(v, s)) {
3644                         break
3645                 }
3646                 v.reset(OpPPC64LoweredMove)
3647                 v.AuxInt = int64ToAuxInt(s)
3648                 v.AddArg3(dst, src, mem)
3649                 return true
3650         }
3651         // match: (Move [s] dst src mem)
3652         // cond: s > 8 && s <= 64 && objabi.GOPPC64 >= 9
3653         // result: (LoweredQuadMoveShort [s] dst src mem)
3654         for {
3655                 s := auxIntToInt64(v.AuxInt)
3656                 dst := v_0
3657                 src := v_1
3658                 mem := v_2
3659                 if !(s > 8 && s <= 64 && objabi.GOPPC64 >= 9) {
3660                         break
3661                 }
3662                 v.reset(OpPPC64LoweredQuadMoveShort)
3663                 v.AuxInt = int64ToAuxInt(s)
3664                 v.AddArg3(dst, src, mem)
3665                 return true
3666         }
3667         // match: (Move [s] dst src mem)
3668         // cond: s > 8 && objabi.GOPPC64 >= 9 && logLargeCopy(v, s)
3669         // result: (LoweredQuadMove [s] dst src mem)
3670         for {
3671                 s := auxIntToInt64(v.AuxInt)
3672                 dst := v_0
3673                 src := v_1
3674                 mem := v_2
3675                 if !(s > 8 && objabi.GOPPC64 >= 9 && logLargeCopy(v, s)) {
3676                         break
3677                 }
3678                 v.reset(OpPPC64LoweredQuadMove)
3679                 v.AuxInt = int64ToAuxInt(s)
3680                 v.AddArg3(dst, src, mem)
3681                 return true
3682         }
3683         return false
3684 }
3685 func rewriteValuePPC64_OpNeq16(v *Value) bool {
3686         v_1 := v.Args[1]
3687         v_0 := v.Args[0]
3688         b := v.Block
3689         typ := &b.Func.Config.Types
3690         // match: (Neq16 x y)
3691         // cond: isSigned(x.Type) && isSigned(y.Type)
3692         // result: (NotEqual (CMPW (SignExt16to32 x) (SignExt16to32 y)))
3693         for {
3694                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3695                         x := v_0
3696                         y := v_1
3697                         if !(isSigned(x.Type) && isSigned(y.Type)) {
3698                                 continue
3699                         }
3700                         v.reset(OpPPC64NotEqual)
3701                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3702                         v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3703                         v1.AddArg(x)
3704                         v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3705                         v2.AddArg(y)
3706                         v0.AddArg2(v1, v2)
3707                         v.AddArg(v0)
3708                         return true
3709                 }
3710                 break
3711         }
3712         // match: (Neq16 x y)
3713         // result: (NotEqual (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
3714         for {
3715                 x := v_0
3716                 y := v_1
3717                 v.reset(OpPPC64NotEqual)
3718                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3719                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3720                 v1.AddArg(x)
3721                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3722                 v2.AddArg(y)
3723                 v0.AddArg2(v1, v2)
3724                 v.AddArg(v0)
3725                 return true
3726         }
3727 }
3728 func rewriteValuePPC64_OpNeq32(v *Value) bool {
3729         v_1 := v.Args[1]
3730         v_0 := v.Args[0]
3731         b := v.Block
3732         // match: (Neq32 x y)
3733         // result: (NotEqual (CMPW x y))
3734         for {
3735                 x := v_0
3736                 y := v_1
3737                 v.reset(OpPPC64NotEqual)
3738                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3739                 v0.AddArg2(x, y)
3740                 v.AddArg(v0)
3741                 return true
3742         }
3743 }
3744 func rewriteValuePPC64_OpNeq32F(v *Value) bool {
3745         v_1 := v.Args[1]
3746         v_0 := v.Args[0]
3747         b := v.Block
3748         // match: (Neq32F x y)
3749         // result: (NotEqual (FCMPU x y))
3750         for {
3751                 x := v_0
3752                 y := v_1
3753                 v.reset(OpPPC64NotEqual)
3754                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
3755                 v0.AddArg2(x, y)
3756                 v.AddArg(v0)
3757                 return true
3758         }
3759 }
3760 func rewriteValuePPC64_OpNeq64(v *Value) bool {
3761         v_1 := v.Args[1]
3762         v_0 := v.Args[0]
3763         b := v.Block
3764         // match: (Neq64 x y)
3765         // result: (NotEqual (CMP x y))
3766         for {
3767                 x := v_0
3768                 y := v_1
3769                 v.reset(OpPPC64NotEqual)
3770                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
3771                 v0.AddArg2(x, y)
3772                 v.AddArg(v0)
3773                 return true
3774         }
3775 }
3776 func rewriteValuePPC64_OpNeq64F(v *Value) bool {
3777         v_1 := v.Args[1]
3778         v_0 := v.Args[0]
3779         b := v.Block
3780         // match: (Neq64F x y)
3781         // result: (NotEqual (FCMPU x y))
3782         for {
3783                 x := v_0
3784                 y := v_1
3785                 v.reset(OpPPC64NotEqual)
3786                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
3787                 v0.AddArg2(x, y)
3788                 v.AddArg(v0)
3789                 return true
3790         }
3791 }
3792 func rewriteValuePPC64_OpNeq8(v *Value) bool {
3793         v_1 := v.Args[1]
3794         v_0 := v.Args[0]
3795         b := v.Block
3796         typ := &b.Func.Config.Types
3797         // match: (Neq8 x y)
3798         // cond: isSigned(x.Type) && isSigned(y.Type)
3799         // result: (NotEqual (CMPW (SignExt8to32 x) (SignExt8to32 y)))
3800         for {
3801                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3802                         x := v_0
3803                         y := v_1
3804                         if !(isSigned(x.Type) && isSigned(y.Type)) {
3805                                 continue
3806                         }
3807                         v.reset(OpPPC64NotEqual)
3808                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3809                         v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3810                         v1.AddArg(x)
3811                         v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3812                         v2.AddArg(y)
3813                         v0.AddArg2(v1, v2)
3814                         v.AddArg(v0)
3815                         return true
3816                 }
3817                 break
3818         }
3819         // match: (Neq8 x y)
3820         // result: (NotEqual (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
3821         for {
3822                 x := v_0
3823                 y := v_1
3824                 v.reset(OpPPC64NotEqual)
3825                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3826                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3827                 v1.AddArg(x)
3828                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3829                 v2.AddArg(y)
3830                 v0.AddArg2(v1, v2)
3831                 v.AddArg(v0)
3832                 return true
3833         }
3834 }
3835 func rewriteValuePPC64_OpNeqPtr(v *Value) bool {
3836         v_1 := v.Args[1]
3837         v_0 := v.Args[0]
3838         b := v.Block
3839         // match: (NeqPtr x y)
3840         // result: (NotEqual (CMP x y))
3841         for {
3842                 x := v_0
3843                 y := v_1
3844                 v.reset(OpPPC64NotEqual)
3845                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
3846                 v0.AddArg2(x, y)
3847                 v.AddArg(v0)
3848                 return true
3849         }
3850 }
3851 func rewriteValuePPC64_OpNot(v *Value) bool {
3852         v_0 := v.Args[0]
3853         // match: (Not x)
3854         // result: (XORconst [1] x)
3855         for {
3856                 x := v_0
3857                 v.reset(OpPPC64XORconst)
3858                 v.AuxInt = int64ToAuxInt(1)
3859                 v.AddArg(x)
3860                 return true
3861         }
3862 }
3863 func rewriteValuePPC64_OpOffPtr(v *Value) bool {
3864         v_0 := v.Args[0]
3865         b := v.Block
3866         typ := &b.Func.Config.Types
3867         // match: (OffPtr [off] ptr)
3868         // result: (ADD (MOVDconst <typ.Int64> [off]) ptr)
3869         for {
3870                 off := auxIntToInt64(v.AuxInt)
3871                 ptr := v_0
3872                 v.reset(OpPPC64ADD)
3873                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3874                 v0.AuxInt = int64ToAuxInt(off)
3875                 v.AddArg2(v0, ptr)
3876                 return true
3877         }
3878 }
3879 func rewriteValuePPC64_OpPPC64ADD(v *Value) bool {
3880         v_1 := v.Args[1]
3881         v_0 := v.Args[0]
3882         b := v.Block
3883         typ := &b.Func.Config.Types
3884         // match: (ADD l:(MULLD x y) z)
3885         // cond: objabi.GOPPC64 >= 9 && l.Uses == 1 && clobber(l)
3886         // result: (MADDLD x y z)
3887         for {
3888                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3889                         l := v_0
3890                         if l.Op != OpPPC64MULLD {
3891                                 continue
3892                         }
3893                         y := l.Args[1]
3894                         x := l.Args[0]
3895                         z := v_1
3896                         if !(objabi.GOPPC64 >= 9 && l.Uses == 1 && clobber(l)) {
3897                                 continue
3898                         }
3899                         v.reset(OpPPC64MADDLD)
3900                         v.AddArg3(x, y, z)
3901                         return true
3902                 }
3903                 break
3904         }
3905         // match: (ADD (SLDconst x [c]) (SRDconst x [d]))
3906         // cond: d == 64-c
3907         // result: (ROTLconst [c] x)
3908         for {
3909                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3910                         if v_0.Op != OpPPC64SLDconst {
3911                                 continue
3912                         }
3913                         c := auxIntToInt64(v_0.AuxInt)
3914                         x := v_0.Args[0]
3915                         if v_1.Op != OpPPC64SRDconst {
3916                                 continue
3917                         }
3918                         d := auxIntToInt64(v_1.AuxInt)
3919                         if x != v_1.Args[0] || !(d == 64-c) {
3920                                 continue
3921                         }
3922                         v.reset(OpPPC64ROTLconst)
3923                         v.AuxInt = int64ToAuxInt(c)
3924                         v.AddArg(x)
3925                         return true
3926                 }
3927                 break
3928         }
3929         // match: (ADD (SLWconst x [c]) (SRWconst x [d]))
3930         // cond: d == 32-c
3931         // result: (ROTLWconst [c] x)
3932         for {
3933                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3934                         if v_0.Op != OpPPC64SLWconst {
3935                                 continue
3936                         }
3937                         c := auxIntToInt64(v_0.AuxInt)
3938                         x := v_0.Args[0]
3939                         if v_1.Op != OpPPC64SRWconst {
3940                                 continue
3941                         }
3942                         d := auxIntToInt64(v_1.AuxInt)
3943                         if x != v_1.Args[0] || !(d == 32-c) {
3944                                 continue
3945                         }
3946                         v.reset(OpPPC64ROTLWconst)
3947                         v.AuxInt = int64ToAuxInt(c)
3948                         v.AddArg(x)
3949                         return true
3950                 }
3951                 break
3952         }
3953         // match: (ADD (SLD x (ANDconst <typ.Int64> [63] y)) (SRD x (SUB <typ.UInt> (MOVDconst [64]) (ANDconst <typ.UInt> [63] y))))
3954         // result: (ROTL x y)
3955         for {
3956                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3957                         if v_0.Op != OpPPC64SLD {
3958                                 continue
3959                         }
3960                         _ = v_0.Args[1]
3961                         x := v_0.Args[0]
3962                         v_0_1 := v_0.Args[1]
3963                         if v_0_1.Op != OpPPC64ANDconst || v_0_1.Type != typ.Int64 || auxIntToInt64(v_0_1.AuxInt) != 63 {
3964                                 continue
3965                         }
3966                         y := v_0_1.Args[0]
3967                         if v_1.Op != OpPPC64SRD {
3968                                 continue
3969                         }
3970                         _ = v_1.Args[1]
3971                         if x != v_1.Args[0] {
3972                                 continue
3973                         }
3974                         v_1_1 := v_1.Args[1]
3975                         if v_1_1.Op != OpPPC64SUB || v_1_1.Type != typ.UInt {
3976                                 continue
3977                         }
3978                         _ = v_1_1.Args[1]
3979                         v_1_1_0 := v_1_1.Args[0]
3980                         if v_1_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1_0.AuxInt) != 64 {
3981                                 continue
3982                         }
3983                         v_1_1_1 := v_1_1.Args[1]
3984                         if v_1_1_1.Op != OpPPC64ANDconst || v_1_1_1.Type != typ.UInt || auxIntToInt64(v_1_1_1.AuxInt) != 63 || y != v_1_1_1.Args[0] {
3985                                 continue
3986                         }
3987                         v.reset(OpPPC64ROTL)
3988                         v.AddArg2(x, y)
3989                         return true
3990                 }
3991                 break
3992         }
3993         // match: (ADD (SLD x (ANDconst <typ.Int64> [63] y)) (SRD x (SUBFCconst <typ.UInt> [64] (ANDconst <typ.UInt> [63] y))))
3994         // result: (ROTL x y)
3995         for {
3996                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3997                         if v_0.Op != OpPPC64SLD {
3998                                 continue
3999                         }
4000                         _ = v_0.Args[1]
4001                         x := v_0.Args[0]
4002                         v_0_1 := v_0.Args[1]
4003                         if v_0_1.Op != OpPPC64ANDconst || v_0_1.Type != typ.Int64 || auxIntToInt64(v_0_1.AuxInt) != 63 {
4004                                 continue
4005                         }
4006                         y := v_0_1.Args[0]
4007                         if v_1.Op != OpPPC64SRD {
4008                                 continue
4009                         }
4010                         _ = v_1.Args[1]
4011                         if x != v_1.Args[0] {
4012                                 continue
4013                         }
4014                         v_1_1 := v_1.Args[1]
4015                         if v_1_1.Op != OpPPC64SUBFCconst || v_1_1.Type != typ.UInt || auxIntToInt64(v_1_1.AuxInt) != 64 {
4016                                 continue
4017                         }
4018                         v_1_1_0 := v_1_1.Args[0]
4019                         if v_1_1_0.Op != OpPPC64ANDconst || v_1_1_0.Type != typ.UInt || auxIntToInt64(v_1_1_0.AuxInt) != 63 || y != v_1_1_0.Args[0] {
4020                                 continue
4021                         }
4022                         v.reset(OpPPC64ROTL)
4023                         v.AddArg2(x, y)
4024                         return true
4025                 }
4026                 break
4027         }
4028         // match: (ADD (SLW x (ANDconst <typ.Int32> [31] y)) (SRW x (SUBFCconst <typ.UInt> [32] (ANDconst <typ.UInt> [31] y))))
4029         // result: (ROTLW x y)
4030         for {
4031                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4032                         if v_0.Op != OpPPC64SLW {
4033                                 continue
4034                         }
4035                         _ = v_0.Args[1]
4036                         x := v_0.Args[0]
4037                         v_0_1 := v_0.Args[1]
4038                         if v_0_1.Op != OpPPC64ANDconst || v_0_1.Type != typ.Int32 || auxIntToInt64(v_0_1.AuxInt) != 31 {
4039                                 continue
4040                         }
4041                         y := v_0_1.Args[0]
4042                         if v_1.Op != OpPPC64SRW {
4043                                 continue
4044                         }
4045                         _ = v_1.Args[1]
4046                         if x != v_1.Args[0] {
4047                                 continue
4048                         }
4049                         v_1_1 := v_1.Args[1]
4050                         if v_1_1.Op != OpPPC64SUBFCconst || v_1_1.Type != typ.UInt || auxIntToInt64(v_1_1.AuxInt) != 32 {
4051                                 continue
4052                         }
4053                         v_1_1_0 := v_1_1.Args[0]
4054                         if v_1_1_0.Op != OpPPC64ANDconst || v_1_1_0.Type != typ.UInt || auxIntToInt64(v_1_1_0.AuxInt) != 31 || y != v_1_1_0.Args[0] {
4055                                 continue
4056                         }
4057                         v.reset(OpPPC64ROTLW)
4058                         v.AddArg2(x, y)
4059                         return true
4060                 }
4061                 break
4062         }
4063         // match: (ADD (SLW x (ANDconst <typ.Int32> [31] y)) (SRW x (SUB <typ.UInt> (MOVDconst [32]) (ANDconst <typ.UInt> [31] y))))
4064         // result: (ROTLW x y)
4065         for {
4066                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4067                         if v_0.Op != OpPPC64SLW {
4068                                 continue
4069                         }
4070                         _ = v_0.Args[1]
4071                         x := v_0.Args[0]
4072                         v_0_1 := v_0.Args[1]
4073                         if v_0_1.Op != OpPPC64ANDconst || v_0_1.Type != typ.Int32 || auxIntToInt64(v_0_1.AuxInt) != 31 {
4074                                 continue
4075                         }
4076                         y := v_0_1.Args[0]
4077                         if v_1.Op != OpPPC64SRW {
4078                                 continue
4079                         }
4080                         _ = v_1.Args[1]
4081                         if x != v_1.Args[0] {
4082                                 continue
4083                         }
4084                         v_1_1 := v_1.Args[1]
4085                         if v_1_1.Op != OpPPC64SUB || v_1_1.Type != typ.UInt {
4086                                 continue
4087                         }
4088                         _ = v_1_1.Args[1]
4089                         v_1_1_0 := v_1_1.Args[0]
4090                         if v_1_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1_0.AuxInt) != 32 {
4091                                 continue
4092                         }
4093                         v_1_1_1 := v_1_1.Args[1]
4094                         if v_1_1_1.Op != OpPPC64ANDconst || v_1_1_1.Type != typ.UInt || auxIntToInt64(v_1_1_1.AuxInt) != 31 || y != v_1_1_1.Args[0] {
4095                                 continue
4096                         }
4097                         v.reset(OpPPC64ROTLW)
4098                         v.AddArg2(x, y)
4099                         return true
4100                 }
4101                 break
4102         }
4103         // match: (ADD x (MOVDconst [c]))
4104         // cond: is32Bit(c)
4105         // result: (ADDconst [c] x)
4106         for {
4107                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4108                         x := v_0
4109                         if v_1.Op != OpPPC64MOVDconst {
4110                                 continue
4111                         }
4112                         c := auxIntToInt64(v_1.AuxInt)
4113                         if !(is32Bit(c)) {
4114                                 continue
4115                         }
4116                         v.reset(OpPPC64ADDconst)
4117                         v.AuxInt = int64ToAuxInt(c)
4118                         v.AddArg(x)
4119                         return true
4120                 }
4121                 break
4122         }
4123         return false
4124 }
4125 func rewriteValuePPC64_OpPPC64ADDconst(v *Value) bool {
4126         v_0 := v.Args[0]
4127         // match: (ADDconst [c] (ADDconst [d] x))
4128         // cond: is32Bit(c+d)
4129         // result: (ADDconst [c+d] x)
4130         for {
4131                 c := auxIntToInt64(v.AuxInt)
4132                 if v_0.Op != OpPPC64ADDconst {
4133                         break
4134                 }
4135                 d := auxIntToInt64(v_0.AuxInt)
4136                 x := v_0.Args[0]
4137                 if !(is32Bit(c + d)) {
4138                         break
4139                 }
4140                 v.reset(OpPPC64ADDconst)
4141                 v.AuxInt = int64ToAuxInt(c + d)
4142                 v.AddArg(x)
4143                 return true
4144         }
4145         // match: (ADDconst [0] x)
4146         // result: x
4147         for {
4148                 if auxIntToInt64(v.AuxInt) != 0 {
4149                         break
4150                 }
4151                 x := v_0
4152                 v.copyOf(x)
4153                 return true
4154         }
4155         // match: (ADDconst [c] (MOVDaddr [d] {sym} x))
4156         // cond: is32Bit(c+int64(d))
4157         // result: (MOVDaddr [int32(c+int64(d))] {sym} x)
4158         for {
4159                 c := auxIntToInt64(v.AuxInt)
4160                 if v_0.Op != OpPPC64MOVDaddr {
4161                         break
4162                 }
4163                 d := auxIntToInt32(v_0.AuxInt)
4164                 sym := auxToSym(v_0.Aux)
4165                 x := v_0.Args[0]
4166                 if !(is32Bit(c + int64(d))) {
4167                         break
4168                 }
4169                 v.reset(OpPPC64MOVDaddr)
4170                 v.AuxInt = int32ToAuxInt(int32(c + int64(d)))
4171                 v.Aux = symToAux(sym)
4172                 v.AddArg(x)
4173                 return true
4174         }
4175         // match: (ADDconst [c] x:(SP))
4176         // cond: is32Bit(c)
4177         // result: (MOVDaddr [int32(c)] x)
4178         for {
4179                 c := auxIntToInt64(v.AuxInt)
4180                 x := v_0
4181                 if x.Op != OpSP || !(is32Bit(c)) {
4182                         break
4183                 }
4184                 v.reset(OpPPC64MOVDaddr)
4185                 v.AuxInt = int32ToAuxInt(int32(c))
4186                 v.AddArg(x)
4187                 return true
4188         }
4189         // match: (ADDconst [c] (SUBFCconst [d] x))
4190         // cond: is32Bit(c+d)
4191         // result: (SUBFCconst [c+d] x)
4192         for {
4193                 c := auxIntToInt64(v.AuxInt)
4194                 if v_0.Op != OpPPC64SUBFCconst {
4195                         break
4196                 }
4197                 d := auxIntToInt64(v_0.AuxInt)
4198                 x := v_0.Args[0]
4199                 if !(is32Bit(c + d)) {
4200                         break
4201                 }
4202                 v.reset(OpPPC64SUBFCconst)
4203                 v.AuxInt = int64ToAuxInt(c + d)
4204                 v.AddArg(x)
4205                 return true
4206         }
4207         return false
4208 }
4209 func rewriteValuePPC64_OpPPC64AND(v *Value) bool {
4210         v_1 := v.Args[1]
4211         v_0 := v.Args[0]
4212         // match: (AND (MOVDconst [m]) (ROTLWconst [r] x))
4213         // cond: isPPC64WordRotateMask(m)
4214         // result: (RLWINM [encodePPC64RotateMask(r,m,32)] x)
4215         for {
4216                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4217                         if v_0.Op != OpPPC64MOVDconst {
4218                                 continue
4219                         }
4220                         m := auxIntToInt64(v_0.AuxInt)
4221                         if v_1.Op != OpPPC64ROTLWconst {
4222                                 continue
4223                         }
4224                         r := auxIntToInt64(v_1.AuxInt)
4225                         x := v_1.Args[0]
4226                         if !(isPPC64WordRotateMask(m)) {
4227                                 continue
4228                         }
4229                         v.reset(OpPPC64RLWINM)
4230                         v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, m, 32))
4231                         v.AddArg(x)
4232                         return true
4233                 }
4234                 break
4235         }
4236         // match: (AND (MOVDconst [m]) (ROTLW x r))
4237         // cond: isPPC64WordRotateMask(m)
4238         // result: (RLWNM [encodePPC64RotateMask(0,m,32)] x r)
4239         for {
4240                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4241                         if v_0.Op != OpPPC64MOVDconst {
4242                                 continue
4243                         }
4244                         m := auxIntToInt64(v_0.AuxInt)
4245                         if v_1.Op != OpPPC64ROTLW {
4246                                 continue
4247                         }
4248                         r := v_1.Args[1]
4249                         x := v_1.Args[0]
4250                         if !(isPPC64WordRotateMask(m)) {
4251                                 continue
4252                         }
4253                         v.reset(OpPPC64RLWNM)
4254                         v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32))
4255                         v.AddArg2(x, r)
4256                         return true
4257                 }
4258                 break
4259         }
4260         // match: (AND (MOVDconst [m]) (SRWconst x [s]))
4261         // cond: mergePPC64RShiftMask(m,s,32) == 0
4262         // result: (MOVDconst [0])
4263         for {
4264                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4265                         if v_0.Op != OpPPC64MOVDconst {
4266                                 continue
4267                         }
4268                         m := auxIntToInt64(v_0.AuxInt)
4269                         if v_1.Op != OpPPC64SRWconst {
4270                                 continue
4271                         }
4272                         s := auxIntToInt64(v_1.AuxInt)
4273                         if !(mergePPC64RShiftMask(m, s, 32) == 0) {
4274                                 continue
4275                         }
4276                         v.reset(OpPPC64MOVDconst)
4277                         v.AuxInt = int64ToAuxInt(0)
4278                         return true
4279                 }
4280                 break
4281         }
4282         // match: (AND (MOVDconst [m]) (SRWconst x [s]))
4283         // cond: mergePPC64AndSrwi(m,s) != 0
4284         // result: (RLWINM [mergePPC64AndSrwi(m,s)] x)
4285         for {
4286                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4287                         if v_0.Op != OpPPC64MOVDconst {
4288                                 continue
4289                         }
4290                         m := auxIntToInt64(v_0.AuxInt)
4291                         if v_1.Op != OpPPC64SRWconst {
4292                                 continue
4293                         }
4294                         s := auxIntToInt64(v_1.AuxInt)
4295                         x := v_1.Args[0]
4296                         if !(mergePPC64AndSrwi(m, s) != 0) {
4297                                 continue
4298                         }
4299                         v.reset(OpPPC64RLWINM)
4300                         v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m, s))
4301                         v.AddArg(x)
4302                         return true
4303                 }
4304                 break
4305         }
4306         // match: (AND x (NOR y y))
4307         // result: (ANDN x y)
4308         for {
4309                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4310                         x := v_0
4311                         if v_1.Op != OpPPC64NOR {
4312                                 continue
4313                         }
4314                         y := v_1.Args[1]
4315                         if y != v_1.Args[0] {
4316                                 continue
4317                         }
4318                         v.reset(OpPPC64ANDN)
4319                         v.AddArg2(x, y)
4320                         return true
4321                 }
4322                 break
4323         }
4324         // match: (AND (MOVDconst [c]) (MOVDconst [d]))
4325         // result: (MOVDconst [c&d])
4326         for {
4327                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4328                         if v_0.Op != OpPPC64MOVDconst {
4329                                 continue
4330                         }
4331                         c := auxIntToInt64(v_0.AuxInt)
4332                         if v_1.Op != OpPPC64MOVDconst {
4333                                 continue
4334                         }
4335                         d := auxIntToInt64(v_1.AuxInt)
4336                         v.reset(OpPPC64MOVDconst)
4337                         v.AuxInt = int64ToAuxInt(c & d)
4338                         return true
4339                 }
4340                 break
4341         }
4342         // match: (AND x (MOVDconst [c]))
4343         // cond: isU16Bit(c)
4344         // result: (ANDconst [c] x)
4345         for {
4346                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4347                         x := v_0
4348                         if v_1.Op != OpPPC64MOVDconst {
4349                                 continue
4350                         }
4351                         c := auxIntToInt64(v_1.AuxInt)
4352                         if !(isU16Bit(c)) {
4353                                 continue
4354                         }
4355                         v.reset(OpPPC64ANDconst)
4356                         v.AuxInt = int64ToAuxInt(c)
4357                         v.AddArg(x)
4358                         return true
4359                 }
4360                 break
4361         }
4362         // match: (AND (MOVDconst [c]) y:(MOVWZreg _))
4363         // cond: c&0xFFFFFFFF == 0xFFFFFFFF
4364         // result: y
4365         for {
4366                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4367                         if v_0.Op != OpPPC64MOVDconst {
4368                                 continue
4369                         }
4370                         c := auxIntToInt64(v_0.AuxInt)
4371                         y := v_1
4372                         if y.Op != OpPPC64MOVWZreg || !(c&0xFFFFFFFF == 0xFFFFFFFF) {
4373                                 continue
4374                         }
4375                         v.copyOf(y)
4376                         return true
4377                 }
4378                 break
4379         }
4380         // match: (AND (MOVDconst [0xFFFFFFFF]) y:(MOVWreg x))
4381         // result: (MOVWZreg x)
4382         for {
4383                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4384                         if v_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_0.AuxInt) != 0xFFFFFFFF {
4385                                 continue
4386                         }
4387                         y := v_1
4388                         if y.Op != OpPPC64MOVWreg {
4389                                 continue
4390                         }
4391                         x := y.Args[0]
4392                         v.reset(OpPPC64MOVWZreg)
4393                         v.AddArg(x)
4394                         return true
4395                 }
4396                 break
4397         }
4398         // match: (AND (MOVDconst [c]) x:(MOVBZload _ _))
4399         // result: (ANDconst [c&0xFF] x)
4400         for {
4401                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4402                         if v_0.Op != OpPPC64MOVDconst {
4403                                 continue
4404                         }
4405                         c := auxIntToInt64(v_0.AuxInt)
4406                         x := v_1
4407                         if x.Op != OpPPC64MOVBZload {
4408                                 continue
4409                         }
4410                         v.reset(OpPPC64ANDconst)
4411                         v.AuxInt = int64ToAuxInt(c & 0xFF)
4412                         v.AddArg(x)
4413                         return true
4414                 }
4415                 break
4416         }
4417         return false
4418 }
4419 func rewriteValuePPC64_OpPPC64ANDN(v *Value) bool {
4420         v_1 := v.Args[1]
4421         v_0 := v.Args[0]
4422         // match: (ANDN (MOVDconst [c]) (MOVDconst [d]))
4423         // result: (MOVDconst [c&^d])
4424         for {
4425                 if v_0.Op != OpPPC64MOVDconst {
4426                         break
4427                 }
4428                 c := auxIntToInt64(v_0.AuxInt)
4429                 if v_1.Op != OpPPC64MOVDconst {
4430                         break
4431                 }
4432                 d := auxIntToInt64(v_1.AuxInt)
4433                 v.reset(OpPPC64MOVDconst)
4434                 v.AuxInt = int64ToAuxInt(c &^ d)
4435                 return true
4436         }
4437         return false
4438 }
4439 func rewriteValuePPC64_OpPPC64ANDconst(v *Value) bool {
4440         v_0 := v.Args[0]
4441         // match: (ANDconst [m] (ROTLWconst [r] x))
4442         // cond: isPPC64WordRotateMask(m)
4443         // result: (RLWINM [encodePPC64RotateMask(r,m,32)] x)
4444         for {
4445                 m := auxIntToInt64(v.AuxInt)
4446                 if v_0.Op != OpPPC64ROTLWconst {
4447                         break
4448                 }
4449                 r := auxIntToInt64(v_0.AuxInt)
4450                 x := v_0.Args[0]
4451                 if !(isPPC64WordRotateMask(m)) {
4452                         break
4453                 }
4454                 v.reset(OpPPC64RLWINM)
4455                 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, m, 32))
4456                 v.AddArg(x)
4457                 return true
4458         }
4459         // match: (ANDconst [m] (ROTLW x r))
4460         // cond: isPPC64WordRotateMask(m)
4461         // result: (RLWNM [encodePPC64RotateMask(0,m,32)] x r)
4462         for {
4463                 m := auxIntToInt64(v.AuxInt)
4464                 if v_0.Op != OpPPC64ROTLW {
4465                         break
4466                 }
4467                 r := v_0.Args[1]
4468                 x := v_0.Args[0]
4469                 if !(isPPC64WordRotateMask(m)) {
4470                         break
4471                 }
4472                 v.reset(OpPPC64RLWNM)
4473                 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32))
4474                 v.AddArg2(x, r)
4475                 return true
4476         }
4477         // match: (ANDconst [m] (SRWconst x [s]))
4478         // cond: mergePPC64RShiftMask(m,s,32) == 0
4479         // result: (MOVDconst [0])
4480         for {
4481                 m := auxIntToInt64(v.AuxInt)
4482                 if v_0.Op != OpPPC64SRWconst {
4483                         break
4484                 }
4485                 s := auxIntToInt64(v_0.AuxInt)
4486                 if !(mergePPC64RShiftMask(m, s, 32) == 0) {
4487                         break
4488                 }
4489                 v.reset(OpPPC64MOVDconst)
4490                 v.AuxInt = int64ToAuxInt(0)
4491                 return true
4492         }
4493         // match: (ANDconst [m] (SRWconst x [s]))
4494         // cond: mergePPC64AndSrwi(m,s) != 0
4495         // result: (RLWINM [mergePPC64AndSrwi(m,s)] x)
4496         for {
4497                 m := auxIntToInt64(v.AuxInt)
4498                 if v_0.Op != OpPPC64SRWconst {
4499                         break
4500                 }
4501                 s := auxIntToInt64(v_0.AuxInt)
4502                 x := v_0.Args[0]
4503                 if !(mergePPC64AndSrwi(m, s) != 0) {
4504                         break
4505                 }
4506                 v.reset(OpPPC64RLWINM)
4507                 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m, s))
4508                 v.AddArg(x)
4509                 return true
4510         }
4511         // match: (ANDconst [c] (ANDconst [d] x))
4512         // result: (ANDconst [c&d] x)
4513         for {
4514                 c := auxIntToInt64(v.AuxInt)
4515                 if v_0.Op != OpPPC64ANDconst {
4516                         break
4517                 }
4518                 d := auxIntToInt64(v_0.AuxInt)
4519                 x := v_0.Args[0]
4520                 v.reset(OpPPC64ANDconst)
4521                 v.AuxInt = int64ToAuxInt(c & d)
4522                 v.AddArg(x)
4523                 return true
4524         }
4525         // match: (ANDconst [-1] x)
4526         // result: x
4527         for {
4528                 if auxIntToInt64(v.AuxInt) != -1 {
4529                         break
4530                 }
4531                 x := v_0
4532                 v.copyOf(x)
4533                 return true
4534         }
4535         // match: (ANDconst [0] _)
4536         // result: (MOVDconst [0])
4537         for {
4538                 if auxIntToInt64(v.AuxInt) != 0 {
4539                         break
4540                 }
4541                 v.reset(OpPPC64MOVDconst)
4542                 v.AuxInt = int64ToAuxInt(0)
4543                 return true
4544         }
4545         // match: (ANDconst [c] y:(MOVBZreg _))
4546         // cond: c&0xFF == 0xFF
4547         // result: y
4548         for {
4549                 c := auxIntToInt64(v.AuxInt)
4550                 y := v_0
4551                 if y.Op != OpPPC64MOVBZreg || !(c&0xFF == 0xFF) {
4552                         break
4553                 }
4554                 v.copyOf(y)
4555                 return true
4556         }
4557         // match: (ANDconst [0xFF] y:(MOVBreg _))
4558         // result: y
4559         for {
4560                 if auxIntToInt64(v.AuxInt) != 0xFF {
4561                         break
4562                 }
4563                 y := v_0
4564                 if y.Op != OpPPC64MOVBreg {
4565                         break
4566                 }
4567                 v.copyOf(y)
4568                 return true
4569         }
4570         // match: (ANDconst [c] y:(MOVHZreg _))
4571         // cond: c&0xFFFF == 0xFFFF
4572         // result: y
4573         for {
4574                 c := auxIntToInt64(v.AuxInt)
4575                 y := v_0
4576                 if y.Op != OpPPC64MOVHZreg || !(c&0xFFFF == 0xFFFF) {
4577                         break
4578                 }
4579                 v.copyOf(y)
4580                 return true
4581         }
4582         // match: (ANDconst [0xFFFF] y:(MOVHreg _))
4583         // result: y
4584         for {
4585                 if auxIntToInt64(v.AuxInt) != 0xFFFF {
4586                         break
4587                 }
4588                 y := v_0
4589                 if y.Op != OpPPC64MOVHreg {
4590                         break
4591                 }
4592                 v.copyOf(y)
4593                 return true
4594         }
4595         // match: (ANDconst [c] (MOVBreg x))
4596         // result: (ANDconst [c&0xFF] x)
4597         for {
4598                 c := auxIntToInt64(v.AuxInt)
4599                 if v_0.Op != OpPPC64MOVBreg {
4600                         break
4601                 }
4602                 x := v_0.Args[0]
4603                 v.reset(OpPPC64ANDconst)
4604                 v.AuxInt = int64ToAuxInt(c & 0xFF)
4605                 v.AddArg(x)
4606                 return true
4607         }
4608         // match: (ANDconst [c] (MOVBZreg x))
4609         // result: (ANDconst [c&0xFF] x)
4610         for {
4611                 c := auxIntToInt64(v.AuxInt)
4612                 if v_0.Op != OpPPC64MOVBZreg {
4613                         break
4614                 }
4615                 x := v_0.Args[0]
4616                 v.reset(OpPPC64ANDconst)
4617                 v.AuxInt = int64ToAuxInt(c & 0xFF)
4618                 v.AddArg(x)
4619                 return true
4620         }
4621         // match: (ANDconst [c] (MOVHreg x))
4622         // result: (ANDconst [c&0xFFFF] x)
4623         for {
4624                 c := auxIntToInt64(v.AuxInt)
4625                 if v_0.Op != OpPPC64MOVHreg {
4626                         break
4627                 }
4628                 x := v_0.Args[0]
4629                 v.reset(OpPPC64ANDconst)
4630                 v.AuxInt = int64ToAuxInt(c & 0xFFFF)
4631                 v.AddArg(x)
4632                 return true
4633         }
4634         // match: (ANDconst [c] (MOVHZreg x))
4635         // result: (ANDconst [c&0xFFFF] x)
4636         for {
4637                 c := auxIntToInt64(v.AuxInt)
4638                 if v_0.Op != OpPPC64MOVHZreg {
4639                         break
4640                 }
4641                 x := v_0.Args[0]
4642                 v.reset(OpPPC64ANDconst)
4643                 v.AuxInt = int64ToAuxInt(c & 0xFFFF)
4644                 v.AddArg(x)
4645                 return true
4646         }
4647         // match: (ANDconst [c] (MOVWreg x))
4648         // result: (ANDconst [c&0xFFFFFFFF] x)
4649         for {
4650                 c := auxIntToInt64(v.AuxInt)
4651                 if v_0.Op != OpPPC64MOVWreg {
4652                         break
4653                 }
4654                 x := v_0.Args[0]
4655                 v.reset(OpPPC64ANDconst)
4656                 v.AuxInt = int64ToAuxInt(c & 0xFFFFFFFF)
4657                 v.AddArg(x)
4658                 return true
4659         }
4660         // match: (ANDconst [c] (MOVWZreg x))
4661         // result: (ANDconst [c&0xFFFFFFFF] x)
4662         for {
4663                 c := auxIntToInt64(v.AuxInt)
4664                 if v_0.Op != OpPPC64MOVWZreg {
4665                         break
4666                 }
4667                 x := v_0.Args[0]
4668                 v.reset(OpPPC64ANDconst)
4669                 v.AuxInt = int64ToAuxInt(c & 0xFFFFFFFF)
4670                 v.AddArg(x)
4671                 return true
4672         }
4673         return false
4674 }
4675 func rewriteValuePPC64_OpPPC64CLRLSLDI(v *Value) bool {
4676         v_0 := v.Args[0]
4677         // match: (CLRLSLDI [c] (SRWconst [s] x))
4678         // cond: mergePPC64ClrlsldiSrw(int64(c),s) != 0
4679         // result: (RLWINM [mergePPC64ClrlsldiSrw(int64(c),s)] x)
4680         for {
4681                 c := auxIntToInt32(v.AuxInt)
4682                 if v_0.Op != OpPPC64SRWconst {
4683                         break
4684                 }
4685                 s := auxIntToInt64(v_0.AuxInt)
4686                 x := v_0.Args[0]
4687                 if !(mergePPC64ClrlsldiSrw(int64(c), s) != 0) {
4688                         break
4689                 }
4690                 v.reset(OpPPC64RLWINM)
4691                 v.AuxInt = int64ToAuxInt(mergePPC64ClrlsldiSrw(int64(c), s))
4692                 v.AddArg(x)
4693                 return true
4694         }
4695         // match: (CLRLSLDI [c] i:(RLWINM [s] x))
4696         // cond: mergePPC64ClrlsldiRlwinm(c,s) != 0
4697         // result: (RLWINM [mergePPC64ClrlsldiRlwinm(c,s)] x)
4698         for {
4699                 c := auxIntToInt32(v.AuxInt)
4700                 i := v_0
4701                 if i.Op != OpPPC64RLWINM {
4702                         break
4703                 }
4704                 s := auxIntToInt64(i.AuxInt)
4705                 x := i.Args[0]
4706                 if !(mergePPC64ClrlsldiRlwinm(c, s) != 0) {
4707                         break
4708                 }
4709                 v.reset(OpPPC64RLWINM)
4710                 v.AuxInt = int64ToAuxInt(mergePPC64ClrlsldiRlwinm(c, s))
4711                 v.AddArg(x)
4712                 return true
4713         }
4714         return false
4715 }
4716 func rewriteValuePPC64_OpPPC64CMP(v *Value) bool {
4717         v_1 := v.Args[1]
4718         v_0 := v.Args[0]
4719         b := v.Block
4720         // match: (CMP x (MOVDconst [c]))
4721         // cond: is16Bit(c)
4722         // result: (CMPconst x [c])
4723         for {
4724                 x := v_0
4725                 if v_1.Op != OpPPC64MOVDconst {
4726                         break
4727                 }
4728                 c := auxIntToInt64(v_1.AuxInt)
4729                 if !(is16Bit(c)) {
4730                         break
4731                 }
4732                 v.reset(OpPPC64CMPconst)
4733                 v.AuxInt = int64ToAuxInt(c)
4734                 v.AddArg(x)
4735                 return true
4736         }
4737         // match: (CMP (MOVDconst [c]) y)
4738         // cond: is16Bit(c)
4739         // result: (InvertFlags (CMPconst y [c]))
4740         for {
4741                 if v_0.Op != OpPPC64MOVDconst {
4742                         break
4743                 }
4744                 c := auxIntToInt64(v_0.AuxInt)
4745                 y := v_1
4746                 if !(is16Bit(c)) {
4747                         break
4748                 }
4749                 v.reset(OpPPC64InvertFlags)
4750                 v0 := b.NewValue0(v.Pos, OpPPC64CMPconst, types.TypeFlags)
4751                 v0.AuxInt = int64ToAuxInt(c)
4752                 v0.AddArg(y)
4753                 v.AddArg(v0)
4754                 return true
4755         }
4756         // match: (CMP x y)
4757         // cond: canonLessThan(x,y)
4758         // result: (InvertFlags (CMP y x))
4759         for {
4760                 x := v_0
4761                 y := v_1
4762                 if !(canonLessThan(x, y)) {
4763                         break
4764                 }
4765                 v.reset(OpPPC64InvertFlags)
4766                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
4767                 v0.AddArg2(y, x)
4768                 v.AddArg(v0)
4769                 return true
4770         }
4771         return false
4772 }
4773 func rewriteValuePPC64_OpPPC64CMPU(v *Value) bool {
4774         v_1 := v.Args[1]
4775         v_0 := v.Args[0]
4776         b := v.Block
4777         // match: (CMPU x (MOVDconst [c]))
4778         // cond: isU16Bit(c)
4779         // result: (CMPUconst x [c])
4780         for {
4781                 x := v_0
4782                 if v_1.Op != OpPPC64MOVDconst {
4783                         break
4784                 }
4785                 c := auxIntToInt64(v_1.AuxInt)
4786                 if !(isU16Bit(c)) {
4787                         break
4788                 }
4789                 v.reset(OpPPC64CMPUconst)
4790                 v.AuxInt = int64ToAuxInt(c)
4791                 v.AddArg(x)
4792                 return true
4793         }
4794         // match: (CMPU (MOVDconst [c]) y)
4795         // cond: isU16Bit(c)
4796         // result: (InvertFlags (CMPUconst y [c]))
4797         for {
4798                 if v_0.Op != OpPPC64MOVDconst {
4799                         break
4800                 }
4801                 c := auxIntToInt64(v_0.AuxInt)
4802                 y := v_1
4803                 if !(isU16Bit(c)) {
4804                         break
4805                 }
4806                 v.reset(OpPPC64InvertFlags)
4807                 v0 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
4808                 v0.AuxInt = int64ToAuxInt(c)
4809                 v0.AddArg(y)
4810                 v.AddArg(v0)
4811                 return true
4812         }
4813         // match: (CMPU x y)
4814         // cond: canonLessThan(x,y)
4815         // result: (InvertFlags (CMPU y x))
4816         for {
4817                 x := v_0
4818                 y := v_1
4819                 if !(canonLessThan(x, y)) {
4820                         break
4821                 }
4822                 v.reset(OpPPC64InvertFlags)
4823                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
4824                 v0.AddArg2(y, x)
4825                 v.AddArg(v0)
4826                 return true
4827         }
4828         return false
4829 }
4830 func rewriteValuePPC64_OpPPC64CMPUconst(v *Value) bool {
4831         v_0 := v.Args[0]
4832         // match: (CMPUconst (MOVDconst [x]) [y])
4833         // cond: x==y
4834         // result: (FlagEQ)
4835         for {
4836                 y := auxIntToInt64(v.AuxInt)
4837                 if v_0.Op != OpPPC64MOVDconst {
4838                         break
4839                 }
4840                 x := auxIntToInt64(v_0.AuxInt)
4841                 if !(x == y) {
4842                         break
4843                 }
4844                 v.reset(OpPPC64FlagEQ)
4845                 return true
4846         }
4847         // match: (CMPUconst (MOVDconst [x]) [y])
4848         // cond: uint64(x)<uint64(y)
4849         // result: (FlagLT)
4850         for {
4851                 y := auxIntToInt64(v.AuxInt)
4852                 if v_0.Op != OpPPC64MOVDconst {
4853                         break
4854                 }
4855                 x := auxIntToInt64(v_0.AuxInt)
4856                 if !(uint64(x) < uint64(y)) {
4857                         break
4858                 }
4859                 v.reset(OpPPC64FlagLT)
4860                 return true
4861         }
4862         // match: (CMPUconst (MOVDconst [x]) [y])
4863         // cond: uint64(x)>uint64(y)
4864         // result: (FlagGT)
4865         for {
4866                 y := auxIntToInt64(v.AuxInt)
4867                 if v_0.Op != OpPPC64MOVDconst {
4868                         break
4869                 }
4870                 x := auxIntToInt64(v_0.AuxInt)
4871                 if !(uint64(x) > uint64(y)) {
4872                         break
4873                 }
4874                 v.reset(OpPPC64FlagGT)
4875                 return true
4876         }
4877         return false
4878 }
4879 func rewriteValuePPC64_OpPPC64CMPW(v *Value) bool {
4880         v_1 := v.Args[1]
4881         v_0 := v.Args[0]
4882         b := v.Block
4883         // match: (CMPW x (MOVWreg y))
4884         // result: (CMPW x y)
4885         for {
4886                 x := v_0
4887                 if v_1.Op != OpPPC64MOVWreg {
4888                         break
4889                 }
4890                 y := v_1.Args[0]
4891                 v.reset(OpPPC64CMPW)
4892                 v.AddArg2(x, y)
4893                 return true
4894         }
4895         // match: (CMPW (MOVWreg x) y)
4896         // result: (CMPW x y)
4897         for {
4898                 if v_0.Op != OpPPC64MOVWreg {
4899                         break
4900                 }
4901                 x := v_0.Args[0]
4902                 y := v_1
4903                 v.reset(OpPPC64CMPW)
4904                 v.AddArg2(x, y)
4905                 return true
4906         }
4907         // match: (CMPW x (MOVDconst [c]))
4908         // cond: is16Bit(c)
4909         // result: (CMPWconst x [int32(c)])
4910         for {
4911                 x := v_0
4912                 if v_1.Op != OpPPC64MOVDconst {
4913                         break
4914                 }
4915                 c := auxIntToInt64(v_1.AuxInt)
4916                 if !(is16Bit(c)) {
4917                         break
4918                 }
4919                 v.reset(OpPPC64CMPWconst)
4920                 v.AuxInt = int32ToAuxInt(int32(c))
4921                 v.AddArg(x)
4922                 return true
4923         }
4924         // match: (CMPW (MOVDconst [c]) y)
4925         // cond: is16Bit(c)
4926         // result: (InvertFlags (CMPWconst y [int32(c)]))
4927         for {
4928                 if v_0.Op != OpPPC64MOVDconst {
4929                         break
4930                 }
4931                 c := auxIntToInt64(v_0.AuxInt)
4932                 y := v_1
4933                 if !(is16Bit(c)) {
4934                         break
4935                 }
4936                 v.reset(OpPPC64InvertFlags)
4937                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWconst, types.TypeFlags)
4938                 v0.AuxInt = int32ToAuxInt(int32(c))
4939                 v0.AddArg(y)
4940                 v.AddArg(v0)
4941                 return true
4942         }
4943         // match: (CMPW x y)
4944         // cond: canonLessThan(x,y)
4945         // result: (InvertFlags (CMPW y x))
4946         for {
4947                 x := v_0
4948                 y := v_1
4949                 if !(canonLessThan(x, y)) {
4950                         break
4951                 }
4952                 v.reset(OpPPC64InvertFlags)
4953                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
4954                 v0.AddArg2(y, x)
4955                 v.AddArg(v0)
4956                 return true
4957         }
4958         return false
4959 }
4960 func rewriteValuePPC64_OpPPC64CMPWU(v *Value) bool {
4961         v_1 := v.Args[1]
4962         v_0 := v.Args[0]
4963         b := v.Block
4964         // match: (CMPWU x (MOVWZreg y))
4965         // result: (CMPWU x y)
4966         for {
4967                 x := v_0
4968                 if v_1.Op != OpPPC64MOVWZreg {
4969                         break
4970                 }
4971                 y := v_1.Args[0]
4972                 v.reset(OpPPC64CMPWU)
4973                 v.AddArg2(x, y)
4974                 return true
4975         }
4976         // match: (CMPWU (MOVWZreg x) y)
4977         // result: (CMPWU x y)
4978         for {
4979                 if v_0.Op != OpPPC64MOVWZreg {
4980                         break
4981                 }
4982                 x := v_0.Args[0]
4983                 y := v_1
4984                 v.reset(OpPPC64CMPWU)
4985                 v.AddArg2(x, y)
4986                 return true
4987         }
4988         // match: (CMPWU x (MOVDconst [c]))
4989         // cond: isU16Bit(c)
4990         // result: (CMPWUconst x [int32(c)])
4991         for {
4992                 x := v_0
4993                 if v_1.Op != OpPPC64MOVDconst {
4994                         break
4995                 }
4996                 c := auxIntToInt64(v_1.AuxInt)
4997                 if !(isU16Bit(c)) {
4998                         break
4999                 }
5000                 v.reset(OpPPC64CMPWUconst)
5001                 v.AuxInt = int32ToAuxInt(int32(c))
5002                 v.AddArg(x)
5003                 return true
5004         }
5005         // match: (CMPWU (MOVDconst [c]) y)
5006         // cond: isU16Bit(c)
5007         // result: (InvertFlags (CMPWUconst y [int32(c)]))
5008         for {
5009                 if v_0.Op != OpPPC64MOVDconst {
5010                         break
5011                 }
5012                 c := auxIntToInt64(v_0.AuxInt)
5013                 y := v_1
5014                 if !(isU16Bit(c)) {
5015                         break
5016                 }
5017                 v.reset(OpPPC64InvertFlags)
5018                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
5019                 v0.AuxInt = int32ToAuxInt(int32(c))
5020                 v0.AddArg(y)
5021                 v.AddArg(v0)
5022                 return true
5023         }
5024         // match: (CMPWU x y)
5025         // cond: canonLessThan(x,y)
5026         // result: (InvertFlags (CMPWU y x))
5027         for {
5028                 x := v_0
5029                 y := v_1
5030                 if !(canonLessThan(x, y)) {
5031                         break
5032                 }
5033                 v.reset(OpPPC64InvertFlags)
5034                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
5035                 v0.AddArg2(y, x)
5036                 v.AddArg(v0)
5037                 return true
5038         }
5039         return false
5040 }
5041 func rewriteValuePPC64_OpPPC64CMPWUconst(v *Value) bool {
5042         v_0 := v.Args[0]
5043         // match: (CMPWUconst (MOVDconst [x]) [y])
5044         // cond: int32(x)==int32(y)
5045         // result: (FlagEQ)
5046         for {
5047                 y := auxIntToInt32(v.AuxInt)
5048                 if v_0.Op != OpPPC64MOVDconst {
5049                         break
5050                 }
5051                 x := auxIntToInt64(v_0.AuxInt)
5052                 if !(int32(x) == int32(y)) {
5053                         break
5054                 }
5055                 v.reset(OpPPC64FlagEQ)
5056                 return true
5057         }
5058         // match: (CMPWUconst (MOVDconst [x]) [y])
5059         // cond: uint32(x)<uint32(y)
5060         // result: (FlagLT)
5061         for {
5062                 y := auxIntToInt32(v.AuxInt)
5063                 if v_0.Op != OpPPC64MOVDconst {
5064                         break
5065                 }
5066                 x := auxIntToInt64(v_0.AuxInt)
5067                 if !(uint32(x) < uint32(y)) {
5068                         break
5069                 }
5070                 v.reset(OpPPC64FlagLT)
5071                 return true
5072         }
5073         // match: (CMPWUconst (MOVDconst [x]) [y])
5074         // cond: uint32(x)>uint32(y)
5075         // result: (FlagGT)
5076         for {
5077                 y := auxIntToInt32(v.AuxInt)
5078                 if v_0.Op != OpPPC64MOVDconst {
5079                         break
5080                 }
5081                 x := auxIntToInt64(v_0.AuxInt)
5082                 if !(uint32(x) > uint32(y)) {
5083                         break
5084                 }
5085                 v.reset(OpPPC64FlagGT)
5086                 return true
5087         }
5088         return false
5089 }
5090 func rewriteValuePPC64_OpPPC64CMPWconst(v *Value) bool {
5091         v_0 := v.Args[0]
5092         // match: (CMPWconst (MOVDconst [x]) [y])
5093         // cond: int32(x)==int32(y)
5094         // result: (FlagEQ)
5095         for {
5096                 y := auxIntToInt32(v.AuxInt)
5097                 if v_0.Op != OpPPC64MOVDconst {
5098                         break
5099                 }
5100                 x := auxIntToInt64(v_0.AuxInt)
5101                 if !(int32(x) == int32(y)) {
5102                         break
5103                 }
5104                 v.reset(OpPPC64FlagEQ)
5105                 return true
5106         }
5107         // match: (CMPWconst (MOVDconst [x]) [y])
5108         // cond: int32(x)<int32(y)
5109         // result: (FlagLT)
5110         for {
5111                 y := auxIntToInt32(v.AuxInt)
5112                 if v_0.Op != OpPPC64MOVDconst {
5113                         break
5114                 }
5115                 x := auxIntToInt64(v_0.AuxInt)
5116                 if !(int32(x) < int32(y)) {
5117                         break
5118                 }
5119                 v.reset(OpPPC64FlagLT)
5120                 return true
5121         }
5122         // match: (CMPWconst (MOVDconst [x]) [y])
5123         // cond: int32(x)>int32(y)
5124         // result: (FlagGT)
5125         for {
5126                 y := auxIntToInt32(v.AuxInt)
5127                 if v_0.Op != OpPPC64MOVDconst {
5128                         break
5129                 }
5130                 x := auxIntToInt64(v_0.AuxInt)
5131                 if !(int32(x) > int32(y)) {
5132                         break
5133                 }
5134                 v.reset(OpPPC64FlagGT)
5135                 return true
5136         }
5137         return false
5138 }
5139 func rewriteValuePPC64_OpPPC64CMPconst(v *Value) bool {
5140         v_0 := v.Args[0]
5141         // match: (CMPconst (MOVDconst [x]) [y])
5142         // cond: x==y
5143         // result: (FlagEQ)
5144         for {
5145                 y := auxIntToInt64(v.AuxInt)
5146                 if v_0.Op != OpPPC64MOVDconst {
5147                         break
5148                 }
5149                 x := auxIntToInt64(v_0.AuxInt)
5150                 if !(x == y) {
5151                         break
5152                 }
5153                 v.reset(OpPPC64FlagEQ)
5154                 return true
5155         }
5156         // match: (CMPconst (MOVDconst [x]) [y])
5157         // cond: x<y
5158         // result: (FlagLT)
5159         for {
5160                 y := auxIntToInt64(v.AuxInt)
5161                 if v_0.Op != OpPPC64MOVDconst {
5162                         break
5163                 }
5164                 x := auxIntToInt64(v_0.AuxInt)
5165                 if !(x < y) {
5166                         break
5167                 }
5168                 v.reset(OpPPC64FlagLT)
5169                 return true
5170         }
5171         // match: (CMPconst (MOVDconst [x]) [y])
5172         // cond: x>y
5173         // result: (FlagGT)
5174         for {
5175                 y := auxIntToInt64(v.AuxInt)
5176                 if v_0.Op != OpPPC64MOVDconst {
5177                         break
5178                 }
5179                 x := auxIntToInt64(v_0.AuxInt)
5180                 if !(x > y) {
5181                         break
5182                 }
5183                 v.reset(OpPPC64FlagGT)
5184                 return true
5185         }
5186         return false
5187 }
5188 func rewriteValuePPC64_OpPPC64Equal(v *Value) bool {
5189         v_0 := v.Args[0]
5190         b := v.Block
5191         typ := &b.Func.Config.Types
5192         // match: (Equal (FlagEQ))
5193         // result: (MOVDconst [1])
5194         for {
5195                 if v_0.Op != OpPPC64FlagEQ {
5196                         break
5197                 }
5198                 v.reset(OpPPC64MOVDconst)
5199                 v.AuxInt = int64ToAuxInt(1)
5200                 return true
5201         }
5202         // match: (Equal (FlagLT))
5203         // result: (MOVDconst [0])
5204         for {
5205                 if v_0.Op != OpPPC64FlagLT {
5206                         break
5207                 }
5208                 v.reset(OpPPC64MOVDconst)
5209                 v.AuxInt = int64ToAuxInt(0)
5210                 return true
5211         }
5212         // match: (Equal (FlagGT))
5213         // result: (MOVDconst [0])
5214         for {
5215                 if v_0.Op != OpPPC64FlagGT {
5216                         break
5217                 }
5218                 v.reset(OpPPC64MOVDconst)
5219                 v.AuxInt = int64ToAuxInt(0)
5220                 return true
5221         }
5222         // match: (Equal (InvertFlags x))
5223         // result: (Equal x)
5224         for {
5225                 if v_0.Op != OpPPC64InvertFlags {
5226                         break
5227                 }
5228                 x := v_0.Args[0]
5229                 v.reset(OpPPC64Equal)
5230                 v.AddArg(x)
5231                 return true
5232         }
5233         // match: (Equal cmp)
5234         // result: (ISELB [2] (MOVDconst [1]) cmp)
5235         for {
5236                 cmp := v_0
5237                 v.reset(OpPPC64ISELB)
5238                 v.AuxInt = int32ToAuxInt(2)
5239                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
5240                 v0.AuxInt = int64ToAuxInt(1)
5241                 v.AddArg2(v0, cmp)
5242                 return true
5243         }
5244 }
5245 func rewriteValuePPC64_OpPPC64FABS(v *Value) bool {
5246         v_0 := v.Args[0]
5247         // match: (FABS (FMOVDconst [x]))
5248         // result: (FMOVDconst [math.Abs(x)])
5249         for {
5250                 if v_0.Op != OpPPC64FMOVDconst {
5251                         break
5252                 }
5253                 x := auxIntToFloat64(v_0.AuxInt)
5254                 v.reset(OpPPC64FMOVDconst)
5255                 v.AuxInt = float64ToAuxInt(math.Abs(x))
5256                 return true
5257         }
5258         return false
5259 }
5260 func rewriteValuePPC64_OpPPC64FADD(v *Value) bool {
5261         v_1 := v.Args[1]
5262         v_0 := v.Args[0]
5263         // match: (FADD (FMUL x y) z)
5264         // result: (FMADD x y z)
5265         for {
5266                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5267                         if v_0.Op != OpPPC64FMUL {
5268                                 continue
5269                         }
5270                         y := v_0.Args[1]
5271                         x := v_0.Args[0]
5272                         z := v_1
5273                         v.reset(OpPPC64FMADD)
5274                         v.AddArg3(x, y, z)
5275                         return true
5276                 }
5277                 break
5278         }
5279         return false
5280 }
5281 func rewriteValuePPC64_OpPPC64FADDS(v *Value) bool {
5282         v_1 := v.Args[1]
5283         v_0 := v.Args[0]
5284         // match: (FADDS (FMULS x y) z)
5285         // result: (FMADDS x y z)
5286         for {
5287                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5288                         if v_0.Op != OpPPC64FMULS {
5289                                 continue
5290                         }
5291                         y := v_0.Args[1]
5292                         x := v_0.Args[0]
5293                         z := v_1
5294                         v.reset(OpPPC64FMADDS)
5295                         v.AddArg3(x, y, z)
5296                         return true
5297                 }
5298                 break
5299         }
5300         return false
5301 }
5302 func rewriteValuePPC64_OpPPC64FCEIL(v *Value) bool {
5303         v_0 := v.Args[0]
5304         // match: (FCEIL (FMOVDconst [x]))
5305         // result: (FMOVDconst [math.Ceil(x)])
5306         for {
5307                 if v_0.Op != OpPPC64FMOVDconst {
5308                         break
5309                 }
5310                 x := auxIntToFloat64(v_0.AuxInt)
5311                 v.reset(OpPPC64FMOVDconst)
5312                 v.AuxInt = float64ToAuxInt(math.Ceil(x))
5313                 return true
5314         }
5315         return false
5316 }
5317 func rewriteValuePPC64_OpPPC64FFLOOR(v *Value) bool {
5318         v_0 := v.Args[0]
5319         // match: (FFLOOR (FMOVDconst [x]))
5320         // result: (FMOVDconst [math.Floor(x)])
5321         for {
5322                 if v_0.Op != OpPPC64FMOVDconst {
5323                         break
5324                 }
5325                 x := auxIntToFloat64(v_0.AuxInt)
5326                 v.reset(OpPPC64FMOVDconst)
5327                 v.AuxInt = float64ToAuxInt(math.Floor(x))
5328                 return true
5329         }
5330         return false
5331 }
5332 func rewriteValuePPC64_OpPPC64FGreaterEqual(v *Value) bool {
5333         v_0 := v.Args[0]
5334         b := v.Block
5335         typ := &b.Func.Config.Types
5336         // match: (FGreaterEqual cmp)
5337         // result: (ISEL [2] (MOVDconst [1]) (ISELB [1] (MOVDconst [1]) cmp) cmp)
5338         for {
5339                 cmp := v_0
5340                 v.reset(OpPPC64ISEL)
5341                 v.AuxInt = int32ToAuxInt(2)
5342                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
5343                 v0.AuxInt = int64ToAuxInt(1)
5344                 v1 := b.NewValue0(v.Pos, OpPPC64ISELB, typ.Int32)
5345                 v1.AuxInt = int32ToAuxInt(1)
5346                 v1.AddArg2(v0, cmp)
5347                 v.AddArg3(v0, v1, cmp)
5348                 return true
5349         }
5350 }
5351 func rewriteValuePPC64_OpPPC64FGreaterThan(v *Value) bool {
5352         v_0 := v.Args[0]
5353         b := v.Block
5354         typ := &b.Func.Config.Types
5355         // match: (FGreaterThan cmp)
5356         // result: (ISELB [1] (MOVDconst [1]) cmp)
5357         for {
5358                 cmp := v_0
5359                 v.reset(OpPPC64ISELB)
5360                 v.AuxInt = int32ToAuxInt(1)
5361                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
5362                 v0.AuxInt = int64ToAuxInt(1)
5363                 v.AddArg2(v0, cmp)
5364                 return true
5365         }
5366 }
5367 func rewriteValuePPC64_OpPPC64FLessEqual(v *Value) bool {
5368         v_0 := v.Args[0]
5369         b := v.Block
5370         typ := &b.Func.Config.Types
5371         // match: (FLessEqual cmp)
5372         // result: (ISEL [2] (MOVDconst [1]) (ISELB [0] (MOVDconst [1]) cmp) cmp)
5373         for {
5374                 cmp := v_0
5375                 v.reset(OpPPC64ISEL)
5376                 v.AuxInt = int32ToAuxInt(2)
5377                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
5378                 v0.AuxInt = int64ToAuxInt(1)
5379                 v1 := b.NewValue0(v.Pos, OpPPC64ISELB, typ.Int32)
5380                 v1.AuxInt = int32ToAuxInt(0)
5381                 v1.AddArg2(v0, cmp)
5382                 v.AddArg3(v0, v1, cmp)
5383                 return true
5384         }
5385 }
5386 func rewriteValuePPC64_OpPPC64FLessThan(v *Value) bool {
5387         v_0 := v.Args[0]
5388         b := v.Block
5389         typ := &b.Func.Config.Types
5390         // match: (FLessThan cmp)
5391         // result: (ISELB [0] (MOVDconst [1]) cmp)
5392         for {
5393                 cmp := v_0
5394                 v.reset(OpPPC64ISELB)
5395                 v.AuxInt = int32ToAuxInt(0)
5396                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
5397                 v0.AuxInt = int64ToAuxInt(1)
5398                 v.AddArg2(v0, cmp)
5399                 return true
5400         }
5401 }
5402 func rewriteValuePPC64_OpPPC64FMOVDload(v *Value) bool {
5403         v_1 := v.Args[1]
5404         v_0 := v.Args[0]
5405         // match: (FMOVDload [off] {sym} ptr (MOVDstore [off] {sym} ptr x _))
5406         // result: (MTVSRD x)
5407         for {
5408                 off := auxIntToInt32(v.AuxInt)
5409                 sym := auxToSym(v.Aux)
5410                 ptr := v_0
5411                 if v_1.Op != OpPPC64MOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
5412                         break
5413                 }
5414                 x := v_1.Args[1]
5415                 if ptr != v_1.Args[0] {
5416                         break
5417                 }
5418                 v.reset(OpPPC64MTVSRD)
5419                 v.AddArg(x)
5420                 return true
5421         }
5422         // match: (FMOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
5423         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
5424         // result: (FMOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
5425         for {
5426                 off1 := auxIntToInt32(v.AuxInt)
5427                 sym1 := auxToSym(v.Aux)
5428                 p := v_0
5429                 if p.Op != OpPPC64MOVDaddr {
5430                         break
5431                 }
5432                 off2 := auxIntToInt32(p.AuxInt)
5433                 sym2 := auxToSym(p.Aux)
5434                 ptr := p.Args[0]
5435                 mem := v_1
5436                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
5437                         break
5438                 }
5439                 v.reset(OpPPC64FMOVDload)
5440                 v.AuxInt = int32ToAuxInt(off1 + off2)
5441                 v.Aux = symToAux(mergeSym(sym1, sym2))
5442                 v.AddArg2(ptr, mem)
5443                 return true
5444         }
5445         // match: (FMOVDload [off1] {sym} (ADDconst [off2] ptr) mem)
5446         // cond: is16Bit(int64(off1)+off2)
5447         // result: (FMOVDload [off1+int32(off2)] {sym} ptr mem)
5448         for {
5449                 off1 := auxIntToInt32(v.AuxInt)
5450                 sym := auxToSym(v.Aux)
5451                 if v_0.Op != OpPPC64ADDconst {
5452                         break
5453                 }
5454                 off2 := auxIntToInt64(v_0.AuxInt)
5455                 ptr := v_0.Args[0]
5456                 mem := v_1
5457                 if !(is16Bit(int64(off1) + off2)) {
5458                         break
5459                 }
5460                 v.reset(OpPPC64FMOVDload)
5461                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5462                 v.Aux = symToAux(sym)
5463                 v.AddArg2(ptr, mem)
5464                 return true
5465         }
5466         return false
5467 }
5468 func rewriteValuePPC64_OpPPC64FMOVDstore(v *Value) bool {
5469         v_2 := v.Args[2]
5470         v_1 := v.Args[1]
5471         v_0 := v.Args[0]
5472         // match: (FMOVDstore [off] {sym} ptr (MTVSRD x) mem)
5473         // result: (MOVDstore [off] {sym} ptr x mem)
5474         for {
5475                 off := auxIntToInt32(v.AuxInt)
5476                 sym := auxToSym(v.Aux)
5477                 ptr := v_0
5478                 if v_1.Op != OpPPC64MTVSRD {
5479                         break
5480                 }
5481                 x := v_1.Args[0]
5482                 mem := v_2
5483                 v.reset(OpPPC64MOVDstore)
5484                 v.AuxInt = int32ToAuxInt(off)
5485                 v.Aux = symToAux(sym)
5486                 v.AddArg3(ptr, x, mem)
5487                 return true
5488         }
5489         // match: (FMOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem)
5490         // cond: is16Bit(int64(off1)+off2)
5491         // result: (FMOVDstore [off1+int32(off2)] {sym} ptr val mem)
5492         for {
5493                 off1 := auxIntToInt32(v.AuxInt)
5494                 sym := auxToSym(v.Aux)
5495                 if v_0.Op != OpPPC64ADDconst {
5496                         break
5497                 }
5498                 off2 := auxIntToInt64(v_0.AuxInt)
5499                 ptr := v_0.Args[0]
5500                 val := v_1
5501                 mem := v_2
5502                 if !(is16Bit(int64(off1) + off2)) {
5503                         break
5504                 }
5505                 v.reset(OpPPC64FMOVDstore)
5506                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5507                 v.Aux = symToAux(sym)
5508                 v.AddArg3(ptr, val, mem)
5509                 return true
5510         }
5511         // match: (FMOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
5512         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
5513         // result: (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
5514         for {
5515                 off1 := auxIntToInt32(v.AuxInt)
5516                 sym1 := auxToSym(v.Aux)
5517                 p := v_0
5518                 if p.Op != OpPPC64MOVDaddr {
5519                         break
5520                 }
5521                 off2 := auxIntToInt32(p.AuxInt)
5522                 sym2 := auxToSym(p.Aux)
5523                 ptr := p.Args[0]
5524                 val := v_1
5525                 mem := v_2
5526                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
5527                         break
5528                 }
5529                 v.reset(OpPPC64FMOVDstore)
5530                 v.AuxInt = int32ToAuxInt(off1 + off2)
5531                 v.Aux = symToAux(mergeSym(sym1, sym2))
5532                 v.AddArg3(ptr, val, mem)
5533                 return true
5534         }
5535         return false
5536 }
5537 func rewriteValuePPC64_OpPPC64FMOVSload(v *Value) bool {
5538         v_1 := v.Args[1]
5539         v_0 := v.Args[0]
5540         // match: (FMOVSload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
5541         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
5542         // result: (FMOVSload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
5543         for {
5544                 off1 := auxIntToInt32(v.AuxInt)
5545                 sym1 := auxToSym(v.Aux)
5546                 p := v_0
5547                 if p.Op != OpPPC64MOVDaddr {
5548                         break
5549                 }
5550                 off2 := auxIntToInt32(p.AuxInt)
5551                 sym2 := auxToSym(p.Aux)
5552                 ptr := p.Args[0]
5553                 mem := v_1
5554                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
5555                         break
5556                 }
5557                 v.reset(OpPPC64FMOVSload)
5558                 v.AuxInt = int32ToAuxInt(off1 + off2)
5559                 v.Aux = symToAux(mergeSym(sym1, sym2))
5560                 v.AddArg2(ptr, mem)
5561                 return true
5562         }
5563         // match: (FMOVSload [off1] {sym} (ADDconst [off2] ptr) mem)
5564         // cond: is16Bit(int64(off1)+off2)
5565         // result: (FMOVSload [off1+int32(off2)] {sym} ptr mem)
5566         for {
5567                 off1 := auxIntToInt32(v.AuxInt)
5568                 sym := auxToSym(v.Aux)
5569                 if v_0.Op != OpPPC64ADDconst {
5570                         break
5571                 }
5572                 off2 := auxIntToInt64(v_0.AuxInt)
5573                 ptr := v_0.Args[0]
5574                 mem := v_1
5575                 if !(is16Bit(int64(off1) + off2)) {
5576                         break
5577                 }
5578                 v.reset(OpPPC64FMOVSload)
5579                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5580                 v.Aux = symToAux(sym)
5581                 v.AddArg2(ptr, mem)
5582                 return true
5583         }
5584         return false
5585 }
5586 func rewriteValuePPC64_OpPPC64FMOVSstore(v *Value) bool {
5587         v_2 := v.Args[2]
5588         v_1 := v.Args[1]
5589         v_0 := v.Args[0]
5590         // match: (FMOVSstore [off1] {sym} (ADDconst [off2] ptr) val mem)
5591         // cond: is16Bit(int64(off1)+off2)
5592         // result: (FMOVSstore [off1+int32(off2)] {sym} ptr val mem)
5593         for {
5594                 off1 := auxIntToInt32(v.AuxInt)
5595                 sym := auxToSym(v.Aux)
5596                 if v_0.Op != OpPPC64ADDconst {
5597                         break
5598                 }
5599                 off2 := auxIntToInt64(v_0.AuxInt)
5600                 ptr := v_0.Args[0]
5601                 val := v_1
5602                 mem := v_2
5603                 if !(is16Bit(int64(off1) + off2)) {
5604                         break
5605                 }
5606                 v.reset(OpPPC64FMOVSstore)
5607                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5608                 v.Aux = symToAux(sym)
5609                 v.AddArg3(ptr, val, mem)
5610                 return true
5611         }
5612         // match: (FMOVSstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
5613         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
5614         // result: (FMOVSstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
5615         for {
5616                 off1 := auxIntToInt32(v.AuxInt)
5617                 sym1 := auxToSym(v.Aux)
5618                 p := v_0
5619                 if p.Op != OpPPC64MOVDaddr {
5620                         break
5621                 }
5622                 off2 := auxIntToInt32(p.AuxInt)
5623                 sym2 := auxToSym(p.Aux)
5624                 ptr := p.Args[0]
5625                 val := v_1
5626                 mem := v_2
5627                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
5628                         break
5629                 }
5630                 v.reset(OpPPC64FMOVSstore)
5631                 v.AuxInt = int32ToAuxInt(off1 + off2)
5632                 v.Aux = symToAux(mergeSym(sym1, sym2))
5633                 v.AddArg3(ptr, val, mem)
5634                 return true
5635         }
5636         return false
5637 }
5638 func rewriteValuePPC64_OpPPC64FNEG(v *Value) bool {
5639         v_0 := v.Args[0]
5640         // match: (FNEG (FABS x))
5641         // result: (FNABS x)
5642         for {
5643                 if v_0.Op != OpPPC64FABS {
5644                         break
5645                 }
5646                 x := v_0.Args[0]
5647                 v.reset(OpPPC64FNABS)
5648                 v.AddArg(x)
5649                 return true
5650         }
5651         // match: (FNEG (FNABS x))
5652         // result: (FABS x)
5653         for {
5654                 if v_0.Op != OpPPC64FNABS {
5655                         break
5656                 }
5657                 x := v_0.Args[0]
5658                 v.reset(OpPPC64FABS)
5659                 v.AddArg(x)
5660                 return true
5661         }
5662         return false
5663 }
5664 func rewriteValuePPC64_OpPPC64FSQRT(v *Value) bool {
5665         v_0 := v.Args[0]
5666         // match: (FSQRT (FMOVDconst [x]))
5667         // cond: x >= 0
5668         // result: (FMOVDconst [math.Sqrt(x)])
5669         for {
5670                 if v_0.Op != OpPPC64FMOVDconst {
5671                         break
5672                 }
5673                 x := auxIntToFloat64(v_0.AuxInt)
5674                 if !(x >= 0) {
5675                         break
5676                 }
5677                 v.reset(OpPPC64FMOVDconst)
5678                 v.AuxInt = float64ToAuxInt(math.Sqrt(x))
5679                 return true
5680         }
5681         return false
5682 }
5683 func rewriteValuePPC64_OpPPC64FSUB(v *Value) bool {
5684         v_1 := v.Args[1]
5685         v_0 := v.Args[0]
5686         // match: (FSUB (FMUL x y) z)
5687         // result: (FMSUB x y z)
5688         for {
5689                 if v_0.Op != OpPPC64FMUL {
5690                         break
5691                 }
5692                 y := v_0.Args[1]
5693                 x := v_0.Args[0]
5694                 z := v_1
5695                 v.reset(OpPPC64FMSUB)
5696                 v.AddArg3(x, y, z)
5697                 return true
5698         }
5699         return false
5700 }
5701 func rewriteValuePPC64_OpPPC64FSUBS(v *Value) bool {
5702         v_1 := v.Args[1]
5703         v_0 := v.Args[0]
5704         // match: (FSUBS (FMULS x y) z)
5705         // result: (FMSUBS x y z)
5706         for {
5707                 if v_0.Op != OpPPC64FMULS {
5708                         break
5709                 }
5710                 y := v_0.Args[1]
5711                 x := v_0.Args[0]
5712                 z := v_1
5713                 v.reset(OpPPC64FMSUBS)
5714                 v.AddArg3(x, y, z)
5715                 return true
5716         }
5717         return false
5718 }
5719 func rewriteValuePPC64_OpPPC64FTRUNC(v *Value) bool {
5720         v_0 := v.Args[0]
5721         // match: (FTRUNC (FMOVDconst [x]))
5722         // result: (FMOVDconst [math.Trunc(x)])
5723         for {
5724                 if v_0.Op != OpPPC64FMOVDconst {
5725                         break
5726                 }
5727                 x := auxIntToFloat64(v_0.AuxInt)
5728                 v.reset(OpPPC64FMOVDconst)
5729                 v.AuxInt = float64ToAuxInt(math.Trunc(x))
5730                 return true
5731         }
5732         return false
5733 }
5734 func rewriteValuePPC64_OpPPC64GreaterEqual(v *Value) bool {
5735         v_0 := v.Args[0]
5736         b := v.Block
5737         typ := &b.Func.Config.Types
5738         // match: (GreaterEqual (FlagEQ))
5739         // result: (MOVDconst [1])
5740         for {
5741                 if v_0.Op != OpPPC64FlagEQ {
5742                         break
5743                 }
5744                 v.reset(OpPPC64MOVDconst)
5745                 v.AuxInt = int64ToAuxInt(1)
5746                 return true
5747         }
5748         // match: (GreaterEqual (FlagLT))
5749         // result: (MOVDconst [0])
5750         for {
5751                 if v_0.Op != OpPPC64FlagLT {
5752                         break
5753                 }
5754                 v.reset(OpPPC64MOVDconst)
5755                 v.AuxInt = int64ToAuxInt(0)
5756                 return true
5757         }
5758         // match: (GreaterEqual (FlagGT))
5759         // result: (MOVDconst [1])
5760         for {
5761                 if v_0.Op != OpPPC64FlagGT {
5762                         break
5763                 }
5764                 v.reset(OpPPC64MOVDconst)
5765                 v.AuxInt = int64ToAuxInt(1)
5766                 return true
5767         }
5768         // match: (GreaterEqual (InvertFlags x))
5769         // result: (LessEqual x)
5770         for {
5771                 if v_0.Op != OpPPC64InvertFlags {
5772                         break
5773                 }
5774                 x := v_0.Args[0]
5775                 v.reset(OpPPC64LessEqual)
5776                 v.AddArg(x)
5777                 return true
5778         }
5779         // match: (GreaterEqual cmp)
5780         // result: (ISELB [4] (MOVDconst [1]) cmp)
5781         for {
5782                 cmp := v_0
5783                 v.reset(OpPPC64ISELB)
5784                 v.AuxInt = int32ToAuxInt(4)
5785                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
5786                 v0.AuxInt = int64ToAuxInt(1)
5787                 v.AddArg2(v0, cmp)
5788                 return true
5789         }
5790 }
5791 func rewriteValuePPC64_OpPPC64GreaterThan(v *Value) bool {
5792         v_0 := v.Args[0]
5793         b := v.Block
5794         typ := &b.Func.Config.Types
5795         // match: (GreaterThan (FlagEQ))
5796         // result: (MOVDconst [0])
5797         for {
5798                 if v_0.Op != OpPPC64FlagEQ {
5799                         break
5800                 }
5801                 v.reset(OpPPC64MOVDconst)
5802                 v.AuxInt = int64ToAuxInt(0)
5803                 return true
5804         }
5805         // match: (GreaterThan (FlagLT))
5806         // result: (MOVDconst [0])
5807         for {
5808                 if v_0.Op != OpPPC64FlagLT {
5809                         break
5810                 }
5811                 v.reset(OpPPC64MOVDconst)
5812                 v.AuxInt = int64ToAuxInt(0)
5813                 return true
5814         }
5815         // match: (GreaterThan (FlagGT))
5816         // result: (MOVDconst [1])
5817         for {
5818                 if v_0.Op != OpPPC64FlagGT {
5819                         break
5820                 }
5821                 v.reset(OpPPC64MOVDconst)
5822                 v.AuxInt = int64ToAuxInt(1)
5823                 return true
5824         }
5825         // match: (GreaterThan (InvertFlags x))
5826         // result: (LessThan x)
5827         for {
5828                 if v_0.Op != OpPPC64InvertFlags {
5829                         break
5830                 }
5831                 x := v_0.Args[0]
5832                 v.reset(OpPPC64LessThan)
5833                 v.AddArg(x)
5834                 return true
5835         }
5836         // match: (GreaterThan cmp)
5837         // result: (ISELB [1] (MOVDconst [1]) cmp)
5838         for {
5839                 cmp := v_0
5840                 v.reset(OpPPC64ISELB)
5841                 v.AuxInt = int32ToAuxInt(1)
5842                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
5843                 v0.AuxInt = int64ToAuxInt(1)
5844                 v.AddArg2(v0, cmp)
5845                 return true
5846         }
5847 }
5848 func rewriteValuePPC64_OpPPC64ISEL(v *Value) bool {
5849         v_2 := v.Args[2]
5850         v_1 := v.Args[1]
5851         v_0 := v.Args[0]
5852         // match: (ISEL [0] (ANDconst [d] y) (MOVDconst [-1]) (CMPU (ANDconst [d] y) (MOVDconst [c])))
5853         // cond: c >= d
5854         // result: (ANDconst [d] y)
5855         for {
5856                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64ANDconst {
5857                         break
5858                 }
5859                 d := auxIntToInt64(v_0.AuxInt)
5860                 y := v_0.Args[0]
5861                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 || v_2.Op != OpPPC64CMPU {
5862                         break
5863                 }
5864                 _ = v_2.Args[1]
5865                 v_2_0 := v_2.Args[0]
5866                 if v_2_0.Op != OpPPC64ANDconst || auxIntToInt64(v_2_0.AuxInt) != d || y != v_2_0.Args[0] {
5867                         break
5868                 }
5869                 v_2_1 := v_2.Args[1]
5870                 if v_2_1.Op != OpPPC64MOVDconst {
5871                         break
5872                 }
5873                 c := auxIntToInt64(v_2_1.AuxInt)
5874                 if !(c >= d) {
5875                         break
5876                 }
5877                 v.reset(OpPPC64ANDconst)
5878                 v.AuxInt = int64ToAuxInt(d)
5879                 v.AddArg(y)
5880                 return true
5881         }
5882         // match: (ISEL [0] (ANDconst [d] y) (MOVDconst [-1]) (CMPUconst [c] (ANDconst [d] y)))
5883         // cond: c >= d
5884         // result: (ANDconst [d] y)
5885         for {
5886                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64ANDconst {
5887                         break
5888                 }
5889                 d := auxIntToInt64(v_0.AuxInt)
5890                 y := v_0.Args[0]
5891                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 || v_2.Op != OpPPC64CMPUconst {
5892                         break
5893                 }
5894                 c := auxIntToInt64(v_2.AuxInt)
5895                 v_2_0 := v_2.Args[0]
5896                 if v_2_0.Op != OpPPC64ANDconst || auxIntToInt64(v_2_0.AuxInt) != d || y != v_2_0.Args[0] || !(c >= d) {
5897                         break
5898                 }
5899                 v.reset(OpPPC64ANDconst)
5900                 v.AuxInt = int64ToAuxInt(d)
5901                 v.AddArg(y)
5902                 return true
5903         }
5904         // match: (ISEL [2] x _ (FlagEQ))
5905         // result: x
5906         for {
5907                 if auxIntToInt32(v.AuxInt) != 2 {
5908                         break
5909                 }
5910                 x := v_0
5911                 if v_2.Op != OpPPC64FlagEQ {
5912                         break
5913                 }
5914                 v.copyOf(x)
5915                 return true
5916         }
5917         // match: (ISEL [2] _ y (FlagLT))
5918         // result: y
5919         for {
5920                 if auxIntToInt32(v.AuxInt) != 2 {
5921                         break
5922                 }
5923                 y := v_1
5924                 if v_2.Op != OpPPC64FlagLT {
5925                         break
5926                 }
5927                 v.copyOf(y)
5928                 return true
5929         }
5930         // match: (ISEL [2] _ y (FlagGT))
5931         // result: y
5932         for {
5933                 if auxIntToInt32(v.AuxInt) != 2 {
5934                         break
5935                 }
5936                 y := v_1
5937                 if v_2.Op != OpPPC64FlagGT {
5938                         break
5939                 }
5940                 v.copyOf(y)
5941                 return true
5942         }
5943         // match: (ISEL [6] _ y (FlagEQ))
5944         // result: y
5945         for {
5946                 if auxIntToInt32(v.AuxInt) != 6 {
5947                         break
5948                 }
5949                 y := v_1
5950                 if v_2.Op != OpPPC64FlagEQ {
5951                         break
5952                 }
5953                 v.copyOf(y)
5954                 return true
5955         }
5956         // match: (ISEL [6] x _ (FlagLT))
5957         // result: x
5958         for {
5959                 if auxIntToInt32(v.AuxInt) != 6 {
5960                         break
5961                 }
5962                 x := v_0
5963                 if v_2.Op != OpPPC64FlagLT {
5964                         break
5965                 }
5966                 v.copyOf(x)
5967                 return true
5968         }
5969         // match: (ISEL [6] x _ (FlagGT))
5970         // result: x
5971         for {
5972                 if auxIntToInt32(v.AuxInt) != 6 {
5973                         break
5974                 }
5975                 x := v_0
5976                 if v_2.Op != OpPPC64FlagGT {
5977                         break
5978                 }
5979                 v.copyOf(x)
5980                 return true
5981         }
5982         // match: (ISEL [0] _ y (FlagEQ))
5983         // result: y
5984         for {
5985                 if auxIntToInt32(v.AuxInt) != 0 {
5986                         break
5987                 }
5988                 y := v_1
5989                 if v_2.Op != OpPPC64FlagEQ {
5990                         break
5991                 }
5992                 v.copyOf(y)
5993                 return true
5994         }
5995         // match: (ISEL [0] _ y (FlagGT))
5996         // result: y
5997         for {
5998                 if auxIntToInt32(v.AuxInt) != 0 {
5999                         break
6000                 }
6001                 y := v_1
6002                 if v_2.Op != OpPPC64FlagGT {
6003                         break
6004                 }
6005                 v.copyOf(y)
6006                 return true
6007         }
6008         // match: (ISEL [0] x _ (FlagLT))
6009         // result: x
6010         for {
6011                 if auxIntToInt32(v.AuxInt) != 0 {
6012                         break
6013                 }
6014                 x := v_0
6015                 if v_2.Op != OpPPC64FlagLT {
6016                         break
6017                 }
6018                 v.copyOf(x)
6019                 return true
6020         }
6021         // match: (ISEL [5] _ x (FlagEQ))
6022         // result: x
6023         for {
6024                 if auxIntToInt32(v.AuxInt) != 5 {
6025                         break
6026                 }
6027                 x := v_1
6028                 if v_2.Op != OpPPC64FlagEQ {
6029                         break
6030                 }
6031                 v.copyOf(x)
6032                 return true
6033         }
6034         // match: (ISEL [5] _ x (FlagLT))
6035         // result: x
6036         for {
6037                 if auxIntToInt32(v.AuxInt) != 5 {
6038                         break
6039                 }
6040                 x := v_1
6041                 if v_2.Op != OpPPC64FlagLT {
6042                         break
6043                 }
6044                 v.copyOf(x)
6045                 return true
6046         }
6047         // match: (ISEL [5] y _ (FlagGT))
6048         // result: y
6049         for {
6050                 if auxIntToInt32(v.AuxInt) != 5 {
6051                         break
6052                 }
6053                 y := v_0
6054                 if v_2.Op != OpPPC64FlagGT {
6055                         break
6056                 }
6057                 v.copyOf(y)
6058                 return true
6059         }
6060         // match: (ISEL [1] _ y (FlagEQ))
6061         // result: y
6062         for {
6063                 if auxIntToInt32(v.AuxInt) != 1 {
6064                         break
6065                 }
6066                 y := v_1
6067                 if v_2.Op != OpPPC64FlagEQ {
6068                         break
6069                 }
6070                 v.copyOf(y)
6071                 return true
6072         }
6073         // match: (ISEL [1] _ y (FlagLT))
6074         // result: y
6075         for {
6076                 if auxIntToInt32(v.AuxInt) != 1 {
6077                         break
6078                 }
6079                 y := v_1
6080                 if v_2.Op != OpPPC64FlagLT {
6081                         break
6082                 }
6083                 v.copyOf(y)
6084                 return true
6085         }
6086         // match: (ISEL [1] x _ (FlagGT))
6087         // result: x
6088         for {
6089                 if auxIntToInt32(v.AuxInt) != 1 {
6090                         break
6091                 }
6092                 x := v_0
6093                 if v_2.Op != OpPPC64FlagGT {
6094                         break
6095                 }
6096                 v.copyOf(x)
6097                 return true
6098         }
6099         // match: (ISEL [4] x _ (FlagEQ))
6100         // result: x
6101         for {
6102                 if auxIntToInt32(v.AuxInt) != 4 {
6103                         break
6104                 }
6105                 x := v_0
6106                 if v_2.Op != OpPPC64FlagEQ {
6107                         break
6108                 }
6109                 v.copyOf(x)
6110                 return true
6111         }
6112         // match: (ISEL [4] x _ (FlagGT))
6113         // result: x
6114         for {
6115                 if auxIntToInt32(v.AuxInt) != 4 {
6116                         break
6117                 }
6118                 x := v_0
6119                 if v_2.Op != OpPPC64FlagGT {
6120                         break
6121                 }
6122                 v.copyOf(x)
6123                 return true
6124         }
6125         // match: (ISEL [4] _ y (FlagLT))
6126         // result: y
6127         for {
6128                 if auxIntToInt32(v.AuxInt) != 4 {
6129                         break
6130                 }
6131                 y := v_1
6132                 if v_2.Op != OpPPC64FlagLT {
6133                         break
6134                 }
6135                 v.copyOf(y)
6136                 return true
6137         }
6138         // match: (ISEL [n] x y (InvertFlags bool))
6139         // cond: n%4 == 0
6140         // result: (ISEL [n+1] x y bool)
6141         for {
6142                 n := auxIntToInt32(v.AuxInt)
6143                 x := v_0
6144                 y := v_1
6145                 if v_2.Op != OpPPC64InvertFlags {
6146                         break
6147                 }
6148                 bool := v_2.Args[0]
6149                 if !(n%4 == 0) {
6150                         break
6151                 }
6152                 v.reset(OpPPC64ISEL)
6153                 v.AuxInt = int32ToAuxInt(n + 1)
6154                 v.AddArg3(x, y, bool)
6155                 return true
6156         }
6157         // match: (ISEL [n] x y (InvertFlags bool))
6158         // cond: n%4 == 1
6159         // result: (ISEL [n-1] x y bool)
6160         for {
6161                 n := auxIntToInt32(v.AuxInt)
6162                 x := v_0
6163                 y := v_1
6164                 if v_2.Op != OpPPC64InvertFlags {
6165                         break
6166                 }
6167                 bool := v_2.Args[0]
6168                 if !(n%4 == 1) {
6169                         break
6170                 }
6171                 v.reset(OpPPC64ISEL)
6172                 v.AuxInt = int32ToAuxInt(n - 1)
6173                 v.AddArg3(x, y, bool)
6174                 return true
6175         }
6176         // match: (ISEL [n] x y (InvertFlags bool))
6177         // cond: n%4 == 2
6178         // result: (ISEL [n] x y bool)
6179         for {
6180                 n := auxIntToInt32(v.AuxInt)
6181                 x := v_0
6182                 y := v_1
6183                 if v_2.Op != OpPPC64InvertFlags {
6184                         break
6185                 }
6186                 bool := v_2.Args[0]
6187                 if !(n%4 == 2) {
6188                         break
6189                 }
6190                 v.reset(OpPPC64ISEL)
6191                 v.AuxInt = int32ToAuxInt(n)
6192                 v.AddArg3(x, y, bool)
6193                 return true
6194         }
6195         return false
6196 }
6197 func rewriteValuePPC64_OpPPC64ISELB(v *Value) bool {
6198         v_1 := v.Args[1]
6199         v_0 := v.Args[0]
6200         b := v.Block
6201         typ := &b.Func.Config.Types
6202         // match: (ISELB [0] _ (FlagLT))
6203         // result: (MOVDconst [1])
6204         for {
6205                 if auxIntToInt32(v.AuxInt) != 0 || v_1.Op != OpPPC64FlagLT {
6206                         break
6207                 }
6208                 v.reset(OpPPC64MOVDconst)
6209                 v.AuxInt = int64ToAuxInt(1)
6210                 return true
6211         }
6212         // match: (ISELB [0] _ (FlagGT))
6213         // result: (MOVDconst [0])
6214         for {
6215                 if auxIntToInt32(v.AuxInt) != 0 || v_1.Op != OpPPC64FlagGT {
6216                         break
6217                 }
6218                 v.reset(OpPPC64MOVDconst)
6219                 v.AuxInt = int64ToAuxInt(0)
6220                 return true
6221         }
6222         // match: (ISELB [0] _ (FlagEQ))
6223         // result: (MOVDconst [0])
6224         for {
6225                 if auxIntToInt32(v.AuxInt) != 0 || v_1.Op != OpPPC64FlagEQ {
6226                         break
6227                 }
6228                 v.reset(OpPPC64MOVDconst)
6229                 v.AuxInt = int64ToAuxInt(0)
6230                 return true
6231         }
6232         // match: (ISELB [1] _ (FlagGT))
6233         // result: (MOVDconst [1])
6234         for {
6235                 if auxIntToInt32(v.AuxInt) != 1 || v_1.Op != OpPPC64FlagGT {
6236                         break
6237                 }
6238                 v.reset(OpPPC64MOVDconst)
6239                 v.AuxInt = int64ToAuxInt(1)
6240                 return true
6241         }
6242         // match: (ISELB [1] _ (FlagLT))
6243         // result: (MOVDconst [0])
6244         for {
6245                 if auxIntToInt32(v.AuxInt) != 1 || v_1.Op != OpPPC64FlagLT {
6246                         break
6247                 }
6248                 v.reset(OpPPC64MOVDconst)
6249                 v.AuxInt = int64ToAuxInt(0)
6250                 return true
6251         }
6252         // match: (ISELB [1] _ (FlagEQ))
6253         // result: (MOVDconst [0])
6254         for {
6255                 if auxIntToInt32(v.AuxInt) != 1 || v_1.Op != OpPPC64FlagEQ {
6256                         break
6257                 }
6258                 v.reset(OpPPC64MOVDconst)
6259                 v.AuxInt = int64ToAuxInt(0)
6260                 return true
6261         }
6262         // match: (ISELB [2] _ (FlagEQ))
6263         // result: (MOVDconst [1])
6264         for {
6265                 if auxIntToInt32(v.AuxInt) != 2 || v_1.Op != OpPPC64FlagEQ {
6266                         break
6267                 }
6268                 v.reset(OpPPC64MOVDconst)
6269                 v.AuxInt = int64ToAuxInt(1)
6270                 return true
6271         }
6272         // match: (ISELB [2] _ (FlagLT))
6273         // result: (MOVDconst [0])
6274         for {
6275                 if auxIntToInt32(v.AuxInt) != 2 || v_1.Op != OpPPC64FlagLT {
6276                         break
6277                 }
6278                 v.reset(OpPPC64MOVDconst)
6279                 v.AuxInt = int64ToAuxInt(0)
6280                 return true
6281         }
6282         // match: (ISELB [2] _ (FlagGT))
6283         // result: (MOVDconst [0])
6284         for {
6285                 if auxIntToInt32(v.AuxInt) != 2 || v_1.Op != OpPPC64FlagGT {
6286                         break
6287                 }
6288                 v.reset(OpPPC64MOVDconst)
6289                 v.AuxInt = int64ToAuxInt(0)
6290                 return true
6291         }
6292         // match: (ISELB [4] _ (FlagLT))
6293         // result: (MOVDconst [0])
6294         for {
6295                 if auxIntToInt32(v.AuxInt) != 4 || v_1.Op != OpPPC64FlagLT {
6296                         break
6297                 }
6298                 v.reset(OpPPC64MOVDconst)
6299                 v.AuxInt = int64ToAuxInt(0)
6300                 return true
6301         }
6302         // match: (ISELB [4] _ (FlagGT))
6303         // result: (MOVDconst [1])
6304         for {
6305                 if auxIntToInt32(v.AuxInt) != 4 || v_1.Op != OpPPC64FlagGT {
6306                         break
6307                 }
6308                 v.reset(OpPPC64MOVDconst)
6309                 v.AuxInt = int64ToAuxInt(1)
6310                 return true
6311         }
6312         // match: (ISELB [4] _ (FlagEQ))
6313         // result: (MOVDconst [1])
6314         for {
6315                 if auxIntToInt32(v.AuxInt) != 4 || v_1.Op != OpPPC64FlagEQ {
6316                         break
6317                 }
6318                 v.reset(OpPPC64MOVDconst)
6319                 v.AuxInt = int64ToAuxInt(1)
6320                 return true
6321         }
6322         // match: (ISELB [5] _ (FlagGT))
6323         // result: (MOVDconst [0])
6324         for {
6325                 if auxIntToInt32(v.AuxInt) != 5 || v_1.Op != OpPPC64FlagGT {
6326                         break
6327                 }
6328                 v.reset(OpPPC64MOVDconst)
6329                 v.AuxInt = int64ToAuxInt(0)
6330                 return true
6331         }
6332         // match: (ISELB [5] _ (FlagLT))
6333         // result: (MOVDconst [1])
6334         for {
6335                 if auxIntToInt32(v.AuxInt) != 5 || v_1.Op != OpPPC64FlagLT {
6336                         break
6337                 }
6338                 v.reset(OpPPC64MOVDconst)
6339                 v.AuxInt = int64ToAuxInt(1)
6340                 return true
6341         }
6342         // match: (ISELB [5] _ (FlagEQ))
6343         // result: (MOVDconst [1])
6344         for {
6345                 if auxIntToInt32(v.AuxInt) != 5 || v_1.Op != OpPPC64FlagEQ {
6346                         break
6347                 }
6348                 v.reset(OpPPC64MOVDconst)
6349                 v.AuxInt = int64ToAuxInt(1)
6350                 return true
6351         }
6352         // match: (ISELB [6] _ (FlagEQ))
6353         // result: (MOVDconst [0])
6354         for {
6355                 if auxIntToInt32(v.AuxInt) != 6 || v_1.Op != OpPPC64FlagEQ {
6356                         break
6357                 }
6358                 v.reset(OpPPC64MOVDconst)
6359                 v.AuxInt = int64ToAuxInt(0)
6360                 return true
6361         }
6362         // match: (ISELB [6] _ (FlagLT))
6363         // result: (MOVDconst [1])
6364         for {
6365                 if auxIntToInt32(v.AuxInt) != 6 || v_1.Op != OpPPC64FlagLT {
6366                         break
6367                 }
6368                 v.reset(OpPPC64MOVDconst)
6369                 v.AuxInt = int64ToAuxInt(1)
6370                 return true
6371         }
6372         // match: (ISELB [6] _ (FlagGT))
6373         // result: (MOVDconst [1])
6374         for {
6375                 if auxIntToInt32(v.AuxInt) != 6 || v_1.Op != OpPPC64FlagGT {
6376                         break
6377                 }
6378                 v.reset(OpPPC64MOVDconst)
6379                 v.AuxInt = int64ToAuxInt(1)
6380                 return true
6381         }
6382         // match: (ISELB [n] (MOVDconst [1]) (InvertFlags bool))
6383         // cond: n%4 == 0
6384         // result: (ISELB [n+1] (MOVDconst [1]) bool)
6385         for {
6386                 n := auxIntToInt32(v.AuxInt)
6387                 if v_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_0.AuxInt) != 1 || v_1.Op != OpPPC64InvertFlags {
6388                         break
6389                 }
6390                 bool := v_1.Args[0]
6391                 if !(n%4 == 0) {
6392                         break
6393                 }
6394                 v.reset(OpPPC64ISELB)
6395                 v.AuxInt = int32ToAuxInt(n + 1)
6396                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
6397                 v0.AuxInt = int64ToAuxInt(1)
6398                 v.AddArg2(v0, bool)
6399                 return true
6400         }
6401         // match: (ISELB [n] (MOVDconst [1]) (InvertFlags bool))
6402         // cond: n%4 == 1
6403         // result: (ISELB [n-1] (MOVDconst [1]) bool)
6404         for {
6405                 n := auxIntToInt32(v.AuxInt)
6406                 if v_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_0.AuxInt) != 1 || v_1.Op != OpPPC64InvertFlags {
6407                         break
6408                 }
6409                 bool := v_1.Args[0]
6410                 if !(n%4 == 1) {
6411                         break
6412                 }
6413                 v.reset(OpPPC64ISELB)
6414                 v.AuxInt = int32ToAuxInt(n - 1)
6415                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
6416                 v0.AuxInt = int64ToAuxInt(1)
6417                 v.AddArg2(v0, bool)
6418                 return true
6419         }
6420         // match: (ISELB [n] (MOVDconst [1]) (InvertFlags bool))
6421         // cond: n%4 == 2
6422         // result: (ISELB [n] (MOVDconst [1]) bool)
6423         for {
6424                 n := auxIntToInt32(v.AuxInt)
6425                 if v_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_0.AuxInt) != 1 || v_1.Op != OpPPC64InvertFlags {
6426                         break
6427                 }
6428                 bool := v_1.Args[0]
6429                 if !(n%4 == 2) {
6430                         break
6431                 }
6432                 v.reset(OpPPC64ISELB)
6433                 v.AuxInt = int32ToAuxInt(n)
6434                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
6435                 v0.AuxInt = int64ToAuxInt(1)
6436                 v.AddArg2(v0, bool)
6437                 return true
6438         }
6439         return false
6440 }
6441 func rewriteValuePPC64_OpPPC64LessEqual(v *Value) bool {
6442         v_0 := v.Args[0]
6443         b := v.Block
6444         typ := &b.Func.Config.Types
6445         // match: (LessEqual (FlagEQ))
6446         // result: (MOVDconst [1])
6447         for {
6448                 if v_0.Op != OpPPC64FlagEQ {
6449                         break
6450                 }
6451                 v.reset(OpPPC64MOVDconst)
6452                 v.AuxInt = int64ToAuxInt(1)
6453                 return true
6454         }
6455         // match: (LessEqual (FlagLT))
6456         // result: (MOVDconst [1])
6457         for {
6458                 if v_0.Op != OpPPC64FlagLT {
6459                         break
6460                 }
6461                 v.reset(OpPPC64MOVDconst)
6462                 v.AuxInt = int64ToAuxInt(1)
6463                 return true
6464         }
6465         // match: (LessEqual (FlagGT))
6466         // result: (MOVDconst [0])
6467         for {
6468                 if v_0.Op != OpPPC64FlagGT {
6469                         break
6470                 }
6471                 v.reset(OpPPC64MOVDconst)
6472                 v.AuxInt = int64ToAuxInt(0)
6473                 return true
6474         }
6475         // match: (LessEqual (InvertFlags x))
6476         // result: (GreaterEqual x)
6477         for {
6478                 if v_0.Op != OpPPC64InvertFlags {
6479                         break
6480                 }
6481                 x := v_0.Args[0]
6482                 v.reset(OpPPC64GreaterEqual)
6483                 v.AddArg(x)
6484                 return true
6485         }
6486         // match: (LessEqual cmp)
6487         // result: (ISELB [5] (MOVDconst [1]) cmp)
6488         for {
6489                 cmp := v_0
6490                 v.reset(OpPPC64ISELB)
6491                 v.AuxInt = int32ToAuxInt(5)
6492                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
6493                 v0.AuxInt = int64ToAuxInt(1)
6494                 v.AddArg2(v0, cmp)
6495                 return true
6496         }
6497 }
6498 func rewriteValuePPC64_OpPPC64LessThan(v *Value) bool {
6499         v_0 := v.Args[0]
6500         b := v.Block
6501         typ := &b.Func.Config.Types
6502         // match: (LessThan (FlagEQ))
6503         // result: (MOVDconst [0])
6504         for {
6505                 if v_0.Op != OpPPC64FlagEQ {
6506                         break
6507                 }
6508                 v.reset(OpPPC64MOVDconst)
6509                 v.AuxInt = int64ToAuxInt(0)
6510                 return true
6511         }
6512         // match: (LessThan (FlagLT))
6513         // result: (MOVDconst [1])
6514         for {
6515                 if v_0.Op != OpPPC64FlagLT {
6516                         break
6517                 }
6518                 v.reset(OpPPC64MOVDconst)
6519                 v.AuxInt = int64ToAuxInt(1)
6520                 return true
6521         }
6522         // match: (LessThan (FlagGT))
6523         // result: (MOVDconst [0])
6524         for {
6525                 if v_0.Op != OpPPC64FlagGT {
6526                         break
6527                 }
6528                 v.reset(OpPPC64MOVDconst)
6529                 v.AuxInt = int64ToAuxInt(0)
6530                 return true
6531         }
6532         // match: (LessThan (InvertFlags x))
6533         // result: (GreaterThan x)
6534         for {
6535                 if v_0.Op != OpPPC64InvertFlags {
6536                         break
6537                 }
6538                 x := v_0.Args[0]
6539                 v.reset(OpPPC64GreaterThan)
6540                 v.AddArg(x)
6541                 return true
6542         }
6543         // match: (LessThan cmp)
6544         // result: (ISELB [0] (MOVDconst [1]) cmp)
6545         for {
6546                 cmp := v_0
6547                 v.reset(OpPPC64ISELB)
6548                 v.AuxInt = int32ToAuxInt(0)
6549                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
6550                 v0.AuxInt = int64ToAuxInt(1)
6551                 v.AddArg2(v0, cmp)
6552                 return true
6553         }
6554 }
6555 func rewriteValuePPC64_OpPPC64MFVSRD(v *Value) bool {
6556         v_0 := v.Args[0]
6557         b := v.Block
6558         typ := &b.Func.Config.Types
6559         // match: (MFVSRD (FMOVDconst [c]))
6560         // result: (MOVDconst [int64(math.Float64bits(c))])
6561         for {
6562                 if v_0.Op != OpPPC64FMOVDconst {
6563                         break
6564                 }
6565                 c := auxIntToFloat64(v_0.AuxInt)
6566                 v.reset(OpPPC64MOVDconst)
6567                 v.AuxInt = int64ToAuxInt(int64(math.Float64bits(c)))
6568                 return true
6569         }
6570         // match: (MFVSRD x:(FMOVDload [off] {sym} ptr mem))
6571         // cond: x.Uses == 1 && clobber(x)
6572         // result: @x.Block (MOVDload [off] {sym} ptr mem)
6573         for {
6574                 x := v_0
6575                 if x.Op != OpPPC64FMOVDload {
6576                         break
6577                 }
6578                 off := auxIntToInt32(x.AuxInt)
6579                 sym := auxToSym(x.Aux)
6580                 mem := x.Args[1]
6581                 ptr := x.Args[0]
6582                 if !(x.Uses == 1 && clobber(x)) {
6583                         break
6584                 }
6585                 b = x.Block
6586                 v0 := b.NewValue0(x.Pos, OpPPC64MOVDload, typ.Int64)
6587                 v.copyOf(v0)
6588                 v0.AuxInt = int32ToAuxInt(off)
6589                 v0.Aux = symToAux(sym)
6590                 v0.AddArg2(ptr, mem)
6591                 return true
6592         }
6593         return false
6594 }
6595 func rewriteValuePPC64_OpPPC64MOVBZload(v *Value) bool {
6596         v_1 := v.Args[1]
6597         v_0 := v.Args[0]
6598         // match: (MOVBZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
6599         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
6600         // result: (MOVBZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
6601         for {
6602                 off1 := auxIntToInt32(v.AuxInt)
6603                 sym1 := auxToSym(v.Aux)
6604                 p := v_0
6605                 if p.Op != OpPPC64MOVDaddr {
6606                         break
6607                 }
6608                 off2 := auxIntToInt32(p.AuxInt)
6609                 sym2 := auxToSym(p.Aux)
6610                 ptr := p.Args[0]
6611                 mem := v_1
6612                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
6613                         break
6614                 }
6615                 v.reset(OpPPC64MOVBZload)
6616                 v.AuxInt = int32ToAuxInt(off1 + off2)
6617                 v.Aux = symToAux(mergeSym(sym1, sym2))
6618                 v.AddArg2(ptr, mem)
6619                 return true
6620         }
6621         // match: (MOVBZload [off1] {sym} (ADDconst [off2] x) mem)
6622         // cond: is16Bit(int64(off1)+off2)
6623         // result: (MOVBZload [off1+int32(off2)] {sym} x mem)
6624         for {
6625                 off1 := auxIntToInt32(v.AuxInt)
6626                 sym := auxToSym(v.Aux)
6627                 if v_0.Op != OpPPC64ADDconst {
6628                         break
6629                 }
6630                 off2 := auxIntToInt64(v_0.AuxInt)
6631                 x := v_0.Args[0]
6632                 mem := v_1
6633                 if !(is16Bit(int64(off1) + off2)) {
6634                         break
6635                 }
6636                 v.reset(OpPPC64MOVBZload)
6637                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
6638                 v.Aux = symToAux(sym)
6639                 v.AddArg2(x, mem)
6640                 return true
6641         }
6642         // match: (MOVBZload [0] {sym} p:(ADD ptr idx) mem)
6643         // cond: sym == nil && p.Uses == 1
6644         // result: (MOVBZloadidx ptr idx mem)
6645         for {
6646                 if auxIntToInt32(v.AuxInt) != 0 {
6647                         break
6648                 }
6649                 sym := auxToSym(v.Aux)
6650                 p := v_0
6651                 if p.Op != OpPPC64ADD {
6652                         break
6653                 }
6654                 idx := p.Args[1]
6655                 ptr := p.Args[0]
6656                 mem := v_1
6657                 if !(sym == nil && p.Uses == 1) {
6658                         break
6659                 }
6660                 v.reset(OpPPC64MOVBZloadidx)
6661                 v.AddArg3(ptr, idx, mem)
6662                 return true
6663         }
6664         return false
6665 }
6666 func rewriteValuePPC64_OpPPC64MOVBZloadidx(v *Value) bool {
6667         v_2 := v.Args[2]
6668         v_1 := v.Args[1]
6669         v_0 := v.Args[0]
6670         // match: (MOVBZloadidx ptr (MOVDconst [c]) mem)
6671         // cond: is16Bit(c)
6672         // result: (MOVBZload [int32(c)] ptr mem)
6673         for {
6674                 ptr := v_0
6675                 if v_1.Op != OpPPC64MOVDconst {
6676                         break
6677                 }
6678                 c := auxIntToInt64(v_1.AuxInt)
6679                 mem := v_2
6680                 if !(is16Bit(c)) {
6681                         break
6682                 }
6683                 v.reset(OpPPC64MOVBZload)
6684                 v.AuxInt = int32ToAuxInt(int32(c))
6685                 v.AddArg2(ptr, mem)
6686                 return true
6687         }
6688         // match: (MOVBZloadidx (MOVDconst [c]) ptr mem)
6689         // cond: is16Bit(c)
6690         // result: (MOVBZload [int32(c)] ptr mem)
6691         for {
6692                 if v_0.Op != OpPPC64MOVDconst {
6693                         break
6694                 }
6695                 c := auxIntToInt64(v_0.AuxInt)
6696                 ptr := v_1
6697                 mem := v_2
6698                 if !(is16Bit(c)) {
6699                         break
6700                 }
6701                 v.reset(OpPPC64MOVBZload)
6702                 v.AuxInt = int32ToAuxInt(int32(c))
6703                 v.AddArg2(ptr, mem)
6704                 return true
6705         }
6706         return false
6707 }
6708 func rewriteValuePPC64_OpPPC64MOVBZreg(v *Value) bool {
6709         v_0 := v.Args[0]
6710         b := v.Block
6711         typ := &b.Func.Config.Types
6712         // match: (MOVBZreg y:(ANDconst [c] _))
6713         // cond: uint64(c) <= 0xFF
6714         // result: y
6715         for {
6716                 y := v_0
6717                 if y.Op != OpPPC64ANDconst {
6718                         break
6719                 }
6720                 c := auxIntToInt64(y.AuxInt)
6721                 if !(uint64(c) <= 0xFF) {
6722                         break
6723                 }
6724                 v.copyOf(y)
6725                 return true
6726         }
6727         // match: (MOVBZreg (SRWconst [c] (MOVBZreg x)))
6728         // result: (SRWconst [c] (MOVBZreg x))
6729         for {
6730                 if v_0.Op != OpPPC64SRWconst {
6731                         break
6732                 }
6733                 c := auxIntToInt64(v_0.AuxInt)
6734                 v_0_0 := v_0.Args[0]
6735                 if v_0_0.Op != OpPPC64MOVBZreg {
6736                         break
6737                 }
6738                 x := v_0_0.Args[0]
6739                 v.reset(OpPPC64SRWconst)
6740                 v.AuxInt = int64ToAuxInt(c)
6741                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
6742                 v0.AddArg(x)
6743                 v.AddArg(v0)
6744                 return true
6745         }
6746         // match: (MOVBZreg (SRWconst [c] x))
6747         // cond: sizeof(x.Type) == 8
6748         // result: (SRWconst [c] x)
6749         for {
6750                 if v_0.Op != OpPPC64SRWconst {
6751                         break
6752                 }
6753                 c := auxIntToInt64(v_0.AuxInt)
6754                 x := v_0.Args[0]
6755                 if !(sizeof(x.Type) == 8) {
6756                         break
6757                 }
6758                 v.reset(OpPPC64SRWconst)
6759                 v.AuxInt = int64ToAuxInt(c)
6760                 v.AddArg(x)
6761                 return true
6762         }
6763         // match: (MOVBZreg (SRDconst [c] x))
6764         // cond: c>=56
6765         // result: (SRDconst [c] x)
6766         for {
6767                 if v_0.Op != OpPPC64SRDconst {
6768                         break
6769                 }
6770                 c := auxIntToInt64(v_0.AuxInt)
6771                 x := v_0.Args[0]
6772                 if !(c >= 56) {
6773                         break
6774                 }
6775                 v.reset(OpPPC64SRDconst)
6776                 v.AuxInt = int64ToAuxInt(c)
6777                 v.AddArg(x)
6778                 return true
6779         }
6780         // match: (MOVBZreg (SRWconst [c] x))
6781         // cond: c>=24
6782         // result: (SRWconst [c] x)
6783         for {
6784                 if v_0.Op != OpPPC64SRWconst {
6785                         break
6786                 }
6787                 c := auxIntToInt64(v_0.AuxInt)
6788                 x := v_0.Args[0]
6789                 if !(c >= 24) {
6790                         break
6791                 }
6792                 v.reset(OpPPC64SRWconst)
6793                 v.AuxInt = int64ToAuxInt(c)
6794                 v.AddArg(x)
6795                 return true
6796         }
6797         // match: (MOVBZreg y:(MOVBZreg _))
6798         // result: y
6799         for {
6800                 y := v_0
6801                 if y.Op != OpPPC64MOVBZreg {
6802                         break
6803                 }
6804                 v.copyOf(y)
6805                 return true
6806         }
6807         // match: (MOVBZreg (MOVBreg x))
6808         // result: (MOVBZreg x)
6809         for {
6810                 if v_0.Op != OpPPC64MOVBreg {
6811                         break
6812                 }
6813                 x := v_0.Args[0]
6814                 v.reset(OpPPC64MOVBZreg)
6815                 v.AddArg(x)
6816                 return true
6817         }
6818         // match: (MOVBZreg (OR <t> x (MOVWZreg y)))
6819         // result: (MOVBZreg (OR <t> x y))
6820         for {
6821                 if v_0.Op != OpPPC64OR {
6822                         break
6823                 }
6824                 t := v_0.Type
6825                 _ = v_0.Args[1]
6826                 v_0_0 := v_0.Args[0]
6827                 v_0_1 := v_0.Args[1]
6828                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6829                         x := v_0_0
6830                         if v_0_1.Op != OpPPC64MOVWZreg {
6831                                 continue
6832                         }
6833                         y := v_0_1.Args[0]
6834                         v.reset(OpPPC64MOVBZreg)
6835                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6836                         v0.AddArg2(x, y)
6837                         v.AddArg(v0)
6838                         return true
6839                 }
6840                 break
6841         }
6842         // match: (MOVBZreg (XOR <t> x (MOVWZreg y)))
6843         // result: (MOVBZreg (XOR <t> x y))
6844         for {
6845                 if v_0.Op != OpPPC64XOR {
6846                         break
6847                 }
6848                 t := v_0.Type
6849                 _ = v_0.Args[1]
6850                 v_0_0 := v_0.Args[0]
6851                 v_0_1 := v_0.Args[1]
6852                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6853                         x := v_0_0
6854                         if v_0_1.Op != OpPPC64MOVWZreg {
6855                                 continue
6856                         }
6857                         y := v_0_1.Args[0]
6858                         v.reset(OpPPC64MOVBZreg)
6859                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6860                         v0.AddArg2(x, y)
6861                         v.AddArg(v0)
6862                         return true
6863                 }
6864                 break
6865         }
6866         // match: (MOVBZreg (AND <t> x (MOVWZreg y)))
6867         // result: (MOVBZreg (AND <t> x y))
6868         for {
6869                 if v_0.Op != OpPPC64AND {
6870                         break
6871                 }
6872                 t := v_0.Type
6873                 _ = v_0.Args[1]
6874                 v_0_0 := v_0.Args[0]
6875                 v_0_1 := v_0.Args[1]
6876                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6877                         x := v_0_0
6878                         if v_0_1.Op != OpPPC64MOVWZreg {
6879                                 continue
6880                         }
6881                         y := v_0_1.Args[0]
6882                         v.reset(OpPPC64MOVBZreg)
6883                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6884                         v0.AddArg2(x, y)
6885                         v.AddArg(v0)
6886                         return true
6887                 }
6888                 break
6889         }
6890         // match: (MOVBZreg (OR <t> x (MOVHZreg y)))
6891         // result: (MOVBZreg (OR <t> x y))
6892         for {
6893                 if v_0.Op != OpPPC64OR {
6894                         break
6895                 }
6896                 t := v_0.Type
6897                 _ = v_0.Args[1]
6898                 v_0_0 := v_0.Args[0]
6899                 v_0_1 := v_0.Args[1]
6900                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6901                         x := v_0_0
6902                         if v_0_1.Op != OpPPC64MOVHZreg {
6903                                 continue
6904                         }
6905                         y := v_0_1.Args[0]
6906                         v.reset(OpPPC64MOVBZreg)
6907                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6908                         v0.AddArg2(x, y)
6909                         v.AddArg(v0)
6910                         return true
6911                 }
6912                 break
6913         }
6914         // match: (MOVBZreg (XOR <t> x (MOVHZreg y)))
6915         // result: (MOVBZreg (XOR <t> x y))
6916         for {
6917                 if v_0.Op != OpPPC64XOR {
6918                         break
6919                 }
6920                 t := v_0.Type
6921                 _ = v_0.Args[1]
6922                 v_0_0 := v_0.Args[0]
6923                 v_0_1 := v_0.Args[1]
6924                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6925                         x := v_0_0
6926                         if v_0_1.Op != OpPPC64MOVHZreg {
6927                                 continue
6928                         }
6929                         y := v_0_1.Args[0]
6930                         v.reset(OpPPC64MOVBZreg)
6931                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6932                         v0.AddArg2(x, y)
6933                         v.AddArg(v0)
6934                         return true
6935                 }
6936                 break
6937         }
6938         // match: (MOVBZreg (AND <t> x (MOVHZreg y)))
6939         // result: (MOVBZreg (AND <t> x y))
6940         for {
6941                 if v_0.Op != OpPPC64AND {
6942                         break
6943                 }
6944                 t := v_0.Type
6945                 _ = v_0.Args[1]
6946                 v_0_0 := v_0.Args[0]
6947                 v_0_1 := v_0.Args[1]
6948                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6949                         x := v_0_0
6950                         if v_0_1.Op != OpPPC64MOVHZreg {
6951                                 continue
6952                         }
6953                         y := v_0_1.Args[0]
6954                         v.reset(OpPPC64MOVBZreg)
6955                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6956                         v0.AddArg2(x, y)
6957                         v.AddArg(v0)
6958                         return true
6959                 }
6960                 break
6961         }
6962         // match: (MOVBZreg (OR <t> x (MOVBZreg y)))
6963         // result: (MOVBZreg (OR <t> x y))
6964         for {
6965                 if v_0.Op != OpPPC64OR {
6966                         break
6967                 }
6968                 t := v_0.Type
6969                 _ = v_0.Args[1]
6970                 v_0_0 := v_0.Args[0]
6971                 v_0_1 := v_0.Args[1]
6972                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6973                         x := v_0_0
6974                         if v_0_1.Op != OpPPC64MOVBZreg {
6975                                 continue
6976                         }
6977                         y := v_0_1.Args[0]
6978                         v.reset(OpPPC64MOVBZreg)
6979                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6980                         v0.AddArg2(x, y)
6981                         v.AddArg(v0)
6982                         return true
6983                 }
6984                 break
6985         }
6986         // match: (MOVBZreg (XOR <t> x (MOVBZreg y)))
6987         // result: (MOVBZreg (XOR <t> x y))
6988         for {
6989                 if v_0.Op != OpPPC64XOR {
6990                         break
6991                 }
6992                 t := v_0.Type
6993                 _ = v_0.Args[1]
6994                 v_0_0 := v_0.Args[0]
6995                 v_0_1 := v_0.Args[1]
6996                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6997                         x := v_0_0
6998                         if v_0_1.Op != OpPPC64MOVBZreg {
6999                                 continue
7000                         }
7001                         y := v_0_1.Args[0]
7002                         v.reset(OpPPC64MOVBZreg)
7003                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
7004                         v0.AddArg2(x, y)
7005                         v.AddArg(v0)
7006                         return true
7007                 }
7008                 break
7009         }
7010         // match: (MOVBZreg (AND <t> x (MOVBZreg y)))
7011         // result: (MOVBZreg (AND <t> x y))
7012         for {
7013                 if v_0.Op != OpPPC64AND {
7014                         break
7015                 }
7016                 t := v_0.Type
7017                 _ = v_0.Args[1]
7018                 v_0_0 := v_0.Args[0]
7019                 v_0_1 := v_0.Args[1]
7020                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
7021                         x := v_0_0
7022                         if v_0_1.Op != OpPPC64MOVBZreg {
7023                                 continue
7024                         }
7025                         y := v_0_1.Args[0]
7026                         v.reset(OpPPC64MOVBZreg)
7027                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
7028                         v0.AddArg2(x, y)
7029                         v.AddArg(v0)
7030                         return true
7031                 }
7032                 break
7033         }
7034         // match: (MOVBZreg z:(ANDconst [c] (MOVBZload ptr x)))
7035         // result: z
7036         for {
7037                 z := v_0
7038                 if z.Op != OpPPC64ANDconst {
7039                         break
7040                 }
7041                 z_0 := z.Args[0]
7042                 if z_0.Op != OpPPC64MOVBZload {
7043                         break
7044                 }
7045                 v.copyOf(z)
7046                 return true
7047         }
7048         // match: (MOVBZreg z:(AND y (MOVBZload ptr x)))
7049         // result: z
7050         for {
7051                 z := v_0
7052                 if z.Op != OpPPC64AND {
7053                         break
7054                 }
7055                 _ = z.Args[1]
7056                 z_0 := z.Args[0]
7057                 z_1 := z.Args[1]
7058                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
7059                         if z_1.Op != OpPPC64MOVBZload {
7060                                 continue
7061                         }
7062                         v.copyOf(z)
7063                         return true
7064                 }
7065                 break
7066         }
7067         // match: (MOVBZreg x:(MOVBZload _ _))
7068         // result: x
7069         for {
7070                 x := v_0
7071                 if x.Op != OpPPC64MOVBZload {
7072                         break
7073                 }
7074                 v.copyOf(x)
7075                 return true
7076         }
7077         // match: (MOVBZreg x:(MOVBZloadidx _ _ _))
7078         // result: x
7079         for {
7080                 x := v_0
7081                 if x.Op != OpPPC64MOVBZloadidx {
7082                         break
7083                 }
7084                 v.copyOf(x)
7085                 return true
7086         }
7087         // match: (MOVBZreg x:(Arg <t>))
7088         // cond: is8BitInt(t) && !isSigned(t)
7089         // result: x
7090         for {
7091                 x := v_0
7092                 if x.Op != OpArg {
7093                         break
7094                 }
7095                 t := x.Type
7096                 if !(is8BitInt(t) && !isSigned(t)) {
7097                         break
7098                 }
7099                 v.copyOf(x)
7100                 return true
7101         }
7102         // match: (MOVBZreg (MOVDconst [c]))
7103         // result: (MOVDconst [int64(uint8(c))])
7104         for {
7105                 if v_0.Op != OpPPC64MOVDconst {
7106                         break
7107                 }
7108                 c := auxIntToInt64(v_0.AuxInt)
7109                 v.reset(OpPPC64MOVDconst)
7110                 v.AuxInt = int64ToAuxInt(int64(uint8(c)))
7111                 return true
7112         }
7113         return false
7114 }
7115 func rewriteValuePPC64_OpPPC64MOVBreg(v *Value) bool {
7116         v_0 := v.Args[0]
7117         b := v.Block
7118         typ := &b.Func.Config.Types
7119         // match: (MOVBreg y:(ANDconst [c] _))
7120         // cond: uint64(c) <= 0x7F
7121         // result: y
7122         for {
7123                 y := v_0
7124                 if y.Op != OpPPC64ANDconst {
7125                         break
7126                 }
7127                 c := auxIntToInt64(y.AuxInt)
7128                 if !(uint64(c) <= 0x7F) {
7129                         break
7130                 }
7131                 v.copyOf(y)
7132                 return true
7133         }
7134         // match: (MOVBreg (SRAWconst [c] (MOVBreg x)))
7135         // result: (SRAWconst [c] (MOVBreg x))
7136         for {
7137                 if v_0.Op != OpPPC64SRAWconst {
7138                         break
7139                 }
7140                 c := auxIntToInt64(v_0.AuxInt)
7141                 v_0_0 := v_0.Args[0]
7142                 if v_0_0.Op != OpPPC64MOVBreg {
7143                         break
7144                 }
7145                 x := v_0_0.Args[0]
7146                 v.reset(OpPPC64SRAWconst)
7147                 v.AuxInt = int64ToAuxInt(c)
7148                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
7149                 v0.AddArg(x)
7150                 v.AddArg(v0)
7151                 return true
7152         }
7153         // match: (MOVBreg (SRAWconst [c] x))
7154         // cond: sizeof(x.Type) == 8
7155         // result: (SRAWconst [c] x)
7156         for {
7157                 if v_0.Op != OpPPC64SRAWconst {
7158                         break
7159                 }
7160                 c := auxIntToInt64(v_0.AuxInt)
7161                 x := v_0.Args[0]
7162                 if !(sizeof(x.Type) == 8) {
7163                         break
7164                 }
7165                 v.reset(OpPPC64SRAWconst)
7166                 v.AuxInt = int64ToAuxInt(c)
7167                 v.AddArg(x)
7168                 return true
7169         }
7170         // match: (MOVBreg (SRDconst [c] x))
7171         // cond: c>56
7172         // result: (SRDconst [c] x)
7173         for {
7174                 if v_0.Op != OpPPC64SRDconst {
7175                         break
7176                 }
7177                 c := auxIntToInt64(v_0.AuxInt)
7178                 x := v_0.Args[0]
7179                 if !(c > 56) {
7180                         break
7181                 }
7182                 v.reset(OpPPC64SRDconst)
7183                 v.AuxInt = int64ToAuxInt(c)
7184                 v.AddArg(x)
7185                 return true
7186         }
7187         // match: (MOVBreg (SRDconst [c] x))
7188         // cond: c==56
7189         // result: (SRADconst [c] x)
7190         for {
7191                 if v_0.Op != OpPPC64SRDconst {
7192                         break
7193                 }
7194                 c := auxIntToInt64(v_0.AuxInt)
7195                 x := v_0.Args[0]
7196                 if !(c == 56) {
7197                         break
7198                 }
7199                 v.reset(OpPPC64SRADconst)
7200                 v.AuxInt = int64ToAuxInt(c)
7201                 v.AddArg(x)
7202                 return true
7203         }
7204         // match: (MOVBreg (SRADconst [c] x))
7205         // cond: c>=56
7206         // result: (SRADconst [c] x)
7207         for {
7208                 if v_0.Op != OpPPC64SRADconst {
7209                         break
7210                 }
7211                 c := auxIntToInt64(v_0.AuxInt)
7212                 x := v_0.Args[0]
7213                 if !(c >= 56) {
7214                         break
7215                 }
7216                 v.reset(OpPPC64SRADconst)
7217                 v.AuxInt = int64ToAuxInt(c)
7218                 v.AddArg(x)
7219                 return true
7220         }
7221         // match: (MOVBreg (SRWconst [c] x))
7222         // cond: c>24
7223         // result: (SRWconst [c] x)
7224         for {
7225                 if v_0.Op != OpPPC64SRWconst {
7226                         break
7227                 }
7228                 c := auxIntToInt64(v_0.AuxInt)
7229                 x := v_0.Args[0]
7230                 if !(c > 24) {
7231                         break
7232                 }
7233                 v.reset(OpPPC64SRWconst)
7234                 v.AuxInt = int64ToAuxInt(c)
7235                 v.AddArg(x)
7236                 return true
7237         }
7238         // match: (MOVBreg (SRWconst [c] x))
7239         // cond: c==24
7240         // result: (SRAWconst [c] x)
7241         for {
7242                 if v_0.Op != OpPPC64SRWconst {
7243                         break
7244                 }
7245                 c := auxIntToInt64(v_0.AuxInt)
7246                 x := v_0.Args[0]
7247                 if !(c == 24) {
7248                         break
7249                 }
7250                 v.reset(OpPPC64SRAWconst)
7251                 v.AuxInt = int64ToAuxInt(c)
7252                 v.AddArg(x)
7253                 return true
7254         }
7255         // match: (MOVBreg (SRAWconst [c] x))
7256         // cond: c>=24
7257         // result: (SRAWconst [c] x)
7258         for {
7259                 if v_0.Op != OpPPC64SRAWconst {
7260                         break
7261                 }
7262                 c := auxIntToInt64(v_0.AuxInt)
7263                 x := v_0.Args[0]
7264                 if !(c >= 24) {
7265                         break
7266                 }
7267                 v.reset(OpPPC64SRAWconst)
7268                 v.AuxInt = int64ToAuxInt(c)
7269                 v.AddArg(x)
7270                 return true
7271         }
7272         // match: (MOVBreg y:(MOVBreg _))
7273         // result: y
7274         for {
7275                 y := v_0
7276                 if y.Op != OpPPC64MOVBreg {
7277                         break
7278                 }
7279                 v.copyOf(y)
7280                 return true
7281         }
7282         // match: (MOVBreg (MOVBZreg x))
7283         // result: (MOVBreg x)
7284         for {
7285                 if v_0.Op != OpPPC64MOVBZreg {
7286                         break
7287                 }
7288                 x := v_0.Args[0]
7289                 v.reset(OpPPC64MOVBreg)
7290                 v.AddArg(x)
7291                 return true
7292         }
7293         // match: (MOVBreg x:(Arg <t>))
7294         // cond: is8BitInt(t) && isSigned(t)
7295         // result: x
7296         for {
7297                 x := v_0
7298                 if x.Op != OpArg {
7299                         break
7300                 }
7301                 t := x.Type
7302                 if !(is8BitInt(t) && isSigned(t)) {
7303                         break
7304                 }
7305                 v.copyOf(x)
7306                 return true
7307         }
7308         // match: (MOVBreg (MOVDconst [c]))
7309         // result: (MOVDconst [int64(int8(c))])
7310         for {
7311                 if v_0.Op != OpPPC64MOVDconst {
7312                         break
7313                 }
7314                 c := auxIntToInt64(v_0.AuxInt)
7315                 v.reset(OpPPC64MOVDconst)
7316                 v.AuxInt = int64ToAuxInt(int64(int8(c)))
7317                 return true
7318         }
7319         return false
7320 }
7321 func rewriteValuePPC64_OpPPC64MOVBstore(v *Value) bool {
7322         v_2 := v.Args[2]
7323         v_1 := v.Args[1]
7324         v_0 := v.Args[0]
7325         b := v.Block
7326         config := b.Func.Config
7327         typ := &b.Func.Config.Types
7328         // match: (MOVBstore [off1] {sym} (ADDconst [off2] x) val mem)
7329         // cond: is16Bit(int64(off1)+off2)
7330         // result: (MOVBstore [off1+int32(off2)] {sym} x val mem)
7331         for {
7332                 off1 := auxIntToInt32(v.AuxInt)
7333                 sym := auxToSym(v.Aux)
7334                 if v_0.Op != OpPPC64ADDconst {
7335                         break
7336                 }
7337                 off2 := auxIntToInt64(v_0.AuxInt)
7338                 x := v_0.Args[0]
7339                 val := v_1
7340                 mem := v_2
7341                 if !(is16Bit(int64(off1) + off2)) {
7342                         break
7343                 }
7344                 v.reset(OpPPC64MOVBstore)
7345                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7346                 v.Aux = symToAux(sym)
7347                 v.AddArg3(x, val, mem)
7348                 return true
7349         }
7350         // match: (MOVBstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
7351         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
7352         // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
7353         for {
7354                 off1 := auxIntToInt32(v.AuxInt)
7355                 sym1 := auxToSym(v.Aux)
7356                 p := v_0
7357                 if p.Op != OpPPC64MOVDaddr {
7358                         break
7359                 }
7360                 off2 := auxIntToInt32(p.AuxInt)
7361                 sym2 := auxToSym(p.Aux)
7362                 ptr := p.Args[0]
7363                 val := v_1
7364                 mem := v_2
7365                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
7366                         break
7367                 }
7368                 v.reset(OpPPC64MOVBstore)
7369                 v.AuxInt = int32ToAuxInt(off1 + off2)
7370                 v.Aux = symToAux(mergeSym(sym1, sym2))
7371                 v.AddArg3(ptr, val, mem)
7372                 return true
7373         }
7374         // match: (MOVBstore [off] {sym} ptr (MOVDconst [0]) mem)
7375         // result: (MOVBstorezero [off] {sym} ptr mem)
7376         for {
7377                 off := auxIntToInt32(v.AuxInt)
7378                 sym := auxToSym(v.Aux)
7379                 ptr := v_0
7380                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
7381                         break
7382                 }
7383                 mem := v_2
7384                 v.reset(OpPPC64MOVBstorezero)
7385                 v.AuxInt = int32ToAuxInt(off)
7386                 v.Aux = symToAux(sym)
7387                 v.AddArg2(ptr, mem)
7388                 return true
7389         }
7390         // match: (MOVBstore [0] {sym} p:(ADD ptr idx) val mem)
7391         // cond: sym == nil && p.Uses == 1
7392         // result: (MOVBstoreidx ptr idx val mem)
7393         for {
7394                 if auxIntToInt32(v.AuxInt) != 0 {
7395                         break
7396                 }
7397                 sym := auxToSym(v.Aux)
7398                 p := v_0
7399                 if p.Op != OpPPC64ADD {
7400                         break
7401                 }
7402                 idx := p.Args[1]
7403                 ptr := p.Args[0]
7404                 val := v_1
7405                 mem := v_2
7406                 if !(sym == nil && p.Uses == 1) {
7407                         break
7408                 }
7409                 v.reset(OpPPC64MOVBstoreidx)
7410                 v.AddArg4(ptr, idx, val, mem)
7411                 return true
7412         }
7413         // match: (MOVBstore [off] {sym} ptr (MOVBreg x) mem)
7414         // result: (MOVBstore [off] {sym} ptr x mem)
7415         for {
7416                 off := auxIntToInt32(v.AuxInt)
7417                 sym := auxToSym(v.Aux)
7418                 ptr := v_0
7419                 if v_1.Op != OpPPC64MOVBreg {
7420                         break
7421                 }
7422                 x := v_1.Args[0]
7423                 mem := v_2
7424                 v.reset(OpPPC64MOVBstore)
7425                 v.AuxInt = int32ToAuxInt(off)
7426                 v.Aux = symToAux(sym)
7427                 v.AddArg3(ptr, x, mem)
7428                 return true
7429         }
7430         // match: (MOVBstore [off] {sym} ptr (MOVBZreg x) mem)
7431         // result: (MOVBstore [off] {sym} ptr x mem)
7432         for {
7433                 off := auxIntToInt32(v.AuxInt)
7434                 sym := auxToSym(v.Aux)
7435                 ptr := v_0
7436                 if v_1.Op != OpPPC64MOVBZreg {
7437                         break
7438                 }
7439                 x := v_1.Args[0]
7440                 mem := v_2
7441                 v.reset(OpPPC64MOVBstore)
7442                 v.AuxInt = int32ToAuxInt(off)
7443                 v.Aux = symToAux(sym)
7444                 v.AddArg3(ptr, x, mem)
7445                 return true
7446         }
7447         // match: (MOVBstore [off] {sym} ptr (MOVHreg x) mem)
7448         // result: (MOVBstore [off] {sym} ptr x mem)
7449         for {
7450                 off := auxIntToInt32(v.AuxInt)
7451                 sym := auxToSym(v.Aux)
7452                 ptr := v_0
7453                 if v_1.Op != OpPPC64MOVHreg {
7454                         break
7455                 }
7456                 x := v_1.Args[0]
7457                 mem := v_2
7458                 v.reset(OpPPC64MOVBstore)
7459                 v.AuxInt = int32ToAuxInt(off)
7460                 v.Aux = symToAux(sym)
7461                 v.AddArg3(ptr, x, mem)
7462                 return true
7463         }
7464         // match: (MOVBstore [off] {sym} ptr (MOVHZreg x) mem)
7465         // result: (MOVBstore [off] {sym} ptr x mem)
7466         for {
7467                 off := auxIntToInt32(v.AuxInt)
7468                 sym := auxToSym(v.Aux)
7469                 ptr := v_0
7470                 if v_1.Op != OpPPC64MOVHZreg {
7471                         break
7472                 }
7473                 x := v_1.Args[0]
7474                 mem := v_2
7475                 v.reset(OpPPC64MOVBstore)
7476                 v.AuxInt = int32ToAuxInt(off)
7477                 v.Aux = symToAux(sym)
7478                 v.AddArg3(ptr, x, mem)
7479                 return true
7480         }
7481         // match: (MOVBstore [off] {sym} ptr (MOVWreg x) mem)
7482         // result: (MOVBstore [off] {sym} ptr x mem)
7483         for {
7484                 off := auxIntToInt32(v.AuxInt)
7485                 sym := auxToSym(v.Aux)
7486                 ptr := v_0
7487                 if v_1.Op != OpPPC64MOVWreg {
7488                         break
7489                 }
7490                 x := v_1.Args[0]
7491                 mem := v_2
7492                 v.reset(OpPPC64MOVBstore)
7493                 v.AuxInt = int32ToAuxInt(off)
7494                 v.Aux = symToAux(sym)
7495                 v.AddArg3(ptr, x, mem)
7496                 return true
7497         }
7498         // match: (MOVBstore [off] {sym} ptr (MOVWZreg x) mem)
7499         // result: (MOVBstore [off] {sym} ptr x mem)
7500         for {
7501                 off := auxIntToInt32(v.AuxInt)
7502                 sym := auxToSym(v.Aux)
7503                 ptr := v_0
7504                 if v_1.Op != OpPPC64MOVWZreg {
7505                         break
7506                 }
7507                 x := v_1.Args[0]
7508                 mem := v_2
7509                 v.reset(OpPPC64MOVBstore)
7510                 v.AuxInt = int32ToAuxInt(off)
7511                 v.Aux = symToAux(sym)
7512                 v.AddArg3(ptr, x, mem)
7513                 return true
7514         }
7515         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVHreg x) [c]) mem)
7516         // cond: c <= 8
7517         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7518         for {
7519                 off := auxIntToInt32(v.AuxInt)
7520                 sym := auxToSym(v.Aux)
7521                 ptr := v_0
7522                 if v_1.Op != OpPPC64SRWconst {
7523                         break
7524                 }
7525                 c := auxIntToInt64(v_1.AuxInt)
7526                 v_1_0 := v_1.Args[0]
7527                 if v_1_0.Op != OpPPC64MOVHreg {
7528                         break
7529                 }
7530                 x := v_1_0.Args[0]
7531                 mem := v_2
7532                 if !(c <= 8) {
7533                         break
7534                 }
7535                 v.reset(OpPPC64MOVBstore)
7536                 v.AuxInt = int32ToAuxInt(off)
7537                 v.Aux = symToAux(sym)
7538                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7539                 v0.AuxInt = int64ToAuxInt(c)
7540                 v0.AddArg(x)
7541                 v.AddArg3(ptr, v0, mem)
7542                 return true
7543         }
7544         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVHZreg x) [c]) mem)
7545         // cond: c <= 8
7546         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7547         for {
7548                 off := auxIntToInt32(v.AuxInt)
7549                 sym := auxToSym(v.Aux)
7550                 ptr := v_0
7551                 if v_1.Op != OpPPC64SRWconst {
7552                         break
7553                 }
7554                 c := auxIntToInt64(v_1.AuxInt)
7555                 v_1_0 := v_1.Args[0]
7556                 if v_1_0.Op != OpPPC64MOVHZreg {
7557                         break
7558                 }
7559                 x := v_1_0.Args[0]
7560                 mem := v_2
7561                 if !(c <= 8) {
7562                         break
7563                 }
7564                 v.reset(OpPPC64MOVBstore)
7565                 v.AuxInt = int32ToAuxInt(off)
7566                 v.Aux = symToAux(sym)
7567                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7568                 v0.AuxInt = int64ToAuxInt(c)
7569                 v0.AddArg(x)
7570                 v.AddArg3(ptr, v0, mem)
7571                 return true
7572         }
7573         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVWreg x) [c]) mem)
7574         // cond: c <= 24
7575         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7576         for {
7577                 off := auxIntToInt32(v.AuxInt)
7578                 sym := auxToSym(v.Aux)
7579                 ptr := v_0
7580                 if v_1.Op != OpPPC64SRWconst {
7581                         break
7582                 }
7583                 c := auxIntToInt64(v_1.AuxInt)
7584                 v_1_0 := v_1.Args[0]
7585                 if v_1_0.Op != OpPPC64MOVWreg {
7586                         break
7587                 }
7588                 x := v_1_0.Args[0]
7589                 mem := v_2
7590                 if !(c <= 24) {
7591                         break
7592                 }
7593                 v.reset(OpPPC64MOVBstore)
7594                 v.AuxInt = int32ToAuxInt(off)
7595                 v.Aux = symToAux(sym)
7596                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7597                 v0.AuxInt = int64ToAuxInt(c)
7598                 v0.AddArg(x)
7599                 v.AddArg3(ptr, v0, mem)
7600                 return true
7601         }
7602         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVWZreg x) [c]) mem)
7603         // cond: c <= 24
7604         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7605         for {
7606                 off := auxIntToInt32(v.AuxInt)
7607                 sym := auxToSym(v.Aux)
7608                 ptr := v_0
7609                 if v_1.Op != OpPPC64SRWconst {
7610                         break
7611                 }
7612                 c := auxIntToInt64(v_1.AuxInt)
7613                 v_1_0 := v_1.Args[0]
7614                 if v_1_0.Op != OpPPC64MOVWZreg {
7615                         break
7616                 }
7617                 x := v_1_0.Args[0]
7618                 mem := v_2
7619                 if !(c <= 24) {
7620                         break
7621                 }
7622                 v.reset(OpPPC64MOVBstore)
7623                 v.AuxInt = int32ToAuxInt(off)
7624                 v.Aux = symToAux(sym)
7625                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7626                 v0.AuxInt = int64ToAuxInt(c)
7627                 v0.AddArg(x)
7628                 v.AddArg3(ptr, v0, mem)
7629                 return true
7630         }
7631         // match: (MOVBstore [i1] {s} p (SRWconst w [24]) x0:(MOVBstore [i0] {s} p (SRWconst w [16]) mem))
7632         // cond: !config.BigEndian && x0.Uses == 1 && i1 == i0+1 && clobber(x0)
7633         // result: (MOVHstore [i0] {s} p (SRWconst <typ.UInt16> w [16]) mem)
7634         for {
7635                 i1 := auxIntToInt32(v.AuxInt)
7636                 s := auxToSym(v.Aux)
7637                 p := v_0
7638                 if v_1.Op != OpPPC64SRWconst || auxIntToInt64(v_1.AuxInt) != 24 {
7639                         break
7640                 }
7641                 w := v_1.Args[0]
7642                 x0 := v_2
7643                 if x0.Op != OpPPC64MOVBstore {
7644                         break
7645                 }
7646                 i0 := auxIntToInt32(x0.AuxInt)
7647                 if auxToSym(x0.Aux) != s {
7648                         break
7649                 }
7650                 mem := x0.Args[2]
7651                 if p != x0.Args[0] {
7652                         break
7653                 }
7654                 x0_1 := x0.Args[1]
7655                 if x0_1.Op != OpPPC64SRWconst || auxIntToInt64(x0_1.AuxInt) != 16 || w != x0_1.Args[0] || !(!config.BigEndian && x0.Uses == 1 && i1 == i0+1 && clobber(x0)) {
7656                         break
7657                 }
7658                 v.reset(OpPPC64MOVHstore)
7659                 v.AuxInt = int32ToAuxInt(i0)
7660                 v.Aux = symToAux(s)
7661                 v0 := b.NewValue0(x0.Pos, OpPPC64SRWconst, typ.UInt16)
7662                 v0.AuxInt = int64ToAuxInt(16)
7663                 v0.AddArg(w)
7664                 v.AddArg3(p, v0, mem)
7665                 return true
7666         }
7667         // match: (MOVBstore [i1] {s} p (SRDconst w [24]) x0:(MOVBstore [i0] {s} p (SRDconst w [16]) mem))
7668         // cond: !config.BigEndian && x0.Uses == 1 && i1 == i0+1 && clobber(x0)
7669         // result: (MOVHstore [i0] {s} p (SRWconst <typ.UInt16> w [16]) mem)
7670         for {
7671                 i1 := auxIntToInt32(v.AuxInt)
7672                 s := auxToSym(v.Aux)
7673                 p := v_0
7674                 if v_1.Op != OpPPC64SRDconst || auxIntToInt64(v_1.AuxInt) != 24 {
7675                         break
7676                 }
7677                 w := v_1.Args[0]
7678                 x0 := v_2
7679                 if x0.Op != OpPPC64MOVBstore {
7680                         break
7681                 }
7682                 i0 := auxIntToInt32(x0.AuxInt)
7683                 if auxToSym(x0.Aux) != s {
7684                         break
7685                 }
7686                 mem := x0.Args[2]
7687                 if p != x0.Args[0] {
7688                         break
7689                 }
7690                 x0_1 := x0.Args[1]
7691                 if x0_1.Op != OpPPC64SRDconst || auxIntToInt64(x0_1.AuxInt) != 16 || w != x0_1.Args[0] || !(!config.BigEndian && x0.Uses == 1 && i1 == i0+1 && clobber(x0)) {
7692                         break
7693                 }
7694                 v.reset(OpPPC64MOVHstore)
7695                 v.AuxInt = int32ToAuxInt(i0)
7696                 v.Aux = symToAux(s)
7697                 v0 := b.NewValue0(x0.Pos, OpPPC64SRWconst, typ.UInt16)
7698                 v0.AuxInt = int64ToAuxInt(16)
7699                 v0.AddArg(w)
7700                 v.AddArg3(p, v0, mem)
7701                 return true
7702         }
7703         // match: (MOVBstore [i1] {s} p (SRWconst w [8]) x0:(MOVBstore [i0] {s} p w mem))
7704         // cond: !config.BigEndian && x0.Uses == 1 && i1 == i0+1 && clobber(x0)
7705         // result: (MOVHstore [i0] {s} p w mem)
7706         for {
7707                 i1 := auxIntToInt32(v.AuxInt)
7708                 s := auxToSym(v.Aux)
7709                 p := v_0
7710                 if v_1.Op != OpPPC64SRWconst || auxIntToInt64(v_1.AuxInt) != 8 {
7711                         break
7712                 }
7713                 w := v_1.Args[0]
7714                 x0 := v_2
7715                 if x0.Op != OpPPC64MOVBstore {
7716                         break
7717                 }
7718                 i0 := auxIntToInt32(x0.AuxInt)
7719                 if auxToSym(x0.Aux) != s {
7720                         break
7721                 }
7722                 mem := x0.Args[2]
7723                 if p != x0.Args[0] || w != x0.Args[1] || !(!config.BigEndian && x0.Uses == 1 && i1 == i0+1 && clobber(x0)) {
7724                         break
7725                 }
7726                 v.reset(OpPPC64MOVHstore)
7727                 v.AuxInt = int32ToAuxInt(i0)
7728                 v.Aux = symToAux(s)
7729                 v.AddArg3(p, w, mem)
7730                 return true
7731         }
7732         // match: (MOVBstore [i1] {s} p (SRDconst w [8]) x0:(MOVBstore [i0] {s} p w mem))
7733         // cond: !config.BigEndian && x0.Uses == 1 && i1 == i0+1 && clobber(x0)
7734         // result: (MOVHstore [i0] {s} p w mem)
7735         for {
7736                 i1 := auxIntToInt32(v.AuxInt)
7737                 s := auxToSym(v.Aux)
7738                 p := v_0
7739                 if v_1.Op != OpPPC64SRDconst || auxIntToInt64(v_1.AuxInt) != 8 {
7740                         break
7741                 }
7742                 w := v_1.Args[0]
7743                 x0 := v_2
7744                 if x0.Op != OpPPC64MOVBstore {
7745                         break
7746                 }
7747                 i0 := auxIntToInt32(x0.AuxInt)
7748                 if auxToSym(x0.Aux) != s {
7749                         break
7750                 }
7751                 mem := x0.Args[2]
7752                 if p != x0.Args[0] || w != x0.Args[1] || !(!config.BigEndian && x0.Uses == 1 && i1 == i0+1 && clobber(x0)) {
7753                         break
7754                 }
7755                 v.reset(OpPPC64MOVHstore)
7756                 v.AuxInt = int32ToAuxInt(i0)
7757                 v.Aux = symToAux(s)
7758                 v.AddArg3(p, w, mem)
7759                 return true
7760         }
7761         // match: (MOVBstore [i3] {s} p w x0:(MOVBstore [i2] {s} p (SRWconst w [8]) x1:(MOVBstore [i1] {s} p (SRWconst w [16]) x2:(MOVBstore [i0] {s} p (SRWconst w [24]) mem))))
7762         // cond: !config.BigEndian && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && i1 == i0+1 && i2 == i0+2 && i3 == i0+3 && clobber(x0, x1, x2)
7763         // result: (MOVWBRstore (MOVDaddr <typ.Uintptr> [i0] {s} p) w mem)
7764         for {
7765                 i3 := auxIntToInt32(v.AuxInt)
7766                 s := auxToSym(v.Aux)
7767                 p := v_0
7768                 w := v_1
7769                 x0 := v_2
7770                 if x0.Op != OpPPC64MOVBstore {
7771                         break
7772                 }
7773                 i2 := auxIntToInt32(x0.AuxInt)
7774                 if auxToSym(x0.Aux) != s {
7775                         break
7776                 }
7777                 _ = x0.Args[2]
7778                 if p != x0.Args[0] {
7779                         break
7780                 }
7781                 x0_1 := x0.Args[1]
7782                 if x0_1.Op != OpPPC64SRWconst || auxIntToInt64(x0_1.AuxInt) != 8 || w != x0_1.Args[0] {
7783                         break
7784                 }
7785                 x1 := x0.Args[2]
7786                 if x1.Op != OpPPC64MOVBstore {
7787                         break
7788                 }
7789                 i1 := auxIntToInt32(x1.AuxInt)
7790                 if auxToSym(x1.Aux) != s {
7791                         break
7792                 }
7793                 _ = x1.Args[2]
7794                 if p != x1.Args[0] {
7795                         break
7796                 }
7797                 x1_1 := x1.Args[1]
7798                 if x1_1.Op != OpPPC64SRWconst || auxIntToInt64(x1_1.AuxInt) != 16 || w != x1_1.Args[0] {
7799                         break
7800                 }
7801                 x2 := x1.Args[2]
7802                 if x2.Op != OpPPC64MOVBstore {
7803                         break
7804                 }
7805                 i0 := auxIntToInt32(x2.AuxInt)
7806                 if auxToSym(x2.Aux) != s {
7807                         break
7808                 }
7809                 mem := x2.Args[2]
7810                 if p != x2.Args[0] {
7811                         break
7812                 }
7813                 x2_1 := x2.Args[1]
7814                 if x2_1.Op != OpPPC64SRWconst || auxIntToInt64(x2_1.AuxInt) != 24 || w != x2_1.Args[0] || !(!config.BigEndian && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && i1 == i0+1 && i2 == i0+2 && i3 == i0+3 && clobber(x0, x1, x2)) {
7815                         break
7816                 }
7817                 v.reset(OpPPC64MOVWBRstore)
7818                 v0 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
7819                 v0.AuxInt = int32ToAuxInt(i0)
7820                 v0.Aux = symToAux(s)
7821                 v0.AddArg(p)
7822                 v.AddArg3(v0, w, mem)
7823                 return true
7824         }
7825         // match: (MOVBstore [i1] {s} p w x0:(MOVBstore [i0] {s} p (SRWconst w [8]) mem))
7826         // cond: !config.BigEndian && x0.Uses == 1 && i1 == i0+1 && clobber(x0)
7827         // result: (MOVHBRstore (MOVDaddr <typ.Uintptr> [i0] {s} p) w mem)
7828         for {
7829                 i1 := auxIntToInt32(v.AuxInt)
7830                 s := auxToSym(v.Aux)
7831                 p := v_0
7832                 w := v_1
7833                 x0 := v_2
7834                 if x0.Op != OpPPC64MOVBstore {
7835                         break
7836                 }
7837                 i0 := auxIntToInt32(x0.AuxInt)
7838                 if auxToSym(x0.Aux) != s {
7839                         break
7840                 }
7841                 mem := x0.Args[2]
7842                 if p != x0.Args[0] {
7843                         break
7844                 }
7845                 x0_1 := x0.Args[1]
7846                 if x0_1.Op != OpPPC64SRWconst || auxIntToInt64(x0_1.AuxInt) != 8 || w != x0_1.Args[0] || !(!config.BigEndian && x0.Uses == 1 && i1 == i0+1 && clobber(x0)) {
7847                         break
7848                 }
7849                 v.reset(OpPPC64MOVHBRstore)
7850                 v0 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
7851                 v0.AuxInt = int32ToAuxInt(i0)
7852                 v0.Aux = symToAux(s)
7853                 v0.AddArg(p)
7854                 v.AddArg3(v0, w, mem)
7855                 return true
7856         }
7857         // match: (MOVBstore [i7] {s} p (SRDconst w [56]) x0:(MOVBstore [i6] {s} p (SRDconst w [48]) x1:(MOVBstore [i5] {s} p (SRDconst w [40]) x2:(MOVBstore [i4] {s} p (SRDconst w [32]) x3:(MOVWstore [i0] {s} p w mem)))))
7858         // cond: !config.BigEndian && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && i4 == i0+4 && i5 == i0+5 && i6 == i0+6 && i7 == i0+7 && clobber(x0, x1, x2, x3)
7859         // result: (MOVDstore [i0] {s} p w mem)
7860         for {
7861                 i7 := auxIntToInt32(v.AuxInt)
7862                 s := auxToSym(v.Aux)
7863                 p := v_0
7864                 if v_1.Op != OpPPC64SRDconst || auxIntToInt64(v_1.AuxInt) != 56 {
7865                         break
7866                 }
7867                 w := v_1.Args[0]
7868                 x0 := v_2
7869                 if x0.Op != OpPPC64MOVBstore {
7870                         break
7871                 }
7872                 i6 := auxIntToInt32(x0.AuxInt)
7873                 if auxToSym(x0.Aux) != s {
7874                         break
7875                 }
7876                 _ = x0.Args[2]
7877                 if p != x0.Args[0] {
7878                         break
7879                 }
7880                 x0_1 := x0.Args[1]
7881                 if x0_1.Op != OpPPC64SRDconst || auxIntToInt64(x0_1.AuxInt) != 48 || w != x0_1.Args[0] {
7882                         break
7883                 }
7884                 x1 := x0.Args[2]
7885                 if x1.Op != OpPPC64MOVBstore {
7886                         break
7887                 }
7888                 i5 := auxIntToInt32(x1.AuxInt)
7889                 if auxToSym(x1.Aux) != s {
7890                         break
7891                 }
7892                 _ = x1.Args[2]
7893                 if p != x1.Args[0] {
7894                         break
7895                 }
7896                 x1_1 := x1.Args[1]
7897                 if x1_1.Op != OpPPC64SRDconst || auxIntToInt64(x1_1.AuxInt) != 40 || w != x1_1.Args[0] {
7898                         break
7899                 }
7900                 x2 := x1.Args[2]
7901                 if x2.Op != OpPPC64MOVBstore {
7902                         break
7903                 }
7904                 i4 := auxIntToInt32(x2.AuxInt)
7905                 if auxToSym(x2.Aux) != s {
7906                         break
7907                 }
7908                 _ = x2.Args[2]
7909                 if p != x2.Args[0] {
7910                         break
7911                 }
7912                 x2_1 := x2.Args[1]
7913                 if x2_1.Op != OpPPC64SRDconst || auxIntToInt64(x2_1.AuxInt) != 32 || w != x2_1.Args[0] {
7914                         break
7915                 }
7916                 x3 := x2.Args[2]
7917                 if x3.Op != OpPPC64MOVWstore {
7918                         break
7919                 }
7920                 i0 := auxIntToInt32(x3.AuxInt)
7921                 if auxToSym(x3.Aux) != s {
7922                         break
7923                 }
7924                 mem := x3.Args[2]
7925                 if p != x3.Args[0] || w != x3.Args[1] || !(!config.BigEndian && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && i4 == i0+4 && i5 == i0+5 && i6 == i0+6 && i7 == i0+7 && clobber(x0, x1, x2, x3)) {
7926                         break
7927                 }
7928                 v.reset(OpPPC64MOVDstore)
7929                 v.AuxInt = int32ToAuxInt(i0)
7930                 v.Aux = symToAux(s)
7931                 v.AddArg3(p, w, mem)
7932                 return true
7933         }
7934         // match: (MOVBstore [i7] {s} p w x0:(MOVBstore [i6] {s} p (SRDconst w [8]) x1:(MOVBstore [i5] {s} p (SRDconst w [16]) x2:(MOVBstore [i4] {s} p (SRDconst w [24]) x3:(MOVBstore [i3] {s} p (SRDconst w [32]) x4:(MOVBstore [i2] {s} p (SRDconst w [40]) x5:(MOVBstore [i1] {s} p (SRDconst w [48]) x6:(MOVBstore [i0] {s} p (SRDconst w [56]) mem))))))))
7935         // cond: !config.BigEndian && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && x4.Uses == 1 && x5.Uses == 1 && x6.Uses == 1 && i1 == i0+1 && i2 == i0+2 && i3 == i0+3 && i4 == i0+4 && i5 == i0+5 && i6 == i0+6 && i7 == i0+7 && clobber(x0, x1, x2, x3, x4, x5, x6)
7936         // result: (MOVDBRstore (MOVDaddr <typ.Uintptr> [i0] {s} p) w mem)
7937         for {
7938                 i7 := auxIntToInt32(v.AuxInt)
7939                 s := auxToSym(v.Aux)
7940                 p := v_0
7941                 w := v_1
7942                 x0 := v_2
7943                 if x0.Op != OpPPC64MOVBstore {
7944                         break
7945                 }
7946                 i6 := auxIntToInt32(x0.AuxInt)
7947                 if auxToSym(x0.Aux) != s {
7948                         break
7949                 }
7950                 _ = x0.Args[2]
7951                 if p != x0.Args[0] {
7952                         break
7953                 }
7954                 x0_1 := x0.Args[1]
7955                 if x0_1.Op != OpPPC64SRDconst || auxIntToInt64(x0_1.AuxInt) != 8 || w != x0_1.Args[0] {
7956                         break
7957                 }
7958                 x1 := x0.Args[2]
7959                 if x1.Op != OpPPC64MOVBstore {
7960                         break
7961                 }
7962                 i5 := auxIntToInt32(x1.AuxInt)
7963                 if auxToSym(x1.Aux) != s {
7964                         break
7965                 }
7966                 _ = x1.Args[2]
7967                 if p != x1.Args[0] {
7968                         break
7969                 }
7970                 x1_1 := x1.Args[1]
7971                 if x1_1.Op != OpPPC64SRDconst || auxIntToInt64(x1_1.AuxInt) != 16 || w != x1_1.Args[0] {
7972                         break
7973                 }
7974                 x2 := x1.Args[2]
7975                 if x2.Op != OpPPC64MOVBstore {
7976                         break
7977                 }
7978                 i4 := auxIntToInt32(x2.AuxInt)
7979                 if auxToSym(x2.Aux) != s {
7980                         break
7981                 }
7982                 _ = x2.Args[2]
7983                 if p != x2.Args[0] {
7984                         break
7985                 }
7986                 x2_1 := x2.Args[1]
7987                 if x2_1.Op != OpPPC64SRDconst || auxIntToInt64(x2_1.AuxInt) != 24 || w != x2_1.Args[0] {
7988                         break
7989                 }
7990                 x3 := x2.Args[2]
7991                 if x3.Op != OpPPC64MOVBstore {
7992                         break
7993                 }
7994                 i3 := auxIntToInt32(x3.AuxInt)
7995                 if auxToSym(x3.Aux) != s {
7996                         break
7997                 }
7998                 _ = x3.Args[2]
7999                 if p != x3.Args[0] {
8000                         break
8001                 }
8002                 x3_1 := x3.Args[1]
8003                 if x3_1.Op != OpPPC64SRDconst || auxIntToInt64(x3_1.AuxInt) != 32 || w != x3_1.Args[0] {
8004                         break
8005                 }
8006                 x4 := x3.Args[2]
8007                 if x4.Op != OpPPC64MOVBstore {
8008                         break
8009                 }
8010                 i2 := auxIntToInt32(x4.AuxInt)
8011                 if auxToSym(x4.Aux) != s {
8012                         break
8013                 }
8014                 _ = x4.Args[2]
8015                 if p != x4.Args[0] {
8016                         break
8017                 }
8018                 x4_1 := x4.Args[1]
8019                 if x4_1.Op != OpPPC64SRDconst || auxIntToInt64(x4_1.AuxInt) != 40 || w != x4_1.Args[0] {
8020                         break
8021                 }
8022                 x5 := x4.Args[2]
8023                 if x5.Op != OpPPC64MOVBstore {
8024                         break
8025                 }
8026                 i1 := auxIntToInt32(x5.AuxInt)
8027                 if auxToSym(x5.Aux) != s {
8028                         break
8029                 }
8030                 _ = x5.Args[2]
8031                 if p != x5.Args[0] {
8032                         break
8033                 }
8034                 x5_1 := x5.Args[1]
8035                 if x5_1.Op != OpPPC64SRDconst || auxIntToInt64(x5_1.AuxInt) != 48 || w != x5_1.Args[0] {
8036                         break
8037                 }
8038                 x6 := x5.Args[2]
8039                 if x6.Op != OpPPC64MOVBstore {
8040                         break
8041                 }
8042                 i0 := auxIntToInt32(x6.AuxInt)
8043                 if auxToSym(x6.Aux) != s {
8044                         break
8045                 }
8046                 mem := x6.Args[2]
8047                 if p != x6.Args[0] {
8048                         break
8049                 }
8050                 x6_1 := x6.Args[1]
8051                 if x6_1.Op != OpPPC64SRDconst || auxIntToInt64(x6_1.AuxInt) != 56 || w != x6_1.Args[0] || !(!config.BigEndian && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && x4.Uses == 1 && x5.Uses == 1 && x6.Uses == 1 && i1 == i0+1 && i2 == i0+2 && i3 == i0+3 && i4 == i0+4 && i5 == i0+5 && i6 == i0+6 && i7 == i0+7 && clobber(x0, x1, x2, x3, x4, x5, x6)) {
8052                         break
8053                 }
8054                 v.reset(OpPPC64MOVDBRstore)
8055                 v0 := b.NewValue0(x6.Pos, OpPPC64MOVDaddr, typ.Uintptr)
8056                 v0.AuxInt = int32ToAuxInt(i0)
8057                 v0.Aux = symToAux(s)
8058                 v0.AddArg(p)
8059                 v.AddArg3(v0, w, mem)
8060                 return true
8061         }
8062         return false
8063 }
8064 func rewriteValuePPC64_OpPPC64MOVBstoreidx(v *Value) bool {
8065         v_3 := v.Args[3]
8066         v_2 := v.Args[2]
8067         v_1 := v.Args[1]
8068         v_0 := v.Args[0]
8069         b := v.Block
8070         typ := &b.Func.Config.Types
8071         // match: (MOVBstoreidx ptr (MOVDconst [c]) val mem)
8072         // cond: is16Bit(c)
8073         // result: (MOVBstore [int32(c)] ptr val mem)
8074         for {
8075                 ptr := v_0
8076                 if v_1.Op != OpPPC64MOVDconst {
8077                         break
8078                 }
8079                 c := auxIntToInt64(v_1.AuxInt)
8080                 val := v_2
8081                 mem := v_3
8082                 if !(is16Bit(c)) {
8083                         break
8084                 }
8085                 v.reset(OpPPC64MOVBstore)
8086                 v.AuxInt = int32ToAuxInt(int32(c))
8087                 v.AddArg3(ptr, val, mem)
8088                 return true
8089         }
8090         // match: (MOVBstoreidx (MOVDconst [c]) ptr val mem)
8091         // cond: is16Bit(c)
8092         // result: (MOVBstore [int32(c)] ptr val mem)
8093         for {
8094                 if v_0.Op != OpPPC64MOVDconst {
8095                         break
8096                 }
8097                 c := auxIntToInt64(v_0.AuxInt)
8098                 ptr := v_1
8099                 val := v_2
8100                 mem := v_3
8101                 if !(is16Bit(c)) {
8102                         break
8103                 }
8104                 v.reset(OpPPC64MOVBstore)
8105                 v.AuxInt = int32ToAuxInt(int32(c))
8106                 v.AddArg3(ptr, val, mem)
8107                 return true
8108         }
8109         // match: (MOVBstoreidx ptr idx (MOVBreg x) mem)
8110         // result: (MOVBstoreidx ptr idx x mem)
8111         for {
8112                 ptr := v_0
8113                 idx := v_1
8114                 if v_2.Op != OpPPC64MOVBreg {
8115                         break
8116                 }
8117                 x := v_2.Args[0]
8118                 mem := v_3
8119                 v.reset(OpPPC64MOVBstoreidx)
8120                 v.AddArg4(ptr, idx, x, mem)
8121                 return true
8122         }
8123         // match: (MOVBstoreidx ptr idx (MOVBZreg x) mem)
8124         // result: (MOVBstoreidx ptr idx x mem)
8125         for {
8126                 ptr := v_0
8127                 idx := v_1
8128                 if v_2.Op != OpPPC64MOVBZreg {
8129                         break
8130                 }
8131                 x := v_2.Args[0]
8132                 mem := v_3
8133                 v.reset(OpPPC64MOVBstoreidx)
8134                 v.AddArg4(ptr, idx, x, mem)
8135                 return true
8136         }
8137         // match: (MOVBstoreidx ptr idx (MOVHreg x) mem)
8138         // result: (MOVBstoreidx ptr idx x mem)
8139         for {
8140                 ptr := v_0
8141                 idx := v_1
8142                 if v_2.Op != OpPPC64MOVHreg {
8143                         break
8144                 }
8145                 x := v_2.Args[0]
8146                 mem := v_3
8147                 v.reset(OpPPC64MOVBstoreidx)
8148                 v.AddArg4(ptr, idx, x, mem)
8149                 return true
8150         }
8151         // match: (MOVBstoreidx ptr idx (MOVHZreg x) mem)
8152         // result: (MOVBstoreidx ptr idx x mem)
8153         for {
8154                 ptr := v_0
8155                 idx := v_1
8156                 if v_2.Op != OpPPC64MOVHZreg {
8157                         break
8158                 }
8159                 x := v_2.Args[0]
8160                 mem := v_3
8161                 v.reset(OpPPC64MOVBstoreidx)
8162                 v.AddArg4(ptr, idx, x, mem)
8163                 return true
8164         }
8165         // match: (MOVBstoreidx ptr idx (MOVWreg x) mem)
8166         // result: (MOVBstoreidx ptr idx x mem)
8167         for {
8168                 ptr := v_0
8169                 idx := v_1
8170                 if v_2.Op != OpPPC64MOVWreg {
8171                         break
8172                 }
8173                 x := v_2.Args[0]
8174                 mem := v_3
8175                 v.reset(OpPPC64MOVBstoreidx)
8176                 v.AddArg4(ptr, idx, x, mem)
8177                 return true
8178         }
8179         // match: (MOVBstoreidx ptr idx (MOVWZreg x) mem)
8180         // result: (MOVBstoreidx ptr idx x mem)
8181         for {
8182                 ptr := v_0
8183                 idx := v_1
8184                 if v_2.Op != OpPPC64MOVWZreg {
8185                         break
8186                 }
8187                 x := v_2.Args[0]
8188                 mem := v_3
8189                 v.reset(OpPPC64MOVBstoreidx)
8190                 v.AddArg4(ptr, idx, x, mem)
8191                 return true
8192         }
8193         // match: (MOVBstoreidx ptr idx (SRWconst (MOVHreg x) [c]) mem)
8194         // cond: c <= 8
8195         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
8196         for {
8197                 ptr := v_0
8198                 idx := v_1
8199                 if v_2.Op != OpPPC64SRWconst {
8200                         break
8201                 }
8202                 c := auxIntToInt64(v_2.AuxInt)
8203                 v_2_0 := v_2.Args[0]
8204                 if v_2_0.Op != OpPPC64MOVHreg {
8205                         break
8206                 }
8207                 x := v_2_0.Args[0]
8208                 mem := v_3
8209                 if !(c <= 8) {
8210                         break
8211                 }
8212                 v.reset(OpPPC64MOVBstoreidx)
8213                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
8214                 v0.AuxInt = int64ToAuxInt(c)
8215                 v0.AddArg(x)
8216                 v.AddArg4(ptr, idx, v0, mem)
8217                 return true
8218         }
8219         // match: (MOVBstoreidx ptr idx (SRWconst (MOVHZreg x) [c]) mem)
8220         // cond: c <= 8
8221         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
8222         for {
8223                 ptr := v_0
8224                 idx := v_1
8225                 if v_2.Op != OpPPC64SRWconst {
8226                         break
8227                 }
8228                 c := auxIntToInt64(v_2.AuxInt)
8229                 v_2_0 := v_2.Args[0]
8230                 if v_2_0.Op != OpPPC64MOVHZreg {
8231                         break
8232                 }
8233                 x := v_2_0.Args[0]
8234                 mem := v_3
8235                 if !(c <= 8) {
8236                         break
8237                 }
8238                 v.reset(OpPPC64MOVBstoreidx)
8239                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
8240                 v0.AuxInt = int64ToAuxInt(c)
8241                 v0.AddArg(x)
8242                 v.AddArg4(ptr, idx, v0, mem)
8243                 return true
8244         }
8245         // match: (MOVBstoreidx ptr idx (SRWconst (MOVWreg x) [c]) mem)
8246         // cond: c <= 24
8247         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
8248         for {
8249                 ptr := v_0
8250                 idx := v_1
8251                 if v_2.Op != OpPPC64SRWconst {
8252                         break
8253                 }
8254                 c := auxIntToInt64(v_2.AuxInt)
8255                 v_2_0 := v_2.Args[0]
8256                 if v_2_0.Op != OpPPC64MOVWreg {
8257                         break
8258                 }
8259                 x := v_2_0.Args[0]
8260                 mem := v_3
8261                 if !(c <= 24) {
8262                         break
8263                 }
8264                 v.reset(OpPPC64MOVBstoreidx)
8265                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
8266                 v0.AuxInt = int64ToAuxInt(c)
8267                 v0.AddArg(x)
8268                 v.AddArg4(ptr, idx, v0, mem)
8269                 return true
8270         }
8271         // match: (MOVBstoreidx ptr idx (SRWconst (MOVWZreg x) [c]) mem)
8272         // cond: c <= 24
8273         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
8274         for {
8275                 ptr := v_0
8276                 idx := v_1
8277                 if v_2.Op != OpPPC64SRWconst {
8278                         break
8279                 }
8280                 c := auxIntToInt64(v_2.AuxInt)
8281                 v_2_0 := v_2.Args[0]
8282                 if v_2_0.Op != OpPPC64MOVWZreg {
8283                         break
8284                 }
8285                 x := v_2_0.Args[0]
8286                 mem := v_3
8287                 if !(c <= 24) {
8288                         break
8289                 }
8290                 v.reset(OpPPC64MOVBstoreidx)
8291                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
8292                 v0.AuxInt = int64ToAuxInt(c)
8293                 v0.AddArg(x)
8294                 v.AddArg4(ptr, idx, v0, mem)
8295                 return true
8296         }
8297         return false
8298 }
8299 func rewriteValuePPC64_OpPPC64MOVBstorezero(v *Value) bool {
8300         v_1 := v.Args[1]
8301         v_0 := v.Args[0]
8302         // match: (MOVBstorezero [off1] {sym} (ADDconst [off2] x) mem)
8303         // cond: is16Bit(int64(off1)+off2)
8304         // result: (MOVBstorezero [off1+int32(off2)] {sym} x mem)
8305         for {
8306                 off1 := auxIntToInt32(v.AuxInt)
8307                 sym := auxToSym(v.Aux)
8308                 if v_0.Op != OpPPC64ADDconst {
8309                         break
8310                 }
8311                 off2 := auxIntToInt64(v_0.AuxInt)
8312                 x := v_0.Args[0]
8313                 mem := v_1
8314                 if !(is16Bit(int64(off1) + off2)) {
8315                         break
8316                 }
8317                 v.reset(OpPPC64MOVBstorezero)
8318                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8319                 v.Aux = symToAux(sym)
8320                 v.AddArg2(x, mem)
8321                 return true
8322         }
8323         // match: (MOVBstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
8324         // cond: canMergeSym(sym1,sym2) && (x.Op != OpSB || p.Uses == 1)
8325         // result: (MOVBstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
8326         for {
8327                 off1 := auxIntToInt32(v.AuxInt)
8328                 sym1 := auxToSym(v.Aux)
8329                 p := v_0
8330                 if p.Op != OpPPC64MOVDaddr {
8331                         break
8332                 }
8333                 off2 := auxIntToInt32(p.AuxInt)
8334                 sym2 := auxToSym(p.Aux)
8335                 x := p.Args[0]
8336                 mem := v_1
8337                 if !(canMergeSym(sym1, sym2) && (x.Op != OpSB || p.Uses == 1)) {
8338                         break
8339                 }
8340                 v.reset(OpPPC64MOVBstorezero)
8341                 v.AuxInt = int32ToAuxInt(off1 + off2)
8342                 v.Aux = symToAux(mergeSym(sym1, sym2))
8343                 v.AddArg2(x, mem)
8344                 return true
8345         }
8346         return false
8347 }
8348 func rewriteValuePPC64_OpPPC64MOVDload(v *Value) bool {
8349         v_1 := v.Args[1]
8350         v_0 := v.Args[0]
8351         // match: (MOVDload [off] {sym} ptr (FMOVDstore [off] {sym} ptr x _))
8352         // result: (MFVSRD x)
8353         for {
8354                 off := auxIntToInt32(v.AuxInt)
8355                 sym := auxToSym(v.Aux)
8356                 ptr := v_0
8357                 if v_1.Op != OpPPC64FMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
8358                         break
8359                 }
8360                 x := v_1.Args[1]
8361                 if ptr != v_1.Args[0] {
8362                         break
8363                 }
8364                 v.reset(OpPPC64MFVSRD)
8365                 v.AddArg(x)
8366                 return true
8367         }
8368         // match: (MOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
8369         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
8370         // result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
8371         for {
8372                 off1 := auxIntToInt32(v.AuxInt)
8373                 sym1 := auxToSym(v.Aux)
8374                 p := v_0
8375                 if p.Op != OpPPC64MOVDaddr {
8376                         break
8377                 }
8378                 off2 := auxIntToInt32(p.AuxInt)
8379                 sym2 := auxToSym(p.Aux)
8380                 ptr := p.Args[0]
8381                 mem := v_1
8382                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
8383                         break
8384                 }
8385                 v.reset(OpPPC64MOVDload)
8386                 v.AuxInt = int32ToAuxInt(off1 + off2)
8387                 v.Aux = symToAux(mergeSym(sym1, sym2))
8388                 v.AddArg2(ptr, mem)
8389                 return true
8390         }
8391         // match: (MOVDload [off1] {sym} (ADDconst [off2] x) mem)
8392         // cond: is16Bit(int64(off1)+off2)
8393         // result: (MOVDload [off1+int32(off2)] {sym} x mem)
8394         for {
8395                 off1 := auxIntToInt32(v.AuxInt)
8396                 sym := auxToSym(v.Aux)
8397                 if v_0.Op != OpPPC64ADDconst {
8398                         break
8399                 }
8400                 off2 := auxIntToInt64(v_0.AuxInt)
8401                 x := v_0.Args[0]
8402                 mem := v_1
8403                 if !(is16Bit(int64(off1) + off2)) {
8404                         break
8405                 }
8406                 v.reset(OpPPC64MOVDload)
8407                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8408                 v.Aux = symToAux(sym)
8409                 v.AddArg2(x, mem)
8410                 return true
8411         }
8412         // match: (MOVDload [0] {sym} p:(ADD ptr idx) mem)
8413         // cond: sym == nil && p.Uses == 1
8414         // result: (MOVDloadidx ptr idx mem)
8415         for {
8416                 if auxIntToInt32(v.AuxInt) != 0 {
8417                         break
8418                 }
8419                 sym := auxToSym(v.Aux)
8420                 p := v_0
8421                 if p.Op != OpPPC64ADD {
8422                         break
8423                 }
8424                 idx := p.Args[1]
8425                 ptr := p.Args[0]
8426                 mem := v_1
8427                 if !(sym == nil && p.Uses == 1) {
8428                         break
8429                 }
8430                 v.reset(OpPPC64MOVDloadidx)
8431                 v.AddArg3(ptr, idx, mem)
8432                 return true
8433         }
8434         return false
8435 }
8436 func rewriteValuePPC64_OpPPC64MOVDloadidx(v *Value) bool {
8437         v_2 := v.Args[2]
8438         v_1 := v.Args[1]
8439         v_0 := v.Args[0]
8440         // match: (MOVDloadidx ptr (MOVDconst [c]) mem)
8441         // cond: is16Bit(c) && c%4 == 0
8442         // result: (MOVDload [int32(c)] ptr mem)
8443         for {
8444                 ptr := v_0
8445                 if v_1.Op != OpPPC64MOVDconst {
8446                         break
8447                 }
8448                 c := auxIntToInt64(v_1.AuxInt)
8449                 mem := v_2
8450                 if !(is16Bit(c) && c%4 == 0) {
8451                         break
8452                 }
8453                 v.reset(OpPPC64MOVDload)
8454                 v.AuxInt = int32ToAuxInt(int32(c))
8455                 v.AddArg2(ptr, mem)
8456                 return true
8457         }
8458         // match: (MOVDloadidx (MOVDconst [c]) ptr mem)
8459         // cond: is16Bit(c) && c%4 == 0
8460         // result: (MOVDload [int32(c)] ptr mem)
8461         for {
8462                 if v_0.Op != OpPPC64MOVDconst {
8463                         break
8464                 }
8465                 c := auxIntToInt64(v_0.AuxInt)
8466                 ptr := v_1
8467                 mem := v_2
8468                 if !(is16Bit(c) && c%4 == 0) {
8469                         break
8470                 }
8471                 v.reset(OpPPC64MOVDload)
8472                 v.AuxInt = int32ToAuxInt(int32(c))
8473                 v.AddArg2(ptr, mem)
8474                 return true
8475         }
8476         return false
8477 }
8478 func rewriteValuePPC64_OpPPC64MOVDstore(v *Value) bool {
8479         v_2 := v.Args[2]
8480         v_1 := v.Args[1]
8481         v_0 := v.Args[0]
8482         // match: (MOVDstore [off] {sym} ptr (MFVSRD x) mem)
8483         // result: (FMOVDstore [off] {sym} ptr x mem)
8484         for {
8485                 off := auxIntToInt32(v.AuxInt)
8486                 sym := auxToSym(v.Aux)
8487                 ptr := v_0
8488                 if v_1.Op != OpPPC64MFVSRD {
8489                         break
8490                 }
8491                 x := v_1.Args[0]
8492                 mem := v_2
8493                 v.reset(OpPPC64FMOVDstore)
8494                 v.AuxInt = int32ToAuxInt(off)
8495                 v.Aux = symToAux(sym)
8496                 v.AddArg3(ptr, x, mem)
8497                 return true
8498         }
8499         // match: (MOVDstore [off1] {sym} (ADDconst [off2] x) val mem)
8500         // cond: is16Bit(int64(off1)+off2)
8501         // result: (MOVDstore [off1+int32(off2)] {sym} x val mem)
8502         for {
8503                 off1 := auxIntToInt32(v.AuxInt)
8504                 sym := auxToSym(v.Aux)
8505                 if v_0.Op != OpPPC64ADDconst {
8506                         break
8507                 }
8508                 off2 := auxIntToInt64(v_0.AuxInt)
8509                 x := v_0.Args[0]
8510                 val := v_1
8511                 mem := v_2
8512                 if !(is16Bit(int64(off1) + off2)) {
8513                         break
8514                 }
8515                 v.reset(OpPPC64MOVDstore)
8516                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8517                 v.Aux = symToAux(sym)
8518                 v.AddArg3(x, val, mem)
8519                 return true
8520         }
8521         // match: (MOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
8522         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
8523         // result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
8524         for {
8525                 off1 := auxIntToInt32(v.AuxInt)
8526                 sym1 := auxToSym(v.Aux)
8527                 p := v_0
8528                 if p.Op != OpPPC64MOVDaddr {
8529                         break
8530                 }
8531                 off2 := auxIntToInt32(p.AuxInt)
8532                 sym2 := auxToSym(p.Aux)
8533                 ptr := p.Args[0]
8534                 val := v_1
8535                 mem := v_2
8536                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
8537                         break
8538                 }
8539                 v.reset(OpPPC64MOVDstore)
8540                 v.AuxInt = int32ToAuxInt(off1 + off2)
8541                 v.Aux = symToAux(mergeSym(sym1, sym2))
8542                 v.AddArg3(ptr, val, mem)
8543                 return true
8544         }
8545         // match: (MOVDstore [off] {sym} ptr (MOVDconst [0]) mem)
8546         // result: (MOVDstorezero [off] {sym} ptr mem)
8547         for {
8548                 off := auxIntToInt32(v.AuxInt)
8549                 sym := auxToSym(v.Aux)
8550                 ptr := v_0
8551                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
8552                         break
8553                 }
8554                 mem := v_2
8555                 v.reset(OpPPC64MOVDstorezero)
8556                 v.AuxInt = int32ToAuxInt(off)
8557                 v.Aux = symToAux(sym)
8558                 v.AddArg2(ptr, mem)
8559                 return true
8560         }
8561         // match: (MOVDstore [0] {sym} p:(ADD ptr idx) val mem)
8562         // cond: sym == nil && p.Uses == 1
8563         // result: (MOVDstoreidx ptr idx val mem)
8564         for {
8565                 if auxIntToInt32(v.AuxInt) != 0 {
8566                         break
8567                 }
8568                 sym := auxToSym(v.Aux)
8569                 p := v_0
8570                 if p.Op != OpPPC64ADD {
8571                         break
8572                 }
8573                 idx := p.Args[1]
8574                 ptr := p.Args[0]
8575                 val := v_1
8576                 mem := v_2
8577                 if !(sym == nil && p.Uses == 1) {
8578                         break
8579                 }
8580                 v.reset(OpPPC64MOVDstoreidx)
8581                 v.AddArg4(ptr, idx, val, mem)
8582                 return true
8583         }
8584         return false
8585 }
8586 func rewriteValuePPC64_OpPPC64MOVDstoreidx(v *Value) bool {
8587         v_3 := v.Args[3]
8588         v_2 := v.Args[2]
8589         v_1 := v.Args[1]
8590         v_0 := v.Args[0]
8591         // match: (MOVDstoreidx ptr (MOVDconst [c]) val mem)
8592         // cond: is16Bit(c) && c%4 == 0
8593         // result: (MOVDstore [int32(c)] ptr val mem)
8594         for {
8595                 ptr := v_0
8596                 if v_1.Op != OpPPC64MOVDconst {
8597                         break
8598                 }
8599                 c := auxIntToInt64(v_1.AuxInt)
8600                 val := v_2
8601                 mem := v_3
8602                 if !(is16Bit(c) && c%4 == 0) {
8603                         break
8604                 }
8605                 v.reset(OpPPC64MOVDstore)
8606                 v.AuxInt = int32ToAuxInt(int32(c))
8607                 v.AddArg3(ptr, val, mem)
8608                 return true
8609         }
8610         // match: (MOVDstoreidx (MOVDconst [c]) ptr val mem)
8611         // cond: is16Bit(c) && c%4 == 0
8612         // result: (MOVDstore [int32(c)] ptr val mem)
8613         for {
8614                 if v_0.Op != OpPPC64MOVDconst {
8615                         break
8616                 }
8617                 c := auxIntToInt64(v_0.AuxInt)
8618                 ptr := v_1
8619                 val := v_2
8620                 mem := v_3
8621                 if !(is16Bit(c) && c%4 == 0) {
8622                         break
8623                 }
8624                 v.reset(OpPPC64MOVDstore)
8625                 v.AuxInt = int32ToAuxInt(int32(c))
8626                 v.AddArg3(ptr, val, mem)
8627                 return true
8628         }
8629         return false
8630 }
8631 func rewriteValuePPC64_OpPPC64MOVDstorezero(v *Value) bool {
8632         v_1 := v.Args[1]
8633         v_0 := v.Args[0]
8634         // match: (MOVDstorezero [off1] {sym} (ADDconst [off2] x) mem)
8635         // cond: is16Bit(int64(off1)+off2)
8636         // result: (MOVDstorezero [off1+int32(off2)] {sym} x mem)
8637         for {
8638                 off1 := auxIntToInt32(v.AuxInt)
8639                 sym := auxToSym(v.Aux)
8640                 if v_0.Op != OpPPC64ADDconst {
8641                         break
8642                 }
8643                 off2 := auxIntToInt64(v_0.AuxInt)
8644                 x := v_0.Args[0]
8645                 mem := v_1
8646                 if !(is16Bit(int64(off1) + off2)) {
8647                         break
8648                 }
8649                 v.reset(OpPPC64MOVDstorezero)
8650                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8651                 v.Aux = symToAux(sym)
8652                 v.AddArg2(x, mem)
8653                 return true
8654         }
8655         // match: (MOVDstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
8656         // cond: canMergeSym(sym1,sym2) && (x.Op != OpSB || p.Uses == 1)
8657         // result: (MOVDstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
8658         for {
8659                 off1 := auxIntToInt32(v.AuxInt)
8660                 sym1 := auxToSym(v.Aux)
8661                 p := v_0
8662                 if p.Op != OpPPC64MOVDaddr {
8663                         break
8664                 }
8665                 off2 := auxIntToInt32(p.AuxInt)
8666                 sym2 := auxToSym(p.Aux)
8667                 x := p.Args[0]
8668                 mem := v_1
8669                 if !(canMergeSym(sym1, sym2) && (x.Op != OpSB || p.Uses == 1)) {
8670                         break
8671                 }
8672                 v.reset(OpPPC64MOVDstorezero)
8673                 v.AuxInt = int32ToAuxInt(off1 + off2)
8674                 v.Aux = symToAux(mergeSym(sym1, sym2))
8675                 v.AddArg2(x, mem)
8676                 return true
8677         }
8678         return false
8679 }
8680 func rewriteValuePPC64_OpPPC64MOVHBRstore(v *Value) bool {
8681         v_2 := v.Args[2]
8682         v_1 := v.Args[1]
8683         v_0 := v.Args[0]
8684         // match: (MOVHBRstore {sym} ptr (MOVHreg x) mem)
8685         // result: (MOVHBRstore {sym} ptr x mem)
8686         for {
8687                 sym := auxToSym(v.Aux)
8688                 ptr := v_0
8689                 if v_1.Op != OpPPC64MOVHreg {
8690                         break
8691                 }
8692                 x := v_1.Args[0]
8693                 mem := v_2
8694                 v.reset(OpPPC64MOVHBRstore)
8695                 v.Aux = symToAux(sym)
8696                 v.AddArg3(ptr, x, mem)
8697                 return true
8698         }
8699         // match: (MOVHBRstore {sym} ptr (MOVHZreg x) mem)
8700         // result: (MOVHBRstore {sym} ptr x mem)
8701         for {
8702                 sym := auxToSym(v.Aux)
8703                 ptr := v_0
8704                 if v_1.Op != OpPPC64MOVHZreg {
8705                         break
8706                 }
8707                 x := v_1.Args[0]
8708                 mem := v_2
8709                 v.reset(OpPPC64MOVHBRstore)
8710                 v.Aux = symToAux(sym)
8711                 v.AddArg3(ptr, x, mem)
8712                 return true
8713         }
8714         // match: (MOVHBRstore {sym} ptr (MOVWreg x) mem)
8715         // result: (MOVHBRstore {sym} ptr x mem)
8716         for {
8717                 sym := auxToSym(v.Aux)
8718                 ptr := v_0
8719                 if v_1.Op != OpPPC64MOVWreg {
8720                         break
8721                 }
8722                 x := v_1.Args[0]
8723                 mem := v_2
8724                 v.reset(OpPPC64MOVHBRstore)
8725                 v.Aux = symToAux(sym)
8726                 v.AddArg3(ptr, x, mem)
8727                 return true
8728         }
8729         // match: (MOVHBRstore {sym} ptr (MOVWZreg x) mem)
8730         // result: (MOVHBRstore {sym} ptr x mem)
8731         for {
8732                 sym := auxToSym(v.Aux)
8733                 ptr := v_0
8734                 if v_1.Op != OpPPC64MOVWZreg {
8735                         break
8736                 }
8737                 x := v_1.Args[0]
8738                 mem := v_2
8739                 v.reset(OpPPC64MOVHBRstore)
8740                 v.Aux = symToAux(sym)
8741                 v.AddArg3(ptr, x, mem)
8742                 return true
8743         }
8744         return false
8745 }
8746 func rewriteValuePPC64_OpPPC64MOVHZload(v *Value) bool {
8747         v_1 := v.Args[1]
8748         v_0 := v.Args[0]
8749         // match: (MOVHZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
8750         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
8751         // result: (MOVHZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
8752         for {
8753                 off1 := auxIntToInt32(v.AuxInt)
8754                 sym1 := auxToSym(v.Aux)
8755                 p := v_0
8756                 if p.Op != OpPPC64MOVDaddr {
8757                         break
8758                 }
8759                 off2 := auxIntToInt32(p.AuxInt)
8760                 sym2 := auxToSym(p.Aux)
8761                 ptr := p.Args[0]
8762                 mem := v_1
8763                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
8764                         break
8765                 }
8766                 v.reset(OpPPC64MOVHZload)
8767                 v.AuxInt = int32ToAuxInt(off1 + off2)
8768                 v.Aux = symToAux(mergeSym(sym1, sym2))
8769                 v.AddArg2(ptr, mem)
8770                 return true
8771         }
8772         // match: (MOVHZload [off1] {sym} (ADDconst [off2] x) mem)
8773         // cond: is16Bit(int64(off1)+off2)
8774         // result: (MOVHZload [off1+int32(off2)] {sym} x mem)
8775         for {
8776                 off1 := auxIntToInt32(v.AuxInt)
8777                 sym := auxToSym(v.Aux)
8778                 if v_0.Op != OpPPC64ADDconst {
8779                         break
8780                 }
8781                 off2 := auxIntToInt64(v_0.AuxInt)
8782                 x := v_0.Args[0]
8783                 mem := v_1
8784                 if !(is16Bit(int64(off1) + off2)) {
8785                         break
8786                 }
8787                 v.reset(OpPPC64MOVHZload)
8788                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8789                 v.Aux = symToAux(sym)
8790                 v.AddArg2(x, mem)
8791                 return true
8792         }
8793         // match: (MOVHZload [0] {sym} p:(ADD ptr idx) mem)
8794         // cond: sym == nil && p.Uses == 1
8795         // result: (MOVHZloadidx ptr idx mem)
8796         for {
8797                 if auxIntToInt32(v.AuxInt) != 0 {
8798                         break
8799                 }
8800                 sym := auxToSym(v.Aux)
8801                 p := v_0
8802                 if p.Op != OpPPC64ADD {
8803                         break
8804                 }
8805                 idx := p.Args[1]
8806                 ptr := p.Args[0]
8807                 mem := v_1
8808                 if !(sym == nil && p.Uses == 1) {
8809                         break
8810                 }
8811                 v.reset(OpPPC64MOVHZloadidx)
8812                 v.AddArg3(ptr, idx, mem)
8813                 return true
8814         }
8815         return false
8816 }
8817 func rewriteValuePPC64_OpPPC64MOVHZloadidx(v *Value) bool {
8818         v_2 := v.Args[2]
8819         v_1 := v.Args[1]
8820         v_0 := v.Args[0]
8821         // match: (MOVHZloadidx ptr (MOVDconst [c]) mem)
8822         // cond: is16Bit(c)
8823         // result: (MOVHZload [int32(c)] ptr mem)
8824         for {
8825                 ptr := v_0
8826                 if v_1.Op != OpPPC64MOVDconst {
8827                         break
8828                 }
8829                 c := auxIntToInt64(v_1.AuxInt)
8830                 mem := v_2
8831                 if !(is16Bit(c)) {
8832                         break
8833                 }
8834                 v.reset(OpPPC64MOVHZload)
8835                 v.AuxInt = int32ToAuxInt(int32(c))
8836                 v.AddArg2(ptr, mem)
8837                 return true
8838         }
8839         // match: (MOVHZloadidx (MOVDconst [c]) ptr mem)
8840         // cond: is16Bit(c)
8841         // result: (MOVHZload [int32(c)] ptr mem)
8842         for {
8843                 if v_0.Op != OpPPC64MOVDconst {
8844                         break
8845                 }
8846                 c := auxIntToInt64(v_0.AuxInt)
8847                 ptr := v_1
8848                 mem := v_2
8849                 if !(is16Bit(c)) {
8850                         break
8851                 }
8852                 v.reset(OpPPC64MOVHZload)
8853                 v.AuxInt = int32ToAuxInt(int32(c))
8854                 v.AddArg2(ptr, mem)
8855                 return true
8856         }
8857         return false
8858 }
8859 func rewriteValuePPC64_OpPPC64MOVHZreg(v *Value) bool {
8860         v_0 := v.Args[0]
8861         b := v.Block
8862         typ := &b.Func.Config.Types
8863         // match: (MOVHZreg y:(ANDconst [c] _))
8864         // cond: uint64(c) <= 0xFFFF
8865         // result: y
8866         for {
8867                 y := v_0
8868                 if y.Op != OpPPC64ANDconst {
8869                         break
8870                 }
8871                 c := auxIntToInt64(y.AuxInt)
8872                 if !(uint64(c) <= 0xFFFF) {
8873                         break
8874                 }
8875                 v.copyOf(y)
8876                 return true
8877         }
8878         // match: (MOVHZreg (SRWconst [c] (MOVBZreg x)))
8879         // result: (SRWconst [c] (MOVBZreg x))
8880         for {
8881                 if v_0.Op != OpPPC64SRWconst {
8882                         break
8883                 }
8884                 c := auxIntToInt64(v_0.AuxInt)
8885                 v_0_0 := v_0.Args[0]
8886                 if v_0_0.Op != OpPPC64MOVBZreg {
8887                         break
8888                 }
8889                 x := v_0_0.Args[0]
8890                 v.reset(OpPPC64SRWconst)
8891                 v.AuxInt = int64ToAuxInt(c)
8892                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
8893                 v0.AddArg(x)
8894                 v.AddArg(v0)
8895                 return true
8896         }
8897         // match: (MOVHZreg (SRWconst [c] (MOVHZreg x)))
8898         // result: (SRWconst [c] (MOVHZreg x))
8899         for {
8900                 if v_0.Op != OpPPC64SRWconst {
8901                         break
8902                 }
8903                 c := auxIntToInt64(v_0.AuxInt)
8904                 v_0_0 := v_0.Args[0]
8905                 if v_0_0.Op != OpPPC64MOVHZreg {
8906                         break
8907                 }
8908                 x := v_0_0.Args[0]
8909                 v.reset(OpPPC64SRWconst)
8910                 v.AuxInt = int64ToAuxInt(c)
8911                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
8912                 v0.AddArg(x)
8913                 v.AddArg(v0)
8914                 return true
8915         }
8916         // match: (MOVHZreg (SRWconst [c] x))
8917         // cond: sizeof(x.Type) <= 16
8918         // result: (SRWconst [c] x)
8919         for {
8920                 if v_0.Op != OpPPC64SRWconst {
8921                         break
8922                 }
8923                 c := auxIntToInt64(v_0.AuxInt)
8924                 x := v_0.Args[0]
8925                 if !(sizeof(x.Type) <= 16) {
8926                         break
8927                 }
8928                 v.reset(OpPPC64SRWconst)
8929                 v.AuxInt = int64ToAuxInt(c)
8930                 v.AddArg(x)
8931                 return true
8932         }
8933         // match: (MOVHZreg (SRDconst [c] x))
8934         // cond: c>=48
8935         // result: (SRDconst [c] x)
8936         for {
8937                 if v_0.Op != OpPPC64SRDconst {
8938                         break
8939                 }
8940                 c := auxIntToInt64(v_0.AuxInt)
8941                 x := v_0.Args[0]
8942                 if !(c >= 48) {
8943                         break
8944                 }
8945                 v.reset(OpPPC64SRDconst)
8946                 v.AuxInt = int64ToAuxInt(c)
8947                 v.AddArg(x)
8948                 return true
8949         }
8950         // match: (MOVHZreg (SRWconst [c] x))
8951         // cond: c>=16
8952         // result: (SRWconst [c] x)
8953         for {
8954                 if v_0.Op != OpPPC64SRWconst {
8955                         break
8956                 }
8957                 c := auxIntToInt64(v_0.AuxInt)
8958                 x := v_0.Args[0]
8959                 if !(c >= 16) {
8960                         break
8961                 }
8962                 v.reset(OpPPC64SRWconst)
8963                 v.AuxInt = int64ToAuxInt(c)
8964                 v.AddArg(x)
8965                 return true
8966         }
8967         // match: (MOVHZreg y:(MOVHZreg _))
8968         // result: y
8969         for {
8970                 y := v_0
8971                 if y.Op != OpPPC64MOVHZreg {
8972                         break
8973                 }
8974                 v.copyOf(y)
8975                 return true
8976         }
8977         // match: (MOVHZreg y:(MOVBZreg _))
8978         // result: y
8979         for {
8980                 y := v_0
8981                 if y.Op != OpPPC64MOVBZreg {
8982                         break
8983                 }
8984                 v.copyOf(y)
8985                 return true
8986         }
8987         // match: (MOVHZreg y:(MOVHBRload _ _))
8988         // result: y
8989         for {
8990                 y := v_0
8991                 if y.Op != OpPPC64MOVHBRload {
8992                         break
8993                 }
8994                 v.copyOf(y)
8995                 return true
8996         }
8997         // match: (MOVHZreg y:(MOVHreg x))
8998         // result: (MOVHZreg x)
8999         for {
9000                 y := v_0
9001                 if y.Op != OpPPC64MOVHreg {
9002                         break
9003                 }
9004                 x := y.Args[0]
9005                 v.reset(OpPPC64MOVHZreg)
9006                 v.AddArg(x)
9007                 return true
9008         }
9009         // match: (MOVHZreg (OR <t> x (MOVWZreg y)))
9010         // result: (MOVHZreg (OR <t> x y))
9011         for {
9012                 if v_0.Op != OpPPC64OR {
9013                         break
9014                 }
9015                 t := v_0.Type
9016                 _ = v_0.Args[1]
9017                 v_0_0 := v_0.Args[0]
9018                 v_0_1 := v_0.Args[1]
9019                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9020                         x := v_0_0
9021                         if v_0_1.Op != OpPPC64MOVWZreg {
9022                                 continue
9023                         }
9024                         y := v_0_1.Args[0]
9025                         v.reset(OpPPC64MOVHZreg)
9026                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
9027                         v0.AddArg2(x, y)
9028                         v.AddArg(v0)
9029                         return true
9030                 }
9031                 break
9032         }
9033         // match: (MOVHZreg (XOR <t> x (MOVWZreg y)))
9034         // result: (MOVHZreg (XOR <t> x y))
9035         for {
9036                 if v_0.Op != OpPPC64XOR {
9037                         break
9038                 }
9039                 t := v_0.Type
9040                 _ = v_0.Args[1]
9041                 v_0_0 := v_0.Args[0]
9042                 v_0_1 := v_0.Args[1]
9043                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9044                         x := v_0_0
9045                         if v_0_1.Op != OpPPC64MOVWZreg {
9046                                 continue
9047                         }
9048                         y := v_0_1.Args[0]
9049                         v.reset(OpPPC64MOVHZreg)
9050                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
9051                         v0.AddArg2(x, y)
9052                         v.AddArg(v0)
9053                         return true
9054                 }
9055                 break
9056         }
9057         // match: (MOVHZreg (AND <t> x (MOVWZreg y)))
9058         // result: (MOVHZreg (AND <t> x y))
9059         for {
9060                 if v_0.Op != OpPPC64AND {
9061                         break
9062                 }
9063                 t := v_0.Type
9064                 _ = v_0.Args[1]
9065                 v_0_0 := v_0.Args[0]
9066                 v_0_1 := v_0.Args[1]
9067                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9068                         x := v_0_0
9069                         if v_0_1.Op != OpPPC64MOVWZreg {
9070                                 continue
9071                         }
9072                         y := v_0_1.Args[0]
9073                         v.reset(OpPPC64MOVHZreg)
9074                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
9075                         v0.AddArg2(x, y)
9076                         v.AddArg(v0)
9077                         return true
9078                 }
9079                 break
9080         }
9081         // match: (MOVHZreg (OR <t> x (MOVHZreg y)))
9082         // result: (MOVHZreg (OR <t> x y))
9083         for {
9084                 if v_0.Op != OpPPC64OR {
9085                         break
9086                 }
9087                 t := v_0.Type
9088                 _ = v_0.Args[1]
9089                 v_0_0 := v_0.Args[0]
9090                 v_0_1 := v_0.Args[1]
9091                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9092                         x := v_0_0
9093                         if v_0_1.Op != OpPPC64MOVHZreg {
9094                                 continue
9095                         }
9096                         y := v_0_1.Args[0]
9097                         v.reset(OpPPC64MOVHZreg)
9098                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
9099                         v0.AddArg2(x, y)
9100                         v.AddArg(v0)
9101                         return true
9102                 }
9103                 break
9104         }
9105         // match: (MOVHZreg (XOR <t> x (MOVHZreg y)))
9106         // result: (MOVHZreg (XOR <t> x y))
9107         for {
9108                 if v_0.Op != OpPPC64XOR {
9109                         break
9110                 }
9111                 t := v_0.Type
9112                 _ = v_0.Args[1]
9113                 v_0_0 := v_0.Args[0]
9114                 v_0_1 := v_0.Args[1]
9115                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9116                         x := v_0_0
9117                         if v_0_1.Op != OpPPC64MOVHZreg {
9118                                 continue
9119                         }
9120                         y := v_0_1.Args[0]
9121                         v.reset(OpPPC64MOVHZreg)
9122                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
9123                         v0.AddArg2(x, y)
9124                         v.AddArg(v0)
9125                         return true
9126                 }
9127                 break
9128         }
9129         // match: (MOVHZreg (AND <t> x (MOVHZreg y)))
9130         // result: (MOVHZreg (AND <t> x y))
9131         for {
9132                 if v_0.Op != OpPPC64AND {
9133                         break
9134                 }
9135                 t := v_0.Type
9136                 _ = v_0.Args[1]
9137                 v_0_0 := v_0.Args[0]
9138                 v_0_1 := v_0.Args[1]
9139                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9140                         x := v_0_0
9141                         if v_0_1.Op != OpPPC64MOVHZreg {
9142                                 continue
9143                         }
9144                         y := v_0_1.Args[0]
9145                         v.reset(OpPPC64MOVHZreg)
9146                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
9147                         v0.AddArg2(x, y)
9148                         v.AddArg(v0)
9149                         return true
9150                 }
9151                 break
9152         }
9153         // match: (MOVHZreg z:(ANDconst [c] (MOVBZload ptr x)))
9154         // result: z
9155         for {
9156                 z := v_0
9157                 if z.Op != OpPPC64ANDconst {
9158                         break
9159                 }
9160                 z_0 := z.Args[0]
9161                 if z_0.Op != OpPPC64MOVBZload {
9162                         break
9163                 }
9164                 v.copyOf(z)
9165                 return true
9166         }
9167         // match: (MOVHZreg z:(ANDconst [c] (MOVHZload ptr x)))
9168         // result: z
9169         for {
9170                 z := v_0
9171                 if z.Op != OpPPC64ANDconst {
9172                         break
9173                 }
9174                 z_0 := z.Args[0]
9175                 if z_0.Op != OpPPC64MOVHZload {
9176                         break
9177                 }
9178                 v.copyOf(z)
9179                 return true
9180         }
9181         // match: (MOVHZreg z:(AND y (MOVHZload ptr x)))
9182         // result: z
9183         for {
9184                 z := v_0
9185                 if z.Op != OpPPC64AND {
9186                         break
9187                 }
9188                 _ = z.Args[1]
9189                 z_0 := z.Args[0]
9190                 z_1 := z.Args[1]
9191                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
9192                         if z_1.Op != OpPPC64MOVHZload {
9193                                 continue
9194                         }
9195                         v.copyOf(z)
9196                         return true
9197                 }
9198                 break
9199         }
9200         // match: (MOVHZreg x:(MOVBZload _ _))
9201         // result: x
9202         for {
9203                 x := v_0
9204                 if x.Op != OpPPC64MOVBZload {
9205                         break
9206                 }
9207                 v.copyOf(x)
9208                 return true
9209         }
9210         // match: (MOVHZreg x:(MOVBZloadidx _ _ _))
9211         // result: x
9212         for {
9213                 x := v_0
9214                 if x.Op != OpPPC64MOVBZloadidx {
9215                         break
9216                 }
9217                 v.copyOf(x)
9218                 return true
9219         }
9220         // match: (MOVHZreg x:(MOVHZload _ _))
9221         // result: x
9222         for {
9223                 x := v_0
9224                 if x.Op != OpPPC64MOVHZload {
9225                         break
9226                 }
9227                 v.copyOf(x)
9228                 return true
9229         }
9230         // match: (MOVHZreg x:(MOVHZloadidx _ _ _))
9231         // result: x
9232         for {
9233                 x := v_0
9234                 if x.Op != OpPPC64MOVHZloadidx {
9235                         break
9236                 }
9237                 v.copyOf(x)
9238                 return true
9239         }
9240         // match: (MOVHZreg x:(Arg <t>))
9241         // cond: (is8BitInt(t) || is16BitInt(t)) && !isSigned(t)
9242         // result: x
9243         for {
9244                 x := v_0
9245                 if x.Op != OpArg {
9246                         break
9247                 }
9248                 t := x.Type
9249                 if !((is8BitInt(t) || is16BitInt(t)) && !isSigned(t)) {
9250                         break
9251                 }
9252                 v.copyOf(x)
9253                 return true
9254         }
9255         // match: (MOVHZreg (MOVDconst [c]))
9256         // result: (MOVDconst [int64(uint16(c))])
9257         for {
9258                 if v_0.Op != OpPPC64MOVDconst {
9259                         break
9260                 }
9261                 c := auxIntToInt64(v_0.AuxInt)
9262                 v.reset(OpPPC64MOVDconst)
9263                 v.AuxInt = int64ToAuxInt(int64(uint16(c)))
9264                 return true
9265         }
9266         return false
9267 }
9268 func rewriteValuePPC64_OpPPC64MOVHload(v *Value) bool {
9269         v_1 := v.Args[1]
9270         v_0 := v.Args[0]
9271         // match: (MOVHload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
9272         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
9273         // result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
9274         for {
9275                 off1 := auxIntToInt32(v.AuxInt)
9276                 sym1 := auxToSym(v.Aux)
9277                 p := v_0
9278                 if p.Op != OpPPC64MOVDaddr {
9279                         break
9280                 }
9281                 off2 := auxIntToInt32(p.AuxInt)
9282                 sym2 := auxToSym(p.Aux)
9283                 ptr := p.Args[0]
9284                 mem := v_1
9285                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
9286                         break
9287                 }
9288                 v.reset(OpPPC64MOVHload)
9289                 v.AuxInt = int32ToAuxInt(off1 + off2)
9290                 v.Aux = symToAux(mergeSym(sym1, sym2))
9291                 v.AddArg2(ptr, mem)
9292                 return true
9293         }
9294         // match: (MOVHload [off1] {sym} (ADDconst [off2] x) mem)
9295         // cond: is16Bit(int64(off1)+off2)
9296         // result: (MOVHload [off1+int32(off2)] {sym} x mem)
9297         for {
9298                 off1 := auxIntToInt32(v.AuxInt)
9299                 sym := auxToSym(v.Aux)
9300                 if v_0.Op != OpPPC64ADDconst {
9301                         break
9302                 }
9303                 off2 := auxIntToInt64(v_0.AuxInt)
9304                 x := v_0.Args[0]
9305                 mem := v_1
9306                 if !(is16Bit(int64(off1) + off2)) {
9307                         break
9308                 }
9309                 v.reset(OpPPC64MOVHload)
9310                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9311                 v.Aux = symToAux(sym)
9312                 v.AddArg2(x, mem)
9313                 return true
9314         }
9315         // match: (MOVHload [0] {sym} p:(ADD ptr idx) mem)
9316         // cond: sym == nil && p.Uses == 1
9317         // result: (MOVHloadidx ptr idx mem)
9318         for {
9319                 if auxIntToInt32(v.AuxInt) != 0 {
9320                         break
9321                 }
9322                 sym := auxToSym(v.Aux)
9323                 p := v_0
9324                 if p.Op != OpPPC64ADD {
9325                         break
9326                 }
9327                 idx := p.Args[1]
9328                 ptr := p.Args[0]
9329                 mem := v_1
9330                 if !(sym == nil && p.Uses == 1) {
9331                         break
9332                 }
9333                 v.reset(OpPPC64MOVHloadidx)
9334                 v.AddArg3(ptr, idx, mem)
9335                 return true
9336         }
9337         return false
9338 }
9339 func rewriteValuePPC64_OpPPC64MOVHloadidx(v *Value) bool {
9340         v_2 := v.Args[2]
9341         v_1 := v.Args[1]
9342         v_0 := v.Args[0]
9343         // match: (MOVHloadidx ptr (MOVDconst [c]) mem)
9344         // cond: is16Bit(c)
9345         // result: (MOVHload [int32(c)] ptr mem)
9346         for {
9347                 ptr := v_0
9348                 if v_1.Op != OpPPC64MOVDconst {
9349                         break
9350                 }
9351                 c := auxIntToInt64(v_1.AuxInt)
9352                 mem := v_2
9353                 if !(is16Bit(c)) {
9354                         break
9355                 }
9356                 v.reset(OpPPC64MOVHload)
9357                 v.AuxInt = int32ToAuxInt(int32(c))
9358                 v.AddArg2(ptr, mem)
9359                 return true
9360         }
9361         // match: (MOVHloadidx (MOVDconst [c]) ptr mem)
9362         // cond: is16Bit(c)
9363         // result: (MOVHload [int32(c)] ptr mem)
9364         for {
9365                 if v_0.Op != OpPPC64MOVDconst {
9366                         break
9367                 }
9368                 c := auxIntToInt64(v_0.AuxInt)
9369                 ptr := v_1
9370                 mem := v_2
9371                 if !(is16Bit(c)) {
9372                         break
9373                 }
9374                 v.reset(OpPPC64MOVHload)
9375                 v.AuxInt = int32ToAuxInt(int32(c))
9376                 v.AddArg2(ptr, mem)
9377                 return true
9378         }
9379         return false
9380 }
9381 func rewriteValuePPC64_OpPPC64MOVHreg(v *Value) bool {
9382         v_0 := v.Args[0]
9383         b := v.Block
9384         typ := &b.Func.Config.Types
9385         // match: (MOVHreg y:(ANDconst [c] _))
9386         // cond: uint64(c) <= 0x7FFF
9387         // result: y
9388         for {
9389                 y := v_0
9390                 if y.Op != OpPPC64ANDconst {
9391                         break
9392                 }
9393                 c := auxIntToInt64(y.AuxInt)
9394                 if !(uint64(c) <= 0x7FFF) {
9395                         break
9396                 }
9397                 v.copyOf(y)
9398                 return true
9399         }
9400         // match: (MOVHreg (SRAWconst [c] (MOVBreg x)))
9401         // result: (SRAWconst [c] (MOVBreg x))
9402         for {
9403                 if v_0.Op != OpPPC64SRAWconst {
9404                         break
9405                 }
9406                 c := auxIntToInt64(v_0.AuxInt)
9407                 v_0_0 := v_0.Args[0]
9408                 if v_0_0.Op != OpPPC64MOVBreg {
9409                         break
9410                 }
9411                 x := v_0_0.Args[0]
9412                 v.reset(OpPPC64SRAWconst)
9413                 v.AuxInt = int64ToAuxInt(c)
9414                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
9415                 v0.AddArg(x)
9416                 v.AddArg(v0)
9417                 return true
9418         }
9419         // match: (MOVHreg (SRAWconst [c] (MOVHreg x)))
9420         // result: (SRAWconst [c] (MOVHreg x))
9421         for {
9422                 if v_0.Op != OpPPC64SRAWconst {
9423                         break
9424                 }
9425                 c := auxIntToInt64(v_0.AuxInt)
9426                 v_0_0 := v_0.Args[0]
9427                 if v_0_0.Op != OpPPC64MOVHreg {
9428                         break
9429                 }
9430                 x := v_0_0.Args[0]
9431                 v.reset(OpPPC64SRAWconst)
9432                 v.AuxInt = int64ToAuxInt(c)
9433                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
9434                 v0.AddArg(x)
9435                 v.AddArg(v0)
9436                 return true
9437         }
9438         // match: (MOVHreg (SRAWconst [c] x))
9439         // cond: sizeof(x.Type) <= 16
9440         // result: (SRAWconst [c] x)
9441         for {
9442                 if v_0.Op != OpPPC64SRAWconst {
9443                         break
9444                 }
9445                 c := auxIntToInt64(v_0.AuxInt)
9446                 x := v_0.Args[0]
9447                 if !(sizeof(x.Type) <= 16) {
9448                         break
9449                 }
9450                 v.reset(OpPPC64SRAWconst)
9451                 v.AuxInt = int64ToAuxInt(c)
9452                 v.AddArg(x)
9453                 return true
9454         }
9455         // match: (MOVHreg (SRDconst [c] x))
9456         // cond: c>48
9457         // result: (SRDconst [c] x)
9458         for {
9459                 if v_0.Op != OpPPC64SRDconst {
9460                         break
9461                 }
9462                 c := auxIntToInt64(v_0.AuxInt)
9463                 x := v_0.Args[0]
9464                 if !(c > 48) {
9465                         break
9466                 }
9467                 v.reset(OpPPC64SRDconst)
9468                 v.AuxInt = int64ToAuxInt(c)
9469                 v.AddArg(x)
9470                 return true
9471         }
9472         // match: (MOVHreg (SRDconst [c] x))
9473         // cond: c==48
9474         // result: (SRADconst [c] x)
9475         for {
9476                 if v_0.Op != OpPPC64SRDconst {
9477                         break
9478                 }
9479                 c := auxIntToInt64(v_0.AuxInt)
9480                 x := v_0.Args[0]
9481                 if !(c == 48) {
9482                         break
9483                 }
9484                 v.reset(OpPPC64SRADconst)
9485                 v.AuxInt = int64ToAuxInt(c)
9486                 v.AddArg(x)
9487                 return true
9488         }
9489         // match: (MOVHreg (SRADconst [c] x))
9490         // cond: c>=48
9491         // result: (SRADconst [c] x)
9492         for {
9493                 if v_0.Op != OpPPC64SRADconst {
9494                         break
9495                 }
9496                 c := auxIntToInt64(v_0.AuxInt)
9497                 x := v_0.Args[0]
9498                 if !(c >= 48) {
9499                         break
9500                 }
9501                 v.reset(OpPPC64SRADconst)
9502                 v.AuxInt = int64ToAuxInt(c)
9503                 v.AddArg(x)
9504                 return true
9505         }
9506         // match: (MOVHreg (SRWconst [c] x))
9507         // cond: c>16
9508         // result: (SRWconst [c] x)
9509         for {
9510                 if v_0.Op != OpPPC64SRWconst {
9511                         break
9512                 }
9513                 c := auxIntToInt64(v_0.AuxInt)
9514                 x := v_0.Args[0]
9515                 if !(c > 16) {
9516                         break
9517                 }
9518                 v.reset(OpPPC64SRWconst)
9519                 v.AuxInt = int64ToAuxInt(c)
9520                 v.AddArg(x)
9521                 return true
9522         }
9523         // match: (MOVHreg (SRAWconst [c] x))
9524         // cond: c>=16
9525         // result: (SRAWconst [c] x)
9526         for {
9527                 if v_0.Op != OpPPC64SRAWconst {
9528                         break
9529                 }
9530                 c := auxIntToInt64(v_0.AuxInt)
9531                 x := v_0.Args[0]
9532                 if !(c >= 16) {
9533                         break
9534                 }
9535                 v.reset(OpPPC64SRAWconst)
9536                 v.AuxInt = int64ToAuxInt(c)
9537                 v.AddArg(x)
9538                 return true
9539         }
9540         // match: (MOVHreg (SRWconst [c] x))
9541         // cond: c==16
9542         // result: (SRAWconst [c] x)
9543         for {
9544                 if v_0.Op != OpPPC64SRWconst {
9545                         break
9546                 }
9547                 c := auxIntToInt64(v_0.AuxInt)
9548                 x := v_0.Args[0]
9549                 if !(c == 16) {
9550                         break
9551                 }
9552                 v.reset(OpPPC64SRAWconst)
9553                 v.AuxInt = int64ToAuxInt(c)
9554                 v.AddArg(x)
9555                 return true
9556         }
9557         // match: (MOVHreg y:(MOVHreg _))
9558         // result: y
9559         for {
9560                 y := v_0
9561                 if y.Op != OpPPC64MOVHreg {
9562                         break
9563                 }
9564                 v.copyOf(y)
9565                 return true
9566         }
9567         // match: (MOVHreg y:(MOVBreg _))
9568         // result: y
9569         for {
9570                 y := v_0
9571                 if y.Op != OpPPC64MOVBreg {
9572                         break
9573                 }
9574                 v.copyOf(y)
9575                 return true
9576         }
9577         // match: (MOVHreg y:(MOVHZreg x))
9578         // result: (MOVHreg x)
9579         for {
9580                 y := v_0
9581                 if y.Op != OpPPC64MOVHZreg {
9582                         break
9583                 }
9584                 x := y.Args[0]
9585                 v.reset(OpPPC64MOVHreg)
9586                 v.AddArg(x)
9587                 return true
9588         }
9589         // match: (MOVHreg x:(MOVHload _ _))
9590         // result: x
9591         for {
9592                 x := v_0
9593                 if x.Op != OpPPC64MOVHload {
9594                         break
9595                 }
9596                 v.copyOf(x)
9597                 return true
9598         }
9599         // match: (MOVHreg x:(MOVHloadidx _ _ _))
9600         // result: x
9601         for {
9602                 x := v_0
9603                 if x.Op != OpPPC64MOVHloadidx {
9604                         break
9605                 }
9606                 v.copyOf(x)
9607                 return true
9608         }
9609         // match: (MOVHreg x:(Arg <t>))
9610         // cond: (is8BitInt(t) || is16BitInt(t)) && isSigned(t)
9611         // result: x
9612         for {
9613                 x := v_0
9614                 if x.Op != OpArg {
9615                         break
9616                 }
9617                 t := x.Type
9618                 if !((is8BitInt(t) || is16BitInt(t)) && isSigned(t)) {
9619                         break
9620                 }
9621                 v.copyOf(x)
9622                 return true
9623         }
9624         // match: (MOVHreg (MOVDconst [c]))
9625         // result: (MOVDconst [int64(int16(c))])
9626         for {
9627                 if v_0.Op != OpPPC64MOVDconst {
9628                         break
9629                 }
9630                 c := auxIntToInt64(v_0.AuxInt)
9631                 v.reset(OpPPC64MOVDconst)
9632                 v.AuxInt = int64ToAuxInt(int64(int16(c)))
9633                 return true
9634         }
9635         return false
9636 }
9637 func rewriteValuePPC64_OpPPC64MOVHstore(v *Value) bool {
9638         v_2 := v.Args[2]
9639         v_1 := v.Args[1]
9640         v_0 := v.Args[0]
9641         b := v.Block
9642         config := b.Func.Config
9643         // match: (MOVHstore [off1] {sym} (ADDconst [off2] x) val mem)
9644         // cond: is16Bit(int64(off1)+off2)
9645         // result: (MOVHstore [off1+int32(off2)] {sym} x val mem)
9646         for {
9647                 off1 := auxIntToInt32(v.AuxInt)
9648                 sym := auxToSym(v.Aux)
9649                 if v_0.Op != OpPPC64ADDconst {
9650                         break
9651                 }
9652                 off2 := auxIntToInt64(v_0.AuxInt)
9653                 x := v_0.Args[0]
9654                 val := v_1
9655                 mem := v_2
9656                 if !(is16Bit(int64(off1) + off2)) {
9657                         break
9658                 }
9659                 v.reset(OpPPC64MOVHstore)
9660                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9661                 v.Aux = symToAux(sym)
9662                 v.AddArg3(x, val, mem)
9663                 return true
9664         }
9665         // match: (MOVHstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
9666         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
9667         // result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
9668         for {
9669                 off1 := auxIntToInt32(v.AuxInt)
9670                 sym1 := auxToSym(v.Aux)
9671                 p := v_0
9672                 if p.Op != OpPPC64MOVDaddr {
9673                         break
9674                 }
9675                 off2 := auxIntToInt32(p.AuxInt)
9676                 sym2 := auxToSym(p.Aux)
9677                 ptr := p.Args[0]
9678                 val := v_1
9679                 mem := v_2
9680                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
9681                         break
9682                 }
9683                 v.reset(OpPPC64MOVHstore)
9684                 v.AuxInt = int32ToAuxInt(off1 + off2)
9685                 v.Aux = symToAux(mergeSym(sym1, sym2))
9686                 v.AddArg3(ptr, val, mem)
9687                 return true
9688         }
9689         // match: (MOVHstore [off] {sym} ptr (MOVDconst [0]) mem)
9690         // result: (MOVHstorezero [off] {sym} ptr mem)
9691         for {
9692                 off := auxIntToInt32(v.AuxInt)
9693                 sym := auxToSym(v.Aux)
9694                 ptr := v_0
9695                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
9696                         break
9697                 }
9698                 mem := v_2
9699                 v.reset(OpPPC64MOVHstorezero)
9700                 v.AuxInt = int32ToAuxInt(off)
9701                 v.Aux = symToAux(sym)
9702                 v.AddArg2(ptr, mem)
9703                 return true
9704         }
9705         // match: (MOVHstore [0] {sym} p:(ADD ptr idx) val mem)
9706         // cond: sym == nil && p.Uses == 1
9707         // result: (MOVHstoreidx ptr idx val mem)
9708         for {
9709                 if auxIntToInt32(v.AuxInt) != 0 {
9710                         break
9711                 }
9712                 sym := auxToSym(v.Aux)
9713                 p := v_0
9714                 if p.Op != OpPPC64ADD {
9715                         break
9716                 }
9717                 idx := p.Args[1]
9718                 ptr := p.Args[0]
9719                 val := v_1
9720                 mem := v_2
9721                 if !(sym == nil && p.Uses == 1) {
9722                         break
9723                 }
9724                 v.reset(OpPPC64MOVHstoreidx)
9725                 v.AddArg4(ptr, idx, val, mem)
9726                 return true
9727         }
9728         // match: (MOVHstore [off] {sym} ptr (MOVHreg x) mem)
9729         // result: (MOVHstore [off] {sym} ptr x mem)
9730         for {
9731                 off := auxIntToInt32(v.AuxInt)
9732                 sym := auxToSym(v.Aux)
9733                 ptr := v_0
9734                 if v_1.Op != OpPPC64MOVHreg {
9735                         break
9736                 }
9737                 x := v_1.Args[0]
9738                 mem := v_2
9739                 v.reset(OpPPC64MOVHstore)
9740                 v.AuxInt = int32ToAuxInt(off)
9741                 v.Aux = symToAux(sym)
9742                 v.AddArg3(ptr, x, mem)
9743                 return true
9744         }
9745         // match: (MOVHstore [off] {sym} ptr (MOVHZreg x) mem)
9746         // result: (MOVHstore [off] {sym} ptr x mem)
9747         for {
9748                 off := auxIntToInt32(v.AuxInt)
9749                 sym := auxToSym(v.Aux)
9750                 ptr := v_0
9751                 if v_1.Op != OpPPC64MOVHZreg {
9752                         break
9753                 }
9754                 x := v_1.Args[0]
9755                 mem := v_2
9756                 v.reset(OpPPC64MOVHstore)
9757                 v.AuxInt = int32ToAuxInt(off)
9758                 v.Aux = symToAux(sym)
9759                 v.AddArg3(ptr, x, mem)
9760                 return true
9761         }
9762         // match: (MOVHstore [off] {sym} ptr (MOVWreg x) mem)
9763         // result: (MOVHstore [off] {sym} ptr x mem)
9764         for {
9765                 off := auxIntToInt32(v.AuxInt)
9766                 sym := auxToSym(v.Aux)
9767                 ptr := v_0
9768                 if v_1.Op != OpPPC64MOVWreg {
9769                         break
9770                 }
9771                 x := v_1.Args[0]
9772                 mem := v_2
9773                 v.reset(OpPPC64MOVHstore)
9774                 v.AuxInt = int32ToAuxInt(off)
9775                 v.Aux = symToAux(sym)
9776                 v.AddArg3(ptr, x, mem)
9777                 return true
9778         }
9779         // match: (MOVHstore [off] {sym} ptr (MOVWZreg x) mem)
9780         // result: (MOVHstore [off] {sym} ptr x mem)
9781         for {
9782                 off := auxIntToInt32(v.AuxInt)
9783                 sym := auxToSym(v.Aux)
9784                 ptr := v_0
9785                 if v_1.Op != OpPPC64MOVWZreg {
9786                         break
9787                 }
9788                 x := v_1.Args[0]
9789                 mem := v_2
9790                 v.reset(OpPPC64MOVHstore)
9791                 v.AuxInt = int32ToAuxInt(off)
9792                 v.Aux = symToAux(sym)
9793                 v.AddArg3(ptr, x, mem)
9794                 return true
9795         }
9796         // match: (MOVHstore [i1] {s} p (SRWconst w [16]) x0:(MOVHstore [i0] {s} p w mem))
9797         // cond: !config.BigEndian && x0.Uses == 1 && i1 == i0+2 && clobber(x0)
9798         // result: (MOVWstore [i0] {s} p w mem)
9799         for {
9800                 i1 := auxIntToInt32(v.AuxInt)
9801                 s := auxToSym(v.Aux)
9802                 p := v_0
9803                 if v_1.Op != OpPPC64SRWconst || auxIntToInt64(v_1.AuxInt) != 16 {
9804                         break
9805                 }
9806                 w := v_1.Args[0]
9807                 x0 := v_2
9808                 if x0.Op != OpPPC64MOVHstore {
9809                         break
9810                 }
9811                 i0 := auxIntToInt32(x0.AuxInt)
9812                 if auxToSym(x0.Aux) != s {
9813                         break
9814                 }
9815                 mem := x0.Args[2]
9816                 if p != x0.Args[0] || w != x0.Args[1] || !(!config.BigEndian && x0.Uses == 1 && i1 == i0+2 && clobber(x0)) {
9817                         break
9818                 }
9819                 v.reset(OpPPC64MOVWstore)
9820                 v.AuxInt = int32ToAuxInt(i0)
9821                 v.Aux = symToAux(s)
9822                 v.AddArg3(p, w, mem)
9823                 return true
9824         }
9825         // match: (MOVHstore [i1] {s} p (SRDconst w [16]) x0:(MOVHstore [i0] {s} p w mem))
9826         // cond: !config.BigEndian && x0.Uses == 1 && i1 == i0+2 && clobber(x0)
9827         // result: (MOVWstore [i0] {s} p w mem)
9828         for {
9829                 i1 := auxIntToInt32(v.AuxInt)
9830                 s := auxToSym(v.Aux)
9831                 p := v_0
9832                 if v_1.Op != OpPPC64SRDconst || auxIntToInt64(v_1.AuxInt) != 16 {
9833                         break
9834                 }
9835                 w := v_1.Args[0]
9836                 x0 := v_2
9837                 if x0.Op != OpPPC64MOVHstore {
9838                         break
9839                 }
9840                 i0 := auxIntToInt32(x0.AuxInt)
9841                 if auxToSym(x0.Aux) != s {
9842                         break
9843                 }
9844                 mem := x0.Args[2]
9845                 if p != x0.Args[0] || w != x0.Args[1] || !(!config.BigEndian && x0.Uses == 1 && i1 == i0+2 && clobber(x0)) {
9846                         break
9847                 }
9848                 v.reset(OpPPC64MOVWstore)
9849                 v.AuxInt = int32ToAuxInt(i0)
9850                 v.Aux = symToAux(s)
9851                 v.AddArg3(p, w, mem)
9852                 return true
9853         }
9854         return false
9855 }
9856 func rewriteValuePPC64_OpPPC64MOVHstoreidx(v *Value) bool {
9857         v_3 := v.Args[3]
9858         v_2 := v.Args[2]
9859         v_1 := v.Args[1]
9860         v_0 := v.Args[0]
9861         // match: (MOVHstoreidx ptr (MOVDconst [c]) val mem)
9862         // cond: is16Bit(c)
9863         // result: (MOVHstore [int32(c)] ptr val mem)
9864         for {
9865                 ptr := v_0
9866                 if v_1.Op != OpPPC64MOVDconst {
9867                         break
9868                 }
9869                 c := auxIntToInt64(v_1.AuxInt)
9870                 val := v_2
9871                 mem := v_3
9872                 if !(is16Bit(c)) {
9873                         break
9874                 }
9875                 v.reset(OpPPC64MOVHstore)
9876                 v.AuxInt = int32ToAuxInt(int32(c))
9877                 v.AddArg3(ptr, val, mem)
9878                 return true
9879         }
9880         // match: (MOVHstoreidx (MOVDconst [c]) ptr val mem)
9881         // cond: is16Bit(c)
9882         // result: (MOVHstore [int32(c)] ptr val mem)
9883         for {
9884                 if v_0.Op != OpPPC64MOVDconst {
9885                         break
9886                 }
9887                 c := auxIntToInt64(v_0.AuxInt)
9888                 ptr := v_1
9889                 val := v_2
9890                 mem := v_3
9891                 if !(is16Bit(c)) {
9892                         break
9893                 }
9894                 v.reset(OpPPC64MOVHstore)
9895                 v.AuxInt = int32ToAuxInt(int32(c))
9896                 v.AddArg3(ptr, val, mem)
9897                 return true
9898         }
9899         // match: (MOVHstoreidx ptr idx (MOVHreg x) mem)
9900         // result: (MOVHstoreidx ptr idx x mem)
9901         for {
9902                 ptr := v_0
9903                 idx := v_1
9904                 if v_2.Op != OpPPC64MOVHreg {
9905                         break
9906                 }
9907                 x := v_2.Args[0]
9908                 mem := v_3
9909                 v.reset(OpPPC64MOVHstoreidx)
9910                 v.AddArg4(ptr, idx, x, mem)
9911                 return true
9912         }
9913         // match: (MOVHstoreidx ptr idx (MOVHZreg x) mem)
9914         // result: (MOVHstoreidx ptr idx x mem)
9915         for {
9916                 ptr := v_0
9917                 idx := v_1
9918                 if v_2.Op != OpPPC64MOVHZreg {
9919                         break
9920                 }
9921                 x := v_2.Args[0]
9922                 mem := v_3
9923                 v.reset(OpPPC64MOVHstoreidx)
9924                 v.AddArg4(ptr, idx, x, mem)
9925                 return true
9926         }
9927         // match: (MOVHstoreidx ptr idx (MOVWreg x) mem)
9928         // result: (MOVHstoreidx ptr idx x mem)
9929         for {
9930                 ptr := v_0
9931                 idx := v_1
9932                 if v_2.Op != OpPPC64MOVWreg {
9933                         break
9934                 }
9935                 x := v_2.Args[0]
9936                 mem := v_3
9937                 v.reset(OpPPC64MOVHstoreidx)
9938                 v.AddArg4(ptr, idx, x, mem)
9939                 return true
9940         }
9941         // match: (MOVHstoreidx ptr idx (MOVWZreg x) mem)
9942         // result: (MOVHstoreidx ptr idx x mem)
9943         for {
9944                 ptr := v_0
9945                 idx := v_1
9946                 if v_2.Op != OpPPC64MOVWZreg {
9947                         break
9948                 }
9949                 x := v_2.Args[0]
9950                 mem := v_3
9951                 v.reset(OpPPC64MOVHstoreidx)
9952                 v.AddArg4(ptr, idx, x, mem)
9953                 return true
9954         }
9955         return false
9956 }
9957 func rewriteValuePPC64_OpPPC64MOVHstorezero(v *Value) bool {
9958         v_1 := v.Args[1]
9959         v_0 := v.Args[0]
9960         // match: (MOVHstorezero [off1] {sym} (ADDconst [off2] x) mem)
9961         // cond: is16Bit(int64(off1)+off2)
9962         // result: (MOVHstorezero [off1+int32(off2)] {sym} x mem)
9963         for {
9964                 off1 := auxIntToInt32(v.AuxInt)
9965                 sym := auxToSym(v.Aux)
9966                 if v_0.Op != OpPPC64ADDconst {
9967                         break
9968                 }
9969                 off2 := auxIntToInt64(v_0.AuxInt)
9970                 x := v_0.Args[0]
9971                 mem := v_1
9972                 if !(is16Bit(int64(off1) + off2)) {
9973                         break
9974                 }
9975                 v.reset(OpPPC64MOVHstorezero)
9976                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9977                 v.Aux = symToAux(sym)
9978                 v.AddArg2(x, mem)
9979                 return true
9980         }
9981         // match: (MOVHstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
9982         // cond: canMergeSym(sym1,sym2) && (x.Op != OpSB || p.Uses == 1)
9983         // result: (MOVHstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
9984         for {
9985                 off1 := auxIntToInt32(v.AuxInt)
9986                 sym1 := auxToSym(v.Aux)
9987                 p := v_0
9988                 if p.Op != OpPPC64MOVDaddr {
9989                         break
9990                 }
9991                 off2 := auxIntToInt32(p.AuxInt)
9992                 sym2 := auxToSym(p.Aux)
9993                 x := p.Args[0]
9994                 mem := v_1
9995                 if !(canMergeSym(sym1, sym2) && (x.Op != OpSB || p.Uses == 1)) {
9996                         break
9997                 }
9998                 v.reset(OpPPC64MOVHstorezero)
9999                 v.AuxInt = int32ToAuxInt(off1 + off2)
10000                 v.Aux = symToAux(mergeSym(sym1, sym2))
10001                 v.AddArg2(x, mem)
10002                 return true
10003         }
10004         return false
10005 }
10006 func rewriteValuePPC64_OpPPC64MOVWBRstore(v *Value) bool {
10007         v_2 := v.Args[2]
10008         v_1 := v.Args[1]
10009         v_0 := v.Args[0]
10010         // match: (MOVWBRstore {sym} ptr (MOVWreg x) mem)
10011         // result: (MOVWBRstore {sym} ptr x mem)
10012         for {
10013                 sym := auxToSym(v.Aux)
10014                 ptr := v_0
10015                 if v_1.Op != OpPPC64MOVWreg {
10016                         break
10017                 }
10018                 x := v_1.Args[0]
10019                 mem := v_2
10020                 v.reset(OpPPC64MOVWBRstore)
10021                 v.Aux = symToAux(sym)
10022                 v.AddArg3(ptr, x, mem)
10023                 return true
10024         }
10025         // match: (MOVWBRstore {sym} ptr (MOVWZreg x) mem)
10026         // result: (MOVWBRstore {sym} ptr x mem)
10027         for {
10028                 sym := auxToSym(v.Aux)
10029                 ptr := v_0
10030                 if v_1.Op != OpPPC64MOVWZreg {
10031                         break
10032                 }
10033                 x := v_1.Args[0]
10034                 mem := v_2
10035                 v.reset(OpPPC64MOVWBRstore)
10036                 v.Aux = symToAux(sym)
10037                 v.AddArg3(ptr, x, mem)
10038                 return true
10039         }
10040         return false
10041 }
10042 func rewriteValuePPC64_OpPPC64MOVWZload(v *Value) bool {
10043         v_1 := v.Args[1]
10044         v_0 := v.Args[0]
10045         // match: (MOVWZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
10046         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
10047         // result: (MOVWZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
10048         for {
10049                 off1 := auxIntToInt32(v.AuxInt)
10050                 sym1 := auxToSym(v.Aux)
10051                 p := v_0
10052                 if p.Op != OpPPC64MOVDaddr {
10053                         break
10054                 }
10055                 off2 := auxIntToInt32(p.AuxInt)
10056                 sym2 := auxToSym(p.Aux)
10057                 ptr := p.Args[0]
10058                 mem := v_1
10059                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
10060                         break
10061                 }
10062                 v.reset(OpPPC64MOVWZload)
10063                 v.AuxInt = int32ToAuxInt(off1 + off2)
10064                 v.Aux = symToAux(mergeSym(sym1, sym2))
10065                 v.AddArg2(ptr, mem)
10066                 return true
10067         }
10068         // match: (MOVWZload [off1] {sym} (ADDconst [off2] x) mem)
10069         // cond: is16Bit(int64(off1)+off2)
10070         // result: (MOVWZload [off1+int32(off2)] {sym} x mem)
10071         for {
10072                 off1 := auxIntToInt32(v.AuxInt)
10073                 sym := auxToSym(v.Aux)
10074                 if v_0.Op != OpPPC64ADDconst {
10075                         break
10076                 }
10077                 off2 := auxIntToInt64(v_0.AuxInt)
10078                 x := v_0.Args[0]
10079                 mem := v_1
10080                 if !(is16Bit(int64(off1) + off2)) {
10081                         break
10082                 }
10083                 v.reset(OpPPC64MOVWZload)
10084                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10085                 v.Aux = symToAux(sym)
10086                 v.AddArg2(x, mem)
10087                 return true
10088         }
10089         // match: (MOVWZload [0] {sym} p:(ADD ptr idx) mem)
10090         // cond: sym == nil && p.Uses == 1
10091         // result: (MOVWZloadidx ptr idx mem)
10092         for {
10093                 if auxIntToInt32(v.AuxInt) != 0 {
10094                         break
10095                 }
10096                 sym := auxToSym(v.Aux)
10097                 p := v_0
10098                 if p.Op != OpPPC64ADD {
10099                         break
10100                 }
10101                 idx := p.Args[1]
10102                 ptr := p.Args[0]
10103                 mem := v_1
10104                 if !(sym == nil && p.Uses == 1) {
10105                         break
10106                 }
10107                 v.reset(OpPPC64MOVWZloadidx)
10108                 v.AddArg3(ptr, idx, mem)
10109                 return true
10110         }
10111         return false
10112 }
10113 func rewriteValuePPC64_OpPPC64MOVWZloadidx(v *Value) bool {
10114         v_2 := v.Args[2]
10115         v_1 := v.Args[1]
10116         v_0 := v.Args[0]
10117         // match: (MOVWZloadidx ptr (MOVDconst [c]) mem)
10118         // cond: is16Bit(c)
10119         // result: (MOVWZload [int32(c)] ptr mem)
10120         for {
10121                 ptr := v_0
10122                 if v_1.Op != OpPPC64MOVDconst {
10123                         break
10124                 }
10125                 c := auxIntToInt64(v_1.AuxInt)
10126                 mem := v_2
10127                 if !(is16Bit(c)) {
10128                         break
10129                 }
10130                 v.reset(OpPPC64MOVWZload)
10131                 v.AuxInt = int32ToAuxInt(int32(c))
10132                 v.AddArg2(ptr, mem)
10133                 return true
10134         }
10135         // match: (MOVWZloadidx (MOVDconst [c]) ptr mem)
10136         // cond: is16Bit(c)
10137         // result: (MOVWZload [int32(c)] ptr mem)
10138         for {
10139                 if v_0.Op != OpPPC64MOVDconst {
10140                         break
10141                 }
10142                 c := auxIntToInt64(v_0.AuxInt)
10143                 ptr := v_1
10144                 mem := v_2
10145                 if !(is16Bit(c)) {
10146                         break
10147                 }
10148                 v.reset(OpPPC64MOVWZload)
10149                 v.AuxInt = int32ToAuxInt(int32(c))
10150                 v.AddArg2(ptr, mem)
10151                 return true
10152         }
10153         return false
10154 }
10155 func rewriteValuePPC64_OpPPC64MOVWZreg(v *Value) bool {
10156         v_0 := v.Args[0]
10157         b := v.Block
10158         typ := &b.Func.Config.Types
10159         // match: (MOVWZreg y:(ANDconst [c] _))
10160         // cond: uint64(c) <= 0xFFFFFFFF
10161         // result: y
10162         for {
10163                 y := v_0
10164                 if y.Op != OpPPC64ANDconst {
10165                         break
10166                 }
10167                 c := auxIntToInt64(y.AuxInt)
10168                 if !(uint64(c) <= 0xFFFFFFFF) {
10169                         break
10170                 }
10171                 v.copyOf(y)
10172                 return true
10173         }
10174         // match: (MOVWZreg y:(AND (MOVDconst [c]) _))
10175         // cond: uint64(c) <= 0xFFFFFFFF
10176         // result: y
10177         for {
10178                 y := v_0
10179                 if y.Op != OpPPC64AND {
10180                         break
10181                 }
10182                 y_0 := y.Args[0]
10183                 y_1 := y.Args[1]
10184                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
10185                         if y_0.Op != OpPPC64MOVDconst {
10186                                 continue
10187                         }
10188                         c := auxIntToInt64(y_0.AuxInt)
10189                         if !(uint64(c) <= 0xFFFFFFFF) {
10190                                 continue
10191                         }
10192                         v.copyOf(y)
10193                         return true
10194                 }
10195                 break
10196         }
10197         // match: (MOVWZreg (SRWconst [c] (MOVBZreg x)))
10198         // result: (SRWconst [c] (MOVBZreg x))
10199         for {
10200                 if v_0.Op != OpPPC64SRWconst {
10201                         break
10202                 }
10203                 c := auxIntToInt64(v_0.AuxInt)
10204                 v_0_0 := v_0.Args[0]
10205                 if v_0_0.Op != OpPPC64MOVBZreg {
10206                         break
10207                 }
10208                 x := v_0_0.Args[0]
10209                 v.reset(OpPPC64SRWconst)
10210                 v.AuxInt = int64ToAuxInt(c)
10211                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
10212                 v0.AddArg(x)
10213                 v.AddArg(v0)
10214                 return true
10215         }
10216         // match: (MOVWZreg (SRWconst [c] (MOVHZreg x)))
10217         // result: (SRWconst [c] (MOVHZreg x))
10218         for {
10219                 if v_0.Op != OpPPC64SRWconst {
10220                         break
10221                 }
10222                 c := auxIntToInt64(v_0.AuxInt)
10223                 v_0_0 := v_0.Args[0]
10224                 if v_0_0.Op != OpPPC64MOVHZreg {
10225                         break
10226                 }
10227                 x := v_0_0.Args[0]
10228                 v.reset(OpPPC64SRWconst)
10229                 v.AuxInt = int64ToAuxInt(c)
10230                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
10231                 v0.AddArg(x)
10232                 v.AddArg(v0)
10233                 return true
10234         }
10235         // match: (MOVWZreg (SRWconst [c] (MOVWZreg x)))
10236         // result: (SRWconst [c] (MOVWZreg x))
10237         for {
10238                 if v_0.Op != OpPPC64SRWconst {
10239                         break
10240                 }
10241                 c := auxIntToInt64(v_0.AuxInt)
10242                 v_0_0 := v_0.Args[0]
10243                 if v_0_0.Op != OpPPC64MOVWZreg {
10244                         break
10245                 }
10246                 x := v_0_0.Args[0]
10247                 v.reset(OpPPC64SRWconst)
10248                 v.AuxInt = int64ToAuxInt(c)
10249                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
10250                 v0.AddArg(x)
10251                 v.AddArg(v0)
10252                 return true
10253         }
10254         // match: (MOVWZreg (SRWconst [c] x))
10255         // cond: sizeof(x.Type) <= 32
10256         // result: (SRWconst [c] x)
10257         for {
10258                 if v_0.Op != OpPPC64SRWconst {
10259                         break
10260                 }
10261                 c := auxIntToInt64(v_0.AuxInt)
10262                 x := v_0.Args[0]
10263                 if !(sizeof(x.Type) <= 32) {
10264                         break
10265                 }
10266                 v.reset(OpPPC64SRWconst)
10267                 v.AuxInt = int64ToAuxInt(c)
10268                 v.AddArg(x)
10269                 return true
10270         }
10271         // match: (MOVWZreg (SRDconst [c] x))
10272         // cond: c>=32
10273         // result: (SRDconst [c] x)
10274         for {
10275                 if v_0.Op != OpPPC64SRDconst {
10276                         break
10277                 }
10278                 c := auxIntToInt64(v_0.AuxInt)
10279                 x := v_0.Args[0]
10280                 if !(c >= 32) {
10281                         break
10282                 }
10283                 v.reset(OpPPC64SRDconst)
10284                 v.AuxInt = int64ToAuxInt(c)
10285                 v.AddArg(x)
10286                 return true
10287         }
10288         // match: (MOVWZreg y:(MOVWZreg _))
10289         // result: y
10290         for {
10291                 y := v_0
10292                 if y.Op != OpPPC64MOVWZreg {
10293                         break
10294                 }
10295                 v.copyOf(y)
10296                 return true
10297         }
10298         // match: (MOVWZreg y:(MOVHZreg _))
10299         // result: y
10300         for {
10301                 y := v_0
10302                 if y.Op != OpPPC64MOVHZreg {
10303                         break
10304                 }
10305                 v.copyOf(y)
10306                 return true
10307         }
10308         // match: (MOVWZreg y:(MOVBZreg _))
10309         // result: y
10310         for {
10311                 y := v_0
10312                 if y.Op != OpPPC64MOVBZreg {
10313                         break
10314                 }
10315                 v.copyOf(y)
10316                 return true
10317         }
10318         // match: (MOVWZreg y:(MOVHBRload _ _))
10319         // result: y
10320         for {
10321                 y := v_0
10322                 if y.Op != OpPPC64MOVHBRload {
10323                         break
10324                 }
10325                 v.copyOf(y)
10326                 return true
10327         }
10328         // match: (MOVWZreg y:(MOVWBRload _ _))
10329         // result: y
10330         for {
10331                 y := v_0
10332                 if y.Op != OpPPC64MOVWBRload {
10333                         break
10334                 }
10335                 v.copyOf(y)
10336                 return true
10337         }
10338         // match: (MOVWZreg y:(MOVWreg x))
10339         // result: (MOVWZreg x)
10340         for {
10341                 y := v_0
10342                 if y.Op != OpPPC64MOVWreg {
10343                         break
10344                 }
10345                 x := y.Args[0]
10346                 v.reset(OpPPC64MOVWZreg)
10347                 v.AddArg(x)
10348                 return true
10349         }
10350         // match: (MOVWZreg (OR <t> x (MOVWZreg y)))
10351         // result: (MOVWZreg (OR <t> x y))
10352         for {
10353                 if v_0.Op != OpPPC64OR {
10354                         break
10355                 }
10356                 t := v_0.Type
10357                 _ = v_0.Args[1]
10358                 v_0_0 := v_0.Args[0]
10359                 v_0_1 := v_0.Args[1]
10360                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
10361                         x := v_0_0
10362                         if v_0_1.Op != OpPPC64MOVWZreg {
10363                                 continue
10364                         }
10365                         y := v_0_1.Args[0]
10366                         v.reset(OpPPC64MOVWZreg)
10367                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
10368                         v0.AddArg2(x, y)
10369                         v.AddArg(v0)
10370                         return true
10371                 }
10372                 break
10373         }
10374         // match: (MOVWZreg (XOR <t> x (MOVWZreg y)))
10375         // result: (MOVWZreg (XOR <t> x y))
10376         for {
10377                 if v_0.Op != OpPPC64XOR {
10378                         break
10379                 }
10380                 t := v_0.Type
10381                 _ = v_0.Args[1]
10382                 v_0_0 := v_0.Args[0]
10383                 v_0_1 := v_0.Args[1]
10384                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
10385                         x := v_0_0
10386                         if v_0_1.Op != OpPPC64MOVWZreg {
10387                                 continue
10388                         }
10389                         y := v_0_1.Args[0]
10390                         v.reset(OpPPC64MOVWZreg)
10391                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
10392                         v0.AddArg2(x, y)
10393                         v.AddArg(v0)
10394                         return true
10395                 }
10396                 break
10397         }
10398         // match: (MOVWZreg (AND <t> x (MOVWZreg y)))
10399         // result: (MOVWZreg (AND <t> x y))
10400         for {
10401                 if v_0.Op != OpPPC64AND {
10402                         break
10403                 }
10404                 t := v_0.Type
10405                 _ = v_0.Args[1]
10406                 v_0_0 := v_0.Args[0]
10407                 v_0_1 := v_0.Args[1]
10408                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
10409                         x := v_0_0
10410                         if v_0_1.Op != OpPPC64MOVWZreg {
10411                                 continue
10412                         }
10413                         y := v_0_1.Args[0]
10414                         v.reset(OpPPC64MOVWZreg)
10415                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
10416                         v0.AddArg2(x, y)
10417                         v.AddArg(v0)
10418                         return true
10419                 }
10420                 break
10421         }
10422         // match: (MOVWZreg z:(ANDconst [c] (MOVBZload ptr x)))
10423         // result: z
10424         for {
10425                 z := v_0
10426                 if z.Op != OpPPC64ANDconst {
10427                         break
10428                 }
10429                 z_0 := z.Args[0]
10430                 if z_0.Op != OpPPC64MOVBZload {
10431                         break
10432                 }
10433                 v.copyOf(z)
10434                 return true
10435         }
10436         // match: (MOVWZreg z:(ANDconst [c] (MOVHZload ptr x)))
10437         // result: z
10438         for {
10439                 z := v_0
10440                 if z.Op != OpPPC64ANDconst {
10441                         break
10442                 }
10443                 z_0 := z.Args[0]
10444                 if z_0.Op != OpPPC64MOVHZload {
10445                         break
10446                 }
10447                 v.copyOf(z)
10448                 return true
10449         }
10450         // match: (MOVWZreg z:(ANDconst [c] (MOVWZload ptr x)))
10451         // result: z
10452         for {
10453                 z := v_0
10454                 if z.Op != OpPPC64ANDconst {
10455                         break
10456                 }
10457                 z_0 := z.Args[0]
10458                 if z_0.Op != OpPPC64MOVWZload {
10459                         break
10460                 }
10461                 v.copyOf(z)
10462                 return true
10463         }
10464         // match: (MOVWZreg z:(AND y (MOVWZload ptr x)))
10465         // result: z
10466         for {
10467                 z := v_0
10468                 if z.Op != OpPPC64AND {
10469                         break
10470                 }
10471                 _ = z.Args[1]
10472                 z_0 := z.Args[0]
10473                 z_1 := z.Args[1]
10474                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
10475                         if z_1.Op != OpPPC64MOVWZload {
10476                                 continue
10477                         }
10478                         v.copyOf(z)
10479                         return true
10480                 }
10481                 break
10482         }
10483         // match: (MOVWZreg x:(MOVBZload _ _))
10484         // result: x
10485         for {
10486                 x := v_0
10487                 if x.Op != OpPPC64MOVBZload {
10488                         break
10489                 }
10490                 v.copyOf(x)
10491                 return true
10492         }
10493         // match: (MOVWZreg x:(MOVBZloadidx _ _ _))
10494         // result: x
10495         for {
10496                 x := v_0
10497                 if x.Op != OpPPC64MOVBZloadidx {
10498                         break
10499                 }
10500                 v.copyOf(x)
10501                 return true
10502         }
10503         // match: (MOVWZreg x:(MOVHZload _ _))
10504         // result: x
10505         for {
10506                 x := v_0
10507                 if x.Op != OpPPC64MOVHZload {
10508                         break
10509                 }
10510                 v.copyOf(x)
10511                 return true
10512         }
10513         // match: (MOVWZreg x:(MOVHZloadidx _ _ _))
10514         // result: x
10515         for {
10516                 x := v_0
10517                 if x.Op != OpPPC64MOVHZloadidx {
10518                         break
10519                 }
10520                 v.copyOf(x)
10521                 return true
10522         }
10523         // match: (MOVWZreg x:(MOVWZload _ _))
10524         // result: x
10525         for {
10526                 x := v_0
10527                 if x.Op != OpPPC64MOVWZload {
10528                         break
10529                 }
10530                 v.copyOf(x)
10531                 return true
10532         }
10533         // match: (MOVWZreg x:(MOVWZloadidx _ _ _))
10534         // result: x
10535         for {
10536                 x := v_0
10537                 if x.Op != OpPPC64MOVWZloadidx {
10538                         break
10539                 }
10540                 v.copyOf(x)
10541                 return true
10542         }
10543         // match: (MOVWZreg x:(Arg <t>))
10544         // cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !isSigned(t)
10545         // result: x
10546         for {
10547                 x := v_0
10548                 if x.Op != OpArg {
10549                         break
10550                 }
10551                 t := x.Type
10552                 if !((is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !isSigned(t)) {
10553                         break
10554                 }
10555                 v.copyOf(x)
10556                 return true
10557         }
10558         // match: (MOVWZreg (MOVDconst [c]))
10559         // result: (MOVDconst [int64(uint32(c))])
10560         for {
10561                 if v_0.Op != OpPPC64MOVDconst {
10562                         break
10563                 }
10564                 c := auxIntToInt64(v_0.AuxInt)
10565                 v.reset(OpPPC64MOVDconst)
10566                 v.AuxInt = int64ToAuxInt(int64(uint32(c)))
10567                 return true
10568         }
10569         return false
10570 }
10571 func rewriteValuePPC64_OpPPC64MOVWload(v *Value) bool {
10572         v_1 := v.Args[1]
10573         v_0 := v.Args[0]
10574         // match: (MOVWload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
10575         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
10576         // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
10577         for {
10578                 off1 := auxIntToInt32(v.AuxInt)
10579                 sym1 := auxToSym(v.Aux)
10580                 p := v_0
10581                 if p.Op != OpPPC64MOVDaddr {
10582                         break
10583                 }
10584                 off2 := auxIntToInt32(p.AuxInt)
10585                 sym2 := auxToSym(p.Aux)
10586                 ptr := p.Args[0]
10587                 mem := v_1
10588                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
10589                         break
10590                 }
10591                 v.reset(OpPPC64MOVWload)
10592                 v.AuxInt = int32ToAuxInt(off1 + off2)
10593                 v.Aux = symToAux(mergeSym(sym1, sym2))
10594                 v.AddArg2(ptr, mem)
10595                 return true
10596         }
10597         // match: (MOVWload [off1] {sym} (ADDconst [off2] x) mem)
10598         // cond: is16Bit(int64(off1)+off2)
10599         // result: (MOVWload [off1+int32(off2)] {sym} x mem)
10600         for {
10601                 off1 := auxIntToInt32(v.AuxInt)
10602                 sym := auxToSym(v.Aux)
10603                 if v_0.Op != OpPPC64ADDconst {
10604                         break
10605                 }
10606                 off2 := auxIntToInt64(v_0.AuxInt)
10607                 x := v_0.Args[0]
10608                 mem := v_1
10609                 if !(is16Bit(int64(off1) + off2)) {
10610                         break
10611                 }
10612                 v.reset(OpPPC64MOVWload)
10613                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10614                 v.Aux = symToAux(sym)
10615                 v.AddArg2(x, mem)
10616                 return true
10617         }
10618         // match: (MOVWload [0] {sym} p:(ADD ptr idx) mem)
10619         // cond: sym == nil && p.Uses == 1
10620         // result: (MOVWloadidx ptr idx mem)
10621         for {
10622                 if auxIntToInt32(v.AuxInt) != 0 {
10623                         break
10624                 }
10625                 sym := auxToSym(v.Aux)
10626                 p := v_0
10627                 if p.Op != OpPPC64ADD {
10628                         break
10629                 }
10630                 idx := p.Args[1]
10631                 ptr := p.Args[0]
10632                 mem := v_1
10633                 if !(sym == nil && p.Uses == 1) {
10634                         break
10635                 }
10636                 v.reset(OpPPC64MOVWloadidx)
10637                 v.AddArg3(ptr, idx, mem)
10638                 return true
10639         }
10640         return false
10641 }
10642 func rewriteValuePPC64_OpPPC64MOVWloadidx(v *Value) bool {
10643         v_2 := v.Args[2]
10644         v_1 := v.Args[1]
10645         v_0 := v.Args[0]
10646         // match: (MOVWloadidx ptr (MOVDconst [c]) mem)
10647         // cond: is16Bit(c) && c%4 == 0
10648         // result: (MOVWload [int32(c)] ptr mem)
10649         for {
10650                 ptr := v_0
10651                 if v_1.Op != OpPPC64MOVDconst {
10652                         break
10653                 }
10654                 c := auxIntToInt64(v_1.AuxInt)
10655                 mem := v_2
10656                 if !(is16Bit(c) && c%4 == 0) {
10657                         break
10658                 }
10659                 v.reset(OpPPC64MOVWload)
10660                 v.AuxInt = int32ToAuxInt(int32(c))
10661                 v.AddArg2(ptr, mem)
10662                 return true
10663         }
10664         // match: (MOVWloadidx (MOVDconst [c]) ptr mem)
10665         // cond: is16Bit(c) && c%4 == 0
10666         // result: (MOVWload [int32(c)] ptr mem)
10667         for {
10668                 if v_0.Op != OpPPC64MOVDconst {
10669                         break
10670                 }
10671                 c := auxIntToInt64(v_0.AuxInt)
10672                 ptr := v_1
10673                 mem := v_2
10674                 if !(is16Bit(c) && c%4 == 0) {
10675                         break
10676                 }
10677                 v.reset(OpPPC64MOVWload)
10678                 v.AuxInt = int32ToAuxInt(int32(c))
10679                 v.AddArg2(ptr, mem)
10680                 return true
10681         }
10682         return false
10683 }
10684 func rewriteValuePPC64_OpPPC64MOVWreg(v *Value) bool {
10685         v_0 := v.Args[0]
10686         b := v.Block
10687         typ := &b.Func.Config.Types
10688         // match: (MOVWreg y:(ANDconst [c] _))
10689         // cond: uint64(c) <= 0xFFFF
10690         // result: y
10691         for {
10692                 y := v_0
10693                 if y.Op != OpPPC64ANDconst {
10694                         break
10695                 }
10696                 c := auxIntToInt64(y.AuxInt)
10697                 if !(uint64(c) <= 0xFFFF) {
10698                         break
10699                 }
10700                 v.copyOf(y)
10701                 return true
10702         }
10703         // match: (MOVWreg y:(AND (MOVDconst [c]) _))
10704         // cond: uint64(c) <= 0x7FFFFFFF
10705         // result: y
10706         for {
10707                 y := v_0
10708                 if y.Op != OpPPC64AND {
10709                         break
10710                 }
10711                 y_0 := y.Args[0]
10712                 y_1 := y.Args[1]
10713                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
10714                         if y_0.Op != OpPPC64MOVDconst {
10715                                 continue
10716                         }
10717                         c := auxIntToInt64(y_0.AuxInt)
10718                         if !(uint64(c) <= 0x7FFFFFFF) {
10719                                 continue
10720                         }
10721                         v.copyOf(y)
10722                         return true
10723                 }
10724                 break
10725         }
10726         // match: (MOVWreg (SRAWconst [c] (MOVBreg x)))
10727         // result: (SRAWconst [c] (MOVBreg x))
10728         for {
10729                 if v_0.Op != OpPPC64SRAWconst {
10730                         break
10731                 }
10732                 c := auxIntToInt64(v_0.AuxInt)
10733                 v_0_0 := v_0.Args[0]
10734                 if v_0_0.Op != OpPPC64MOVBreg {
10735                         break
10736                 }
10737                 x := v_0_0.Args[0]
10738                 v.reset(OpPPC64SRAWconst)
10739                 v.AuxInt = int64ToAuxInt(c)
10740                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
10741                 v0.AddArg(x)
10742                 v.AddArg(v0)
10743                 return true
10744         }
10745         // match: (MOVWreg (SRAWconst [c] (MOVHreg x)))
10746         // result: (SRAWconst [c] (MOVHreg x))
10747         for {
10748                 if v_0.Op != OpPPC64SRAWconst {
10749                         break
10750                 }
10751                 c := auxIntToInt64(v_0.AuxInt)
10752                 v_0_0 := v_0.Args[0]
10753                 if v_0_0.Op != OpPPC64MOVHreg {
10754                         break
10755                 }
10756                 x := v_0_0.Args[0]
10757                 v.reset(OpPPC64SRAWconst)
10758                 v.AuxInt = int64ToAuxInt(c)
10759                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
10760                 v0.AddArg(x)
10761                 v.AddArg(v0)
10762                 return true
10763         }
10764         // match: (MOVWreg (SRAWconst [c] (MOVWreg x)))
10765         // result: (SRAWconst [c] (MOVWreg x))
10766         for {
10767                 if v_0.Op != OpPPC64SRAWconst {
10768                         break
10769                 }
10770                 c := auxIntToInt64(v_0.AuxInt)
10771                 v_0_0 := v_0.Args[0]
10772                 if v_0_0.Op != OpPPC64MOVWreg {
10773                         break
10774                 }
10775                 x := v_0_0.Args[0]
10776                 v.reset(OpPPC64SRAWconst)
10777                 v.AuxInt = int64ToAuxInt(c)
10778                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWreg, typ.Int64)
10779                 v0.AddArg(x)
10780                 v.AddArg(v0)
10781                 return true
10782         }
10783         // match: (MOVWreg (SRAWconst [c] x))
10784         // cond: sizeof(x.Type) <= 32
10785         // result: (SRAWconst [c] x)
10786         for {
10787                 if v_0.Op != OpPPC64SRAWconst {
10788                         break
10789                 }
10790                 c := auxIntToInt64(v_0.AuxInt)
10791                 x := v_0.Args[0]
10792                 if !(sizeof(x.Type) <= 32) {
10793                         break
10794                 }
10795                 v.reset(OpPPC64SRAWconst)
10796                 v.AuxInt = int64ToAuxInt(c)
10797                 v.AddArg(x)
10798                 return true
10799         }
10800         // match: (MOVWreg (SRDconst [c] x))
10801         // cond: c>32
10802         // result: (SRDconst [c] x)
10803         for {
10804                 if v_0.Op != OpPPC64SRDconst {
10805                         break
10806                 }
10807                 c := auxIntToInt64(v_0.AuxInt)
10808                 x := v_0.Args[0]
10809                 if !(c > 32) {
10810                         break
10811                 }
10812                 v.reset(OpPPC64SRDconst)
10813                 v.AuxInt = int64ToAuxInt(c)
10814                 v.AddArg(x)
10815                 return true
10816         }
10817         // match: (MOVWreg (SRADconst [c] x))
10818         // cond: c>=32
10819         // result: (SRADconst [c] x)
10820         for {
10821                 if v_0.Op != OpPPC64SRADconst {
10822                         break
10823                 }
10824                 c := auxIntToInt64(v_0.AuxInt)
10825                 x := v_0.Args[0]
10826                 if !(c >= 32) {
10827                         break
10828                 }
10829                 v.reset(OpPPC64SRADconst)
10830                 v.AuxInt = int64ToAuxInt(c)
10831                 v.AddArg(x)
10832                 return true
10833         }
10834         // match: (MOVWreg (SRDconst [c] x))
10835         // cond: c==32
10836         // result: (SRADconst [c] x)
10837         for {
10838                 if v_0.Op != OpPPC64SRDconst {
10839                         break
10840                 }
10841                 c := auxIntToInt64(v_0.AuxInt)
10842                 x := v_0.Args[0]
10843                 if !(c == 32) {
10844                         break
10845                 }
10846                 v.reset(OpPPC64SRADconst)
10847                 v.AuxInt = int64ToAuxInt(c)
10848                 v.AddArg(x)
10849                 return true
10850         }
10851         // match: (MOVWreg y:(MOVWreg _))
10852         // result: y
10853         for {
10854                 y := v_0
10855                 if y.Op != OpPPC64MOVWreg {
10856                         break
10857                 }
10858                 v.copyOf(y)
10859                 return true
10860         }
10861         // match: (MOVWreg y:(MOVHreg _))
10862         // result: y
10863         for {
10864                 y := v_0
10865                 if y.Op != OpPPC64MOVHreg {
10866                         break
10867                 }
10868                 v.copyOf(y)
10869                 return true
10870         }
10871         // match: (MOVWreg y:(MOVBreg _))
10872         // result: y
10873         for {
10874                 y := v_0
10875                 if y.Op != OpPPC64MOVBreg {
10876                         break
10877                 }
10878                 v.copyOf(y)
10879                 return true
10880         }
10881         // match: (MOVWreg y:(MOVWZreg x))
10882         // result: (MOVWreg x)
10883         for {
10884                 y := v_0
10885                 if y.Op != OpPPC64MOVWZreg {
10886                         break
10887                 }
10888                 x := y.Args[0]
10889                 v.reset(OpPPC64MOVWreg)
10890                 v.AddArg(x)
10891                 return true
10892         }
10893         // match: (MOVWreg x:(MOVHload _ _))
10894         // result: x
10895         for {
10896                 x := v_0
10897                 if x.Op != OpPPC64MOVHload {
10898                         break
10899                 }
10900                 v.copyOf(x)
10901                 return true
10902         }
10903         // match: (MOVWreg x:(MOVHloadidx _ _ _))
10904         // result: x
10905         for {
10906                 x := v_0
10907                 if x.Op != OpPPC64MOVHloadidx {
10908                         break
10909                 }
10910                 v.copyOf(x)
10911                 return true
10912         }
10913         // match: (MOVWreg x:(MOVWload _ _))
10914         // result: x
10915         for {
10916                 x := v_0
10917                 if x.Op != OpPPC64MOVWload {
10918                         break
10919                 }
10920                 v.copyOf(x)
10921                 return true
10922         }
10923         // match: (MOVWreg x:(MOVWloadidx _ _ _))
10924         // result: x
10925         for {
10926                 x := v_0
10927                 if x.Op != OpPPC64MOVWloadidx {
10928                         break
10929                 }
10930                 v.copyOf(x)
10931                 return true
10932         }
10933         // match: (MOVWreg x:(Arg <t>))
10934         // cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && isSigned(t)
10935         // result: x
10936         for {
10937                 x := v_0
10938                 if x.Op != OpArg {
10939                         break
10940                 }
10941                 t := x.Type
10942                 if !((is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && isSigned(t)) {
10943                         break
10944                 }
10945                 v.copyOf(x)
10946                 return true
10947         }
10948         // match: (MOVWreg (MOVDconst [c]))
10949         // result: (MOVDconst [int64(int32(c))])
10950         for {
10951                 if v_0.Op != OpPPC64MOVDconst {
10952                         break
10953                 }
10954                 c := auxIntToInt64(v_0.AuxInt)
10955                 v.reset(OpPPC64MOVDconst)
10956                 v.AuxInt = int64ToAuxInt(int64(int32(c)))
10957                 return true
10958         }
10959         return false
10960 }
10961 func rewriteValuePPC64_OpPPC64MOVWstore(v *Value) bool {
10962         v_2 := v.Args[2]
10963         v_1 := v.Args[1]
10964         v_0 := v.Args[0]
10965         // match: (MOVWstore [off1] {sym} (ADDconst [off2] x) val mem)
10966         // cond: is16Bit(int64(off1)+off2)
10967         // result: (MOVWstore [off1+int32(off2)] {sym} x val mem)
10968         for {
10969                 off1 := auxIntToInt32(v.AuxInt)
10970                 sym := auxToSym(v.Aux)
10971                 if v_0.Op != OpPPC64ADDconst {
10972                         break
10973                 }
10974                 off2 := auxIntToInt64(v_0.AuxInt)
10975                 x := v_0.Args[0]
10976                 val := v_1
10977                 mem := v_2
10978                 if !(is16Bit(int64(off1) + off2)) {
10979                         break
10980                 }
10981                 v.reset(OpPPC64MOVWstore)
10982                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10983                 v.Aux = symToAux(sym)
10984                 v.AddArg3(x, val, mem)
10985                 return true
10986         }
10987         // match: (MOVWstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
10988         // cond: canMergeSym(sym1,sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)
10989         // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
10990         for {
10991                 off1 := auxIntToInt32(v.AuxInt)
10992                 sym1 := auxToSym(v.Aux)
10993                 p := v_0
10994                 if p.Op != OpPPC64MOVDaddr {
10995                         break
10996                 }
10997                 off2 := auxIntToInt32(p.AuxInt)
10998                 sym2 := auxToSym(p.Aux)
10999                 ptr := p.Args[0]
11000                 val := v_1
11001                 mem := v_2
11002                 if !(canMergeSym(sym1, sym2) && is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) {
11003                         break
11004                 }
11005                 v.reset(OpPPC64MOVWstore)
11006                 v.AuxInt = int32ToAuxInt(off1 + off2)
11007                 v.Aux = symToAux(mergeSym(sym1, sym2))
11008                 v.AddArg3(ptr, val, mem)
11009                 return true
11010         }
11011         // match: (MOVWstore [off] {sym} ptr (MOVDconst [0]) mem)
11012         // result: (MOVWstorezero [off] {sym} ptr mem)
11013         for {
11014                 off := auxIntToInt32(v.AuxInt)
11015                 sym := auxToSym(v.Aux)
11016                 ptr := v_0
11017                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
11018                         break
11019                 }
11020                 mem := v_2
11021                 v.reset(OpPPC64MOVWstorezero)
11022                 v.AuxInt = int32ToAuxInt(off)
11023                 v.Aux = symToAux(sym)
11024                 v.AddArg2(ptr, mem)
11025                 return true
11026         }
11027         // match: (MOVWstore [0] {sym} p:(ADD ptr idx) val mem)
11028         // cond: sym == nil && p.Uses == 1
11029         // result: (MOVWstoreidx ptr idx val mem)
11030         for {
11031                 if auxIntToInt32(v.AuxInt) != 0 {
11032                         break
11033                 }
11034                 sym := auxToSym(v.Aux)
11035                 p := v_0
11036                 if p.Op != OpPPC64ADD {
11037                         break
11038                 }
11039                 idx := p.Args[1]
11040                 ptr := p.Args[0]
11041                 val := v_1
11042                 mem := v_2
11043                 if !(sym == nil && p.Uses == 1) {
11044                         break
11045                 }
11046                 v.reset(OpPPC64MOVWstoreidx)
11047                 v.AddArg4(ptr, idx, val, mem)
11048                 return true
11049         }
11050         // match: (MOVWstore [off] {sym} ptr (MOVWreg x) mem)
11051         // result: (MOVWstore [off] {sym} ptr x mem)
11052         for {
11053                 off := auxIntToInt32(v.AuxInt)
11054                 sym := auxToSym(v.Aux)
11055                 ptr := v_0
11056                 if v_1.Op != OpPPC64MOVWreg {
11057                         break
11058                 }
11059                 x := v_1.Args[0]
11060                 mem := v_2
11061                 v.reset(OpPPC64MOVWstore)
11062                 v.AuxInt = int32ToAuxInt(off)
11063                 v.Aux = symToAux(sym)
11064                 v.AddArg3(ptr, x, mem)
11065                 return true
11066         }
11067         // match: (MOVWstore [off] {sym} ptr (MOVWZreg x) mem)
11068         // result: (MOVWstore [off] {sym} ptr x mem)
11069         for {
11070                 off := auxIntToInt32(v.AuxInt)
11071                 sym := auxToSym(v.Aux)
11072                 ptr := v_0
11073                 if v_1.Op != OpPPC64MOVWZreg {
11074                         break
11075                 }
11076                 x := v_1.Args[0]
11077                 mem := v_2
11078                 v.reset(OpPPC64MOVWstore)
11079                 v.AuxInt = int32ToAuxInt(off)
11080                 v.Aux = symToAux(sym)
11081                 v.AddArg3(ptr, x, mem)
11082                 return true
11083         }
11084         return false
11085 }
11086 func rewriteValuePPC64_OpPPC64MOVWstoreidx(v *Value) bool {
11087         v_3 := v.Args[3]
11088         v_2 := v.Args[2]
11089         v_1 := v.Args[1]
11090         v_0 := v.Args[0]
11091         // match: (MOVWstoreidx ptr (MOVDconst [c]) val mem)
11092         // cond: is16Bit(c)
11093         // result: (MOVWstore [int32(c)] ptr val mem)
11094         for {
11095                 ptr := v_0
11096                 if v_1.Op != OpPPC64MOVDconst {
11097                         break
11098                 }
11099                 c := auxIntToInt64(v_1.AuxInt)
11100                 val := v_2
11101                 mem := v_3
11102                 if !(is16Bit(c)) {
11103                         break
11104                 }
11105                 v.reset(OpPPC64MOVWstore)
11106                 v.AuxInt = int32ToAuxInt(int32(c))
11107                 v.AddArg3(ptr, val, mem)
11108                 return true
11109         }
11110         // match: (MOVWstoreidx (MOVDconst [c]) ptr val mem)
11111         // cond: is16Bit(c)
11112         // result: (MOVWstore [int32(c)] ptr val mem)
11113         for {
11114                 if v_0.Op != OpPPC64MOVDconst {
11115                         break
11116                 }
11117                 c := auxIntToInt64(v_0.AuxInt)
11118                 ptr := v_1
11119                 val := v_2
11120                 mem := v_3
11121                 if !(is16Bit(c)) {
11122                         break
11123                 }
11124                 v.reset(OpPPC64MOVWstore)
11125                 v.AuxInt = int32ToAuxInt(int32(c))
11126                 v.AddArg3(ptr, val, mem)
11127                 return true
11128         }
11129         // match: (MOVWstoreidx ptr idx (MOVWreg x) mem)
11130         // result: (MOVWstoreidx ptr idx x mem)
11131         for {
11132                 ptr := v_0
11133                 idx := v_1
11134                 if v_2.Op != OpPPC64MOVWreg {
11135                         break
11136                 }
11137                 x := v_2.Args[0]
11138                 mem := v_3
11139                 v.reset(OpPPC64MOVWstoreidx)
11140                 v.AddArg4(ptr, idx, x, mem)
11141                 return true
11142         }
11143         // match: (MOVWstoreidx ptr idx (MOVWZreg x) mem)
11144         // result: (MOVWstoreidx ptr idx x mem)
11145         for {
11146                 ptr := v_0
11147                 idx := v_1
11148                 if v_2.Op != OpPPC64MOVWZreg {
11149                         break
11150                 }
11151                 x := v_2.Args[0]
11152                 mem := v_3
11153                 v.reset(OpPPC64MOVWstoreidx)
11154                 v.AddArg4(ptr, idx, x, mem)
11155                 return true
11156         }
11157         return false
11158 }
11159 func rewriteValuePPC64_OpPPC64MOVWstorezero(v *Value) bool {
11160         v_1 := v.Args[1]
11161         v_0 := v.Args[0]
11162         // match: (MOVWstorezero [off1] {sym} (ADDconst [off2] x) mem)
11163         // cond: is16Bit(int64(off1)+off2)
11164         // result: (MOVWstorezero [off1+int32(off2)] {sym} x mem)
11165         for {
11166                 off1 := auxIntToInt32(v.AuxInt)
11167                 sym := auxToSym(v.Aux)
11168                 if v_0.Op != OpPPC64ADDconst {
11169                         break
11170                 }
11171                 off2 := auxIntToInt64(v_0.AuxInt)
11172                 x := v_0.Args[0]
11173                 mem := v_1
11174                 if !(is16Bit(int64(off1) + off2)) {
11175                         break
11176                 }
11177                 v.reset(OpPPC64MOVWstorezero)
11178                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
11179                 v.Aux = symToAux(sym)
11180                 v.AddArg2(x, mem)
11181                 return true
11182         }
11183         // match: (MOVWstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
11184         // cond: canMergeSym(sym1,sym2) && (x.Op != OpSB || p.Uses == 1)
11185         // result: (MOVWstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
11186         for {
11187                 off1 := auxIntToInt32(v.AuxInt)
11188                 sym1 := auxToSym(v.Aux)
11189                 p := v_0
11190                 if p.Op != OpPPC64MOVDaddr {
11191                         break
11192                 }
11193                 off2 := auxIntToInt32(p.AuxInt)
11194                 sym2 := auxToSym(p.Aux)
11195                 x := p.Args[0]
11196                 mem := v_1
11197                 if !(canMergeSym(sym1, sym2) && (x.Op != OpSB || p.Uses == 1)) {
11198                         break
11199                 }
11200                 v.reset(OpPPC64MOVWstorezero)
11201                 v.AuxInt = int32ToAuxInt(off1 + off2)
11202                 v.Aux = symToAux(mergeSym(sym1, sym2))
11203                 v.AddArg2(x, mem)
11204                 return true
11205         }
11206         return false
11207 }
11208 func rewriteValuePPC64_OpPPC64MTVSRD(v *Value) bool {
11209         v_0 := v.Args[0]
11210         b := v.Block
11211         typ := &b.Func.Config.Types
11212         // match: (MTVSRD (MOVDconst [c]))
11213         // cond: !math.IsNaN(math.Float64frombits(uint64(c)))
11214         // result: (FMOVDconst [math.Float64frombits(uint64(c))])
11215         for {
11216                 if v_0.Op != OpPPC64MOVDconst {
11217                         break
11218                 }
11219                 c := auxIntToInt64(v_0.AuxInt)
11220                 if !(!math.IsNaN(math.Float64frombits(uint64(c)))) {
11221                         break
11222                 }
11223                 v.reset(OpPPC64FMOVDconst)
11224                 v.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c)))
11225                 return true
11226         }
11227         // match: (MTVSRD x:(MOVDload [off] {sym} ptr mem))
11228         // cond: x.Uses == 1 && clobber(x)
11229         // result: @x.Block (FMOVDload [off] {sym} ptr mem)
11230         for {
11231                 x := v_0
11232                 if x.Op != OpPPC64MOVDload {
11233                         break
11234                 }
11235                 off := auxIntToInt32(x.AuxInt)
11236                 sym := auxToSym(x.Aux)
11237                 mem := x.Args[1]
11238                 ptr := x.Args[0]
11239                 if !(x.Uses == 1 && clobber(x)) {
11240                         break
11241                 }
11242                 b = x.Block
11243                 v0 := b.NewValue0(x.Pos, OpPPC64FMOVDload, typ.Float64)
11244                 v.copyOf(v0)
11245                 v0.AuxInt = int32ToAuxInt(off)
11246                 v0.Aux = symToAux(sym)
11247                 v0.AddArg2(ptr, mem)
11248                 return true
11249         }
11250         return false
11251 }
11252 func rewriteValuePPC64_OpPPC64MULLD(v *Value) bool {
11253         v_1 := v.Args[1]
11254         v_0 := v.Args[0]
11255         // match: (MULLD x (MOVDconst [c]))
11256         // cond: is16Bit(c)
11257         // result: (MULLDconst [int32(c)] x)
11258         for {
11259                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11260                         x := v_0
11261                         if v_1.Op != OpPPC64MOVDconst {
11262                                 continue
11263                         }
11264                         c := auxIntToInt64(v_1.AuxInt)
11265                         if !(is16Bit(c)) {
11266                                 continue
11267                         }
11268                         v.reset(OpPPC64MULLDconst)
11269                         v.AuxInt = int32ToAuxInt(int32(c))
11270                         v.AddArg(x)
11271                         return true
11272                 }
11273                 break
11274         }
11275         return false
11276 }
11277 func rewriteValuePPC64_OpPPC64MULLW(v *Value) bool {
11278         v_1 := v.Args[1]
11279         v_0 := v.Args[0]
11280         // match: (MULLW x (MOVDconst [c]))
11281         // cond: is16Bit(c)
11282         // result: (MULLWconst [int32(c)] x)
11283         for {
11284                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11285                         x := v_0
11286                         if v_1.Op != OpPPC64MOVDconst {
11287                                 continue
11288                         }
11289                         c := auxIntToInt64(v_1.AuxInt)
11290                         if !(is16Bit(c)) {
11291                                 continue
11292                         }
11293                         v.reset(OpPPC64MULLWconst)
11294                         v.AuxInt = int32ToAuxInt(int32(c))
11295                         v.AddArg(x)
11296                         return true
11297                 }
11298                 break
11299         }
11300         return false
11301 }
11302 func rewriteValuePPC64_OpPPC64NEG(v *Value) bool {
11303         v_0 := v.Args[0]
11304         // match: (NEG (ADDconst [c] x))
11305         // cond: is32Bit(-c)
11306         // result: (SUBFCconst [-c] x)
11307         for {
11308                 if v_0.Op != OpPPC64ADDconst {
11309                         break
11310                 }
11311                 c := auxIntToInt64(v_0.AuxInt)
11312                 x := v_0.Args[0]
11313                 if !(is32Bit(-c)) {
11314                         break
11315                 }
11316                 v.reset(OpPPC64SUBFCconst)
11317                 v.AuxInt = int64ToAuxInt(-c)
11318                 v.AddArg(x)
11319                 return true
11320         }
11321         // match: (NEG (SUBFCconst [c] x))
11322         // cond: is32Bit(-c)
11323         // result: (ADDconst [-c] x)
11324         for {
11325                 if v_0.Op != OpPPC64SUBFCconst {
11326                         break
11327                 }
11328                 c := auxIntToInt64(v_0.AuxInt)
11329                 x := v_0.Args[0]
11330                 if !(is32Bit(-c)) {
11331                         break
11332                 }
11333                 v.reset(OpPPC64ADDconst)
11334                 v.AuxInt = int64ToAuxInt(-c)
11335                 v.AddArg(x)
11336                 return true
11337         }
11338         return false
11339 }
11340 func rewriteValuePPC64_OpPPC64NOR(v *Value) bool {
11341         v_1 := v.Args[1]
11342         v_0 := v.Args[0]
11343         // match: (NOR (MOVDconst [c]) (MOVDconst [d]))
11344         // result: (MOVDconst [^(c|d)])
11345         for {
11346                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11347                         if v_0.Op != OpPPC64MOVDconst {
11348                                 continue
11349                         }
11350                         c := auxIntToInt64(v_0.AuxInt)
11351                         if v_1.Op != OpPPC64MOVDconst {
11352                                 continue
11353                         }
11354                         d := auxIntToInt64(v_1.AuxInt)
11355                         v.reset(OpPPC64MOVDconst)
11356                         v.AuxInt = int64ToAuxInt(^(c | d))
11357                         return true
11358                 }
11359                 break
11360         }
11361         return false
11362 }
11363 func rewriteValuePPC64_OpPPC64NotEqual(v *Value) bool {
11364         v_0 := v.Args[0]
11365         b := v.Block
11366         typ := &b.Func.Config.Types
11367         // match: (NotEqual (FlagEQ))
11368         // result: (MOVDconst [0])
11369         for {
11370                 if v_0.Op != OpPPC64FlagEQ {
11371                         break
11372                 }
11373                 v.reset(OpPPC64MOVDconst)
11374                 v.AuxInt = int64ToAuxInt(0)
11375                 return true
11376         }
11377         // match: (NotEqual (FlagLT))
11378         // result: (MOVDconst [1])
11379         for {
11380                 if v_0.Op != OpPPC64FlagLT {
11381                         break
11382                 }
11383                 v.reset(OpPPC64MOVDconst)
11384                 v.AuxInt = int64ToAuxInt(1)
11385                 return true
11386         }
11387         // match: (NotEqual (FlagGT))
11388         // result: (MOVDconst [1])
11389         for {
11390                 if v_0.Op != OpPPC64FlagGT {
11391                         break
11392                 }
11393                 v.reset(OpPPC64MOVDconst)
11394                 v.AuxInt = int64ToAuxInt(1)
11395                 return true
11396         }
11397         // match: (NotEqual (InvertFlags x))
11398         // result: (NotEqual x)
11399         for {
11400                 if v_0.Op != OpPPC64InvertFlags {
11401                         break
11402                 }
11403                 x := v_0.Args[0]
11404                 v.reset(OpPPC64NotEqual)
11405                 v.AddArg(x)
11406                 return true
11407         }
11408         // match: (NotEqual cmp)
11409         // result: (ISELB [6] (MOVDconst [1]) cmp)
11410         for {
11411                 cmp := v_0
11412                 v.reset(OpPPC64ISELB)
11413                 v.AuxInt = int32ToAuxInt(6)
11414                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
11415                 v0.AuxInt = int64ToAuxInt(1)
11416                 v.AddArg2(v0, cmp)
11417                 return true
11418         }
11419 }
11420 func rewriteValuePPC64_OpPPC64OR(v *Value) bool {
11421         v_1 := v.Args[1]
11422         v_0 := v.Args[0]
11423         b := v.Block
11424         config := b.Func.Config
11425         typ := &b.Func.Config.Types
11426         // match: ( OR (SLDconst x [c]) (SRDconst x [d]))
11427         // cond: d == 64-c
11428         // result: (ROTLconst [c] x)
11429         for {
11430                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11431                         if v_0.Op != OpPPC64SLDconst {
11432                                 continue
11433                         }
11434                         c := auxIntToInt64(v_0.AuxInt)
11435                         x := v_0.Args[0]
11436                         if v_1.Op != OpPPC64SRDconst {
11437                                 continue
11438                         }
11439                         d := auxIntToInt64(v_1.AuxInt)
11440                         if x != v_1.Args[0] || !(d == 64-c) {
11441                                 continue
11442                         }
11443                         v.reset(OpPPC64ROTLconst)
11444                         v.AuxInt = int64ToAuxInt(c)
11445                         v.AddArg(x)
11446                         return true
11447                 }
11448                 break
11449         }
11450         // match: ( OR (SLWconst x [c]) (SRWconst x [d]))
11451         // cond: d == 32-c
11452         // result: (ROTLWconst [c] x)
11453         for {
11454                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11455                         if v_0.Op != OpPPC64SLWconst {
11456                                 continue
11457                         }
11458                         c := auxIntToInt64(v_0.AuxInt)
11459                         x := v_0.Args[0]
11460                         if v_1.Op != OpPPC64SRWconst {
11461                                 continue
11462                         }
11463                         d := auxIntToInt64(v_1.AuxInt)
11464                         if x != v_1.Args[0] || !(d == 32-c) {
11465                                 continue
11466                         }
11467                         v.reset(OpPPC64ROTLWconst)
11468                         v.AuxInt = int64ToAuxInt(c)
11469                         v.AddArg(x)
11470                         return true
11471                 }
11472                 break
11473         }
11474         // match: ( OR (SLD x (ANDconst <typ.Int64> [63] y)) (SRD x (SUB <typ.UInt> (MOVDconst [64]) (ANDconst <typ.UInt> [63] y))))
11475         // result: (ROTL x y)
11476         for {
11477                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11478                         if v_0.Op != OpPPC64SLD {
11479                                 continue
11480                         }
11481                         _ = v_0.Args[1]
11482                         x := v_0.Args[0]
11483                         v_0_1 := v_0.Args[1]
11484                         if v_0_1.Op != OpPPC64ANDconst || v_0_1.Type != typ.Int64 || auxIntToInt64(v_0_1.AuxInt) != 63 {
11485                                 continue
11486                         }
11487                         y := v_0_1.Args[0]
11488                         if v_1.Op != OpPPC64SRD {
11489                                 continue
11490                         }
11491                         _ = v_1.Args[1]
11492                         if x != v_1.Args[0] {
11493                                 continue
11494                         }
11495                         v_1_1 := v_1.Args[1]
11496                         if v_1_1.Op != OpPPC64SUB || v_1_1.Type != typ.UInt {
11497                                 continue
11498                         }
11499                         _ = v_1_1.Args[1]
11500                         v_1_1_0 := v_1_1.Args[0]
11501                         if v_1_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1_0.AuxInt) != 64 {
11502                                 continue
11503                         }
11504                         v_1_1_1 := v_1_1.Args[1]
11505                         if v_1_1_1.Op != OpPPC64ANDconst || v_1_1_1.Type != typ.UInt || auxIntToInt64(v_1_1_1.AuxInt) != 63 || y != v_1_1_1.Args[0] {
11506                                 continue
11507                         }
11508                         v.reset(OpPPC64ROTL)
11509                         v.AddArg2(x, y)
11510                         return true
11511                 }
11512                 break
11513         }
11514         // match: ( OR (SLD x (ANDconst <typ.Int64> [63] y)) (SRD x (SUBFCconst <typ.UInt> [64] (ANDconst <typ.UInt> [63] y))))
11515         // result: (ROTL x y)
11516         for {
11517                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11518                         if v_0.Op != OpPPC64SLD {
11519                                 continue
11520                         }
11521                         _ = v_0.Args[1]
11522                         x := v_0.Args[0]
11523                         v_0_1 := v_0.Args[1]
11524                         if v_0_1.Op != OpPPC64ANDconst || v_0_1.Type != typ.Int64 || auxIntToInt64(v_0_1.AuxInt) != 63 {
11525                                 continue
11526                         }
11527                         y := v_0_1.Args[0]
11528                         if v_1.Op != OpPPC64SRD {
11529                                 continue
11530                         }
11531                         _ = v_1.Args[1]
11532                         if x != v_1.Args[0] {
11533                                 continue
11534                         }
11535                         v_1_1 := v_1.Args[1]
11536                         if v_1_1.Op != OpPPC64SUBFCconst || v_1_1.Type != typ.UInt || auxIntToInt64(v_1_1.AuxInt) != 64 {
11537                                 continue
11538                         }
11539                         v_1_1_0 := v_1_1.Args[0]
11540                         if v_1_1_0.Op != OpPPC64ANDconst || v_1_1_0.Type != typ.UInt || auxIntToInt64(v_1_1_0.AuxInt) != 63 || y != v_1_1_0.Args[0] {
11541                                 continue
11542                         }
11543                         v.reset(OpPPC64ROTL)
11544                         v.AddArg2(x, y)
11545                         return true
11546                 }
11547                 break
11548         }
11549         // match: ( OR (SLW x (ANDconst <typ.Int32> [31] y)) (SRW x (SUBFCconst <typ.UInt> [32] (ANDconst <typ.UInt> [31] y))))
11550         // result: (ROTLW x y)
11551         for {
11552                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11553                         if v_0.Op != OpPPC64SLW {
11554                                 continue
11555                         }
11556                         _ = v_0.Args[1]
11557                         x := v_0.Args[0]
11558                         v_0_1 := v_0.Args[1]
11559                         if v_0_1.Op != OpPPC64ANDconst || v_0_1.Type != typ.Int32 || auxIntToInt64(v_0_1.AuxInt) != 31 {
11560                                 continue
11561                         }
11562                         y := v_0_1.Args[0]
11563                         if v_1.Op != OpPPC64SRW {
11564                                 continue
11565                         }
11566                         _ = v_1.Args[1]
11567                         if x != v_1.Args[0] {
11568                                 continue
11569                         }
11570                         v_1_1 := v_1.Args[1]
11571                         if v_1_1.Op != OpPPC64SUBFCconst || v_1_1.Type != typ.UInt || auxIntToInt64(v_1_1.AuxInt) != 32 {
11572                                 continue
11573                         }
11574                         v_1_1_0 := v_1_1.Args[0]
11575                         if v_1_1_0.Op != OpPPC64ANDconst || v_1_1_0.Type != typ.UInt || auxIntToInt64(v_1_1_0.AuxInt) != 31 || y != v_1_1_0.Args[0] {
11576                                 continue
11577                         }
11578                         v.reset(OpPPC64ROTLW)
11579                         v.AddArg2(x, y)
11580                         return true
11581                 }
11582                 break
11583         }
11584         // match: ( OR (SLW x (ANDconst <typ.Int32> [31] y)) (SRW x (SUB <typ.UInt> (MOVDconst [32]) (ANDconst <typ.UInt> [31] y))))
11585         // result: (ROTLW x y)
11586         for {
11587                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11588                         if v_0.Op != OpPPC64SLW {
11589                                 continue
11590                         }
11591                         _ = v_0.Args[1]
11592                         x := v_0.Args[0]
11593                         v_0_1 := v_0.Args[1]
11594                         if v_0_1.Op != OpPPC64ANDconst || v_0_1.Type != typ.Int32 || auxIntToInt64(v_0_1.AuxInt) != 31 {
11595                                 continue
11596                         }
11597                         y := v_0_1.Args[0]
11598                         if v_1.Op != OpPPC64SRW {
11599                                 continue
11600                         }
11601                         _ = v_1.Args[1]
11602                         if x != v_1.Args[0] {
11603                                 continue
11604                         }
11605                         v_1_1 := v_1.Args[1]
11606                         if v_1_1.Op != OpPPC64SUB || v_1_1.Type != typ.UInt {
11607                                 continue
11608                         }
11609                         _ = v_1_1.Args[1]
11610                         v_1_1_0 := v_1_1.Args[0]
11611                         if v_1_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1_0.AuxInt) != 32 {
11612                                 continue
11613                         }
11614                         v_1_1_1 := v_1_1.Args[1]
11615                         if v_1_1_1.Op != OpPPC64ANDconst || v_1_1_1.Type != typ.UInt || auxIntToInt64(v_1_1_1.AuxInt) != 31 || y != v_1_1_1.Args[0] {
11616                                 continue
11617                         }
11618                         v.reset(OpPPC64ROTLW)
11619                         v.AddArg2(x, y)
11620                         return true
11621                 }
11622                 break
11623         }
11624         // match: (OR (MOVDconst [c]) (MOVDconst [d]))
11625         // result: (MOVDconst [c|d])
11626         for {
11627                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11628                         if v_0.Op != OpPPC64MOVDconst {
11629                                 continue
11630                         }
11631                         c := auxIntToInt64(v_0.AuxInt)
11632                         if v_1.Op != OpPPC64MOVDconst {
11633                                 continue
11634                         }
11635                         d := auxIntToInt64(v_1.AuxInt)
11636                         v.reset(OpPPC64MOVDconst)
11637                         v.AuxInt = int64ToAuxInt(c | d)
11638                         return true
11639                 }
11640                 break
11641         }
11642         // match: (OR x (MOVDconst [c]))
11643         // cond: isU32Bit(c)
11644         // result: (ORconst [c] x)
11645         for {
11646                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11647                         x := v_0
11648                         if v_1.Op != OpPPC64MOVDconst {
11649                                 continue
11650                         }
11651                         c := auxIntToInt64(v_1.AuxInt)
11652                         if !(isU32Bit(c)) {
11653                                 continue
11654                         }
11655                         v.reset(OpPPC64ORconst)
11656                         v.AuxInt = int64ToAuxInt(c)
11657                         v.AddArg(x)
11658                         return true
11659                 }
11660                 break
11661         }
11662         // match: (OR <t> x0:(MOVBZload [i0] {s} p mem) o1:(SLWconst x1:(MOVBZload [i1] {s} p mem) [8]))
11663         // cond: !config.BigEndian && i1 == i0+1 && x0.Uses ==1 && x1.Uses == 1 && o1.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, o1)
11664         // result: @mergePoint(b,x0,x1) (MOVHZload <t> {s} [i0] p mem)
11665         for {
11666                 t := v.Type
11667                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11668                         x0 := v_0
11669                         if x0.Op != OpPPC64MOVBZload {
11670                                 continue
11671                         }
11672                         i0 := auxIntToInt32(x0.AuxInt)
11673                         s := auxToSym(x0.Aux)
11674                         mem := x0.Args[1]
11675                         p := x0.Args[0]
11676                         o1 := v_1
11677                         if o1.Op != OpPPC64SLWconst || auxIntToInt64(o1.AuxInt) != 8 {
11678                                 continue
11679                         }
11680                         x1 := o1.Args[0]
11681                         if x1.Op != OpPPC64MOVBZload {
11682                                 continue
11683                         }
11684                         i1 := auxIntToInt32(x1.AuxInt)
11685                         if auxToSym(x1.Aux) != s {
11686                                 continue
11687                         }
11688                         _ = x1.Args[1]
11689                         if p != x1.Args[0] || mem != x1.Args[1] || !(!config.BigEndian && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && o1.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, o1)) {
11690                                 continue
11691                         }
11692                         b = mergePoint(b, x0, x1)
11693                         v0 := b.NewValue0(x1.Pos, OpPPC64MOVHZload, t)
11694                         v.copyOf(v0)
11695                         v0.AuxInt = int32ToAuxInt(i0)
11696                         v0.Aux = symToAux(s)
11697                         v0.AddArg2(p, mem)
11698                         return true
11699                 }
11700                 break
11701         }
11702         // match: (OR <t> x0:(MOVBZload [i0] {s} p mem) o1:(SLDconst x1:(MOVBZload [i1] {s} p mem) [8]))
11703         // cond: !config.BigEndian && i1 == i0+1 && x0.Uses ==1 && x1.Uses == 1 && o1.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, o1)
11704         // result: @mergePoint(b,x0,x1) (MOVHZload <t> {s} [i0] p mem)
11705         for {
11706                 t := v.Type
11707                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11708                         x0 := v_0
11709                         if x0.Op != OpPPC64MOVBZload {
11710                                 continue
11711                         }
11712                         i0 := auxIntToInt32(x0.AuxInt)
11713                         s := auxToSym(x0.Aux)
11714                         mem := x0.Args[1]
11715                         p := x0.Args[0]
11716                         o1 := v_1
11717                         if o1.Op != OpPPC64SLDconst || auxIntToInt64(o1.AuxInt) != 8 {
11718                                 continue
11719                         }
11720                         x1 := o1.Args[0]
11721                         if x1.Op != OpPPC64MOVBZload {
11722                                 continue
11723                         }
11724                         i1 := auxIntToInt32(x1.AuxInt)
11725                         if auxToSym(x1.Aux) != s {
11726                                 continue
11727                         }
11728                         _ = x1.Args[1]
11729                         if p != x1.Args[0] || mem != x1.Args[1] || !(!config.BigEndian && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && o1.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, o1)) {
11730                                 continue
11731                         }
11732                         b = mergePoint(b, x0, x1)
11733                         v0 := b.NewValue0(x1.Pos, OpPPC64MOVHZload, t)
11734                         v.copyOf(v0)
11735                         v0.AuxInt = int32ToAuxInt(i0)
11736                         v0.Aux = symToAux(s)
11737                         v0.AddArg2(p, mem)
11738                         return true
11739                 }
11740                 break
11741         }
11742         // match: (OR <t> x0:(MOVBZload [i1] {s} p mem) o1:(SLWconst x1:(MOVBZload [i0] {s} p mem) [8]))
11743         // cond: !config.BigEndian && i1 == i0+1 && x0.Uses ==1 && x1.Uses == 1 && o1.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, o1)
11744         // result: @mergePoint(b,x0,x1) (MOVHBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem)
11745         for {
11746                 t := v.Type
11747                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11748                         x0 := v_0
11749                         if x0.Op != OpPPC64MOVBZload {
11750                                 continue
11751                         }
11752                         i1 := auxIntToInt32(x0.AuxInt)
11753                         s := auxToSym(x0.Aux)
11754                         mem := x0.Args[1]
11755                         p := x0.Args[0]
11756                         o1 := v_1
11757                         if o1.Op != OpPPC64SLWconst || auxIntToInt64(o1.AuxInt) != 8 {
11758                                 continue
11759                         }
11760                         x1 := o1.Args[0]
11761                         if x1.Op != OpPPC64MOVBZload {
11762                                 continue
11763                         }
11764                         i0 := auxIntToInt32(x1.AuxInt)
11765                         if auxToSym(x1.Aux) != s {
11766                                 continue
11767                         }
11768                         _ = x1.Args[1]
11769                         if p != x1.Args[0] || mem != x1.Args[1] || !(!config.BigEndian && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && o1.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, o1)) {
11770                                 continue
11771                         }
11772                         b = mergePoint(b, x0, x1)
11773                         v0 := b.NewValue0(x1.Pos, OpPPC64MOVHBRload, t)
11774                         v.copyOf(v0)
11775                         v1 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
11776                         v1.AuxInt = int32ToAuxInt(i0)
11777                         v1.Aux = symToAux(s)
11778                         v1.AddArg(p)
11779                         v0.AddArg2(v1, mem)
11780                         return true
11781                 }
11782                 break
11783         }
11784         // match: (OR <t> x0:(MOVBZload [i1] {s} p mem) o1:(SLDconst x1:(MOVBZload [i0] {s} p mem) [8]))
11785         // cond: !config.BigEndian && i1 == i0+1 && x0.Uses ==1 && x1.Uses == 1 && o1.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, o1)
11786         // result: @mergePoint(b,x0,x1) (MOVHBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem)
11787         for {
11788                 t := v.Type
11789                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11790                         x0 := v_0
11791                         if x0.Op != OpPPC64MOVBZload {
11792                                 continue
11793                         }
11794                         i1 := auxIntToInt32(x0.AuxInt)
11795                         s := auxToSym(x0.Aux)
11796                         mem := x0.Args[1]
11797                         p := x0.Args[0]
11798                         o1 := v_1
11799                         if o1.Op != OpPPC64SLDconst || auxIntToInt64(o1.AuxInt) != 8 {
11800                                 continue
11801                         }
11802                         x1 := o1.Args[0]
11803                         if x1.Op != OpPPC64MOVBZload {
11804                                 continue
11805                         }
11806                         i0 := auxIntToInt32(x1.AuxInt)
11807                         if auxToSym(x1.Aux) != s {
11808                                 continue
11809                         }
11810                         _ = x1.Args[1]
11811                         if p != x1.Args[0] || mem != x1.Args[1] || !(!config.BigEndian && i1 == i0+1 && x0.Uses == 1 && x1.Uses == 1 && o1.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, o1)) {
11812                                 continue
11813                         }
11814                         b = mergePoint(b, x0, x1)
11815                         v0 := b.NewValue0(x1.Pos, OpPPC64MOVHBRload, t)
11816                         v.copyOf(v0)
11817                         v1 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
11818                         v1.AuxInt = int32ToAuxInt(i0)
11819                         v1.Aux = symToAux(s)
11820                         v1.AddArg(p)
11821                         v0.AddArg2(v1, mem)
11822                         return true
11823                 }
11824                 break
11825         }
11826         // match: (OR <t> s0:(SLWconst x0:(MOVBZload [i1] {s} p mem) [n1]) s1:(SLWconst x1:(MOVBZload [i0] {s} p mem) [n2]))
11827         // cond: !config.BigEndian && i1 == i0+1 && n1%8 == 0 && n2 == n1+8 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, s0, s1)
11828         // result: @mergePoint(b,x0,x1) (SLDconst <t> (MOVHBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem) [n1])
11829         for {
11830                 t := v.Type
11831                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11832                         s0 := v_0
11833                         if s0.Op != OpPPC64SLWconst {
11834                                 continue
11835                         }
11836                         n1 := auxIntToInt64(s0.AuxInt)
11837                         x0 := s0.Args[0]
11838                         if x0.Op != OpPPC64MOVBZload {
11839                                 continue
11840                         }
11841                         i1 := auxIntToInt32(x0.AuxInt)
11842                         s := auxToSym(x0.Aux)
11843                         mem := x0.Args[1]
11844                         p := x0.Args[0]
11845                         s1 := v_1
11846                         if s1.Op != OpPPC64SLWconst {
11847                                 continue
11848                         }
11849                         n2 := auxIntToInt64(s1.AuxInt)
11850                         x1 := s1.Args[0]
11851                         if x1.Op != OpPPC64MOVBZload {
11852                                 continue
11853                         }
11854                         i0 := auxIntToInt32(x1.AuxInt)
11855                         if auxToSym(x1.Aux) != s {
11856                                 continue
11857                         }
11858                         _ = x1.Args[1]
11859                         if p != x1.Args[0] || mem != x1.Args[1] || !(!config.BigEndian && i1 == i0+1 && n1%8 == 0 && n2 == n1+8 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, s0, s1)) {
11860                                 continue
11861                         }
11862                         b = mergePoint(b, x0, x1)
11863                         v0 := b.NewValue0(x1.Pos, OpPPC64SLDconst, t)
11864                         v.copyOf(v0)
11865                         v0.AuxInt = int64ToAuxInt(n1)
11866                         v1 := b.NewValue0(x1.Pos, OpPPC64MOVHBRload, t)
11867                         v2 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
11868                         v2.AuxInt = int32ToAuxInt(i0)
11869                         v2.Aux = symToAux(s)
11870                         v2.AddArg(p)
11871                         v1.AddArg2(v2, mem)
11872                         v0.AddArg(v1)
11873                         return true
11874                 }
11875                 break
11876         }
11877         // match: (OR <t> s0:(SLDconst x0:(MOVBZload [i1] {s} p mem) [n1]) s1:(SLDconst x1:(MOVBZload [i0] {s} p mem) [n2]))
11878         // cond: !config.BigEndian && i1 == i0+1 && n1%8 == 0 && n2 == n1+8 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, s0, s1)
11879         // result: @mergePoint(b,x0,x1) (SLDconst <t> (MOVHBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem) [n1])
11880         for {
11881                 t := v.Type
11882                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11883                         s0 := v_0
11884                         if s0.Op != OpPPC64SLDconst {
11885                                 continue
11886                         }
11887                         n1 := auxIntToInt64(s0.AuxInt)
11888                         x0 := s0.Args[0]
11889                         if x0.Op != OpPPC64MOVBZload {
11890                                 continue
11891                         }
11892                         i1 := auxIntToInt32(x0.AuxInt)
11893                         s := auxToSym(x0.Aux)
11894                         mem := x0.Args[1]
11895                         p := x0.Args[0]
11896                         s1 := v_1
11897                         if s1.Op != OpPPC64SLDconst {
11898                                 continue
11899                         }
11900                         n2 := auxIntToInt64(s1.AuxInt)
11901                         x1 := s1.Args[0]
11902                         if x1.Op != OpPPC64MOVBZload {
11903                                 continue
11904                         }
11905                         i0 := auxIntToInt32(x1.AuxInt)
11906                         if auxToSym(x1.Aux) != s {
11907                                 continue
11908                         }
11909                         _ = x1.Args[1]
11910                         if p != x1.Args[0] || mem != x1.Args[1] || !(!config.BigEndian && i1 == i0+1 && n1%8 == 0 && n2 == n1+8 && x0.Uses == 1 && x1.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1) != nil && clobber(x0, x1, s0, s1)) {
11911                                 continue
11912                         }
11913                         b = mergePoint(b, x0, x1)
11914                         v0 := b.NewValue0(x1.Pos, OpPPC64SLDconst, t)
11915                         v.copyOf(v0)
11916                         v0.AuxInt = int64ToAuxInt(n1)
11917                         v1 := b.NewValue0(x1.Pos, OpPPC64MOVHBRload, t)
11918                         v2 := b.NewValue0(x1.Pos, OpPPC64MOVDaddr, typ.Uintptr)
11919                         v2.AuxInt = int32ToAuxInt(i0)
11920                         v2.Aux = symToAux(s)
11921                         v2.AddArg(p)
11922                         v1.AddArg2(v2, mem)
11923                         v0.AddArg(v1)
11924                         return true
11925                 }
11926                 break
11927         }
11928         // match: (OR <t> s1:(SLWconst x2:(MOVBZload [i3] {s} p mem) [24]) o0:(OR <t> s0:(SLWconst x1:(MOVBZload [i2] {s} p mem) [16]) x0:(MOVHZload [i0] {s} p mem)))
11929         // cond: !config.BigEndian && i2 == i0+2 && i3 == i0+3 && x0.Uses ==1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)
11930         // result: @mergePoint(b,x0,x1,x2) (MOVWZload <t> {s} [i0] p mem)
11931         for {
11932                 t := v.Type
11933                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11934                         s1 := v_0
11935                         if s1.Op != OpPPC64SLWconst || auxIntToInt64(s1.AuxInt) != 24 {
11936                                 continue
11937                         }
11938                         x2 := s1.Args[0]
11939                         if x2.Op != OpPPC64MOVBZload {
11940                                 continue
11941                         }
11942                         i3 := auxIntToInt32(x2.AuxInt)
11943                         s := auxToSym(x2.Aux)
11944                         mem := x2.Args[1]
11945                         p := x2.Args[0]
11946                         o0 := v_1
11947                         if o0.Op != OpPPC64OR || o0.Type != t {
11948                                 continue
11949                         }
11950                         _ = o0.Args[1]
11951                         o0_0 := o0.Args[0]
11952                         o0_1 := o0.Args[1]
11953                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
11954                                 s0 := o0_0
11955                                 if s0.Op != OpPPC64SLWconst || auxIntToInt64(s0.AuxInt) != 16 {
11956                                         continue
11957                                 }
11958                                 x1 := s0.Args[0]
11959                                 if x1.Op != OpPPC64MOVBZload {
11960                                         continue
11961                                 }
11962                                 i2 := auxIntToInt32(x1.AuxInt)
11963                                 if auxToSym(x1.Aux) != s {
11964                                         continue
11965                                 }
11966                                 _ = x1.Args[1]
11967                                 if p != x1.Args[0] || mem != x1.Args[1] {
11968                                         continue
11969                                 }
11970                                 x0 := o0_1
11971                                 if x0.Op != OpPPC64MOVHZload {
11972                                         continue
11973                                 }
11974                                 i0 := auxIntToInt32(x0.AuxInt)
11975                                 if auxToSym(x0.Aux) != s {
11976                                         continue
11977                                 }
11978                                 _ = x0.Args[1]
11979                                 if p != x0.Args[0] || mem != x0.Args[1] || !(!config.BigEndian && i2 == i0+2 && i3 == i0+3 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)) {
11980                                         continue
11981                                 }
11982                                 b = mergePoint(b, x0, x1, x2)
11983                                 v0 := b.NewValue0(x0.Pos, OpPPC64MOVWZload, t)
11984                                 v.copyOf(v0)
11985                                 v0.AuxInt = int32ToAuxInt(i0)
11986                                 v0.Aux = symToAux(s)
11987                                 v0.AddArg2(p, mem)
11988                                 return true
11989                         }
11990                 }
11991                 break
11992         }
11993         // match: (OR <t> s1:(SLDconst x2:(MOVBZload [i3] {s} p mem) [24]) o0:(OR <t> s0:(SLDconst x1:(MOVBZload [i2] {s} p mem) [16]) x0:(MOVHZload [i0] {s} p mem)))
11994         // cond: !config.BigEndian && i2 == i0+2 && i3 == i0+3 && x0.Uses ==1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)
11995         // result: @mergePoint(b,x0,x1,x2) (MOVWZload <t> {s} [i0] p mem)
11996         for {
11997                 t := v.Type
11998                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11999                         s1 := v_0
12000                         if s1.Op != OpPPC64SLDconst || auxIntToInt64(s1.AuxInt) != 24 {
12001                                 continue
12002                         }
12003                         x2 := s1.Args[0]
12004                         if x2.Op != OpPPC64MOVBZload {
12005                                 continue
12006                         }
12007                         i3 := auxIntToInt32(x2.AuxInt)
12008                         s := auxToSym(x2.Aux)
12009                         mem := x2.Args[1]
12010                         p := x2.Args[0]
12011                         o0 := v_1
12012                         if o0.Op != OpPPC64OR || o0.Type != t {
12013                                 continue
12014                         }
12015                         _ = o0.Args[1]
12016                         o0_0 := o0.Args[0]
12017                         o0_1 := o0.Args[1]
12018                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
12019                                 s0 := o0_0
12020                                 if s0.Op != OpPPC64SLDconst || auxIntToInt64(s0.AuxInt) != 16 {
12021                                         continue
12022                                 }
12023                                 x1 := s0.Args[0]
12024                                 if x1.Op != OpPPC64MOVBZload {
12025                                         continue
12026                                 }
12027                                 i2 := auxIntToInt32(x1.AuxInt)
12028                                 if auxToSym(x1.Aux) != s {
12029                                         continue
12030                                 }
12031                                 _ = x1.Args[1]
12032                                 if p != x1.Args[0] || mem != x1.Args[1] {
12033                                         continue
12034                                 }
12035                                 x0 := o0_1
12036                                 if x0.Op != OpPPC64MOVHZload {
12037                                         continue
12038                                 }
12039                                 i0 := auxIntToInt32(x0.AuxInt)
12040                                 if auxToSym(x0.Aux) != s {
12041                                         continue
12042                                 }
12043                                 _ = x0.Args[1]
12044                                 if p != x0.Args[0] || mem != x0.Args[1] || !(!config.BigEndian && i2 == i0+2 && i3 == i0+3 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)) {
12045                                         continue
12046                                 }
12047                                 b = mergePoint(b, x0, x1, x2)
12048                                 v0 := b.NewValue0(x0.Pos, OpPPC64MOVWZload, t)
12049                                 v.copyOf(v0)
12050                                 v0.AuxInt = int32ToAuxInt(i0)
12051                                 v0.Aux = symToAux(s)
12052                                 v0.AddArg2(p, mem)
12053                                 return true
12054                         }
12055                 }
12056                 break
12057         }
12058         // match: (OR <t> s1:(SLWconst x2:(MOVBZload [i0] {s} p mem) [24]) o0:(OR <t> s0:(SLWconst x1:(MOVBZload [i1] {s} p mem) [16]) x0:(MOVHBRload <t> (MOVDaddr <typ.Uintptr> [i2] {s} p) mem)))
12059         // cond: !config.BigEndian && i1 == i0+1 && i2 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)
12060         // result: @mergePoint(b,x0,x1,x2) (MOVWBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem)
12061         for {
12062                 t := v.Type
12063                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12064                         s1 := v_0
12065                         if s1.Op != OpPPC64SLWconst || auxIntToInt64(s1.AuxInt) != 24 {
12066                                 continue
12067                         }
12068                         x2 := s1.Args[0]
12069                         if x2.Op != OpPPC64MOVBZload {
12070                                 continue
12071                         }
12072                         i0 := auxIntToInt32(x2.AuxInt)
12073                         s := auxToSym(x2.Aux)
12074                         mem := x2.Args[1]
12075                         p := x2.Args[0]
12076                         o0 := v_1
12077                         if o0.Op != OpPPC64OR || o0.Type != t {
12078                                 continue
12079                         }
12080                         _ = o0.Args[1]
12081                         o0_0 := o0.Args[0]
12082                         o0_1 := o0.Args[1]
12083                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
12084                                 s0 := o0_0
12085                                 if s0.Op != OpPPC64SLWconst || auxIntToInt64(s0.AuxInt) != 16 {
12086                                         continue
12087                                 }
12088                                 x1 := s0.Args[0]
12089                                 if x1.Op != OpPPC64MOVBZload {
12090                                         continue
12091                                 }
12092                                 i1 := auxIntToInt32(x1.AuxInt)
12093                                 if auxToSym(x1.Aux) != s {
12094                                         continue
12095                                 }
12096                                 _ = x1.Args[1]
12097                                 if p != x1.Args[0] || mem != x1.Args[1] {
12098                                         continue
12099                                 }
12100                                 x0 := o0_1
12101                                 if x0.Op != OpPPC64MOVHBRload || x0.Type != t {
12102                                         continue
12103                                 }
12104                                 _ = x0.Args[1]
12105                                 x0_0 := x0.Args[0]
12106                                 if x0_0.Op != OpPPC64MOVDaddr || x0_0.Type != typ.Uintptr {
12107                                         continue
12108                                 }
12109                                 i2 := auxIntToInt32(x0_0.AuxInt)
12110                                 if auxToSym(x0_0.Aux) != s || p != x0_0.Args[0] || mem != x0.Args[1] || !(!config.BigEndian && i1 == i0+1 && i2 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)) {
12111                                         continue
12112                                 }
12113                                 b = mergePoint(b, x0, x1, x2)
12114                                 v0 := b.NewValue0(x0.Pos, OpPPC64MOVWBRload, t)
12115                                 v.copyOf(v0)
12116                                 v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
12117                                 v1.AuxInt = int32ToAuxInt(i0)
12118                                 v1.Aux = symToAux(s)
12119                                 v1.AddArg(p)
12120                                 v0.AddArg2(v1, mem)
12121                                 return true
12122                         }
12123                 }
12124                 break
12125         }
12126         // match: (OR <t> s1:(SLDconst x2:(MOVBZload [i0] {s} p mem) [24]) o0:(OR <t> s0:(SLDconst x1:(MOVBZload [i1] {s} p mem) [16]) x0:(MOVHBRload <t> (MOVDaddr <typ.Uintptr> [i2] {s} p) mem)))
12127         // cond: !config.BigEndian && i1 == i0+1 && i2 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)
12128         // result: @mergePoint(b,x0,x1,x2) (MOVWBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem)
12129         for {
12130                 t := v.Type
12131                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12132                         s1 := v_0
12133                         if s1.Op != OpPPC64SLDconst || auxIntToInt64(s1.AuxInt) != 24 {
12134                                 continue
12135                         }
12136                         x2 := s1.Args[0]
12137                         if x2.Op != OpPPC64MOVBZload {
12138                                 continue
12139                         }
12140                         i0 := auxIntToInt32(x2.AuxInt)
12141                         s := auxToSym(x2.Aux)
12142                         mem := x2.Args[1]
12143                         p := x2.Args[0]
12144                         o0 := v_1
12145                         if o0.Op != OpPPC64OR || o0.Type != t {
12146                                 continue
12147                         }
12148                         _ = o0.Args[1]
12149                         o0_0 := o0.Args[0]
12150                         o0_1 := o0.Args[1]
12151                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
12152                                 s0 := o0_0
12153                                 if s0.Op != OpPPC64SLDconst || auxIntToInt64(s0.AuxInt) != 16 {
12154                                         continue
12155                                 }
12156                                 x1 := s0.Args[0]
12157                                 if x1.Op != OpPPC64MOVBZload {
12158                                         continue
12159                                 }
12160                                 i1 := auxIntToInt32(x1.AuxInt)
12161                                 if auxToSym(x1.Aux) != s {
12162                                         continue
12163                                 }
12164                                 _ = x1.Args[1]
12165                                 if p != x1.Args[0] || mem != x1.Args[1] {
12166                                         continue
12167                                 }
12168                                 x0 := o0_1
12169                                 if x0.Op != OpPPC64MOVHBRload || x0.Type != t {
12170                                         continue
12171                                 }
12172                                 _ = x0.Args[1]
12173                                 x0_0 := x0.Args[0]
12174                                 if x0_0.Op != OpPPC64MOVDaddr || x0_0.Type != typ.Uintptr {
12175                                         continue
12176                                 }
12177                                 i2 := auxIntToInt32(x0_0.AuxInt)
12178                                 if auxToSym(x0_0.Aux) != s || p != x0_0.Args[0] || mem != x0.Args[1] || !(!config.BigEndian && i1 == i0+1 && i2 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)) {
12179                                         continue
12180                                 }
12181                                 b = mergePoint(b, x0, x1, x2)
12182                                 v0 := b.NewValue0(x0.Pos, OpPPC64MOVWBRload, t)
12183                                 v.copyOf(v0)
12184                                 v1 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
12185                                 v1.AuxInt = int32ToAuxInt(i0)
12186                                 v1.Aux = symToAux(s)
12187                                 v1.AddArg(p)
12188                                 v0.AddArg2(v1, mem)
12189                                 return true
12190                         }
12191                 }
12192                 break
12193         }
12194         // match: (OR <t> x0:(MOVBZload [i3] {s} p mem) o0:(OR <t> s0:(SLWconst x1:(MOVBZload [i2] {s} p mem) [8]) s1:(SLWconst x2:(MOVHBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem) [16])))
12195         // cond: !config.BigEndian && i2 == i0+2 && i3 == i0+3 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)
12196         // result: @mergePoint(b,x0,x1,x2) (MOVWBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem)
12197         for {
12198                 t := v.Type
12199                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12200                         x0 := v_0
12201                         if x0.Op != OpPPC64MOVBZload {
12202                                 continue
12203                         }
12204                         i3 := auxIntToInt32(x0.AuxInt)
12205                         s := auxToSym(x0.Aux)
12206                         mem := x0.Args[1]
12207                         p := x0.Args[0]
12208                         o0 := v_1
12209                         if o0.Op != OpPPC64OR || o0.Type != t {
12210                                 continue
12211                         }
12212                         _ = o0.Args[1]
12213                         o0_0 := o0.Args[0]
12214                         o0_1 := o0.Args[1]
12215                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
12216                                 s0 := o0_0
12217                                 if s0.Op != OpPPC64SLWconst || auxIntToInt64(s0.AuxInt) != 8 {
12218                                         continue
12219                                 }
12220                                 x1 := s0.Args[0]
12221                                 if x1.Op != OpPPC64MOVBZload {
12222                                         continue
12223                                 }
12224                                 i2 := auxIntToInt32(x1.AuxInt)
12225                                 if auxToSym(x1.Aux) != s {
12226                                         continue
12227                                 }
12228                                 _ = x1.Args[1]
12229                                 if p != x1.Args[0] || mem != x1.Args[1] {
12230                                         continue
12231                                 }
12232                                 s1 := o0_1
12233                                 if s1.Op != OpPPC64SLWconst || auxIntToInt64(s1.AuxInt) != 16 {
12234                                         continue
12235                                 }
12236                                 x2 := s1.Args[0]
12237                                 if x2.Op != OpPPC64MOVHBRload || x2.Type != t {
12238                                         continue
12239                                 }
12240                                 _ = x2.Args[1]
12241                                 x2_0 := x2.Args[0]
12242                                 if x2_0.Op != OpPPC64MOVDaddr || x2_0.Type != typ.Uintptr {
12243                                         continue
12244                                 }
12245                                 i0 := auxIntToInt32(x2_0.AuxInt)
12246                                 if auxToSym(x2_0.Aux) != s || p != x2_0.Args[0] || mem != x2.Args[1] || !(!config.BigEndian && i2 == i0+2 && i3 == i0+3 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)) {
12247                                         continue
12248                                 }
12249                                 b = mergePoint(b, x0, x1, x2)
12250                                 v0 := b.NewValue0(x2.Pos, OpPPC64MOVWBRload, t)
12251                                 v.copyOf(v0)
12252                                 v1 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
12253                                 v1.AuxInt = int32ToAuxInt(i0)
12254                                 v1.Aux = symToAux(s)
12255                                 v1.AddArg(p)
12256                                 v0.AddArg2(v1, mem)
12257                                 return true
12258                         }
12259                 }
12260                 break
12261         }
12262         // match: (OR <t> x0:(MOVBZload [i3] {s} p mem) o0:(OR <t> s0:(SLDconst x1:(MOVBZload [i2] {s} p mem) [8]) s1:(SLDconst x2:(MOVHBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem) [16])))
12263         // cond: !config.BigEndian && i2 == i0+2 && i3 == i0+3 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)
12264         // result: @mergePoint(b,x0,x1,x2) (MOVWBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem)
12265         for {
12266                 t := v.Type
12267                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12268                         x0 := v_0
12269                         if x0.Op != OpPPC64MOVBZload {
12270                                 continue
12271                         }
12272                         i3 := auxIntToInt32(x0.AuxInt)
12273                         s := auxToSym(x0.Aux)
12274                         mem := x0.Args[1]
12275                         p := x0.Args[0]
12276                         o0 := v_1
12277                         if o0.Op != OpPPC64OR || o0.Type != t {
12278                                 continue
12279                         }
12280                         _ = o0.Args[1]
12281                         o0_0 := o0.Args[0]
12282                         o0_1 := o0.Args[1]
12283                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
12284                                 s0 := o0_0
12285                                 if s0.Op != OpPPC64SLDconst || auxIntToInt64(s0.AuxInt) != 8 {
12286                                         continue
12287                                 }
12288                                 x1 := s0.Args[0]
12289                                 if x1.Op != OpPPC64MOVBZload {
12290                                         continue
12291                                 }
12292                                 i2 := auxIntToInt32(x1.AuxInt)
12293                                 if auxToSym(x1.Aux) != s {
12294                                         continue
12295                                 }
12296                                 _ = x1.Args[1]
12297                                 if p != x1.Args[0] || mem != x1.Args[1] {
12298                                         continue
12299                                 }
12300                                 s1 := o0_1
12301                                 if s1.Op != OpPPC64SLDconst || auxIntToInt64(s1.AuxInt) != 16 {
12302                                         continue
12303                                 }
12304                                 x2 := s1.Args[0]
12305                                 if x2.Op != OpPPC64MOVHBRload || x2.Type != t {
12306                                         continue
12307                                 }
12308                                 _ = x2.Args[1]
12309                                 x2_0 := x2.Args[0]
12310                                 if x2_0.Op != OpPPC64MOVDaddr || x2_0.Type != typ.Uintptr {
12311                                         continue
12312                                 }
12313                                 i0 := auxIntToInt32(x2_0.AuxInt)
12314                                 if auxToSym(x2_0.Aux) != s || p != x2_0.Args[0] || mem != x2.Args[1] || !(!config.BigEndian && i2 == i0+2 && i3 == i0+3 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, o0)) {
12315                                         continue
12316                                 }
12317                                 b = mergePoint(b, x0, x1, x2)
12318                                 v0 := b.NewValue0(x2.Pos, OpPPC64MOVWBRload, t)
12319                                 v.copyOf(v0)
12320                                 v1 := b.NewValue0(x2.Pos, OpPPC64MOVDaddr, typ.Uintptr)
12321                                 v1.AuxInt = int32ToAuxInt(i0)
12322                                 v1.Aux = symToAux(s)
12323                                 v1.AddArg(p)
12324                                 v0.AddArg2(v1, mem)
12325                                 return true
12326                         }
12327                 }
12328                 break
12329         }
12330         // match: (OR <t> s2:(SLDconst x2:(MOVBZload [i3] {s} p mem) [32]) o0:(OR <t> s1:(SLDconst x1:(MOVBZload [i2] {s} p mem) [40]) s0:(SLDconst x0:(MOVHBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem) [48])))
12331         // cond: !config.BigEndian && i2 == i0+2 && i3 == i0+3 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && s2.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, s2, o0)
12332         // result: @mergePoint(b,x0,x1,x2) (SLDconst <t> (MOVWBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem) [32])
12333         for {
12334                 t := v.Type
12335                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12336                         s2 := v_0
12337                         if s2.Op != OpPPC64SLDconst || auxIntToInt64(s2.AuxInt) != 32 {
12338                                 continue
12339                         }
12340                         x2 := s2.Args[0]
12341                         if x2.Op != OpPPC64MOVBZload {
12342                                 continue
12343                         }
12344                         i3 := auxIntToInt32(x2.AuxInt)
12345                         s := auxToSym(x2.Aux)
12346                         mem := x2.Args[1]
12347                         p := x2.Args[0]
12348                         o0 := v_1
12349                         if o0.Op != OpPPC64OR || o0.Type != t {
12350                                 continue
12351                         }
12352                         _ = o0.Args[1]
12353                         o0_0 := o0.Args[0]
12354                         o0_1 := o0.Args[1]
12355                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
12356                                 s1 := o0_0
12357                                 if s1.Op != OpPPC64SLDconst || auxIntToInt64(s1.AuxInt) != 40 {
12358                                         continue
12359                                 }
12360                                 x1 := s1.Args[0]
12361                                 if x1.Op != OpPPC64MOVBZload {
12362                                         continue
12363                                 }
12364                                 i2 := auxIntToInt32(x1.AuxInt)
12365                                 if auxToSym(x1.Aux) != s {
12366                                         continue
12367                                 }
12368                                 _ = x1.Args[1]
12369                                 if p != x1.Args[0] || mem != x1.Args[1] {
12370                                         continue
12371                                 }
12372                                 s0 := o0_1
12373                                 if s0.Op != OpPPC64SLDconst || auxIntToInt64(s0.AuxInt) != 48 {
12374                                         continue
12375                                 }
12376                                 x0 := s0.Args[0]
12377                                 if x0.Op != OpPPC64MOVHBRload || x0.Type != t {
12378                                         continue
12379                                 }
12380                                 _ = x0.Args[1]
12381                                 x0_0 := x0.Args[0]
12382                                 if x0_0.Op != OpPPC64MOVDaddr || x0_0.Type != typ.Uintptr {
12383                                         continue
12384                                 }
12385                                 i0 := auxIntToInt32(x0_0.AuxInt)
12386                                 if auxToSym(x0_0.Aux) != s || p != x0_0.Args[0] || mem != x0.Args[1] || !(!config.BigEndian && i2 == i0+2 && i3 == i0+3 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && s2.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, s2, o0)) {
12387                                         continue
12388                                 }
12389                                 b = mergePoint(b, x0, x1, x2)
12390                                 v0 := b.NewValue0(x0.Pos, OpPPC64SLDconst, t)
12391                                 v.copyOf(v0)
12392                                 v0.AuxInt = int64ToAuxInt(32)
12393                                 v1 := b.NewValue0(x0.Pos, OpPPC64MOVWBRload, t)
12394                                 v2 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
12395                                 v2.AuxInt = int32ToAuxInt(i0)
12396                                 v2.Aux = symToAux(s)
12397                                 v2.AddArg(p)
12398                                 v1.AddArg2(v2, mem)
12399                                 v0.AddArg(v1)
12400                                 return true
12401                         }
12402                 }
12403                 break
12404         }
12405         // match: (OR <t> s2:(SLDconst x2:(MOVBZload [i0] {s} p mem) [56]) o0:(OR <t> s1:(SLDconst x1:(MOVBZload [i1] {s} p mem) [48]) s0:(SLDconst x0:(MOVHBRload <t> (MOVDaddr <typ.Uintptr> [i2] {s} p) mem) [32])))
12406         // cond: !config.BigEndian && i1 == i0+1 && i2 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && s2.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, s2, o0)
12407         // result: @mergePoint(b,x0,x1,x2) (SLDconst <t> (MOVWBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem) [32])
12408         for {
12409                 t := v.Type
12410                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12411                         s2 := v_0
12412                         if s2.Op != OpPPC64SLDconst || auxIntToInt64(s2.AuxInt) != 56 {
12413                                 continue
12414                         }
12415                         x2 := s2.Args[0]
12416                         if x2.Op != OpPPC64MOVBZload {
12417                                 continue
12418                         }
12419                         i0 := auxIntToInt32(x2.AuxInt)
12420                         s := auxToSym(x2.Aux)
12421                         mem := x2.Args[1]
12422                         p := x2.Args[0]
12423                         o0 := v_1
12424                         if o0.Op != OpPPC64OR || o0.Type != t {
12425                                 continue
12426                         }
12427                         _ = o0.Args[1]
12428                         o0_0 := o0.Args[0]
12429                         o0_1 := o0.Args[1]
12430                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
12431                                 s1 := o0_0
12432                                 if s1.Op != OpPPC64SLDconst || auxIntToInt64(s1.AuxInt) != 48 {
12433                                         continue
12434                                 }
12435                                 x1 := s1.Args[0]
12436                                 if x1.Op != OpPPC64MOVBZload {
12437                                         continue
12438                                 }
12439                                 i1 := auxIntToInt32(x1.AuxInt)
12440                                 if auxToSym(x1.Aux) != s {
12441                                         continue
12442                                 }
12443                                 _ = x1.Args[1]
12444                                 if p != x1.Args[0] || mem != x1.Args[1] {
12445                                         continue
12446                                 }
12447                                 s0 := o0_1
12448                                 if s0.Op != OpPPC64SLDconst || auxIntToInt64(s0.AuxInt) != 32 {
12449                                         continue
12450                                 }
12451                                 x0 := s0.Args[0]
12452                                 if x0.Op != OpPPC64MOVHBRload || x0.Type != t {
12453                                         continue
12454                                 }
12455                                 _ = x0.Args[1]
12456                                 x0_0 := x0.Args[0]
12457                                 if x0_0.Op != OpPPC64MOVDaddr || x0_0.Type != typ.Uintptr {
12458                                         continue
12459                                 }
12460                                 i2 := auxIntToInt32(x0_0.AuxInt)
12461                                 if auxToSym(x0_0.Aux) != s || p != x0_0.Args[0] || mem != x0.Args[1] || !(!config.BigEndian && i1 == i0+1 && i2 == i0+2 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && o0.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && s2.Uses == 1 && mergePoint(b, x0, x1, x2) != nil && clobber(x0, x1, x2, s0, s1, s2, o0)) {
12462                                         continue
12463                                 }
12464                                 b = mergePoint(b, x0, x1, x2)
12465                                 v0 := b.NewValue0(x0.Pos, OpPPC64SLDconst, t)
12466                                 v.copyOf(v0)
12467                                 v0.AuxInt = int64ToAuxInt(32)
12468                                 v1 := b.NewValue0(x0.Pos, OpPPC64MOVWBRload, t)
12469                                 v2 := b.NewValue0(x0.Pos, OpPPC64MOVDaddr, typ.Uintptr)
12470                                 v2.AuxInt = int32ToAuxInt(i0)
12471                                 v2.Aux = symToAux(s)
12472                                 v2.AddArg(p)
12473                                 v1.AddArg2(v2, mem)
12474                                 v0.AddArg(v1)
12475                                 return true
12476                         }
12477                 }
12478                 break
12479         }
12480         // match: (OR <t> s6:(SLDconst x7:(MOVBZload [i7] {s} p mem) [56]) o5:(OR <t> s5:(SLDconst x6:(MOVBZload [i6] {s} p mem) [48]) o4:(OR <t> s4:(SLDconst x5:(MOVBZload [i5] {s} p mem) [40]) o3:(OR <t> s3:(SLDconst x4:(MOVBZload [i4] {s} p mem) [32]) x0:(MOVWZload {s} [i0] p mem)))))
12481         // cond: !config.BigEndian && i4 == i0+4 && i5 == i0+5 && i6 == i0+6 && i7 == i0+7 && x0.Uses == 1 && x4.Uses == 1 && x5.Uses == 1 && x6.Uses ==1 && x7.Uses == 1 && o3.Uses == 1 && o4.Uses == 1 && o5.Uses == 1 && s3.Uses == 1 && s4.Uses == 1 && s5.Uses == 1 && s6.Uses == 1 && mergePoint(b, x0, x4, x5, x6, x7) != nil && clobber(x0, x4, x5, x6, x7, s3, s4, s5, s6, o3, o4, o5)
12482         // result: @mergePoint(b,x0,x4,x5,x6,x7) (MOVDload <t> {s} [i0] p mem)
12483         for {
12484                 t := v.Type
12485                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12486                         s6 := v_0
12487                         if s6.Op != OpPPC64SLDconst || auxIntToInt64(s6.AuxInt) != 56 {
12488                                 continue
12489                         }
12490                         x7 := s6.Args[0]
12491                         if x7.Op != OpPPC64MOVBZload {
12492                                 continue
12493                         }
12494                         i7 := auxIntToInt32(x7.AuxInt)
12495                         s := auxToSym(x7.Aux)
12496                         mem := x7.Args[1]
12497                         p := x7.Args[0]
12498                         o5 := v_1
12499                         if o5.Op != OpPPC64OR || o5.Type != t {
12500                                 continue
12501                         }
12502                         _ = o5.Args[1]
12503                         o5_0 := o5.Args[0]
12504                         o5_1 := o5.Args[1]
12505                         for _i1 := 0; _i1 <= 1; _i1, o5_0, o5_1 = _i1+1, o5_1, o5_0 {
12506                                 s5 := o5_0
12507                                 if s5.Op != OpPPC64SLDconst || auxIntToInt64(s5.AuxInt) != 48 {
12508                                         continue
12509                                 }
12510                                 x6 := s5.Args[0]
12511                                 if x6.Op != OpPPC64MOVBZload {
12512                                         continue
12513                                 }
12514                                 i6 := auxIntToInt32(x6.AuxInt)
12515                                 if auxToSym(x6.Aux) != s {
12516                                         continue
12517                                 }
12518                                 _ = x6.Args[1]
12519                                 if p != x6.Args[0] || mem != x6.Args[1] {
12520                                         continue
12521                                 }
12522                                 o4 := o5_1
12523                                 if o4.Op != OpPPC64OR || o4.Type != t {
12524                                         continue
12525                                 }
12526                                 _ = o4.Args[1]
12527                                 o4_0 := o4.Args[0]
12528                                 o4_1 := o4.Args[1]
12529                                 for _i2 := 0; _i2 <= 1; _i2, o4_0, o4_1 = _i2+1, o4_1, o4_0 {
12530                                         s4 := o4_0
12531                                         if s4.Op != OpPPC64SLDconst || auxIntToInt64(s4.AuxInt) != 40 {
12532                                                 continue
12533                                         }
12534                                         x5 := s4.Args[0]
12535                                         if x5.Op != OpPPC64MOVBZload {
12536                                                 continue
12537                                         }
12538                                         i5 := auxIntToInt32(x5.AuxInt)
12539                                         if auxToSym(x5.Aux) != s {
12540                                                 continue
12541                                         }
12542                                         _ = x5.Args[1]
12543                                         if p != x5.Args[0] || mem != x5.Args[1] {
12544                                                 continue
12545                                         }
12546                                         o3 := o4_1
12547                                         if o3.Op != OpPPC64OR || o3.Type != t {
12548                                                 continue
12549                                         }
12550                                         _ = o3.Args[1]
12551                                         o3_0 := o3.Args[0]
12552                                         o3_1 := o3.Args[1]
12553                                         for _i3 := 0; _i3 <= 1; _i3, o3_0, o3_1 = _i3+1, o3_1, o3_0 {
12554                                                 s3 := o3_0
12555                                                 if s3.Op != OpPPC64SLDconst || auxIntToInt64(s3.AuxInt) != 32 {
12556                                                         continue
12557                                                 }
12558                                                 x4 := s3.Args[0]
12559                                                 if x4.Op != OpPPC64MOVBZload {
12560                                                         continue
12561                                                 }
12562                                                 i4 := auxIntToInt32(x4.AuxInt)
12563                                                 if auxToSym(x4.Aux) != s {
12564                                                         continue
12565                                                 }
12566                                                 _ = x4.Args[1]
12567                                                 if p != x4.Args[0] || mem != x4.Args[1] {
12568                                                         continue
12569                                                 }
12570                                                 x0 := o3_1
12571                                                 if x0.Op != OpPPC64MOVWZload {
12572                                                         continue
12573                                                 }
12574                                                 i0 := auxIntToInt32(x0.AuxInt)
12575                                                 if auxToSym(x0.Aux) != s {
12576                                                         continue
12577                                                 }
12578                                                 _ = x0.Args[1]
12579                                                 if p != x0.Args[0] || mem != x0.Args[1] || !(!config.BigEndian && i4 == i0+4 && i5 == i0+5 && i6 == i0+6 && i7 == i0+7 && x0.Uses == 1 && x4.Uses == 1 && x5.Uses == 1 && x6.Uses == 1 && x7.Uses == 1 && o3.Uses == 1 && o4.Uses == 1 && o5.Uses == 1 && s3.Uses == 1 && s4.Uses == 1 && s5.Uses == 1 && s6.Uses == 1 && mergePoint(b, x0, x4, x5, x6, x7) != nil && clobber(x0, x4, x5, x6, x7, s3, s4, s5, s6, o3, o4, o5)) {
12580                                                         continue
12581                                                 }
12582                                                 b = mergePoint(b, x0, x4, x5, x6, x7)
12583                                                 v0 := b.NewValue0(x0.Pos, OpPPC64MOVDload, t)
12584                                                 v.copyOf(v0)
12585                                                 v0.AuxInt = int32ToAuxInt(i0)
12586                                                 v0.Aux = symToAux(s)
12587                                                 v0.AddArg2(p, mem)
12588                                                 return true
12589                                         }
12590                                 }
12591                         }
12592                 }
12593                 break
12594         }
12595         // match: (OR <t> s0:(SLDconst x0:(MOVBZload [i0] {s} p mem) [56]) o0:(OR <t> s1:(SLDconst x1:(MOVBZload [i1] {s} p mem) [48]) o1:(OR <t> s2:(SLDconst x2:(MOVBZload [i2] {s} p mem) [40]) o2:(OR <t> s3:(SLDconst x3:(MOVBZload [i3] {s} p mem) [32]) x4:(MOVWBRload <t> (MOVDaddr <typ.Uintptr> [i4] p) mem)))))
12596         // cond: !config.BigEndian && i1 == i0+1 && i2 == i0+2 && i3 == i0+3 && i4 == i0+4 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && x4.Uses == 1 && o0.Uses == 1 && o1.Uses == 1 && o2.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && mergePoint(b, x0, x1, x2, x3, x4) != nil && clobber(x0, x1, x2, x3, x4, o0, o1, o2, s0, s1, s2, s3)
12597         // result: @mergePoint(b,x0,x1,x2,x3,x4) (MOVDBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem)
12598         for {
12599                 t := v.Type
12600                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12601                         s0 := v_0
12602                         if s0.Op != OpPPC64SLDconst || auxIntToInt64(s0.AuxInt) != 56 {
12603                                 continue
12604                         }
12605                         x0 := s0.Args[0]
12606                         if x0.Op != OpPPC64MOVBZload {
12607                                 continue
12608                         }
12609                         i0 := auxIntToInt32(x0.AuxInt)
12610                         s := auxToSym(x0.Aux)
12611                         mem := x0.Args[1]
12612                         p := x0.Args[0]
12613                         o0 := v_1
12614                         if o0.Op != OpPPC64OR || o0.Type != t {
12615                                 continue
12616                         }
12617                         _ = o0.Args[1]
12618                         o0_0 := o0.Args[0]
12619                         o0_1 := o0.Args[1]
12620                         for _i1 := 0; _i1 <= 1; _i1, o0_0, o0_1 = _i1+1, o0_1, o0_0 {
12621                                 s1 := o0_0
12622                                 if s1.Op != OpPPC64SLDconst || auxIntToInt64(s1.AuxInt) != 48 {
12623                                         continue
12624                                 }
12625                                 x1 := s1.Args[0]
12626                                 if x1.Op != OpPPC64MOVBZload {
12627                                         continue
12628                                 }
12629                                 i1 := auxIntToInt32(x1.AuxInt)
12630                                 if auxToSym(x1.Aux) != s {
12631                                         continue
12632                                 }
12633                                 _ = x1.Args[1]
12634                                 if p != x1.Args[0] || mem != x1.Args[1] {
12635                                         continue
12636                                 }
12637                                 o1 := o0_1
12638                                 if o1.Op != OpPPC64OR || o1.Type != t {
12639                                         continue
12640                                 }
12641                                 _ = o1.Args[1]
12642                                 o1_0 := o1.Args[0]
12643                                 o1_1 := o1.Args[1]
12644                                 for _i2 := 0; _i2 <= 1; _i2, o1_0, o1_1 = _i2+1, o1_1, o1_0 {
12645                                         s2 := o1_0
12646                                         if s2.Op != OpPPC64SLDconst || auxIntToInt64(s2.AuxInt) != 40 {
12647                                                 continue
12648                                         }
12649                                         x2 := s2.Args[0]
12650                                         if x2.Op != OpPPC64MOVBZload {
12651                                                 continue
12652                                         }
12653                                         i2 := auxIntToInt32(x2.AuxInt)
12654                                         if auxToSym(x2.Aux) != s {
12655                                                 continue
12656                                         }
12657                                         _ = x2.Args[1]
12658                                         if p != x2.Args[0] || mem != x2.Args[1] {
12659                                                 continue
12660                                         }
12661                                         o2 := o1_1
12662                                         if o2.Op != OpPPC64OR || o2.Type != t {
12663                                                 continue
12664                                         }
12665                                         _ = o2.Args[1]
12666                                         o2_0 := o2.Args[0]
12667                                         o2_1 := o2.Args[1]
12668                                         for _i3 := 0; _i3 <= 1; _i3, o2_0, o2_1 = _i3+1, o2_1, o2_0 {
12669                                                 s3 := o2_0
12670                                                 if s3.Op != OpPPC64SLDconst || auxIntToInt64(s3.AuxInt) != 32 {
12671                                                         continue
12672                                                 }
12673                                                 x3 := s3.Args[0]
12674                                                 if x3.Op != OpPPC64MOVBZload {
12675                                                         continue
12676                                                 }
12677                                                 i3 := auxIntToInt32(x3.AuxInt)
12678                                                 if auxToSym(x3.Aux) != s {
12679                                                         continue
12680                                                 }
12681                                                 _ = x3.Args[1]
12682                                                 if p != x3.Args[0] || mem != x3.Args[1] {
12683                                                         continue
12684                                                 }
12685                                                 x4 := o2_1
12686                                                 if x4.Op != OpPPC64MOVWBRload || x4.Type != t {
12687                                                         continue
12688                                                 }
12689                                                 _ = x4.Args[1]
12690                                                 x4_0 := x4.Args[0]
12691                                                 if x4_0.Op != OpPPC64MOVDaddr || x4_0.Type != typ.Uintptr {
12692                                                         continue
12693                                                 }
12694                                                 i4 := auxIntToInt32(x4_0.AuxInt)
12695                                                 if p != x4_0.Args[0] || mem != x4.Args[1] || !(!config.BigEndian && i1 == i0+1 && i2 == i0+2 && i3 == i0+3 && i4 == i0+4 && x0.Uses == 1 && x1.Uses == 1 && x2.Uses == 1 && x3.Uses == 1 && x4.Uses == 1 && o0.Uses == 1 && o1.Uses == 1 && o2.Uses == 1 && s0.Uses == 1 && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && mergePoint(b, x0, x1, x2, x3, x4) != nil && clobber(x0, x1, x2, x3, x4, o0, o1, o2, s0, s1, s2, s3)) {
12696                                                         continue
12697                                                 }
12698                                                 b = mergePoint(b, x0, x1, x2, x3, x4)
12699                                                 v0 := b.NewValue0(x4.Pos, OpPPC64MOVDBRload, t)
12700                                                 v.copyOf(v0)
12701                                                 v1 := b.NewValue0(x4.Pos, OpPPC64MOVDaddr, typ.Uintptr)
12702                                                 v1.AuxInt = int32ToAuxInt(i0)
12703                                                 v1.Aux = symToAux(s)
12704                                                 v1.AddArg(p)
12705                                                 v0.AddArg2(v1, mem)
12706                                                 return true
12707                                         }
12708                                 }
12709                         }
12710                 }
12711                 break
12712         }
12713         // match: (OR <t> x7:(MOVBZload [i7] {s} p mem) o5:(OR <t> s6:(SLDconst x6:(MOVBZload [i6] {s} p mem) [8]) o4:(OR <t> s5:(SLDconst x5:(MOVBZload [i5] {s} p mem) [16]) o3:(OR <t> s4:(SLDconst x4:(MOVBZload [i4] {s} p mem) [24]) s0:(SLWconst x3:(MOVWBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem) [32])))))
12714         // cond: !config.BigEndian && i4 == i0+4 && i5 == i0+5 && i6 == i0+6 && i7 == i0+7 && x3.Uses == 1 && x4.Uses == 1 && x5.Uses == 1 && x6.Uses == 1 && x7.Uses == 1 && o3.Uses == 1 && o4.Uses == 1 && o5.Uses == 1 && s0.Uses == 1 && s4.Uses == 1 && s5.Uses == 1 && s6.Uses == 1 && mergePoint(b, x3, x4, x5, x6, x7) != nil && clobber(x3, x4, x5, x6, x7, o3, o4, o5, s0, s4, s5, s6)
12715         // result: @mergePoint(b,x3,x4,x5,x6,x7) (MOVDBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem)
12716         for {
12717                 t := v.Type
12718                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12719                         x7 := v_0
12720                         if x7.Op != OpPPC64MOVBZload {
12721                                 continue
12722                         }
12723                         i7 := auxIntToInt32(x7.AuxInt)
12724                         s := auxToSym(x7.Aux)
12725                         mem := x7.Args[1]
12726                         p := x7.Args[0]
12727                         o5 := v_1
12728                         if o5.Op != OpPPC64OR || o5.Type != t {
12729                                 continue
12730                         }
12731                         _ = o5.Args[1]
12732                         o5_0 := o5.Args[0]
12733                         o5_1 := o5.Args[1]
12734                         for _i1 := 0; _i1 <= 1; _i1, o5_0, o5_1 = _i1+1, o5_1, o5_0 {
12735                                 s6 := o5_0
12736                                 if s6.Op != OpPPC64SLDconst || auxIntToInt64(s6.AuxInt) != 8 {
12737                                         continue
12738                                 }
12739                                 x6 := s6.Args[0]
12740                                 if x6.Op != OpPPC64MOVBZload {
12741                                         continue
12742                                 }
12743                                 i6 := auxIntToInt32(x6.AuxInt)
12744                                 if auxToSym(x6.Aux) != s {
12745                                         continue
12746                                 }
12747                                 _ = x6.Args[1]
12748                                 if p != x6.Args[0] || mem != x6.Args[1] {
12749                                         continue
12750                                 }
12751                                 o4 := o5_1
12752                                 if o4.Op != OpPPC64OR || o4.Type != t {
12753                                         continue
12754                                 }
12755                                 _ = o4.Args[1]
12756                                 o4_0 := o4.Args[0]
12757                                 o4_1 := o4.Args[1]
12758                                 for _i2 := 0; _i2 <= 1; _i2, o4_0, o4_1 = _i2+1, o4_1, o4_0 {
12759                                         s5 := o4_0
12760                                         if s5.Op != OpPPC64SLDconst || auxIntToInt64(s5.AuxInt) != 16 {
12761                                                 continue
12762                                         }
12763                                         x5 := s5.Args[0]
12764                                         if x5.Op != OpPPC64MOVBZload {
12765                                                 continue
12766                                         }
12767                                         i5 := auxIntToInt32(x5.AuxInt)
12768                                         if auxToSym(x5.Aux) != s {
12769                                                 continue
12770                                         }
12771                                         _ = x5.Args[1]
12772                                         if p != x5.Args[0] || mem != x5.Args[1] {
12773                                                 continue
12774                                         }
12775                                         o3 := o4_1
12776                                         if o3.Op != OpPPC64OR || o3.Type != t {
12777                                                 continue
12778                                         }
12779                                         _ = o3.Args[1]
12780                                         o3_0 := o3.Args[0]
12781                                         o3_1 := o3.Args[1]
12782                                         for _i3 := 0; _i3 <= 1; _i3, o3_0, o3_1 = _i3+1, o3_1, o3_0 {
12783                                                 s4 := o3_0
12784                                                 if s4.Op != OpPPC64SLDconst || auxIntToInt64(s4.AuxInt) != 24 {
12785                                                         continue
12786                                                 }
12787                                                 x4 := s4.Args[0]
12788                                                 if x4.Op != OpPPC64MOVBZload {
12789                                                         continue
12790                                                 }
12791                                                 i4 := auxIntToInt32(x4.AuxInt)
12792                                                 if auxToSym(x4.Aux) != s {
12793                                                         continue
12794                                                 }
12795                                                 _ = x4.Args[1]
12796                                                 if p != x4.Args[0] || mem != x4.Args[1] {
12797                                                         continue
12798                                                 }
12799                                                 s0 := o3_1
12800                                                 if s0.Op != OpPPC64SLWconst || auxIntToInt64(s0.AuxInt) != 32 {
12801                                                         continue
12802                                                 }
12803                                                 x3 := s0.Args[0]
12804                                                 if x3.Op != OpPPC64MOVWBRload || x3.Type != t {
12805                                                         continue
12806                                                 }
12807                                                 _ = x3.Args[1]
12808                                                 x3_0 := x3.Args[0]
12809                                                 if x3_0.Op != OpPPC64MOVDaddr || x3_0.Type != typ.Uintptr {
12810                                                         continue
12811                                                 }
12812                                                 i0 := auxIntToInt32(x3_0.AuxInt)
12813                                                 if auxToSym(x3_0.Aux) != s || p != x3_0.Args[0] || mem != x3.Args[1] || !(!config.BigEndian && i4 == i0+4 && i5 == i0+5 && i6 == i0+6 && i7 == i0+7 && x3.Uses == 1 && x4.Uses == 1 && x5.Uses == 1 && x6.Uses == 1 && x7.Uses == 1 && o3.Uses == 1 && o4.Uses == 1 && o5.Uses == 1 && s0.Uses == 1 && s4.Uses == 1 && s5.Uses == 1 && s6.Uses == 1 && mergePoint(b, x3, x4, x5, x6, x7) != nil && clobber(x3, x4, x5, x6, x7, o3, o4, o5, s0, s4, s5, s6)) {
12814                                                         continue
12815                                                 }
12816                                                 b = mergePoint(b, x3, x4, x5, x6, x7)
12817                                                 v0 := b.NewValue0(x3.Pos, OpPPC64MOVDBRload, t)
12818                                                 v.copyOf(v0)
12819                                                 v1 := b.NewValue0(x3.Pos, OpPPC64MOVDaddr, typ.Uintptr)
12820                                                 v1.AuxInt = int32ToAuxInt(i0)
12821                                                 v1.Aux = symToAux(s)
12822                                                 v1.AddArg(p)
12823                                                 v0.AddArg2(v1, mem)
12824                                                 return true
12825                                         }
12826                                 }
12827                         }
12828                 }
12829                 break
12830         }
12831         // match: (OR <t> x7:(MOVBZload [i7] {s} p mem) o5:(OR <t> s6:(SLDconst x6:(MOVBZload [i6] {s} p mem) [8]) o4:(OR <t> s5:(SLDconst x5:(MOVBZload [i5] {s} p mem) [16]) o3:(OR <t> s4:(SLDconst x4:(MOVBZload [i4] {s} p mem) [24]) s0:(SLDconst x3:(MOVWBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem) [32])))))
12832         // cond: !config.BigEndian && i4 == i0+4 && i5 == i0+5 && i6 == i0+6 && i7 == i0+7 && x3.Uses == 1 && x4.Uses == 1 && x5.Uses == 1 && x6.Uses == 1 && x7.Uses == 1 && o3.Uses == 1 && o4.Uses == 1 && o5.Uses == 1 && s0.Uses == 1 && s4.Uses == 1 && s5.Uses == 1 && s6.Uses == 1 && mergePoint(b, x3, x4, x5, x6, x7) != nil && clobber(x3, x4, x5, x6, x7, o3, o4, o5, s0, s4, s5, s6)
12833         // result: @mergePoint(b,x3,x4,x5,x6,x7) (MOVDBRload <t> (MOVDaddr <typ.Uintptr> [i0] {s} p) mem)
12834         for {
12835                 t := v.Type
12836                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12837                         x7 := v_0
12838                         if x7.Op != OpPPC64MOVBZload {
12839                                 continue
12840                         }
12841                         i7 := auxIntToInt32(x7.AuxInt)
12842                         s := auxToSym(x7.Aux)
12843                         mem := x7.Args[1]
12844                         p := x7.Args[0]
12845                         o5 := v_1
12846                         if o5.Op != OpPPC64OR || o5.Type != t {
12847                                 continue
12848                         }
12849                         _ = o5.Args[1]
12850                         o5_0 := o5.Args[0]
12851                         o5_1 := o5.Args[1]
12852                         for _i1 := 0; _i1 <= 1; _i1, o5_0, o5_1 = _i1+1, o5_1, o5_0 {
12853                                 s6 := o5_0
12854                                 if s6.Op != OpPPC64SLDconst || auxIntToInt64(s6.AuxInt) != 8 {
12855                                         continue
12856                                 }
12857                                 x6 := s6.Args[0]
12858                                 if x6.Op != OpPPC64MOVBZload {
12859                                         continue
12860                                 }
12861                                 i6 := auxIntToInt32(x6.AuxInt)
12862                                 if auxToSym(x6.Aux) != s {
12863                                         continue
12864                                 }
12865                                 _ = x6.Args[1]
12866                                 if p != x6.Args[0] || mem != x6.Args[1] {
12867                                         continue
12868                                 }
12869                                 o4 := o5_1
12870                                 if o4.Op != OpPPC64OR || o4.Type != t {
12871                                         continue
12872                                 }
12873                                 _ = o4.Args[1]
12874                                 o4_0 := o4.Args[0]
12875                                 o4_1 := o4.Args[1]
12876                                 for _i2 := 0; _i2 <= 1; _i2, o4_0, o4_1 = _i2+1, o4_1, o4_0 {
12877                                         s5 := o4_0
12878                                         if s5.Op != OpPPC64SLDconst || auxIntToInt64(s5.AuxInt) != 16 {
12879                                                 continue
12880                                         }
12881                                         x5 := s5.Args[0]
12882                                         if x5.Op != OpPPC64MOVBZload {
12883                                                 continue
12884                                         }
12885                                         i5 := auxIntToInt32(x5.AuxInt)
12886                                         if auxToSym(x5.Aux) != s {
12887                                                 continue
12888                                         }
12889                                         _ = x5.Args[1]
12890                                         if p != x5.Args[0] || mem != x5.Args[1] {
12891                                                 continue
12892                                         }
12893                                         o3 := o4_1
12894                                         if o3.Op != OpPPC64OR || o3.Type != t {
12895                                                 continue
12896                                         }
12897                                         _ = o3.Args[1]
12898                                         o3_0 := o3.Args[0]
12899                                         o3_1 := o3.Args[1]
12900                                         for _i3 := 0; _i3 <= 1; _i3, o3_0, o3_1 = _i3+1, o3_1, o3_0 {
12901                                                 s4 := o3_0
12902                                                 if s4.Op != OpPPC64SLDconst || auxIntToInt64(s4.AuxInt) != 24 {
12903                                                         continue
12904                                                 }
12905                                                 x4 := s4.Args[0]
12906                                                 if x4.Op != OpPPC64MOVBZload {
12907                                                         continue
12908                                                 }
12909                                                 i4 := auxIntToInt32(x4.AuxInt)
12910                                                 if auxToSym(x4.Aux) != s {
12911                                                         continue
12912                                                 }
12913                                                 _ = x4.Args[1]
12914                                                 if p != x4.Args[0] || mem != x4.Args[1] {
12915                                                         continue
12916                                                 }
12917                                                 s0 := o3_1
12918                                                 if s0.Op != OpPPC64SLDconst || auxIntToInt64(s0.AuxInt) != 32 {
12919                                                         continue
12920                                                 }
12921                                                 x3 := s0.Args[0]
12922                                                 if x3.Op != OpPPC64MOVWBRload || x3.Type != t {
12923                                                         continue
12924                                                 }
12925                                                 _ = x3.Args[1]
12926                                                 x3_0 := x3.Args[0]
12927                                                 if x3_0.Op != OpPPC64MOVDaddr || x3_0.Type != typ.Uintptr {
12928                                                         continue
12929                                                 }
12930                                                 i0 := auxIntToInt32(x3_0.AuxInt)
12931                                                 if auxToSym(x3_0.Aux) != s || p != x3_0.Args[0] || mem != x3.Args[1] || !(!config.BigEndian && i4 == i0+4 && i5 == i0+5 && i6 == i0+6 && i7 == i0+7 && x3.Uses == 1 && x4.Uses == 1 && x5.Uses == 1 && x6.Uses == 1 && x7.Uses == 1 && o3.Uses == 1 && o4.Uses == 1 && o5.Uses == 1 && s0.Uses == 1 && s4.Uses == 1 && s5.Uses == 1 && s6.Uses == 1 && mergePoint(b, x3, x4, x5, x6, x7) != nil && clobber(x3, x4, x5, x6, x7, o3, o4, o5, s0, s4, s5, s6)) {
12932                                                         continue
12933                                                 }
12934                                                 b = mergePoint(b, x3, x4, x5, x6, x7)
12935                                                 v0 := b.NewValue0(x3.Pos, OpPPC64MOVDBRload, t)
12936                                                 v.copyOf(v0)
12937                                                 v1 := b.NewValue0(x3.Pos, OpPPC64MOVDaddr, typ.Uintptr)
12938                                                 v1.AuxInt = int32ToAuxInt(i0)
12939                                                 v1.Aux = symToAux(s)
12940                                                 v1.AddArg(p)
12941                                                 v0.AddArg2(v1, mem)
12942                                                 return true
12943                                         }
12944                                 }
12945                         }
12946                 }
12947                 break
12948         }
12949         return false
12950 }
12951 func rewriteValuePPC64_OpPPC64ORN(v *Value) bool {
12952         v_1 := v.Args[1]
12953         v_0 := v.Args[0]
12954         // match: (ORN x (MOVDconst [-1]))
12955         // result: x
12956         for {
12957                 x := v_0
12958                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
12959                         break
12960                 }
12961                 v.copyOf(x)
12962                 return true
12963         }
12964         // match: (ORN (MOVDconst [c]) (MOVDconst [d]))
12965         // result: (MOVDconst [c|^d])
12966         for {
12967                 if v_0.Op != OpPPC64MOVDconst {
12968                         break
12969                 }
12970                 c := auxIntToInt64(v_0.AuxInt)
12971                 if v_1.Op != OpPPC64MOVDconst {
12972                         break
12973                 }
12974                 d := auxIntToInt64(v_1.AuxInt)
12975                 v.reset(OpPPC64MOVDconst)
12976                 v.AuxInt = int64ToAuxInt(c | ^d)
12977                 return true
12978         }
12979         return false
12980 }
12981 func rewriteValuePPC64_OpPPC64ORconst(v *Value) bool {
12982         v_0 := v.Args[0]
12983         // match: (ORconst [c] (ORconst [d] x))
12984         // result: (ORconst [c|d] x)
12985         for {
12986                 c := auxIntToInt64(v.AuxInt)
12987                 if v_0.Op != OpPPC64ORconst {
12988                         break
12989                 }
12990                 d := auxIntToInt64(v_0.AuxInt)
12991                 x := v_0.Args[0]
12992                 v.reset(OpPPC64ORconst)
12993                 v.AuxInt = int64ToAuxInt(c | d)
12994                 v.AddArg(x)
12995                 return true
12996         }
12997         // match: (ORconst [-1] _)
12998         // result: (MOVDconst [-1])
12999         for {
13000                 if auxIntToInt64(v.AuxInt) != -1 {
13001                         break
13002                 }
13003                 v.reset(OpPPC64MOVDconst)
13004                 v.AuxInt = int64ToAuxInt(-1)
13005                 return true
13006         }
13007         // match: (ORconst [0] x)
13008         // result: x
13009         for {
13010                 if auxIntToInt64(v.AuxInt) != 0 {
13011                         break
13012                 }
13013                 x := v_0
13014                 v.copyOf(x)
13015                 return true
13016         }
13017         return false
13018 }
13019 func rewriteValuePPC64_OpPPC64ROTL(v *Value) bool {
13020         v_1 := v.Args[1]
13021         v_0 := v.Args[0]
13022         // match: (ROTL x (MOVDconst [c]))
13023         // result: (ROTLconst x [c&63])
13024         for {
13025                 x := v_0
13026                 if v_1.Op != OpPPC64MOVDconst {
13027                         break
13028                 }
13029                 c := auxIntToInt64(v_1.AuxInt)
13030                 v.reset(OpPPC64ROTLconst)
13031                 v.AuxInt = int64ToAuxInt(c & 63)
13032                 v.AddArg(x)
13033                 return true
13034         }
13035         return false
13036 }
13037 func rewriteValuePPC64_OpPPC64ROTLW(v *Value) bool {
13038         v_1 := v.Args[1]
13039         v_0 := v.Args[0]
13040         // match: (ROTLW x (MOVDconst [c]))
13041         // result: (ROTLWconst x [c&31])
13042         for {
13043                 x := v_0
13044                 if v_1.Op != OpPPC64MOVDconst {
13045                         break
13046                 }
13047                 c := auxIntToInt64(v_1.AuxInt)
13048                 v.reset(OpPPC64ROTLWconst)
13049                 v.AuxInt = int64ToAuxInt(c & 31)
13050                 v.AddArg(x)
13051                 return true
13052         }
13053         return false
13054 }
13055 func rewriteValuePPC64_OpPPC64ROTLWconst(v *Value) bool {
13056         v_0 := v.Args[0]
13057         // match: (ROTLWconst [r] (AND (MOVDconst [m]) x))
13058         // cond: isPPC64WordRotateMask(m)
13059         // result: (RLWINM [encodePPC64RotateMask(r,rotateLeft32(m,r),32)] x)
13060         for {
13061                 r := auxIntToInt64(v.AuxInt)
13062                 if v_0.Op != OpPPC64AND {
13063                         break
13064                 }
13065                 _ = v_0.Args[1]
13066                 v_0_0 := v_0.Args[0]
13067                 v_0_1 := v_0.Args[1]
13068                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
13069                         if v_0_0.Op != OpPPC64MOVDconst {
13070                                 continue
13071                         }
13072                         m := auxIntToInt64(v_0_0.AuxInt)
13073                         x := v_0_1
13074                         if !(isPPC64WordRotateMask(m)) {
13075                                 continue
13076                         }
13077                         v.reset(OpPPC64RLWINM)
13078                         v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, rotateLeft32(m, r), 32))
13079                         v.AddArg(x)
13080                         return true
13081                 }
13082                 break
13083         }
13084         // match: (ROTLWconst [r] (ANDconst [m] x))
13085         // cond: isPPC64WordRotateMask(m)
13086         // result: (RLWINM [encodePPC64RotateMask(r,rotateLeft32(m,r),32)] x)
13087         for {
13088                 r := auxIntToInt64(v.AuxInt)
13089                 if v_0.Op != OpPPC64ANDconst {
13090                         break
13091                 }
13092                 m := auxIntToInt64(v_0.AuxInt)
13093                 x := v_0.Args[0]
13094                 if !(isPPC64WordRotateMask(m)) {
13095                         break
13096                 }
13097                 v.reset(OpPPC64RLWINM)
13098                 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, rotateLeft32(m, r), 32))
13099                 v.AddArg(x)
13100                 return true
13101         }
13102         return false
13103 }
13104 func rewriteValuePPC64_OpPPC64SLD(v *Value) bool {
13105         v_1 := v.Args[1]
13106         v_0 := v.Args[0]
13107         // match: (SLD x (MOVDconst [c]))
13108         // result: (SLDconst [c&63 | (c>>6&1*63)] x)
13109         for {
13110                 x := v_0
13111                 if v_1.Op != OpPPC64MOVDconst {
13112                         break
13113                 }
13114                 c := auxIntToInt64(v_1.AuxInt)
13115                 v.reset(OpPPC64SLDconst)
13116                 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
13117                 v.AddArg(x)
13118                 return true
13119         }
13120         return false
13121 }
13122 func rewriteValuePPC64_OpPPC64SLDconst(v *Value) bool {
13123         v_0 := v.Args[0]
13124         // match: (SLDconst [l] (SRWconst [r] x))
13125         // cond: mergePPC64SldiSrw(l,r) != 0
13126         // result: (RLWINM [mergePPC64SldiSrw(l,r)] x)
13127         for {
13128                 l := auxIntToInt64(v.AuxInt)
13129                 if v_0.Op != OpPPC64SRWconst {
13130                         break
13131                 }
13132                 r := auxIntToInt64(v_0.AuxInt)
13133                 x := v_0.Args[0]
13134                 if !(mergePPC64SldiSrw(l, r) != 0) {
13135                         break
13136                 }
13137                 v.reset(OpPPC64RLWINM)
13138                 v.AuxInt = int64ToAuxInt(mergePPC64SldiSrw(l, r))
13139                 v.AddArg(x)
13140                 return true
13141         }
13142         // match: (SLDconst [c] z:(MOVBZreg x))
13143         // cond: c < 8 && z.Uses == 1
13144         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,56,63,64)] x)
13145         for {
13146                 c := auxIntToInt64(v.AuxInt)
13147                 z := v_0
13148                 if z.Op != OpPPC64MOVBZreg {
13149                         break
13150                 }
13151                 x := z.Args[0]
13152                 if !(c < 8 && z.Uses == 1) {
13153                         break
13154                 }
13155                 v.reset(OpPPC64CLRLSLDI)
13156                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 56, 63, 64))
13157                 v.AddArg(x)
13158                 return true
13159         }
13160         // match: (SLDconst [c] z:(MOVHZreg x))
13161         // cond: c < 16 && z.Uses == 1
13162         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,48,63,64)] x)
13163         for {
13164                 c := auxIntToInt64(v.AuxInt)
13165                 z := v_0
13166                 if z.Op != OpPPC64MOVHZreg {
13167                         break
13168                 }
13169                 x := z.Args[0]
13170                 if !(c < 16 && z.Uses == 1) {
13171                         break
13172                 }
13173                 v.reset(OpPPC64CLRLSLDI)
13174                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 48, 63, 64))
13175                 v.AddArg(x)
13176                 return true
13177         }
13178         // match: (SLDconst [c] z:(MOVWZreg x))
13179         // cond: c < 32 && z.Uses == 1
13180         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,32,63,64)] x)
13181         for {
13182                 c := auxIntToInt64(v.AuxInt)
13183                 z := v_0
13184                 if z.Op != OpPPC64MOVWZreg {
13185                         break
13186                 }
13187                 x := z.Args[0]
13188                 if !(c < 32 && z.Uses == 1) {
13189                         break
13190                 }
13191                 v.reset(OpPPC64CLRLSLDI)
13192                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32, 63, 64))
13193                 v.AddArg(x)
13194                 return true
13195         }
13196         // match: (SLDconst [c] z:(ANDconst [d] x))
13197         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))
13198         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,64-getPPC64ShiftMaskLength(d),63,64)] x)
13199         for {
13200                 c := auxIntToInt64(v.AuxInt)
13201                 z := v_0
13202                 if z.Op != OpPPC64ANDconst {
13203                         break
13204                 }
13205                 d := auxIntToInt64(z.AuxInt)
13206                 x := z.Args[0]
13207                 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))) {
13208                         break
13209                 }
13210                 v.reset(OpPPC64CLRLSLDI)
13211                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 64-getPPC64ShiftMaskLength(d), 63, 64))
13212                 v.AddArg(x)
13213                 return true
13214         }
13215         // match: (SLDconst [c] z:(AND (MOVDconst [d]) x))
13216         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(64-getPPC64ShiftMaskLength(d))
13217         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,64-getPPC64ShiftMaskLength(d),63,64)] x)
13218         for {
13219                 c := auxIntToInt64(v.AuxInt)
13220                 z := v_0
13221                 if z.Op != OpPPC64AND {
13222                         break
13223                 }
13224                 _ = z.Args[1]
13225                 z_0 := z.Args[0]
13226                 z_1 := z.Args[1]
13227                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
13228                         if z_0.Op != OpPPC64MOVDconst {
13229                                 continue
13230                         }
13231                         d := auxIntToInt64(z_0.AuxInt)
13232                         x := z_1
13233                         if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))) {
13234                                 continue
13235                         }
13236                         v.reset(OpPPC64CLRLSLDI)
13237                         v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 64-getPPC64ShiftMaskLength(d), 63, 64))
13238                         v.AddArg(x)
13239                         return true
13240                 }
13241                 break
13242         }
13243         // match: (SLDconst [c] z:(MOVWreg x))
13244         // cond: c < 32 && objabi.GOPPC64 >= 9
13245         // result: (EXTSWSLconst [c] x)
13246         for {
13247                 c := auxIntToInt64(v.AuxInt)
13248                 z := v_0
13249                 if z.Op != OpPPC64MOVWreg {
13250                         break
13251                 }
13252                 x := z.Args[0]
13253                 if !(c < 32 && objabi.GOPPC64 >= 9) {
13254                         break
13255                 }
13256                 v.reset(OpPPC64EXTSWSLconst)
13257                 v.AuxInt = int64ToAuxInt(c)
13258                 v.AddArg(x)
13259                 return true
13260         }
13261         return false
13262 }
13263 func rewriteValuePPC64_OpPPC64SLW(v *Value) bool {
13264         v_1 := v.Args[1]
13265         v_0 := v.Args[0]
13266         // match: (SLW x (MOVDconst [c]))
13267         // result: (SLWconst [c&31 | (c>>5&1*31)] x)
13268         for {
13269                 x := v_0
13270                 if v_1.Op != OpPPC64MOVDconst {
13271                         break
13272                 }
13273                 c := auxIntToInt64(v_1.AuxInt)
13274                 v.reset(OpPPC64SLWconst)
13275                 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
13276                 v.AddArg(x)
13277                 return true
13278         }
13279         return false
13280 }
13281 func rewriteValuePPC64_OpPPC64SLWconst(v *Value) bool {
13282         v_0 := v.Args[0]
13283         // match: (SLWconst [c] z:(MOVBZreg x))
13284         // cond: z.Uses == 1 && c < 8
13285         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,24,31,32)] x)
13286         for {
13287                 c := auxIntToInt64(v.AuxInt)
13288                 z := v_0
13289                 if z.Op != OpPPC64MOVBZreg {
13290                         break
13291                 }
13292                 x := z.Args[0]
13293                 if !(z.Uses == 1 && c < 8) {
13294                         break
13295                 }
13296                 v.reset(OpPPC64CLRLSLWI)
13297                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 24, 31, 32))
13298                 v.AddArg(x)
13299                 return true
13300         }
13301         // match: (SLWconst [c] z:(MOVHZreg x))
13302         // cond: z.Uses == 1 && c < 16
13303         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,16,31,32)] x)
13304         for {
13305                 c := auxIntToInt64(v.AuxInt)
13306                 z := v_0
13307                 if z.Op != OpPPC64MOVHZreg {
13308                         break
13309                 }
13310                 x := z.Args[0]
13311                 if !(z.Uses == 1 && c < 16) {
13312                         break
13313                 }
13314                 v.reset(OpPPC64CLRLSLWI)
13315                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 16, 31, 32))
13316                 v.AddArg(x)
13317                 return true
13318         }
13319         // match: (SLWconst [c] z:(ANDconst [d] x))
13320         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(32-getPPC64ShiftMaskLength(d))
13321         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,32-getPPC64ShiftMaskLength(d),31,32)] x)
13322         for {
13323                 c := auxIntToInt64(v.AuxInt)
13324                 z := v_0
13325                 if z.Op != OpPPC64ANDconst {
13326                         break
13327                 }
13328                 d := auxIntToInt64(z.AuxInt)
13329                 x := z.Args[0]
13330                 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (32-getPPC64ShiftMaskLength(d))) {
13331                         break
13332                 }
13333                 v.reset(OpPPC64CLRLSLWI)
13334                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32-getPPC64ShiftMaskLength(d), 31, 32))
13335                 v.AddArg(x)
13336                 return true
13337         }
13338         // match: (SLWconst [c] z:(AND (MOVDconst [d]) x))
13339         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(32-getPPC64ShiftMaskLength(d))
13340         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,32-getPPC64ShiftMaskLength(d),31,32)] x)
13341         for {
13342                 c := auxIntToInt64(v.AuxInt)
13343                 z := v_0
13344                 if z.Op != OpPPC64AND {
13345                         break
13346                 }
13347                 _ = z.Args[1]
13348                 z_0 := z.Args[0]
13349                 z_1 := z.Args[1]
13350                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
13351                         if z_0.Op != OpPPC64MOVDconst {
13352                                 continue
13353                         }
13354                         d := auxIntToInt64(z_0.AuxInt)
13355                         x := z_1
13356                         if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (32-getPPC64ShiftMaskLength(d))) {
13357                                 continue
13358                         }
13359                         v.reset(OpPPC64CLRLSLWI)
13360                         v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32-getPPC64ShiftMaskLength(d), 31, 32))
13361                         v.AddArg(x)
13362                         return true
13363                 }
13364                 break
13365         }
13366         // match: (SLWconst [c] z:(MOVWreg x))
13367         // cond: c < 32 && objabi.GOPPC64 >= 9
13368         // result: (EXTSWSLconst [c] x)
13369         for {
13370                 c := auxIntToInt64(v.AuxInt)
13371                 z := v_0
13372                 if z.Op != OpPPC64MOVWreg {
13373                         break
13374                 }
13375                 x := z.Args[0]
13376                 if !(c < 32 && objabi.GOPPC64 >= 9) {
13377                         break
13378                 }
13379                 v.reset(OpPPC64EXTSWSLconst)
13380                 v.AuxInt = int64ToAuxInt(c)
13381                 v.AddArg(x)
13382                 return true
13383         }
13384         return false
13385 }
13386 func rewriteValuePPC64_OpPPC64SRAD(v *Value) bool {
13387         v_1 := v.Args[1]
13388         v_0 := v.Args[0]
13389         // match: (SRAD x (MOVDconst [c]))
13390         // result: (SRADconst [c&63 | (c>>6&1*63)] x)
13391         for {
13392                 x := v_0
13393                 if v_1.Op != OpPPC64MOVDconst {
13394                         break
13395                 }
13396                 c := auxIntToInt64(v_1.AuxInt)
13397                 v.reset(OpPPC64SRADconst)
13398                 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
13399                 v.AddArg(x)
13400                 return true
13401         }
13402         return false
13403 }
13404 func rewriteValuePPC64_OpPPC64SRAW(v *Value) bool {
13405         v_1 := v.Args[1]
13406         v_0 := v.Args[0]
13407         // match: (SRAW x (MOVDconst [c]))
13408         // result: (SRAWconst [c&31 | (c>>5&1*31)] x)
13409         for {
13410                 x := v_0
13411                 if v_1.Op != OpPPC64MOVDconst {
13412                         break
13413                 }
13414                 c := auxIntToInt64(v_1.AuxInt)
13415                 v.reset(OpPPC64SRAWconst)
13416                 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
13417                 v.AddArg(x)
13418                 return true
13419         }
13420         return false
13421 }
13422 func rewriteValuePPC64_OpPPC64SRD(v *Value) bool {
13423         v_1 := v.Args[1]
13424         v_0 := v.Args[0]
13425         // match: (SRD x (MOVDconst [c]))
13426         // result: (SRDconst [c&63 | (c>>6&1*63)] x)
13427         for {
13428                 x := v_0
13429                 if v_1.Op != OpPPC64MOVDconst {
13430                         break
13431                 }
13432                 c := auxIntToInt64(v_1.AuxInt)
13433                 v.reset(OpPPC64SRDconst)
13434                 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
13435                 v.AddArg(x)
13436                 return true
13437         }
13438         return false
13439 }
13440 func rewriteValuePPC64_OpPPC64SRW(v *Value) bool {
13441         v_1 := v.Args[1]
13442         v_0 := v.Args[0]
13443         // match: (SRW x (MOVDconst [c]))
13444         // result: (SRWconst [c&31 | (c>>5&1*31)] x)
13445         for {
13446                 x := v_0
13447                 if v_1.Op != OpPPC64MOVDconst {
13448                         break
13449                 }
13450                 c := auxIntToInt64(v_1.AuxInt)
13451                 v.reset(OpPPC64SRWconst)
13452                 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
13453                 v.AddArg(x)
13454                 return true
13455         }
13456         return false
13457 }
13458 func rewriteValuePPC64_OpPPC64SRWconst(v *Value) bool {
13459         v_0 := v.Args[0]
13460         // match: (SRWconst (ANDconst [m] x) [s])
13461         // cond: mergePPC64RShiftMask(m>>uint(s),s,32) == 0
13462         // result: (MOVDconst [0])
13463         for {
13464                 s := auxIntToInt64(v.AuxInt)
13465                 if v_0.Op != OpPPC64ANDconst {
13466                         break
13467                 }
13468                 m := auxIntToInt64(v_0.AuxInt)
13469                 if !(mergePPC64RShiftMask(m>>uint(s), s, 32) == 0) {
13470                         break
13471                 }
13472                 v.reset(OpPPC64MOVDconst)
13473                 v.AuxInt = int64ToAuxInt(0)
13474                 return true
13475         }
13476         // match: (SRWconst (ANDconst [m] x) [s])
13477         // cond: mergePPC64AndSrwi(m>>uint(s),s) != 0
13478         // result: (RLWINM [mergePPC64AndSrwi(m>>uint(s),s)] x)
13479         for {
13480                 s := auxIntToInt64(v.AuxInt)
13481                 if v_0.Op != OpPPC64ANDconst {
13482                         break
13483                 }
13484                 m := auxIntToInt64(v_0.AuxInt)
13485                 x := v_0.Args[0]
13486                 if !(mergePPC64AndSrwi(m>>uint(s), s) != 0) {
13487                         break
13488                 }
13489                 v.reset(OpPPC64RLWINM)
13490                 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m>>uint(s), s))
13491                 v.AddArg(x)
13492                 return true
13493         }
13494         // match: (SRWconst (AND (MOVDconst [m]) x) [s])
13495         // cond: mergePPC64RShiftMask(m>>uint(s),s,32) == 0
13496         // result: (MOVDconst [0])
13497         for {
13498                 s := auxIntToInt64(v.AuxInt)
13499                 if v_0.Op != OpPPC64AND {
13500                         break
13501                 }
13502                 _ = v_0.Args[1]
13503                 v_0_0 := v_0.Args[0]
13504                 v_0_1 := v_0.Args[1]
13505                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
13506                         if v_0_0.Op != OpPPC64MOVDconst {
13507                                 continue
13508                         }
13509                         m := auxIntToInt64(v_0_0.AuxInt)
13510                         if !(mergePPC64RShiftMask(m>>uint(s), s, 32) == 0) {
13511                                 continue
13512                         }
13513                         v.reset(OpPPC64MOVDconst)
13514                         v.AuxInt = int64ToAuxInt(0)
13515                         return true
13516                 }
13517                 break
13518         }
13519         // match: (SRWconst (AND (MOVDconst [m]) x) [s])
13520         // cond: mergePPC64AndSrwi(m>>uint(s),s) != 0
13521         // result: (RLWINM [mergePPC64AndSrwi(m>>uint(s),s)] x)
13522         for {
13523                 s := auxIntToInt64(v.AuxInt)
13524                 if v_0.Op != OpPPC64AND {
13525                         break
13526                 }
13527                 _ = v_0.Args[1]
13528                 v_0_0 := v_0.Args[0]
13529                 v_0_1 := v_0.Args[1]
13530                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
13531                         if v_0_0.Op != OpPPC64MOVDconst {
13532                                 continue
13533                         }
13534                         m := auxIntToInt64(v_0_0.AuxInt)
13535                         x := v_0_1
13536                         if !(mergePPC64AndSrwi(m>>uint(s), s) != 0) {
13537                                 continue
13538                         }
13539                         v.reset(OpPPC64RLWINM)
13540                         v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m>>uint(s), s))
13541                         v.AddArg(x)
13542                         return true
13543                 }
13544                 break
13545         }
13546         return false
13547 }
13548 func rewriteValuePPC64_OpPPC64SUB(v *Value) bool {
13549         v_1 := v.Args[1]
13550         v_0 := v.Args[0]
13551         // match: (SUB x (MOVDconst [c]))
13552         // cond: is32Bit(-c)
13553         // result: (ADDconst [-c] x)
13554         for {
13555                 x := v_0
13556                 if v_1.Op != OpPPC64MOVDconst {
13557                         break
13558                 }
13559                 c := auxIntToInt64(v_1.AuxInt)
13560                 if !(is32Bit(-c)) {
13561                         break
13562                 }
13563                 v.reset(OpPPC64ADDconst)
13564                 v.AuxInt = int64ToAuxInt(-c)
13565                 v.AddArg(x)
13566                 return true
13567         }
13568         // match: (SUB (MOVDconst [c]) x)
13569         // cond: is32Bit(c)
13570         // result: (SUBFCconst [c] x)
13571         for {
13572                 if v_0.Op != OpPPC64MOVDconst {
13573                         break
13574                 }
13575                 c := auxIntToInt64(v_0.AuxInt)
13576                 x := v_1
13577                 if !(is32Bit(c)) {
13578                         break
13579                 }
13580                 v.reset(OpPPC64SUBFCconst)
13581                 v.AuxInt = int64ToAuxInt(c)
13582                 v.AddArg(x)
13583                 return true
13584         }
13585         return false
13586 }
13587 func rewriteValuePPC64_OpPPC64SUBFCconst(v *Value) bool {
13588         v_0 := v.Args[0]
13589         // match: (SUBFCconst [c] (NEG x))
13590         // result: (ADDconst [c] x)
13591         for {
13592                 c := auxIntToInt64(v.AuxInt)
13593                 if v_0.Op != OpPPC64NEG {
13594                         break
13595                 }
13596                 x := v_0.Args[0]
13597                 v.reset(OpPPC64ADDconst)
13598                 v.AuxInt = int64ToAuxInt(c)
13599                 v.AddArg(x)
13600                 return true
13601         }
13602         // match: (SUBFCconst [c] (SUBFCconst [d] x))
13603         // cond: is32Bit(c-d)
13604         // result: (ADDconst [c-d] x)
13605         for {
13606                 c := auxIntToInt64(v.AuxInt)
13607                 if v_0.Op != OpPPC64SUBFCconst {
13608                         break
13609                 }
13610                 d := auxIntToInt64(v_0.AuxInt)
13611                 x := v_0.Args[0]
13612                 if !(is32Bit(c - d)) {
13613                         break
13614                 }
13615                 v.reset(OpPPC64ADDconst)
13616                 v.AuxInt = int64ToAuxInt(c - d)
13617                 v.AddArg(x)
13618                 return true
13619         }
13620         // match: (SUBFCconst [0] x)
13621         // result: (NEG x)
13622         for {
13623                 if auxIntToInt64(v.AuxInt) != 0 {
13624                         break
13625                 }
13626                 x := v_0
13627                 v.reset(OpPPC64NEG)
13628                 v.AddArg(x)
13629                 return true
13630         }
13631         return false
13632 }
13633 func rewriteValuePPC64_OpPPC64XOR(v *Value) bool {
13634         v_1 := v.Args[1]
13635         v_0 := v.Args[0]
13636         b := v.Block
13637         typ := &b.Func.Config.Types
13638         // match: (XOR (SLDconst x [c]) (SRDconst x [d]))
13639         // cond: d == 64-c
13640         // result: (ROTLconst [c] x)
13641         for {
13642                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13643                         if v_0.Op != OpPPC64SLDconst {
13644                                 continue
13645                         }
13646                         c := auxIntToInt64(v_0.AuxInt)
13647                         x := v_0.Args[0]
13648                         if v_1.Op != OpPPC64SRDconst {
13649                                 continue
13650                         }
13651                         d := auxIntToInt64(v_1.AuxInt)
13652                         if x != v_1.Args[0] || !(d == 64-c) {
13653                                 continue
13654                         }
13655                         v.reset(OpPPC64ROTLconst)
13656                         v.AuxInt = int64ToAuxInt(c)
13657                         v.AddArg(x)
13658                         return true
13659                 }
13660                 break
13661         }
13662         // match: (XOR (SLWconst x [c]) (SRWconst x [d]))
13663         // cond: d == 32-c
13664         // result: (ROTLWconst [c] x)
13665         for {
13666                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13667                         if v_0.Op != OpPPC64SLWconst {
13668                                 continue
13669                         }
13670                         c := auxIntToInt64(v_0.AuxInt)
13671                         x := v_0.Args[0]
13672                         if v_1.Op != OpPPC64SRWconst {
13673                                 continue
13674                         }
13675                         d := auxIntToInt64(v_1.AuxInt)
13676                         if x != v_1.Args[0] || !(d == 32-c) {
13677                                 continue
13678                         }
13679                         v.reset(OpPPC64ROTLWconst)
13680                         v.AuxInt = int64ToAuxInt(c)
13681                         v.AddArg(x)
13682                         return true
13683                 }
13684                 break
13685         }
13686         // match: (XOR (SLD x (ANDconst <typ.Int64> [63] y)) (SRD x (SUB <typ.UInt> (MOVDconst [64]) (ANDconst <typ.UInt> [63] y))))
13687         // result: (ROTL x y)
13688         for {
13689                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13690                         if v_0.Op != OpPPC64SLD {
13691                                 continue
13692                         }
13693                         _ = v_0.Args[1]
13694                         x := v_0.Args[0]
13695                         v_0_1 := v_0.Args[1]
13696                         if v_0_1.Op != OpPPC64ANDconst || v_0_1.Type != typ.Int64 || auxIntToInt64(v_0_1.AuxInt) != 63 {
13697                                 continue
13698                         }
13699                         y := v_0_1.Args[0]
13700                         if v_1.Op != OpPPC64SRD {
13701                                 continue
13702                         }
13703                         _ = v_1.Args[1]
13704                         if x != v_1.Args[0] {
13705                                 continue
13706                         }
13707                         v_1_1 := v_1.Args[1]
13708                         if v_1_1.Op != OpPPC64SUB || v_1_1.Type != typ.UInt {
13709                                 continue
13710                         }
13711                         _ = v_1_1.Args[1]
13712                         v_1_1_0 := v_1_1.Args[0]
13713                         if v_1_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1_0.AuxInt) != 64 {
13714                                 continue
13715                         }
13716                         v_1_1_1 := v_1_1.Args[1]
13717                         if v_1_1_1.Op != OpPPC64ANDconst || v_1_1_1.Type != typ.UInt || auxIntToInt64(v_1_1_1.AuxInt) != 63 || y != v_1_1_1.Args[0] {
13718                                 continue
13719                         }
13720                         v.reset(OpPPC64ROTL)
13721                         v.AddArg2(x, y)
13722                         return true
13723                 }
13724                 break
13725         }
13726         // match: (XOR (SLD x (ANDconst <typ.Int64> [63] y)) (SRD x (SUBFCconst <typ.UInt> [64] (ANDconst <typ.UInt> [63] y))))
13727         // result: (ROTL x y)
13728         for {
13729                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13730                         if v_0.Op != OpPPC64SLD {
13731                                 continue
13732                         }
13733                         _ = v_0.Args[1]
13734                         x := v_0.Args[0]
13735                         v_0_1 := v_0.Args[1]
13736                         if v_0_1.Op != OpPPC64ANDconst || v_0_1.Type != typ.Int64 || auxIntToInt64(v_0_1.AuxInt) != 63 {
13737                                 continue
13738                         }
13739                         y := v_0_1.Args[0]
13740                         if v_1.Op != OpPPC64SRD {
13741                                 continue
13742                         }
13743                         _ = v_1.Args[1]
13744                         if x != v_1.Args[0] {
13745                                 continue
13746                         }
13747                         v_1_1 := v_1.Args[1]
13748                         if v_1_1.Op != OpPPC64SUBFCconst || v_1_1.Type != typ.UInt || auxIntToInt64(v_1_1.AuxInt) != 64 {
13749                                 continue
13750                         }
13751                         v_1_1_0 := v_1_1.Args[0]
13752                         if v_1_1_0.Op != OpPPC64ANDconst || v_1_1_0.Type != typ.UInt || auxIntToInt64(v_1_1_0.AuxInt) != 63 || y != v_1_1_0.Args[0] {
13753                                 continue
13754                         }
13755                         v.reset(OpPPC64ROTL)
13756                         v.AddArg2(x, y)
13757                         return true
13758                 }
13759                 break
13760         }
13761         // match: (XOR (SLW x (ANDconst <typ.Int32> [31] y)) (SRW x (SUBFCconst <typ.UInt> [32] (ANDconst <typ.UInt> [31] y))))
13762         // result: (ROTLW x y)
13763         for {
13764                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13765                         if v_0.Op != OpPPC64SLW {
13766                                 continue
13767                         }
13768                         _ = v_0.Args[1]
13769                         x := v_0.Args[0]
13770                         v_0_1 := v_0.Args[1]
13771                         if v_0_1.Op != OpPPC64ANDconst || v_0_1.Type != typ.Int32 || auxIntToInt64(v_0_1.AuxInt) != 31 {
13772                                 continue
13773                         }
13774                         y := v_0_1.Args[0]
13775                         if v_1.Op != OpPPC64SRW {
13776                                 continue
13777                         }
13778                         _ = v_1.Args[1]
13779                         if x != v_1.Args[0] {
13780                                 continue
13781                         }
13782                         v_1_1 := v_1.Args[1]
13783                         if v_1_1.Op != OpPPC64SUBFCconst || v_1_1.Type != typ.UInt || auxIntToInt64(v_1_1.AuxInt) != 32 {
13784                                 continue
13785                         }
13786                         v_1_1_0 := v_1_1.Args[0]
13787                         if v_1_1_0.Op != OpPPC64ANDconst || v_1_1_0.Type != typ.UInt || auxIntToInt64(v_1_1_0.AuxInt) != 31 || y != v_1_1_0.Args[0] {
13788                                 continue
13789                         }
13790                         v.reset(OpPPC64ROTLW)
13791                         v.AddArg2(x, y)
13792                         return true
13793                 }
13794                 break
13795         }
13796         // match: (XOR (SLW x (ANDconst <typ.Int32> [31] y)) (SRW x (SUB <typ.UInt> (MOVDconst [32]) (ANDconst <typ.UInt> [31] y))))
13797         // result: (ROTLW x y)
13798         for {
13799                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13800                         if v_0.Op != OpPPC64SLW {
13801                                 continue
13802                         }
13803                         _ = v_0.Args[1]
13804                         x := v_0.Args[0]
13805                         v_0_1 := v_0.Args[1]
13806                         if v_0_1.Op != OpPPC64ANDconst || v_0_1.Type != typ.Int32 || auxIntToInt64(v_0_1.AuxInt) != 31 {
13807                                 continue
13808                         }
13809                         y := v_0_1.Args[0]
13810                         if v_1.Op != OpPPC64SRW {
13811                                 continue
13812                         }
13813                         _ = v_1.Args[1]
13814                         if x != v_1.Args[0] {
13815                                 continue
13816                         }
13817                         v_1_1 := v_1.Args[1]
13818                         if v_1_1.Op != OpPPC64SUB || v_1_1.Type != typ.UInt {
13819                                 continue
13820                         }
13821                         _ = v_1_1.Args[1]
13822                         v_1_1_0 := v_1_1.Args[0]
13823                         if v_1_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1_0.AuxInt) != 32 {
13824                                 continue
13825                         }
13826                         v_1_1_1 := v_1_1.Args[1]
13827                         if v_1_1_1.Op != OpPPC64ANDconst || v_1_1_1.Type != typ.UInt || auxIntToInt64(v_1_1_1.AuxInt) != 31 || y != v_1_1_1.Args[0] {
13828                                 continue
13829                         }
13830                         v.reset(OpPPC64ROTLW)
13831                         v.AddArg2(x, y)
13832                         return true
13833                 }
13834                 break
13835         }
13836         // match: (XOR (MOVDconst [c]) (MOVDconst [d]))
13837         // result: (MOVDconst [c^d])
13838         for {
13839                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13840                         if v_0.Op != OpPPC64MOVDconst {
13841                                 continue
13842                         }
13843                         c := auxIntToInt64(v_0.AuxInt)
13844                         if v_1.Op != OpPPC64MOVDconst {
13845                                 continue
13846                         }
13847                         d := auxIntToInt64(v_1.AuxInt)
13848                         v.reset(OpPPC64MOVDconst)
13849                         v.AuxInt = int64ToAuxInt(c ^ d)
13850                         return true
13851                 }
13852                 break
13853         }
13854         // match: (XOR x (MOVDconst [c]))
13855         // cond: isU32Bit(c)
13856         // result: (XORconst [c] x)
13857         for {
13858                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
13859                         x := v_0
13860                         if v_1.Op != OpPPC64MOVDconst {
13861                                 continue
13862                         }
13863                         c := auxIntToInt64(v_1.AuxInt)
13864                         if !(isU32Bit(c)) {
13865                                 continue
13866                         }
13867                         v.reset(OpPPC64XORconst)
13868                         v.AuxInt = int64ToAuxInt(c)
13869                         v.AddArg(x)
13870                         return true
13871                 }
13872                 break
13873         }
13874         return false
13875 }
13876 func rewriteValuePPC64_OpPPC64XORconst(v *Value) bool {
13877         v_0 := v.Args[0]
13878         // match: (XORconst [c] (XORconst [d] x))
13879         // result: (XORconst [c^d] x)
13880         for {
13881                 c := auxIntToInt64(v.AuxInt)
13882                 if v_0.Op != OpPPC64XORconst {
13883                         break
13884                 }
13885                 d := auxIntToInt64(v_0.AuxInt)
13886                 x := v_0.Args[0]
13887                 v.reset(OpPPC64XORconst)
13888                 v.AuxInt = int64ToAuxInt(c ^ d)
13889                 v.AddArg(x)
13890                 return true
13891         }
13892         // match: (XORconst [0] x)
13893         // result: x
13894         for {
13895                 if auxIntToInt64(v.AuxInt) != 0 {
13896                         break
13897                 }
13898                 x := v_0
13899                 v.copyOf(x)
13900                 return true
13901         }
13902         return false
13903 }
13904 func rewriteValuePPC64_OpPanicBounds(v *Value) bool {
13905         v_2 := v.Args[2]
13906         v_1 := v.Args[1]
13907         v_0 := v.Args[0]
13908         // match: (PanicBounds [kind] x y mem)
13909         // cond: boundsABI(kind) == 0
13910         // result: (LoweredPanicBoundsA [kind] x y mem)
13911         for {
13912                 kind := auxIntToInt64(v.AuxInt)
13913                 x := v_0
13914                 y := v_1
13915                 mem := v_2
13916                 if !(boundsABI(kind) == 0) {
13917                         break
13918                 }
13919                 v.reset(OpPPC64LoweredPanicBoundsA)
13920                 v.AuxInt = int64ToAuxInt(kind)
13921                 v.AddArg3(x, y, mem)
13922                 return true
13923         }
13924         // match: (PanicBounds [kind] x y mem)
13925         // cond: boundsABI(kind) == 1
13926         // result: (LoweredPanicBoundsB [kind] x y mem)
13927         for {
13928                 kind := auxIntToInt64(v.AuxInt)
13929                 x := v_0
13930                 y := v_1
13931                 mem := v_2
13932                 if !(boundsABI(kind) == 1) {
13933                         break
13934                 }
13935                 v.reset(OpPPC64LoweredPanicBoundsB)
13936                 v.AuxInt = int64ToAuxInt(kind)
13937                 v.AddArg3(x, y, mem)
13938                 return true
13939         }
13940         // match: (PanicBounds [kind] x y mem)
13941         // cond: boundsABI(kind) == 2
13942         // result: (LoweredPanicBoundsC [kind] x y mem)
13943         for {
13944                 kind := auxIntToInt64(v.AuxInt)
13945                 x := v_0
13946                 y := v_1
13947                 mem := v_2
13948                 if !(boundsABI(kind) == 2) {
13949                         break
13950                 }
13951                 v.reset(OpPPC64LoweredPanicBoundsC)
13952                 v.AuxInt = int64ToAuxInt(kind)
13953                 v.AddArg3(x, y, mem)
13954                 return true
13955         }
13956         return false
13957 }
13958 func rewriteValuePPC64_OpPopCount16(v *Value) bool {
13959         v_0 := v.Args[0]
13960         b := v.Block
13961         typ := &b.Func.Config.Types
13962         // match: (PopCount16 x)
13963         // result: (POPCNTW (MOVHZreg x))
13964         for {
13965                 x := v_0
13966                 v.reset(OpPPC64POPCNTW)
13967                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
13968                 v0.AddArg(x)
13969                 v.AddArg(v0)
13970                 return true
13971         }
13972 }
13973 func rewriteValuePPC64_OpPopCount32(v *Value) bool {
13974         v_0 := v.Args[0]
13975         b := v.Block
13976         typ := &b.Func.Config.Types
13977         // match: (PopCount32 x)
13978         // result: (POPCNTW (MOVWZreg x))
13979         for {
13980                 x := v_0
13981                 v.reset(OpPPC64POPCNTW)
13982                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
13983                 v0.AddArg(x)
13984                 v.AddArg(v0)
13985                 return true
13986         }
13987 }
13988 func rewriteValuePPC64_OpPopCount8(v *Value) bool {
13989         v_0 := v.Args[0]
13990         b := v.Block
13991         typ := &b.Func.Config.Types
13992         // match: (PopCount8 x)
13993         // result: (POPCNTB (MOVBZreg x))
13994         for {
13995                 x := v_0
13996                 v.reset(OpPPC64POPCNTB)
13997                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13998                 v0.AddArg(x)
13999                 v.AddArg(v0)
14000                 return true
14001         }
14002 }
14003 func rewriteValuePPC64_OpRotateLeft16(v *Value) bool {
14004         v_1 := v.Args[1]
14005         v_0 := v.Args[0]
14006         b := v.Block
14007         typ := &b.Func.Config.Types
14008         // match: (RotateLeft16 <t> x (MOVDconst [c]))
14009         // result: (Or16 (Lsh16x64 <t> x (MOVDconst [c&15])) (Rsh16Ux64 <t> x (MOVDconst [-c&15])))
14010         for {
14011                 t := v.Type
14012                 x := v_0
14013                 if v_1.Op != OpPPC64MOVDconst {
14014                         break
14015                 }
14016                 c := auxIntToInt64(v_1.AuxInt)
14017                 v.reset(OpOr16)
14018                 v0 := b.NewValue0(v.Pos, OpLsh16x64, t)
14019                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14020                 v1.AuxInt = int64ToAuxInt(c & 15)
14021                 v0.AddArg2(x, v1)
14022                 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t)
14023                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14024                 v3.AuxInt = int64ToAuxInt(-c & 15)
14025                 v2.AddArg2(x, v3)
14026                 v.AddArg2(v0, v2)
14027                 return true
14028         }
14029         return false
14030 }
14031 func rewriteValuePPC64_OpRotateLeft32(v *Value) bool {
14032         v_1 := v.Args[1]
14033         v_0 := v.Args[0]
14034         // match: (RotateLeft32 x (MOVDconst [c]))
14035         // result: (ROTLWconst [c&31] x)
14036         for {
14037                 x := v_0
14038                 if v_1.Op != OpPPC64MOVDconst {
14039                         break
14040                 }
14041                 c := auxIntToInt64(v_1.AuxInt)
14042                 v.reset(OpPPC64ROTLWconst)
14043                 v.AuxInt = int64ToAuxInt(c & 31)
14044                 v.AddArg(x)
14045                 return true
14046         }
14047         // match: (RotateLeft32 x y)
14048         // result: (ROTLW x y)
14049         for {
14050                 x := v_0
14051                 y := v_1
14052                 v.reset(OpPPC64ROTLW)
14053                 v.AddArg2(x, y)
14054                 return true
14055         }
14056 }
14057 func rewriteValuePPC64_OpRotateLeft64(v *Value) bool {
14058         v_1 := v.Args[1]
14059         v_0 := v.Args[0]
14060         // match: (RotateLeft64 x (MOVDconst [c]))
14061         // result: (ROTLconst [c&63] x)
14062         for {
14063                 x := v_0
14064                 if v_1.Op != OpPPC64MOVDconst {
14065                         break
14066                 }
14067                 c := auxIntToInt64(v_1.AuxInt)
14068                 v.reset(OpPPC64ROTLconst)
14069                 v.AuxInt = int64ToAuxInt(c & 63)
14070                 v.AddArg(x)
14071                 return true
14072         }
14073         // match: (RotateLeft64 x y)
14074         // result: (ROTL x y)
14075         for {
14076                 x := v_0
14077                 y := v_1
14078                 v.reset(OpPPC64ROTL)
14079                 v.AddArg2(x, y)
14080                 return true
14081         }
14082 }
14083 func rewriteValuePPC64_OpRotateLeft8(v *Value) bool {
14084         v_1 := v.Args[1]
14085         v_0 := v.Args[0]
14086         b := v.Block
14087         typ := &b.Func.Config.Types
14088         // match: (RotateLeft8 <t> x (MOVDconst [c]))
14089         // result: (Or8 (Lsh8x64 <t> x (MOVDconst [c&7])) (Rsh8Ux64 <t> x (MOVDconst [-c&7])))
14090         for {
14091                 t := v.Type
14092                 x := v_0
14093                 if v_1.Op != OpPPC64MOVDconst {
14094                         break
14095                 }
14096                 c := auxIntToInt64(v_1.AuxInt)
14097                 v.reset(OpOr8)
14098                 v0 := b.NewValue0(v.Pos, OpLsh8x64, t)
14099                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14100                 v1.AuxInt = int64ToAuxInt(c & 7)
14101                 v0.AddArg2(x, v1)
14102                 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t)
14103                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14104                 v3.AuxInt = int64ToAuxInt(-c & 7)
14105                 v2.AddArg2(x, v3)
14106                 v.AddArg2(v0, v2)
14107                 return true
14108         }
14109         return false
14110 }
14111 func rewriteValuePPC64_OpRsh16Ux16(v *Value) bool {
14112         v_1 := v.Args[1]
14113         v_0 := v.Args[0]
14114         b := v.Block
14115         typ := &b.Func.Config.Types
14116         // match: (Rsh16Ux16 x y)
14117         // cond: shiftIsBounded(v)
14118         // result: (SRW (MOVHZreg x) y)
14119         for {
14120                 x := v_0
14121                 y := v_1
14122                 if !(shiftIsBounded(v)) {
14123                         break
14124                 }
14125                 v.reset(OpPPC64SRW)
14126                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
14127                 v0.AddArg(x)
14128                 v.AddArg2(v0, y)
14129                 return true
14130         }
14131         // match: (Rsh16Ux16 x y)
14132         // result: (SRW (ZeroExt16to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt16to64 y) (MOVDconst [16]))))
14133         for {
14134                 x := v_0
14135                 y := v_1
14136                 v.reset(OpPPC64SRW)
14137                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
14138                 v0.AddArg(x)
14139                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14140                 v1.AuxInt = int32ToAuxInt(0)
14141                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14142                 v2.AuxInt = int64ToAuxInt(-1)
14143                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14144                 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
14145                 v4.AddArg(y)
14146                 v5 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14147                 v5.AuxInt = int64ToAuxInt(16)
14148                 v3.AddArg2(v4, v5)
14149                 v1.AddArg3(y, v2, v3)
14150                 v.AddArg2(v0, v1)
14151                 return true
14152         }
14153 }
14154 func rewriteValuePPC64_OpRsh16Ux32(v *Value) bool {
14155         v_1 := v.Args[1]
14156         v_0 := v.Args[0]
14157         b := v.Block
14158         typ := &b.Func.Config.Types
14159         // match: (Rsh16Ux32 x (MOVDconst [c]))
14160         // cond: uint32(c) < 16
14161         // result: (SRWconst (ZeroExt16to32 x) [c&15])
14162         for {
14163                 x := v_0
14164                 if v_1.Op != OpPPC64MOVDconst {
14165                         break
14166                 }
14167                 c := auxIntToInt64(v_1.AuxInt)
14168                 if !(uint32(c) < 16) {
14169                         break
14170                 }
14171                 v.reset(OpPPC64SRWconst)
14172                 v.AuxInt = int64ToAuxInt(c & 15)
14173                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
14174                 v0.AddArg(x)
14175                 v.AddArg(v0)
14176                 return true
14177         }
14178         // match: (Rsh16Ux32 x y)
14179         // cond: shiftIsBounded(v)
14180         // result: (SRW (MOVHZreg x) y)
14181         for {
14182                 x := v_0
14183                 y := v_1
14184                 if !(shiftIsBounded(v)) {
14185                         break
14186                 }
14187                 v.reset(OpPPC64SRW)
14188                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
14189                 v0.AddArg(x)
14190                 v.AddArg2(v0, y)
14191                 return true
14192         }
14193         // match: (Rsh16Ux32 x y)
14194         // result: (SRW (ZeroExt16to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [16]))))
14195         for {
14196                 x := v_0
14197                 y := v_1
14198                 v.reset(OpPPC64SRW)
14199                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
14200                 v0.AddArg(x)
14201                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14202                 v1.AuxInt = int32ToAuxInt(0)
14203                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14204                 v2.AuxInt = int64ToAuxInt(-1)
14205                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14206                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14207                 v4.AuxInt = int64ToAuxInt(16)
14208                 v3.AddArg2(y, v4)
14209                 v1.AddArg3(y, v2, v3)
14210                 v.AddArg2(v0, v1)
14211                 return true
14212         }
14213 }
14214 func rewriteValuePPC64_OpRsh16Ux64(v *Value) bool {
14215         v_1 := v.Args[1]
14216         v_0 := v.Args[0]
14217         b := v.Block
14218         typ := &b.Func.Config.Types
14219         // match: (Rsh16Ux64 _ (MOVDconst [c]))
14220         // cond: uint64(c) >= 16
14221         // result: (MOVDconst [0])
14222         for {
14223                 if v_1.Op != OpPPC64MOVDconst {
14224                         break
14225                 }
14226                 c := auxIntToInt64(v_1.AuxInt)
14227                 if !(uint64(c) >= 16) {
14228                         break
14229                 }
14230                 v.reset(OpPPC64MOVDconst)
14231                 v.AuxInt = int64ToAuxInt(0)
14232                 return true
14233         }
14234         // match: (Rsh16Ux64 x (MOVDconst [c]))
14235         // cond: uint64(c) < 16
14236         // result: (SRWconst (ZeroExt16to32 x) [c])
14237         for {
14238                 x := v_0
14239                 if v_1.Op != OpPPC64MOVDconst {
14240                         break
14241                 }
14242                 c := auxIntToInt64(v_1.AuxInt)
14243                 if !(uint64(c) < 16) {
14244                         break
14245                 }
14246                 v.reset(OpPPC64SRWconst)
14247                 v.AuxInt = int64ToAuxInt(c)
14248                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
14249                 v0.AddArg(x)
14250                 v.AddArg(v0)
14251                 return true
14252         }
14253         // match: (Rsh16Ux64 x y)
14254         // cond: shiftIsBounded(v)
14255         // result: (SRW (MOVHZreg x) y)
14256         for {
14257                 x := v_0
14258                 y := v_1
14259                 if !(shiftIsBounded(v)) {
14260                         break
14261                 }
14262                 v.reset(OpPPC64SRW)
14263                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
14264                 v0.AddArg(x)
14265                 v.AddArg2(v0, y)
14266                 return true
14267         }
14268         // match: (Rsh16Ux64 x y)
14269         // result: (SRW (ZeroExt16to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [16]))))
14270         for {
14271                 x := v_0
14272                 y := v_1
14273                 v.reset(OpPPC64SRW)
14274                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
14275                 v0.AddArg(x)
14276                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14277                 v1.AuxInt = int32ToAuxInt(0)
14278                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14279                 v2.AuxInt = int64ToAuxInt(-1)
14280                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14281                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14282                 v4.AuxInt = int64ToAuxInt(16)
14283                 v3.AddArg2(y, v4)
14284                 v1.AddArg3(y, v2, v3)
14285                 v.AddArg2(v0, v1)
14286                 return true
14287         }
14288 }
14289 func rewriteValuePPC64_OpRsh16Ux8(v *Value) bool {
14290         v_1 := v.Args[1]
14291         v_0 := v.Args[0]
14292         b := v.Block
14293         typ := &b.Func.Config.Types
14294         // match: (Rsh16Ux8 x y)
14295         // cond: shiftIsBounded(v)
14296         // result: (SRW (MOVHZreg x) y)
14297         for {
14298                 x := v_0
14299                 y := v_1
14300                 if !(shiftIsBounded(v)) {
14301                         break
14302                 }
14303                 v.reset(OpPPC64SRW)
14304                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
14305                 v0.AddArg(x)
14306                 v.AddArg2(v0, y)
14307                 return true
14308         }
14309         // match: (Rsh16Ux8 x y)
14310         // result: (SRW (ZeroExt16to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt8to64 y) (MOVDconst [16]))))
14311         for {
14312                 x := v_0
14313                 y := v_1
14314                 v.reset(OpPPC64SRW)
14315                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
14316                 v0.AddArg(x)
14317                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14318                 v1.AuxInt = int32ToAuxInt(0)
14319                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14320                 v2.AuxInt = int64ToAuxInt(-1)
14321                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14322                 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
14323                 v4.AddArg(y)
14324                 v5 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14325                 v5.AuxInt = int64ToAuxInt(16)
14326                 v3.AddArg2(v4, v5)
14327                 v1.AddArg3(y, v2, v3)
14328                 v.AddArg2(v0, v1)
14329                 return true
14330         }
14331 }
14332 func rewriteValuePPC64_OpRsh16x16(v *Value) bool {
14333         v_1 := v.Args[1]
14334         v_0 := v.Args[0]
14335         b := v.Block
14336         typ := &b.Func.Config.Types
14337         // match: (Rsh16x16 x y)
14338         // cond: shiftIsBounded(v)
14339         // result: (SRAW (MOVHreg x) y)
14340         for {
14341                 x := v_0
14342                 y := v_1
14343                 if !(shiftIsBounded(v)) {
14344                         break
14345                 }
14346                 v.reset(OpPPC64SRAW)
14347                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
14348                 v0.AddArg(x)
14349                 v.AddArg2(v0, y)
14350                 return true
14351         }
14352         // match: (Rsh16x16 x y)
14353         // result: (SRAW (SignExt16to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt16to64 y) (MOVDconst [16]))))
14354         for {
14355                 x := v_0
14356                 y := v_1
14357                 v.reset(OpPPC64SRAW)
14358                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
14359                 v0.AddArg(x)
14360                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14361                 v1.AuxInt = int32ToAuxInt(0)
14362                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14363                 v2.AuxInt = int64ToAuxInt(-1)
14364                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14365                 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
14366                 v4.AddArg(y)
14367                 v5 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14368                 v5.AuxInt = int64ToAuxInt(16)
14369                 v3.AddArg2(v4, v5)
14370                 v1.AddArg3(y, v2, v3)
14371                 v.AddArg2(v0, v1)
14372                 return true
14373         }
14374 }
14375 func rewriteValuePPC64_OpRsh16x32(v *Value) bool {
14376         v_1 := v.Args[1]
14377         v_0 := v.Args[0]
14378         b := v.Block
14379         typ := &b.Func.Config.Types
14380         // match: (Rsh16x32 x (MOVDconst [c]))
14381         // cond: uint32(c) < 16
14382         // result: (SRAWconst (SignExt16to32 x) [c&15])
14383         for {
14384                 x := v_0
14385                 if v_1.Op != OpPPC64MOVDconst {
14386                         break
14387                 }
14388                 c := auxIntToInt64(v_1.AuxInt)
14389                 if !(uint32(c) < 16) {
14390                         break
14391                 }
14392                 v.reset(OpPPC64SRAWconst)
14393                 v.AuxInt = int64ToAuxInt(c & 15)
14394                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
14395                 v0.AddArg(x)
14396                 v.AddArg(v0)
14397                 return true
14398         }
14399         // match: (Rsh16x32 x y)
14400         // cond: shiftIsBounded(v)
14401         // result: (SRAW (MOVHreg x) y)
14402         for {
14403                 x := v_0
14404                 y := v_1
14405                 if !(shiftIsBounded(v)) {
14406                         break
14407                 }
14408                 v.reset(OpPPC64SRAW)
14409                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
14410                 v0.AddArg(x)
14411                 v.AddArg2(v0, y)
14412                 return true
14413         }
14414         // match: (Rsh16x32 x y)
14415         // result: (SRAW (SignExt16to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [16]))))
14416         for {
14417                 x := v_0
14418                 y := v_1
14419                 v.reset(OpPPC64SRAW)
14420                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
14421                 v0.AddArg(x)
14422                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14423                 v1.AuxInt = int32ToAuxInt(0)
14424                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14425                 v2.AuxInt = int64ToAuxInt(-1)
14426                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14427                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14428                 v4.AuxInt = int64ToAuxInt(16)
14429                 v3.AddArg2(y, v4)
14430                 v1.AddArg3(y, v2, v3)
14431                 v.AddArg2(v0, v1)
14432                 return true
14433         }
14434 }
14435 func rewriteValuePPC64_OpRsh16x64(v *Value) bool {
14436         v_1 := v.Args[1]
14437         v_0 := v.Args[0]
14438         b := v.Block
14439         typ := &b.Func.Config.Types
14440         // match: (Rsh16x64 x (MOVDconst [c]))
14441         // cond: uint64(c) >= 16
14442         // result: (SRAWconst (SignExt16to32 x) [63])
14443         for {
14444                 x := v_0
14445                 if v_1.Op != OpPPC64MOVDconst {
14446                         break
14447                 }
14448                 c := auxIntToInt64(v_1.AuxInt)
14449                 if !(uint64(c) >= 16) {
14450                         break
14451                 }
14452                 v.reset(OpPPC64SRAWconst)
14453                 v.AuxInt = int64ToAuxInt(63)
14454                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
14455                 v0.AddArg(x)
14456                 v.AddArg(v0)
14457                 return true
14458         }
14459         // match: (Rsh16x64 x (MOVDconst [c]))
14460         // cond: uint64(c) < 16
14461         // result: (SRAWconst (SignExt16to32 x) [c])
14462         for {
14463                 x := v_0
14464                 if v_1.Op != OpPPC64MOVDconst {
14465                         break
14466                 }
14467                 c := auxIntToInt64(v_1.AuxInt)
14468                 if !(uint64(c) < 16) {
14469                         break
14470                 }
14471                 v.reset(OpPPC64SRAWconst)
14472                 v.AuxInt = int64ToAuxInt(c)
14473                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
14474                 v0.AddArg(x)
14475                 v.AddArg(v0)
14476                 return true
14477         }
14478         // match: (Rsh16x64 x y)
14479         // cond: shiftIsBounded(v)
14480         // result: (SRAW (MOVHreg x) y)
14481         for {
14482                 x := v_0
14483                 y := v_1
14484                 if !(shiftIsBounded(v)) {
14485                         break
14486                 }
14487                 v.reset(OpPPC64SRAW)
14488                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
14489                 v0.AddArg(x)
14490                 v.AddArg2(v0, y)
14491                 return true
14492         }
14493         // match: (Rsh16x64 x y)
14494         // result: (SRAW (SignExt16to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [16]))))
14495         for {
14496                 x := v_0
14497                 y := v_1
14498                 v.reset(OpPPC64SRAW)
14499                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
14500                 v0.AddArg(x)
14501                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14502                 v1.AuxInt = int32ToAuxInt(0)
14503                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14504                 v2.AuxInt = int64ToAuxInt(-1)
14505                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14506                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14507                 v4.AuxInt = int64ToAuxInt(16)
14508                 v3.AddArg2(y, v4)
14509                 v1.AddArg3(y, v2, v3)
14510                 v.AddArg2(v0, v1)
14511                 return true
14512         }
14513 }
14514 func rewriteValuePPC64_OpRsh16x8(v *Value) bool {
14515         v_1 := v.Args[1]
14516         v_0 := v.Args[0]
14517         b := v.Block
14518         typ := &b.Func.Config.Types
14519         // match: (Rsh16x8 x y)
14520         // cond: shiftIsBounded(v)
14521         // result: (SRAW (MOVHreg x) y)
14522         for {
14523                 x := v_0
14524                 y := v_1
14525                 if !(shiftIsBounded(v)) {
14526                         break
14527                 }
14528                 v.reset(OpPPC64SRAW)
14529                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
14530                 v0.AddArg(x)
14531                 v.AddArg2(v0, y)
14532                 return true
14533         }
14534         // match: (Rsh16x8 x y)
14535         // result: (SRAW (SignExt16to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt8to64 y) (MOVDconst [16]))))
14536         for {
14537                 x := v_0
14538                 y := v_1
14539                 v.reset(OpPPC64SRAW)
14540                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
14541                 v0.AddArg(x)
14542                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14543                 v1.AuxInt = int32ToAuxInt(0)
14544                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14545                 v2.AuxInt = int64ToAuxInt(-1)
14546                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14547                 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
14548                 v4.AddArg(y)
14549                 v5 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14550                 v5.AuxInt = int64ToAuxInt(16)
14551                 v3.AddArg2(v4, v5)
14552                 v1.AddArg3(y, v2, v3)
14553                 v.AddArg2(v0, v1)
14554                 return true
14555         }
14556 }
14557 func rewriteValuePPC64_OpRsh32Ux16(v *Value) bool {
14558         v_1 := v.Args[1]
14559         v_0 := v.Args[0]
14560         b := v.Block
14561         typ := &b.Func.Config.Types
14562         // match: (Rsh32Ux16 x y)
14563         // cond: shiftIsBounded(v)
14564         // result: (SRW x y)
14565         for {
14566                 x := v_0
14567                 y := v_1
14568                 if !(shiftIsBounded(v)) {
14569                         break
14570                 }
14571                 v.reset(OpPPC64SRW)
14572                 v.AddArg2(x, y)
14573                 return true
14574         }
14575         // match: (Rsh32Ux16 x y)
14576         // result: (SRW x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt16to64 y) (MOVDconst [32]))))
14577         for {
14578                 x := v_0
14579                 y := v_1
14580                 v.reset(OpPPC64SRW)
14581                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14582                 v0.AuxInt = int32ToAuxInt(0)
14583                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14584                 v1.AuxInt = int64ToAuxInt(-1)
14585                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14586                 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
14587                 v3.AddArg(y)
14588                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14589                 v4.AuxInt = int64ToAuxInt(32)
14590                 v2.AddArg2(v3, v4)
14591                 v0.AddArg3(y, v1, v2)
14592                 v.AddArg2(x, v0)
14593                 return true
14594         }
14595 }
14596 func rewriteValuePPC64_OpRsh32Ux32(v *Value) bool {
14597         v_1 := v.Args[1]
14598         v_0 := v.Args[0]
14599         b := v.Block
14600         typ := &b.Func.Config.Types
14601         // match: (Rsh32Ux32 x (MOVDconst [c]))
14602         // cond: uint32(c) < 32
14603         // result: (SRWconst x [c&31])
14604         for {
14605                 x := v_0
14606                 if v_1.Op != OpPPC64MOVDconst {
14607                         break
14608                 }
14609                 c := auxIntToInt64(v_1.AuxInt)
14610                 if !(uint32(c) < 32) {
14611                         break
14612                 }
14613                 v.reset(OpPPC64SRWconst)
14614                 v.AuxInt = int64ToAuxInt(c & 31)
14615                 v.AddArg(x)
14616                 return true
14617         }
14618         // match: (Rsh32Ux32 x y)
14619         // cond: shiftIsBounded(v)
14620         // result: (SRW x y)
14621         for {
14622                 x := v_0
14623                 y := v_1
14624                 if !(shiftIsBounded(v)) {
14625                         break
14626                 }
14627                 v.reset(OpPPC64SRW)
14628                 v.AddArg2(x, y)
14629                 return true
14630         }
14631         // match: (Rsh32Ux32 x y)
14632         // result: (SRW x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [32]))))
14633         for {
14634                 x := v_0
14635                 y := v_1
14636                 v.reset(OpPPC64SRW)
14637                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14638                 v0.AuxInt = int32ToAuxInt(0)
14639                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14640                 v1.AuxInt = int64ToAuxInt(-1)
14641                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14642                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14643                 v3.AuxInt = int64ToAuxInt(32)
14644                 v2.AddArg2(y, v3)
14645                 v0.AddArg3(y, v1, v2)
14646                 v.AddArg2(x, v0)
14647                 return true
14648         }
14649 }
14650 func rewriteValuePPC64_OpRsh32Ux64(v *Value) bool {
14651         v_1 := v.Args[1]
14652         v_0 := v.Args[0]
14653         b := v.Block
14654         typ := &b.Func.Config.Types
14655         // match: (Rsh32Ux64 _ (MOVDconst [c]))
14656         // cond: uint64(c) >= 32
14657         // result: (MOVDconst [0])
14658         for {
14659                 if v_1.Op != OpPPC64MOVDconst {
14660                         break
14661                 }
14662                 c := auxIntToInt64(v_1.AuxInt)
14663                 if !(uint64(c) >= 32) {
14664                         break
14665                 }
14666                 v.reset(OpPPC64MOVDconst)
14667                 v.AuxInt = int64ToAuxInt(0)
14668                 return true
14669         }
14670         // match: (Rsh32Ux64 x (MOVDconst [c]))
14671         // cond: uint64(c) < 32
14672         // result: (SRWconst x [c])
14673         for {
14674                 x := v_0
14675                 if v_1.Op != OpPPC64MOVDconst {
14676                         break
14677                 }
14678                 c := auxIntToInt64(v_1.AuxInt)
14679                 if !(uint64(c) < 32) {
14680                         break
14681                 }
14682                 v.reset(OpPPC64SRWconst)
14683                 v.AuxInt = int64ToAuxInt(c)
14684                 v.AddArg(x)
14685                 return true
14686         }
14687         // match: (Rsh32Ux64 x y)
14688         // cond: shiftIsBounded(v)
14689         // result: (SRW x y)
14690         for {
14691                 x := v_0
14692                 y := v_1
14693                 if !(shiftIsBounded(v)) {
14694                         break
14695                 }
14696                 v.reset(OpPPC64SRW)
14697                 v.AddArg2(x, y)
14698                 return true
14699         }
14700         // match: (Rsh32Ux64 x (AND y (MOVDconst [31])))
14701         // result: (SRW x (ANDconst <typ.Int32> [31] y))
14702         for {
14703                 x := v_0
14704                 if v_1.Op != OpPPC64AND {
14705                         break
14706                 }
14707                 _ = v_1.Args[1]
14708                 v_1_0 := v_1.Args[0]
14709                 v_1_1 := v_1.Args[1]
14710                 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
14711                         y := v_1_0
14712                         if v_1_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1.AuxInt) != 31 {
14713                                 continue
14714                         }
14715                         v.reset(OpPPC64SRW)
14716                         v0 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.Int32)
14717                         v0.AuxInt = int64ToAuxInt(31)
14718                         v0.AddArg(y)
14719                         v.AddArg2(x, v0)
14720                         return true
14721                 }
14722                 break
14723         }
14724         // match: (Rsh32Ux64 x (ANDconst <typ.UInt> [31] y))
14725         // result: (SRW x (ANDconst <typ.UInt> [31] y))
14726         for {
14727                 x := v_0
14728                 if v_1.Op != OpPPC64ANDconst || v_1.Type != typ.UInt || auxIntToInt64(v_1.AuxInt) != 31 {
14729                         break
14730                 }
14731                 y := v_1.Args[0]
14732                 v.reset(OpPPC64SRW)
14733                 v0 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
14734                 v0.AuxInt = int64ToAuxInt(31)
14735                 v0.AddArg(y)
14736                 v.AddArg2(x, v0)
14737                 return true
14738         }
14739         // match: (Rsh32Ux64 x (SUB <typ.UInt> (MOVDconst [32]) (ANDconst <typ.UInt> [31] y)))
14740         // result: (SRW x (SUB <typ.UInt> (MOVDconst [32]) (ANDconst <typ.UInt> [31] y)))
14741         for {
14742                 x := v_0
14743                 if v_1.Op != OpPPC64SUB || v_1.Type != typ.UInt {
14744                         break
14745                 }
14746                 _ = v_1.Args[1]
14747                 v_1_0 := v_1.Args[0]
14748                 if v_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_0.AuxInt) != 32 {
14749                         break
14750                 }
14751                 v_1_1 := v_1.Args[1]
14752                 if v_1_1.Op != OpPPC64ANDconst || v_1_1.Type != typ.UInt || auxIntToInt64(v_1_1.AuxInt) != 31 {
14753                         break
14754                 }
14755                 y := v_1_1.Args[0]
14756                 v.reset(OpPPC64SRW)
14757                 v0 := b.NewValue0(v.Pos, OpPPC64SUB, typ.UInt)
14758                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14759                 v1.AuxInt = int64ToAuxInt(32)
14760                 v2 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
14761                 v2.AuxInt = int64ToAuxInt(31)
14762                 v2.AddArg(y)
14763                 v0.AddArg2(v1, v2)
14764                 v.AddArg2(x, v0)
14765                 return true
14766         }
14767         // match: (Rsh32Ux64 x (SUBFCconst <typ.UInt> [32] (ANDconst <typ.UInt> [31] y)))
14768         // result: (SRW x (SUBFCconst <typ.UInt> [32] (ANDconst <typ.UInt> [31] y)))
14769         for {
14770                 x := v_0
14771                 if v_1.Op != OpPPC64SUBFCconst || v_1.Type != typ.UInt || auxIntToInt64(v_1.AuxInt) != 32 {
14772                         break
14773                 }
14774                 v_1_0 := v_1.Args[0]
14775                 if v_1_0.Op != OpPPC64ANDconst || v_1_0.Type != typ.UInt || auxIntToInt64(v_1_0.AuxInt) != 31 {
14776                         break
14777                 }
14778                 y := v_1_0.Args[0]
14779                 v.reset(OpPPC64SRW)
14780                 v0 := b.NewValue0(v.Pos, OpPPC64SUBFCconst, typ.UInt)
14781                 v0.AuxInt = int64ToAuxInt(32)
14782                 v1 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
14783                 v1.AuxInt = int64ToAuxInt(31)
14784                 v1.AddArg(y)
14785                 v0.AddArg(v1)
14786                 v.AddArg2(x, v0)
14787                 return true
14788         }
14789         // match: (Rsh32Ux64 x (SUB <typ.UInt> (MOVDconst [32]) (AND <typ.UInt> y (MOVDconst [31]))))
14790         // result: (SRW x (SUB <typ.UInt> (MOVDconst [32]) (ANDconst <typ.UInt> [31] y)))
14791         for {
14792                 x := v_0
14793                 if v_1.Op != OpPPC64SUB || v_1.Type != typ.UInt {
14794                         break
14795                 }
14796                 _ = v_1.Args[1]
14797                 v_1_0 := v_1.Args[0]
14798                 if v_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_0.AuxInt) != 32 {
14799                         break
14800                 }
14801                 v_1_1 := v_1.Args[1]
14802                 if v_1_1.Op != OpPPC64AND || v_1_1.Type != typ.UInt {
14803                         break
14804                 }
14805                 _ = v_1_1.Args[1]
14806                 v_1_1_0 := v_1_1.Args[0]
14807                 v_1_1_1 := v_1_1.Args[1]
14808                 for _i0 := 0; _i0 <= 1; _i0, v_1_1_0, v_1_1_1 = _i0+1, v_1_1_1, v_1_1_0 {
14809                         y := v_1_1_0
14810                         if v_1_1_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1_1.AuxInt) != 31 {
14811                                 continue
14812                         }
14813                         v.reset(OpPPC64SRW)
14814                         v0 := b.NewValue0(v.Pos, OpPPC64SUB, typ.UInt)
14815                         v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14816                         v1.AuxInt = int64ToAuxInt(32)
14817                         v2 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
14818                         v2.AuxInt = int64ToAuxInt(31)
14819                         v2.AddArg(y)
14820                         v0.AddArg2(v1, v2)
14821                         v.AddArg2(x, v0)
14822                         return true
14823                 }
14824                 break
14825         }
14826         // match: (Rsh32Ux64 x (SUBFCconst <typ.UInt> [32] (AND <typ.UInt> y (MOVDconst [31]))))
14827         // result: (SRW x (SUBFCconst <typ.UInt> [32] (ANDconst <typ.UInt> [31] y)))
14828         for {
14829                 x := v_0
14830                 if v_1.Op != OpPPC64SUBFCconst || v_1.Type != typ.UInt || auxIntToInt64(v_1.AuxInt) != 32 {
14831                         break
14832                 }
14833                 v_1_0 := v_1.Args[0]
14834                 if v_1_0.Op != OpPPC64AND || v_1_0.Type != typ.UInt {
14835                         break
14836                 }
14837                 _ = v_1_0.Args[1]
14838                 v_1_0_0 := v_1_0.Args[0]
14839                 v_1_0_1 := v_1_0.Args[1]
14840                 for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 {
14841                         y := v_1_0_0
14842                         if v_1_0_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_0_1.AuxInt) != 31 {
14843                                 continue
14844                         }
14845                         v.reset(OpPPC64SRW)
14846                         v0 := b.NewValue0(v.Pos, OpPPC64SUBFCconst, typ.UInt)
14847                         v0.AuxInt = int64ToAuxInt(32)
14848                         v1 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
14849                         v1.AuxInt = int64ToAuxInt(31)
14850                         v1.AddArg(y)
14851                         v0.AddArg(v1)
14852                         v.AddArg2(x, v0)
14853                         return true
14854                 }
14855                 break
14856         }
14857         // match: (Rsh32Ux64 x y)
14858         // result: (SRW x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [32]))))
14859         for {
14860                 x := v_0
14861                 y := v_1
14862                 v.reset(OpPPC64SRW)
14863                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14864                 v0.AuxInt = int32ToAuxInt(0)
14865                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14866                 v1.AuxInt = int64ToAuxInt(-1)
14867                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14868                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14869                 v3.AuxInt = int64ToAuxInt(32)
14870                 v2.AddArg2(y, v3)
14871                 v0.AddArg3(y, v1, v2)
14872                 v.AddArg2(x, v0)
14873                 return true
14874         }
14875 }
14876 func rewriteValuePPC64_OpRsh32Ux8(v *Value) bool {
14877         v_1 := v.Args[1]
14878         v_0 := v.Args[0]
14879         b := v.Block
14880         typ := &b.Func.Config.Types
14881         // match: (Rsh32Ux8 x y)
14882         // cond: shiftIsBounded(v)
14883         // result: (SRW x y)
14884         for {
14885                 x := v_0
14886                 y := v_1
14887                 if !(shiftIsBounded(v)) {
14888                         break
14889                 }
14890                 v.reset(OpPPC64SRW)
14891                 v.AddArg2(x, y)
14892                 return true
14893         }
14894         // match: (Rsh32Ux8 x y)
14895         // result: (SRW x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt8to64 y) (MOVDconst [32]))))
14896         for {
14897                 x := v_0
14898                 y := v_1
14899                 v.reset(OpPPC64SRW)
14900                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14901                 v0.AuxInt = int32ToAuxInt(0)
14902                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14903                 v1.AuxInt = int64ToAuxInt(-1)
14904                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14905                 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
14906                 v3.AddArg(y)
14907                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14908                 v4.AuxInt = int64ToAuxInt(32)
14909                 v2.AddArg2(v3, v4)
14910                 v0.AddArg3(y, v1, v2)
14911                 v.AddArg2(x, v0)
14912                 return true
14913         }
14914 }
14915 func rewriteValuePPC64_OpRsh32x16(v *Value) bool {
14916         v_1 := v.Args[1]
14917         v_0 := v.Args[0]
14918         b := v.Block
14919         typ := &b.Func.Config.Types
14920         // match: (Rsh32x16 x y)
14921         // cond: shiftIsBounded(v)
14922         // result: (SRAW x y)
14923         for {
14924                 x := v_0
14925                 y := v_1
14926                 if !(shiftIsBounded(v)) {
14927                         break
14928                 }
14929                 v.reset(OpPPC64SRAW)
14930                 v.AddArg2(x, y)
14931                 return true
14932         }
14933         // match: (Rsh32x16 x y)
14934         // result: (SRAW x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt16to64 y) (MOVDconst [32]))))
14935         for {
14936                 x := v_0
14937                 y := v_1
14938                 v.reset(OpPPC64SRAW)
14939                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14940                 v0.AuxInt = int32ToAuxInt(0)
14941                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14942                 v1.AuxInt = int64ToAuxInt(-1)
14943                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
14944                 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
14945                 v3.AddArg(y)
14946                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14947                 v4.AuxInt = int64ToAuxInt(32)
14948                 v2.AddArg2(v3, v4)
14949                 v0.AddArg3(y, v1, v2)
14950                 v.AddArg2(x, v0)
14951                 return true
14952         }
14953 }
14954 func rewriteValuePPC64_OpRsh32x32(v *Value) bool {
14955         v_1 := v.Args[1]
14956         v_0 := v.Args[0]
14957         b := v.Block
14958         typ := &b.Func.Config.Types
14959         // match: (Rsh32x32 x (MOVDconst [c]))
14960         // cond: uint32(c) < 32
14961         // result: (SRAWconst x [c&31])
14962         for {
14963                 x := v_0
14964                 if v_1.Op != OpPPC64MOVDconst {
14965                         break
14966                 }
14967                 c := auxIntToInt64(v_1.AuxInt)
14968                 if !(uint32(c) < 32) {
14969                         break
14970                 }
14971                 v.reset(OpPPC64SRAWconst)
14972                 v.AuxInt = int64ToAuxInt(c & 31)
14973                 v.AddArg(x)
14974                 return true
14975         }
14976         // match: (Rsh32x32 x y)
14977         // cond: shiftIsBounded(v)
14978         // result: (SRAW x y)
14979         for {
14980                 x := v_0
14981                 y := v_1
14982                 if !(shiftIsBounded(v)) {
14983                         break
14984                 }
14985                 v.reset(OpPPC64SRAW)
14986                 v.AddArg2(x, y)
14987                 return true
14988         }
14989         // match: (Rsh32x32 x y)
14990         // result: (SRAW x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [32]))))
14991         for {
14992                 x := v_0
14993                 y := v_1
14994                 v.reset(OpPPC64SRAW)
14995                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
14996                 v0.AuxInt = int32ToAuxInt(0)
14997                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14998                 v1.AuxInt = int64ToAuxInt(-1)
14999                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
15000                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15001                 v3.AuxInt = int64ToAuxInt(32)
15002                 v2.AddArg2(y, v3)
15003                 v0.AddArg3(y, v1, v2)
15004                 v.AddArg2(x, v0)
15005                 return true
15006         }
15007 }
15008 func rewriteValuePPC64_OpRsh32x64(v *Value) bool {
15009         v_1 := v.Args[1]
15010         v_0 := v.Args[0]
15011         b := v.Block
15012         typ := &b.Func.Config.Types
15013         // match: (Rsh32x64 x (MOVDconst [c]))
15014         // cond: uint64(c) >= 32
15015         // result: (SRAWconst x [63])
15016         for {
15017                 x := v_0
15018                 if v_1.Op != OpPPC64MOVDconst {
15019                         break
15020                 }
15021                 c := auxIntToInt64(v_1.AuxInt)
15022                 if !(uint64(c) >= 32) {
15023                         break
15024                 }
15025                 v.reset(OpPPC64SRAWconst)
15026                 v.AuxInt = int64ToAuxInt(63)
15027                 v.AddArg(x)
15028                 return true
15029         }
15030         // match: (Rsh32x64 x (MOVDconst [c]))
15031         // cond: uint64(c) < 32
15032         // result: (SRAWconst x [c])
15033         for {
15034                 x := v_0
15035                 if v_1.Op != OpPPC64MOVDconst {
15036                         break
15037                 }
15038                 c := auxIntToInt64(v_1.AuxInt)
15039                 if !(uint64(c) < 32) {
15040                         break
15041                 }
15042                 v.reset(OpPPC64SRAWconst)
15043                 v.AuxInt = int64ToAuxInt(c)
15044                 v.AddArg(x)
15045                 return true
15046         }
15047         // match: (Rsh32x64 x y)
15048         // cond: shiftIsBounded(v)
15049         // result: (SRAW x y)
15050         for {
15051                 x := v_0
15052                 y := v_1
15053                 if !(shiftIsBounded(v)) {
15054                         break
15055                 }
15056                 v.reset(OpPPC64SRAW)
15057                 v.AddArg2(x, y)
15058                 return true
15059         }
15060         // match: (Rsh32x64 x (AND y (MOVDconst [31])))
15061         // result: (SRAW x (ANDconst <typ.Int32> [31] y))
15062         for {
15063                 x := v_0
15064                 if v_1.Op != OpPPC64AND {
15065                         break
15066                 }
15067                 _ = v_1.Args[1]
15068                 v_1_0 := v_1.Args[0]
15069                 v_1_1 := v_1.Args[1]
15070                 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
15071                         y := v_1_0
15072                         if v_1_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1.AuxInt) != 31 {
15073                                 continue
15074                         }
15075                         v.reset(OpPPC64SRAW)
15076                         v0 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.Int32)
15077                         v0.AuxInt = int64ToAuxInt(31)
15078                         v0.AddArg(y)
15079                         v.AddArg2(x, v0)
15080                         return true
15081                 }
15082                 break
15083         }
15084         // match: (Rsh32x64 x (ANDconst <typ.UInt> [31] y))
15085         // result: (SRAW x (ANDconst <typ.UInt> [31] y))
15086         for {
15087                 x := v_0
15088                 if v_1.Op != OpPPC64ANDconst || v_1.Type != typ.UInt || auxIntToInt64(v_1.AuxInt) != 31 {
15089                         break
15090                 }
15091                 y := v_1.Args[0]
15092                 v.reset(OpPPC64SRAW)
15093                 v0 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15094                 v0.AuxInt = int64ToAuxInt(31)
15095                 v0.AddArg(y)
15096                 v.AddArg2(x, v0)
15097                 return true
15098         }
15099         // match: (Rsh32x64 x (SUB <typ.UInt> (MOVDconst [32]) (ANDconst <typ.UInt> [31] y)))
15100         // result: (SRAW x (SUB <typ.UInt> (MOVDconst [32]) (ANDconst <typ.UInt> [31] y)))
15101         for {
15102                 x := v_0
15103                 if v_1.Op != OpPPC64SUB || v_1.Type != typ.UInt {
15104                         break
15105                 }
15106                 _ = v_1.Args[1]
15107                 v_1_0 := v_1.Args[0]
15108                 if v_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_0.AuxInt) != 32 {
15109                         break
15110                 }
15111                 v_1_1 := v_1.Args[1]
15112                 if v_1_1.Op != OpPPC64ANDconst || v_1_1.Type != typ.UInt || auxIntToInt64(v_1_1.AuxInt) != 31 {
15113                         break
15114                 }
15115                 y := v_1_1.Args[0]
15116                 v.reset(OpPPC64SRAW)
15117                 v0 := b.NewValue0(v.Pos, OpPPC64SUB, typ.UInt)
15118                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15119                 v1.AuxInt = int64ToAuxInt(32)
15120                 v2 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15121                 v2.AuxInt = int64ToAuxInt(31)
15122                 v2.AddArg(y)
15123                 v0.AddArg2(v1, v2)
15124                 v.AddArg2(x, v0)
15125                 return true
15126         }
15127         // match: (Rsh32x64 x (SUBFCconst <typ.UInt> [32] (ANDconst <typ.UInt> [31] y)))
15128         // result: (SRAW x (SUBFCconst <typ.UInt> [32] (ANDconst <typ.UInt> [31] y)))
15129         for {
15130                 x := v_0
15131                 if v_1.Op != OpPPC64SUBFCconst || v_1.Type != typ.UInt || auxIntToInt64(v_1.AuxInt) != 32 {
15132                         break
15133                 }
15134                 v_1_0 := v_1.Args[0]
15135                 if v_1_0.Op != OpPPC64ANDconst || v_1_0.Type != typ.UInt || auxIntToInt64(v_1_0.AuxInt) != 31 {
15136                         break
15137                 }
15138                 y := v_1_0.Args[0]
15139                 v.reset(OpPPC64SRAW)
15140                 v0 := b.NewValue0(v.Pos, OpPPC64SUBFCconst, typ.UInt)
15141                 v0.AuxInt = int64ToAuxInt(32)
15142                 v1 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15143                 v1.AuxInt = int64ToAuxInt(31)
15144                 v1.AddArg(y)
15145                 v0.AddArg(v1)
15146                 v.AddArg2(x, v0)
15147                 return true
15148         }
15149         // match: (Rsh32x64 x (SUB <typ.UInt> (MOVDconst [32]) (AND <typ.UInt> y (MOVDconst [31]))))
15150         // result: (SRAW x (SUB <typ.UInt> (MOVDconst [32]) (ANDconst <typ.UInt> [31] y)))
15151         for {
15152                 x := v_0
15153                 if v_1.Op != OpPPC64SUB || v_1.Type != typ.UInt {
15154                         break
15155                 }
15156                 _ = v_1.Args[1]
15157                 v_1_0 := v_1.Args[0]
15158                 if v_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_0.AuxInt) != 32 {
15159                         break
15160                 }
15161                 v_1_1 := v_1.Args[1]
15162                 if v_1_1.Op != OpPPC64AND || v_1_1.Type != typ.UInt {
15163                         break
15164                 }
15165                 _ = v_1_1.Args[1]
15166                 v_1_1_0 := v_1_1.Args[0]
15167                 v_1_1_1 := v_1_1.Args[1]
15168                 for _i0 := 0; _i0 <= 1; _i0, v_1_1_0, v_1_1_1 = _i0+1, v_1_1_1, v_1_1_0 {
15169                         y := v_1_1_0
15170                         if v_1_1_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1_1.AuxInt) != 31 {
15171                                 continue
15172                         }
15173                         v.reset(OpPPC64SRAW)
15174                         v0 := b.NewValue0(v.Pos, OpPPC64SUB, typ.UInt)
15175                         v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15176                         v1.AuxInt = int64ToAuxInt(32)
15177                         v2 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15178                         v2.AuxInt = int64ToAuxInt(31)
15179                         v2.AddArg(y)
15180                         v0.AddArg2(v1, v2)
15181                         v.AddArg2(x, v0)
15182                         return true
15183                 }
15184                 break
15185         }
15186         // match: (Rsh32x64 x (SUBFCconst <typ.UInt> [32] (AND <typ.UInt> y (MOVDconst [31]))))
15187         // result: (SRAW x (SUBFCconst <typ.UInt> [32] (ANDconst <typ.UInt> [31] y)))
15188         for {
15189                 x := v_0
15190                 if v_1.Op != OpPPC64SUBFCconst || v_1.Type != typ.UInt || auxIntToInt64(v_1.AuxInt) != 32 {
15191                         break
15192                 }
15193                 v_1_0 := v_1.Args[0]
15194                 if v_1_0.Op != OpPPC64AND || v_1_0.Type != typ.UInt {
15195                         break
15196                 }
15197                 _ = v_1_0.Args[1]
15198                 v_1_0_0 := v_1_0.Args[0]
15199                 v_1_0_1 := v_1_0.Args[1]
15200                 for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 {
15201                         y := v_1_0_0
15202                         if v_1_0_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_0_1.AuxInt) != 31 {
15203                                 continue
15204                         }
15205                         v.reset(OpPPC64SRAW)
15206                         v0 := b.NewValue0(v.Pos, OpPPC64SUBFCconst, typ.UInt)
15207                         v0.AuxInt = int64ToAuxInt(32)
15208                         v1 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15209                         v1.AuxInt = int64ToAuxInt(31)
15210                         v1.AddArg(y)
15211                         v0.AddArg(v1)
15212                         v.AddArg2(x, v0)
15213                         return true
15214                 }
15215                 break
15216         }
15217         // match: (Rsh32x64 x y)
15218         // result: (SRAW x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [32]))))
15219         for {
15220                 x := v_0
15221                 y := v_1
15222                 v.reset(OpPPC64SRAW)
15223                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
15224                 v0.AuxInt = int32ToAuxInt(0)
15225                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15226                 v1.AuxInt = int64ToAuxInt(-1)
15227                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
15228                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15229                 v3.AuxInt = int64ToAuxInt(32)
15230                 v2.AddArg2(y, v3)
15231                 v0.AddArg3(y, v1, v2)
15232                 v.AddArg2(x, v0)
15233                 return true
15234         }
15235 }
15236 func rewriteValuePPC64_OpRsh32x8(v *Value) bool {
15237         v_1 := v.Args[1]
15238         v_0 := v.Args[0]
15239         b := v.Block
15240         typ := &b.Func.Config.Types
15241         // match: (Rsh32x8 x y)
15242         // cond: shiftIsBounded(v)
15243         // result: (SRAW x y)
15244         for {
15245                 x := v_0
15246                 y := v_1
15247                 if !(shiftIsBounded(v)) {
15248                         break
15249                 }
15250                 v.reset(OpPPC64SRAW)
15251                 v.AddArg2(x, y)
15252                 return true
15253         }
15254         // match: (Rsh32x8 x y)
15255         // result: (SRAW x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt8to64 y) (MOVDconst [32]))))
15256         for {
15257                 x := v_0
15258                 y := v_1
15259                 v.reset(OpPPC64SRAW)
15260                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
15261                 v0.AuxInt = int32ToAuxInt(0)
15262                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15263                 v1.AuxInt = int64ToAuxInt(-1)
15264                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
15265                 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
15266                 v3.AddArg(y)
15267                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15268                 v4.AuxInt = int64ToAuxInt(32)
15269                 v2.AddArg2(v3, v4)
15270                 v0.AddArg3(y, v1, v2)
15271                 v.AddArg2(x, v0)
15272                 return true
15273         }
15274 }
15275 func rewriteValuePPC64_OpRsh64Ux16(v *Value) bool {
15276         v_1 := v.Args[1]
15277         v_0 := v.Args[0]
15278         b := v.Block
15279         typ := &b.Func.Config.Types
15280         // match: (Rsh64Ux16 x y)
15281         // cond: shiftIsBounded(v)
15282         // result: (SRD x y)
15283         for {
15284                 x := v_0
15285                 y := v_1
15286                 if !(shiftIsBounded(v)) {
15287                         break
15288                 }
15289                 v.reset(OpPPC64SRD)
15290                 v.AddArg2(x, y)
15291                 return true
15292         }
15293         // match: (Rsh64Ux16 x y)
15294         // result: (SRD x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt16to64 y) (MOVDconst [64]))))
15295         for {
15296                 x := v_0
15297                 y := v_1
15298                 v.reset(OpPPC64SRD)
15299                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
15300                 v0.AuxInt = int32ToAuxInt(0)
15301                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15302                 v1.AuxInt = int64ToAuxInt(-1)
15303                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
15304                 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
15305                 v3.AddArg(y)
15306                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15307                 v4.AuxInt = int64ToAuxInt(64)
15308                 v2.AddArg2(v3, v4)
15309                 v0.AddArg3(y, v1, v2)
15310                 v.AddArg2(x, v0)
15311                 return true
15312         }
15313 }
15314 func rewriteValuePPC64_OpRsh64Ux32(v *Value) bool {
15315         v_1 := v.Args[1]
15316         v_0 := v.Args[0]
15317         b := v.Block
15318         typ := &b.Func.Config.Types
15319         // match: (Rsh64Ux32 x (MOVDconst [c]))
15320         // cond: uint32(c) < 64
15321         // result: (SRDconst x [c&63])
15322         for {
15323                 x := v_0
15324                 if v_1.Op != OpPPC64MOVDconst {
15325                         break
15326                 }
15327                 c := auxIntToInt64(v_1.AuxInt)
15328                 if !(uint32(c) < 64) {
15329                         break
15330                 }
15331                 v.reset(OpPPC64SRDconst)
15332                 v.AuxInt = int64ToAuxInt(c & 63)
15333                 v.AddArg(x)
15334                 return true
15335         }
15336         // match: (Rsh64Ux32 x y)
15337         // cond: shiftIsBounded(v)
15338         // result: (SRD x y)
15339         for {
15340                 x := v_0
15341                 y := v_1
15342                 if !(shiftIsBounded(v)) {
15343                         break
15344                 }
15345                 v.reset(OpPPC64SRD)
15346                 v.AddArg2(x, y)
15347                 return true
15348         }
15349         // match: (Rsh64Ux32 x y)
15350         // result: (SRD x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [64]))))
15351         for {
15352                 x := v_0
15353                 y := v_1
15354                 v.reset(OpPPC64SRD)
15355                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
15356                 v0.AuxInt = int32ToAuxInt(0)
15357                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15358                 v1.AuxInt = int64ToAuxInt(-1)
15359                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
15360                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15361                 v3.AuxInt = int64ToAuxInt(64)
15362                 v2.AddArg2(y, v3)
15363                 v0.AddArg3(y, v1, v2)
15364                 v.AddArg2(x, v0)
15365                 return true
15366         }
15367 }
15368 func rewriteValuePPC64_OpRsh64Ux64(v *Value) bool {
15369         v_1 := v.Args[1]
15370         v_0 := v.Args[0]
15371         b := v.Block
15372         typ := &b.Func.Config.Types
15373         // match: (Rsh64Ux64 _ (MOVDconst [c]))
15374         // cond: uint64(c) >= 64
15375         // result: (MOVDconst [0])
15376         for {
15377                 if v_1.Op != OpPPC64MOVDconst {
15378                         break
15379                 }
15380                 c := auxIntToInt64(v_1.AuxInt)
15381                 if !(uint64(c) >= 64) {
15382                         break
15383                 }
15384                 v.reset(OpPPC64MOVDconst)
15385                 v.AuxInt = int64ToAuxInt(0)
15386                 return true
15387         }
15388         // match: (Rsh64Ux64 x (MOVDconst [c]))
15389         // cond: uint64(c) < 64
15390         // result: (SRDconst x [c])
15391         for {
15392                 x := v_0
15393                 if v_1.Op != OpPPC64MOVDconst {
15394                         break
15395                 }
15396                 c := auxIntToInt64(v_1.AuxInt)
15397                 if !(uint64(c) < 64) {
15398                         break
15399                 }
15400                 v.reset(OpPPC64SRDconst)
15401                 v.AuxInt = int64ToAuxInt(c)
15402                 v.AddArg(x)
15403                 return true
15404         }
15405         // match: (Rsh64Ux64 x y)
15406         // cond: shiftIsBounded(v)
15407         // result: (SRD x y)
15408         for {
15409                 x := v_0
15410                 y := v_1
15411                 if !(shiftIsBounded(v)) {
15412                         break
15413                 }
15414                 v.reset(OpPPC64SRD)
15415                 v.AddArg2(x, y)
15416                 return true
15417         }
15418         // match: (Rsh64Ux64 x (AND y (MOVDconst [63])))
15419         // result: (SRD x (ANDconst <typ.Int64> [63] y))
15420         for {
15421                 x := v_0
15422                 if v_1.Op != OpPPC64AND {
15423                         break
15424                 }
15425                 _ = v_1.Args[1]
15426                 v_1_0 := v_1.Args[0]
15427                 v_1_1 := v_1.Args[1]
15428                 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
15429                         y := v_1_0
15430                         if v_1_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1.AuxInt) != 63 {
15431                                 continue
15432                         }
15433                         v.reset(OpPPC64SRD)
15434                         v0 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.Int64)
15435                         v0.AuxInt = int64ToAuxInt(63)
15436                         v0.AddArg(y)
15437                         v.AddArg2(x, v0)
15438                         return true
15439                 }
15440                 break
15441         }
15442         // match: (Rsh64Ux64 x (ANDconst <typ.UInt> [63] y))
15443         // result: (SRD x (ANDconst <typ.UInt> [63] y))
15444         for {
15445                 x := v_0
15446                 if v_1.Op != OpPPC64ANDconst || v_1.Type != typ.UInt || auxIntToInt64(v_1.AuxInt) != 63 {
15447                         break
15448                 }
15449                 y := v_1.Args[0]
15450                 v.reset(OpPPC64SRD)
15451                 v0 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15452                 v0.AuxInt = int64ToAuxInt(63)
15453                 v0.AddArg(y)
15454                 v.AddArg2(x, v0)
15455                 return true
15456         }
15457         // match: (Rsh64Ux64 x (SUB <typ.UInt> (MOVDconst [64]) (ANDconst <typ.UInt> [63] y)))
15458         // result: (SRD x (SUB <typ.UInt> (MOVDconst [64]) (ANDconst <typ.UInt> [63] y)))
15459         for {
15460                 x := v_0
15461                 if v_1.Op != OpPPC64SUB || v_1.Type != typ.UInt {
15462                         break
15463                 }
15464                 _ = v_1.Args[1]
15465                 v_1_0 := v_1.Args[0]
15466                 if v_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_0.AuxInt) != 64 {
15467                         break
15468                 }
15469                 v_1_1 := v_1.Args[1]
15470                 if v_1_1.Op != OpPPC64ANDconst || v_1_1.Type != typ.UInt || auxIntToInt64(v_1_1.AuxInt) != 63 {
15471                         break
15472                 }
15473                 y := v_1_1.Args[0]
15474                 v.reset(OpPPC64SRD)
15475                 v0 := b.NewValue0(v.Pos, OpPPC64SUB, typ.UInt)
15476                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15477                 v1.AuxInt = int64ToAuxInt(64)
15478                 v2 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15479                 v2.AuxInt = int64ToAuxInt(63)
15480                 v2.AddArg(y)
15481                 v0.AddArg2(v1, v2)
15482                 v.AddArg2(x, v0)
15483                 return true
15484         }
15485         // match: (Rsh64Ux64 x (SUBFCconst <typ.UInt> [64] (ANDconst <typ.UInt> [63] y)))
15486         // result: (SRD x (SUBFCconst <typ.UInt> [64] (ANDconst <typ.UInt> [63] y)))
15487         for {
15488                 x := v_0
15489                 if v_1.Op != OpPPC64SUBFCconst || v_1.Type != typ.UInt || auxIntToInt64(v_1.AuxInt) != 64 {
15490                         break
15491                 }
15492                 v_1_0 := v_1.Args[0]
15493                 if v_1_0.Op != OpPPC64ANDconst || v_1_0.Type != typ.UInt || auxIntToInt64(v_1_0.AuxInt) != 63 {
15494                         break
15495                 }
15496                 y := v_1_0.Args[0]
15497                 v.reset(OpPPC64SRD)
15498                 v0 := b.NewValue0(v.Pos, OpPPC64SUBFCconst, typ.UInt)
15499                 v0.AuxInt = int64ToAuxInt(64)
15500                 v1 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15501                 v1.AuxInt = int64ToAuxInt(63)
15502                 v1.AddArg(y)
15503                 v0.AddArg(v1)
15504                 v.AddArg2(x, v0)
15505                 return true
15506         }
15507         // match: (Rsh64Ux64 x (SUB <typ.UInt> (MOVDconst [64]) (AND <typ.UInt> y (MOVDconst [63]))))
15508         // result: (SRD x (SUB <typ.UInt> (MOVDconst [64]) (ANDconst <typ.UInt> [63] y)))
15509         for {
15510                 x := v_0
15511                 if v_1.Op != OpPPC64SUB || v_1.Type != typ.UInt {
15512                         break
15513                 }
15514                 _ = v_1.Args[1]
15515                 v_1_0 := v_1.Args[0]
15516                 if v_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_0.AuxInt) != 64 {
15517                         break
15518                 }
15519                 v_1_1 := v_1.Args[1]
15520                 if v_1_1.Op != OpPPC64AND || v_1_1.Type != typ.UInt {
15521                         break
15522                 }
15523                 _ = v_1_1.Args[1]
15524                 v_1_1_0 := v_1_1.Args[0]
15525                 v_1_1_1 := v_1_1.Args[1]
15526                 for _i0 := 0; _i0 <= 1; _i0, v_1_1_0, v_1_1_1 = _i0+1, v_1_1_1, v_1_1_0 {
15527                         y := v_1_1_0
15528                         if v_1_1_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1_1.AuxInt) != 63 {
15529                                 continue
15530                         }
15531                         v.reset(OpPPC64SRD)
15532                         v0 := b.NewValue0(v.Pos, OpPPC64SUB, typ.UInt)
15533                         v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15534                         v1.AuxInt = int64ToAuxInt(64)
15535                         v2 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15536                         v2.AuxInt = int64ToAuxInt(63)
15537                         v2.AddArg(y)
15538                         v0.AddArg2(v1, v2)
15539                         v.AddArg2(x, v0)
15540                         return true
15541                 }
15542                 break
15543         }
15544         // match: (Rsh64Ux64 x (SUBFCconst <typ.UInt> [64] (AND <typ.UInt> y (MOVDconst [63]))))
15545         // result: (SRD x (SUBFCconst <typ.UInt> [64] (ANDconst <typ.UInt> [63] y)))
15546         for {
15547                 x := v_0
15548                 if v_1.Op != OpPPC64SUBFCconst || v_1.Type != typ.UInt || auxIntToInt64(v_1.AuxInt) != 64 {
15549                         break
15550                 }
15551                 v_1_0 := v_1.Args[0]
15552                 if v_1_0.Op != OpPPC64AND || v_1_0.Type != typ.UInt {
15553                         break
15554                 }
15555                 _ = v_1_0.Args[1]
15556                 v_1_0_0 := v_1_0.Args[0]
15557                 v_1_0_1 := v_1_0.Args[1]
15558                 for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 {
15559                         y := v_1_0_0
15560                         if v_1_0_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_0_1.AuxInt) != 63 {
15561                                 continue
15562                         }
15563                         v.reset(OpPPC64SRD)
15564                         v0 := b.NewValue0(v.Pos, OpPPC64SUBFCconst, typ.UInt)
15565                         v0.AuxInt = int64ToAuxInt(64)
15566                         v1 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15567                         v1.AuxInt = int64ToAuxInt(63)
15568                         v1.AddArg(y)
15569                         v0.AddArg(v1)
15570                         v.AddArg2(x, v0)
15571                         return true
15572                 }
15573                 break
15574         }
15575         // match: (Rsh64Ux64 x y)
15576         // result: (SRD x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [64]))))
15577         for {
15578                 x := v_0
15579                 y := v_1
15580                 v.reset(OpPPC64SRD)
15581                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
15582                 v0.AuxInt = int32ToAuxInt(0)
15583                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15584                 v1.AuxInt = int64ToAuxInt(-1)
15585                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
15586                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15587                 v3.AuxInt = int64ToAuxInt(64)
15588                 v2.AddArg2(y, v3)
15589                 v0.AddArg3(y, v1, v2)
15590                 v.AddArg2(x, v0)
15591                 return true
15592         }
15593 }
15594 func rewriteValuePPC64_OpRsh64Ux8(v *Value) bool {
15595         v_1 := v.Args[1]
15596         v_0 := v.Args[0]
15597         b := v.Block
15598         typ := &b.Func.Config.Types
15599         // match: (Rsh64Ux8 x y)
15600         // cond: shiftIsBounded(v)
15601         // result: (SRD x y)
15602         for {
15603                 x := v_0
15604                 y := v_1
15605                 if !(shiftIsBounded(v)) {
15606                         break
15607                 }
15608                 v.reset(OpPPC64SRD)
15609                 v.AddArg2(x, y)
15610                 return true
15611         }
15612         // match: (Rsh64Ux8 x y)
15613         // result: (SRD x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt8to64 y) (MOVDconst [64]))))
15614         for {
15615                 x := v_0
15616                 y := v_1
15617                 v.reset(OpPPC64SRD)
15618                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
15619                 v0.AuxInt = int32ToAuxInt(0)
15620                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15621                 v1.AuxInt = int64ToAuxInt(-1)
15622                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
15623                 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
15624                 v3.AddArg(y)
15625                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15626                 v4.AuxInt = int64ToAuxInt(64)
15627                 v2.AddArg2(v3, v4)
15628                 v0.AddArg3(y, v1, v2)
15629                 v.AddArg2(x, v0)
15630                 return true
15631         }
15632 }
15633 func rewriteValuePPC64_OpRsh64x16(v *Value) bool {
15634         v_1 := v.Args[1]
15635         v_0 := v.Args[0]
15636         b := v.Block
15637         typ := &b.Func.Config.Types
15638         // match: (Rsh64x16 x y)
15639         // cond: shiftIsBounded(v)
15640         // result: (SRAD x y)
15641         for {
15642                 x := v_0
15643                 y := v_1
15644                 if !(shiftIsBounded(v)) {
15645                         break
15646                 }
15647                 v.reset(OpPPC64SRAD)
15648                 v.AddArg2(x, y)
15649                 return true
15650         }
15651         // match: (Rsh64x16 x y)
15652         // result: (SRAD x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt16to64 y) (MOVDconst [64]))))
15653         for {
15654                 x := v_0
15655                 y := v_1
15656                 v.reset(OpPPC64SRAD)
15657                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
15658                 v0.AuxInt = int32ToAuxInt(0)
15659                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15660                 v1.AuxInt = int64ToAuxInt(-1)
15661                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
15662                 v3 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
15663                 v3.AddArg(y)
15664                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15665                 v4.AuxInt = int64ToAuxInt(64)
15666                 v2.AddArg2(v3, v4)
15667                 v0.AddArg3(y, v1, v2)
15668                 v.AddArg2(x, v0)
15669                 return true
15670         }
15671 }
15672 func rewriteValuePPC64_OpRsh64x32(v *Value) bool {
15673         v_1 := v.Args[1]
15674         v_0 := v.Args[0]
15675         b := v.Block
15676         typ := &b.Func.Config.Types
15677         // match: (Rsh64x32 x (MOVDconst [c]))
15678         // cond: uint32(c) < 64
15679         // result: (SRADconst x [c&63])
15680         for {
15681                 x := v_0
15682                 if v_1.Op != OpPPC64MOVDconst {
15683                         break
15684                 }
15685                 c := auxIntToInt64(v_1.AuxInt)
15686                 if !(uint32(c) < 64) {
15687                         break
15688                 }
15689                 v.reset(OpPPC64SRADconst)
15690                 v.AuxInt = int64ToAuxInt(c & 63)
15691                 v.AddArg(x)
15692                 return true
15693         }
15694         // match: (Rsh64x32 x y)
15695         // cond: shiftIsBounded(v)
15696         // result: (SRAD x y)
15697         for {
15698                 x := v_0
15699                 y := v_1
15700                 if !(shiftIsBounded(v)) {
15701                         break
15702                 }
15703                 v.reset(OpPPC64SRAD)
15704                 v.AddArg2(x, y)
15705                 return true
15706         }
15707         // match: (Rsh64x32 x y)
15708         // result: (SRAD x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [64]))))
15709         for {
15710                 x := v_0
15711                 y := v_1
15712                 v.reset(OpPPC64SRAD)
15713                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
15714                 v0.AuxInt = int32ToAuxInt(0)
15715                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15716                 v1.AuxInt = int64ToAuxInt(-1)
15717                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
15718                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15719                 v3.AuxInt = int64ToAuxInt(64)
15720                 v2.AddArg2(y, v3)
15721                 v0.AddArg3(y, v1, v2)
15722                 v.AddArg2(x, v0)
15723                 return true
15724         }
15725 }
15726 func rewriteValuePPC64_OpRsh64x64(v *Value) bool {
15727         v_1 := v.Args[1]
15728         v_0 := v.Args[0]
15729         b := v.Block
15730         typ := &b.Func.Config.Types
15731         // match: (Rsh64x64 x (MOVDconst [c]))
15732         // cond: uint64(c) >= 64
15733         // result: (SRADconst x [63])
15734         for {
15735                 x := v_0
15736                 if v_1.Op != OpPPC64MOVDconst {
15737                         break
15738                 }
15739                 c := auxIntToInt64(v_1.AuxInt)
15740                 if !(uint64(c) >= 64) {
15741                         break
15742                 }
15743                 v.reset(OpPPC64SRADconst)
15744                 v.AuxInt = int64ToAuxInt(63)
15745                 v.AddArg(x)
15746                 return true
15747         }
15748         // match: (Rsh64x64 x (MOVDconst [c]))
15749         // cond: uint64(c) < 64
15750         // result: (SRADconst x [c])
15751         for {
15752                 x := v_0
15753                 if v_1.Op != OpPPC64MOVDconst {
15754                         break
15755                 }
15756                 c := auxIntToInt64(v_1.AuxInt)
15757                 if !(uint64(c) < 64) {
15758                         break
15759                 }
15760                 v.reset(OpPPC64SRADconst)
15761                 v.AuxInt = int64ToAuxInt(c)
15762                 v.AddArg(x)
15763                 return true
15764         }
15765         // match: (Rsh64x64 x y)
15766         // cond: shiftIsBounded(v)
15767         // result: (SRAD x y)
15768         for {
15769                 x := v_0
15770                 y := v_1
15771                 if !(shiftIsBounded(v)) {
15772                         break
15773                 }
15774                 v.reset(OpPPC64SRAD)
15775                 v.AddArg2(x, y)
15776                 return true
15777         }
15778         // match: (Rsh64x64 x (AND y (MOVDconst [63])))
15779         // result: (SRAD x (ANDconst <typ.Int64> [63] y))
15780         for {
15781                 x := v_0
15782                 if v_1.Op != OpPPC64AND {
15783                         break
15784                 }
15785                 _ = v_1.Args[1]
15786                 v_1_0 := v_1.Args[0]
15787                 v_1_1 := v_1.Args[1]
15788                 for _i0 := 0; _i0 <= 1; _i0, v_1_0, v_1_1 = _i0+1, v_1_1, v_1_0 {
15789                         y := v_1_0
15790                         if v_1_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1.AuxInt) != 63 {
15791                                 continue
15792                         }
15793                         v.reset(OpPPC64SRAD)
15794                         v0 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.Int64)
15795                         v0.AuxInt = int64ToAuxInt(63)
15796                         v0.AddArg(y)
15797                         v.AddArg2(x, v0)
15798                         return true
15799                 }
15800                 break
15801         }
15802         // match: (Rsh64x64 x (ANDconst <typ.UInt> [63] y))
15803         // result: (SRAD x (ANDconst <typ.UInt> [63] y))
15804         for {
15805                 x := v_0
15806                 if v_1.Op != OpPPC64ANDconst || v_1.Type != typ.UInt || auxIntToInt64(v_1.AuxInt) != 63 {
15807                         break
15808                 }
15809                 y := v_1.Args[0]
15810                 v.reset(OpPPC64SRAD)
15811                 v0 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15812                 v0.AuxInt = int64ToAuxInt(63)
15813                 v0.AddArg(y)
15814                 v.AddArg2(x, v0)
15815                 return true
15816         }
15817         // match: (Rsh64x64 x (SUB <typ.UInt> (MOVDconst [64]) (ANDconst <typ.UInt> [63] y)))
15818         // result: (SRAD x (SUB <typ.UInt> (MOVDconst [64]) (ANDconst <typ.UInt> [63] y)))
15819         for {
15820                 x := v_0
15821                 if v_1.Op != OpPPC64SUB || v_1.Type != typ.UInt {
15822                         break
15823                 }
15824                 _ = v_1.Args[1]
15825                 v_1_0 := v_1.Args[0]
15826                 if v_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_0.AuxInt) != 64 {
15827                         break
15828                 }
15829                 v_1_1 := v_1.Args[1]
15830                 if v_1_1.Op != OpPPC64ANDconst || v_1_1.Type != typ.UInt || auxIntToInt64(v_1_1.AuxInt) != 63 {
15831                         break
15832                 }
15833                 y := v_1_1.Args[0]
15834                 v.reset(OpPPC64SRAD)
15835                 v0 := b.NewValue0(v.Pos, OpPPC64SUB, typ.UInt)
15836                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15837                 v1.AuxInt = int64ToAuxInt(64)
15838                 v2 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15839                 v2.AuxInt = int64ToAuxInt(63)
15840                 v2.AddArg(y)
15841                 v0.AddArg2(v1, v2)
15842                 v.AddArg2(x, v0)
15843                 return true
15844         }
15845         // match: (Rsh64x64 x (SUBFCconst <typ.UInt> [64] (ANDconst <typ.UInt> [63] y)))
15846         // result: (SRAD x (SUBFCconst <typ.UInt> [64] (ANDconst <typ.UInt> [63] y)))
15847         for {
15848                 x := v_0
15849                 if v_1.Op != OpPPC64SUBFCconst || v_1.Type != typ.UInt || auxIntToInt64(v_1.AuxInt) != 64 {
15850                         break
15851                 }
15852                 v_1_0 := v_1.Args[0]
15853                 if v_1_0.Op != OpPPC64ANDconst || v_1_0.Type != typ.UInt || auxIntToInt64(v_1_0.AuxInt) != 63 {
15854                         break
15855                 }
15856                 y := v_1_0.Args[0]
15857                 v.reset(OpPPC64SRAD)
15858                 v0 := b.NewValue0(v.Pos, OpPPC64SUBFCconst, typ.UInt)
15859                 v0.AuxInt = int64ToAuxInt(64)
15860                 v1 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15861                 v1.AuxInt = int64ToAuxInt(63)
15862                 v1.AddArg(y)
15863                 v0.AddArg(v1)
15864                 v.AddArg2(x, v0)
15865                 return true
15866         }
15867         // match: (Rsh64x64 x (SUB <typ.UInt> (MOVDconst [64]) (AND <typ.UInt> y (MOVDconst [63]))))
15868         // result: (SRAD x (SUB <typ.UInt> (MOVDconst [64]) (ANDconst <typ.UInt> [63] y)))
15869         for {
15870                 x := v_0
15871                 if v_1.Op != OpPPC64SUB || v_1.Type != typ.UInt {
15872                         break
15873                 }
15874                 _ = v_1.Args[1]
15875                 v_1_0 := v_1.Args[0]
15876                 if v_1_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_0.AuxInt) != 64 {
15877                         break
15878                 }
15879                 v_1_1 := v_1.Args[1]
15880                 if v_1_1.Op != OpPPC64AND || v_1_1.Type != typ.UInt {
15881                         break
15882                 }
15883                 _ = v_1_1.Args[1]
15884                 v_1_1_0 := v_1_1.Args[0]
15885                 v_1_1_1 := v_1_1.Args[1]
15886                 for _i0 := 0; _i0 <= 1; _i0, v_1_1_0, v_1_1_1 = _i0+1, v_1_1_1, v_1_1_0 {
15887                         y := v_1_1_0
15888                         if v_1_1_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_1_1.AuxInt) != 63 {
15889                                 continue
15890                         }
15891                         v.reset(OpPPC64SRAD)
15892                         v0 := b.NewValue0(v.Pos, OpPPC64SUB, typ.UInt)
15893                         v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15894                         v1.AuxInt = int64ToAuxInt(64)
15895                         v2 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15896                         v2.AuxInt = int64ToAuxInt(63)
15897                         v2.AddArg(y)
15898                         v0.AddArg2(v1, v2)
15899                         v.AddArg2(x, v0)
15900                         return true
15901                 }
15902                 break
15903         }
15904         // match: (Rsh64x64 x (SUBFCconst <typ.UInt> [64] (AND <typ.UInt> y (MOVDconst [63]))))
15905         // result: (SRAD x (SUBFCconst <typ.UInt> [64] (ANDconst <typ.UInt> [63] y)))
15906         for {
15907                 x := v_0
15908                 if v_1.Op != OpPPC64SUBFCconst || v_1.Type != typ.UInt || auxIntToInt64(v_1.AuxInt) != 64 {
15909                         break
15910                 }
15911                 v_1_0 := v_1.Args[0]
15912                 if v_1_0.Op != OpPPC64AND || v_1_0.Type != typ.UInt {
15913                         break
15914                 }
15915                 _ = v_1_0.Args[1]
15916                 v_1_0_0 := v_1_0.Args[0]
15917                 v_1_0_1 := v_1_0.Args[1]
15918                 for _i0 := 0; _i0 <= 1; _i0, v_1_0_0, v_1_0_1 = _i0+1, v_1_0_1, v_1_0_0 {
15919                         y := v_1_0_0
15920                         if v_1_0_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1_0_1.AuxInt) != 63 {
15921                                 continue
15922                         }
15923                         v.reset(OpPPC64SRAD)
15924                         v0 := b.NewValue0(v.Pos, OpPPC64SUBFCconst, typ.UInt)
15925                         v0.AuxInt = int64ToAuxInt(64)
15926                         v1 := b.NewValue0(v.Pos, OpPPC64ANDconst, typ.UInt)
15927                         v1.AuxInt = int64ToAuxInt(63)
15928                         v1.AddArg(y)
15929                         v0.AddArg(v1)
15930                         v.AddArg2(x, v0)
15931                         return true
15932                 }
15933                 break
15934         }
15935         // match: (Rsh64x64 x y)
15936         // result: (SRAD x (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [64]))))
15937         for {
15938                 x := v_0
15939                 y := v_1
15940                 v.reset(OpPPC64SRAD)
15941                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
15942                 v0.AuxInt = int32ToAuxInt(0)
15943                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15944                 v1.AuxInt = int64ToAuxInt(-1)
15945                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
15946                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15947                 v3.AuxInt = int64ToAuxInt(64)
15948                 v2.AddArg2(y, v3)
15949                 v0.AddArg3(y, v1, v2)
15950                 v.AddArg2(x, v0)
15951                 return true
15952         }
15953 }
15954 func rewriteValuePPC64_OpRsh64x8(v *Value) bool {
15955         v_1 := v.Args[1]
15956         v_0 := v.Args[0]
15957         b := v.Block
15958         typ := &b.Func.Config.Types
15959         // match: (Rsh64x8 x y)
15960         // cond: shiftIsBounded(v)
15961         // result: (SRAD x y)
15962         for {
15963                 x := v_0
15964                 y := v_1
15965                 if !(shiftIsBounded(v)) {
15966                         break
15967                 }
15968                 v.reset(OpPPC64SRAD)
15969                 v.AddArg2(x, y)
15970                 return true
15971         }
15972         // match: (Rsh64x8 x y)
15973         // result: (SRAD x (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt8to64 y) (MOVDconst [64]))))
15974         for {
15975                 x := v_0
15976                 y := v_1
15977                 v.reset(OpPPC64SRAD)
15978                 v0 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
15979                 v0.AuxInt = int32ToAuxInt(0)
15980                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15981                 v1.AuxInt = int64ToAuxInt(-1)
15982                 v2 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
15983                 v3 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
15984                 v3.AddArg(y)
15985                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
15986                 v4.AuxInt = int64ToAuxInt(64)
15987                 v2.AddArg2(v3, v4)
15988                 v0.AddArg3(y, v1, v2)
15989                 v.AddArg2(x, v0)
15990                 return true
15991         }
15992 }
15993 func rewriteValuePPC64_OpRsh8Ux16(v *Value) bool {
15994         v_1 := v.Args[1]
15995         v_0 := v.Args[0]
15996         b := v.Block
15997         typ := &b.Func.Config.Types
15998         // match: (Rsh8Ux16 x y)
15999         // cond: shiftIsBounded(v)
16000         // result: (SRW (MOVBZreg x) y)
16001         for {
16002                 x := v_0
16003                 y := v_1
16004                 if !(shiftIsBounded(v)) {
16005                         break
16006                 }
16007                 v.reset(OpPPC64SRW)
16008                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
16009                 v0.AddArg(x)
16010                 v.AddArg2(v0, y)
16011                 return true
16012         }
16013         // match: (Rsh8Ux16 x y)
16014         // result: (SRW (ZeroExt8to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt16to64 y) (MOVDconst [8]))))
16015         for {
16016                 x := v_0
16017                 y := v_1
16018                 v.reset(OpPPC64SRW)
16019                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
16020                 v0.AddArg(x)
16021                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
16022                 v1.AuxInt = int32ToAuxInt(0)
16023                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16024                 v2.AuxInt = int64ToAuxInt(-1)
16025                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
16026                 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
16027                 v4.AddArg(y)
16028                 v5 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16029                 v5.AuxInt = int64ToAuxInt(8)
16030                 v3.AddArg2(v4, v5)
16031                 v1.AddArg3(y, v2, v3)
16032                 v.AddArg2(v0, v1)
16033                 return true
16034         }
16035 }
16036 func rewriteValuePPC64_OpRsh8Ux32(v *Value) bool {
16037         v_1 := v.Args[1]
16038         v_0 := v.Args[0]
16039         b := v.Block
16040         typ := &b.Func.Config.Types
16041         // match: (Rsh8Ux32 x (MOVDconst [c]))
16042         // cond: uint32(c) < 8
16043         // result: (SRWconst (ZeroExt8to32 x) [c&7])
16044         for {
16045                 x := v_0
16046                 if v_1.Op != OpPPC64MOVDconst {
16047                         break
16048                 }
16049                 c := auxIntToInt64(v_1.AuxInt)
16050                 if !(uint32(c) < 8) {
16051                         break
16052                 }
16053                 v.reset(OpPPC64SRWconst)
16054                 v.AuxInt = int64ToAuxInt(c & 7)
16055                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
16056                 v0.AddArg(x)
16057                 v.AddArg(v0)
16058                 return true
16059         }
16060         // match: (Rsh8Ux32 x y)
16061         // cond: shiftIsBounded(v)
16062         // result: (SRW (MOVBZreg x) y)
16063         for {
16064                 x := v_0
16065                 y := v_1
16066                 if !(shiftIsBounded(v)) {
16067                         break
16068                 }
16069                 v.reset(OpPPC64SRW)
16070                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
16071                 v0.AddArg(x)
16072                 v.AddArg2(v0, y)
16073                 return true
16074         }
16075         // match: (Rsh8Ux32 x y)
16076         // result: (SRW (ZeroExt8to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [8]))))
16077         for {
16078                 x := v_0
16079                 y := v_1
16080                 v.reset(OpPPC64SRW)
16081                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
16082                 v0.AddArg(x)
16083                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
16084                 v1.AuxInt = int32ToAuxInt(0)
16085                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16086                 v2.AuxInt = int64ToAuxInt(-1)
16087                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
16088                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16089                 v4.AuxInt = int64ToAuxInt(8)
16090                 v3.AddArg2(y, v4)
16091                 v1.AddArg3(y, v2, v3)
16092                 v.AddArg2(v0, v1)
16093                 return true
16094         }
16095 }
16096 func rewriteValuePPC64_OpRsh8Ux64(v *Value) bool {
16097         v_1 := v.Args[1]
16098         v_0 := v.Args[0]
16099         b := v.Block
16100         typ := &b.Func.Config.Types
16101         // match: (Rsh8Ux64 _ (MOVDconst [c]))
16102         // cond: uint64(c) >= 8
16103         // result: (MOVDconst [0])
16104         for {
16105                 if v_1.Op != OpPPC64MOVDconst {
16106                         break
16107                 }
16108                 c := auxIntToInt64(v_1.AuxInt)
16109                 if !(uint64(c) >= 8) {
16110                         break
16111                 }
16112                 v.reset(OpPPC64MOVDconst)
16113                 v.AuxInt = int64ToAuxInt(0)
16114                 return true
16115         }
16116         // match: (Rsh8Ux64 x (MOVDconst [c]))
16117         // cond: uint64(c) < 8
16118         // result: (SRWconst (ZeroExt8to32 x) [c])
16119         for {
16120                 x := v_0
16121                 if v_1.Op != OpPPC64MOVDconst {
16122                         break
16123                 }
16124                 c := auxIntToInt64(v_1.AuxInt)
16125                 if !(uint64(c) < 8) {
16126                         break
16127                 }
16128                 v.reset(OpPPC64SRWconst)
16129                 v.AuxInt = int64ToAuxInt(c)
16130                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
16131                 v0.AddArg(x)
16132                 v.AddArg(v0)
16133                 return true
16134         }
16135         // match: (Rsh8Ux64 x y)
16136         // cond: shiftIsBounded(v)
16137         // result: (SRW (MOVBZreg x) y)
16138         for {
16139                 x := v_0
16140                 y := v_1
16141                 if !(shiftIsBounded(v)) {
16142                         break
16143                 }
16144                 v.reset(OpPPC64SRW)
16145                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
16146                 v0.AddArg(x)
16147                 v.AddArg2(v0, y)
16148                 return true
16149         }
16150         // match: (Rsh8Ux64 x y)
16151         // result: (SRW (ZeroExt8to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [8]))))
16152         for {
16153                 x := v_0
16154                 y := v_1
16155                 v.reset(OpPPC64SRW)
16156                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
16157                 v0.AddArg(x)
16158                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
16159                 v1.AuxInt = int32ToAuxInt(0)
16160                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16161                 v2.AuxInt = int64ToAuxInt(-1)
16162                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
16163                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16164                 v4.AuxInt = int64ToAuxInt(8)
16165                 v3.AddArg2(y, v4)
16166                 v1.AddArg3(y, v2, v3)
16167                 v.AddArg2(v0, v1)
16168                 return true
16169         }
16170 }
16171 func rewriteValuePPC64_OpRsh8Ux8(v *Value) bool {
16172         v_1 := v.Args[1]
16173         v_0 := v.Args[0]
16174         b := v.Block
16175         typ := &b.Func.Config.Types
16176         // match: (Rsh8Ux8 x y)
16177         // cond: shiftIsBounded(v)
16178         // result: (SRW (MOVBZreg x) y)
16179         for {
16180                 x := v_0
16181                 y := v_1
16182                 if !(shiftIsBounded(v)) {
16183                         break
16184                 }
16185                 v.reset(OpPPC64SRW)
16186                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
16187                 v0.AddArg(x)
16188                 v.AddArg2(v0, y)
16189                 return true
16190         }
16191         // match: (Rsh8Ux8 x y)
16192         // result: (SRW (ZeroExt8to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt8to64 y) (MOVDconst [8]))))
16193         for {
16194                 x := v_0
16195                 y := v_1
16196                 v.reset(OpPPC64SRW)
16197                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
16198                 v0.AddArg(x)
16199                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
16200                 v1.AuxInt = int32ToAuxInt(0)
16201                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16202                 v2.AuxInt = int64ToAuxInt(-1)
16203                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
16204                 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
16205                 v4.AddArg(y)
16206                 v5 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16207                 v5.AuxInt = int64ToAuxInt(8)
16208                 v3.AddArg2(v4, v5)
16209                 v1.AddArg3(y, v2, v3)
16210                 v.AddArg2(v0, v1)
16211                 return true
16212         }
16213 }
16214 func rewriteValuePPC64_OpRsh8x16(v *Value) bool {
16215         v_1 := v.Args[1]
16216         v_0 := v.Args[0]
16217         b := v.Block
16218         typ := &b.Func.Config.Types
16219         // match: (Rsh8x16 x y)
16220         // cond: shiftIsBounded(v)
16221         // result: (SRAW (MOVBreg x) y)
16222         for {
16223                 x := v_0
16224                 y := v_1
16225                 if !(shiftIsBounded(v)) {
16226                         break
16227                 }
16228                 v.reset(OpPPC64SRAW)
16229                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
16230                 v0.AddArg(x)
16231                 v.AddArg2(v0, y)
16232                 return true
16233         }
16234         // match: (Rsh8x16 x y)
16235         // result: (SRAW (SignExt8to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt16to64 y) (MOVDconst [8]))))
16236         for {
16237                 x := v_0
16238                 y := v_1
16239                 v.reset(OpPPC64SRAW)
16240                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
16241                 v0.AddArg(x)
16242                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
16243                 v1.AuxInt = int32ToAuxInt(0)
16244                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16245                 v2.AuxInt = int64ToAuxInt(-1)
16246                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
16247                 v4 := b.NewValue0(v.Pos, OpZeroExt16to64, typ.UInt64)
16248                 v4.AddArg(y)
16249                 v5 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16250                 v5.AuxInt = int64ToAuxInt(8)
16251                 v3.AddArg2(v4, v5)
16252                 v1.AddArg3(y, v2, v3)
16253                 v.AddArg2(v0, v1)
16254                 return true
16255         }
16256 }
16257 func rewriteValuePPC64_OpRsh8x32(v *Value) bool {
16258         v_1 := v.Args[1]
16259         v_0 := v.Args[0]
16260         b := v.Block
16261         typ := &b.Func.Config.Types
16262         // match: (Rsh8x32 x (MOVDconst [c]))
16263         // cond: uint32(c) < 8
16264         // result: (SRAWconst (SignExt8to32 x) [c&7])
16265         for {
16266                 x := v_0
16267                 if v_1.Op != OpPPC64MOVDconst {
16268                         break
16269                 }
16270                 c := auxIntToInt64(v_1.AuxInt)
16271                 if !(uint32(c) < 8) {
16272                         break
16273                 }
16274                 v.reset(OpPPC64SRAWconst)
16275                 v.AuxInt = int64ToAuxInt(c & 7)
16276                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
16277                 v0.AddArg(x)
16278                 v.AddArg(v0)
16279                 return true
16280         }
16281         // match: (Rsh8x32 x y)
16282         // cond: shiftIsBounded(v)
16283         // result: (SRAW (MOVBreg x) y)
16284         for {
16285                 x := v_0
16286                 y := v_1
16287                 if !(shiftIsBounded(v)) {
16288                         break
16289                 }
16290                 v.reset(OpPPC64SRAW)
16291                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
16292                 v0.AddArg(x)
16293                 v.AddArg2(v0, y)
16294                 return true
16295         }
16296         // match: (Rsh8x32 x y)
16297         // result: (SRAW (SignExt8to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [8]))))
16298         for {
16299                 x := v_0
16300                 y := v_1
16301                 v.reset(OpPPC64SRAW)
16302                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
16303                 v0.AddArg(x)
16304                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
16305                 v1.AuxInt = int32ToAuxInt(0)
16306                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16307                 v2.AuxInt = int64ToAuxInt(-1)
16308                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
16309                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16310                 v4.AuxInt = int64ToAuxInt(8)
16311                 v3.AddArg2(y, v4)
16312                 v1.AddArg3(y, v2, v3)
16313                 v.AddArg2(v0, v1)
16314                 return true
16315         }
16316 }
16317 func rewriteValuePPC64_OpRsh8x64(v *Value) bool {
16318         v_1 := v.Args[1]
16319         v_0 := v.Args[0]
16320         b := v.Block
16321         typ := &b.Func.Config.Types
16322         // match: (Rsh8x64 x (MOVDconst [c]))
16323         // cond: uint64(c) >= 8
16324         // result: (SRAWconst (SignExt8to32 x) [63])
16325         for {
16326                 x := v_0
16327                 if v_1.Op != OpPPC64MOVDconst {
16328                         break
16329                 }
16330                 c := auxIntToInt64(v_1.AuxInt)
16331                 if !(uint64(c) >= 8) {
16332                         break
16333                 }
16334                 v.reset(OpPPC64SRAWconst)
16335                 v.AuxInt = int64ToAuxInt(63)
16336                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
16337                 v0.AddArg(x)
16338                 v.AddArg(v0)
16339                 return true
16340         }
16341         // match: (Rsh8x64 x (MOVDconst [c]))
16342         // cond: uint64(c) < 8
16343         // result: (SRAWconst (SignExt8to32 x) [c])
16344         for {
16345                 x := v_0
16346                 if v_1.Op != OpPPC64MOVDconst {
16347                         break
16348                 }
16349                 c := auxIntToInt64(v_1.AuxInt)
16350                 if !(uint64(c) < 8) {
16351                         break
16352                 }
16353                 v.reset(OpPPC64SRAWconst)
16354                 v.AuxInt = int64ToAuxInt(c)
16355                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
16356                 v0.AddArg(x)
16357                 v.AddArg(v0)
16358                 return true
16359         }
16360         // match: (Rsh8x64 x y)
16361         // cond: shiftIsBounded(v)
16362         // result: (SRAW (MOVBreg x) y)
16363         for {
16364                 x := v_0
16365                 y := v_1
16366                 if !(shiftIsBounded(v)) {
16367                         break
16368                 }
16369                 v.reset(OpPPC64SRAW)
16370                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
16371                 v0.AddArg(x)
16372                 v.AddArg2(v0, y)
16373                 return true
16374         }
16375         // match: (Rsh8x64 x y)
16376         // result: (SRAW (SignExt8to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU y (MOVDconst [8]))))
16377         for {
16378                 x := v_0
16379                 y := v_1
16380                 v.reset(OpPPC64SRAW)
16381                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
16382                 v0.AddArg(x)
16383                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
16384                 v1.AuxInt = int32ToAuxInt(0)
16385                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16386                 v2.AuxInt = int64ToAuxInt(-1)
16387                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
16388                 v4 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16389                 v4.AuxInt = int64ToAuxInt(8)
16390                 v3.AddArg2(y, v4)
16391                 v1.AddArg3(y, v2, v3)
16392                 v.AddArg2(v0, v1)
16393                 return true
16394         }
16395 }
16396 func rewriteValuePPC64_OpRsh8x8(v *Value) bool {
16397         v_1 := v.Args[1]
16398         v_0 := v.Args[0]
16399         b := v.Block
16400         typ := &b.Func.Config.Types
16401         // match: (Rsh8x8 x y)
16402         // cond: shiftIsBounded(v)
16403         // result: (SRAW (MOVBreg x) y)
16404         for {
16405                 x := v_0
16406                 y := v_1
16407                 if !(shiftIsBounded(v)) {
16408                         break
16409                 }
16410                 v.reset(OpPPC64SRAW)
16411                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
16412                 v0.AddArg(x)
16413                 v.AddArg2(v0, y)
16414                 return true
16415         }
16416         // match: (Rsh8x8 x y)
16417         // result: (SRAW (SignExt8to32 x) (ISEL [0] y (MOVDconst [-1]) (CMPU (ZeroExt8to64 y) (MOVDconst [8]))))
16418         for {
16419                 x := v_0
16420                 y := v_1
16421                 v.reset(OpPPC64SRAW)
16422                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
16423                 v0.AddArg(x)
16424                 v1 := b.NewValue0(v.Pos, OpPPC64ISEL, typ.Int32)
16425                 v1.AuxInt = int32ToAuxInt(0)
16426                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16427                 v2.AuxInt = int64ToAuxInt(-1)
16428                 v3 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
16429                 v4 := b.NewValue0(v.Pos, OpZeroExt8to64, typ.UInt64)
16430                 v4.AddArg(y)
16431                 v5 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
16432                 v5.AuxInt = int64ToAuxInt(8)
16433                 v3.AddArg2(v4, v5)
16434                 v1.AddArg3(y, v2, v3)
16435                 v.AddArg2(v0, v1)
16436                 return true
16437         }
16438 }
16439 func rewriteValuePPC64_OpSlicemask(v *Value) bool {
16440         v_0 := v.Args[0]
16441         b := v.Block
16442         // match: (Slicemask <t> x)
16443         // result: (SRADconst (NEG <t> x) [63])
16444         for {
16445                 t := v.Type
16446                 x := v_0
16447                 v.reset(OpPPC64SRADconst)
16448                 v.AuxInt = int64ToAuxInt(63)
16449                 v0 := b.NewValue0(v.Pos, OpPPC64NEG, t)
16450                 v0.AddArg(x)
16451                 v.AddArg(v0)
16452                 return true
16453         }
16454 }
16455 func rewriteValuePPC64_OpStore(v *Value) bool {
16456         v_2 := v.Args[2]
16457         v_1 := v.Args[1]
16458         v_0 := v.Args[0]
16459         // match: (Store {t} ptr val mem)
16460         // cond: t.Size() == 8 && is64BitFloat(val.Type)
16461         // result: (FMOVDstore ptr val mem)
16462         for {
16463                 t := auxToType(v.Aux)
16464                 ptr := v_0
16465                 val := v_1
16466                 mem := v_2
16467                 if !(t.Size() == 8 && is64BitFloat(val.Type)) {
16468                         break
16469                 }
16470                 v.reset(OpPPC64FMOVDstore)
16471                 v.AddArg3(ptr, val, mem)
16472                 return true
16473         }
16474         // match: (Store {t} ptr val mem)
16475         // cond: t.Size() == 8 && is32BitFloat(val.Type)
16476         // result: (FMOVDstore ptr val mem)
16477         for {
16478                 t := auxToType(v.Aux)
16479                 ptr := v_0
16480                 val := v_1
16481                 mem := v_2
16482                 if !(t.Size() == 8 && is32BitFloat(val.Type)) {
16483                         break
16484                 }
16485                 v.reset(OpPPC64FMOVDstore)
16486                 v.AddArg3(ptr, val, mem)
16487                 return true
16488         }
16489         // match: (Store {t} ptr val mem)
16490         // cond: t.Size() == 4 && is32BitFloat(val.Type)
16491         // result: (FMOVSstore ptr val mem)
16492         for {
16493                 t := auxToType(v.Aux)
16494                 ptr := v_0
16495                 val := v_1
16496                 mem := v_2
16497                 if !(t.Size() == 4 && is32BitFloat(val.Type)) {
16498                         break
16499                 }
16500                 v.reset(OpPPC64FMOVSstore)
16501                 v.AddArg3(ptr, val, mem)
16502                 return true
16503         }
16504         // match: (Store {t} ptr val mem)
16505         // cond: t.Size() == 8 && (is64BitInt(val.Type) || isPtr(val.Type))
16506         // result: (MOVDstore ptr val mem)
16507         for {
16508                 t := auxToType(v.Aux)
16509                 ptr := v_0
16510                 val := v_1
16511                 mem := v_2
16512                 if !(t.Size() == 8 && (is64BitInt(val.Type) || isPtr(val.Type))) {
16513                         break
16514                 }
16515                 v.reset(OpPPC64MOVDstore)
16516                 v.AddArg3(ptr, val, mem)
16517                 return true
16518         }
16519         // match: (Store {t} ptr val mem)
16520         // cond: t.Size() == 4 && is32BitInt(val.Type)
16521         // result: (MOVWstore ptr val mem)
16522         for {
16523                 t := auxToType(v.Aux)
16524                 ptr := v_0
16525                 val := v_1
16526                 mem := v_2
16527                 if !(t.Size() == 4 && is32BitInt(val.Type)) {
16528                         break
16529                 }
16530                 v.reset(OpPPC64MOVWstore)
16531                 v.AddArg3(ptr, val, mem)
16532                 return true
16533         }
16534         // match: (Store {t} ptr val mem)
16535         // cond: t.Size() == 2
16536         // result: (MOVHstore ptr val mem)
16537         for {
16538                 t := auxToType(v.Aux)
16539                 ptr := v_0
16540                 val := v_1
16541                 mem := v_2
16542                 if !(t.Size() == 2) {
16543                         break
16544                 }
16545                 v.reset(OpPPC64MOVHstore)
16546                 v.AddArg3(ptr, val, mem)
16547                 return true
16548         }
16549         // match: (Store {t} ptr val mem)
16550         // cond: t.Size() == 1
16551         // result: (MOVBstore ptr val mem)
16552         for {
16553                 t := auxToType(v.Aux)
16554                 ptr := v_0
16555                 val := v_1
16556                 mem := v_2
16557                 if !(t.Size() == 1) {
16558                         break
16559                 }
16560                 v.reset(OpPPC64MOVBstore)
16561                 v.AddArg3(ptr, val, mem)
16562                 return true
16563         }
16564         return false
16565 }
16566 func rewriteValuePPC64_OpTrunc16to8(v *Value) bool {
16567         v_0 := v.Args[0]
16568         // match: (Trunc16to8 <t> x)
16569         // cond: isSigned(t)
16570         // result: (MOVBreg x)
16571         for {
16572                 t := v.Type
16573                 x := v_0
16574                 if !(isSigned(t)) {
16575                         break
16576                 }
16577                 v.reset(OpPPC64MOVBreg)
16578                 v.AddArg(x)
16579                 return true
16580         }
16581         // match: (Trunc16to8 x)
16582         // result: (MOVBZreg x)
16583         for {
16584                 x := v_0
16585                 v.reset(OpPPC64MOVBZreg)
16586                 v.AddArg(x)
16587                 return true
16588         }
16589 }
16590 func rewriteValuePPC64_OpTrunc32to16(v *Value) bool {
16591         v_0 := v.Args[0]
16592         // match: (Trunc32to16 <t> x)
16593         // cond: isSigned(t)
16594         // result: (MOVHreg x)
16595         for {
16596                 t := v.Type
16597                 x := v_0
16598                 if !(isSigned(t)) {
16599                         break
16600                 }
16601                 v.reset(OpPPC64MOVHreg)
16602                 v.AddArg(x)
16603                 return true
16604         }
16605         // match: (Trunc32to16 x)
16606         // result: (MOVHZreg x)
16607         for {
16608                 x := v_0
16609                 v.reset(OpPPC64MOVHZreg)
16610                 v.AddArg(x)
16611                 return true
16612         }
16613 }
16614 func rewriteValuePPC64_OpTrunc32to8(v *Value) bool {
16615         v_0 := v.Args[0]
16616         // match: (Trunc32to8 <t> x)
16617         // cond: isSigned(t)
16618         // result: (MOVBreg x)
16619         for {
16620                 t := v.Type
16621                 x := v_0
16622                 if !(isSigned(t)) {
16623                         break
16624                 }
16625                 v.reset(OpPPC64MOVBreg)
16626                 v.AddArg(x)
16627                 return true
16628         }
16629         // match: (Trunc32to8 x)
16630         // result: (MOVBZreg x)
16631         for {
16632                 x := v_0
16633                 v.reset(OpPPC64MOVBZreg)
16634                 v.AddArg(x)
16635                 return true
16636         }
16637 }
16638 func rewriteValuePPC64_OpTrunc64to16(v *Value) bool {
16639         v_0 := v.Args[0]
16640         // match: (Trunc64to16 <t> x)
16641         // cond: isSigned(t)
16642         // result: (MOVHreg x)
16643         for {
16644                 t := v.Type
16645                 x := v_0
16646                 if !(isSigned(t)) {
16647                         break
16648                 }
16649                 v.reset(OpPPC64MOVHreg)
16650                 v.AddArg(x)
16651                 return true
16652         }
16653         // match: (Trunc64to16 x)
16654         // result: (MOVHZreg x)
16655         for {
16656                 x := v_0
16657                 v.reset(OpPPC64MOVHZreg)
16658                 v.AddArg(x)
16659                 return true
16660         }
16661 }
16662 func rewriteValuePPC64_OpTrunc64to32(v *Value) bool {
16663         v_0 := v.Args[0]
16664         // match: (Trunc64to32 <t> x)
16665         // cond: isSigned(t)
16666         // result: (MOVWreg x)
16667         for {
16668                 t := v.Type
16669                 x := v_0
16670                 if !(isSigned(t)) {
16671                         break
16672                 }
16673                 v.reset(OpPPC64MOVWreg)
16674                 v.AddArg(x)
16675                 return true
16676         }
16677         // match: (Trunc64to32 x)
16678         // result: (MOVWZreg x)
16679         for {
16680                 x := v_0
16681                 v.reset(OpPPC64MOVWZreg)
16682                 v.AddArg(x)
16683                 return true
16684         }
16685 }
16686 func rewriteValuePPC64_OpTrunc64to8(v *Value) bool {
16687         v_0 := v.Args[0]
16688         // match: (Trunc64to8 <t> x)
16689         // cond: isSigned(t)
16690         // result: (MOVBreg x)
16691         for {
16692                 t := v.Type
16693                 x := v_0
16694                 if !(isSigned(t)) {
16695                         break
16696                 }
16697                 v.reset(OpPPC64MOVBreg)
16698                 v.AddArg(x)
16699                 return true
16700         }
16701         // match: (Trunc64to8 x)
16702         // result: (MOVBZreg x)
16703         for {
16704                 x := v_0
16705                 v.reset(OpPPC64MOVBZreg)
16706                 v.AddArg(x)
16707                 return true
16708         }
16709 }
16710 func rewriteValuePPC64_OpZero(v *Value) bool {
16711         v_1 := v.Args[1]
16712         v_0 := v.Args[0]
16713         b := v.Block
16714         // match: (Zero [0] _ mem)
16715         // result: mem
16716         for {
16717                 if auxIntToInt64(v.AuxInt) != 0 {
16718                         break
16719                 }
16720                 mem := v_1
16721                 v.copyOf(mem)
16722                 return true
16723         }
16724         // match: (Zero [1] destptr mem)
16725         // result: (MOVBstorezero destptr mem)
16726         for {
16727                 if auxIntToInt64(v.AuxInt) != 1 {
16728                         break
16729                 }
16730                 destptr := v_0
16731                 mem := v_1
16732                 v.reset(OpPPC64MOVBstorezero)
16733                 v.AddArg2(destptr, mem)
16734                 return true
16735         }
16736         // match: (Zero [2] destptr mem)
16737         // result: (MOVHstorezero destptr mem)
16738         for {
16739                 if auxIntToInt64(v.AuxInt) != 2 {
16740                         break
16741                 }
16742                 destptr := v_0
16743                 mem := v_1
16744                 v.reset(OpPPC64MOVHstorezero)
16745                 v.AddArg2(destptr, mem)
16746                 return true
16747         }
16748         // match: (Zero [3] destptr mem)
16749         // result: (MOVBstorezero [2] destptr (MOVHstorezero destptr mem))
16750         for {
16751                 if auxIntToInt64(v.AuxInt) != 3 {
16752                         break
16753                 }
16754                 destptr := v_0
16755                 mem := v_1
16756                 v.reset(OpPPC64MOVBstorezero)
16757                 v.AuxInt = int32ToAuxInt(2)
16758                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHstorezero, types.TypeMem)
16759                 v0.AddArg2(destptr, mem)
16760                 v.AddArg2(destptr, v0)
16761                 return true
16762         }
16763         // match: (Zero [4] destptr mem)
16764         // result: (MOVWstorezero destptr mem)
16765         for {
16766                 if auxIntToInt64(v.AuxInt) != 4 {
16767                         break
16768                 }
16769                 destptr := v_0
16770                 mem := v_1
16771                 v.reset(OpPPC64MOVWstorezero)
16772                 v.AddArg2(destptr, mem)
16773                 return true
16774         }
16775         // match: (Zero [5] destptr mem)
16776         // result: (MOVBstorezero [4] destptr (MOVWstorezero destptr mem))
16777         for {
16778                 if auxIntToInt64(v.AuxInt) != 5 {
16779                         break
16780                 }
16781                 destptr := v_0
16782                 mem := v_1
16783                 v.reset(OpPPC64MOVBstorezero)
16784                 v.AuxInt = int32ToAuxInt(4)
16785                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem)
16786                 v0.AddArg2(destptr, mem)
16787                 v.AddArg2(destptr, v0)
16788                 return true
16789         }
16790         // match: (Zero [6] destptr mem)
16791         // result: (MOVHstorezero [4] destptr (MOVWstorezero destptr mem))
16792         for {
16793                 if auxIntToInt64(v.AuxInt) != 6 {
16794                         break
16795                 }
16796                 destptr := v_0
16797                 mem := v_1
16798                 v.reset(OpPPC64MOVHstorezero)
16799                 v.AuxInt = int32ToAuxInt(4)
16800                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem)
16801                 v0.AddArg2(destptr, mem)
16802                 v.AddArg2(destptr, v0)
16803                 return true
16804         }
16805         // match: (Zero [7] destptr mem)
16806         // result: (MOVBstorezero [6] destptr (MOVHstorezero [4] destptr (MOVWstorezero destptr mem)))
16807         for {
16808                 if auxIntToInt64(v.AuxInt) != 7 {
16809                         break
16810                 }
16811                 destptr := v_0
16812                 mem := v_1
16813                 v.reset(OpPPC64MOVBstorezero)
16814                 v.AuxInt = int32ToAuxInt(6)
16815                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHstorezero, types.TypeMem)
16816                 v0.AuxInt = int32ToAuxInt(4)
16817                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem)
16818                 v1.AddArg2(destptr, mem)
16819                 v0.AddArg2(destptr, v1)
16820                 v.AddArg2(destptr, v0)
16821                 return true
16822         }
16823         // match: (Zero [8] {t} destptr mem)
16824         // result: (MOVDstorezero destptr mem)
16825         for {
16826                 if auxIntToInt64(v.AuxInt) != 8 {
16827                         break
16828                 }
16829                 destptr := v_0
16830                 mem := v_1
16831                 v.reset(OpPPC64MOVDstorezero)
16832                 v.AddArg2(destptr, mem)
16833                 return true
16834         }
16835         // match: (Zero [12] {t} destptr mem)
16836         // result: (MOVWstorezero [8] destptr (MOVDstorezero [0] destptr mem))
16837         for {
16838                 if auxIntToInt64(v.AuxInt) != 12 {
16839                         break
16840                 }
16841                 destptr := v_0
16842                 mem := v_1
16843                 v.reset(OpPPC64MOVWstorezero)
16844                 v.AuxInt = int32ToAuxInt(8)
16845                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
16846                 v0.AuxInt = int32ToAuxInt(0)
16847                 v0.AddArg2(destptr, mem)
16848                 v.AddArg2(destptr, v0)
16849                 return true
16850         }
16851         // match: (Zero [16] {t} destptr mem)
16852         // result: (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem))
16853         for {
16854                 if auxIntToInt64(v.AuxInt) != 16 {
16855                         break
16856                 }
16857                 destptr := v_0
16858                 mem := v_1
16859                 v.reset(OpPPC64MOVDstorezero)
16860                 v.AuxInt = int32ToAuxInt(8)
16861                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
16862                 v0.AuxInt = int32ToAuxInt(0)
16863                 v0.AddArg2(destptr, mem)
16864                 v.AddArg2(destptr, v0)
16865                 return true
16866         }
16867         // match: (Zero [24] {t} destptr mem)
16868         // result: (MOVDstorezero [16] destptr (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem)))
16869         for {
16870                 if auxIntToInt64(v.AuxInt) != 24 {
16871                         break
16872                 }
16873                 destptr := v_0
16874                 mem := v_1
16875                 v.reset(OpPPC64MOVDstorezero)
16876                 v.AuxInt = int32ToAuxInt(16)
16877                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
16878                 v0.AuxInt = int32ToAuxInt(8)
16879                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
16880                 v1.AuxInt = int32ToAuxInt(0)
16881                 v1.AddArg2(destptr, mem)
16882                 v0.AddArg2(destptr, v1)
16883                 v.AddArg2(destptr, v0)
16884                 return true
16885         }
16886         // match: (Zero [32] {t} destptr mem)
16887         // result: (MOVDstorezero [24] destptr (MOVDstorezero [16] destptr (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem))))
16888         for {
16889                 if auxIntToInt64(v.AuxInt) != 32 {
16890                         break
16891                 }
16892                 destptr := v_0
16893                 mem := v_1
16894                 v.reset(OpPPC64MOVDstorezero)
16895                 v.AuxInt = int32ToAuxInt(24)
16896                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
16897                 v0.AuxInt = int32ToAuxInt(16)
16898                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
16899                 v1.AuxInt = int32ToAuxInt(8)
16900                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
16901                 v2.AuxInt = int32ToAuxInt(0)
16902                 v2.AddArg2(destptr, mem)
16903                 v1.AddArg2(destptr, v2)
16904                 v0.AddArg2(destptr, v1)
16905                 v.AddArg2(destptr, v0)
16906                 return true
16907         }
16908         // match: (Zero [s] ptr mem)
16909         // cond: objabi.GOPPC64 <= 8 && s < 64
16910         // result: (LoweredZeroShort [s] ptr mem)
16911         for {
16912                 s := auxIntToInt64(v.AuxInt)
16913                 ptr := v_0
16914                 mem := v_1
16915                 if !(objabi.GOPPC64 <= 8 && s < 64) {
16916                         break
16917                 }
16918                 v.reset(OpPPC64LoweredZeroShort)
16919                 v.AuxInt = int64ToAuxInt(s)
16920                 v.AddArg2(ptr, mem)
16921                 return true
16922         }
16923         // match: (Zero [s] ptr mem)
16924         // cond: objabi.GOPPC64 <= 8
16925         // result: (LoweredZero [s] ptr mem)
16926         for {
16927                 s := auxIntToInt64(v.AuxInt)
16928                 ptr := v_0
16929                 mem := v_1
16930                 if !(objabi.GOPPC64 <= 8) {
16931                         break
16932                 }
16933                 v.reset(OpPPC64LoweredZero)
16934                 v.AuxInt = int64ToAuxInt(s)
16935                 v.AddArg2(ptr, mem)
16936                 return true
16937         }
16938         // match: (Zero [s] ptr mem)
16939         // cond: s < 128 && objabi.GOPPC64 >= 9
16940         // result: (LoweredQuadZeroShort [s] ptr mem)
16941         for {
16942                 s := auxIntToInt64(v.AuxInt)
16943                 ptr := v_0
16944                 mem := v_1
16945                 if !(s < 128 && objabi.GOPPC64 >= 9) {
16946                         break
16947                 }
16948                 v.reset(OpPPC64LoweredQuadZeroShort)
16949                 v.AuxInt = int64ToAuxInt(s)
16950                 v.AddArg2(ptr, mem)
16951                 return true
16952         }
16953         // match: (Zero [s] ptr mem)
16954         // cond: objabi.GOPPC64 >= 9
16955         // result: (LoweredQuadZero [s] ptr mem)
16956         for {
16957                 s := auxIntToInt64(v.AuxInt)
16958                 ptr := v_0
16959                 mem := v_1
16960                 if !(objabi.GOPPC64 >= 9) {
16961                         break
16962                 }
16963                 v.reset(OpPPC64LoweredQuadZero)
16964                 v.AuxInt = int64ToAuxInt(s)
16965                 v.AddArg2(ptr, mem)
16966                 return true
16967         }
16968         return false
16969 }
16970 func rewriteBlockPPC64(b *Block) bool {
16971         switch b.Kind {
16972         case BlockPPC64EQ:
16973                 // match: (EQ (CMPconst [0] (ANDconst [c] x)) yes no)
16974                 // result: (EQ (ANDCCconst [c] x) yes no)
16975                 for b.Controls[0].Op == OpPPC64CMPconst {
16976                         v_0 := b.Controls[0]
16977                         if auxIntToInt64(v_0.AuxInt) != 0 {
16978                                 break
16979                         }
16980                         v_0_0 := v_0.Args[0]
16981                         if v_0_0.Op != OpPPC64ANDconst {
16982                                 break
16983                         }
16984                         c := auxIntToInt64(v_0_0.AuxInt)
16985                         x := v_0_0.Args[0]
16986                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
16987                         v0.AuxInt = int64ToAuxInt(c)
16988                         v0.AddArg(x)
16989                         b.resetWithControl(BlockPPC64EQ, v0)
16990                         return true
16991                 }
16992                 // match: (EQ (CMPWconst [0] (ANDconst [c] x)) yes no)
16993                 // result: (EQ (ANDCCconst [c] x) yes no)
16994                 for b.Controls[0].Op == OpPPC64CMPWconst {
16995                         v_0 := b.Controls[0]
16996                         if auxIntToInt32(v_0.AuxInt) != 0 {
16997                                 break
16998                         }
16999                         v_0_0 := v_0.Args[0]
17000                         if v_0_0.Op != OpPPC64ANDconst {
17001                                 break
17002                         }
17003                         c := auxIntToInt64(v_0_0.AuxInt)
17004                         x := v_0_0.Args[0]
17005                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
17006                         v0.AuxInt = int64ToAuxInt(c)
17007                         v0.AddArg(x)
17008                         b.resetWithControl(BlockPPC64EQ, v0)
17009                         return true
17010                 }
17011                 // match: (EQ (FlagEQ) yes no)
17012                 // result: (First yes no)
17013                 for b.Controls[0].Op == OpPPC64FlagEQ {
17014                         b.Reset(BlockFirst)
17015                         return true
17016                 }
17017                 // match: (EQ (FlagLT) yes no)
17018                 // result: (First no yes)
17019                 for b.Controls[0].Op == OpPPC64FlagLT {
17020                         b.Reset(BlockFirst)
17021                         b.swapSuccessors()
17022                         return true
17023                 }
17024                 // match: (EQ (FlagGT) yes no)
17025                 // result: (First no yes)
17026                 for b.Controls[0].Op == OpPPC64FlagGT {
17027                         b.Reset(BlockFirst)
17028                         b.swapSuccessors()
17029                         return true
17030                 }
17031                 // match: (EQ (InvertFlags cmp) yes no)
17032                 // result: (EQ cmp yes no)
17033                 for b.Controls[0].Op == OpPPC64InvertFlags {
17034                         v_0 := b.Controls[0]
17035                         cmp := v_0.Args[0]
17036                         b.resetWithControl(BlockPPC64EQ, cmp)
17037                         return true
17038                 }
17039                 // match: (EQ (CMPconst [0] (ANDconst [c] x)) yes no)
17040                 // result: (EQ (ANDCCconst [c] x) yes no)
17041                 for b.Controls[0].Op == OpPPC64CMPconst {
17042                         v_0 := b.Controls[0]
17043                         if auxIntToInt64(v_0.AuxInt) != 0 {
17044                                 break
17045                         }
17046                         v_0_0 := v_0.Args[0]
17047                         if v_0_0.Op != OpPPC64ANDconst {
17048                                 break
17049                         }
17050                         c := auxIntToInt64(v_0_0.AuxInt)
17051                         x := v_0_0.Args[0]
17052                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
17053                         v0.AuxInt = int64ToAuxInt(c)
17054                         v0.AddArg(x)
17055                         b.resetWithControl(BlockPPC64EQ, v0)
17056                         return true
17057                 }
17058                 // match: (EQ (CMPWconst [0] (ANDconst [c] x)) yes no)
17059                 // result: (EQ (ANDCCconst [c] x) yes no)
17060                 for b.Controls[0].Op == OpPPC64CMPWconst {
17061                         v_0 := b.Controls[0]
17062                         if auxIntToInt32(v_0.AuxInt) != 0 {
17063                                 break
17064                         }
17065                         v_0_0 := v_0.Args[0]
17066                         if v_0_0.Op != OpPPC64ANDconst {
17067                                 break
17068                         }
17069                         c := auxIntToInt64(v_0_0.AuxInt)
17070                         x := v_0_0.Args[0]
17071                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
17072                         v0.AuxInt = int64ToAuxInt(c)
17073                         v0.AddArg(x)
17074                         b.resetWithControl(BlockPPC64EQ, v0)
17075                         return true
17076                 }
17077                 // match: (EQ (CMPconst [0] z:(AND x y)) yes no)
17078                 // cond: z.Uses == 1
17079                 // result: (EQ (ANDCC x y) yes no)
17080                 for b.Controls[0].Op == OpPPC64CMPconst {
17081                         v_0 := b.Controls[0]
17082                         if auxIntToInt64(v_0.AuxInt) != 0 {
17083                                 break
17084                         }
17085                         z := v_0.Args[0]
17086                         if z.Op != OpPPC64AND {
17087                                 break
17088                         }
17089                         _ = z.Args[1]
17090                         z_0 := z.Args[0]
17091                         z_1 := z.Args[1]
17092                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17093                                 x := z_0
17094                                 y := z_1
17095                                 if !(z.Uses == 1) {
17096                                         continue
17097                                 }
17098                                 v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.TypeFlags)
17099                                 v0.AddArg2(x, y)
17100                                 b.resetWithControl(BlockPPC64EQ, v0)
17101                                 return true
17102                         }
17103                         break
17104                 }
17105                 // match: (EQ (CMPconst [0] z:(OR x y)) yes no)
17106                 // cond: z.Uses == 1
17107                 // result: (EQ (ORCC x y) yes no)
17108                 for b.Controls[0].Op == OpPPC64CMPconst {
17109                         v_0 := b.Controls[0]
17110                         if auxIntToInt64(v_0.AuxInt) != 0 {
17111                                 break
17112                         }
17113                         z := v_0.Args[0]
17114                         if z.Op != OpPPC64OR {
17115                                 break
17116                         }
17117                         _ = z.Args[1]
17118                         z_0 := z.Args[0]
17119                         z_1 := z.Args[1]
17120                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17121                                 x := z_0
17122                                 y := z_1
17123                                 if !(z.Uses == 1) {
17124                                         continue
17125                                 }
17126                                 v0 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.TypeFlags)
17127                                 v0.AddArg2(x, y)
17128                                 b.resetWithControl(BlockPPC64EQ, v0)
17129                                 return true
17130                         }
17131                         break
17132                 }
17133                 // match: (EQ (CMPconst [0] z:(XOR x y)) yes no)
17134                 // cond: z.Uses == 1
17135                 // result: (EQ (XORCC x y) yes no)
17136                 for b.Controls[0].Op == OpPPC64CMPconst {
17137                         v_0 := b.Controls[0]
17138                         if auxIntToInt64(v_0.AuxInt) != 0 {
17139                                 break
17140                         }
17141                         z := v_0.Args[0]
17142                         if z.Op != OpPPC64XOR {
17143                                 break
17144                         }
17145                         _ = z.Args[1]
17146                         z_0 := z.Args[0]
17147                         z_1 := z.Args[1]
17148                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17149                                 x := z_0
17150                                 y := z_1
17151                                 if !(z.Uses == 1) {
17152                                         continue
17153                                 }
17154                                 v0 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.TypeFlags)
17155                                 v0.AddArg2(x, y)
17156                                 b.resetWithControl(BlockPPC64EQ, v0)
17157                                 return true
17158                         }
17159                         break
17160                 }
17161         case BlockPPC64GE:
17162                 // match: (GE (FlagEQ) yes no)
17163                 // result: (First yes no)
17164                 for b.Controls[0].Op == OpPPC64FlagEQ {
17165                         b.Reset(BlockFirst)
17166                         return true
17167                 }
17168                 // match: (GE (FlagLT) yes no)
17169                 // result: (First no yes)
17170                 for b.Controls[0].Op == OpPPC64FlagLT {
17171                         b.Reset(BlockFirst)
17172                         b.swapSuccessors()
17173                         return true
17174                 }
17175                 // match: (GE (FlagGT) yes no)
17176                 // result: (First yes no)
17177                 for b.Controls[0].Op == OpPPC64FlagGT {
17178                         b.Reset(BlockFirst)
17179                         return true
17180                 }
17181                 // match: (GE (InvertFlags cmp) yes no)
17182                 // result: (LE cmp yes no)
17183                 for b.Controls[0].Op == OpPPC64InvertFlags {
17184                         v_0 := b.Controls[0]
17185                         cmp := v_0.Args[0]
17186                         b.resetWithControl(BlockPPC64LE, cmp)
17187                         return true
17188                 }
17189                 // match: (GE (CMPconst [0] (ANDconst [c] x)) yes no)
17190                 // result: (GE (ANDCCconst [c] x) yes no)
17191                 for b.Controls[0].Op == OpPPC64CMPconst {
17192                         v_0 := b.Controls[0]
17193                         if auxIntToInt64(v_0.AuxInt) != 0 {
17194                                 break
17195                         }
17196                         v_0_0 := v_0.Args[0]
17197                         if v_0_0.Op != OpPPC64ANDconst {
17198                                 break
17199                         }
17200                         c := auxIntToInt64(v_0_0.AuxInt)
17201                         x := v_0_0.Args[0]
17202                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
17203                         v0.AuxInt = int64ToAuxInt(c)
17204                         v0.AddArg(x)
17205                         b.resetWithControl(BlockPPC64GE, v0)
17206                         return true
17207                 }
17208                 // match: (GE (CMPWconst [0] (ANDconst [c] x)) yes no)
17209                 // result: (GE (ANDCCconst [c] x) yes no)
17210                 for b.Controls[0].Op == OpPPC64CMPWconst {
17211                         v_0 := b.Controls[0]
17212                         if auxIntToInt32(v_0.AuxInt) != 0 {
17213                                 break
17214                         }
17215                         v_0_0 := v_0.Args[0]
17216                         if v_0_0.Op != OpPPC64ANDconst {
17217                                 break
17218                         }
17219                         c := auxIntToInt64(v_0_0.AuxInt)
17220                         x := v_0_0.Args[0]
17221                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
17222                         v0.AuxInt = int64ToAuxInt(c)
17223                         v0.AddArg(x)
17224                         b.resetWithControl(BlockPPC64GE, v0)
17225                         return true
17226                 }
17227                 // match: (GE (CMPconst [0] z:(AND x y)) yes no)
17228                 // cond: z.Uses == 1
17229                 // result: (GE (ANDCC x y) yes no)
17230                 for b.Controls[0].Op == OpPPC64CMPconst {
17231                         v_0 := b.Controls[0]
17232                         if auxIntToInt64(v_0.AuxInt) != 0 {
17233                                 break
17234                         }
17235                         z := v_0.Args[0]
17236                         if z.Op != OpPPC64AND {
17237                                 break
17238                         }
17239                         _ = z.Args[1]
17240                         z_0 := z.Args[0]
17241                         z_1 := z.Args[1]
17242                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17243                                 x := z_0
17244                                 y := z_1
17245                                 if !(z.Uses == 1) {
17246                                         continue
17247                                 }
17248                                 v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.TypeFlags)
17249                                 v0.AddArg2(x, y)
17250                                 b.resetWithControl(BlockPPC64GE, v0)
17251                                 return true
17252                         }
17253                         break
17254                 }
17255                 // match: (GE (CMPconst [0] z:(OR x y)) yes no)
17256                 // cond: z.Uses == 1
17257                 // result: (GE (ORCC x y) yes no)
17258                 for b.Controls[0].Op == OpPPC64CMPconst {
17259                         v_0 := b.Controls[0]
17260                         if auxIntToInt64(v_0.AuxInt) != 0 {
17261                                 break
17262                         }
17263                         z := v_0.Args[0]
17264                         if z.Op != OpPPC64OR {
17265                                 break
17266                         }
17267                         _ = z.Args[1]
17268                         z_0 := z.Args[0]
17269                         z_1 := z.Args[1]
17270                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17271                                 x := z_0
17272                                 y := z_1
17273                                 if !(z.Uses == 1) {
17274                                         continue
17275                                 }
17276                                 v0 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.TypeFlags)
17277                                 v0.AddArg2(x, y)
17278                                 b.resetWithControl(BlockPPC64GE, v0)
17279                                 return true
17280                         }
17281                         break
17282                 }
17283                 // match: (GE (CMPconst [0] z:(XOR x y)) yes no)
17284                 // cond: z.Uses == 1
17285                 // result: (GE (XORCC x y) yes no)
17286                 for b.Controls[0].Op == OpPPC64CMPconst {
17287                         v_0 := b.Controls[0]
17288                         if auxIntToInt64(v_0.AuxInt) != 0 {
17289                                 break
17290                         }
17291                         z := v_0.Args[0]
17292                         if z.Op != OpPPC64XOR {
17293                                 break
17294                         }
17295                         _ = z.Args[1]
17296                         z_0 := z.Args[0]
17297                         z_1 := z.Args[1]
17298                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17299                                 x := z_0
17300                                 y := z_1
17301                                 if !(z.Uses == 1) {
17302                                         continue
17303                                 }
17304                                 v0 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.TypeFlags)
17305                                 v0.AddArg2(x, y)
17306                                 b.resetWithControl(BlockPPC64GE, v0)
17307                                 return true
17308                         }
17309                         break
17310                 }
17311         case BlockPPC64GT:
17312                 // match: (GT (FlagEQ) yes no)
17313                 // result: (First no yes)
17314                 for b.Controls[0].Op == OpPPC64FlagEQ {
17315                         b.Reset(BlockFirst)
17316                         b.swapSuccessors()
17317                         return true
17318                 }
17319                 // match: (GT (FlagLT) yes no)
17320                 // result: (First no yes)
17321                 for b.Controls[0].Op == OpPPC64FlagLT {
17322                         b.Reset(BlockFirst)
17323                         b.swapSuccessors()
17324                         return true
17325                 }
17326                 // match: (GT (FlagGT) yes no)
17327                 // result: (First yes no)
17328                 for b.Controls[0].Op == OpPPC64FlagGT {
17329                         b.Reset(BlockFirst)
17330                         return true
17331                 }
17332                 // match: (GT (InvertFlags cmp) yes no)
17333                 // result: (LT cmp yes no)
17334                 for b.Controls[0].Op == OpPPC64InvertFlags {
17335                         v_0 := b.Controls[0]
17336                         cmp := v_0.Args[0]
17337                         b.resetWithControl(BlockPPC64LT, cmp)
17338                         return true
17339                 }
17340                 // match: (GT (CMPconst [0] (ANDconst [c] x)) yes no)
17341                 // result: (GT (ANDCCconst [c] x) yes no)
17342                 for b.Controls[0].Op == OpPPC64CMPconst {
17343                         v_0 := b.Controls[0]
17344                         if auxIntToInt64(v_0.AuxInt) != 0 {
17345                                 break
17346                         }
17347                         v_0_0 := v_0.Args[0]
17348                         if v_0_0.Op != OpPPC64ANDconst {
17349                                 break
17350                         }
17351                         c := auxIntToInt64(v_0_0.AuxInt)
17352                         x := v_0_0.Args[0]
17353                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
17354                         v0.AuxInt = int64ToAuxInt(c)
17355                         v0.AddArg(x)
17356                         b.resetWithControl(BlockPPC64GT, v0)
17357                         return true
17358                 }
17359                 // match: (GT (CMPWconst [0] (ANDconst [c] x)) yes no)
17360                 // result: (GT (ANDCCconst [c] x) yes no)
17361                 for b.Controls[0].Op == OpPPC64CMPWconst {
17362                         v_0 := b.Controls[0]
17363                         if auxIntToInt32(v_0.AuxInt) != 0 {
17364                                 break
17365                         }
17366                         v_0_0 := v_0.Args[0]
17367                         if v_0_0.Op != OpPPC64ANDconst {
17368                                 break
17369                         }
17370                         c := auxIntToInt64(v_0_0.AuxInt)
17371                         x := v_0_0.Args[0]
17372                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
17373                         v0.AuxInt = int64ToAuxInt(c)
17374                         v0.AddArg(x)
17375                         b.resetWithControl(BlockPPC64GT, v0)
17376                         return true
17377                 }
17378                 // match: (GT (CMPconst [0] z:(AND x y)) yes no)
17379                 // cond: z.Uses == 1
17380                 // result: (GT (ANDCC x y) yes no)
17381                 for b.Controls[0].Op == OpPPC64CMPconst {
17382                         v_0 := b.Controls[0]
17383                         if auxIntToInt64(v_0.AuxInt) != 0 {
17384                                 break
17385                         }
17386                         z := v_0.Args[0]
17387                         if z.Op != OpPPC64AND {
17388                                 break
17389                         }
17390                         _ = z.Args[1]
17391                         z_0 := z.Args[0]
17392                         z_1 := z.Args[1]
17393                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17394                                 x := z_0
17395                                 y := z_1
17396                                 if !(z.Uses == 1) {
17397                                         continue
17398                                 }
17399                                 v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.TypeFlags)
17400                                 v0.AddArg2(x, y)
17401                                 b.resetWithControl(BlockPPC64GT, v0)
17402                                 return true
17403                         }
17404                         break
17405                 }
17406                 // match: (GT (CMPconst [0] z:(OR x y)) yes no)
17407                 // cond: z.Uses == 1
17408                 // result: (GT (ORCC x y) yes no)
17409                 for b.Controls[0].Op == OpPPC64CMPconst {
17410                         v_0 := b.Controls[0]
17411                         if auxIntToInt64(v_0.AuxInt) != 0 {
17412                                 break
17413                         }
17414                         z := v_0.Args[0]
17415                         if z.Op != OpPPC64OR {
17416                                 break
17417                         }
17418                         _ = z.Args[1]
17419                         z_0 := z.Args[0]
17420                         z_1 := z.Args[1]
17421                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17422                                 x := z_0
17423                                 y := z_1
17424                                 if !(z.Uses == 1) {
17425                                         continue
17426                                 }
17427                                 v0 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.TypeFlags)
17428                                 v0.AddArg2(x, y)
17429                                 b.resetWithControl(BlockPPC64GT, v0)
17430                                 return true
17431                         }
17432                         break
17433                 }
17434                 // match: (GT (CMPconst [0] z:(XOR x y)) yes no)
17435                 // cond: z.Uses == 1
17436                 // result: (GT (XORCC x y) yes no)
17437                 for b.Controls[0].Op == OpPPC64CMPconst {
17438                         v_0 := b.Controls[0]
17439                         if auxIntToInt64(v_0.AuxInt) != 0 {
17440                                 break
17441                         }
17442                         z := v_0.Args[0]
17443                         if z.Op != OpPPC64XOR {
17444                                 break
17445                         }
17446                         _ = z.Args[1]
17447                         z_0 := z.Args[0]
17448                         z_1 := z.Args[1]
17449                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17450                                 x := z_0
17451                                 y := z_1
17452                                 if !(z.Uses == 1) {
17453                                         continue
17454                                 }
17455                                 v0 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.TypeFlags)
17456                                 v0.AddArg2(x, y)
17457                                 b.resetWithControl(BlockPPC64GT, v0)
17458                                 return true
17459                         }
17460                         break
17461                 }
17462         case BlockIf:
17463                 // match: (If (Equal cc) yes no)
17464                 // result: (EQ cc yes no)
17465                 for b.Controls[0].Op == OpPPC64Equal {
17466                         v_0 := b.Controls[0]
17467                         cc := v_0.Args[0]
17468                         b.resetWithControl(BlockPPC64EQ, cc)
17469                         return true
17470                 }
17471                 // match: (If (NotEqual cc) yes no)
17472                 // result: (NE cc yes no)
17473                 for b.Controls[0].Op == OpPPC64NotEqual {
17474                         v_0 := b.Controls[0]
17475                         cc := v_0.Args[0]
17476                         b.resetWithControl(BlockPPC64NE, cc)
17477                         return true
17478                 }
17479                 // match: (If (LessThan cc) yes no)
17480                 // result: (LT cc yes no)
17481                 for b.Controls[0].Op == OpPPC64LessThan {
17482                         v_0 := b.Controls[0]
17483                         cc := v_0.Args[0]
17484                         b.resetWithControl(BlockPPC64LT, cc)
17485                         return true
17486                 }
17487                 // match: (If (LessEqual cc) yes no)
17488                 // result: (LE cc yes no)
17489                 for b.Controls[0].Op == OpPPC64LessEqual {
17490                         v_0 := b.Controls[0]
17491                         cc := v_0.Args[0]
17492                         b.resetWithControl(BlockPPC64LE, cc)
17493                         return true
17494                 }
17495                 // match: (If (GreaterThan cc) yes no)
17496                 // result: (GT cc yes no)
17497                 for b.Controls[0].Op == OpPPC64GreaterThan {
17498                         v_0 := b.Controls[0]
17499                         cc := v_0.Args[0]
17500                         b.resetWithControl(BlockPPC64GT, cc)
17501                         return true
17502                 }
17503                 // match: (If (GreaterEqual cc) yes no)
17504                 // result: (GE cc yes no)
17505                 for b.Controls[0].Op == OpPPC64GreaterEqual {
17506                         v_0 := b.Controls[0]
17507                         cc := v_0.Args[0]
17508                         b.resetWithControl(BlockPPC64GE, cc)
17509                         return true
17510                 }
17511                 // match: (If (FLessThan cc) yes no)
17512                 // result: (FLT cc yes no)
17513                 for b.Controls[0].Op == OpPPC64FLessThan {
17514                         v_0 := b.Controls[0]
17515                         cc := v_0.Args[0]
17516                         b.resetWithControl(BlockPPC64FLT, cc)
17517                         return true
17518                 }
17519                 // match: (If (FLessEqual cc) yes no)
17520                 // result: (FLE cc yes no)
17521                 for b.Controls[0].Op == OpPPC64FLessEqual {
17522                         v_0 := b.Controls[0]
17523                         cc := v_0.Args[0]
17524                         b.resetWithControl(BlockPPC64FLE, cc)
17525                         return true
17526                 }
17527                 // match: (If (FGreaterThan cc) yes no)
17528                 // result: (FGT cc yes no)
17529                 for b.Controls[0].Op == OpPPC64FGreaterThan {
17530                         v_0 := b.Controls[0]
17531                         cc := v_0.Args[0]
17532                         b.resetWithControl(BlockPPC64FGT, cc)
17533                         return true
17534                 }
17535                 // match: (If (FGreaterEqual cc) yes no)
17536                 // result: (FGE cc yes no)
17537                 for b.Controls[0].Op == OpPPC64FGreaterEqual {
17538                         v_0 := b.Controls[0]
17539                         cc := v_0.Args[0]
17540                         b.resetWithControl(BlockPPC64FGE, cc)
17541                         return true
17542                 }
17543                 // match: (If cond yes no)
17544                 // result: (NE (CMPWconst [0] cond) yes no)
17545                 for {
17546                         cond := b.Controls[0]
17547                         v0 := b.NewValue0(cond.Pos, OpPPC64CMPWconst, types.TypeFlags)
17548                         v0.AuxInt = int32ToAuxInt(0)
17549                         v0.AddArg(cond)
17550                         b.resetWithControl(BlockPPC64NE, v0)
17551                         return true
17552                 }
17553         case BlockPPC64LE:
17554                 // match: (LE (FlagEQ) yes no)
17555                 // result: (First yes no)
17556                 for b.Controls[0].Op == OpPPC64FlagEQ {
17557                         b.Reset(BlockFirst)
17558                         return true
17559                 }
17560                 // match: (LE (FlagLT) yes no)
17561                 // result: (First yes no)
17562                 for b.Controls[0].Op == OpPPC64FlagLT {
17563                         b.Reset(BlockFirst)
17564                         return true
17565                 }
17566                 // match: (LE (FlagGT) yes no)
17567                 // result: (First no yes)
17568                 for b.Controls[0].Op == OpPPC64FlagGT {
17569                         b.Reset(BlockFirst)
17570                         b.swapSuccessors()
17571                         return true
17572                 }
17573                 // match: (LE (InvertFlags cmp) yes no)
17574                 // result: (GE cmp yes no)
17575                 for b.Controls[0].Op == OpPPC64InvertFlags {
17576                         v_0 := b.Controls[0]
17577                         cmp := v_0.Args[0]
17578                         b.resetWithControl(BlockPPC64GE, cmp)
17579                         return true
17580                 }
17581                 // match: (LE (CMPconst [0] (ANDconst [c] x)) yes no)
17582                 // result: (LE (ANDCCconst [c] x) yes no)
17583                 for b.Controls[0].Op == OpPPC64CMPconst {
17584                         v_0 := b.Controls[0]
17585                         if auxIntToInt64(v_0.AuxInt) != 0 {
17586                                 break
17587                         }
17588                         v_0_0 := v_0.Args[0]
17589                         if v_0_0.Op != OpPPC64ANDconst {
17590                                 break
17591                         }
17592                         c := auxIntToInt64(v_0_0.AuxInt)
17593                         x := v_0_0.Args[0]
17594                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
17595                         v0.AuxInt = int64ToAuxInt(c)
17596                         v0.AddArg(x)
17597                         b.resetWithControl(BlockPPC64LE, v0)
17598                         return true
17599                 }
17600                 // match: (LE (CMPWconst [0] (ANDconst [c] x)) yes no)
17601                 // result: (LE (ANDCCconst [c] x) yes no)
17602                 for b.Controls[0].Op == OpPPC64CMPWconst {
17603                         v_0 := b.Controls[0]
17604                         if auxIntToInt32(v_0.AuxInt) != 0 {
17605                                 break
17606                         }
17607                         v_0_0 := v_0.Args[0]
17608                         if v_0_0.Op != OpPPC64ANDconst {
17609                                 break
17610                         }
17611                         c := auxIntToInt64(v_0_0.AuxInt)
17612                         x := v_0_0.Args[0]
17613                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
17614                         v0.AuxInt = int64ToAuxInt(c)
17615                         v0.AddArg(x)
17616                         b.resetWithControl(BlockPPC64LE, v0)
17617                         return true
17618                 }
17619                 // match: (LE (CMPconst [0] z:(AND x y)) yes no)
17620                 // cond: z.Uses == 1
17621                 // result: (LE (ANDCC x y) yes no)
17622                 for b.Controls[0].Op == OpPPC64CMPconst {
17623                         v_0 := b.Controls[0]
17624                         if auxIntToInt64(v_0.AuxInt) != 0 {
17625                                 break
17626                         }
17627                         z := v_0.Args[0]
17628                         if z.Op != OpPPC64AND {
17629                                 break
17630                         }
17631                         _ = z.Args[1]
17632                         z_0 := z.Args[0]
17633                         z_1 := z.Args[1]
17634                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17635                                 x := z_0
17636                                 y := z_1
17637                                 if !(z.Uses == 1) {
17638                                         continue
17639                                 }
17640                                 v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.TypeFlags)
17641                                 v0.AddArg2(x, y)
17642                                 b.resetWithControl(BlockPPC64LE, v0)
17643                                 return true
17644                         }
17645                         break
17646                 }
17647                 // match: (LE (CMPconst [0] z:(OR x y)) yes no)
17648                 // cond: z.Uses == 1
17649                 // result: (LE (ORCC x y) yes no)
17650                 for b.Controls[0].Op == OpPPC64CMPconst {
17651                         v_0 := b.Controls[0]
17652                         if auxIntToInt64(v_0.AuxInt) != 0 {
17653                                 break
17654                         }
17655                         z := v_0.Args[0]
17656                         if z.Op != OpPPC64OR {
17657                                 break
17658                         }
17659                         _ = z.Args[1]
17660                         z_0 := z.Args[0]
17661                         z_1 := z.Args[1]
17662                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17663                                 x := z_0
17664                                 y := z_1
17665                                 if !(z.Uses == 1) {
17666                                         continue
17667                                 }
17668                                 v0 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.TypeFlags)
17669                                 v0.AddArg2(x, y)
17670                                 b.resetWithControl(BlockPPC64LE, v0)
17671                                 return true
17672                         }
17673                         break
17674                 }
17675                 // match: (LE (CMPconst [0] z:(XOR x y)) yes no)
17676                 // cond: z.Uses == 1
17677                 // result: (LE (XORCC x y) yes no)
17678                 for b.Controls[0].Op == OpPPC64CMPconst {
17679                         v_0 := b.Controls[0]
17680                         if auxIntToInt64(v_0.AuxInt) != 0 {
17681                                 break
17682                         }
17683                         z := v_0.Args[0]
17684                         if z.Op != OpPPC64XOR {
17685                                 break
17686                         }
17687                         _ = z.Args[1]
17688                         z_0 := z.Args[0]
17689                         z_1 := z.Args[1]
17690                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17691                                 x := z_0
17692                                 y := z_1
17693                                 if !(z.Uses == 1) {
17694                                         continue
17695                                 }
17696                                 v0 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.TypeFlags)
17697                                 v0.AddArg2(x, y)
17698                                 b.resetWithControl(BlockPPC64LE, v0)
17699                                 return true
17700                         }
17701                         break
17702                 }
17703         case BlockPPC64LT:
17704                 // match: (LT (FlagEQ) yes no)
17705                 // result: (First no yes)
17706                 for b.Controls[0].Op == OpPPC64FlagEQ {
17707                         b.Reset(BlockFirst)
17708                         b.swapSuccessors()
17709                         return true
17710                 }
17711                 // match: (LT (FlagLT) yes no)
17712                 // result: (First yes no)
17713                 for b.Controls[0].Op == OpPPC64FlagLT {
17714                         b.Reset(BlockFirst)
17715                         return true
17716                 }
17717                 // match: (LT (FlagGT) yes no)
17718                 // result: (First no yes)
17719                 for b.Controls[0].Op == OpPPC64FlagGT {
17720                         b.Reset(BlockFirst)
17721                         b.swapSuccessors()
17722                         return true
17723                 }
17724                 // match: (LT (InvertFlags cmp) yes no)
17725                 // result: (GT cmp yes no)
17726                 for b.Controls[0].Op == OpPPC64InvertFlags {
17727                         v_0 := b.Controls[0]
17728                         cmp := v_0.Args[0]
17729                         b.resetWithControl(BlockPPC64GT, cmp)
17730                         return true
17731                 }
17732                 // match: (LT (CMPconst [0] (ANDconst [c] x)) yes no)
17733                 // result: (LT (ANDCCconst [c] x) yes no)
17734                 for b.Controls[0].Op == OpPPC64CMPconst {
17735                         v_0 := b.Controls[0]
17736                         if auxIntToInt64(v_0.AuxInt) != 0 {
17737                                 break
17738                         }
17739                         v_0_0 := v_0.Args[0]
17740                         if v_0_0.Op != OpPPC64ANDconst {
17741                                 break
17742                         }
17743                         c := auxIntToInt64(v_0_0.AuxInt)
17744                         x := v_0_0.Args[0]
17745                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
17746                         v0.AuxInt = int64ToAuxInt(c)
17747                         v0.AddArg(x)
17748                         b.resetWithControl(BlockPPC64LT, v0)
17749                         return true
17750                 }
17751                 // match: (LT (CMPWconst [0] (ANDconst [c] x)) yes no)
17752                 // result: (LT (ANDCCconst [c] x) yes no)
17753                 for b.Controls[0].Op == OpPPC64CMPWconst {
17754                         v_0 := b.Controls[0]
17755                         if auxIntToInt32(v_0.AuxInt) != 0 {
17756                                 break
17757                         }
17758                         v_0_0 := v_0.Args[0]
17759                         if v_0_0.Op != OpPPC64ANDconst {
17760                                 break
17761                         }
17762                         c := auxIntToInt64(v_0_0.AuxInt)
17763                         x := v_0_0.Args[0]
17764                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
17765                         v0.AuxInt = int64ToAuxInt(c)
17766                         v0.AddArg(x)
17767                         b.resetWithControl(BlockPPC64LT, v0)
17768                         return true
17769                 }
17770                 // match: (LT (CMPconst [0] z:(AND x y)) yes no)
17771                 // cond: z.Uses == 1
17772                 // result: (LT (ANDCC x y) yes no)
17773                 for b.Controls[0].Op == OpPPC64CMPconst {
17774                         v_0 := b.Controls[0]
17775                         if auxIntToInt64(v_0.AuxInt) != 0 {
17776                                 break
17777                         }
17778                         z := v_0.Args[0]
17779                         if z.Op != OpPPC64AND {
17780                                 break
17781                         }
17782                         _ = z.Args[1]
17783                         z_0 := z.Args[0]
17784                         z_1 := z.Args[1]
17785                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17786                                 x := z_0
17787                                 y := z_1
17788                                 if !(z.Uses == 1) {
17789                                         continue
17790                                 }
17791                                 v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.TypeFlags)
17792                                 v0.AddArg2(x, y)
17793                                 b.resetWithControl(BlockPPC64LT, v0)
17794                                 return true
17795                         }
17796                         break
17797                 }
17798                 // match: (LT (CMPconst [0] z:(OR x y)) yes no)
17799                 // cond: z.Uses == 1
17800                 // result: (LT (ORCC x y) yes no)
17801                 for b.Controls[0].Op == OpPPC64CMPconst {
17802                         v_0 := b.Controls[0]
17803                         if auxIntToInt64(v_0.AuxInt) != 0 {
17804                                 break
17805                         }
17806                         z := v_0.Args[0]
17807                         if z.Op != OpPPC64OR {
17808                                 break
17809                         }
17810                         _ = z.Args[1]
17811                         z_0 := z.Args[0]
17812                         z_1 := z.Args[1]
17813                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17814                                 x := z_0
17815                                 y := z_1
17816                                 if !(z.Uses == 1) {
17817                                         continue
17818                                 }
17819                                 v0 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.TypeFlags)
17820                                 v0.AddArg2(x, y)
17821                                 b.resetWithControl(BlockPPC64LT, v0)
17822                                 return true
17823                         }
17824                         break
17825                 }
17826                 // match: (LT (CMPconst [0] z:(XOR x y)) yes no)
17827                 // cond: z.Uses == 1
17828                 // result: (LT (XORCC x y) yes no)
17829                 for b.Controls[0].Op == OpPPC64CMPconst {
17830                         v_0 := b.Controls[0]
17831                         if auxIntToInt64(v_0.AuxInt) != 0 {
17832                                 break
17833                         }
17834                         z := v_0.Args[0]
17835                         if z.Op != OpPPC64XOR {
17836                                 break
17837                         }
17838                         _ = z.Args[1]
17839                         z_0 := z.Args[0]
17840                         z_1 := z.Args[1]
17841                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
17842                                 x := z_0
17843                                 y := z_1
17844                                 if !(z.Uses == 1) {
17845                                         continue
17846                                 }
17847                                 v0 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.TypeFlags)
17848                                 v0.AddArg2(x, y)
17849                                 b.resetWithControl(BlockPPC64LT, v0)
17850                                 return true
17851                         }
17852                         break
17853                 }
17854         case BlockPPC64NE:
17855                 // match: (NE (CMPWconst [0] (Equal cc)) yes no)
17856                 // result: (EQ cc yes no)
17857                 for b.Controls[0].Op == OpPPC64CMPWconst {
17858                         v_0 := b.Controls[0]
17859                         if auxIntToInt32(v_0.AuxInt) != 0 {
17860                                 break
17861                         }
17862                         v_0_0 := v_0.Args[0]
17863                         if v_0_0.Op != OpPPC64Equal {
17864                                 break
17865                         }
17866                         cc := v_0_0.Args[0]
17867                         b.resetWithControl(BlockPPC64EQ, cc)
17868                         return true
17869                 }
17870                 // match: (NE (CMPWconst [0] (NotEqual cc)) yes no)
17871                 // result: (NE cc yes no)
17872                 for b.Controls[0].Op == OpPPC64CMPWconst {
17873                         v_0 := b.Controls[0]
17874                         if auxIntToInt32(v_0.AuxInt) != 0 {
17875                                 break
17876                         }
17877                         v_0_0 := v_0.Args[0]
17878                         if v_0_0.Op != OpPPC64NotEqual {
17879                                 break
17880                         }
17881                         cc := v_0_0.Args[0]
17882                         b.resetWithControl(BlockPPC64NE, cc)
17883                         return true
17884                 }
17885                 // match: (NE (CMPWconst [0] (LessThan cc)) yes no)
17886                 // result: (LT cc yes no)
17887                 for b.Controls[0].Op == OpPPC64CMPWconst {
17888                         v_0 := b.Controls[0]
17889                         if auxIntToInt32(v_0.AuxInt) != 0 {
17890                                 break
17891                         }
17892                         v_0_0 := v_0.Args[0]
17893                         if v_0_0.Op != OpPPC64LessThan {
17894                                 break
17895                         }
17896                         cc := v_0_0.Args[0]
17897                         b.resetWithControl(BlockPPC64LT, cc)
17898                         return true
17899                 }
17900                 // match: (NE (CMPWconst [0] (LessEqual cc)) yes no)
17901                 // result: (LE cc yes no)
17902                 for b.Controls[0].Op == OpPPC64CMPWconst {
17903                         v_0 := b.Controls[0]
17904                         if auxIntToInt32(v_0.AuxInt) != 0 {
17905                                 break
17906                         }
17907                         v_0_0 := v_0.Args[0]
17908                         if v_0_0.Op != OpPPC64LessEqual {
17909                                 break
17910                         }
17911                         cc := v_0_0.Args[0]
17912                         b.resetWithControl(BlockPPC64LE, cc)
17913                         return true
17914                 }
17915                 // match: (NE (CMPWconst [0] (GreaterThan cc)) yes no)
17916                 // result: (GT cc yes no)
17917                 for b.Controls[0].Op == OpPPC64CMPWconst {
17918                         v_0 := b.Controls[0]
17919                         if auxIntToInt32(v_0.AuxInt) != 0 {
17920                                 break
17921                         }
17922                         v_0_0 := v_0.Args[0]
17923                         if v_0_0.Op != OpPPC64GreaterThan {
17924                                 break
17925                         }
17926                         cc := v_0_0.Args[0]
17927                         b.resetWithControl(BlockPPC64GT, cc)
17928                         return true
17929                 }
17930                 // match: (NE (CMPWconst [0] (GreaterEqual cc)) yes no)
17931                 // result: (GE cc yes no)
17932                 for b.Controls[0].Op == OpPPC64CMPWconst {
17933                         v_0 := b.Controls[0]
17934                         if auxIntToInt32(v_0.AuxInt) != 0 {
17935                                 break
17936                         }
17937                         v_0_0 := v_0.Args[0]
17938                         if v_0_0.Op != OpPPC64GreaterEqual {
17939                                 break
17940                         }
17941                         cc := v_0_0.Args[0]
17942                         b.resetWithControl(BlockPPC64GE, cc)
17943                         return true
17944                 }
17945                 // match: (NE (CMPWconst [0] (FLessThan cc)) yes no)
17946                 // result: (FLT cc yes no)
17947                 for b.Controls[0].Op == OpPPC64CMPWconst {
17948                         v_0 := b.Controls[0]
17949                         if auxIntToInt32(v_0.AuxInt) != 0 {
17950                                 break
17951                         }
17952                         v_0_0 := v_0.Args[0]
17953                         if v_0_0.Op != OpPPC64FLessThan {
17954                                 break
17955                         }
17956                         cc := v_0_0.Args[0]
17957                         b.resetWithControl(BlockPPC64FLT, cc)
17958                         return true
17959                 }
17960                 // match: (NE (CMPWconst [0] (FLessEqual cc)) yes no)
17961                 // result: (FLE cc yes no)
17962                 for b.Controls[0].Op == OpPPC64CMPWconst {
17963                         v_0 := b.Controls[0]
17964                         if auxIntToInt32(v_0.AuxInt) != 0 {
17965                                 break
17966                         }
17967                         v_0_0 := v_0.Args[0]
17968                         if v_0_0.Op != OpPPC64FLessEqual {
17969                                 break
17970                         }
17971                         cc := v_0_0.Args[0]
17972                         b.resetWithControl(BlockPPC64FLE, cc)
17973                         return true
17974                 }
17975                 // match: (NE (CMPWconst [0] (FGreaterThan cc)) yes no)
17976                 // result: (FGT cc yes no)
17977                 for b.Controls[0].Op == OpPPC64CMPWconst {
17978                         v_0 := b.Controls[0]
17979                         if auxIntToInt32(v_0.AuxInt) != 0 {
17980                                 break
17981                         }
17982                         v_0_0 := v_0.Args[0]
17983                         if v_0_0.Op != OpPPC64FGreaterThan {
17984                                 break
17985                         }
17986                         cc := v_0_0.Args[0]
17987                         b.resetWithControl(BlockPPC64FGT, cc)
17988                         return true
17989                 }
17990                 // match: (NE (CMPWconst [0] (FGreaterEqual cc)) yes no)
17991                 // result: (FGE cc yes no)
17992                 for b.Controls[0].Op == OpPPC64CMPWconst {
17993                         v_0 := b.Controls[0]
17994                         if auxIntToInt32(v_0.AuxInt) != 0 {
17995                                 break
17996                         }
17997                         v_0_0 := v_0.Args[0]
17998                         if v_0_0.Op != OpPPC64FGreaterEqual {
17999                                 break
18000                         }
18001                         cc := v_0_0.Args[0]
18002                         b.resetWithControl(BlockPPC64FGE, cc)
18003                         return true
18004                 }
18005                 // match: (NE (CMPconst [0] (ANDconst [c] x)) yes no)
18006                 // result: (NE (ANDCCconst [c] x) yes no)
18007                 for b.Controls[0].Op == OpPPC64CMPconst {
18008                         v_0 := b.Controls[0]
18009                         if auxIntToInt64(v_0.AuxInt) != 0 {
18010                                 break
18011                         }
18012                         v_0_0 := v_0.Args[0]
18013                         if v_0_0.Op != OpPPC64ANDconst {
18014                                 break
18015                         }
18016                         c := auxIntToInt64(v_0_0.AuxInt)
18017                         x := v_0_0.Args[0]
18018                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
18019                         v0.AuxInt = int64ToAuxInt(c)
18020                         v0.AddArg(x)
18021                         b.resetWithControl(BlockPPC64NE, v0)
18022                         return true
18023                 }
18024                 // match: (NE (CMPWconst [0] (ANDconst [c] x)) yes no)
18025                 // result: (NE (ANDCCconst [c] x) yes no)
18026                 for b.Controls[0].Op == OpPPC64CMPWconst {
18027                         v_0 := b.Controls[0]
18028                         if auxIntToInt32(v_0.AuxInt) != 0 {
18029                                 break
18030                         }
18031                         v_0_0 := v_0.Args[0]
18032                         if v_0_0.Op != OpPPC64ANDconst {
18033                                 break
18034                         }
18035                         c := auxIntToInt64(v_0_0.AuxInt)
18036                         x := v_0_0.Args[0]
18037                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
18038                         v0.AuxInt = int64ToAuxInt(c)
18039                         v0.AddArg(x)
18040                         b.resetWithControl(BlockPPC64NE, v0)
18041                         return true
18042                 }
18043                 // match: (NE (FlagEQ) yes no)
18044                 // result: (First no yes)
18045                 for b.Controls[0].Op == OpPPC64FlagEQ {
18046                         b.Reset(BlockFirst)
18047                         b.swapSuccessors()
18048                         return true
18049                 }
18050                 // match: (NE (FlagLT) yes no)
18051                 // result: (First yes no)
18052                 for b.Controls[0].Op == OpPPC64FlagLT {
18053                         b.Reset(BlockFirst)
18054                         return true
18055                 }
18056                 // match: (NE (FlagGT) yes no)
18057                 // result: (First yes no)
18058                 for b.Controls[0].Op == OpPPC64FlagGT {
18059                         b.Reset(BlockFirst)
18060                         return true
18061                 }
18062                 // match: (NE (InvertFlags cmp) yes no)
18063                 // result: (NE cmp yes no)
18064                 for b.Controls[0].Op == OpPPC64InvertFlags {
18065                         v_0 := b.Controls[0]
18066                         cmp := v_0.Args[0]
18067                         b.resetWithControl(BlockPPC64NE, cmp)
18068                         return true
18069                 }
18070                 // match: (NE (CMPconst [0] (ANDconst [c] x)) yes no)
18071                 // result: (NE (ANDCCconst [c] x) yes no)
18072                 for b.Controls[0].Op == OpPPC64CMPconst {
18073                         v_0 := b.Controls[0]
18074                         if auxIntToInt64(v_0.AuxInt) != 0 {
18075                                 break
18076                         }
18077                         v_0_0 := v_0.Args[0]
18078                         if v_0_0.Op != OpPPC64ANDconst {
18079                                 break
18080                         }
18081                         c := auxIntToInt64(v_0_0.AuxInt)
18082                         x := v_0_0.Args[0]
18083                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
18084                         v0.AuxInt = int64ToAuxInt(c)
18085                         v0.AddArg(x)
18086                         b.resetWithControl(BlockPPC64NE, v0)
18087                         return true
18088                 }
18089                 // match: (NE (CMPWconst [0] (ANDconst [c] x)) yes no)
18090                 // result: (NE (ANDCCconst [c] x) yes no)
18091                 for b.Controls[0].Op == OpPPC64CMPWconst {
18092                         v_0 := b.Controls[0]
18093                         if auxIntToInt32(v_0.AuxInt) != 0 {
18094                                 break
18095                         }
18096                         v_0_0 := v_0.Args[0]
18097                         if v_0_0.Op != OpPPC64ANDconst {
18098                                 break
18099                         }
18100                         c := auxIntToInt64(v_0_0.AuxInt)
18101                         x := v_0_0.Args[0]
18102                         v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.TypeFlags)
18103                         v0.AuxInt = int64ToAuxInt(c)
18104                         v0.AddArg(x)
18105                         b.resetWithControl(BlockPPC64NE, v0)
18106                         return true
18107                 }
18108                 // match: (NE (CMPconst [0] z:(AND x y)) yes no)
18109                 // cond: z.Uses == 1
18110                 // result: (NE (ANDCC x y) yes no)
18111                 for b.Controls[0].Op == OpPPC64CMPconst {
18112                         v_0 := b.Controls[0]
18113                         if auxIntToInt64(v_0.AuxInt) != 0 {
18114                                 break
18115                         }
18116                         z := v_0.Args[0]
18117                         if z.Op != OpPPC64AND {
18118                                 break
18119                         }
18120                         _ = z.Args[1]
18121                         z_0 := z.Args[0]
18122                         z_1 := z.Args[1]
18123                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
18124                                 x := z_0
18125                                 y := z_1
18126                                 if !(z.Uses == 1) {
18127                                         continue
18128                                 }
18129                                 v0 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.TypeFlags)
18130                                 v0.AddArg2(x, y)
18131                                 b.resetWithControl(BlockPPC64NE, v0)
18132                                 return true
18133                         }
18134                         break
18135                 }
18136                 // match: (NE (CMPconst [0] z:(OR x y)) yes no)
18137                 // cond: z.Uses == 1
18138                 // result: (NE (ORCC x y) yes no)
18139                 for b.Controls[0].Op == OpPPC64CMPconst {
18140                         v_0 := b.Controls[0]
18141                         if auxIntToInt64(v_0.AuxInt) != 0 {
18142                                 break
18143                         }
18144                         z := v_0.Args[0]
18145                         if z.Op != OpPPC64OR {
18146                                 break
18147                         }
18148                         _ = z.Args[1]
18149                         z_0 := z.Args[0]
18150                         z_1 := z.Args[1]
18151                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
18152                                 x := z_0
18153                                 y := z_1
18154                                 if !(z.Uses == 1) {
18155                                         continue
18156                                 }
18157                                 v0 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.TypeFlags)
18158                                 v0.AddArg2(x, y)
18159                                 b.resetWithControl(BlockPPC64NE, v0)
18160                                 return true
18161                         }
18162                         break
18163                 }
18164                 // match: (NE (CMPconst [0] z:(XOR x y)) yes no)
18165                 // cond: z.Uses == 1
18166                 // result: (NE (XORCC x y) yes no)
18167                 for b.Controls[0].Op == OpPPC64CMPconst {
18168                         v_0 := b.Controls[0]
18169                         if auxIntToInt64(v_0.AuxInt) != 0 {
18170                                 break
18171                         }
18172                         z := v_0.Args[0]
18173                         if z.Op != OpPPC64XOR {
18174                                 break
18175                         }
18176                         _ = z.Args[1]
18177                         z_0 := z.Args[0]
18178                         z_1 := z.Args[1]
18179                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
18180                                 x := z_0
18181                                 y := z_1
18182                                 if !(z.Uses == 1) {
18183                                         continue
18184                                 }
18185                                 v0 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.TypeFlags)
18186                                 v0.AddArg2(x, y)
18187                                 b.resetWithControl(BlockPPC64NE, v0)
18188                                 return true
18189                         }
18190                         break
18191                 }
18192         }
18193         return false
18194 }