]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/compile/internal/ssa/rewritePPC64.go
d1c0c2b07f666eadd94e54012bf3b92bbed2a67a
[gostls13.git] / src / cmd / compile / internal / ssa / rewritePPC64.go
1 // Code generated from _gen/PPC64.rules using 'go generate'; DO NOT EDIT.
2
3 package ssa
4
5 import "internal/buildcfg"
6 import "math"
7 import "cmd/compile/internal/types"
8
9 func rewriteValuePPC64(v *Value) bool {
10         switch v.Op {
11         case OpAbs:
12                 v.Op = OpPPC64FABS
13                 return true
14         case OpAdd16:
15                 v.Op = OpPPC64ADD
16                 return true
17         case OpAdd32:
18                 v.Op = OpPPC64ADD
19                 return true
20         case OpAdd32F:
21                 v.Op = OpPPC64FADDS
22                 return true
23         case OpAdd64:
24                 v.Op = OpPPC64ADD
25                 return true
26         case OpAdd64F:
27                 v.Op = OpPPC64FADD
28                 return true
29         case OpAdd8:
30                 v.Op = OpPPC64ADD
31                 return true
32         case OpAddPtr:
33                 v.Op = OpPPC64ADD
34                 return true
35         case OpAddr:
36                 return rewriteValuePPC64_OpAddr(v)
37         case OpAnd16:
38                 v.Op = OpPPC64AND
39                 return true
40         case OpAnd32:
41                 v.Op = OpPPC64AND
42                 return true
43         case OpAnd64:
44                 v.Op = OpPPC64AND
45                 return true
46         case OpAnd8:
47                 v.Op = OpPPC64AND
48                 return true
49         case OpAndB:
50                 v.Op = OpPPC64AND
51                 return true
52         case OpAtomicAdd32:
53                 v.Op = OpPPC64LoweredAtomicAdd32
54                 return true
55         case OpAtomicAdd64:
56                 v.Op = OpPPC64LoweredAtomicAdd64
57                 return true
58         case OpAtomicAnd32:
59                 v.Op = OpPPC64LoweredAtomicAnd32
60                 return true
61         case OpAtomicAnd8:
62                 v.Op = OpPPC64LoweredAtomicAnd8
63                 return true
64         case OpAtomicCompareAndSwap32:
65                 return rewriteValuePPC64_OpAtomicCompareAndSwap32(v)
66         case OpAtomicCompareAndSwap64:
67                 return rewriteValuePPC64_OpAtomicCompareAndSwap64(v)
68         case OpAtomicCompareAndSwapRel32:
69                 return rewriteValuePPC64_OpAtomicCompareAndSwapRel32(v)
70         case OpAtomicExchange32:
71                 v.Op = OpPPC64LoweredAtomicExchange32
72                 return true
73         case OpAtomicExchange64:
74                 v.Op = OpPPC64LoweredAtomicExchange64
75                 return true
76         case OpAtomicLoad32:
77                 return rewriteValuePPC64_OpAtomicLoad32(v)
78         case OpAtomicLoad64:
79                 return rewriteValuePPC64_OpAtomicLoad64(v)
80         case OpAtomicLoad8:
81                 return rewriteValuePPC64_OpAtomicLoad8(v)
82         case OpAtomicLoadAcq32:
83                 return rewriteValuePPC64_OpAtomicLoadAcq32(v)
84         case OpAtomicLoadAcq64:
85                 return rewriteValuePPC64_OpAtomicLoadAcq64(v)
86         case OpAtomicLoadPtr:
87                 return rewriteValuePPC64_OpAtomicLoadPtr(v)
88         case OpAtomicOr32:
89                 v.Op = OpPPC64LoweredAtomicOr32
90                 return true
91         case OpAtomicOr8:
92                 v.Op = OpPPC64LoweredAtomicOr8
93                 return true
94         case OpAtomicStore32:
95                 return rewriteValuePPC64_OpAtomicStore32(v)
96         case OpAtomicStore64:
97                 return rewriteValuePPC64_OpAtomicStore64(v)
98         case OpAtomicStore8:
99                 return rewriteValuePPC64_OpAtomicStore8(v)
100         case OpAtomicStoreRel32:
101                 return rewriteValuePPC64_OpAtomicStoreRel32(v)
102         case OpAtomicStoreRel64:
103                 return rewriteValuePPC64_OpAtomicStoreRel64(v)
104         case OpAvg64u:
105                 return rewriteValuePPC64_OpAvg64u(v)
106         case OpBitLen32:
107                 return rewriteValuePPC64_OpBitLen32(v)
108         case OpBitLen64:
109                 return rewriteValuePPC64_OpBitLen64(v)
110         case OpBswap16:
111                 return rewriteValuePPC64_OpBswap16(v)
112         case OpBswap32:
113                 return rewriteValuePPC64_OpBswap32(v)
114         case OpBswap64:
115                 return rewriteValuePPC64_OpBswap64(v)
116         case OpCeil:
117                 v.Op = OpPPC64FCEIL
118                 return true
119         case OpClosureCall:
120                 v.Op = OpPPC64CALLclosure
121                 return true
122         case OpCom16:
123                 return rewriteValuePPC64_OpCom16(v)
124         case OpCom32:
125                 return rewriteValuePPC64_OpCom32(v)
126         case OpCom64:
127                 return rewriteValuePPC64_OpCom64(v)
128         case OpCom8:
129                 return rewriteValuePPC64_OpCom8(v)
130         case OpCondSelect:
131                 return rewriteValuePPC64_OpCondSelect(v)
132         case OpConst16:
133                 return rewriteValuePPC64_OpConst16(v)
134         case OpConst32:
135                 return rewriteValuePPC64_OpConst32(v)
136         case OpConst32F:
137                 v.Op = OpPPC64FMOVSconst
138                 return true
139         case OpConst64:
140                 return rewriteValuePPC64_OpConst64(v)
141         case OpConst64F:
142                 v.Op = OpPPC64FMOVDconst
143                 return true
144         case OpConst8:
145                 return rewriteValuePPC64_OpConst8(v)
146         case OpConstBool:
147                 return rewriteValuePPC64_OpConstBool(v)
148         case OpConstNil:
149                 return rewriteValuePPC64_OpConstNil(v)
150         case OpCopysign:
151                 return rewriteValuePPC64_OpCopysign(v)
152         case OpCtz16:
153                 return rewriteValuePPC64_OpCtz16(v)
154         case OpCtz32:
155                 return rewriteValuePPC64_OpCtz32(v)
156         case OpCtz32NonZero:
157                 v.Op = OpCtz32
158                 return true
159         case OpCtz64:
160                 return rewriteValuePPC64_OpCtz64(v)
161         case OpCtz64NonZero:
162                 v.Op = OpCtz64
163                 return true
164         case OpCtz8:
165                 return rewriteValuePPC64_OpCtz8(v)
166         case OpCvt32Fto32:
167                 return rewriteValuePPC64_OpCvt32Fto32(v)
168         case OpCvt32Fto64:
169                 return rewriteValuePPC64_OpCvt32Fto64(v)
170         case OpCvt32Fto64F:
171                 v.Op = OpCopy
172                 return true
173         case OpCvt32to32F:
174                 return rewriteValuePPC64_OpCvt32to32F(v)
175         case OpCvt32to64F:
176                 return rewriteValuePPC64_OpCvt32to64F(v)
177         case OpCvt64Fto32:
178                 return rewriteValuePPC64_OpCvt64Fto32(v)
179         case OpCvt64Fto32F:
180                 v.Op = OpPPC64FRSP
181                 return true
182         case OpCvt64Fto64:
183                 return rewriteValuePPC64_OpCvt64Fto64(v)
184         case OpCvt64to32F:
185                 return rewriteValuePPC64_OpCvt64to32F(v)
186         case OpCvt64to64F:
187                 return rewriteValuePPC64_OpCvt64to64F(v)
188         case OpCvtBoolToUint8:
189                 v.Op = OpCopy
190                 return true
191         case OpDiv16:
192                 return rewriteValuePPC64_OpDiv16(v)
193         case OpDiv16u:
194                 return rewriteValuePPC64_OpDiv16u(v)
195         case OpDiv32:
196                 return rewriteValuePPC64_OpDiv32(v)
197         case OpDiv32F:
198                 v.Op = OpPPC64FDIVS
199                 return true
200         case OpDiv32u:
201                 v.Op = OpPPC64DIVWU
202                 return true
203         case OpDiv64:
204                 return rewriteValuePPC64_OpDiv64(v)
205         case OpDiv64F:
206                 v.Op = OpPPC64FDIV
207                 return true
208         case OpDiv64u:
209                 v.Op = OpPPC64DIVDU
210                 return true
211         case OpDiv8:
212                 return rewriteValuePPC64_OpDiv8(v)
213         case OpDiv8u:
214                 return rewriteValuePPC64_OpDiv8u(v)
215         case OpEq16:
216                 return rewriteValuePPC64_OpEq16(v)
217         case OpEq32:
218                 return rewriteValuePPC64_OpEq32(v)
219         case OpEq32F:
220                 return rewriteValuePPC64_OpEq32F(v)
221         case OpEq64:
222                 return rewriteValuePPC64_OpEq64(v)
223         case OpEq64F:
224                 return rewriteValuePPC64_OpEq64F(v)
225         case OpEq8:
226                 return rewriteValuePPC64_OpEq8(v)
227         case OpEqB:
228                 return rewriteValuePPC64_OpEqB(v)
229         case OpEqPtr:
230                 return rewriteValuePPC64_OpEqPtr(v)
231         case OpFMA:
232                 v.Op = OpPPC64FMADD
233                 return true
234         case OpFloor:
235                 v.Op = OpPPC64FFLOOR
236                 return true
237         case OpGetCallerPC:
238                 v.Op = OpPPC64LoweredGetCallerPC
239                 return true
240         case OpGetCallerSP:
241                 v.Op = OpPPC64LoweredGetCallerSP
242                 return true
243         case OpGetClosurePtr:
244                 v.Op = OpPPC64LoweredGetClosurePtr
245                 return true
246         case OpHmul32:
247                 v.Op = OpPPC64MULHW
248                 return true
249         case OpHmul32u:
250                 v.Op = OpPPC64MULHWU
251                 return true
252         case OpHmul64:
253                 v.Op = OpPPC64MULHD
254                 return true
255         case OpHmul64u:
256                 v.Op = OpPPC64MULHDU
257                 return true
258         case OpInterCall:
259                 v.Op = OpPPC64CALLinter
260                 return true
261         case OpIsInBounds:
262                 return rewriteValuePPC64_OpIsInBounds(v)
263         case OpIsNonNil:
264                 return rewriteValuePPC64_OpIsNonNil(v)
265         case OpIsSliceInBounds:
266                 return rewriteValuePPC64_OpIsSliceInBounds(v)
267         case OpLeq16:
268                 return rewriteValuePPC64_OpLeq16(v)
269         case OpLeq16U:
270                 return rewriteValuePPC64_OpLeq16U(v)
271         case OpLeq32:
272                 return rewriteValuePPC64_OpLeq32(v)
273         case OpLeq32F:
274                 return rewriteValuePPC64_OpLeq32F(v)
275         case OpLeq32U:
276                 return rewriteValuePPC64_OpLeq32U(v)
277         case OpLeq64:
278                 return rewriteValuePPC64_OpLeq64(v)
279         case OpLeq64F:
280                 return rewriteValuePPC64_OpLeq64F(v)
281         case OpLeq64U:
282                 return rewriteValuePPC64_OpLeq64U(v)
283         case OpLeq8:
284                 return rewriteValuePPC64_OpLeq8(v)
285         case OpLeq8U:
286                 return rewriteValuePPC64_OpLeq8U(v)
287         case OpLess16:
288                 return rewriteValuePPC64_OpLess16(v)
289         case OpLess16U:
290                 return rewriteValuePPC64_OpLess16U(v)
291         case OpLess32:
292                 return rewriteValuePPC64_OpLess32(v)
293         case OpLess32F:
294                 return rewriteValuePPC64_OpLess32F(v)
295         case OpLess32U:
296                 return rewriteValuePPC64_OpLess32U(v)
297         case OpLess64:
298                 return rewriteValuePPC64_OpLess64(v)
299         case OpLess64F:
300                 return rewriteValuePPC64_OpLess64F(v)
301         case OpLess64U:
302                 return rewriteValuePPC64_OpLess64U(v)
303         case OpLess8:
304                 return rewriteValuePPC64_OpLess8(v)
305         case OpLess8U:
306                 return rewriteValuePPC64_OpLess8U(v)
307         case OpLoad:
308                 return rewriteValuePPC64_OpLoad(v)
309         case OpLocalAddr:
310                 return rewriteValuePPC64_OpLocalAddr(v)
311         case OpLsh16x16:
312                 return rewriteValuePPC64_OpLsh16x16(v)
313         case OpLsh16x32:
314                 return rewriteValuePPC64_OpLsh16x32(v)
315         case OpLsh16x64:
316                 return rewriteValuePPC64_OpLsh16x64(v)
317         case OpLsh16x8:
318                 return rewriteValuePPC64_OpLsh16x8(v)
319         case OpLsh32x16:
320                 return rewriteValuePPC64_OpLsh32x16(v)
321         case OpLsh32x32:
322                 return rewriteValuePPC64_OpLsh32x32(v)
323         case OpLsh32x64:
324                 return rewriteValuePPC64_OpLsh32x64(v)
325         case OpLsh32x8:
326                 return rewriteValuePPC64_OpLsh32x8(v)
327         case OpLsh64x16:
328                 return rewriteValuePPC64_OpLsh64x16(v)
329         case OpLsh64x32:
330                 return rewriteValuePPC64_OpLsh64x32(v)
331         case OpLsh64x64:
332                 return rewriteValuePPC64_OpLsh64x64(v)
333         case OpLsh64x8:
334                 return rewriteValuePPC64_OpLsh64x8(v)
335         case OpLsh8x16:
336                 return rewriteValuePPC64_OpLsh8x16(v)
337         case OpLsh8x32:
338                 return rewriteValuePPC64_OpLsh8x32(v)
339         case OpLsh8x64:
340                 return rewriteValuePPC64_OpLsh8x64(v)
341         case OpLsh8x8:
342                 return rewriteValuePPC64_OpLsh8x8(v)
343         case OpMod16:
344                 return rewriteValuePPC64_OpMod16(v)
345         case OpMod16u:
346                 return rewriteValuePPC64_OpMod16u(v)
347         case OpMod32:
348                 return rewriteValuePPC64_OpMod32(v)
349         case OpMod32u:
350                 return rewriteValuePPC64_OpMod32u(v)
351         case OpMod64:
352                 return rewriteValuePPC64_OpMod64(v)
353         case OpMod64u:
354                 return rewriteValuePPC64_OpMod64u(v)
355         case OpMod8:
356                 return rewriteValuePPC64_OpMod8(v)
357         case OpMod8u:
358                 return rewriteValuePPC64_OpMod8u(v)
359         case OpMove:
360                 return rewriteValuePPC64_OpMove(v)
361         case OpMul16:
362                 v.Op = OpPPC64MULLW
363                 return true
364         case OpMul32:
365                 v.Op = OpPPC64MULLW
366                 return true
367         case OpMul32F:
368                 v.Op = OpPPC64FMULS
369                 return true
370         case OpMul64:
371                 v.Op = OpPPC64MULLD
372                 return true
373         case OpMul64F:
374                 v.Op = OpPPC64FMUL
375                 return true
376         case OpMul8:
377                 v.Op = OpPPC64MULLW
378                 return true
379         case OpNeg16:
380                 v.Op = OpPPC64NEG
381                 return true
382         case OpNeg32:
383                 v.Op = OpPPC64NEG
384                 return true
385         case OpNeg32F:
386                 v.Op = OpPPC64FNEG
387                 return true
388         case OpNeg64:
389                 v.Op = OpPPC64NEG
390                 return true
391         case OpNeg64F:
392                 v.Op = OpPPC64FNEG
393                 return true
394         case OpNeg8:
395                 v.Op = OpPPC64NEG
396                 return true
397         case OpNeq16:
398                 return rewriteValuePPC64_OpNeq16(v)
399         case OpNeq32:
400                 return rewriteValuePPC64_OpNeq32(v)
401         case OpNeq32F:
402                 return rewriteValuePPC64_OpNeq32F(v)
403         case OpNeq64:
404                 return rewriteValuePPC64_OpNeq64(v)
405         case OpNeq64F:
406                 return rewriteValuePPC64_OpNeq64F(v)
407         case OpNeq8:
408                 return rewriteValuePPC64_OpNeq8(v)
409         case OpNeqB:
410                 v.Op = OpPPC64XOR
411                 return true
412         case OpNeqPtr:
413                 return rewriteValuePPC64_OpNeqPtr(v)
414         case OpNilCheck:
415                 v.Op = OpPPC64LoweredNilCheck
416                 return true
417         case OpNot:
418                 return rewriteValuePPC64_OpNot(v)
419         case OpOffPtr:
420                 return rewriteValuePPC64_OpOffPtr(v)
421         case OpOr16:
422                 v.Op = OpPPC64OR
423                 return true
424         case OpOr32:
425                 v.Op = OpPPC64OR
426                 return true
427         case OpOr64:
428                 v.Op = OpPPC64OR
429                 return true
430         case OpOr8:
431                 v.Op = OpPPC64OR
432                 return true
433         case OpOrB:
434                 v.Op = OpPPC64OR
435                 return true
436         case OpPPC64ADD:
437                 return rewriteValuePPC64_OpPPC64ADD(v)
438         case OpPPC64ADDE:
439                 return rewriteValuePPC64_OpPPC64ADDE(v)
440         case OpPPC64ADDconst:
441                 return rewriteValuePPC64_OpPPC64ADDconst(v)
442         case OpPPC64AND:
443                 return rewriteValuePPC64_OpPPC64AND(v)
444         case OpPPC64ANDCCconst:
445                 return rewriteValuePPC64_OpPPC64ANDCCconst(v)
446         case OpPPC64ANDN:
447                 return rewriteValuePPC64_OpPPC64ANDN(v)
448         case OpPPC64BRD:
449                 return rewriteValuePPC64_OpPPC64BRD(v)
450         case OpPPC64BRH:
451                 return rewriteValuePPC64_OpPPC64BRH(v)
452         case OpPPC64BRW:
453                 return rewriteValuePPC64_OpPPC64BRW(v)
454         case OpPPC64CLRLSLDI:
455                 return rewriteValuePPC64_OpPPC64CLRLSLDI(v)
456         case OpPPC64CMP:
457                 return rewriteValuePPC64_OpPPC64CMP(v)
458         case OpPPC64CMPU:
459                 return rewriteValuePPC64_OpPPC64CMPU(v)
460         case OpPPC64CMPUconst:
461                 return rewriteValuePPC64_OpPPC64CMPUconst(v)
462         case OpPPC64CMPW:
463                 return rewriteValuePPC64_OpPPC64CMPW(v)
464         case OpPPC64CMPWU:
465                 return rewriteValuePPC64_OpPPC64CMPWU(v)
466         case OpPPC64CMPWUconst:
467                 return rewriteValuePPC64_OpPPC64CMPWUconst(v)
468         case OpPPC64CMPWconst:
469                 return rewriteValuePPC64_OpPPC64CMPWconst(v)
470         case OpPPC64CMPconst:
471                 return rewriteValuePPC64_OpPPC64CMPconst(v)
472         case OpPPC64Equal:
473                 return rewriteValuePPC64_OpPPC64Equal(v)
474         case OpPPC64FABS:
475                 return rewriteValuePPC64_OpPPC64FABS(v)
476         case OpPPC64FADD:
477                 return rewriteValuePPC64_OpPPC64FADD(v)
478         case OpPPC64FADDS:
479                 return rewriteValuePPC64_OpPPC64FADDS(v)
480         case OpPPC64FCEIL:
481                 return rewriteValuePPC64_OpPPC64FCEIL(v)
482         case OpPPC64FFLOOR:
483                 return rewriteValuePPC64_OpPPC64FFLOOR(v)
484         case OpPPC64FGreaterEqual:
485                 return rewriteValuePPC64_OpPPC64FGreaterEqual(v)
486         case OpPPC64FGreaterThan:
487                 return rewriteValuePPC64_OpPPC64FGreaterThan(v)
488         case OpPPC64FLessEqual:
489                 return rewriteValuePPC64_OpPPC64FLessEqual(v)
490         case OpPPC64FLessThan:
491                 return rewriteValuePPC64_OpPPC64FLessThan(v)
492         case OpPPC64FMOVDload:
493                 return rewriteValuePPC64_OpPPC64FMOVDload(v)
494         case OpPPC64FMOVDstore:
495                 return rewriteValuePPC64_OpPPC64FMOVDstore(v)
496         case OpPPC64FMOVSload:
497                 return rewriteValuePPC64_OpPPC64FMOVSload(v)
498         case OpPPC64FMOVSstore:
499                 return rewriteValuePPC64_OpPPC64FMOVSstore(v)
500         case OpPPC64FNEG:
501                 return rewriteValuePPC64_OpPPC64FNEG(v)
502         case OpPPC64FSQRT:
503                 return rewriteValuePPC64_OpPPC64FSQRT(v)
504         case OpPPC64FSUB:
505                 return rewriteValuePPC64_OpPPC64FSUB(v)
506         case OpPPC64FSUBS:
507                 return rewriteValuePPC64_OpPPC64FSUBS(v)
508         case OpPPC64FTRUNC:
509                 return rewriteValuePPC64_OpPPC64FTRUNC(v)
510         case OpPPC64GreaterEqual:
511                 return rewriteValuePPC64_OpPPC64GreaterEqual(v)
512         case OpPPC64GreaterThan:
513                 return rewriteValuePPC64_OpPPC64GreaterThan(v)
514         case OpPPC64ISEL:
515                 return rewriteValuePPC64_OpPPC64ISEL(v)
516         case OpPPC64LessEqual:
517                 return rewriteValuePPC64_OpPPC64LessEqual(v)
518         case OpPPC64LessThan:
519                 return rewriteValuePPC64_OpPPC64LessThan(v)
520         case OpPPC64MFVSRD:
521                 return rewriteValuePPC64_OpPPC64MFVSRD(v)
522         case OpPPC64MOVBZload:
523                 return rewriteValuePPC64_OpPPC64MOVBZload(v)
524         case OpPPC64MOVBZloadidx:
525                 return rewriteValuePPC64_OpPPC64MOVBZloadidx(v)
526         case OpPPC64MOVBZreg:
527                 return rewriteValuePPC64_OpPPC64MOVBZreg(v)
528         case OpPPC64MOVBreg:
529                 return rewriteValuePPC64_OpPPC64MOVBreg(v)
530         case OpPPC64MOVBstore:
531                 return rewriteValuePPC64_OpPPC64MOVBstore(v)
532         case OpPPC64MOVBstoreidx:
533                 return rewriteValuePPC64_OpPPC64MOVBstoreidx(v)
534         case OpPPC64MOVBstorezero:
535                 return rewriteValuePPC64_OpPPC64MOVBstorezero(v)
536         case OpPPC64MOVDload:
537                 return rewriteValuePPC64_OpPPC64MOVDload(v)
538         case OpPPC64MOVDloadidx:
539                 return rewriteValuePPC64_OpPPC64MOVDloadidx(v)
540         case OpPPC64MOVDstore:
541                 return rewriteValuePPC64_OpPPC64MOVDstore(v)
542         case OpPPC64MOVDstoreidx:
543                 return rewriteValuePPC64_OpPPC64MOVDstoreidx(v)
544         case OpPPC64MOVDstorezero:
545                 return rewriteValuePPC64_OpPPC64MOVDstorezero(v)
546         case OpPPC64MOVHBRstore:
547                 return rewriteValuePPC64_OpPPC64MOVHBRstore(v)
548         case OpPPC64MOVHZload:
549                 return rewriteValuePPC64_OpPPC64MOVHZload(v)
550         case OpPPC64MOVHZloadidx:
551                 return rewriteValuePPC64_OpPPC64MOVHZloadidx(v)
552         case OpPPC64MOVHZreg:
553                 return rewriteValuePPC64_OpPPC64MOVHZreg(v)
554         case OpPPC64MOVHload:
555                 return rewriteValuePPC64_OpPPC64MOVHload(v)
556         case OpPPC64MOVHloadidx:
557                 return rewriteValuePPC64_OpPPC64MOVHloadidx(v)
558         case OpPPC64MOVHreg:
559                 return rewriteValuePPC64_OpPPC64MOVHreg(v)
560         case OpPPC64MOVHstore:
561                 return rewriteValuePPC64_OpPPC64MOVHstore(v)
562         case OpPPC64MOVHstoreidx:
563                 return rewriteValuePPC64_OpPPC64MOVHstoreidx(v)
564         case OpPPC64MOVHstorezero:
565                 return rewriteValuePPC64_OpPPC64MOVHstorezero(v)
566         case OpPPC64MOVWBRstore:
567                 return rewriteValuePPC64_OpPPC64MOVWBRstore(v)
568         case OpPPC64MOVWZload:
569                 return rewriteValuePPC64_OpPPC64MOVWZload(v)
570         case OpPPC64MOVWZloadidx:
571                 return rewriteValuePPC64_OpPPC64MOVWZloadidx(v)
572         case OpPPC64MOVWZreg:
573                 return rewriteValuePPC64_OpPPC64MOVWZreg(v)
574         case OpPPC64MOVWload:
575                 return rewriteValuePPC64_OpPPC64MOVWload(v)
576         case OpPPC64MOVWloadidx:
577                 return rewriteValuePPC64_OpPPC64MOVWloadidx(v)
578         case OpPPC64MOVWreg:
579                 return rewriteValuePPC64_OpPPC64MOVWreg(v)
580         case OpPPC64MOVWstore:
581                 return rewriteValuePPC64_OpPPC64MOVWstore(v)
582         case OpPPC64MOVWstoreidx:
583                 return rewriteValuePPC64_OpPPC64MOVWstoreidx(v)
584         case OpPPC64MOVWstorezero:
585                 return rewriteValuePPC64_OpPPC64MOVWstorezero(v)
586         case OpPPC64MTVSRD:
587                 return rewriteValuePPC64_OpPPC64MTVSRD(v)
588         case OpPPC64MULLD:
589                 return rewriteValuePPC64_OpPPC64MULLD(v)
590         case OpPPC64MULLW:
591                 return rewriteValuePPC64_OpPPC64MULLW(v)
592         case OpPPC64NEG:
593                 return rewriteValuePPC64_OpPPC64NEG(v)
594         case OpPPC64NOR:
595                 return rewriteValuePPC64_OpPPC64NOR(v)
596         case OpPPC64NotEqual:
597                 return rewriteValuePPC64_OpPPC64NotEqual(v)
598         case OpPPC64OR:
599                 return rewriteValuePPC64_OpPPC64OR(v)
600         case OpPPC64ORN:
601                 return rewriteValuePPC64_OpPPC64ORN(v)
602         case OpPPC64ORconst:
603                 return rewriteValuePPC64_OpPPC64ORconst(v)
604         case OpPPC64ROTL:
605                 return rewriteValuePPC64_OpPPC64ROTL(v)
606         case OpPPC64ROTLW:
607                 return rewriteValuePPC64_OpPPC64ROTLW(v)
608         case OpPPC64ROTLWconst:
609                 return rewriteValuePPC64_OpPPC64ROTLWconst(v)
610         case OpPPC64SETBC:
611                 return rewriteValuePPC64_OpPPC64SETBC(v)
612         case OpPPC64SETBCR:
613                 return rewriteValuePPC64_OpPPC64SETBCR(v)
614         case OpPPC64SLD:
615                 return rewriteValuePPC64_OpPPC64SLD(v)
616         case OpPPC64SLDconst:
617                 return rewriteValuePPC64_OpPPC64SLDconst(v)
618         case OpPPC64SLW:
619                 return rewriteValuePPC64_OpPPC64SLW(v)
620         case OpPPC64SLWconst:
621                 return rewriteValuePPC64_OpPPC64SLWconst(v)
622         case OpPPC64SRAD:
623                 return rewriteValuePPC64_OpPPC64SRAD(v)
624         case OpPPC64SRAW:
625                 return rewriteValuePPC64_OpPPC64SRAW(v)
626         case OpPPC64SRD:
627                 return rewriteValuePPC64_OpPPC64SRD(v)
628         case OpPPC64SRW:
629                 return rewriteValuePPC64_OpPPC64SRW(v)
630         case OpPPC64SRWconst:
631                 return rewriteValuePPC64_OpPPC64SRWconst(v)
632         case OpPPC64SUB:
633                 return rewriteValuePPC64_OpPPC64SUB(v)
634         case OpPPC64SUBE:
635                 return rewriteValuePPC64_OpPPC64SUBE(v)
636         case OpPPC64SUBFCconst:
637                 return rewriteValuePPC64_OpPPC64SUBFCconst(v)
638         case OpPPC64XOR:
639                 return rewriteValuePPC64_OpPPC64XOR(v)
640         case OpPPC64XORconst:
641                 return rewriteValuePPC64_OpPPC64XORconst(v)
642         case OpPanicBounds:
643                 return rewriteValuePPC64_OpPanicBounds(v)
644         case OpPopCount16:
645                 return rewriteValuePPC64_OpPopCount16(v)
646         case OpPopCount32:
647                 return rewriteValuePPC64_OpPopCount32(v)
648         case OpPopCount64:
649                 v.Op = OpPPC64POPCNTD
650                 return true
651         case OpPopCount8:
652                 return rewriteValuePPC64_OpPopCount8(v)
653         case OpPrefetchCache:
654                 return rewriteValuePPC64_OpPrefetchCache(v)
655         case OpPrefetchCacheStreamed:
656                 return rewriteValuePPC64_OpPrefetchCacheStreamed(v)
657         case OpPubBarrier:
658                 v.Op = OpPPC64LoweredPubBarrier
659                 return true
660         case OpRotateLeft16:
661                 return rewriteValuePPC64_OpRotateLeft16(v)
662         case OpRotateLeft32:
663                 v.Op = OpPPC64ROTLW
664                 return true
665         case OpRotateLeft64:
666                 v.Op = OpPPC64ROTL
667                 return true
668         case OpRotateLeft8:
669                 return rewriteValuePPC64_OpRotateLeft8(v)
670         case OpRound:
671                 v.Op = OpPPC64FROUND
672                 return true
673         case OpRound32F:
674                 v.Op = OpPPC64LoweredRound32F
675                 return true
676         case OpRound64F:
677                 v.Op = OpPPC64LoweredRound64F
678                 return true
679         case OpRsh16Ux16:
680                 return rewriteValuePPC64_OpRsh16Ux16(v)
681         case OpRsh16Ux32:
682                 return rewriteValuePPC64_OpRsh16Ux32(v)
683         case OpRsh16Ux64:
684                 return rewriteValuePPC64_OpRsh16Ux64(v)
685         case OpRsh16Ux8:
686                 return rewriteValuePPC64_OpRsh16Ux8(v)
687         case OpRsh16x16:
688                 return rewriteValuePPC64_OpRsh16x16(v)
689         case OpRsh16x32:
690                 return rewriteValuePPC64_OpRsh16x32(v)
691         case OpRsh16x64:
692                 return rewriteValuePPC64_OpRsh16x64(v)
693         case OpRsh16x8:
694                 return rewriteValuePPC64_OpRsh16x8(v)
695         case OpRsh32Ux16:
696                 return rewriteValuePPC64_OpRsh32Ux16(v)
697         case OpRsh32Ux32:
698                 return rewriteValuePPC64_OpRsh32Ux32(v)
699         case OpRsh32Ux64:
700                 return rewriteValuePPC64_OpRsh32Ux64(v)
701         case OpRsh32Ux8:
702                 return rewriteValuePPC64_OpRsh32Ux8(v)
703         case OpRsh32x16:
704                 return rewriteValuePPC64_OpRsh32x16(v)
705         case OpRsh32x32:
706                 return rewriteValuePPC64_OpRsh32x32(v)
707         case OpRsh32x64:
708                 return rewriteValuePPC64_OpRsh32x64(v)
709         case OpRsh32x8:
710                 return rewriteValuePPC64_OpRsh32x8(v)
711         case OpRsh64Ux16:
712                 return rewriteValuePPC64_OpRsh64Ux16(v)
713         case OpRsh64Ux32:
714                 return rewriteValuePPC64_OpRsh64Ux32(v)
715         case OpRsh64Ux64:
716                 return rewriteValuePPC64_OpRsh64Ux64(v)
717         case OpRsh64Ux8:
718                 return rewriteValuePPC64_OpRsh64Ux8(v)
719         case OpRsh64x16:
720                 return rewriteValuePPC64_OpRsh64x16(v)
721         case OpRsh64x32:
722                 return rewriteValuePPC64_OpRsh64x32(v)
723         case OpRsh64x64:
724                 return rewriteValuePPC64_OpRsh64x64(v)
725         case OpRsh64x8:
726                 return rewriteValuePPC64_OpRsh64x8(v)
727         case OpRsh8Ux16:
728                 return rewriteValuePPC64_OpRsh8Ux16(v)
729         case OpRsh8Ux32:
730                 return rewriteValuePPC64_OpRsh8Ux32(v)
731         case OpRsh8Ux64:
732                 return rewriteValuePPC64_OpRsh8Ux64(v)
733         case OpRsh8Ux8:
734                 return rewriteValuePPC64_OpRsh8Ux8(v)
735         case OpRsh8x16:
736                 return rewriteValuePPC64_OpRsh8x16(v)
737         case OpRsh8x32:
738                 return rewriteValuePPC64_OpRsh8x32(v)
739         case OpRsh8x64:
740                 return rewriteValuePPC64_OpRsh8x64(v)
741         case OpRsh8x8:
742                 return rewriteValuePPC64_OpRsh8x8(v)
743         case OpSelect0:
744                 return rewriteValuePPC64_OpSelect0(v)
745         case OpSelect1:
746                 return rewriteValuePPC64_OpSelect1(v)
747         case OpSelectN:
748                 return rewriteValuePPC64_OpSelectN(v)
749         case OpSignExt16to32:
750                 v.Op = OpPPC64MOVHreg
751                 return true
752         case OpSignExt16to64:
753                 v.Op = OpPPC64MOVHreg
754                 return true
755         case OpSignExt32to64:
756                 v.Op = OpPPC64MOVWreg
757                 return true
758         case OpSignExt8to16:
759                 v.Op = OpPPC64MOVBreg
760                 return true
761         case OpSignExt8to32:
762                 v.Op = OpPPC64MOVBreg
763                 return true
764         case OpSignExt8to64:
765                 v.Op = OpPPC64MOVBreg
766                 return true
767         case OpSlicemask:
768                 return rewriteValuePPC64_OpSlicemask(v)
769         case OpSqrt:
770                 v.Op = OpPPC64FSQRT
771                 return true
772         case OpSqrt32:
773                 v.Op = OpPPC64FSQRTS
774                 return true
775         case OpStaticCall:
776                 v.Op = OpPPC64CALLstatic
777                 return true
778         case OpStore:
779                 return rewriteValuePPC64_OpStore(v)
780         case OpSub16:
781                 v.Op = OpPPC64SUB
782                 return true
783         case OpSub32:
784                 v.Op = OpPPC64SUB
785                 return true
786         case OpSub32F:
787                 v.Op = OpPPC64FSUBS
788                 return true
789         case OpSub64:
790                 v.Op = OpPPC64SUB
791                 return true
792         case OpSub64F:
793                 v.Op = OpPPC64FSUB
794                 return true
795         case OpSub8:
796                 v.Op = OpPPC64SUB
797                 return true
798         case OpSubPtr:
799                 v.Op = OpPPC64SUB
800                 return true
801         case OpTailCall:
802                 v.Op = OpPPC64CALLtail
803                 return true
804         case OpTrunc:
805                 v.Op = OpPPC64FTRUNC
806                 return true
807         case OpTrunc16to8:
808                 return rewriteValuePPC64_OpTrunc16to8(v)
809         case OpTrunc32to16:
810                 return rewriteValuePPC64_OpTrunc32to16(v)
811         case OpTrunc32to8:
812                 return rewriteValuePPC64_OpTrunc32to8(v)
813         case OpTrunc64to16:
814                 return rewriteValuePPC64_OpTrunc64to16(v)
815         case OpTrunc64to32:
816                 return rewriteValuePPC64_OpTrunc64to32(v)
817         case OpTrunc64to8:
818                 return rewriteValuePPC64_OpTrunc64to8(v)
819         case OpWB:
820                 v.Op = OpPPC64LoweredWB
821                 return true
822         case OpXor16:
823                 v.Op = OpPPC64XOR
824                 return true
825         case OpXor32:
826                 v.Op = OpPPC64XOR
827                 return true
828         case OpXor64:
829                 v.Op = OpPPC64XOR
830                 return true
831         case OpXor8:
832                 v.Op = OpPPC64XOR
833                 return true
834         case OpZero:
835                 return rewriteValuePPC64_OpZero(v)
836         case OpZeroExt16to32:
837                 v.Op = OpPPC64MOVHZreg
838                 return true
839         case OpZeroExt16to64:
840                 v.Op = OpPPC64MOVHZreg
841                 return true
842         case OpZeroExt32to64:
843                 v.Op = OpPPC64MOVWZreg
844                 return true
845         case OpZeroExt8to16:
846                 v.Op = OpPPC64MOVBZreg
847                 return true
848         case OpZeroExt8to32:
849                 v.Op = OpPPC64MOVBZreg
850                 return true
851         case OpZeroExt8to64:
852                 v.Op = OpPPC64MOVBZreg
853                 return true
854         }
855         return false
856 }
857 func rewriteValuePPC64_OpAddr(v *Value) bool {
858         v_0 := v.Args[0]
859         // match: (Addr {sym} base)
860         // result: (MOVDaddr {sym} [0] base)
861         for {
862                 sym := auxToSym(v.Aux)
863                 base := v_0
864                 v.reset(OpPPC64MOVDaddr)
865                 v.AuxInt = int32ToAuxInt(0)
866                 v.Aux = symToAux(sym)
867                 v.AddArg(base)
868                 return true
869         }
870 }
871 func rewriteValuePPC64_OpAtomicCompareAndSwap32(v *Value) bool {
872         v_3 := v.Args[3]
873         v_2 := v.Args[2]
874         v_1 := v.Args[1]
875         v_0 := v.Args[0]
876         // match: (AtomicCompareAndSwap32 ptr old new_ mem)
877         // result: (LoweredAtomicCas32 [1] ptr old new_ mem)
878         for {
879                 ptr := v_0
880                 old := v_1
881                 new_ := v_2
882                 mem := v_3
883                 v.reset(OpPPC64LoweredAtomicCas32)
884                 v.AuxInt = int64ToAuxInt(1)
885                 v.AddArg4(ptr, old, new_, mem)
886                 return true
887         }
888 }
889 func rewriteValuePPC64_OpAtomicCompareAndSwap64(v *Value) bool {
890         v_3 := v.Args[3]
891         v_2 := v.Args[2]
892         v_1 := v.Args[1]
893         v_0 := v.Args[0]
894         // match: (AtomicCompareAndSwap64 ptr old new_ mem)
895         // result: (LoweredAtomicCas64 [1] ptr old new_ mem)
896         for {
897                 ptr := v_0
898                 old := v_1
899                 new_ := v_2
900                 mem := v_3
901                 v.reset(OpPPC64LoweredAtomicCas64)
902                 v.AuxInt = int64ToAuxInt(1)
903                 v.AddArg4(ptr, old, new_, mem)
904                 return true
905         }
906 }
907 func rewriteValuePPC64_OpAtomicCompareAndSwapRel32(v *Value) bool {
908         v_3 := v.Args[3]
909         v_2 := v.Args[2]
910         v_1 := v.Args[1]
911         v_0 := v.Args[0]
912         // match: (AtomicCompareAndSwapRel32 ptr old new_ mem)
913         // result: (LoweredAtomicCas32 [0] ptr old new_ mem)
914         for {
915                 ptr := v_0
916                 old := v_1
917                 new_ := v_2
918                 mem := v_3
919                 v.reset(OpPPC64LoweredAtomicCas32)
920                 v.AuxInt = int64ToAuxInt(0)
921                 v.AddArg4(ptr, old, new_, mem)
922                 return true
923         }
924 }
925 func rewriteValuePPC64_OpAtomicLoad32(v *Value) bool {
926         v_1 := v.Args[1]
927         v_0 := v.Args[0]
928         // match: (AtomicLoad32 ptr mem)
929         // result: (LoweredAtomicLoad32 [1] ptr mem)
930         for {
931                 ptr := v_0
932                 mem := v_1
933                 v.reset(OpPPC64LoweredAtomicLoad32)
934                 v.AuxInt = int64ToAuxInt(1)
935                 v.AddArg2(ptr, mem)
936                 return true
937         }
938 }
939 func rewriteValuePPC64_OpAtomicLoad64(v *Value) bool {
940         v_1 := v.Args[1]
941         v_0 := v.Args[0]
942         // match: (AtomicLoad64 ptr mem)
943         // result: (LoweredAtomicLoad64 [1] ptr mem)
944         for {
945                 ptr := v_0
946                 mem := v_1
947                 v.reset(OpPPC64LoweredAtomicLoad64)
948                 v.AuxInt = int64ToAuxInt(1)
949                 v.AddArg2(ptr, mem)
950                 return true
951         }
952 }
953 func rewriteValuePPC64_OpAtomicLoad8(v *Value) bool {
954         v_1 := v.Args[1]
955         v_0 := v.Args[0]
956         // match: (AtomicLoad8 ptr mem)
957         // result: (LoweredAtomicLoad8 [1] ptr mem)
958         for {
959                 ptr := v_0
960                 mem := v_1
961                 v.reset(OpPPC64LoweredAtomicLoad8)
962                 v.AuxInt = int64ToAuxInt(1)
963                 v.AddArg2(ptr, mem)
964                 return true
965         }
966 }
967 func rewriteValuePPC64_OpAtomicLoadAcq32(v *Value) bool {
968         v_1 := v.Args[1]
969         v_0 := v.Args[0]
970         // match: (AtomicLoadAcq32 ptr mem)
971         // result: (LoweredAtomicLoad32 [0] ptr mem)
972         for {
973                 ptr := v_0
974                 mem := v_1
975                 v.reset(OpPPC64LoweredAtomicLoad32)
976                 v.AuxInt = int64ToAuxInt(0)
977                 v.AddArg2(ptr, mem)
978                 return true
979         }
980 }
981 func rewriteValuePPC64_OpAtomicLoadAcq64(v *Value) bool {
982         v_1 := v.Args[1]
983         v_0 := v.Args[0]
984         // match: (AtomicLoadAcq64 ptr mem)
985         // result: (LoweredAtomicLoad64 [0] ptr mem)
986         for {
987                 ptr := v_0
988                 mem := v_1
989                 v.reset(OpPPC64LoweredAtomicLoad64)
990                 v.AuxInt = int64ToAuxInt(0)
991                 v.AddArg2(ptr, mem)
992                 return true
993         }
994 }
995 func rewriteValuePPC64_OpAtomicLoadPtr(v *Value) bool {
996         v_1 := v.Args[1]
997         v_0 := v.Args[0]
998         // match: (AtomicLoadPtr ptr mem)
999         // result: (LoweredAtomicLoadPtr [1] ptr mem)
1000         for {
1001                 ptr := v_0
1002                 mem := v_1
1003                 v.reset(OpPPC64LoweredAtomicLoadPtr)
1004                 v.AuxInt = int64ToAuxInt(1)
1005                 v.AddArg2(ptr, mem)
1006                 return true
1007         }
1008 }
1009 func rewriteValuePPC64_OpAtomicStore32(v *Value) bool {
1010         v_2 := v.Args[2]
1011         v_1 := v.Args[1]
1012         v_0 := v.Args[0]
1013         // match: (AtomicStore32 ptr val mem)
1014         // result: (LoweredAtomicStore32 [1] ptr val mem)
1015         for {
1016                 ptr := v_0
1017                 val := v_1
1018                 mem := v_2
1019                 v.reset(OpPPC64LoweredAtomicStore32)
1020                 v.AuxInt = int64ToAuxInt(1)
1021                 v.AddArg3(ptr, val, mem)
1022                 return true
1023         }
1024 }
1025 func rewriteValuePPC64_OpAtomicStore64(v *Value) bool {
1026         v_2 := v.Args[2]
1027         v_1 := v.Args[1]
1028         v_0 := v.Args[0]
1029         // match: (AtomicStore64 ptr val mem)
1030         // result: (LoweredAtomicStore64 [1] ptr val mem)
1031         for {
1032                 ptr := v_0
1033                 val := v_1
1034                 mem := v_2
1035                 v.reset(OpPPC64LoweredAtomicStore64)
1036                 v.AuxInt = int64ToAuxInt(1)
1037                 v.AddArg3(ptr, val, mem)
1038                 return true
1039         }
1040 }
1041 func rewriteValuePPC64_OpAtomicStore8(v *Value) bool {
1042         v_2 := v.Args[2]
1043         v_1 := v.Args[1]
1044         v_0 := v.Args[0]
1045         // match: (AtomicStore8 ptr val mem)
1046         // result: (LoweredAtomicStore8 [1] ptr val mem)
1047         for {
1048                 ptr := v_0
1049                 val := v_1
1050                 mem := v_2
1051                 v.reset(OpPPC64LoweredAtomicStore8)
1052                 v.AuxInt = int64ToAuxInt(1)
1053                 v.AddArg3(ptr, val, mem)
1054                 return true
1055         }
1056 }
1057 func rewriteValuePPC64_OpAtomicStoreRel32(v *Value) bool {
1058         v_2 := v.Args[2]
1059         v_1 := v.Args[1]
1060         v_0 := v.Args[0]
1061         // match: (AtomicStoreRel32 ptr val mem)
1062         // result: (LoweredAtomicStore32 [0] ptr val mem)
1063         for {
1064                 ptr := v_0
1065                 val := v_1
1066                 mem := v_2
1067                 v.reset(OpPPC64LoweredAtomicStore32)
1068                 v.AuxInt = int64ToAuxInt(0)
1069                 v.AddArg3(ptr, val, mem)
1070                 return true
1071         }
1072 }
1073 func rewriteValuePPC64_OpAtomicStoreRel64(v *Value) bool {
1074         v_2 := v.Args[2]
1075         v_1 := v.Args[1]
1076         v_0 := v.Args[0]
1077         // match: (AtomicStoreRel64 ptr val mem)
1078         // result: (LoweredAtomicStore64 [0] ptr val mem)
1079         for {
1080                 ptr := v_0
1081                 val := v_1
1082                 mem := v_2
1083                 v.reset(OpPPC64LoweredAtomicStore64)
1084                 v.AuxInt = int64ToAuxInt(0)
1085                 v.AddArg3(ptr, val, mem)
1086                 return true
1087         }
1088 }
1089 func rewriteValuePPC64_OpAvg64u(v *Value) bool {
1090         v_1 := v.Args[1]
1091         v_0 := v.Args[0]
1092         b := v.Block
1093         // match: (Avg64u <t> x y)
1094         // result: (ADD (SRDconst <t> (SUB <t> x y) [1]) y)
1095         for {
1096                 t := v.Type
1097                 x := v_0
1098                 y := v_1
1099                 v.reset(OpPPC64ADD)
1100                 v0 := b.NewValue0(v.Pos, OpPPC64SRDconst, t)
1101                 v0.AuxInt = int64ToAuxInt(1)
1102                 v1 := b.NewValue0(v.Pos, OpPPC64SUB, t)
1103                 v1.AddArg2(x, y)
1104                 v0.AddArg(v1)
1105                 v.AddArg2(v0, y)
1106                 return true
1107         }
1108 }
1109 func rewriteValuePPC64_OpBitLen32(v *Value) bool {
1110         v_0 := v.Args[0]
1111         b := v.Block
1112         typ := &b.Func.Config.Types
1113         // match: (BitLen32 x)
1114         // result: (SUBFCconst [32] (CNTLZW <typ.Int> x))
1115         for {
1116                 x := v_0
1117                 v.reset(OpPPC64SUBFCconst)
1118                 v.AuxInt = int64ToAuxInt(32)
1119                 v0 := b.NewValue0(v.Pos, OpPPC64CNTLZW, typ.Int)
1120                 v0.AddArg(x)
1121                 v.AddArg(v0)
1122                 return true
1123         }
1124 }
1125 func rewriteValuePPC64_OpBitLen64(v *Value) bool {
1126         v_0 := v.Args[0]
1127         b := v.Block
1128         typ := &b.Func.Config.Types
1129         // match: (BitLen64 x)
1130         // result: (SUBFCconst [64] (CNTLZD <typ.Int> x))
1131         for {
1132                 x := v_0
1133                 v.reset(OpPPC64SUBFCconst)
1134                 v.AuxInt = int64ToAuxInt(64)
1135                 v0 := b.NewValue0(v.Pos, OpPPC64CNTLZD, typ.Int)
1136                 v0.AddArg(x)
1137                 v.AddArg(v0)
1138                 return true
1139         }
1140 }
1141 func rewriteValuePPC64_OpBswap16(v *Value) bool {
1142         v_0 := v.Args[0]
1143         b := v.Block
1144         typ := &b.Func.Config.Types
1145         // match: (Bswap16 x)
1146         // cond: buildcfg.GOPPC64>=10
1147         // result: (BRH x)
1148         for {
1149                 x := v_0
1150                 if !(buildcfg.GOPPC64 >= 10) {
1151                         break
1152                 }
1153                 v.reset(OpPPC64BRH)
1154                 v.AddArg(x)
1155                 return true
1156         }
1157         // match: (Bswap16 x:(MOVHZload [off] {sym} ptr mem))
1158         // result: @x.Block (MOVHBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
1159         for {
1160                 x := v_0
1161                 if x.Op != OpPPC64MOVHZload {
1162                         break
1163                 }
1164                 off := auxIntToInt32(x.AuxInt)
1165                 sym := auxToSym(x.Aux)
1166                 mem := x.Args[1]
1167                 ptr := x.Args[0]
1168                 b = x.Block
1169                 v0 := b.NewValue0(x.Pos, OpPPC64MOVHBRload, typ.UInt16)
1170                 v.copyOf(v0)
1171                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
1172                 v1.AuxInt = int32ToAuxInt(off)
1173                 v1.Aux = symToAux(sym)
1174                 v1.AddArg(ptr)
1175                 v0.AddArg2(v1, mem)
1176                 return true
1177         }
1178         // match: (Bswap16 x:(MOVHZloadidx ptr idx mem))
1179         // result: @x.Block (MOVHZreg (MOVHBRloadidx ptr idx mem))
1180         for {
1181                 x := v_0
1182                 if x.Op != OpPPC64MOVHZloadidx {
1183                         break
1184                 }
1185                 mem := x.Args[2]
1186                 ptr := x.Args[0]
1187                 idx := x.Args[1]
1188                 b = x.Block
1189                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
1190                 v.copyOf(v0)
1191                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHBRloadidx, typ.Int16)
1192                 v1.AddArg3(ptr, idx, mem)
1193                 v0.AddArg(v1)
1194                 return true
1195         }
1196         return false
1197 }
1198 func rewriteValuePPC64_OpBswap32(v *Value) bool {
1199         v_0 := v.Args[0]
1200         b := v.Block
1201         typ := &b.Func.Config.Types
1202         // match: (Bswap32 x)
1203         // cond: buildcfg.GOPPC64>=10
1204         // result: (BRW x)
1205         for {
1206                 x := v_0
1207                 if !(buildcfg.GOPPC64 >= 10) {
1208                         break
1209                 }
1210                 v.reset(OpPPC64BRW)
1211                 v.AddArg(x)
1212                 return true
1213         }
1214         // match: (Bswap32 x:(MOVWZload [off] {sym} ptr mem))
1215         // result: @x.Block (MOVWBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
1216         for {
1217                 x := v_0
1218                 if x.Op != OpPPC64MOVWZload {
1219                         break
1220                 }
1221                 off := auxIntToInt32(x.AuxInt)
1222                 sym := auxToSym(x.Aux)
1223                 mem := x.Args[1]
1224                 ptr := x.Args[0]
1225                 b = x.Block
1226                 v0 := b.NewValue0(x.Pos, OpPPC64MOVWBRload, typ.UInt32)
1227                 v.copyOf(v0)
1228                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
1229                 v1.AuxInt = int32ToAuxInt(off)
1230                 v1.Aux = symToAux(sym)
1231                 v1.AddArg(ptr)
1232                 v0.AddArg2(v1, mem)
1233                 return true
1234         }
1235         // match: (Bswap32 x:(MOVWZloadidx ptr idx mem))
1236         // result: @x.Block (MOVWZreg (MOVWBRloadidx ptr idx mem))
1237         for {
1238                 x := v_0
1239                 if x.Op != OpPPC64MOVWZloadidx {
1240                         break
1241                 }
1242                 mem := x.Args[2]
1243                 ptr := x.Args[0]
1244                 idx := x.Args[1]
1245                 b = x.Block
1246                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
1247                 v.copyOf(v0)
1248                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWBRloadidx, typ.Int32)
1249                 v1.AddArg3(ptr, idx, mem)
1250                 v0.AddArg(v1)
1251                 return true
1252         }
1253         return false
1254 }
1255 func rewriteValuePPC64_OpBswap64(v *Value) bool {
1256         v_0 := v.Args[0]
1257         b := v.Block
1258         typ := &b.Func.Config.Types
1259         // match: (Bswap64 x)
1260         // cond: buildcfg.GOPPC64>=10
1261         // result: (BRD x)
1262         for {
1263                 x := v_0
1264                 if !(buildcfg.GOPPC64 >= 10) {
1265                         break
1266                 }
1267                 v.reset(OpPPC64BRD)
1268                 v.AddArg(x)
1269                 return true
1270         }
1271         // match: (Bswap64 x:(MOVDload [off] {sym} ptr mem))
1272         // result: @x.Block (MOVDBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
1273         for {
1274                 x := v_0
1275                 if x.Op != OpPPC64MOVDload {
1276                         break
1277                 }
1278                 off := auxIntToInt32(x.AuxInt)
1279                 sym := auxToSym(x.Aux)
1280                 mem := x.Args[1]
1281                 ptr := x.Args[0]
1282                 b = x.Block
1283                 v0 := b.NewValue0(x.Pos, OpPPC64MOVDBRload, typ.UInt64)
1284                 v.copyOf(v0)
1285                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
1286                 v1.AuxInt = int32ToAuxInt(off)
1287                 v1.Aux = symToAux(sym)
1288                 v1.AddArg(ptr)
1289                 v0.AddArg2(v1, mem)
1290                 return true
1291         }
1292         // match: (Bswap64 x:(MOVDloadidx ptr idx mem))
1293         // result: @x.Block (MOVDBRloadidx ptr idx mem)
1294         for {
1295                 x := v_0
1296                 if x.Op != OpPPC64MOVDloadidx {
1297                         break
1298                 }
1299                 mem := x.Args[2]
1300                 ptr := x.Args[0]
1301                 idx := x.Args[1]
1302                 b = x.Block
1303                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRloadidx, typ.Int64)
1304                 v.copyOf(v0)
1305                 v0.AddArg3(ptr, idx, mem)
1306                 return true
1307         }
1308         return false
1309 }
1310 func rewriteValuePPC64_OpCom16(v *Value) bool {
1311         v_0 := v.Args[0]
1312         // match: (Com16 x)
1313         // result: (NOR x x)
1314         for {
1315                 x := v_0
1316                 v.reset(OpPPC64NOR)
1317                 v.AddArg2(x, x)
1318                 return true
1319         }
1320 }
1321 func rewriteValuePPC64_OpCom32(v *Value) bool {
1322         v_0 := v.Args[0]
1323         // match: (Com32 x)
1324         // result: (NOR x x)
1325         for {
1326                 x := v_0
1327                 v.reset(OpPPC64NOR)
1328                 v.AddArg2(x, x)
1329                 return true
1330         }
1331 }
1332 func rewriteValuePPC64_OpCom64(v *Value) bool {
1333         v_0 := v.Args[0]
1334         // match: (Com64 x)
1335         // result: (NOR x x)
1336         for {
1337                 x := v_0
1338                 v.reset(OpPPC64NOR)
1339                 v.AddArg2(x, x)
1340                 return true
1341         }
1342 }
1343 func rewriteValuePPC64_OpCom8(v *Value) bool {
1344         v_0 := v.Args[0]
1345         // match: (Com8 x)
1346         // result: (NOR x x)
1347         for {
1348                 x := v_0
1349                 v.reset(OpPPC64NOR)
1350                 v.AddArg2(x, x)
1351                 return true
1352         }
1353 }
1354 func rewriteValuePPC64_OpCondSelect(v *Value) bool {
1355         v_2 := v.Args[2]
1356         v_1 := v.Args[1]
1357         v_0 := v.Args[0]
1358         b := v.Block
1359         typ := &b.Func.Config.Types
1360         // match: (CondSelect x y (SETBC [a] cmp))
1361         // result: (ISEL [a] x y cmp)
1362         for {
1363                 x := v_0
1364                 y := v_1
1365                 if v_2.Op != OpPPC64SETBC {
1366                         break
1367                 }
1368                 a := auxIntToInt32(v_2.AuxInt)
1369                 cmp := v_2.Args[0]
1370                 v.reset(OpPPC64ISEL)
1371                 v.AuxInt = int32ToAuxInt(a)
1372                 v.AddArg3(x, y, cmp)
1373                 return true
1374         }
1375         // match: (CondSelect x y (SETBCR [a] cmp))
1376         // result: (ISEL [a+4] x y cmp)
1377         for {
1378                 x := v_0
1379                 y := v_1
1380                 if v_2.Op != OpPPC64SETBCR {
1381                         break
1382                 }
1383                 a := auxIntToInt32(v_2.AuxInt)
1384                 cmp := v_2.Args[0]
1385                 v.reset(OpPPC64ISEL)
1386                 v.AuxInt = int32ToAuxInt(a + 4)
1387                 v.AddArg3(x, y, cmp)
1388                 return true
1389         }
1390         // match: (CondSelect x y bool)
1391         // cond: flagArg(bool) == nil
1392         // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [1] bool)))
1393         for {
1394                 x := v_0
1395                 y := v_1
1396                 bool := v_2
1397                 if !(flagArg(bool) == nil) {
1398                         break
1399                 }
1400                 v.reset(OpPPC64ISEL)
1401                 v.AuxInt = int32ToAuxInt(6)
1402                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
1403                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
1404                 v1.AuxInt = int64ToAuxInt(1)
1405                 v1.AddArg(bool)
1406                 v0.AddArg(v1)
1407                 v.AddArg3(x, y, v0)
1408                 return true
1409         }
1410         return false
1411 }
1412 func rewriteValuePPC64_OpConst16(v *Value) bool {
1413         // match: (Const16 [val])
1414         // result: (MOVDconst [int64(val)])
1415         for {
1416                 val := auxIntToInt16(v.AuxInt)
1417                 v.reset(OpPPC64MOVDconst)
1418                 v.AuxInt = int64ToAuxInt(int64(val))
1419                 return true
1420         }
1421 }
1422 func rewriteValuePPC64_OpConst32(v *Value) bool {
1423         // match: (Const32 [val])
1424         // result: (MOVDconst [int64(val)])
1425         for {
1426                 val := auxIntToInt32(v.AuxInt)
1427                 v.reset(OpPPC64MOVDconst)
1428                 v.AuxInt = int64ToAuxInt(int64(val))
1429                 return true
1430         }
1431 }
1432 func rewriteValuePPC64_OpConst64(v *Value) bool {
1433         // match: (Const64 [val])
1434         // result: (MOVDconst [int64(val)])
1435         for {
1436                 val := auxIntToInt64(v.AuxInt)
1437                 v.reset(OpPPC64MOVDconst)
1438                 v.AuxInt = int64ToAuxInt(int64(val))
1439                 return true
1440         }
1441 }
1442 func rewriteValuePPC64_OpConst8(v *Value) bool {
1443         // match: (Const8 [val])
1444         // result: (MOVDconst [int64(val)])
1445         for {
1446                 val := auxIntToInt8(v.AuxInt)
1447                 v.reset(OpPPC64MOVDconst)
1448                 v.AuxInt = int64ToAuxInt(int64(val))
1449                 return true
1450         }
1451 }
1452 func rewriteValuePPC64_OpConstBool(v *Value) bool {
1453         // match: (ConstBool [t])
1454         // result: (MOVDconst [b2i(t)])
1455         for {
1456                 t := auxIntToBool(v.AuxInt)
1457                 v.reset(OpPPC64MOVDconst)
1458                 v.AuxInt = int64ToAuxInt(b2i(t))
1459                 return true
1460         }
1461 }
1462 func rewriteValuePPC64_OpConstNil(v *Value) bool {
1463         // match: (ConstNil)
1464         // result: (MOVDconst [0])
1465         for {
1466                 v.reset(OpPPC64MOVDconst)
1467                 v.AuxInt = int64ToAuxInt(0)
1468                 return true
1469         }
1470 }
1471 func rewriteValuePPC64_OpCopysign(v *Value) bool {
1472         v_1 := v.Args[1]
1473         v_0 := v.Args[0]
1474         // match: (Copysign x y)
1475         // result: (FCPSGN y x)
1476         for {
1477                 x := v_0
1478                 y := v_1
1479                 v.reset(OpPPC64FCPSGN)
1480                 v.AddArg2(y, x)
1481                 return true
1482         }
1483 }
1484 func rewriteValuePPC64_OpCtz16(v *Value) bool {
1485         v_0 := v.Args[0]
1486         b := v.Block
1487         typ := &b.Func.Config.Types
1488         // match: (Ctz16 x)
1489         // result: (POPCNTW (MOVHZreg (ANDN <typ.Int16> (ADDconst <typ.Int16> [-1] x) x)))
1490         for {
1491                 x := v_0
1492                 v.reset(OpPPC64POPCNTW)
1493                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
1494                 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int16)
1495                 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int16)
1496                 v2.AuxInt = int64ToAuxInt(-1)
1497                 v2.AddArg(x)
1498                 v1.AddArg2(v2, x)
1499                 v0.AddArg(v1)
1500                 v.AddArg(v0)
1501                 return true
1502         }
1503 }
1504 func rewriteValuePPC64_OpCtz32(v *Value) bool {
1505         v_0 := v.Args[0]
1506         b := v.Block
1507         typ := &b.Func.Config.Types
1508         // match: (Ctz32 x)
1509         // cond: buildcfg.GOPPC64<=8
1510         // result: (POPCNTW (MOVWZreg (ANDN <typ.Int> (ADDconst <typ.Int> [-1] x) x)))
1511         for {
1512                 x := v_0
1513                 if !(buildcfg.GOPPC64 <= 8) {
1514                         break
1515                 }
1516                 v.reset(OpPPC64POPCNTW)
1517                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
1518                 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int)
1519                 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int)
1520                 v2.AuxInt = int64ToAuxInt(-1)
1521                 v2.AddArg(x)
1522                 v1.AddArg2(v2, x)
1523                 v0.AddArg(v1)
1524                 v.AddArg(v0)
1525                 return true
1526         }
1527         // match: (Ctz32 x)
1528         // result: (CNTTZW (MOVWZreg x))
1529         for {
1530                 x := v_0
1531                 v.reset(OpPPC64CNTTZW)
1532                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
1533                 v0.AddArg(x)
1534                 v.AddArg(v0)
1535                 return true
1536         }
1537 }
1538 func rewriteValuePPC64_OpCtz64(v *Value) bool {
1539         v_0 := v.Args[0]
1540         b := v.Block
1541         typ := &b.Func.Config.Types
1542         // match: (Ctz64 x)
1543         // cond: buildcfg.GOPPC64<=8
1544         // result: (POPCNTD (ANDN <typ.Int64> (ADDconst <typ.Int64> [-1] x) x))
1545         for {
1546                 x := v_0
1547                 if !(buildcfg.GOPPC64 <= 8) {
1548                         break
1549                 }
1550                 v.reset(OpPPC64POPCNTD)
1551                 v0 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int64)
1552                 v1 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int64)
1553                 v1.AuxInt = int64ToAuxInt(-1)
1554                 v1.AddArg(x)
1555                 v0.AddArg2(v1, x)
1556                 v.AddArg(v0)
1557                 return true
1558         }
1559         // match: (Ctz64 x)
1560         // result: (CNTTZD x)
1561         for {
1562                 x := v_0
1563                 v.reset(OpPPC64CNTTZD)
1564                 v.AddArg(x)
1565                 return true
1566         }
1567 }
1568 func rewriteValuePPC64_OpCtz8(v *Value) bool {
1569         v_0 := v.Args[0]
1570         b := v.Block
1571         typ := &b.Func.Config.Types
1572         // match: (Ctz8 x)
1573         // result: (POPCNTB (MOVBZreg (ANDN <typ.UInt8> (ADDconst <typ.UInt8> [-1] x) x)))
1574         for {
1575                 x := v_0
1576                 v.reset(OpPPC64POPCNTB)
1577                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
1578                 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.UInt8)
1579                 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.UInt8)
1580                 v2.AuxInt = int64ToAuxInt(-1)
1581                 v2.AddArg(x)
1582                 v1.AddArg2(v2, x)
1583                 v0.AddArg(v1)
1584                 v.AddArg(v0)
1585                 return true
1586         }
1587 }
1588 func rewriteValuePPC64_OpCvt32Fto32(v *Value) bool {
1589         v_0 := v.Args[0]
1590         b := v.Block
1591         typ := &b.Func.Config.Types
1592         // match: (Cvt32Fto32 x)
1593         // result: (MFVSRD (FCTIWZ x))
1594         for {
1595                 x := v_0
1596                 v.reset(OpPPC64MFVSRD)
1597                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIWZ, typ.Float64)
1598                 v0.AddArg(x)
1599                 v.AddArg(v0)
1600                 return true
1601         }
1602 }
1603 func rewriteValuePPC64_OpCvt32Fto64(v *Value) bool {
1604         v_0 := v.Args[0]
1605         b := v.Block
1606         typ := &b.Func.Config.Types
1607         // match: (Cvt32Fto64 x)
1608         // result: (MFVSRD (FCTIDZ x))
1609         for {
1610                 x := v_0
1611                 v.reset(OpPPC64MFVSRD)
1612                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIDZ, typ.Float64)
1613                 v0.AddArg(x)
1614                 v.AddArg(v0)
1615                 return true
1616         }
1617 }
1618 func rewriteValuePPC64_OpCvt32to32F(v *Value) bool {
1619         v_0 := v.Args[0]
1620         b := v.Block
1621         typ := &b.Func.Config.Types
1622         // match: (Cvt32to32F x)
1623         // result: (FCFIDS (MTVSRD (SignExt32to64 x)))
1624         for {
1625                 x := v_0
1626                 v.reset(OpPPC64FCFIDS)
1627                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1628                 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
1629                 v1.AddArg(x)
1630                 v0.AddArg(v1)
1631                 v.AddArg(v0)
1632                 return true
1633         }
1634 }
1635 func rewriteValuePPC64_OpCvt32to64F(v *Value) bool {
1636         v_0 := v.Args[0]
1637         b := v.Block
1638         typ := &b.Func.Config.Types
1639         // match: (Cvt32to64F x)
1640         // result: (FCFID (MTVSRD (SignExt32to64 x)))
1641         for {
1642                 x := v_0
1643                 v.reset(OpPPC64FCFID)
1644                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1645                 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
1646                 v1.AddArg(x)
1647                 v0.AddArg(v1)
1648                 v.AddArg(v0)
1649                 return true
1650         }
1651 }
1652 func rewriteValuePPC64_OpCvt64Fto32(v *Value) bool {
1653         v_0 := v.Args[0]
1654         b := v.Block
1655         typ := &b.Func.Config.Types
1656         // match: (Cvt64Fto32 x)
1657         // result: (MFVSRD (FCTIWZ x))
1658         for {
1659                 x := v_0
1660                 v.reset(OpPPC64MFVSRD)
1661                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIWZ, typ.Float64)
1662                 v0.AddArg(x)
1663                 v.AddArg(v0)
1664                 return true
1665         }
1666 }
1667 func rewriteValuePPC64_OpCvt64Fto64(v *Value) bool {
1668         v_0 := v.Args[0]
1669         b := v.Block
1670         typ := &b.Func.Config.Types
1671         // match: (Cvt64Fto64 x)
1672         // result: (MFVSRD (FCTIDZ x))
1673         for {
1674                 x := v_0
1675                 v.reset(OpPPC64MFVSRD)
1676                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIDZ, typ.Float64)
1677                 v0.AddArg(x)
1678                 v.AddArg(v0)
1679                 return true
1680         }
1681 }
1682 func rewriteValuePPC64_OpCvt64to32F(v *Value) bool {
1683         v_0 := v.Args[0]
1684         b := v.Block
1685         typ := &b.Func.Config.Types
1686         // match: (Cvt64to32F x)
1687         // result: (FCFIDS (MTVSRD x))
1688         for {
1689                 x := v_0
1690                 v.reset(OpPPC64FCFIDS)
1691                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1692                 v0.AddArg(x)
1693                 v.AddArg(v0)
1694                 return true
1695         }
1696 }
1697 func rewriteValuePPC64_OpCvt64to64F(v *Value) bool {
1698         v_0 := v.Args[0]
1699         b := v.Block
1700         typ := &b.Func.Config.Types
1701         // match: (Cvt64to64F x)
1702         // result: (FCFID (MTVSRD x))
1703         for {
1704                 x := v_0
1705                 v.reset(OpPPC64FCFID)
1706                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1707                 v0.AddArg(x)
1708                 v.AddArg(v0)
1709                 return true
1710         }
1711 }
1712 func rewriteValuePPC64_OpDiv16(v *Value) bool {
1713         v_1 := v.Args[1]
1714         v_0 := v.Args[0]
1715         b := v.Block
1716         typ := &b.Func.Config.Types
1717         // match: (Div16 [false] x y)
1718         // result: (DIVW (SignExt16to32 x) (SignExt16to32 y))
1719         for {
1720                 if auxIntToBool(v.AuxInt) != false {
1721                         break
1722                 }
1723                 x := v_0
1724                 y := v_1
1725                 v.reset(OpPPC64DIVW)
1726                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1727                 v0.AddArg(x)
1728                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1729                 v1.AddArg(y)
1730                 v.AddArg2(v0, v1)
1731                 return true
1732         }
1733         return false
1734 }
1735 func rewriteValuePPC64_OpDiv16u(v *Value) bool {
1736         v_1 := v.Args[1]
1737         v_0 := v.Args[0]
1738         b := v.Block
1739         typ := &b.Func.Config.Types
1740         // match: (Div16u x y)
1741         // result: (DIVWU (ZeroExt16to32 x) (ZeroExt16to32 y))
1742         for {
1743                 x := v_0
1744                 y := v_1
1745                 v.reset(OpPPC64DIVWU)
1746                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1747                 v0.AddArg(x)
1748                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1749                 v1.AddArg(y)
1750                 v.AddArg2(v0, v1)
1751                 return true
1752         }
1753 }
1754 func rewriteValuePPC64_OpDiv32(v *Value) bool {
1755         v_1 := v.Args[1]
1756         v_0 := v.Args[0]
1757         // match: (Div32 [false] x y)
1758         // result: (DIVW x y)
1759         for {
1760                 if auxIntToBool(v.AuxInt) != false {
1761                         break
1762                 }
1763                 x := v_0
1764                 y := v_1
1765                 v.reset(OpPPC64DIVW)
1766                 v.AddArg2(x, y)
1767                 return true
1768         }
1769         return false
1770 }
1771 func rewriteValuePPC64_OpDiv64(v *Value) bool {
1772         v_1 := v.Args[1]
1773         v_0 := v.Args[0]
1774         // match: (Div64 [false] x y)
1775         // result: (DIVD x y)
1776         for {
1777                 if auxIntToBool(v.AuxInt) != false {
1778                         break
1779                 }
1780                 x := v_0
1781                 y := v_1
1782                 v.reset(OpPPC64DIVD)
1783                 v.AddArg2(x, y)
1784                 return true
1785         }
1786         return false
1787 }
1788 func rewriteValuePPC64_OpDiv8(v *Value) bool {
1789         v_1 := v.Args[1]
1790         v_0 := v.Args[0]
1791         b := v.Block
1792         typ := &b.Func.Config.Types
1793         // match: (Div8 x y)
1794         // result: (DIVW (SignExt8to32 x) (SignExt8to32 y))
1795         for {
1796                 x := v_0
1797                 y := v_1
1798                 v.reset(OpPPC64DIVW)
1799                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1800                 v0.AddArg(x)
1801                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1802                 v1.AddArg(y)
1803                 v.AddArg2(v0, v1)
1804                 return true
1805         }
1806 }
1807 func rewriteValuePPC64_OpDiv8u(v *Value) bool {
1808         v_1 := v.Args[1]
1809         v_0 := v.Args[0]
1810         b := v.Block
1811         typ := &b.Func.Config.Types
1812         // match: (Div8u x y)
1813         // result: (DIVWU (ZeroExt8to32 x) (ZeroExt8to32 y))
1814         for {
1815                 x := v_0
1816                 y := v_1
1817                 v.reset(OpPPC64DIVWU)
1818                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1819                 v0.AddArg(x)
1820                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1821                 v1.AddArg(y)
1822                 v.AddArg2(v0, v1)
1823                 return true
1824         }
1825 }
1826 func rewriteValuePPC64_OpEq16(v *Value) bool {
1827         v_1 := v.Args[1]
1828         v_0 := v.Args[0]
1829         b := v.Block
1830         typ := &b.Func.Config.Types
1831         // match: (Eq16 x y)
1832         // cond: x.Type.IsSigned() && y.Type.IsSigned()
1833         // result: (Equal (CMPW (SignExt16to32 x) (SignExt16to32 y)))
1834         for {
1835                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1836                         x := v_0
1837                         y := v_1
1838                         if !(x.Type.IsSigned() && y.Type.IsSigned()) {
1839                                 continue
1840                         }
1841                         v.reset(OpPPC64Equal)
1842                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1843                         v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1844                         v1.AddArg(x)
1845                         v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1846                         v2.AddArg(y)
1847                         v0.AddArg2(v1, v2)
1848                         v.AddArg(v0)
1849                         return true
1850                 }
1851                 break
1852         }
1853         // match: (Eq16 x y)
1854         // result: (Equal (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
1855         for {
1856                 x := v_0
1857                 y := v_1
1858                 v.reset(OpPPC64Equal)
1859                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1860                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1861                 v1.AddArg(x)
1862                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1863                 v2.AddArg(y)
1864                 v0.AddArg2(v1, v2)
1865                 v.AddArg(v0)
1866                 return true
1867         }
1868 }
1869 func rewriteValuePPC64_OpEq32(v *Value) bool {
1870         v_1 := v.Args[1]
1871         v_0 := v.Args[0]
1872         b := v.Block
1873         // match: (Eq32 x y)
1874         // result: (Equal (CMPW x y))
1875         for {
1876                 x := v_0
1877                 y := v_1
1878                 v.reset(OpPPC64Equal)
1879                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1880                 v0.AddArg2(x, y)
1881                 v.AddArg(v0)
1882                 return true
1883         }
1884 }
1885 func rewriteValuePPC64_OpEq32F(v *Value) bool {
1886         v_1 := v.Args[1]
1887         v_0 := v.Args[0]
1888         b := v.Block
1889         // match: (Eq32F x y)
1890         // result: (Equal (FCMPU x y))
1891         for {
1892                 x := v_0
1893                 y := v_1
1894                 v.reset(OpPPC64Equal)
1895                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
1896                 v0.AddArg2(x, y)
1897                 v.AddArg(v0)
1898                 return true
1899         }
1900 }
1901 func rewriteValuePPC64_OpEq64(v *Value) bool {
1902         v_1 := v.Args[1]
1903         v_0 := v.Args[0]
1904         b := v.Block
1905         // match: (Eq64 x y)
1906         // result: (Equal (CMP x y))
1907         for {
1908                 x := v_0
1909                 y := v_1
1910                 v.reset(OpPPC64Equal)
1911                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
1912                 v0.AddArg2(x, y)
1913                 v.AddArg(v0)
1914                 return true
1915         }
1916 }
1917 func rewriteValuePPC64_OpEq64F(v *Value) bool {
1918         v_1 := v.Args[1]
1919         v_0 := v.Args[0]
1920         b := v.Block
1921         // match: (Eq64F x y)
1922         // result: (Equal (FCMPU x y))
1923         for {
1924                 x := v_0
1925                 y := v_1
1926                 v.reset(OpPPC64Equal)
1927                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
1928                 v0.AddArg2(x, y)
1929                 v.AddArg(v0)
1930                 return true
1931         }
1932 }
1933 func rewriteValuePPC64_OpEq8(v *Value) bool {
1934         v_1 := v.Args[1]
1935         v_0 := v.Args[0]
1936         b := v.Block
1937         typ := &b.Func.Config.Types
1938         // match: (Eq8 x y)
1939         // cond: x.Type.IsSigned() && y.Type.IsSigned()
1940         // result: (Equal (CMPW (SignExt8to32 x) (SignExt8to32 y)))
1941         for {
1942                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1943                         x := v_0
1944                         y := v_1
1945                         if !(x.Type.IsSigned() && y.Type.IsSigned()) {
1946                                 continue
1947                         }
1948                         v.reset(OpPPC64Equal)
1949                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1950                         v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1951                         v1.AddArg(x)
1952                         v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1953                         v2.AddArg(y)
1954                         v0.AddArg2(v1, v2)
1955                         v.AddArg(v0)
1956                         return true
1957                 }
1958                 break
1959         }
1960         // match: (Eq8 x y)
1961         // result: (Equal (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
1962         for {
1963                 x := v_0
1964                 y := v_1
1965                 v.reset(OpPPC64Equal)
1966                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1967                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1968                 v1.AddArg(x)
1969                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1970                 v2.AddArg(y)
1971                 v0.AddArg2(v1, v2)
1972                 v.AddArg(v0)
1973                 return true
1974         }
1975 }
1976 func rewriteValuePPC64_OpEqB(v *Value) bool {
1977         v_1 := v.Args[1]
1978         v_0 := v.Args[0]
1979         b := v.Block
1980         typ := &b.Func.Config.Types
1981         // match: (EqB x y)
1982         // result: (Select0 <typ.Int> (ANDCCconst [1] (EQV x y)))
1983         for {
1984                 x := v_0
1985                 y := v_1
1986                 v.reset(OpSelect0)
1987                 v.Type = typ.Int
1988                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
1989                 v0.AuxInt = int64ToAuxInt(1)
1990                 v1 := b.NewValue0(v.Pos, OpPPC64EQV, typ.Int64)
1991                 v1.AddArg2(x, y)
1992                 v0.AddArg(v1)
1993                 v.AddArg(v0)
1994                 return true
1995         }
1996 }
1997 func rewriteValuePPC64_OpEqPtr(v *Value) bool {
1998         v_1 := v.Args[1]
1999         v_0 := v.Args[0]
2000         b := v.Block
2001         // match: (EqPtr x y)
2002         // result: (Equal (CMP x y))
2003         for {
2004                 x := v_0
2005                 y := v_1
2006                 v.reset(OpPPC64Equal)
2007                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2008                 v0.AddArg2(x, y)
2009                 v.AddArg(v0)
2010                 return true
2011         }
2012 }
2013 func rewriteValuePPC64_OpIsInBounds(v *Value) bool {
2014         v_1 := v.Args[1]
2015         v_0 := v.Args[0]
2016         b := v.Block
2017         // match: (IsInBounds idx len)
2018         // result: (LessThan (CMPU idx len))
2019         for {
2020                 idx := v_0
2021                 len := v_1
2022                 v.reset(OpPPC64LessThan)
2023                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2024                 v0.AddArg2(idx, len)
2025                 v.AddArg(v0)
2026                 return true
2027         }
2028 }
2029 func rewriteValuePPC64_OpIsNonNil(v *Value) bool {
2030         v_0 := v.Args[0]
2031         b := v.Block
2032         // match: (IsNonNil ptr)
2033         // result: (NotEqual (CMPconst [0] ptr))
2034         for {
2035                 ptr := v_0
2036                 v.reset(OpPPC64NotEqual)
2037                 v0 := b.NewValue0(v.Pos, OpPPC64CMPconst, types.TypeFlags)
2038                 v0.AuxInt = int64ToAuxInt(0)
2039                 v0.AddArg(ptr)
2040                 v.AddArg(v0)
2041                 return true
2042         }
2043 }
2044 func rewriteValuePPC64_OpIsSliceInBounds(v *Value) bool {
2045         v_1 := v.Args[1]
2046         v_0 := v.Args[0]
2047         b := v.Block
2048         // match: (IsSliceInBounds idx len)
2049         // result: (LessEqual (CMPU idx len))
2050         for {
2051                 idx := v_0
2052                 len := v_1
2053                 v.reset(OpPPC64LessEqual)
2054                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2055                 v0.AddArg2(idx, len)
2056                 v.AddArg(v0)
2057                 return true
2058         }
2059 }
2060 func rewriteValuePPC64_OpLeq16(v *Value) bool {
2061         v_1 := v.Args[1]
2062         v_0 := v.Args[0]
2063         b := v.Block
2064         typ := &b.Func.Config.Types
2065         // match: (Leq16 x y)
2066         // result: (LessEqual (CMPW (SignExt16to32 x) (SignExt16to32 y)))
2067         for {
2068                 x := v_0
2069                 y := v_1
2070                 v.reset(OpPPC64LessEqual)
2071                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2072                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2073                 v1.AddArg(x)
2074                 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2075                 v2.AddArg(y)
2076                 v0.AddArg2(v1, v2)
2077                 v.AddArg(v0)
2078                 return true
2079         }
2080 }
2081 func rewriteValuePPC64_OpLeq16U(v *Value) bool {
2082         v_1 := v.Args[1]
2083         v_0 := v.Args[0]
2084         b := v.Block
2085         typ := &b.Func.Config.Types
2086         // match: (Leq16U x y)
2087         // result: (LessEqual (CMPWU (ZeroExt16to32 x) (ZeroExt16to32 y)))
2088         for {
2089                 x := v_0
2090                 y := v_1
2091                 v.reset(OpPPC64LessEqual)
2092                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2093                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2094                 v1.AddArg(x)
2095                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2096                 v2.AddArg(y)
2097                 v0.AddArg2(v1, v2)
2098                 v.AddArg(v0)
2099                 return true
2100         }
2101 }
2102 func rewriteValuePPC64_OpLeq32(v *Value) bool {
2103         v_1 := v.Args[1]
2104         v_0 := v.Args[0]
2105         b := v.Block
2106         // match: (Leq32 x y)
2107         // result: (LessEqual (CMPW x y))
2108         for {
2109                 x := v_0
2110                 y := v_1
2111                 v.reset(OpPPC64LessEqual)
2112                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2113                 v0.AddArg2(x, y)
2114                 v.AddArg(v0)
2115                 return true
2116         }
2117 }
2118 func rewriteValuePPC64_OpLeq32F(v *Value) bool {
2119         v_1 := v.Args[1]
2120         v_0 := v.Args[0]
2121         b := v.Block
2122         // match: (Leq32F x y)
2123         // result: (FLessEqual (FCMPU x y))
2124         for {
2125                 x := v_0
2126                 y := v_1
2127                 v.reset(OpPPC64FLessEqual)
2128                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2129                 v0.AddArg2(x, y)
2130                 v.AddArg(v0)
2131                 return true
2132         }
2133 }
2134 func rewriteValuePPC64_OpLeq32U(v *Value) bool {
2135         v_1 := v.Args[1]
2136         v_0 := v.Args[0]
2137         b := v.Block
2138         // match: (Leq32U x y)
2139         // result: (LessEqual (CMPWU x y))
2140         for {
2141                 x := v_0
2142                 y := v_1
2143                 v.reset(OpPPC64LessEqual)
2144                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2145                 v0.AddArg2(x, y)
2146                 v.AddArg(v0)
2147                 return true
2148         }
2149 }
2150 func rewriteValuePPC64_OpLeq64(v *Value) bool {
2151         v_1 := v.Args[1]
2152         v_0 := v.Args[0]
2153         b := v.Block
2154         // match: (Leq64 x y)
2155         // result: (LessEqual (CMP x y))
2156         for {
2157                 x := v_0
2158                 y := v_1
2159                 v.reset(OpPPC64LessEqual)
2160                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2161                 v0.AddArg2(x, y)
2162                 v.AddArg(v0)
2163                 return true
2164         }
2165 }
2166 func rewriteValuePPC64_OpLeq64F(v *Value) bool {
2167         v_1 := v.Args[1]
2168         v_0 := v.Args[0]
2169         b := v.Block
2170         // match: (Leq64F x y)
2171         // result: (FLessEqual (FCMPU x y))
2172         for {
2173                 x := v_0
2174                 y := v_1
2175                 v.reset(OpPPC64FLessEqual)
2176                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2177                 v0.AddArg2(x, y)
2178                 v.AddArg(v0)
2179                 return true
2180         }
2181 }
2182 func rewriteValuePPC64_OpLeq64U(v *Value) bool {
2183         v_1 := v.Args[1]
2184         v_0 := v.Args[0]
2185         b := v.Block
2186         // match: (Leq64U x y)
2187         // result: (LessEqual (CMPU x y))
2188         for {
2189                 x := v_0
2190                 y := v_1
2191                 v.reset(OpPPC64LessEqual)
2192                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2193                 v0.AddArg2(x, y)
2194                 v.AddArg(v0)
2195                 return true
2196         }
2197 }
2198 func rewriteValuePPC64_OpLeq8(v *Value) bool {
2199         v_1 := v.Args[1]
2200         v_0 := v.Args[0]
2201         b := v.Block
2202         typ := &b.Func.Config.Types
2203         // match: (Leq8 x y)
2204         // result: (LessEqual (CMPW (SignExt8to32 x) (SignExt8to32 y)))
2205         for {
2206                 x := v_0
2207                 y := v_1
2208                 v.reset(OpPPC64LessEqual)
2209                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2210                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2211                 v1.AddArg(x)
2212                 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2213                 v2.AddArg(y)
2214                 v0.AddArg2(v1, v2)
2215                 v.AddArg(v0)
2216                 return true
2217         }
2218 }
2219 func rewriteValuePPC64_OpLeq8U(v *Value) bool {
2220         v_1 := v.Args[1]
2221         v_0 := v.Args[0]
2222         b := v.Block
2223         typ := &b.Func.Config.Types
2224         // match: (Leq8U x y)
2225         // result: (LessEqual (CMPWU (ZeroExt8to32 x) (ZeroExt8to32 y)))
2226         for {
2227                 x := v_0
2228                 y := v_1
2229                 v.reset(OpPPC64LessEqual)
2230                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2231                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2232                 v1.AddArg(x)
2233                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2234                 v2.AddArg(y)
2235                 v0.AddArg2(v1, v2)
2236                 v.AddArg(v0)
2237                 return true
2238         }
2239 }
2240 func rewriteValuePPC64_OpLess16(v *Value) bool {
2241         v_1 := v.Args[1]
2242         v_0 := v.Args[0]
2243         b := v.Block
2244         typ := &b.Func.Config.Types
2245         // match: (Less16 x y)
2246         // result: (LessThan (CMPW (SignExt16to32 x) (SignExt16to32 y)))
2247         for {
2248                 x := v_0
2249                 y := v_1
2250                 v.reset(OpPPC64LessThan)
2251                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2252                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2253                 v1.AddArg(x)
2254                 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2255                 v2.AddArg(y)
2256                 v0.AddArg2(v1, v2)
2257                 v.AddArg(v0)
2258                 return true
2259         }
2260 }
2261 func rewriteValuePPC64_OpLess16U(v *Value) bool {
2262         v_1 := v.Args[1]
2263         v_0 := v.Args[0]
2264         b := v.Block
2265         typ := &b.Func.Config.Types
2266         // match: (Less16U x y)
2267         // result: (LessThan (CMPWU (ZeroExt16to32 x) (ZeroExt16to32 y)))
2268         for {
2269                 x := v_0
2270                 y := v_1
2271                 v.reset(OpPPC64LessThan)
2272                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2273                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2274                 v1.AddArg(x)
2275                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2276                 v2.AddArg(y)
2277                 v0.AddArg2(v1, v2)
2278                 v.AddArg(v0)
2279                 return true
2280         }
2281 }
2282 func rewriteValuePPC64_OpLess32(v *Value) bool {
2283         v_1 := v.Args[1]
2284         v_0 := v.Args[0]
2285         b := v.Block
2286         // match: (Less32 x y)
2287         // result: (LessThan (CMPW x y))
2288         for {
2289                 x := v_0
2290                 y := v_1
2291                 v.reset(OpPPC64LessThan)
2292                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2293                 v0.AddArg2(x, y)
2294                 v.AddArg(v0)
2295                 return true
2296         }
2297 }
2298 func rewriteValuePPC64_OpLess32F(v *Value) bool {
2299         v_1 := v.Args[1]
2300         v_0 := v.Args[0]
2301         b := v.Block
2302         // match: (Less32F x y)
2303         // result: (FLessThan (FCMPU x y))
2304         for {
2305                 x := v_0
2306                 y := v_1
2307                 v.reset(OpPPC64FLessThan)
2308                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2309                 v0.AddArg2(x, y)
2310                 v.AddArg(v0)
2311                 return true
2312         }
2313 }
2314 func rewriteValuePPC64_OpLess32U(v *Value) bool {
2315         v_1 := v.Args[1]
2316         v_0 := v.Args[0]
2317         b := v.Block
2318         // match: (Less32U x y)
2319         // result: (LessThan (CMPWU x y))
2320         for {
2321                 x := v_0
2322                 y := v_1
2323                 v.reset(OpPPC64LessThan)
2324                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2325                 v0.AddArg2(x, y)
2326                 v.AddArg(v0)
2327                 return true
2328         }
2329 }
2330 func rewriteValuePPC64_OpLess64(v *Value) bool {
2331         v_1 := v.Args[1]
2332         v_0 := v.Args[0]
2333         b := v.Block
2334         // match: (Less64 x y)
2335         // result: (LessThan (CMP x y))
2336         for {
2337                 x := v_0
2338                 y := v_1
2339                 v.reset(OpPPC64LessThan)
2340                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2341                 v0.AddArg2(x, y)
2342                 v.AddArg(v0)
2343                 return true
2344         }
2345 }
2346 func rewriteValuePPC64_OpLess64F(v *Value) bool {
2347         v_1 := v.Args[1]
2348         v_0 := v.Args[0]
2349         b := v.Block
2350         // match: (Less64F x y)
2351         // result: (FLessThan (FCMPU x y))
2352         for {
2353                 x := v_0
2354                 y := v_1
2355                 v.reset(OpPPC64FLessThan)
2356                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2357                 v0.AddArg2(x, y)
2358                 v.AddArg(v0)
2359                 return true
2360         }
2361 }
2362 func rewriteValuePPC64_OpLess64U(v *Value) bool {
2363         v_1 := v.Args[1]
2364         v_0 := v.Args[0]
2365         b := v.Block
2366         // match: (Less64U x y)
2367         // result: (LessThan (CMPU x y))
2368         for {
2369                 x := v_0
2370                 y := v_1
2371                 v.reset(OpPPC64LessThan)
2372                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2373                 v0.AddArg2(x, y)
2374                 v.AddArg(v0)
2375                 return true
2376         }
2377 }
2378 func rewriteValuePPC64_OpLess8(v *Value) bool {
2379         v_1 := v.Args[1]
2380         v_0 := v.Args[0]
2381         b := v.Block
2382         typ := &b.Func.Config.Types
2383         // match: (Less8 x y)
2384         // result: (LessThan (CMPW (SignExt8to32 x) (SignExt8to32 y)))
2385         for {
2386                 x := v_0
2387                 y := v_1
2388                 v.reset(OpPPC64LessThan)
2389                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2390                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2391                 v1.AddArg(x)
2392                 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2393                 v2.AddArg(y)
2394                 v0.AddArg2(v1, v2)
2395                 v.AddArg(v0)
2396                 return true
2397         }
2398 }
2399 func rewriteValuePPC64_OpLess8U(v *Value) bool {
2400         v_1 := v.Args[1]
2401         v_0 := v.Args[0]
2402         b := v.Block
2403         typ := &b.Func.Config.Types
2404         // match: (Less8U x y)
2405         // result: (LessThan (CMPWU (ZeroExt8to32 x) (ZeroExt8to32 y)))
2406         for {
2407                 x := v_0
2408                 y := v_1
2409                 v.reset(OpPPC64LessThan)
2410                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2411                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2412                 v1.AddArg(x)
2413                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2414                 v2.AddArg(y)
2415                 v0.AddArg2(v1, v2)
2416                 v.AddArg(v0)
2417                 return true
2418         }
2419 }
2420 func rewriteValuePPC64_OpLoad(v *Value) bool {
2421         v_1 := v.Args[1]
2422         v_0 := v.Args[0]
2423         b := v.Block
2424         typ := &b.Func.Config.Types
2425         // match: (Load <t> ptr mem)
2426         // cond: (is64BitInt(t) || isPtr(t))
2427         // result: (MOVDload ptr mem)
2428         for {
2429                 t := v.Type
2430                 ptr := v_0
2431                 mem := v_1
2432                 if !(is64BitInt(t) || isPtr(t)) {
2433                         break
2434                 }
2435                 v.reset(OpPPC64MOVDload)
2436                 v.AddArg2(ptr, mem)
2437                 return true
2438         }
2439         // match: (Load <t> ptr mem)
2440         // cond: is32BitInt(t) && t.IsSigned()
2441         // result: (MOVWload ptr mem)
2442         for {
2443                 t := v.Type
2444                 ptr := v_0
2445                 mem := v_1
2446                 if !(is32BitInt(t) && t.IsSigned()) {
2447                         break
2448                 }
2449                 v.reset(OpPPC64MOVWload)
2450                 v.AddArg2(ptr, mem)
2451                 return true
2452         }
2453         // match: (Load <t> ptr mem)
2454         // cond: is32BitInt(t) && !t.IsSigned()
2455         // result: (MOVWZload ptr mem)
2456         for {
2457                 t := v.Type
2458                 ptr := v_0
2459                 mem := v_1
2460                 if !(is32BitInt(t) && !t.IsSigned()) {
2461                         break
2462                 }
2463                 v.reset(OpPPC64MOVWZload)
2464                 v.AddArg2(ptr, mem)
2465                 return true
2466         }
2467         // match: (Load <t> ptr mem)
2468         // cond: is16BitInt(t) && t.IsSigned()
2469         // result: (MOVHload ptr mem)
2470         for {
2471                 t := v.Type
2472                 ptr := v_0
2473                 mem := v_1
2474                 if !(is16BitInt(t) && t.IsSigned()) {
2475                         break
2476                 }
2477                 v.reset(OpPPC64MOVHload)
2478                 v.AddArg2(ptr, mem)
2479                 return true
2480         }
2481         // match: (Load <t> ptr mem)
2482         // cond: is16BitInt(t) && !t.IsSigned()
2483         // result: (MOVHZload ptr mem)
2484         for {
2485                 t := v.Type
2486                 ptr := v_0
2487                 mem := v_1
2488                 if !(is16BitInt(t) && !t.IsSigned()) {
2489                         break
2490                 }
2491                 v.reset(OpPPC64MOVHZload)
2492                 v.AddArg2(ptr, mem)
2493                 return true
2494         }
2495         // match: (Load <t> ptr mem)
2496         // cond: t.IsBoolean()
2497         // result: (MOVBZload ptr mem)
2498         for {
2499                 t := v.Type
2500                 ptr := v_0
2501                 mem := v_1
2502                 if !(t.IsBoolean()) {
2503                         break
2504                 }
2505                 v.reset(OpPPC64MOVBZload)
2506                 v.AddArg2(ptr, mem)
2507                 return true
2508         }
2509         // match: (Load <t> ptr mem)
2510         // cond: is8BitInt(t) && t.IsSigned()
2511         // result: (MOVBreg (MOVBZload ptr mem))
2512         for {
2513                 t := v.Type
2514                 ptr := v_0
2515                 mem := v_1
2516                 if !(is8BitInt(t) && t.IsSigned()) {
2517                         break
2518                 }
2519                 v.reset(OpPPC64MOVBreg)
2520                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
2521                 v0.AddArg2(ptr, mem)
2522                 v.AddArg(v0)
2523                 return true
2524         }
2525         // match: (Load <t> ptr mem)
2526         // cond: is8BitInt(t) && !t.IsSigned()
2527         // result: (MOVBZload ptr mem)
2528         for {
2529                 t := v.Type
2530                 ptr := v_0
2531                 mem := v_1
2532                 if !(is8BitInt(t) && !t.IsSigned()) {
2533                         break
2534                 }
2535                 v.reset(OpPPC64MOVBZload)
2536                 v.AddArg2(ptr, mem)
2537                 return true
2538         }
2539         // match: (Load <t> ptr mem)
2540         // cond: is32BitFloat(t)
2541         // result: (FMOVSload ptr mem)
2542         for {
2543                 t := v.Type
2544                 ptr := v_0
2545                 mem := v_1
2546                 if !(is32BitFloat(t)) {
2547                         break
2548                 }
2549                 v.reset(OpPPC64FMOVSload)
2550                 v.AddArg2(ptr, mem)
2551                 return true
2552         }
2553         // match: (Load <t> ptr mem)
2554         // cond: is64BitFloat(t)
2555         // result: (FMOVDload ptr mem)
2556         for {
2557                 t := v.Type
2558                 ptr := v_0
2559                 mem := v_1
2560                 if !(is64BitFloat(t)) {
2561                         break
2562                 }
2563                 v.reset(OpPPC64FMOVDload)
2564                 v.AddArg2(ptr, mem)
2565                 return true
2566         }
2567         return false
2568 }
2569 func rewriteValuePPC64_OpLocalAddr(v *Value) bool {
2570         v_1 := v.Args[1]
2571         v_0 := v.Args[0]
2572         b := v.Block
2573         typ := &b.Func.Config.Types
2574         // match: (LocalAddr <t> {sym} base mem)
2575         // cond: t.Elem().HasPointers()
2576         // result: (MOVDaddr {sym} (SPanchored base mem))
2577         for {
2578                 t := v.Type
2579                 sym := auxToSym(v.Aux)
2580                 base := v_0
2581                 mem := v_1
2582                 if !(t.Elem().HasPointers()) {
2583                         break
2584                 }
2585                 v.reset(OpPPC64MOVDaddr)
2586                 v.Aux = symToAux(sym)
2587                 v0 := b.NewValue0(v.Pos, OpSPanchored, typ.Uintptr)
2588                 v0.AddArg2(base, mem)
2589                 v.AddArg(v0)
2590                 return true
2591         }
2592         // match: (LocalAddr <t> {sym} base _)
2593         // cond: !t.Elem().HasPointers()
2594         // result: (MOVDaddr {sym} base)
2595         for {
2596                 t := v.Type
2597                 sym := auxToSym(v.Aux)
2598                 base := v_0
2599                 if !(!t.Elem().HasPointers()) {
2600                         break
2601                 }
2602                 v.reset(OpPPC64MOVDaddr)
2603                 v.Aux = symToAux(sym)
2604                 v.AddArg(base)
2605                 return true
2606         }
2607         return false
2608 }
2609 func rewriteValuePPC64_OpLsh16x16(v *Value) bool {
2610         v_1 := v.Args[1]
2611         v_0 := v.Args[0]
2612         b := v.Block
2613         typ := &b.Func.Config.Types
2614         // match: (Lsh16x16 x y)
2615         // cond: shiftIsBounded(v)
2616         // result: (SLD x y)
2617         for {
2618                 x := v_0
2619                 y := v_1
2620                 if !(shiftIsBounded(v)) {
2621                         break
2622                 }
2623                 v.reset(OpPPC64SLD)
2624                 v.AddArg2(x, y)
2625                 return true
2626         }
2627         // match: (Lsh16x16 <t> x y)
2628         // result: (ISEL [2] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y)))
2629         for {
2630                 t := v.Type
2631                 x := v_0
2632                 y := v_1
2633                 v.reset(OpPPC64ISEL)
2634                 v.AuxInt = int32ToAuxInt(2)
2635                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2636                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
2637                 v1.AddArg(x)
2638                 v0.AddArg2(v1, y)
2639                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2640                 v2.AuxInt = int64ToAuxInt(0)
2641                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2642                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2643                 v4.AuxInt = int64ToAuxInt(0xFFF0)
2644                 v4.AddArg(y)
2645                 v3.AddArg(v4)
2646                 v.AddArg3(v0, v2, v3)
2647                 return true
2648         }
2649 }
2650 func rewriteValuePPC64_OpLsh16x32(v *Value) bool {
2651         v_1 := v.Args[1]
2652         v_0 := v.Args[0]
2653         b := v.Block
2654         typ := &b.Func.Config.Types
2655         // match: (Lsh16x32 x y)
2656         // cond: shiftIsBounded(v)
2657         // result: (SLD x y)
2658         for {
2659                 x := v_0
2660                 y := v_1
2661                 if !(shiftIsBounded(v)) {
2662                         break
2663                 }
2664                 v.reset(OpPPC64SLD)
2665                 v.AddArg2(x, y)
2666                 return true
2667         }
2668         // match: (Lsh16x32 <t> x y)
2669         // result: (ISEL [0] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [16]))
2670         for {
2671                 t := v.Type
2672                 x := v_0
2673                 y := v_1
2674                 v.reset(OpPPC64ISEL)
2675                 v.AuxInt = int32ToAuxInt(0)
2676                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2677                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
2678                 v1.AddArg(x)
2679                 v0.AddArg2(v1, y)
2680                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2681                 v2.AuxInt = int64ToAuxInt(0)
2682                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
2683                 v3.AuxInt = int32ToAuxInt(16)
2684                 v3.AddArg(y)
2685                 v.AddArg3(v0, v2, v3)
2686                 return true
2687         }
2688 }
2689 func rewriteValuePPC64_OpLsh16x64(v *Value) bool {
2690         v_1 := v.Args[1]
2691         v_0 := v.Args[0]
2692         b := v.Block
2693         typ := &b.Func.Config.Types
2694         // match: (Lsh16x64 x (MOVDconst [c]))
2695         // cond: uint64(c) < 16
2696         // result: (SLWconst x [c])
2697         for {
2698                 x := v_0
2699                 if v_1.Op != OpPPC64MOVDconst {
2700                         break
2701                 }
2702                 c := auxIntToInt64(v_1.AuxInt)
2703                 if !(uint64(c) < 16) {
2704                         break
2705                 }
2706                 v.reset(OpPPC64SLWconst)
2707                 v.AuxInt = int64ToAuxInt(c)
2708                 v.AddArg(x)
2709                 return true
2710         }
2711         // match: (Lsh16x64 x y)
2712         // cond: shiftIsBounded(v)
2713         // result: (SLD x y)
2714         for {
2715                 x := v_0
2716                 y := v_1
2717                 if !(shiftIsBounded(v)) {
2718                         break
2719                 }
2720                 v.reset(OpPPC64SLD)
2721                 v.AddArg2(x, y)
2722                 return true
2723         }
2724         // match: (Lsh16x64 <t> x y)
2725         // result: (ISEL [0] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [16]))
2726         for {
2727                 t := v.Type
2728                 x := v_0
2729                 y := v_1
2730                 v.reset(OpPPC64ISEL)
2731                 v.AuxInt = int32ToAuxInt(0)
2732                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2733                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
2734                 v1.AddArg(x)
2735                 v0.AddArg2(v1, y)
2736                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2737                 v2.AuxInt = int64ToAuxInt(0)
2738                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
2739                 v3.AuxInt = int64ToAuxInt(16)
2740                 v3.AddArg(y)
2741                 v.AddArg3(v0, v2, v3)
2742                 return true
2743         }
2744 }
2745 func rewriteValuePPC64_OpLsh16x8(v *Value) bool {
2746         v_1 := v.Args[1]
2747         v_0 := v.Args[0]
2748         b := v.Block
2749         typ := &b.Func.Config.Types
2750         // match: (Lsh16x8 x y)
2751         // cond: shiftIsBounded(v)
2752         // result: (SLD x y)
2753         for {
2754                 x := v_0
2755                 y := v_1
2756                 if !(shiftIsBounded(v)) {
2757                         break
2758                 }
2759                 v.reset(OpPPC64SLD)
2760                 v.AddArg2(x, y)
2761                 return true
2762         }
2763         // match: (Lsh16x8 <t> x y)
2764         // result: (ISEL [2] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y)))
2765         for {
2766                 t := v.Type
2767                 x := v_0
2768                 y := v_1
2769                 v.reset(OpPPC64ISEL)
2770                 v.AuxInt = int32ToAuxInt(2)
2771                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2772                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
2773                 v1.AddArg(x)
2774                 v0.AddArg2(v1, y)
2775                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2776                 v2.AuxInt = int64ToAuxInt(0)
2777                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2778                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2779                 v4.AuxInt = int64ToAuxInt(0x00F0)
2780                 v4.AddArg(y)
2781                 v3.AddArg(v4)
2782                 v.AddArg3(v0, v2, v3)
2783                 return true
2784         }
2785 }
2786 func rewriteValuePPC64_OpLsh32x16(v *Value) bool {
2787         v_1 := v.Args[1]
2788         v_0 := v.Args[0]
2789         b := v.Block
2790         typ := &b.Func.Config.Types
2791         // match: (Lsh32x16 x y)
2792         // cond: shiftIsBounded(v)
2793         // result: (SLW x y)
2794         for {
2795                 x := v_0
2796                 y := v_1
2797                 if !(shiftIsBounded(v)) {
2798                         break
2799                 }
2800                 v.reset(OpPPC64SLW)
2801                 v.AddArg2(x, y)
2802                 return true
2803         }
2804         // match: (Lsh32x16 <t> x y)
2805         // result: (ISEL [2] (SLW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y)))
2806         for {
2807                 t := v.Type
2808                 x := v_0
2809                 y := v_1
2810                 v.reset(OpPPC64ISEL)
2811                 v.AuxInt = int32ToAuxInt(2)
2812                 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
2813                 v0.AddArg2(x, y)
2814                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2815                 v1.AuxInt = int64ToAuxInt(0)
2816                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2817                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2818                 v3.AuxInt = int64ToAuxInt(0xFFE0)
2819                 v3.AddArg(y)
2820                 v2.AddArg(v3)
2821                 v.AddArg3(v0, v1, v2)
2822                 return true
2823         }
2824 }
2825 func rewriteValuePPC64_OpLsh32x32(v *Value) bool {
2826         v_1 := v.Args[1]
2827         v_0 := v.Args[0]
2828         b := v.Block
2829         typ := &b.Func.Config.Types
2830         // match: (Lsh32x32 x y)
2831         // cond: shiftIsBounded(v)
2832         // result: (SLW x y)
2833         for {
2834                 x := v_0
2835                 y := v_1
2836                 if !(shiftIsBounded(v)) {
2837                         break
2838                 }
2839                 v.reset(OpPPC64SLW)
2840                 v.AddArg2(x, y)
2841                 return true
2842         }
2843         // match: (Lsh32x32 <t> x y)
2844         // result: (ISEL [0] (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [32]))
2845         for {
2846                 t := v.Type
2847                 x := v_0
2848                 y := v_1
2849                 v.reset(OpPPC64ISEL)
2850                 v.AuxInt = int32ToAuxInt(0)
2851                 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
2852                 v0.AddArg2(x, y)
2853                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2854                 v1.AuxInt = int64ToAuxInt(0)
2855                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
2856                 v2.AuxInt = int32ToAuxInt(32)
2857                 v2.AddArg(y)
2858                 v.AddArg3(v0, v1, v2)
2859                 return true
2860         }
2861 }
2862 func rewriteValuePPC64_OpLsh32x64(v *Value) bool {
2863         v_1 := v.Args[1]
2864         v_0 := v.Args[0]
2865         b := v.Block
2866         typ := &b.Func.Config.Types
2867         // match: (Lsh32x64 x (MOVDconst [c]))
2868         // cond: uint64(c) < 32
2869         // result: (SLWconst x [c])
2870         for {
2871                 x := v_0
2872                 if v_1.Op != OpPPC64MOVDconst {
2873                         break
2874                 }
2875                 c := auxIntToInt64(v_1.AuxInt)
2876                 if !(uint64(c) < 32) {
2877                         break
2878                 }
2879                 v.reset(OpPPC64SLWconst)
2880                 v.AuxInt = int64ToAuxInt(c)
2881                 v.AddArg(x)
2882                 return true
2883         }
2884         // match: (Lsh32x64 x y)
2885         // cond: shiftIsBounded(v)
2886         // result: (SLW x y)
2887         for {
2888                 x := v_0
2889                 y := v_1
2890                 if !(shiftIsBounded(v)) {
2891                         break
2892                 }
2893                 v.reset(OpPPC64SLW)
2894                 v.AddArg2(x, y)
2895                 return true
2896         }
2897         // match: (Lsh32x64 <t> x y)
2898         // result: (ISEL [0] (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [32]))
2899         for {
2900                 t := v.Type
2901                 x := v_0
2902                 y := v_1
2903                 v.reset(OpPPC64ISEL)
2904                 v.AuxInt = int32ToAuxInt(0)
2905                 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
2906                 v0.AddArg2(x, y)
2907                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2908                 v1.AuxInt = int64ToAuxInt(0)
2909                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
2910                 v2.AuxInt = int64ToAuxInt(32)
2911                 v2.AddArg(y)
2912                 v.AddArg3(v0, v1, v2)
2913                 return true
2914         }
2915 }
2916 func rewriteValuePPC64_OpLsh32x8(v *Value) bool {
2917         v_1 := v.Args[1]
2918         v_0 := v.Args[0]
2919         b := v.Block
2920         typ := &b.Func.Config.Types
2921         // match: (Lsh32x8 x y)
2922         // cond: shiftIsBounded(v)
2923         // result: (SLW x y)
2924         for {
2925                 x := v_0
2926                 y := v_1
2927                 if !(shiftIsBounded(v)) {
2928                         break
2929                 }
2930                 v.reset(OpPPC64SLW)
2931                 v.AddArg2(x, y)
2932                 return true
2933         }
2934         // match: (Lsh32x8 <t> x y)
2935         // result: (ISEL [2] (SLW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y)))
2936         for {
2937                 t := v.Type
2938                 x := v_0
2939                 y := v_1
2940                 v.reset(OpPPC64ISEL)
2941                 v.AuxInt = int32ToAuxInt(2)
2942                 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
2943                 v0.AddArg2(x, y)
2944                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2945                 v1.AuxInt = int64ToAuxInt(0)
2946                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2947                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2948                 v3.AuxInt = int64ToAuxInt(0x00E0)
2949                 v3.AddArg(y)
2950                 v2.AddArg(v3)
2951                 v.AddArg3(v0, v1, v2)
2952                 return true
2953         }
2954 }
2955 func rewriteValuePPC64_OpLsh64x16(v *Value) bool {
2956         v_1 := v.Args[1]
2957         v_0 := v.Args[0]
2958         b := v.Block
2959         typ := &b.Func.Config.Types
2960         // match: (Lsh64x16 x y)
2961         // cond: shiftIsBounded(v)
2962         // result: (SLD x y)
2963         for {
2964                 x := v_0
2965                 y := v_1
2966                 if !(shiftIsBounded(v)) {
2967                         break
2968                 }
2969                 v.reset(OpPPC64SLD)
2970                 v.AddArg2(x, y)
2971                 return true
2972         }
2973         // match: (Lsh64x16 <t> x y)
2974         // result: (ISEL [2] (SLD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y)))
2975         for {
2976                 t := v.Type
2977                 x := v_0
2978                 y := v_1
2979                 v.reset(OpPPC64ISEL)
2980                 v.AuxInt = int32ToAuxInt(2)
2981                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2982                 v0.AddArg2(x, y)
2983                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2984                 v1.AuxInt = int64ToAuxInt(0)
2985                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2986                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2987                 v3.AuxInt = int64ToAuxInt(0xFFC0)
2988                 v3.AddArg(y)
2989                 v2.AddArg(v3)
2990                 v.AddArg3(v0, v1, v2)
2991                 return true
2992         }
2993 }
2994 func rewriteValuePPC64_OpLsh64x32(v *Value) bool {
2995         v_1 := v.Args[1]
2996         v_0 := v.Args[0]
2997         b := v.Block
2998         typ := &b.Func.Config.Types
2999         // match: (Lsh64x32 x y)
3000         // cond: shiftIsBounded(v)
3001         // result: (SLD x y)
3002         for {
3003                 x := v_0
3004                 y := v_1
3005                 if !(shiftIsBounded(v)) {
3006                         break
3007                 }
3008                 v.reset(OpPPC64SLD)
3009                 v.AddArg2(x, y)
3010                 return true
3011         }
3012         // match: (Lsh64x32 <t> x y)
3013         // result: (ISEL [0] (SLD <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
3014         for {
3015                 t := v.Type
3016                 x := v_0
3017                 y := v_1
3018                 v.reset(OpPPC64ISEL)
3019                 v.AuxInt = int32ToAuxInt(0)
3020                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3021                 v0.AddArg2(x, y)
3022                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3023                 v1.AuxInt = int64ToAuxInt(0)
3024                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
3025                 v2.AuxInt = int32ToAuxInt(64)
3026                 v2.AddArg(y)
3027                 v.AddArg3(v0, v1, v2)
3028                 return true
3029         }
3030 }
3031 func rewriteValuePPC64_OpLsh64x64(v *Value) bool {
3032         v_1 := v.Args[1]
3033         v_0 := v.Args[0]
3034         b := v.Block
3035         typ := &b.Func.Config.Types
3036         // match: (Lsh64x64 x (MOVDconst [c]))
3037         // cond: uint64(c) < 64
3038         // result: (SLDconst x [c])
3039         for {
3040                 x := v_0
3041                 if v_1.Op != OpPPC64MOVDconst {
3042                         break
3043                 }
3044                 c := auxIntToInt64(v_1.AuxInt)
3045                 if !(uint64(c) < 64) {
3046                         break
3047                 }
3048                 v.reset(OpPPC64SLDconst)
3049                 v.AuxInt = int64ToAuxInt(c)
3050                 v.AddArg(x)
3051                 return true
3052         }
3053         // match: (Lsh64x64 x y)
3054         // cond: shiftIsBounded(v)
3055         // result: (SLD x y)
3056         for {
3057                 x := v_0
3058                 y := v_1
3059                 if !(shiftIsBounded(v)) {
3060                         break
3061                 }
3062                 v.reset(OpPPC64SLD)
3063                 v.AddArg2(x, y)
3064                 return true
3065         }
3066         // match: (Lsh64x64 <t> x y)
3067         // result: (ISEL [0] (SLD <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
3068         for {
3069                 t := v.Type
3070                 x := v_0
3071                 y := v_1
3072                 v.reset(OpPPC64ISEL)
3073                 v.AuxInt = int32ToAuxInt(0)
3074                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3075                 v0.AddArg2(x, y)
3076                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3077                 v1.AuxInt = int64ToAuxInt(0)
3078                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
3079                 v2.AuxInt = int64ToAuxInt(64)
3080                 v2.AddArg(y)
3081                 v.AddArg3(v0, v1, v2)
3082                 return true
3083         }
3084 }
3085 func rewriteValuePPC64_OpLsh64x8(v *Value) bool {
3086         v_1 := v.Args[1]
3087         v_0 := v.Args[0]
3088         b := v.Block
3089         typ := &b.Func.Config.Types
3090         // match: (Lsh64x8 x y)
3091         // cond: shiftIsBounded(v)
3092         // result: (SLD x y)
3093         for {
3094                 x := v_0
3095                 y := v_1
3096                 if !(shiftIsBounded(v)) {
3097                         break
3098                 }
3099                 v.reset(OpPPC64SLD)
3100                 v.AddArg2(x, y)
3101                 return true
3102         }
3103         // match: (Lsh64x8 <t> x y)
3104         // result: (ISEL [2] (SLD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y)))
3105         for {
3106                 t := v.Type
3107                 x := v_0
3108                 y := v_1
3109                 v.reset(OpPPC64ISEL)
3110                 v.AuxInt = int32ToAuxInt(2)
3111                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3112                 v0.AddArg2(x, y)
3113                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3114                 v1.AuxInt = int64ToAuxInt(0)
3115                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
3116                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
3117                 v3.AuxInt = int64ToAuxInt(0x00C0)
3118                 v3.AddArg(y)
3119                 v2.AddArg(v3)
3120                 v.AddArg3(v0, v1, v2)
3121                 return true
3122         }
3123 }
3124 func rewriteValuePPC64_OpLsh8x16(v *Value) bool {
3125         v_1 := v.Args[1]
3126         v_0 := v.Args[0]
3127         b := v.Block
3128         typ := &b.Func.Config.Types
3129         // match: (Lsh8x16 x y)
3130         // cond: shiftIsBounded(v)
3131         // result: (SLD x y)
3132         for {
3133                 x := v_0
3134                 y := v_1
3135                 if !(shiftIsBounded(v)) {
3136                         break
3137                 }
3138                 v.reset(OpPPC64SLD)
3139                 v.AddArg2(x, y)
3140                 return true
3141         }
3142         // match: (Lsh8x16 <t> x y)
3143         // result: (ISEL [2] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y)))
3144         for {
3145                 t := v.Type
3146                 x := v_0
3147                 y := v_1
3148                 v.reset(OpPPC64ISEL)
3149                 v.AuxInt = int32ToAuxInt(2)
3150                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3151                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
3152                 v1.AddArg(x)
3153                 v0.AddArg2(v1, y)
3154                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3155                 v2.AuxInt = int64ToAuxInt(0)
3156                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
3157                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
3158                 v4.AuxInt = int64ToAuxInt(0xFFF8)
3159                 v4.AddArg(y)
3160                 v3.AddArg(v4)
3161                 v.AddArg3(v0, v2, v3)
3162                 return true
3163         }
3164 }
3165 func rewriteValuePPC64_OpLsh8x32(v *Value) bool {
3166         v_1 := v.Args[1]
3167         v_0 := v.Args[0]
3168         b := v.Block
3169         typ := &b.Func.Config.Types
3170         // match: (Lsh8x32 x y)
3171         // cond: shiftIsBounded(v)
3172         // result: (SLD x y)
3173         for {
3174                 x := v_0
3175                 y := v_1
3176                 if !(shiftIsBounded(v)) {
3177                         break
3178                 }
3179                 v.reset(OpPPC64SLD)
3180                 v.AddArg2(x, y)
3181                 return true
3182         }
3183         // match: (Lsh8x32 <t> x y)
3184         // result: (ISEL [0] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [8]))
3185         for {
3186                 t := v.Type
3187                 x := v_0
3188                 y := v_1
3189                 v.reset(OpPPC64ISEL)
3190                 v.AuxInt = int32ToAuxInt(0)
3191                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3192                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
3193                 v1.AddArg(x)
3194                 v0.AddArg2(v1, y)
3195                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3196                 v2.AuxInt = int64ToAuxInt(0)
3197                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
3198                 v3.AuxInt = int32ToAuxInt(8)
3199                 v3.AddArg(y)
3200                 v.AddArg3(v0, v2, v3)
3201                 return true
3202         }
3203 }
3204 func rewriteValuePPC64_OpLsh8x64(v *Value) bool {
3205         v_1 := v.Args[1]
3206         v_0 := v.Args[0]
3207         b := v.Block
3208         typ := &b.Func.Config.Types
3209         // match: (Lsh8x64 x (MOVDconst [c]))
3210         // cond: uint64(c) < 8
3211         // result: (SLWconst x [c])
3212         for {
3213                 x := v_0
3214                 if v_1.Op != OpPPC64MOVDconst {
3215                         break
3216                 }
3217                 c := auxIntToInt64(v_1.AuxInt)
3218                 if !(uint64(c) < 8) {
3219                         break
3220                 }
3221                 v.reset(OpPPC64SLWconst)
3222                 v.AuxInt = int64ToAuxInt(c)
3223                 v.AddArg(x)
3224                 return true
3225         }
3226         // match: (Lsh8x64 x y)
3227         // cond: shiftIsBounded(v)
3228         // result: (SLD x y)
3229         for {
3230                 x := v_0
3231                 y := v_1
3232                 if !(shiftIsBounded(v)) {
3233                         break
3234                 }
3235                 v.reset(OpPPC64SLD)
3236                 v.AddArg2(x, y)
3237                 return true
3238         }
3239         // match: (Lsh8x64 <t> x y)
3240         // result: (ISEL [0] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [8]))
3241         for {
3242                 t := v.Type
3243                 x := v_0
3244                 y := v_1
3245                 v.reset(OpPPC64ISEL)
3246                 v.AuxInt = int32ToAuxInt(0)
3247                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3248                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
3249                 v1.AddArg(x)
3250                 v0.AddArg2(v1, y)
3251                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3252                 v2.AuxInt = int64ToAuxInt(0)
3253                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
3254                 v3.AuxInt = int64ToAuxInt(8)
3255                 v3.AddArg(y)
3256                 v.AddArg3(v0, v2, v3)
3257                 return true
3258         }
3259 }
3260 func rewriteValuePPC64_OpLsh8x8(v *Value) bool {
3261         v_1 := v.Args[1]
3262         v_0 := v.Args[0]
3263         b := v.Block
3264         typ := &b.Func.Config.Types
3265         // match: (Lsh8x8 x y)
3266         // cond: shiftIsBounded(v)
3267         // result: (SLD x y)
3268         for {
3269                 x := v_0
3270                 y := v_1
3271                 if !(shiftIsBounded(v)) {
3272                         break
3273                 }
3274                 v.reset(OpPPC64SLD)
3275                 v.AddArg2(x, y)
3276                 return true
3277         }
3278         // match: (Lsh8x8 <t> x y)
3279         // result: (ISEL [2] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y)))
3280         for {
3281                 t := v.Type
3282                 x := v_0
3283                 y := v_1
3284                 v.reset(OpPPC64ISEL)
3285                 v.AuxInt = int32ToAuxInt(2)
3286                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3287                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
3288                 v1.AddArg(x)
3289                 v0.AddArg2(v1, y)
3290                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3291                 v2.AuxInt = int64ToAuxInt(0)
3292                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
3293                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
3294                 v4.AuxInt = int64ToAuxInt(0x00F8)
3295                 v4.AddArg(y)
3296                 v3.AddArg(v4)
3297                 v.AddArg3(v0, v2, v3)
3298                 return true
3299         }
3300 }
3301 func rewriteValuePPC64_OpMod16(v *Value) bool {
3302         v_1 := v.Args[1]
3303         v_0 := v.Args[0]
3304         b := v.Block
3305         typ := &b.Func.Config.Types
3306         // match: (Mod16 x y)
3307         // result: (Mod32 (SignExt16to32 x) (SignExt16to32 y))
3308         for {
3309                 x := v_0
3310                 y := v_1
3311                 v.reset(OpMod32)
3312                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3313                 v0.AddArg(x)
3314                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3315                 v1.AddArg(y)
3316                 v.AddArg2(v0, v1)
3317                 return true
3318         }
3319 }
3320 func rewriteValuePPC64_OpMod16u(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: (Mod16u x y)
3326         // result: (Mod32u (ZeroExt16to32 x) (ZeroExt16to32 y))
3327         for {
3328                 x := v_0
3329                 y := v_1
3330                 v.reset(OpMod32u)
3331                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3332                 v0.AddArg(x)
3333                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3334                 v1.AddArg(y)
3335                 v.AddArg2(v0, v1)
3336                 return true
3337         }
3338 }
3339 func rewriteValuePPC64_OpMod32(v *Value) bool {
3340         v_1 := v.Args[1]
3341         v_0 := v.Args[0]
3342         b := v.Block
3343         typ := &b.Func.Config.Types
3344         // match: (Mod32 x y)
3345         // cond: buildcfg.GOPPC64 >= 9
3346         // result: (MODSW x y)
3347         for {
3348                 x := v_0
3349                 y := v_1
3350                 if !(buildcfg.GOPPC64 >= 9) {
3351                         break
3352                 }
3353                 v.reset(OpPPC64MODSW)
3354                 v.AddArg2(x, y)
3355                 return true
3356         }
3357         // match: (Mod32 x y)
3358         // cond: buildcfg.GOPPC64 <= 8
3359         // result: (SUB x (MULLW y (DIVW x y)))
3360         for {
3361                 x := v_0
3362                 y := v_1
3363                 if !(buildcfg.GOPPC64 <= 8) {
3364                         break
3365                 }
3366                 v.reset(OpPPC64SUB)
3367                 v0 := b.NewValue0(v.Pos, OpPPC64MULLW, typ.Int32)
3368                 v1 := b.NewValue0(v.Pos, OpPPC64DIVW, typ.Int32)
3369                 v1.AddArg2(x, y)
3370                 v0.AddArg2(y, v1)
3371                 v.AddArg2(x, v0)
3372                 return true
3373         }
3374         return false
3375 }
3376 func rewriteValuePPC64_OpMod32u(v *Value) bool {
3377         v_1 := v.Args[1]
3378         v_0 := v.Args[0]
3379         b := v.Block
3380         typ := &b.Func.Config.Types
3381         // match: (Mod32u x y)
3382         // cond: buildcfg.GOPPC64 >= 9
3383         // result: (MODUW x y)
3384         for {
3385                 x := v_0
3386                 y := v_1
3387                 if !(buildcfg.GOPPC64 >= 9) {
3388                         break
3389                 }
3390                 v.reset(OpPPC64MODUW)
3391                 v.AddArg2(x, y)
3392                 return true
3393         }
3394         // match: (Mod32u x y)
3395         // cond: buildcfg.GOPPC64 <= 8
3396         // result: (SUB x (MULLW y (DIVWU x y)))
3397         for {
3398                 x := v_0
3399                 y := v_1
3400                 if !(buildcfg.GOPPC64 <= 8) {
3401                         break
3402                 }
3403                 v.reset(OpPPC64SUB)
3404                 v0 := b.NewValue0(v.Pos, OpPPC64MULLW, typ.Int32)
3405                 v1 := b.NewValue0(v.Pos, OpPPC64DIVWU, typ.Int32)
3406                 v1.AddArg2(x, y)
3407                 v0.AddArg2(y, v1)
3408                 v.AddArg2(x, v0)
3409                 return true
3410         }
3411         return false
3412 }
3413 func rewriteValuePPC64_OpMod64(v *Value) bool {
3414         v_1 := v.Args[1]
3415         v_0 := v.Args[0]
3416         b := v.Block
3417         typ := &b.Func.Config.Types
3418         // match: (Mod64 x y)
3419         // cond: buildcfg.GOPPC64 >=9
3420         // result: (MODSD x y)
3421         for {
3422                 x := v_0
3423                 y := v_1
3424                 if !(buildcfg.GOPPC64 >= 9) {
3425                         break
3426                 }
3427                 v.reset(OpPPC64MODSD)
3428                 v.AddArg2(x, y)
3429                 return true
3430         }
3431         // match: (Mod64 x y)
3432         // cond: buildcfg.GOPPC64 <=8
3433         // result: (SUB x (MULLD y (DIVD x y)))
3434         for {
3435                 x := v_0
3436                 y := v_1
3437                 if !(buildcfg.GOPPC64 <= 8) {
3438                         break
3439                 }
3440                 v.reset(OpPPC64SUB)
3441                 v0 := b.NewValue0(v.Pos, OpPPC64MULLD, typ.Int64)
3442                 v1 := b.NewValue0(v.Pos, OpPPC64DIVD, typ.Int64)
3443                 v1.AddArg2(x, y)
3444                 v0.AddArg2(y, v1)
3445                 v.AddArg2(x, v0)
3446                 return true
3447         }
3448         return false
3449 }
3450 func rewriteValuePPC64_OpMod64u(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: (Mod64u x y)
3456         // cond: buildcfg.GOPPC64 >= 9
3457         // result: (MODUD x y)
3458         for {
3459                 x := v_0
3460                 y := v_1
3461                 if !(buildcfg.GOPPC64 >= 9) {
3462                         break
3463                 }
3464                 v.reset(OpPPC64MODUD)
3465                 v.AddArg2(x, y)
3466                 return true
3467         }
3468         // match: (Mod64u x y)
3469         // cond: buildcfg.GOPPC64 <= 8
3470         // result: (SUB x (MULLD y (DIVDU x y)))
3471         for {
3472                 x := v_0
3473                 y := v_1
3474                 if !(buildcfg.GOPPC64 <= 8) {
3475                         break
3476                 }
3477                 v.reset(OpPPC64SUB)
3478                 v0 := b.NewValue0(v.Pos, OpPPC64MULLD, typ.Int64)
3479                 v1 := b.NewValue0(v.Pos, OpPPC64DIVDU, typ.Int64)
3480                 v1.AddArg2(x, y)
3481                 v0.AddArg2(y, v1)
3482                 v.AddArg2(x, v0)
3483                 return true
3484         }
3485         return false
3486 }
3487 func rewriteValuePPC64_OpMod8(v *Value) bool {
3488         v_1 := v.Args[1]
3489         v_0 := v.Args[0]
3490         b := v.Block
3491         typ := &b.Func.Config.Types
3492         // match: (Mod8 x y)
3493         // result: (Mod32 (SignExt8to32 x) (SignExt8to32 y))
3494         for {
3495                 x := v_0
3496                 y := v_1
3497                 v.reset(OpMod32)
3498                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3499                 v0.AddArg(x)
3500                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3501                 v1.AddArg(y)
3502                 v.AddArg2(v0, v1)
3503                 return true
3504         }
3505 }
3506 func rewriteValuePPC64_OpMod8u(v *Value) bool {
3507         v_1 := v.Args[1]
3508         v_0 := v.Args[0]
3509         b := v.Block
3510         typ := &b.Func.Config.Types
3511         // match: (Mod8u x y)
3512         // result: (Mod32u (ZeroExt8to32 x) (ZeroExt8to32 y))
3513         for {
3514                 x := v_0
3515                 y := v_1
3516                 v.reset(OpMod32u)
3517                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3518                 v0.AddArg(x)
3519                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3520                 v1.AddArg(y)
3521                 v.AddArg2(v0, v1)
3522                 return true
3523         }
3524 }
3525 func rewriteValuePPC64_OpMove(v *Value) bool {
3526         v_2 := v.Args[2]
3527         v_1 := v.Args[1]
3528         v_0 := v.Args[0]
3529         b := v.Block
3530         typ := &b.Func.Config.Types
3531         // match: (Move [0] _ _ mem)
3532         // result: mem
3533         for {
3534                 if auxIntToInt64(v.AuxInt) != 0 {
3535                         break
3536                 }
3537                 mem := v_2
3538                 v.copyOf(mem)
3539                 return true
3540         }
3541         // match: (Move [1] dst src mem)
3542         // result: (MOVBstore dst (MOVBZload src mem) mem)
3543         for {
3544                 if auxIntToInt64(v.AuxInt) != 1 {
3545                         break
3546                 }
3547                 dst := v_0
3548                 src := v_1
3549                 mem := v_2
3550                 v.reset(OpPPC64MOVBstore)
3551                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3552                 v0.AddArg2(src, mem)
3553                 v.AddArg3(dst, v0, mem)
3554                 return true
3555         }
3556         // match: (Move [2] dst src mem)
3557         // result: (MOVHstore dst (MOVHZload src mem) mem)
3558         for {
3559                 if auxIntToInt64(v.AuxInt) != 2 {
3560                         break
3561                 }
3562                 dst := v_0
3563                 src := v_1
3564                 mem := v_2
3565                 v.reset(OpPPC64MOVHstore)
3566                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16)
3567                 v0.AddArg2(src, mem)
3568                 v.AddArg3(dst, v0, mem)
3569                 return true
3570         }
3571         // match: (Move [4] dst src mem)
3572         // result: (MOVWstore dst (MOVWZload src mem) mem)
3573         for {
3574                 if auxIntToInt64(v.AuxInt) != 4 {
3575                         break
3576                 }
3577                 dst := v_0
3578                 src := v_1
3579                 mem := v_2
3580                 v.reset(OpPPC64MOVWstore)
3581                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3582                 v0.AddArg2(src, mem)
3583                 v.AddArg3(dst, v0, mem)
3584                 return true
3585         }
3586         // match: (Move [8] {t} dst src mem)
3587         // result: (MOVDstore dst (MOVDload src mem) mem)
3588         for {
3589                 if auxIntToInt64(v.AuxInt) != 8 {
3590                         break
3591                 }
3592                 dst := v_0
3593                 src := v_1
3594                 mem := v_2
3595                 v.reset(OpPPC64MOVDstore)
3596                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, typ.Int64)
3597                 v0.AddArg2(src, mem)
3598                 v.AddArg3(dst, v0, mem)
3599                 return true
3600         }
3601         // match: (Move [3] dst src mem)
3602         // result: (MOVBstore [2] dst (MOVBZload [2] src mem) (MOVHstore dst (MOVHload src mem) mem))
3603         for {
3604                 if auxIntToInt64(v.AuxInt) != 3 {
3605                         break
3606                 }
3607                 dst := v_0
3608                 src := v_1
3609                 mem := v_2
3610                 v.reset(OpPPC64MOVBstore)
3611                 v.AuxInt = int32ToAuxInt(2)
3612                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3613                 v0.AuxInt = int32ToAuxInt(2)
3614                 v0.AddArg2(src, mem)
3615                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHstore, types.TypeMem)
3616                 v2 := b.NewValue0(v.Pos, OpPPC64MOVHload, typ.Int16)
3617                 v2.AddArg2(src, mem)
3618                 v1.AddArg3(dst, v2, mem)
3619                 v.AddArg3(dst, v0, v1)
3620                 return true
3621         }
3622         // match: (Move [5] dst src mem)
3623         // result: (MOVBstore [4] dst (MOVBZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3624         for {
3625                 if auxIntToInt64(v.AuxInt) != 5 {
3626                         break
3627                 }
3628                 dst := v_0
3629                 src := v_1
3630                 mem := v_2
3631                 v.reset(OpPPC64MOVBstore)
3632                 v.AuxInt = int32ToAuxInt(4)
3633                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3634                 v0.AuxInt = int32ToAuxInt(4)
3635                 v0.AddArg2(src, mem)
3636                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem)
3637                 v2 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3638                 v2.AddArg2(src, mem)
3639                 v1.AddArg3(dst, v2, mem)
3640                 v.AddArg3(dst, v0, v1)
3641                 return true
3642         }
3643         // match: (Move [6] dst src mem)
3644         // result: (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3645         for {
3646                 if auxIntToInt64(v.AuxInt) != 6 {
3647                         break
3648                 }
3649                 dst := v_0
3650                 src := v_1
3651                 mem := v_2
3652                 v.reset(OpPPC64MOVHstore)
3653                 v.AuxInt = int32ToAuxInt(4)
3654                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16)
3655                 v0.AuxInt = int32ToAuxInt(4)
3656                 v0.AddArg2(src, mem)
3657                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem)
3658                 v2 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3659                 v2.AddArg2(src, mem)
3660                 v1.AddArg3(dst, v2, mem)
3661                 v.AddArg3(dst, v0, v1)
3662                 return true
3663         }
3664         // match: (Move [7] dst src mem)
3665         // result: (MOVBstore [6] dst (MOVBZload [6] src mem) (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem)))
3666         for {
3667                 if auxIntToInt64(v.AuxInt) != 7 {
3668                         break
3669                 }
3670                 dst := v_0
3671                 src := v_1
3672                 mem := v_2
3673                 v.reset(OpPPC64MOVBstore)
3674                 v.AuxInt = int32ToAuxInt(6)
3675                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3676                 v0.AuxInt = int32ToAuxInt(6)
3677                 v0.AddArg2(src, mem)
3678                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHstore, types.TypeMem)
3679                 v1.AuxInt = int32ToAuxInt(4)
3680                 v2 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16)
3681                 v2.AuxInt = int32ToAuxInt(4)
3682                 v2.AddArg2(src, mem)
3683                 v3 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem)
3684                 v4 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3685                 v4.AddArg2(src, mem)
3686                 v3.AddArg3(dst, v4, mem)
3687                 v1.AddArg3(dst, v2, v3)
3688                 v.AddArg3(dst, v0, v1)
3689                 return true
3690         }
3691         // match: (Move [s] dst src mem)
3692         // cond: s > 8 && buildcfg.GOPPC64 <= 8 && logLargeCopy(v, s)
3693         // result: (LoweredMove [s] dst src mem)
3694         for {
3695                 s := auxIntToInt64(v.AuxInt)
3696                 dst := v_0
3697                 src := v_1
3698                 mem := v_2
3699                 if !(s > 8 && buildcfg.GOPPC64 <= 8 && logLargeCopy(v, s)) {
3700                         break
3701                 }
3702                 v.reset(OpPPC64LoweredMove)
3703                 v.AuxInt = int64ToAuxInt(s)
3704                 v.AddArg3(dst, src, mem)
3705                 return true
3706         }
3707         // match: (Move [s] dst src mem)
3708         // cond: s > 8 && s <= 64 && buildcfg.GOPPC64 >= 9
3709         // result: (LoweredQuadMoveShort [s] dst src mem)
3710         for {
3711                 s := auxIntToInt64(v.AuxInt)
3712                 dst := v_0
3713                 src := v_1
3714                 mem := v_2
3715                 if !(s > 8 && s <= 64 && buildcfg.GOPPC64 >= 9) {
3716                         break
3717                 }
3718                 v.reset(OpPPC64LoweredQuadMoveShort)
3719                 v.AuxInt = int64ToAuxInt(s)
3720                 v.AddArg3(dst, src, mem)
3721                 return true
3722         }
3723         // match: (Move [s] dst src mem)
3724         // cond: s > 8 && buildcfg.GOPPC64 >= 9 && logLargeCopy(v, s)
3725         // result: (LoweredQuadMove [s] dst src mem)
3726         for {
3727                 s := auxIntToInt64(v.AuxInt)
3728                 dst := v_0
3729                 src := v_1
3730                 mem := v_2
3731                 if !(s > 8 && buildcfg.GOPPC64 >= 9 && logLargeCopy(v, s)) {
3732                         break
3733                 }
3734                 v.reset(OpPPC64LoweredQuadMove)
3735                 v.AuxInt = int64ToAuxInt(s)
3736                 v.AddArg3(dst, src, mem)
3737                 return true
3738         }
3739         return false
3740 }
3741 func rewriteValuePPC64_OpNeq16(v *Value) bool {
3742         v_1 := v.Args[1]
3743         v_0 := v.Args[0]
3744         b := v.Block
3745         typ := &b.Func.Config.Types
3746         // match: (Neq16 x y)
3747         // cond: x.Type.IsSigned() && y.Type.IsSigned()
3748         // result: (NotEqual (CMPW (SignExt16to32 x) (SignExt16to32 y)))
3749         for {
3750                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3751                         x := v_0
3752                         y := v_1
3753                         if !(x.Type.IsSigned() && y.Type.IsSigned()) {
3754                                 continue
3755                         }
3756                         v.reset(OpPPC64NotEqual)
3757                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3758                         v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3759                         v1.AddArg(x)
3760                         v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3761                         v2.AddArg(y)
3762                         v0.AddArg2(v1, v2)
3763                         v.AddArg(v0)
3764                         return true
3765                 }
3766                 break
3767         }
3768         // match: (Neq16 x y)
3769         // result: (NotEqual (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
3770         for {
3771                 x := v_0
3772                 y := v_1
3773                 v.reset(OpPPC64NotEqual)
3774                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3775                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3776                 v1.AddArg(x)
3777                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3778                 v2.AddArg(y)
3779                 v0.AddArg2(v1, v2)
3780                 v.AddArg(v0)
3781                 return true
3782         }
3783 }
3784 func rewriteValuePPC64_OpNeq32(v *Value) bool {
3785         v_1 := v.Args[1]
3786         v_0 := v.Args[0]
3787         b := v.Block
3788         // match: (Neq32 x y)
3789         // result: (NotEqual (CMPW x y))
3790         for {
3791                 x := v_0
3792                 y := v_1
3793                 v.reset(OpPPC64NotEqual)
3794                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3795                 v0.AddArg2(x, y)
3796                 v.AddArg(v0)
3797                 return true
3798         }
3799 }
3800 func rewriteValuePPC64_OpNeq32F(v *Value) bool {
3801         v_1 := v.Args[1]
3802         v_0 := v.Args[0]
3803         b := v.Block
3804         // match: (Neq32F x y)
3805         // result: (NotEqual (FCMPU x y))
3806         for {
3807                 x := v_0
3808                 y := v_1
3809                 v.reset(OpPPC64NotEqual)
3810                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
3811                 v0.AddArg2(x, y)
3812                 v.AddArg(v0)
3813                 return true
3814         }
3815 }
3816 func rewriteValuePPC64_OpNeq64(v *Value) bool {
3817         v_1 := v.Args[1]
3818         v_0 := v.Args[0]
3819         b := v.Block
3820         // match: (Neq64 x y)
3821         // result: (NotEqual (CMP x y))
3822         for {
3823                 x := v_0
3824                 y := v_1
3825                 v.reset(OpPPC64NotEqual)
3826                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
3827                 v0.AddArg2(x, y)
3828                 v.AddArg(v0)
3829                 return true
3830         }
3831 }
3832 func rewriteValuePPC64_OpNeq64F(v *Value) bool {
3833         v_1 := v.Args[1]
3834         v_0 := v.Args[0]
3835         b := v.Block
3836         // match: (Neq64F x y)
3837         // result: (NotEqual (FCMPU x y))
3838         for {
3839                 x := v_0
3840                 y := v_1
3841                 v.reset(OpPPC64NotEqual)
3842                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
3843                 v0.AddArg2(x, y)
3844                 v.AddArg(v0)
3845                 return true
3846         }
3847 }
3848 func rewriteValuePPC64_OpNeq8(v *Value) bool {
3849         v_1 := v.Args[1]
3850         v_0 := v.Args[0]
3851         b := v.Block
3852         typ := &b.Func.Config.Types
3853         // match: (Neq8 x y)
3854         // cond: x.Type.IsSigned() && y.Type.IsSigned()
3855         // result: (NotEqual (CMPW (SignExt8to32 x) (SignExt8to32 y)))
3856         for {
3857                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3858                         x := v_0
3859                         y := v_1
3860                         if !(x.Type.IsSigned() && y.Type.IsSigned()) {
3861                                 continue
3862                         }
3863                         v.reset(OpPPC64NotEqual)
3864                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3865                         v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3866                         v1.AddArg(x)
3867                         v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3868                         v2.AddArg(y)
3869                         v0.AddArg2(v1, v2)
3870                         v.AddArg(v0)
3871                         return true
3872                 }
3873                 break
3874         }
3875         // match: (Neq8 x y)
3876         // result: (NotEqual (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
3877         for {
3878                 x := v_0
3879                 y := v_1
3880                 v.reset(OpPPC64NotEqual)
3881                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3882                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3883                 v1.AddArg(x)
3884                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3885                 v2.AddArg(y)
3886                 v0.AddArg2(v1, v2)
3887                 v.AddArg(v0)
3888                 return true
3889         }
3890 }
3891 func rewriteValuePPC64_OpNeqPtr(v *Value) bool {
3892         v_1 := v.Args[1]
3893         v_0 := v.Args[0]
3894         b := v.Block
3895         // match: (NeqPtr x y)
3896         // result: (NotEqual (CMP x y))
3897         for {
3898                 x := v_0
3899                 y := v_1
3900                 v.reset(OpPPC64NotEqual)
3901                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
3902                 v0.AddArg2(x, y)
3903                 v.AddArg(v0)
3904                 return true
3905         }
3906 }
3907 func rewriteValuePPC64_OpNot(v *Value) bool {
3908         v_0 := v.Args[0]
3909         // match: (Not x)
3910         // result: (XORconst [1] x)
3911         for {
3912                 x := v_0
3913                 v.reset(OpPPC64XORconst)
3914                 v.AuxInt = int64ToAuxInt(1)
3915                 v.AddArg(x)
3916                 return true
3917         }
3918 }
3919 func rewriteValuePPC64_OpOffPtr(v *Value) bool {
3920         v_0 := v.Args[0]
3921         b := v.Block
3922         typ := &b.Func.Config.Types
3923         // match: (OffPtr [off] ptr)
3924         // result: (ADD (MOVDconst <typ.Int64> [off]) ptr)
3925         for {
3926                 off := auxIntToInt64(v.AuxInt)
3927                 ptr := v_0
3928                 v.reset(OpPPC64ADD)
3929                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3930                 v0.AuxInt = int64ToAuxInt(off)
3931                 v.AddArg2(v0, ptr)
3932                 return true
3933         }
3934 }
3935 func rewriteValuePPC64_OpPPC64ADD(v *Value) bool {
3936         v_1 := v.Args[1]
3937         v_0 := v.Args[0]
3938         // match: (ADD l:(MULLD x y) z)
3939         // cond: buildcfg.GOPPC64 >= 9 && l.Uses == 1 && clobber(l)
3940         // result: (MADDLD x y z)
3941         for {
3942                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3943                         l := v_0
3944                         if l.Op != OpPPC64MULLD {
3945                                 continue
3946                         }
3947                         y := l.Args[1]
3948                         x := l.Args[0]
3949                         z := v_1
3950                         if !(buildcfg.GOPPC64 >= 9 && l.Uses == 1 && clobber(l)) {
3951                                 continue
3952                         }
3953                         v.reset(OpPPC64MADDLD)
3954                         v.AddArg3(x, y, z)
3955                         return true
3956                 }
3957                 break
3958         }
3959         // match: (ADD x (MOVDconst <t> [c]))
3960         // cond: is32Bit(c) && !t.IsPtr()
3961         // result: (ADDconst [c] x)
3962         for {
3963                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3964                         x := v_0
3965                         if v_1.Op != OpPPC64MOVDconst {
3966                                 continue
3967                         }
3968                         t := v_1.Type
3969                         c := auxIntToInt64(v_1.AuxInt)
3970                         if !(is32Bit(c) && !t.IsPtr()) {
3971                                 continue
3972                         }
3973                         v.reset(OpPPC64ADDconst)
3974                         v.AuxInt = int64ToAuxInt(c)
3975                         v.AddArg(x)
3976                         return true
3977                 }
3978                 break
3979         }
3980         return false
3981 }
3982 func rewriteValuePPC64_OpPPC64ADDE(v *Value) bool {
3983         v_2 := v.Args[2]
3984         v_1 := v.Args[1]
3985         v_0 := v.Args[0]
3986         b := v.Block
3987         typ := &b.Func.Config.Types
3988         // match: (ADDE x y (Select1 <typ.UInt64> (ADDCconst (MOVDconst [0]) [-1])))
3989         // result: (ADDC x y)
3990         for {
3991                 x := v_0
3992                 y := v_1
3993                 if v_2.Op != OpSelect1 || v_2.Type != typ.UInt64 {
3994                         break
3995                 }
3996                 v_2_0 := v_2.Args[0]
3997                 if v_2_0.Op != OpPPC64ADDCconst || auxIntToInt64(v_2_0.AuxInt) != -1 {
3998                         break
3999                 }
4000                 v_2_0_0 := v_2_0.Args[0]
4001                 if v_2_0_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 {
4002                         break
4003                 }
4004                 v.reset(OpPPC64ADDC)
4005                 v.AddArg2(x, y)
4006                 return true
4007         }
4008         return false
4009 }
4010 func rewriteValuePPC64_OpPPC64ADDconst(v *Value) bool {
4011         v_0 := v.Args[0]
4012         // match: (ADDconst [c] (ADDconst [d] x))
4013         // cond: is32Bit(c+d)
4014         // result: (ADDconst [c+d] x)
4015         for {
4016                 c := auxIntToInt64(v.AuxInt)
4017                 if v_0.Op != OpPPC64ADDconst {
4018                         break
4019                 }
4020                 d := auxIntToInt64(v_0.AuxInt)
4021                 x := v_0.Args[0]
4022                 if !(is32Bit(c + d)) {
4023                         break
4024                 }
4025                 v.reset(OpPPC64ADDconst)
4026                 v.AuxInt = int64ToAuxInt(c + d)
4027                 v.AddArg(x)
4028                 return true
4029         }
4030         // match: (ADDconst [0] x)
4031         // result: x
4032         for {
4033                 if auxIntToInt64(v.AuxInt) != 0 {
4034                         break
4035                 }
4036                 x := v_0
4037                 v.copyOf(x)
4038                 return true
4039         }
4040         // match: (ADDconst [c] (MOVDaddr [d] {sym} x))
4041         // cond: is32Bit(c+int64(d))
4042         // result: (MOVDaddr [int32(c+int64(d))] {sym} x)
4043         for {
4044                 c := auxIntToInt64(v.AuxInt)
4045                 if v_0.Op != OpPPC64MOVDaddr {
4046                         break
4047                 }
4048                 d := auxIntToInt32(v_0.AuxInt)
4049                 sym := auxToSym(v_0.Aux)
4050                 x := v_0.Args[0]
4051                 if !(is32Bit(c + int64(d))) {
4052                         break
4053                 }
4054                 v.reset(OpPPC64MOVDaddr)
4055                 v.AuxInt = int32ToAuxInt(int32(c + int64(d)))
4056                 v.Aux = symToAux(sym)
4057                 v.AddArg(x)
4058                 return true
4059         }
4060         // match: (ADDconst [c] x:(SP))
4061         // cond: is32Bit(c)
4062         // result: (MOVDaddr [int32(c)] x)
4063         for {
4064                 c := auxIntToInt64(v.AuxInt)
4065                 x := v_0
4066                 if x.Op != OpSP || !(is32Bit(c)) {
4067                         break
4068                 }
4069                 v.reset(OpPPC64MOVDaddr)
4070                 v.AuxInt = int32ToAuxInt(int32(c))
4071                 v.AddArg(x)
4072                 return true
4073         }
4074         // match: (ADDconst [c] (SUBFCconst [d] x))
4075         // cond: is32Bit(c+d)
4076         // result: (SUBFCconst [c+d] x)
4077         for {
4078                 c := auxIntToInt64(v.AuxInt)
4079                 if v_0.Op != OpPPC64SUBFCconst {
4080                         break
4081                 }
4082                 d := auxIntToInt64(v_0.AuxInt)
4083                 x := v_0.Args[0]
4084                 if !(is32Bit(c + d)) {
4085                         break
4086                 }
4087                 v.reset(OpPPC64SUBFCconst)
4088                 v.AuxInt = int64ToAuxInt(c + d)
4089                 v.AddArg(x)
4090                 return true
4091         }
4092         return false
4093 }
4094 func rewriteValuePPC64_OpPPC64AND(v *Value) bool {
4095         v_1 := v.Args[1]
4096         v_0 := v.Args[0]
4097         b := v.Block
4098         typ := &b.Func.Config.Types
4099         // match: (AND (MOVDconst [m]) (ROTLWconst [r] x))
4100         // cond: isPPC64WordRotateMask(m)
4101         // result: (RLWINM [encodePPC64RotateMask(r,m,32)] x)
4102         for {
4103                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4104                         if v_0.Op != OpPPC64MOVDconst {
4105                                 continue
4106                         }
4107                         m := auxIntToInt64(v_0.AuxInt)
4108                         if v_1.Op != OpPPC64ROTLWconst {
4109                                 continue
4110                         }
4111                         r := auxIntToInt64(v_1.AuxInt)
4112                         x := v_1.Args[0]
4113                         if !(isPPC64WordRotateMask(m)) {
4114                                 continue
4115                         }
4116                         v.reset(OpPPC64RLWINM)
4117                         v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, m, 32))
4118                         v.AddArg(x)
4119                         return true
4120                 }
4121                 break
4122         }
4123         // match: (AND (MOVDconst [m]) (ROTLW x r))
4124         // cond: isPPC64WordRotateMask(m)
4125         // result: (RLWNM [encodePPC64RotateMask(0,m,32)] x r)
4126         for {
4127                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4128                         if v_0.Op != OpPPC64MOVDconst {
4129                                 continue
4130                         }
4131                         m := auxIntToInt64(v_0.AuxInt)
4132                         if v_1.Op != OpPPC64ROTLW {
4133                                 continue
4134                         }
4135                         r := v_1.Args[1]
4136                         x := v_1.Args[0]
4137                         if !(isPPC64WordRotateMask(m)) {
4138                                 continue
4139                         }
4140                         v.reset(OpPPC64RLWNM)
4141                         v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32))
4142                         v.AddArg2(x, r)
4143                         return true
4144                 }
4145                 break
4146         }
4147         // match: (AND (MOVDconst [m]) (SRWconst x [s]))
4148         // cond: mergePPC64RShiftMask(m,s,32) == 0
4149         // result: (MOVDconst [0])
4150         for {
4151                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4152                         if v_0.Op != OpPPC64MOVDconst {
4153                                 continue
4154                         }
4155                         m := auxIntToInt64(v_0.AuxInt)
4156                         if v_1.Op != OpPPC64SRWconst {
4157                                 continue
4158                         }
4159                         s := auxIntToInt64(v_1.AuxInt)
4160                         if !(mergePPC64RShiftMask(m, s, 32) == 0) {
4161                                 continue
4162                         }
4163                         v.reset(OpPPC64MOVDconst)
4164                         v.AuxInt = int64ToAuxInt(0)
4165                         return true
4166                 }
4167                 break
4168         }
4169         // match: (AND (MOVDconst [m]) (SRWconst x [s]))
4170         // cond: mergePPC64AndSrwi(m,s) != 0
4171         // result: (RLWINM [mergePPC64AndSrwi(m,s)] x)
4172         for {
4173                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4174                         if v_0.Op != OpPPC64MOVDconst {
4175                                 continue
4176                         }
4177                         m := auxIntToInt64(v_0.AuxInt)
4178                         if v_1.Op != OpPPC64SRWconst {
4179                                 continue
4180                         }
4181                         s := auxIntToInt64(v_1.AuxInt)
4182                         x := v_1.Args[0]
4183                         if !(mergePPC64AndSrwi(m, s) != 0) {
4184                                 continue
4185                         }
4186                         v.reset(OpPPC64RLWINM)
4187                         v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m, s))
4188                         v.AddArg(x)
4189                         return true
4190                 }
4191                 break
4192         }
4193         // match: (AND x (NOR y y))
4194         // result: (ANDN x y)
4195         for {
4196                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4197                         x := v_0
4198                         if v_1.Op != OpPPC64NOR {
4199                                 continue
4200                         }
4201                         y := v_1.Args[1]
4202                         if y != v_1.Args[0] {
4203                                 continue
4204                         }
4205                         v.reset(OpPPC64ANDN)
4206                         v.AddArg2(x, y)
4207                         return true
4208                 }
4209                 break
4210         }
4211         // match: (AND (MOVDconst [c]) (MOVDconst [d]))
4212         // result: (MOVDconst [c&d])
4213         for {
4214                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4215                         if v_0.Op != OpPPC64MOVDconst {
4216                                 continue
4217                         }
4218                         c := auxIntToInt64(v_0.AuxInt)
4219                         if v_1.Op != OpPPC64MOVDconst {
4220                                 continue
4221                         }
4222                         d := auxIntToInt64(v_1.AuxInt)
4223                         v.reset(OpPPC64MOVDconst)
4224                         v.AuxInt = int64ToAuxInt(c & d)
4225                         return true
4226                 }
4227                 break
4228         }
4229         // match: (AND x (MOVDconst [c]))
4230         // cond: isU16Bit(c)
4231         // result: (Select0 (ANDCCconst [c] x))
4232         for {
4233                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4234                         x := v_0
4235                         if v_1.Op != OpPPC64MOVDconst {
4236                                 continue
4237                         }
4238                         c := auxIntToInt64(v_1.AuxInt)
4239                         if !(isU16Bit(c)) {
4240                                 continue
4241                         }
4242                         v.reset(OpSelect0)
4243                         v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
4244                         v0.AuxInt = int64ToAuxInt(c)
4245                         v0.AddArg(x)
4246                         v.AddArg(v0)
4247                         return true
4248                 }
4249                 break
4250         }
4251         // match: (AND (MOVDconst [c]) y:(MOVWZreg _))
4252         // cond: c&0xFFFFFFFF == 0xFFFFFFFF
4253         // result: y
4254         for {
4255                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4256                         if v_0.Op != OpPPC64MOVDconst {
4257                                 continue
4258                         }
4259                         c := auxIntToInt64(v_0.AuxInt)
4260                         y := v_1
4261                         if y.Op != OpPPC64MOVWZreg || !(c&0xFFFFFFFF == 0xFFFFFFFF) {
4262                                 continue
4263                         }
4264                         v.copyOf(y)
4265                         return true
4266                 }
4267                 break
4268         }
4269         // match: (AND (MOVDconst [0xFFFFFFFF]) y:(MOVWreg x))
4270         // result: (MOVWZreg x)
4271         for {
4272                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4273                         if v_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_0.AuxInt) != 0xFFFFFFFF {
4274                                 continue
4275                         }
4276                         y := v_1
4277                         if y.Op != OpPPC64MOVWreg {
4278                                 continue
4279                         }
4280                         x := y.Args[0]
4281                         v.reset(OpPPC64MOVWZreg)
4282                         v.AddArg(x)
4283                         return true
4284                 }
4285                 break
4286         }
4287         // match: (AND (MOVDconst [c]) x:(MOVBZload _ _))
4288         // result: (Select0 (ANDCCconst [c&0xFF] x))
4289         for {
4290                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4291                         if v_0.Op != OpPPC64MOVDconst {
4292                                 continue
4293                         }
4294                         c := auxIntToInt64(v_0.AuxInt)
4295                         x := v_1
4296                         if x.Op != OpPPC64MOVBZload {
4297                                 continue
4298                         }
4299                         v.reset(OpSelect0)
4300                         v0 := b.NewValue0(x.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
4301                         v0.AuxInt = int64ToAuxInt(c & 0xFF)
4302                         v0.AddArg(x)
4303                         v.AddArg(v0)
4304                         return true
4305                 }
4306                 break
4307         }
4308         return false
4309 }
4310 func rewriteValuePPC64_OpPPC64ANDCCconst(v *Value) bool {
4311         v_0 := v.Args[0]
4312         // match: (ANDCCconst [c] (Select0 (ANDCCconst [d] x)))
4313         // result: (ANDCCconst [c&d] x)
4314         for {
4315                 c := auxIntToInt64(v.AuxInt)
4316                 if v_0.Op != OpSelect0 {
4317                         break
4318                 }
4319                 v_0_0 := v_0.Args[0]
4320                 if v_0_0.Op != OpPPC64ANDCCconst {
4321                         break
4322                 }
4323                 d := auxIntToInt64(v_0_0.AuxInt)
4324                 x := v_0_0.Args[0]
4325                 v.reset(OpPPC64ANDCCconst)
4326                 v.AuxInt = int64ToAuxInt(c & d)
4327                 v.AddArg(x)
4328                 return true
4329         }
4330         return false
4331 }
4332 func rewriteValuePPC64_OpPPC64ANDN(v *Value) bool {
4333         v_1 := v.Args[1]
4334         v_0 := v.Args[0]
4335         // match: (ANDN (MOVDconst [c]) (MOVDconst [d]))
4336         // result: (MOVDconst [c&^d])
4337         for {
4338                 if v_0.Op != OpPPC64MOVDconst {
4339                         break
4340                 }
4341                 c := auxIntToInt64(v_0.AuxInt)
4342                 if v_1.Op != OpPPC64MOVDconst {
4343                         break
4344                 }
4345                 d := auxIntToInt64(v_1.AuxInt)
4346                 v.reset(OpPPC64MOVDconst)
4347                 v.AuxInt = int64ToAuxInt(c &^ d)
4348                 return true
4349         }
4350         return false
4351 }
4352 func rewriteValuePPC64_OpPPC64BRD(v *Value) bool {
4353         v_0 := v.Args[0]
4354         b := v.Block
4355         typ := &b.Func.Config.Types
4356         // match: (BRD x:(MOVDload [off] {sym} ptr mem))
4357         // cond: x.Uses == 1
4358         // result: @x.Block (MOVDBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
4359         for {
4360                 x := v_0
4361                 if x.Op != OpPPC64MOVDload {
4362                         break
4363                 }
4364                 off := auxIntToInt32(x.AuxInt)
4365                 sym := auxToSym(x.Aux)
4366                 mem := x.Args[1]
4367                 ptr := x.Args[0]
4368                 if !(x.Uses == 1) {
4369                         break
4370                 }
4371                 b = x.Block
4372                 v0 := b.NewValue0(x.Pos, OpPPC64MOVDBRload, typ.UInt64)
4373                 v.copyOf(v0)
4374                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
4375                 v1.AuxInt = int32ToAuxInt(off)
4376                 v1.Aux = symToAux(sym)
4377                 v1.AddArg(ptr)
4378                 v0.AddArg2(v1, mem)
4379                 return true
4380         }
4381         // match: (BRD x:(MOVDloadidx ptr idx mem))
4382         // cond: x.Uses == 1
4383         // result: @x.Block (MOVDBRloadidx ptr idx mem)
4384         for {
4385                 x := v_0
4386                 if x.Op != OpPPC64MOVDloadidx {
4387                         break
4388                 }
4389                 mem := x.Args[2]
4390                 ptr := x.Args[0]
4391                 idx := x.Args[1]
4392                 if !(x.Uses == 1) {
4393                         break
4394                 }
4395                 b = x.Block
4396                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRloadidx, typ.Int64)
4397                 v.copyOf(v0)
4398                 v0.AddArg3(ptr, idx, mem)
4399                 return true
4400         }
4401         return false
4402 }
4403 func rewriteValuePPC64_OpPPC64BRH(v *Value) bool {
4404         v_0 := v.Args[0]
4405         b := v.Block
4406         typ := &b.Func.Config.Types
4407         // match: (BRH x:(MOVHZload [off] {sym} ptr mem))
4408         // cond: x.Uses == 1
4409         // result: @x.Block (MOVHBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
4410         for {
4411                 x := v_0
4412                 if x.Op != OpPPC64MOVHZload {
4413                         break
4414                 }
4415                 off := auxIntToInt32(x.AuxInt)
4416                 sym := auxToSym(x.Aux)
4417                 mem := x.Args[1]
4418                 ptr := x.Args[0]
4419                 if !(x.Uses == 1) {
4420                         break
4421                 }
4422                 b = x.Block
4423                 v0 := b.NewValue0(x.Pos, OpPPC64MOVHBRload, typ.UInt16)
4424                 v.copyOf(v0)
4425                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
4426                 v1.AuxInt = int32ToAuxInt(off)
4427                 v1.Aux = symToAux(sym)
4428                 v1.AddArg(ptr)
4429                 v0.AddArg2(v1, mem)
4430                 return true
4431         }
4432         // match: (BRH x:(MOVHZloadidx ptr idx mem))
4433         // cond: x.Uses == 1
4434         // result: @x.Block (MOVHZreg (MOVHBRloadidx ptr idx mem))
4435         for {
4436                 x := v_0
4437                 if x.Op != OpPPC64MOVHZloadidx {
4438                         break
4439                 }
4440                 mem := x.Args[2]
4441                 ptr := x.Args[0]
4442                 idx := x.Args[1]
4443                 if !(x.Uses == 1) {
4444                         break
4445                 }
4446                 b = x.Block
4447                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
4448                 v.copyOf(v0)
4449                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHBRloadidx, typ.Int16)
4450                 v1.AddArg3(ptr, idx, mem)
4451                 v0.AddArg(v1)
4452                 return true
4453         }
4454         return false
4455 }
4456 func rewriteValuePPC64_OpPPC64BRW(v *Value) bool {
4457         v_0 := v.Args[0]
4458         b := v.Block
4459         typ := &b.Func.Config.Types
4460         // match: (BRW x:(MOVWZload [off] {sym} ptr mem))
4461         // cond: x.Uses == 1
4462         // result: @x.Block (MOVWBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
4463         for {
4464                 x := v_0
4465                 if x.Op != OpPPC64MOVWZload {
4466                         break
4467                 }
4468                 off := auxIntToInt32(x.AuxInt)
4469                 sym := auxToSym(x.Aux)
4470                 mem := x.Args[1]
4471                 ptr := x.Args[0]
4472                 if !(x.Uses == 1) {
4473                         break
4474                 }
4475                 b = x.Block
4476                 v0 := b.NewValue0(x.Pos, OpPPC64MOVWBRload, typ.UInt32)
4477                 v.copyOf(v0)
4478                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
4479                 v1.AuxInt = int32ToAuxInt(off)
4480                 v1.Aux = symToAux(sym)
4481                 v1.AddArg(ptr)
4482                 v0.AddArg2(v1, mem)
4483                 return true
4484         }
4485         // match: (BRW x:(MOVWZloadidx ptr idx mem))
4486         // cond: x.Uses == 1
4487         // result: @x.Block (MOVWZreg (MOVWBRloadidx ptr idx mem))
4488         for {
4489                 x := v_0
4490                 if x.Op != OpPPC64MOVWZloadidx {
4491                         break
4492                 }
4493                 mem := x.Args[2]
4494                 ptr := x.Args[0]
4495                 idx := x.Args[1]
4496                 if !(x.Uses == 1) {
4497                         break
4498                 }
4499                 b = x.Block
4500                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
4501                 v.copyOf(v0)
4502                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWBRloadidx, typ.Int32)
4503                 v1.AddArg3(ptr, idx, mem)
4504                 v0.AddArg(v1)
4505                 return true
4506         }
4507         return false
4508 }
4509 func rewriteValuePPC64_OpPPC64CLRLSLDI(v *Value) bool {
4510         v_0 := v.Args[0]
4511         // match: (CLRLSLDI [c] (SRWconst [s] x))
4512         // cond: mergePPC64ClrlsldiSrw(int64(c),s) != 0
4513         // result: (RLWINM [mergePPC64ClrlsldiSrw(int64(c),s)] x)
4514         for {
4515                 c := auxIntToInt32(v.AuxInt)
4516                 if v_0.Op != OpPPC64SRWconst {
4517                         break
4518                 }
4519                 s := auxIntToInt64(v_0.AuxInt)
4520                 x := v_0.Args[0]
4521                 if !(mergePPC64ClrlsldiSrw(int64(c), s) != 0) {
4522                         break
4523                 }
4524                 v.reset(OpPPC64RLWINM)
4525                 v.AuxInt = int64ToAuxInt(mergePPC64ClrlsldiSrw(int64(c), s))
4526                 v.AddArg(x)
4527                 return true
4528         }
4529         // match: (CLRLSLDI [c] i:(RLWINM [s] x))
4530         // cond: mergePPC64ClrlsldiRlwinm(c,s) != 0
4531         // result: (RLWINM [mergePPC64ClrlsldiRlwinm(c,s)] x)
4532         for {
4533                 c := auxIntToInt32(v.AuxInt)
4534                 i := v_0
4535                 if i.Op != OpPPC64RLWINM {
4536                         break
4537                 }
4538                 s := auxIntToInt64(i.AuxInt)
4539                 x := i.Args[0]
4540                 if !(mergePPC64ClrlsldiRlwinm(c, s) != 0) {
4541                         break
4542                 }
4543                 v.reset(OpPPC64RLWINM)
4544                 v.AuxInt = int64ToAuxInt(mergePPC64ClrlsldiRlwinm(c, s))
4545                 v.AddArg(x)
4546                 return true
4547         }
4548         return false
4549 }
4550 func rewriteValuePPC64_OpPPC64CMP(v *Value) bool {
4551         v_1 := v.Args[1]
4552         v_0 := v.Args[0]
4553         b := v.Block
4554         // match: (CMP x (MOVDconst [c]))
4555         // cond: is16Bit(c)
4556         // result: (CMPconst x [c])
4557         for {
4558                 x := v_0
4559                 if v_1.Op != OpPPC64MOVDconst {
4560                         break
4561                 }
4562                 c := auxIntToInt64(v_1.AuxInt)
4563                 if !(is16Bit(c)) {
4564                         break
4565                 }
4566                 v.reset(OpPPC64CMPconst)
4567                 v.AuxInt = int64ToAuxInt(c)
4568                 v.AddArg(x)
4569                 return true
4570         }
4571         // match: (CMP (MOVDconst [c]) y)
4572         // cond: is16Bit(c)
4573         // result: (InvertFlags (CMPconst y [c]))
4574         for {
4575                 if v_0.Op != OpPPC64MOVDconst {
4576                         break
4577                 }
4578                 c := auxIntToInt64(v_0.AuxInt)
4579                 y := v_1
4580                 if !(is16Bit(c)) {
4581                         break
4582                 }
4583                 v.reset(OpPPC64InvertFlags)
4584                 v0 := b.NewValue0(v.Pos, OpPPC64CMPconst, types.TypeFlags)
4585                 v0.AuxInt = int64ToAuxInt(c)
4586                 v0.AddArg(y)
4587                 v.AddArg(v0)
4588                 return true
4589         }
4590         // match: (CMP x y)
4591         // cond: canonLessThan(x,y)
4592         // result: (InvertFlags (CMP y x))
4593         for {
4594                 x := v_0
4595                 y := v_1
4596                 if !(canonLessThan(x, y)) {
4597                         break
4598                 }
4599                 v.reset(OpPPC64InvertFlags)
4600                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
4601                 v0.AddArg2(y, x)
4602                 v.AddArg(v0)
4603                 return true
4604         }
4605         return false
4606 }
4607 func rewriteValuePPC64_OpPPC64CMPU(v *Value) bool {
4608         v_1 := v.Args[1]
4609         v_0 := v.Args[0]
4610         b := v.Block
4611         // match: (CMPU x (MOVDconst [c]))
4612         // cond: isU16Bit(c)
4613         // result: (CMPUconst x [c])
4614         for {
4615                 x := v_0
4616                 if v_1.Op != OpPPC64MOVDconst {
4617                         break
4618                 }
4619                 c := auxIntToInt64(v_1.AuxInt)
4620                 if !(isU16Bit(c)) {
4621                         break
4622                 }
4623                 v.reset(OpPPC64CMPUconst)
4624                 v.AuxInt = int64ToAuxInt(c)
4625                 v.AddArg(x)
4626                 return true
4627         }
4628         // match: (CMPU (MOVDconst [c]) y)
4629         // cond: isU16Bit(c)
4630         // result: (InvertFlags (CMPUconst y [c]))
4631         for {
4632                 if v_0.Op != OpPPC64MOVDconst {
4633                         break
4634                 }
4635                 c := auxIntToInt64(v_0.AuxInt)
4636                 y := v_1
4637                 if !(isU16Bit(c)) {
4638                         break
4639                 }
4640                 v.reset(OpPPC64InvertFlags)
4641                 v0 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
4642                 v0.AuxInt = int64ToAuxInt(c)
4643                 v0.AddArg(y)
4644                 v.AddArg(v0)
4645                 return true
4646         }
4647         // match: (CMPU x y)
4648         // cond: canonLessThan(x,y)
4649         // result: (InvertFlags (CMPU y x))
4650         for {
4651                 x := v_0
4652                 y := v_1
4653                 if !(canonLessThan(x, y)) {
4654                         break
4655                 }
4656                 v.reset(OpPPC64InvertFlags)
4657                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
4658                 v0.AddArg2(y, x)
4659                 v.AddArg(v0)
4660                 return true
4661         }
4662         return false
4663 }
4664 func rewriteValuePPC64_OpPPC64CMPUconst(v *Value) bool {
4665         v_0 := v.Args[0]
4666         // match: (CMPUconst [d] (Select0 (ANDCCconst z [c])))
4667         // cond: uint64(d) > uint64(c)
4668         // result: (FlagLT)
4669         for {
4670                 d := auxIntToInt64(v.AuxInt)
4671                 if v_0.Op != OpSelect0 {
4672                         break
4673                 }
4674                 v_0_0 := v_0.Args[0]
4675                 if v_0_0.Op != OpPPC64ANDCCconst {
4676                         break
4677                 }
4678                 c := auxIntToInt64(v_0_0.AuxInt)
4679                 if !(uint64(d) > uint64(c)) {
4680                         break
4681                 }
4682                 v.reset(OpPPC64FlagLT)
4683                 return true
4684         }
4685         // match: (CMPUconst (MOVDconst [x]) [y])
4686         // cond: x==y
4687         // result: (FlagEQ)
4688         for {
4689                 y := auxIntToInt64(v.AuxInt)
4690                 if v_0.Op != OpPPC64MOVDconst {
4691                         break
4692                 }
4693                 x := auxIntToInt64(v_0.AuxInt)
4694                 if !(x == y) {
4695                         break
4696                 }
4697                 v.reset(OpPPC64FlagEQ)
4698                 return true
4699         }
4700         // match: (CMPUconst (MOVDconst [x]) [y])
4701         // cond: uint64(x)<uint64(y)
4702         // result: (FlagLT)
4703         for {
4704                 y := auxIntToInt64(v.AuxInt)
4705                 if v_0.Op != OpPPC64MOVDconst {
4706                         break
4707                 }
4708                 x := auxIntToInt64(v_0.AuxInt)
4709                 if !(uint64(x) < uint64(y)) {
4710                         break
4711                 }
4712                 v.reset(OpPPC64FlagLT)
4713                 return true
4714         }
4715         // match: (CMPUconst (MOVDconst [x]) [y])
4716         // cond: uint64(x)>uint64(y)
4717         // result: (FlagGT)
4718         for {
4719                 y := auxIntToInt64(v.AuxInt)
4720                 if v_0.Op != OpPPC64MOVDconst {
4721                         break
4722                 }
4723                 x := auxIntToInt64(v_0.AuxInt)
4724                 if !(uint64(x) > uint64(y)) {
4725                         break
4726                 }
4727                 v.reset(OpPPC64FlagGT)
4728                 return true
4729         }
4730         return false
4731 }
4732 func rewriteValuePPC64_OpPPC64CMPW(v *Value) bool {
4733         v_1 := v.Args[1]
4734         v_0 := v.Args[0]
4735         b := v.Block
4736         // match: (CMPW x (MOVWreg y))
4737         // result: (CMPW x y)
4738         for {
4739                 x := v_0
4740                 if v_1.Op != OpPPC64MOVWreg {
4741                         break
4742                 }
4743                 y := v_1.Args[0]
4744                 v.reset(OpPPC64CMPW)
4745                 v.AddArg2(x, y)
4746                 return true
4747         }
4748         // match: (CMPW (MOVWreg x) y)
4749         // result: (CMPW x y)
4750         for {
4751                 if v_0.Op != OpPPC64MOVWreg {
4752                         break
4753                 }
4754                 x := v_0.Args[0]
4755                 y := v_1
4756                 v.reset(OpPPC64CMPW)
4757                 v.AddArg2(x, y)
4758                 return true
4759         }
4760         // match: (CMPW x (MOVDconst [c]))
4761         // cond: is16Bit(c)
4762         // result: (CMPWconst x [int32(c)])
4763         for {
4764                 x := v_0
4765                 if v_1.Op != OpPPC64MOVDconst {
4766                         break
4767                 }
4768                 c := auxIntToInt64(v_1.AuxInt)
4769                 if !(is16Bit(c)) {
4770                         break
4771                 }
4772                 v.reset(OpPPC64CMPWconst)
4773                 v.AuxInt = int32ToAuxInt(int32(c))
4774                 v.AddArg(x)
4775                 return true
4776         }
4777         // match: (CMPW (MOVDconst [c]) y)
4778         // cond: is16Bit(c)
4779         // result: (InvertFlags (CMPWconst y [int32(c)]))
4780         for {
4781                 if v_0.Op != OpPPC64MOVDconst {
4782                         break
4783                 }
4784                 c := auxIntToInt64(v_0.AuxInt)
4785                 y := v_1
4786                 if !(is16Bit(c)) {
4787                         break
4788                 }
4789                 v.reset(OpPPC64InvertFlags)
4790                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWconst, types.TypeFlags)
4791                 v0.AuxInt = int32ToAuxInt(int32(c))
4792                 v0.AddArg(y)
4793                 v.AddArg(v0)
4794                 return true
4795         }
4796         // match: (CMPW x y)
4797         // cond: canonLessThan(x,y)
4798         // result: (InvertFlags (CMPW y x))
4799         for {
4800                 x := v_0
4801                 y := v_1
4802                 if !(canonLessThan(x, y)) {
4803                         break
4804                 }
4805                 v.reset(OpPPC64InvertFlags)
4806                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
4807                 v0.AddArg2(y, x)
4808                 v.AddArg(v0)
4809                 return true
4810         }
4811         return false
4812 }
4813 func rewriteValuePPC64_OpPPC64CMPWU(v *Value) bool {
4814         v_1 := v.Args[1]
4815         v_0 := v.Args[0]
4816         b := v.Block
4817         // match: (CMPWU x (MOVWZreg y))
4818         // result: (CMPWU x y)
4819         for {
4820                 x := v_0
4821                 if v_1.Op != OpPPC64MOVWZreg {
4822                         break
4823                 }
4824                 y := v_1.Args[0]
4825                 v.reset(OpPPC64CMPWU)
4826                 v.AddArg2(x, y)
4827                 return true
4828         }
4829         // match: (CMPWU (MOVWZreg x) y)
4830         // result: (CMPWU x y)
4831         for {
4832                 if v_0.Op != OpPPC64MOVWZreg {
4833                         break
4834                 }
4835                 x := v_0.Args[0]
4836                 y := v_1
4837                 v.reset(OpPPC64CMPWU)
4838                 v.AddArg2(x, y)
4839                 return true
4840         }
4841         // match: (CMPWU x (MOVDconst [c]))
4842         // cond: isU16Bit(c)
4843         // result: (CMPWUconst x [int32(c)])
4844         for {
4845                 x := v_0
4846                 if v_1.Op != OpPPC64MOVDconst {
4847                         break
4848                 }
4849                 c := auxIntToInt64(v_1.AuxInt)
4850                 if !(isU16Bit(c)) {
4851                         break
4852                 }
4853                 v.reset(OpPPC64CMPWUconst)
4854                 v.AuxInt = int32ToAuxInt(int32(c))
4855                 v.AddArg(x)
4856                 return true
4857         }
4858         // match: (CMPWU (MOVDconst [c]) y)
4859         // cond: isU16Bit(c)
4860         // result: (InvertFlags (CMPWUconst y [int32(c)]))
4861         for {
4862                 if v_0.Op != OpPPC64MOVDconst {
4863                         break
4864                 }
4865                 c := auxIntToInt64(v_0.AuxInt)
4866                 y := v_1
4867                 if !(isU16Bit(c)) {
4868                         break
4869                 }
4870                 v.reset(OpPPC64InvertFlags)
4871                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
4872                 v0.AuxInt = int32ToAuxInt(int32(c))
4873                 v0.AddArg(y)
4874                 v.AddArg(v0)
4875                 return true
4876         }
4877         // match: (CMPWU x y)
4878         // cond: canonLessThan(x,y)
4879         // result: (InvertFlags (CMPWU y x))
4880         for {
4881                 x := v_0
4882                 y := v_1
4883                 if !(canonLessThan(x, y)) {
4884                         break
4885                 }
4886                 v.reset(OpPPC64InvertFlags)
4887                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
4888                 v0.AddArg2(y, x)
4889                 v.AddArg(v0)
4890                 return true
4891         }
4892         return false
4893 }
4894 func rewriteValuePPC64_OpPPC64CMPWUconst(v *Value) bool {
4895         v_0 := v.Args[0]
4896         // match: (CMPWUconst [d] (Select0 (ANDCCconst z [c])))
4897         // cond: uint64(d) > uint64(c)
4898         // result: (FlagLT)
4899         for {
4900                 d := auxIntToInt32(v.AuxInt)
4901                 if v_0.Op != OpSelect0 {
4902                         break
4903                 }
4904                 v_0_0 := v_0.Args[0]
4905                 if v_0_0.Op != OpPPC64ANDCCconst {
4906                         break
4907                 }
4908                 c := auxIntToInt64(v_0_0.AuxInt)
4909                 if !(uint64(d) > uint64(c)) {
4910                         break
4911                 }
4912                 v.reset(OpPPC64FlagLT)
4913                 return true
4914         }
4915         // match: (CMPWUconst (MOVDconst [x]) [y])
4916         // cond: int32(x)==int32(y)
4917         // result: (FlagEQ)
4918         for {
4919                 y := auxIntToInt32(v.AuxInt)
4920                 if v_0.Op != OpPPC64MOVDconst {
4921                         break
4922                 }
4923                 x := auxIntToInt64(v_0.AuxInt)
4924                 if !(int32(x) == int32(y)) {
4925                         break
4926                 }
4927                 v.reset(OpPPC64FlagEQ)
4928                 return true
4929         }
4930         // match: (CMPWUconst (MOVDconst [x]) [y])
4931         // cond: uint32(x)<uint32(y)
4932         // result: (FlagLT)
4933         for {
4934                 y := auxIntToInt32(v.AuxInt)
4935                 if v_0.Op != OpPPC64MOVDconst {
4936                         break
4937                 }
4938                 x := auxIntToInt64(v_0.AuxInt)
4939                 if !(uint32(x) < uint32(y)) {
4940                         break
4941                 }
4942                 v.reset(OpPPC64FlagLT)
4943                 return true
4944         }
4945         // match: (CMPWUconst (MOVDconst [x]) [y])
4946         // cond: uint32(x)>uint32(y)
4947         // result: (FlagGT)
4948         for {
4949                 y := auxIntToInt32(v.AuxInt)
4950                 if v_0.Op != OpPPC64MOVDconst {
4951                         break
4952                 }
4953                 x := auxIntToInt64(v_0.AuxInt)
4954                 if !(uint32(x) > uint32(y)) {
4955                         break
4956                 }
4957                 v.reset(OpPPC64FlagGT)
4958                 return true
4959         }
4960         return false
4961 }
4962 func rewriteValuePPC64_OpPPC64CMPWconst(v *Value) bool {
4963         v_0 := v.Args[0]
4964         // match: (CMPWconst (MOVDconst [x]) [y])
4965         // cond: int32(x)==int32(y)
4966         // result: (FlagEQ)
4967         for {
4968                 y := auxIntToInt32(v.AuxInt)
4969                 if v_0.Op != OpPPC64MOVDconst {
4970                         break
4971                 }
4972                 x := auxIntToInt64(v_0.AuxInt)
4973                 if !(int32(x) == int32(y)) {
4974                         break
4975                 }
4976                 v.reset(OpPPC64FlagEQ)
4977                 return true
4978         }
4979         // match: (CMPWconst (MOVDconst [x]) [y])
4980         // cond: int32(x)<int32(y)
4981         // result: (FlagLT)
4982         for {
4983                 y := auxIntToInt32(v.AuxInt)
4984                 if v_0.Op != OpPPC64MOVDconst {
4985                         break
4986                 }
4987                 x := auxIntToInt64(v_0.AuxInt)
4988                 if !(int32(x) < int32(y)) {
4989                         break
4990                 }
4991                 v.reset(OpPPC64FlagLT)
4992                 return true
4993         }
4994         // match: (CMPWconst (MOVDconst [x]) [y])
4995         // cond: int32(x)>int32(y)
4996         // result: (FlagGT)
4997         for {
4998                 y := auxIntToInt32(v.AuxInt)
4999                 if v_0.Op != OpPPC64MOVDconst {
5000                         break
5001                 }
5002                 x := auxIntToInt64(v_0.AuxInt)
5003                 if !(int32(x) > int32(y)) {
5004                         break
5005                 }
5006                 v.reset(OpPPC64FlagGT)
5007                 return true
5008         }
5009         return false
5010 }
5011 func rewriteValuePPC64_OpPPC64CMPconst(v *Value) bool {
5012         v_0 := v.Args[0]
5013         // match: (CMPconst (MOVDconst [x]) [y])
5014         // cond: x==y
5015         // result: (FlagEQ)
5016         for {
5017                 y := auxIntToInt64(v.AuxInt)
5018                 if v_0.Op != OpPPC64MOVDconst {
5019                         break
5020                 }
5021                 x := auxIntToInt64(v_0.AuxInt)
5022                 if !(x == y) {
5023                         break
5024                 }
5025                 v.reset(OpPPC64FlagEQ)
5026                 return true
5027         }
5028         // match: (CMPconst (MOVDconst [x]) [y])
5029         // cond: x<y
5030         // result: (FlagLT)
5031         for {
5032                 y := auxIntToInt64(v.AuxInt)
5033                 if v_0.Op != OpPPC64MOVDconst {
5034                         break
5035                 }
5036                 x := auxIntToInt64(v_0.AuxInt)
5037                 if !(x < y) {
5038                         break
5039                 }
5040                 v.reset(OpPPC64FlagLT)
5041                 return true
5042         }
5043         // match: (CMPconst (MOVDconst [x]) [y])
5044         // cond: x>y
5045         // result: (FlagGT)
5046         for {
5047                 y := auxIntToInt64(v.AuxInt)
5048                 if v_0.Op != OpPPC64MOVDconst {
5049                         break
5050                 }
5051                 x := auxIntToInt64(v_0.AuxInt)
5052                 if !(x > y) {
5053                         break
5054                 }
5055                 v.reset(OpPPC64FlagGT)
5056                 return true
5057         }
5058         return false
5059 }
5060 func rewriteValuePPC64_OpPPC64Equal(v *Value) bool {
5061         v_0 := v.Args[0]
5062         // match: (Equal (FlagEQ))
5063         // result: (MOVDconst [1])
5064         for {
5065                 if v_0.Op != OpPPC64FlagEQ {
5066                         break
5067                 }
5068                 v.reset(OpPPC64MOVDconst)
5069                 v.AuxInt = int64ToAuxInt(1)
5070                 return true
5071         }
5072         // match: (Equal (FlagLT))
5073         // result: (MOVDconst [0])
5074         for {
5075                 if v_0.Op != OpPPC64FlagLT {
5076                         break
5077                 }
5078                 v.reset(OpPPC64MOVDconst)
5079                 v.AuxInt = int64ToAuxInt(0)
5080                 return true
5081         }
5082         // match: (Equal (FlagGT))
5083         // result: (MOVDconst [0])
5084         for {
5085                 if v_0.Op != OpPPC64FlagGT {
5086                         break
5087                 }
5088                 v.reset(OpPPC64MOVDconst)
5089                 v.AuxInt = int64ToAuxInt(0)
5090                 return true
5091         }
5092         // match: (Equal (InvertFlags x))
5093         // result: (Equal x)
5094         for {
5095                 if v_0.Op != OpPPC64InvertFlags {
5096                         break
5097                 }
5098                 x := v_0.Args[0]
5099                 v.reset(OpPPC64Equal)
5100                 v.AddArg(x)
5101                 return true
5102         }
5103         // match: (Equal cmp)
5104         // result: (SETBC [2] cmp)
5105         for {
5106                 cmp := v_0
5107                 v.reset(OpPPC64SETBC)
5108                 v.AuxInt = int32ToAuxInt(2)
5109                 v.AddArg(cmp)
5110                 return true
5111         }
5112 }
5113 func rewriteValuePPC64_OpPPC64FABS(v *Value) bool {
5114         v_0 := v.Args[0]
5115         // match: (FABS (FMOVDconst [x]))
5116         // result: (FMOVDconst [math.Abs(x)])
5117         for {
5118                 if v_0.Op != OpPPC64FMOVDconst {
5119                         break
5120                 }
5121                 x := auxIntToFloat64(v_0.AuxInt)
5122                 v.reset(OpPPC64FMOVDconst)
5123                 v.AuxInt = float64ToAuxInt(math.Abs(x))
5124                 return true
5125         }
5126         return false
5127 }
5128 func rewriteValuePPC64_OpPPC64FADD(v *Value) bool {
5129         v_1 := v.Args[1]
5130         v_0 := v.Args[0]
5131         // match: (FADD (FMUL x y) z)
5132         // cond: x.Block.Func.useFMA(v)
5133         // result: (FMADD x y z)
5134         for {
5135                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5136                         if v_0.Op != OpPPC64FMUL {
5137                                 continue
5138                         }
5139                         _ = v_0.Args[1]
5140                         v_0_0 := v_0.Args[0]
5141                         v_0_1 := v_0.Args[1]
5142                         for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 {
5143                                 x := v_0_0
5144                                 y := v_0_1
5145                                 z := v_1
5146                                 if !(x.Block.Func.useFMA(v)) {
5147                                         continue
5148                                 }
5149                                 v.reset(OpPPC64FMADD)
5150                                 v.AddArg3(x, y, z)
5151                                 return true
5152                         }
5153                 }
5154                 break
5155         }
5156         return false
5157 }
5158 func rewriteValuePPC64_OpPPC64FADDS(v *Value) bool {
5159         v_1 := v.Args[1]
5160         v_0 := v.Args[0]
5161         // match: (FADDS (FMULS x y) z)
5162         // cond: x.Block.Func.useFMA(v)
5163         // result: (FMADDS x y z)
5164         for {
5165                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5166                         if v_0.Op != OpPPC64FMULS {
5167                                 continue
5168                         }
5169                         _ = v_0.Args[1]
5170                         v_0_0 := v_0.Args[0]
5171                         v_0_1 := v_0.Args[1]
5172                         for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 {
5173                                 x := v_0_0
5174                                 y := v_0_1
5175                                 z := v_1
5176                                 if !(x.Block.Func.useFMA(v)) {
5177                                         continue
5178                                 }
5179                                 v.reset(OpPPC64FMADDS)
5180                                 v.AddArg3(x, y, z)
5181                                 return true
5182                         }
5183                 }
5184                 break
5185         }
5186         return false
5187 }
5188 func rewriteValuePPC64_OpPPC64FCEIL(v *Value) bool {
5189         v_0 := v.Args[0]
5190         // match: (FCEIL (FMOVDconst [x]))
5191         // result: (FMOVDconst [math.Ceil(x)])
5192         for {
5193                 if v_0.Op != OpPPC64FMOVDconst {
5194                         break
5195                 }
5196                 x := auxIntToFloat64(v_0.AuxInt)
5197                 v.reset(OpPPC64FMOVDconst)
5198                 v.AuxInt = float64ToAuxInt(math.Ceil(x))
5199                 return true
5200         }
5201         return false
5202 }
5203 func rewriteValuePPC64_OpPPC64FFLOOR(v *Value) bool {
5204         v_0 := v.Args[0]
5205         // match: (FFLOOR (FMOVDconst [x]))
5206         // result: (FMOVDconst [math.Floor(x)])
5207         for {
5208                 if v_0.Op != OpPPC64FMOVDconst {
5209                         break
5210                 }
5211                 x := auxIntToFloat64(v_0.AuxInt)
5212                 v.reset(OpPPC64FMOVDconst)
5213                 v.AuxInt = float64ToAuxInt(math.Floor(x))
5214                 return true
5215         }
5216         return false
5217 }
5218 func rewriteValuePPC64_OpPPC64FGreaterEqual(v *Value) bool {
5219         v_0 := v.Args[0]
5220         b := v.Block
5221         typ := &b.Func.Config.Types
5222         // match: (FGreaterEqual cmp)
5223         // result: (OR (SETBC [2] cmp) (SETBC [1] cmp))
5224         for {
5225                 cmp := v_0
5226                 v.reset(OpPPC64OR)
5227                 v0 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5228                 v0.AuxInt = int32ToAuxInt(2)
5229                 v0.AddArg(cmp)
5230                 v1 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5231                 v1.AuxInt = int32ToAuxInt(1)
5232                 v1.AddArg(cmp)
5233                 v.AddArg2(v0, v1)
5234                 return true
5235         }
5236 }
5237 func rewriteValuePPC64_OpPPC64FGreaterThan(v *Value) bool {
5238         v_0 := v.Args[0]
5239         // match: (FGreaterThan cmp)
5240         // result: (SETBC [1] cmp)
5241         for {
5242                 cmp := v_0
5243                 v.reset(OpPPC64SETBC)
5244                 v.AuxInt = int32ToAuxInt(1)
5245                 v.AddArg(cmp)
5246                 return true
5247         }
5248 }
5249 func rewriteValuePPC64_OpPPC64FLessEqual(v *Value) bool {
5250         v_0 := v.Args[0]
5251         b := v.Block
5252         typ := &b.Func.Config.Types
5253         // match: (FLessEqual cmp)
5254         // result: (OR (SETBC [2] cmp) (SETBC [0] cmp))
5255         for {
5256                 cmp := v_0
5257                 v.reset(OpPPC64OR)
5258                 v0 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5259                 v0.AuxInt = int32ToAuxInt(2)
5260                 v0.AddArg(cmp)
5261                 v1 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5262                 v1.AuxInt = int32ToAuxInt(0)
5263                 v1.AddArg(cmp)
5264                 v.AddArg2(v0, v1)
5265                 return true
5266         }
5267 }
5268 func rewriteValuePPC64_OpPPC64FLessThan(v *Value) bool {
5269         v_0 := v.Args[0]
5270         // match: (FLessThan cmp)
5271         // result: (SETBC [0] cmp)
5272         for {
5273                 cmp := v_0
5274                 v.reset(OpPPC64SETBC)
5275                 v.AuxInt = int32ToAuxInt(0)
5276                 v.AddArg(cmp)
5277                 return true
5278         }
5279 }
5280 func rewriteValuePPC64_OpPPC64FMOVDload(v *Value) bool {
5281         v_1 := v.Args[1]
5282         v_0 := v.Args[0]
5283         // match: (FMOVDload [off] {sym} ptr (MOVDstore [off] {sym} ptr x _))
5284         // result: (MTVSRD x)
5285         for {
5286                 off := auxIntToInt32(v.AuxInt)
5287                 sym := auxToSym(v.Aux)
5288                 ptr := v_0
5289                 if v_1.Op != OpPPC64MOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
5290                         break
5291                 }
5292                 x := v_1.Args[1]
5293                 if ptr != v_1.Args[0] {
5294                         break
5295                 }
5296                 v.reset(OpPPC64MTVSRD)
5297                 v.AddArg(x)
5298                 return true
5299         }
5300         // match: (FMOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
5301         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
5302         // result: (FMOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
5303         for {
5304                 off1 := auxIntToInt32(v.AuxInt)
5305                 sym1 := auxToSym(v.Aux)
5306                 p := v_0
5307                 if p.Op != OpPPC64MOVDaddr {
5308                         break
5309                 }
5310                 off2 := auxIntToInt32(p.AuxInt)
5311                 sym2 := auxToSym(p.Aux)
5312                 ptr := p.Args[0]
5313                 mem := v_1
5314                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5315                         break
5316                 }
5317                 v.reset(OpPPC64FMOVDload)
5318                 v.AuxInt = int32ToAuxInt(off1 + off2)
5319                 v.Aux = symToAux(mergeSym(sym1, sym2))
5320                 v.AddArg2(ptr, mem)
5321                 return true
5322         }
5323         // match: (FMOVDload [off1] {sym} (ADDconst [off2] ptr) mem)
5324         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
5325         // result: (FMOVDload [off1+int32(off2)] {sym} ptr mem)
5326         for {
5327                 off1 := auxIntToInt32(v.AuxInt)
5328                 sym := auxToSym(v.Aux)
5329                 if v_0.Op != OpPPC64ADDconst {
5330                         break
5331                 }
5332                 off2 := auxIntToInt64(v_0.AuxInt)
5333                 ptr := v_0.Args[0]
5334                 mem := v_1
5335                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5336                         break
5337                 }
5338                 v.reset(OpPPC64FMOVDload)
5339                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5340                 v.Aux = symToAux(sym)
5341                 v.AddArg2(ptr, mem)
5342                 return true
5343         }
5344         return false
5345 }
5346 func rewriteValuePPC64_OpPPC64FMOVDstore(v *Value) bool {
5347         v_2 := v.Args[2]
5348         v_1 := v.Args[1]
5349         v_0 := v.Args[0]
5350         // match: (FMOVDstore [off] {sym} ptr (MTVSRD x) mem)
5351         // result: (MOVDstore [off] {sym} ptr x mem)
5352         for {
5353                 off := auxIntToInt32(v.AuxInt)
5354                 sym := auxToSym(v.Aux)
5355                 ptr := v_0
5356                 if v_1.Op != OpPPC64MTVSRD {
5357                         break
5358                 }
5359                 x := v_1.Args[0]
5360                 mem := v_2
5361                 v.reset(OpPPC64MOVDstore)
5362                 v.AuxInt = int32ToAuxInt(off)
5363                 v.Aux = symToAux(sym)
5364                 v.AddArg3(ptr, x, mem)
5365                 return true
5366         }
5367         // match: (FMOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem)
5368         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
5369         // result: (FMOVDstore [off1+int32(off2)] {sym} ptr val mem)
5370         for {
5371                 off1 := auxIntToInt32(v.AuxInt)
5372                 sym := auxToSym(v.Aux)
5373                 if v_0.Op != OpPPC64ADDconst {
5374                         break
5375                 }
5376                 off2 := auxIntToInt64(v_0.AuxInt)
5377                 ptr := v_0.Args[0]
5378                 val := v_1
5379                 mem := v_2
5380                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5381                         break
5382                 }
5383                 v.reset(OpPPC64FMOVDstore)
5384                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5385                 v.Aux = symToAux(sym)
5386                 v.AddArg3(ptr, val, mem)
5387                 return true
5388         }
5389         // match: (FMOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
5390         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
5391         // result: (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
5392         for {
5393                 off1 := auxIntToInt32(v.AuxInt)
5394                 sym1 := auxToSym(v.Aux)
5395                 p := v_0
5396                 if p.Op != OpPPC64MOVDaddr {
5397                         break
5398                 }
5399                 off2 := auxIntToInt32(p.AuxInt)
5400                 sym2 := auxToSym(p.Aux)
5401                 ptr := p.Args[0]
5402                 val := v_1
5403                 mem := v_2
5404                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5405                         break
5406                 }
5407                 v.reset(OpPPC64FMOVDstore)
5408                 v.AuxInt = int32ToAuxInt(off1 + off2)
5409                 v.Aux = symToAux(mergeSym(sym1, sym2))
5410                 v.AddArg3(ptr, val, mem)
5411                 return true
5412         }
5413         return false
5414 }
5415 func rewriteValuePPC64_OpPPC64FMOVSload(v *Value) bool {
5416         v_1 := v.Args[1]
5417         v_0 := v.Args[0]
5418         // match: (FMOVSload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
5419         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
5420         // result: (FMOVSload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
5421         for {
5422                 off1 := auxIntToInt32(v.AuxInt)
5423                 sym1 := auxToSym(v.Aux)
5424                 p := v_0
5425                 if p.Op != OpPPC64MOVDaddr {
5426                         break
5427                 }
5428                 off2 := auxIntToInt32(p.AuxInt)
5429                 sym2 := auxToSym(p.Aux)
5430                 ptr := p.Args[0]
5431                 mem := v_1
5432                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5433                         break
5434                 }
5435                 v.reset(OpPPC64FMOVSload)
5436                 v.AuxInt = int32ToAuxInt(off1 + off2)
5437                 v.Aux = symToAux(mergeSym(sym1, sym2))
5438                 v.AddArg2(ptr, mem)
5439                 return true
5440         }
5441         // match: (FMOVSload [off1] {sym} (ADDconst [off2] ptr) mem)
5442         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
5443         // result: (FMOVSload [off1+int32(off2)] {sym} ptr mem)
5444         for {
5445                 off1 := auxIntToInt32(v.AuxInt)
5446                 sym := auxToSym(v.Aux)
5447                 if v_0.Op != OpPPC64ADDconst {
5448                         break
5449                 }
5450                 off2 := auxIntToInt64(v_0.AuxInt)
5451                 ptr := v_0.Args[0]
5452                 mem := v_1
5453                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5454                         break
5455                 }
5456                 v.reset(OpPPC64FMOVSload)
5457                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5458                 v.Aux = symToAux(sym)
5459                 v.AddArg2(ptr, mem)
5460                 return true
5461         }
5462         return false
5463 }
5464 func rewriteValuePPC64_OpPPC64FMOVSstore(v *Value) bool {
5465         v_2 := v.Args[2]
5466         v_1 := v.Args[1]
5467         v_0 := v.Args[0]
5468         // match: (FMOVSstore [off1] {sym} (ADDconst [off2] ptr) val mem)
5469         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
5470         // result: (FMOVSstore [off1+int32(off2)] {sym} ptr val mem)
5471         for {
5472                 off1 := auxIntToInt32(v.AuxInt)
5473                 sym := auxToSym(v.Aux)
5474                 if v_0.Op != OpPPC64ADDconst {
5475                         break
5476                 }
5477                 off2 := auxIntToInt64(v_0.AuxInt)
5478                 ptr := v_0.Args[0]
5479                 val := v_1
5480                 mem := v_2
5481                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5482                         break
5483                 }
5484                 v.reset(OpPPC64FMOVSstore)
5485                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5486                 v.Aux = symToAux(sym)
5487                 v.AddArg3(ptr, val, mem)
5488                 return true
5489         }
5490         // match: (FMOVSstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
5491         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
5492         // result: (FMOVSstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
5493         for {
5494                 off1 := auxIntToInt32(v.AuxInt)
5495                 sym1 := auxToSym(v.Aux)
5496                 p := v_0
5497                 if p.Op != OpPPC64MOVDaddr {
5498                         break
5499                 }
5500                 off2 := auxIntToInt32(p.AuxInt)
5501                 sym2 := auxToSym(p.Aux)
5502                 ptr := p.Args[0]
5503                 val := v_1
5504                 mem := v_2
5505                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5506                         break
5507                 }
5508                 v.reset(OpPPC64FMOVSstore)
5509                 v.AuxInt = int32ToAuxInt(off1 + off2)
5510                 v.Aux = symToAux(mergeSym(sym1, sym2))
5511                 v.AddArg3(ptr, val, mem)
5512                 return true
5513         }
5514         return false
5515 }
5516 func rewriteValuePPC64_OpPPC64FNEG(v *Value) bool {
5517         v_0 := v.Args[0]
5518         // match: (FNEG (FABS x))
5519         // result: (FNABS x)
5520         for {
5521                 if v_0.Op != OpPPC64FABS {
5522                         break
5523                 }
5524                 x := v_0.Args[0]
5525                 v.reset(OpPPC64FNABS)
5526                 v.AddArg(x)
5527                 return true
5528         }
5529         // match: (FNEG (FNABS x))
5530         // result: (FABS x)
5531         for {
5532                 if v_0.Op != OpPPC64FNABS {
5533                         break
5534                 }
5535                 x := v_0.Args[0]
5536                 v.reset(OpPPC64FABS)
5537                 v.AddArg(x)
5538                 return true
5539         }
5540         return false
5541 }
5542 func rewriteValuePPC64_OpPPC64FSQRT(v *Value) bool {
5543         v_0 := v.Args[0]
5544         // match: (FSQRT (FMOVDconst [x]))
5545         // cond: x >= 0
5546         // result: (FMOVDconst [math.Sqrt(x)])
5547         for {
5548                 if v_0.Op != OpPPC64FMOVDconst {
5549                         break
5550                 }
5551                 x := auxIntToFloat64(v_0.AuxInt)
5552                 if !(x >= 0) {
5553                         break
5554                 }
5555                 v.reset(OpPPC64FMOVDconst)
5556                 v.AuxInt = float64ToAuxInt(math.Sqrt(x))
5557                 return true
5558         }
5559         return false
5560 }
5561 func rewriteValuePPC64_OpPPC64FSUB(v *Value) bool {
5562         v_1 := v.Args[1]
5563         v_0 := v.Args[0]
5564         // match: (FSUB (FMUL x y) z)
5565         // cond: x.Block.Func.useFMA(v)
5566         // result: (FMSUB x y z)
5567         for {
5568                 if v_0.Op != OpPPC64FMUL {
5569                         break
5570                 }
5571                 _ = v_0.Args[1]
5572                 v_0_0 := v_0.Args[0]
5573                 v_0_1 := v_0.Args[1]
5574                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
5575                         x := v_0_0
5576                         y := v_0_1
5577                         z := v_1
5578                         if !(x.Block.Func.useFMA(v)) {
5579                                 continue
5580                         }
5581                         v.reset(OpPPC64FMSUB)
5582                         v.AddArg3(x, y, z)
5583                         return true
5584                 }
5585                 break
5586         }
5587         return false
5588 }
5589 func rewriteValuePPC64_OpPPC64FSUBS(v *Value) bool {
5590         v_1 := v.Args[1]
5591         v_0 := v.Args[0]
5592         // match: (FSUBS (FMULS x y) z)
5593         // cond: x.Block.Func.useFMA(v)
5594         // result: (FMSUBS x y z)
5595         for {
5596                 if v_0.Op != OpPPC64FMULS {
5597                         break
5598                 }
5599                 _ = v_0.Args[1]
5600                 v_0_0 := v_0.Args[0]
5601                 v_0_1 := v_0.Args[1]
5602                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
5603                         x := v_0_0
5604                         y := v_0_1
5605                         z := v_1
5606                         if !(x.Block.Func.useFMA(v)) {
5607                                 continue
5608                         }
5609                         v.reset(OpPPC64FMSUBS)
5610                         v.AddArg3(x, y, z)
5611                         return true
5612                 }
5613                 break
5614         }
5615         return false
5616 }
5617 func rewriteValuePPC64_OpPPC64FTRUNC(v *Value) bool {
5618         v_0 := v.Args[0]
5619         // match: (FTRUNC (FMOVDconst [x]))
5620         // result: (FMOVDconst [math.Trunc(x)])
5621         for {
5622                 if v_0.Op != OpPPC64FMOVDconst {
5623                         break
5624                 }
5625                 x := auxIntToFloat64(v_0.AuxInt)
5626                 v.reset(OpPPC64FMOVDconst)
5627                 v.AuxInt = float64ToAuxInt(math.Trunc(x))
5628                 return true
5629         }
5630         return false
5631 }
5632 func rewriteValuePPC64_OpPPC64GreaterEqual(v *Value) bool {
5633         v_0 := v.Args[0]
5634         // match: (GreaterEqual (FlagEQ))
5635         // result: (MOVDconst [1])
5636         for {
5637                 if v_0.Op != OpPPC64FlagEQ {
5638                         break
5639                 }
5640                 v.reset(OpPPC64MOVDconst)
5641                 v.AuxInt = int64ToAuxInt(1)
5642                 return true
5643         }
5644         // match: (GreaterEqual (FlagLT))
5645         // result: (MOVDconst [0])
5646         for {
5647                 if v_0.Op != OpPPC64FlagLT {
5648                         break
5649                 }
5650                 v.reset(OpPPC64MOVDconst)
5651                 v.AuxInt = int64ToAuxInt(0)
5652                 return true
5653         }
5654         // match: (GreaterEqual (FlagGT))
5655         // result: (MOVDconst [1])
5656         for {
5657                 if v_0.Op != OpPPC64FlagGT {
5658                         break
5659                 }
5660                 v.reset(OpPPC64MOVDconst)
5661                 v.AuxInt = int64ToAuxInt(1)
5662                 return true
5663         }
5664         // match: (GreaterEqual (InvertFlags x))
5665         // result: (LessEqual x)
5666         for {
5667                 if v_0.Op != OpPPC64InvertFlags {
5668                         break
5669                 }
5670                 x := v_0.Args[0]
5671                 v.reset(OpPPC64LessEqual)
5672                 v.AddArg(x)
5673                 return true
5674         }
5675         // match: (GreaterEqual cmp)
5676         // result: (SETBCR [0] cmp)
5677         for {
5678                 cmp := v_0
5679                 v.reset(OpPPC64SETBCR)
5680                 v.AuxInt = int32ToAuxInt(0)
5681                 v.AddArg(cmp)
5682                 return true
5683         }
5684 }
5685 func rewriteValuePPC64_OpPPC64GreaterThan(v *Value) bool {
5686         v_0 := v.Args[0]
5687         // match: (GreaterThan (FlagEQ))
5688         // result: (MOVDconst [0])
5689         for {
5690                 if v_0.Op != OpPPC64FlagEQ {
5691                         break
5692                 }
5693                 v.reset(OpPPC64MOVDconst)
5694                 v.AuxInt = int64ToAuxInt(0)
5695                 return true
5696         }
5697         // match: (GreaterThan (FlagLT))
5698         // result: (MOVDconst [0])
5699         for {
5700                 if v_0.Op != OpPPC64FlagLT {
5701                         break
5702                 }
5703                 v.reset(OpPPC64MOVDconst)
5704                 v.AuxInt = int64ToAuxInt(0)
5705                 return true
5706         }
5707         // match: (GreaterThan (FlagGT))
5708         // result: (MOVDconst [1])
5709         for {
5710                 if v_0.Op != OpPPC64FlagGT {
5711                         break
5712                 }
5713                 v.reset(OpPPC64MOVDconst)
5714                 v.AuxInt = int64ToAuxInt(1)
5715                 return true
5716         }
5717         // match: (GreaterThan (InvertFlags x))
5718         // result: (LessThan x)
5719         for {
5720                 if v_0.Op != OpPPC64InvertFlags {
5721                         break
5722                 }
5723                 x := v_0.Args[0]
5724                 v.reset(OpPPC64LessThan)
5725                 v.AddArg(x)
5726                 return true
5727         }
5728         // match: (GreaterThan cmp)
5729         // result: (SETBC [1] cmp)
5730         for {
5731                 cmp := v_0
5732                 v.reset(OpPPC64SETBC)
5733                 v.AuxInt = int32ToAuxInt(1)
5734                 v.AddArg(cmp)
5735                 return true
5736         }
5737 }
5738 func rewriteValuePPC64_OpPPC64ISEL(v *Value) bool {
5739         v_2 := v.Args[2]
5740         v_1 := v.Args[1]
5741         v_0 := v.Args[0]
5742         b := v.Block
5743         typ := &b.Func.Config.Types
5744         // match: (ISEL [6] x y (Select1 (ANDCCconst [1] (SETBC [c] cmp))))
5745         // result: (ISEL [c] x y cmp)
5746         for {
5747                 if auxIntToInt32(v.AuxInt) != 6 {
5748                         break
5749                 }
5750                 x := v_0
5751                 y := v_1
5752                 if v_2.Op != OpSelect1 {
5753                         break
5754                 }
5755                 v_2_0 := v_2.Args[0]
5756                 if v_2_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_2_0.AuxInt) != 1 {
5757                         break
5758                 }
5759                 v_2_0_0 := v_2_0.Args[0]
5760                 if v_2_0_0.Op != OpPPC64SETBC {
5761                         break
5762                 }
5763                 c := auxIntToInt32(v_2_0_0.AuxInt)
5764                 cmp := v_2_0_0.Args[0]
5765                 v.reset(OpPPC64ISEL)
5766                 v.AuxInt = int32ToAuxInt(c)
5767                 v.AddArg3(x, y, cmp)
5768                 return true
5769         }
5770         // match: (ISEL [6] x y (CMPconst [0] (SETBC [c] cmp)))
5771         // result: (ISEL [c] x y cmp)
5772         for {
5773                 if auxIntToInt32(v.AuxInt) != 6 {
5774                         break
5775                 }
5776                 x := v_0
5777                 y := v_1
5778                 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
5779                         break
5780                 }
5781                 v_2_0 := v_2.Args[0]
5782                 if v_2_0.Op != OpPPC64SETBC {
5783                         break
5784                 }
5785                 c := auxIntToInt32(v_2_0.AuxInt)
5786                 cmp := v_2_0.Args[0]
5787                 v.reset(OpPPC64ISEL)
5788                 v.AuxInt = int32ToAuxInt(c)
5789                 v.AddArg3(x, y, cmp)
5790                 return true
5791         }
5792         // match: (ISEL [6] x y (CMPWconst [0] (SETBC [c] cmp)))
5793         // result: (ISEL [c] x y cmp)
5794         for {
5795                 if auxIntToInt32(v.AuxInt) != 6 {
5796                         break
5797                 }
5798                 x := v_0
5799                 y := v_1
5800                 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
5801                         break
5802                 }
5803                 v_2_0 := v_2.Args[0]
5804                 if v_2_0.Op != OpPPC64SETBC {
5805                         break
5806                 }
5807                 c := auxIntToInt32(v_2_0.AuxInt)
5808                 cmp := v_2_0.Args[0]
5809                 v.reset(OpPPC64ISEL)
5810                 v.AuxInt = int32ToAuxInt(c)
5811                 v.AddArg3(x, y, cmp)
5812                 return true
5813         }
5814         // match: (ISEL [6] x y (CMPconst [0] (SETBCR [c] cmp)))
5815         // result: (ISEL [c+4] x y cmp)
5816         for {
5817                 if auxIntToInt32(v.AuxInt) != 6 {
5818                         break
5819                 }
5820                 x := v_0
5821                 y := v_1
5822                 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
5823                         break
5824                 }
5825                 v_2_0 := v_2.Args[0]
5826                 if v_2_0.Op != OpPPC64SETBCR {
5827                         break
5828                 }
5829                 c := auxIntToInt32(v_2_0.AuxInt)
5830                 cmp := v_2_0.Args[0]
5831                 v.reset(OpPPC64ISEL)
5832                 v.AuxInt = int32ToAuxInt(c + 4)
5833                 v.AddArg3(x, y, cmp)
5834                 return true
5835         }
5836         // match: (ISEL [6] x y (CMPWconst [0] (SETBCR [c] cmp)))
5837         // result: (ISEL [c+4] x y cmp)
5838         for {
5839                 if auxIntToInt32(v.AuxInt) != 6 {
5840                         break
5841                 }
5842                 x := v_0
5843                 y := v_1
5844                 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
5845                         break
5846                 }
5847                 v_2_0 := v_2.Args[0]
5848                 if v_2_0.Op != OpPPC64SETBCR {
5849                         break
5850                 }
5851                 c := auxIntToInt32(v_2_0.AuxInt)
5852                 cmp := v_2_0.Args[0]
5853                 v.reset(OpPPC64ISEL)
5854                 v.AuxInt = int32ToAuxInt(c + 4)
5855                 v.AddArg3(x, y, cmp)
5856                 return true
5857         }
5858         // match: (ISEL [2] x _ (FlagEQ))
5859         // result: x
5860         for {
5861                 if auxIntToInt32(v.AuxInt) != 2 {
5862                         break
5863                 }
5864                 x := v_0
5865                 if v_2.Op != OpPPC64FlagEQ {
5866                         break
5867                 }
5868                 v.copyOf(x)
5869                 return true
5870         }
5871         // match: (ISEL [2] _ y (FlagLT))
5872         // result: y
5873         for {
5874                 if auxIntToInt32(v.AuxInt) != 2 {
5875                         break
5876                 }
5877                 y := v_1
5878                 if v_2.Op != OpPPC64FlagLT {
5879                         break
5880                 }
5881                 v.copyOf(y)
5882                 return true
5883         }
5884         // match: (ISEL [2] _ y (FlagGT))
5885         // result: y
5886         for {
5887                 if auxIntToInt32(v.AuxInt) != 2 {
5888                         break
5889                 }
5890                 y := v_1
5891                 if v_2.Op != OpPPC64FlagGT {
5892                         break
5893                 }
5894                 v.copyOf(y)
5895                 return true
5896         }
5897         // match: (ISEL [6] _ y (FlagEQ))
5898         // result: y
5899         for {
5900                 if auxIntToInt32(v.AuxInt) != 6 {
5901                         break
5902                 }
5903                 y := v_1
5904                 if v_2.Op != OpPPC64FlagEQ {
5905                         break
5906                 }
5907                 v.copyOf(y)
5908                 return true
5909         }
5910         // match: (ISEL [6] x _ (FlagLT))
5911         // result: x
5912         for {
5913                 if auxIntToInt32(v.AuxInt) != 6 {
5914                         break
5915                 }
5916                 x := v_0
5917                 if v_2.Op != OpPPC64FlagLT {
5918                         break
5919                 }
5920                 v.copyOf(x)
5921                 return true
5922         }
5923         // match: (ISEL [6] x _ (FlagGT))
5924         // result: x
5925         for {
5926                 if auxIntToInt32(v.AuxInt) != 6 {
5927                         break
5928                 }
5929                 x := v_0
5930                 if v_2.Op != OpPPC64FlagGT {
5931                         break
5932                 }
5933                 v.copyOf(x)
5934                 return true
5935         }
5936         // match: (ISEL [0] _ y (FlagEQ))
5937         // result: y
5938         for {
5939                 if auxIntToInt32(v.AuxInt) != 0 {
5940                         break
5941                 }
5942                 y := v_1
5943                 if v_2.Op != OpPPC64FlagEQ {
5944                         break
5945                 }
5946                 v.copyOf(y)
5947                 return true
5948         }
5949         // match: (ISEL [0] _ y (FlagGT))
5950         // result: y
5951         for {
5952                 if auxIntToInt32(v.AuxInt) != 0 {
5953                         break
5954                 }
5955                 y := v_1
5956                 if v_2.Op != OpPPC64FlagGT {
5957                         break
5958                 }
5959                 v.copyOf(y)
5960                 return true
5961         }
5962         // match: (ISEL [0] x _ (FlagLT))
5963         // result: x
5964         for {
5965                 if auxIntToInt32(v.AuxInt) != 0 {
5966                         break
5967                 }
5968                 x := v_0
5969                 if v_2.Op != OpPPC64FlagLT {
5970                         break
5971                 }
5972                 v.copyOf(x)
5973                 return true
5974         }
5975         // match: (ISEL [5] _ x (FlagEQ))
5976         // result: x
5977         for {
5978                 if auxIntToInt32(v.AuxInt) != 5 {
5979                         break
5980                 }
5981                 x := v_1
5982                 if v_2.Op != OpPPC64FlagEQ {
5983                         break
5984                 }
5985                 v.copyOf(x)
5986                 return true
5987         }
5988         // match: (ISEL [5] _ x (FlagLT))
5989         // result: x
5990         for {
5991                 if auxIntToInt32(v.AuxInt) != 5 {
5992                         break
5993                 }
5994                 x := v_1
5995                 if v_2.Op != OpPPC64FlagLT {
5996                         break
5997                 }
5998                 v.copyOf(x)
5999                 return true
6000         }
6001         // match: (ISEL [5] y _ (FlagGT))
6002         // result: y
6003         for {
6004                 if auxIntToInt32(v.AuxInt) != 5 {
6005                         break
6006                 }
6007                 y := v_0
6008                 if v_2.Op != OpPPC64FlagGT {
6009                         break
6010                 }
6011                 v.copyOf(y)
6012                 return true
6013         }
6014         // match: (ISEL [1] _ y (FlagEQ))
6015         // result: y
6016         for {
6017                 if auxIntToInt32(v.AuxInt) != 1 {
6018                         break
6019                 }
6020                 y := v_1
6021                 if v_2.Op != OpPPC64FlagEQ {
6022                         break
6023                 }
6024                 v.copyOf(y)
6025                 return true
6026         }
6027         // match: (ISEL [1] _ y (FlagLT))
6028         // result: y
6029         for {
6030                 if auxIntToInt32(v.AuxInt) != 1 {
6031                         break
6032                 }
6033                 y := v_1
6034                 if v_2.Op != OpPPC64FlagLT {
6035                         break
6036                 }
6037                 v.copyOf(y)
6038                 return true
6039         }
6040         // match: (ISEL [1] x _ (FlagGT))
6041         // result: x
6042         for {
6043                 if auxIntToInt32(v.AuxInt) != 1 {
6044                         break
6045                 }
6046                 x := v_0
6047                 if v_2.Op != OpPPC64FlagGT {
6048                         break
6049                 }
6050                 v.copyOf(x)
6051                 return true
6052         }
6053         // match: (ISEL [4] x _ (FlagEQ))
6054         // result: x
6055         for {
6056                 if auxIntToInt32(v.AuxInt) != 4 {
6057                         break
6058                 }
6059                 x := v_0
6060                 if v_2.Op != OpPPC64FlagEQ {
6061                         break
6062                 }
6063                 v.copyOf(x)
6064                 return true
6065         }
6066         // match: (ISEL [4] x _ (FlagGT))
6067         // result: x
6068         for {
6069                 if auxIntToInt32(v.AuxInt) != 4 {
6070                         break
6071                 }
6072                 x := v_0
6073                 if v_2.Op != OpPPC64FlagGT {
6074                         break
6075                 }
6076                 v.copyOf(x)
6077                 return true
6078         }
6079         // match: (ISEL [4] _ y (FlagLT))
6080         // result: y
6081         for {
6082                 if auxIntToInt32(v.AuxInt) != 4 {
6083                         break
6084                 }
6085                 y := v_1
6086                 if v_2.Op != OpPPC64FlagLT {
6087                         break
6088                 }
6089                 v.copyOf(y)
6090                 return true
6091         }
6092         // match: (ISEL [2] x y (CMPconst [0] (Select0 (ANDCCconst [n] z))))
6093         // result: (ISEL [2] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6094         for {
6095                 if auxIntToInt32(v.AuxInt) != 2 {
6096                         break
6097                 }
6098                 x := v_0
6099                 y := v_1
6100                 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
6101                         break
6102                 }
6103                 v_2_0 := v_2.Args[0]
6104                 if v_2_0.Op != OpSelect0 {
6105                         break
6106                 }
6107                 v_2_0_0 := v_2_0.Args[0]
6108                 if v_2_0_0.Op != OpPPC64ANDCCconst {
6109                         break
6110                 }
6111                 n := auxIntToInt64(v_2_0_0.AuxInt)
6112                 z := v_2_0_0.Args[0]
6113                 v.reset(OpPPC64ISEL)
6114                 v.AuxInt = int32ToAuxInt(2)
6115                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
6116                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
6117                 v1.AuxInt = int64ToAuxInt(n)
6118                 v1.AddArg(z)
6119                 v0.AddArg(v1)
6120                 v.AddArg3(x, y, v0)
6121                 return true
6122         }
6123         // match: (ISEL [2] x y (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
6124         // result: (ISEL [2] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6125         for {
6126                 if auxIntToInt32(v.AuxInt) != 2 {
6127                         break
6128                 }
6129                 x := v_0
6130                 y := v_1
6131                 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
6132                         break
6133                 }
6134                 v_2_0 := v_2.Args[0]
6135                 if v_2_0.Op != OpSelect0 {
6136                         break
6137                 }
6138                 v_2_0_0 := v_2_0.Args[0]
6139                 if v_2_0_0.Op != OpPPC64ANDCCconst {
6140                         break
6141                 }
6142                 n := auxIntToInt64(v_2_0_0.AuxInt)
6143                 z := v_2_0_0.Args[0]
6144                 v.reset(OpPPC64ISEL)
6145                 v.AuxInt = int32ToAuxInt(2)
6146                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
6147                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
6148                 v1.AuxInt = int64ToAuxInt(n)
6149                 v1.AddArg(z)
6150                 v0.AddArg(v1)
6151                 v.AddArg3(x, y, v0)
6152                 return true
6153         }
6154         // match: (ISEL [6] x y (CMPconst [0] (Select0 (ANDCCconst [n] z))))
6155         // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6156         for {
6157                 if auxIntToInt32(v.AuxInt) != 6 {
6158                         break
6159                 }
6160                 x := v_0
6161                 y := v_1
6162                 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
6163                         break
6164                 }
6165                 v_2_0 := v_2.Args[0]
6166                 if v_2_0.Op != OpSelect0 {
6167                         break
6168                 }
6169                 v_2_0_0 := v_2_0.Args[0]
6170                 if v_2_0_0.Op != OpPPC64ANDCCconst {
6171                         break
6172                 }
6173                 n := auxIntToInt64(v_2_0_0.AuxInt)
6174                 z := v_2_0_0.Args[0]
6175                 v.reset(OpPPC64ISEL)
6176                 v.AuxInt = int32ToAuxInt(6)
6177                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
6178                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
6179                 v1.AuxInt = int64ToAuxInt(n)
6180                 v1.AddArg(z)
6181                 v0.AddArg(v1)
6182                 v.AddArg3(x, y, v0)
6183                 return true
6184         }
6185         // match: (ISEL [6] x y (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
6186         // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6187         for {
6188                 if auxIntToInt32(v.AuxInt) != 6 {
6189                         break
6190                 }
6191                 x := v_0
6192                 y := v_1
6193                 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
6194                         break
6195                 }
6196                 v_2_0 := v_2.Args[0]
6197                 if v_2_0.Op != OpSelect0 {
6198                         break
6199                 }
6200                 v_2_0_0 := v_2_0.Args[0]
6201                 if v_2_0_0.Op != OpPPC64ANDCCconst {
6202                         break
6203                 }
6204                 n := auxIntToInt64(v_2_0_0.AuxInt)
6205                 z := v_2_0_0.Args[0]
6206                 v.reset(OpPPC64ISEL)
6207                 v.AuxInt = int32ToAuxInt(6)
6208                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
6209                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
6210                 v1.AuxInt = int64ToAuxInt(n)
6211                 v1.AddArg(z)
6212                 v0.AddArg(v1)
6213                 v.AddArg3(x, y, v0)
6214                 return true
6215         }
6216         // match: (ISEL [n] x y (InvertFlags bool))
6217         // cond: n%4 == 0
6218         // result: (ISEL [n+1] x y bool)
6219         for {
6220                 n := auxIntToInt32(v.AuxInt)
6221                 x := v_0
6222                 y := v_1
6223                 if v_2.Op != OpPPC64InvertFlags {
6224                         break
6225                 }
6226                 bool := v_2.Args[0]
6227                 if !(n%4 == 0) {
6228                         break
6229                 }
6230                 v.reset(OpPPC64ISEL)
6231                 v.AuxInt = int32ToAuxInt(n + 1)
6232                 v.AddArg3(x, y, bool)
6233                 return true
6234         }
6235         // match: (ISEL [n] x y (InvertFlags bool))
6236         // cond: n%4 == 1
6237         // result: (ISEL [n-1] x y bool)
6238         for {
6239                 n := auxIntToInt32(v.AuxInt)
6240                 x := v_0
6241                 y := v_1
6242                 if v_2.Op != OpPPC64InvertFlags {
6243                         break
6244                 }
6245                 bool := v_2.Args[0]
6246                 if !(n%4 == 1) {
6247                         break
6248                 }
6249                 v.reset(OpPPC64ISEL)
6250                 v.AuxInt = int32ToAuxInt(n - 1)
6251                 v.AddArg3(x, y, bool)
6252                 return true
6253         }
6254         // match: (ISEL [n] x y (InvertFlags bool))
6255         // cond: n%4 == 2
6256         // result: (ISEL [n] x y bool)
6257         for {
6258                 n := auxIntToInt32(v.AuxInt)
6259                 x := v_0
6260                 y := v_1
6261                 if v_2.Op != OpPPC64InvertFlags {
6262                         break
6263                 }
6264                 bool := v_2.Args[0]
6265                 if !(n%4 == 2) {
6266                         break
6267                 }
6268                 v.reset(OpPPC64ISEL)
6269                 v.AuxInt = int32ToAuxInt(n)
6270                 v.AddArg3(x, y, bool)
6271                 return true
6272         }
6273         return false
6274 }
6275 func rewriteValuePPC64_OpPPC64LessEqual(v *Value) bool {
6276         v_0 := v.Args[0]
6277         // match: (LessEqual (FlagEQ))
6278         // result: (MOVDconst [1])
6279         for {
6280                 if v_0.Op != OpPPC64FlagEQ {
6281                         break
6282                 }
6283                 v.reset(OpPPC64MOVDconst)
6284                 v.AuxInt = int64ToAuxInt(1)
6285                 return true
6286         }
6287         // match: (LessEqual (FlagLT))
6288         // result: (MOVDconst [1])
6289         for {
6290                 if v_0.Op != OpPPC64FlagLT {
6291                         break
6292                 }
6293                 v.reset(OpPPC64MOVDconst)
6294                 v.AuxInt = int64ToAuxInt(1)
6295                 return true
6296         }
6297         // match: (LessEqual (FlagGT))
6298         // result: (MOVDconst [0])
6299         for {
6300                 if v_0.Op != OpPPC64FlagGT {
6301                         break
6302                 }
6303                 v.reset(OpPPC64MOVDconst)
6304                 v.AuxInt = int64ToAuxInt(0)
6305                 return true
6306         }
6307         // match: (LessEqual (InvertFlags x))
6308         // result: (GreaterEqual x)
6309         for {
6310                 if v_0.Op != OpPPC64InvertFlags {
6311                         break
6312                 }
6313                 x := v_0.Args[0]
6314                 v.reset(OpPPC64GreaterEqual)
6315                 v.AddArg(x)
6316                 return true
6317         }
6318         // match: (LessEqual cmp)
6319         // result: (SETBCR [1] cmp)
6320         for {
6321                 cmp := v_0
6322                 v.reset(OpPPC64SETBCR)
6323                 v.AuxInt = int32ToAuxInt(1)
6324                 v.AddArg(cmp)
6325                 return true
6326         }
6327 }
6328 func rewriteValuePPC64_OpPPC64LessThan(v *Value) bool {
6329         v_0 := v.Args[0]
6330         // match: (LessThan (FlagEQ))
6331         // result: (MOVDconst [0])
6332         for {
6333                 if v_0.Op != OpPPC64FlagEQ {
6334                         break
6335                 }
6336                 v.reset(OpPPC64MOVDconst)
6337                 v.AuxInt = int64ToAuxInt(0)
6338                 return true
6339         }
6340         // match: (LessThan (FlagLT))
6341         // result: (MOVDconst [1])
6342         for {
6343                 if v_0.Op != OpPPC64FlagLT {
6344                         break
6345                 }
6346                 v.reset(OpPPC64MOVDconst)
6347                 v.AuxInt = int64ToAuxInt(1)
6348                 return true
6349         }
6350         // match: (LessThan (FlagGT))
6351         // result: (MOVDconst [0])
6352         for {
6353                 if v_0.Op != OpPPC64FlagGT {
6354                         break
6355                 }
6356                 v.reset(OpPPC64MOVDconst)
6357                 v.AuxInt = int64ToAuxInt(0)
6358                 return true
6359         }
6360         // match: (LessThan (InvertFlags x))
6361         // result: (GreaterThan x)
6362         for {
6363                 if v_0.Op != OpPPC64InvertFlags {
6364                         break
6365                 }
6366                 x := v_0.Args[0]
6367                 v.reset(OpPPC64GreaterThan)
6368                 v.AddArg(x)
6369                 return true
6370         }
6371         // match: (LessThan cmp)
6372         // result: (SETBC [0] cmp)
6373         for {
6374                 cmp := v_0
6375                 v.reset(OpPPC64SETBC)
6376                 v.AuxInt = int32ToAuxInt(0)
6377                 v.AddArg(cmp)
6378                 return true
6379         }
6380 }
6381 func rewriteValuePPC64_OpPPC64MFVSRD(v *Value) bool {
6382         v_0 := v.Args[0]
6383         b := v.Block
6384         typ := &b.Func.Config.Types
6385         // match: (MFVSRD (FMOVDconst [c]))
6386         // result: (MOVDconst [int64(math.Float64bits(c))])
6387         for {
6388                 if v_0.Op != OpPPC64FMOVDconst {
6389                         break
6390                 }
6391                 c := auxIntToFloat64(v_0.AuxInt)
6392                 v.reset(OpPPC64MOVDconst)
6393                 v.AuxInt = int64ToAuxInt(int64(math.Float64bits(c)))
6394                 return true
6395         }
6396         // match: (MFVSRD x:(FMOVDload [off] {sym} ptr mem))
6397         // cond: x.Uses == 1 && clobber(x)
6398         // result: @x.Block (MOVDload [off] {sym} ptr mem)
6399         for {
6400                 x := v_0
6401                 if x.Op != OpPPC64FMOVDload {
6402                         break
6403                 }
6404                 off := auxIntToInt32(x.AuxInt)
6405                 sym := auxToSym(x.Aux)
6406                 mem := x.Args[1]
6407                 ptr := x.Args[0]
6408                 if !(x.Uses == 1 && clobber(x)) {
6409                         break
6410                 }
6411                 b = x.Block
6412                 v0 := b.NewValue0(x.Pos, OpPPC64MOVDload, typ.Int64)
6413                 v.copyOf(v0)
6414                 v0.AuxInt = int32ToAuxInt(off)
6415                 v0.Aux = symToAux(sym)
6416                 v0.AddArg2(ptr, mem)
6417                 return true
6418         }
6419         return false
6420 }
6421 func rewriteValuePPC64_OpPPC64MOVBZload(v *Value) bool {
6422         v_1 := v.Args[1]
6423         v_0 := v.Args[0]
6424         // match: (MOVBZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
6425         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
6426         // result: (MOVBZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
6427         for {
6428                 off1 := auxIntToInt32(v.AuxInt)
6429                 sym1 := auxToSym(v.Aux)
6430                 p := v_0
6431                 if p.Op != OpPPC64MOVDaddr {
6432                         break
6433                 }
6434                 off2 := auxIntToInt32(p.AuxInt)
6435                 sym2 := auxToSym(p.Aux)
6436                 ptr := p.Args[0]
6437                 mem := v_1
6438                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
6439                         break
6440                 }
6441                 v.reset(OpPPC64MOVBZload)
6442                 v.AuxInt = int32ToAuxInt(off1 + off2)
6443                 v.Aux = symToAux(mergeSym(sym1, sym2))
6444                 v.AddArg2(ptr, mem)
6445                 return true
6446         }
6447         // match: (MOVBZload [off1] {sym} (ADDconst [off2] x) mem)
6448         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
6449         // result: (MOVBZload [off1+int32(off2)] {sym} x mem)
6450         for {
6451                 off1 := auxIntToInt32(v.AuxInt)
6452                 sym := auxToSym(v.Aux)
6453                 if v_0.Op != OpPPC64ADDconst {
6454                         break
6455                 }
6456                 off2 := auxIntToInt64(v_0.AuxInt)
6457                 x := v_0.Args[0]
6458                 mem := v_1
6459                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
6460                         break
6461                 }
6462                 v.reset(OpPPC64MOVBZload)
6463                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
6464                 v.Aux = symToAux(sym)
6465                 v.AddArg2(x, mem)
6466                 return true
6467         }
6468         // match: (MOVBZload [0] {sym} p:(ADD ptr idx) mem)
6469         // cond: sym == nil && p.Uses == 1
6470         // result: (MOVBZloadidx ptr idx mem)
6471         for {
6472                 if auxIntToInt32(v.AuxInt) != 0 {
6473                         break
6474                 }
6475                 sym := auxToSym(v.Aux)
6476                 p := v_0
6477                 if p.Op != OpPPC64ADD {
6478                         break
6479                 }
6480                 idx := p.Args[1]
6481                 ptr := p.Args[0]
6482                 mem := v_1
6483                 if !(sym == nil && p.Uses == 1) {
6484                         break
6485                 }
6486                 v.reset(OpPPC64MOVBZloadidx)
6487                 v.AddArg3(ptr, idx, mem)
6488                 return true
6489         }
6490         return false
6491 }
6492 func rewriteValuePPC64_OpPPC64MOVBZloadidx(v *Value) bool {
6493         v_2 := v.Args[2]
6494         v_1 := v.Args[1]
6495         v_0 := v.Args[0]
6496         // match: (MOVBZloadidx ptr (MOVDconst [c]) mem)
6497         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
6498         // result: (MOVBZload [int32(c)] ptr mem)
6499         for {
6500                 ptr := v_0
6501                 if v_1.Op != OpPPC64MOVDconst {
6502                         break
6503                 }
6504                 c := auxIntToInt64(v_1.AuxInt)
6505                 mem := v_2
6506                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
6507                         break
6508                 }
6509                 v.reset(OpPPC64MOVBZload)
6510                 v.AuxInt = int32ToAuxInt(int32(c))
6511                 v.AddArg2(ptr, mem)
6512                 return true
6513         }
6514         // match: (MOVBZloadidx (MOVDconst [c]) ptr mem)
6515         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
6516         // result: (MOVBZload [int32(c)] ptr mem)
6517         for {
6518                 if v_0.Op != OpPPC64MOVDconst {
6519                         break
6520                 }
6521                 c := auxIntToInt64(v_0.AuxInt)
6522                 ptr := v_1
6523                 mem := v_2
6524                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
6525                         break
6526                 }
6527                 v.reset(OpPPC64MOVBZload)
6528                 v.AuxInt = int32ToAuxInt(int32(c))
6529                 v.AddArg2(ptr, mem)
6530                 return true
6531         }
6532         return false
6533 }
6534 func rewriteValuePPC64_OpPPC64MOVBZreg(v *Value) bool {
6535         v_0 := v.Args[0]
6536         b := v.Block
6537         typ := &b.Func.Config.Types
6538         // match: (MOVBZreg y:(Select0 (ANDCCconst [c] _)))
6539         // cond: uint64(c) <= 0xFF
6540         // result: y
6541         for {
6542                 y := v_0
6543                 if y.Op != OpSelect0 {
6544                         break
6545                 }
6546                 y_0 := y.Args[0]
6547                 if y_0.Op != OpPPC64ANDCCconst {
6548                         break
6549                 }
6550                 c := auxIntToInt64(y_0.AuxInt)
6551                 if !(uint64(c) <= 0xFF) {
6552                         break
6553                 }
6554                 v.copyOf(y)
6555                 return true
6556         }
6557         // match: (MOVBZreg (SRWconst [c] (MOVBZreg x)))
6558         // result: (SRWconst [c] (MOVBZreg x))
6559         for {
6560                 if v_0.Op != OpPPC64SRWconst {
6561                         break
6562                 }
6563                 c := auxIntToInt64(v_0.AuxInt)
6564                 v_0_0 := v_0.Args[0]
6565                 if v_0_0.Op != OpPPC64MOVBZreg {
6566                         break
6567                 }
6568                 x := v_0_0.Args[0]
6569                 v.reset(OpPPC64SRWconst)
6570                 v.AuxInt = int64ToAuxInt(c)
6571                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
6572                 v0.AddArg(x)
6573                 v.AddArg(v0)
6574                 return true
6575         }
6576         // match: (MOVBZreg (SRWconst [c] x))
6577         // cond: sizeof(x.Type) == 8
6578         // result: (SRWconst [c] x)
6579         for {
6580                 if v_0.Op != OpPPC64SRWconst {
6581                         break
6582                 }
6583                 c := auxIntToInt64(v_0.AuxInt)
6584                 x := v_0.Args[0]
6585                 if !(sizeof(x.Type) == 8) {
6586                         break
6587                 }
6588                 v.reset(OpPPC64SRWconst)
6589                 v.AuxInt = int64ToAuxInt(c)
6590                 v.AddArg(x)
6591                 return true
6592         }
6593         // match: (MOVBZreg (SRDconst [c] x))
6594         // cond: c>=56
6595         // result: (SRDconst [c] x)
6596         for {
6597                 if v_0.Op != OpPPC64SRDconst {
6598                         break
6599                 }
6600                 c := auxIntToInt64(v_0.AuxInt)
6601                 x := v_0.Args[0]
6602                 if !(c >= 56) {
6603                         break
6604                 }
6605                 v.reset(OpPPC64SRDconst)
6606                 v.AuxInt = int64ToAuxInt(c)
6607                 v.AddArg(x)
6608                 return true
6609         }
6610         // match: (MOVBZreg (SRWconst [c] x))
6611         // cond: c>=24
6612         // result: (SRWconst [c] x)
6613         for {
6614                 if v_0.Op != OpPPC64SRWconst {
6615                         break
6616                 }
6617                 c := auxIntToInt64(v_0.AuxInt)
6618                 x := v_0.Args[0]
6619                 if !(c >= 24) {
6620                         break
6621                 }
6622                 v.reset(OpPPC64SRWconst)
6623                 v.AuxInt = int64ToAuxInt(c)
6624                 v.AddArg(x)
6625                 return true
6626         }
6627         // match: (MOVBZreg y:(MOVBZreg _))
6628         // result: y
6629         for {
6630                 y := v_0
6631                 if y.Op != OpPPC64MOVBZreg {
6632                         break
6633                 }
6634                 v.copyOf(y)
6635                 return true
6636         }
6637         // match: (MOVBZreg (MOVBreg x))
6638         // result: (MOVBZreg x)
6639         for {
6640                 if v_0.Op != OpPPC64MOVBreg {
6641                         break
6642                 }
6643                 x := v_0.Args[0]
6644                 v.reset(OpPPC64MOVBZreg)
6645                 v.AddArg(x)
6646                 return true
6647         }
6648         // match: (MOVBZreg (OR <t> x (MOVWZreg y)))
6649         // result: (MOVBZreg (OR <t> x y))
6650         for {
6651                 if v_0.Op != OpPPC64OR {
6652                         break
6653                 }
6654                 t := v_0.Type
6655                 _ = v_0.Args[1]
6656                 v_0_0 := v_0.Args[0]
6657                 v_0_1 := v_0.Args[1]
6658                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6659                         x := v_0_0
6660                         if v_0_1.Op != OpPPC64MOVWZreg {
6661                                 continue
6662                         }
6663                         y := v_0_1.Args[0]
6664                         v.reset(OpPPC64MOVBZreg)
6665                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6666                         v0.AddArg2(x, y)
6667                         v.AddArg(v0)
6668                         return true
6669                 }
6670                 break
6671         }
6672         // match: (MOVBZreg (XOR <t> x (MOVWZreg y)))
6673         // result: (MOVBZreg (XOR <t> x y))
6674         for {
6675                 if v_0.Op != OpPPC64XOR {
6676                         break
6677                 }
6678                 t := v_0.Type
6679                 _ = v_0.Args[1]
6680                 v_0_0 := v_0.Args[0]
6681                 v_0_1 := v_0.Args[1]
6682                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6683                         x := v_0_0
6684                         if v_0_1.Op != OpPPC64MOVWZreg {
6685                                 continue
6686                         }
6687                         y := v_0_1.Args[0]
6688                         v.reset(OpPPC64MOVBZreg)
6689                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6690                         v0.AddArg2(x, y)
6691                         v.AddArg(v0)
6692                         return true
6693                 }
6694                 break
6695         }
6696         // match: (MOVBZreg (AND <t> x (MOVWZreg y)))
6697         // result: (MOVBZreg (AND <t> x y))
6698         for {
6699                 if v_0.Op != OpPPC64AND {
6700                         break
6701                 }
6702                 t := v_0.Type
6703                 _ = v_0.Args[1]
6704                 v_0_0 := v_0.Args[0]
6705                 v_0_1 := v_0.Args[1]
6706                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6707                         x := v_0_0
6708                         if v_0_1.Op != OpPPC64MOVWZreg {
6709                                 continue
6710                         }
6711                         y := v_0_1.Args[0]
6712                         v.reset(OpPPC64MOVBZreg)
6713                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6714                         v0.AddArg2(x, y)
6715                         v.AddArg(v0)
6716                         return true
6717                 }
6718                 break
6719         }
6720         // match: (MOVBZreg (OR <t> x (MOVHZreg y)))
6721         // result: (MOVBZreg (OR <t> x y))
6722         for {
6723                 if v_0.Op != OpPPC64OR {
6724                         break
6725                 }
6726                 t := v_0.Type
6727                 _ = v_0.Args[1]
6728                 v_0_0 := v_0.Args[0]
6729                 v_0_1 := v_0.Args[1]
6730                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6731                         x := v_0_0
6732                         if v_0_1.Op != OpPPC64MOVHZreg {
6733                                 continue
6734                         }
6735                         y := v_0_1.Args[0]
6736                         v.reset(OpPPC64MOVBZreg)
6737                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6738                         v0.AddArg2(x, y)
6739                         v.AddArg(v0)
6740                         return true
6741                 }
6742                 break
6743         }
6744         // match: (MOVBZreg (XOR <t> x (MOVHZreg y)))
6745         // result: (MOVBZreg (XOR <t> x y))
6746         for {
6747                 if v_0.Op != OpPPC64XOR {
6748                         break
6749                 }
6750                 t := v_0.Type
6751                 _ = v_0.Args[1]
6752                 v_0_0 := v_0.Args[0]
6753                 v_0_1 := v_0.Args[1]
6754                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6755                         x := v_0_0
6756                         if v_0_1.Op != OpPPC64MOVHZreg {
6757                                 continue
6758                         }
6759                         y := v_0_1.Args[0]
6760                         v.reset(OpPPC64MOVBZreg)
6761                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6762                         v0.AddArg2(x, y)
6763                         v.AddArg(v0)
6764                         return true
6765                 }
6766                 break
6767         }
6768         // match: (MOVBZreg (AND <t> x (MOVHZreg y)))
6769         // result: (MOVBZreg (AND <t> x y))
6770         for {
6771                 if v_0.Op != OpPPC64AND {
6772                         break
6773                 }
6774                 t := v_0.Type
6775                 _ = v_0.Args[1]
6776                 v_0_0 := v_0.Args[0]
6777                 v_0_1 := v_0.Args[1]
6778                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6779                         x := v_0_0
6780                         if v_0_1.Op != OpPPC64MOVHZreg {
6781                                 continue
6782                         }
6783                         y := v_0_1.Args[0]
6784                         v.reset(OpPPC64MOVBZreg)
6785                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6786                         v0.AddArg2(x, y)
6787                         v.AddArg(v0)
6788                         return true
6789                 }
6790                 break
6791         }
6792         // match: (MOVBZreg (OR <t> x (MOVBZreg y)))
6793         // result: (MOVBZreg (OR <t> x y))
6794         for {
6795                 if v_0.Op != OpPPC64OR {
6796                         break
6797                 }
6798                 t := v_0.Type
6799                 _ = v_0.Args[1]
6800                 v_0_0 := v_0.Args[0]
6801                 v_0_1 := v_0.Args[1]
6802                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6803                         x := v_0_0
6804                         if v_0_1.Op != OpPPC64MOVBZreg {
6805                                 continue
6806                         }
6807                         y := v_0_1.Args[0]
6808                         v.reset(OpPPC64MOVBZreg)
6809                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6810                         v0.AddArg2(x, y)
6811                         v.AddArg(v0)
6812                         return true
6813                 }
6814                 break
6815         }
6816         // match: (MOVBZreg (XOR <t> x (MOVBZreg y)))
6817         // result: (MOVBZreg (XOR <t> x y))
6818         for {
6819                 if v_0.Op != OpPPC64XOR {
6820                         break
6821                 }
6822                 t := v_0.Type
6823                 _ = v_0.Args[1]
6824                 v_0_0 := v_0.Args[0]
6825                 v_0_1 := v_0.Args[1]
6826                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6827                         x := v_0_0
6828                         if v_0_1.Op != OpPPC64MOVBZreg {
6829                                 continue
6830                         }
6831                         y := v_0_1.Args[0]
6832                         v.reset(OpPPC64MOVBZreg)
6833                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6834                         v0.AddArg2(x, y)
6835                         v.AddArg(v0)
6836                         return true
6837                 }
6838                 break
6839         }
6840         // match: (MOVBZreg (AND <t> x (MOVBZreg y)))
6841         // result: (MOVBZreg (AND <t> x y))
6842         for {
6843                 if v_0.Op != OpPPC64AND {
6844                         break
6845                 }
6846                 t := v_0.Type
6847                 _ = v_0.Args[1]
6848                 v_0_0 := v_0.Args[0]
6849                 v_0_1 := v_0.Args[1]
6850                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6851                         x := v_0_0
6852                         if v_0_1.Op != OpPPC64MOVBZreg {
6853                                 continue
6854                         }
6855                         y := v_0_1.Args[0]
6856                         v.reset(OpPPC64MOVBZreg)
6857                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6858                         v0.AddArg2(x, y)
6859                         v.AddArg(v0)
6860                         return true
6861                 }
6862                 break
6863         }
6864         // match: (MOVBZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x))))
6865         // result: z
6866         for {
6867                 z := v_0
6868                 if z.Op != OpSelect0 {
6869                         break
6870                 }
6871                 z_0 := z.Args[0]
6872                 if z_0.Op != OpPPC64ANDCCconst {
6873                         break
6874                 }
6875                 z_0_0 := z_0.Args[0]
6876                 if z_0_0.Op != OpPPC64MOVBZload {
6877                         break
6878                 }
6879                 v.copyOf(z)
6880                 return true
6881         }
6882         // match: (MOVBZreg z:(AND y (MOVBZload ptr x)))
6883         // result: z
6884         for {
6885                 z := v_0
6886                 if z.Op != OpPPC64AND {
6887                         break
6888                 }
6889                 _ = z.Args[1]
6890                 z_0 := z.Args[0]
6891                 z_1 := z.Args[1]
6892                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
6893                         if z_1.Op != OpPPC64MOVBZload {
6894                                 continue
6895                         }
6896                         v.copyOf(z)
6897                         return true
6898                 }
6899                 break
6900         }
6901         // match: (MOVBZreg x:(MOVBZload _ _))
6902         // result: x
6903         for {
6904                 x := v_0
6905                 if x.Op != OpPPC64MOVBZload {
6906                         break
6907                 }
6908                 v.copyOf(x)
6909                 return true
6910         }
6911         // match: (MOVBZreg x:(MOVBZloadidx _ _ _))
6912         // result: x
6913         for {
6914                 x := v_0
6915                 if x.Op != OpPPC64MOVBZloadidx {
6916                         break
6917                 }
6918                 v.copyOf(x)
6919                 return true
6920         }
6921         // match: (MOVBZreg x:(Select0 (LoweredAtomicLoad8 _ _)))
6922         // result: x
6923         for {
6924                 x := v_0
6925                 if x.Op != OpSelect0 {
6926                         break
6927                 }
6928                 x_0 := x.Args[0]
6929                 if x_0.Op != OpPPC64LoweredAtomicLoad8 {
6930                         break
6931                 }
6932                 v.copyOf(x)
6933                 return true
6934         }
6935         // match: (MOVBZreg x:(Arg <t>))
6936         // cond: is8BitInt(t) && !t.IsSigned()
6937         // result: x
6938         for {
6939                 x := v_0
6940                 if x.Op != OpArg {
6941                         break
6942                 }
6943                 t := x.Type
6944                 if !(is8BitInt(t) && !t.IsSigned()) {
6945                         break
6946                 }
6947                 v.copyOf(x)
6948                 return true
6949         }
6950         // match: (MOVBZreg (MOVDconst [c]))
6951         // result: (MOVDconst [int64(uint8(c))])
6952         for {
6953                 if v_0.Op != OpPPC64MOVDconst {
6954                         break
6955                 }
6956                 c := auxIntToInt64(v_0.AuxInt)
6957                 v.reset(OpPPC64MOVDconst)
6958                 v.AuxInt = int64ToAuxInt(int64(uint8(c)))
6959                 return true
6960         }
6961         return false
6962 }
6963 func rewriteValuePPC64_OpPPC64MOVBreg(v *Value) bool {
6964         v_0 := v.Args[0]
6965         b := v.Block
6966         typ := &b.Func.Config.Types
6967         // match: (MOVBreg y:(Select0 (ANDCCconst [c] _)))
6968         // cond: uint64(c) <= 0x7F
6969         // result: y
6970         for {
6971                 y := v_0
6972                 if y.Op != OpSelect0 {
6973                         break
6974                 }
6975                 y_0 := y.Args[0]
6976                 if y_0.Op != OpPPC64ANDCCconst {
6977                         break
6978                 }
6979                 c := auxIntToInt64(y_0.AuxInt)
6980                 if !(uint64(c) <= 0x7F) {
6981                         break
6982                 }
6983                 v.copyOf(y)
6984                 return true
6985         }
6986         // match: (MOVBreg (SRAWconst [c] (MOVBreg x)))
6987         // result: (SRAWconst [c] (MOVBreg x))
6988         for {
6989                 if v_0.Op != OpPPC64SRAWconst {
6990                         break
6991                 }
6992                 c := auxIntToInt64(v_0.AuxInt)
6993                 v_0_0 := v_0.Args[0]
6994                 if v_0_0.Op != OpPPC64MOVBreg {
6995                         break
6996                 }
6997                 x := v_0_0.Args[0]
6998                 v.reset(OpPPC64SRAWconst)
6999                 v.AuxInt = int64ToAuxInt(c)
7000                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
7001                 v0.AddArg(x)
7002                 v.AddArg(v0)
7003                 return true
7004         }
7005         // match: (MOVBreg (SRAWconst [c] x))
7006         // cond: sizeof(x.Type) == 8
7007         // result: (SRAWconst [c] x)
7008         for {
7009                 if v_0.Op != OpPPC64SRAWconst {
7010                         break
7011                 }
7012                 c := auxIntToInt64(v_0.AuxInt)
7013                 x := v_0.Args[0]
7014                 if !(sizeof(x.Type) == 8) {
7015                         break
7016                 }
7017                 v.reset(OpPPC64SRAWconst)
7018                 v.AuxInt = int64ToAuxInt(c)
7019                 v.AddArg(x)
7020                 return true
7021         }
7022         // match: (MOVBreg (SRDconst [c] x))
7023         // cond: c>56
7024         // result: (SRDconst [c] x)
7025         for {
7026                 if v_0.Op != OpPPC64SRDconst {
7027                         break
7028                 }
7029                 c := auxIntToInt64(v_0.AuxInt)
7030                 x := v_0.Args[0]
7031                 if !(c > 56) {
7032                         break
7033                 }
7034                 v.reset(OpPPC64SRDconst)
7035                 v.AuxInt = int64ToAuxInt(c)
7036                 v.AddArg(x)
7037                 return true
7038         }
7039         // match: (MOVBreg (SRDconst [c] x))
7040         // cond: c==56
7041         // result: (SRADconst [c] x)
7042         for {
7043                 if v_0.Op != OpPPC64SRDconst {
7044                         break
7045                 }
7046                 c := auxIntToInt64(v_0.AuxInt)
7047                 x := v_0.Args[0]
7048                 if !(c == 56) {
7049                         break
7050                 }
7051                 v.reset(OpPPC64SRADconst)
7052                 v.AuxInt = int64ToAuxInt(c)
7053                 v.AddArg(x)
7054                 return true
7055         }
7056         // match: (MOVBreg (SRADconst [c] x))
7057         // cond: c>=56
7058         // result: (SRADconst [c] x)
7059         for {
7060                 if v_0.Op != OpPPC64SRADconst {
7061                         break
7062                 }
7063                 c := auxIntToInt64(v_0.AuxInt)
7064                 x := v_0.Args[0]
7065                 if !(c >= 56) {
7066                         break
7067                 }
7068                 v.reset(OpPPC64SRADconst)
7069                 v.AuxInt = int64ToAuxInt(c)
7070                 v.AddArg(x)
7071                 return true
7072         }
7073         // match: (MOVBreg (SRWconst [c] x))
7074         // cond: c>24
7075         // result: (SRWconst [c] x)
7076         for {
7077                 if v_0.Op != OpPPC64SRWconst {
7078                         break
7079                 }
7080                 c := auxIntToInt64(v_0.AuxInt)
7081                 x := v_0.Args[0]
7082                 if !(c > 24) {
7083                         break
7084                 }
7085                 v.reset(OpPPC64SRWconst)
7086                 v.AuxInt = int64ToAuxInt(c)
7087                 v.AddArg(x)
7088                 return true
7089         }
7090         // match: (MOVBreg (SRWconst [c] x))
7091         // cond: c==24
7092         // result: (SRAWconst [c] x)
7093         for {
7094                 if v_0.Op != OpPPC64SRWconst {
7095                         break
7096                 }
7097                 c := auxIntToInt64(v_0.AuxInt)
7098                 x := v_0.Args[0]
7099                 if !(c == 24) {
7100                         break
7101                 }
7102                 v.reset(OpPPC64SRAWconst)
7103                 v.AuxInt = int64ToAuxInt(c)
7104                 v.AddArg(x)
7105                 return true
7106         }
7107         // match: (MOVBreg (SRAWconst [c] x))
7108         // cond: c>=24
7109         // result: (SRAWconst [c] x)
7110         for {
7111                 if v_0.Op != OpPPC64SRAWconst {
7112                         break
7113                 }
7114                 c := auxIntToInt64(v_0.AuxInt)
7115                 x := v_0.Args[0]
7116                 if !(c >= 24) {
7117                         break
7118                 }
7119                 v.reset(OpPPC64SRAWconst)
7120                 v.AuxInt = int64ToAuxInt(c)
7121                 v.AddArg(x)
7122                 return true
7123         }
7124         // match: (MOVBreg y:(MOVBreg _))
7125         // result: y
7126         for {
7127                 y := v_0
7128                 if y.Op != OpPPC64MOVBreg {
7129                         break
7130                 }
7131                 v.copyOf(y)
7132                 return true
7133         }
7134         // match: (MOVBreg (MOVBZreg x))
7135         // result: (MOVBreg x)
7136         for {
7137                 if v_0.Op != OpPPC64MOVBZreg {
7138                         break
7139                 }
7140                 x := v_0.Args[0]
7141                 v.reset(OpPPC64MOVBreg)
7142                 v.AddArg(x)
7143                 return true
7144         }
7145         // match: (MOVBreg x:(Arg <t>))
7146         // cond: is8BitInt(t) && t.IsSigned()
7147         // result: x
7148         for {
7149                 x := v_0
7150                 if x.Op != OpArg {
7151                         break
7152                 }
7153                 t := x.Type
7154                 if !(is8BitInt(t) && t.IsSigned()) {
7155                         break
7156                 }
7157                 v.copyOf(x)
7158                 return true
7159         }
7160         // match: (MOVBreg (MOVDconst [c]))
7161         // result: (MOVDconst [int64(int8(c))])
7162         for {
7163                 if v_0.Op != OpPPC64MOVDconst {
7164                         break
7165                 }
7166                 c := auxIntToInt64(v_0.AuxInt)
7167                 v.reset(OpPPC64MOVDconst)
7168                 v.AuxInt = int64ToAuxInt(int64(int8(c)))
7169                 return true
7170         }
7171         return false
7172 }
7173 func rewriteValuePPC64_OpPPC64MOVBstore(v *Value) bool {
7174         v_2 := v.Args[2]
7175         v_1 := v.Args[1]
7176         v_0 := v.Args[0]
7177         b := v.Block
7178         typ := &b.Func.Config.Types
7179         // match: (MOVBstore [off1] {sym} (ADDconst [off2] x) val mem)
7180         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
7181         // result: (MOVBstore [off1+int32(off2)] {sym} x val mem)
7182         for {
7183                 off1 := auxIntToInt32(v.AuxInt)
7184                 sym := auxToSym(v.Aux)
7185                 if v_0.Op != OpPPC64ADDconst {
7186                         break
7187                 }
7188                 off2 := auxIntToInt64(v_0.AuxInt)
7189                 x := v_0.Args[0]
7190                 val := v_1
7191                 mem := v_2
7192                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
7193                         break
7194                 }
7195                 v.reset(OpPPC64MOVBstore)
7196                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7197                 v.Aux = symToAux(sym)
7198                 v.AddArg3(x, val, mem)
7199                 return true
7200         }
7201         // match: (MOVBstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
7202         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
7203         // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
7204         for {
7205                 off1 := auxIntToInt32(v.AuxInt)
7206                 sym1 := auxToSym(v.Aux)
7207                 p := v_0
7208                 if p.Op != OpPPC64MOVDaddr {
7209                         break
7210                 }
7211                 off2 := auxIntToInt32(p.AuxInt)
7212                 sym2 := auxToSym(p.Aux)
7213                 ptr := p.Args[0]
7214                 val := v_1
7215                 mem := v_2
7216                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7217                         break
7218                 }
7219                 v.reset(OpPPC64MOVBstore)
7220                 v.AuxInt = int32ToAuxInt(off1 + off2)
7221                 v.Aux = symToAux(mergeSym(sym1, sym2))
7222                 v.AddArg3(ptr, val, mem)
7223                 return true
7224         }
7225         // match: (MOVBstore [off] {sym} ptr (MOVDconst [0]) mem)
7226         // result: (MOVBstorezero [off] {sym} ptr mem)
7227         for {
7228                 off := auxIntToInt32(v.AuxInt)
7229                 sym := auxToSym(v.Aux)
7230                 ptr := v_0
7231                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
7232                         break
7233                 }
7234                 mem := v_2
7235                 v.reset(OpPPC64MOVBstorezero)
7236                 v.AuxInt = int32ToAuxInt(off)
7237                 v.Aux = symToAux(sym)
7238                 v.AddArg2(ptr, mem)
7239                 return true
7240         }
7241         // match: (MOVBstore [0] {sym} p:(ADD ptr idx) val mem)
7242         // cond: sym == nil && p.Uses == 1
7243         // result: (MOVBstoreidx ptr idx val mem)
7244         for {
7245                 if auxIntToInt32(v.AuxInt) != 0 {
7246                         break
7247                 }
7248                 sym := auxToSym(v.Aux)
7249                 p := v_0
7250                 if p.Op != OpPPC64ADD {
7251                         break
7252                 }
7253                 idx := p.Args[1]
7254                 ptr := p.Args[0]
7255                 val := v_1
7256                 mem := v_2
7257                 if !(sym == nil && p.Uses == 1) {
7258                         break
7259                 }
7260                 v.reset(OpPPC64MOVBstoreidx)
7261                 v.AddArg4(ptr, idx, val, mem)
7262                 return true
7263         }
7264         // match: (MOVBstore [off] {sym} ptr (MOVBreg x) mem)
7265         // result: (MOVBstore [off] {sym} ptr x mem)
7266         for {
7267                 off := auxIntToInt32(v.AuxInt)
7268                 sym := auxToSym(v.Aux)
7269                 ptr := v_0
7270                 if v_1.Op != OpPPC64MOVBreg {
7271                         break
7272                 }
7273                 x := v_1.Args[0]
7274                 mem := v_2
7275                 v.reset(OpPPC64MOVBstore)
7276                 v.AuxInt = int32ToAuxInt(off)
7277                 v.Aux = symToAux(sym)
7278                 v.AddArg3(ptr, x, mem)
7279                 return true
7280         }
7281         // match: (MOVBstore [off] {sym} ptr (MOVBZreg x) mem)
7282         // result: (MOVBstore [off] {sym} ptr x mem)
7283         for {
7284                 off := auxIntToInt32(v.AuxInt)
7285                 sym := auxToSym(v.Aux)
7286                 ptr := v_0
7287                 if v_1.Op != OpPPC64MOVBZreg {
7288                         break
7289                 }
7290                 x := v_1.Args[0]
7291                 mem := v_2
7292                 v.reset(OpPPC64MOVBstore)
7293                 v.AuxInt = int32ToAuxInt(off)
7294                 v.Aux = symToAux(sym)
7295                 v.AddArg3(ptr, x, mem)
7296                 return true
7297         }
7298         // match: (MOVBstore [off] {sym} ptr (MOVHreg x) mem)
7299         // result: (MOVBstore [off] {sym} ptr x mem)
7300         for {
7301                 off := auxIntToInt32(v.AuxInt)
7302                 sym := auxToSym(v.Aux)
7303                 ptr := v_0
7304                 if v_1.Op != OpPPC64MOVHreg {
7305                         break
7306                 }
7307                 x := v_1.Args[0]
7308                 mem := v_2
7309                 v.reset(OpPPC64MOVBstore)
7310                 v.AuxInt = int32ToAuxInt(off)
7311                 v.Aux = symToAux(sym)
7312                 v.AddArg3(ptr, x, mem)
7313                 return true
7314         }
7315         // match: (MOVBstore [off] {sym} ptr (MOVHZreg x) mem)
7316         // result: (MOVBstore [off] {sym} ptr x mem)
7317         for {
7318                 off := auxIntToInt32(v.AuxInt)
7319                 sym := auxToSym(v.Aux)
7320                 ptr := v_0
7321                 if v_1.Op != OpPPC64MOVHZreg {
7322                         break
7323                 }
7324                 x := v_1.Args[0]
7325                 mem := v_2
7326                 v.reset(OpPPC64MOVBstore)
7327                 v.AuxInt = int32ToAuxInt(off)
7328                 v.Aux = symToAux(sym)
7329                 v.AddArg3(ptr, x, mem)
7330                 return true
7331         }
7332         // match: (MOVBstore [off] {sym} ptr (MOVWreg x) mem)
7333         // result: (MOVBstore [off] {sym} ptr x mem)
7334         for {
7335                 off := auxIntToInt32(v.AuxInt)
7336                 sym := auxToSym(v.Aux)
7337                 ptr := v_0
7338                 if v_1.Op != OpPPC64MOVWreg {
7339                         break
7340                 }
7341                 x := v_1.Args[0]
7342                 mem := v_2
7343                 v.reset(OpPPC64MOVBstore)
7344                 v.AuxInt = int32ToAuxInt(off)
7345                 v.Aux = symToAux(sym)
7346                 v.AddArg3(ptr, x, mem)
7347                 return true
7348         }
7349         // match: (MOVBstore [off] {sym} ptr (MOVWZreg x) mem)
7350         // result: (MOVBstore [off] {sym} ptr x mem)
7351         for {
7352                 off := auxIntToInt32(v.AuxInt)
7353                 sym := auxToSym(v.Aux)
7354                 ptr := v_0
7355                 if v_1.Op != OpPPC64MOVWZreg {
7356                         break
7357                 }
7358                 x := v_1.Args[0]
7359                 mem := v_2
7360                 v.reset(OpPPC64MOVBstore)
7361                 v.AuxInt = int32ToAuxInt(off)
7362                 v.Aux = symToAux(sym)
7363                 v.AddArg3(ptr, x, mem)
7364                 return true
7365         }
7366         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVHreg x) [c]) mem)
7367         // cond: c <= 8
7368         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7369         for {
7370                 off := auxIntToInt32(v.AuxInt)
7371                 sym := auxToSym(v.Aux)
7372                 ptr := v_0
7373                 if v_1.Op != OpPPC64SRWconst {
7374                         break
7375                 }
7376                 c := auxIntToInt64(v_1.AuxInt)
7377                 v_1_0 := v_1.Args[0]
7378                 if v_1_0.Op != OpPPC64MOVHreg {
7379                         break
7380                 }
7381                 x := v_1_0.Args[0]
7382                 mem := v_2
7383                 if !(c <= 8) {
7384                         break
7385                 }
7386                 v.reset(OpPPC64MOVBstore)
7387                 v.AuxInt = int32ToAuxInt(off)
7388                 v.Aux = symToAux(sym)
7389                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7390                 v0.AuxInt = int64ToAuxInt(c)
7391                 v0.AddArg(x)
7392                 v.AddArg3(ptr, v0, mem)
7393                 return true
7394         }
7395         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVHZreg x) [c]) mem)
7396         // cond: c <= 8
7397         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7398         for {
7399                 off := auxIntToInt32(v.AuxInt)
7400                 sym := auxToSym(v.Aux)
7401                 ptr := v_0
7402                 if v_1.Op != OpPPC64SRWconst {
7403                         break
7404                 }
7405                 c := auxIntToInt64(v_1.AuxInt)
7406                 v_1_0 := v_1.Args[0]
7407                 if v_1_0.Op != OpPPC64MOVHZreg {
7408                         break
7409                 }
7410                 x := v_1_0.Args[0]
7411                 mem := v_2
7412                 if !(c <= 8) {
7413                         break
7414                 }
7415                 v.reset(OpPPC64MOVBstore)
7416                 v.AuxInt = int32ToAuxInt(off)
7417                 v.Aux = symToAux(sym)
7418                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7419                 v0.AuxInt = int64ToAuxInt(c)
7420                 v0.AddArg(x)
7421                 v.AddArg3(ptr, v0, mem)
7422                 return true
7423         }
7424         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVWreg x) [c]) mem)
7425         // cond: c <= 24
7426         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7427         for {
7428                 off := auxIntToInt32(v.AuxInt)
7429                 sym := auxToSym(v.Aux)
7430                 ptr := v_0
7431                 if v_1.Op != OpPPC64SRWconst {
7432                         break
7433                 }
7434                 c := auxIntToInt64(v_1.AuxInt)
7435                 v_1_0 := v_1.Args[0]
7436                 if v_1_0.Op != OpPPC64MOVWreg {
7437                         break
7438                 }
7439                 x := v_1_0.Args[0]
7440                 mem := v_2
7441                 if !(c <= 24) {
7442                         break
7443                 }
7444                 v.reset(OpPPC64MOVBstore)
7445                 v.AuxInt = int32ToAuxInt(off)
7446                 v.Aux = symToAux(sym)
7447                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7448                 v0.AuxInt = int64ToAuxInt(c)
7449                 v0.AddArg(x)
7450                 v.AddArg3(ptr, v0, mem)
7451                 return true
7452         }
7453         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVWZreg x) [c]) mem)
7454         // cond: c <= 24
7455         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7456         for {
7457                 off := auxIntToInt32(v.AuxInt)
7458                 sym := auxToSym(v.Aux)
7459                 ptr := v_0
7460                 if v_1.Op != OpPPC64SRWconst {
7461                         break
7462                 }
7463                 c := auxIntToInt64(v_1.AuxInt)
7464                 v_1_0 := v_1.Args[0]
7465                 if v_1_0.Op != OpPPC64MOVWZreg {
7466                         break
7467                 }
7468                 x := v_1_0.Args[0]
7469                 mem := v_2
7470                 if !(c <= 24) {
7471                         break
7472                 }
7473                 v.reset(OpPPC64MOVBstore)
7474                 v.AuxInt = int32ToAuxInt(off)
7475                 v.Aux = symToAux(sym)
7476                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7477                 v0.AuxInt = int64ToAuxInt(c)
7478                 v0.AddArg(x)
7479                 v.AddArg3(ptr, v0, mem)
7480                 return true
7481         }
7482         return false
7483 }
7484 func rewriteValuePPC64_OpPPC64MOVBstoreidx(v *Value) bool {
7485         v_3 := v.Args[3]
7486         v_2 := v.Args[2]
7487         v_1 := v.Args[1]
7488         v_0 := v.Args[0]
7489         b := v.Block
7490         typ := &b.Func.Config.Types
7491         // match: (MOVBstoreidx ptr (MOVDconst [c]) val mem)
7492         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
7493         // result: (MOVBstore [int32(c)] ptr val mem)
7494         for {
7495                 ptr := v_0
7496                 if v_1.Op != OpPPC64MOVDconst {
7497                         break
7498                 }
7499                 c := auxIntToInt64(v_1.AuxInt)
7500                 val := v_2
7501                 mem := v_3
7502                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7503                         break
7504                 }
7505                 v.reset(OpPPC64MOVBstore)
7506                 v.AuxInt = int32ToAuxInt(int32(c))
7507                 v.AddArg3(ptr, val, mem)
7508                 return true
7509         }
7510         // match: (MOVBstoreidx (MOVDconst [c]) ptr val mem)
7511         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
7512         // result: (MOVBstore [int32(c)] ptr val mem)
7513         for {
7514                 if v_0.Op != OpPPC64MOVDconst {
7515                         break
7516                 }
7517                 c := auxIntToInt64(v_0.AuxInt)
7518                 ptr := v_1
7519                 val := v_2
7520                 mem := v_3
7521                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7522                         break
7523                 }
7524                 v.reset(OpPPC64MOVBstore)
7525                 v.AuxInt = int32ToAuxInt(int32(c))
7526                 v.AddArg3(ptr, val, mem)
7527                 return true
7528         }
7529         // match: (MOVBstoreidx ptr idx (MOVBreg x) mem)
7530         // result: (MOVBstoreidx ptr idx x mem)
7531         for {
7532                 ptr := v_0
7533                 idx := v_1
7534                 if v_2.Op != OpPPC64MOVBreg {
7535                         break
7536                 }
7537                 x := v_2.Args[0]
7538                 mem := v_3
7539                 v.reset(OpPPC64MOVBstoreidx)
7540                 v.AddArg4(ptr, idx, x, mem)
7541                 return true
7542         }
7543         // match: (MOVBstoreidx ptr idx (MOVBZreg x) mem)
7544         // result: (MOVBstoreidx ptr idx x mem)
7545         for {
7546                 ptr := v_0
7547                 idx := v_1
7548                 if v_2.Op != OpPPC64MOVBZreg {
7549                         break
7550                 }
7551                 x := v_2.Args[0]
7552                 mem := v_3
7553                 v.reset(OpPPC64MOVBstoreidx)
7554                 v.AddArg4(ptr, idx, x, mem)
7555                 return true
7556         }
7557         // match: (MOVBstoreidx ptr idx (MOVHreg x) mem)
7558         // result: (MOVBstoreidx ptr idx x mem)
7559         for {
7560                 ptr := v_0
7561                 idx := v_1
7562                 if v_2.Op != OpPPC64MOVHreg {
7563                         break
7564                 }
7565                 x := v_2.Args[0]
7566                 mem := v_3
7567                 v.reset(OpPPC64MOVBstoreidx)
7568                 v.AddArg4(ptr, idx, x, mem)
7569                 return true
7570         }
7571         // match: (MOVBstoreidx ptr idx (MOVHZreg x) mem)
7572         // result: (MOVBstoreidx ptr idx x mem)
7573         for {
7574                 ptr := v_0
7575                 idx := v_1
7576                 if v_2.Op != OpPPC64MOVHZreg {
7577                         break
7578                 }
7579                 x := v_2.Args[0]
7580                 mem := v_3
7581                 v.reset(OpPPC64MOVBstoreidx)
7582                 v.AddArg4(ptr, idx, x, mem)
7583                 return true
7584         }
7585         // match: (MOVBstoreidx ptr idx (MOVWreg x) mem)
7586         // result: (MOVBstoreidx ptr idx x mem)
7587         for {
7588                 ptr := v_0
7589                 idx := v_1
7590                 if v_2.Op != OpPPC64MOVWreg {
7591                         break
7592                 }
7593                 x := v_2.Args[0]
7594                 mem := v_3
7595                 v.reset(OpPPC64MOVBstoreidx)
7596                 v.AddArg4(ptr, idx, x, mem)
7597                 return true
7598         }
7599         // match: (MOVBstoreidx ptr idx (MOVWZreg x) mem)
7600         // result: (MOVBstoreidx ptr idx x mem)
7601         for {
7602                 ptr := v_0
7603                 idx := v_1
7604                 if v_2.Op != OpPPC64MOVWZreg {
7605                         break
7606                 }
7607                 x := v_2.Args[0]
7608                 mem := v_3
7609                 v.reset(OpPPC64MOVBstoreidx)
7610                 v.AddArg4(ptr, idx, x, mem)
7611                 return true
7612         }
7613         // match: (MOVBstoreidx ptr idx (SRWconst (MOVHreg x) [c]) mem)
7614         // cond: c <= 8
7615         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7616         for {
7617                 ptr := v_0
7618                 idx := v_1
7619                 if v_2.Op != OpPPC64SRWconst {
7620                         break
7621                 }
7622                 c := auxIntToInt64(v_2.AuxInt)
7623                 v_2_0 := v_2.Args[0]
7624                 if v_2_0.Op != OpPPC64MOVHreg {
7625                         break
7626                 }
7627                 x := v_2_0.Args[0]
7628                 mem := v_3
7629                 if !(c <= 8) {
7630                         break
7631                 }
7632                 v.reset(OpPPC64MOVBstoreidx)
7633                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7634                 v0.AuxInt = int64ToAuxInt(c)
7635                 v0.AddArg(x)
7636                 v.AddArg4(ptr, idx, v0, mem)
7637                 return true
7638         }
7639         // match: (MOVBstoreidx ptr idx (SRWconst (MOVHZreg x) [c]) mem)
7640         // cond: c <= 8
7641         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7642         for {
7643                 ptr := v_0
7644                 idx := v_1
7645                 if v_2.Op != OpPPC64SRWconst {
7646                         break
7647                 }
7648                 c := auxIntToInt64(v_2.AuxInt)
7649                 v_2_0 := v_2.Args[0]
7650                 if v_2_0.Op != OpPPC64MOVHZreg {
7651                         break
7652                 }
7653                 x := v_2_0.Args[0]
7654                 mem := v_3
7655                 if !(c <= 8) {
7656                         break
7657                 }
7658                 v.reset(OpPPC64MOVBstoreidx)
7659                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7660                 v0.AuxInt = int64ToAuxInt(c)
7661                 v0.AddArg(x)
7662                 v.AddArg4(ptr, idx, v0, mem)
7663                 return true
7664         }
7665         // match: (MOVBstoreidx ptr idx (SRWconst (MOVWreg x) [c]) mem)
7666         // cond: c <= 24
7667         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7668         for {
7669                 ptr := v_0
7670                 idx := v_1
7671                 if v_2.Op != OpPPC64SRWconst {
7672                         break
7673                 }
7674                 c := auxIntToInt64(v_2.AuxInt)
7675                 v_2_0 := v_2.Args[0]
7676                 if v_2_0.Op != OpPPC64MOVWreg {
7677                         break
7678                 }
7679                 x := v_2_0.Args[0]
7680                 mem := v_3
7681                 if !(c <= 24) {
7682                         break
7683                 }
7684                 v.reset(OpPPC64MOVBstoreidx)
7685                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7686                 v0.AuxInt = int64ToAuxInt(c)
7687                 v0.AddArg(x)
7688                 v.AddArg4(ptr, idx, v0, mem)
7689                 return true
7690         }
7691         // match: (MOVBstoreidx ptr idx (SRWconst (MOVWZreg x) [c]) mem)
7692         // cond: c <= 24
7693         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7694         for {
7695                 ptr := v_0
7696                 idx := v_1
7697                 if v_2.Op != OpPPC64SRWconst {
7698                         break
7699                 }
7700                 c := auxIntToInt64(v_2.AuxInt)
7701                 v_2_0 := v_2.Args[0]
7702                 if v_2_0.Op != OpPPC64MOVWZreg {
7703                         break
7704                 }
7705                 x := v_2_0.Args[0]
7706                 mem := v_3
7707                 if !(c <= 24) {
7708                         break
7709                 }
7710                 v.reset(OpPPC64MOVBstoreidx)
7711                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7712                 v0.AuxInt = int64ToAuxInt(c)
7713                 v0.AddArg(x)
7714                 v.AddArg4(ptr, idx, v0, mem)
7715                 return true
7716         }
7717         return false
7718 }
7719 func rewriteValuePPC64_OpPPC64MOVBstorezero(v *Value) bool {
7720         v_1 := v.Args[1]
7721         v_0 := v.Args[0]
7722         // match: (MOVBstorezero [off1] {sym} (ADDconst [off2] x) mem)
7723         // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2)))
7724         // result: (MOVBstorezero [off1+int32(off2)] {sym} x mem)
7725         for {
7726                 off1 := auxIntToInt32(v.AuxInt)
7727                 sym := auxToSym(v.Aux)
7728                 if v_0.Op != OpPPC64ADDconst {
7729                         break
7730                 }
7731                 off2 := auxIntToInt64(v_0.AuxInt)
7732                 x := v_0.Args[0]
7733                 mem := v_1
7734                 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
7735                         break
7736                 }
7737                 v.reset(OpPPC64MOVBstorezero)
7738                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7739                 v.Aux = symToAux(sym)
7740                 v.AddArg2(x, mem)
7741                 return true
7742         }
7743         // match: (MOVBstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
7744         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
7745         // result: (MOVBstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
7746         for {
7747                 off1 := auxIntToInt32(v.AuxInt)
7748                 sym1 := auxToSym(v.Aux)
7749                 p := v_0
7750                 if p.Op != OpPPC64MOVDaddr {
7751                         break
7752                 }
7753                 off2 := auxIntToInt32(p.AuxInt)
7754                 sym2 := auxToSym(p.Aux)
7755                 x := p.Args[0]
7756                 mem := v_1
7757                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7758                         break
7759                 }
7760                 v.reset(OpPPC64MOVBstorezero)
7761                 v.AuxInt = int32ToAuxInt(off1 + off2)
7762                 v.Aux = symToAux(mergeSym(sym1, sym2))
7763                 v.AddArg2(x, mem)
7764                 return true
7765         }
7766         return false
7767 }
7768 func rewriteValuePPC64_OpPPC64MOVDload(v *Value) bool {
7769         v_1 := v.Args[1]
7770         v_0 := v.Args[0]
7771         // match: (MOVDload [off] {sym} ptr (FMOVDstore [off] {sym} ptr x _))
7772         // result: (MFVSRD x)
7773         for {
7774                 off := auxIntToInt32(v.AuxInt)
7775                 sym := auxToSym(v.Aux)
7776                 ptr := v_0
7777                 if v_1.Op != OpPPC64FMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
7778                         break
7779                 }
7780                 x := v_1.Args[1]
7781                 if ptr != v_1.Args[0] {
7782                         break
7783                 }
7784                 v.reset(OpPPC64MFVSRD)
7785                 v.AddArg(x)
7786                 return true
7787         }
7788         // match: (MOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
7789         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
7790         // result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
7791         for {
7792                 off1 := auxIntToInt32(v.AuxInt)
7793                 sym1 := auxToSym(v.Aux)
7794                 p := v_0
7795                 if p.Op != OpPPC64MOVDaddr {
7796                         break
7797                 }
7798                 off2 := auxIntToInt32(p.AuxInt)
7799                 sym2 := auxToSym(p.Aux)
7800                 ptr := p.Args[0]
7801                 mem := v_1
7802                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7803                         break
7804                 }
7805                 v.reset(OpPPC64MOVDload)
7806                 v.AuxInt = int32ToAuxInt(off1 + off2)
7807                 v.Aux = symToAux(mergeSym(sym1, sym2))
7808                 v.AddArg2(ptr, mem)
7809                 return true
7810         }
7811         // match: (MOVDload [off1] {sym} (ADDconst [off2] x) mem)
7812         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
7813         // result: (MOVDload [off1+int32(off2)] {sym} x mem)
7814         for {
7815                 off1 := auxIntToInt32(v.AuxInt)
7816                 sym := auxToSym(v.Aux)
7817                 if v_0.Op != OpPPC64ADDconst {
7818                         break
7819                 }
7820                 off2 := auxIntToInt64(v_0.AuxInt)
7821                 x := v_0.Args[0]
7822                 mem := v_1
7823                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
7824                         break
7825                 }
7826                 v.reset(OpPPC64MOVDload)
7827                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7828                 v.Aux = symToAux(sym)
7829                 v.AddArg2(x, mem)
7830                 return true
7831         }
7832         // match: (MOVDload [0] {sym} p:(ADD ptr idx) mem)
7833         // cond: sym == nil && p.Uses == 1
7834         // result: (MOVDloadidx ptr idx mem)
7835         for {
7836                 if auxIntToInt32(v.AuxInt) != 0 {
7837                         break
7838                 }
7839                 sym := auxToSym(v.Aux)
7840                 p := v_0
7841                 if p.Op != OpPPC64ADD {
7842                         break
7843                 }
7844                 idx := p.Args[1]
7845                 ptr := p.Args[0]
7846                 mem := v_1
7847                 if !(sym == nil && p.Uses == 1) {
7848                         break
7849                 }
7850                 v.reset(OpPPC64MOVDloadidx)
7851                 v.AddArg3(ptr, idx, mem)
7852                 return true
7853         }
7854         return false
7855 }
7856 func rewriteValuePPC64_OpPPC64MOVDloadidx(v *Value) bool {
7857         v_2 := v.Args[2]
7858         v_1 := v.Args[1]
7859         v_0 := v.Args[0]
7860         // match: (MOVDloadidx ptr (MOVDconst [c]) mem)
7861         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
7862         // result: (MOVDload [int32(c)] ptr mem)
7863         for {
7864                 ptr := v_0
7865                 if v_1.Op != OpPPC64MOVDconst {
7866                         break
7867                 }
7868                 c := auxIntToInt64(v_1.AuxInt)
7869                 mem := v_2
7870                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7871                         break
7872                 }
7873                 v.reset(OpPPC64MOVDload)
7874                 v.AuxInt = int32ToAuxInt(int32(c))
7875                 v.AddArg2(ptr, mem)
7876                 return true
7877         }
7878         // match: (MOVDloadidx (MOVDconst [c]) ptr mem)
7879         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
7880         // result: (MOVDload [int32(c)] ptr mem)
7881         for {
7882                 if v_0.Op != OpPPC64MOVDconst {
7883                         break
7884                 }
7885                 c := auxIntToInt64(v_0.AuxInt)
7886                 ptr := v_1
7887                 mem := v_2
7888                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7889                         break
7890                 }
7891                 v.reset(OpPPC64MOVDload)
7892                 v.AuxInt = int32ToAuxInt(int32(c))
7893                 v.AddArg2(ptr, mem)
7894                 return true
7895         }
7896         return false
7897 }
7898 func rewriteValuePPC64_OpPPC64MOVDstore(v *Value) bool {
7899         v_2 := v.Args[2]
7900         v_1 := v.Args[1]
7901         v_0 := v.Args[0]
7902         b := v.Block
7903         // match: (MOVDstore [off] {sym} ptr (MFVSRD x) mem)
7904         // result: (FMOVDstore [off] {sym} ptr x mem)
7905         for {
7906                 off := auxIntToInt32(v.AuxInt)
7907                 sym := auxToSym(v.Aux)
7908                 ptr := v_0
7909                 if v_1.Op != OpPPC64MFVSRD {
7910                         break
7911                 }
7912                 x := v_1.Args[0]
7913                 mem := v_2
7914                 v.reset(OpPPC64FMOVDstore)
7915                 v.AuxInt = int32ToAuxInt(off)
7916                 v.Aux = symToAux(sym)
7917                 v.AddArg3(ptr, x, mem)
7918                 return true
7919         }
7920         // match: (MOVDstore [off1] {sym} (ADDconst [off2] x) val mem)
7921         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
7922         // result: (MOVDstore [off1+int32(off2)] {sym} x val mem)
7923         for {
7924                 off1 := auxIntToInt32(v.AuxInt)
7925                 sym := auxToSym(v.Aux)
7926                 if v_0.Op != OpPPC64ADDconst {
7927                         break
7928                 }
7929                 off2 := auxIntToInt64(v_0.AuxInt)
7930                 x := v_0.Args[0]
7931                 val := v_1
7932                 mem := v_2
7933                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
7934                         break
7935                 }
7936                 v.reset(OpPPC64MOVDstore)
7937                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7938                 v.Aux = symToAux(sym)
7939                 v.AddArg3(x, val, mem)
7940                 return true
7941         }
7942         // match: (MOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
7943         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
7944         // result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
7945         for {
7946                 off1 := auxIntToInt32(v.AuxInt)
7947                 sym1 := auxToSym(v.Aux)
7948                 p := v_0
7949                 if p.Op != OpPPC64MOVDaddr {
7950                         break
7951                 }
7952                 off2 := auxIntToInt32(p.AuxInt)
7953                 sym2 := auxToSym(p.Aux)
7954                 ptr := p.Args[0]
7955                 val := v_1
7956                 mem := v_2
7957                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7958                         break
7959                 }
7960                 v.reset(OpPPC64MOVDstore)
7961                 v.AuxInt = int32ToAuxInt(off1 + off2)
7962                 v.Aux = symToAux(mergeSym(sym1, sym2))
7963                 v.AddArg3(ptr, val, mem)
7964                 return true
7965         }
7966         // match: (MOVDstore [off] {sym} ptr (MOVDconst [0]) mem)
7967         // result: (MOVDstorezero [off] {sym} ptr mem)
7968         for {
7969                 off := auxIntToInt32(v.AuxInt)
7970                 sym := auxToSym(v.Aux)
7971                 ptr := v_0
7972                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
7973                         break
7974                 }
7975                 mem := v_2
7976                 v.reset(OpPPC64MOVDstorezero)
7977                 v.AuxInt = int32ToAuxInt(off)
7978                 v.Aux = symToAux(sym)
7979                 v.AddArg2(ptr, mem)
7980                 return true
7981         }
7982         // match: (MOVDstore [0] {sym} p:(ADD ptr idx) val mem)
7983         // cond: sym == nil && p.Uses == 1
7984         // result: (MOVDstoreidx ptr idx val mem)
7985         for {
7986                 if auxIntToInt32(v.AuxInt) != 0 {
7987                         break
7988                 }
7989                 sym := auxToSym(v.Aux)
7990                 p := v_0
7991                 if p.Op != OpPPC64ADD {
7992                         break
7993                 }
7994                 idx := p.Args[1]
7995                 ptr := p.Args[0]
7996                 val := v_1
7997                 mem := v_2
7998                 if !(sym == nil && p.Uses == 1) {
7999                         break
8000                 }
8001                 v.reset(OpPPC64MOVDstoreidx)
8002                 v.AddArg4(ptr, idx, val, mem)
8003                 return true
8004         }
8005         // match: (MOVDstore [off] {sym} ptr r:(BRD val) mem)
8006         // cond: r.Uses == 1
8007         // result: (MOVDBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
8008         for {
8009                 off := auxIntToInt32(v.AuxInt)
8010                 sym := auxToSym(v.Aux)
8011                 ptr := v_0
8012                 r := v_1
8013                 if r.Op != OpPPC64BRD {
8014                         break
8015                 }
8016                 val := r.Args[0]
8017                 mem := v_2
8018                 if !(r.Uses == 1) {
8019                         break
8020                 }
8021                 v.reset(OpPPC64MOVDBRstore)
8022                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
8023                 v0.AuxInt = int32ToAuxInt(off)
8024                 v0.Aux = symToAux(sym)
8025                 v0.AddArg(ptr)
8026                 v.AddArg3(v0, val, mem)
8027                 return true
8028         }
8029         // match: (MOVDstore [off] {sym} ptr (Bswap64 val) mem)
8030         // result: (MOVDBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
8031         for {
8032                 off := auxIntToInt32(v.AuxInt)
8033                 sym := auxToSym(v.Aux)
8034                 ptr := v_0
8035                 if v_1.Op != OpBswap64 {
8036                         break
8037                 }
8038                 val := v_1.Args[0]
8039                 mem := v_2
8040                 v.reset(OpPPC64MOVDBRstore)
8041                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
8042                 v0.AuxInt = int32ToAuxInt(off)
8043                 v0.Aux = symToAux(sym)
8044                 v0.AddArg(ptr)
8045                 v.AddArg3(v0, val, mem)
8046                 return true
8047         }
8048         return false
8049 }
8050 func rewriteValuePPC64_OpPPC64MOVDstoreidx(v *Value) bool {
8051         v_3 := v.Args[3]
8052         v_2 := v.Args[2]
8053         v_1 := v.Args[1]
8054         v_0 := v.Args[0]
8055         // match: (MOVDstoreidx ptr (MOVDconst [c]) val mem)
8056         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8057         // result: (MOVDstore [int32(c)] ptr val mem)
8058         for {
8059                 ptr := v_0
8060                 if v_1.Op != OpPPC64MOVDconst {
8061                         break
8062                 }
8063                 c := auxIntToInt64(v_1.AuxInt)
8064                 val := v_2
8065                 mem := v_3
8066                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8067                         break
8068                 }
8069                 v.reset(OpPPC64MOVDstore)
8070                 v.AuxInt = int32ToAuxInt(int32(c))
8071                 v.AddArg3(ptr, val, mem)
8072                 return true
8073         }
8074         // match: (MOVDstoreidx (MOVDconst [c]) ptr val mem)
8075         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8076         // result: (MOVDstore [int32(c)] ptr val mem)
8077         for {
8078                 if v_0.Op != OpPPC64MOVDconst {
8079                         break
8080                 }
8081                 c := auxIntToInt64(v_0.AuxInt)
8082                 ptr := v_1
8083                 val := v_2
8084                 mem := v_3
8085                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8086                         break
8087                 }
8088                 v.reset(OpPPC64MOVDstore)
8089                 v.AuxInt = int32ToAuxInt(int32(c))
8090                 v.AddArg3(ptr, val, mem)
8091                 return true
8092         }
8093         // match: (MOVDstoreidx ptr idx r:(BRD val) mem)
8094         // cond: r.Uses == 1
8095         // result: (MOVDBRstoreidx ptr idx val mem)
8096         for {
8097                 ptr := v_0
8098                 idx := v_1
8099                 r := v_2
8100                 if r.Op != OpPPC64BRD {
8101                         break
8102                 }
8103                 val := r.Args[0]
8104                 mem := v_3
8105                 if !(r.Uses == 1) {
8106                         break
8107                 }
8108                 v.reset(OpPPC64MOVDBRstoreidx)
8109                 v.AddArg4(ptr, idx, val, mem)
8110                 return true
8111         }
8112         // match: (MOVDstoreidx ptr idx (Bswap64 val) mem)
8113         // result: (MOVDBRstoreidx ptr idx val mem)
8114         for {
8115                 ptr := v_0
8116                 idx := v_1
8117                 if v_2.Op != OpBswap64 {
8118                         break
8119                 }
8120                 val := v_2.Args[0]
8121                 mem := v_3
8122                 v.reset(OpPPC64MOVDBRstoreidx)
8123                 v.AddArg4(ptr, idx, val, mem)
8124                 return true
8125         }
8126         return false
8127 }
8128 func rewriteValuePPC64_OpPPC64MOVDstorezero(v *Value) bool {
8129         v_1 := v.Args[1]
8130         v_0 := v.Args[0]
8131         // match: (MOVDstorezero [off1] {sym} (ADDconst [off2] x) mem)
8132         // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2)))
8133         // result: (MOVDstorezero [off1+int32(off2)] {sym} x mem)
8134         for {
8135                 off1 := auxIntToInt32(v.AuxInt)
8136                 sym := auxToSym(v.Aux)
8137                 if v_0.Op != OpPPC64ADDconst {
8138                         break
8139                 }
8140                 off2 := auxIntToInt64(v_0.AuxInt)
8141                 x := v_0.Args[0]
8142                 mem := v_1
8143                 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
8144                         break
8145                 }
8146                 v.reset(OpPPC64MOVDstorezero)
8147                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8148                 v.Aux = symToAux(sym)
8149                 v.AddArg2(x, mem)
8150                 return true
8151         }
8152         // match: (MOVDstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
8153         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
8154         // result: (MOVDstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
8155         for {
8156                 off1 := auxIntToInt32(v.AuxInt)
8157                 sym1 := auxToSym(v.Aux)
8158                 p := v_0
8159                 if p.Op != OpPPC64MOVDaddr {
8160                         break
8161                 }
8162                 off2 := auxIntToInt32(p.AuxInt)
8163                 sym2 := auxToSym(p.Aux)
8164                 x := p.Args[0]
8165                 mem := v_1
8166                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8167                         break
8168                 }
8169                 v.reset(OpPPC64MOVDstorezero)
8170                 v.AuxInt = int32ToAuxInt(off1 + off2)
8171                 v.Aux = symToAux(mergeSym(sym1, sym2))
8172                 v.AddArg2(x, mem)
8173                 return true
8174         }
8175         return false
8176 }
8177 func rewriteValuePPC64_OpPPC64MOVHBRstore(v *Value) bool {
8178         v_2 := v.Args[2]
8179         v_1 := v.Args[1]
8180         v_0 := v.Args[0]
8181         // match: (MOVHBRstore ptr (MOVHreg x) mem)
8182         // result: (MOVHBRstore ptr x mem)
8183         for {
8184                 ptr := v_0
8185                 if v_1.Op != OpPPC64MOVHreg {
8186                         break
8187                 }
8188                 x := v_1.Args[0]
8189                 mem := v_2
8190                 v.reset(OpPPC64MOVHBRstore)
8191                 v.AddArg3(ptr, x, mem)
8192                 return true
8193         }
8194         // match: (MOVHBRstore ptr (MOVHZreg x) mem)
8195         // result: (MOVHBRstore ptr x mem)
8196         for {
8197                 ptr := v_0
8198                 if v_1.Op != OpPPC64MOVHZreg {
8199                         break
8200                 }
8201                 x := v_1.Args[0]
8202                 mem := v_2
8203                 v.reset(OpPPC64MOVHBRstore)
8204                 v.AddArg3(ptr, x, mem)
8205                 return true
8206         }
8207         // match: (MOVHBRstore ptr (MOVWreg x) mem)
8208         // result: (MOVHBRstore ptr x mem)
8209         for {
8210                 ptr := v_0
8211                 if v_1.Op != OpPPC64MOVWreg {
8212                         break
8213                 }
8214                 x := v_1.Args[0]
8215                 mem := v_2
8216                 v.reset(OpPPC64MOVHBRstore)
8217                 v.AddArg3(ptr, x, mem)
8218                 return true
8219         }
8220         // match: (MOVHBRstore ptr (MOVWZreg x) mem)
8221         // result: (MOVHBRstore ptr x mem)
8222         for {
8223                 ptr := v_0
8224                 if v_1.Op != OpPPC64MOVWZreg {
8225                         break
8226                 }
8227                 x := v_1.Args[0]
8228                 mem := v_2
8229                 v.reset(OpPPC64MOVHBRstore)
8230                 v.AddArg3(ptr, x, mem)
8231                 return true
8232         }
8233         return false
8234 }
8235 func rewriteValuePPC64_OpPPC64MOVHZload(v *Value) bool {
8236         v_1 := v.Args[1]
8237         v_0 := v.Args[0]
8238         // match: (MOVHZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
8239         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
8240         // result: (MOVHZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
8241         for {
8242                 off1 := auxIntToInt32(v.AuxInt)
8243                 sym1 := auxToSym(v.Aux)
8244                 p := v_0
8245                 if p.Op != OpPPC64MOVDaddr {
8246                         break
8247                 }
8248                 off2 := auxIntToInt32(p.AuxInt)
8249                 sym2 := auxToSym(p.Aux)
8250                 ptr := p.Args[0]
8251                 mem := v_1
8252                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8253                         break
8254                 }
8255                 v.reset(OpPPC64MOVHZload)
8256                 v.AuxInt = int32ToAuxInt(off1 + off2)
8257                 v.Aux = symToAux(mergeSym(sym1, sym2))
8258                 v.AddArg2(ptr, mem)
8259                 return true
8260         }
8261         // match: (MOVHZload [off1] {sym} (ADDconst [off2] x) mem)
8262         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
8263         // result: (MOVHZload [off1+int32(off2)] {sym} x mem)
8264         for {
8265                 off1 := auxIntToInt32(v.AuxInt)
8266                 sym := auxToSym(v.Aux)
8267                 if v_0.Op != OpPPC64ADDconst {
8268                         break
8269                 }
8270                 off2 := auxIntToInt64(v_0.AuxInt)
8271                 x := v_0.Args[0]
8272                 mem := v_1
8273                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
8274                         break
8275                 }
8276                 v.reset(OpPPC64MOVHZload)
8277                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8278                 v.Aux = symToAux(sym)
8279                 v.AddArg2(x, mem)
8280                 return true
8281         }
8282         // match: (MOVHZload [0] {sym} p:(ADD ptr idx) mem)
8283         // cond: sym == nil && p.Uses == 1
8284         // result: (MOVHZloadidx ptr idx mem)
8285         for {
8286                 if auxIntToInt32(v.AuxInt) != 0 {
8287                         break
8288                 }
8289                 sym := auxToSym(v.Aux)
8290                 p := v_0
8291                 if p.Op != OpPPC64ADD {
8292                         break
8293                 }
8294                 idx := p.Args[1]
8295                 ptr := p.Args[0]
8296                 mem := v_1
8297                 if !(sym == nil && p.Uses == 1) {
8298                         break
8299                 }
8300                 v.reset(OpPPC64MOVHZloadidx)
8301                 v.AddArg3(ptr, idx, mem)
8302                 return true
8303         }
8304         return false
8305 }
8306 func rewriteValuePPC64_OpPPC64MOVHZloadidx(v *Value) bool {
8307         v_2 := v.Args[2]
8308         v_1 := v.Args[1]
8309         v_0 := v.Args[0]
8310         // match: (MOVHZloadidx ptr (MOVDconst [c]) mem)
8311         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8312         // result: (MOVHZload [int32(c)] ptr mem)
8313         for {
8314                 ptr := v_0
8315                 if v_1.Op != OpPPC64MOVDconst {
8316                         break
8317                 }
8318                 c := auxIntToInt64(v_1.AuxInt)
8319                 mem := v_2
8320                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8321                         break
8322                 }
8323                 v.reset(OpPPC64MOVHZload)
8324                 v.AuxInt = int32ToAuxInt(int32(c))
8325                 v.AddArg2(ptr, mem)
8326                 return true
8327         }
8328         // match: (MOVHZloadidx (MOVDconst [c]) ptr mem)
8329         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8330         // result: (MOVHZload [int32(c)] ptr mem)
8331         for {
8332                 if v_0.Op != OpPPC64MOVDconst {
8333                         break
8334                 }
8335                 c := auxIntToInt64(v_0.AuxInt)
8336                 ptr := v_1
8337                 mem := v_2
8338                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8339                         break
8340                 }
8341                 v.reset(OpPPC64MOVHZload)
8342                 v.AuxInt = int32ToAuxInt(int32(c))
8343                 v.AddArg2(ptr, mem)
8344                 return true
8345         }
8346         return false
8347 }
8348 func rewriteValuePPC64_OpPPC64MOVHZreg(v *Value) bool {
8349         v_0 := v.Args[0]
8350         b := v.Block
8351         typ := &b.Func.Config.Types
8352         // match: (MOVHZreg y:(Select0 (ANDCCconst [c] _)))
8353         // cond: uint64(c) <= 0xFFFF
8354         // result: y
8355         for {
8356                 y := v_0
8357                 if y.Op != OpSelect0 {
8358                         break
8359                 }
8360                 y_0 := y.Args[0]
8361                 if y_0.Op != OpPPC64ANDCCconst {
8362                         break
8363                 }
8364                 c := auxIntToInt64(y_0.AuxInt)
8365                 if !(uint64(c) <= 0xFFFF) {
8366                         break
8367                 }
8368                 v.copyOf(y)
8369                 return true
8370         }
8371         // match: (MOVHZreg (SRWconst [c] (MOVBZreg x)))
8372         // result: (SRWconst [c] (MOVBZreg x))
8373         for {
8374                 if v_0.Op != OpPPC64SRWconst {
8375                         break
8376                 }
8377                 c := auxIntToInt64(v_0.AuxInt)
8378                 v_0_0 := v_0.Args[0]
8379                 if v_0_0.Op != OpPPC64MOVBZreg {
8380                         break
8381                 }
8382                 x := v_0_0.Args[0]
8383                 v.reset(OpPPC64SRWconst)
8384                 v.AuxInt = int64ToAuxInt(c)
8385                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
8386                 v0.AddArg(x)
8387                 v.AddArg(v0)
8388                 return true
8389         }
8390         // match: (MOVHZreg (SRWconst [c] (MOVHZreg x)))
8391         // result: (SRWconst [c] (MOVHZreg x))
8392         for {
8393                 if v_0.Op != OpPPC64SRWconst {
8394                         break
8395                 }
8396                 c := auxIntToInt64(v_0.AuxInt)
8397                 v_0_0 := v_0.Args[0]
8398                 if v_0_0.Op != OpPPC64MOVHZreg {
8399                         break
8400                 }
8401                 x := v_0_0.Args[0]
8402                 v.reset(OpPPC64SRWconst)
8403                 v.AuxInt = int64ToAuxInt(c)
8404                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
8405                 v0.AddArg(x)
8406                 v.AddArg(v0)
8407                 return true
8408         }
8409         // match: (MOVHZreg (SRWconst [c] x))
8410         // cond: sizeof(x.Type) <= 16
8411         // result: (SRWconst [c] x)
8412         for {
8413                 if v_0.Op != OpPPC64SRWconst {
8414                         break
8415                 }
8416                 c := auxIntToInt64(v_0.AuxInt)
8417                 x := v_0.Args[0]
8418                 if !(sizeof(x.Type) <= 16) {
8419                         break
8420                 }
8421                 v.reset(OpPPC64SRWconst)
8422                 v.AuxInt = int64ToAuxInt(c)
8423                 v.AddArg(x)
8424                 return true
8425         }
8426         // match: (MOVHZreg (SRDconst [c] x))
8427         // cond: c>=48
8428         // result: (SRDconst [c] x)
8429         for {
8430                 if v_0.Op != OpPPC64SRDconst {
8431                         break
8432                 }
8433                 c := auxIntToInt64(v_0.AuxInt)
8434                 x := v_0.Args[0]
8435                 if !(c >= 48) {
8436                         break
8437                 }
8438                 v.reset(OpPPC64SRDconst)
8439                 v.AuxInt = int64ToAuxInt(c)
8440                 v.AddArg(x)
8441                 return true
8442         }
8443         // match: (MOVHZreg (SRWconst [c] x))
8444         // cond: c>=16
8445         // result: (SRWconst [c] x)
8446         for {
8447                 if v_0.Op != OpPPC64SRWconst {
8448                         break
8449                 }
8450                 c := auxIntToInt64(v_0.AuxInt)
8451                 x := v_0.Args[0]
8452                 if !(c >= 16) {
8453                         break
8454                 }
8455                 v.reset(OpPPC64SRWconst)
8456                 v.AuxInt = int64ToAuxInt(c)
8457                 v.AddArg(x)
8458                 return true
8459         }
8460         // match: (MOVHZreg y:(MOVHZreg _))
8461         // result: y
8462         for {
8463                 y := v_0
8464                 if y.Op != OpPPC64MOVHZreg {
8465                         break
8466                 }
8467                 v.copyOf(y)
8468                 return true
8469         }
8470         // match: (MOVHZreg y:(MOVBZreg _))
8471         // result: y
8472         for {
8473                 y := v_0
8474                 if y.Op != OpPPC64MOVBZreg {
8475                         break
8476                 }
8477                 v.copyOf(y)
8478                 return true
8479         }
8480         // match: (MOVHZreg y:(MOVHBRload _ _))
8481         // result: y
8482         for {
8483                 y := v_0
8484                 if y.Op != OpPPC64MOVHBRload {
8485                         break
8486                 }
8487                 v.copyOf(y)
8488                 return true
8489         }
8490         // match: (MOVHZreg y:(MOVHreg x))
8491         // result: (MOVHZreg x)
8492         for {
8493                 y := v_0
8494                 if y.Op != OpPPC64MOVHreg {
8495                         break
8496                 }
8497                 x := y.Args[0]
8498                 v.reset(OpPPC64MOVHZreg)
8499                 v.AddArg(x)
8500                 return true
8501         }
8502         // match: (MOVHZreg (OR <t> x (MOVWZreg y)))
8503         // result: (MOVHZreg (OR <t> x y))
8504         for {
8505                 if v_0.Op != OpPPC64OR {
8506                         break
8507                 }
8508                 t := v_0.Type
8509                 _ = v_0.Args[1]
8510                 v_0_0 := v_0.Args[0]
8511                 v_0_1 := v_0.Args[1]
8512                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8513                         x := v_0_0
8514                         if v_0_1.Op != OpPPC64MOVWZreg {
8515                                 continue
8516                         }
8517                         y := v_0_1.Args[0]
8518                         v.reset(OpPPC64MOVHZreg)
8519                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
8520                         v0.AddArg2(x, y)
8521                         v.AddArg(v0)
8522                         return true
8523                 }
8524                 break
8525         }
8526         // match: (MOVHZreg (XOR <t> x (MOVWZreg y)))
8527         // result: (MOVHZreg (XOR <t> x y))
8528         for {
8529                 if v_0.Op != OpPPC64XOR {
8530                         break
8531                 }
8532                 t := v_0.Type
8533                 _ = v_0.Args[1]
8534                 v_0_0 := v_0.Args[0]
8535                 v_0_1 := v_0.Args[1]
8536                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8537                         x := v_0_0
8538                         if v_0_1.Op != OpPPC64MOVWZreg {
8539                                 continue
8540                         }
8541                         y := v_0_1.Args[0]
8542                         v.reset(OpPPC64MOVHZreg)
8543                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
8544                         v0.AddArg2(x, y)
8545                         v.AddArg(v0)
8546                         return true
8547                 }
8548                 break
8549         }
8550         // match: (MOVHZreg (AND <t> x (MOVWZreg y)))
8551         // result: (MOVHZreg (AND <t> x y))
8552         for {
8553                 if v_0.Op != OpPPC64AND {
8554                         break
8555                 }
8556                 t := v_0.Type
8557                 _ = v_0.Args[1]
8558                 v_0_0 := v_0.Args[0]
8559                 v_0_1 := v_0.Args[1]
8560                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8561                         x := v_0_0
8562                         if v_0_1.Op != OpPPC64MOVWZreg {
8563                                 continue
8564                         }
8565                         y := v_0_1.Args[0]
8566                         v.reset(OpPPC64MOVHZreg)
8567                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
8568                         v0.AddArg2(x, y)
8569                         v.AddArg(v0)
8570                         return true
8571                 }
8572                 break
8573         }
8574         // match: (MOVHZreg (OR <t> x (MOVHZreg y)))
8575         // result: (MOVHZreg (OR <t> x y))
8576         for {
8577                 if v_0.Op != OpPPC64OR {
8578                         break
8579                 }
8580                 t := v_0.Type
8581                 _ = v_0.Args[1]
8582                 v_0_0 := v_0.Args[0]
8583                 v_0_1 := v_0.Args[1]
8584                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8585                         x := v_0_0
8586                         if v_0_1.Op != OpPPC64MOVHZreg {
8587                                 continue
8588                         }
8589                         y := v_0_1.Args[0]
8590                         v.reset(OpPPC64MOVHZreg)
8591                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
8592                         v0.AddArg2(x, y)
8593                         v.AddArg(v0)
8594                         return true
8595                 }
8596                 break
8597         }
8598         // match: (MOVHZreg (XOR <t> x (MOVHZreg y)))
8599         // result: (MOVHZreg (XOR <t> x y))
8600         for {
8601                 if v_0.Op != OpPPC64XOR {
8602                         break
8603                 }
8604                 t := v_0.Type
8605                 _ = v_0.Args[1]
8606                 v_0_0 := v_0.Args[0]
8607                 v_0_1 := v_0.Args[1]
8608                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8609                         x := v_0_0
8610                         if v_0_1.Op != OpPPC64MOVHZreg {
8611                                 continue
8612                         }
8613                         y := v_0_1.Args[0]
8614                         v.reset(OpPPC64MOVHZreg)
8615                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
8616                         v0.AddArg2(x, y)
8617                         v.AddArg(v0)
8618                         return true
8619                 }
8620                 break
8621         }
8622         // match: (MOVHZreg (AND <t> x (MOVHZreg y)))
8623         // result: (MOVHZreg (AND <t> x y))
8624         for {
8625                 if v_0.Op != OpPPC64AND {
8626                         break
8627                 }
8628                 t := v_0.Type
8629                 _ = v_0.Args[1]
8630                 v_0_0 := v_0.Args[0]
8631                 v_0_1 := v_0.Args[1]
8632                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8633                         x := v_0_0
8634                         if v_0_1.Op != OpPPC64MOVHZreg {
8635                                 continue
8636                         }
8637                         y := v_0_1.Args[0]
8638                         v.reset(OpPPC64MOVHZreg)
8639                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
8640                         v0.AddArg2(x, y)
8641                         v.AddArg(v0)
8642                         return true
8643                 }
8644                 break
8645         }
8646         // match: (MOVHZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x))))
8647         // result: z
8648         for {
8649                 z := v_0
8650                 if z.Op != OpSelect0 {
8651                         break
8652                 }
8653                 z_0 := z.Args[0]
8654                 if z_0.Op != OpPPC64ANDCCconst {
8655                         break
8656                 }
8657                 z_0_0 := z_0.Args[0]
8658                 if z_0_0.Op != OpPPC64MOVBZload {
8659                         break
8660                 }
8661                 v.copyOf(z)
8662                 return true
8663         }
8664         // match: (MOVHZreg z:(AND y (MOVHZload ptr x)))
8665         // result: z
8666         for {
8667                 z := v_0
8668                 if z.Op != OpPPC64AND {
8669                         break
8670                 }
8671                 _ = z.Args[1]
8672                 z_0 := z.Args[0]
8673                 z_1 := z.Args[1]
8674                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
8675                         if z_1.Op != OpPPC64MOVHZload {
8676                                 continue
8677                         }
8678                         v.copyOf(z)
8679                         return true
8680                 }
8681                 break
8682         }
8683         // match: (MOVHZreg z:(Select0 (ANDCCconst [c] (MOVHZload ptr x))))
8684         // result: z
8685         for {
8686                 z := v_0
8687                 if z.Op != OpSelect0 {
8688                         break
8689                 }
8690                 z_0 := z.Args[0]
8691                 if z_0.Op != OpPPC64ANDCCconst {
8692                         break
8693                 }
8694                 z_0_0 := z_0.Args[0]
8695                 if z_0_0.Op != OpPPC64MOVHZload {
8696                         break
8697                 }
8698                 v.copyOf(z)
8699                 return true
8700         }
8701         // match: (MOVHZreg x:(MOVBZload _ _))
8702         // result: x
8703         for {
8704                 x := v_0
8705                 if x.Op != OpPPC64MOVBZload {
8706                         break
8707                 }
8708                 v.copyOf(x)
8709                 return true
8710         }
8711         // match: (MOVHZreg x:(MOVBZloadidx _ _ _))
8712         // result: x
8713         for {
8714                 x := v_0
8715                 if x.Op != OpPPC64MOVBZloadidx {
8716                         break
8717                 }
8718                 v.copyOf(x)
8719                 return true
8720         }
8721         // match: (MOVHZreg x:(MOVHZload _ _))
8722         // result: x
8723         for {
8724                 x := v_0
8725                 if x.Op != OpPPC64MOVHZload {
8726                         break
8727                 }
8728                 v.copyOf(x)
8729                 return true
8730         }
8731         // match: (MOVHZreg x:(MOVHZloadidx _ _ _))
8732         // result: x
8733         for {
8734                 x := v_0
8735                 if x.Op != OpPPC64MOVHZloadidx {
8736                         break
8737                 }
8738                 v.copyOf(x)
8739                 return true
8740         }
8741         // match: (MOVHZreg x:(Arg <t>))
8742         // cond: (is8BitInt(t) || is16BitInt(t)) && !t.IsSigned()
8743         // result: x
8744         for {
8745                 x := v_0
8746                 if x.Op != OpArg {
8747                         break
8748                 }
8749                 t := x.Type
8750                 if !((is8BitInt(t) || is16BitInt(t)) && !t.IsSigned()) {
8751                         break
8752                 }
8753                 v.copyOf(x)
8754                 return true
8755         }
8756         // match: (MOVHZreg (MOVDconst [c]))
8757         // result: (MOVDconst [int64(uint16(c))])
8758         for {
8759                 if v_0.Op != OpPPC64MOVDconst {
8760                         break
8761                 }
8762                 c := auxIntToInt64(v_0.AuxInt)
8763                 v.reset(OpPPC64MOVDconst)
8764                 v.AuxInt = int64ToAuxInt(int64(uint16(c)))
8765                 return true
8766         }
8767         return false
8768 }
8769 func rewriteValuePPC64_OpPPC64MOVHload(v *Value) bool {
8770         v_1 := v.Args[1]
8771         v_0 := v.Args[0]
8772         // match: (MOVHload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
8773         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
8774         // result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
8775         for {
8776                 off1 := auxIntToInt32(v.AuxInt)
8777                 sym1 := auxToSym(v.Aux)
8778                 p := v_0
8779                 if p.Op != OpPPC64MOVDaddr {
8780                         break
8781                 }
8782                 off2 := auxIntToInt32(p.AuxInt)
8783                 sym2 := auxToSym(p.Aux)
8784                 ptr := p.Args[0]
8785                 mem := v_1
8786                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8787                         break
8788                 }
8789                 v.reset(OpPPC64MOVHload)
8790                 v.AuxInt = int32ToAuxInt(off1 + off2)
8791                 v.Aux = symToAux(mergeSym(sym1, sym2))
8792                 v.AddArg2(ptr, mem)
8793                 return true
8794         }
8795         // match: (MOVHload [off1] {sym} (ADDconst [off2] x) mem)
8796         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
8797         // result: (MOVHload [off1+int32(off2)] {sym} x mem)
8798         for {
8799                 off1 := auxIntToInt32(v.AuxInt)
8800                 sym := auxToSym(v.Aux)
8801                 if v_0.Op != OpPPC64ADDconst {
8802                         break
8803                 }
8804                 off2 := auxIntToInt64(v_0.AuxInt)
8805                 x := v_0.Args[0]
8806                 mem := v_1
8807                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
8808                         break
8809                 }
8810                 v.reset(OpPPC64MOVHload)
8811                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8812                 v.Aux = symToAux(sym)
8813                 v.AddArg2(x, mem)
8814                 return true
8815         }
8816         // match: (MOVHload [0] {sym} p:(ADD ptr idx) mem)
8817         // cond: sym == nil && p.Uses == 1
8818         // result: (MOVHloadidx ptr idx mem)
8819         for {
8820                 if auxIntToInt32(v.AuxInt) != 0 {
8821                         break
8822                 }
8823                 sym := auxToSym(v.Aux)
8824                 p := v_0
8825                 if p.Op != OpPPC64ADD {
8826                         break
8827                 }
8828                 idx := p.Args[1]
8829                 ptr := p.Args[0]
8830                 mem := v_1
8831                 if !(sym == nil && p.Uses == 1) {
8832                         break
8833                 }
8834                 v.reset(OpPPC64MOVHloadidx)
8835                 v.AddArg3(ptr, idx, mem)
8836                 return true
8837         }
8838         return false
8839 }
8840 func rewriteValuePPC64_OpPPC64MOVHloadidx(v *Value) bool {
8841         v_2 := v.Args[2]
8842         v_1 := v.Args[1]
8843         v_0 := v.Args[0]
8844         // match: (MOVHloadidx ptr (MOVDconst [c]) mem)
8845         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8846         // result: (MOVHload [int32(c)] ptr mem)
8847         for {
8848                 ptr := v_0
8849                 if v_1.Op != OpPPC64MOVDconst {
8850                         break
8851                 }
8852                 c := auxIntToInt64(v_1.AuxInt)
8853                 mem := v_2
8854                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8855                         break
8856                 }
8857                 v.reset(OpPPC64MOVHload)
8858                 v.AuxInt = int32ToAuxInt(int32(c))
8859                 v.AddArg2(ptr, mem)
8860                 return true
8861         }
8862         // match: (MOVHloadidx (MOVDconst [c]) ptr mem)
8863         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8864         // result: (MOVHload [int32(c)] ptr mem)
8865         for {
8866                 if v_0.Op != OpPPC64MOVDconst {
8867                         break
8868                 }
8869                 c := auxIntToInt64(v_0.AuxInt)
8870                 ptr := v_1
8871                 mem := v_2
8872                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8873                         break
8874                 }
8875                 v.reset(OpPPC64MOVHload)
8876                 v.AuxInt = int32ToAuxInt(int32(c))
8877                 v.AddArg2(ptr, mem)
8878                 return true
8879         }
8880         return false
8881 }
8882 func rewriteValuePPC64_OpPPC64MOVHreg(v *Value) bool {
8883         v_0 := v.Args[0]
8884         b := v.Block
8885         typ := &b.Func.Config.Types
8886         // match: (MOVHreg y:(Select0 (ANDCCconst [c] _)))
8887         // cond: uint64(c) <= 0x7FFF
8888         // result: y
8889         for {
8890                 y := v_0
8891                 if y.Op != OpSelect0 {
8892                         break
8893                 }
8894                 y_0 := y.Args[0]
8895                 if y_0.Op != OpPPC64ANDCCconst {
8896                         break
8897                 }
8898                 c := auxIntToInt64(y_0.AuxInt)
8899                 if !(uint64(c) <= 0x7FFF) {
8900                         break
8901                 }
8902                 v.copyOf(y)
8903                 return true
8904         }
8905         // match: (MOVHreg (SRAWconst [c] (MOVBreg x)))
8906         // result: (SRAWconst [c] (MOVBreg x))
8907         for {
8908                 if v_0.Op != OpPPC64SRAWconst {
8909                         break
8910                 }
8911                 c := auxIntToInt64(v_0.AuxInt)
8912                 v_0_0 := v_0.Args[0]
8913                 if v_0_0.Op != OpPPC64MOVBreg {
8914                         break
8915                 }
8916                 x := v_0_0.Args[0]
8917                 v.reset(OpPPC64SRAWconst)
8918                 v.AuxInt = int64ToAuxInt(c)
8919                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
8920                 v0.AddArg(x)
8921                 v.AddArg(v0)
8922                 return true
8923         }
8924         // match: (MOVHreg (SRAWconst [c] (MOVHreg x)))
8925         // result: (SRAWconst [c] (MOVHreg x))
8926         for {
8927                 if v_0.Op != OpPPC64SRAWconst {
8928                         break
8929                 }
8930                 c := auxIntToInt64(v_0.AuxInt)
8931                 v_0_0 := v_0.Args[0]
8932                 if v_0_0.Op != OpPPC64MOVHreg {
8933                         break
8934                 }
8935                 x := v_0_0.Args[0]
8936                 v.reset(OpPPC64SRAWconst)
8937                 v.AuxInt = int64ToAuxInt(c)
8938                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
8939                 v0.AddArg(x)
8940                 v.AddArg(v0)
8941                 return true
8942         }
8943         // match: (MOVHreg (SRAWconst [c] x))
8944         // cond: sizeof(x.Type) <= 16
8945         // result: (SRAWconst [c] x)
8946         for {
8947                 if v_0.Op != OpPPC64SRAWconst {
8948                         break
8949                 }
8950                 c := auxIntToInt64(v_0.AuxInt)
8951                 x := v_0.Args[0]
8952                 if !(sizeof(x.Type) <= 16) {
8953                         break
8954                 }
8955                 v.reset(OpPPC64SRAWconst)
8956                 v.AuxInt = int64ToAuxInt(c)
8957                 v.AddArg(x)
8958                 return true
8959         }
8960         // match: (MOVHreg (SRDconst [c] x))
8961         // cond: c>48
8962         // result: (SRDconst [c] x)
8963         for {
8964                 if v_0.Op != OpPPC64SRDconst {
8965                         break
8966                 }
8967                 c := auxIntToInt64(v_0.AuxInt)
8968                 x := v_0.Args[0]
8969                 if !(c > 48) {
8970                         break
8971                 }
8972                 v.reset(OpPPC64SRDconst)
8973                 v.AuxInt = int64ToAuxInt(c)
8974                 v.AddArg(x)
8975                 return true
8976         }
8977         // match: (MOVHreg (SRDconst [c] x))
8978         // cond: c==48
8979         // result: (SRADconst [c] x)
8980         for {
8981                 if v_0.Op != OpPPC64SRDconst {
8982                         break
8983                 }
8984                 c := auxIntToInt64(v_0.AuxInt)
8985                 x := v_0.Args[0]
8986                 if !(c == 48) {
8987                         break
8988                 }
8989                 v.reset(OpPPC64SRADconst)
8990                 v.AuxInt = int64ToAuxInt(c)
8991                 v.AddArg(x)
8992                 return true
8993         }
8994         // match: (MOVHreg (SRADconst [c] x))
8995         // cond: c>=48
8996         // result: (SRADconst [c] x)
8997         for {
8998                 if v_0.Op != OpPPC64SRADconst {
8999                         break
9000                 }
9001                 c := auxIntToInt64(v_0.AuxInt)
9002                 x := v_0.Args[0]
9003                 if !(c >= 48) {
9004                         break
9005                 }
9006                 v.reset(OpPPC64SRADconst)
9007                 v.AuxInt = int64ToAuxInt(c)
9008                 v.AddArg(x)
9009                 return true
9010         }
9011         // match: (MOVHreg (SRWconst [c] x))
9012         // cond: c>16
9013         // result: (SRWconst [c] x)
9014         for {
9015                 if v_0.Op != OpPPC64SRWconst {
9016                         break
9017                 }
9018                 c := auxIntToInt64(v_0.AuxInt)
9019                 x := v_0.Args[0]
9020                 if !(c > 16) {
9021                         break
9022                 }
9023                 v.reset(OpPPC64SRWconst)
9024                 v.AuxInt = int64ToAuxInt(c)
9025                 v.AddArg(x)
9026                 return true
9027         }
9028         // match: (MOVHreg (SRAWconst [c] x))
9029         // cond: c>=16
9030         // result: (SRAWconst [c] x)
9031         for {
9032                 if v_0.Op != OpPPC64SRAWconst {
9033                         break
9034                 }
9035                 c := auxIntToInt64(v_0.AuxInt)
9036                 x := v_0.Args[0]
9037                 if !(c >= 16) {
9038                         break
9039                 }
9040                 v.reset(OpPPC64SRAWconst)
9041                 v.AuxInt = int64ToAuxInt(c)
9042                 v.AddArg(x)
9043                 return true
9044         }
9045         // match: (MOVHreg (SRWconst [c] x))
9046         // cond: c==16
9047         // result: (SRAWconst [c] x)
9048         for {
9049                 if v_0.Op != OpPPC64SRWconst {
9050                         break
9051                 }
9052                 c := auxIntToInt64(v_0.AuxInt)
9053                 x := v_0.Args[0]
9054                 if !(c == 16) {
9055                         break
9056                 }
9057                 v.reset(OpPPC64SRAWconst)
9058                 v.AuxInt = int64ToAuxInt(c)
9059                 v.AddArg(x)
9060                 return true
9061         }
9062         // match: (MOVHreg y:(MOVHreg _))
9063         // result: y
9064         for {
9065                 y := v_0
9066                 if y.Op != OpPPC64MOVHreg {
9067                         break
9068                 }
9069                 v.copyOf(y)
9070                 return true
9071         }
9072         // match: (MOVHreg y:(MOVBreg _))
9073         // result: y
9074         for {
9075                 y := v_0
9076                 if y.Op != OpPPC64MOVBreg {
9077                         break
9078                 }
9079                 v.copyOf(y)
9080                 return true
9081         }
9082         // match: (MOVHreg y:(MOVHZreg x))
9083         // result: (MOVHreg x)
9084         for {
9085                 y := v_0
9086                 if y.Op != OpPPC64MOVHZreg {
9087                         break
9088                 }
9089                 x := y.Args[0]
9090                 v.reset(OpPPC64MOVHreg)
9091                 v.AddArg(x)
9092                 return true
9093         }
9094         // match: (MOVHreg x:(MOVHload _ _))
9095         // result: x
9096         for {
9097                 x := v_0
9098                 if x.Op != OpPPC64MOVHload {
9099                         break
9100                 }
9101                 v.copyOf(x)
9102                 return true
9103         }
9104         // match: (MOVHreg x:(MOVHloadidx _ _ _))
9105         // result: x
9106         for {
9107                 x := v_0
9108                 if x.Op != OpPPC64MOVHloadidx {
9109                         break
9110                 }
9111                 v.copyOf(x)
9112                 return true
9113         }
9114         // match: (MOVHreg x:(Arg <t>))
9115         // cond: (is8BitInt(t) || is16BitInt(t)) && t.IsSigned()
9116         // result: x
9117         for {
9118                 x := v_0
9119                 if x.Op != OpArg {
9120                         break
9121                 }
9122                 t := x.Type
9123                 if !((is8BitInt(t) || is16BitInt(t)) && t.IsSigned()) {
9124                         break
9125                 }
9126                 v.copyOf(x)
9127                 return true
9128         }
9129         // match: (MOVHreg (MOVDconst [c]))
9130         // result: (MOVDconst [int64(int16(c))])
9131         for {
9132                 if v_0.Op != OpPPC64MOVDconst {
9133                         break
9134                 }
9135                 c := auxIntToInt64(v_0.AuxInt)
9136                 v.reset(OpPPC64MOVDconst)
9137                 v.AuxInt = int64ToAuxInt(int64(int16(c)))
9138                 return true
9139         }
9140         return false
9141 }
9142 func rewriteValuePPC64_OpPPC64MOVHstore(v *Value) bool {
9143         v_2 := v.Args[2]
9144         v_1 := v.Args[1]
9145         v_0 := v.Args[0]
9146         b := v.Block
9147         // match: (MOVHstore [off1] {sym} (ADDconst [off2] x) val mem)
9148         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
9149         // result: (MOVHstore [off1+int32(off2)] {sym} x val mem)
9150         for {
9151                 off1 := auxIntToInt32(v.AuxInt)
9152                 sym := auxToSym(v.Aux)
9153                 if v_0.Op != OpPPC64ADDconst {
9154                         break
9155                 }
9156                 off2 := auxIntToInt64(v_0.AuxInt)
9157                 x := v_0.Args[0]
9158                 val := v_1
9159                 mem := v_2
9160                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
9161                         break
9162                 }
9163                 v.reset(OpPPC64MOVHstore)
9164                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9165                 v.Aux = symToAux(sym)
9166                 v.AddArg3(x, val, mem)
9167                 return true
9168         }
9169         // match: (MOVHstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
9170         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
9171         // result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
9172         for {
9173                 off1 := auxIntToInt32(v.AuxInt)
9174                 sym1 := auxToSym(v.Aux)
9175                 p := v_0
9176                 if p.Op != OpPPC64MOVDaddr {
9177                         break
9178                 }
9179                 off2 := auxIntToInt32(p.AuxInt)
9180                 sym2 := auxToSym(p.Aux)
9181                 ptr := p.Args[0]
9182                 val := v_1
9183                 mem := v_2
9184                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
9185                         break
9186                 }
9187                 v.reset(OpPPC64MOVHstore)
9188                 v.AuxInt = int32ToAuxInt(off1 + off2)
9189                 v.Aux = symToAux(mergeSym(sym1, sym2))
9190                 v.AddArg3(ptr, val, mem)
9191                 return true
9192         }
9193         // match: (MOVHstore [off] {sym} ptr (MOVDconst [0]) mem)
9194         // result: (MOVHstorezero [off] {sym} ptr mem)
9195         for {
9196                 off := auxIntToInt32(v.AuxInt)
9197                 sym := auxToSym(v.Aux)
9198                 ptr := v_0
9199                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
9200                         break
9201                 }
9202                 mem := v_2
9203                 v.reset(OpPPC64MOVHstorezero)
9204                 v.AuxInt = int32ToAuxInt(off)
9205                 v.Aux = symToAux(sym)
9206                 v.AddArg2(ptr, mem)
9207                 return true
9208         }
9209         // match: (MOVHstore [0] {sym} p:(ADD ptr idx) val mem)
9210         // cond: sym == nil && p.Uses == 1
9211         // result: (MOVHstoreidx ptr idx val mem)
9212         for {
9213                 if auxIntToInt32(v.AuxInt) != 0 {
9214                         break
9215                 }
9216                 sym := auxToSym(v.Aux)
9217                 p := v_0
9218                 if p.Op != OpPPC64ADD {
9219                         break
9220                 }
9221                 idx := p.Args[1]
9222                 ptr := p.Args[0]
9223                 val := v_1
9224                 mem := v_2
9225                 if !(sym == nil && p.Uses == 1) {
9226                         break
9227                 }
9228                 v.reset(OpPPC64MOVHstoreidx)
9229                 v.AddArg4(ptr, idx, val, mem)
9230                 return true
9231         }
9232         // match: (MOVHstore [off] {sym} ptr (MOVHreg x) mem)
9233         // result: (MOVHstore [off] {sym} ptr x mem)
9234         for {
9235                 off := auxIntToInt32(v.AuxInt)
9236                 sym := auxToSym(v.Aux)
9237                 ptr := v_0
9238                 if v_1.Op != OpPPC64MOVHreg {
9239                         break
9240                 }
9241                 x := v_1.Args[0]
9242                 mem := v_2
9243                 v.reset(OpPPC64MOVHstore)
9244                 v.AuxInt = int32ToAuxInt(off)
9245                 v.Aux = symToAux(sym)
9246                 v.AddArg3(ptr, x, mem)
9247                 return true
9248         }
9249         // match: (MOVHstore [off] {sym} ptr (MOVHZreg x) mem)
9250         // result: (MOVHstore [off] {sym} ptr x mem)
9251         for {
9252                 off := auxIntToInt32(v.AuxInt)
9253                 sym := auxToSym(v.Aux)
9254                 ptr := v_0
9255                 if v_1.Op != OpPPC64MOVHZreg {
9256                         break
9257                 }
9258                 x := v_1.Args[0]
9259                 mem := v_2
9260                 v.reset(OpPPC64MOVHstore)
9261                 v.AuxInt = int32ToAuxInt(off)
9262                 v.Aux = symToAux(sym)
9263                 v.AddArg3(ptr, x, mem)
9264                 return true
9265         }
9266         // match: (MOVHstore [off] {sym} ptr (MOVWreg x) mem)
9267         // result: (MOVHstore [off] {sym} ptr x mem)
9268         for {
9269                 off := auxIntToInt32(v.AuxInt)
9270                 sym := auxToSym(v.Aux)
9271                 ptr := v_0
9272                 if v_1.Op != OpPPC64MOVWreg {
9273                         break
9274                 }
9275                 x := v_1.Args[0]
9276                 mem := v_2
9277                 v.reset(OpPPC64MOVHstore)
9278                 v.AuxInt = int32ToAuxInt(off)
9279                 v.Aux = symToAux(sym)
9280                 v.AddArg3(ptr, x, mem)
9281                 return true
9282         }
9283         // match: (MOVHstore [off] {sym} ptr (MOVWZreg x) mem)
9284         // result: (MOVHstore [off] {sym} ptr x mem)
9285         for {
9286                 off := auxIntToInt32(v.AuxInt)
9287                 sym := auxToSym(v.Aux)
9288                 ptr := v_0
9289                 if v_1.Op != OpPPC64MOVWZreg {
9290                         break
9291                 }
9292                 x := v_1.Args[0]
9293                 mem := v_2
9294                 v.reset(OpPPC64MOVHstore)
9295                 v.AuxInt = int32ToAuxInt(off)
9296                 v.Aux = symToAux(sym)
9297                 v.AddArg3(ptr, x, mem)
9298                 return true
9299         }
9300         // match: (MOVHstore [off] {sym} ptr r:(BRH val) mem)
9301         // cond: r.Uses == 1
9302         // result: (MOVHBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
9303         for {
9304                 off := auxIntToInt32(v.AuxInt)
9305                 sym := auxToSym(v.Aux)
9306                 ptr := v_0
9307                 r := v_1
9308                 if r.Op != OpPPC64BRH {
9309                         break
9310                 }
9311                 val := r.Args[0]
9312                 mem := v_2
9313                 if !(r.Uses == 1) {
9314                         break
9315                 }
9316                 v.reset(OpPPC64MOVHBRstore)
9317                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
9318                 v0.AuxInt = int32ToAuxInt(off)
9319                 v0.Aux = symToAux(sym)
9320                 v0.AddArg(ptr)
9321                 v.AddArg3(v0, val, mem)
9322                 return true
9323         }
9324         // match: (MOVHstore [off] {sym} ptr (Bswap16 val) mem)
9325         // result: (MOVHBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
9326         for {
9327                 off := auxIntToInt32(v.AuxInt)
9328                 sym := auxToSym(v.Aux)
9329                 ptr := v_0
9330                 if v_1.Op != OpBswap16 {
9331                         break
9332                 }
9333                 val := v_1.Args[0]
9334                 mem := v_2
9335                 v.reset(OpPPC64MOVHBRstore)
9336                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
9337                 v0.AuxInt = int32ToAuxInt(off)
9338                 v0.Aux = symToAux(sym)
9339                 v0.AddArg(ptr)
9340                 v.AddArg3(v0, val, mem)
9341                 return true
9342         }
9343         return false
9344 }
9345 func rewriteValuePPC64_OpPPC64MOVHstoreidx(v *Value) bool {
9346         v_3 := v.Args[3]
9347         v_2 := v.Args[2]
9348         v_1 := v.Args[1]
9349         v_0 := v.Args[0]
9350         // match: (MOVHstoreidx ptr (MOVDconst [c]) val mem)
9351         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9352         // result: (MOVHstore [int32(c)] ptr val mem)
9353         for {
9354                 ptr := v_0
9355                 if v_1.Op != OpPPC64MOVDconst {
9356                         break
9357                 }
9358                 c := auxIntToInt64(v_1.AuxInt)
9359                 val := v_2
9360                 mem := v_3
9361                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9362                         break
9363                 }
9364                 v.reset(OpPPC64MOVHstore)
9365                 v.AuxInt = int32ToAuxInt(int32(c))
9366                 v.AddArg3(ptr, val, mem)
9367                 return true
9368         }
9369         // match: (MOVHstoreidx (MOVDconst [c]) ptr val mem)
9370         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9371         // result: (MOVHstore [int32(c)] ptr val mem)
9372         for {
9373                 if v_0.Op != OpPPC64MOVDconst {
9374                         break
9375                 }
9376                 c := auxIntToInt64(v_0.AuxInt)
9377                 ptr := v_1
9378                 val := v_2
9379                 mem := v_3
9380                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9381                         break
9382                 }
9383                 v.reset(OpPPC64MOVHstore)
9384                 v.AuxInt = int32ToAuxInt(int32(c))
9385                 v.AddArg3(ptr, val, mem)
9386                 return true
9387         }
9388         // match: (MOVHstoreidx ptr idx (MOVHreg x) mem)
9389         // result: (MOVHstoreidx ptr idx x mem)
9390         for {
9391                 ptr := v_0
9392                 idx := v_1
9393                 if v_2.Op != OpPPC64MOVHreg {
9394                         break
9395                 }
9396                 x := v_2.Args[0]
9397                 mem := v_3
9398                 v.reset(OpPPC64MOVHstoreidx)
9399                 v.AddArg4(ptr, idx, x, mem)
9400                 return true
9401         }
9402         // match: (MOVHstoreidx ptr idx (MOVHZreg x) mem)
9403         // result: (MOVHstoreidx ptr idx x mem)
9404         for {
9405                 ptr := v_0
9406                 idx := v_1
9407                 if v_2.Op != OpPPC64MOVHZreg {
9408                         break
9409                 }
9410                 x := v_2.Args[0]
9411                 mem := v_3
9412                 v.reset(OpPPC64MOVHstoreidx)
9413                 v.AddArg4(ptr, idx, x, mem)
9414                 return true
9415         }
9416         // match: (MOVHstoreidx ptr idx (MOVWreg x) mem)
9417         // result: (MOVHstoreidx ptr idx x mem)
9418         for {
9419                 ptr := v_0
9420                 idx := v_1
9421                 if v_2.Op != OpPPC64MOVWreg {
9422                         break
9423                 }
9424                 x := v_2.Args[0]
9425                 mem := v_3
9426                 v.reset(OpPPC64MOVHstoreidx)
9427                 v.AddArg4(ptr, idx, x, mem)
9428                 return true
9429         }
9430         // match: (MOVHstoreidx ptr idx (MOVWZreg x) mem)
9431         // result: (MOVHstoreidx ptr idx x mem)
9432         for {
9433                 ptr := v_0
9434                 idx := v_1
9435                 if v_2.Op != OpPPC64MOVWZreg {
9436                         break
9437                 }
9438                 x := v_2.Args[0]
9439                 mem := v_3
9440                 v.reset(OpPPC64MOVHstoreidx)
9441                 v.AddArg4(ptr, idx, x, mem)
9442                 return true
9443         }
9444         // match: (MOVHstoreidx ptr idx r:(BRH val) mem)
9445         // cond: r.Uses == 1
9446         // result: (MOVHBRstoreidx ptr idx val mem)
9447         for {
9448                 ptr := v_0
9449                 idx := v_1
9450                 r := v_2
9451                 if r.Op != OpPPC64BRH {
9452                         break
9453                 }
9454                 val := r.Args[0]
9455                 mem := v_3
9456                 if !(r.Uses == 1) {
9457                         break
9458                 }
9459                 v.reset(OpPPC64MOVHBRstoreidx)
9460                 v.AddArg4(ptr, idx, val, mem)
9461                 return true
9462         }
9463         // match: (MOVHstoreidx ptr idx (Bswap16 val) mem)
9464         // result: (MOVHBRstoreidx ptr idx val mem)
9465         for {
9466                 ptr := v_0
9467                 idx := v_1
9468                 if v_2.Op != OpBswap16 {
9469                         break
9470                 }
9471                 val := v_2.Args[0]
9472                 mem := v_3
9473                 v.reset(OpPPC64MOVHBRstoreidx)
9474                 v.AddArg4(ptr, idx, val, mem)
9475                 return true
9476         }
9477         return false
9478 }
9479 func rewriteValuePPC64_OpPPC64MOVHstorezero(v *Value) bool {
9480         v_1 := v.Args[1]
9481         v_0 := v.Args[0]
9482         // match: (MOVHstorezero [off1] {sym} (ADDconst [off2] x) mem)
9483         // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2)))
9484         // result: (MOVHstorezero [off1+int32(off2)] {sym} x mem)
9485         for {
9486                 off1 := auxIntToInt32(v.AuxInt)
9487                 sym := auxToSym(v.Aux)
9488                 if v_0.Op != OpPPC64ADDconst {
9489                         break
9490                 }
9491                 off2 := auxIntToInt64(v_0.AuxInt)
9492                 x := v_0.Args[0]
9493                 mem := v_1
9494                 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
9495                         break
9496                 }
9497                 v.reset(OpPPC64MOVHstorezero)
9498                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9499                 v.Aux = symToAux(sym)
9500                 v.AddArg2(x, mem)
9501                 return true
9502         }
9503         // match: (MOVHstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
9504         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
9505         // result: (MOVHstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
9506         for {
9507                 off1 := auxIntToInt32(v.AuxInt)
9508                 sym1 := auxToSym(v.Aux)
9509                 p := v_0
9510                 if p.Op != OpPPC64MOVDaddr {
9511                         break
9512                 }
9513                 off2 := auxIntToInt32(p.AuxInt)
9514                 sym2 := auxToSym(p.Aux)
9515                 x := p.Args[0]
9516                 mem := v_1
9517                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
9518                         break
9519                 }
9520                 v.reset(OpPPC64MOVHstorezero)
9521                 v.AuxInt = int32ToAuxInt(off1 + off2)
9522                 v.Aux = symToAux(mergeSym(sym1, sym2))
9523                 v.AddArg2(x, mem)
9524                 return true
9525         }
9526         return false
9527 }
9528 func rewriteValuePPC64_OpPPC64MOVWBRstore(v *Value) bool {
9529         v_2 := v.Args[2]
9530         v_1 := v.Args[1]
9531         v_0 := v.Args[0]
9532         // match: (MOVWBRstore ptr (MOVWreg x) mem)
9533         // result: (MOVWBRstore ptr x mem)
9534         for {
9535                 ptr := v_0
9536                 if v_1.Op != OpPPC64MOVWreg {
9537                         break
9538                 }
9539                 x := v_1.Args[0]
9540                 mem := v_2
9541                 v.reset(OpPPC64MOVWBRstore)
9542                 v.AddArg3(ptr, x, mem)
9543                 return true
9544         }
9545         // match: (MOVWBRstore ptr (MOVWZreg x) mem)
9546         // result: (MOVWBRstore ptr x mem)
9547         for {
9548                 ptr := v_0
9549                 if v_1.Op != OpPPC64MOVWZreg {
9550                         break
9551                 }
9552                 x := v_1.Args[0]
9553                 mem := v_2
9554                 v.reset(OpPPC64MOVWBRstore)
9555                 v.AddArg3(ptr, x, mem)
9556                 return true
9557         }
9558         return false
9559 }
9560 func rewriteValuePPC64_OpPPC64MOVWZload(v *Value) bool {
9561         v_1 := v.Args[1]
9562         v_0 := v.Args[0]
9563         // match: (MOVWZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
9564         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
9565         // result: (MOVWZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
9566         for {
9567                 off1 := auxIntToInt32(v.AuxInt)
9568                 sym1 := auxToSym(v.Aux)
9569                 p := v_0
9570                 if p.Op != OpPPC64MOVDaddr {
9571                         break
9572                 }
9573                 off2 := auxIntToInt32(p.AuxInt)
9574                 sym2 := auxToSym(p.Aux)
9575                 ptr := p.Args[0]
9576                 mem := v_1
9577                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
9578                         break
9579                 }
9580                 v.reset(OpPPC64MOVWZload)
9581                 v.AuxInt = int32ToAuxInt(off1 + off2)
9582                 v.Aux = symToAux(mergeSym(sym1, sym2))
9583                 v.AddArg2(ptr, mem)
9584                 return true
9585         }
9586         // match: (MOVWZload [off1] {sym} (ADDconst [off2] x) mem)
9587         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
9588         // result: (MOVWZload [off1+int32(off2)] {sym} x mem)
9589         for {
9590                 off1 := auxIntToInt32(v.AuxInt)
9591                 sym := auxToSym(v.Aux)
9592                 if v_0.Op != OpPPC64ADDconst {
9593                         break
9594                 }
9595                 off2 := auxIntToInt64(v_0.AuxInt)
9596                 x := v_0.Args[0]
9597                 mem := v_1
9598                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
9599                         break
9600                 }
9601                 v.reset(OpPPC64MOVWZload)
9602                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9603                 v.Aux = symToAux(sym)
9604                 v.AddArg2(x, mem)
9605                 return true
9606         }
9607         // match: (MOVWZload [0] {sym} p:(ADD ptr idx) mem)
9608         // cond: sym == nil && p.Uses == 1
9609         // result: (MOVWZloadidx ptr idx mem)
9610         for {
9611                 if auxIntToInt32(v.AuxInt) != 0 {
9612                         break
9613                 }
9614                 sym := auxToSym(v.Aux)
9615                 p := v_0
9616                 if p.Op != OpPPC64ADD {
9617                         break
9618                 }
9619                 idx := p.Args[1]
9620                 ptr := p.Args[0]
9621                 mem := v_1
9622                 if !(sym == nil && p.Uses == 1) {
9623                         break
9624                 }
9625                 v.reset(OpPPC64MOVWZloadidx)
9626                 v.AddArg3(ptr, idx, mem)
9627                 return true
9628         }
9629         return false
9630 }
9631 func rewriteValuePPC64_OpPPC64MOVWZloadidx(v *Value) bool {
9632         v_2 := v.Args[2]
9633         v_1 := v.Args[1]
9634         v_0 := v.Args[0]
9635         // match: (MOVWZloadidx ptr (MOVDconst [c]) mem)
9636         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9637         // result: (MOVWZload [int32(c)] ptr mem)
9638         for {
9639                 ptr := v_0
9640                 if v_1.Op != OpPPC64MOVDconst {
9641                         break
9642                 }
9643                 c := auxIntToInt64(v_1.AuxInt)
9644                 mem := v_2
9645                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9646                         break
9647                 }
9648                 v.reset(OpPPC64MOVWZload)
9649                 v.AuxInt = int32ToAuxInt(int32(c))
9650                 v.AddArg2(ptr, mem)
9651                 return true
9652         }
9653         // match: (MOVWZloadidx (MOVDconst [c]) ptr mem)
9654         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9655         // result: (MOVWZload [int32(c)] ptr mem)
9656         for {
9657                 if v_0.Op != OpPPC64MOVDconst {
9658                         break
9659                 }
9660                 c := auxIntToInt64(v_0.AuxInt)
9661                 ptr := v_1
9662                 mem := v_2
9663                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9664                         break
9665                 }
9666                 v.reset(OpPPC64MOVWZload)
9667                 v.AuxInt = int32ToAuxInt(int32(c))
9668                 v.AddArg2(ptr, mem)
9669                 return true
9670         }
9671         return false
9672 }
9673 func rewriteValuePPC64_OpPPC64MOVWZreg(v *Value) bool {
9674         v_0 := v.Args[0]
9675         b := v.Block
9676         typ := &b.Func.Config.Types
9677         // match: (MOVWZreg y:(Select0 (ANDCCconst [c] _)))
9678         // cond: uint64(c) <= 0xFFFFFFFF
9679         // result: y
9680         for {
9681                 y := v_0
9682                 if y.Op != OpSelect0 {
9683                         break
9684                 }
9685                 y_0 := y.Args[0]
9686                 if y_0.Op != OpPPC64ANDCCconst {
9687                         break
9688                 }
9689                 c := auxIntToInt64(y_0.AuxInt)
9690                 if !(uint64(c) <= 0xFFFFFFFF) {
9691                         break
9692                 }
9693                 v.copyOf(y)
9694                 return true
9695         }
9696         // match: (MOVWZreg y:(AND (MOVDconst [c]) _))
9697         // cond: uint64(c) <= 0xFFFFFFFF
9698         // result: y
9699         for {
9700                 y := v_0
9701                 if y.Op != OpPPC64AND {
9702                         break
9703                 }
9704                 y_0 := y.Args[0]
9705                 y_1 := y.Args[1]
9706                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
9707                         if y_0.Op != OpPPC64MOVDconst {
9708                                 continue
9709                         }
9710                         c := auxIntToInt64(y_0.AuxInt)
9711                         if !(uint64(c) <= 0xFFFFFFFF) {
9712                                 continue
9713                         }
9714                         v.copyOf(y)
9715                         return true
9716                 }
9717                 break
9718         }
9719         // match: (MOVWZreg (SRWconst [c] (MOVBZreg x)))
9720         // result: (SRWconst [c] (MOVBZreg x))
9721         for {
9722                 if v_0.Op != OpPPC64SRWconst {
9723                         break
9724                 }
9725                 c := auxIntToInt64(v_0.AuxInt)
9726                 v_0_0 := v_0.Args[0]
9727                 if v_0_0.Op != OpPPC64MOVBZreg {
9728                         break
9729                 }
9730                 x := v_0_0.Args[0]
9731                 v.reset(OpPPC64SRWconst)
9732                 v.AuxInt = int64ToAuxInt(c)
9733                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
9734                 v0.AddArg(x)
9735                 v.AddArg(v0)
9736                 return true
9737         }
9738         // match: (MOVWZreg (SRWconst [c] (MOVHZreg x)))
9739         // result: (SRWconst [c] (MOVHZreg x))
9740         for {
9741                 if v_0.Op != OpPPC64SRWconst {
9742                         break
9743                 }
9744                 c := auxIntToInt64(v_0.AuxInt)
9745                 v_0_0 := v_0.Args[0]
9746                 if v_0_0.Op != OpPPC64MOVHZreg {
9747                         break
9748                 }
9749                 x := v_0_0.Args[0]
9750                 v.reset(OpPPC64SRWconst)
9751                 v.AuxInt = int64ToAuxInt(c)
9752                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
9753                 v0.AddArg(x)
9754                 v.AddArg(v0)
9755                 return true
9756         }
9757         // match: (MOVWZreg (SRWconst [c] (MOVWZreg x)))
9758         // result: (SRWconst [c] (MOVWZreg x))
9759         for {
9760                 if v_0.Op != OpPPC64SRWconst {
9761                         break
9762                 }
9763                 c := auxIntToInt64(v_0.AuxInt)
9764                 v_0_0 := v_0.Args[0]
9765                 if v_0_0.Op != OpPPC64MOVWZreg {
9766                         break
9767                 }
9768                 x := v_0_0.Args[0]
9769                 v.reset(OpPPC64SRWconst)
9770                 v.AuxInt = int64ToAuxInt(c)
9771                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
9772                 v0.AddArg(x)
9773                 v.AddArg(v0)
9774                 return true
9775         }
9776         // match: (MOVWZreg (SRWconst [c] x))
9777         // cond: sizeof(x.Type) <= 32
9778         // result: (SRWconst [c] x)
9779         for {
9780                 if v_0.Op != OpPPC64SRWconst {
9781                         break
9782                 }
9783                 c := auxIntToInt64(v_0.AuxInt)
9784                 x := v_0.Args[0]
9785                 if !(sizeof(x.Type) <= 32) {
9786                         break
9787                 }
9788                 v.reset(OpPPC64SRWconst)
9789                 v.AuxInt = int64ToAuxInt(c)
9790                 v.AddArg(x)
9791                 return true
9792         }
9793         // match: (MOVWZreg (SRDconst [c] x))
9794         // cond: c>=32
9795         // result: (SRDconst [c] x)
9796         for {
9797                 if v_0.Op != OpPPC64SRDconst {
9798                         break
9799                 }
9800                 c := auxIntToInt64(v_0.AuxInt)
9801                 x := v_0.Args[0]
9802                 if !(c >= 32) {
9803                         break
9804                 }
9805                 v.reset(OpPPC64SRDconst)
9806                 v.AuxInt = int64ToAuxInt(c)
9807                 v.AddArg(x)
9808                 return true
9809         }
9810         // match: (MOVWZreg y:(MOVWZreg _))
9811         // result: y
9812         for {
9813                 y := v_0
9814                 if y.Op != OpPPC64MOVWZreg {
9815                         break
9816                 }
9817                 v.copyOf(y)
9818                 return true
9819         }
9820         // match: (MOVWZreg y:(MOVHZreg _))
9821         // result: y
9822         for {
9823                 y := v_0
9824                 if y.Op != OpPPC64MOVHZreg {
9825                         break
9826                 }
9827                 v.copyOf(y)
9828                 return true
9829         }
9830         // match: (MOVWZreg y:(MOVBZreg _))
9831         // result: y
9832         for {
9833                 y := v_0
9834                 if y.Op != OpPPC64MOVBZreg {
9835                         break
9836                 }
9837                 v.copyOf(y)
9838                 return true
9839         }
9840         // match: (MOVWZreg y:(MOVHBRload _ _))
9841         // result: y
9842         for {
9843                 y := v_0
9844                 if y.Op != OpPPC64MOVHBRload {
9845                         break
9846                 }
9847                 v.copyOf(y)
9848                 return true
9849         }
9850         // match: (MOVWZreg y:(MOVWBRload _ _))
9851         // result: y
9852         for {
9853                 y := v_0
9854                 if y.Op != OpPPC64MOVWBRload {
9855                         break
9856                 }
9857                 v.copyOf(y)
9858                 return true
9859         }
9860         // match: (MOVWZreg y:(MOVWreg x))
9861         // result: (MOVWZreg x)
9862         for {
9863                 y := v_0
9864                 if y.Op != OpPPC64MOVWreg {
9865                         break
9866                 }
9867                 x := y.Args[0]
9868                 v.reset(OpPPC64MOVWZreg)
9869                 v.AddArg(x)
9870                 return true
9871         }
9872         // match: (MOVWZreg (OR <t> x (MOVWZreg y)))
9873         // result: (MOVWZreg (OR <t> x y))
9874         for {
9875                 if v_0.Op != OpPPC64OR {
9876                         break
9877                 }
9878                 t := v_0.Type
9879                 _ = v_0.Args[1]
9880                 v_0_0 := v_0.Args[0]
9881                 v_0_1 := v_0.Args[1]
9882                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9883                         x := v_0_0
9884                         if v_0_1.Op != OpPPC64MOVWZreg {
9885                                 continue
9886                         }
9887                         y := v_0_1.Args[0]
9888                         v.reset(OpPPC64MOVWZreg)
9889                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
9890                         v0.AddArg2(x, y)
9891                         v.AddArg(v0)
9892                         return true
9893                 }
9894                 break
9895         }
9896         // match: (MOVWZreg (XOR <t> x (MOVWZreg y)))
9897         // result: (MOVWZreg (XOR <t> x y))
9898         for {
9899                 if v_0.Op != OpPPC64XOR {
9900                         break
9901                 }
9902                 t := v_0.Type
9903                 _ = v_0.Args[1]
9904                 v_0_0 := v_0.Args[0]
9905                 v_0_1 := v_0.Args[1]
9906                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9907                         x := v_0_0
9908                         if v_0_1.Op != OpPPC64MOVWZreg {
9909                                 continue
9910                         }
9911                         y := v_0_1.Args[0]
9912                         v.reset(OpPPC64MOVWZreg)
9913                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
9914                         v0.AddArg2(x, y)
9915                         v.AddArg(v0)
9916                         return true
9917                 }
9918                 break
9919         }
9920         // match: (MOVWZreg (AND <t> x (MOVWZreg y)))
9921         // result: (MOVWZreg (AND <t> x y))
9922         for {
9923                 if v_0.Op != OpPPC64AND {
9924                         break
9925                 }
9926                 t := v_0.Type
9927                 _ = v_0.Args[1]
9928                 v_0_0 := v_0.Args[0]
9929                 v_0_1 := v_0.Args[1]
9930                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9931                         x := v_0_0
9932                         if v_0_1.Op != OpPPC64MOVWZreg {
9933                                 continue
9934                         }
9935                         y := v_0_1.Args[0]
9936                         v.reset(OpPPC64MOVWZreg)
9937                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
9938                         v0.AddArg2(x, y)
9939                         v.AddArg(v0)
9940                         return true
9941                 }
9942                 break
9943         }
9944         // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x))))
9945         // result: z
9946         for {
9947                 z := v_0
9948                 if z.Op != OpSelect0 {
9949                         break
9950                 }
9951                 z_0 := z.Args[0]
9952                 if z_0.Op != OpPPC64ANDCCconst {
9953                         break
9954                 }
9955                 z_0_0 := z_0.Args[0]
9956                 if z_0_0.Op != OpPPC64MOVBZload {
9957                         break
9958                 }
9959                 v.copyOf(z)
9960                 return true
9961         }
9962         // match: (MOVWZreg z:(AND y (MOVWZload ptr x)))
9963         // result: z
9964         for {
9965                 z := v_0
9966                 if z.Op != OpPPC64AND {
9967                         break
9968                 }
9969                 _ = z.Args[1]
9970                 z_0 := z.Args[0]
9971                 z_1 := z.Args[1]
9972                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
9973                         if z_1.Op != OpPPC64MOVWZload {
9974                                 continue
9975                         }
9976                         v.copyOf(z)
9977                         return true
9978                 }
9979                 break
9980         }
9981         // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVHZload ptr x))))
9982         // result: z
9983         for {
9984                 z := v_0
9985                 if z.Op != OpSelect0 {
9986                         break
9987                 }
9988                 z_0 := z.Args[0]
9989                 if z_0.Op != OpPPC64ANDCCconst {
9990                         break
9991                 }
9992                 z_0_0 := z_0.Args[0]
9993                 if z_0_0.Op != OpPPC64MOVHZload {
9994                         break
9995                 }
9996                 v.copyOf(z)
9997                 return true
9998         }
9999         // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVWZload ptr x))))
10000         // result: z
10001         for {
10002                 z := v_0
10003                 if z.Op != OpSelect0 {
10004                         break
10005                 }
10006                 z_0 := z.Args[0]
10007                 if z_0.Op != OpPPC64ANDCCconst {
10008                         break
10009                 }
10010                 z_0_0 := z_0.Args[0]
10011                 if z_0_0.Op != OpPPC64MOVWZload {
10012                         break
10013                 }
10014                 v.copyOf(z)
10015                 return true
10016         }
10017         // match: (MOVWZreg x:(MOVBZload _ _))
10018         // result: x
10019         for {
10020                 x := v_0
10021                 if x.Op != OpPPC64MOVBZload {
10022                         break
10023                 }
10024                 v.copyOf(x)
10025                 return true
10026         }
10027         // match: (MOVWZreg x:(MOVBZloadidx _ _ _))
10028         // result: x
10029         for {
10030                 x := v_0
10031                 if x.Op != OpPPC64MOVBZloadidx {
10032                         break
10033                 }
10034                 v.copyOf(x)
10035                 return true
10036         }
10037         // match: (MOVWZreg x:(MOVHZload _ _))
10038         // result: x
10039         for {
10040                 x := v_0
10041                 if x.Op != OpPPC64MOVHZload {
10042                         break
10043                 }
10044                 v.copyOf(x)
10045                 return true
10046         }
10047         // match: (MOVWZreg x:(MOVHZloadidx _ _ _))
10048         // result: x
10049         for {
10050                 x := v_0
10051                 if x.Op != OpPPC64MOVHZloadidx {
10052                         break
10053                 }
10054                 v.copyOf(x)
10055                 return true
10056         }
10057         // match: (MOVWZreg x:(MOVWZload _ _))
10058         // result: x
10059         for {
10060                 x := v_0
10061                 if x.Op != OpPPC64MOVWZload {
10062                         break
10063                 }
10064                 v.copyOf(x)
10065                 return true
10066         }
10067         // match: (MOVWZreg x:(MOVWZloadidx _ _ _))
10068         // result: x
10069         for {
10070                 x := v_0
10071                 if x.Op != OpPPC64MOVWZloadidx {
10072                         break
10073                 }
10074                 v.copyOf(x)
10075                 return true
10076         }
10077         // match: (MOVWZreg x:(Select0 (LoweredAtomicLoad32 _ _)))
10078         // result: x
10079         for {
10080                 x := v_0
10081                 if x.Op != OpSelect0 {
10082                         break
10083                 }
10084                 x_0 := x.Args[0]
10085                 if x_0.Op != OpPPC64LoweredAtomicLoad32 {
10086                         break
10087                 }
10088                 v.copyOf(x)
10089                 return true
10090         }
10091         // match: (MOVWZreg x:(Arg <t>))
10092         // cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !t.IsSigned()
10093         // result: x
10094         for {
10095                 x := v_0
10096                 if x.Op != OpArg {
10097                         break
10098                 }
10099                 t := x.Type
10100                 if !((is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !t.IsSigned()) {
10101                         break
10102                 }
10103                 v.copyOf(x)
10104                 return true
10105         }
10106         // match: (MOVWZreg (MOVDconst [c]))
10107         // result: (MOVDconst [int64(uint32(c))])
10108         for {
10109                 if v_0.Op != OpPPC64MOVDconst {
10110                         break
10111                 }
10112                 c := auxIntToInt64(v_0.AuxInt)
10113                 v.reset(OpPPC64MOVDconst)
10114                 v.AuxInt = int64ToAuxInt(int64(uint32(c)))
10115                 return true
10116         }
10117         return false
10118 }
10119 func rewriteValuePPC64_OpPPC64MOVWload(v *Value) bool {
10120         v_1 := v.Args[1]
10121         v_0 := v.Args[0]
10122         // match: (MOVWload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
10123         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
10124         // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
10125         for {
10126                 off1 := auxIntToInt32(v.AuxInt)
10127                 sym1 := auxToSym(v.Aux)
10128                 p := v_0
10129                 if p.Op != OpPPC64MOVDaddr {
10130                         break
10131                 }
10132                 off2 := auxIntToInt32(p.AuxInt)
10133                 sym2 := auxToSym(p.Aux)
10134                 ptr := p.Args[0]
10135                 mem := v_1
10136                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
10137                         break
10138                 }
10139                 v.reset(OpPPC64MOVWload)
10140                 v.AuxInt = int32ToAuxInt(off1 + off2)
10141                 v.Aux = symToAux(mergeSym(sym1, sym2))
10142                 v.AddArg2(ptr, mem)
10143                 return true
10144         }
10145         // match: (MOVWload [off1] {sym} (ADDconst [off2] x) mem)
10146         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
10147         // result: (MOVWload [off1+int32(off2)] {sym} x mem)
10148         for {
10149                 off1 := auxIntToInt32(v.AuxInt)
10150                 sym := auxToSym(v.Aux)
10151                 if v_0.Op != OpPPC64ADDconst {
10152                         break
10153                 }
10154                 off2 := auxIntToInt64(v_0.AuxInt)
10155                 x := v_0.Args[0]
10156                 mem := v_1
10157                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
10158                         break
10159                 }
10160                 v.reset(OpPPC64MOVWload)
10161                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10162                 v.Aux = symToAux(sym)
10163                 v.AddArg2(x, mem)
10164                 return true
10165         }
10166         // match: (MOVWload [0] {sym} p:(ADD ptr idx) mem)
10167         // cond: sym == nil && p.Uses == 1
10168         // result: (MOVWloadidx ptr idx mem)
10169         for {
10170                 if auxIntToInt32(v.AuxInt) != 0 {
10171                         break
10172                 }
10173                 sym := auxToSym(v.Aux)
10174                 p := v_0
10175                 if p.Op != OpPPC64ADD {
10176                         break
10177                 }
10178                 idx := p.Args[1]
10179                 ptr := p.Args[0]
10180                 mem := v_1
10181                 if !(sym == nil && p.Uses == 1) {
10182                         break
10183                 }
10184                 v.reset(OpPPC64MOVWloadidx)
10185                 v.AddArg3(ptr, idx, mem)
10186                 return true
10187         }
10188         return false
10189 }
10190 func rewriteValuePPC64_OpPPC64MOVWloadidx(v *Value) bool {
10191         v_2 := v.Args[2]
10192         v_1 := v.Args[1]
10193         v_0 := v.Args[0]
10194         // match: (MOVWloadidx ptr (MOVDconst [c]) mem)
10195         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
10196         // result: (MOVWload [int32(c)] ptr mem)
10197         for {
10198                 ptr := v_0
10199                 if v_1.Op != OpPPC64MOVDconst {
10200                         break
10201                 }
10202                 c := auxIntToInt64(v_1.AuxInt)
10203                 mem := v_2
10204                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10205                         break
10206                 }
10207                 v.reset(OpPPC64MOVWload)
10208                 v.AuxInt = int32ToAuxInt(int32(c))
10209                 v.AddArg2(ptr, mem)
10210                 return true
10211         }
10212         // match: (MOVWloadidx (MOVDconst [c]) ptr mem)
10213         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
10214         // result: (MOVWload [int32(c)] ptr mem)
10215         for {
10216                 if v_0.Op != OpPPC64MOVDconst {
10217                         break
10218                 }
10219                 c := auxIntToInt64(v_0.AuxInt)
10220                 ptr := v_1
10221                 mem := v_2
10222                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10223                         break
10224                 }
10225                 v.reset(OpPPC64MOVWload)
10226                 v.AuxInt = int32ToAuxInt(int32(c))
10227                 v.AddArg2(ptr, mem)
10228                 return true
10229         }
10230         return false
10231 }
10232 func rewriteValuePPC64_OpPPC64MOVWreg(v *Value) bool {
10233         v_0 := v.Args[0]
10234         b := v.Block
10235         typ := &b.Func.Config.Types
10236         // match: (MOVWreg y:(Select0 (ANDCCconst [c] _)))
10237         // cond: uint64(c) <= 0xFFFF
10238         // result: y
10239         for {
10240                 y := v_0
10241                 if y.Op != OpSelect0 {
10242                         break
10243                 }
10244                 y_0 := y.Args[0]
10245                 if y_0.Op != OpPPC64ANDCCconst {
10246                         break
10247                 }
10248                 c := auxIntToInt64(y_0.AuxInt)
10249                 if !(uint64(c) <= 0xFFFF) {
10250                         break
10251                 }
10252                 v.copyOf(y)
10253                 return true
10254         }
10255         // match: (MOVWreg y:(AND (MOVDconst [c]) _))
10256         // cond: uint64(c) <= 0x7FFFFFFF
10257         // result: y
10258         for {
10259                 y := v_0
10260                 if y.Op != OpPPC64AND {
10261                         break
10262                 }
10263                 y_0 := y.Args[0]
10264                 y_1 := y.Args[1]
10265                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
10266                         if y_0.Op != OpPPC64MOVDconst {
10267                                 continue
10268                         }
10269                         c := auxIntToInt64(y_0.AuxInt)
10270                         if !(uint64(c) <= 0x7FFFFFFF) {
10271                                 continue
10272                         }
10273                         v.copyOf(y)
10274                         return true
10275                 }
10276                 break
10277         }
10278         // match: (MOVWreg (SRAWconst [c] (MOVBreg x)))
10279         // result: (SRAWconst [c] (MOVBreg x))
10280         for {
10281                 if v_0.Op != OpPPC64SRAWconst {
10282                         break
10283                 }
10284                 c := auxIntToInt64(v_0.AuxInt)
10285                 v_0_0 := v_0.Args[0]
10286                 if v_0_0.Op != OpPPC64MOVBreg {
10287                         break
10288                 }
10289                 x := v_0_0.Args[0]
10290                 v.reset(OpPPC64SRAWconst)
10291                 v.AuxInt = int64ToAuxInt(c)
10292                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
10293                 v0.AddArg(x)
10294                 v.AddArg(v0)
10295                 return true
10296         }
10297         // match: (MOVWreg (SRAWconst [c] (MOVHreg x)))
10298         // result: (SRAWconst [c] (MOVHreg x))
10299         for {
10300                 if v_0.Op != OpPPC64SRAWconst {
10301                         break
10302                 }
10303                 c := auxIntToInt64(v_0.AuxInt)
10304                 v_0_0 := v_0.Args[0]
10305                 if v_0_0.Op != OpPPC64MOVHreg {
10306                         break
10307                 }
10308                 x := v_0_0.Args[0]
10309                 v.reset(OpPPC64SRAWconst)
10310                 v.AuxInt = int64ToAuxInt(c)
10311                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
10312                 v0.AddArg(x)
10313                 v.AddArg(v0)
10314                 return true
10315         }
10316         // match: (MOVWreg (SRAWconst [c] (MOVWreg x)))
10317         // result: (SRAWconst [c] (MOVWreg x))
10318         for {
10319                 if v_0.Op != OpPPC64SRAWconst {
10320                         break
10321                 }
10322                 c := auxIntToInt64(v_0.AuxInt)
10323                 v_0_0 := v_0.Args[0]
10324                 if v_0_0.Op != OpPPC64MOVWreg {
10325                         break
10326                 }
10327                 x := v_0_0.Args[0]
10328                 v.reset(OpPPC64SRAWconst)
10329                 v.AuxInt = int64ToAuxInt(c)
10330                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWreg, typ.Int64)
10331                 v0.AddArg(x)
10332                 v.AddArg(v0)
10333                 return true
10334         }
10335         // match: (MOVWreg (SRAWconst [c] x))
10336         // cond: sizeof(x.Type) <= 32
10337         // result: (SRAWconst [c] x)
10338         for {
10339                 if v_0.Op != OpPPC64SRAWconst {
10340                         break
10341                 }
10342                 c := auxIntToInt64(v_0.AuxInt)
10343                 x := v_0.Args[0]
10344                 if !(sizeof(x.Type) <= 32) {
10345                         break
10346                 }
10347                 v.reset(OpPPC64SRAWconst)
10348                 v.AuxInt = int64ToAuxInt(c)
10349                 v.AddArg(x)
10350                 return true
10351         }
10352         // match: (MOVWreg (SRDconst [c] x))
10353         // cond: c>32
10354         // result: (SRDconst [c] x)
10355         for {
10356                 if v_0.Op != OpPPC64SRDconst {
10357                         break
10358                 }
10359                 c := auxIntToInt64(v_0.AuxInt)
10360                 x := v_0.Args[0]
10361                 if !(c > 32) {
10362                         break
10363                 }
10364                 v.reset(OpPPC64SRDconst)
10365                 v.AuxInt = int64ToAuxInt(c)
10366                 v.AddArg(x)
10367                 return true
10368         }
10369         // match: (MOVWreg (SRADconst [c] x))
10370         // cond: c>=32
10371         // result: (SRADconst [c] x)
10372         for {
10373                 if v_0.Op != OpPPC64SRADconst {
10374                         break
10375                 }
10376                 c := auxIntToInt64(v_0.AuxInt)
10377                 x := v_0.Args[0]
10378                 if !(c >= 32) {
10379                         break
10380                 }
10381                 v.reset(OpPPC64SRADconst)
10382                 v.AuxInt = int64ToAuxInt(c)
10383                 v.AddArg(x)
10384                 return true
10385         }
10386         // match: (MOVWreg (SRDconst [c] x))
10387         // cond: c==32
10388         // result: (SRADconst [c] x)
10389         for {
10390                 if v_0.Op != OpPPC64SRDconst {
10391                         break
10392                 }
10393                 c := auxIntToInt64(v_0.AuxInt)
10394                 x := v_0.Args[0]
10395                 if !(c == 32) {
10396                         break
10397                 }
10398                 v.reset(OpPPC64SRADconst)
10399                 v.AuxInt = int64ToAuxInt(c)
10400                 v.AddArg(x)
10401                 return true
10402         }
10403         // match: (MOVWreg y:(MOVWreg _))
10404         // result: y
10405         for {
10406                 y := v_0
10407                 if y.Op != OpPPC64MOVWreg {
10408                         break
10409                 }
10410                 v.copyOf(y)
10411                 return true
10412         }
10413         // match: (MOVWreg y:(MOVHreg _))
10414         // result: y
10415         for {
10416                 y := v_0
10417                 if y.Op != OpPPC64MOVHreg {
10418                         break
10419                 }
10420                 v.copyOf(y)
10421                 return true
10422         }
10423         // match: (MOVWreg y:(MOVBreg _))
10424         // result: y
10425         for {
10426                 y := v_0
10427                 if y.Op != OpPPC64MOVBreg {
10428                         break
10429                 }
10430                 v.copyOf(y)
10431                 return true
10432         }
10433         // match: (MOVWreg y:(MOVWZreg x))
10434         // result: (MOVWreg x)
10435         for {
10436                 y := v_0
10437                 if y.Op != OpPPC64MOVWZreg {
10438                         break
10439                 }
10440                 x := y.Args[0]
10441                 v.reset(OpPPC64MOVWreg)
10442                 v.AddArg(x)
10443                 return true
10444         }
10445         // match: (MOVWreg x:(MOVHload _ _))
10446         // result: x
10447         for {
10448                 x := v_0
10449                 if x.Op != OpPPC64MOVHload {
10450                         break
10451                 }
10452                 v.copyOf(x)
10453                 return true
10454         }
10455         // match: (MOVWreg x:(MOVHloadidx _ _ _))
10456         // result: x
10457         for {
10458                 x := v_0
10459                 if x.Op != OpPPC64MOVHloadidx {
10460                         break
10461                 }
10462                 v.copyOf(x)
10463                 return true
10464         }
10465         // match: (MOVWreg x:(MOVWload _ _))
10466         // result: x
10467         for {
10468                 x := v_0
10469                 if x.Op != OpPPC64MOVWload {
10470                         break
10471                 }
10472                 v.copyOf(x)
10473                 return true
10474         }
10475         // match: (MOVWreg x:(MOVWloadidx _ _ _))
10476         // result: x
10477         for {
10478                 x := v_0
10479                 if x.Op != OpPPC64MOVWloadidx {
10480                         break
10481                 }
10482                 v.copyOf(x)
10483                 return true
10484         }
10485         // match: (MOVWreg x:(Arg <t>))
10486         // cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && t.IsSigned()
10487         // result: x
10488         for {
10489                 x := v_0
10490                 if x.Op != OpArg {
10491                         break
10492                 }
10493                 t := x.Type
10494                 if !((is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && t.IsSigned()) {
10495                         break
10496                 }
10497                 v.copyOf(x)
10498                 return true
10499         }
10500         // match: (MOVWreg (MOVDconst [c]))
10501         // result: (MOVDconst [int64(int32(c))])
10502         for {
10503                 if v_0.Op != OpPPC64MOVDconst {
10504                         break
10505                 }
10506                 c := auxIntToInt64(v_0.AuxInt)
10507                 v.reset(OpPPC64MOVDconst)
10508                 v.AuxInt = int64ToAuxInt(int64(int32(c)))
10509                 return true
10510         }
10511         return false
10512 }
10513 func rewriteValuePPC64_OpPPC64MOVWstore(v *Value) bool {
10514         v_2 := v.Args[2]
10515         v_1 := v.Args[1]
10516         v_0 := v.Args[0]
10517         b := v.Block
10518         // match: (MOVWstore [off1] {sym} (ADDconst [off2] x) val mem)
10519         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
10520         // result: (MOVWstore [off1+int32(off2)] {sym} x val mem)
10521         for {
10522                 off1 := auxIntToInt32(v.AuxInt)
10523                 sym := auxToSym(v.Aux)
10524                 if v_0.Op != OpPPC64ADDconst {
10525                         break
10526                 }
10527                 off2 := auxIntToInt64(v_0.AuxInt)
10528                 x := v_0.Args[0]
10529                 val := v_1
10530                 mem := v_2
10531                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
10532                         break
10533                 }
10534                 v.reset(OpPPC64MOVWstore)
10535                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10536                 v.Aux = symToAux(sym)
10537                 v.AddArg3(x, val, mem)
10538                 return true
10539         }
10540         // match: (MOVWstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
10541         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
10542         // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
10543         for {
10544                 off1 := auxIntToInt32(v.AuxInt)
10545                 sym1 := auxToSym(v.Aux)
10546                 p := v_0
10547                 if p.Op != OpPPC64MOVDaddr {
10548                         break
10549                 }
10550                 off2 := auxIntToInt32(p.AuxInt)
10551                 sym2 := auxToSym(p.Aux)
10552                 ptr := p.Args[0]
10553                 val := v_1
10554                 mem := v_2
10555                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
10556                         break
10557                 }
10558                 v.reset(OpPPC64MOVWstore)
10559                 v.AuxInt = int32ToAuxInt(off1 + off2)
10560                 v.Aux = symToAux(mergeSym(sym1, sym2))
10561                 v.AddArg3(ptr, val, mem)
10562                 return true
10563         }
10564         // match: (MOVWstore [off] {sym} ptr (MOVDconst [0]) mem)
10565         // result: (MOVWstorezero [off] {sym} ptr mem)
10566         for {
10567                 off := auxIntToInt32(v.AuxInt)
10568                 sym := auxToSym(v.Aux)
10569                 ptr := v_0
10570                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
10571                         break
10572                 }
10573                 mem := v_2
10574                 v.reset(OpPPC64MOVWstorezero)
10575                 v.AuxInt = int32ToAuxInt(off)
10576                 v.Aux = symToAux(sym)
10577                 v.AddArg2(ptr, mem)
10578                 return true
10579         }
10580         // match: (MOVWstore [0] {sym} p:(ADD ptr idx) val mem)
10581         // cond: sym == nil && p.Uses == 1
10582         // result: (MOVWstoreidx ptr idx val mem)
10583         for {
10584                 if auxIntToInt32(v.AuxInt) != 0 {
10585                         break
10586                 }
10587                 sym := auxToSym(v.Aux)
10588                 p := v_0
10589                 if p.Op != OpPPC64ADD {
10590                         break
10591                 }
10592                 idx := p.Args[1]
10593                 ptr := p.Args[0]
10594                 val := v_1
10595                 mem := v_2
10596                 if !(sym == nil && p.Uses == 1) {
10597                         break
10598                 }
10599                 v.reset(OpPPC64MOVWstoreidx)
10600                 v.AddArg4(ptr, idx, val, mem)
10601                 return true
10602         }
10603         // match: (MOVWstore [off] {sym} ptr (MOVWreg x) mem)
10604         // result: (MOVWstore [off] {sym} ptr x mem)
10605         for {
10606                 off := auxIntToInt32(v.AuxInt)
10607                 sym := auxToSym(v.Aux)
10608                 ptr := v_0
10609                 if v_1.Op != OpPPC64MOVWreg {
10610                         break
10611                 }
10612                 x := v_1.Args[0]
10613                 mem := v_2
10614                 v.reset(OpPPC64MOVWstore)
10615                 v.AuxInt = int32ToAuxInt(off)
10616                 v.Aux = symToAux(sym)
10617                 v.AddArg3(ptr, x, mem)
10618                 return true
10619         }
10620         // match: (MOVWstore [off] {sym} ptr (MOVWZreg x) mem)
10621         // result: (MOVWstore [off] {sym} ptr x mem)
10622         for {
10623                 off := auxIntToInt32(v.AuxInt)
10624                 sym := auxToSym(v.Aux)
10625                 ptr := v_0
10626                 if v_1.Op != OpPPC64MOVWZreg {
10627                         break
10628                 }
10629                 x := v_1.Args[0]
10630                 mem := v_2
10631                 v.reset(OpPPC64MOVWstore)
10632                 v.AuxInt = int32ToAuxInt(off)
10633                 v.Aux = symToAux(sym)
10634                 v.AddArg3(ptr, x, mem)
10635                 return true
10636         }
10637         // match: (MOVWstore [off] {sym} ptr r:(BRW val) mem)
10638         // cond: r.Uses == 1
10639         // result: (MOVWBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
10640         for {
10641                 off := auxIntToInt32(v.AuxInt)
10642                 sym := auxToSym(v.Aux)
10643                 ptr := v_0
10644                 r := v_1
10645                 if r.Op != OpPPC64BRW {
10646                         break
10647                 }
10648                 val := r.Args[0]
10649                 mem := v_2
10650                 if !(r.Uses == 1) {
10651                         break
10652                 }
10653                 v.reset(OpPPC64MOVWBRstore)
10654                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
10655                 v0.AuxInt = int32ToAuxInt(off)
10656                 v0.Aux = symToAux(sym)
10657                 v0.AddArg(ptr)
10658                 v.AddArg3(v0, val, mem)
10659                 return true
10660         }
10661         // match: (MOVWstore [off] {sym} ptr (Bswap32 val) mem)
10662         // result: (MOVWBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
10663         for {
10664                 off := auxIntToInt32(v.AuxInt)
10665                 sym := auxToSym(v.Aux)
10666                 ptr := v_0
10667                 if v_1.Op != OpBswap32 {
10668                         break
10669                 }
10670                 val := v_1.Args[0]
10671                 mem := v_2
10672                 v.reset(OpPPC64MOVWBRstore)
10673                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
10674                 v0.AuxInt = int32ToAuxInt(off)
10675                 v0.Aux = symToAux(sym)
10676                 v0.AddArg(ptr)
10677                 v.AddArg3(v0, val, mem)
10678                 return true
10679         }
10680         return false
10681 }
10682 func rewriteValuePPC64_OpPPC64MOVWstoreidx(v *Value) bool {
10683         v_3 := v.Args[3]
10684         v_2 := v.Args[2]
10685         v_1 := v.Args[1]
10686         v_0 := v.Args[0]
10687         // match: (MOVWstoreidx ptr (MOVDconst [c]) val mem)
10688         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
10689         // result: (MOVWstore [int32(c)] ptr val mem)
10690         for {
10691                 ptr := v_0
10692                 if v_1.Op != OpPPC64MOVDconst {
10693                         break
10694                 }
10695                 c := auxIntToInt64(v_1.AuxInt)
10696                 val := v_2
10697                 mem := v_3
10698                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10699                         break
10700                 }
10701                 v.reset(OpPPC64MOVWstore)
10702                 v.AuxInt = int32ToAuxInt(int32(c))
10703                 v.AddArg3(ptr, val, mem)
10704                 return true
10705         }
10706         // match: (MOVWstoreidx (MOVDconst [c]) ptr val mem)
10707         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
10708         // result: (MOVWstore [int32(c)] ptr val mem)
10709         for {
10710                 if v_0.Op != OpPPC64MOVDconst {
10711                         break
10712                 }
10713                 c := auxIntToInt64(v_0.AuxInt)
10714                 ptr := v_1
10715                 val := v_2
10716                 mem := v_3
10717                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10718                         break
10719                 }
10720                 v.reset(OpPPC64MOVWstore)
10721                 v.AuxInt = int32ToAuxInt(int32(c))
10722                 v.AddArg3(ptr, val, mem)
10723                 return true
10724         }
10725         // match: (MOVWstoreidx ptr idx (MOVWreg x) mem)
10726         // result: (MOVWstoreidx ptr idx x mem)
10727         for {
10728                 ptr := v_0
10729                 idx := v_1
10730                 if v_2.Op != OpPPC64MOVWreg {
10731                         break
10732                 }
10733                 x := v_2.Args[0]
10734                 mem := v_3
10735                 v.reset(OpPPC64MOVWstoreidx)
10736                 v.AddArg4(ptr, idx, x, mem)
10737                 return true
10738         }
10739         // match: (MOVWstoreidx ptr idx (MOVWZreg x) mem)
10740         // result: (MOVWstoreidx ptr idx x mem)
10741         for {
10742                 ptr := v_0
10743                 idx := v_1
10744                 if v_2.Op != OpPPC64MOVWZreg {
10745                         break
10746                 }
10747                 x := v_2.Args[0]
10748                 mem := v_3
10749                 v.reset(OpPPC64MOVWstoreidx)
10750                 v.AddArg4(ptr, idx, x, mem)
10751                 return true
10752         }
10753         // match: (MOVWstoreidx ptr idx r:(BRW val) mem)
10754         // cond: r.Uses == 1
10755         // result: (MOVWBRstoreidx ptr idx val mem)
10756         for {
10757                 ptr := v_0
10758                 idx := v_1
10759                 r := v_2
10760                 if r.Op != OpPPC64BRW {
10761                         break
10762                 }
10763                 val := r.Args[0]
10764                 mem := v_3
10765                 if !(r.Uses == 1) {
10766                         break
10767                 }
10768                 v.reset(OpPPC64MOVWBRstoreidx)
10769                 v.AddArg4(ptr, idx, val, mem)
10770                 return true
10771         }
10772         // match: (MOVWstoreidx ptr idx (Bswap32 val) mem)
10773         // result: (MOVWBRstoreidx ptr idx val mem)
10774         for {
10775                 ptr := v_0
10776                 idx := v_1
10777                 if v_2.Op != OpBswap32 {
10778                         break
10779                 }
10780                 val := v_2.Args[0]
10781                 mem := v_3
10782                 v.reset(OpPPC64MOVWBRstoreidx)
10783                 v.AddArg4(ptr, idx, val, mem)
10784                 return true
10785         }
10786         return false
10787 }
10788 func rewriteValuePPC64_OpPPC64MOVWstorezero(v *Value) bool {
10789         v_1 := v.Args[1]
10790         v_0 := v.Args[0]
10791         // match: (MOVWstorezero [off1] {sym} (ADDconst [off2] x) mem)
10792         // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2)))
10793         // result: (MOVWstorezero [off1+int32(off2)] {sym} x mem)
10794         for {
10795                 off1 := auxIntToInt32(v.AuxInt)
10796                 sym := auxToSym(v.Aux)
10797                 if v_0.Op != OpPPC64ADDconst {
10798                         break
10799                 }
10800                 off2 := auxIntToInt64(v_0.AuxInt)
10801                 x := v_0.Args[0]
10802                 mem := v_1
10803                 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
10804                         break
10805                 }
10806                 v.reset(OpPPC64MOVWstorezero)
10807                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10808                 v.Aux = symToAux(sym)
10809                 v.AddArg2(x, mem)
10810                 return true
10811         }
10812         // match: (MOVWstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
10813         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
10814         // result: (MOVWstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
10815         for {
10816                 off1 := auxIntToInt32(v.AuxInt)
10817                 sym1 := auxToSym(v.Aux)
10818                 p := v_0
10819                 if p.Op != OpPPC64MOVDaddr {
10820                         break
10821                 }
10822                 off2 := auxIntToInt32(p.AuxInt)
10823                 sym2 := auxToSym(p.Aux)
10824                 x := p.Args[0]
10825                 mem := v_1
10826                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
10827                         break
10828                 }
10829                 v.reset(OpPPC64MOVWstorezero)
10830                 v.AuxInt = int32ToAuxInt(off1 + off2)
10831                 v.Aux = symToAux(mergeSym(sym1, sym2))
10832                 v.AddArg2(x, mem)
10833                 return true
10834         }
10835         return false
10836 }
10837 func rewriteValuePPC64_OpPPC64MTVSRD(v *Value) bool {
10838         v_0 := v.Args[0]
10839         b := v.Block
10840         typ := &b.Func.Config.Types
10841         // match: (MTVSRD (MOVDconst [c]))
10842         // cond: !math.IsNaN(math.Float64frombits(uint64(c)))
10843         // result: (FMOVDconst [math.Float64frombits(uint64(c))])
10844         for {
10845                 if v_0.Op != OpPPC64MOVDconst {
10846                         break
10847                 }
10848                 c := auxIntToInt64(v_0.AuxInt)
10849                 if !(!math.IsNaN(math.Float64frombits(uint64(c)))) {
10850                         break
10851                 }
10852                 v.reset(OpPPC64FMOVDconst)
10853                 v.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c)))
10854                 return true
10855         }
10856         // match: (MTVSRD x:(MOVDload [off] {sym} ptr mem))
10857         // cond: x.Uses == 1 && clobber(x)
10858         // result: @x.Block (FMOVDload [off] {sym} ptr mem)
10859         for {
10860                 x := v_0
10861                 if x.Op != OpPPC64MOVDload {
10862                         break
10863                 }
10864                 off := auxIntToInt32(x.AuxInt)
10865                 sym := auxToSym(x.Aux)
10866                 mem := x.Args[1]
10867                 ptr := x.Args[0]
10868                 if !(x.Uses == 1 && clobber(x)) {
10869                         break
10870                 }
10871                 b = x.Block
10872                 v0 := b.NewValue0(x.Pos, OpPPC64FMOVDload, typ.Float64)
10873                 v.copyOf(v0)
10874                 v0.AuxInt = int32ToAuxInt(off)
10875                 v0.Aux = symToAux(sym)
10876                 v0.AddArg2(ptr, mem)
10877                 return true
10878         }
10879         return false
10880 }
10881 func rewriteValuePPC64_OpPPC64MULLD(v *Value) bool {
10882         v_1 := v.Args[1]
10883         v_0 := v.Args[0]
10884         // match: (MULLD x (MOVDconst [c]))
10885         // cond: is16Bit(c)
10886         // result: (MULLDconst [int32(c)] x)
10887         for {
10888                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10889                         x := v_0
10890                         if v_1.Op != OpPPC64MOVDconst {
10891                                 continue
10892                         }
10893                         c := auxIntToInt64(v_1.AuxInt)
10894                         if !(is16Bit(c)) {
10895                                 continue
10896                         }
10897                         v.reset(OpPPC64MULLDconst)
10898                         v.AuxInt = int32ToAuxInt(int32(c))
10899                         v.AddArg(x)
10900                         return true
10901                 }
10902                 break
10903         }
10904         return false
10905 }
10906 func rewriteValuePPC64_OpPPC64MULLW(v *Value) bool {
10907         v_1 := v.Args[1]
10908         v_0 := v.Args[0]
10909         // match: (MULLW x (MOVDconst [c]))
10910         // cond: is16Bit(c)
10911         // result: (MULLWconst [int32(c)] x)
10912         for {
10913                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10914                         x := v_0
10915                         if v_1.Op != OpPPC64MOVDconst {
10916                                 continue
10917                         }
10918                         c := auxIntToInt64(v_1.AuxInt)
10919                         if !(is16Bit(c)) {
10920                                 continue
10921                         }
10922                         v.reset(OpPPC64MULLWconst)
10923                         v.AuxInt = int32ToAuxInt(int32(c))
10924                         v.AddArg(x)
10925                         return true
10926                 }
10927                 break
10928         }
10929         return false
10930 }
10931 func rewriteValuePPC64_OpPPC64NEG(v *Value) bool {
10932         v_0 := v.Args[0]
10933         // match: (NEG (ADDconst [c] x))
10934         // cond: is32Bit(-c)
10935         // result: (SUBFCconst [-c] x)
10936         for {
10937                 if v_0.Op != OpPPC64ADDconst {
10938                         break
10939                 }
10940                 c := auxIntToInt64(v_0.AuxInt)
10941                 x := v_0.Args[0]
10942                 if !(is32Bit(-c)) {
10943                         break
10944                 }
10945                 v.reset(OpPPC64SUBFCconst)
10946                 v.AuxInt = int64ToAuxInt(-c)
10947                 v.AddArg(x)
10948                 return true
10949         }
10950         // match: (NEG (SUBFCconst [c] x))
10951         // cond: is32Bit(-c)
10952         // result: (ADDconst [-c] x)
10953         for {
10954                 if v_0.Op != OpPPC64SUBFCconst {
10955                         break
10956                 }
10957                 c := auxIntToInt64(v_0.AuxInt)
10958                 x := v_0.Args[0]
10959                 if !(is32Bit(-c)) {
10960                         break
10961                 }
10962                 v.reset(OpPPC64ADDconst)
10963                 v.AuxInt = int64ToAuxInt(-c)
10964                 v.AddArg(x)
10965                 return true
10966         }
10967         // match: (NEG (SUB x y))
10968         // result: (SUB y x)
10969         for {
10970                 if v_0.Op != OpPPC64SUB {
10971                         break
10972                 }
10973                 y := v_0.Args[1]
10974                 x := v_0.Args[0]
10975                 v.reset(OpPPC64SUB)
10976                 v.AddArg2(y, x)
10977                 return true
10978         }
10979         // match: (NEG (NEG x))
10980         // result: x
10981         for {
10982                 if v_0.Op != OpPPC64NEG {
10983                         break
10984                 }
10985                 x := v_0.Args[0]
10986                 v.copyOf(x)
10987                 return true
10988         }
10989         return false
10990 }
10991 func rewriteValuePPC64_OpPPC64NOR(v *Value) bool {
10992         v_1 := v.Args[1]
10993         v_0 := v.Args[0]
10994         // match: (NOR (MOVDconst [c]) (MOVDconst [d]))
10995         // result: (MOVDconst [^(c|d)])
10996         for {
10997                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10998                         if v_0.Op != OpPPC64MOVDconst {
10999                                 continue
11000                         }
11001                         c := auxIntToInt64(v_0.AuxInt)
11002                         if v_1.Op != OpPPC64MOVDconst {
11003                                 continue
11004                         }
11005                         d := auxIntToInt64(v_1.AuxInt)
11006                         v.reset(OpPPC64MOVDconst)
11007                         v.AuxInt = int64ToAuxInt(^(c | d))
11008                         return true
11009                 }
11010                 break
11011         }
11012         return false
11013 }
11014 func rewriteValuePPC64_OpPPC64NotEqual(v *Value) bool {
11015         v_0 := v.Args[0]
11016         // match: (NotEqual (FlagEQ))
11017         // result: (MOVDconst [0])
11018         for {
11019                 if v_0.Op != OpPPC64FlagEQ {
11020                         break
11021                 }
11022                 v.reset(OpPPC64MOVDconst)
11023                 v.AuxInt = int64ToAuxInt(0)
11024                 return true
11025         }
11026         // match: (NotEqual (FlagLT))
11027         // result: (MOVDconst [1])
11028         for {
11029                 if v_0.Op != OpPPC64FlagLT {
11030                         break
11031                 }
11032                 v.reset(OpPPC64MOVDconst)
11033                 v.AuxInt = int64ToAuxInt(1)
11034                 return true
11035         }
11036         // match: (NotEqual (FlagGT))
11037         // result: (MOVDconst [1])
11038         for {
11039                 if v_0.Op != OpPPC64FlagGT {
11040                         break
11041                 }
11042                 v.reset(OpPPC64MOVDconst)
11043                 v.AuxInt = int64ToAuxInt(1)
11044                 return true
11045         }
11046         // match: (NotEqual (InvertFlags x))
11047         // result: (NotEqual x)
11048         for {
11049                 if v_0.Op != OpPPC64InvertFlags {
11050                         break
11051                 }
11052                 x := v_0.Args[0]
11053                 v.reset(OpPPC64NotEqual)
11054                 v.AddArg(x)
11055                 return true
11056         }
11057         // match: (NotEqual cmp)
11058         // result: (SETBCR [2] cmp)
11059         for {
11060                 cmp := v_0
11061                 v.reset(OpPPC64SETBCR)
11062                 v.AuxInt = int32ToAuxInt(2)
11063                 v.AddArg(cmp)
11064                 return true
11065         }
11066 }
11067 func rewriteValuePPC64_OpPPC64OR(v *Value) bool {
11068         v_1 := v.Args[1]
11069         v_0 := v.Args[0]
11070         // match: (OR x (NOR y y))
11071         // result: (ORN x y)
11072         for {
11073                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11074                         x := v_0
11075                         if v_1.Op != OpPPC64NOR {
11076                                 continue
11077                         }
11078                         y := v_1.Args[1]
11079                         if y != v_1.Args[0] {
11080                                 continue
11081                         }
11082                         v.reset(OpPPC64ORN)
11083                         v.AddArg2(x, y)
11084                         return true
11085                 }
11086                 break
11087         }
11088         // match: (OR (MOVDconst [c]) (MOVDconst [d]))
11089         // result: (MOVDconst [c|d])
11090         for {
11091                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11092                         if v_0.Op != OpPPC64MOVDconst {
11093                                 continue
11094                         }
11095                         c := auxIntToInt64(v_0.AuxInt)
11096                         if v_1.Op != OpPPC64MOVDconst {
11097                                 continue
11098                         }
11099                         d := auxIntToInt64(v_1.AuxInt)
11100                         v.reset(OpPPC64MOVDconst)
11101                         v.AuxInt = int64ToAuxInt(c | d)
11102                         return true
11103                 }
11104                 break
11105         }
11106         // match: (OR x (MOVDconst [c]))
11107         // cond: isU32Bit(c)
11108         // result: (ORconst [c] x)
11109         for {
11110                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11111                         x := v_0
11112                         if v_1.Op != OpPPC64MOVDconst {
11113                                 continue
11114                         }
11115                         c := auxIntToInt64(v_1.AuxInt)
11116                         if !(isU32Bit(c)) {
11117                                 continue
11118                         }
11119                         v.reset(OpPPC64ORconst)
11120                         v.AuxInt = int64ToAuxInt(c)
11121                         v.AddArg(x)
11122                         return true
11123                 }
11124                 break
11125         }
11126         return false
11127 }
11128 func rewriteValuePPC64_OpPPC64ORN(v *Value) bool {
11129         v_1 := v.Args[1]
11130         v_0 := v.Args[0]
11131         // match: (ORN x (MOVDconst [-1]))
11132         // result: x
11133         for {
11134                 x := v_0
11135                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
11136                         break
11137                 }
11138                 v.copyOf(x)
11139                 return true
11140         }
11141         // match: (ORN (MOVDconst [c]) (MOVDconst [d]))
11142         // result: (MOVDconst [c|^d])
11143         for {
11144                 if v_0.Op != OpPPC64MOVDconst {
11145                         break
11146                 }
11147                 c := auxIntToInt64(v_0.AuxInt)
11148                 if v_1.Op != OpPPC64MOVDconst {
11149                         break
11150                 }
11151                 d := auxIntToInt64(v_1.AuxInt)
11152                 v.reset(OpPPC64MOVDconst)
11153                 v.AuxInt = int64ToAuxInt(c | ^d)
11154                 return true
11155         }
11156         return false
11157 }
11158 func rewriteValuePPC64_OpPPC64ORconst(v *Value) bool {
11159         v_0 := v.Args[0]
11160         // match: (ORconst [c] (ORconst [d] x))
11161         // result: (ORconst [c|d] x)
11162         for {
11163                 c := auxIntToInt64(v.AuxInt)
11164                 if v_0.Op != OpPPC64ORconst {
11165                         break
11166                 }
11167                 d := auxIntToInt64(v_0.AuxInt)
11168                 x := v_0.Args[0]
11169                 v.reset(OpPPC64ORconst)
11170                 v.AuxInt = int64ToAuxInt(c | d)
11171                 v.AddArg(x)
11172                 return true
11173         }
11174         // match: (ORconst [-1] _)
11175         // result: (MOVDconst [-1])
11176         for {
11177                 if auxIntToInt64(v.AuxInt) != -1 {
11178                         break
11179                 }
11180                 v.reset(OpPPC64MOVDconst)
11181                 v.AuxInt = int64ToAuxInt(-1)
11182                 return true
11183         }
11184         // match: (ORconst [0] x)
11185         // result: x
11186         for {
11187                 if auxIntToInt64(v.AuxInt) != 0 {
11188                         break
11189                 }
11190                 x := v_0
11191                 v.copyOf(x)
11192                 return true
11193         }
11194         return false
11195 }
11196 func rewriteValuePPC64_OpPPC64ROTL(v *Value) bool {
11197         v_1 := v.Args[1]
11198         v_0 := v.Args[0]
11199         // match: (ROTL x (MOVDconst [c]))
11200         // result: (ROTLconst x [c&63])
11201         for {
11202                 x := v_0
11203                 if v_1.Op != OpPPC64MOVDconst {
11204                         break
11205                 }
11206                 c := auxIntToInt64(v_1.AuxInt)
11207                 v.reset(OpPPC64ROTLconst)
11208                 v.AuxInt = int64ToAuxInt(c & 63)
11209                 v.AddArg(x)
11210                 return true
11211         }
11212         return false
11213 }
11214 func rewriteValuePPC64_OpPPC64ROTLW(v *Value) bool {
11215         v_1 := v.Args[1]
11216         v_0 := v.Args[0]
11217         // match: (ROTLW x (MOVDconst [c]))
11218         // result: (ROTLWconst x [c&31])
11219         for {
11220                 x := v_0
11221                 if v_1.Op != OpPPC64MOVDconst {
11222                         break
11223                 }
11224                 c := auxIntToInt64(v_1.AuxInt)
11225                 v.reset(OpPPC64ROTLWconst)
11226                 v.AuxInt = int64ToAuxInt(c & 31)
11227                 v.AddArg(x)
11228                 return true
11229         }
11230         return false
11231 }
11232 func rewriteValuePPC64_OpPPC64ROTLWconst(v *Value) bool {
11233         v_0 := v.Args[0]
11234         // match: (ROTLWconst [r] (AND (MOVDconst [m]) x))
11235         // cond: isPPC64WordRotateMask(m)
11236         // result: (RLWINM [encodePPC64RotateMask(r,rotateLeft32(m,r),32)] x)
11237         for {
11238                 r := auxIntToInt64(v.AuxInt)
11239                 if v_0.Op != OpPPC64AND {
11240                         break
11241                 }
11242                 _ = v_0.Args[1]
11243                 v_0_0 := v_0.Args[0]
11244                 v_0_1 := v_0.Args[1]
11245                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
11246                         if v_0_0.Op != OpPPC64MOVDconst {
11247                                 continue
11248                         }
11249                         m := auxIntToInt64(v_0_0.AuxInt)
11250                         x := v_0_1
11251                         if !(isPPC64WordRotateMask(m)) {
11252                                 continue
11253                         }
11254                         v.reset(OpPPC64RLWINM)
11255                         v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, rotateLeft32(m, r), 32))
11256                         v.AddArg(x)
11257                         return true
11258                 }
11259                 break
11260         }
11261         // match: (ROTLWconst [r] (Select0 (ANDCCconst [m] x)))
11262         // cond: isPPC64WordRotateMask(m)
11263         // result: (RLWINM [encodePPC64RotateMask(r,rotateLeft32(m,r),32)] x)
11264         for {
11265                 r := auxIntToInt64(v.AuxInt)
11266                 if v_0.Op != OpSelect0 {
11267                         break
11268                 }
11269                 v_0_0 := v_0.Args[0]
11270                 if v_0_0.Op != OpPPC64ANDCCconst {
11271                         break
11272                 }
11273                 m := auxIntToInt64(v_0_0.AuxInt)
11274                 x := v_0_0.Args[0]
11275                 if !(isPPC64WordRotateMask(m)) {
11276                         break
11277                 }
11278                 v.reset(OpPPC64RLWINM)
11279                 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, rotateLeft32(m, r), 32))
11280                 v.AddArg(x)
11281                 return true
11282         }
11283         return false
11284 }
11285 func rewriteValuePPC64_OpPPC64SETBC(v *Value) bool {
11286         v_0 := v.Args[0]
11287         b := v.Block
11288         typ := &b.Func.Config.Types
11289         // match: (SETBC [0] (FlagLT))
11290         // result: (MOVDconst [1])
11291         for {
11292                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagLT {
11293                         break
11294                 }
11295                 v.reset(OpPPC64MOVDconst)
11296                 v.AuxInt = int64ToAuxInt(1)
11297                 return true
11298         }
11299         // match: (SETBC [0] (FlagGT))
11300         // result: (MOVDconst [0])
11301         for {
11302                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagGT {
11303                         break
11304                 }
11305                 v.reset(OpPPC64MOVDconst)
11306                 v.AuxInt = int64ToAuxInt(0)
11307                 return true
11308         }
11309         // match: (SETBC [0] (FlagEQ))
11310         // result: (MOVDconst [0])
11311         for {
11312                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagEQ {
11313                         break
11314                 }
11315                 v.reset(OpPPC64MOVDconst)
11316                 v.AuxInt = int64ToAuxInt(0)
11317                 return true
11318         }
11319         // match: (SETBC [1] (FlagGT))
11320         // result: (MOVDconst [1])
11321         for {
11322                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagGT {
11323                         break
11324                 }
11325                 v.reset(OpPPC64MOVDconst)
11326                 v.AuxInt = int64ToAuxInt(1)
11327                 return true
11328         }
11329         // match: (SETBC [1] (FlagLT))
11330         // result: (MOVDconst [0])
11331         for {
11332                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagLT {
11333                         break
11334                 }
11335                 v.reset(OpPPC64MOVDconst)
11336                 v.AuxInt = int64ToAuxInt(0)
11337                 return true
11338         }
11339         // match: (SETBC [1] (FlagEQ))
11340         // result: (MOVDconst [0])
11341         for {
11342                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagEQ {
11343                         break
11344                 }
11345                 v.reset(OpPPC64MOVDconst)
11346                 v.AuxInt = int64ToAuxInt(0)
11347                 return true
11348         }
11349         // match: (SETBC [2] (FlagEQ))
11350         // result: (MOVDconst [1])
11351         for {
11352                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagEQ {
11353                         break
11354                 }
11355                 v.reset(OpPPC64MOVDconst)
11356                 v.AuxInt = int64ToAuxInt(1)
11357                 return true
11358         }
11359         // match: (SETBC [2] (FlagLT))
11360         // result: (MOVDconst [0])
11361         for {
11362                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagLT {
11363                         break
11364                 }
11365                 v.reset(OpPPC64MOVDconst)
11366                 v.AuxInt = int64ToAuxInt(0)
11367                 return true
11368         }
11369         // match: (SETBC [2] (FlagGT))
11370         // result: (MOVDconst [0])
11371         for {
11372                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagGT {
11373                         break
11374                 }
11375                 v.reset(OpPPC64MOVDconst)
11376                 v.AuxInt = int64ToAuxInt(0)
11377                 return true
11378         }
11379         // match: (SETBC [0] (InvertFlags bool))
11380         // result: (SETBC [1] bool)
11381         for {
11382                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64InvertFlags {
11383                         break
11384                 }
11385                 bool := v_0.Args[0]
11386                 v.reset(OpPPC64SETBC)
11387                 v.AuxInt = int32ToAuxInt(1)
11388                 v.AddArg(bool)
11389                 return true
11390         }
11391         // match: (SETBC [1] (InvertFlags bool))
11392         // result: (SETBC [0] bool)
11393         for {
11394                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64InvertFlags {
11395                         break
11396                 }
11397                 bool := v_0.Args[0]
11398                 v.reset(OpPPC64SETBC)
11399                 v.AuxInt = int32ToAuxInt(0)
11400                 v.AddArg(bool)
11401                 return true
11402         }
11403         // match: (SETBC [2] (InvertFlags bool))
11404         // result: (SETBC [2] bool)
11405         for {
11406                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64InvertFlags {
11407                         break
11408                 }
11409                 bool := v_0.Args[0]
11410                 v.reset(OpPPC64SETBC)
11411                 v.AuxInt = int32ToAuxInt(2)
11412                 v.AddArg(bool)
11413                 return true
11414         }
11415         // match: (SETBC [n] (InvertFlags bool))
11416         // result: (SETBCR [n] bool)
11417         for {
11418                 n := auxIntToInt32(v.AuxInt)
11419                 if v_0.Op != OpPPC64InvertFlags {
11420                         break
11421                 }
11422                 bool := v_0.Args[0]
11423                 v.reset(OpPPC64SETBCR)
11424                 v.AuxInt = int32ToAuxInt(n)
11425                 v.AddArg(bool)
11426                 return true
11427         }
11428         // match: (SETBC [2] (CMPconst [0] (Select0 (ANDCCconst [1] z))))
11429         // result: (XORconst [1] (Select0 <typ.UInt64> (ANDCCconst [1] z )))
11430         for {
11431                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11432                         break
11433                 }
11434                 v_0_0 := v_0.Args[0]
11435                 if v_0_0.Op != OpSelect0 {
11436                         break
11437                 }
11438                 v_0_0_0 := v_0_0.Args[0]
11439                 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
11440                         break
11441                 }
11442                 z := v_0_0_0.Args[0]
11443                 v.reset(OpPPC64XORconst)
11444                 v.AuxInt = int64ToAuxInt(1)
11445                 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
11446                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11447                 v1.AuxInt = int64ToAuxInt(1)
11448                 v1.AddArg(z)
11449                 v0.AddArg(v1)
11450                 v.AddArg(v0)
11451                 return true
11452         }
11453         // match: (SETBC [2] (CMPWconst [0] (Select0 (ANDCCconst [1] z))))
11454         // result: (XORconst [1] (Select0 <typ.UInt64> (ANDCCconst [1] z )))
11455         for {
11456                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11457                         break
11458                 }
11459                 v_0_0 := v_0.Args[0]
11460                 if v_0_0.Op != OpSelect0 {
11461                         break
11462                 }
11463                 v_0_0_0 := v_0_0.Args[0]
11464                 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
11465                         break
11466                 }
11467                 z := v_0_0_0.Args[0]
11468                 v.reset(OpPPC64XORconst)
11469                 v.AuxInt = int64ToAuxInt(1)
11470                 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
11471                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11472                 v1.AuxInt = int64ToAuxInt(1)
11473                 v1.AddArg(z)
11474                 v0.AddArg(v1)
11475                 v.AddArg(v0)
11476                 return true
11477         }
11478         // match: (SETBC [2] (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
11479         // result: (SETBC [2] (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
11480         for {
11481                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11482                         break
11483                 }
11484                 v_0_0 := v_0.Args[0]
11485                 if v_0_0.Op != OpSelect0 {
11486                         break
11487                 }
11488                 v_0_0_0 := v_0_0.Args[0]
11489                 if v_0_0_0.Op != OpPPC64ANDCCconst {
11490                         break
11491                 }
11492                 n := auxIntToInt64(v_0_0_0.AuxInt)
11493                 z := v_0_0_0.Args[0]
11494                 v.reset(OpPPC64SETBC)
11495                 v.AuxInt = int32ToAuxInt(2)
11496                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11497                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11498                 v1.AuxInt = int64ToAuxInt(n)
11499                 v1.AddArg(z)
11500                 v0.AddArg(v1)
11501                 v.AddArg(v0)
11502                 return true
11503         }
11504         // match: (SETBC [2] (CMPconst [0] a:(AND y z)))
11505         // cond: a.Uses == 1
11506         // result: (SETBC [2] (Select1 <types.TypeFlags> (ANDCC y z )))
11507         for {
11508                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11509                         break
11510                 }
11511                 a := v_0.Args[0]
11512                 if a.Op != OpPPC64AND {
11513                         break
11514                 }
11515                 z := a.Args[1]
11516                 y := a.Args[0]
11517                 if !(a.Uses == 1) {
11518                         break
11519                 }
11520                 v.reset(OpPPC64SETBC)
11521                 v.AuxInt = int32ToAuxInt(2)
11522                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11523                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
11524                 v1.AddArg2(y, z)
11525                 v0.AddArg(v1)
11526                 v.AddArg(v0)
11527                 return true
11528         }
11529         // match: (SETBC [2] (CMPconst [0] o:(OR y z)))
11530         // cond: o.Uses == 1
11531         // result: (SETBC [2] (Select1 <types.TypeFlags> (ORCC y z )))
11532         for {
11533                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11534                         break
11535                 }
11536                 o := v_0.Args[0]
11537                 if o.Op != OpPPC64OR {
11538                         break
11539                 }
11540                 z := o.Args[1]
11541                 y := o.Args[0]
11542                 if !(o.Uses == 1) {
11543                         break
11544                 }
11545                 v.reset(OpPPC64SETBC)
11546                 v.AuxInt = int32ToAuxInt(2)
11547                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11548                 v1 := b.NewValue0(v.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
11549                 v1.AddArg2(y, z)
11550                 v0.AddArg(v1)
11551                 v.AddArg(v0)
11552                 return true
11553         }
11554         // match: (SETBC [2] (CMPconst [0] a:(XOR y z)))
11555         // cond: a.Uses == 1
11556         // result: (SETBC [2] (Select1 <types.TypeFlags> (XORCC y z )))
11557         for {
11558                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11559                         break
11560                 }
11561                 a := v_0.Args[0]
11562                 if a.Op != OpPPC64XOR {
11563                         break
11564                 }
11565                 z := a.Args[1]
11566                 y := a.Args[0]
11567                 if !(a.Uses == 1) {
11568                         break
11569                 }
11570                 v.reset(OpPPC64SETBC)
11571                 v.AuxInt = int32ToAuxInt(2)
11572                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11573                 v1 := b.NewValue0(v.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
11574                 v1.AddArg2(y, z)
11575                 v0.AddArg(v1)
11576                 v.AddArg(v0)
11577                 return true
11578         }
11579         return false
11580 }
11581 func rewriteValuePPC64_OpPPC64SETBCR(v *Value) bool {
11582         v_0 := v.Args[0]
11583         b := v.Block
11584         typ := &b.Func.Config.Types
11585         // match: (SETBCR [0] (FlagLT))
11586         // result: (MOVDconst [0])
11587         for {
11588                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagLT {
11589                         break
11590                 }
11591                 v.reset(OpPPC64MOVDconst)
11592                 v.AuxInt = int64ToAuxInt(0)
11593                 return true
11594         }
11595         // match: (SETBCR [0] (FlagGT))
11596         // result: (MOVDconst [1])
11597         for {
11598                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagGT {
11599                         break
11600                 }
11601                 v.reset(OpPPC64MOVDconst)
11602                 v.AuxInt = int64ToAuxInt(1)
11603                 return true
11604         }
11605         // match: (SETBCR [0] (FlagEQ))
11606         // result: (MOVDconst [1])
11607         for {
11608                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagEQ {
11609                         break
11610                 }
11611                 v.reset(OpPPC64MOVDconst)
11612                 v.AuxInt = int64ToAuxInt(1)
11613                 return true
11614         }
11615         // match: (SETBCR [1] (FlagGT))
11616         // result: (MOVDconst [0])
11617         for {
11618                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagGT {
11619                         break
11620                 }
11621                 v.reset(OpPPC64MOVDconst)
11622                 v.AuxInt = int64ToAuxInt(0)
11623                 return true
11624         }
11625         // match: (SETBCR [1] (FlagLT))
11626         // result: (MOVDconst [1])
11627         for {
11628                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagLT {
11629                         break
11630                 }
11631                 v.reset(OpPPC64MOVDconst)
11632                 v.AuxInt = int64ToAuxInt(1)
11633                 return true
11634         }
11635         // match: (SETBCR [1] (FlagEQ))
11636         // result: (MOVDconst [1])
11637         for {
11638                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagEQ {
11639                         break
11640                 }
11641                 v.reset(OpPPC64MOVDconst)
11642                 v.AuxInt = int64ToAuxInt(1)
11643                 return true
11644         }
11645         // match: (SETBCR [2] (FlagEQ))
11646         // result: (MOVDconst [0])
11647         for {
11648                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagEQ {
11649                         break
11650                 }
11651                 v.reset(OpPPC64MOVDconst)
11652                 v.AuxInt = int64ToAuxInt(0)
11653                 return true
11654         }
11655         // match: (SETBCR [2] (FlagLT))
11656         // result: (MOVDconst [1])
11657         for {
11658                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagLT {
11659                         break
11660                 }
11661                 v.reset(OpPPC64MOVDconst)
11662                 v.AuxInt = int64ToAuxInt(1)
11663                 return true
11664         }
11665         // match: (SETBCR [2] (FlagGT))
11666         // result: (MOVDconst [1])
11667         for {
11668                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagGT {
11669                         break
11670                 }
11671                 v.reset(OpPPC64MOVDconst)
11672                 v.AuxInt = int64ToAuxInt(1)
11673                 return true
11674         }
11675         // match: (SETBCR [0] (InvertFlags bool))
11676         // result: (SETBCR [1] bool)
11677         for {
11678                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64InvertFlags {
11679                         break
11680                 }
11681                 bool := v_0.Args[0]
11682                 v.reset(OpPPC64SETBCR)
11683                 v.AuxInt = int32ToAuxInt(1)
11684                 v.AddArg(bool)
11685                 return true
11686         }
11687         // match: (SETBCR [1] (InvertFlags bool))
11688         // result: (SETBCR [0] bool)
11689         for {
11690                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64InvertFlags {
11691                         break
11692                 }
11693                 bool := v_0.Args[0]
11694                 v.reset(OpPPC64SETBCR)
11695                 v.AuxInt = int32ToAuxInt(0)
11696                 v.AddArg(bool)
11697                 return true
11698         }
11699         // match: (SETBCR [2] (InvertFlags bool))
11700         // result: (SETBCR [2] bool)
11701         for {
11702                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64InvertFlags {
11703                         break
11704                 }
11705                 bool := v_0.Args[0]
11706                 v.reset(OpPPC64SETBCR)
11707                 v.AuxInt = int32ToAuxInt(2)
11708                 v.AddArg(bool)
11709                 return true
11710         }
11711         // match: (SETBCR [n] (InvertFlags bool))
11712         // result: (SETBC [n] bool)
11713         for {
11714                 n := auxIntToInt32(v.AuxInt)
11715                 if v_0.Op != OpPPC64InvertFlags {
11716                         break
11717                 }
11718                 bool := v_0.Args[0]
11719                 v.reset(OpPPC64SETBC)
11720                 v.AuxInt = int32ToAuxInt(n)
11721                 v.AddArg(bool)
11722                 return true
11723         }
11724         // match: (SETBCR [2] (CMPconst [0] (Select0 (ANDCCconst [1] z))))
11725         // result: (Select0 <typ.UInt64> (ANDCCconst [1] z ))
11726         for {
11727                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11728                         break
11729                 }
11730                 v_0_0 := v_0.Args[0]
11731                 if v_0_0.Op != OpSelect0 {
11732                         break
11733                 }
11734                 v_0_0_0 := v_0_0.Args[0]
11735                 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
11736                         break
11737                 }
11738                 z := v_0_0_0.Args[0]
11739                 v.reset(OpSelect0)
11740                 v.Type = typ.UInt64
11741                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11742                 v0.AuxInt = int64ToAuxInt(1)
11743                 v0.AddArg(z)
11744                 v.AddArg(v0)
11745                 return true
11746         }
11747         // match: (SETBCR [2] (CMPWconst [0] (Select0 (ANDCCconst [1] z))))
11748         // result: (Select0 <typ.UInt64> (ANDCCconst [1] z ))
11749         for {
11750                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11751                         break
11752                 }
11753                 v_0_0 := v_0.Args[0]
11754                 if v_0_0.Op != OpSelect0 {
11755                         break
11756                 }
11757                 v_0_0_0 := v_0_0.Args[0]
11758                 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
11759                         break
11760                 }
11761                 z := v_0_0_0.Args[0]
11762                 v.reset(OpSelect0)
11763                 v.Type = typ.UInt64
11764                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11765                 v0.AuxInt = int64ToAuxInt(1)
11766                 v0.AddArg(z)
11767                 v.AddArg(v0)
11768                 return true
11769         }
11770         // match: (SETBCR [2] (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
11771         // result: (SETBCR [2] (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
11772         for {
11773                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11774                         break
11775                 }
11776                 v_0_0 := v_0.Args[0]
11777                 if v_0_0.Op != OpSelect0 {
11778                         break
11779                 }
11780                 v_0_0_0 := v_0_0.Args[0]
11781                 if v_0_0_0.Op != OpPPC64ANDCCconst {
11782                         break
11783                 }
11784                 n := auxIntToInt64(v_0_0_0.AuxInt)
11785                 z := v_0_0_0.Args[0]
11786                 v.reset(OpPPC64SETBCR)
11787                 v.AuxInt = int32ToAuxInt(2)
11788                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11789                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11790                 v1.AuxInt = int64ToAuxInt(n)
11791                 v1.AddArg(z)
11792                 v0.AddArg(v1)
11793                 v.AddArg(v0)
11794                 return true
11795         }
11796         // match: (SETBCR [2] (CMPconst [0] a:(AND y z)))
11797         // cond: a.Uses == 1
11798         // result: (SETBCR [2] (Select1 <types.TypeFlags> (ANDCC y z )))
11799         for {
11800                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11801                         break
11802                 }
11803                 a := v_0.Args[0]
11804                 if a.Op != OpPPC64AND {
11805                         break
11806                 }
11807                 z := a.Args[1]
11808                 y := a.Args[0]
11809                 if !(a.Uses == 1) {
11810                         break
11811                 }
11812                 v.reset(OpPPC64SETBCR)
11813                 v.AuxInt = int32ToAuxInt(2)
11814                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11815                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
11816                 v1.AddArg2(y, z)
11817                 v0.AddArg(v1)
11818                 v.AddArg(v0)
11819                 return true
11820         }
11821         // match: (SETBCR [2] (CMPconst [0] o:(OR y z)))
11822         // cond: o.Uses == 1
11823         // result: (SETBCR [2] (Select1 <types.TypeFlags> (ORCC y z )))
11824         for {
11825                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11826                         break
11827                 }
11828                 o := v_0.Args[0]
11829                 if o.Op != OpPPC64OR {
11830                         break
11831                 }
11832                 z := o.Args[1]
11833                 y := o.Args[0]
11834                 if !(o.Uses == 1) {
11835                         break
11836                 }
11837                 v.reset(OpPPC64SETBCR)
11838                 v.AuxInt = int32ToAuxInt(2)
11839                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11840                 v1 := b.NewValue0(v.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
11841                 v1.AddArg2(y, z)
11842                 v0.AddArg(v1)
11843                 v.AddArg(v0)
11844                 return true
11845         }
11846         // match: (SETBCR [2] (CMPconst [0] a:(XOR y z)))
11847         // cond: a.Uses == 1
11848         // result: (SETBCR [2] (Select1 <types.TypeFlags> (XORCC y z )))
11849         for {
11850                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11851                         break
11852                 }
11853                 a := v_0.Args[0]
11854                 if a.Op != OpPPC64XOR {
11855                         break
11856                 }
11857                 z := a.Args[1]
11858                 y := a.Args[0]
11859                 if !(a.Uses == 1) {
11860                         break
11861                 }
11862                 v.reset(OpPPC64SETBCR)
11863                 v.AuxInt = int32ToAuxInt(2)
11864                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11865                 v1 := b.NewValue0(v.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
11866                 v1.AddArg2(y, z)
11867                 v0.AddArg(v1)
11868                 v.AddArg(v0)
11869                 return true
11870         }
11871         return false
11872 }
11873 func rewriteValuePPC64_OpPPC64SLD(v *Value) bool {
11874         v_1 := v.Args[1]
11875         v_0 := v.Args[0]
11876         // match: (SLD x (MOVDconst [c]))
11877         // result: (SLDconst [c&63 | (c>>6&1*63)] x)
11878         for {
11879                 x := v_0
11880                 if v_1.Op != OpPPC64MOVDconst {
11881                         break
11882                 }
11883                 c := auxIntToInt64(v_1.AuxInt)
11884                 v.reset(OpPPC64SLDconst)
11885                 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
11886                 v.AddArg(x)
11887                 return true
11888         }
11889         return false
11890 }
11891 func rewriteValuePPC64_OpPPC64SLDconst(v *Value) bool {
11892         v_0 := v.Args[0]
11893         // match: (SLDconst [l] (SRWconst [r] x))
11894         // cond: mergePPC64SldiSrw(l,r) != 0
11895         // result: (RLWINM [mergePPC64SldiSrw(l,r)] x)
11896         for {
11897                 l := auxIntToInt64(v.AuxInt)
11898                 if v_0.Op != OpPPC64SRWconst {
11899                         break
11900                 }
11901                 r := auxIntToInt64(v_0.AuxInt)
11902                 x := v_0.Args[0]
11903                 if !(mergePPC64SldiSrw(l, r) != 0) {
11904                         break
11905                 }
11906                 v.reset(OpPPC64RLWINM)
11907                 v.AuxInt = int64ToAuxInt(mergePPC64SldiSrw(l, r))
11908                 v.AddArg(x)
11909                 return true
11910         }
11911         // match: (SLDconst [c] z:(MOVBZreg x))
11912         // cond: c < 8 && z.Uses == 1
11913         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,56,63,64)] x)
11914         for {
11915                 c := auxIntToInt64(v.AuxInt)
11916                 z := v_0
11917                 if z.Op != OpPPC64MOVBZreg {
11918                         break
11919                 }
11920                 x := z.Args[0]
11921                 if !(c < 8 && z.Uses == 1) {
11922                         break
11923                 }
11924                 v.reset(OpPPC64CLRLSLDI)
11925                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 56, 63, 64))
11926                 v.AddArg(x)
11927                 return true
11928         }
11929         // match: (SLDconst [c] z:(MOVHZreg x))
11930         // cond: c < 16 && z.Uses == 1
11931         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,48,63,64)] x)
11932         for {
11933                 c := auxIntToInt64(v.AuxInt)
11934                 z := v_0
11935                 if z.Op != OpPPC64MOVHZreg {
11936                         break
11937                 }
11938                 x := z.Args[0]
11939                 if !(c < 16 && z.Uses == 1) {
11940                         break
11941                 }
11942                 v.reset(OpPPC64CLRLSLDI)
11943                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 48, 63, 64))
11944                 v.AddArg(x)
11945                 return true
11946         }
11947         // match: (SLDconst [c] z:(MOVWZreg x))
11948         // cond: c < 32 && z.Uses == 1
11949         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,32,63,64)] x)
11950         for {
11951                 c := auxIntToInt64(v.AuxInt)
11952                 z := v_0
11953                 if z.Op != OpPPC64MOVWZreg {
11954                         break
11955                 }
11956                 x := z.Args[0]
11957                 if !(c < 32 && z.Uses == 1) {
11958                         break
11959                 }
11960                 v.reset(OpPPC64CLRLSLDI)
11961                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32, 63, 64))
11962                 v.AddArg(x)
11963                 return true
11964         }
11965         // match: (SLDconst [c] z:(Select0 (ANDCCconst [d] x)))
11966         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))
11967         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,64-getPPC64ShiftMaskLength(d),63,64)] x)
11968         for {
11969                 c := auxIntToInt64(v.AuxInt)
11970                 z := v_0
11971                 if z.Op != OpSelect0 {
11972                         break
11973                 }
11974                 z_0 := z.Args[0]
11975                 if z_0.Op != OpPPC64ANDCCconst {
11976                         break
11977                 }
11978                 d := auxIntToInt64(z_0.AuxInt)
11979                 x := z_0.Args[0]
11980                 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))) {
11981                         break
11982                 }
11983                 v.reset(OpPPC64CLRLSLDI)
11984                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 64-getPPC64ShiftMaskLength(d), 63, 64))
11985                 v.AddArg(x)
11986                 return true
11987         }
11988         // match: (SLDconst [c] z:(AND (MOVDconst [d]) x))
11989         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(64-getPPC64ShiftMaskLength(d))
11990         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,64-getPPC64ShiftMaskLength(d),63,64)] x)
11991         for {
11992                 c := auxIntToInt64(v.AuxInt)
11993                 z := v_0
11994                 if z.Op != OpPPC64AND {
11995                         break
11996                 }
11997                 _ = z.Args[1]
11998                 z_0 := z.Args[0]
11999                 z_1 := z.Args[1]
12000                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
12001                         if z_0.Op != OpPPC64MOVDconst {
12002                                 continue
12003                         }
12004                         d := auxIntToInt64(z_0.AuxInt)
12005                         x := z_1
12006                         if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))) {
12007                                 continue
12008                         }
12009                         v.reset(OpPPC64CLRLSLDI)
12010                         v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 64-getPPC64ShiftMaskLength(d), 63, 64))
12011                         v.AddArg(x)
12012                         return true
12013                 }
12014                 break
12015         }
12016         // match: (SLDconst [c] z:(MOVWreg x))
12017         // cond: c < 32 && buildcfg.GOPPC64 >= 9
12018         // result: (EXTSWSLconst [c] x)
12019         for {
12020                 c := auxIntToInt64(v.AuxInt)
12021                 z := v_0
12022                 if z.Op != OpPPC64MOVWreg {
12023                         break
12024                 }
12025                 x := z.Args[0]
12026                 if !(c < 32 && buildcfg.GOPPC64 >= 9) {
12027                         break
12028                 }
12029                 v.reset(OpPPC64EXTSWSLconst)
12030                 v.AuxInt = int64ToAuxInt(c)
12031                 v.AddArg(x)
12032                 return true
12033         }
12034         return false
12035 }
12036 func rewriteValuePPC64_OpPPC64SLW(v *Value) bool {
12037         v_1 := v.Args[1]
12038         v_0 := v.Args[0]
12039         // match: (SLW x (MOVDconst [c]))
12040         // result: (SLWconst [c&31 | (c>>5&1*31)] x)
12041         for {
12042                 x := v_0
12043                 if v_1.Op != OpPPC64MOVDconst {
12044                         break
12045                 }
12046                 c := auxIntToInt64(v_1.AuxInt)
12047                 v.reset(OpPPC64SLWconst)
12048                 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
12049                 v.AddArg(x)
12050                 return true
12051         }
12052         return false
12053 }
12054 func rewriteValuePPC64_OpPPC64SLWconst(v *Value) bool {
12055         v_0 := v.Args[0]
12056         // match: (SLWconst [c] z:(MOVBZreg x))
12057         // cond: z.Uses == 1 && c < 8
12058         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,24,31,32)] x)
12059         for {
12060                 c := auxIntToInt64(v.AuxInt)
12061                 z := v_0
12062                 if z.Op != OpPPC64MOVBZreg {
12063                         break
12064                 }
12065                 x := z.Args[0]
12066                 if !(z.Uses == 1 && c < 8) {
12067                         break
12068                 }
12069                 v.reset(OpPPC64CLRLSLWI)
12070                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 24, 31, 32))
12071                 v.AddArg(x)
12072                 return true
12073         }
12074         // match: (SLWconst [c] z:(MOVHZreg x))
12075         // cond: z.Uses == 1 && c < 16
12076         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,16,31,32)] x)
12077         for {
12078                 c := auxIntToInt64(v.AuxInt)
12079                 z := v_0
12080                 if z.Op != OpPPC64MOVHZreg {
12081                         break
12082                 }
12083                 x := z.Args[0]
12084                 if !(z.Uses == 1 && c < 16) {
12085                         break
12086                 }
12087                 v.reset(OpPPC64CLRLSLWI)
12088                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 16, 31, 32))
12089                 v.AddArg(x)
12090                 return true
12091         }
12092         // match: (SLWconst [c] z:(Select0 (ANDCCconst [d] x)))
12093         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(32-getPPC64ShiftMaskLength(d))
12094         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,32-getPPC64ShiftMaskLength(d),31,32)] x)
12095         for {
12096                 c := auxIntToInt64(v.AuxInt)
12097                 z := v_0
12098                 if z.Op != OpSelect0 {
12099                         break
12100                 }
12101                 z_0 := z.Args[0]
12102                 if z_0.Op != OpPPC64ANDCCconst {
12103                         break
12104                 }
12105                 d := auxIntToInt64(z_0.AuxInt)
12106                 x := z_0.Args[0]
12107                 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (32-getPPC64ShiftMaskLength(d))) {
12108                         break
12109                 }
12110                 v.reset(OpPPC64CLRLSLWI)
12111                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32-getPPC64ShiftMaskLength(d), 31, 32))
12112                 v.AddArg(x)
12113                 return true
12114         }
12115         // match: (SLWconst [c] z:(AND (MOVDconst [d]) x))
12116         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(32-getPPC64ShiftMaskLength(d))
12117         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,32-getPPC64ShiftMaskLength(d),31,32)] x)
12118         for {
12119                 c := auxIntToInt64(v.AuxInt)
12120                 z := v_0
12121                 if z.Op != OpPPC64AND {
12122                         break
12123                 }
12124                 _ = z.Args[1]
12125                 z_0 := z.Args[0]
12126                 z_1 := z.Args[1]
12127                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
12128                         if z_0.Op != OpPPC64MOVDconst {
12129                                 continue
12130                         }
12131                         d := auxIntToInt64(z_0.AuxInt)
12132                         x := z_1
12133                         if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (32-getPPC64ShiftMaskLength(d))) {
12134                                 continue
12135                         }
12136                         v.reset(OpPPC64CLRLSLWI)
12137                         v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32-getPPC64ShiftMaskLength(d), 31, 32))
12138                         v.AddArg(x)
12139                         return true
12140                 }
12141                 break
12142         }
12143         // match: (SLWconst [c] z:(MOVWreg x))
12144         // cond: c < 32 && buildcfg.GOPPC64 >= 9
12145         // result: (EXTSWSLconst [c] x)
12146         for {
12147                 c := auxIntToInt64(v.AuxInt)
12148                 z := v_0
12149                 if z.Op != OpPPC64MOVWreg {
12150                         break
12151                 }
12152                 x := z.Args[0]
12153                 if !(c < 32 && buildcfg.GOPPC64 >= 9) {
12154                         break
12155                 }
12156                 v.reset(OpPPC64EXTSWSLconst)
12157                 v.AuxInt = int64ToAuxInt(c)
12158                 v.AddArg(x)
12159                 return true
12160         }
12161         return false
12162 }
12163 func rewriteValuePPC64_OpPPC64SRAD(v *Value) bool {
12164         v_1 := v.Args[1]
12165         v_0 := v.Args[0]
12166         // match: (SRAD x (MOVDconst [c]))
12167         // result: (SRADconst [c&63 | (c>>6&1*63)] x)
12168         for {
12169                 x := v_0
12170                 if v_1.Op != OpPPC64MOVDconst {
12171                         break
12172                 }
12173                 c := auxIntToInt64(v_1.AuxInt)
12174                 v.reset(OpPPC64SRADconst)
12175                 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
12176                 v.AddArg(x)
12177                 return true
12178         }
12179         return false
12180 }
12181 func rewriteValuePPC64_OpPPC64SRAW(v *Value) bool {
12182         v_1 := v.Args[1]
12183         v_0 := v.Args[0]
12184         // match: (SRAW x (MOVDconst [c]))
12185         // result: (SRAWconst [c&31 | (c>>5&1*31)] x)
12186         for {
12187                 x := v_0
12188                 if v_1.Op != OpPPC64MOVDconst {
12189                         break
12190                 }
12191                 c := auxIntToInt64(v_1.AuxInt)
12192                 v.reset(OpPPC64SRAWconst)
12193                 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
12194                 v.AddArg(x)
12195                 return true
12196         }
12197         return false
12198 }
12199 func rewriteValuePPC64_OpPPC64SRD(v *Value) bool {
12200         v_1 := v.Args[1]
12201         v_0 := v.Args[0]
12202         // match: (SRD x (MOVDconst [c]))
12203         // result: (SRDconst [c&63 | (c>>6&1*63)] x)
12204         for {
12205                 x := v_0
12206                 if v_1.Op != OpPPC64MOVDconst {
12207                         break
12208                 }
12209                 c := auxIntToInt64(v_1.AuxInt)
12210                 v.reset(OpPPC64SRDconst)
12211                 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
12212                 v.AddArg(x)
12213                 return true
12214         }
12215         return false
12216 }
12217 func rewriteValuePPC64_OpPPC64SRW(v *Value) bool {
12218         v_1 := v.Args[1]
12219         v_0 := v.Args[0]
12220         // match: (SRW x (MOVDconst [c]))
12221         // result: (SRWconst [c&31 | (c>>5&1*31)] x)
12222         for {
12223                 x := v_0
12224                 if v_1.Op != OpPPC64MOVDconst {
12225                         break
12226                 }
12227                 c := auxIntToInt64(v_1.AuxInt)
12228                 v.reset(OpPPC64SRWconst)
12229                 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
12230                 v.AddArg(x)
12231                 return true
12232         }
12233         return false
12234 }
12235 func rewriteValuePPC64_OpPPC64SRWconst(v *Value) bool {
12236         v_0 := v.Args[0]
12237         // match: (SRWconst (Select0 (ANDCCconst [m] x)) [s])
12238         // cond: mergePPC64RShiftMask(m>>uint(s),s,32) == 0
12239         // result: (MOVDconst [0])
12240         for {
12241                 s := auxIntToInt64(v.AuxInt)
12242                 if v_0.Op != OpSelect0 {
12243                         break
12244                 }
12245                 v_0_0 := v_0.Args[0]
12246                 if v_0_0.Op != OpPPC64ANDCCconst {
12247                         break
12248                 }
12249                 m := auxIntToInt64(v_0_0.AuxInt)
12250                 if !(mergePPC64RShiftMask(m>>uint(s), s, 32) == 0) {
12251                         break
12252                 }
12253                 v.reset(OpPPC64MOVDconst)
12254                 v.AuxInt = int64ToAuxInt(0)
12255                 return true
12256         }
12257         // match: (SRWconst (Select0 (ANDCCconst [m] x)) [s])
12258         // cond: mergePPC64AndSrwi(m>>uint(s),s) != 0
12259         // result: (RLWINM [mergePPC64AndSrwi(m>>uint(s),s)] x)
12260         for {
12261                 s := auxIntToInt64(v.AuxInt)
12262                 if v_0.Op != OpSelect0 {
12263                         break
12264                 }
12265                 v_0_0 := v_0.Args[0]
12266                 if v_0_0.Op != OpPPC64ANDCCconst {
12267                         break
12268                 }
12269                 m := auxIntToInt64(v_0_0.AuxInt)
12270                 x := v_0_0.Args[0]
12271                 if !(mergePPC64AndSrwi(m>>uint(s), s) != 0) {
12272                         break
12273                 }
12274                 v.reset(OpPPC64RLWINM)
12275                 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m>>uint(s), s))
12276                 v.AddArg(x)
12277                 return true
12278         }
12279         // match: (SRWconst (AND (MOVDconst [m]) x) [s])
12280         // cond: mergePPC64RShiftMask(m>>uint(s),s,32) == 0
12281         // result: (MOVDconst [0])
12282         for {
12283                 s := auxIntToInt64(v.AuxInt)
12284                 if v_0.Op != OpPPC64AND {
12285                         break
12286                 }
12287                 _ = v_0.Args[1]
12288                 v_0_0 := v_0.Args[0]
12289                 v_0_1 := v_0.Args[1]
12290                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
12291                         if v_0_0.Op != OpPPC64MOVDconst {
12292                                 continue
12293                         }
12294                         m := auxIntToInt64(v_0_0.AuxInt)
12295                         if !(mergePPC64RShiftMask(m>>uint(s), s, 32) == 0) {
12296                                 continue
12297                         }
12298                         v.reset(OpPPC64MOVDconst)
12299                         v.AuxInt = int64ToAuxInt(0)
12300                         return true
12301                 }
12302                 break
12303         }
12304         // match: (SRWconst (AND (MOVDconst [m]) x) [s])
12305         // cond: mergePPC64AndSrwi(m>>uint(s),s) != 0
12306         // result: (RLWINM [mergePPC64AndSrwi(m>>uint(s),s)] x)
12307         for {
12308                 s := auxIntToInt64(v.AuxInt)
12309                 if v_0.Op != OpPPC64AND {
12310                         break
12311                 }
12312                 _ = v_0.Args[1]
12313                 v_0_0 := v_0.Args[0]
12314                 v_0_1 := v_0.Args[1]
12315                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
12316                         if v_0_0.Op != OpPPC64MOVDconst {
12317                                 continue
12318                         }
12319                         m := auxIntToInt64(v_0_0.AuxInt)
12320                         x := v_0_1
12321                         if !(mergePPC64AndSrwi(m>>uint(s), s) != 0) {
12322                                 continue
12323                         }
12324                         v.reset(OpPPC64RLWINM)
12325                         v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m>>uint(s), s))
12326                         v.AddArg(x)
12327                         return true
12328                 }
12329                 break
12330         }
12331         return false
12332 }
12333 func rewriteValuePPC64_OpPPC64SUB(v *Value) bool {
12334         v_1 := v.Args[1]
12335         v_0 := v.Args[0]
12336         // match: (SUB x (MOVDconst [c]))
12337         // cond: is32Bit(-c)
12338         // result: (ADDconst [-c] x)
12339         for {
12340                 x := v_0
12341                 if v_1.Op != OpPPC64MOVDconst {
12342                         break
12343                 }
12344                 c := auxIntToInt64(v_1.AuxInt)
12345                 if !(is32Bit(-c)) {
12346                         break
12347                 }
12348                 v.reset(OpPPC64ADDconst)
12349                 v.AuxInt = int64ToAuxInt(-c)
12350                 v.AddArg(x)
12351                 return true
12352         }
12353         // match: (SUB (MOVDconst [c]) x)
12354         // cond: is32Bit(c)
12355         // result: (SUBFCconst [c] x)
12356         for {
12357                 if v_0.Op != OpPPC64MOVDconst {
12358                         break
12359                 }
12360                 c := auxIntToInt64(v_0.AuxInt)
12361                 x := v_1
12362                 if !(is32Bit(c)) {
12363                         break
12364                 }
12365                 v.reset(OpPPC64SUBFCconst)
12366                 v.AuxInt = int64ToAuxInt(c)
12367                 v.AddArg(x)
12368                 return true
12369         }
12370         return false
12371 }
12372 func rewriteValuePPC64_OpPPC64SUBE(v *Value) bool {
12373         v_2 := v.Args[2]
12374         v_1 := v.Args[1]
12375         v_0 := v.Args[0]
12376         b := v.Block
12377         typ := &b.Func.Config.Types
12378         // match: (SUBE x y (Select1 <typ.UInt64> (SUBCconst (MOVDconst [0]) [0])))
12379         // result: (SUBC x y)
12380         for {
12381                 x := v_0
12382                 y := v_1
12383                 if v_2.Op != OpSelect1 || v_2.Type != typ.UInt64 {
12384                         break
12385                 }
12386                 v_2_0 := v_2.Args[0]
12387                 if v_2_0.Op != OpPPC64SUBCconst || auxIntToInt64(v_2_0.AuxInt) != 0 {
12388                         break
12389                 }
12390                 v_2_0_0 := v_2_0.Args[0]
12391                 if v_2_0_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 {
12392                         break
12393                 }
12394                 v.reset(OpPPC64SUBC)
12395                 v.AddArg2(x, y)
12396                 return true
12397         }
12398         return false
12399 }
12400 func rewriteValuePPC64_OpPPC64SUBFCconst(v *Value) bool {
12401         v_0 := v.Args[0]
12402         // match: (SUBFCconst [c] (NEG x))
12403         // result: (ADDconst [c] x)
12404         for {
12405                 c := auxIntToInt64(v.AuxInt)
12406                 if v_0.Op != OpPPC64NEG {
12407                         break
12408                 }
12409                 x := v_0.Args[0]
12410                 v.reset(OpPPC64ADDconst)
12411                 v.AuxInt = int64ToAuxInt(c)
12412                 v.AddArg(x)
12413                 return true
12414         }
12415         // match: (SUBFCconst [c] (SUBFCconst [d] x))
12416         // cond: is32Bit(c-d)
12417         // result: (ADDconst [c-d] x)
12418         for {
12419                 c := auxIntToInt64(v.AuxInt)
12420                 if v_0.Op != OpPPC64SUBFCconst {
12421                         break
12422                 }
12423                 d := auxIntToInt64(v_0.AuxInt)
12424                 x := v_0.Args[0]
12425                 if !(is32Bit(c - d)) {
12426                         break
12427                 }
12428                 v.reset(OpPPC64ADDconst)
12429                 v.AuxInt = int64ToAuxInt(c - d)
12430                 v.AddArg(x)
12431                 return true
12432         }
12433         // match: (SUBFCconst [0] x)
12434         // result: (NEG x)
12435         for {
12436                 if auxIntToInt64(v.AuxInt) != 0 {
12437                         break
12438                 }
12439                 x := v_0
12440                 v.reset(OpPPC64NEG)
12441                 v.AddArg(x)
12442                 return true
12443         }
12444         return false
12445 }
12446 func rewriteValuePPC64_OpPPC64XOR(v *Value) bool {
12447         v_1 := v.Args[1]
12448         v_0 := v.Args[0]
12449         // match: (XOR (MOVDconst [c]) (MOVDconst [d]))
12450         // result: (MOVDconst [c^d])
12451         for {
12452                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12453                         if v_0.Op != OpPPC64MOVDconst {
12454                                 continue
12455                         }
12456                         c := auxIntToInt64(v_0.AuxInt)
12457                         if v_1.Op != OpPPC64MOVDconst {
12458                                 continue
12459                         }
12460                         d := auxIntToInt64(v_1.AuxInt)
12461                         v.reset(OpPPC64MOVDconst)
12462                         v.AuxInt = int64ToAuxInt(c ^ d)
12463                         return true
12464                 }
12465                 break
12466         }
12467         // match: (XOR x (MOVDconst [c]))
12468         // cond: isU32Bit(c)
12469         // result: (XORconst [c] x)
12470         for {
12471                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12472                         x := v_0
12473                         if v_1.Op != OpPPC64MOVDconst {
12474                                 continue
12475                         }
12476                         c := auxIntToInt64(v_1.AuxInt)
12477                         if !(isU32Bit(c)) {
12478                                 continue
12479                         }
12480                         v.reset(OpPPC64XORconst)
12481                         v.AuxInt = int64ToAuxInt(c)
12482                         v.AddArg(x)
12483                         return true
12484                 }
12485                 break
12486         }
12487         return false
12488 }
12489 func rewriteValuePPC64_OpPPC64XORconst(v *Value) bool {
12490         v_0 := v.Args[0]
12491         // match: (XORconst [c] (XORconst [d] x))
12492         // result: (XORconst [c^d] x)
12493         for {
12494                 c := auxIntToInt64(v.AuxInt)
12495                 if v_0.Op != OpPPC64XORconst {
12496                         break
12497                 }
12498                 d := auxIntToInt64(v_0.AuxInt)
12499                 x := v_0.Args[0]
12500                 v.reset(OpPPC64XORconst)
12501                 v.AuxInt = int64ToAuxInt(c ^ d)
12502                 v.AddArg(x)
12503                 return true
12504         }
12505         // match: (XORconst [0] x)
12506         // result: x
12507         for {
12508                 if auxIntToInt64(v.AuxInt) != 0 {
12509                         break
12510                 }
12511                 x := v_0
12512                 v.copyOf(x)
12513                 return true
12514         }
12515         // match: (XORconst [1] (SETBCR [n] cmp))
12516         // result: (SETBC [n] cmp)
12517         for {
12518                 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpPPC64SETBCR {
12519                         break
12520                 }
12521                 n := auxIntToInt32(v_0.AuxInt)
12522                 cmp := v_0.Args[0]
12523                 v.reset(OpPPC64SETBC)
12524                 v.AuxInt = int32ToAuxInt(n)
12525                 v.AddArg(cmp)
12526                 return true
12527         }
12528         // match: (XORconst [1] (SETBC [n] cmp))
12529         // result: (SETBCR [n] cmp)
12530         for {
12531                 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpPPC64SETBC {
12532                         break
12533                 }
12534                 n := auxIntToInt32(v_0.AuxInt)
12535                 cmp := v_0.Args[0]
12536                 v.reset(OpPPC64SETBCR)
12537                 v.AuxInt = int32ToAuxInt(n)
12538                 v.AddArg(cmp)
12539                 return true
12540         }
12541         return false
12542 }
12543 func rewriteValuePPC64_OpPanicBounds(v *Value) bool {
12544         v_2 := v.Args[2]
12545         v_1 := v.Args[1]
12546         v_0 := v.Args[0]
12547         // match: (PanicBounds [kind] x y mem)
12548         // cond: boundsABI(kind) == 0
12549         // result: (LoweredPanicBoundsA [kind] x y mem)
12550         for {
12551                 kind := auxIntToInt64(v.AuxInt)
12552                 x := v_0
12553                 y := v_1
12554                 mem := v_2
12555                 if !(boundsABI(kind) == 0) {
12556                         break
12557                 }
12558                 v.reset(OpPPC64LoweredPanicBoundsA)
12559                 v.AuxInt = int64ToAuxInt(kind)
12560                 v.AddArg3(x, y, mem)
12561                 return true
12562         }
12563         // match: (PanicBounds [kind] x y mem)
12564         // cond: boundsABI(kind) == 1
12565         // result: (LoweredPanicBoundsB [kind] x y mem)
12566         for {
12567                 kind := auxIntToInt64(v.AuxInt)
12568                 x := v_0
12569                 y := v_1
12570                 mem := v_2
12571                 if !(boundsABI(kind) == 1) {
12572                         break
12573                 }
12574                 v.reset(OpPPC64LoweredPanicBoundsB)
12575                 v.AuxInt = int64ToAuxInt(kind)
12576                 v.AddArg3(x, y, mem)
12577                 return true
12578         }
12579         // match: (PanicBounds [kind] x y mem)
12580         // cond: boundsABI(kind) == 2
12581         // result: (LoweredPanicBoundsC [kind] x y mem)
12582         for {
12583                 kind := auxIntToInt64(v.AuxInt)
12584                 x := v_0
12585                 y := v_1
12586                 mem := v_2
12587                 if !(boundsABI(kind) == 2) {
12588                         break
12589                 }
12590                 v.reset(OpPPC64LoweredPanicBoundsC)
12591                 v.AuxInt = int64ToAuxInt(kind)
12592                 v.AddArg3(x, y, mem)
12593                 return true
12594         }
12595         return false
12596 }
12597 func rewriteValuePPC64_OpPopCount16(v *Value) bool {
12598         v_0 := v.Args[0]
12599         b := v.Block
12600         typ := &b.Func.Config.Types
12601         // match: (PopCount16 x)
12602         // result: (POPCNTW (MOVHZreg x))
12603         for {
12604                 x := v_0
12605                 v.reset(OpPPC64POPCNTW)
12606                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12607                 v0.AddArg(x)
12608                 v.AddArg(v0)
12609                 return true
12610         }
12611 }
12612 func rewriteValuePPC64_OpPopCount32(v *Value) bool {
12613         v_0 := v.Args[0]
12614         b := v.Block
12615         typ := &b.Func.Config.Types
12616         // match: (PopCount32 x)
12617         // result: (POPCNTW (MOVWZreg x))
12618         for {
12619                 x := v_0
12620                 v.reset(OpPPC64POPCNTW)
12621                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
12622                 v0.AddArg(x)
12623                 v.AddArg(v0)
12624                 return true
12625         }
12626 }
12627 func rewriteValuePPC64_OpPopCount8(v *Value) bool {
12628         v_0 := v.Args[0]
12629         b := v.Block
12630         typ := &b.Func.Config.Types
12631         // match: (PopCount8 x)
12632         // result: (POPCNTB (MOVBZreg x))
12633         for {
12634                 x := v_0
12635                 v.reset(OpPPC64POPCNTB)
12636                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
12637                 v0.AddArg(x)
12638                 v.AddArg(v0)
12639                 return true
12640         }
12641 }
12642 func rewriteValuePPC64_OpPrefetchCache(v *Value) bool {
12643         v_1 := v.Args[1]
12644         v_0 := v.Args[0]
12645         // match: (PrefetchCache ptr mem)
12646         // result: (DCBT ptr mem [0])
12647         for {
12648                 ptr := v_0
12649                 mem := v_1
12650                 v.reset(OpPPC64DCBT)
12651                 v.AuxInt = int64ToAuxInt(0)
12652                 v.AddArg2(ptr, mem)
12653                 return true
12654         }
12655 }
12656 func rewriteValuePPC64_OpPrefetchCacheStreamed(v *Value) bool {
12657         v_1 := v.Args[1]
12658         v_0 := v.Args[0]
12659         // match: (PrefetchCacheStreamed ptr mem)
12660         // result: (DCBT ptr mem [16])
12661         for {
12662                 ptr := v_0
12663                 mem := v_1
12664                 v.reset(OpPPC64DCBT)
12665                 v.AuxInt = int64ToAuxInt(16)
12666                 v.AddArg2(ptr, mem)
12667                 return true
12668         }
12669 }
12670 func rewriteValuePPC64_OpRotateLeft16(v *Value) bool {
12671         v_1 := v.Args[1]
12672         v_0 := v.Args[0]
12673         b := v.Block
12674         typ := &b.Func.Config.Types
12675         // match: (RotateLeft16 <t> x (MOVDconst [c]))
12676         // result: (Or16 (Lsh16x64 <t> x (MOVDconst [c&15])) (Rsh16Ux64 <t> x (MOVDconst [-c&15])))
12677         for {
12678                 t := v.Type
12679                 x := v_0
12680                 if v_1.Op != OpPPC64MOVDconst {
12681                         break
12682                 }
12683                 c := auxIntToInt64(v_1.AuxInt)
12684                 v.reset(OpOr16)
12685                 v0 := b.NewValue0(v.Pos, OpLsh16x64, t)
12686                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12687                 v1.AuxInt = int64ToAuxInt(c & 15)
12688                 v0.AddArg2(x, v1)
12689                 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t)
12690                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12691                 v3.AuxInt = int64ToAuxInt(-c & 15)
12692                 v2.AddArg2(x, v3)
12693                 v.AddArg2(v0, v2)
12694                 return true
12695         }
12696         return false
12697 }
12698 func rewriteValuePPC64_OpRotateLeft8(v *Value) bool {
12699         v_1 := v.Args[1]
12700         v_0 := v.Args[0]
12701         b := v.Block
12702         typ := &b.Func.Config.Types
12703         // match: (RotateLeft8 <t> x (MOVDconst [c]))
12704         // result: (Or8 (Lsh8x64 <t> x (MOVDconst [c&7])) (Rsh8Ux64 <t> x (MOVDconst [-c&7])))
12705         for {
12706                 t := v.Type
12707                 x := v_0
12708                 if v_1.Op != OpPPC64MOVDconst {
12709                         break
12710                 }
12711                 c := auxIntToInt64(v_1.AuxInt)
12712                 v.reset(OpOr8)
12713                 v0 := b.NewValue0(v.Pos, OpLsh8x64, t)
12714                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12715                 v1.AuxInt = int64ToAuxInt(c & 7)
12716                 v0.AddArg2(x, v1)
12717                 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t)
12718                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12719                 v3.AuxInt = int64ToAuxInt(-c & 7)
12720                 v2.AddArg2(x, v3)
12721                 v.AddArg2(v0, v2)
12722                 return true
12723         }
12724         return false
12725 }
12726 func rewriteValuePPC64_OpRsh16Ux16(v *Value) bool {
12727         v_1 := v.Args[1]
12728         v_0 := v.Args[0]
12729         b := v.Block
12730         typ := &b.Func.Config.Types
12731         // match: (Rsh16Ux16 x y)
12732         // cond: shiftIsBounded(v)
12733         // result: (SRD (MOVHZreg x) y)
12734         for {
12735                 x := v_0
12736                 y := v_1
12737                 if !(shiftIsBounded(v)) {
12738                         break
12739                 }
12740                 v.reset(OpPPC64SRD)
12741                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12742                 v0.AddArg(x)
12743                 v.AddArg2(v0, y)
12744                 return true
12745         }
12746         // match: (Rsh16Ux16 <t> x y)
12747         // result: (ISEL [2] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y)))
12748         for {
12749                 t := v.Type
12750                 x := v_0
12751                 y := v_1
12752                 v.reset(OpPPC64ISEL)
12753                 v.AuxInt = int32ToAuxInt(2)
12754                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
12755                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12756                 v1.AddArg(x)
12757                 v0.AddArg2(v1, y)
12758                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12759                 v2.AuxInt = int64ToAuxInt(0)
12760                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
12761                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
12762                 v4.AuxInt = int64ToAuxInt(0xFFF0)
12763                 v4.AddArg(y)
12764                 v3.AddArg(v4)
12765                 v.AddArg3(v0, v2, v3)
12766                 return true
12767         }
12768 }
12769 func rewriteValuePPC64_OpRsh16Ux32(v *Value) bool {
12770         v_1 := v.Args[1]
12771         v_0 := v.Args[0]
12772         b := v.Block
12773         typ := &b.Func.Config.Types
12774         // match: (Rsh16Ux32 x y)
12775         // cond: shiftIsBounded(v)
12776         // result: (SRD (MOVHZreg x) y)
12777         for {
12778                 x := v_0
12779                 y := v_1
12780                 if !(shiftIsBounded(v)) {
12781                         break
12782                 }
12783                 v.reset(OpPPC64SRD)
12784                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12785                 v0.AddArg(x)
12786                 v.AddArg2(v0, y)
12787                 return true
12788         }
12789         // match: (Rsh16Ux32 <t> x y)
12790         // result: (ISEL [0] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [16]))
12791         for {
12792                 t := v.Type
12793                 x := v_0
12794                 y := v_1
12795                 v.reset(OpPPC64ISEL)
12796                 v.AuxInt = int32ToAuxInt(0)
12797                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
12798                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12799                 v1.AddArg(x)
12800                 v0.AddArg2(v1, y)
12801                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12802                 v2.AuxInt = int64ToAuxInt(0)
12803                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
12804                 v3.AuxInt = int32ToAuxInt(16)
12805                 v3.AddArg(y)
12806                 v.AddArg3(v0, v2, v3)
12807                 return true
12808         }
12809 }
12810 func rewriteValuePPC64_OpRsh16Ux64(v *Value) bool {
12811         v_1 := v.Args[1]
12812         v_0 := v.Args[0]
12813         b := v.Block
12814         typ := &b.Func.Config.Types
12815         // match: (Rsh16Ux64 x (MOVDconst [c]))
12816         // cond: uint64(c) < 16
12817         // result: (SRWconst (ZeroExt16to32 x) [c])
12818         for {
12819                 x := v_0
12820                 if v_1.Op != OpPPC64MOVDconst {
12821                         break
12822                 }
12823                 c := auxIntToInt64(v_1.AuxInt)
12824                 if !(uint64(c) < 16) {
12825                         break
12826                 }
12827                 v.reset(OpPPC64SRWconst)
12828                 v.AuxInt = int64ToAuxInt(c)
12829                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
12830                 v0.AddArg(x)
12831                 v.AddArg(v0)
12832                 return true
12833         }
12834         // match: (Rsh16Ux64 x y)
12835         // cond: shiftIsBounded(v)
12836         // result: (SRD (MOVHZreg x) y)
12837         for {
12838                 x := v_0
12839                 y := v_1
12840                 if !(shiftIsBounded(v)) {
12841                         break
12842                 }
12843                 v.reset(OpPPC64SRD)
12844                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12845                 v0.AddArg(x)
12846                 v.AddArg2(v0, y)
12847                 return true
12848         }
12849         // match: (Rsh16Ux64 <t> x y)
12850         // result: (ISEL [0] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [16]))
12851         for {
12852                 t := v.Type
12853                 x := v_0
12854                 y := v_1
12855                 v.reset(OpPPC64ISEL)
12856                 v.AuxInt = int32ToAuxInt(0)
12857                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
12858                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12859                 v1.AddArg(x)
12860                 v0.AddArg2(v1, y)
12861                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12862                 v2.AuxInt = int64ToAuxInt(0)
12863                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
12864                 v3.AuxInt = int64ToAuxInt(16)
12865                 v3.AddArg(y)
12866                 v.AddArg3(v0, v2, v3)
12867                 return true
12868         }
12869 }
12870 func rewriteValuePPC64_OpRsh16Ux8(v *Value) bool {
12871         v_1 := v.Args[1]
12872         v_0 := v.Args[0]
12873         b := v.Block
12874         typ := &b.Func.Config.Types
12875         // match: (Rsh16Ux8 x y)
12876         // cond: shiftIsBounded(v)
12877         // result: (SRD (MOVHZreg x) y)
12878         for {
12879                 x := v_0
12880                 y := v_1
12881                 if !(shiftIsBounded(v)) {
12882                         break
12883                 }
12884                 v.reset(OpPPC64SRD)
12885                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12886                 v0.AddArg(x)
12887                 v.AddArg2(v0, y)
12888                 return true
12889         }
12890         // match: (Rsh16Ux8 <t> x y)
12891         // result: (ISEL [2] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y)))
12892         for {
12893                 t := v.Type
12894                 x := v_0
12895                 y := v_1
12896                 v.reset(OpPPC64ISEL)
12897                 v.AuxInt = int32ToAuxInt(2)
12898                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
12899                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12900                 v1.AddArg(x)
12901                 v0.AddArg2(v1, y)
12902                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12903                 v2.AuxInt = int64ToAuxInt(0)
12904                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
12905                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
12906                 v4.AuxInt = int64ToAuxInt(0x00F0)
12907                 v4.AddArg(y)
12908                 v3.AddArg(v4)
12909                 v.AddArg3(v0, v2, v3)
12910                 return true
12911         }
12912 }
12913 func rewriteValuePPC64_OpRsh16x16(v *Value) bool {
12914         v_1 := v.Args[1]
12915         v_0 := v.Args[0]
12916         b := v.Block
12917         typ := &b.Func.Config.Types
12918         // match: (Rsh16x16 x y)
12919         // cond: shiftIsBounded(v)
12920         // result: (SRAD (MOVHreg x) y)
12921         for {
12922                 x := v_0
12923                 y := v_1
12924                 if !(shiftIsBounded(v)) {
12925                         break
12926                 }
12927                 v.reset(OpPPC64SRAD)
12928                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
12929                 v0.AddArg(x)
12930                 v.AddArg2(v0, y)
12931                 return true
12932         }
12933         // match: (Rsh16x16 <t> x y)
12934         // result: (ISEL [2] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y)))
12935         for {
12936                 t := v.Type
12937                 x := v_0
12938                 y := v_1
12939                 v.reset(OpPPC64ISEL)
12940                 v.AuxInt = int32ToAuxInt(2)
12941                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
12942                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
12943                 v1.AddArg(x)
12944                 v0.AddArg2(v1, y)
12945                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
12946                 v2.AuxInt = int64ToAuxInt(15)
12947                 v2.AddArg(v1)
12948                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
12949                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
12950                 v4.AuxInt = int64ToAuxInt(0xFFF0)
12951                 v4.AddArg(y)
12952                 v3.AddArg(v4)
12953                 v.AddArg3(v0, v2, v3)
12954                 return true
12955         }
12956 }
12957 func rewriteValuePPC64_OpRsh16x32(v *Value) bool {
12958         v_1 := v.Args[1]
12959         v_0 := v.Args[0]
12960         b := v.Block
12961         typ := &b.Func.Config.Types
12962         // match: (Rsh16x32 x y)
12963         // cond: shiftIsBounded(v)
12964         // result: (SRAD (MOVHreg x) y)
12965         for {
12966                 x := v_0
12967                 y := v_1
12968                 if !(shiftIsBounded(v)) {
12969                         break
12970                 }
12971                 v.reset(OpPPC64SRAD)
12972                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
12973                 v0.AddArg(x)
12974                 v.AddArg2(v0, y)
12975                 return true
12976         }
12977         // match: (Rsh16x32 <t> x y)
12978         // result: (ISEL [0] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (CMPWUconst y [16]))
12979         for {
12980                 t := v.Type
12981                 x := v_0
12982                 y := v_1
12983                 v.reset(OpPPC64ISEL)
12984                 v.AuxInt = int32ToAuxInt(0)
12985                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
12986                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
12987                 v1.AddArg(x)
12988                 v0.AddArg2(v1, y)
12989                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
12990                 v2.AuxInt = int64ToAuxInt(15)
12991                 v2.AddArg(v1)
12992                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
12993                 v3.AuxInt = int32ToAuxInt(16)
12994                 v3.AddArg(y)
12995                 v.AddArg3(v0, v2, v3)
12996                 return true
12997         }
12998 }
12999 func rewriteValuePPC64_OpRsh16x64(v *Value) bool {
13000         v_1 := v.Args[1]
13001         v_0 := v.Args[0]
13002         b := v.Block
13003         typ := &b.Func.Config.Types
13004         // match: (Rsh16x64 x (MOVDconst [c]))
13005         // cond: uint64(c) >= 16
13006         // result: (SRAWconst (SignExt16to32 x) [63])
13007         for {
13008                 x := v_0
13009                 if v_1.Op != OpPPC64MOVDconst {
13010                         break
13011                 }
13012                 c := auxIntToInt64(v_1.AuxInt)
13013                 if !(uint64(c) >= 16) {
13014                         break
13015                 }
13016                 v.reset(OpPPC64SRAWconst)
13017                 v.AuxInt = int64ToAuxInt(63)
13018                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
13019                 v0.AddArg(x)
13020                 v.AddArg(v0)
13021                 return true
13022         }
13023         // match: (Rsh16x64 x (MOVDconst [c]))
13024         // cond: uint64(c) < 16
13025         // result: (SRAWconst (SignExt16to32 x) [c])
13026         for {
13027                 x := v_0
13028                 if v_1.Op != OpPPC64MOVDconst {
13029                         break
13030                 }
13031                 c := auxIntToInt64(v_1.AuxInt)
13032                 if !(uint64(c) < 16) {
13033                         break
13034                 }
13035                 v.reset(OpPPC64SRAWconst)
13036                 v.AuxInt = int64ToAuxInt(c)
13037                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
13038                 v0.AddArg(x)
13039                 v.AddArg(v0)
13040                 return true
13041         }
13042         // match: (Rsh16x64 x y)
13043         // cond: shiftIsBounded(v)
13044         // result: (SRAD (MOVHreg x) y)
13045         for {
13046                 x := v_0
13047                 y := v_1
13048                 if !(shiftIsBounded(v)) {
13049                         break
13050                 }
13051                 v.reset(OpPPC64SRAD)
13052                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13053                 v0.AddArg(x)
13054                 v.AddArg2(v0, y)
13055                 return true
13056         }
13057         // match: (Rsh16x64 <t> x y)
13058         // result: (ISEL [0] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (CMPUconst y [16]))
13059         for {
13060                 t := v.Type
13061                 x := v_0
13062                 y := v_1
13063                 v.reset(OpPPC64ISEL)
13064                 v.AuxInt = int32ToAuxInt(0)
13065                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13066                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13067                 v1.AddArg(x)
13068                 v0.AddArg2(v1, y)
13069                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13070                 v2.AuxInt = int64ToAuxInt(15)
13071                 v2.AddArg(v1)
13072                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13073                 v3.AuxInt = int64ToAuxInt(16)
13074                 v3.AddArg(y)
13075                 v.AddArg3(v0, v2, v3)
13076                 return true
13077         }
13078 }
13079 func rewriteValuePPC64_OpRsh16x8(v *Value) bool {
13080         v_1 := v.Args[1]
13081         v_0 := v.Args[0]
13082         b := v.Block
13083         typ := &b.Func.Config.Types
13084         // match: (Rsh16x8 x y)
13085         // cond: shiftIsBounded(v)
13086         // result: (SRAD (MOVHreg x) y)
13087         for {
13088                 x := v_0
13089                 y := v_1
13090                 if !(shiftIsBounded(v)) {
13091                         break
13092                 }
13093                 v.reset(OpPPC64SRAD)
13094                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13095                 v0.AddArg(x)
13096                 v.AddArg2(v0, y)
13097                 return true
13098         }
13099         // match: (Rsh16x8 <t> x y)
13100         // result: (ISEL [2] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y)))
13101         for {
13102                 t := v.Type
13103                 x := v_0
13104                 y := v_1
13105                 v.reset(OpPPC64ISEL)
13106                 v.AuxInt = int32ToAuxInt(2)
13107                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13108                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13109                 v1.AddArg(x)
13110                 v0.AddArg2(v1, y)
13111                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13112                 v2.AuxInt = int64ToAuxInt(15)
13113                 v2.AddArg(v1)
13114                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13115                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13116                 v4.AuxInt = int64ToAuxInt(0x00F0)
13117                 v4.AddArg(y)
13118                 v3.AddArg(v4)
13119                 v.AddArg3(v0, v2, v3)
13120                 return true
13121         }
13122 }
13123 func rewriteValuePPC64_OpRsh32Ux16(v *Value) bool {
13124         v_1 := v.Args[1]
13125         v_0 := v.Args[0]
13126         b := v.Block
13127         typ := &b.Func.Config.Types
13128         // match: (Rsh32Ux16 x y)
13129         // cond: shiftIsBounded(v)
13130         // result: (SRW x y)
13131         for {
13132                 x := v_0
13133                 y := v_1
13134                 if !(shiftIsBounded(v)) {
13135                         break
13136                 }
13137                 v.reset(OpPPC64SRW)
13138                 v.AddArg2(x, y)
13139                 return true
13140         }
13141         // match: (Rsh32Ux16 <t> x y)
13142         // result: (ISEL [2] (SRW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y)))
13143         for {
13144                 t := v.Type
13145                 x := v_0
13146                 y := v_1
13147                 v.reset(OpPPC64ISEL)
13148                 v.AuxInt = int32ToAuxInt(2)
13149                 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
13150                 v0.AddArg2(x, y)
13151                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13152                 v1.AuxInt = int64ToAuxInt(0)
13153                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13154                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13155                 v3.AuxInt = int64ToAuxInt(0xFFE0)
13156                 v3.AddArg(y)
13157                 v2.AddArg(v3)
13158                 v.AddArg3(v0, v1, v2)
13159                 return true
13160         }
13161 }
13162 func rewriteValuePPC64_OpRsh32Ux32(v *Value) bool {
13163         v_1 := v.Args[1]
13164         v_0 := v.Args[0]
13165         b := v.Block
13166         typ := &b.Func.Config.Types
13167         // match: (Rsh32Ux32 x y)
13168         // cond: shiftIsBounded(v)
13169         // result: (SRW x y)
13170         for {
13171                 x := v_0
13172                 y := v_1
13173                 if !(shiftIsBounded(v)) {
13174                         break
13175                 }
13176                 v.reset(OpPPC64SRW)
13177                 v.AddArg2(x, y)
13178                 return true
13179         }
13180         // match: (Rsh32Ux32 <t> x y)
13181         // result: (ISEL [0] (SRW <t> x y) (MOVDconst [0]) (CMPWUconst y [32]))
13182         for {
13183                 t := v.Type
13184                 x := v_0
13185                 y := v_1
13186                 v.reset(OpPPC64ISEL)
13187                 v.AuxInt = int32ToAuxInt(0)
13188                 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
13189                 v0.AddArg2(x, y)
13190                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13191                 v1.AuxInt = int64ToAuxInt(0)
13192                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13193                 v2.AuxInt = int32ToAuxInt(32)
13194                 v2.AddArg(y)
13195                 v.AddArg3(v0, v1, v2)
13196                 return true
13197         }
13198 }
13199 func rewriteValuePPC64_OpRsh32Ux64(v *Value) bool {
13200         v_1 := v.Args[1]
13201         v_0 := v.Args[0]
13202         b := v.Block
13203         typ := &b.Func.Config.Types
13204         // match: (Rsh32Ux64 x (MOVDconst [c]))
13205         // cond: uint64(c) < 32
13206         // result: (SRWconst x [c])
13207         for {
13208                 x := v_0
13209                 if v_1.Op != OpPPC64MOVDconst {
13210                         break
13211                 }
13212                 c := auxIntToInt64(v_1.AuxInt)
13213                 if !(uint64(c) < 32) {
13214                         break
13215                 }
13216                 v.reset(OpPPC64SRWconst)
13217                 v.AuxInt = int64ToAuxInt(c)
13218                 v.AddArg(x)
13219                 return true
13220         }
13221         // match: (Rsh32Ux64 x y)
13222         // cond: shiftIsBounded(v)
13223         // result: (SRW x y)
13224         for {
13225                 x := v_0
13226                 y := v_1
13227                 if !(shiftIsBounded(v)) {
13228                         break
13229                 }
13230                 v.reset(OpPPC64SRW)
13231                 v.AddArg2(x, y)
13232                 return true
13233         }
13234         // match: (Rsh32Ux64 <t> x y)
13235         // result: (ISEL [0] (SRW <t> x y) (MOVDconst [0]) (CMPUconst y [32]))
13236         for {
13237                 t := v.Type
13238                 x := v_0
13239                 y := v_1
13240                 v.reset(OpPPC64ISEL)
13241                 v.AuxInt = int32ToAuxInt(0)
13242                 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
13243                 v0.AddArg2(x, y)
13244                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13245                 v1.AuxInt = int64ToAuxInt(0)
13246                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13247                 v2.AuxInt = int64ToAuxInt(32)
13248                 v2.AddArg(y)
13249                 v.AddArg3(v0, v1, v2)
13250                 return true
13251         }
13252 }
13253 func rewriteValuePPC64_OpRsh32Ux8(v *Value) bool {
13254         v_1 := v.Args[1]
13255         v_0 := v.Args[0]
13256         b := v.Block
13257         typ := &b.Func.Config.Types
13258         // match: (Rsh32Ux8 x y)
13259         // cond: shiftIsBounded(v)
13260         // result: (SRW x y)
13261         for {
13262                 x := v_0
13263                 y := v_1
13264                 if !(shiftIsBounded(v)) {
13265                         break
13266                 }
13267                 v.reset(OpPPC64SRW)
13268                 v.AddArg2(x, y)
13269                 return true
13270         }
13271         // match: (Rsh32Ux8 <t> x y)
13272         // result: (ISEL [2] (SRW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y)))
13273         for {
13274                 t := v.Type
13275                 x := v_0
13276                 y := v_1
13277                 v.reset(OpPPC64ISEL)
13278                 v.AuxInt = int32ToAuxInt(2)
13279                 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
13280                 v0.AddArg2(x, y)
13281                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13282                 v1.AuxInt = int64ToAuxInt(0)
13283                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13284                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13285                 v3.AuxInt = int64ToAuxInt(0x00E0)
13286                 v3.AddArg(y)
13287                 v2.AddArg(v3)
13288                 v.AddArg3(v0, v1, v2)
13289                 return true
13290         }
13291 }
13292 func rewriteValuePPC64_OpRsh32x16(v *Value) bool {
13293         v_1 := v.Args[1]
13294         v_0 := v.Args[0]
13295         b := v.Block
13296         typ := &b.Func.Config.Types
13297         // match: (Rsh32x16 x y)
13298         // cond: shiftIsBounded(v)
13299         // result: (SRAW x y)
13300         for {
13301                 x := v_0
13302                 y := v_1
13303                 if !(shiftIsBounded(v)) {
13304                         break
13305                 }
13306                 v.reset(OpPPC64SRAW)
13307                 v.AddArg2(x, y)
13308                 return true
13309         }
13310         // match: (Rsh32x16 <t> x y)
13311         // result: (ISEL [2] (SRAW <t> x y) (SRAWconst <t> x [31]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y)))
13312         for {
13313                 t := v.Type
13314                 x := v_0
13315                 y := v_1
13316                 v.reset(OpPPC64ISEL)
13317                 v.AuxInt = int32ToAuxInt(2)
13318                 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13319                 v0.AddArg2(x, y)
13320                 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13321                 v1.AuxInt = int64ToAuxInt(31)
13322                 v1.AddArg(x)
13323                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13324                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13325                 v3.AuxInt = int64ToAuxInt(0xFFE0)
13326                 v3.AddArg(y)
13327                 v2.AddArg(v3)
13328                 v.AddArg3(v0, v1, v2)
13329                 return true
13330         }
13331 }
13332 func rewriteValuePPC64_OpRsh32x32(v *Value) bool {
13333         v_1 := v.Args[1]
13334         v_0 := v.Args[0]
13335         b := v.Block
13336         // match: (Rsh32x32 x y)
13337         // cond: shiftIsBounded(v)
13338         // result: (SRAW x y)
13339         for {
13340                 x := v_0
13341                 y := v_1
13342                 if !(shiftIsBounded(v)) {
13343                         break
13344                 }
13345                 v.reset(OpPPC64SRAW)
13346                 v.AddArg2(x, y)
13347                 return true
13348         }
13349         // match: (Rsh32x32 <t> x y)
13350         // result: (ISEL [0] (SRAW <t> x y) (SRAWconst <t> x [31]) (CMPWUconst y [32]))
13351         for {
13352                 t := v.Type
13353                 x := v_0
13354                 y := v_1
13355                 v.reset(OpPPC64ISEL)
13356                 v.AuxInt = int32ToAuxInt(0)
13357                 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13358                 v0.AddArg2(x, y)
13359                 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13360                 v1.AuxInt = int64ToAuxInt(31)
13361                 v1.AddArg(x)
13362                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13363                 v2.AuxInt = int32ToAuxInt(32)
13364                 v2.AddArg(y)
13365                 v.AddArg3(v0, v1, v2)
13366                 return true
13367         }
13368 }
13369 func rewriteValuePPC64_OpRsh32x64(v *Value) bool {
13370         v_1 := v.Args[1]
13371         v_0 := v.Args[0]
13372         b := v.Block
13373         // match: (Rsh32x64 x (MOVDconst [c]))
13374         // cond: uint64(c) >= 32
13375         // result: (SRAWconst x [63])
13376         for {
13377                 x := v_0
13378                 if v_1.Op != OpPPC64MOVDconst {
13379                         break
13380                 }
13381                 c := auxIntToInt64(v_1.AuxInt)
13382                 if !(uint64(c) >= 32) {
13383                         break
13384                 }
13385                 v.reset(OpPPC64SRAWconst)
13386                 v.AuxInt = int64ToAuxInt(63)
13387                 v.AddArg(x)
13388                 return true
13389         }
13390         // match: (Rsh32x64 x (MOVDconst [c]))
13391         // cond: uint64(c) < 32
13392         // result: (SRAWconst x [c])
13393         for {
13394                 x := v_0
13395                 if v_1.Op != OpPPC64MOVDconst {
13396                         break
13397                 }
13398                 c := auxIntToInt64(v_1.AuxInt)
13399                 if !(uint64(c) < 32) {
13400                         break
13401                 }
13402                 v.reset(OpPPC64SRAWconst)
13403                 v.AuxInt = int64ToAuxInt(c)
13404                 v.AddArg(x)
13405                 return true
13406         }
13407         // match: (Rsh32x64 x y)
13408         // cond: shiftIsBounded(v)
13409         // result: (SRAW x y)
13410         for {
13411                 x := v_0
13412                 y := v_1
13413                 if !(shiftIsBounded(v)) {
13414                         break
13415                 }
13416                 v.reset(OpPPC64SRAW)
13417                 v.AddArg2(x, y)
13418                 return true
13419         }
13420         // match: (Rsh32x64 <t> x y)
13421         // result: (ISEL [0] (SRAW <t> x y) (SRAWconst <t> x [31]) (CMPUconst y [32]))
13422         for {
13423                 t := v.Type
13424                 x := v_0
13425                 y := v_1
13426                 v.reset(OpPPC64ISEL)
13427                 v.AuxInt = int32ToAuxInt(0)
13428                 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13429                 v0.AddArg2(x, y)
13430                 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13431                 v1.AuxInt = int64ToAuxInt(31)
13432                 v1.AddArg(x)
13433                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13434                 v2.AuxInt = int64ToAuxInt(32)
13435                 v2.AddArg(y)
13436                 v.AddArg3(v0, v1, v2)
13437                 return true
13438         }
13439 }
13440 func rewriteValuePPC64_OpRsh32x8(v *Value) bool {
13441         v_1 := v.Args[1]
13442         v_0 := v.Args[0]
13443         b := v.Block
13444         typ := &b.Func.Config.Types
13445         // match: (Rsh32x8 x y)
13446         // cond: shiftIsBounded(v)
13447         // result: (SRAW x y)
13448         for {
13449                 x := v_0
13450                 y := v_1
13451                 if !(shiftIsBounded(v)) {
13452                         break
13453                 }
13454                 v.reset(OpPPC64SRAW)
13455                 v.AddArg2(x, y)
13456                 return true
13457         }
13458         // match: (Rsh32x8 <t> x y)
13459         // result: (ISEL [2] (SRAW <t> x y) (SRAWconst <t> x [31]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y)))
13460         for {
13461                 t := v.Type
13462                 x := v_0
13463                 y := v_1
13464                 v.reset(OpPPC64ISEL)
13465                 v.AuxInt = int32ToAuxInt(2)
13466                 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13467                 v0.AddArg2(x, y)
13468                 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13469                 v1.AuxInt = int64ToAuxInt(31)
13470                 v1.AddArg(x)
13471                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13472                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13473                 v3.AuxInt = int64ToAuxInt(0x00E0)
13474                 v3.AddArg(y)
13475                 v2.AddArg(v3)
13476                 v.AddArg3(v0, v1, v2)
13477                 return true
13478         }
13479 }
13480 func rewriteValuePPC64_OpRsh64Ux16(v *Value) bool {
13481         v_1 := v.Args[1]
13482         v_0 := v.Args[0]
13483         b := v.Block
13484         typ := &b.Func.Config.Types
13485         // match: (Rsh64Ux16 x y)
13486         // cond: shiftIsBounded(v)
13487         // result: (SRD x y)
13488         for {
13489                 x := v_0
13490                 y := v_1
13491                 if !(shiftIsBounded(v)) {
13492                         break
13493                 }
13494                 v.reset(OpPPC64SRD)
13495                 v.AddArg2(x, y)
13496                 return true
13497         }
13498         // match: (Rsh64Ux16 <t> x y)
13499         // result: (ISEL [2] (SRD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y)))
13500         for {
13501                 t := v.Type
13502                 x := v_0
13503                 y := v_1
13504                 v.reset(OpPPC64ISEL)
13505                 v.AuxInt = int32ToAuxInt(2)
13506                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13507                 v0.AddArg2(x, y)
13508                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13509                 v1.AuxInt = int64ToAuxInt(0)
13510                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13511                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13512                 v3.AuxInt = int64ToAuxInt(0xFFC0)
13513                 v3.AddArg(y)
13514                 v2.AddArg(v3)
13515                 v.AddArg3(v0, v1, v2)
13516                 return true
13517         }
13518 }
13519 func rewriteValuePPC64_OpRsh64Ux32(v *Value) bool {
13520         v_1 := v.Args[1]
13521         v_0 := v.Args[0]
13522         b := v.Block
13523         typ := &b.Func.Config.Types
13524         // match: (Rsh64Ux32 x y)
13525         // cond: shiftIsBounded(v)
13526         // result: (SRD x y)
13527         for {
13528                 x := v_0
13529                 y := v_1
13530                 if !(shiftIsBounded(v)) {
13531                         break
13532                 }
13533                 v.reset(OpPPC64SRD)
13534                 v.AddArg2(x, y)
13535                 return true
13536         }
13537         // match: (Rsh64Ux32 <t> x y)
13538         // result: (ISEL [0] (SRD <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
13539         for {
13540                 t := v.Type
13541                 x := v_0
13542                 y := v_1
13543                 v.reset(OpPPC64ISEL)
13544                 v.AuxInt = int32ToAuxInt(0)
13545                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13546                 v0.AddArg2(x, y)
13547                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13548                 v1.AuxInt = int64ToAuxInt(0)
13549                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13550                 v2.AuxInt = int32ToAuxInt(64)
13551                 v2.AddArg(y)
13552                 v.AddArg3(v0, v1, v2)
13553                 return true
13554         }
13555 }
13556 func rewriteValuePPC64_OpRsh64Ux64(v *Value) bool {
13557         v_1 := v.Args[1]
13558         v_0 := v.Args[0]
13559         b := v.Block
13560         typ := &b.Func.Config.Types
13561         // match: (Rsh64Ux64 x (MOVDconst [c]))
13562         // cond: uint64(c) < 64
13563         // result: (SRDconst x [c])
13564         for {
13565                 x := v_0
13566                 if v_1.Op != OpPPC64MOVDconst {
13567                         break
13568                 }
13569                 c := auxIntToInt64(v_1.AuxInt)
13570                 if !(uint64(c) < 64) {
13571                         break
13572                 }
13573                 v.reset(OpPPC64SRDconst)
13574                 v.AuxInt = int64ToAuxInt(c)
13575                 v.AddArg(x)
13576                 return true
13577         }
13578         // match: (Rsh64Ux64 x y)
13579         // cond: shiftIsBounded(v)
13580         // result: (SRD x y)
13581         for {
13582                 x := v_0
13583                 y := v_1
13584                 if !(shiftIsBounded(v)) {
13585                         break
13586                 }
13587                 v.reset(OpPPC64SRD)
13588                 v.AddArg2(x, y)
13589                 return true
13590         }
13591         // match: (Rsh64Ux64 <t> x y)
13592         // result: (ISEL [0] (SRD <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
13593         for {
13594                 t := v.Type
13595                 x := v_0
13596                 y := v_1
13597                 v.reset(OpPPC64ISEL)
13598                 v.AuxInt = int32ToAuxInt(0)
13599                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13600                 v0.AddArg2(x, y)
13601                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13602                 v1.AuxInt = int64ToAuxInt(0)
13603                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13604                 v2.AuxInt = int64ToAuxInt(64)
13605                 v2.AddArg(y)
13606                 v.AddArg3(v0, v1, v2)
13607                 return true
13608         }
13609 }
13610 func rewriteValuePPC64_OpRsh64Ux8(v *Value) bool {
13611         v_1 := v.Args[1]
13612         v_0 := v.Args[0]
13613         b := v.Block
13614         typ := &b.Func.Config.Types
13615         // match: (Rsh64Ux8 x y)
13616         // cond: shiftIsBounded(v)
13617         // result: (SRD x y)
13618         for {
13619                 x := v_0
13620                 y := v_1
13621                 if !(shiftIsBounded(v)) {
13622                         break
13623                 }
13624                 v.reset(OpPPC64SRD)
13625                 v.AddArg2(x, y)
13626                 return true
13627         }
13628         // match: (Rsh64Ux8 <t> x y)
13629         // result: (ISEL [2] (SRD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y)))
13630         for {
13631                 t := v.Type
13632                 x := v_0
13633                 y := v_1
13634                 v.reset(OpPPC64ISEL)
13635                 v.AuxInt = int32ToAuxInt(2)
13636                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13637                 v0.AddArg2(x, y)
13638                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13639                 v1.AuxInt = int64ToAuxInt(0)
13640                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13641                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13642                 v3.AuxInt = int64ToAuxInt(0x00C0)
13643                 v3.AddArg(y)
13644                 v2.AddArg(v3)
13645                 v.AddArg3(v0, v1, v2)
13646                 return true
13647         }
13648 }
13649 func rewriteValuePPC64_OpRsh64x16(v *Value) bool {
13650         v_1 := v.Args[1]
13651         v_0 := v.Args[0]
13652         b := v.Block
13653         typ := &b.Func.Config.Types
13654         // match: (Rsh64x16 x y)
13655         // cond: shiftIsBounded(v)
13656         // result: (SRAD x y)
13657         for {
13658                 x := v_0
13659                 y := v_1
13660                 if !(shiftIsBounded(v)) {
13661                         break
13662                 }
13663                 v.reset(OpPPC64SRAD)
13664                 v.AddArg2(x, y)
13665                 return true
13666         }
13667         // match: (Rsh64x16 <t> x y)
13668         // result: (ISEL [2] (SRAD <t> x y) (SRADconst <t> x [63]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y)))
13669         for {
13670                 t := v.Type
13671                 x := v_0
13672                 y := v_1
13673                 v.reset(OpPPC64ISEL)
13674                 v.AuxInt = int32ToAuxInt(2)
13675                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13676                 v0.AddArg2(x, y)
13677                 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13678                 v1.AuxInt = int64ToAuxInt(63)
13679                 v1.AddArg(x)
13680                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13681                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13682                 v3.AuxInt = int64ToAuxInt(0xFFC0)
13683                 v3.AddArg(y)
13684                 v2.AddArg(v3)
13685                 v.AddArg3(v0, v1, v2)
13686                 return true
13687         }
13688 }
13689 func rewriteValuePPC64_OpRsh64x32(v *Value) bool {
13690         v_1 := v.Args[1]
13691         v_0 := v.Args[0]
13692         b := v.Block
13693         // match: (Rsh64x32 x y)
13694         // cond: shiftIsBounded(v)
13695         // result: (SRAD x y)
13696         for {
13697                 x := v_0
13698                 y := v_1
13699                 if !(shiftIsBounded(v)) {
13700                         break
13701                 }
13702                 v.reset(OpPPC64SRAD)
13703                 v.AddArg2(x, y)
13704                 return true
13705         }
13706         // match: (Rsh64x32 <t> x y)
13707         // result: (ISEL [0] (SRAD <t> x y) (SRADconst <t> x [63]) (CMPWUconst y [64]))
13708         for {
13709                 t := v.Type
13710                 x := v_0
13711                 y := v_1
13712                 v.reset(OpPPC64ISEL)
13713                 v.AuxInt = int32ToAuxInt(0)
13714                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13715                 v0.AddArg2(x, y)
13716                 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13717                 v1.AuxInt = int64ToAuxInt(63)
13718                 v1.AddArg(x)
13719                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13720                 v2.AuxInt = int32ToAuxInt(64)
13721                 v2.AddArg(y)
13722                 v.AddArg3(v0, v1, v2)
13723                 return true
13724         }
13725 }
13726 func rewriteValuePPC64_OpRsh64x64(v *Value) bool {
13727         v_1 := v.Args[1]
13728         v_0 := v.Args[0]
13729         b := v.Block
13730         // match: (Rsh64x64 x (MOVDconst [c]))
13731         // cond: uint64(c) >= 64
13732         // result: (SRADconst x [63])
13733         for {
13734                 x := v_0
13735                 if v_1.Op != OpPPC64MOVDconst {
13736                         break
13737                 }
13738                 c := auxIntToInt64(v_1.AuxInt)
13739                 if !(uint64(c) >= 64) {
13740                         break
13741                 }
13742                 v.reset(OpPPC64SRADconst)
13743                 v.AuxInt = int64ToAuxInt(63)
13744                 v.AddArg(x)
13745                 return true
13746         }
13747         // match: (Rsh64x64 x (MOVDconst [c]))
13748         // cond: uint64(c) < 64
13749         // result: (SRADconst x [c])
13750         for {
13751                 x := v_0
13752                 if v_1.Op != OpPPC64MOVDconst {
13753                         break
13754                 }
13755                 c := auxIntToInt64(v_1.AuxInt)
13756                 if !(uint64(c) < 64) {
13757                         break
13758                 }
13759                 v.reset(OpPPC64SRADconst)
13760                 v.AuxInt = int64ToAuxInt(c)
13761                 v.AddArg(x)
13762                 return true
13763         }
13764         // match: (Rsh64x64 x y)
13765         // cond: shiftIsBounded(v)
13766         // result: (SRAD x y)
13767         for {
13768                 x := v_0
13769                 y := v_1
13770                 if !(shiftIsBounded(v)) {
13771                         break
13772                 }
13773                 v.reset(OpPPC64SRAD)
13774                 v.AddArg2(x, y)
13775                 return true
13776         }
13777         // match: (Rsh64x64 <t> x y)
13778         // result: (ISEL [0] (SRAD <t> x y) (SRADconst <t> x [63]) (CMPUconst y [64]))
13779         for {
13780                 t := v.Type
13781                 x := v_0
13782                 y := v_1
13783                 v.reset(OpPPC64ISEL)
13784                 v.AuxInt = int32ToAuxInt(0)
13785                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13786                 v0.AddArg2(x, y)
13787                 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13788                 v1.AuxInt = int64ToAuxInt(63)
13789                 v1.AddArg(x)
13790                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13791                 v2.AuxInt = int64ToAuxInt(64)
13792                 v2.AddArg(y)
13793                 v.AddArg3(v0, v1, v2)
13794                 return true
13795         }
13796 }
13797 func rewriteValuePPC64_OpRsh64x8(v *Value) bool {
13798         v_1 := v.Args[1]
13799         v_0 := v.Args[0]
13800         b := v.Block
13801         typ := &b.Func.Config.Types
13802         // match: (Rsh64x8 x y)
13803         // cond: shiftIsBounded(v)
13804         // result: (SRAD x y)
13805         for {
13806                 x := v_0
13807                 y := v_1
13808                 if !(shiftIsBounded(v)) {
13809                         break
13810                 }
13811                 v.reset(OpPPC64SRAD)
13812                 v.AddArg2(x, y)
13813                 return true
13814         }
13815         // match: (Rsh64x8 <t> x y)
13816         // result: (ISEL [2] (SRAD <t> x y) (SRADconst <t> x [63]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y)))
13817         for {
13818                 t := v.Type
13819                 x := v_0
13820                 y := v_1
13821                 v.reset(OpPPC64ISEL)
13822                 v.AuxInt = int32ToAuxInt(2)
13823                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13824                 v0.AddArg2(x, y)
13825                 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13826                 v1.AuxInt = int64ToAuxInt(63)
13827                 v1.AddArg(x)
13828                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13829                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13830                 v3.AuxInt = int64ToAuxInt(0x00C0)
13831                 v3.AddArg(y)
13832                 v2.AddArg(v3)
13833                 v.AddArg3(v0, v1, v2)
13834                 return true
13835         }
13836 }
13837 func rewriteValuePPC64_OpRsh8Ux16(v *Value) bool {
13838         v_1 := v.Args[1]
13839         v_0 := v.Args[0]
13840         b := v.Block
13841         typ := &b.Func.Config.Types
13842         // match: (Rsh8Ux16 x y)
13843         // cond: shiftIsBounded(v)
13844         // result: (SRD (MOVBZreg x) y)
13845         for {
13846                 x := v_0
13847                 y := v_1
13848                 if !(shiftIsBounded(v)) {
13849                         break
13850                 }
13851                 v.reset(OpPPC64SRD)
13852                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13853                 v0.AddArg(x)
13854                 v.AddArg2(v0, y)
13855                 return true
13856         }
13857         // match: (Rsh8Ux16 <t> x y)
13858         // result: (ISEL [2] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y)))
13859         for {
13860                 t := v.Type
13861                 x := v_0
13862                 y := v_1
13863                 v.reset(OpPPC64ISEL)
13864                 v.AuxInt = int32ToAuxInt(2)
13865                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13866                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13867                 v1.AddArg(x)
13868                 v0.AddArg2(v1, y)
13869                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13870                 v2.AuxInt = int64ToAuxInt(0)
13871                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13872                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13873                 v4.AuxInt = int64ToAuxInt(0xFFF8)
13874                 v4.AddArg(y)
13875                 v3.AddArg(v4)
13876                 v.AddArg3(v0, v2, v3)
13877                 return true
13878         }
13879 }
13880 func rewriteValuePPC64_OpRsh8Ux32(v *Value) bool {
13881         v_1 := v.Args[1]
13882         v_0 := v.Args[0]
13883         b := v.Block
13884         typ := &b.Func.Config.Types
13885         // match: (Rsh8Ux32 x y)
13886         // cond: shiftIsBounded(v)
13887         // result: (SRD (MOVBZreg x) y)
13888         for {
13889                 x := v_0
13890                 y := v_1
13891                 if !(shiftIsBounded(v)) {
13892                         break
13893                 }
13894                 v.reset(OpPPC64SRD)
13895                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13896                 v0.AddArg(x)
13897                 v.AddArg2(v0, y)
13898                 return true
13899         }
13900         // match: (Rsh8Ux32 <t> x y)
13901         // result: (ISEL [0] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [8]))
13902         for {
13903                 t := v.Type
13904                 x := v_0
13905                 y := v_1
13906                 v.reset(OpPPC64ISEL)
13907                 v.AuxInt = int32ToAuxInt(0)
13908                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13909                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13910                 v1.AddArg(x)
13911                 v0.AddArg2(v1, y)
13912                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13913                 v2.AuxInt = int64ToAuxInt(0)
13914                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13915                 v3.AuxInt = int32ToAuxInt(8)
13916                 v3.AddArg(y)
13917                 v.AddArg3(v0, v2, v3)
13918                 return true
13919         }
13920 }
13921 func rewriteValuePPC64_OpRsh8Ux64(v *Value) bool {
13922         v_1 := v.Args[1]
13923         v_0 := v.Args[0]
13924         b := v.Block
13925         typ := &b.Func.Config.Types
13926         // match: (Rsh8Ux64 x (MOVDconst [c]))
13927         // cond: uint64(c) < 8
13928         // result: (SRWconst (ZeroExt8to32 x) [c])
13929         for {
13930                 x := v_0
13931                 if v_1.Op != OpPPC64MOVDconst {
13932                         break
13933                 }
13934                 c := auxIntToInt64(v_1.AuxInt)
13935                 if !(uint64(c) < 8) {
13936                         break
13937                 }
13938                 v.reset(OpPPC64SRWconst)
13939                 v.AuxInt = int64ToAuxInt(c)
13940                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
13941                 v0.AddArg(x)
13942                 v.AddArg(v0)
13943                 return true
13944         }
13945         // match: (Rsh8Ux64 x y)
13946         // cond: shiftIsBounded(v)
13947         // result: (SRD (MOVBZreg x) y)
13948         for {
13949                 x := v_0
13950                 y := v_1
13951                 if !(shiftIsBounded(v)) {
13952                         break
13953                 }
13954                 v.reset(OpPPC64SRD)
13955                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13956                 v0.AddArg(x)
13957                 v.AddArg2(v0, y)
13958                 return true
13959         }
13960         // match: (Rsh8Ux64 <t> x y)
13961         // result: (ISEL [0] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [8]))
13962         for {
13963                 t := v.Type
13964                 x := v_0
13965                 y := v_1
13966                 v.reset(OpPPC64ISEL)
13967                 v.AuxInt = int32ToAuxInt(0)
13968                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13969                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13970                 v1.AddArg(x)
13971                 v0.AddArg2(v1, y)
13972                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13973                 v2.AuxInt = int64ToAuxInt(0)
13974                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13975                 v3.AuxInt = int64ToAuxInt(8)
13976                 v3.AddArg(y)
13977                 v.AddArg3(v0, v2, v3)
13978                 return true
13979         }
13980 }
13981 func rewriteValuePPC64_OpRsh8Ux8(v *Value) bool {
13982         v_1 := v.Args[1]
13983         v_0 := v.Args[0]
13984         b := v.Block
13985         typ := &b.Func.Config.Types
13986         // match: (Rsh8Ux8 x y)
13987         // cond: shiftIsBounded(v)
13988         // result: (SRD (MOVBZreg x) y)
13989         for {
13990                 x := v_0
13991                 y := v_1
13992                 if !(shiftIsBounded(v)) {
13993                         break
13994                 }
13995                 v.reset(OpPPC64SRD)
13996                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13997                 v0.AddArg(x)
13998                 v.AddArg2(v0, y)
13999                 return true
14000         }
14001         // match: (Rsh8Ux8 <t> x y)
14002         // result: (ISEL [2] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y)))
14003         for {
14004                 t := v.Type
14005                 x := v_0
14006                 y := v_1
14007                 v.reset(OpPPC64ISEL)
14008                 v.AuxInt = int32ToAuxInt(2)
14009                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
14010                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
14011                 v1.AddArg(x)
14012                 v0.AddArg2(v1, y)
14013                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14014                 v2.AuxInt = int64ToAuxInt(0)
14015                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14016                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14017                 v4.AuxInt = int64ToAuxInt(0x00F8)
14018                 v4.AddArg(y)
14019                 v3.AddArg(v4)
14020                 v.AddArg3(v0, v2, v3)
14021                 return true
14022         }
14023 }
14024 func rewriteValuePPC64_OpRsh8x16(v *Value) bool {
14025         v_1 := v.Args[1]
14026         v_0 := v.Args[0]
14027         b := v.Block
14028         typ := &b.Func.Config.Types
14029         // match: (Rsh8x16 x y)
14030         // cond: shiftIsBounded(v)
14031         // result: (SRAD (MOVBreg x) y)
14032         for {
14033                 x := v_0
14034                 y := v_1
14035                 if !(shiftIsBounded(v)) {
14036                         break
14037                 }
14038                 v.reset(OpPPC64SRAD)
14039                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14040                 v0.AddArg(x)
14041                 v.AddArg2(v0, y)
14042                 return true
14043         }
14044         // match: (Rsh8x16 <t> x y)
14045         // result: (ISEL [2] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y)))
14046         for {
14047                 t := v.Type
14048                 x := v_0
14049                 y := v_1
14050                 v.reset(OpPPC64ISEL)
14051                 v.AuxInt = int32ToAuxInt(2)
14052                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
14053                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14054                 v1.AddArg(x)
14055                 v0.AddArg2(v1, y)
14056                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14057                 v2.AuxInt = int64ToAuxInt(7)
14058                 v2.AddArg(v1)
14059                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14060                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14061                 v4.AuxInt = int64ToAuxInt(0xFFF8)
14062                 v4.AddArg(y)
14063                 v3.AddArg(v4)
14064                 v.AddArg3(v0, v2, v3)
14065                 return true
14066         }
14067 }
14068 func rewriteValuePPC64_OpRsh8x32(v *Value) bool {
14069         v_1 := v.Args[1]
14070         v_0 := v.Args[0]
14071         b := v.Block
14072         typ := &b.Func.Config.Types
14073         // match: (Rsh8x32 x y)
14074         // cond: shiftIsBounded(v)
14075         // result: (SRAD (MOVBreg x) y)
14076         for {
14077                 x := v_0
14078                 y := v_1
14079                 if !(shiftIsBounded(v)) {
14080                         break
14081                 }
14082                 v.reset(OpPPC64SRAD)
14083                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14084                 v0.AddArg(x)
14085                 v.AddArg2(v0, y)
14086                 return true
14087         }
14088         // match: (Rsh8x32 <t> x y)
14089         // result: (ISEL [0] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (CMPWUconst y [8]))
14090         for {
14091                 t := v.Type
14092                 x := v_0
14093                 y := v_1
14094                 v.reset(OpPPC64ISEL)
14095                 v.AuxInt = int32ToAuxInt(0)
14096                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
14097                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14098                 v1.AddArg(x)
14099                 v0.AddArg2(v1, y)
14100                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14101                 v2.AuxInt = int64ToAuxInt(7)
14102                 v2.AddArg(v1)
14103                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
14104                 v3.AuxInt = int32ToAuxInt(8)
14105                 v3.AddArg(y)
14106                 v.AddArg3(v0, v2, v3)
14107                 return true
14108         }
14109 }
14110 func rewriteValuePPC64_OpRsh8x64(v *Value) bool {
14111         v_1 := v.Args[1]
14112         v_0 := v.Args[0]
14113         b := v.Block
14114         typ := &b.Func.Config.Types
14115         // match: (Rsh8x64 x (MOVDconst [c]))
14116         // cond: uint64(c) >= 8
14117         // result: (SRAWconst (SignExt8to32 x) [63])
14118         for {
14119                 x := v_0
14120                 if v_1.Op != OpPPC64MOVDconst {
14121                         break
14122                 }
14123                 c := auxIntToInt64(v_1.AuxInt)
14124                 if !(uint64(c) >= 8) {
14125                         break
14126                 }
14127                 v.reset(OpPPC64SRAWconst)
14128                 v.AuxInt = int64ToAuxInt(63)
14129                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
14130                 v0.AddArg(x)
14131                 v.AddArg(v0)
14132                 return true
14133         }
14134         // match: (Rsh8x64 x (MOVDconst [c]))
14135         // cond: uint64(c) < 8
14136         // result: (SRAWconst (SignExt8to32 x) [c])
14137         for {
14138                 x := v_0
14139                 if v_1.Op != OpPPC64MOVDconst {
14140                         break
14141                 }
14142                 c := auxIntToInt64(v_1.AuxInt)
14143                 if !(uint64(c) < 8) {
14144                         break
14145                 }
14146                 v.reset(OpPPC64SRAWconst)
14147                 v.AuxInt = int64ToAuxInt(c)
14148                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
14149                 v0.AddArg(x)
14150                 v.AddArg(v0)
14151                 return true
14152         }
14153         // match: (Rsh8x64 x y)
14154         // cond: shiftIsBounded(v)
14155         // result: (SRAD (MOVBreg x) y)
14156         for {
14157                 x := v_0
14158                 y := v_1
14159                 if !(shiftIsBounded(v)) {
14160                         break
14161                 }
14162                 v.reset(OpPPC64SRAD)
14163                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14164                 v0.AddArg(x)
14165                 v.AddArg2(v0, y)
14166                 return true
14167         }
14168         // match: (Rsh8x64 <t> x y)
14169         // result: (ISEL [0] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (CMPUconst y [8]))
14170         for {
14171                 t := v.Type
14172                 x := v_0
14173                 y := v_1
14174                 v.reset(OpPPC64ISEL)
14175                 v.AuxInt = int32ToAuxInt(0)
14176                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
14177                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14178                 v1.AddArg(x)
14179                 v0.AddArg2(v1, y)
14180                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14181                 v2.AuxInt = int64ToAuxInt(7)
14182                 v2.AddArg(v1)
14183                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
14184                 v3.AuxInt = int64ToAuxInt(8)
14185                 v3.AddArg(y)
14186                 v.AddArg3(v0, v2, v3)
14187                 return true
14188         }
14189 }
14190 func rewriteValuePPC64_OpRsh8x8(v *Value) bool {
14191         v_1 := v.Args[1]
14192         v_0 := v.Args[0]
14193         b := v.Block
14194         typ := &b.Func.Config.Types
14195         // match: (Rsh8x8 x y)
14196         // cond: shiftIsBounded(v)
14197         // result: (SRAD (MOVBreg x) y)
14198         for {
14199                 x := v_0
14200                 y := v_1
14201                 if !(shiftIsBounded(v)) {
14202                         break
14203                 }
14204                 v.reset(OpPPC64SRAD)
14205                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14206                 v0.AddArg(x)
14207                 v.AddArg2(v0, y)
14208                 return true
14209         }
14210         // match: (Rsh8x8 <t> x y)
14211         // result: (ISEL [2] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y)))
14212         for {
14213                 t := v.Type
14214                 x := v_0
14215                 y := v_1
14216                 v.reset(OpPPC64ISEL)
14217                 v.AuxInt = int32ToAuxInt(2)
14218                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
14219                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14220                 v1.AddArg(x)
14221                 v0.AddArg2(v1, y)
14222                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14223                 v2.AuxInt = int64ToAuxInt(7)
14224                 v2.AddArg(v1)
14225                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14226                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14227                 v4.AuxInt = int64ToAuxInt(0x00F8)
14228                 v4.AddArg(y)
14229                 v3.AddArg(v4)
14230                 v.AddArg3(v0, v2, v3)
14231                 return true
14232         }
14233 }
14234 func rewriteValuePPC64_OpSelect0(v *Value) bool {
14235         v_0 := v.Args[0]
14236         b := v.Block
14237         typ := &b.Func.Config.Types
14238         // match: (Select0 (Mul64uhilo x y))
14239         // result: (MULHDU x y)
14240         for {
14241                 if v_0.Op != OpMul64uhilo {
14242                         break
14243                 }
14244                 y := v_0.Args[1]
14245                 x := v_0.Args[0]
14246                 v.reset(OpPPC64MULHDU)
14247                 v.AddArg2(x, y)
14248                 return true
14249         }
14250         // match: (Select0 (Add64carry x y c))
14251         // result: (Select0 <typ.UInt64> (ADDE x y (Select1 <typ.UInt64> (ADDCconst c [-1]))))
14252         for {
14253                 if v_0.Op != OpAdd64carry {
14254                         break
14255                 }
14256                 c := v_0.Args[2]
14257                 x := v_0.Args[0]
14258                 y := v_0.Args[1]
14259                 v.reset(OpSelect0)
14260                 v.Type = typ.UInt64
14261                 v0 := b.NewValue0(v.Pos, OpPPC64ADDE, types.NewTuple(typ.UInt64, typ.UInt64))
14262                 v1 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14263                 v2 := b.NewValue0(v.Pos, OpPPC64ADDCconst, types.NewTuple(typ.UInt64, typ.UInt64))
14264                 v2.AuxInt = int64ToAuxInt(-1)
14265                 v2.AddArg(c)
14266                 v1.AddArg(v2)
14267                 v0.AddArg3(x, y, v1)
14268                 v.AddArg(v0)
14269                 return true
14270         }
14271         // match: (Select0 (Sub64borrow x y c))
14272         // result: (Select0 <typ.UInt64> (SUBE x y (Select1 <typ.UInt64> (SUBCconst c [0]))))
14273         for {
14274                 if v_0.Op != OpSub64borrow {
14275                         break
14276                 }
14277                 c := v_0.Args[2]
14278                 x := v_0.Args[0]
14279                 y := v_0.Args[1]
14280                 v.reset(OpSelect0)
14281                 v.Type = typ.UInt64
14282                 v0 := b.NewValue0(v.Pos, OpPPC64SUBE, types.NewTuple(typ.UInt64, typ.UInt64))
14283                 v1 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14284                 v2 := b.NewValue0(v.Pos, OpPPC64SUBCconst, types.NewTuple(typ.UInt64, typ.UInt64))
14285                 v2.AuxInt = int64ToAuxInt(0)
14286                 v2.AddArg(c)
14287                 v1.AddArg(v2)
14288                 v0.AddArg3(x, y, v1)
14289                 v.AddArg(v0)
14290                 return true
14291         }
14292         // match: (Select0 (ANDCCconst [m] (ROTLWconst [r] x)))
14293         // cond: isPPC64WordRotateMask(m)
14294         // result: (RLWINM [encodePPC64RotateMask(r,m,32)] x)
14295         for {
14296                 if v_0.Op != OpPPC64ANDCCconst {
14297                         break
14298                 }
14299                 m := auxIntToInt64(v_0.AuxInt)
14300                 v_0_0 := v_0.Args[0]
14301                 if v_0_0.Op != OpPPC64ROTLWconst {
14302                         break
14303                 }
14304                 r := auxIntToInt64(v_0_0.AuxInt)
14305                 x := v_0_0.Args[0]
14306                 if !(isPPC64WordRotateMask(m)) {
14307                         break
14308                 }
14309                 v.reset(OpPPC64RLWINM)
14310                 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, m, 32))
14311                 v.AddArg(x)
14312                 return true
14313         }
14314         // match: (Select0 (ANDCCconst [m] (ROTLW x r)))
14315         // cond: isPPC64WordRotateMask(m)
14316         // result: (RLWNM [encodePPC64RotateMask(0,m,32)] x r)
14317         for {
14318                 if v_0.Op != OpPPC64ANDCCconst {
14319                         break
14320                 }
14321                 m := auxIntToInt64(v_0.AuxInt)
14322                 v_0_0 := v_0.Args[0]
14323                 if v_0_0.Op != OpPPC64ROTLW {
14324                         break
14325                 }
14326                 r := v_0_0.Args[1]
14327                 x := v_0_0.Args[0]
14328                 if !(isPPC64WordRotateMask(m)) {
14329                         break
14330                 }
14331                 v.reset(OpPPC64RLWNM)
14332                 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32))
14333                 v.AddArg2(x, r)
14334                 return true
14335         }
14336         // match: (Select0 (ANDCCconst [m] (SRWconst x [s])))
14337         // cond: mergePPC64RShiftMask(m,s,32) == 0
14338         // result: (MOVDconst [0])
14339         for {
14340                 if v_0.Op != OpPPC64ANDCCconst {
14341                         break
14342                 }
14343                 m := auxIntToInt64(v_0.AuxInt)
14344                 v_0_0 := v_0.Args[0]
14345                 if v_0_0.Op != OpPPC64SRWconst {
14346                         break
14347                 }
14348                 s := auxIntToInt64(v_0_0.AuxInt)
14349                 if !(mergePPC64RShiftMask(m, s, 32) == 0) {
14350                         break
14351                 }
14352                 v.reset(OpPPC64MOVDconst)
14353                 v.AuxInt = int64ToAuxInt(0)
14354                 return true
14355         }
14356         // match: (Select0 (ANDCCconst [m] (SRWconst x [s])))
14357         // cond: mergePPC64AndSrwi(m,s) != 0
14358         // result: (RLWINM [mergePPC64AndSrwi(m,s)] x)
14359         for {
14360                 if v_0.Op != OpPPC64ANDCCconst {
14361                         break
14362                 }
14363                 m := auxIntToInt64(v_0.AuxInt)
14364                 v_0_0 := v_0.Args[0]
14365                 if v_0_0.Op != OpPPC64SRWconst {
14366                         break
14367                 }
14368                 s := auxIntToInt64(v_0_0.AuxInt)
14369                 x := v_0_0.Args[0]
14370                 if !(mergePPC64AndSrwi(m, s) != 0) {
14371                         break
14372                 }
14373                 v.reset(OpPPC64RLWINM)
14374                 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m, s))
14375                 v.AddArg(x)
14376                 return true
14377         }
14378         // match: (Select0 (ANDCCconst [-1] x))
14379         // result: x
14380         for {
14381                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != -1 {
14382                         break
14383                 }
14384                 x := v_0.Args[0]
14385                 v.copyOf(x)
14386                 return true
14387         }
14388         // match: (Select0 (ANDCCconst [0] _))
14389         // result: (MOVDconst [0])
14390         for {
14391                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0 {
14392                         break
14393                 }
14394                 v.reset(OpPPC64MOVDconst)
14395                 v.AuxInt = int64ToAuxInt(0)
14396                 return true
14397         }
14398         // match: (Select0 (ANDCCconst [c] y:(MOVBZreg _)))
14399         // cond: c&0xFF == 0xFF
14400         // result: y
14401         for {
14402                 if v_0.Op != OpPPC64ANDCCconst {
14403                         break
14404                 }
14405                 c := auxIntToInt64(v_0.AuxInt)
14406                 y := v_0.Args[0]
14407                 if y.Op != OpPPC64MOVBZreg || !(c&0xFF == 0xFF) {
14408                         break
14409                 }
14410                 v.copyOf(y)
14411                 return true
14412         }
14413         // match: (Select0 (ANDCCconst [0xFF] (MOVBreg x)))
14414         // result: (MOVBZreg x)
14415         for {
14416                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0xFF {
14417                         break
14418                 }
14419                 v_0_0 := v_0.Args[0]
14420                 if v_0_0.Op != OpPPC64MOVBreg {
14421                         break
14422                 }
14423                 x := v_0_0.Args[0]
14424                 v.reset(OpPPC64MOVBZreg)
14425                 v.AddArg(x)
14426                 return true
14427         }
14428         // match: (Select0 (ANDCCconst [c] y:(MOVHZreg _)))
14429         // cond: c&0xFFFF == 0xFFFF
14430         // result: y
14431         for {
14432                 if v_0.Op != OpPPC64ANDCCconst {
14433                         break
14434                 }
14435                 c := auxIntToInt64(v_0.AuxInt)
14436                 y := v_0.Args[0]
14437                 if y.Op != OpPPC64MOVHZreg || !(c&0xFFFF == 0xFFFF) {
14438                         break
14439                 }
14440                 v.copyOf(y)
14441                 return true
14442         }
14443         // match: (Select0 (ANDCCconst [0xFFFF] (MOVHreg x)))
14444         // result: (MOVHZreg x)
14445         for {
14446                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0xFFFF {
14447                         break
14448                 }
14449                 v_0_0 := v_0.Args[0]
14450                 if v_0_0.Op != OpPPC64MOVHreg {
14451                         break
14452                 }
14453                 x := v_0_0.Args[0]
14454                 v.reset(OpPPC64MOVHZreg)
14455                 v.AddArg(x)
14456                 return true
14457         }
14458         // match: (Select0 (ANDCCconst [c] (MOVBZreg x)))
14459         // result: (Select0 (ANDCCconst [c&0xFF] x))
14460         for {
14461                 if v_0.Op != OpPPC64ANDCCconst {
14462                         break
14463                 }
14464                 c := auxIntToInt64(v_0.AuxInt)
14465                 v_0_0 := v_0.Args[0]
14466                 if v_0_0.Op != OpPPC64MOVBZreg {
14467                         break
14468                 }
14469                 x := v_0_0.Args[0]
14470                 v.reset(OpSelect0)
14471                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14472                 v0.AuxInt = int64ToAuxInt(c & 0xFF)
14473                 v0.AddArg(x)
14474                 v.AddArg(v0)
14475                 return true
14476         }
14477         // match: (Select0 (ANDCCconst [c] (MOVHZreg x)))
14478         // result: (Select0 (ANDCCconst [c&0xFFFF] x))
14479         for {
14480                 if v_0.Op != OpPPC64ANDCCconst {
14481                         break
14482                 }
14483                 c := auxIntToInt64(v_0.AuxInt)
14484                 v_0_0 := v_0.Args[0]
14485                 if v_0_0.Op != OpPPC64MOVHZreg {
14486                         break
14487                 }
14488                 x := v_0_0.Args[0]
14489                 v.reset(OpSelect0)
14490                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14491                 v0.AuxInt = int64ToAuxInt(c & 0xFFFF)
14492                 v0.AddArg(x)
14493                 v.AddArg(v0)
14494                 return true
14495         }
14496         // match: (Select0 (ANDCCconst [c] (MOVWZreg x)))
14497         // result: (Select0 (ANDCCconst [c&0xFFFFFFFF] x))
14498         for {
14499                 if v_0.Op != OpPPC64ANDCCconst {
14500                         break
14501                 }
14502                 c := auxIntToInt64(v_0.AuxInt)
14503                 v_0_0 := v_0.Args[0]
14504                 if v_0_0.Op != OpPPC64MOVWZreg {
14505                         break
14506                 }
14507                 x := v_0_0.Args[0]
14508                 v.reset(OpSelect0)
14509                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14510                 v0.AuxInt = int64ToAuxInt(c & 0xFFFFFFFF)
14511                 v0.AddArg(x)
14512                 v.AddArg(v0)
14513                 return true
14514         }
14515         return false
14516 }
14517 func rewriteValuePPC64_OpSelect1(v *Value) bool {
14518         v_0 := v.Args[0]
14519         b := v.Block
14520         typ := &b.Func.Config.Types
14521         // match: (Select1 (Mul64uhilo x y))
14522         // result: (MULLD x y)
14523         for {
14524                 if v_0.Op != OpMul64uhilo {
14525                         break
14526                 }
14527                 y := v_0.Args[1]
14528                 x := v_0.Args[0]
14529                 v.reset(OpPPC64MULLD)
14530                 v.AddArg2(x, y)
14531                 return true
14532         }
14533         // match: (Select1 (Add64carry x y c))
14534         // result: (ADDZEzero (Select1 <typ.UInt64> (ADDE x y (Select1 <typ.UInt64> (ADDCconst c [-1])))))
14535         for {
14536                 if v_0.Op != OpAdd64carry {
14537                         break
14538                 }
14539                 c := v_0.Args[2]
14540                 x := v_0.Args[0]
14541                 y := v_0.Args[1]
14542                 v.reset(OpPPC64ADDZEzero)
14543                 v0 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14544                 v1 := b.NewValue0(v.Pos, OpPPC64ADDE, types.NewTuple(typ.UInt64, typ.UInt64))
14545                 v2 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14546                 v3 := b.NewValue0(v.Pos, OpPPC64ADDCconst, types.NewTuple(typ.UInt64, typ.UInt64))
14547                 v3.AuxInt = int64ToAuxInt(-1)
14548                 v3.AddArg(c)
14549                 v2.AddArg(v3)
14550                 v1.AddArg3(x, y, v2)
14551                 v0.AddArg(v1)
14552                 v.AddArg(v0)
14553                 return true
14554         }
14555         // match: (Select1 (ADDCconst n:(ADDZEzero x) [-1]))
14556         // cond: n.Uses <= 2
14557         // result: x
14558         for {
14559                 if v_0.Op != OpPPC64ADDCconst || auxIntToInt64(v_0.AuxInt) != -1 {
14560                         break
14561                 }
14562                 n := v_0.Args[0]
14563                 if n.Op != OpPPC64ADDZEzero {
14564                         break
14565                 }
14566                 x := n.Args[0]
14567                 if !(n.Uses <= 2) {
14568                         break
14569                 }
14570                 v.copyOf(x)
14571                 return true
14572         }
14573         // match: (Select1 (Sub64borrow x y c))
14574         // result: (NEG (SUBZEzero (Select1 <typ.UInt64> (SUBE x y (Select1 <typ.UInt64> (SUBCconst c [0]))))))
14575         for {
14576                 if v_0.Op != OpSub64borrow {
14577                         break
14578                 }
14579                 c := v_0.Args[2]
14580                 x := v_0.Args[0]
14581                 y := v_0.Args[1]
14582                 v.reset(OpPPC64NEG)
14583                 v0 := b.NewValue0(v.Pos, OpPPC64SUBZEzero, typ.UInt64)
14584                 v1 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14585                 v2 := b.NewValue0(v.Pos, OpPPC64SUBE, types.NewTuple(typ.UInt64, typ.UInt64))
14586                 v3 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14587                 v4 := b.NewValue0(v.Pos, OpPPC64SUBCconst, types.NewTuple(typ.UInt64, typ.UInt64))
14588                 v4.AuxInt = int64ToAuxInt(0)
14589                 v4.AddArg(c)
14590                 v3.AddArg(v4)
14591                 v2.AddArg3(x, y, v3)
14592                 v1.AddArg(v2)
14593                 v0.AddArg(v1)
14594                 v.AddArg(v0)
14595                 return true
14596         }
14597         // match: (Select1 (SUBCconst n:(NEG (SUBZEzero x)) [0]))
14598         // cond: n.Uses <= 2
14599         // result: x
14600         for {
14601                 if v_0.Op != OpPPC64SUBCconst || auxIntToInt64(v_0.AuxInt) != 0 {
14602                         break
14603                 }
14604                 n := v_0.Args[0]
14605                 if n.Op != OpPPC64NEG {
14606                         break
14607                 }
14608                 n_0 := n.Args[0]
14609                 if n_0.Op != OpPPC64SUBZEzero {
14610                         break
14611                 }
14612                 x := n_0.Args[0]
14613                 if !(n.Uses <= 2) {
14614                         break
14615                 }
14616                 v.copyOf(x)
14617                 return true
14618         }
14619         // match: (Select1 (ANDCCconst [0] _))
14620         // result: (FlagEQ)
14621         for {
14622                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0 {
14623                         break
14624                 }
14625                 v.reset(OpPPC64FlagEQ)
14626                 return true
14627         }
14628         return false
14629 }
14630 func rewriteValuePPC64_OpSelectN(v *Value) bool {
14631         v_0 := v.Args[0]
14632         b := v.Block
14633         config := b.Func.Config
14634         // match: (SelectN [0] call:(CALLstatic {sym} s1:(MOVDstore _ (MOVDconst [sz]) s2:(MOVDstore _ src s3:(MOVDstore {t} _ dst mem)))))
14635         // cond: sz >= 0 && isSameCall(sym, "runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(s1, s2, s3, call)
14636         // result: (Move [sz] dst src mem)
14637         for {
14638                 if auxIntToInt64(v.AuxInt) != 0 {
14639                         break
14640                 }
14641                 call := v_0
14642                 if call.Op != OpPPC64CALLstatic || len(call.Args) != 1 {
14643                         break
14644                 }
14645                 sym := auxToCall(call.Aux)
14646                 s1 := call.Args[0]
14647                 if s1.Op != OpPPC64MOVDstore {
14648                         break
14649                 }
14650                 _ = s1.Args[2]
14651                 s1_1 := s1.Args[1]
14652                 if s1_1.Op != OpPPC64MOVDconst {
14653                         break
14654                 }
14655                 sz := auxIntToInt64(s1_1.AuxInt)
14656                 s2 := s1.Args[2]
14657                 if s2.Op != OpPPC64MOVDstore {
14658                         break
14659                 }
14660                 _ = s2.Args[2]
14661                 src := s2.Args[1]
14662                 s3 := s2.Args[2]
14663                 if s3.Op != OpPPC64MOVDstore {
14664                         break
14665                 }
14666                 mem := s3.Args[2]
14667                 dst := s3.Args[1]
14668                 if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && s1.Uses == 1 && s2.Uses == 1 && s3.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(s1, s2, s3, call)) {
14669                         break
14670                 }
14671                 v.reset(OpMove)
14672                 v.AuxInt = int64ToAuxInt(sz)
14673                 v.AddArg3(dst, src, mem)
14674                 return true
14675         }
14676         // match: (SelectN [0] call:(CALLstatic {sym} dst src (MOVDconst [sz]) mem))
14677         // cond: sz >= 0 && isSameCall(sym, "runtime.memmove") && call.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(call)
14678         // result: (Move [sz] dst src mem)
14679         for {
14680                 if auxIntToInt64(v.AuxInt) != 0 {
14681                         break
14682                 }
14683                 call := v_0
14684                 if call.Op != OpPPC64CALLstatic || len(call.Args) != 4 {
14685                         break
14686                 }
14687                 sym := auxToCall(call.Aux)
14688                 mem := call.Args[3]
14689                 dst := call.Args[0]
14690                 src := call.Args[1]
14691                 call_2 := call.Args[2]
14692                 if call_2.Op != OpPPC64MOVDconst {
14693                         break
14694                 }
14695                 sz := auxIntToInt64(call_2.AuxInt)
14696                 if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && call.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(call)) {
14697                         break
14698                 }
14699                 v.reset(OpMove)
14700                 v.AuxInt = int64ToAuxInt(sz)
14701                 v.AddArg3(dst, src, mem)
14702                 return true
14703         }
14704         return false
14705 }
14706 func rewriteValuePPC64_OpSlicemask(v *Value) bool {
14707         v_0 := v.Args[0]
14708         b := v.Block
14709         // match: (Slicemask <t> x)
14710         // result: (SRADconst (NEG <t> x) [63])
14711         for {
14712                 t := v.Type
14713                 x := v_0
14714                 v.reset(OpPPC64SRADconst)
14715                 v.AuxInt = int64ToAuxInt(63)
14716                 v0 := b.NewValue0(v.Pos, OpPPC64NEG, t)
14717                 v0.AddArg(x)
14718                 v.AddArg(v0)
14719                 return true
14720         }
14721 }
14722 func rewriteValuePPC64_OpStore(v *Value) bool {
14723         v_2 := v.Args[2]
14724         v_1 := v.Args[1]
14725         v_0 := v.Args[0]
14726         // match: (Store {t} ptr val mem)
14727         // cond: t.Size() == 8 && t.IsFloat()
14728         // result: (FMOVDstore ptr val mem)
14729         for {
14730                 t := auxToType(v.Aux)
14731                 ptr := v_0
14732                 val := v_1
14733                 mem := v_2
14734                 if !(t.Size() == 8 && t.IsFloat()) {
14735                         break
14736                 }
14737                 v.reset(OpPPC64FMOVDstore)
14738                 v.AddArg3(ptr, val, mem)
14739                 return true
14740         }
14741         // match: (Store {t} ptr val mem)
14742         // cond: t.Size() == 4 && t.IsFloat()
14743         // result: (FMOVSstore ptr val mem)
14744         for {
14745                 t := auxToType(v.Aux)
14746                 ptr := v_0
14747                 val := v_1
14748                 mem := v_2
14749                 if !(t.Size() == 4 && t.IsFloat()) {
14750                         break
14751                 }
14752                 v.reset(OpPPC64FMOVSstore)
14753                 v.AddArg3(ptr, val, mem)
14754                 return true
14755         }
14756         // match: (Store {t} ptr val mem)
14757         // cond: t.Size() == 8 && !t.IsFloat()
14758         // result: (MOVDstore ptr val mem)
14759         for {
14760                 t := auxToType(v.Aux)
14761                 ptr := v_0
14762                 val := v_1
14763                 mem := v_2
14764                 if !(t.Size() == 8 && !t.IsFloat()) {
14765                         break
14766                 }
14767                 v.reset(OpPPC64MOVDstore)
14768                 v.AddArg3(ptr, val, mem)
14769                 return true
14770         }
14771         // match: (Store {t} ptr val mem)
14772         // cond: t.Size() == 4 && !t.IsFloat()
14773         // result: (MOVWstore ptr val mem)
14774         for {
14775                 t := auxToType(v.Aux)
14776                 ptr := v_0
14777                 val := v_1
14778                 mem := v_2
14779                 if !(t.Size() == 4 && !t.IsFloat()) {
14780                         break
14781                 }
14782                 v.reset(OpPPC64MOVWstore)
14783                 v.AddArg3(ptr, val, mem)
14784                 return true
14785         }
14786         // match: (Store {t} ptr val mem)
14787         // cond: t.Size() == 2
14788         // result: (MOVHstore ptr val mem)
14789         for {
14790                 t := auxToType(v.Aux)
14791                 ptr := v_0
14792                 val := v_1
14793                 mem := v_2
14794                 if !(t.Size() == 2) {
14795                         break
14796                 }
14797                 v.reset(OpPPC64MOVHstore)
14798                 v.AddArg3(ptr, val, mem)
14799                 return true
14800         }
14801         // match: (Store {t} ptr val mem)
14802         // cond: t.Size() == 1
14803         // result: (MOVBstore ptr val mem)
14804         for {
14805                 t := auxToType(v.Aux)
14806                 ptr := v_0
14807                 val := v_1
14808                 mem := v_2
14809                 if !(t.Size() == 1) {
14810                         break
14811                 }
14812                 v.reset(OpPPC64MOVBstore)
14813                 v.AddArg3(ptr, val, mem)
14814                 return true
14815         }
14816         return false
14817 }
14818 func rewriteValuePPC64_OpTrunc16to8(v *Value) bool {
14819         v_0 := v.Args[0]
14820         // match: (Trunc16to8 <t> x)
14821         // cond: t.IsSigned()
14822         // result: (MOVBreg x)
14823         for {
14824                 t := v.Type
14825                 x := v_0
14826                 if !(t.IsSigned()) {
14827                         break
14828                 }
14829                 v.reset(OpPPC64MOVBreg)
14830                 v.AddArg(x)
14831                 return true
14832         }
14833         // match: (Trunc16to8 x)
14834         // result: (MOVBZreg x)
14835         for {
14836                 x := v_0
14837                 v.reset(OpPPC64MOVBZreg)
14838                 v.AddArg(x)
14839                 return true
14840         }
14841 }
14842 func rewriteValuePPC64_OpTrunc32to16(v *Value) bool {
14843         v_0 := v.Args[0]
14844         // match: (Trunc32to16 <t> x)
14845         // cond: t.IsSigned()
14846         // result: (MOVHreg x)
14847         for {
14848                 t := v.Type
14849                 x := v_0
14850                 if !(t.IsSigned()) {
14851                         break
14852                 }
14853                 v.reset(OpPPC64MOVHreg)
14854                 v.AddArg(x)
14855                 return true
14856         }
14857         // match: (Trunc32to16 x)
14858         // result: (MOVHZreg x)
14859         for {
14860                 x := v_0
14861                 v.reset(OpPPC64MOVHZreg)
14862                 v.AddArg(x)
14863                 return true
14864         }
14865 }
14866 func rewriteValuePPC64_OpTrunc32to8(v *Value) bool {
14867         v_0 := v.Args[0]
14868         // match: (Trunc32to8 <t> x)
14869         // cond: t.IsSigned()
14870         // result: (MOVBreg x)
14871         for {
14872                 t := v.Type
14873                 x := v_0
14874                 if !(t.IsSigned()) {
14875                         break
14876                 }
14877                 v.reset(OpPPC64MOVBreg)
14878                 v.AddArg(x)
14879                 return true
14880         }
14881         // match: (Trunc32to8 x)
14882         // result: (MOVBZreg x)
14883         for {
14884                 x := v_0
14885                 v.reset(OpPPC64MOVBZreg)
14886                 v.AddArg(x)
14887                 return true
14888         }
14889 }
14890 func rewriteValuePPC64_OpTrunc64to16(v *Value) bool {
14891         v_0 := v.Args[0]
14892         // match: (Trunc64to16 <t> x)
14893         // cond: t.IsSigned()
14894         // result: (MOVHreg x)
14895         for {
14896                 t := v.Type
14897                 x := v_0
14898                 if !(t.IsSigned()) {
14899                         break
14900                 }
14901                 v.reset(OpPPC64MOVHreg)
14902                 v.AddArg(x)
14903                 return true
14904         }
14905         // match: (Trunc64to16 x)
14906         // result: (MOVHZreg x)
14907         for {
14908                 x := v_0
14909                 v.reset(OpPPC64MOVHZreg)
14910                 v.AddArg(x)
14911                 return true
14912         }
14913 }
14914 func rewriteValuePPC64_OpTrunc64to32(v *Value) bool {
14915         v_0 := v.Args[0]
14916         // match: (Trunc64to32 <t> x)
14917         // cond: t.IsSigned()
14918         // result: (MOVWreg x)
14919         for {
14920                 t := v.Type
14921                 x := v_0
14922                 if !(t.IsSigned()) {
14923                         break
14924                 }
14925                 v.reset(OpPPC64MOVWreg)
14926                 v.AddArg(x)
14927                 return true
14928         }
14929         // match: (Trunc64to32 x)
14930         // result: (MOVWZreg x)
14931         for {
14932                 x := v_0
14933                 v.reset(OpPPC64MOVWZreg)
14934                 v.AddArg(x)
14935                 return true
14936         }
14937 }
14938 func rewriteValuePPC64_OpTrunc64to8(v *Value) bool {
14939         v_0 := v.Args[0]
14940         // match: (Trunc64to8 <t> x)
14941         // cond: t.IsSigned()
14942         // result: (MOVBreg x)
14943         for {
14944                 t := v.Type
14945                 x := v_0
14946                 if !(t.IsSigned()) {
14947                         break
14948                 }
14949                 v.reset(OpPPC64MOVBreg)
14950                 v.AddArg(x)
14951                 return true
14952         }
14953         // match: (Trunc64to8 x)
14954         // result: (MOVBZreg x)
14955         for {
14956                 x := v_0
14957                 v.reset(OpPPC64MOVBZreg)
14958                 v.AddArg(x)
14959                 return true
14960         }
14961 }
14962 func rewriteValuePPC64_OpZero(v *Value) bool {
14963         v_1 := v.Args[1]
14964         v_0 := v.Args[0]
14965         b := v.Block
14966         // match: (Zero [0] _ mem)
14967         // result: mem
14968         for {
14969                 if auxIntToInt64(v.AuxInt) != 0 {
14970                         break
14971                 }
14972                 mem := v_1
14973                 v.copyOf(mem)
14974                 return true
14975         }
14976         // match: (Zero [1] destptr mem)
14977         // result: (MOVBstorezero destptr mem)
14978         for {
14979                 if auxIntToInt64(v.AuxInt) != 1 {
14980                         break
14981                 }
14982                 destptr := v_0
14983                 mem := v_1
14984                 v.reset(OpPPC64MOVBstorezero)
14985                 v.AddArg2(destptr, mem)
14986                 return true
14987         }
14988         // match: (Zero [2] destptr mem)
14989         // result: (MOVHstorezero destptr mem)
14990         for {
14991                 if auxIntToInt64(v.AuxInt) != 2 {
14992                         break
14993                 }
14994                 destptr := v_0
14995                 mem := v_1
14996                 v.reset(OpPPC64MOVHstorezero)
14997                 v.AddArg2(destptr, mem)
14998                 return true
14999         }
15000         // match: (Zero [3] destptr mem)
15001         // result: (MOVBstorezero [2] destptr (MOVHstorezero destptr mem))
15002         for {
15003                 if auxIntToInt64(v.AuxInt) != 3 {
15004                         break
15005                 }
15006                 destptr := v_0
15007                 mem := v_1
15008                 v.reset(OpPPC64MOVBstorezero)
15009                 v.AuxInt = int32ToAuxInt(2)
15010                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHstorezero, types.TypeMem)
15011                 v0.AddArg2(destptr, mem)
15012                 v.AddArg2(destptr, v0)
15013                 return true
15014         }
15015         // match: (Zero [4] destptr mem)
15016         // result: (MOVWstorezero destptr mem)
15017         for {
15018                 if auxIntToInt64(v.AuxInt) != 4 {
15019                         break
15020                 }
15021                 destptr := v_0
15022                 mem := v_1
15023                 v.reset(OpPPC64MOVWstorezero)
15024                 v.AddArg2(destptr, mem)
15025                 return true
15026         }
15027         // match: (Zero [5] destptr mem)
15028         // result: (MOVBstorezero [4] destptr (MOVWstorezero destptr mem))
15029         for {
15030                 if auxIntToInt64(v.AuxInt) != 5 {
15031                         break
15032                 }
15033                 destptr := v_0
15034                 mem := v_1
15035                 v.reset(OpPPC64MOVBstorezero)
15036                 v.AuxInt = int32ToAuxInt(4)
15037                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem)
15038                 v0.AddArg2(destptr, mem)
15039                 v.AddArg2(destptr, v0)
15040                 return true
15041         }
15042         // match: (Zero [6] destptr mem)
15043         // result: (MOVHstorezero [4] destptr (MOVWstorezero destptr mem))
15044         for {
15045                 if auxIntToInt64(v.AuxInt) != 6 {
15046                         break
15047                 }
15048                 destptr := v_0
15049                 mem := v_1
15050                 v.reset(OpPPC64MOVHstorezero)
15051                 v.AuxInt = int32ToAuxInt(4)
15052                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem)
15053                 v0.AddArg2(destptr, mem)
15054                 v.AddArg2(destptr, v0)
15055                 return true
15056         }
15057         // match: (Zero [7] destptr mem)
15058         // result: (MOVBstorezero [6] destptr (MOVHstorezero [4] destptr (MOVWstorezero destptr mem)))
15059         for {
15060                 if auxIntToInt64(v.AuxInt) != 7 {
15061                         break
15062                 }
15063                 destptr := v_0
15064                 mem := v_1
15065                 v.reset(OpPPC64MOVBstorezero)
15066                 v.AuxInt = int32ToAuxInt(6)
15067                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHstorezero, types.TypeMem)
15068                 v0.AuxInt = int32ToAuxInt(4)
15069                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem)
15070                 v1.AddArg2(destptr, mem)
15071                 v0.AddArg2(destptr, v1)
15072                 v.AddArg2(destptr, v0)
15073                 return true
15074         }
15075         // match: (Zero [8] {t} destptr mem)
15076         // result: (MOVDstorezero destptr mem)
15077         for {
15078                 if auxIntToInt64(v.AuxInt) != 8 {
15079                         break
15080                 }
15081                 destptr := v_0
15082                 mem := v_1
15083                 v.reset(OpPPC64MOVDstorezero)
15084                 v.AddArg2(destptr, mem)
15085                 return true
15086         }
15087         // match: (Zero [12] {t} destptr mem)
15088         // result: (MOVWstorezero [8] destptr (MOVDstorezero [0] destptr mem))
15089         for {
15090                 if auxIntToInt64(v.AuxInt) != 12 {
15091                         break
15092                 }
15093                 destptr := v_0
15094                 mem := v_1
15095                 v.reset(OpPPC64MOVWstorezero)
15096                 v.AuxInt = int32ToAuxInt(8)
15097                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15098                 v0.AuxInt = int32ToAuxInt(0)
15099                 v0.AddArg2(destptr, mem)
15100                 v.AddArg2(destptr, v0)
15101                 return true
15102         }
15103         // match: (Zero [16] {t} destptr mem)
15104         // result: (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem))
15105         for {
15106                 if auxIntToInt64(v.AuxInt) != 16 {
15107                         break
15108                 }
15109                 destptr := v_0
15110                 mem := v_1
15111                 v.reset(OpPPC64MOVDstorezero)
15112                 v.AuxInt = int32ToAuxInt(8)
15113                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15114                 v0.AuxInt = int32ToAuxInt(0)
15115                 v0.AddArg2(destptr, mem)
15116                 v.AddArg2(destptr, v0)
15117                 return true
15118         }
15119         // match: (Zero [24] {t} destptr mem)
15120         // result: (MOVDstorezero [16] destptr (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem)))
15121         for {
15122                 if auxIntToInt64(v.AuxInt) != 24 {
15123                         break
15124                 }
15125                 destptr := v_0
15126                 mem := v_1
15127                 v.reset(OpPPC64MOVDstorezero)
15128                 v.AuxInt = int32ToAuxInt(16)
15129                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15130                 v0.AuxInt = int32ToAuxInt(8)
15131                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15132                 v1.AuxInt = int32ToAuxInt(0)
15133                 v1.AddArg2(destptr, mem)
15134                 v0.AddArg2(destptr, v1)
15135                 v.AddArg2(destptr, v0)
15136                 return true
15137         }
15138         // match: (Zero [32] {t} destptr mem)
15139         // result: (MOVDstorezero [24] destptr (MOVDstorezero [16] destptr (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem))))
15140         for {
15141                 if auxIntToInt64(v.AuxInt) != 32 {
15142                         break
15143                 }
15144                 destptr := v_0
15145                 mem := v_1
15146                 v.reset(OpPPC64MOVDstorezero)
15147                 v.AuxInt = int32ToAuxInt(24)
15148                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15149                 v0.AuxInt = int32ToAuxInt(16)
15150                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15151                 v1.AuxInt = int32ToAuxInt(8)
15152                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15153                 v2.AuxInt = int32ToAuxInt(0)
15154                 v2.AddArg2(destptr, mem)
15155                 v1.AddArg2(destptr, v2)
15156                 v0.AddArg2(destptr, v1)
15157                 v.AddArg2(destptr, v0)
15158                 return true
15159         }
15160         // match: (Zero [s] ptr mem)
15161         // cond: buildcfg.GOPPC64 <= 8 && s < 64
15162         // result: (LoweredZeroShort [s] ptr mem)
15163         for {
15164                 s := auxIntToInt64(v.AuxInt)
15165                 ptr := v_0
15166                 mem := v_1
15167                 if !(buildcfg.GOPPC64 <= 8 && s < 64) {
15168                         break
15169                 }
15170                 v.reset(OpPPC64LoweredZeroShort)
15171                 v.AuxInt = int64ToAuxInt(s)
15172                 v.AddArg2(ptr, mem)
15173                 return true
15174         }
15175         // match: (Zero [s] ptr mem)
15176         // cond: buildcfg.GOPPC64 <= 8
15177         // result: (LoweredZero [s] ptr mem)
15178         for {
15179                 s := auxIntToInt64(v.AuxInt)
15180                 ptr := v_0
15181                 mem := v_1
15182                 if !(buildcfg.GOPPC64 <= 8) {
15183                         break
15184                 }
15185                 v.reset(OpPPC64LoweredZero)
15186                 v.AuxInt = int64ToAuxInt(s)
15187                 v.AddArg2(ptr, mem)
15188                 return true
15189         }
15190         // match: (Zero [s] ptr mem)
15191         // cond: s < 128 && buildcfg.GOPPC64 >= 9
15192         // result: (LoweredQuadZeroShort [s] ptr mem)
15193         for {
15194                 s := auxIntToInt64(v.AuxInt)
15195                 ptr := v_0
15196                 mem := v_1
15197                 if !(s < 128 && buildcfg.GOPPC64 >= 9) {
15198                         break
15199                 }
15200                 v.reset(OpPPC64LoweredQuadZeroShort)
15201                 v.AuxInt = int64ToAuxInt(s)
15202                 v.AddArg2(ptr, mem)
15203                 return true
15204         }
15205         // match: (Zero [s] ptr mem)
15206         // cond: buildcfg.GOPPC64 >= 9
15207         // result: (LoweredQuadZero [s] ptr mem)
15208         for {
15209                 s := auxIntToInt64(v.AuxInt)
15210                 ptr := v_0
15211                 mem := v_1
15212                 if !(buildcfg.GOPPC64 >= 9) {
15213                         break
15214                 }
15215                 v.reset(OpPPC64LoweredQuadZero)
15216                 v.AuxInt = int64ToAuxInt(s)
15217                 v.AddArg2(ptr, mem)
15218                 return true
15219         }
15220         return false
15221 }
15222 func rewriteBlockPPC64(b *Block) bool {
15223         typ := &b.Func.Config.Types
15224         switch b.Kind {
15225         case BlockPPC64EQ:
15226                 // match: (EQ (CMPconst [0] (Select0 (ANDCCconst [c] x))) yes no)
15227                 // result: (EQ (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
15228                 for b.Controls[0].Op == OpPPC64CMPconst {
15229                         v_0 := b.Controls[0]
15230                         if auxIntToInt64(v_0.AuxInt) != 0 {
15231                                 break
15232                         }
15233                         v_0_0 := v_0.Args[0]
15234                         if v_0_0.Op != OpSelect0 {
15235                                 break
15236                         }
15237                         v_0_0_0 := v_0_0.Args[0]
15238                         if v_0_0_0.Op != OpPPC64ANDCCconst {
15239                                 break
15240                         }
15241                         c := auxIntToInt64(v_0_0_0.AuxInt)
15242                         x := v_0_0_0.Args[0]
15243                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15244                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15245                         v1.AuxInt = int64ToAuxInt(c)
15246                         v1.AddArg(x)
15247                         v0.AddArg(v1)
15248                         b.resetWithControl(BlockPPC64EQ, v0)
15249                         return true
15250                 }
15251                 // match: (EQ (CMPWconst [0] (Select0 (ANDCCconst [c] x))) yes no)
15252                 // result: (EQ (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
15253                 for b.Controls[0].Op == OpPPC64CMPWconst {
15254                         v_0 := b.Controls[0]
15255                         if auxIntToInt32(v_0.AuxInt) != 0 {
15256                                 break
15257                         }
15258                         v_0_0 := v_0.Args[0]
15259                         if v_0_0.Op != OpSelect0 {
15260                                 break
15261                         }
15262                         v_0_0_0 := v_0_0.Args[0]
15263                         if v_0_0_0.Op != OpPPC64ANDCCconst {
15264                                 break
15265                         }
15266                         c := auxIntToInt64(v_0_0_0.AuxInt)
15267                         x := v_0_0_0.Args[0]
15268                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15269                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15270                         v1.AuxInt = int64ToAuxInt(c)
15271                         v1.AddArg(x)
15272                         v0.AddArg(v1)
15273                         b.resetWithControl(BlockPPC64EQ, v0)
15274                         return true
15275                 }
15276                 // match: (EQ (FlagEQ) yes no)
15277                 // result: (First yes no)
15278                 for b.Controls[0].Op == OpPPC64FlagEQ {
15279                         b.Reset(BlockFirst)
15280                         return true
15281                 }
15282                 // match: (EQ (FlagLT) yes no)
15283                 // result: (First no yes)
15284                 for b.Controls[0].Op == OpPPC64FlagLT {
15285                         b.Reset(BlockFirst)
15286                         b.swapSuccessors()
15287                         return true
15288                 }
15289                 // match: (EQ (FlagGT) yes no)
15290                 // result: (First no yes)
15291                 for b.Controls[0].Op == OpPPC64FlagGT {
15292                         b.Reset(BlockFirst)
15293                         b.swapSuccessors()
15294                         return true
15295                 }
15296                 // match: (EQ (InvertFlags cmp) yes no)
15297                 // result: (EQ cmp yes no)
15298                 for b.Controls[0].Op == OpPPC64InvertFlags {
15299                         v_0 := b.Controls[0]
15300                         cmp := v_0.Args[0]
15301                         b.resetWithControl(BlockPPC64EQ, cmp)
15302                         return true
15303                 }
15304                 // match: (EQ (CMPconst [0] (Select0 (ANDCCconst [c] x))) yes no)
15305                 // result: (EQ (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
15306                 for b.Controls[0].Op == OpPPC64CMPconst {
15307                         v_0 := b.Controls[0]
15308                         if auxIntToInt64(v_0.AuxInt) != 0 {
15309                                 break
15310                         }
15311                         v_0_0 := v_0.Args[0]
15312                         if v_0_0.Op != OpSelect0 {
15313                                 break
15314                         }
15315                         v_0_0_0 := v_0_0.Args[0]
15316                         if v_0_0_0.Op != OpPPC64ANDCCconst {
15317                                 break
15318                         }
15319                         c := auxIntToInt64(v_0_0_0.AuxInt)
15320                         x := v_0_0_0.Args[0]
15321                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15322                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15323                         v1.AuxInt = int64ToAuxInt(c)
15324                         v1.AddArg(x)
15325                         v0.AddArg(v1)
15326                         b.resetWithControl(BlockPPC64EQ, v0)
15327                         return true
15328                 }
15329                 // match: (EQ (CMPWconst [0] (Select0 (ANDCCconst [c] x))) yes no)
15330                 // result: (EQ (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
15331                 for b.Controls[0].Op == OpPPC64CMPWconst {
15332                         v_0 := b.Controls[0]
15333                         if auxIntToInt32(v_0.AuxInt) != 0 {
15334                                 break
15335                         }
15336                         v_0_0 := v_0.Args[0]
15337                         if v_0_0.Op != OpSelect0 {
15338                                 break
15339                         }
15340                         v_0_0_0 := v_0_0.Args[0]
15341                         if v_0_0_0.Op != OpPPC64ANDCCconst {
15342                                 break
15343                         }
15344                         c := auxIntToInt64(v_0_0_0.AuxInt)
15345                         x := v_0_0_0.Args[0]
15346                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15347                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15348                         v1.AuxInt = int64ToAuxInt(c)
15349                         v1.AddArg(x)
15350                         v0.AddArg(v1)
15351                         b.resetWithControl(BlockPPC64EQ, v0)
15352                         return true
15353                 }
15354                 // match: (EQ (CMPconst [0] z:(AND x y)) yes no)
15355                 // cond: z.Uses == 1
15356                 // result: (EQ (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
15357                 for b.Controls[0].Op == OpPPC64CMPconst {
15358                         v_0 := b.Controls[0]
15359                         if auxIntToInt64(v_0.AuxInt) != 0 {
15360                                 break
15361                         }
15362                         z := v_0.Args[0]
15363                         if z.Op != OpPPC64AND {
15364                                 break
15365                         }
15366                         _ = z.Args[1]
15367                         z_0 := z.Args[0]
15368                         z_1 := z.Args[1]
15369                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15370                                 x := z_0
15371                                 y := z_1
15372                                 if !(z.Uses == 1) {
15373                                         continue
15374                                 }
15375                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15376                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15377                                 v1.AddArg2(x, y)
15378                                 v0.AddArg(v1)
15379                                 b.resetWithControl(BlockPPC64EQ, v0)
15380                                 return true
15381                         }
15382                         break
15383                 }
15384                 // match: (EQ (CMPconst [0] z:(OR x y)) yes no)
15385                 // cond: z.Uses == 1
15386                 // result: (EQ (Select1 <types.TypeFlags> (ORCC x y)) yes no)
15387                 for b.Controls[0].Op == OpPPC64CMPconst {
15388                         v_0 := b.Controls[0]
15389                         if auxIntToInt64(v_0.AuxInt) != 0 {
15390                                 break
15391                         }
15392                         z := v_0.Args[0]
15393                         if z.Op != OpPPC64OR {
15394                                 break
15395                         }
15396                         _ = z.Args[1]
15397                         z_0 := z.Args[0]
15398                         z_1 := z.Args[1]
15399                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15400                                 x := z_0
15401                                 y := z_1
15402                                 if !(z.Uses == 1) {
15403                                         continue
15404                                 }
15405                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15406                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15407                                 v1.AddArg2(x, y)
15408                                 v0.AddArg(v1)
15409                                 b.resetWithControl(BlockPPC64EQ, v0)
15410                                 return true
15411                         }
15412                         break
15413                 }
15414                 // match: (EQ (CMPconst [0] z:(XOR x y)) yes no)
15415                 // cond: z.Uses == 1
15416                 // result: (EQ (Select1 <types.TypeFlags> (XORCC x y)) yes no)
15417                 for b.Controls[0].Op == OpPPC64CMPconst {
15418                         v_0 := b.Controls[0]
15419                         if auxIntToInt64(v_0.AuxInt) != 0 {
15420                                 break
15421                         }
15422                         z := v_0.Args[0]
15423                         if z.Op != OpPPC64XOR {
15424                                 break
15425                         }
15426                         _ = z.Args[1]
15427                         z_0 := z.Args[0]
15428                         z_1 := z.Args[1]
15429                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15430                                 x := z_0
15431                                 y := z_1
15432                                 if !(z.Uses == 1) {
15433                                         continue
15434                                 }
15435                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15436                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15437                                 v1.AddArg2(x, y)
15438                                 v0.AddArg(v1)
15439                                 b.resetWithControl(BlockPPC64EQ, v0)
15440                                 return true
15441                         }
15442                         break
15443                 }
15444         case BlockPPC64GE:
15445                 // match: (GE (FlagEQ) yes no)
15446                 // result: (First yes no)
15447                 for b.Controls[0].Op == OpPPC64FlagEQ {
15448                         b.Reset(BlockFirst)
15449                         return true
15450                 }
15451                 // match: (GE (FlagLT) yes no)
15452                 // result: (First no yes)
15453                 for b.Controls[0].Op == OpPPC64FlagLT {
15454                         b.Reset(BlockFirst)
15455                         b.swapSuccessors()
15456                         return true
15457                 }
15458                 // match: (GE (FlagGT) yes no)
15459                 // result: (First yes no)
15460                 for b.Controls[0].Op == OpPPC64FlagGT {
15461                         b.Reset(BlockFirst)
15462                         return true
15463                 }
15464                 // match: (GE (InvertFlags cmp) yes no)
15465                 // result: (LE cmp yes no)
15466                 for b.Controls[0].Op == OpPPC64InvertFlags {
15467                         v_0 := b.Controls[0]
15468                         cmp := v_0.Args[0]
15469                         b.resetWithControl(BlockPPC64LE, cmp)
15470                         return true
15471                 }
15472                 // match: (GE (CMPconst [0] (Select0 (ANDCCconst [c] x))) yes no)
15473                 // result: (GE (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
15474                 for b.Controls[0].Op == OpPPC64CMPconst {
15475                         v_0 := b.Controls[0]
15476                         if auxIntToInt64(v_0.AuxInt) != 0 {
15477                                 break
15478                         }
15479                         v_0_0 := v_0.Args[0]
15480                         if v_0_0.Op != OpSelect0 {
15481                                 break
15482                         }
15483                         v_0_0_0 := v_0_0.Args[0]
15484                         if v_0_0_0.Op != OpPPC64ANDCCconst {
15485                                 break
15486                         }
15487                         c := auxIntToInt64(v_0_0_0.AuxInt)
15488                         x := v_0_0_0.Args[0]
15489                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15490                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15491                         v1.AuxInt = int64ToAuxInt(c)
15492                         v1.AddArg(x)
15493                         v0.AddArg(v1)
15494                         b.resetWithControl(BlockPPC64GE, v0)
15495                         return true
15496                 }
15497                 // match: (GE (CMPWconst [0] (Select0 (ANDCCconst [c] x))) yes no)
15498                 // result: (GE (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
15499                 for b.Controls[0].Op == OpPPC64CMPWconst {
15500                         v_0 := b.Controls[0]
15501                         if auxIntToInt32(v_0.AuxInt) != 0 {
15502                                 break
15503                         }
15504                         v_0_0 := v_0.Args[0]
15505                         if v_0_0.Op != OpSelect0 {
15506                                 break
15507                         }
15508                         v_0_0_0 := v_0_0.Args[0]
15509                         if v_0_0_0.Op != OpPPC64ANDCCconst {
15510                                 break
15511                         }
15512                         c := auxIntToInt64(v_0_0_0.AuxInt)
15513                         x := v_0_0_0.Args[0]
15514                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15515                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15516                         v1.AuxInt = int64ToAuxInt(c)
15517                         v1.AddArg(x)
15518                         v0.AddArg(v1)
15519                         b.resetWithControl(BlockPPC64GE, v0)
15520                         return true
15521                 }
15522                 // match: (GE (CMPconst [0] z:(AND x y)) yes no)
15523                 // cond: z.Uses == 1
15524                 // result: (GE (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
15525                 for b.Controls[0].Op == OpPPC64CMPconst {
15526                         v_0 := b.Controls[0]
15527                         if auxIntToInt64(v_0.AuxInt) != 0 {
15528                                 break
15529                         }
15530                         z := v_0.Args[0]
15531                         if z.Op != OpPPC64AND {
15532                                 break
15533                         }
15534                         _ = z.Args[1]
15535                         z_0 := z.Args[0]
15536                         z_1 := z.Args[1]
15537                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15538                                 x := z_0
15539                                 y := z_1
15540                                 if !(z.Uses == 1) {
15541                                         continue
15542                                 }
15543                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15544                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15545                                 v1.AddArg2(x, y)
15546                                 v0.AddArg(v1)
15547                                 b.resetWithControl(BlockPPC64GE, v0)
15548                                 return true
15549                         }
15550                         break
15551                 }
15552                 // match: (GE (CMPconst [0] z:(OR x y)) yes no)
15553                 // cond: z.Uses == 1
15554                 // result: (GE (Select1 <types.TypeFlags> (ORCC x y)) yes no)
15555                 for b.Controls[0].Op == OpPPC64CMPconst {
15556                         v_0 := b.Controls[0]
15557                         if auxIntToInt64(v_0.AuxInt) != 0 {
15558                                 break
15559                         }
15560                         z := v_0.Args[0]
15561                         if z.Op != OpPPC64OR {
15562                                 break
15563                         }
15564                         _ = z.Args[1]
15565                         z_0 := z.Args[0]
15566                         z_1 := z.Args[1]
15567                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15568                                 x := z_0
15569                                 y := z_1
15570                                 if !(z.Uses == 1) {
15571                                         continue
15572                                 }
15573                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15574                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15575                                 v1.AddArg2(x, y)
15576                                 v0.AddArg(v1)
15577                                 b.resetWithControl(BlockPPC64GE, v0)
15578                                 return true
15579                         }
15580                         break
15581                 }
15582                 // match: (GE (CMPconst [0] z:(XOR x y)) yes no)
15583                 // cond: z.Uses == 1
15584                 // result: (GE (Select1 <types.TypeFlags> (XORCC x y)) yes no)
15585                 for b.Controls[0].Op == OpPPC64CMPconst {
15586                         v_0 := b.Controls[0]
15587                         if auxIntToInt64(v_0.AuxInt) != 0 {
15588                                 break
15589                         }
15590                         z := v_0.Args[0]
15591                         if z.Op != OpPPC64XOR {
15592                                 break
15593                         }
15594                         _ = z.Args[1]
15595                         z_0 := z.Args[0]
15596                         z_1 := z.Args[1]
15597                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15598                                 x := z_0
15599                                 y := z_1
15600                                 if !(z.Uses == 1) {
15601                                         continue
15602                                 }
15603                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15604                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15605                                 v1.AddArg2(x, y)
15606                                 v0.AddArg(v1)
15607                                 b.resetWithControl(BlockPPC64GE, v0)
15608                                 return true
15609                         }
15610                         break
15611                 }
15612         case BlockPPC64GT:
15613                 // match: (GT (FlagEQ) yes no)
15614                 // result: (First no yes)
15615                 for b.Controls[0].Op == OpPPC64FlagEQ {
15616                         b.Reset(BlockFirst)
15617                         b.swapSuccessors()
15618                         return true
15619                 }
15620                 // match: (GT (FlagLT) yes no)
15621                 // result: (First no yes)
15622                 for b.Controls[0].Op == OpPPC64FlagLT {
15623                         b.Reset(BlockFirst)
15624                         b.swapSuccessors()
15625                         return true
15626                 }
15627                 // match: (GT (FlagGT) yes no)
15628                 // result: (First yes no)
15629                 for b.Controls[0].Op == OpPPC64FlagGT {
15630                         b.Reset(BlockFirst)
15631                         return true
15632                 }
15633                 // match: (GT (InvertFlags cmp) yes no)
15634                 // result: (LT cmp yes no)
15635                 for b.Controls[0].Op == OpPPC64InvertFlags {
15636                         v_0 := b.Controls[0]
15637                         cmp := v_0.Args[0]
15638                         b.resetWithControl(BlockPPC64LT, cmp)
15639                         return true
15640                 }
15641                 // match: (GT (CMPconst [0] (Select0 (ANDCCconst [c] x))) yes no)
15642                 // result: (GT (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
15643                 for b.Controls[0].Op == OpPPC64CMPconst {
15644                         v_0 := b.Controls[0]
15645                         if auxIntToInt64(v_0.AuxInt) != 0 {
15646                                 break
15647                         }
15648                         v_0_0 := v_0.Args[0]
15649                         if v_0_0.Op != OpSelect0 {
15650                                 break
15651                         }
15652                         v_0_0_0 := v_0_0.Args[0]
15653                         if v_0_0_0.Op != OpPPC64ANDCCconst {
15654                                 break
15655                         }
15656                         c := auxIntToInt64(v_0_0_0.AuxInt)
15657                         x := v_0_0_0.Args[0]
15658                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15659                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15660                         v1.AuxInt = int64ToAuxInt(c)
15661                         v1.AddArg(x)
15662                         v0.AddArg(v1)
15663                         b.resetWithControl(BlockPPC64GT, v0)
15664                         return true
15665                 }
15666                 // match: (GT (CMPWconst [0] (Select0 (ANDCCconst [c] x))) yes no)
15667                 // result: (GT (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
15668                 for b.Controls[0].Op == OpPPC64CMPWconst {
15669                         v_0 := b.Controls[0]
15670                         if auxIntToInt32(v_0.AuxInt) != 0 {
15671                                 break
15672                         }
15673                         v_0_0 := v_0.Args[0]
15674                         if v_0_0.Op != OpSelect0 {
15675                                 break
15676                         }
15677                         v_0_0_0 := v_0_0.Args[0]
15678                         if v_0_0_0.Op != OpPPC64ANDCCconst {
15679                                 break
15680                         }
15681                         c := auxIntToInt64(v_0_0_0.AuxInt)
15682                         x := v_0_0_0.Args[0]
15683                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15684                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15685                         v1.AuxInt = int64ToAuxInt(c)
15686                         v1.AddArg(x)
15687                         v0.AddArg(v1)
15688                         b.resetWithControl(BlockPPC64GT, v0)
15689                         return true
15690                 }
15691                 // match: (GT (CMPconst [0] z:(AND x y)) yes no)
15692                 // cond: z.Uses == 1
15693                 // result: (GT (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
15694                 for b.Controls[0].Op == OpPPC64CMPconst {
15695                         v_0 := b.Controls[0]
15696                         if auxIntToInt64(v_0.AuxInt) != 0 {
15697                                 break
15698                         }
15699                         z := v_0.Args[0]
15700                         if z.Op != OpPPC64AND {
15701                                 break
15702                         }
15703                         _ = z.Args[1]
15704                         z_0 := z.Args[0]
15705                         z_1 := z.Args[1]
15706                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15707                                 x := z_0
15708                                 y := z_1
15709                                 if !(z.Uses == 1) {
15710                                         continue
15711                                 }
15712                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15713                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15714                                 v1.AddArg2(x, y)
15715                                 v0.AddArg(v1)
15716                                 b.resetWithControl(BlockPPC64GT, v0)
15717                                 return true
15718                         }
15719                         break
15720                 }
15721                 // match: (GT (CMPconst [0] z:(OR x y)) yes no)
15722                 // cond: z.Uses == 1
15723                 // result: (GT (Select1 <types.TypeFlags> (ORCC x y)) yes no)
15724                 for b.Controls[0].Op == OpPPC64CMPconst {
15725                         v_0 := b.Controls[0]
15726                         if auxIntToInt64(v_0.AuxInt) != 0 {
15727                                 break
15728                         }
15729                         z := v_0.Args[0]
15730                         if z.Op != OpPPC64OR {
15731                                 break
15732                         }
15733                         _ = z.Args[1]
15734                         z_0 := z.Args[0]
15735                         z_1 := z.Args[1]
15736                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15737                                 x := z_0
15738                                 y := z_1
15739                                 if !(z.Uses == 1) {
15740                                         continue
15741                                 }
15742                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15743                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15744                                 v1.AddArg2(x, y)
15745                                 v0.AddArg(v1)
15746                                 b.resetWithControl(BlockPPC64GT, v0)
15747                                 return true
15748                         }
15749                         break
15750                 }
15751                 // match: (GT (CMPconst [0] z:(XOR x y)) yes no)
15752                 // cond: z.Uses == 1
15753                 // result: (GT (Select1 <types.TypeFlags> (XORCC x y)) yes no)
15754                 for b.Controls[0].Op == OpPPC64CMPconst {
15755                         v_0 := b.Controls[0]
15756                         if auxIntToInt64(v_0.AuxInt) != 0 {
15757                                 break
15758                         }
15759                         z := v_0.Args[0]
15760                         if z.Op != OpPPC64XOR {
15761                                 break
15762                         }
15763                         _ = z.Args[1]
15764                         z_0 := z.Args[0]
15765                         z_1 := z.Args[1]
15766                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15767                                 x := z_0
15768                                 y := z_1
15769                                 if !(z.Uses == 1) {
15770                                         continue
15771                                 }
15772                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15773                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15774                                 v1.AddArg2(x, y)
15775                                 v0.AddArg(v1)
15776                                 b.resetWithControl(BlockPPC64GT, v0)
15777                                 return true
15778                         }
15779                         break
15780                 }
15781         case BlockIf:
15782                 // match: (If (Equal cc) yes no)
15783                 // result: (EQ cc yes no)
15784                 for b.Controls[0].Op == OpPPC64Equal {
15785                         v_0 := b.Controls[0]
15786                         cc := v_0.Args[0]
15787                         b.resetWithControl(BlockPPC64EQ, cc)
15788                         return true
15789                 }
15790                 // match: (If (NotEqual cc) yes no)
15791                 // result: (NE cc yes no)
15792                 for b.Controls[0].Op == OpPPC64NotEqual {
15793                         v_0 := b.Controls[0]
15794                         cc := v_0.Args[0]
15795                         b.resetWithControl(BlockPPC64NE, cc)
15796                         return true
15797                 }
15798                 // match: (If (LessThan cc) yes no)
15799                 // result: (LT cc yes no)
15800                 for b.Controls[0].Op == OpPPC64LessThan {
15801                         v_0 := b.Controls[0]
15802                         cc := v_0.Args[0]
15803                         b.resetWithControl(BlockPPC64LT, cc)
15804                         return true
15805                 }
15806                 // match: (If (LessEqual cc) yes no)
15807                 // result: (LE cc yes no)
15808                 for b.Controls[0].Op == OpPPC64LessEqual {
15809                         v_0 := b.Controls[0]
15810                         cc := v_0.Args[0]
15811                         b.resetWithControl(BlockPPC64LE, cc)
15812                         return true
15813                 }
15814                 // match: (If (GreaterThan cc) yes no)
15815                 // result: (GT cc yes no)
15816                 for b.Controls[0].Op == OpPPC64GreaterThan {
15817                         v_0 := b.Controls[0]
15818                         cc := v_0.Args[0]
15819                         b.resetWithControl(BlockPPC64GT, cc)
15820                         return true
15821                 }
15822                 // match: (If (GreaterEqual cc) yes no)
15823                 // result: (GE cc yes no)
15824                 for b.Controls[0].Op == OpPPC64GreaterEqual {
15825                         v_0 := b.Controls[0]
15826                         cc := v_0.Args[0]
15827                         b.resetWithControl(BlockPPC64GE, cc)
15828                         return true
15829                 }
15830                 // match: (If (FLessThan cc) yes no)
15831                 // result: (FLT cc yes no)
15832                 for b.Controls[0].Op == OpPPC64FLessThan {
15833                         v_0 := b.Controls[0]
15834                         cc := v_0.Args[0]
15835                         b.resetWithControl(BlockPPC64FLT, cc)
15836                         return true
15837                 }
15838                 // match: (If (FLessEqual cc) yes no)
15839                 // result: (FLE cc yes no)
15840                 for b.Controls[0].Op == OpPPC64FLessEqual {
15841                         v_0 := b.Controls[0]
15842                         cc := v_0.Args[0]
15843                         b.resetWithControl(BlockPPC64FLE, cc)
15844                         return true
15845                 }
15846                 // match: (If (FGreaterThan cc) yes no)
15847                 // result: (FGT cc yes no)
15848                 for b.Controls[0].Op == OpPPC64FGreaterThan {
15849                         v_0 := b.Controls[0]
15850                         cc := v_0.Args[0]
15851                         b.resetWithControl(BlockPPC64FGT, cc)
15852                         return true
15853                 }
15854                 // match: (If (FGreaterEqual cc) yes no)
15855                 // result: (FGE cc yes no)
15856                 for b.Controls[0].Op == OpPPC64FGreaterEqual {
15857                         v_0 := b.Controls[0]
15858                         cc := v_0.Args[0]
15859                         b.resetWithControl(BlockPPC64FGE, cc)
15860                         return true
15861                 }
15862                 // match: (If cond yes no)
15863                 // result: (NE (CMPWconst [0] (Select0 <typ.UInt32> (ANDCCconst [1] cond))) yes no)
15864                 for {
15865                         cond := b.Controls[0]
15866                         v0 := b.NewValue0(cond.Pos, OpPPC64CMPWconst, types.TypeFlags)
15867                         v0.AuxInt = int32ToAuxInt(0)
15868                         v1 := b.NewValue0(cond.Pos, OpSelect0, typ.UInt32)
15869                         v2 := b.NewValue0(cond.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15870                         v2.AuxInt = int64ToAuxInt(1)
15871                         v2.AddArg(cond)
15872                         v1.AddArg(v2)
15873                         v0.AddArg(v1)
15874                         b.resetWithControl(BlockPPC64NE, v0)
15875                         return true
15876                 }
15877         case BlockPPC64LE:
15878                 // match: (LE (FlagEQ) yes no)
15879                 // result: (First yes no)
15880                 for b.Controls[0].Op == OpPPC64FlagEQ {
15881                         b.Reset(BlockFirst)
15882                         return true
15883                 }
15884                 // match: (LE (FlagLT) yes no)
15885                 // result: (First yes no)
15886                 for b.Controls[0].Op == OpPPC64FlagLT {
15887                         b.Reset(BlockFirst)
15888                         return true
15889                 }
15890                 // match: (LE (FlagGT) yes no)
15891                 // result: (First no yes)
15892                 for b.Controls[0].Op == OpPPC64FlagGT {
15893                         b.Reset(BlockFirst)
15894                         b.swapSuccessors()
15895                         return true
15896                 }
15897                 // match: (LE (InvertFlags cmp) yes no)
15898                 // result: (GE cmp yes no)
15899                 for b.Controls[0].Op == OpPPC64InvertFlags {
15900                         v_0 := b.Controls[0]
15901                         cmp := v_0.Args[0]
15902                         b.resetWithControl(BlockPPC64GE, cmp)
15903                         return true
15904                 }
15905                 // match: (LE (CMPconst [0] (Select0 (ANDCCconst [c] x))) yes no)
15906                 // result: (LE (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
15907                 for b.Controls[0].Op == OpPPC64CMPconst {
15908                         v_0 := b.Controls[0]
15909                         if auxIntToInt64(v_0.AuxInt) != 0 {
15910                                 break
15911                         }
15912                         v_0_0 := v_0.Args[0]
15913                         if v_0_0.Op != OpSelect0 {
15914                                 break
15915                         }
15916                         v_0_0_0 := v_0_0.Args[0]
15917                         if v_0_0_0.Op != OpPPC64ANDCCconst {
15918                                 break
15919                         }
15920                         c := auxIntToInt64(v_0_0_0.AuxInt)
15921                         x := v_0_0_0.Args[0]
15922                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15923                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15924                         v1.AuxInt = int64ToAuxInt(c)
15925                         v1.AddArg(x)
15926                         v0.AddArg(v1)
15927                         b.resetWithControl(BlockPPC64LE, v0)
15928                         return true
15929                 }
15930                 // match: (LE (CMPWconst [0] (Select0 (ANDCCconst [c] x))) yes no)
15931                 // result: (LE (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
15932                 for b.Controls[0].Op == OpPPC64CMPWconst {
15933                         v_0 := b.Controls[0]
15934                         if auxIntToInt32(v_0.AuxInt) != 0 {
15935                                 break
15936                         }
15937                         v_0_0 := v_0.Args[0]
15938                         if v_0_0.Op != OpSelect0 {
15939                                 break
15940                         }
15941                         v_0_0_0 := v_0_0.Args[0]
15942                         if v_0_0_0.Op != OpPPC64ANDCCconst {
15943                                 break
15944                         }
15945                         c := auxIntToInt64(v_0_0_0.AuxInt)
15946                         x := v_0_0_0.Args[0]
15947                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15948                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15949                         v1.AuxInt = int64ToAuxInt(c)
15950                         v1.AddArg(x)
15951                         v0.AddArg(v1)
15952                         b.resetWithControl(BlockPPC64LE, v0)
15953                         return true
15954                 }
15955                 // match: (LE (CMPconst [0] z:(AND x y)) yes no)
15956                 // cond: z.Uses == 1
15957                 // result: (LE (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
15958                 for b.Controls[0].Op == OpPPC64CMPconst {
15959                         v_0 := b.Controls[0]
15960                         if auxIntToInt64(v_0.AuxInt) != 0 {
15961                                 break
15962                         }
15963                         z := v_0.Args[0]
15964                         if z.Op != OpPPC64AND {
15965                                 break
15966                         }
15967                         _ = z.Args[1]
15968                         z_0 := z.Args[0]
15969                         z_1 := z.Args[1]
15970                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15971                                 x := z_0
15972                                 y := z_1
15973                                 if !(z.Uses == 1) {
15974                                         continue
15975                                 }
15976                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15977                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15978                                 v1.AddArg2(x, y)
15979                                 v0.AddArg(v1)
15980                                 b.resetWithControl(BlockPPC64LE, v0)
15981                                 return true
15982                         }
15983                         break
15984                 }
15985                 // match: (LE (CMPconst [0] z:(OR x y)) yes no)
15986                 // cond: z.Uses == 1
15987                 // result: (LE (Select1 <types.TypeFlags> (ORCC x y)) yes no)
15988                 for b.Controls[0].Op == OpPPC64CMPconst {
15989                         v_0 := b.Controls[0]
15990                         if auxIntToInt64(v_0.AuxInt) != 0 {
15991                                 break
15992                         }
15993                         z := v_0.Args[0]
15994                         if z.Op != OpPPC64OR {
15995                                 break
15996                         }
15997                         _ = z.Args[1]
15998                         z_0 := z.Args[0]
15999                         z_1 := z.Args[1]
16000                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16001                                 x := z_0
16002                                 y := z_1
16003                                 if !(z.Uses == 1) {
16004                                         continue
16005                                 }
16006                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16007                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
16008                                 v1.AddArg2(x, y)
16009                                 v0.AddArg(v1)
16010                                 b.resetWithControl(BlockPPC64LE, v0)
16011                                 return true
16012                         }
16013                         break
16014                 }
16015                 // match: (LE (CMPconst [0] z:(XOR x y)) yes no)
16016                 // cond: z.Uses == 1
16017                 // result: (LE (Select1 <types.TypeFlags> (XORCC x y)) yes no)
16018                 for b.Controls[0].Op == OpPPC64CMPconst {
16019                         v_0 := b.Controls[0]
16020                         if auxIntToInt64(v_0.AuxInt) != 0 {
16021                                 break
16022                         }
16023                         z := v_0.Args[0]
16024                         if z.Op != OpPPC64XOR {
16025                                 break
16026                         }
16027                         _ = z.Args[1]
16028                         z_0 := z.Args[0]
16029                         z_1 := z.Args[1]
16030                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16031                                 x := z_0
16032                                 y := z_1
16033                                 if !(z.Uses == 1) {
16034                                         continue
16035                                 }
16036                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16037                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
16038                                 v1.AddArg2(x, y)
16039                                 v0.AddArg(v1)
16040                                 b.resetWithControl(BlockPPC64LE, v0)
16041                                 return true
16042                         }
16043                         break
16044                 }
16045         case BlockPPC64LT:
16046                 // match: (LT (FlagEQ) yes no)
16047                 // result: (First no yes)
16048                 for b.Controls[0].Op == OpPPC64FlagEQ {
16049                         b.Reset(BlockFirst)
16050                         b.swapSuccessors()
16051                         return true
16052                 }
16053                 // match: (LT (FlagLT) yes no)
16054                 // result: (First yes no)
16055                 for b.Controls[0].Op == OpPPC64FlagLT {
16056                         b.Reset(BlockFirst)
16057                         return true
16058                 }
16059                 // match: (LT (FlagGT) yes no)
16060                 // result: (First no yes)
16061                 for b.Controls[0].Op == OpPPC64FlagGT {
16062                         b.Reset(BlockFirst)
16063                         b.swapSuccessors()
16064                         return true
16065                 }
16066                 // match: (LT (InvertFlags cmp) yes no)
16067                 // result: (GT cmp yes no)
16068                 for b.Controls[0].Op == OpPPC64InvertFlags {
16069                         v_0 := b.Controls[0]
16070                         cmp := v_0.Args[0]
16071                         b.resetWithControl(BlockPPC64GT, cmp)
16072                         return true
16073                 }
16074                 // match: (LT (CMPconst [0] (Select0 (ANDCCconst [c] x))) yes no)
16075                 // result: (LT (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
16076                 for b.Controls[0].Op == OpPPC64CMPconst {
16077                         v_0 := b.Controls[0]
16078                         if auxIntToInt64(v_0.AuxInt) != 0 {
16079                                 break
16080                         }
16081                         v_0_0 := v_0.Args[0]
16082                         if v_0_0.Op != OpSelect0 {
16083                                 break
16084                         }
16085                         v_0_0_0 := v_0_0.Args[0]
16086                         if v_0_0_0.Op != OpPPC64ANDCCconst {
16087                                 break
16088                         }
16089                         c := auxIntToInt64(v_0_0_0.AuxInt)
16090                         x := v_0_0_0.Args[0]
16091                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16092                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
16093                         v1.AuxInt = int64ToAuxInt(c)
16094                         v1.AddArg(x)
16095                         v0.AddArg(v1)
16096                         b.resetWithControl(BlockPPC64LT, v0)
16097                         return true
16098                 }
16099                 // match: (LT (CMPWconst [0] (Select0 (ANDCCconst [c] x))) yes no)
16100                 // result: (LT (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
16101                 for b.Controls[0].Op == OpPPC64CMPWconst {
16102                         v_0 := b.Controls[0]
16103                         if auxIntToInt32(v_0.AuxInt) != 0 {
16104                                 break
16105                         }
16106                         v_0_0 := v_0.Args[0]
16107                         if v_0_0.Op != OpSelect0 {
16108                                 break
16109                         }
16110                         v_0_0_0 := v_0_0.Args[0]
16111                         if v_0_0_0.Op != OpPPC64ANDCCconst {
16112                                 break
16113                         }
16114                         c := auxIntToInt64(v_0_0_0.AuxInt)
16115                         x := v_0_0_0.Args[0]
16116                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16117                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
16118                         v1.AuxInt = int64ToAuxInt(c)
16119                         v1.AddArg(x)
16120                         v0.AddArg(v1)
16121                         b.resetWithControl(BlockPPC64LT, v0)
16122                         return true
16123                 }
16124                 // match: (LT (CMPconst [0] z:(AND x y)) yes no)
16125                 // cond: z.Uses == 1
16126                 // result: (LT (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
16127                 for b.Controls[0].Op == OpPPC64CMPconst {
16128                         v_0 := b.Controls[0]
16129                         if auxIntToInt64(v_0.AuxInt) != 0 {
16130                                 break
16131                         }
16132                         z := v_0.Args[0]
16133                         if z.Op != OpPPC64AND {
16134                                 break
16135                         }
16136                         _ = z.Args[1]
16137                         z_0 := z.Args[0]
16138                         z_1 := z.Args[1]
16139                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16140                                 x := z_0
16141                                 y := z_1
16142                                 if !(z.Uses == 1) {
16143                                         continue
16144                                 }
16145                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16146                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
16147                                 v1.AddArg2(x, y)
16148                                 v0.AddArg(v1)
16149                                 b.resetWithControl(BlockPPC64LT, v0)
16150                                 return true
16151                         }
16152                         break
16153                 }
16154                 // match: (LT (CMPconst [0] z:(OR x y)) yes no)
16155                 // cond: z.Uses == 1
16156                 // result: (LT (Select1 <types.TypeFlags> (ORCC x y)) yes no)
16157                 for b.Controls[0].Op == OpPPC64CMPconst {
16158                         v_0 := b.Controls[0]
16159                         if auxIntToInt64(v_0.AuxInt) != 0 {
16160                                 break
16161                         }
16162                         z := v_0.Args[0]
16163                         if z.Op != OpPPC64OR {
16164                                 break
16165                         }
16166                         _ = z.Args[1]
16167                         z_0 := z.Args[0]
16168                         z_1 := z.Args[1]
16169                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16170                                 x := z_0
16171                                 y := z_1
16172                                 if !(z.Uses == 1) {
16173                                         continue
16174                                 }
16175                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16176                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
16177                                 v1.AddArg2(x, y)
16178                                 v0.AddArg(v1)
16179                                 b.resetWithControl(BlockPPC64LT, v0)
16180                                 return true
16181                         }
16182                         break
16183                 }
16184                 // match: (LT (CMPconst [0] z:(XOR x y)) yes no)
16185                 // cond: z.Uses == 1
16186                 // result: (LT (Select1 <types.TypeFlags> (XORCC x y)) yes no)
16187                 for b.Controls[0].Op == OpPPC64CMPconst {
16188                         v_0 := b.Controls[0]
16189                         if auxIntToInt64(v_0.AuxInt) != 0 {
16190                                 break
16191                         }
16192                         z := v_0.Args[0]
16193                         if z.Op != OpPPC64XOR {
16194                                 break
16195                         }
16196                         _ = z.Args[1]
16197                         z_0 := z.Args[0]
16198                         z_1 := z.Args[1]
16199                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16200                                 x := z_0
16201                                 y := z_1
16202                                 if !(z.Uses == 1) {
16203                                         continue
16204                                 }
16205                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16206                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
16207                                 v1.AddArg2(x, y)
16208                                 v0.AddArg(v1)
16209                                 b.resetWithControl(BlockPPC64LT, v0)
16210                                 return true
16211                         }
16212                         break
16213                 }
16214         case BlockPPC64NE:
16215                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (Equal cc)))) yes no)
16216                 // result: (EQ cc yes no)
16217                 for b.Controls[0].Op == OpPPC64CMPWconst {
16218                         v_0 := b.Controls[0]
16219                         if auxIntToInt32(v_0.AuxInt) != 0 {
16220                                 break
16221                         }
16222                         v_0_0 := v_0.Args[0]
16223                         if v_0_0.Op != OpSelect0 {
16224                                 break
16225                         }
16226                         v_0_0_0 := v_0_0.Args[0]
16227                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16228                                 break
16229                         }
16230                         v_0_0_0_0 := v_0_0_0.Args[0]
16231                         if v_0_0_0_0.Op != OpPPC64Equal {
16232                                 break
16233                         }
16234                         cc := v_0_0_0_0.Args[0]
16235                         b.resetWithControl(BlockPPC64EQ, cc)
16236                         return true
16237                 }
16238                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (NotEqual cc)))) yes no)
16239                 // result: (NE cc yes no)
16240                 for b.Controls[0].Op == OpPPC64CMPWconst {
16241                         v_0 := b.Controls[0]
16242                         if auxIntToInt32(v_0.AuxInt) != 0 {
16243                                 break
16244                         }
16245                         v_0_0 := v_0.Args[0]
16246                         if v_0_0.Op != OpSelect0 {
16247                                 break
16248                         }
16249                         v_0_0_0 := v_0_0.Args[0]
16250                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16251                                 break
16252                         }
16253                         v_0_0_0_0 := v_0_0_0.Args[0]
16254                         if v_0_0_0_0.Op != OpPPC64NotEqual {
16255                                 break
16256                         }
16257                         cc := v_0_0_0_0.Args[0]
16258                         b.resetWithControl(BlockPPC64NE, cc)
16259                         return true
16260                 }
16261                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (LessThan cc)))) yes no)
16262                 // result: (LT cc yes no)
16263                 for b.Controls[0].Op == OpPPC64CMPWconst {
16264                         v_0 := b.Controls[0]
16265                         if auxIntToInt32(v_0.AuxInt) != 0 {
16266                                 break
16267                         }
16268                         v_0_0 := v_0.Args[0]
16269                         if v_0_0.Op != OpSelect0 {
16270                                 break
16271                         }
16272                         v_0_0_0 := v_0_0.Args[0]
16273                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16274                                 break
16275                         }
16276                         v_0_0_0_0 := v_0_0_0.Args[0]
16277                         if v_0_0_0_0.Op != OpPPC64LessThan {
16278                                 break
16279                         }
16280                         cc := v_0_0_0_0.Args[0]
16281                         b.resetWithControl(BlockPPC64LT, cc)
16282                         return true
16283                 }
16284                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (LessEqual cc)))) yes no)
16285                 // result: (LE cc yes no)
16286                 for b.Controls[0].Op == OpPPC64CMPWconst {
16287                         v_0 := b.Controls[0]
16288                         if auxIntToInt32(v_0.AuxInt) != 0 {
16289                                 break
16290                         }
16291                         v_0_0 := v_0.Args[0]
16292                         if v_0_0.Op != OpSelect0 {
16293                                 break
16294                         }
16295                         v_0_0_0 := v_0_0.Args[0]
16296                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16297                                 break
16298                         }
16299                         v_0_0_0_0 := v_0_0_0.Args[0]
16300                         if v_0_0_0_0.Op != OpPPC64LessEqual {
16301                                 break
16302                         }
16303                         cc := v_0_0_0_0.Args[0]
16304                         b.resetWithControl(BlockPPC64LE, cc)
16305                         return true
16306                 }
16307                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (GreaterThan cc)))) yes no)
16308                 // result: (GT cc yes no)
16309                 for b.Controls[0].Op == OpPPC64CMPWconst {
16310                         v_0 := b.Controls[0]
16311                         if auxIntToInt32(v_0.AuxInt) != 0 {
16312                                 break
16313                         }
16314                         v_0_0 := v_0.Args[0]
16315                         if v_0_0.Op != OpSelect0 {
16316                                 break
16317                         }
16318                         v_0_0_0 := v_0_0.Args[0]
16319                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16320                                 break
16321                         }
16322                         v_0_0_0_0 := v_0_0_0.Args[0]
16323                         if v_0_0_0_0.Op != OpPPC64GreaterThan {
16324                                 break
16325                         }
16326                         cc := v_0_0_0_0.Args[0]
16327                         b.resetWithControl(BlockPPC64GT, cc)
16328                         return true
16329                 }
16330                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (GreaterEqual cc)))) yes no)
16331                 // result: (GE cc yes no)
16332                 for b.Controls[0].Op == OpPPC64CMPWconst {
16333                         v_0 := b.Controls[0]
16334                         if auxIntToInt32(v_0.AuxInt) != 0 {
16335                                 break
16336                         }
16337                         v_0_0 := v_0.Args[0]
16338                         if v_0_0.Op != OpSelect0 {
16339                                 break
16340                         }
16341                         v_0_0_0 := v_0_0.Args[0]
16342                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16343                                 break
16344                         }
16345                         v_0_0_0_0 := v_0_0_0.Args[0]
16346                         if v_0_0_0_0.Op != OpPPC64GreaterEqual {
16347                                 break
16348                         }
16349                         cc := v_0_0_0_0.Args[0]
16350                         b.resetWithControl(BlockPPC64GE, cc)
16351                         return true
16352                 }
16353                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FLessThan cc)))) yes no)
16354                 // result: (FLT cc yes no)
16355                 for b.Controls[0].Op == OpPPC64CMPWconst {
16356                         v_0 := b.Controls[0]
16357                         if auxIntToInt32(v_0.AuxInt) != 0 {
16358                                 break
16359                         }
16360                         v_0_0 := v_0.Args[0]
16361                         if v_0_0.Op != OpSelect0 {
16362                                 break
16363                         }
16364                         v_0_0_0 := v_0_0.Args[0]
16365                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16366                                 break
16367                         }
16368                         v_0_0_0_0 := v_0_0_0.Args[0]
16369                         if v_0_0_0_0.Op != OpPPC64FLessThan {
16370                                 break
16371                         }
16372                         cc := v_0_0_0_0.Args[0]
16373                         b.resetWithControl(BlockPPC64FLT, cc)
16374                         return true
16375                 }
16376                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FLessEqual cc)))) yes no)
16377                 // result: (FLE cc yes no)
16378                 for b.Controls[0].Op == OpPPC64CMPWconst {
16379                         v_0 := b.Controls[0]
16380                         if auxIntToInt32(v_0.AuxInt) != 0 {
16381                                 break
16382                         }
16383                         v_0_0 := v_0.Args[0]
16384                         if v_0_0.Op != OpSelect0 {
16385                                 break
16386                         }
16387                         v_0_0_0 := v_0_0.Args[0]
16388                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16389                                 break
16390                         }
16391                         v_0_0_0_0 := v_0_0_0.Args[0]
16392                         if v_0_0_0_0.Op != OpPPC64FLessEqual {
16393                                 break
16394                         }
16395                         cc := v_0_0_0_0.Args[0]
16396                         b.resetWithControl(BlockPPC64FLE, cc)
16397                         return true
16398                 }
16399                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FGreaterThan cc)))) yes no)
16400                 // result: (FGT cc yes no)
16401                 for b.Controls[0].Op == OpPPC64CMPWconst {
16402                         v_0 := b.Controls[0]
16403                         if auxIntToInt32(v_0.AuxInt) != 0 {
16404                                 break
16405                         }
16406                         v_0_0 := v_0.Args[0]
16407                         if v_0_0.Op != OpSelect0 {
16408                                 break
16409                         }
16410                         v_0_0_0 := v_0_0.Args[0]
16411                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16412                                 break
16413                         }
16414                         v_0_0_0_0 := v_0_0_0.Args[0]
16415                         if v_0_0_0_0.Op != OpPPC64FGreaterThan {
16416                                 break
16417                         }
16418                         cc := v_0_0_0_0.Args[0]
16419                         b.resetWithControl(BlockPPC64FGT, cc)
16420                         return true
16421                 }
16422                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FGreaterEqual cc)))) yes no)
16423                 // result: (FGE cc yes no)
16424                 for b.Controls[0].Op == OpPPC64CMPWconst {
16425                         v_0 := b.Controls[0]
16426                         if auxIntToInt32(v_0.AuxInt) != 0 {
16427                                 break
16428                         }
16429                         v_0_0 := v_0.Args[0]
16430                         if v_0_0.Op != OpSelect0 {
16431                                 break
16432                         }
16433                         v_0_0_0 := v_0_0.Args[0]
16434                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16435                                 break
16436                         }
16437                         v_0_0_0_0 := v_0_0_0.Args[0]
16438                         if v_0_0_0_0.Op != OpPPC64FGreaterEqual {
16439                                 break
16440                         }
16441                         cc := v_0_0_0_0.Args[0]
16442                         b.resetWithControl(BlockPPC64FGE, cc)
16443                         return true
16444                 }
16445                 // match: (NE (CMPconst [0] (Select0 (ANDCCconst [c] x))) yes no)
16446                 // result: (NE (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
16447                 for b.Controls[0].Op == OpPPC64CMPconst {
16448                         v_0 := b.Controls[0]
16449                         if auxIntToInt64(v_0.AuxInt) != 0 {
16450                                 break
16451                         }
16452                         v_0_0 := v_0.Args[0]
16453                         if v_0_0.Op != OpSelect0 {
16454                                 break
16455                         }
16456                         v_0_0_0 := v_0_0.Args[0]
16457                         if v_0_0_0.Op != OpPPC64ANDCCconst {
16458                                 break
16459                         }
16460                         c := auxIntToInt64(v_0_0_0.AuxInt)
16461                         x := v_0_0_0.Args[0]
16462                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16463                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
16464                         v1.AuxInt = int64ToAuxInt(c)
16465                         v1.AddArg(x)
16466                         v0.AddArg(v1)
16467                         b.resetWithControl(BlockPPC64NE, v0)
16468                         return true
16469                 }
16470                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [c] x))) yes no)
16471                 // result: (NE (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
16472                 for b.Controls[0].Op == OpPPC64CMPWconst {
16473                         v_0 := b.Controls[0]
16474                         if auxIntToInt32(v_0.AuxInt) != 0 {
16475                                 break
16476                         }
16477                         v_0_0 := v_0.Args[0]
16478                         if v_0_0.Op != OpSelect0 {
16479                                 break
16480                         }
16481                         v_0_0_0 := v_0_0.Args[0]
16482                         if v_0_0_0.Op != OpPPC64ANDCCconst {
16483                                 break
16484                         }
16485                         c := auxIntToInt64(v_0_0_0.AuxInt)
16486                         x := v_0_0_0.Args[0]
16487                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16488                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
16489                         v1.AuxInt = int64ToAuxInt(c)
16490                         v1.AddArg(x)
16491                         v0.AddArg(v1)
16492                         b.resetWithControl(BlockPPC64NE, v0)
16493                         return true
16494                 }
16495                 // match: (NE (FlagEQ) yes no)
16496                 // result: (First no yes)
16497                 for b.Controls[0].Op == OpPPC64FlagEQ {
16498                         b.Reset(BlockFirst)
16499                         b.swapSuccessors()
16500                         return true
16501                 }
16502                 // match: (NE (FlagLT) yes no)
16503                 // result: (First yes no)
16504                 for b.Controls[0].Op == OpPPC64FlagLT {
16505                         b.Reset(BlockFirst)
16506                         return true
16507                 }
16508                 // match: (NE (FlagGT) yes no)
16509                 // result: (First yes no)
16510                 for b.Controls[0].Op == OpPPC64FlagGT {
16511                         b.Reset(BlockFirst)
16512                         return true
16513                 }
16514                 // match: (NE (InvertFlags cmp) yes no)
16515                 // result: (NE cmp yes no)
16516                 for b.Controls[0].Op == OpPPC64InvertFlags {
16517                         v_0 := b.Controls[0]
16518                         cmp := v_0.Args[0]
16519                         b.resetWithControl(BlockPPC64NE, cmp)
16520                         return true
16521                 }
16522                 // match: (NE (CMPconst [0] (Select0 (ANDCCconst [c] x))) yes no)
16523                 // result: (NE (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
16524                 for b.Controls[0].Op == OpPPC64CMPconst {
16525                         v_0 := b.Controls[0]
16526                         if auxIntToInt64(v_0.AuxInt) != 0 {
16527                                 break
16528                         }
16529                         v_0_0 := v_0.Args[0]
16530                         if v_0_0.Op != OpSelect0 {
16531                                 break
16532                         }
16533                         v_0_0_0 := v_0_0.Args[0]
16534                         if v_0_0_0.Op != OpPPC64ANDCCconst {
16535                                 break
16536                         }
16537                         c := auxIntToInt64(v_0_0_0.AuxInt)
16538                         x := v_0_0_0.Args[0]
16539                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16540                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
16541                         v1.AuxInt = int64ToAuxInt(c)
16542                         v1.AddArg(x)
16543                         v0.AddArg(v1)
16544                         b.resetWithControl(BlockPPC64NE, v0)
16545                         return true
16546                 }
16547                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [c] x))) yes no)
16548                 // result: (NE (Select1 <types.TypeFlags> (ANDCCconst [c] x)) yes no)
16549                 for b.Controls[0].Op == OpPPC64CMPWconst {
16550                         v_0 := b.Controls[0]
16551                         if auxIntToInt32(v_0.AuxInt) != 0 {
16552                                 break
16553                         }
16554                         v_0_0 := v_0.Args[0]
16555                         if v_0_0.Op != OpSelect0 {
16556                                 break
16557                         }
16558                         v_0_0_0 := v_0_0.Args[0]
16559                         if v_0_0_0.Op != OpPPC64ANDCCconst {
16560                                 break
16561                         }
16562                         c := auxIntToInt64(v_0_0_0.AuxInt)
16563                         x := v_0_0_0.Args[0]
16564                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16565                         v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
16566                         v1.AuxInt = int64ToAuxInt(c)
16567                         v1.AddArg(x)
16568                         v0.AddArg(v1)
16569                         b.resetWithControl(BlockPPC64NE, v0)
16570                         return true
16571                 }
16572                 // match: (NE (CMPconst [0] z:(AND x y)) yes no)
16573                 // cond: z.Uses == 1
16574                 // result: (NE (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
16575                 for b.Controls[0].Op == OpPPC64CMPconst {
16576                         v_0 := b.Controls[0]
16577                         if auxIntToInt64(v_0.AuxInt) != 0 {
16578                                 break
16579                         }
16580                         z := v_0.Args[0]
16581                         if z.Op != OpPPC64AND {
16582                                 break
16583                         }
16584                         _ = z.Args[1]
16585                         z_0 := z.Args[0]
16586                         z_1 := z.Args[1]
16587                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16588                                 x := z_0
16589                                 y := z_1
16590                                 if !(z.Uses == 1) {
16591                                         continue
16592                                 }
16593                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16594                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
16595                                 v1.AddArg2(x, y)
16596                                 v0.AddArg(v1)
16597                                 b.resetWithControl(BlockPPC64NE, v0)
16598                                 return true
16599                         }
16600                         break
16601                 }
16602                 // match: (NE (CMPconst [0] z:(OR x y)) yes no)
16603                 // cond: z.Uses == 1
16604                 // result: (NE (Select1 <types.TypeFlags> (ORCC x y)) yes no)
16605                 for b.Controls[0].Op == OpPPC64CMPconst {
16606                         v_0 := b.Controls[0]
16607                         if auxIntToInt64(v_0.AuxInt) != 0 {
16608                                 break
16609                         }
16610                         z := v_0.Args[0]
16611                         if z.Op != OpPPC64OR {
16612                                 break
16613                         }
16614                         _ = z.Args[1]
16615                         z_0 := z.Args[0]
16616                         z_1 := z.Args[1]
16617                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16618                                 x := z_0
16619                                 y := z_1
16620                                 if !(z.Uses == 1) {
16621                                         continue
16622                                 }
16623                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16624                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
16625                                 v1.AddArg2(x, y)
16626                                 v0.AddArg(v1)
16627                                 b.resetWithControl(BlockPPC64NE, v0)
16628                                 return true
16629                         }
16630                         break
16631                 }
16632                 // match: (NE (CMPconst [0] z:(XOR x y)) yes no)
16633                 // cond: z.Uses == 1
16634                 // result: (NE (Select1 <types.TypeFlags> (XORCC x y)) yes no)
16635                 for b.Controls[0].Op == OpPPC64CMPconst {
16636                         v_0 := b.Controls[0]
16637                         if auxIntToInt64(v_0.AuxInt) != 0 {
16638                                 break
16639                         }
16640                         z := v_0.Args[0]
16641                         if z.Op != OpPPC64XOR {
16642                                 break
16643                         }
16644                         _ = z.Args[1]
16645                         z_0 := z.Args[0]
16646                         z_1 := z.Args[1]
16647                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16648                                 x := z_0
16649                                 y := z_1
16650                                 if !(z.Uses == 1) {
16651                                         continue
16652                                 }
16653                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16654                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
16655                                 v1.AddArg2(x, y)
16656                                 v0.AddArg(v1)
16657                                 b.resetWithControl(BlockPPC64NE, v0)
16658                                 return true
16659                         }
16660                         break
16661                 }
16662         }
16663         return false
16664 }