]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/compile/internal/ssa/rewritePPC64.go
cmd/compile: avoid ANDCCconst on PPC64 if condition not needed
[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 OpPPC64MOVDaddr:
537                 return rewriteValuePPC64_OpPPC64MOVDaddr(v)
538         case OpPPC64MOVDload:
539                 return rewriteValuePPC64_OpPPC64MOVDload(v)
540         case OpPPC64MOVDloadidx:
541                 return rewriteValuePPC64_OpPPC64MOVDloadidx(v)
542         case OpPPC64MOVDstore:
543                 return rewriteValuePPC64_OpPPC64MOVDstore(v)
544         case OpPPC64MOVDstoreidx:
545                 return rewriteValuePPC64_OpPPC64MOVDstoreidx(v)
546         case OpPPC64MOVDstorezero:
547                 return rewriteValuePPC64_OpPPC64MOVDstorezero(v)
548         case OpPPC64MOVHBRstore:
549                 return rewriteValuePPC64_OpPPC64MOVHBRstore(v)
550         case OpPPC64MOVHZload:
551                 return rewriteValuePPC64_OpPPC64MOVHZload(v)
552         case OpPPC64MOVHZloadidx:
553                 return rewriteValuePPC64_OpPPC64MOVHZloadidx(v)
554         case OpPPC64MOVHZreg:
555                 return rewriteValuePPC64_OpPPC64MOVHZreg(v)
556         case OpPPC64MOVHload:
557                 return rewriteValuePPC64_OpPPC64MOVHload(v)
558         case OpPPC64MOVHloadidx:
559                 return rewriteValuePPC64_OpPPC64MOVHloadidx(v)
560         case OpPPC64MOVHreg:
561                 return rewriteValuePPC64_OpPPC64MOVHreg(v)
562         case OpPPC64MOVHstore:
563                 return rewriteValuePPC64_OpPPC64MOVHstore(v)
564         case OpPPC64MOVHstoreidx:
565                 return rewriteValuePPC64_OpPPC64MOVHstoreidx(v)
566         case OpPPC64MOVHstorezero:
567                 return rewriteValuePPC64_OpPPC64MOVHstorezero(v)
568         case OpPPC64MOVWBRstore:
569                 return rewriteValuePPC64_OpPPC64MOVWBRstore(v)
570         case OpPPC64MOVWZload:
571                 return rewriteValuePPC64_OpPPC64MOVWZload(v)
572         case OpPPC64MOVWZloadidx:
573                 return rewriteValuePPC64_OpPPC64MOVWZloadidx(v)
574         case OpPPC64MOVWZreg:
575                 return rewriteValuePPC64_OpPPC64MOVWZreg(v)
576         case OpPPC64MOVWload:
577                 return rewriteValuePPC64_OpPPC64MOVWload(v)
578         case OpPPC64MOVWloadidx:
579                 return rewriteValuePPC64_OpPPC64MOVWloadidx(v)
580         case OpPPC64MOVWreg:
581                 return rewriteValuePPC64_OpPPC64MOVWreg(v)
582         case OpPPC64MOVWstore:
583                 return rewriteValuePPC64_OpPPC64MOVWstore(v)
584         case OpPPC64MOVWstoreidx:
585                 return rewriteValuePPC64_OpPPC64MOVWstoreidx(v)
586         case OpPPC64MOVWstorezero:
587                 return rewriteValuePPC64_OpPPC64MOVWstorezero(v)
588         case OpPPC64MTVSRD:
589                 return rewriteValuePPC64_OpPPC64MTVSRD(v)
590         case OpPPC64MULLD:
591                 return rewriteValuePPC64_OpPPC64MULLD(v)
592         case OpPPC64MULLW:
593                 return rewriteValuePPC64_OpPPC64MULLW(v)
594         case OpPPC64NEG:
595                 return rewriteValuePPC64_OpPPC64NEG(v)
596         case OpPPC64NOR:
597                 return rewriteValuePPC64_OpPPC64NOR(v)
598         case OpPPC64NotEqual:
599                 return rewriteValuePPC64_OpPPC64NotEqual(v)
600         case OpPPC64OR:
601                 return rewriteValuePPC64_OpPPC64OR(v)
602         case OpPPC64ORN:
603                 return rewriteValuePPC64_OpPPC64ORN(v)
604         case OpPPC64ORconst:
605                 return rewriteValuePPC64_OpPPC64ORconst(v)
606         case OpPPC64ROTL:
607                 return rewriteValuePPC64_OpPPC64ROTL(v)
608         case OpPPC64ROTLW:
609                 return rewriteValuePPC64_OpPPC64ROTLW(v)
610         case OpPPC64ROTLWconst:
611                 return rewriteValuePPC64_OpPPC64ROTLWconst(v)
612         case OpPPC64SETBC:
613                 return rewriteValuePPC64_OpPPC64SETBC(v)
614         case OpPPC64SETBCR:
615                 return rewriteValuePPC64_OpPPC64SETBCR(v)
616         case OpPPC64SLD:
617                 return rewriteValuePPC64_OpPPC64SLD(v)
618         case OpPPC64SLDconst:
619                 return rewriteValuePPC64_OpPPC64SLDconst(v)
620         case OpPPC64SLW:
621                 return rewriteValuePPC64_OpPPC64SLW(v)
622         case OpPPC64SLWconst:
623                 return rewriteValuePPC64_OpPPC64SLWconst(v)
624         case OpPPC64SRAD:
625                 return rewriteValuePPC64_OpPPC64SRAD(v)
626         case OpPPC64SRAW:
627                 return rewriteValuePPC64_OpPPC64SRAW(v)
628         case OpPPC64SRD:
629                 return rewriteValuePPC64_OpPPC64SRD(v)
630         case OpPPC64SRW:
631                 return rewriteValuePPC64_OpPPC64SRW(v)
632         case OpPPC64SRWconst:
633                 return rewriteValuePPC64_OpPPC64SRWconst(v)
634         case OpPPC64SUB:
635                 return rewriteValuePPC64_OpPPC64SUB(v)
636         case OpPPC64SUBE:
637                 return rewriteValuePPC64_OpPPC64SUBE(v)
638         case OpPPC64SUBFCconst:
639                 return rewriteValuePPC64_OpPPC64SUBFCconst(v)
640         case OpPPC64XOR:
641                 return rewriteValuePPC64_OpPPC64XOR(v)
642         case OpPPC64XORconst:
643                 return rewriteValuePPC64_OpPPC64XORconst(v)
644         case OpPanicBounds:
645                 return rewriteValuePPC64_OpPanicBounds(v)
646         case OpPopCount16:
647                 return rewriteValuePPC64_OpPopCount16(v)
648         case OpPopCount32:
649                 return rewriteValuePPC64_OpPopCount32(v)
650         case OpPopCount64:
651                 v.Op = OpPPC64POPCNTD
652                 return true
653         case OpPopCount8:
654                 return rewriteValuePPC64_OpPopCount8(v)
655         case OpPrefetchCache:
656                 return rewriteValuePPC64_OpPrefetchCache(v)
657         case OpPrefetchCacheStreamed:
658                 return rewriteValuePPC64_OpPrefetchCacheStreamed(v)
659         case OpPubBarrier:
660                 v.Op = OpPPC64LoweredPubBarrier
661                 return true
662         case OpRotateLeft16:
663                 return rewriteValuePPC64_OpRotateLeft16(v)
664         case OpRotateLeft32:
665                 v.Op = OpPPC64ROTLW
666                 return true
667         case OpRotateLeft64:
668                 v.Op = OpPPC64ROTL
669                 return true
670         case OpRotateLeft8:
671                 return rewriteValuePPC64_OpRotateLeft8(v)
672         case OpRound:
673                 v.Op = OpPPC64FROUND
674                 return true
675         case OpRound32F:
676                 v.Op = OpPPC64LoweredRound32F
677                 return true
678         case OpRound64F:
679                 v.Op = OpPPC64LoweredRound64F
680                 return true
681         case OpRsh16Ux16:
682                 return rewriteValuePPC64_OpRsh16Ux16(v)
683         case OpRsh16Ux32:
684                 return rewriteValuePPC64_OpRsh16Ux32(v)
685         case OpRsh16Ux64:
686                 return rewriteValuePPC64_OpRsh16Ux64(v)
687         case OpRsh16Ux8:
688                 return rewriteValuePPC64_OpRsh16Ux8(v)
689         case OpRsh16x16:
690                 return rewriteValuePPC64_OpRsh16x16(v)
691         case OpRsh16x32:
692                 return rewriteValuePPC64_OpRsh16x32(v)
693         case OpRsh16x64:
694                 return rewriteValuePPC64_OpRsh16x64(v)
695         case OpRsh16x8:
696                 return rewriteValuePPC64_OpRsh16x8(v)
697         case OpRsh32Ux16:
698                 return rewriteValuePPC64_OpRsh32Ux16(v)
699         case OpRsh32Ux32:
700                 return rewriteValuePPC64_OpRsh32Ux32(v)
701         case OpRsh32Ux64:
702                 return rewriteValuePPC64_OpRsh32Ux64(v)
703         case OpRsh32Ux8:
704                 return rewriteValuePPC64_OpRsh32Ux8(v)
705         case OpRsh32x16:
706                 return rewriteValuePPC64_OpRsh32x16(v)
707         case OpRsh32x32:
708                 return rewriteValuePPC64_OpRsh32x32(v)
709         case OpRsh32x64:
710                 return rewriteValuePPC64_OpRsh32x64(v)
711         case OpRsh32x8:
712                 return rewriteValuePPC64_OpRsh32x8(v)
713         case OpRsh64Ux16:
714                 return rewriteValuePPC64_OpRsh64Ux16(v)
715         case OpRsh64Ux32:
716                 return rewriteValuePPC64_OpRsh64Ux32(v)
717         case OpRsh64Ux64:
718                 return rewriteValuePPC64_OpRsh64Ux64(v)
719         case OpRsh64Ux8:
720                 return rewriteValuePPC64_OpRsh64Ux8(v)
721         case OpRsh64x16:
722                 return rewriteValuePPC64_OpRsh64x16(v)
723         case OpRsh64x32:
724                 return rewriteValuePPC64_OpRsh64x32(v)
725         case OpRsh64x64:
726                 return rewriteValuePPC64_OpRsh64x64(v)
727         case OpRsh64x8:
728                 return rewriteValuePPC64_OpRsh64x8(v)
729         case OpRsh8Ux16:
730                 return rewriteValuePPC64_OpRsh8Ux16(v)
731         case OpRsh8Ux32:
732                 return rewriteValuePPC64_OpRsh8Ux32(v)
733         case OpRsh8Ux64:
734                 return rewriteValuePPC64_OpRsh8Ux64(v)
735         case OpRsh8Ux8:
736                 return rewriteValuePPC64_OpRsh8Ux8(v)
737         case OpRsh8x16:
738                 return rewriteValuePPC64_OpRsh8x16(v)
739         case OpRsh8x32:
740                 return rewriteValuePPC64_OpRsh8x32(v)
741         case OpRsh8x64:
742                 return rewriteValuePPC64_OpRsh8x64(v)
743         case OpRsh8x8:
744                 return rewriteValuePPC64_OpRsh8x8(v)
745         case OpSelect0:
746                 return rewriteValuePPC64_OpSelect0(v)
747         case OpSelect1:
748                 return rewriteValuePPC64_OpSelect1(v)
749         case OpSelectN:
750                 return rewriteValuePPC64_OpSelectN(v)
751         case OpSignExt16to32:
752                 v.Op = OpPPC64MOVHreg
753                 return true
754         case OpSignExt16to64:
755                 v.Op = OpPPC64MOVHreg
756                 return true
757         case OpSignExt32to64:
758                 v.Op = OpPPC64MOVWreg
759                 return true
760         case OpSignExt8to16:
761                 v.Op = OpPPC64MOVBreg
762                 return true
763         case OpSignExt8to32:
764                 v.Op = OpPPC64MOVBreg
765                 return true
766         case OpSignExt8to64:
767                 v.Op = OpPPC64MOVBreg
768                 return true
769         case OpSlicemask:
770                 return rewriteValuePPC64_OpSlicemask(v)
771         case OpSqrt:
772                 v.Op = OpPPC64FSQRT
773                 return true
774         case OpSqrt32:
775                 v.Op = OpPPC64FSQRTS
776                 return true
777         case OpStaticCall:
778                 v.Op = OpPPC64CALLstatic
779                 return true
780         case OpStore:
781                 return rewriteValuePPC64_OpStore(v)
782         case OpSub16:
783                 v.Op = OpPPC64SUB
784                 return true
785         case OpSub32:
786                 v.Op = OpPPC64SUB
787                 return true
788         case OpSub32F:
789                 v.Op = OpPPC64FSUBS
790                 return true
791         case OpSub64:
792                 v.Op = OpPPC64SUB
793                 return true
794         case OpSub64F:
795                 v.Op = OpPPC64FSUB
796                 return true
797         case OpSub8:
798                 v.Op = OpPPC64SUB
799                 return true
800         case OpSubPtr:
801                 v.Op = OpPPC64SUB
802                 return true
803         case OpTailCall:
804                 v.Op = OpPPC64CALLtail
805                 return true
806         case OpTrunc:
807                 v.Op = OpPPC64FTRUNC
808                 return true
809         case OpTrunc16to8:
810                 return rewriteValuePPC64_OpTrunc16to8(v)
811         case OpTrunc32to16:
812                 return rewriteValuePPC64_OpTrunc32to16(v)
813         case OpTrunc32to8:
814                 return rewriteValuePPC64_OpTrunc32to8(v)
815         case OpTrunc64to16:
816                 return rewriteValuePPC64_OpTrunc64to16(v)
817         case OpTrunc64to32:
818                 return rewriteValuePPC64_OpTrunc64to32(v)
819         case OpTrunc64to8:
820                 return rewriteValuePPC64_OpTrunc64to8(v)
821         case OpWB:
822                 v.Op = OpPPC64LoweredWB
823                 return true
824         case OpXor16:
825                 v.Op = OpPPC64XOR
826                 return true
827         case OpXor32:
828                 v.Op = OpPPC64XOR
829                 return true
830         case OpXor64:
831                 v.Op = OpPPC64XOR
832                 return true
833         case OpXor8:
834                 v.Op = OpPPC64XOR
835                 return true
836         case OpZero:
837                 return rewriteValuePPC64_OpZero(v)
838         case OpZeroExt16to32:
839                 v.Op = OpPPC64MOVHZreg
840                 return true
841         case OpZeroExt16to64:
842                 v.Op = OpPPC64MOVHZreg
843                 return true
844         case OpZeroExt32to64:
845                 v.Op = OpPPC64MOVWZreg
846                 return true
847         case OpZeroExt8to16:
848                 v.Op = OpPPC64MOVBZreg
849                 return true
850         case OpZeroExt8to32:
851                 v.Op = OpPPC64MOVBZreg
852                 return true
853         case OpZeroExt8to64:
854                 v.Op = OpPPC64MOVBZreg
855                 return true
856         }
857         return false
858 }
859 func rewriteValuePPC64_OpAddr(v *Value) bool {
860         v_0 := v.Args[0]
861         // match: (Addr {sym} base)
862         // result: (MOVDaddr {sym} [0] base)
863         for {
864                 sym := auxToSym(v.Aux)
865                 base := v_0
866                 v.reset(OpPPC64MOVDaddr)
867                 v.AuxInt = int32ToAuxInt(0)
868                 v.Aux = symToAux(sym)
869                 v.AddArg(base)
870                 return true
871         }
872 }
873 func rewriteValuePPC64_OpAtomicCompareAndSwap32(v *Value) bool {
874         v_3 := v.Args[3]
875         v_2 := v.Args[2]
876         v_1 := v.Args[1]
877         v_0 := v.Args[0]
878         // match: (AtomicCompareAndSwap32 ptr old new_ mem)
879         // result: (LoweredAtomicCas32 [1] ptr old new_ mem)
880         for {
881                 ptr := v_0
882                 old := v_1
883                 new_ := v_2
884                 mem := v_3
885                 v.reset(OpPPC64LoweredAtomicCas32)
886                 v.AuxInt = int64ToAuxInt(1)
887                 v.AddArg4(ptr, old, new_, mem)
888                 return true
889         }
890 }
891 func rewriteValuePPC64_OpAtomicCompareAndSwap64(v *Value) bool {
892         v_3 := v.Args[3]
893         v_2 := v.Args[2]
894         v_1 := v.Args[1]
895         v_0 := v.Args[0]
896         // match: (AtomicCompareAndSwap64 ptr old new_ mem)
897         // result: (LoweredAtomicCas64 [1] ptr old new_ mem)
898         for {
899                 ptr := v_0
900                 old := v_1
901                 new_ := v_2
902                 mem := v_3
903                 v.reset(OpPPC64LoweredAtomicCas64)
904                 v.AuxInt = int64ToAuxInt(1)
905                 v.AddArg4(ptr, old, new_, mem)
906                 return true
907         }
908 }
909 func rewriteValuePPC64_OpAtomicCompareAndSwapRel32(v *Value) bool {
910         v_3 := v.Args[3]
911         v_2 := v.Args[2]
912         v_1 := v.Args[1]
913         v_0 := v.Args[0]
914         // match: (AtomicCompareAndSwapRel32 ptr old new_ mem)
915         // result: (LoweredAtomicCas32 [0] ptr old new_ mem)
916         for {
917                 ptr := v_0
918                 old := v_1
919                 new_ := v_2
920                 mem := v_3
921                 v.reset(OpPPC64LoweredAtomicCas32)
922                 v.AuxInt = int64ToAuxInt(0)
923                 v.AddArg4(ptr, old, new_, mem)
924                 return true
925         }
926 }
927 func rewriteValuePPC64_OpAtomicLoad32(v *Value) bool {
928         v_1 := v.Args[1]
929         v_0 := v.Args[0]
930         // match: (AtomicLoad32 ptr mem)
931         // result: (LoweredAtomicLoad32 [1] ptr mem)
932         for {
933                 ptr := v_0
934                 mem := v_1
935                 v.reset(OpPPC64LoweredAtomicLoad32)
936                 v.AuxInt = int64ToAuxInt(1)
937                 v.AddArg2(ptr, mem)
938                 return true
939         }
940 }
941 func rewriteValuePPC64_OpAtomicLoad64(v *Value) bool {
942         v_1 := v.Args[1]
943         v_0 := v.Args[0]
944         // match: (AtomicLoad64 ptr mem)
945         // result: (LoweredAtomicLoad64 [1] ptr mem)
946         for {
947                 ptr := v_0
948                 mem := v_1
949                 v.reset(OpPPC64LoweredAtomicLoad64)
950                 v.AuxInt = int64ToAuxInt(1)
951                 v.AddArg2(ptr, mem)
952                 return true
953         }
954 }
955 func rewriteValuePPC64_OpAtomicLoad8(v *Value) bool {
956         v_1 := v.Args[1]
957         v_0 := v.Args[0]
958         // match: (AtomicLoad8 ptr mem)
959         // result: (LoweredAtomicLoad8 [1] ptr mem)
960         for {
961                 ptr := v_0
962                 mem := v_1
963                 v.reset(OpPPC64LoweredAtomicLoad8)
964                 v.AuxInt = int64ToAuxInt(1)
965                 v.AddArg2(ptr, mem)
966                 return true
967         }
968 }
969 func rewriteValuePPC64_OpAtomicLoadAcq32(v *Value) bool {
970         v_1 := v.Args[1]
971         v_0 := v.Args[0]
972         // match: (AtomicLoadAcq32 ptr mem)
973         // result: (LoweredAtomicLoad32 [0] ptr mem)
974         for {
975                 ptr := v_0
976                 mem := v_1
977                 v.reset(OpPPC64LoweredAtomicLoad32)
978                 v.AuxInt = int64ToAuxInt(0)
979                 v.AddArg2(ptr, mem)
980                 return true
981         }
982 }
983 func rewriteValuePPC64_OpAtomicLoadAcq64(v *Value) bool {
984         v_1 := v.Args[1]
985         v_0 := v.Args[0]
986         // match: (AtomicLoadAcq64 ptr mem)
987         // result: (LoweredAtomicLoad64 [0] ptr mem)
988         for {
989                 ptr := v_0
990                 mem := v_1
991                 v.reset(OpPPC64LoweredAtomicLoad64)
992                 v.AuxInt = int64ToAuxInt(0)
993                 v.AddArg2(ptr, mem)
994                 return true
995         }
996 }
997 func rewriteValuePPC64_OpAtomicLoadPtr(v *Value) bool {
998         v_1 := v.Args[1]
999         v_0 := v.Args[0]
1000         // match: (AtomicLoadPtr ptr mem)
1001         // result: (LoweredAtomicLoadPtr [1] ptr mem)
1002         for {
1003                 ptr := v_0
1004                 mem := v_1
1005                 v.reset(OpPPC64LoweredAtomicLoadPtr)
1006                 v.AuxInt = int64ToAuxInt(1)
1007                 v.AddArg2(ptr, mem)
1008                 return true
1009         }
1010 }
1011 func rewriteValuePPC64_OpAtomicStore32(v *Value) bool {
1012         v_2 := v.Args[2]
1013         v_1 := v.Args[1]
1014         v_0 := v.Args[0]
1015         // match: (AtomicStore32 ptr val mem)
1016         // result: (LoweredAtomicStore32 [1] ptr val mem)
1017         for {
1018                 ptr := v_0
1019                 val := v_1
1020                 mem := v_2
1021                 v.reset(OpPPC64LoweredAtomicStore32)
1022                 v.AuxInt = int64ToAuxInt(1)
1023                 v.AddArg3(ptr, val, mem)
1024                 return true
1025         }
1026 }
1027 func rewriteValuePPC64_OpAtomicStore64(v *Value) bool {
1028         v_2 := v.Args[2]
1029         v_1 := v.Args[1]
1030         v_0 := v.Args[0]
1031         // match: (AtomicStore64 ptr val mem)
1032         // result: (LoweredAtomicStore64 [1] ptr val mem)
1033         for {
1034                 ptr := v_0
1035                 val := v_1
1036                 mem := v_2
1037                 v.reset(OpPPC64LoweredAtomicStore64)
1038                 v.AuxInt = int64ToAuxInt(1)
1039                 v.AddArg3(ptr, val, mem)
1040                 return true
1041         }
1042 }
1043 func rewriteValuePPC64_OpAtomicStore8(v *Value) bool {
1044         v_2 := v.Args[2]
1045         v_1 := v.Args[1]
1046         v_0 := v.Args[0]
1047         // match: (AtomicStore8 ptr val mem)
1048         // result: (LoweredAtomicStore8 [1] ptr val mem)
1049         for {
1050                 ptr := v_0
1051                 val := v_1
1052                 mem := v_2
1053                 v.reset(OpPPC64LoweredAtomicStore8)
1054                 v.AuxInt = int64ToAuxInt(1)
1055                 v.AddArg3(ptr, val, mem)
1056                 return true
1057         }
1058 }
1059 func rewriteValuePPC64_OpAtomicStoreRel32(v *Value) bool {
1060         v_2 := v.Args[2]
1061         v_1 := v.Args[1]
1062         v_0 := v.Args[0]
1063         // match: (AtomicStoreRel32 ptr val mem)
1064         // result: (LoweredAtomicStore32 [0] ptr val mem)
1065         for {
1066                 ptr := v_0
1067                 val := v_1
1068                 mem := v_2
1069                 v.reset(OpPPC64LoweredAtomicStore32)
1070                 v.AuxInt = int64ToAuxInt(0)
1071                 v.AddArg3(ptr, val, mem)
1072                 return true
1073         }
1074 }
1075 func rewriteValuePPC64_OpAtomicStoreRel64(v *Value) bool {
1076         v_2 := v.Args[2]
1077         v_1 := v.Args[1]
1078         v_0 := v.Args[0]
1079         // match: (AtomicStoreRel64 ptr val mem)
1080         // result: (LoweredAtomicStore64 [0] ptr val mem)
1081         for {
1082                 ptr := v_0
1083                 val := v_1
1084                 mem := v_2
1085                 v.reset(OpPPC64LoweredAtomicStore64)
1086                 v.AuxInt = int64ToAuxInt(0)
1087                 v.AddArg3(ptr, val, mem)
1088                 return true
1089         }
1090 }
1091 func rewriteValuePPC64_OpAvg64u(v *Value) bool {
1092         v_1 := v.Args[1]
1093         v_0 := v.Args[0]
1094         b := v.Block
1095         // match: (Avg64u <t> x y)
1096         // result: (ADD (SRDconst <t> (SUB <t> x y) [1]) y)
1097         for {
1098                 t := v.Type
1099                 x := v_0
1100                 y := v_1
1101                 v.reset(OpPPC64ADD)
1102                 v0 := b.NewValue0(v.Pos, OpPPC64SRDconst, t)
1103                 v0.AuxInt = int64ToAuxInt(1)
1104                 v1 := b.NewValue0(v.Pos, OpPPC64SUB, t)
1105                 v1.AddArg2(x, y)
1106                 v0.AddArg(v1)
1107                 v.AddArg2(v0, y)
1108                 return true
1109         }
1110 }
1111 func rewriteValuePPC64_OpBitLen32(v *Value) bool {
1112         v_0 := v.Args[0]
1113         b := v.Block
1114         typ := &b.Func.Config.Types
1115         // match: (BitLen32 x)
1116         // result: (SUBFCconst [32] (CNTLZW <typ.Int> x))
1117         for {
1118                 x := v_0
1119                 v.reset(OpPPC64SUBFCconst)
1120                 v.AuxInt = int64ToAuxInt(32)
1121                 v0 := b.NewValue0(v.Pos, OpPPC64CNTLZW, typ.Int)
1122                 v0.AddArg(x)
1123                 v.AddArg(v0)
1124                 return true
1125         }
1126 }
1127 func rewriteValuePPC64_OpBitLen64(v *Value) bool {
1128         v_0 := v.Args[0]
1129         b := v.Block
1130         typ := &b.Func.Config.Types
1131         // match: (BitLen64 x)
1132         // result: (SUBFCconst [64] (CNTLZD <typ.Int> x))
1133         for {
1134                 x := v_0
1135                 v.reset(OpPPC64SUBFCconst)
1136                 v.AuxInt = int64ToAuxInt(64)
1137                 v0 := b.NewValue0(v.Pos, OpPPC64CNTLZD, typ.Int)
1138                 v0.AddArg(x)
1139                 v.AddArg(v0)
1140                 return true
1141         }
1142 }
1143 func rewriteValuePPC64_OpBswap16(v *Value) bool {
1144         v_0 := v.Args[0]
1145         b := v.Block
1146         typ := &b.Func.Config.Types
1147         // match: (Bswap16 x)
1148         // cond: buildcfg.GOPPC64>=10
1149         // result: (BRH x)
1150         for {
1151                 x := v_0
1152                 if !(buildcfg.GOPPC64 >= 10) {
1153                         break
1154                 }
1155                 v.reset(OpPPC64BRH)
1156                 v.AddArg(x)
1157                 return true
1158         }
1159         // match: (Bswap16 x:(MOVHZload [off] {sym} ptr mem))
1160         // result: @x.Block (MOVHBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
1161         for {
1162                 x := v_0
1163                 if x.Op != OpPPC64MOVHZload {
1164                         break
1165                 }
1166                 off := auxIntToInt32(x.AuxInt)
1167                 sym := auxToSym(x.Aux)
1168                 mem := x.Args[1]
1169                 ptr := x.Args[0]
1170                 b = x.Block
1171                 v0 := b.NewValue0(x.Pos, OpPPC64MOVHBRload, typ.UInt16)
1172                 v.copyOf(v0)
1173                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
1174                 v1.AuxInt = int32ToAuxInt(off)
1175                 v1.Aux = symToAux(sym)
1176                 v1.AddArg(ptr)
1177                 v0.AddArg2(v1, mem)
1178                 return true
1179         }
1180         // match: (Bswap16 x:(MOVHZloadidx ptr idx mem))
1181         // result: @x.Block (MOVHZreg (MOVHBRloadidx ptr idx mem))
1182         for {
1183                 x := v_0
1184                 if x.Op != OpPPC64MOVHZloadidx {
1185                         break
1186                 }
1187                 mem := x.Args[2]
1188                 ptr := x.Args[0]
1189                 idx := x.Args[1]
1190                 b = x.Block
1191                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
1192                 v.copyOf(v0)
1193                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHBRloadidx, typ.Int16)
1194                 v1.AddArg3(ptr, idx, mem)
1195                 v0.AddArg(v1)
1196                 return true
1197         }
1198         return false
1199 }
1200 func rewriteValuePPC64_OpBswap32(v *Value) bool {
1201         v_0 := v.Args[0]
1202         b := v.Block
1203         typ := &b.Func.Config.Types
1204         // match: (Bswap32 x)
1205         // cond: buildcfg.GOPPC64>=10
1206         // result: (BRW x)
1207         for {
1208                 x := v_0
1209                 if !(buildcfg.GOPPC64 >= 10) {
1210                         break
1211                 }
1212                 v.reset(OpPPC64BRW)
1213                 v.AddArg(x)
1214                 return true
1215         }
1216         // match: (Bswap32 x:(MOVWZload [off] {sym} ptr mem))
1217         // result: @x.Block (MOVWBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
1218         for {
1219                 x := v_0
1220                 if x.Op != OpPPC64MOVWZload {
1221                         break
1222                 }
1223                 off := auxIntToInt32(x.AuxInt)
1224                 sym := auxToSym(x.Aux)
1225                 mem := x.Args[1]
1226                 ptr := x.Args[0]
1227                 b = x.Block
1228                 v0 := b.NewValue0(x.Pos, OpPPC64MOVWBRload, typ.UInt32)
1229                 v.copyOf(v0)
1230                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
1231                 v1.AuxInt = int32ToAuxInt(off)
1232                 v1.Aux = symToAux(sym)
1233                 v1.AddArg(ptr)
1234                 v0.AddArg2(v1, mem)
1235                 return true
1236         }
1237         // match: (Bswap32 x:(MOVWZloadidx ptr idx mem))
1238         // result: @x.Block (MOVWZreg (MOVWBRloadidx ptr idx mem))
1239         for {
1240                 x := v_0
1241                 if x.Op != OpPPC64MOVWZloadidx {
1242                         break
1243                 }
1244                 mem := x.Args[2]
1245                 ptr := x.Args[0]
1246                 idx := x.Args[1]
1247                 b = x.Block
1248                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
1249                 v.copyOf(v0)
1250                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWBRloadidx, typ.Int32)
1251                 v1.AddArg3(ptr, idx, mem)
1252                 v0.AddArg(v1)
1253                 return true
1254         }
1255         return false
1256 }
1257 func rewriteValuePPC64_OpBswap64(v *Value) bool {
1258         v_0 := v.Args[0]
1259         b := v.Block
1260         typ := &b.Func.Config.Types
1261         // match: (Bswap64 x)
1262         // cond: buildcfg.GOPPC64>=10
1263         // result: (BRD x)
1264         for {
1265                 x := v_0
1266                 if !(buildcfg.GOPPC64 >= 10) {
1267                         break
1268                 }
1269                 v.reset(OpPPC64BRD)
1270                 v.AddArg(x)
1271                 return true
1272         }
1273         // match: (Bswap64 x:(MOVDload [off] {sym} ptr mem))
1274         // result: @x.Block (MOVDBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
1275         for {
1276                 x := v_0
1277                 if x.Op != OpPPC64MOVDload {
1278                         break
1279                 }
1280                 off := auxIntToInt32(x.AuxInt)
1281                 sym := auxToSym(x.Aux)
1282                 mem := x.Args[1]
1283                 ptr := x.Args[0]
1284                 b = x.Block
1285                 v0 := b.NewValue0(x.Pos, OpPPC64MOVDBRload, typ.UInt64)
1286                 v.copyOf(v0)
1287                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
1288                 v1.AuxInt = int32ToAuxInt(off)
1289                 v1.Aux = symToAux(sym)
1290                 v1.AddArg(ptr)
1291                 v0.AddArg2(v1, mem)
1292                 return true
1293         }
1294         // match: (Bswap64 x:(MOVDloadidx ptr idx mem))
1295         // result: @x.Block (MOVDBRloadidx ptr idx mem)
1296         for {
1297                 x := v_0
1298                 if x.Op != OpPPC64MOVDloadidx {
1299                         break
1300                 }
1301                 mem := x.Args[2]
1302                 ptr := x.Args[0]
1303                 idx := x.Args[1]
1304                 b = x.Block
1305                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRloadidx, typ.Int64)
1306                 v.copyOf(v0)
1307                 v0.AddArg3(ptr, idx, mem)
1308                 return true
1309         }
1310         return false
1311 }
1312 func rewriteValuePPC64_OpCom16(v *Value) bool {
1313         v_0 := v.Args[0]
1314         // match: (Com16 x)
1315         // result: (NOR x x)
1316         for {
1317                 x := v_0
1318                 v.reset(OpPPC64NOR)
1319                 v.AddArg2(x, x)
1320                 return true
1321         }
1322 }
1323 func rewriteValuePPC64_OpCom32(v *Value) bool {
1324         v_0 := v.Args[0]
1325         // match: (Com32 x)
1326         // result: (NOR x x)
1327         for {
1328                 x := v_0
1329                 v.reset(OpPPC64NOR)
1330                 v.AddArg2(x, x)
1331                 return true
1332         }
1333 }
1334 func rewriteValuePPC64_OpCom64(v *Value) bool {
1335         v_0 := v.Args[0]
1336         // match: (Com64 x)
1337         // result: (NOR x x)
1338         for {
1339                 x := v_0
1340                 v.reset(OpPPC64NOR)
1341                 v.AddArg2(x, x)
1342                 return true
1343         }
1344 }
1345 func rewriteValuePPC64_OpCom8(v *Value) bool {
1346         v_0 := v.Args[0]
1347         // match: (Com8 x)
1348         // result: (NOR x x)
1349         for {
1350                 x := v_0
1351                 v.reset(OpPPC64NOR)
1352                 v.AddArg2(x, x)
1353                 return true
1354         }
1355 }
1356 func rewriteValuePPC64_OpCondSelect(v *Value) bool {
1357         v_2 := v.Args[2]
1358         v_1 := v.Args[1]
1359         v_0 := v.Args[0]
1360         b := v.Block
1361         typ := &b.Func.Config.Types
1362         // match: (CondSelect x y (SETBC [a] cmp))
1363         // result: (ISEL [a] x y cmp)
1364         for {
1365                 x := v_0
1366                 y := v_1
1367                 if v_2.Op != OpPPC64SETBC {
1368                         break
1369                 }
1370                 a := auxIntToInt32(v_2.AuxInt)
1371                 cmp := v_2.Args[0]
1372                 v.reset(OpPPC64ISEL)
1373                 v.AuxInt = int32ToAuxInt(a)
1374                 v.AddArg3(x, y, cmp)
1375                 return true
1376         }
1377         // match: (CondSelect x y (SETBCR [a] cmp))
1378         // result: (ISEL [a+4] x y cmp)
1379         for {
1380                 x := v_0
1381                 y := v_1
1382                 if v_2.Op != OpPPC64SETBCR {
1383                         break
1384                 }
1385                 a := auxIntToInt32(v_2.AuxInt)
1386                 cmp := v_2.Args[0]
1387                 v.reset(OpPPC64ISEL)
1388                 v.AuxInt = int32ToAuxInt(a + 4)
1389                 v.AddArg3(x, y, cmp)
1390                 return true
1391         }
1392         // match: (CondSelect x y bool)
1393         // cond: flagArg(bool) == nil
1394         // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [1] bool)))
1395         for {
1396                 x := v_0
1397                 y := v_1
1398                 bool := v_2
1399                 if !(flagArg(bool) == nil) {
1400                         break
1401                 }
1402                 v.reset(OpPPC64ISEL)
1403                 v.AuxInt = int32ToAuxInt(6)
1404                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
1405                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
1406                 v1.AuxInt = int64ToAuxInt(1)
1407                 v1.AddArg(bool)
1408                 v0.AddArg(v1)
1409                 v.AddArg3(x, y, v0)
1410                 return true
1411         }
1412         return false
1413 }
1414 func rewriteValuePPC64_OpConst16(v *Value) bool {
1415         // match: (Const16 [val])
1416         // result: (MOVDconst [int64(val)])
1417         for {
1418                 val := auxIntToInt16(v.AuxInt)
1419                 v.reset(OpPPC64MOVDconst)
1420                 v.AuxInt = int64ToAuxInt(int64(val))
1421                 return true
1422         }
1423 }
1424 func rewriteValuePPC64_OpConst32(v *Value) bool {
1425         // match: (Const32 [val])
1426         // result: (MOVDconst [int64(val)])
1427         for {
1428                 val := auxIntToInt32(v.AuxInt)
1429                 v.reset(OpPPC64MOVDconst)
1430                 v.AuxInt = int64ToAuxInt(int64(val))
1431                 return true
1432         }
1433 }
1434 func rewriteValuePPC64_OpConst64(v *Value) bool {
1435         // match: (Const64 [val])
1436         // result: (MOVDconst [int64(val)])
1437         for {
1438                 val := auxIntToInt64(v.AuxInt)
1439                 v.reset(OpPPC64MOVDconst)
1440                 v.AuxInt = int64ToAuxInt(int64(val))
1441                 return true
1442         }
1443 }
1444 func rewriteValuePPC64_OpConst8(v *Value) bool {
1445         // match: (Const8 [val])
1446         // result: (MOVDconst [int64(val)])
1447         for {
1448                 val := auxIntToInt8(v.AuxInt)
1449                 v.reset(OpPPC64MOVDconst)
1450                 v.AuxInt = int64ToAuxInt(int64(val))
1451                 return true
1452         }
1453 }
1454 func rewriteValuePPC64_OpConstBool(v *Value) bool {
1455         // match: (ConstBool [t])
1456         // result: (MOVDconst [b2i(t)])
1457         for {
1458                 t := auxIntToBool(v.AuxInt)
1459                 v.reset(OpPPC64MOVDconst)
1460                 v.AuxInt = int64ToAuxInt(b2i(t))
1461                 return true
1462         }
1463 }
1464 func rewriteValuePPC64_OpConstNil(v *Value) bool {
1465         // match: (ConstNil)
1466         // result: (MOVDconst [0])
1467         for {
1468                 v.reset(OpPPC64MOVDconst)
1469                 v.AuxInt = int64ToAuxInt(0)
1470                 return true
1471         }
1472 }
1473 func rewriteValuePPC64_OpCopysign(v *Value) bool {
1474         v_1 := v.Args[1]
1475         v_0 := v.Args[0]
1476         // match: (Copysign x y)
1477         // result: (FCPSGN y x)
1478         for {
1479                 x := v_0
1480                 y := v_1
1481                 v.reset(OpPPC64FCPSGN)
1482                 v.AddArg2(y, x)
1483                 return true
1484         }
1485 }
1486 func rewriteValuePPC64_OpCtz16(v *Value) bool {
1487         v_0 := v.Args[0]
1488         b := v.Block
1489         typ := &b.Func.Config.Types
1490         // match: (Ctz16 x)
1491         // result: (POPCNTW (MOVHZreg (ANDN <typ.Int16> (ADDconst <typ.Int16> [-1] x) x)))
1492         for {
1493                 x := v_0
1494                 v.reset(OpPPC64POPCNTW)
1495                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
1496                 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int16)
1497                 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int16)
1498                 v2.AuxInt = int64ToAuxInt(-1)
1499                 v2.AddArg(x)
1500                 v1.AddArg2(v2, x)
1501                 v0.AddArg(v1)
1502                 v.AddArg(v0)
1503                 return true
1504         }
1505 }
1506 func rewriteValuePPC64_OpCtz32(v *Value) bool {
1507         v_0 := v.Args[0]
1508         b := v.Block
1509         typ := &b.Func.Config.Types
1510         // match: (Ctz32 x)
1511         // cond: buildcfg.GOPPC64<=8
1512         // result: (POPCNTW (MOVWZreg (ANDN <typ.Int> (ADDconst <typ.Int> [-1] x) x)))
1513         for {
1514                 x := v_0
1515                 if !(buildcfg.GOPPC64 <= 8) {
1516                         break
1517                 }
1518                 v.reset(OpPPC64POPCNTW)
1519                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
1520                 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int)
1521                 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int)
1522                 v2.AuxInt = int64ToAuxInt(-1)
1523                 v2.AddArg(x)
1524                 v1.AddArg2(v2, x)
1525                 v0.AddArg(v1)
1526                 v.AddArg(v0)
1527                 return true
1528         }
1529         // match: (Ctz32 x)
1530         // result: (CNTTZW (MOVWZreg x))
1531         for {
1532                 x := v_0
1533                 v.reset(OpPPC64CNTTZW)
1534                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
1535                 v0.AddArg(x)
1536                 v.AddArg(v0)
1537                 return true
1538         }
1539 }
1540 func rewriteValuePPC64_OpCtz64(v *Value) bool {
1541         v_0 := v.Args[0]
1542         b := v.Block
1543         typ := &b.Func.Config.Types
1544         // match: (Ctz64 x)
1545         // cond: buildcfg.GOPPC64<=8
1546         // result: (POPCNTD (ANDN <typ.Int64> (ADDconst <typ.Int64> [-1] x) x))
1547         for {
1548                 x := v_0
1549                 if !(buildcfg.GOPPC64 <= 8) {
1550                         break
1551                 }
1552                 v.reset(OpPPC64POPCNTD)
1553                 v0 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int64)
1554                 v1 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int64)
1555                 v1.AuxInt = int64ToAuxInt(-1)
1556                 v1.AddArg(x)
1557                 v0.AddArg2(v1, x)
1558                 v.AddArg(v0)
1559                 return true
1560         }
1561         // match: (Ctz64 x)
1562         // result: (CNTTZD x)
1563         for {
1564                 x := v_0
1565                 v.reset(OpPPC64CNTTZD)
1566                 v.AddArg(x)
1567                 return true
1568         }
1569 }
1570 func rewriteValuePPC64_OpCtz8(v *Value) bool {
1571         v_0 := v.Args[0]
1572         b := v.Block
1573         typ := &b.Func.Config.Types
1574         // match: (Ctz8 x)
1575         // result: (POPCNTB (MOVBZreg (ANDN <typ.UInt8> (ADDconst <typ.UInt8> [-1] x) x)))
1576         for {
1577                 x := v_0
1578                 v.reset(OpPPC64POPCNTB)
1579                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
1580                 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.UInt8)
1581                 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.UInt8)
1582                 v2.AuxInt = int64ToAuxInt(-1)
1583                 v2.AddArg(x)
1584                 v1.AddArg2(v2, x)
1585                 v0.AddArg(v1)
1586                 v.AddArg(v0)
1587                 return true
1588         }
1589 }
1590 func rewriteValuePPC64_OpCvt32Fto32(v *Value) bool {
1591         v_0 := v.Args[0]
1592         b := v.Block
1593         typ := &b.Func.Config.Types
1594         // match: (Cvt32Fto32 x)
1595         // result: (MFVSRD (FCTIWZ x))
1596         for {
1597                 x := v_0
1598                 v.reset(OpPPC64MFVSRD)
1599                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIWZ, typ.Float64)
1600                 v0.AddArg(x)
1601                 v.AddArg(v0)
1602                 return true
1603         }
1604 }
1605 func rewriteValuePPC64_OpCvt32Fto64(v *Value) bool {
1606         v_0 := v.Args[0]
1607         b := v.Block
1608         typ := &b.Func.Config.Types
1609         // match: (Cvt32Fto64 x)
1610         // result: (MFVSRD (FCTIDZ x))
1611         for {
1612                 x := v_0
1613                 v.reset(OpPPC64MFVSRD)
1614                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIDZ, typ.Float64)
1615                 v0.AddArg(x)
1616                 v.AddArg(v0)
1617                 return true
1618         }
1619 }
1620 func rewriteValuePPC64_OpCvt32to32F(v *Value) bool {
1621         v_0 := v.Args[0]
1622         b := v.Block
1623         typ := &b.Func.Config.Types
1624         // match: (Cvt32to32F x)
1625         // result: (FCFIDS (MTVSRD (SignExt32to64 x)))
1626         for {
1627                 x := v_0
1628                 v.reset(OpPPC64FCFIDS)
1629                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1630                 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
1631                 v1.AddArg(x)
1632                 v0.AddArg(v1)
1633                 v.AddArg(v0)
1634                 return true
1635         }
1636 }
1637 func rewriteValuePPC64_OpCvt32to64F(v *Value) bool {
1638         v_0 := v.Args[0]
1639         b := v.Block
1640         typ := &b.Func.Config.Types
1641         // match: (Cvt32to64F x)
1642         // result: (FCFID (MTVSRD (SignExt32to64 x)))
1643         for {
1644                 x := v_0
1645                 v.reset(OpPPC64FCFID)
1646                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1647                 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
1648                 v1.AddArg(x)
1649                 v0.AddArg(v1)
1650                 v.AddArg(v0)
1651                 return true
1652         }
1653 }
1654 func rewriteValuePPC64_OpCvt64Fto32(v *Value) bool {
1655         v_0 := v.Args[0]
1656         b := v.Block
1657         typ := &b.Func.Config.Types
1658         // match: (Cvt64Fto32 x)
1659         // result: (MFVSRD (FCTIWZ x))
1660         for {
1661                 x := v_0
1662                 v.reset(OpPPC64MFVSRD)
1663                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIWZ, typ.Float64)
1664                 v0.AddArg(x)
1665                 v.AddArg(v0)
1666                 return true
1667         }
1668 }
1669 func rewriteValuePPC64_OpCvt64Fto64(v *Value) bool {
1670         v_0 := v.Args[0]
1671         b := v.Block
1672         typ := &b.Func.Config.Types
1673         // match: (Cvt64Fto64 x)
1674         // result: (MFVSRD (FCTIDZ x))
1675         for {
1676                 x := v_0
1677                 v.reset(OpPPC64MFVSRD)
1678                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIDZ, typ.Float64)
1679                 v0.AddArg(x)
1680                 v.AddArg(v0)
1681                 return true
1682         }
1683 }
1684 func rewriteValuePPC64_OpCvt64to32F(v *Value) bool {
1685         v_0 := v.Args[0]
1686         b := v.Block
1687         typ := &b.Func.Config.Types
1688         // match: (Cvt64to32F x)
1689         // result: (FCFIDS (MTVSRD x))
1690         for {
1691                 x := v_0
1692                 v.reset(OpPPC64FCFIDS)
1693                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1694                 v0.AddArg(x)
1695                 v.AddArg(v0)
1696                 return true
1697         }
1698 }
1699 func rewriteValuePPC64_OpCvt64to64F(v *Value) bool {
1700         v_0 := v.Args[0]
1701         b := v.Block
1702         typ := &b.Func.Config.Types
1703         // match: (Cvt64to64F x)
1704         // result: (FCFID (MTVSRD x))
1705         for {
1706                 x := v_0
1707                 v.reset(OpPPC64FCFID)
1708                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1709                 v0.AddArg(x)
1710                 v.AddArg(v0)
1711                 return true
1712         }
1713 }
1714 func rewriteValuePPC64_OpDiv16(v *Value) bool {
1715         v_1 := v.Args[1]
1716         v_0 := v.Args[0]
1717         b := v.Block
1718         typ := &b.Func.Config.Types
1719         // match: (Div16 [false] x y)
1720         // result: (DIVW (SignExt16to32 x) (SignExt16to32 y))
1721         for {
1722                 if auxIntToBool(v.AuxInt) != false {
1723                         break
1724                 }
1725                 x := v_0
1726                 y := v_1
1727                 v.reset(OpPPC64DIVW)
1728                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1729                 v0.AddArg(x)
1730                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1731                 v1.AddArg(y)
1732                 v.AddArg2(v0, v1)
1733                 return true
1734         }
1735         return false
1736 }
1737 func rewriteValuePPC64_OpDiv16u(v *Value) bool {
1738         v_1 := v.Args[1]
1739         v_0 := v.Args[0]
1740         b := v.Block
1741         typ := &b.Func.Config.Types
1742         // match: (Div16u x y)
1743         // result: (DIVWU (ZeroExt16to32 x) (ZeroExt16to32 y))
1744         for {
1745                 x := v_0
1746                 y := v_1
1747                 v.reset(OpPPC64DIVWU)
1748                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1749                 v0.AddArg(x)
1750                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1751                 v1.AddArg(y)
1752                 v.AddArg2(v0, v1)
1753                 return true
1754         }
1755 }
1756 func rewriteValuePPC64_OpDiv32(v *Value) bool {
1757         v_1 := v.Args[1]
1758         v_0 := v.Args[0]
1759         // match: (Div32 [false] x y)
1760         // result: (DIVW x y)
1761         for {
1762                 if auxIntToBool(v.AuxInt) != false {
1763                         break
1764                 }
1765                 x := v_0
1766                 y := v_1
1767                 v.reset(OpPPC64DIVW)
1768                 v.AddArg2(x, y)
1769                 return true
1770         }
1771         return false
1772 }
1773 func rewriteValuePPC64_OpDiv64(v *Value) bool {
1774         v_1 := v.Args[1]
1775         v_0 := v.Args[0]
1776         // match: (Div64 [false] x y)
1777         // result: (DIVD x y)
1778         for {
1779                 if auxIntToBool(v.AuxInt) != false {
1780                         break
1781                 }
1782                 x := v_0
1783                 y := v_1
1784                 v.reset(OpPPC64DIVD)
1785                 v.AddArg2(x, y)
1786                 return true
1787         }
1788         return false
1789 }
1790 func rewriteValuePPC64_OpDiv8(v *Value) bool {
1791         v_1 := v.Args[1]
1792         v_0 := v.Args[0]
1793         b := v.Block
1794         typ := &b.Func.Config.Types
1795         // match: (Div8 x y)
1796         // result: (DIVW (SignExt8to32 x) (SignExt8to32 y))
1797         for {
1798                 x := v_0
1799                 y := v_1
1800                 v.reset(OpPPC64DIVW)
1801                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1802                 v0.AddArg(x)
1803                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1804                 v1.AddArg(y)
1805                 v.AddArg2(v0, v1)
1806                 return true
1807         }
1808 }
1809 func rewriteValuePPC64_OpDiv8u(v *Value) bool {
1810         v_1 := v.Args[1]
1811         v_0 := v.Args[0]
1812         b := v.Block
1813         typ := &b.Func.Config.Types
1814         // match: (Div8u x y)
1815         // result: (DIVWU (ZeroExt8to32 x) (ZeroExt8to32 y))
1816         for {
1817                 x := v_0
1818                 y := v_1
1819                 v.reset(OpPPC64DIVWU)
1820                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1821                 v0.AddArg(x)
1822                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1823                 v1.AddArg(y)
1824                 v.AddArg2(v0, v1)
1825                 return true
1826         }
1827 }
1828 func rewriteValuePPC64_OpEq16(v *Value) bool {
1829         v_1 := v.Args[1]
1830         v_0 := v.Args[0]
1831         b := v.Block
1832         typ := &b.Func.Config.Types
1833         // match: (Eq16 x y)
1834         // cond: x.Type.IsSigned() && y.Type.IsSigned()
1835         // result: (Equal (CMPW (SignExt16to32 x) (SignExt16to32 y)))
1836         for {
1837                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1838                         x := v_0
1839                         y := v_1
1840                         if !(x.Type.IsSigned() && y.Type.IsSigned()) {
1841                                 continue
1842                         }
1843                         v.reset(OpPPC64Equal)
1844                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1845                         v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1846                         v1.AddArg(x)
1847                         v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1848                         v2.AddArg(y)
1849                         v0.AddArg2(v1, v2)
1850                         v.AddArg(v0)
1851                         return true
1852                 }
1853                 break
1854         }
1855         // match: (Eq16 x y)
1856         // result: (Equal (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
1857         for {
1858                 x := v_0
1859                 y := v_1
1860                 v.reset(OpPPC64Equal)
1861                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1862                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1863                 v1.AddArg(x)
1864                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1865                 v2.AddArg(y)
1866                 v0.AddArg2(v1, v2)
1867                 v.AddArg(v0)
1868                 return true
1869         }
1870 }
1871 func rewriteValuePPC64_OpEq32(v *Value) bool {
1872         v_1 := v.Args[1]
1873         v_0 := v.Args[0]
1874         b := v.Block
1875         // match: (Eq32 x y)
1876         // result: (Equal (CMPW x y))
1877         for {
1878                 x := v_0
1879                 y := v_1
1880                 v.reset(OpPPC64Equal)
1881                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1882                 v0.AddArg2(x, y)
1883                 v.AddArg(v0)
1884                 return true
1885         }
1886 }
1887 func rewriteValuePPC64_OpEq32F(v *Value) bool {
1888         v_1 := v.Args[1]
1889         v_0 := v.Args[0]
1890         b := v.Block
1891         // match: (Eq32F x y)
1892         // result: (Equal (FCMPU x y))
1893         for {
1894                 x := v_0
1895                 y := v_1
1896                 v.reset(OpPPC64Equal)
1897                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
1898                 v0.AddArg2(x, y)
1899                 v.AddArg(v0)
1900                 return true
1901         }
1902 }
1903 func rewriteValuePPC64_OpEq64(v *Value) bool {
1904         v_1 := v.Args[1]
1905         v_0 := v.Args[0]
1906         b := v.Block
1907         // match: (Eq64 x y)
1908         // result: (Equal (CMP x y))
1909         for {
1910                 x := v_0
1911                 y := v_1
1912                 v.reset(OpPPC64Equal)
1913                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
1914                 v0.AddArg2(x, y)
1915                 v.AddArg(v0)
1916                 return true
1917         }
1918 }
1919 func rewriteValuePPC64_OpEq64F(v *Value) bool {
1920         v_1 := v.Args[1]
1921         v_0 := v.Args[0]
1922         b := v.Block
1923         // match: (Eq64F x y)
1924         // result: (Equal (FCMPU x y))
1925         for {
1926                 x := v_0
1927                 y := v_1
1928                 v.reset(OpPPC64Equal)
1929                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
1930                 v0.AddArg2(x, y)
1931                 v.AddArg(v0)
1932                 return true
1933         }
1934 }
1935 func rewriteValuePPC64_OpEq8(v *Value) bool {
1936         v_1 := v.Args[1]
1937         v_0 := v.Args[0]
1938         b := v.Block
1939         typ := &b.Func.Config.Types
1940         // match: (Eq8 x y)
1941         // cond: x.Type.IsSigned() && y.Type.IsSigned()
1942         // result: (Equal (CMPW (SignExt8to32 x) (SignExt8to32 y)))
1943         for {
1944                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1945                         x := v_0
1946                         y := v_1
1947                         if !(x.Type.IsSigned() && y.Type.IsSigned()) {
1948                                 continue
1949                         }
1950                         v.reset(OpPPC64Equal)
1951                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1952                         v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1953                         v1.AddArg(x)
1954                         v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1955                         v2.AddArg(y)
1956                         v0.AddArg2(v1, v2)
1957                         v.AddArg(v0)
1958                         return true
1959                 }
1960                 break
1961         }
1962         // match: (Eq8 x y)
1963         // result: (Equal (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
1964         for {
1965                 x := v_0
1966                 y := v_1
1967                 v.reset(OpPPC64Equal)
1968                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1969                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1970                 v1.AddArg(x)
1971                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1972                 v2.AddArg(y)
1973                 v0.AddArg2(v1, v2)
1974                 v.AddArg(v0)
1975                 return true
1976         }
1977 }
1978 func rewriteValuePPC64_OpEqB(v *Value) bool {
1979         v_1 := v.Args[1]
1980         v_0 := v.Args[0]
1981         b := v.Block
1982         typ := &b.Func.Config.Types
1983         // match: (EqB x y)
1984         // result: (Select0 <typ.Int> (ANDCCconst [1] (EQV x y)))
1985         for {
1986                 x := v_0
1987                 y := v_1
1988                 v.reset(OpSelect0)
1989                 v.Type = typ.Int
1990                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
1991                 v0.AuxInt = int64ToAuxInt(1)
1992                 v1 := b.NewValue0(v.Pos, OpPPC64EQV, typ.Int64)
1993                 v1.AddArg2(x, y)
1994                 v0.AddArg(v1)
1995                 v.AddArg(v0)
1996                 return true
1997         }
1998 }
1999 func rewriteValuePPC64_OpEqPtr(v *Value) bool {
2000         v_1 := v.Args[1]
2001         v_0 := v.Args[0]
2002         b := v.Block
2003         // match: (EqPtr x y)
2004         // result: (Equal (CMP x y))
2005         for {
2006                 x := v_0
2007                 y := v_1
2008                 v.reset(OpPPC64Equal)
2009                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2010                 v0.AddArg2(x, y)
2011                 v.AddArg(v0)
2012                 return true
2013         }
2014 }
2015 func rewriteValuePPC64_OpIsInBounds(v *Value) bool {
2016         v_1 := v.Args[1]
2017         v_0 := v.Args[0]
2018         b := v.Block
2019         // match: (IsInBounds idx len)
2020         // result: (LessThan (CMPU idx len))
2021         for {
2022                 idx := v_0
2023                 len := v_1
2024                 v.reset(OpPPC64LessThan)
2025                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2026                 v0.AddArg2(idx, len)
2027                 v.AddArg(v0)
2028                 return true
2029         }
2030 }
2031 func rewriteValuePPC64_OpIsNonNil(v *Value) bool {
2032         v_0 := v.Args[0]
2033         b := v.Block
2034         // match: (IsNonNil ptr)
2035         // result: (NotEqual (CMPconst [0] ptr))
2036         for {
2037                 ptr := v_0
2038                 v.reset(OpPPC64NotEqual)
2039                 v0 := b.NewValue0(v.Pos, OpPPC64CMPconst, types.TypeFlags)
2040                 v0.AuxInt = int64ToAuxInt(0)
2041                 v0.AddArg(ptr)
2042                 v.AddArg(v0)
2043                 return true
2044         }
2045 }
2046 func rewriteValuePPC64_OpIsSliceInBounds(v *Value) bool {
2047         v_1 := v.Args[1]
2048         v_0 := v.Args[0]
2049         b := v.Block
2050         // match: (IsSliceInBounds idx len)
2051         // result: (LessEqual (CMPU idx len))
2052         for {
2053                 idx := v_0
2054                 len := v_1
2055                 v.reset(OpPPC64LessEqual)
2056                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2057                 v0.AddArg2(idx, len)
2058                 v.AddArg(v0)
2059                 return true
2060         }
2061 }
2062 func rewriteValuePPC64_OpLeq16(v *Value) bool {
2063         v_1 := v.Args[1]
2064         v_0 := v.Args[0]
2065         b := v.Block
2066         typ := &b.Func.Config.Types
2067         // match: (Leq16 x y)
2068         // result: (LessEqual (CMPW (SignExt16to32 x) (SignExt16to32 y)))
2069         for {
2070                 x := v_0
2071                 y := v_1
2072                 v.reset(OpPPC64LessEqual)
2073                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2074                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2075                 v1.AddArg(x)
2076                 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2077                 v2.AddArg(y)
2078                 v0.AddArg2(v1, v2)
2079                 v.AddArg(v0)
2080                 return true
2081         }
2082 }
2083 func rewriteValuePPC64_OpLeq16U(v *Value) bool {
2084         v_1 := v.Args[1]
2085         v_0 := v.Args[0]
2086         b := v.Block
2087         typ := &b.Func.Config.Types
2088         // match: (Leq16U x y)
2089         // result: (LessEqual (CMPWU (ZeroExt16to32 x) (ZeroExt16to32 y)))
2090         for {
2091                 x := v_0
2092                 y := v_1
2093                 v.reset(OpPPC64LessEqual)
2094                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2095                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2096                 v1.AddArg(x)
2097                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2098                 v2.AddArg(y)
2099                 v0.AddArg2(v1, v2)
2100                 v.AddArg(v0)
2101                 return true
2102         }
2103 }
2104 func rewriteValuePPC64_OpLeq32(v *Value) bool {
2105         v_1 := v.Args[1]
2106         v_0 := v.Args[0]
2107         b := v.Block
2108         // match: (Leq32 x y)
2109         // result: (LessEqual (CMPW x y))
2110         for {
2111                 x := v_0
2112                 y := v_1
2113                 v.reset(OpPPC64LessEqual)
2114                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2115                 v0.AddArg2(x, y)
2116                 v.AddArg(v0)
2117                 return true
2118         }
2119 }
2120 func rewriteValuePPC64_OpLeq32F(v *Value) bool {
2121         v_1 := v.Args[1]
2122         v_0 := v.Args[0]
2123         b := v.Block
2124         // match: (Leq32F x y)
2125         // result: (FLessEqual (FCMPU x y))
2126         for {
2127                 x := v_0
2128                 y := v_1
2129                 v.reset(OpPPC64FLessEqual)
2130                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2131                 v0.AddArg2(x, y)
2132                 v.AddArg(v0)
2133                 return true
2134         }
2135 }
2136 func rewriteValuePPC64_OpLeq32U(v *Value) bool {
2137         v_1 := v.Args[1]
2138         v_0 := v.Args[0]
2139         b := v.Block
2140         // match: (Leq32U x y)
2141         // result: (LessEqual (CMPWU x y))
2142         for {
2143                 x := v_0
2144                 y := v_1
2145                 v.reset(OpPPC64LessEqual)
2146                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2147                 v0.AddArg2(x, y)
2148                 v.AddArg(v0)
2149                 return true
2150         }
2151 }
2152 func rewriteValuePPC64_OpLeq64(v *Value) bool {
2153         v_1 := v.Args[1]
2154         v_0 := v.Args[0]
2155         b := v.Block
2156         // match: (Leq64 x y)
2157         // result: (LessEqual (CMP x y))
2158         for {
2159                 x := v_0
2160                 y := v_1
2161                 v.reset(OpPPC64LessEqual)
2162                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2163                 v0.AddArg2(x, y)
2164                 v.AddArg(v0)
2165                 return true
2166         }
2167 }
2168 func rewriteValuePPC64_OpLeq64F(v *Value) bool {
2169         v_1 := v.Args[1]
2170         v_0 := v.Args[0]
2171         b := v.Block
2172         // match: (Leq64F x y)
2173         // result: (FLessEqual (FCMPU x y))
2174         for {
2175                 x := v_0
2176                 y := v_1
2177                 v.reset(OpPPC64FLessEqual)
2178                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2179                 v0.AddArg2(x, y)
2180                 v.AddArg(v0)
2181                 return true
2182         }
2183 }
2184 func rewriteValuePPC64_OpLeq64U(v *Value) bool {
2185         v_1 := v.Args[1]
2186         v_0 := v.Args[0]
2187         b := v.Block
2188         // match: (Leq64U x y)
2189         // result: (LessEqual (CMPU x y))
2190         for {
2191                 x := v_0
2192                 y := v_1
2193                 v.reset(OpPPC64LessEqual)
2194                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2195                 v0.AddArg2(x, y)
2196                 v.AddArg(v0)
2197                 return true
2198         }
2199 }
2200 func rewriteValuePPC64_OpLeq8(v *Value) bool {
2201         v_1 := v.Args[1]
2202         v_0 := v.Args[0]
2203         b := v.Block
2204         typ := &b.Func.Config.Types
2205         // match: (Leq8 x y)
2206         // result: (LessEqual (CMPW (SignExt8to32 x) (SignExt8to32 y)))
2207         for {
2208                 x := v_0
2209                 y := v_1
2210                 v.reset(OpPPC64LessEqual)
2211                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2212                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2213                 v1.AddArg(x)
2214                 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2215                 v2.AddArg(y)
2216                 v0.AddArg2(v1, v2)
2217                 v.AddArg(v0)
2218                 return true
2219         }
2220 }
2221 func rewriteValuePPC64_OpLeq8U(v *Value) bool {
2222         v_1 := v.Args[1]
2223         v_0 := v.Args[0]
2224         b := v.Block
2225         typ := &b.Func.Config.Types
2226         // match: (Leq8U x y)
2227         // result: (LessEqual (CMPWU (ZeroExt8to32 x) (ZeroExt8to32 y)))
2228         for {
2229                 x := v_0
2230                 y := v_1
2231                 v.reset(OpPPC64LessEqual)
2232                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2233                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2234                 v1.AddArg(x)
2235                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2236                 v2.AddArg(y)
2237                 v0.AddArg2(v1, v2)
2238                 v.AddArg(v0)
2239                 return true
2240         }
2241 }
2242 func rewriteValuePPC64_OpLess16(v *Value) bool {
2243         v_1 := v.Args[1]
2244         v_0 := v.Args[0]
2245         b := v.Block
2246         typ := &b.Func.Config.Types
2247         // match: (Less16 x y)
2248         // result: (LessThan (CMPW (SignExt16to32 x) (SignExt16to32 y)))
2249         for {
2250                 x := v_0
2251                 y := v_1
2252                 v.reset(OpPPC64LessThan)
2253                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2254                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2255                 v1.AddArg(x)
2256                 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2257                 v2.AddArg(y)
2258                 v0.AddArg2(v1, v2)
2259                 v.AddArg(v0)
2260                 return true
2261         }
2262 }
2263 func rewriteValuePPC64_OpLess16U(v *Value) bool {
2264         v_1 := v.Args[1]
2265         v_0 := v.Args[0]
2266         b := v.Block
2267         typ := &b.Func.Config.Types
2268         // match: (Less16U x y)
2269         // result: (LessThan (CMPWU (ZeroExt16to32 x) (ZeroExt16to32 y)))
2270         for {
2271                 x := v_0
2272                 y := v_1
2273                 v.reset(OpPPC64LessThan)
2274                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2275                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2276                 v1.AddArg(x)
2277                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2278                 v2.AddArg(y)
2279                 v0.AddArg2(v1, v2)
2280                 v.AddArg(v0)
2281                 return true
2282         }
2283 }
2284 func rewriteValuePPC64_OpLess32(v *Value) bool {
2285         v_1 := v.Args[1]
2286         v_0 := v.Args[0]
2287         b := v.Block
2288         // match: (Less32 x y)
2289         // result: (LessThan (CMPW x y))
2290         for {
2291                 x := v_0
2292                 y := v_1
2293                 v.reset(OpPPC64LessThan)
2294                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2295                 v0.AddArg2(x, y)
2296                 v.AddArg(v0)
2297                 return true
2298         }
2299 }
2300 func rewriteValuePPC64_OpLess32F(v *Value) bool {
2301         v_1 := v.Args[1]
2302         v_0 := v.Args[0]
2303         b := v.Block
2304         // match: (Less32F x y)
2305         // result: (FLessThan (FCMPU x y))
2306         for {
2307                 x := v_0
2308                 y := v_1
2309                 v.reset(OpPPC64FLessThan)
2310                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2311                 v0.AddArg2(x, y)
2312                 v.AddArg(v0)
2313                 return true
2314         }
2315 }
2316 func rewriteValuePPC64_OpLess32U(v *Value) bool {
2317         v_1 := v.Args[1]
2318         v_0 := v.Args[0]
2319         b := v.Block
2320         // match: (Less32U x y)
2321         // result: (LessThan (CMPWU x y))
2322         for {
2323                 x := v_0
2324                 y := v_1
2325                 v.reset(OpPPC64LessThan)
2326                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2327                 v0.AddArg2(x, y)
2328                 v.AddArg(v0)
2329                 return true
2330         }
2331 }
2332 func rewriteValuePPC64_OpLess64(v *Value) bool {
2333         v_1 := v.Args[1]
2334         v_0 := v.Args[0]
2335         b := v.Block
2336         // match: (Less64 x y)
2337         // result: (LessThan (CMP x y))
2338         for {
2339                 x := v_0
2340                 y := v_1
2341                 v.reset(OpPPC64LessThan)
2342                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2343                 v0.AddArg2(x, y)
2344                 v.AddArg(v0)
2345                 return true
2346         }
2347 }
2348 func rewriteValuePPC64_OpLess64F(v *Value) bool {
2349         v_1 := v.Args[1]
2350         v_0 := v.Args[0]
2351         b := v.Block
2352         // match: (Less64F x y)
2353         // result: (FLessThan (FCMPU x y))
2354         for {
2355                 x := v_0
2356                 y := v_1
2357                 v.reset(OpPPC64FLessThan)
2358                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2359                 v0.AddArg2(x, y)
2360                 v.AddArg(v0)
2361                 return true
2362         }
2363 }
2364 func rewriteValuePPC64_OpLess64U(v *Value) bool {
2365         v_1 := v.Args[1]
2366         v_0 := v.Args[0]
2367         b := v.Block
2368         // match: (Less64U x y)
2369         // result: (LessThan (CMPU x y))
2370         for {
2371                 x := v_0
2372                 y := v_1
2373                 v.reset(OpPPC64LessThan)
2374                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2375                 v0.AddArg2(x, y)
2376                 v.AddArg(v0)
2377                 return true
2378         }
2379 }
2380 func rewriteValuePPC64_OpLess8(v *Value) bool {
2381         v_1 := v.Args[1]
2382         v_0 := v.Args[0]
2383         b := v.Block
2384         typ := &b.Func.Config.Types
2385         // match: (Less8 x y)
2386         // result: (LessThan (CMPW (SignExt8to32 x) (SignExt8to32 y)))
2387         for {
2388                 x := v_0
2389                 y := v_1
2390                 v.reset(OpPPC64LessThan)
2391                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2392                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2393                 v1.AddArg(x)
2394                 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2395                 v2.AddArg(y)
2396                 v0.AddArg2(v1, v2)
2397                 v.AddArg(v0)
2398                 return true
2399         }
2400 }
2401 func rewriteValuePPC64_OpLess8U(v *Value) bool {
2402         v_1 := v.Args[1]
2403         v_0 := v.Args[0]
2404         b := v.Block
2405         typ := &b.Func.Config.Types
2406         // match: (Less8U x y)
2407         // result: (LessThan (CMPWU (ZeroExt8to32 x) (ZeroExt8to32 y)))
2408         for {
2409                 x := v_0
2410                 y := v_1
2411                 v.reset(OpPPC64LessThan)
2412                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2413                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2414                 v1.AddArg(x)
2415                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2416                 v2.AddArg(y)
2417                 v0.AddArg2(v1, v2)
2418                 v.AddArg(v0)
2419                 return true
2420         }
2421 }
2422 func rewriteValuePPC64_OpLoad(v *Value) bool {
2423         v_1 := v.Args[1]
2424         v_0 := v.Args[0]
2425         b := v.Block
2426         typ := &b.Func.Config.Types
2427         // match: (Load <t> ptr mem)
2428         // cond: (is64BitInt(t) || isPtr(t))
2429         // result: (MOVDload ptr mem)
2430         for {
2431                 t := v.Type
2432                 ptr := v_0
2433                 mem := v_1
2434                 if !(is64BitInt(t) || isPtr(t)) {
2435                         break
2436                 }
2437                 v.reset(OpPPC64MOVDload)
2438                 v.AddArg2(ptr, mem)
2439                 return true
2440         }
2441         // match: (Load <t> ptr mem)
2442         // cond: is32BitInt(t) && t.IsSigned()
2443         // result: (MOVWload ptr mem)
2444         for {
2445                 t := v.Type
2446                 ptr := v_0
2447                 mem := v_1
2448                 if !(is32BitInt(t) && t.IsSigned()) {
2449                         break
2450                 }
2451                 v.reset(OpPPC64MOVWload)
2452                 v.AddArg2(ptr, mem)
2453                 return true
2454         }
2455         // match: (Load <t> ptr mem)
2456         // cond: is32BitInt(t) && !t.IsSigned()
2457         // result: (MOVWZload ptr mem)
2458         for {
2459                 t := v.Type
2460                 ptr := v_0
2461                 mem := v_1
2462                 if !(is32BitInt(t) && !t.IsSigned()) {
2463                         break
2464                 }
2465                 v.reset(OpPPC64MOVWZload)
2466                 v.AddArg2(ptr, mem)
2467                 return true
2468         }
2469         // match: (Load <t> ptr mem)
2470         // cond: is16BitInt(t) && t.IsSigned()
2471         // result: (MOVHload ptr mem)
2472         for {
2473                 t := v.Type
2474                 ptr := v_0
2475                 mem := v_1
2476                 if !(is16BitInt(t) && t.IsSigned()) {
2477                         break
2478                 }
2479                 v.reset(OpPPC64MOVHload)
2480                 v.AddArg2(ptr, mem)
2481                 return true
2482         }
2483         // match: (Load <t> ptr mem)
2484         // cond: is16BitInt(t) && !t.IsSigned()
2485         // result: (MOVHZload ptr mem)
2486         for {
2487                 t := v.Type
2488                 ptr := v_0
2489                 mem := v_1
2490                 if !(is16BitInt(t) && !t.IsSigned()) {
2491                         break
2492                 }
2493                 v.reset(OpPPC64MOVHZload)
2494                 v.AddArg2(ptr, mem)
2495                 return true
2496         }
2497         // match: (Load <t> ptr mem)
2498         // cond: t.IsBoolean()
2499         // result: (MOVBZload ptr mem)
2500         for {
2501                 t := v.Type
2502                 ptr := v_0
2503                 mem := v_1
2504                 if !(t.IsBoolean()) {
2505                         break
2506                 }
2507                 v.reset(OpPPC64MOVBZload)
2508                 v.AddArg2(ptr, mem)
2509                 return true
2510         }
2511         // match: (Load <t> ptr mem)
2512         // cond: is8BitInt(t) && t.IsSigned()
2513         // result: (MOVBreg (MOVBZload ptr mem))
2514         for {
2515                 t := v.Type
2516                 ptr := v_0
2517                 mem := v_1
2518                 if !(is8BitInt(t) && t.IsSigned()) {
2519                         break
2520                 }
2521                 v.reset(OpPPC64MOVBreg)
2522                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
2523                 v0.AddArg2(ptr, mem)
2524                 v.AddArg(v0)
2525                 return true
2526         }
2527         // match: (Load <t> ptr mem)
2528         // cond: is8BitInt(t) && !t.IsSigned()
2529         // result: (MOVBZload ptr mem)
2530         for {
2531                 t := v.Type
2532                 ptr := v_0
2533                 mem := v_1
2534                 if !(is8BitInt(t) && !t.IsSigned()) {
2535                         break
2536                 }
2537                 v.reset(OpPPC64MOVBZload)
2538                 v.AddArg2(ptr, mem)
2539                 return true
2540         }
2541         // match: (Load <t> ptr mem)
2542         // cond: is32BitFloat(t)
2543         // result: (FMOVSload ptr mem)
2544         for {
2545                 t := v.Type
2546                 ptr := v_0
2547                 mem := v_1
2548                 if !(is32BitFloat(t)) {
2549                         break
2550                 }
2551                 v.reset(OpPPC64FMOVSload)
2552                 v.AddArg2(ptr, mem)
2553                 return true
2554         }
2555         // match: (Load <t> ptr mem)
2556         // cond: is64BitFloat(t)
2557         // result: (FMOVDload ptr mem)
2558         for {
2559                 t := v.Type
2560                 ptr := v_0
2561                 mem := v_1
2562                 if !(is64BitFloat(t)) {
2563                         break
2564                 }
2565                 v.reset(OpPPC64FMOVDload)
2566                 v.AddArg2(ptr, mem)
2567                 return true
2568         }
2569         return false
2570 }
2571 func rewriteValuePPC64_OpLocalAddr(v *Value) bool {
2572         v_1 := v.Args[1]
2573         v_0 := v.Args[0]
2574         b := v.Block
2575         typ := &b.Func.Config.Types
2576         // match: (LocalAddr <t> {sym} base mem)
2577         // cond: t.Elem().HasPointers()
2578         // result: (MOVDaddr {sym} (SPanchored base mem))
2579         for {
2580                 t := v.Type
2581                 sym := auxToSym(v.Aux)
2582                 base := v_0
2583                 mem := v_1
2584                 if !(t.Elem().HasPointers()) {
2585                         break
2586                 }
2587                 v.reset(OpPPC64MOVDaddr)
2588                 v.Aux = symToAux(sym)
2589                 v0 := b.NewValue0(v.Pos, OpSPanchored, typ.Uintptr)
2590                 v0.AddArg2(base, mem)
2591                 v.AddArg(v0)
2592                 return true
2593         }
2594         // match: (LocalAddr <t> {sym} base _)
2595         // cond: !t.Elem().HasPointers()
2596         // result: (MOVDaddr {sym} base)
2597         for {
2598                 t := v.Type
2599                 sym := auxToSym(v.Aux)
2600                 base := v_0
2601                 if !(!t.Elem().HasPointers()) {
2602                         break
2603                 }
2604                 v.reset(OpPPC64MOVDaddr)
2605                 v.Aux = symToAux(sym)
2606                 v.AddArg(base)
2607                 return true
2608         }
2609         return false
2610 }
2611 func rewriteValuePPC64_OpLsh16x16(v *Value) bool {
2612         v_1 := v.Args[1]
2613         v_0 := v.Args[0]
2614         b := v.Block
2615         typ := &b.Func.Config.Types
2616         // match: (Lsh16x16 x y)
2617         // cond: shiftIsBounded(v)
2618         // result: (SLD x y)
2619         for {
2620                 x := v_0
2621                 y := v_1
2622                 if !(shiftIsBounded(v)) {
2623                         break
2624                 }
2625                 v.reset(OpPPC64SLD)
2626                 v.AddArg2(x, y)
2627                 return true
2628         }
2629         // match: (Lsh16x16 <t> x y)
2630         // result: (ISEL [2] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y)))
2631         for {
2632                 t := v.Type
2633                 x := v_0
2634                 y := v_1
2635                 v.reset(OpPPC64ISEL)
2636                 v.AuxInt = int32ToAuxInt(2)
2637                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2638                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
2639                 v1.AddArg(x)
2640                 v0.AddArg2(v1, y)
2641                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2642                 v2.AuxInt = int64ToAuxInt(0)
2643                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2644                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2645                 v4.AuxInt = int64ToAuxInt(0xFFF0)
2646                 v4.AddArg(y)
2647                 v3.AddArg(v4)
2648                 v.AddArg3(v0, v2, v3)
2649                 return true
2650         }
2651 }
2652 func rewriteValuePPC64_OpLsh16x32(v *Value) bool {
2653         v_1 := v.Args[1]
2654         v_0 := v.Args[0]
2655         b := v.Block
2656         typ := &b.Func.Config.Types
2657         // match: (Lsh16x32 x y)
2658         // cond: shiftIsBounded(v)
2659         // result: (SLD x y)
2660         for {
2661                 x := v_0
2662                 y := v_1
2663                 if !(shiftIsBounded(v)) {
2664                         break
2665                 }
2666                 v.reset(OpPPC64SLD)
2667                 v.AddArg2(x, y)
2668                 return true
2669         }
2670         // match: (Lsh16x32 <t> x y)
2671         // result: (ISEL [0] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [16]))
2672         for {
2673                 t := v.Type
2674                 x := v_0
2675                 y := v_1
2676                 v.reset(OpPPC64ISEL)
2677                 v.AuxInt = int32ToAuxInt(0)
2678                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2679                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
2680                 v1.AddArg(x)
2681                 v0.AddArg2(v1, y)
2682                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2683                 v2.AuxInt = int64ToAuxInt(0)
2684                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
2685                 v3.AuxInt = int32ToAuxInt(16)
2686                 v3.AddArg(y)
2687                 v.AddArg3(v0, v2, v3)
2688                 return true
2689         }
2690 }
2691 func rewriteValuePPC64_OpLsh16x64(v *Value) bool {
2692         v_1 := v.Args[1]
2693         v_0 := v.Args[0]
2694         b := v.Block
2695         typ := &b.Func.Config.Types
2696         // match: (Lsh16x64 x (MOVDconst [c]))
2697         // cond: uint64(c) < 16
2698         // result: (SLWconst x [c])
2699         for {
2700                 x := v_0
2701                 if v_1.Op != OpPPC64MOVDconst {
2702                         break
2703                 }
2704                 c := auxIntToInt64(v_1.AuxInt)
2705                 if !(uint64(c) < 16) {
2706                         break
2707                 }
2708                 v.reset(OpPPC64SLWconst)
2709                 v.AuxInt = int64ToAuxInt(c)
2710                 v.AddArg(x)
2711                 return true
2712         }
2713         // match: (Lsh16x64 x y)
2714         // cond: shiftIsBounded(v)
2715         // result: (SLD x y)
2716         for {
2717                 x := v_0
2718                 y := v_1
2719                 if !(shiftIsBounded(v)) {
2720                         break
2721                 }
2722                 v.reset(OpPPC64SLD)
2723                 v.AddArg2(x, y)
2724                 return true
2725         }
2726         // match: (Lsh16x64 <t> x y)
2727         // result: (ISEL [0] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [16]))
2728         for {
2729                 t := v.Type
2730                 x := v_0
2731                 y := v_1
2732                 v.reset(OpPPC64ISEL)
2733                 v.AuxInt = int32ToAuxInt(0)
2734                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2735                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
2736                 v1.AddArg(x)
2737                 v0.AddArg2(v1, y)
2738                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2739                 v2.AuxInt = int64ToAuxInt(0)
2740                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
2741                 v3.AuxInt = int64ToAuxInt(16)
2742                 v3.AddArg(y)
2743                 v.AddArg3(v0, v2, v3)
2744                 return true
2745         }
2746 }
2747 func rewriteValuePPC64_OpLsh16x8(v *Value) bool {
2748         v_1 := v.Args[1]
2749         v_0 := v.Args[0]
2750         b := v.Block
2751         typ := &b.Func.Config.Types
2752         // match: (Lsh16x8 x y)
2753         // cond: shiftIsBounded(v)
2754         // result: (SLD x y)
2755         for {
2756                 x := v_0
2757                 y := v_1
2758                 if !(shiftIsBounded(v)) {
2759                         break
2760                 }
2761                 v.reset(OpPPC64SLD)
2762                 v.AddArg2(x, y)
2763                 return true
2764         }
2765         // match: (Lsh16x8 <t> x y)
2766         // result: (ISEL [2] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y)))
2767         for {
2768                 t := v.Type
2769                 x := v_0
2770                 y := v_1
2771                 v.reset(OpPPC64ISEL)
2772                 v.AuxInt = int32ToAuxInt(2)
2773                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2774                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
2775                 v1.AddArg(x)
2776                 v0.AddArg2(v1, y)
2777                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2778                 v2.AuxInt = int64ToAuxInt(0)
2779                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2780                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2781                 v4.AuxInt = int64ToAuxInt(0x00F0)
2782                 v4.AddArg(y)
2783                 v3.AddArg(v4)
2784                 v.AddArg3(v0, v2, v3)
2785                 return true
2786         }
2787 }
2788 func rewriteValuePPC64_OpLsh32x16(v *Value) bool {
2789         v_1 := v.Args[1]
2790         v_0 := v.Args[0]
2791         b := v.Block
2792         typ := &b.Func.Config.Types
2793         // match: (Lsh32x16 x y)
2794         // cond: shiftIsBounded(v)
2795         // result: (SLW x y)
2796         for {
2797                 x := v_0
2798                 y := v_1
2799                 if !(shiftIsBounded(v)) {
2800                         break
2801                 }
2802                 v.reset(OpPPC64SLW)
2803                 v.AddArg2(x, y)
2804                 return true
2805         }
2806         // match: (Lsh32x16 <t> x y)
2807         // result: (ISEL [2] (SLW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y)))
2808         for {
2809                 t := v.Type
2810                 x := v_0
2811                 y := v_1
2812                 v.reset(OpPPC64ISEL)
2813                 v.AuxInt = int32ToAuxInt(2)
2814                 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
2815                 v0.AddArg2(x, y)
2816                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2817                 v1.AuxInt = int64ToAuxInt(0)
2818                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2819                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2820                 v3.AuxInt = int64ToAuxInt(0xFFE0)
2821                 v3.AddArg(y)
2822                 v2.AddArg(v3)
2823                 v.AddArg3(v0, v1, v2)
2824                 return true
2825         }
2826 }
2827 func rewriteValuePPC64_OpLsh32x32(v *Value) bool {
2828         v_1 := v.Args[1]
2829         v_0 := v.Args[0]
2830         b := v.Block
2831         typ := &b.Func.Config.Types
2832         // match: (Lsh32x32 x y)
2833         // cond: shiftIsBounded(v)
2834         // result: (SLW x y)
2835         for {
2836                 x := v_0
2837                 y := v_1
2838                 if !(shiftIsBounded(v)) {
2839                         break
2840                 }
2841                 v.reset(OpPPC64SLW)
2842                 v.AddArg2(x, y)
2843                 return true
2844         }
2845         // match: (Lsh32x32 <t> x y)
2846         // result: (ISEL [0] (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [32]))
2847         for {
2848                 t := v.Type
2849                 x := v_0
2850                 y := v_1
2851                 v.reset(OpPPC64ISEL)
2852                 v.AuxInt = int32ToAuxInt(0)
2853                 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
2854                 v0.AddArg2(x, y)
2855                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2856                 v1.AuxInt = int64ToAuxInt(0)
2857                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
2858                 v2.AuxInt = int32ToAuxInt(32)
2859                 v2.AddArg(y)
2860                 v.AddArg3(v0, v1, v2)
2861                 return true
2862         }
2863 }
2864 func rewriteValuePPC64_OpLsh32x64(v *Value) bool {
2865         v_1 := v.Args[1]
2866         v_0 := v.Args[0]
2867         b := v.Block
2868         typ := &b.Func.Config.Types
2869         // match: (Lsh32x64 x (MOVDconst [c]))
2870         // cond: uint64(c) < 32
2871         // result: (SLWconst x [c])
2872         for {
2873                 x := v_0
2874                 if v_1.Op != OpPPC64MOVDconst {
2875                         break
2876                 }
2877                 c := auxIntToInt64(v_1.AuxInt)
2878                 if !(uint64(c) < 32) {
2879                         break
2880                 }
2881                 v.reset(OpPPC64SLWconst)
2882                 v.AuxInt = int64ToAuxInt(c)
2883                 v.AddArg(x)
2884                 return true
2885         }
2886         // match: (Lsh32x64 x y)
2887         // cond: shiftIsBounded(v)
2888         // result: (SLW x y)
2889         for {
2890                 x := v_0
2891                 y := v_1
2892                 if !(shiftIsBounded(v)) {
2893                         break
2894                 }
2895                 v.reset(OpPPC64SLW)
2896                 v.AddArg2(x, y)
2897                 return true
2898         }
2899         // match: (Lsh32x64 <t> x y)
2900         // result: (ISEL [0] (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [32]))
2901         for {
2902                 t := v.Type
2903                 x := v_0
2904                 y := v_1
2905                 v.reset(OpPPC64ISEL)
2906                 v.AuxInt = int32ToAuxInt(0)
2907                 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
2908                 v0.AddArg2(x, y)
2909                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2910                 v1.AuxInt = int64ToAuxInt(0)
2911                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
2912                 v2.AuxInt = int64ToAuxInt(32)
2913                 v2.AddArg(y)
2914                 v.AddArg3(v0, v1, v2)
2915                 return true
2916         }
2917 }
2918 func rewriteValuePPC64_OpLsh32x8(v *Value) bool {
2919         v_1 := v.Args[1]
2920         v_0 := v.Args[0]
2921         b := v.Block
2922         typ := &b.Func.Config.Types
2923         // match: (Lsh32x8 x y)
2924         // cond: shiftIsBounded(v)
2925         // result: (SLW x y)
2926         for {
2927                 x := v_0
2928                 y := v_1
2929                 if !(shiftIsBounded(v)) {
2930                         break
2931                 }
2932                 v.reset(OpPPC64SLW)
2933                 v.AddArg2(x, y)
2934                 return true
2935         }
2936         // match: (Lsh32x8 <t> x y)
2937         // result: (ISEL [2] (SLW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y)))
2938         for {
2939                 t := v.Type
2940                 x := v_0
2941                 y := v_1
2942                 v.reset(OpPPC64ISEL)
2943                 v.AuxInt = int32ToAuxInt(2)
2944                 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
2945                 v0.AddArg2(x, y)
2946                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2947                 v1.AuxInt = int64ToAuxInt(0)
2948                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2949                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2950                 v3.AuxInt = int64ToAuxInt(0x00E0)
2951                 v3.AddArg(y)
2952                 v2.AddArg(v3)
2953                 v.AddArg3(v0, v1, v2)
2954                 return true
2955         }
2956 }
2957 func rewriteValuePPC64_OpLsh64x16(v *Value) bool {
2958         v_1 := v.Args[1]
2959         v_0 := v.Args[0]
2960         b := v.Block
2961         typ := &b.Func.Config.Types
2962         // match: (Lsh64x16 x y)
2963         // cond: shiftIsBounded(v)
2964         // result: (SLD x y)
2965         for {
2966                 x := v_0
2967                 y := v_1
2968                 if !(shiftIsBounded(v)) {
2969                         break
2970                 }
2971                 v.reset(OpPPC64SLD)
2972                 v.AddArg2(x, y)
2973                 return true
2974         }
2975         // match: (Lsh64x16 <t> x y)
2976         // result: (ISEL [2] (SLD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y)))
2977         for {
2978                 t := v.Type
2979                 x := v_0
2980                 y := v_1
2981                 v.reset(OpPPC64ISEL)
2982                 v.AuxInt = int32ToAuxInt(2)
2983                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2984                 v0.AddArg2(x, y)
2985                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2986                 v1.AuxInt = int64ToAuxInt(0)
2987                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2988                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2989                 v3.AuxInt = int64ToAuxInt(0xFFC0)
2990                 v3.AddArg(y)
2991                 v2.AddArg(v3)
2992                 v.AddArg3(v0, v1, v2)
2993                 return true
2994         }
2995 }
2996 func rewriteValuePPC64_OpLsh64x32(v *Value) bool {
2997         v_1 := v.Args[1]
2998         v_0 := v.Args[0]
2999         b := v.Block
3000         typ := &b.Func.Config.Types
3001         // match: (Lsh64x32 x y)
3002         // cond: shiftIsBounded(v)
3003         // result: (SLD x y)
3004         for {
3005                 x := v_0
3006                 y := v_1
3007                 if !(shiftIsBounded(v)) {
3008                         break
3009                 }
3010                 v.reset(OpPPC64SLD)
3011                 v.AddArg2(x, y)
3012                 return true
3013         }
3014         // match: (Lsh64x32 <t> x y)
3015         // result: (ISEL [0] (SLD <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
3016         for {
3017                 t := v.Type
3018                 x := v_0
3019                 y := v_1
3020                 v.reset(OpPPC64ISEL)
3021                 v.AuxInt = int32ToAuxInt(0)
3022                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3023                 v0.AddArg2(x, y)
3024                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3025                 v1.AuxInt = int64ToAuxInt(0)
3026                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
3027                 v2.AuxInt = int32ToAuxInt(64)
3028                 v2.AddArg(y)
3029                 v.AddArg3(v0, v1, v2)
3030                 return true
3031         }
3032 }
3033 func rewriteValuePPC64_OpLsh64x64(v *Value) bool {
3034         v_1 := v.Args[1]
3035         v_0 := v.Args[0]
3036         b := v.Block
3037         typ := &b.Func.Config.Types
3038         // match: (Lsh64x64 x (MOVDconst [c]))
3039         // cond: uint64(c) < 64
3040         // result: (SLDconst x [c])
3041         for {
3042                 x := v_0
3043                 if v_1.Op != OpPPC64MOVDconst {
3044                         break
3045                 }
3046                 c := auxIntToInt64(v_1.AuxInt)
3047                 if !(uint64(c) < 64) {
3048                         break
3049                 }
3050                 v.reset(OpPPC64SLDconst)
3051                 v.AuxInt = int64ToAuxInt(c)
3052                 v.AddArg(x)
3053                 return true
3054         }
3055         // match: (Lsh64x64 x y)
3056         // cond: shiftIsBounded(v)
3057         // result: (SLD x y)
3058         for {
3059                 x := v_0
3060                 y := v_1
3061                 if !(shiftIsBounded(v)) {
3062                         break
3063                 }
3064                 v.reset(OpPPC64SLD)
3065                 v.AddArg2(x, y)
3066                 return true
3067         }
3068         // match: (Lsh64x64 <t> x y)
3069         // result: (ISEL [0] (SLD <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
3070         for {
3071                 t := v.Type
3072                 x := v_0
3073                 y := v_1
3074                 v.reset(OpPPC64ISEL)
3075                 v.AuxInt = int32ToAuxInt(0)
3076                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3077                 v0.AddArg2(x, y)
3078                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3079                 v1.AuxInt = int64ToAuxInt(0)
3080                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
3081                 v2.AuxInt = int64ToAuxInt(64)
3082                 v2.AddArg(y)
3083                 v.AddArg3(v0, v1, v2)
3084                 return true
3085         }
3086 }
3087 func rewriteValuePPC64_OpLsh64x8(v *Value) bool {
3088         v_1 := v.Args[1]
3089         v_0 := v.Args[0]
3090         b := v.Block
3091         typ := &b.Func.Config.Types
3092         // match: (Lsh64x8 x y)
3093         // cond: shiftIsBounded(v)
3094         // result: (SLD x y)
3095         for {
3096                 x := v_0
3097                 y := v_1
3098                 if !(shiftIsBounded(v)) {
3099                         break
3100                 }
3101                 v.reset(OpPPC64SLD)
3102                 v.AddArg2(x, y)
3103                 return true
3104         }
3105         // match: (Lsh64x8 <t> x y)
3106         // result: (ISEL [2] (SLD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y)))
3107         for {
3108                 t := v.Type
3109                 x := v_0
3110                 y := v_1
3111                 v.reset(OpPPC64ISEL)
3112                 v.AuxInt = int32ToAuxInt(2)
3113                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3114                 v0.AddArg2(x, y)
3115                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3116                 v1.AuxInt = int64ToAuxInt(0)
3117                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
3118                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
3119                 v3.AuxInt = int64ToAuxInt(0x00C0)
3120                 v3.AddArg(y)
3121                 v2.AddArg(v3)
3122                 v.AddArg3(v0, v1, v2)
3123                 return true
3124         }
3125 }
3126 func rewriteValuePPC64_OpLsh8x16(v *Value) bool {
3127         v_1 := v.Args[1]
3128         v_0 := v.Args[0]
3129         b := v.Block
3130         typ := &b.Func.Config.Types
3131         // match: (Lsh8x16 x y)
3132         // cond: shiftIsBounded(v)
3133         // result: (SLD x y)
3134         for {
3135                 x := v_0
3136                 y := v_1
3137                 if !(shiftIsBounded(v)) {
3138                         break
3139                 }
3140                 v.reset(OpPPC64SLD)
3141                 v.AddArg2(x, y)
3142                 return true
3143         }
3144         // match: (Lsh8x16 <t> x y)
3145         // result: (ISEL [2] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y)))
3146         for {
3147                 t := v.Type
3148                 x := v_0
3149                 y := v_1
3150                 v.reset(OpPPC64ISEL)
3151                 v.AuxInt = int32ToAuxInt(2)
3152                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3153                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
3154                 v1.AddArg(x)
3155                 v0.AddArg2(v1, y)
3156                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3157                 v2.AuxInt = int64ToAuxInt(0)
3158                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
3159                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
3160                 v4.AuxInt = int64ToAuxInt(0xFFF8)
3161                 v4.AddArg(y)
3162                 v3.AddArg(v4)
3163                 v.AddArg3(v0, v2, v3)
3164                 return true
3165         }
3166 }
3167 func rewriteValuePPC64_OpLsh8x32(v *Value) bool {
3168         v_1 := v.Args[1]
3169         v_0 := v.Args[0]
3170         b := v.Block
3171         typ := &b.Func.Config.Types
3172         // match: (Lsh8x32 x y)
3173         // cond: shiftIsBounded(v)
3174         // result: (SLD x y)
3175         for {
3176                 x := v_0
3177                 y := v_1
3178                 if !(shiftIsBounded(v)) {
3179                         break
3180                 }
3181                 v.reset(OpPPC64SLD)
3182                 v.AddArg2(x, y)
3183                 return true
3184         }
3185         // match: (Lsh8x32 <t> x y)
3186         // result: (ISEL [0] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [8]))
3187         for {
3188                 t := v.Type
3189                 x := v_0
3190                 y := v_1
3191                 v.reset(OpPPC64ISEL)
3192                 v.AuxInt = int32ToAuxInt(0)
3193                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3194                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
3195                 v1.AddArg(x)
3196                 v0.AddArg2(v1, y)
3197                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3198                 v2.AuxInt = int64ToAuxInt(0)
3199                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
3200                 v3.AuxInt = int32ToAuxInt(8)
3201                 v3.AddArg(y)
3202                 v.AddArg3(v0, v2, v3)
3203                 return true
3204         }
3205 }
3206 func rewriteValuePPC64_OpLsh8x64(v *Value) bool {
3207         v_1 := v.Args[1]
3208         v_0 := v.Args[0]
3209         b := v.Block
3210         typ := &b.Func.Config.Types
3211         // match: (Lsh8x64 x (MOVDconst [c]))
3212         // cond: uint64(c) < 8
3213         // result: (SLWconst x [c])
3214         for {
3215                 x := v_0
3216                 if v_1.Op != OpPPC64MOVDconst {
3217                         break
3218                 }
3219                 c := auxIntToInt64(v_1.AuxInt)
3220                 if !(uint64(c) < 8) {
3221                         break
3222                 }
3223                 v.reset(OpPPC64SLWconst)
3224                 v.AuxInt = int64ToAuxInt(c)
3225                 v.AddArg(x)
3226                 return true
3227         }
3228         // match: (Lsh8x64 x y)
3229         // cond: shiftIsBounded(v)
3230         // result: (SLD x y)
3231         for {
3232                 x := v_0
3233                 y := v_1
3234                 if !(shiftIsBounded(v)) {
3235                         break
3236                 }
3237                 v.reset(OpPPC64SLD)
3238                 v.AddArg2(x, y)
3239                 return true
3240         }
3241         // match: (Lsh8x64 <t> x y)
3242         // result: (ISEL [0] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [8]))
3243         for {
3244                 t := v.Type
3245                 x := v_0
3246                 y := v_1
3247                 v.reset(OpPPC64ISEL)
3248                 v.AuxInt = int32ToAuxInt(0)
3249                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3250                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
3251                 v1.AddArg(x)
3252                 v0.AddArg2(v1, y)
3253                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3254                 v2.AuxInt = int64ToAuxInt(0)
3255                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
3256                 v3.AuxInt = int64ToAuxInt(8)
3257                 v3.AddArg(y)
3258                 v.AddArg3(v0, v2, v3)
3259                 return true
3260         }
3261 }
3262 func rewriteValuePPC64_OpLsh8x8(v *Value) bool {
3263         v_1 := v.Args[1]
3264         v_0 := v.Args[0]
3265         b := v.Block
3266         typ := &b.Func.Config.Types
3267         // match: (Lsh8x8 x y)
3268         // cond: shiftIsBounded(v)
3269         // result: (SLD x y)
3270         for {
3271                 x := v_0
3272                 y := v_1
3273                 if !(shiftIsBounded(v)) {
3274                         break
3275                 }
3276                 v.reset(OpPPC64SLD)
3277                 v.AddArg2(x, y)
3278                 return true
3279         }
3280         // match: (Lsh8x8 <t> x y)
3281         // result: (ISEL [2] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y)))
3282         for {
3283                 t := v.Type
3284                 x := v_0
3285                 y := v_1
3286                 v.reset(OpPPC64ISEL)
3287                 v.AuxInt = int32ToAuxInt(2)
3288                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3289                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
3290                 v1.AddArg(x)
3291                 v0.AddArg2(v1, y)
3292                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3293                 v2.AuxInt = int64ToAuxInt(0)
3294                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
3295                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
3296                 v4.AuxInt = int64ToAuxInt(0x00F8)
3297                 v4.AddArg(y)
3298                 v3.AddArg(v4)
3299                 v.AddArg3(v0, v2, v3)
3300                 return true
3301         }
3302 }
3303 func rewriteValuePPC64_OpMod16(v *Value) bool {
3304         v_1 := v.Args[1]
3305         v_0 := v.Args[0]
3306         b := v.Block
3307         typ := &b.Func.Config.Types
3308         // match: (Mod16 x y)
3309         // result: (Mod32 (SignExt16to32 x) (SignExt16to32 y))
3310         for {
3311                 x := v_0
3312                 y := v_1
3313                 v.reset(OpMod32)
3314                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3315                 v0.AddArg(x)
3316                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3317                 v1.AddArg(y)
3318                 v.AddArg2(v0, v1)
3319                 return true
3320         }
3321 }
3322 func rewriteValuePPC64_OpMod16u(v *Value) bool {
3323         v_1 := v.Args[1]
3324         v_0 := v.Args[0]
3325         b := v.Block
3326         typ := &b.Func.Config.Types
3327         // match: (Mod16u x y)
3328         // result: (Mod32u (ZeroExt16to32 x) (ZeroExt16to32 y))
3329         for {
3330                 x := v_0
3331                 y := v_1
3332                 v.reset(OpMod32u)
3333                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3334                 v0.AddArg(x)
3335                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3336                 v1.AddArg(y)
3337                 v.AddArg2(v0, v1)
3338                 return true
3339         }
3340 }
3341 func rewriteValuePPC64_OpMod32(v *Value) bool {
3342         v_1 := v.Args[1]
3343         v_0 := v.Args[0]
3344         b := v.Block
3345         typ := &b.Func.Config.Types
3346         // match: (Mod32 x y)
3347         // cond: buildcfg.GOPPC64 >= 9
3348         // result: (MODSW x y)
3349         for {
3350                 x := v_0
3351                 y := v_1
3352                 if !(buildcfg.GOPPC64 >= 9) {
3353                         break
3354                 }
3355                 v.reset(OpPPC64MODSW)
3356                 v.AddArg2(x, y)
3357                 return true
3358         }
3359         // match: (Mod32 x y)
3360         // cond: buildcfg.GOPPC64 <= 8
3361         // result: (SUB x (MULLW y (DIVW x y)))
3362         for {
3363                 x := v_0
3364                 y := v_1
3365                 if !(buildcfg.GOPPC64 <= 8) {
3366                         break
3367                 }
3368                 v.reset(OpPPC64SUB)
3369                 v0 := b.NewValue0(v.Pos, OpPPC64MULLW, typ.Int32)
3370                 v1 := b.NewValue0(v.Pos, OpPPC64DIVW, typ.Int32)
3371                 v1.AddArg2(x, y)
3372                 v0.AddArg2(y, v1)
3373                 v.AddArg2(x, v0)
3374                 return true
3375         }
3376         return false
3377 }
3378 func rewriteValuePPC64_OpMod32u(v *Value) bool {
3379         v_1 := v.Args[1]
3380         v_0 := v.Args[0]
3381         b := v.Block
3382         typ := &b.Func.Config.Types
3383         // match: (Mod32u x y)
3384         // cond: buildcfg.GOPPC64 >= 9
3385         // result: (MODUW x y)
3386         for {
3387                 x := v_0
3388                 y := v_1
3389                 if !(buildcfg.GOPPC64 >= 9) {
3390                         break
3391                 }
3392                 v.reset(OpPPC64MODUW)
3393                 v.AddArg2(x, y)
3394                 return true
3395         }
3396         // match: (Mod32u x y)
3397         // cond: buildcfg.GOPPC64 <= 8
3398         // result: (SUB x (MULLW y (DIVWU x y)))
3399         for {
3400                 x := v_0
3401                 y := v_1
3402                 if !(buildcfg.GOPPC64 <= 8) {
3403                         break
3404                 }
3405                 v.reset(OpPPC64SUB)
3406                 v0 := b.NewValue0(v.Pos, OpPPC64MULLW, typ.Int32)
3407                 v1 := b.NewValue0(v.Pos, OpPPC64DIVWU, typ.Int32)
3408                 v1.AddArg2(x, y)
3409                 v0.AddArg2(y, v1)
3410                 v.AddArg2(x, v0)
3411                 return true
3412         }
3413         return false
3414 }
3415 func rewriteValuePPC64_OpMod64(v *Value) bool {
3416         v_1 := v.Args[1]
3417         v_0 := v.Args[0]
3418         b := v.Block
3419         typ := &b.Func.Config.Types
3420         // match: (Mod64 x y)
3421         // cond: buildcfg.GOPPC64 >=9
3422         // result: (MODSD x y)
3423         for {
3424                 x := v_0
3425                 y := v_1
3426                 if !(buildcfg.GOPPC64 >= 9) {
3427                         break
3428                 }
3429                 v.reset(OpPPC64MODSD)
3430                 v.AddArg2(x, y)
3431                 return true
3432         }
3433         // match: (Mod64 x y)
3434         // cond: buildcfg.GOPPC64 <=8
3435         // result: (SUB x (MULLD y (DIVD x y)))
3436         for {
3437                 x := v_0
3438                 y := v_1
3439                 if !(buildcfg.GOPPC64 <= 8) {
3440                         break
3441                 }
3442                 v.reset(OpPPC64SUB)
3443                 v0 := b.NewValue0(v.Pos, OpPPC64MULLD, typ.Int64)
3444                 v1 := b.NewValue0(v.Pos, OpPPC64DIVD, typ.Int64)
3445                 v1.AddArg2(x, y)
3446                 v0.AddArg2(y, v1)
3447                 v.AddArg2(x, v0)
3448                 return true
3449         }
3450         return false
3451 }
3452 func rewriteValuePPC64_OpMod64u(v *Value) bool {
3453         v_1 := v.Args[1]
3454         v_0 := v.Args[0]
3455         b := v.Block
3456         typ := &b.Func.Config.Types
3457         // match: (Mod64u x y)
3458         // cond: buildcfg.GOPPC64 >= 9
3459         // result: (MODUD x y)
3460         for {
3461                 x := v_0
3462                 y := v_1
3463                 if !(buildcfg.GOPPC64 >= 9) {
3464                         break
3465                 }
3466                 v.reset(OpPPC64MODUD)
3467                 v.AddArg2(x, y)
3468                 return true
3469         }
3470         // match: (Mod64u x y)
3471         // cond: buildcfg.GOPPC64 <= 8
3472         // result: (SUB x (MULLD y (DIVDU x y)))
3473         for {
3474                 x := v_0
3475                 y := v_1
3476                 if !(buildcfg.GOPPC64 <= 8) {
3477                         break
3478                 }
3479                 v.reset(OpPPC64SUB)
3480                 v0 := b.NewValue0(v.Pos, OpPPC64MULLD, typ.Int64)
3481                 v1 := b.NewValue0(v.Pos, OpPPC64DIVDU, typ.Int64)
3482                 v1.AddArg2(x, y)
3483                 v0.AddArg2(y, v1)
3484                 v.AddArg2(x, v0)
3485                 return true
3486         }
3487         return false
3488 }
3489 func rewriteValuePPC64_OpMod8(v *Value) bool {
3490         v_1 := v.Args[1]
3491         v_0 := v.Args[0]
3492         b := v.Block
3493         typ := &b.Func.Config.Types
3494         // match: (Mod8 x y)
3495         // result: (Mod32 (SignExt8to32 x) (SignExt8to32 y))
3496         for {
3497                 x := v_0
3498                 y := v_1
3499                 v.reset(OpMod32)
3500                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3501                 v0.AddArg(x)
3502                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3503                 v1.AddArg(y)
3504                 v.AddArg2(v0, v1)
3505                 return true
3506         }
3507 }
3508 func rewriteValuePPC64_OpMod8u(v *Value) bool {
3509         v_1 := v.Args[1]
3510         v_0 := v.Args[0]
3511         b := v.Block
3512         typ := &b.Func.Config.Types
3513         // match: (Mod8u x y)
3514         // result: (Mod32u (ZeroExt8to32 x) (ZeroExt8to32 y))
3515         for {
3516                 x := v_0
3517                 y := v_1
3518                 v.reset(OpMod32u)
3519                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3520                 v0.AddArg(x)
3521                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3522                 v1.AddArg(y)
3523                 v.AddArg2(v0, v1)
3524                 return true
3525         }
3526 }
3527 func rewriteValuePPC64_OpMove(v *Value) bool {
3528         v_2 := v.Args[2]
3529         v_1 := v.Args[1]
3530         v_0 := v.Args[0]
3531         b := v.Block
3532         typ := &b.Func.Config.Types
3533         // match: (Move [0] _ _ mem)
3534         // result: mem
3535         for {
3536                 if auxIntToInt64(v.AuxInt) != 0 {
3537                         break
3538                 }
3539                 mem := v_2
3540                 v.copyOf(mem)
3541                 return true
3542         }
3543         // match: (Move [1] dst src mem)
3544         // result: (MOVBstore dst (MOVBZload src mem) mem)
3545         for {
3546                 if auxIntToInt64(v.AuxInt) != 1 {
3547                         break
3548                 }
3549                 dst := v_0
3550                 src := v_1
3551                 mem := v_2
3552                 v.reset(OpPPC64MOVBstore)
3553                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3554                 v0.AddArg2(src, mem)
3555                 v.AddArg3(dst, v0, mem)
3556                 return true
3557         }
3558         // match: (Move [2] dst src mem)
3559         // result: (MOVHstore dst (MOVHZload src mem) mem)
3560         for {
3561                 if auxIntToInt64(v.AuxInt) != 2 {
3562                         break
3563                 }
3564                 dst := v_0
3565                 src := v_1
3566                 mem := v_2
3567                 v.reset(OpPPC64MOVHstore)
3568                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16)
3569                 v0.AddArg2(src, mem)
3570                 v.AddArg3(dst, v0, mem)
3571                 return true
3572         }
3573         // match: (Move [4] dst src mem)
3574         // result: (MOVWstore dst (MOVWZload src mem) mem)
3575         for {
3576                 if auxIntToInt64(v.AuxInt) != 4 {
3577                         break
3578                 }
3579                 dst := v_0
3580                 src := v_1
3581                 mem := v_2
3582                 v.reset(OpPPC64MOVWstore)
3583                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3584                 v0.AddArg2(src, mem)
3585                 v.AddArg3(dst, v0, mem)
3586                 return true
3587         }
3588         // match: (Move [8] {t} dst src mem)
3589         // result: (MOVDstore dst (MOVDload src mem) mem)
3590         for {
3591                 if auxIntToInt64(v.AuxInt) != 8 {
3592                         break
3593                 }
3594                 dst := v_0
3595                 src := v_1
3596                 mem := v_2
3597                 v.reset(OpPPC64MOVDstore)
3598                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, typ.Int64)
3599                 v0.AddArg2(src, mem)
3600                 v.AddArg3(dst, v0, mem)
3601                 return true
3602         }
3603         // match: (Move [3] dst src mem)
3604         // result: (MOVBstore [2] dst (MOVBZload [2] src mem) (MOVHstore dst (MOVHload src mem) mem))
3605         for {
3606                 if auxIntToInt64(v.AuxInt) != 3 {
3607                         break
3608                 }
3609                 dst := v_0
3610                 src := v_1
3611                 mem := v_2
3612                 v.reset(OpPPC64MOVBstore)
3613                 v.AuxInt = int32ToAuxInt(2)
3614                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3615                 v0.AuxInt = int32ToAuxInt(2)
3616                 v0.AddArg2(src, mem)
3617                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHstore, types.TypeMem)
3618                 v2 := b.NewValue0(v.Pos, OpPPC64MOVHload, typ.Int16)
3619                 v2.AddArg2(src, mem)
3620                 v1.AddArg3(dst, v2, mem)
3621                 v.AddArg3(dst, v0, v1)
3622                 return true
3623         }
3624         // match: (Move [5] dst src mem)
3625         // result: (MOVBstore [4] dst (MOVBZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3626         for {
3627                 if auxIntToInt64(v.AuxInt) != 5 {
3628                         break
3629                 }
3630                 dst := v_0
3631                 src := v_1
3632                 mem := v_2
3633                 v.reset(OpPPC64MOVBstore)
3634                 v.AuxInt = int32ToAuxInt(4)
3635                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3636                 v0.AuxInt = int32ToAuxInt(4)
3637                 v0.AddArg2(src, mem)
3638                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem)
3639                 v2 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3640                 v2.AddArg2(src, mem)
3641                 v1.AddArg3(dst, v2, mem)
3642                 v.AddArg3(dst, v0, v1)
3643                 return true
3644         }
3645         // match: (Move [6] dst src mem)
3646         // result: (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3647         for {
3648                 if auxIntToInt64(v.AuxInt) != 6 {
3649                         break
3650                 }
3651                 dst := v_0
3652                 src := v_1
3653                 mem := v_2
3654                 v.reset(OpPPC64MOVHstore)
3655                 v.AuxInt = int32ToAuxInt(4)
3656                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16)
3657                 v0.AuxInt = int32ToAuxInt(4)
3658                 v0.AddArg2(src, mem)
3659                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem)
3660                 v2 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3661                 v2.AddArg2(src, mem)
3662                 v1.AddArg3(dst, v2, mem)
3663                 v.AddArg3(dst, v0, v1)
3664                 return true
3665         }
3666         // match: (Move [7] dst src mem)
3667         // result: (MOVBstore [6] dst (MOVBZload [6] src mem) (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem)))
3668         for {
3669                 if auxIntToInt64(v.AuxInt) != 7 {
3670                         break
3671                 }
3672                 dst := v_0
3673                 src := v_1
3674                 mem := v_2
3675                 v.reset(OpPPC64MOVBstore)
3676                 v.AuxInt = int32ToAuxInt(6)
3677                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3678                 v0.AuxInt = int32ToAuxInt(6)
3679                 v0.AddArg2(src, mem)
3680                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHstore, types.TypeMem)
3681                 v1.AuxInt = int32ToAuxInt(4)
3682                 v2 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16)
3683                 v2.AuxInt = int32ToAuxInt(4)
3684                 v2.AddArg2(src, mem)
3685                 v3 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem)
3686                 v4 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3687                 v4.AddArg2(src, mem)
3688                 v3.AddArg3(dst, v4, mem)
3689                 v1.AddArg3(dst, v2, v3)
3690                 v.AddArg3(dst, v0, v1)
3691                 return true
3692         }
3693         // match: (Move [s] dst src mem)
3694         // cond: s > 8 && buildcfg.GOPPC64 <= 8 && logLargeCopy(v, s)
3695         // result: (LoweredMove [s] dst src mem)
3696         for {
3697                 s := auxIntToInt64(v.AuxInt)
3698                 dst := v_0
3699                 src := v_1
3700                 mem := v_2
3701                 if !(s > 8 && buildcfg.GOPPC64 <= 8 && logLargeCopy(v, s)) {
3702                         break
3703                 }
3704                 v.reset(OpPPC64LoweredMove)
3705                 v.AuxInt = int64ToAuxInt(s)
3706                 v.AddArg3(dst, src, mem)
3707                 return true
3708         }
3709         // match: (Move [s] dst src mem)
3710         // cond: s > 8 && s <= 64 && buildcfg.GOPPC64 >= 9
3711         // result: (LoweredQuadMoveShort [s] dst src mem)
3712         for {
3713                 s := auxIntToInt64(v.AuxInt)
3714                 dst := v_0
3715                 src := v_1
3716                 mem := v_2
3717                 if !(s > 8 && s <= 64 && buildcfg.GOPPC64 >= 9) {
3718                         break
3719                 }
3720                 v.reset(OpPPC64LoweredQuadMoveShort)
3721                 v.AuxInt = int64ToAuxInt(s)
3722                 v.AddArg3(dst, src, mem)
3723                 return true
3724         }
3725         // match: (Move [s] dst src mem)
3726         // cond: s > 8 && buildcfg.GOPPC64 >= 9 && logLargeCopy(v, s)
3727         // result: (LoweredQuadMove [s] dst src mem)
3728         for {
3729                 s := auxIntToInt64(v.AuxInt)
3730                 dst := v_0
3731                 src := v_1
3732                 mem := v_2
3733                 if !(s > 8 && buildcfg.GOPPC64 >= 9 && logLargeCopy(v, s)) {
3734                         break
3735                 }
3736                 v.reset(OpPPC64LoweredQuadMove)
3737                 v.AuxInt = int64ToAuxInt(s)
3738                 v.AddArg3(dst, src, mem)
3739                 return true
3740         }
3741         return false
3742 }
3743 func rewriteValuePPC64_OpNeq16(v *Value) bool {
3744         v_1 := v.Args[1]
3745         v_0 := v.Args[0]
3746         b := v.Block
3747         typ := &b.Func.Config.Types
3748         // match: (Neq16 x y)
3749         // cond: x.Type.IsSigned() && y.Type.IsSigned()
3750         // result: (NotEqual (CMPW (SignExt16to32 x) (SignExt16to32 y)))
3751         for {
3752                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3753                         x := v_0
3754                         y := v_1
3755                         if !(x.Type.IsSigned() && y.Type.IsSigned()) {
3756                                 continue
3757                         }
3758                         v.reset(OpPPC64NotEqual)
3759                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3760                         v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3761                         v1.AddArg(x)
3762                         v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3763                         v2.AddArg(y)
3764                         v0.AddArg2(v1, v2)
3765                         v.AddArg(v0)
3766                         return true
3767                 }
3768                 break
3769         }
3770         // match: (Neq16 x y)
3771         // result: (NotEqual (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
3772         for {
3773                 x := v_0
3774                 y := v_1
3775                 v.reset(OpPPC64NotEqual)
3776                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3777                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3778                 v1.AddArg(x)
3779                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3780                 v2.AddArg(y)
3781                 v0.AddArg2(v1, v2)
3782                 v.AddArg(v0)
3783                 return true
3784         }
3785 }
3786 func rewriteValuePPC64_OpNeq32(v *Value) bool {
3787         v_1 := v.Args[1]
3788         v_0 := v.Args[0]
3789         b := v.Block
3790         // match: (Neq32 x y)
3791         // result: (NotEqual (CMPW x y))
3792         for {
3793                 x := v_0
3794                 y := v_1
3795                 v.reset(OpPPC64NotEqual)
3796                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3797                 v0.AddArg2(x, y)
3798                 v.AddArg(v0)
3799                 return true
3800         }
3801 }
3802 func rewriteValuePPC64_OpNeq32F(v *Value) bool {
3803         v_1 := v.Args[1]
3804         v_0 := v.Args[0]
3805         b := v.Block
3806         // match: (Neq32F x y)
3807         // result: (NotEqual (FCMPU x y))
3808         for {
3809                 x := v_0
3810                 y := v_1
3811                 v.reset(OpPPC64NotEqual)
3812                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
3813                 v0.AddArg2(x, y)
3814                 v.AddArg(v0)
3815                 return true
3816         }
3817 }
3818 func rewriteValuePPC64_OpNeq64(v *Value) bool {
3819         v_1 := v.Args[1]
3820         v_0 := v.Args[0]
3821         b := v.Block
3822         // match: (Neq64 x y)
3823         // result: (NotEqual (CMP x y))
3824         for {
3825                 x := v_0
3826                 y := v_1
3827                 v.reset(OpPPC64NotEqual)
3828                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
3829                 v0.AddArg2(x, y)
3830                 v.AddArg(v0)
3831                 return true
3832         }
3833 }
3834 func rewriteValuePPC64_OpNeq64F(v *Value) bool {
3835         v_1 := v.Args[1]
3836         v_0 := v.Args[0]
3837         b := v.Block
3838         // match: (Neq64F x y)
3839         // result: (NotEqual (FCMPU x y))
3840         for {
3841                 x := v_0
3842                 y := v_1
3843                 v.reset(OpPPC64NotEqual)
3844                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
3845                 v0.AddArg2(x, y)
3846                 v.AddArg(v0)
3847                 return true
3848         }
3849 }
3850 func rewriteValuePPC64_OpNeq8(v *Value) bool {
3851         v_1 := v.Args[1]
3852         v_0 := v.Args[0]
3853         b := v.Block
3854         typ := &b.Func.Config.Types
3855         // match: (Neq8 x y)
3856         // cond: x.Type.IsSigned() && y.Type.IsSigned()
3857         // result: (NotEqual (CMPW (SignExt8to32 x) (SignExt8to32 y)))
3858         for {
3859                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3860                         x := v_0
3861                         y := v_1
3862                         if !(x.Type.IsSigned() && y.Type.IsSigned()) {
3863                                 continue
3864                         }
3865                         v.reset(OpPPC64NotEqual)
3866                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3867                         v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3868                         v1.AddArg(x)
3869                         v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3870                         v2.AddArg(y)
3871                         v0.AddArg2(v1, v2)
3872                         v.AddArg(v0)
3873                         return true
3874                 }
3875                 break
3876         }
3877         // match: (Neq8 x y)
3878         // result: (NotEqual (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
3879         for {
3880                 x := v_0
3881                 y := v_1
3882                 v.reset(OpPPC64NotEqual)
3883                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3884                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3885                 v1.AddArg(x)
3886                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3887                 v2.AddArg(y)
3888                 v0.AddArg2(v1, v2)
3889                 v.AddArg(v0)
3890                 return true
3891         }
3892 }
3893 func rewriteValuePPC64_OpNeqPtr(v *Value) bool {
3894         v_1 := v.Args[1]
3895         v_0 := v.Args[0]
3896         b := v.Block
3897         // match: (NeqPtr x y)
3898         // result: (NotEqual (CMP x y))
3899         for {
3900                 x := v_0
3901                 y := v_1
3902                 v.reset(OpPPC64NotEqual)
3903                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
3904                 v0.AddArg2(x, y)
3905                 v.AddArg(v0)
3906                 return true
3907         }
3908 }
3909 func rewriteValuePPC64_OpNot(v *Value) bool {
3910         v_0 := v.Args[0]
3911         // match: (Not x)
3912         // result: (XORconst [1] x)
3913         for {
3914                 x := v_0
3915                 v.reset(OpPPC64XORconst)
3916                 v.AuxInt = int64ToAuxInt(1)
3917                 v.AddArg(x)
3918                 return true
3919         }
3920 }
3921 func rewriteValuePPC64_OpOffPtr(v *Value) bool {
3922         v_0 := v.Args[0]
3923         b := v.Block
3924         typ := &b.Func.Config.Types
3925         // match: (OffPtr [off] ptr)
3926         // result: (ADD (MOVDconst <typ.Int64> [off]) ptr)
3927         for {
3928                 off := auxIntToInt64(v.AuxInt)
3929                 ptr := v_0
3930                 v.reset(OpPPC64ADD)
3931                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3932                 v0.AuxInt = int64ToAuxInt(off)
3933                 v.AddArg2(v0, ptr)
3934                 return true
3935         }
3936 }
3937 func rewriteValuePPC64_OpPPC64ADD(v *Value) bool {
3938         v_1 := v.Args[1]
3939         v_0 := v.Args[0]
3940         // match: (ADD l:(MULLD x y) z)
3941         // cond: buildcfg.GOPPC64 >= 9 && l.Uses == 1 && clobber(l)
3942         // result: (MADDLD x y z)
3943         for {
3944                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3945                         l := v_0
3946                         if l.Op != OpPPC64MULLD {
3947                                 continue
3948                         }
3949                         y := l.Args[1]
3950                         x := l.Args[0]
3951                         z := v_1
3952                         if !(buildcfg.GOPPC64 >= 9 && l.Uses == 1 && clobber(l)) {
3953                                 continue
3954                         }
3955                         v.reset(OpPPC64MADDLD)
3956                         v.AddArg3(x, y, z)
3957                         return true
3958                 }
3959                 break
3960         }
3961         // match: (ADD x (MOVDconst <t> [c]))
3962         // cond: is32Bit(c) && !t.IsPtr()
3963         // result: (ADDconst [c] x)
3964         for {
3965                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3966                         x := v_0
3967                         if v_1.Op != OpPPC64MOVDconst {
3968                                 continue
3969                         }
3970                         t := v_1.Type
3971                         c := auxIntToInt64(v_1.AuxInt)
3972                         if !(is32Bit(c) && !t.IsPtr()) {
3973                                 continue
3974                         }
3975                         v.reset(OpPPC64ADDconst)
3976                         v.AuxInt = int64ToAuxInt(c)
3977                         v.AddArg(x)
3978                         return true
3979                 }
3980                 break
3981         }
3982         return false
3983 }
3984 func rewriteValuePPC64_OpPPC64ADDE(v *Value) bool {
3985         v_2 := v.Args[2]
3986         v_1 := v.Args[1]
3987         v_0 := v.Args[0]
3988         b := v.Block
3989         typ := &b.Func.Config.Types
3990         // match: (ADDE x y (Select1 <typ.UInt64> (ADDCconst (MOVDconst [0]) [-1])))
3991         // result: (ADDC x y)
3992         for {
3993                 x := v_0
3994                 y := v_1
3995                 if v_2.Op != OpSelect1 || v_2.Type != typ.UInt64 {
3996                         break
3997                 }
3998                 v_2_0 := v_2.Args[0]
3999                 if v_2_0.Op != OpPPC64ADDCconst || auxIntToInt64(v_2_0.AuxInt) != -1 {
4000                         break
4001                 }
4002                 v_2_0_0 := v_2_0.Args[0]
4003                 if v_2_0_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 {
4004                         break
4005                 }
4006                 v.reset(OpPPC64ADDC)
4007                 v.AddArg2(x, y)
4008                 return true
4009         }
4010         return false
4011 }
4012 func rewriteValuePPC64_OpPPC64ADDconst(v *Value) bool {
4013         v_0 := v.Args[0]
4014         // match: (ADDconst [c] (ADDconst [d] x))
4015         // cond: is32Bit(c+d)
4016         // result: (ADDconst [c+d] x)
4017         for {
4018                 c := auxIntToInt64(v.AuxInt)
4019                 if v_0.Op != OpPPC64ADDconst {
4020                         break
4021                 }
4022                 d := auxIntToInt64(v_0.AuxInt)
4023                 x := v_0.Args[0]
4024                 if !(is32Bit(c + d)) {
4025                         break
4026                 }
4027                 v.reset(OpPPC64ADDconst)
4028                 v.AuxInt = int64ToAuxInt(c + d)
4029                 v.AddArg(x)
4030                 return true
4031         }
4032         // match: (ADDconst [0] x)
4033         // result: x
4034         for {
4035                 if auxIntToInt64(v.AuxInt) != 0 {
4036                         break
4037                 }
4038                 x := v_0
4039                 v.copyOf(x)
4040                 return true
4041         }
4042         // match: (ADDconst [c] (MOVDaddr [d] {sym} x))
4043         // cond: is32Bit(c+int64(d))
4044         // result: (MOVDaddr [int32(c+int64(d))] {sym} x)
4045         for {
4046                 c := auxIntToInt64(v.AuxInt)
4047                 if v_0.Op != OpPPC64MOVDaddr {
4048                         break
4049                 }
4050                 d := auxIntToInt32(v_0.AuxInt)
4051                 sym := auxToSym(v_0.Aux)
4052                 x := v_0.Args[0]
4053                 if !(is32Bit(c + int64(d))) {
4054                         break
4055                 }
4056                 v.reset(OpPPC64MOVDaddr)
4057                 v.AuxInt = int32ToAuxInt(int32(c + int64(d)))
4058                 v.Aux = symToAux(sym)
4059                 v.AddArg(x)
4060                 return true
4061         }
4062         // match: (ADDconst [c] x:(SP))
4063         // cond: is32Bit(c)
4064         // result: (MOVDaddr [int32(c)] x)
4065         for {
4066                 c := auxIntToInt64(v.AuxInt)
4067                 x := v_0
4068                 if x.Op != OpSP || !(is32Bit(c)) {
4069                         break
4070                 }
4071                 v.reset(OpPPC64MOVDaddr)
4072                 v.AuxInt = int32ToAuxInt(int32(c))
4073                 v.AddArg(x)
4074                 return true
4075         }
4076         // match: (ADDconst [c] (SUBFCconst [d] x))
4077         // cond: is32Bit(c+d)
4078         // result: (SUBFCconst [c+d] x)
4079         for {
4080                 c := auxIntToInt64(v.AuxInt)
4081                 if v_0.Op != OpPPC64SUBFCconst {
4082                         break
4083                 }
4084                 d := auxIntToInt64(v_0.AuxInt)
4085                 x := v_0.Args[0]
4086                 if !(is32Bit(c + d)) {
4087                         break
4088                 }
4089                 v.reset(OpPPC64SUBFCconst)
4090                 v.AuxInt = int64ToAuxInt(c + d)
4091                 v.AddArg(x)
4092                 return true
4093         }
4094         return false
4095 }
4096 func rewriteValuePPC64_OpPPC64AND(v *Value) bool {
4097         v_1 := v.Args[1]
4098         v_0 := v.Args[0]
4099         b := v.Block
4100         typ := &b.Func.Config.Types
4101         // match: (AND (MOVDconst [m]) (ROTLWconst [r] x))
4102         // cond: isPPC64WordRotateMask(m)
4103         // result: (RLWINM [encodePPC64RotateMask(r,m,32)] x)
4104         for {
4105                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4106                         if v_0.Op != OpPPC64MOVDconst {
4107                                 continue
4108                         }
4109                         m := auxIntToInt64(v_0.AuxInt)
4110                         if v_1.Op != OpPPC64ROTLWconst {
4111                                 continue
4112                         }
4113                         r := auxIntToInt64(v_1.AuxInt)
4114                         x := v_1.Args[0]
4115                         if !(isPPC64WordRotateMask(m)) {
4116                                 continue
4117                         }
4118                         v.reset(OpPPC64RLWINM)
4119                         v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, m, 32))
4120                         v.AddArg(x)
4121                         return true
4122                 }
4123                 break
4124         }
4125         // match: (AND (MOVDconst [m]) (ROTLW x r))
4126         // cond: isPPC64WordRotateMask(m)
4127         // result: (RLWNM [encodePPC64RotateMask(0,m,32)] x r)
4128         for {
4129                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4130                         if v_0.Op != OpPPC64MOVDconst {
4131                                 continue
4132                         }
4133                         m := auxIntToInt64(v_0.AuxInt)
4134                         if v_1.Op != OpPPC64ROTLW {
4135                                 continue
4136                         }
4137                         r := v_1.Args[1]
4138                         x := v_1.Args[0]
4139                         if !(isPPC64WordRotateMask(m)) {
4140                                 continue
4141                         }
4142                         v.reset(OpPPC64RLWNM)
4143                         v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32))
4144                         v.AddArg2(x, r)
4145                         return true
4146                 }
4147                 break
4148         }
4149         // match: (AND (MOVDconst [m]) (SRWconst x [s]))
4150         // cond: mergePPC64RShiftMask(m,s,32) == 0
4151         // result: (MOVDconst [0])
4152         for {
4153                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4154                         if v_0.Op != OpPPC64MOVDconst {
4155                                 continue
4156                         }
4157                         m := auxIntToInt64(v_0.AuxInt)
4158                         if v_1.Op != OpPPC64SRWconst {
4159                                 continue
4160                         }
4161                         s := auxIntToInt64(v_1.AuxInt)
4162                         if !(mergePPC64RShiftMask(m, s, 32) == 0) {
4163                                 continue
4164                         }
4165                         v.reset(OpPPC64MOVDconst)
4166                         v.AuxInt = int64ToAuxInt(0)
4167                         return true
4168                 }
4169                 break
4170         }
4171         // match: (AND (MOVDconst [m]) (SRWconst x [s]))
4172         // cond: mergePPC64AndSrwi(m,s) != 0
4173         // result: (RLWINM [mergePPC64AndSrwi(m,s)] x)
4174         for {
4175                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4176                         if v_0.Op != OpPPC64MOVDconst {
4177                                 continue
4178                         }
4179                         m := auxIntToInt64(v_0.AuxInt)
4180                         if v_1.Op != OpPPC64SRWconst {
4181                                 continue
4182                         }
4183                         s := auxIntToInt64(v_1.AuxInt)
4184                         x := v_1.Args[0]
4185                         if !(mergePPC64AndSrwi(m, s) != 0) {
4186                                 continue
4187                         }
4188                         v.reset(OpPPC64RLWINM)
4189                         v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m, s))
4190                         v.AddArg(x)
4191                         return true
4192                 }
4193                 break
4194         }
4195         // match: (AND x (NOR y y))
4196         // result: (ANDN x y)
4197         for {
4198                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4199                         x := v_0
4200                         if v_1.Op != OpPPC64NOR {
4201                                 continue
4202                         }
4203                         y := v_1.Args[1]
4204                         if y != v_1.Args[0] {
4205                                 continue
4206                         }
4207                         v.reset(OpPPC64ANDN)
4208                         v.AddArg2(x, y)
4209                         return true
4210                 }
4211                 break
4212         }
4213         // match: (AND (MOVDconst [c]) (MOVDconst [d]))
4214         // result: (MOVDconst [c&d])
4215         for {
4216                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4217                         if v_0.Op != OpPPC64MOVDconst {
4218                                 continue
4219                         }
4220                         c := auxIntToInt64(v_0.AuxInt)
4221                         if v_1.Op != OpPPC64MOVDconst {
4222                                 continue
4223                         }
4224                         d := auxIntToInt64(v_1.AuxInt)
4225                         v.reset(OpPPC64MOVDconst)
4226                         v.AuxInt = int64ToAuxInt(c & d)
4227                         return true
4228                 }
4229                 break
4230         }
4231         // match: (AND x (MOVDconst [-1]))
4232         // result: x
4233         for {
4234                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4235                         x := v_0
4236                         if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
4237                                 continue
4238                         }
4239                         v.copyOf(x)
4240                         return true
4241                 }
4242                 break
4243         }
4244         // match: (AND x (MOVDconst [c]))
4245         // cond: isU16Bit(c)
4246         // result: (Select0 (ANDCCconst [c] x))
4247         for {
4248                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4249                         x := v_0
4250                         if v_1.Op != OpPPC64MOVDconst {
4251                                 continue
4252                         }
4253                         c := auxIntToInt64(v_1.AuxInt)
4254                         if !(isU16Bit(c)) {
4255                                 continue
4256                         }
4257                         v.reset(OpSelect0)
4258                         v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
4259                         v0.AuxInt = int64ToAuxInt(c)
4260                         v0.AddArg(x)
4261                         v.AddArg(v0)
4262                         return true
4263                 }
4264                 break
4265         }
4266         // match: (AND (MOVDconst [c]) y:(MOVWZreg _))
4267         // cond: c&0xFFFFFFFF == 0xFFFFFFFF
4268         // result: y
4269         for {
4270                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4271                         if v_0.Op != OpPPC64MOVDconst {
4272                                 continue
4273                         }
4274                         c := auxIntToInt64(v_0.AuxInt)
4275                         y := v_1
4276                         if y.Op != OpPPC64MOVWZreg || !(c&0xFFFFFFFF == 0xFFFFFFFF) {
4277                                 continue
4278                         }
4279                         v.copyOf(y)
4280                         return true
4281                 }
4282                 break
4283         }
4284         // match: (AND (MOVDconst [0xFFFFFFFF]) y:(MOVWreg x))
4285         // result: (MOVWZreg x)
4286         for {
4287                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4288                         if v_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_0.AuxInt) != 0xFFFFFFFF {
4289                                 continue
4290                         }
4291                         y := v_1
4292                         if y.Op != OpPPC64MOVWreg {
4293                                 continue
4294                         }
4295                         x := y.Args[0]
4296                         v.reset(OpPPC64MOVWZreg)
4297                         v.AddArg(x)
4298                         return true
4299                 }
4300                 break
4301         }
4302         // match: (AND (MOVDconst [c]) x:(MOVBZload _ _))
4303         // result: (Select0 (ANDCCconst [c&0xFF] x))
4304         for {
4305                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4306                         if v_0.Op != OpPPC64MOVDconst {
4307                                 continue
4308                         }
4309                         c := auxIntToInt64(v_0.AuxInt)
4310                         x := v_1
4311                         if x.Op != OpPPC64MOVBZload {
4312                                 continue
4313                         }
4314                         v.reset(OpSelect0)
4315                         v0 := b.NewValue0(x.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
4316                         v0.AuxInt = int64ToAuxInt(c & 0xFF)
4317                         v0.AddArg(x)
4318                         v.AddArg(v0)
4319                         return true
4320                 }
4321                 break
4322         }
4323         return false
4324 }
4325 func rewriteValuePPC64_OpPPC64ANDCCconst(v *Value) bool {
4326         v_0 := v.Args[0]
4327         // match: (ANDCCconst [c] (Select0 (ANDCCconst [d] x)))
4328         // result: (ANDCCconst [c&d] x)
4329         for {
4330                 c := auxIntToInt64(v.AuxInt)
4331                 if v_0.Op != OpSelect0 {
4332                         break
4333                 }
4334                 v_0_0 := v_0.Args[0]
4335                 if v_0_0.Op != OpPPC64ANDCCconst {
4336                         break
4337                 }
4338                 d := auxIntToInt64(v_0_0.AuxInt)
4339                 x := v_0_0.Args[0]
4340                 v.reset(OpPPC64ANDCCconst)
4341                 v.AuxInt = int64ToAuxInt(c & d)
4342                 v.AddArg(x)
4343                 return true
4344         }
4345         return false
4346 }
4347 func rewriteValuePPC64_OpPPC64ANDN(v *Value) bool {
4348         v_1 := v.Args[1]
4349         v_0 := v.Args[0]
4350         // match: (ANDN (MOVDconst [c]) (MOVDconst [d]))
4351         // result: (MOVDconst [c&^d])
4352         for {
4353                 if v_0.Op != OpPPC64MOVDconst {
4354                         break
4355                 }
4356                 c := auxIntToInt64(v_0.AuxInt)
4357                 if v_1.Op != OpPPC64MOVDconst {
4358                         break
4359                 }
4360                 d := auxIntToInt64(v_1.AuxInt)
4361                 v.reset(OpPPC64MOVDconst)
4362                 v.AuxInt = int64ToAuxInt(c &^ d)
4363                 return true
4364         }
4365         return false
4366 }
4367 func rewriteValuePPC64_OpPPC64BRD(v *Value) bool {
4368         v_0 := v.Args[0]
4369         b := v.Block
4370         typ := &b.Func.Config.Types
4371         // match: (BRD x:(MOVDload [off] {sym} ptr mem))
4372         // cond: x.Uses == 1
4373         // result: @x.Block (MOVDBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
4374         for {
4375                 x := v_0
4376                 if x.Op != OpPPC64MOVDload {
4377                         break
4378                 }
4379                 off := auxIntToInt32(x.AuxInt)
4380                 sym := auxToSym(x.Aux)
4381                 mem := x.Args[1]
4382                 ptr := x.Args[0]
4383                 if !(x.Uses == 1) {
4384                         break
4385                 }
4386                 b = x.Block
4387                 v0 := b.NewValue0(x.Pos, OpPPC64MOVDBRload, typ.UInt64)
4388                 v.copyOf(v0)
4389                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
4390                 v1.AuxInt = int32ToAuxInt(off)
4391                 v1.Aux = symToAux(sym)
4392                 v1.AddArg(ptr)
4393                 v0.AddArg2(v1, mem)
4394                 return true
4395         }
4396         // match: (BRD x:(MOVDloadidx ptr idx mem))
4397         // cond: x.Uses == 1
4398         // result: @x.Block (MOVDBRloadidx ptr idx mem)
4399         for {
4400                 x := v_0
4401                 if x.Op != OpPPC64MOVDloadidx {
4402                         break
4403                 }
4404                 mem := x.Args[2]
4405                 ptr := x.Args[0]
4406                 idx := x.Args[1]
4407                 if !(x.Uses == 1) {
4408                         break
4409                 }
4410                 b = x.Block
4411                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRloadidx, typ.Int64)
4412                 v.copyOf(v0)
4413                 v0.AddArg3(ptr, idx, mem)
4414                 return true
4415         }
4416         return false
4417 }
4418 func rewriteValuePPC64_OpPPC64BRH(v *Value) bool {
4419         v_0 := v.Args[0]
4420         b := v.Block
4421         typ := &b.Func.Config.Types
4422         // match: (BRH x:(MOVHZload [off] {sym} ptr mem))
4423         // cond: x.Uses == 1
4424         // result: @x.Block (MOVHBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
4425         for {
4426                 x := v_0
4427                 if x.Op != OpPPC64MOVHZload {
4428                         break
4429                 }
4430                 off := auxIntToInt32(x.AuxInt)
4431                 sym := auxToSym(x.Aux)
4432                 mem := x.Args[1]
4433                 ptr := x.Args[0]
4434                 if !(x.Uses == 1) {
4435                         break
4436                 }
4437                 b = x.Block
4438                 v0 := b.NewValue0(x.Pos, OpPPC64MOVHBRload, typ.UInt16)
4439                 v.copyOf(v0)
4440                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
4441                 v1.AuxInt = int32ToAuxInt(off)
4442                 v1.Aux = symToAux(sym)
4443                 v1.AddArg(ptr)
4444                 v0.AddArg2(v1, mem)
4445                 return true
4446         }
4447         // match: (BRH x:(MOVHZloadidx ptr idx mem))
4448         // cond: x.Uses == 1
4449         // result: @x.Block (MOVHZreg (MOVHBRloadidx ptr idx mem))
4450         for {
4451                 x := v_0
4452                 if x.Op != OpPPC64MOVHZloadidx {
4453                         break
4454                 }
4455                 mem := x.Args[2]
4456                 ptr := x.Args[0]
4457                 idx := x.Args[1]
4458                 if !(x.Uses == 1) {
4459                         break
4460                 }
4461                 b = x.Block
4462                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
4463                 v.copyOf(v0)
4464                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHBRloadidx, typ.Int16)
4465                 v1.AddArg3(ptr, idx, mem)
4466                 v0.AddArg(v1)
4467                 return true
4468         }
4469         return false
4470 }
4471 func rewriteValuePPC64_OpPPC64BRW(v *Value) bool {
4472         v_0 := v.Args[0]
4473         b := v.Block
4474         typ := &b.Func.Config.Types
4475         // match: (BRW x:(MOVWZload [off] {sym} ptr mem))
4476         // cond: x.Uses == 1
4477         // result: @x.Block (MOVWBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
4478         for {
4479                 x := v_0
4480                 if x.Op != OpPPC64MOVWZload {
4481                         break
4482                 }
4483                 off := auxIntToInt32(x.AuxInt)
4484                 sym := auxToSym(x.Aux)
4485                 mem := x.Args[1]
4486                 ptr := x.Args[0]
4487                 if !(x.Uses == 1) {
4488                         break
4489                 }
4490                 b = x.Block
4491                 v0 := b.NewValue0(x.Pos, OpPPC64MOVWBRload, typ.UInt32)
4492                 v.copyOf(v0)
4493                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
4494                 v1.AuxInt = int32ToAuxInt(off)
4495                 v1.Aux = symToAux(sym)
4496                 v1.AddArg(ptr)
4497                 v0.AddArg2(v1, mem)
4498                 return true
4499         }
4500         // match: (BRW x:(MOVWZloadidx ptr idx mem))
4501         // cond: x.Uses == 1
4502         // result: @x.Block (MOVWZreg (MOVWBRloadidx ptr idx mem))
4503         for {
4504                 x := v_0
4505                 if x.Op != OpPPC64MOVWZloadidx {
4506                         break
4507                 }
4508                 mem := x.Args[2]
4509                 ptr := x.Args[0]
4510                 idx := x.Args[1]
4511                 if !(x.Uses == 1) {
4512                         break
4513                 }
4514                 b = x.Block
4515                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
4516                 v.copyOf(v0)
4517                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWBRloadidx, typ.Int32)
4518                 v1.AddArg3(ptr, idx, mem)
4519                 v0.AddArg(v1)
4520                 return true
4521         }
4522         return false
4523 }
4524 func rewriteValuePPC64_OpPPC64CLRLSLDI(v *Value) bool {
4525         v_0 := v.Args[0]
4526         // match: (CLRLSLDI [c] (SRWconst [s] x))
4527         // cond: mergePPC64ClrlsldiSrw(int64(c),s) != 0
4528         // result: (RLWINM [mergePPC64ClrlsldiSrw(int64(c),s)] x)
4529         for {
4530                 c := auxIntToInt32(v.AuxInt)
4531                 if v_0.Op != OpPPC64SRWconst {
4532                         break
4533                 }
4534                 s := auxIntToInt64(v_0.AuxInt)
4535                 x := v_0.Args[0]
4536                 if !(mergePPC64ClrlsldiSrw(int64(c), s) != 0) {
4537                         break
4538                 }
4539                 v.reset(OpPPC64RLWINM)
4540                 v.AuxInt = int64ToAuxInt(mergePPC64ClrlsldiSrw(int64(c), s))
4541                 v.AddArg(x)
4542                 return true
4543         }
4544         // match: (CLRLSLDI [c] i:(RLWINM [s] x))
4545         // cond: mergePPC64ClrlsldiRlwinm(c,s) != 0
4546         // result: (RLWINM [mergePPC64ClrlsldiRlwinm(c,s)] x)
4547         for {
4548                 c := auxIntToInt32(v.AuxInt)
4549                 i := v_0
4550                 if i.Op != OpPPC64RLWINM {
4551                         break
4552                 }
4553                 s := auxIntToInt64(i.AuxInt)
4554                 x := i.Args[0]
4555                 if !(mergePPC64ClrlsldiRlwinm(c, s) != 0) {
4556                         break
4557                 }
4558                 v.reset(OpPPC64RLWINM)
4559                 v.AuxInt = int64ToAuxInt(mergePPC64ClrlsldiRlwinm(c, s))
4560                 v.AddArg(x)
4561                 return true
4562         }
4563         return false
4564 }
4565 func rewriteValuePPC64_OpPPC64CMP(v *Value) bool {
4566         v_1 := v.Args[1]
4567         v_0 := v.Args[0]
4568         b := v.Block
4569         // match: (CMP x (MOVDconst [c]))
4570         // cond: is16Bit(c)
4571         // result: (CMPconst x [c])
4572         for {
4573                 x := v_0
4574                 if v_1.Op != OpPPC64MOVDconst {
4575                         break
4576                 }
4577                 c := auxIntToInt64(v_1.AuxInt)
4578                 if !(is16Bit(c)) {
4579                         break
4580                 }
4581                 v.reset(OpPPC64CMPconst)
4582                 v.AuxInt = int64ToAuxInt(c)
4583                 v.AddArg(x)
4584                 return true
4585         }
4586         // match: (CMP (MOVDconst [c]) y)
4587         // cond: is16Bit(c)
4588         // result: (InvertFlags (CMPconst y [c]))
4589         for {
4590                 if v_0.Op != OpPPC64MOVDconst {
4591                         break
4592                 }
4593                 c := auxIntToInt64(v_0.AuxInt)
4594                 y := v_1
4595                 if !(is16Bit(c)) {
4596                         break
4597                 }
4598                 v.reset(OpPPC64InvertFlags)
4599                 v0 := b.NewValue0(v.Pos, OpPPC64CMPconst, types.TypeFlags)
4600                 v0.AuxInt = int64ToAuxInt(c)
4601                 v0.AddArg(y)
4602                 v.AddArg(v0)
4603                 return true
4604         }
4605         // match: (CMP x y)
4606         // cond: canonLessThan(x,y)
4607         // result: (InvertFlags (CMP y x))
4608         for {
4609                 x := v_0
4610                 y := v_1
4611                 if !(canonLessThan(x, y)) {
4612                         break
4613                 }
4614                 v.reset(OpPPC64InvertFlags)
4615                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
4616                 v0.AddArg2(y, x)
4617                 v.AddArg(v0)
4618                 return true
4619         }
4620         return false
4621 }
4622 func rewriteValuePPC64_OpPPC64CMPU(v *Value) bool {
4623         v_1 := v.Args[1]
4624         v_0 := v.Args[0]
4625         b := v.Block
4626         // match: (CMPU x (MOVDconst [c]))
4627         // cond: isU16Bit(c)
4628         // result: (CMPUconst x [c])
4629         for {
4630                 x := v_0
4631                 if v_1.Op != OpPPC64MOVDconst {
4632                         break
4633                 }
4634                 c := auxIntToInt64(v_1.AuxInt)
4635                 if !(isU16Bit(c)) {
4636                         break
4637                 }
4638                 v.reset(OpPPC64CMPUconst)
4639                 v.AuxInt = int64ToAuxInt(c)
4640                 v.AddArg(x)
4641                 return true
4642         }
4643         // match: (CMPU (MOVDconst [c]) y)
4644         // cond: isU16Bit(c)
4645         // result: (InvertFlags (CMPUconst y [c]))
4646         for {
4647                 if v_0.Op != OpPPC64MOVDconst {
4648                         break
4649                 }
4650                 c := auxIntToInt64(v_0.AuxInt)
4651                 y := v_1
4652                 if !(isU16Bit(c)) {
4653                         break
4654                 }
4655                 v.reset(OpPPC64InvertFlags)
4656                 v0 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
4657                 v0.AuxInt = int64ToAuxInt(c)
4658                 v0.AddArg(y)
4659                 v.AddArg(v0)
4660                 return true
4661         }
4662         // match: (CMPU x y)
4663         // cond: canonLessThan(x,y)
4664         // result: (InvertFlags (CMPU y x))
4665         for {
4666                 x := v_0
4667                 y := v_1
4668                 if !(canonLessThan(x, y)) {
4669                         break
4670                 }
4671                 v.reset(OpPPC64InvertFlags)
4672                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
4673                 v0.AddArg2(y, x)
4674                 v.AddArg(v0)
4675                 return true
4676         }
4677         return false
4678 }
4679 func rewriteValuePPC64_OpPPC64CMPUconst(v *Value) bool {
4680         v_0 := v.Args[0]
4681         // match: (CMPUconst [d] (Select0 (ANDCCconst z [c])))
4682         // cond: uint64(d) > uint64(c)
4683         // result: (FlagLT)
4684         for {
4685                 d := auxIntToInt64(v.AuxInt)
4686                 if v_0.Op != OpSelect0 {
4687                         break
4688                 }
4689                 v_0_0 := v_0.Args[0]
4690                 if v_0_0.Op != OpPPC64ANDCCconst {
4691                         break
4692                 }
4693                 c := auxIntToInt64(v_0_0.AuxInt)
4694                 if !(uint64(d) > uint64(c)) {
4695                         break
4696                 }
4697                 v.reset(OpPPC64FlagLT)
4698                 return true
4699         }
4700         // match: (CMPUconst (MOVDconst [x]) [y])
4701         // cond: x==y
4702         // result: (FlagEQ)
4703         for {
4704                 y := auxIntToInt64(v.AuxInt)
4705                 if v_0.Op != OpPPC64MOVDconst {
4706                         break
4707                 }
4708                 x := auxIntToInt64(v_0.AuxInt)
4709                 if !(x == y) {
4710                         break
4711                 }
4712                 v.reset(OpPPC64FlagEQ)
4713                 return true
4714         }
4715         // match: (CMPUconst (MOVDconst [x]) [y])
4716         // cond: uint64(x)<uint64(y)
4717         // result: (FlagLT)
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(OpPPC64FlagLT)
4728                 return true
4729         }
4730         // match: (CMPUconst (MOVDconst [x]) [y])
4731         // cond: uint64(x)>uint64(y)
4732         // result: (FlagGT)
4733         for {
4734                 y := auxIntToInt64(v.AuxInt)
4735                 if v_0.Op != OpPPC64MOVDconst {
4736                         break
4737                 }
4738                 x := auxIntToInt64(v_0.AuxInt)
4739                 if !(uint64(x) > uint64(y)) {
4740                         break
4741                 }
4742                 v.reset(OpPPC64FlagGT)
4743                 return true
4744         }
4745         return false
4746 }
4747 func rewriteValuePPC64_OpPPC64CMPW(v *Value) bool {
4748         v_1 := v.Args[1]
4749         v_0 := v.Args[0]
4750         b := v.Block
4751         // match: (CMPW x (MOVWreg y))
4752         // result: (CMPW x y)
4753         for {
4754                 x := v_0
4755                 if v_1.Op != OpPPC64MOVWreg {
4756                         break
4757                 }
4758                 y := v_1.Args[0]
4759                 v.reset(OpPPC64CMPW)
4760                 v.AddArg2(x, y)
4761                 return true
4762         }
4763         // match: (CMPW (MOVWreg x) y)
4764         // result: (CMPW x y)
4765         for {
4766                 if v_0.Op != OpPPC64MOVWreg {
4767                         break
4768                 }
4769                 x := v_0.Args[0]
4770                 y := v_1
4771                 v.reset(OpPPC64CMPW)
4772                 v.AddArg2(x, y)
4773                 return true
4774         }
4775         // match: (CMPW x (MOVDconst [c]))
4776         // cond: is16Bit(c)
4777         // result: (CMPWconst x [int32(c)])
4778         for {
4779                 x := v_0
4780                 if v_1.Op != OpPPC64MOVDconst {
4781                         break
4782                 }
4783                 c := auxIntToInt64(v_1.AuxInt)
4784                 if !(is16Bit(c)) {
4785                         break
4786                 }
4787                 v.reset(OpPPC64CMPWconst)
4788                 v.AuxInt = int32ToAuxInt(int32(c))
4789                 v.AddArg(x)
4790                 return true
4791         }
4792         // match: (CMPW (MOVDconst [c]) y)
4793         // cond: is16Bit(c)
4794         // result: (InvertFlags (CMPWconst y [int32(c)]))
4795         for {
4796                 if v_0.Op != OpPPC64MOVDconst {
4797                         break
4798                 }
4799                 c := auxIntToInt64(v_0.AuxInt)
4800                 y := v_1
4801                 if !(is16Bit(c)) {
4802                         break
4803                 }
4804                 v.reset(OpPPC64InvertFlags)
4805                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWconst, types.TypeFlags)
4806                 v0.AuxInt = int32ToAuxInt(int32(c))
4807                 v0.AddArg(y)
4808                 v.AddArg(v0)
4809                 return true
4810         }
4811         // match: (CMPW x y)
4812         // cond: canonLessThan(x,y)
4813         // result: (InvertFlags (CMPW y x))
4814         for {
4815                 x := v_0
4816                 y := v_1
4817                 if !(canonLessThan(x, y)) {
4818                         break
4819                 }
4820                 v.reset(OpPPC64InvertFlags)
4821                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
4822                 v0.AddArg2(y, x)
4823                 v.AddArg(v0)
4824                 return true
4825         }
4826         return false
4827 }
4828 func rewriteValuePPC64_OpPPC64CMPWU(v *Value) bool {
4829         v_1 := v.Args[1]
4830         v_0 := v.Args[0]
4831         b := v.Block
4832         // match: (CMPWU x (MOVWZreg y))
4833         // result: (CMPWU x y)
4834         for {
4835                 x := v_0
4836                 if v_1.Op != OpPPC64MOVWZreg {
4837                         break
4838                 }
4839                 y := v_1.Args[0]
4840                 v.reset(OpPPC64CMPWU)
4841                 v.AddArg2(x, y)
4842                 return true
4843         }
4844         // match: (CMPWU (MOVWZreg x) y)
4845         // result: (CMPWU x y)
4846         for {
4847                 if v_0.Op != OpPPC64MOVWZreg {
4848                         break
4849                 }
4850                 x := v_0.Args[0]
4851                 y := v_1
4852                 v.reset(OpPPC64CMPWU)
4853                 v.AddArg2(x, y)
4854                 return true
4855         }
4856         // match: (CMPWU x (MOVDconst [c]))
4857         // cond: isU16Bit(c)
4858         // result: (CMPWUconst x [int32(c)])
4859         for {
4860                 x := v_0
4861                 if v_1.Op != OpPPC64MOVDconst {
4862                         break
4863                 }
4864                 c := auxIntToInt64(v_1.AuxInt)
4865                 if !(isU16Bit(c)) {
4866                         break
4867                 }
4868                 v.reset(OpPPC64CMPWUconst)
4869                 v.AuxInt = int32ToAuxInt(int32(c))
4870                 v.AddArg(x)
4871                 return true
4872         }
4873         // match: (CMPWU (MOVDconst [c]) y)
4874         // cond: isU16Bit(c)
4875         // result: (InvertFlags (CMPWUconst y [int32(c)]))
4876         for {
4877                 if v_0.Op != OpPPC64MOVDconst {
4878                         break
4879                 }
4880                 c := auxIntToInt64(v_0.AuxInt)
4881                 y := v_1
4882                 if !(isU16Bit(c)) {
4883                         break
4884                 }
4885                 v.reset(OpPPC64InvertFlags)
4886                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
4887                 v0.AuxInt = int32ToAuxInt(int32(c))
4888                 v0.AddArg(y)
4889                 v.AddArg(v0)
4890                 return true
4891         }
4892         // match: (CMPWU x y)
4893         // cond: canonLessThan(x,y)
4894         // result: (InvertFlags (CMPWU y x))
4895         for {
4896                 x := v_0
4897                 y := v_1
4898                 if !(canonLessThan(x, y)) {
4899                         break
4900                 }
4901                 v.reset(OpPPC64InvertFlags)
4902                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
4903                 v0.AddArg2(y, x)
4904                 v.AddArg(v0)
4905                 return true
4906         }
4907         return false
4908 }
4909 func rewriteValuePPC64_OpPPC64CMPWUconst(v *Value) bool {
4910         v_0 := v.Args[0]
4911         // match: (CMPWUconst [d] (Select0 (ANDCCconst z [c])))
4912         // cond: uint64(d) > uint64(c)
4913         // result: (FlagLT)
4914         for {
4915                 d := auxIntToInt32(v.AuxInt)
4916                 if v_0.Op != OpSelect0 {
4917                         break
4918                 }
4919                 v_0_0 := v_0.Args[0]
4920                 if v_0_0.Op != OpPPC64ANDCCconst {
4921                         break
4922                 }
4923                 c := auxIntToInt64(v_0_0.AuxInt)
4924                 if !(uint64(d) > uint64(c)) {
4925                         break
4926                 }
4927                 v.reset(OpPPC64FlagLT)
4928                 return true
4929         }
4930         // match: (CMPWUconst (MOVDconst [x]) [y])
4931         // cond: int32(x)==int32(y)
4932         // result: (FlagEQ)
4933         for {
4934                 y := auxIntToInt32(v.AuxInt)
4935                 if v_0.Op != OpPPC64MOVDconst {
4936                         break
4937                 }
4938                 x := auxIntToInt64(v_0.AuxInt)
4939                 if !(int32(x) == int32(y)) {
4940                         break
4941                 }
4942                 v.reset(OpPPC64FlagEQ)
4943                 return true
4944         }
4945         // match: (CMPWUconst (MOVDconst [x]) [y])
4946         // cond: uint32(x)<uint32(y)
4947         // result: (FlagLT)
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(OpPPC64FlagLT)
4958                 return true
4959         }
4960         // match: (CMPWUconst (MOVDconst [x]) [y])
4961         // cond: uint32(x)>uint32(y)
4962         // result: (FlagGT)
4963         for {
4964                 y := auxIntToInt32(v.AuxInt)
4965                 if v_0.Op != OpPPC64MOVDconst {
4966                         break
4967                 }
4968                 x := auxIntToInt64(v_0.AuxInt)
4969                 if !(uint32(x) > uint32(y)) {
4970                         break
4971                 }
4972                 v.reset(OpPPC64FlagGT)
4973                 return true
4974         }
4975         return false
4976 }
4977 func rewriteValuePPC64_OpPPC64CMPWconst(v *Value) bool {
4978         v_0 := v.Args[0]
4979         // match: (CMPWconst (MOVDconst [x]) [y])
4980         // cond: int32(x)==int32(y)
4981         // result: (FlagEQ)
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(OpPPC64FlagEQ)
4992                 return true
4993         }
4994         // match: (CMPWconst (MOVDconst [x]) [y])
4995         // cond: int32(x)<int32(y)
4996         // result: (FlagLT)
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(OpPPC64FlagLT)
5007                 return true
5008         }
5009         // match: (CMPWconst (MOVDconst [x]) [y])
5010         // cond: int32(x)>int32(y)
5011         // result: (FlagGT)
5012         for {
5013                 y := auxIntToInt32(v.AuxInt)
5014                 if v_0.Op != OpPPC64MOVDconst {
5015                         break
5016                 }
5017                 x := auxIntToInt64(v_0.AuxInt)
5018                 if !(int32(x) > int32(y)) {
5019                         break
5020                 }
5021                 v.reset(OpPPC64FlagGT)
5022                 return true
5023         }
5024         return false
5025 }
5026 func rewriteValuePPC64_OpPPC64CMPconst(v *Value) bool {
5027         v_0 := v.Args[0]
5028         // match: (CMPconst (MOVDconst [x]) [y])
5029         // cond: x==y
5030         // result: (FlagEQ)
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(OpPPC64FlagEQ)
5041                 return true
5042         }
5043         // match: (CMPconst (MOVDconst [x]) [y])
5044         // cond: x<y
5045         // result: (FlagLT)
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(OpPPC64FlagLT)
5056                 return true
5057         }
5058         // match: (CMPconst (MOVDconst [x]) [y])
5059         // cond: x>y
5060         // result: (FlagGT)
5061         for {
5062                 y := auxIntToInt64(v.AuxInt)
5063                 if v_0.Op != OpPPC64MOVDconst {
5064                         break
5065                 }
5066                 x := auxIntToInt64(v_0.AuxInt)
5067                 if !(x > y) {
5068                         break
5069                 }
5070                 v.reset(OpPPC64FlagGT)
5071                 return true
5072         }
5073         return false
5074 }
5075 func rewriteValuePPC64_OpPPC64Equal(v *Value) bool {
5076         v_0 := v.Args[0]
5077         // match: (Equal (FlagEQ))
5078         // result: (MOVDconst [1])
5079         for {
5080                 if v_0.Op != OpPPC64FlagEQ {
5081                         break
5082                 }
5083                 v.reset(OpPPC64MOVDconst)
5084                 v.AuxInt = int64ToAuxInt(1)
5085                 return true
5086         }
5087         // match: (Equal (FlagLT))
5088         // result: (MOVDconst [0])
5089         for {
5090                 if v_0.Op != OpPPC64FlagLT {
5091                         break
5092                 }
5093                 v.reset(OpPPC64MOVDconst)
5094                 v.AuxInt = int64ToAuxInt(0)
5095                 return true
5096         }
5097         // match: (Equal (FlagGT))
5098         // result: (MOVDconst [0])
5099         for {
5100                 if v_0.Op != OpPPC64FlagGT {
5101                         break
5102                 }
5103                 v.reset(OpPPC64MOVDconst)
5104                 v.AuxInt = int64ToAuxInt(0)
5105                 return true
5106         }
5107         // match: (Equal (InvertFlags x))
5108         // result: (Equal x)
5109         for {
5110                 if v_0.Op != OpPPC64InvertFlags {
5111                         break
5112                 }
5113                 x := v_0.Args[0]
5114                 v.reset(OpPPC64Equal)
5115                 v.AddArg(x)
5116                 return true
5117         }
5118         // match: (Equal cmp)
5119         // result: (SETBC [2] cmp)
5120         for {
5121                 cmp := v_0
5122                 v.reset(OpPPC64SETBC)
5123                 v.AuxInt = int32ToAuxInt(2)
5124                 v.AddArg(cmp)
5125                 return true
5126         }
5127 }
5128 func rewriteValuePPC64_OpPPC64FABS(v *Value) bool {
5129         v_0 := v.Args[0]
5130         // match: (FABS (FMOVDconst [x]))
5131         // result: (FMOVDconst [math.Abs(x)])
5132         for {
5133                 if v_0.Op != OpPPC64FMOVDconst {
5134                         break
5135                 }
5136                 x := auxIntToFloat64(v_0.AuxInt)
5137                 v.reset(OpPPC64FMOVDconst)
5138                 v.AuxInt = float64ToAuxInt(math.Abs(x))
5139                 return true
5140         }
5141         return false
5142 }
5143 func rewriteValuePPC64_OpPPC64FADD(v *Value) bool {
5144         v_1 := v.Args[1]
5145         v_0 := v.Args[0]
5146         // match: (FADD (FMUL x y) z)
5147         // cond: x.Block.Func.useFMA(v)
5148         // result: (FMADD x y z)
5149         for {
5150                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5151                         if v_0.Op != OpPPC64FMUL {
5152                                 continue
5153                         }
5154                         _ = v_0.Args[1]
5155                         v_0_0 := v_0.Args[0]
5156                         v_0_1 := v_0.Args[1]
5157                         for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 {
5158                                 x := v_0_0
5159                                 y := v_0_1
5160                                 z := v_1
5161                                 if !(x.Block.Func.useFMA(v)) {
5162                                         continue
5163                                 }
5164                                 v.reset(OpPPC64FMADD)
5165                                 v.AddArg3(x, y, z)
5166                                 return true
5167                         }
5168                 }
5169                 break
5170         }
5171         return false
5172 }
5173 func rewriteValuePPC64_OpPPC64FADDS(v *Value) bool {
5174         v_1 := v.Args[1]
5175         v_0 := v.Args[0]
5176         // match: (FADDS (FMULS x y) z)
5177         // cond: x.Block.Func.useFMA(v)
5178         // result: (FMADDS x y z)
5179         for {
5180                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5181                         if v_0.Op != OpPPC64FMULS {
5182                                 continue
5183                         }
5184                         _ = v_0.Args[1]
5185                         v_0_0 := v_0.Args[0]
5186                         v_0_1 := v_0.Args[1]
5187                         for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 {
5188                                 x := v_0_0
5189                                 y := v_0_1
5190                                 z := v_1
5191                                 if !(x.Block.Func.useFMA(v)) {
5192                                         continue
5193                                 }
5194                                 v.reset(OpPPC64FMADDS)
5195                                 v.AddArg3(x, y, z)
5196                                 return true
5197                         }
5198                 }
5199                 break
5200         }
5201         return false
5202 }
5203 func rewriteValuePPC64_OpPPC64FCEIL(v *Value) bool {
5204         v_0 := v.Args[0]
5205         // match: (FCEIL (FMOVDconst [x]))
5206         // result: (FMOVDconst [math.Ceil(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.Ceil(x))
5214                 return true
5215         }
5216         return false
5217 }
5218 func rewriteValuePPC64_OpPPC64FFLOOR(v *Value) bool {
5219         v_0 := v.Args[0]
5220         // match: (FFLOOR (FMOVDconst [x]))
5221         // result: (FMOVDconst [math.Floor(x)])
5222         for {
5223                 if v_0.Op != OpPPC64FMOVDconst {
5224                         break
5225                 }
5226                 x := auxIntToFloat64(v_0.AuxInt)
5227                 v.reset(OpPPC64FMOVDconst)
5228                 v.AuxInt = float64ToAuxInt(math.Floor(x))
5229                 return true
5230         }
5231         return false
5232 }
5233 func rewriteValuePPC64_OpPPC64FGreaterEqual(v *Value) bool {
5234         v_0 := v.Args[0]
5235         b := v.Block
5236         typ := &b.Func.Config.Types
5237         // match: (FGreaterEqual cmp)
5238         // result: (OR (SETBC [2] cmp) (SETBC [1] cmp))
5239         for {
5240                 cmp := v_0
5241                 v.reset(OpPPC64OR)
5242                 v0 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5243                 v0.AuxInt = int32ToAuxInt(2)
5244                 v0.AddArg(cmp)
5245                 v1 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5246                 v1.AuxInt = int32ToAuxInt(1)
5247                 v1.AddArg(cmp)
5248                 v.AddArg2(v0, v1)
5249                 return true
5250         }
5251 }
5252 func rewriteValuePPC64_OpPPC64FGreaterThan(v *Value) bool {
5253         v_0 := v.Args[0]
5254         // match: (FGreaterThan cmp)
5255         // result: (SETBC [1] cmp)
5256         for {
5257                 cmp := v_0
5258                 v.reset(OpPPC64SETBC)
5259                 v.AuxInt = int32ToAuxInt(1)
5260                 v.AddArg(cmp)
5261                 return true
5262         }
5263 }
5264 func rewriteValuePPC64_OpPPC64FLessEqual(v *Value) bool {
5265         v_0 := v.Args[0]
5266         b := v.Block
5267         typ := &b.Func.Config.Types
5268         // match: (FLessEqual cmp)
5269         // result: (OR (SETBC [2] cmp) (SETBC [0] cmp))
5270         for {
5271                 cmp := v_0
5272                 v.reset(OpPPC64OR)
5273                 v0 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5274                 v0.AuxInt = int32ToAuxInt(2)
5275                 v0.AddArg(cmp)
5276                 v1 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5277                 v1.AuxInt = int32ToAuxInt(0)
5278                 v1.AddArg(cmp)
5279                 v.AddArg2(v0, v1)
5280                 return true
5281         }
5282 }
5283 func rewriteValuePPC64_OpPPC64FLessThan(v *Value) bool {
5284         v_0 := v.Args[0]
5285         // match: (FLessThan cmp)
5286         // result: (SETBC [0] cmp)
5287         for {
5288                 cmp := v_0
5289                 v.reset(OpPPC64SETBC)
5290                 v.AuxInt = int32ToAuxInt(0)
5291                 v.AddArg(cmp)
5292                 return true
5293         }
5294 }
5295 func rewriteValuePPC64_OpPPC64FMOVDload(v *Value) bool {
5296         v_1 := v.Args[1]
5297         v_0 := v.Args[0]
5298         // match: (FMOVDload [off] {sym} ptr (MOVDstore [off] {sym} ptr x _))
5299         // result: (MTVSRD x)
5300         for {
5301                 off := auxIntToInt32(v.AuxInt)
5302                 sym := auxToSym(v.Aux)
5303                 ptr := v_0
5304                 if v_1.Op != OpPPC64MOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
5305                         break
5306                 }
5307                 x := v_1.Args[1]
5308                 if ptr != v_1.Args[0] {
5309                         break
5310                 }
5311                 v.reset(OpPPC64MTVSRD)
5312                 v.AddArg(x)
5313                 return true
5314         }
5315         // match: (FMOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
5316         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
5317         // result: (FMOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
5318         for {
5319                 off1 := auxIntToInt32(v.AuxInt)
5320                 sym1 := auxToSym(v.Aux)
5321                 p := v_0
5322                 if p.Op != OpPPC64MOVDaddr {
5323                         break
5324                 }
5325                 off2 := auxIntToInt32(p.AuxInt)
5326                 sym2 := auxToSym(p.Aux)
5327                 ptr := p.Args[0]
5328                 mem := v_1
5329                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5330                         break
5331                 }
5332                 v.reset(OpPPC64FMOVDload)
5333                 v.AuxInt = int32ToAuxInt(off1 + off2)
5334                 v.Aux = symToAux(mergeSym(sym1, sym2))
5335                 v.AddArg2(ptr, mem)
5336                 return true
5337         }
5338         // match: (FMOVDload [off1] {sym} (ADDconst [off2] ptr) mem)
5339         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
5340         // result: (FMOVDload [off1+int32(off2)] {sym} ptr mem)
5341         for {
5342                 off1 := auxIntToInt32(v.AuxInt)
5343                 sym := auxToSym(v.Aux)
5344                 if v_0.Op != OpPPC64ADDconst {
5345                         break
5346                 }
5347                 off2 := auxIntToInt64(v_0.AuxInt)
5348                 ptr := v_0.Args[0]
5349                 mem := v_1
5350                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5351                         break
5352                 }
5353                 v.reset(OpPPC64FMOVDload)
5354                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5355                 v.Aux = symToAux(sym)
5356                 v.AddArg2(ptr, mem)
5357                 return true
5358         }
5359         return false
5360 }
5361 func rewriteValuePPC64_OpPPC64FMOVDstore(v *Value) bool {
5362         v_2 := v.Args[2]
5363         v_1 := v.Args[1]
5364         v_0 := v.Args[0]
5365         // match: (FMOVDstore [off] {sym} ptr (MTVSRD x) mem)
5366         // result: (MOVDstore [off] {sym} ptr x mem)
5367         for {
5368                 off := auxIntToInt32(v.AuxInt)
5369                 sym := auxToSym(v.Aux)
5370                 ptr := v_0
5371                 if v_1.Op != OpPPC64MTVSRD {
5372                         break
5373                 }
5374                 x := v_1.Args[0]
5375                 mem := v_2
5376                 v.reset(OpPPC64MOVDstore)
5377                 v.AuxInt = int32ToAuxInt(off)
5378                 v.Aux = symToAux(sym)
5379                 v.AddArg3(ptr, x, mem)
5380                 return true
5381         }
5382         // match: (FMOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem)
5383         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
5384         // result: (FMOVDstore [off1+int32(off2)] {sym} ptr val mem)
5385         for {
5386                 off1 := auxIntToInt32(v.AuxInt)
5387                 sym := auxToSym(v.Aux)
5388                 if v_0.Op != OpPPC64ADDconst {
5389                         break
5390                 }
5391                 off2 := auxIntToInt64(v_0.AuxInt)
5392                 ptr := v_0.Args[0]
5393                 val := v_1
5394                 mem := v_2
5395                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5396                         break
5397                 }
5398                 v.reset(OpPPC64FMOVDstore)
5399                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5400                 v.Aux = symToAux(sym)
5401                 v.AddArg3(ptr, val, mem)
5402                 return true
5403         }
5404         // match: (FMOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
5405         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
5406         // result: (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
5407         for {
5408                 off1 := auxIntToInt32(v.AuxInt)
5409                 sym1 := auxToSym(v.Aux)
5410                 p := v_0
5411                 if p.Op != OpPPC64MOVDaddr {
5412                         break
5413                 }
5414                 off2 := auxIntToInt32(p.AuxInt)
5415                 sym2 := auxToSym(p.Aux)
5416                 ptr := p.Args[0]
5417                 val := v_1
5418                 mem := v_2
5419                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5420                         break
5421                 }
5422                 v.reset(OpPPC64FMOVDstore)
5423                 v.AuxInt = int32ToAuxInt(off1 + off2)
5424                 v.Aux = symToAux(mergeSym(sym1, sym2))
5425                 v.AddArg3(ptr, val, mem)
5426                 return true
5427         }
5428         return false
5429 }
5430 func rewriteValuePPC64_OpPPC64FMOVSload(v *Value) bool {
5431         v_1 := v.Args[1]
5432         v_0 := v.Args[0]
5433         // match: (FMOVSload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
5434         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
5435         // result: (FMOVSload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
5436         for {
5437                 off1 := auxIntToInt32(v.AuxInt)
5438                 sym1 := auxToSym(v.Aux)
5439                 p := v_0
5440                 if p.Op != OpPPC64MOVDaddr {
5441                         break
5442                 }
5443                 off2 := auxIntToInt32(p.AuxInt)
5444                 sym2 := auxToSym(p.Aux)
5445                 ptr := p.Args[0]
5446                 mem := v_1
5447                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5448                         break
5449                 }
5450                 v.reset(OpPPC64FMOVSload)
5451                 v.AuxInt = int32ToAuxInt(off1 + off2)
5452                 v.Aux = symToAux(mergeSym(sym1, sym2))
5453                 v.AddArg2(ptr, mem)
5454                 return true
5455         }
5456         // match: (FMOVSload [off1] {sym} (ADDconst [off2] ptr) mem)
5457         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
5458         // result: (FMOVSload [off1+int32(off2)] {sym} ptr mem)
5459         for {
5460                 off1 := auxIntToInt32(v.AuxInt)
5461                 sym := auxToSym(v.Aux)
5462                 if v_0.Op != OpPPC64ADDconst {
5463                         break
5464                 }
5465                 off2 := auxIntToInt64(v_0.AuxInt)
5466                 ptr := v_0.Args[0]
5467                 mem := v_1
5468                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5469                         break
5470                 }
5471                 v.reset(OpPPC64FMOVSload)
5472                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5473                 v.Aux = symToAux(sym)
5474                 v.AddArg2(ptr, mem)
5475                 return true
5476         }
5477         return false
5478 }
5479 func rewriteValuePPC64_OpPPC64FMOVSstore(v *Value) bool {
5480         v_2 := v.Args[2]
5481         v_1 := v.Args[1]
5482         v_0 := v.Args[0]
5483         // match: (FMOVSstore [off1] {sym} (ADDconst [off2] ptr) val mem)
5484         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
5485         // result: (FMOVSstore [off1+int32(off2)] {sym} ptr val mem)
5486         for {
5487                 off1 := auxIntToInt32(v.AuxInt)
5488                 sym := auxToSym(v.Aux)
5489                 if v_0.Op != OpPPC64ADDconst {
5490                         break
5491                 }
5492                 off2 := auxIntToInt64(v_0.AuxInt)
5493                 ptr := v_0.Args[0]
5494                 val := v_1
5495                 mem := v_2
5496                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5497                         break
5498                 }
5499                 v.reset(OpPPC64FMOVSstore)
5500                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5501                 v.Aux = symToAux(sym)
5502                 v.AddArg3(ptr, val, mem)
5503                 return true
5504         }
5505         // match: (FMOVSstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
5506         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
5507         // result: (FMOVSstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
5508         for {
5509                 off1 := auxIntToInt32(v.AuxInt)
5510                 sym1 := auxToSym(v.Aux)
5511                 p := v_0
5512                 if p.Op != OpPPC64MOVDaddr {
5513                         break
5514                 }
5515                 off2 := auxIntToInt32(p.AuxInt)
5516                 sym2 := auxToSym(p.Aux)
5517                 ptr := p.Args[0]
5518                 val := v_1
5519                 mem := v_2
5520                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5521                         break
5522                 }
5523                 v.reset(OpPPC64FMOVSstore)
5524                 v.AuxInt = int32ToAuxInt(off1 + off2)
5525                 v.Aux = symToAux(mergeSym(sym1, sym2))
5526                 v.AddArg3(ptr, val, mem)
5527                 return true
5528         }
5529         return false
5530 }
5531 func rewriteValuePPC64_OpPPC64FNEG(v *Value) bool {
5532         v_0 := v.Args[0]
5533         // match: (FNEG (FABS x))
5534         // result: (FNABS x)
5535         for {
5536                 if v_0.Op != OpPPC64FABS {
5537                         break
5538                 }
5539                 x := v_0.Args[0]
5540                 v.reset(OpPPC64FNABS)
5541                 v.AddArg(x)
5542                 return true
5543         }
5544         // match: (FNEG (FNABS x))
5545         // result: (FABS x)
5546         for {
5547                 if v_0.Op != OpPPC64FNABS {
5548                         break
5549                 }
5550                 x := v_0.Args[0]
5551                 v.reset(OpPPC64FABS)
5552                 v.AddArg(x)
5553                 return true
5554         }
5555         return false
5556 }
5557 func rewriteValuePPC64_OpPPC64FSQRT(v *Value) bool {
5558         v_0 := v.Args[0]
5559         // match: (FSQRT (FMOVDconst [x]))
5560         // cond: x >= 0
5561         // result: (FMOVDconst [math.Sqrt(x)])
5562         for {
5563                 if v_0.Op != OpPPC64FMOVDconst {
5564                         break
5565                 }
5566                 x := auxIntToFloat64(v_0.AuxInt)
5567                 if !(x >= 0) {
5568                         break
5569                 }
5570                 v.reset(OpPPC64FMOVDconst)
5571                 v.AuxInt = float64ToAuxInt(math.Sqrt(x))
5572                 return true
5573         }
5574         return false
5575 }
5576 func rewriteValuePPC64_OpPPC64FSUB(v *Value) bool {
5577         v_1 := v.Args[1]
5578         v_0 := v.Args[0]
5579         // match: (FSUB (FMUL x y) z)
5580         // cond: x.Block.Func.useFMA(v)
5581         // result: (FMSUB x y z)
5582         for {
5583                 if v_0.Op != OpPPC64FMUL {
5584                         break
5585                 }
5586                 _ = v_0.Args[1]
5587                 v_0_0 := v_0.Args[0]
5588                 v_0_1 := v_0.Args[1]
5589                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
5590                         x := v_0_0
5591                         y := v_0_1
5592                         z := v_1
5593                         if !(x.Block.Func.useFMA(v)) {
5594                                 continue
5595                         }
5596                         v.reset(OpPPC64FMSUB)
5597                         v.AddArg3(x, y, z)
5598                         return true
5599                 }
5600                 break
5601         }
5602         return false
5603 }
5604 func rewriteValuePPC64_OpPPC64FSUBS(v *Value) bool {
5605         v_1 := v.Args[1]
5606         v_0 := v.Args[0]
5607         // match: (FSUBS (FMULS x y) z)
5608         // cond: x.Block.Func.useFMA(v)
5609         // result: (FMSUBS x y z)
5610         for {
5611                 if v_0.Op != OpPPC64FMULS {
5612                         break
5613                 }
5614                 _ = v_0.Args[1]
5615                 v_0_0 := v_0.Args[0]
5616                 v_0_1 := v_0.Args[1]
5617                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
5618                         x := v_0_0
5619                         y := v_0_1
5620                         z := v_1
5621                         if !(x.Block.Func.useFMA(v)) {
5622                                 continue
5623                         }
5624                         v.reset(OpPPC64FMSUBS)
5625                         v.AddArg3(x, y, z)
5626                         return true
5627                 }
5628                 break
5629         }
5630         return false
5631 }
5632 func rewriteValuePPC64_OpPPC64FTRUNC(v *Value) bool {
5633         v_0 := v.Args[0]
5634         // match: (FTRUNC (FMOVDconst [x]))
5635         // result: (FMOVDconst [math.Trunc(x)])
5636         for {
5637                 if v_0.Op != OpPPC64FMOVDconst {
5638                         break
5639                 }
5640                 x := auxIntToFloat64(v_0.AuxInt)
5641                 v.reset(OpPPC64FMOVDconst)
5642                 v.AuxInt = float64ToAuxInt(math.Trunc(x))
5643                 return true
5644         }
5645         return false
5646 }
5647 func rewriteValuePPC64_OpPPC64GreaterEqual(v *Value) bool {
5648         v_0 := v.Args[0]
5649         // match: (GreaterEqual (FlagEQ))
5650         // result: (MOVDconst [1])
5651         for {
5652                 if v_0.Op != OpPPC64FlagEQ {
5653                         break
5654                 }
5655                 v.reset(OpPPC64MOVDconst)
5656                 v.AuxInt = int64ToAuxInt(1)
5657                 return true
5658         }
5659         // match: (GreaterEqual (FlagLT))
5660         // result: (MOVDconst [0])
5661         for {
5662                 if v_0.Op != OpPPC64FlagLT {
5663                         break
5664                 }
5665                 v.reset(OpPPC64MOVDconst)
5666                 v.AuxInt = int64ToAuxInt(0)
5667                 return true
5668         }
5669         // match: (GreaterEqual (FlagGT))
5670         // result: (MOVDconst [1])
5671         for {
5672                 if v_0.Op != OpPPC64FlagGT {
5673                         break
5674                 }
5675                 v.reset(OpPPC64MOVDconst)
5676                 v.AuxInt = int64ToAuxInt(1)
5677                 return true
5678         }
5679         // match: (GreaterEqual (InvertFlags x))
5680         // result: (LessEqual x)
5681         for {
5682                 if v_0.Op != OpPPC64InvertFlags {
5683                         break
5684                 }
5685                 x := v_0.Args[0]
5686                 v.reset(OpPPC64LessEqual)
5687                 v.AddArg(x)
5688                 return true
5689         }
5690         // match: (GreaterEqual cmp)
5691         // result: (SETBCR [0] cmp)
5692         for {
5693                 cmp := v_0
5694                 v.reset(OpPPC64SETBCR)
5695                 v.AuxInt = int32ToAuxInt(0)
5696                 v.AddArg(cmp)
5697                 return true
5698         }
5699 }
5700 func rewriteValuePPC64_OpPPC64GreaterThan(v *Value) bool {
5701         v_0 := v.Args[0]
5702         // match: (GreaterThan (FlagEQ))
5703         // result: (MOVDconst [0])
5704         for {
5705                 if v_0.Op != OpPPC64FlagEQ {
5706                         break
5707                 }
5708                 v.reset(OpPPC64MOVDconst)
5709                 v.AuxInt = int64ToAuxInt(0)
5710                 return true
5711         }
5712         // match: (GreaterThan (FlagLT))
5713         // result: (MOVDconst [0])
5714         for {
5715                 if v_0.Op != OpPPC64FlagLT {
5716                         break
5717                 }
5718                 v.reset(OpPPC64MOVDconst)
5719                 v.AuxInt = int64ToAuxInt(0)
5720                 return true
5721         }
5722         // match: (GreaterThan (FlagGT))
5723         // result: (MOVDconst [1])
5724         for {
5725                 if v_0.Op != OpPPC64FlagGT {
5726                         break
5727                 }
5728                 v.reset(OpPPC64MOVDconst)
5729                 v.AuxInt = int64ToAuxInt(1)
5730                 return true
5731         }
5732         // match: (GreaterThan (InvertFlags x))
5733         // result: (LessThan x)
5734         for {
5735                 if v_0.Op != OpPPC64InvertFlags {
5736                         break
5737                 }
5738                 x := v_0.Args[0]
5739                 v.reset(OpPPC64LessThan)
5740                 v.AddArg(x)
5741                 return true
5742         }
5743         // match: (GreaterThan cmp)
5744         // result: (SETBC [1] cmp)
5745         for {
5746                 cmp := v_0
5747                 v.reset(OpPPC64SETBC)
5748                 v.AuxInt = int32ToAuxInt(1)
5749                 v.AddArg(cmp)
5750                 return true
5751         }
5752 }
5753 func rewriteValuePPC64_OpPPC64ISEL(v *Value) bool {
5754         v_2 := v.Args[2]
5755         v_1 := v.Args[1]
5756         v_0 := v.Args[0]
5757         b := v.Block
5758         typ := &b.Func.Config.Types
5759         // match: (ISEL [6] x y (Select1 (ANDCCconst [1] (SETBC [c] cmp))))
5760         // result: (ISEL [c] x y cmp)
5761         for {
5762                 if auxIntToInt32(v.AuxInt) != 6 {
5763                         break
5764                 }
5765                 x := v_0
5766                 y := v_1
5767                 if v_2.Op != OpSelect1 {
5768                         break
5769                 }
5770                 v_2_0 := v_2.Args[0]
5771                 if v_2_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_2_0.AuxInt) != 1 {
5772                         break
5773                 }
5774                 v_2_0_0 := v_2_0.Args[0]
5775                 if v_2_0_0.Op != OpPPC64SETBC {
5776                         break
5777                 }
5778                 c := auxIntToInt32(v_2_0_0.AuxInt)
5779                 cmp := v_2_0_0.Args[0]
5780                 v.reset(OpPPC64ISEL)
5781                 v.AuxInt = int32ToAuxInt(c)
5782                 v.AddArg3(x, y, cmp)
5783                 return true
5784         }
5785         // match: (ISEL [6] x y (CMPconst [0] (SETBC [c] cmp)))
5786         // result: (ISEL [c] x y cmp)
5787         for {
5788                 if auxIntToInt32(v.AuxInt) != 6 {
5789                         break
5790                 }
5791                 x := v_0
5792                 y := v_1
5793                 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
5794                         break
5795                 }
5796                 v_2_0 := v_2.Args[0]
5797                 if v_2_0.Op != OpPPC64SETBC {
5798                         break
5799                 }
5800                 c := auxIntToInt32(v_2_0.AuxInt)
5801                 cmp := v_2_0.Args[0]
5802                 v.reset(OpPPC64ISEL)
5803                 v.AuxInt = int32ToAuxInt(c)
5804                 v.AddArg3(x, y, cmp)
5805                 return true
5806         }
5807         // match: (ISEL [6] x y (CMPWconst [0] (SETBC [c] cmp)))
5808         // result: (ISEL [c] x y cmp)
5809         for {
5810                 if auxIntToInt32(v.AuxInt) != 6 {
5811                         break
5812                 }
5813                 x := v_0
5814                 y := v_1
5815                 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
5816                         break
5817                 }
5818                 v_2_0 := v_2.Args[0]
5819                 if v_2_0.Op != OpPPC64SETBC {
5820                         break
5821                 }
5822                 c := auxIntToInt32(v_2_0.AuxInt)
5823                 cmp := v_2_0.Args[0]
5824                 v.reset(OpPPC64ISEL)
5825                 v.AuxInt = int32ToAuxInt(c)
5826                 v.AddArg3(x, y, cmp)
5827                 return true
5828         }
5829         // match: (ISEL [6] x y (CMPconst [0] (SETBCR [c] cmp)))
5830         // result: (ISEL [c+4] x y cmp)
5831         for {
5832                 if auxIntToInt32(v.AuxInt) != 6 {
5833                         break
5834                 }
5835                 x := v_0
5836                 y := v_1
5837                 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
5838                         break
5839                 }
5840                 v_2_0 := v_2.Args[0]
5841                 if v_2_0.Op != OpPPC64SETBCR {
5842                         break
5843                 }
5844                 c := auxIntToInt32(v_2_0.AuxInt)
5845                 cmp := v_2_0.Args[0]
5846                 v.reset(OpPPC64ISEL)
5847                 v.AuxInt = int32ToAuxInt(c + 4)
5848                 v.AddArg3(x, y, cmp)
5849                 return true
5850         }
5851         // match: (ISEL [6] x y (CMPWconst [0] (SETBCR [c] cmp)))
5852         // result: (ISEL [c+4] x y cmp)
5853         for {
5854                 if auxIntToInt32(v.AuxInt) != 6 {
5855                         break
5856                 }
5857                 x := v_0
5858                 y := v_1
5859                 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
5860                         break
5861                 }
5862                 v_2_0 := v_2.Args[0]
5863                 if v_2_0.Op != OpPPC64SETBCR {
5864                         break
5865                 }
5866                 c := auxIntToInt32(v_2_0.AuxInt)
5867                 cmp := v_2_0.Args[0]
5868                 v.reset(OpPPC64ISEL)
5869                 v.AuxInt = int32ToAuxInt(c + 4)
5870                 v.AddArg3(x, y, cmp)
5871                 return true
5872         }
5873         // match: (ISEL [2] x _ (FlagEQ))
5874         // result: x
5875         for {
5876                 if auxIntToInt32(v.AuxInt) != 2 {
5877                         break
5878                 }
5879                 x := v_0
5880                 if v_2.Op != OpPPC64FlagEQ {
5881                         break
5882                 }
5883                 v.copyOf(x)
5884                 return true
5885         }
5886         // match: (ISEL [2] _ y (FlagLT))
5887         // result: y
5888         for {
5889                 if auxIntToInt32(v.AuxInt) != 2 {
5890                         break
5891                 }
5892                 y := v_1
5893                 if v_2.Op != OpPPC64FlagLT {
5894                         break
5895                 }
5896                 v.copyOf(y)
5897                 return true
5898         }
5899         // match: (ISEL [2] _ y (FlagGT))
5900         // result: y
5901         for {
5902                 if auxIntToInt32(v.AuxInt) != 2 {
5903                         break
5904                 }
5905                 y := v_1
5906                 if v_2.Op != OpPPC64FlagGT {
5907                         break
5908                 }
5909                 v.copyOf(y)
5910                 return true
5911         }
5912         // match: (ISEL [6] _ y (FlagEQ))
5913         // result: y
5914         for {
5915                 if auxIntToInt32(v.AuxInt) != 6 {
5916                         break
5917                 }
5918                 y := v_1
5919                 if v_2.Op != OpPPC64FlagEQ {
5920                         break
5921                 }
5922                 v.copyOf(y)
5923                 return true
5924         }
5925         // match: (ISEL [6] x _ (FlagLT))
5926         // result: x
5927         for {
5928                 if auxIntToInt32(v.AuxInt) != 6 {
5929                         break
5930                 }
5931                 x := v_0
5932                 if v_2.Op != OpPPC64FlagLT {
5933                         break
5934                 }
5935                 v.copyOf(x)
5936                 return true
5937         }
5938         // match: (ISEL [6] x _ (FlagGT))
5939         // result: x
5940         for {
5941                 if auxIntToInt32(v.AuxInt) != 6 {
5942                         break
5943                 }
5944                 x := v_0
5945                 if v_2.Op != OpPPC64FlagGT {
5946                         break
5947                 }
5948                 v.copyOf(x)
5949                 return true
5950         }
5951         // match: (ISEL [0] _ y (FlagEQ))
5952         // result: y
5953         for {
5954                 if auxIntToInt32(v.AuxInt) != 0 {
5955                         break
5956                 }
5957                 y := v_1
5958                 if v_2.Op != OpPPC64FlagEQ {
5959                         break
5960                 }
5961                 v.copyOf(y)
5962                 return true
5963         }
5964         // match: (ISEL [0] _ y (FlagGT))
5965         // result: y
5966         for {
5967                 if auxIntToInt32(v.AuxInt) != 0 {
5968                         break
5969                 }
5970                 y := v_1
5971                 if v_2.Op != OpPPC64FlagGT {
5972                         break
5973                 }
5974                 v.copyOf(y)
5975                 return true
5976         }
5977         // match: (ISEL [0] x _ (FlagLT))
5978         // result: x
5979         for {
5980                 if auxIntToInt32(v.AuxInt) != 0 {
5981                         break
5982                 }
5983                 x := v_0
5984                 if v_2.Op != OpPPC64FlagLT {
5985                         break
5986                 }
5987                 v.copyOf(x)
5988                 return true
5989         }
5990         // match: (ISEL [5] _ x (FlagEQ))
5991         // result: x
5992         for {
5993                 if auxIntToInt32(v.AuxInt) != 5 {
5994                         break
5995                 }
5996                 x := v_1
5997                 if v_2.Op != OpPPC64FlagEQ {
5998                         break
5999                 }
6000                 v.copyOf(x)
6001                 return true
6002         }
6003         // match: (ISEL [5] _ x (FlagLT))
6004         // result: x
6005         for {
6006                 if auxIntToInt32(v.AuxInt) != 5 {
6007                         break
6008                 }
6009                 x := v_1
6010                 if v_2.Op != OpPPC64FlagLT {
6011                         break
6012                 }
6013                 v.copyOf(x)
6014                 return true
6015         }
6016         // match: (ISEL [5] y _ (FlagGT))
6017         // result: y
6018         for {
6019                 if auxIntToInt32(v.AuxInt) != 5 {
6020                         break
6021                 }
6022                 y := v_0
6023                 if v_2.Op != OpPPC64FlagGT {
6024                         break
6025                 }
6026                 v.copyOf(y)
6027                 return true
6028         }
6029         // match: (ISEL [1] _ y (FlagEQ))
6030         // result: y
6031         for {
6032                 if auxIntToInt32(v.AuxInt) != 1 {
6033                         break
6034                 }
6035                 y := v_1
6036                 if v_2.Op != OpPPC64FlagEQ {
6037                         break
6038                 }
6039                 v.copyOf(y)
6040                 return true
6041         }
6042         // match: (ISEL [1] _ y (FlagLT))
6043         // result: y
6044         for {
6045                 if auxIntToInt32(v.AuxInt) != 1 {
6046                         break
6047                 }
6048                 y := v_1
6049                 if v_2.Op != OpPPC64FlagLT {
6050                         break
6051                 }
6052                 v.copyOf(y)
6053                 return true
6054         }
6055         // match: (ISEL [1] x _ (FlagGT))
6056         // result: x
6057         for {
6058                 if auxIntToInt32(v.AuxInt) != 1 {
6059                         break
6060                 }
6061                 x := v_0
6062                 if v_2.Op != OpPPC64FlagGT {
6063                         break
6064                 }
6065                 v.copyOf(x)
6066                 return true
6067         }
6068         // match: (ISEL [4] x _ (FlagEQ))
6069         // result: x
6070         for {
6071                 if auxIntToInt32(v.AuxInt) != 4 {
6072                         break
6073                 }
6074                 x := v_0
6075                 if v_2.Op != OpPPC64FlagEQ {
6076                         break
6077                 }
6078                 v.copyOf(x)
6079                 return true
6080         }
6081         // match: (ISEL [4] x _ (FlagGT))
6082         // result: x
6083         for {
6084                 if auxIntToInt32(v.AuxInt) != 4 {
6085                         break
6086                 }
6087                 x := v_0
6088                 if v_2.Op != OpPPC64FlagGT {
6089                         break
6090                 }
6091                 v.copyOf(x)
6092                 return true
6093         }
6094         // match: (ISEL [4] _ y (FlagLT))
6095         // result: y
6096         for {
6097                 if auxIntToInt32(v.AuxInt) != 4 {
6098                         break
6099                 }
6100                 y := v_1
6101                 if v_2.Op != OpPPC64FlagLT {
6102                         break
6103                 }
6104                 v.copyOf(y)
6105                 return true
6106         }
6107         // match: (ISEL [2] x y (CMPconst [0] (Select0 (ANDCCconst [n] z))))
6108         // result: (ISEL [2] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6109         for {
6110                 if auxIntToInt32(v.AuxInt) != 2 {
6111                         break
6112                 }
6113                 x := v_0
6114                 y := v_1
6115                 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
6116                         break
6117                 }
6118                 v_2_0 := v_2.Args[0]
6119                 if v_2_0.Op != OpSelect0 {
6120                         break
6121                 }
6122                 v_2_0_0 := v_2_0.Args[0]
6123                 if v_2_0_0.Op != OpPPC64ANDCCconst {
6124                         break
6125                 }
6126                 n := auxIntToInt64(v_2_0_0.AuxInt)
6127                 z := v_2_0_0.Args[0]
6128                 v.reset(OpPPC64ISEL)
6129                 v.AuxInt = int32ToAuxInt(2)
6130                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
6131                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
6132                 v1.AuxInt = int64ToAuxInt(n)
6133                 v1.AddArg(z)
6134                 v0.AddArg(v1)
6135                 v.AddArg3(x, y, v0)
6136                 return true
6137         }
6138         // match: (ISEL [2] x y (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
6139         // result: (ISEL [2] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6140         for {
6141                 if auxIntToInt32(v.AuxInt) != 2 {
6142                         break
6143                 }
6144                 x := v_0
6145                 y := v_1
6146                 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
6147                         break
6148                 }
6149                 v_2_0 := v_2.Args[0]
6150                 if v_2_0.Op != OpSelect0 {
6151                         break
6152                 }
6153                 v_2_0_0 := v_2_0.Args[0]
6154                 if v_2_0_0.Op != OpPPC64ANDCCconst {
6155                         break
6156                 }
6157                 n := auxIntToInt64(v_2_0_0.AuxInt)
6158                 z := v_2_0_0.Args[0]
6159                 v.reset(OpPPC64ISEL)
6160                 v.AuxInt = int32ToAuxInt(2)
6161                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
6162                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
6163                 v1.AuxInt = int64ToAuxInt(n)
6164                 v1.AddArg(z)
6165                 v0.AddArg(v1)
6166                 v.AddArg3(x, y, v0)
6167                 return true
6168         }
6169         // match: (ISEL [6] x y (CMPconst [0] (Select0 (ANDCCconst [n] z))))
6170         // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6171         for {
6172                 if auxIntToInt32(v.AuxInt) != 6 {
6173                         break
6174                 }
6175                 x := v_0
6176                 y := v_1
6177                 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
6178                         break
6179                 }
6180                 v_2_0 := v_2.Args[0]
6181                 if v_2_0.Op != OpSelect0 {
6182                         break
6183                 }
6184                 v_2_0_0 := v_2_0.Args[0]
6185                 if v_2_0_0.Op != OpPPC64ANDCCconst {
6186                         break
6187                 }
6188                 n := auxIntToInt64(v_2_0_0.AuxInt)
6189                 z := v_2_0_0.Args[0]
6190                 v.reset(OpPPC64ISEL)
6191                 v.AuxInt = int32ToAuxInt(6)
6192                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
6193                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
6194                 v1.AuxInt = int64ToAuxInt(n)
6195                 v1.AddArg(z)
6196                 v0.AddArg(v1)
6197                 v.AddArg3(x, y, v0)
6198                 return true
6199         }
6200         // match: (ISEL [6] x y (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
6201         // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6202         for {
6203                 if auxIntToInt32(v.AuxInt) != 6 {
6204                         break
6205                 }
6206                 x := v_0
6207                 y := v_1
6208                 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
6209                         break
6210                 }
6211                 v_2_0 := v_2.Args[0]
6212                 if v_2_0.Op != OpSelect0 {
6213                         break
6214                 }
6215                 v_2_0_0 := v_2_0.Args[0]
6216                 if v_2_0_0.Op != OpPPC64ANDCCconst {
6217                         break
6218                 }
6219                 n := auxIntToInt64(v_2_0_0.AuxInt)
6220                 z := v_2_0_0.Args[0]
6221                 v.reset(OpPPC64ISEL)
6222                 v.AuxInt = int32ToAuxInt(6)
6223                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
6224                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
6225                 v1.AuxInt = int64ToAuxInt(n)
6226                 v1.AddArg(z)
6227                 v0.AddArg(v1)
6228                 v.AddArg3(x, y, v0)
6229                 return true
6230         }
6231         // match: (ISEL [n] x y (InvertFlags bool))
6232         // cond: n%4 == 0
6233         // result: (ISEL [n+1] x y bool)
6234         for {
6235                 n := auxIntToInt32(v.AuxInt)
6236                 x := v_0
6237                 y := v_1
6238                 if v_2.Op != OpPPC64InvertFlags {
6239                         break
6240                 }
6241                 bool := v_2.Args[0]
6242                 if !(n%4 == 0) {
6243                         break
6244                 }
6245                 v.reset(OpPPC64ISEL)
6246                 v.AuxInt = int32ToAuxInt(n + 1)
6247                 v.AddArg3(x, y, bool)
6248                 return true
6249         }
6250         // match: (ISEL [n] x y (InvertFlags bool))
6251         // cond: n%4 == 1
6252         // result: (ISEL [n-1] x y bool)
6253         for {
6254                 n := auxIntToInt32(v.AuxInt)
6255                 x := v_0
6256                 y := v_1
6257                 if v_2.Op != OpPPC64InvertFlags {
6258                         break
6259                 }
6260                 bool := v_2.Args[0]
6261                 if !(n%4 == 1) {
6262                         break
6263                 }
6264                 v.reset(OpPPC64ISEL)
6265                 v.AuxInt = int32ToAuxInt(n - 1)
6266                 v.AddArg3(x, y, bool)
6267                 return true
6268         }
6269         // match: (ISEL [n] x y (InvertFlags bool))
6270         // cond: n%4 == 2
6271         // result: (ISEL [n] x y bool)
6272         for {
6273                 n := auxIntToInt32(v.AuxInt)
6274                 x := v_0
6275                 y := v_1
6276                 if v_2.Op != OpPPC64InvertFlags {
6277                         break
6278                 }
6279                 bool := v_2.Args[0]
6280                 if !(n%4 == 2) {
6281                         break
6282                 }
6283                 v.reset(OpPPC64ISEL)
6284                 v.AuxInt = int32ToAuxInt(n)
6285                 v.AddArg3(x, y, bool)
6286                 return true
6287         }
6288         return false
6289 }
6290 func rewriteValuePPC64_OpPPC64LessEqual(v *Value) bool {
6291         v_0 := v.Args[0]
6292         // match: (LessEqual (FlagEQ))
6293         // result: (MOVDconst [1])
6294         for {
6295                 if v_0.Op != OpPPC64FlagEQ {
6296                         break
6297                 }
6298                 v.reset(OpPPC64MOVDconst)
6299                 v.AuxInt = int64ToAuxInt(1)
6300                 return true
6301         }
6302         // match: (LessEqual (FlagLT))
6303         // result: (MOVDconst [1])
6304         for {
6305                 if v_0.Op != OpPPC64FlagLT {
6306                         break
6307                 }
6308                 v.reset(OpPPC64MOVDconst)
6309                 v.AuxInt = int64ToAuxInt(1)
6310                 return true
6311         }
6312         // match: (LessEqual (FlagGT))
6313         // result: (MOVDconst [0])
6314         for {
6315                 if v_0.Op != OpPPC64FlagGT {
6316                         break
6317                 }
6318                 v.reset(OpPPC64MOVDconst)
6319                 v.AuxInt = int64ToAuxInt(0)
6320                 return true
6321         }
6322         // match: (LessEqual (InvertFlags x))
6323         // result: (GreaterEqual x)
6324         for {
6325                 if v_0.Op != OpPPC64InvertFlags {
6326                         break
6327                 }
6328                 x := v_0.Args[0]
6329                 v.reset(OpPPC64GreaterEqual)
6330                 v.AddArg(x)
6331                 return true
6332         }
6333         // match: (LessEqual cmp)
6334         // result: (SETBCR [1] cmp)
6335         for {
6336                 cmp := v_0
6337                 v.reset(OpPPC64SETBCR)
6338                 v.AuxInt = int32ToAuxInt(1)
6339                 v.AddArg(cmp)
6340                 return true
6341         }
6342 }
6343 func rewriteValuePPC64_OpPPC64LessThan(v *Value) bool {
6344         v_0 := v.Args[0]
6345         // match: (LessThan (FlagEQ))
6346         // result: (MOVDconst [0])
6347         for {
6348                 if v_0.Op != OpPPC64FlagEQ {
6349                         break
6350                 }
6351                 v.reset(OpPPC64MOVDconst)
6352                 v.AuxInt = int64ToAuxInt(0)
6353                 return true
6354         }
6355         // match: (LessThan (FlagLT))
6356         // result: (MOVDconst [1])
6357         for {
6358                 if v_0.Op != OpPPC64FlagLT {
6359                         break
6360                 }
6361                 v.reset(OpPPC64MOVDconst)
6362                 v.AuxInt = int64ToAuxInt(1)
6363                 return true
6364         }
6365         // match: (LessThan (FlagGT))
6366         // result: (MOVDconst [0])
6367         for {
6368                 if v_0.Op != OpPPC64FlagGT {
6369                         break
6370                 }
6371                 v.reset(OpPPC64MOVDconst)
6372                 v.AuxInt = int64ToAuxInt(0)
6373                 return true
6374         }
6375         // match: (LessThan (InvertFlags x))
6376         // result: (GreaterThan x)
6377         for {
6378                 if v_0.Op != OpPPC64InvertFlags {
6379                         break
6380                 }
6381                 x := v_0.Args[0]
6382                 v.reset(OpPPC64GreaterThan)
6383                 v.AddArg(x)
6384                 return true
6385         }
6386         // match: (LessThan cmp)
6387         // result: (SETBC [0] cmp)
6388         for {
6389                 cmp := v_0
6390                 v.reset(OpPPC64SETBC)
6391                 v.AuxInt = int32ToAuxInt(0)
6392                 v.AddArg(cmp)
6393                 return true
6394         }
6395 }
6396 func rewriteValuePPC64_OpPPC64MFVSRD(v *Value) bool {
6397         v_0 := v.Args[0]
6398         b := v.Block
6399         typ := &b.Func.Config.Types
6400         // match: (MFVSRD (FMOVDconst [c]))
6401         // result: (MOVDconst [int64(math.Float64bits(c))])
6402         for {
6403                 if v_0.Op != OpPPC64FMOVDconst {
6404                         break
6405                 }
6406                 c := auxIntToFloat64(v_0.AuxInt)
6407                 v.reset(OpPPC64MOVDconst)
6408                 v.AuxInt = int64ToAuxInt(int64(math.Float64bits(c)))
6409                 return true
6410         }
6411         // match: (MFVSRD x:(FMOVDload [off] {sym} ptr mem))
6412         // cond: x.Uses == 1 && clobber(x)
6413         // result: @x.Block (MOVDload [off] {sym} ptr mem)
6414         for {
6415                 x := v_0
6416                 if x.Op != OpPPC64FMOVDload {
6417                         break
6418                 }
6419                 off := auxIntToInt32(x.AuxInt)
6420                 sym := auxToSym(x.Aux)
6421                 mem := x.Args[1]
6422                 ptr := x.Args[0]
6423                 if !(x.Uses == 1 && clobber(x)) {
6424                         break
6425                 }
6426                 b = x.Block
6427                 v0 := b.NewValue0(x.Pos, OpPPC64MOVDload, typ.Int64)
6428                 v.copyOf(v0)
6429                 v0.AuxInt = int32ToAuxInt(off)
6430                 v0.Aux = symToAux(sym)
6431                 v0.AddArg2(ptr, mem)
6432                 return true
6433         }
6434         return false
6435 }
6436 func rewriteValuePPC64_OpPPC64MOVBZload(v *Value) bool {
6437         v_1 := v.Args[1]
6438         v_0 := v.Args[0]
6439         // match: (MOVBZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
6440         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
6441         // result: (MOVBZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
6442         for {
6443                 off1 := auxIntToInt32(v.AuxInt)
6444                 sym1 := auxToSym(v.Aux)
6445                 p := v_0
6446                 if p.Op != OpPPC64MOVDaddr {
6447                         break
6448                 }
6449                 off2 := auxIntToInt32(p.AuxInt)
6450                 sym2 := auxToSym(p.Aux)
6451                 ptr := p.Args[0]
6452                 mem := v_1
6453                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
6454                         break
6455                 }
6456                 v.reset(OpPPC64MOVBZload)
6457                 v.AuxInt = int32ToAuxInt(off1 + off2)
6458                 v.Aux = symToAux(mergeSym(sym1, sym2))
6459                 v.AddArg2(ptr, mem)
6460                 return true
6461         }
6462         // match: (MOVBZload [off1] {sym} (ADDconst [off2] x) mem)
6463         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
6464         // result: (MOVBZload [off1+int32(off2)] {sym} x mem)
6465         for {
6466                 off1 := auxIntToInt32(v.AuxInt)
6467                 sym := auxToSym(v.Aux)
6468                 if v_0.Op != OpPPC64ADDconst {
6469                         break
6470                 }
6471                 off2 := auxIntToInt64(v_0.AuxInt)
6472                 x := v_0.Args[0]
6473                 mem := v_1
6474                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
6475                         break
6476                 }
6477                 v.reset(OpPPC64MOVBZload)
6478                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
6479                 v.Aux = symToAux(sym)
6480                 v.AddArg2(x, mem)
6481                 return true
6482         }
6483         // match: (MOVBZload [0] {sym} p:(ADD ptr idx) mem)
6484         // cond: sym == nil && p.Uses == 1
6485         // result: (MOVBZloadidx ptr idx mem)
6486         for {
6487                 if auxIntToInt32(v.AuxInt) != 0 {
6488                         break
6489                 }
6490                 sym := auxToSym(v.Aux)
6491                 p := v_0
6492                 if p.Op != OpPPC64ADD {
6493                         break
6494                 }
6495                 idx := p.Args[1]
6496                 ptr := p.Args[0]
6497                 mem := v_1
6498                 if !(sym == nil && p.Uses == 1) {
6499                         break
6500                 }
6501                 v.reset(OpPPC64MOVBZloadidx)
6502                 v.AddArg3(ptr, idx, mem)
6503                 return true
6504         }
6505         return false
6506 }
6507 func rewriteValuePPC64_OpPPC64MOVBZloadidx(v *Value) bool {
6508         v_2 := v.Args[2]
6509         v_1 := v.Args[1]
6510         v_0 := v.Args[0]
6511         // match: (MOVBZloadidx ptr (MOVDconst [c]) mem)
6512         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
6513         // result: (MOVBZload [int32(c)] ptr mem)
6514         for {
6515                 ptr := v_0
6516                 if v_1.Op != OpPPC64MOVDconst {
6517                         break
6518                 }
6519                 c := auxIntToInt64(v_1.AuxInt)
6520                 mem := v_2
6521                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
6522                         break
6523                 }
6524                 v.reset(OpPPC64MOVBZload)
6525                 v.AuxInt = int32ToAuxInt(int32(c))
6526                 v.AddArg2(ptr, mem)
6527                 return true
6528         }
6529         // match: (MOVBZloadidx (MOVDconst [c]) ptr mem)
6530         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
6531         // result: (MOVBZload [int32(c)] ptr mem)
6532         for {
6533                 if v_0.Op != OpPPC64MOVDconst {
6534                         break
6535                 }
6536                 c := auxIntToInt64(v_0.AuxInt)
6537                 ptr := v_1
6538                 mem := v_2
6539                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
6540                         break
6541                 }
6542                 v.reset(OpPPC64MOVBZload)
6543                 v.AuxInt = int32ToAuxInt(int32(c))
6544                 v.AddArg2(ptr, mem)
6545                 return true
6546         }
6547         return false
6548 }
6549 func rewriteValuePPC64_OpPPC64MOVBZreg(v *Value) bool {
6550         v_0 := v.Args[0]
6551         b := v.Block
6552         typ := &b.Func.Config.Types
6553         // match: (MOVBZreg y:(Select0 (ANDCCconst [c] _)))
6554         // cond: uint64(c) <= 0xFF
6555         // result: y
6556         for {
6557                 y := v_0
6558                 if y.Op != OpSelect0 {
6559                         break
6560                 }
6561                 y_0 := y.Args[0]
6562                 if y_0.Op != OpPPC64ANDCCconst {
6563                         break
6564                 }
6565                 c := auxIntToInt64(y_0.AuxInt)
6566                 if !(uint64(c) <= 0xFF) {
6567                         break
6568                 }
6569                 v.copyOf(y)
6570                 return true
6571         }
6572         // match: (MOVBZreg (SRWconst [c] (MOVBZreg x)))
6573         // result: (SRWconst [c] (MOVBZreg x))
6574         for {
6575                 if v_0.Op != OpPPC64SRWconst {
6576                         break
6577                 }
6578                 c := auxIntToInt64(v_0.AuxInt)
6579                 v_0_0 := v_0.Args[0]
6580                 if v_0_0.Op != OpPPC64MOVBZreg {
6581                         break
6582                 }
6583                 x := v_0_0.Args[0]
6584                 v.reset(OpPPC64SRWconst)
6585                 v.AuxInt = int64ToAuxInt(c)
6586                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
6587                 v0.AddArg(x)
6588                 v.AddArg(v0)
6589                 return true
6590         }
6591         // match: (MOVBZreg (SRWconst [c] x))
6592         // cond: sizeof(x.Type) == 8
6593         // result: (SRWconst [c] x)
6594         for {
6595                 if v_0.Op != OpPPC64SRWconst {
6596                         break
6597                 }
6598                 c := auxIntToInt64(v_0.AuxInt)
6599                 x := v_0.Args[0]
6600                 if !(sizeof(x.Type) == 8) {
6601                         break
6602                 }
6603                 v.reset(OpPPC64SRWconst)
6604                 v.AuxInt = int64ToAuxInt(c)
6605                 v.AddArg(x)
6606                 return true
6607         }
6608         // match: (MOVBZreg (SRDconst [c] x))
6609         // cond: c>=56
6610         // result: (SRDconst [c] x)
6611         for {
6612                 if v_0.Op != OpPPC64SRDconst {
6613                         break
6614                 }
6615                 c := auxIntToInt64(v_0.AuxInt)
6616                 x := v_0.Args[0]
6617                 if !(c >= 56) {
6618                         break
6619                 }
6620                 v.reset(OpPPC64SRDconst)
6621                 v.AuxInt = int64ToAuxInt(c)
6622                 v.AddArg(x)
6623                 return true
6624         }
6625         // match: (MOVBZreg (SRWconst [c] x))
6626         // cond: c>=24
6627         // result: (SRWconst [c] x)
6628         for {
6629                 if v_0.Op != OpPPC64SRWconst {
6630                         break
6631                 }
6632                 c := auxIntToInt64(v_0.AuxInt)
6633                 x := v_0.Args[0]
6634                 if !(c >= 24) {
6635                         break
6636                 }
6637                 v.reset(OpPPC64SRWconst)
6638                 v.AuxInt = int64ToAuxInt(c)
6639                 v.AddArg(x)
6640                 return true
6641         }
6642         // match: (MOVBZreg y:(MOVBZreg _))
6643         // result: y
6644         for {
6645                 y := v_0
6646                 if y.Op != OpPPC64MOVBZreg {
6647                         break
6648                 }
6649                 v.copyOf(y)
6650                 return true
6651         }
6652         // match: (MOVBZreg (MOVBreg x))
6653         // result: (MOVBZreg x)
6654         for {
6655                 if v_0.Op != OpPPC64MOVBreg {
6656                         break
6657                 }
6658                 x := v_0.Args[0]
6659                 v.reset(OpPPC64MOVBZreg)
6660                 v.AddArg(x)
6661                 return true
6662         }
6663         // match: (MOVBZreg (OR <t> x (MOVWZreg y)))
6664         // result: (MOVBZreg (OR <t> x y))
6665         for {
6666                 if v_0.Op != OpPPC64OR {
6667                         break
6668                 }
6669                 t := v_0.Type
6670                 _ = v_0.Args[1]
6671                 v_0_0 := v_0.Args[0]
6672                 v_0_1 := v_0.Args[1]
6673                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6674                         x := v_0_0
6675                         if v_0_1.Op != OpPPC64MOVWZreg {
6676                                 continue
6677                         }
6678                         y := v_0_1.Args[0]
6679                         v.reset(OpPPC64MOVBZreg)
6680                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6681                         v0.AddArg2(x, y)
6682                         v.AddArg(v0)
6683                         return true
6684                 }
6685                 break
6686         }
6687         // match: (MOVBZreg (XOR <t> x (MOVWZreg y)))
6688         // result: (MOVBZreg (XOR <t> x y))
6689         for {
6690                 if v_0.Op != OpPPC64XOR {
6691                         break
6692                 }
6693                 t := v_0.Type
6694                 _ = v_0.Args[1]
6695                 v_0_0 := v_0.Args[0]
6696                 v_0_1 := v_0.Args[1]
6697                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6698                         x := v_0_0
6699                         if v_0_1.Op != OpPPC64MOVWZreg {
6700                                 continue
6701                         }
6702                         y := v_0_1.Args[0]
6703                         v.reset(OpPPC64MOVBZreg)
6704                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6705                         v0.AddArg2(x, y)
6706                         v.AddArg(v0)
6707                         return true
6708                 }
6709                 break
6710         }
6711         // match: (MOVBZreg (AND <t> x (MOVWZreg y)))
6712         // result: (MOVBZreg (AND <t> x y))
6713         for {
6714                 if v_0.Op != OpPPC64AND {
6715                         break
6716                 }
6717                 t := v_0.Type
6718                 _ = v_0.Args[1]
6719                 v_0_0 := v_0.Args[0]
6720                 v_0_1 := v_0.Args[1]
6721                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6722                         x := v_0_0
6723                         if v_0_1.Op != OpPPC64MOVWZreg {
6724                                 continue
6725                         }
6726                         y := v_0_1.Args[0]
6727                         v.reset(OpPPC64MOVBZreg)
6728                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6729                         v0.AddArg2(x, y)
6730                         v.AddArg(v0)
6731                         return true
6732                 }
6733                 break
6734         }
6735         // match: (MOVBZreg (OR <t> x (MOVHZreg y)))
6736         // result: (MOVBZreg (OR <t> x y))
6737         for {
6738                 if v_0.Op != OpPPC64OR {
6739                         break
6740                 }
6741                 t := v_0.Type
6742                 _ = v_0.Args[1]
6743                 v_0_0 := v_0.Args[0]
6744                 v_0_1 := v_0.Args[1]
6745                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6746                         x := v_0_0
6747                         if v_0_1.Op != OpPPC64MOVHZreg {
6748                                 continue
6749                         }
6750                         y := v_0_1.Args[0]
6751                         v.reset(OpPPC64MOVBZreg)
6752                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6753                         v0.AddArg2(x, y)
6754                         v.AddArg(v0)
6755                         return true
6756                 }
6757                 break
6758         }
6759         // match: (MOVBZreg (XOR <t> x (MOVHZreg y)))
6760         // result: (MOVBZreg (XOR <t> x y))
6761         for {
6762                 if v_0.Op != OpPPC64XOR {
6763                         break
6764                 }
6765                 t := v_0.Type
6766                 _ = v_0.Args[1]
6767                 v_0_0 := v_0.Args[0]
6768                 v_0_1 := v_0.Args[1]
6769                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6770                         x := v_0_0
6771                         if v_0_1.Op != OpPPC64MOVHZreg {
6772                                 continue
6773                         }
6774                         y := v_0_1.Args[0]
6775                         v.reset(OpPPC64MOVBZreg)
6776                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6777                         v0.AddArg2(x, y)
6778                         v.AddArg(v0)
6779                         return true
6780                 }
6781                 break
6782         }
6783         // match: (MOVBZreg (AND <t> x (MOVHZreg y)))
6784         // result: (MOVBZreg (AND <t> x y))
6785         for {
6786                 if v_0.Op != OpPPC64AND {
6787                         break
6788                 }
6789                 t := v_0.Type
6790                 _ = v_0.Args[1]
6791                 v_0_0 := v_0.Args[0]
6792                 v_0_1 := v_0.Args[1]
6793                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6794                         x := v_0_0
6795                         if v_0_1.Op != OpPPC64MOVHZreg {
6796                                 continue
6797                         }
6798                         y := v_0_1.Args[0]
6799                         v.reset(OpPPC64MOVBZreg)
6800                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6801                         v0.AddArg2(x, y)
6802                         v.AddArg(v0)
6803                         return true
6804                 }
6805                 break
6806         }
6807         // match: (MOVBZreg (OR <t> x (MOVBZreg y)))
6808         // result: (MOVBZreg (OR <t> x y))
6809         for {
6810                 if v_0.Op != OpPPC64OR {
6811                         break
6812                 }
6813                 t := v_0.Type
6814                 _ = v_0.Args[1]
6815                 v_0_0 := v_0.Args[0]
6816                 v_0_1 := v_0.Args[1]
6817                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6818                         x := v_0_0
6819                         if v_0_1.Op != OpPPC64MOVBZreg {
6820                                 continue
6821                         }
6822                         y := v_0_1.Args[0]
6823                         v.reset(OpPPC64MOVBZreg)
6824                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6825                         v0.AddArg2(x, y)
6826                         v.AddArg(v0)
6827                         return true
6828                 }
6829                 break
6830         }
6831         // match: (MOVBZreg (XOR <t> x (MOVBZreg y)))
6832         // result: (MOVBZreg (XOR <t> x y))
6833         for {
6834                 if v_0.Op != OpPPC64XOR {
6835                         break
6836                 }
6837                 t := v_0.Type
6838                 _ = v_0.Args[1]
6839                 v_0_0 := v_0.Args[0]
6840                 v_0_1 := v_0.Args[1]
6841                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6842                         x := v_0_0
6843                         if v_0_1.Op != OpPPC64MOVBZreg {
6844                                 continue
6845                         }
6846                         y := v_0_1.Args[0]
6847                         v.reset(OpPPC64MOVBZreg)
6848                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6849                         v0.AddArg2(x, y)
6850                         v.AddArg(v0)
6851                         return true
6852                 }
6853                 break
6854         }
6855         // match: (MOVBZreg (AND <t> x (MOVBZreg y)))
6856         // result: (MOVBZreg (AND <t> x y))
6857         for {
6858                 if v_0.Op != OpPPC64AND {
6859                         break
6860                 }
6861                 t := v_0.Type
6862                 _ = v_0.Args[1]
6863                 v_0_0 := v_0.Args[0]
6864                 v_0_1 := v_0.Args[1]
6865                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6866                         x := v_0_0
6867                         if v_0_1.Op != OpPPC64MOVBZreg {
6868                                 continue
6869                         }
6870                         y := v_0_1.Args[0]
6871                         v.reset(OpPPC64MOVBZreg)
6872                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6873                         v0.AddArg2(x, y)
6874                         v.AddArg(v0)
6875                         return true
6876                 }
6877                 break
6878         }
6879         // match: (MOVBZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x))))
6880         // result: z
6881         for {
6882                 z := v_0
6883                 if z.Op != OpSelect0 {
6884                         break
6885                 }
6886                 z_0 := z.Args[0]
6887                 if z_0.Op != OpPPC64ANDCCconst {
6888                         break
6889                 }
6890                 z_0_0 := z_0.Args[0]
6891                 if z_0_0.Op != OpPPC64MOVBZload {
6892                         break
6893                 }
6894                 v.copyOf(z)
6895                 return true
6896         }
6897         // match: (MOVBZreg z:(AND y (MOVBZload ptr x)))
6898         // result: z
6899         for {
6900                 z := v_0
6901                 if z.Op != OpPPC64AND {
6902                         break
6903                 }
6904                 _ = z.Args[1]
6905                 z_0 := z.Args[0]
6906                 z_1 := z.Args[1]
6907                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
6908                         if z_1.Op != OpPPC64MOVBZload {
6909                                 continue
6910                         }
6911                         v.copyOf(z)
6912                         return true
6913                 }
6914                 break
6915         }
6916         // match: (MOVBZreg x:(MOVBZload _ _))
6917         // result: x
6918         for {
6919                 x := v_0
6920                 if x.Op != OpPPC64MOVBZload {
6921                         break
6922                 }
6923                 v.copyOf(x)
6924                 return true
6925         }
6926         // match: (MOVBZreg x:(MOVBZloadidx _ _ _))
6927         // result: x
6928         for {
6929                 x := v_0
6930                 if x.Op != OpPPC64MOVBZloadidx {
6931                         break
6932                 }
6933                 v.copyOf(x)
6934                 return true
6935         }
6936         // match: (MOVBZreg x:(Select0 (LoweredAtomicLoad8 _ _)))
6937         // result: x
6938         for {
6939                 x := v_0
6940                 if x.Op != OpSelect0 {
6941                         break
6942                 }
6943                 x_0 := x.Args[0]
6944                 if x_0.Op != OpPPC64LoweredAtomicLoad8 {
6945                         break
6946                 }
6947                 v.copyOf(x)
6948                 return true
6949         }
6950         // match: (MOVBZreg x:(Arg <t>))
6951         // cond: is8BitInt(t) && !t.IsSigned()
6952         // result: x
6953         for {
6954                 x := v_0
6955                 if x.Op != OpArg {
6956                         break
6957                 }
6958                 t := x.Type
6959                 if !(is8BitInt(t) && !t.IsSigned()) {
6960                         break
6961                 }
6962                 v.copyOf(x)
6963                 return true
6964         }
6965         // match: (MOVBZreg (MOVDconst [c]))
6966         // result: (MOVDconst [int64(uint8(c))])
6967         for {
6968                 if v_0.Op != OpPPC64MOVDconst {
6969                         break
6970                 }
6971                 c := auxIntToInt64(v_0.AuxInt)
6972                 v.reset(OpPPC64MOVDconst)
6973                 v.AuxInt = int64ToAuxInt(int64(uint8(c)))
6974                 return true
6975         }
6976         return false
6977 }
6978 func rewriteValuePPC64_OpPPC64MOVBreg(v *Value) bool {
6979         v_0 := v.Args[0]
6980         b := v.Block
6981         typ := &b.Func.Config.Types
6982         // match: (MOVBreg y:(Select0 (ANDCCconst [c] _)))
6983         // cond: uint64(c) <= 0x7F
6984         // result: y
6985         for {
6986                 y := v_0
6987                 if y.Op != OpSelect0 {
6988                         break
6989                 }
6990                 y_0 := y.Args[0]
6991                 if y_0.Op != OpPPC64ANDCCconst {
6992                         break
6993                 }
6994                 c := auxIntToInt64(y_0.AuxInt)
6995                 if !(uint64(c) <= 0x7F) {
6996                         break
6997                 }
6998                 v.copyOf(y)
6999                 return true
7000         }
7001         // match: (MOVBreg (SRAWconst [c] (MOVBreg x)))
7002         // result: (SRAWconst [c] (MOVBreg x))
7003         for {
7004                 if v_0.Op != OpPPC64SRAWconst {
7005                         break
7006                 }
7007                 c := auxIntToInt64(v_0.AuxInt)
7008                 v_0_0 := v_0.Args[0]
7009                 if v_0_0.Op != OpPPC64MOVBreg {
7010                         break
7011                 }
7012                 x := v_0_0.Args[0]
7013                 v.reset(OpPPC64SRAWconst)
7014                 v.AuxInt = int64ToAuxInt(c)
7015                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
7016                 v0.AddArg(x)
7017                 v.AddArg(v0)
7018                 return true
7019         }
7020         // match: (MOVBreg (SRAWconst [c] x))
7021         // cond: sizeof(x.Type) == 8
7022         // result: (SRAWconst [c] x)
7023         for {
7024                 if v_0.Op != OpPPC64SRAWconst {
7025                         break
7026                 }
7027                 c := auxIntToInt64(v_0.AuxInt)
7028                 x := v_0.Args[0]
7029                 if !(sizeof(x.Type) == 8) {
7030                         break
7031                 }
7032                 v.reset(OpPPC64SRAWconst)
7033                 v.AuxInt = int64ToAuxInt(c)
7034                 v.AddArg(x)
7035                 return true
7036         }
7037         // match: (MOVBreg (SRDconst [c] x))
7038         // cond: c>56
7039         // result: (SRDconst [c] x)
7040         for {
7041                 if v_0.Op != OpPPC64SRDconst {
7042                         break
7043                 }
7044                 c := auxIntToInt64(v_0.AuxInt)
7045                 x := v_0.Args[0]
7046                 if !(c > 56) {
7047                         break
7048                 }
7049                 v.reset(OpPPC64SRDconst)
7050                 v.AuxInt = int64ToAuxInt(c)
7051                 v.AddArg(x)
7052                 return true
7053         }
7054         // match: (MOVBreg (SRDconst [c] x))
7055         // cond: c==56
7056         // result: (SRADconst [c] x)
7057         for {
7058                 if v_0.Op != OpPPC64SRDconst {
7059                         break
7060                 }
7061                 c := auxIntToInt64(v_0.AuxInt)
7062                 x := v_0.Args[0]
7063                 if !(c == 56) {
7064                         break
7065                 }
7066                 v.reset(OpPPC64SRADconst)
7067                 v.AuxInt = int64ToAuxInt(c)
7068                 v.AddArg(x)
7069                 return true
7070         }
7071         // match: (MOVBreg (SRADconst [c] x))
7072         // cond: c>=56
7073         // result: (SRADconst [c] x)
7074         for {
7075                 if v_0.Op != OpPPC64SRADconst {
7076                         break
7077                 }
7078                 c := auxIntToInt64(v_0.AuxInt)
7079                 x := v_0.Args[0]
7080                 if !(c >= 56) {
7081                         break
7082                 }
7083                 v.reset(OpPPC64SRADconst)
7084                 v.AuxInt = int64ToAuxInt(c)
7085                 v.AddArg(x)
7086                 return true
7087         }
7088         // match: (MOVBreg (SRWconst [c] x))
7089         // cond: c>24
7090         // result: (SRWconst [c] x)
7091         for {
7092                 if v_0.Op != OpPPC64SRWconst {
7093                         break
7094                 }
7095                 c := auxIntToInt64(v_0.AuxInt)
7096                 x := v_0.Args[0]
7097                 if !(c > 24) {
7098                         break
7099                 }
7100                 v.reset(OpPPC64SRWconst)
7101                 v.AuxInt = int64ToAuxInt(c)
7102                 v.AddArg(x)
7103                 return true
7104         }
7105         // match: (MOVBreg (SRWconst [c] x))
7106         // cond: c==24
7107         // result: (SRAWconst [c] x)
7108         for {
7109                 if v_0.Op != OpPPC64SRWconst {
7110                         break
7111                 }
7112                 c := auxIntToInt64(v_0.AuxInt)
7113                 x := v_0.Args[0]
7114                 if !(c == 24) {
7115                         break
7116                 }
7117                 v.reset(OpPPC64SRAWconst)
7118                 v.AuxInt = int64ToAuxInt(c)
7119                 v.AddArg(x)
7120                 return true
7121         }
7122         // match: (MOVBreg (SRAWconst [c] x))
7123         // cond: c>=24
7124         // result: (SRAWconst [c] x)
7125         for {
7126                 if v_0.Op != OpPPC64SRAWconst {
7127                         break
7128                 }
7129                 c := auxIntToInt64(v_0.AuxInt)
7130                 x := v_0.Args[0]
7131                 if !(c >= 24) {
7132                         break
7133                 }
7134                 v.reset(OpPPC64SRAWconst)
7135                 v.AuxInt = int64ToAuxInt(c)
7136                 v.AddArg(x)
7137                 return true
7138         }
7139         // match: (MOVBreg y:(MOVBreg _))
7140         // result: y
7141         for {
7142                 y := v_0
7143                 if y.Op != OpPPC64MOVBreg {
7144                         break
7145                 }
7146                 v.copyOf(y)
7147                 return true
7148         }
7149         // match: (MOVBreg (MOVBZreg x))
7150         // result: (MOVBreg x)
7151         for {
7152                 if v_0.Op != OpPPC64MOVBZreg {
7153                         break
7154                 }
7155                 x := v_0.Args[0]
7156                 v.reset(OpPPC64MOVBreg)
7157                 v.AddArg(x)
7158                 return true
7159         }
7160         // match: (MOVBreg x:(Arg <t>))
7161         // cond: is8BitInt(t) && t.IsSigned()
7162         // result: x
7163         for {
7164                 x := v_0
7165                 if x.Op != OpArg {
7166                         break
7167                 }
7168                 t := x.Type
7169                 if !(is8BitInt(t) && t.IsSigned()) {
7170                         break
7171                 }
7172                 v.copyOf(x)
7173                 return true
7174         }
7175         // match: (MOVBreg (MOVDconst [c]))
7176         // result: (MOVDconst [int64(int8(c))])
7177         for {
7178                 if v_0.Op != OpPPC64MOVDconst {
7179                         break
7180                 }
7181                 c := auxIntToInt64(v_0.AuxInt)
7182                 v.reset(OpPPC64MOVDconst)
7183                 v.AuxInt = int64ToAuxInt(int64(int8(c)))
7184                 return true
7185         }
7186         return false
7187 }
7188 func rewriteValuePPC64_OpPPC64MOVBstore(v *Value) bool {
7189         v_2 := v.Args[2]
7190         v_1 := v.Args[1]
7191         v_0 := v.Args[0]
7192         b := v.Block
7193         typ := &b.Func.Config.Types
7194         // match: (MOVBstore [off1] {sym} (ADDconst [off2] x) val mem)
7195         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
7196         // result: (MOVBstore [off1+int32(off2)] {sym} x val mem)
7197         for {
7198                 off1 := auxIntToInt32(v.AuxInt)
7199                 sym := auxToSym(v.Aux)
7200                 if v_0.Op != OpPPC64ADDconst {
7201                         break
7202                 }
7203                 off2 := auxIntToInt64(v_0.AuxInt)
7204                 x := v_0.Args[0]
7205                 val := v_1
7206                 mem := v_2
7207                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
7208                         break
7209                 }
7210                 v.reset(OpPPC64MOVBstore)
7211                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7212                 v.Aux = symToAux(sym)
7213                 v.AddArg3(x, val, mem)
7214                 return true
7215         }
7216         // match: (MOVBstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
7217         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
7218         // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
7219         for {
7220                 off1 := auxIntToInt32(v.AuxInt)
7221                 sym1 := auxToSym(v.Aux)
7222                 p := v_0
7223                 if p.Op != OpPPC64MOVDaddr {
7224                         break
7225                 }
7226                 off2 := auxIntToInt32(p.AuxInt)
7227                 sym2 := auxToSym(p.Aux)
7228                 ptr := p.Args[0]
7229                 val := v_1
7230                 mem := v_2
7231                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7232                         break
7233                 }
7234                 v.reset(OpPPC64MOVBstore)
7235                 v.AuxInt = int32ToAuxInt(off1 + off2)
7236                 v.Aux = symToAux(mergeSym(sym1, sym2))
7237                 v.AddArg3(ptr, val, mem)
7238                 return true
7239         }
7240         // match: (MOVBstore [off] {sym} ptr (MOVDconst [0]) mem)
7241         // result: (MOVBstorezero [off] {sym} ptr mem)
7242         for {
7243                 off := auxIntToInt32(v.AuxInt)
7244                 sym := auxToSym(v.Aux)
7245                 ptr := v_0
7246                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
7247                         break
7248                 }
7249                 mem := v_2
7250                 v.reset(OpPPC64MOVBstorezero)
7251                 v.AuxInt = int32ToAuxInt(off)
7252                 v.Aux = symToAux(sym)
7253                 v.AddArg2(ptr, mem)
7254                 return true
7255         }
7256         // match: (MOVBstore [0] {sym} p:(ADD ptr idx) val mem)
7257         // cond: sym == nil && p.Uses == 1
7258         // result: (MOVBstoreidx ptr idx val mem)
7259         for {
7260                 if auxIntToInt32(v.AuxInt) != 0 {
7261                         break
7262                 }
7263                 sym := auxToSym(v.Aux)
7264                 p := v_0
7265                 if p.Op != OpPPC64ADD {
7266                         break
7267                 }
7268                 idx := p.Args[1]
7269                 ptr := p.Args[0]
7270                 val := v_1
7271                 mem := v_2
7272                 if !(sym == nil && p.Uses == 1) {
7273                         break
7274                 }
7275                 v.reset(OpPPC64MOVBstoreidx)
7276                 v.AddArg4(ptr, idx, val, mem)
7277                 return true
7278         }
7279         // match: (MOVBstore [off] {sym} ptr (MOVBreg x) mem)
7280         // result: (MOVBstore [off] {sym} ptr x mem)
7281         for {
7282                 off := auxIntToInt32(v.AuxInt)
7283                 sym := auxToSym(v.Aux)
7284                 ptr := v_0
7285                 if v_1.Op != OpPPC64MOVBreg {
7286                         break
7287                 }
7288                 x := v_1.Args[0]
7289                 mem := v_2
7290                 v.reset(OpPPC64MOVBstore)
7291                 v.AuxInt = int32ToAuxInt(off)
7292                 v.Aux = symToAux(sym)
7293                 v.AddArg3(ptr, x, mem)
7294                 return true
7295         }
7296         // match: (MOVBstore [off] {sym} ptr (MOVBZreg x) mem)
7297         // result: (MOVBstore [off] {sym} ptr x mem)
7298         for {
7299                 off := auxIntToInt32(v.AuxInt)
7300                 sym := auxToSym(v.Aux)
7301                 ptr := v_0
7302                 if v_1.Op != OpPPC64MOVBZreg {
7303                         break
7304                 }
7305                 x := v_1.Args[0]
7306                 mem := v_2
7307                 v.reset(OpPPC64MOVBstore)
7308                 v.AuxInt = int32ToAuxInt(off)
7309                 v.Aux = symToAux(sym)
7310                 v.AddArg3(ptr, x, mem)
7311                 return true
7312         }
7313         // match: (MOVBstore [off] {sym} ptr (MOVHreg x) mem)
7314         // result: (MOVBstore [off] {sym} ptr x mem)
7315         for {
7316                 off := auxIntToInt32(v.AuxInt)
7317                 sym := auxToSym(v.Aux)
7318                 ptr := v_0
7319                 if v_1.Op != OpPPC64MOVHreg {
7320                         break
7321                 }
7322                 x := v_1.Args[0]
7323                 mem := v_2
7324                 v.reset(OpPPC64MOVBstore)
7325                 v.AuxInt = int32ToAuxInt(off)
7326                 v.Aux = symToAux(sym)
7327                 v.AddArg3(ptr, x, mem)
7328                 return true
7329         }
7330         // match: (MOVBstore [off] {sym} ptr (MOVHZreg x) mem)
7331         // result: (MOVBstore [off] {sym} ptr x mem)
7332         for {
7333                 off := auxIntToInt32(v.AuxInt)
7334                 sym := auxToSym(v.Aux)
7335                 ptr := v_0
7336                 if v_1.Op != OpPPC64MOVHZreg {
7337                         break
7338                 }
7339                 x := v_1.Args[0]
7340                 mem := v_2
7341                 v.reset(OpPPC64MOVBstore)
7342                 v.AuxInt = int32ToAuxInt(off)
7343                 v.Aux = symToAux(sym)
7344                 v.AddArg3(ptr, x, mem)
7345                 return true
7346         }
7347         // match: (MOVBstore [off] {sym} ptr (MOVWreg x) mem)
7348         // result: (MOVBstore [off] {sym} ptr x mem)
7349         for {
7350                 off := auxIntToInt32(v.AuxInt)
7351                 sym := auxToSym(v.Aux)
7352                 ptr := v_0
7353                 if v_1.Op != OpPPC64MOVWreg {
7354                         break
7355                 }
7356                 x := v_1.Args[0]
7357                 mem := v_2
7358                 v.reset(OpPPC64MOVBstore)
7359                 v.AuxInt = int32ToAuxInt(off)
7360                 v.Aux = symToAux(sym)
7361                 v.AddArg3(ptr, x, mem)
7362                 return true
7363         }
7364         // match: (MOVBstore [off] {sym} ptr (MOVWZreg x) mem)
7365         // result: (MOVBstore [off] {sym} ptr x mem)
7366         for {
7367                 off := auxIntToInt32(v.AuxInt)
7368                 sym := auxToSym(v.Aux)
7369                 ptr := v_0
7370                 if v_1.Op != OpPPC64MOVWZreg {
7371                         break
7372                 }
7373                 x := v_1.Args[0]
7374                 mem := v_2
7375                 v.reset(OpPPC64MOVBstore)
7376                 v.AuxInt = int32ToAuxInt(off)
7377                 v.Aux = symToAux(sym)
7378                 v.AddArg3(ptr, x, mem)
7379                 return true
7380         }
7381         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVHreg x) [c]) mem)
7382         // cond: c <= 8
7383         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7384         for {
7385                 off := auxIntToInt32(v.AuxInt)
7386                 sym := auxToSym(v.Aux)
7387                 ptr := v_0
7388                 if v_1.Op != OpPPC64SRWconst {
7389                         break
7390                 }
7391                 c := auxIntToInt64(v_1.AuxInt)
7392                 v_1_0 := v_1.Args[0]
7393                 if v_1_0.Op != OpPPC64MOVHreg {
7394                         break
7395                 }
7396                 x := v_1_0.Args[0]
7397                 mem := v_2
7398                 if !(c <= 8) {
7399                         break
7400                 }
7401                 v.reset(OpPPC64MOVBstore)
7402                 v.AuxInt = int32ToAuxInt(off)
7403                 v.Aux = symToAux(sym)
7404                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7405                 v0.AuxInt = int64ToAuxInt(c)
7406                 v0.AddArg(x)
7407                 v.AddArg3(ptr, v0, mem)
7408                 return true
7409         }
7410         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVHZreg x) [c]) mem)
7411         // cond: c <= 8
7412         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7413         for {
7414                 off := auxIntToInt32(v.AuxInt)
7415                 sym := auxToSym(v.Aux)
7416                 ptr := v_0
7417                 if v_1.Op != OpPPC64SRWconst {
7418                         break
7419                 }
7420                 c := auxIntToInt64(v_1.AuxInt)
7421                 v_1_0 := v_1.Args[0]
7422                 if v_1_0.Op != OpPPC64MOVHZreg {
7423                         break
7424                 }
7425                 x := v_1_0.Args[0]
7426                 mem := v_2
7427                 if !(c <= 8) {
7428                         break
7429                 }
7430                 v.reset(OpPPC64MOVBstore)
7431                 v.AuxInt = int32ToAuxInt(off)
7432                 v.Aux = symToAux(sym)
7433                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7434                 v0.AuxInt = int64ToAuxInt(c)
7435                 v0.AddArg(x)
7436                 v.AddArg3(ptr, v0, mem)
7437                 return true
7438         }
7439         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVWreg x) [c]) mem)
7440         // cond: c <= 24
7441         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7442         for {
7443                 off := auxIntToInt32(v.AuxInt)
7444                 sym := auxToSym(v.Aux)
7445                 ptr := v_0
7446                 if v_1.Op != OpPPC64SRWconst {
7447                         break
7448                 }
7449                 c := auxIntToInt64(v_1.AuxInt)
7450                 v_1_0 := v_1.Args[0]
7451                 if v_1_0.Op != OpPPC64MOVWreg {
7452                         break
7453                 }
7454                 x := v_1_0.Args[0]
7455                 mem := v_2
7456                 if !(c <= 24) {
7457                         break
7458                 }
7459                 v.reset(OpPPC64MOVBstore)
7460                 v.AuxInt = int32ToAuxInt(off)
7461                 v.Aux = symToAux(sym)
7462                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7463                 v0.AuxInt = int64ToAuxInt(c)
7464                 v0.AddArg(x)
7465                 v.AddArg3(ptr, v0, mem)
7466                 return true
7467         }
7468         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVWZreg x) [c]) mem)
7469         // cond: c <= 24
7470         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7471         for {
7472                 off := auxIntToInt32(v.AuxInt)
7473                 sym := auxToSym(v.Aux)
7474                 ptr := v_0
7475                 if v_1.Op != OpPPC64SRWconst {
7476                         break
7477                 }
7478                 c := auxIntToInt64(v_1.AuxInt)
7479                 v_1_0 := v_1.Args[0]
7480                 if v_1_0.Op != OpPPC64MOVWZreg {
7481                         break
7482                 }
7483                 x := v_1_0.Args[0]
7484                 mem := v_2
7485                 if !(c <= 24) {
7486                         break
7487                 }
7488                 v.reset(OpPPC64MOVBstore)
7489                 v.AuxInt = int32ToAuxInt(off)
7490                 v.Aux = symToAux(sym)
7491                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7492                 v0.AuxInt = int64ToAuxInt(c)
7493                 v0.AddArg(x)
7494                 v.AddArg3(ptr, v0, mem)
7495                 return true
7496         }
7497         return false
7498 }
7499 func rewriteValuePPC64_OpPPC64MOVBstoreidx(v *Value) bool {
7500         v_3 := v.Args[3]
7501         v_2 := v.Args[2]
7502         v_1 := v.Args[1]
7503         v_0 := v.Args[0]
7504         b := v.Block
7505         typ := &b.Func.Config.Types
7506         // match: (MOVBstoreidx ptr (MOVDconst [c]) val mem)
7507         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
7508         // result: (MOVBstore [int32(c)] ptr val mem)
7509         for {
7510                 ptr := v_0
7511                 if v_1.Op != OpPPC64MOVDconst {
7512                         break
7513                 }
7514                 c := auxIntToInt64(v_1.AuxInt)
7515                 val := v_2
7516                 mem := v_3
7517                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7518                         break
7519                 }
7520                 v.reset(OpPPC64MOVBstore)
7521                 v.AuxInt = int32ToAuxInt(int32(c))
7522                 v.AddArg3(ptr, val, mem)
7523                 return true
7524         }
7525         // match: (MOVBstoreidx (MOVDconst [c]) ptr val mem)
7526         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
7527         // result: (MOVBstore [int32(c)] ptr val mem)
7528         for {
7529                 if v_0.Op != OpPPC64MOVDconst {
7530                         break
7531                 }
7532                 c := auxIntToInt64(v_0.AuxInt)
7533                 ptr := v_1
7534                 val := v_2
7535                 mem := v_3
7536                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7537                         break
7538                 }
7539                 v.reset(OpPPC64MOVBstore)
7540                 v.AuxInt = int32ToAuxInt(int32(c))
7541                 v.AddArg3(ptr, val, mem)
7542                 return true
7543         }
7544         // match: (MOVBstoreidx ptr idx (MOVBreg x) mem)
7545         // result: (MOVBstoreidx ptr idx x mem)
7546         for {
7547                 ptr := v_0
7548                 idx := v_1
7549                 if v_2.Op != OpPPC64MOVBreg {
7550                         break
7551                 }
7552                 x := v_2.Args[0]
7553                 mem := v_3
7554                 v.reset(OpPPC64MOVBstoreidx)
7555                 v.AddArg4(ptr, idx, x, mem)
7556                 return true
7557         }
7558         // match: (MOVBstoreidx ptr idx (MOVBZreg x) mem)
7559         // result: (MOVBstoreidx ptr idx x mem)
7560         for {
7561                 ptr := v_0
7562                 idx := v_1
7563                 if v_2.Op != OpPPC64MOVBZreg {
7564                         break
7565                 }
7566                 x := v_2.Args[0]
7567                 mem := v_3
7568                 v.reset(OpPPC64MOVBstoreidx)
7569                 v.AddArg4(ptr, idx, x, mem)
7570                 return true
7571         }
7572         // match: (MOVBstoreidx ptr idx (MOVHreg x) mem)
7573         // result: (MOVBstoreidx ptr idx x mem)
7574         for {
7575                 ptr := v_0
7576                 idx := v_1
7577                 if v_2.Op != OpPPC64MOVHreg {
7578                         break
7579                 }
7580                 x := v_2.Args[0]
7581                 mem := v_3
7582                 v.reset(OpPPC64MOVBstoreidx)
7583                 v.AddArg4(ptr, idx, x, mem)
7584                 return true
7585         }
7586         // match: (MOVBstoreidx ptr idx (MOVHZreg x) mem)
7587         // result: (MOVBstoreidx ptr idx x mem)
7588         for {
7589                 ptr := v_0
7590                 idx := v_1
7591                 if v_2.Op != OpPPC64MOVHZreg {
7592                         break
7593                 }
7594                 x := v_2.Args[0]
7595                 mem := v_3
7596                 v.reset(OpPPC64MOVBstoreidx)
7597                 v.AddArg4(ptr, idx, x, mem)
7598                 return true
7599         }
7600         // match: (MOVBstoreidx ptr idx (MOVWreg x) mem)
7601         // result: (MOVBstoreidx ptr idx x mem)
7602         for {
7603                 ptr := v_0
7604                 idx := v_1
7605                 if v_2.Op != OpPPC64MOVWreg {
7606                         break
7607                 }
7608                 x := v_2.Args[0]
7609                 mem := v_3
7610                 v.reset(OpPPC64MOVBstoreidx)
7611                 v.AddArg4(ptr, idx, x, mem)
7612                 return true
7613         }
7614         // match: (MOVBstoreidx ptr idx (MOVWZreg x) mem)
7615         // result: (MOVBstoreidx ptr idx x mem)
7616         for {
7617                 ptr := v_0
7618                 idx := v_1
7619                 if v_2.Op != OpPPC64MOVWZreg {
7620                         break
7621                 }
7622                 x := v_2.Args[0]
7623                 mem := v_3
7624                 v.reset(OpPPC64MOVBstoreidx)
7625                 v.AddArg4(ptr, idx, x, mem)
7626                 return true
7627         }
7628         // match: (MOVBstoreidx ptr idx (SRWconst (MOVHreg x) [c]) mem)
7629         // cond: c <= 8
7630         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7631         for {
7632                 ptr := v_0
7633                 idx := v_1
7634                 if v_2.Op != OpPPC64SRWconst {
7635                         break
7636                 }
7637                 c := auxIntToInt64(v_2.AuxInt)
7638                 v_2_0 := v_2.Args[0]
7639                 if v_2_0.Op != OpPPC64MOVHreg {
7640                         break
7641                 }
7642                 x := v_2_0.Args[0]
7643                 mem := v_3
7644                 if !(c <= 8) {
7645                         break
7646                 }
7647                 v.reset(OpPPC64MOVBstoreidx)
7648                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7649                 v0.AuxInt = int64ToAuxInt(c)
7650                 v0.AddArg(x)
7651                 v.AddArg4(ptr, idx, v0, mem)
7652                 return true
7653         }
7654         // match: (MOVBstoreidx ptr idx (SRWconst (MOVHZreg x) [c]) mem)
7655         // cond: c <= 8
7656         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7657         for {
7658                 ptr := v_0
7659                 idx := v_1
7660                 if v_2.Op != OpPPC64SRWconst {
7661                         break
7662                 }
7663                 c := auxIntToInt64(v_2.AuxInt)
7664                 v_2_0 := v_2.Args[0]
7665                 if v_2_0.Op != OpPPC64MOVHZreg {
7666                         break
7667                 }
7668                 x := v_2_0.Args[0]
7669                 mem := v_3
7670                 if !(c <= 8) {
7671                         break
7672                 }
7673                 v.reset(OpPPC64MOVBstoreidx)
7674                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7675                 v0.AuxInt = int64ToAuxInt(c)
7676                 v0.AddArg(x)
7677                 v.AddArg4(ptr, idx, v0, mem)
7678                 return true
7679         }
7680         // match: (MOVBstoreidx ptr idx (SRWconst (MOVWreg x) [c]) mem)
7681         // cond: c <= 24
7682         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7683         for {
7684                 ptr := v_0
7685                 idx := v_1
7686                 if v_2.Op != OpPPC64SRWconst {
7687                         break
7688                 }
7689                 c := auxIntToInt64(v_2.AuxInt)
7690                 v_2_0 := v_2.Args[0]
7691                 if v_2_0.Op != OpPPC64MOVWreg {
7692                         break
7693                 }
7694                 x := v_2_0.Args[0]
7695                 mem := v_3
7696                 if !(c <= 24) {
7697                         break
7698                 }
7699                 v.reset(OpPPC64MOVBstoreidx)
7700                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7701                 v0.AuxInt = int64ToAuxInt(c)
7702                 v0.AddArg(x)
7703                 v.AddArg4(ptr, idx, v0, mem)
7704                 return true
7705         }
7706         // match: (MOVBstoreidx ptr idx (SRWconst (MOVWZreg x) [c]) mem)
7707         // cond: c <= 24
7708         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7709         for {
7710                 ptr := v_0
7711                 idx := v_1
7712                 if v_2.Op != OpPPC64SRWconst {
7713                         break
7714                 }
7715                 c := auxIntToInt64(v_2.AuxInt)
7716                 v_2_0 := v_2.Args[0]
7717                 if v_2_0.Op != OpPPC64MOVWZreg {
7718                         break
7719                 }
7720                 x := v_2_0.Args[0]
7721                 mem := v_3
7722                 if !(c <= 24) {
7723                         break
7724                 }
7725                 v.reset(OpPPC64MOVBstoreidx)
7726                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7727                 v0.AuxInt = int64ToAuxInt(c)
7728                 v0.AddArg(x)
7729                 v.AddArg4(ptr, idx, v0, mem)
7730                 return true
7731         }
7732         return false
7733 }
7734 func rewriteValuePPC64_OpPPC64MOVBstorezero(v *Value) bool {
7735         v_1 := v.Args[1]
7736         v_0 := v.Args[0]
7737         // match: (MOVBstorezero [off1] {sym} (ADDconst [off2] x) mem)
7738         // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2)))
7739         // result: (MOVBstorezero [off1+int32(off2)] {sym} x mem)
7740         for {
7741                 off1 := auxIntToInt32(v.AuxInt)
7742                 sym := auxToSym(v.Aux)
7743                 if v_0.Op != OpPPC64ADDconst {
7744                         break
7745                 }
7746                 off2 := auxIntToInt64(v_0.AuxInt)
7747                 x := v_0.Args[0]
7748                 mem := v_1
7749                 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
7750                         break
7751                 }
7752                 v.reset(OpPPC64MOVBstorezero)
7753                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7754                 v.Aux = symToAux(sym)
7755                 v.AddArg2(x, mem)
7756                 return true
7757         }
7758         // match: (MOVBstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
7759         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
7760         // result: (MOVBstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
7761         for {
7762                 off1 := auxIntToInt32(v.AuxInt)
7763                 sym1 := auxToSym(v.Aux)
7764                 p := v_0
7765                 if p.Op != OpPPC64MOVDaddr {
7766                         break
7767                 }
7768                 off2 := auxIntToInt32(p.AuxInt)
7769                 sym2 := auxToSym(p.Aux)
7770                 x := p.Args[0]
7771                 mem := v_1
7772                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7773                         break
7774                 }
7775                 v.reset(OpPPC64MOVBstorezero)
7776                 v.AuxInt = int32ToAuxInt(off1 + off2)
7777                 v.Aux = symToAux(mergeSym(sym1, sym2))
7778                 v.AddArg2(x, mem)
7779                 return true
7780         }
7781         return false
7782 }
7783 func rewriteValuePPC64_OpPPC64MOVDaddr(v *Value) bool {
7784         v_0 := v.Args[0]
7785         // match: (MOVDaddr {sym} [n] p:(ADD x y))
7786         // cond: sym == nil && n == 0
7787         // result: p
7788         for {
7789                 n := auxIntToInt32(v.AuxInt)
7790                 sym := auxToSym(v.Aux)
7791                 p := v_0
7792                 if p.Op != OpPPC64ADD {
7793                         break
7794                 }
7795                 if !(sym == nil && n == 0) {
7796                         break
7797                 }
7798                 v.copyOf(p)
7799                 return true
7800         }
7801         // match: (MOVDaddr {sym} [n] ptr)
7802         // cond: sym == nil && n == 0 && (ptr.Op == OpArgIntReg || ptr.Op == OpPhi)
7803         // result: ptr
7804         for {
7805                 n := auxIntToInt32(v.AuxInt)
7806                 sym := auxToSym(v.Aux)
7807                 ptr := v_0
7808                 if !(sym == nil && n == 0 && (ptr.Op == OpArgIntReg || ptr.Op == OpPhi)) {
7809                         break
7810                 }
7811                 v.copyOf(ptr)
7812                 return true
7813         }
7814         return false
7815 }
7816 func rewriteValuePPC64_OpPPC64MOVDload(v *Value) bool {
7817         v_1 := v.Args[1]
7818         v_0 := v.Args[0]
7819         // match: (MOVDload [off] {sym} ptr (FMOVDstore [off] {sym} ptr x _))
7820         // result: (MFVSRD x)
7821         for {
7822                 off := auxIntToInt32(v.AuxInt)
7823                 sym := auxToSym(v.Aux)
7824                 ptr := v_0
7825                 if v_1.Op != OpPPC64FMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
7826                         break
7827                 }
7828                 x := v_1.Args[1]
7829                 if ptr != v_1.Args[0] {
7830                         break
7831                 }
7832                 v.reset(OpPPC64MFVSRD)
7833                 v.AddArg(x)
7834                 return true
7835         }
7836         // match: (MOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
7837         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
7838         // result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
7839         for {
7840                 off1 := auxIntToInt32(v.AuxInt)
7841                 sym1 := auxToSym(v.Aux)
7842                 p := v_0
7843                 if p.Op != OpPPC64MOVDaddr {
7844                         break
7845                 }
7846                 off2 := auxIntToInt32(p.AuxInt)
7847                 sym2 := auxToSym(p.Aux)
7848                 ptr := p.Args[0]
7849                 mem := v_1
7850                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7851                         break
7852                 }
7853                 v.reset(OpPPC64MOVDload)
7854                 v.AuxInt = int32ToAuxInt(off1 + off2)
7855                 v.Aux = symToAux(mergeSym(sym1, sym2))
7856                 v.AddArg2(ptr, mem)
7857                 return true
7858         }
7859         // match: (MOVDload [off1] {sym} (ADDconst [off2] x) mem)
7860         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
7861         // result: (MOVDload [off1+int32(off2)] {sym} x mem)
7862         for {
7863                 off1 := auxIntToInt32(v.AuxInt)
7864                 sym := auxToSym(v.Aux)
7865                 if v_0.Op != OpPPC64ADDconst {
7866                         break
7867                 }
7868                 off2 := auxIntToInt64(v_0.AuxInt)
7869                 x := v_0.Args[0]
7870                 mem := v_1
7871                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
7872                         break
7873                 }
7874                 v.reset(OpPPC64MOVDload)
7875                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7876                 v.Aux = symToAux(sym)
7877                 v.AddArg2(x, mem)
7878                 return true
7879         }
7880         // match: (MOVDload [0] {sym} p:(ADD ptr idx) mem)
7881         // cond: sym == nil && p.Uses == 1
7882         // result: (MOVDloadidx ptr idx mem)
7883         for {
7884                 if auxIntToInt32(v.AuxInt) != 0 {
7885                         break
7886                 }
7887                 sym := auxToSym(v.Aux)
7888                 p := v_0
7889                 if p.Op != OpPPC64ADD {
7890                         break
7891                 }
7892                 idx := p.Args[1]
7893                 ptr := p.Args[0]
7894                 mem := v_1
7895                 if !(sym == nil && p.Uses == 1) {
7896                         break
7897                 }
7898                 v.reset(OpPPC64MOVDloadidx)
7899                 v.AddArg3(ptr, idx, mem)
7900                 return true
7901         }
7902         return false
7903 }
7904 func rewriteValuePPC64_OpPPC64MOVDloadidx(v *Value) bool {
7905         v_2 := v.Args[2]
7906         v_1 := v.Args[1]
7907         v_0 := v.Args[0]
7908         // match: (MOVDloadidx ptr (MOVDconst [c]) mem)
7909         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
7910         // result: (MOVDload [int32(c)] ptr mem)
7911         for {
7912                 ptr := v_0
7913                 if v_1.Op != OpPPC64MOVDconst {
7914                         break
7915                 }
7916                 c := auxIntToInt64(v_1.AuxInt)
7917                 mem := v_2
7918                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7919                         break
7920                 }
7921                 v.reset(OpPPC64MOVDload)
7922                 v.AuxInt = int32ToAuxInt(int32(c))
7923                 v.AddArg2(ptr, mem)
7924                 return true
7925         }
7926         // match: (MOVDloadidx (MOVDconst [c]) ptr mem)
7927         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
7928         // result: (MOVDload [int32(c)] ptr mem)
7929         for {
7930                 if v_0.Op != OpPPC64MOVDconst {
7931                         break
7932                 }
7933                 c := auxIntToInt64(v_0.AuxInt)
7934                 ptr := v_1
7935                 mem := v_2
7936                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7937                         break
7938                 }
7939                 v.reset(OpPPC64MOVDload)
7940                 v.AuxInt = int32ToAuxInt(int32(c))
7941                 v.AddArg2(ptr, mem)
7942                 return true
7943         }
7944         return false
7945 }
7946 func rewriteValuePPC64_OpPPC64MOVDstore(v *Value) bool {
7947         v_2 := v.Args[2]
7948         v_1 := v.Args[1]
7949         v_0 := v.Args[0]
7950         b := v.Block
7951         // match: (MOVDstore [off] {sym} ptr (MFVSRD x) mem)
7952         // result: (FMOVDstore [off] {sym} ptr x mem)
7953         for {
7954                 off := auxIntToInt32(v.AuxInt)
7955                 sym := auxToSym(v.Aux)
7956                 ptr := v_0
7957                 if v_1.Op != OpPPC64MFVSRD {
7958                         break
7959                 }
7960                 x := v_1.Args[0]
7961                 mem := v_2
7962                 v.reset(OpPPC64FMOVDstore)
7963                 v.AuxInt = int32ToAuxInt(off)
7964                 v.Aux = symToAux(sym)
7965                 v.AddArg3(ptr, x, mem)
7966                 return true
7967         }
7968         // match: (MOVDstore [off1] {sym} (ADDconst [off2] x) val mem)
7969         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
7970         // result: (MOVDstore [off1+int32(off2)] {sym} x val mem)
7971         for {
7972                 off1 := auxIntToInt32(v.AuxInt)
7973                 sym := auxToSym(v.Aux)
7974                 if v_0.Op != OpPPC64ADDconst {
7975                         break
7976                 }
7977                 off2 := auxIntToInt64(v_0.AuxInt)
7978                 x := v_0.Args[0]
7979                 val := v_1
7980                 mem := v_2
7981                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
7982                         break
7983                 }
7984                 v.reset(OpPPC64MOVDstore)
7985                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7986                 v.Aux = symToAux(sym)
7987                 v.AddArg3(x, val, mem)
7988                 return true
7989         }
7990         // match: (MOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
7991         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
7992         // result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
7993         for {
7994                 off1 := auxIntToInt32(v.AuxInt)
7995                 sym1 := auxToSym(v.Aux)
7996                 p := v_0
7997                 if p.Op != OpPPC64MOVDaddr {
7998                         break
7999                 }
8000                 off2 := auxIntToInt32(p.AuxInt)
8001                 sym2 := auxToSym(p.Aux)
8002                 ptr := p.Args[0]
8003                 val := v_1
8004                 mem := v_2
8005                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8006                         break
8007                 }
8008                 v.reset(OpPPC64MOVDstore)
8009                 v.AuxInt = int32ToAuxInt(off1 + off2)
8010                 v.Aux = symToAux(mergeSym(sym1, sym2))
8011                 v.AddArg3(ptr, val, mem)
8012                 return true
8013         }
8014         // match: (MOVDstore [off] {sym} ptr (MOVDconst [0]) mem)
8015         // result: (MOVDstorezero [off] {sym} ptr mem)
8016         for {
8017                 off := auxIntToInt32(v.AuxInt)
8018                 sym := auxToSym(v.Aux)
8019                 ptr := v_0
8020                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
8021                         break
8022                 }
8023                 mem := v_2
8024                 v.reset(OpPPC64MOVDstorezero)
8025                 v.AuxInt = int32ToAuxInt(off)
8026                 v.Aux = symToAux(sym)
8027                 v.AddArg2(ptr, mem)
8028                 return true
8029         }
8030         // match: (MOVDstore [0] {sym} p:(ADD ptr idx) val mem)
8031         // cond: sym == nil && p.Uses == 1
8032         // result: (MOVDstoreidx ptr idx val mem)
8033         for {
8034                 if auxIntToInt32(v.AuxInt) != 0 {
8035                         break
8036                 }
8037                 sym := auxToSym(v.Aux)
8038                 p := v_0
8039                 if p.Op != OpPPC64ADD {
8040                         break
8041                 }
8042                 idx := p.Args[1]
8043                 ptr := p.Args[0]
8044                 val := v_1
8045                 mem := v_2
8046                 if !(sym == nil && p.Uses == 1) {
8047                         break
8048                 }
8049                 v.reset(OpPPC64MOVDstoreidx)
8050                 v.AddArg4(ptr, idx, val, mem)
8051                 return true
8052         }
8053         // match: (MOVDstore [off] {sym} ptr r:(BRD val) mem)
8054         // cond: r.Uses == 1
8055         // result: (MOVDBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
8056         for {
8057                 off := auxIntToInt32(v.AuxInt)
8058                 sym := auxToSym(v.Aux)
8059                 ptr := v_0
8060                 r := v_1
8061                 if r.Op != OpPPC64BRD {
8062                         break
8063                 }
8064                 val := r.Args[0]
8065                 mem := v_2
8066                 if !(r.Uses == 1) {
8067                         break
8068                 }
8069                 v.reset(OpPPC64MOVDBRstore)
8070                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
8071                 v0.AuxInt = int32ToAuxInt(off)
8072                 v0.Aux = symToAux(sym)
8073                 v0.AddArg(ptr)
8074                 v.AddArg3(v0, val, mem)
8075                 return true
8076         }
8077         // match: (MOVDstore [off] {sym} ptr (Bswap64 val) mem)
8078         // result: (MOVDBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
8079         for {
8080                 off := auxIntToInt32(v.AuxInt)
8081                 sym := auxToSym(v.Aux)
8082                 ptr := v_0
8083                 if v_1.Op != OpBswap64 {
8084                         break
8085                 }
8086                 val := v_1.Args[0]
8087                 mem := v_2
8088                 v.reset(OpPPC64MOVDBRstore)
8089                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
8090                 v0.AuxInt = int32ToAuxInt(off)
8091                 v0.Aux = symToAux(sym)
8092                 v0.AddArg(ptr)
8093                 v.AddArg3(v0, val, mem)
8094                 return true
8095         }
8096         return false
8097 }
8098 func rewriteValuePPC64_OpPPC64MOVDstoreidx(v *Value) bool {
8099         v_3 := v.Args[3]
8100         v_2 := v.Args[2]
8101         v_1 := v.Args[1]
8102         v_0 := v.Args[0]
8103         // match: (MOVDstoreidx ptr (MOVDconst [c]) val mem)
8104         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8105         // result: (MOVDstore [int32(c)] ptr val mem)
8106         for {
8107                 ptr := v_0
8108                 if v_1.Op != OpPPC64MOVDconst {
8109                         break
8110                 }
8111                 c := auxIntToInt64(v_1.AuxInt)
8112                 val := v_2
8113                 mem := v_3
8114                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8115                         break
8116                 }
8117                 v.reset(OpPPC64MOVDstore)
8118                 v.AuxInt = int32ToAuxInt(int32(c))
8119                 v.AddArg3(ptr, val, mem)
8120                 return true
8121         }
8122         // match: (MOVDstoreidx (MOVDconst [c]) ptr val mem)
8123         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8124         // result: (MOVDstore [int32(c)] ptr val mem)
8125         for {
8126                 if v_0.Op != OpPPC64MOVDconst {
8127                         break
8128                 }
8129                 c := auxIntToInt64(v_0.AuxInt)
8130                 ptr := v_1
8131                 val := v_2
8132                 mem := v_3
8133                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8134                         break
8135                 }
8136                 v.reset(OpPPC64MOVDstore)
8137                 v.AuxInt = int32ToAuxInt(int32(c))
8138                 v.AddArg3(ptr, val, mem)
8139                 return true
8140         }
8141         // match: (MOVDstoreidx ptr idx r:(BRD val) mem)
8142         // cond: r.Uses == 1
8143         // result: (MOVDBRstoreidx ptr idx val mem)
8144         for {
8145                 ptr := v_0
8146                 idx := v_1
8147                 r := v_2
8148                 if r.Op != OpPPC64BRD {
8149                         break
8150                 }
8151                 val := r.Args[0]
8152                 mem := v_3
8153                 if !(r.Uses == 1) {
8154                         break
8155                 }
8156                 v.reset(OpPPC64MOVDBRstoreidx)
8157                 v.AddArg4(ptr, idx, val, mem)
8158                 return true
8159         }
8160         // match: (MOVDstoreidx ptr idx (Bswap64 val) mem)
8161         // result: (MOVDBRstoreidx ptr idx val mem)
8162         for {
8163                 ptr := v_0
8164                 idx := v_1
8165                 if v_2.Op != OpBswap64 {
8166                         break
8167                 }
8168                 val := v_2.Args[0]
8169                 mem := v_3
8170                 v.reset(OpPPC64MOVDBRstoreidx)
8171                 v.AddArg4(ptr, idx, val, mem)
8172                 return true
8173         }
8174         return false
8175 }
8176 func rewriteValuePPC64_OpPPC64MOVDstorezero(v *Value) bool {
8177         v_1 := v.Args[1]
8178         v_0 := v.Args[0]
8179         // match: (MOVDstorezero [off1] {sym} (ADDconst [off2] x) mem)
8180         // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2)))
8181         // result: (MOVDstorezero [off1+int32(off2)] {sym} x mem)
8182         for {
8183                 off1 := auxIntToInt32(v.AuxInt)
8184                 sym := auxToSym(v.Aux)
8185                 if v_0.Op != OpPPC64ADDconst {
8186                         break
8187                 }
8188                 off2 := auxIntToInt64(v_0.AuxInt)
8189                 x := v_0.Args[0]
8190                 mem := v_1
8191                 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
8192                         break
8193                 }
8194                 v.reset(OpPPC64MOVDstorezero)
8195                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8196                 v.Aux = symToAux(sym)
8197                 v.AddArg2(x, mem)
8198                 return true
8199         }
8200         // match: (MOVDstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
8201         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
8202         // result: (MOVDstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
8203         for {
8204                 off1 := auxIntToInt32(v.AuxInt)
8205                 sym1 := auxToSym(v.Aux)
8206                 p := v_0
8207                 if p.Op != OpPPC64MOVDaddr {
8208                         break
8209                 }
8210                 off2 := auxIntToInt32(p.AuxInt)
8211                 sym2 := auxToSym(p.Aux)
8212                 x := p.Args[0]
8213                 mem := v_1
8214                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8215                         break
8216                 }
8217                 v.reset(OpPPC64MOVDstorezero)
8218                 v.AuxInt = int32ToAuxInt(off1 + off2)
8219                 v.Aux = symToAux(mergeSym(sym1, sym2))
8220                 v.AddArg2(x, mem)
8221                 return true
8222         }
8223         return false
8224 }
8225 func rewriteValuePPC64_OpPPC64MOVHBRstore(v *Value) bool {
8226         v_2 := v.Args[2]
8227         v_1 := v.Args[1]
8228         v_0 := v.Args[0]
8229         // match: (MOVHBRstore ptr (MOVHreg x) mem)
8230         // result: (MOVHBRstore ptr x mem)
8231         for {
8232                 ptr := v_0
8233                 if v_1.Op != OpPPC64MOVHreg {
8234                         break
8235                 }
8236                 x := v_1.Args[0]
8237                 mem := v_2
8238                 v.reset(OpPPC64MOVHBRstore)
8239                 v.AddArg3(ptr, x, mem)
8240                 return true
8241         }
8242         // match: (MOVHBRstore ptr (MOVHZreg x) mem)
8243         // result: (MOVHBRstore ptr x mem)
8244         for {
8245                 ptr := v_0
8246                 if v_1.Op != OpPPC64MOVHZreg {
8247                         break
8248                 }
8249                 x := v_1.Args[0]
8250                 mem := v_2
8251                 v.reset(OpPPC64MOVHBRstore)
8252                 v.AddArg3(ptr, x, mem)
8253                 return true
8254         }
8255         // match: (MOVHBRstore ptr (MOVWreg x) mem)
8256         // result: (MOVHBRstore ptr x mem)
8257         for {
8258                 ptr := v_0
8259                 if v_1.Op != OpPPC64MOVWreg {
8260                         break
8261                 }
8262                 x := v_1.Args[0]
8263                 mem := v_2
8264                 v.reset(OpPPC64MOVHBRstore)
8265                 v.AddArg3(ptr, x, mem)
8266                 return true
8267         }
8268         // match: (MOVHBRstore ptr (MOVWZreg x) mem)
8269         // result: (MOVHBRstore ptr x mem)
8270         for {
8271                 ptr := v_0
8272                 if v_1.Op != OpPPC64MOVWZreg {
8273                         break
8274                 }
8275                 x := v_1.Args[0]
8276                 mem := v_2
8277                 v.reset(OpPPC64MOVHBRstore)
8278                 v.AddArg3(ptr, x, mem)
8279                 return true
8280         }
8281         return false
8282 }
8283 func rewriteValuePPC64_OpPPC64MOVHZload(v *Value) bool {
8284         v_1 := v.Args[1]
8285         v_0 := v.Args[0]
8286         // match: (MOVHZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
8287         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
8288         // result: (MOVHZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
8289         for {
8290                 off1 := auxIntToInt32(v.AuxInt)
8291                 sym1 := auxToSym(v.Aux)
8292                 p := v_0
8293                 if p.Op != OpPPC64MOVDaddr {
8294                         break
8295                 }
8296                 off2 := auxIntToInt32(p.AuxInt)
8297                 sym2 := auxToSym(p.Aux)
8298                 ptr := p.Args[0]
8299                 mem := v_1
8300                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8301                         break
8302                 }
8303                 v.reset(OpPPC64MOVHZload)
8304                 v.AuxInt = int32ToAuxInt(off1 + off2)
8305                 v.Aux = symToAux(mergeSym(sym1, sym2))
8306                 v.AddArg2(ptr, mem)
8307                 return true
8308         }
8309         // match: (MOVHZload [off1] {sym} (ADDconst [off2] x) mem)
8310         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
8311         // result: (MOVHZload [off1+int32(off2)] {sym} x mem)
8312         for {
8313                 off1 := auxIntToInt32(v.AuxInt)
8314                 sym := auxToSym(v.Aux)
8315                 if v_0.Op != OpPPC64ADDconst {
8316                         break
8317                 }
8318                 off2 := auxIntToInt64(v_0.AuxInt)
8319                 x := v_0.Args[0]
8320                 mem := v_1
8321                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
8322                         break
8323                 }
8324                 v.reset(OpPPC64MOVHZload)
8325                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8326                 v.Aux = symToAux(sym)
8327                 v.AddArg2(x, mem)
8328                 return true
8329         }
8330         // match: (MOVHZload [0] {sym} p:(ADD ptr idx) mem)
8331         // cond: sym == nil && p.Uses == 1
8332         // result: (MOVHZloadidx ptr idx mem)
8333         for {
8334                 if auxIntToInt32(v.AuxInt) != 0 {
8335                         break
8336                 }
8337                 sym := auxToSym(v.Aux)
8338                 p := v_0
8339                 if p.Op != OpPPC64ADD {
8340                         break
8341                 }
8342                 idx := p.Args[1]
8343                 ptr := p.Args[0]
8344                 mem := v_1
8345                 if !(sym == nil && p.Uses == 1) {
8346                         break
8347                 }
8348                 v.reset(OpPPC64MOVHZloadidx)
8349                 v.AddArg3(ptr, idx, mem)
8350                 return true
8351         }
8352         return false
8353 }
8354 func rewriteValuePPC64_OpPPC64MOVHZloadidx(v *Value) bool {
8355         v_2 := v.Args[2]
8356         v_1 := v.Args[1]
8357         v_0 := v.Args[0]
8358         // match: (MOVHZloadidx ptr (MOVDconst [c]) mem)
8359         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8360         // result: (MOVHZload [int32(c)] ptr mem)
8361         for {
8362                 ptr := v_0
8363                 if v_1.Op != OpPPC64MOVDconst {
8364                         break
8365                 }
8366                 c := auxIntToInt64(v_1.AuxInt)
8367                 mem := v_2
8368                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8369                         break
8370                 }
8371                 v.reset(OpPPC64MOVHZload)
8372                 v.AuxInt = int32ToAuxInt(int32(c))
8373                 v.AddArg2(ptr, mem)
8374                 return true
8375         }
8376         // match: (MOVHZloadidx (MOVDconst [c]) ptr mem)
8377         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8378         // result: (MOVHZload [int32(c)] ptr mem)
8379         for {
8380                 if v_0.Op != OpPPC64MOVDconst {
8381                         break
8382                 }
8383                 c := auxIntToInt64(v_0.AuxInt)
8384                 ptr := v_1
8385                 mem := v_2
8386                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8387                         break
8388                 }
8389                 v.reset(OpPPC64MOVHZload)
8390                 v.AuxInt = int32ToAuxInt(int32(c))
8391                 v.AddArg2(ptr, mem)
8392                 return true
8393         }
8394         return false
8395 }
8396 func rewriteValuePPC64_OpPPC64MOVHZreg(v *Value) bool {
8397         v_0 := v.Args[0]
8398         b := v.Block
8399         typ := &b.Func.Config.Types
8400         // match: (MOVHZreg y:(Select0 (ANDCCconst [c] _)))
8401         // cond: uint64(c) <= 0xFFFF
8402         // result: y
8403         for {
8404                 y := v_0
8405                 if y.Op != OpSelect0 {
8406                         break
8407                 }
8408                 y_0 := y.Args[0]
8409                 if y_0.Op != OpPPC64ANDCCconst {
8410                         break
8411                 }
8412                 c := auxIntToInt64(y_0.AuxInt)
8413                 if !(uint64(c) <= 0xFFFF) {
8414                         break
8415                 }
8416                 v.copyOf(y)
8417                 return true
8418         }
8419         // match: (MOVHZreg (SRWconst [c] (MOVBZreg x)))
8420         // result: (SRWconst [c] (MOVBZreg x))
8421         for {
8422                 if v_0.Op != OpPPC64SRWconst {
8423                         break
8424                 }
8425                 c := auxIntToInt64(v_0.AuxInt)
8426                 v_0_0 := v_0.Args[0]
8427                 if v_0_0.Op != OpPPC64MOVBZreg {
8428                         break
8429                 }
8430                 x := v_0_0.Args[0]
8431                 v.reset(OpPPC64SRWconst)
8432                 v.AuxInt = int64ToAuxInt(c)
8433                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
8434                 v0.AddArg(x)
8435                 v.AddArg(v0)
8436                 return true
8437         }
8438         // match: (MOVHZreg (SRWconst [c] (MOVHZreg x)))
8439         // result: (SRWconst [c] (MOVHZreg x))
8440         for {
8441                 if v_0.Op != OpPPC64SRWconst {
8442                         break
8443                 }
8444                 c := auxIntToInt64(v_0.AuxInt)
8445                 v_0_0 := v_0.Args[0]
8446                 if v_0_0.Op != OpPPC64MOVHZreg {
8447                         break
8448                 }
8449                 x := v_0_0.Args[0]
8450                 v.reset(OpPPC64SRWconst)
8451                 v.AuxInt = int64ToAuxInt(c)
8452                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
8453                 v0.AddArg(x)
8454                 v.AddArg(v0)
8455                 return true
8456         }
8457         // match: (MOVHZreg (SRWconst [c] x))
8458         // cond: sizeof(x.Type) <= 16
8459         // result: (SRWconst [c] x)
8460         for {
8461                 if v_0.Op != OpPPC64SRWconst {
8462                         break
8463                 }
8464                 c := auxIntToInt64(v_0.AuxInt)
8465                 x := v_0.Args[0]
8466                 if !(sizeof(x.Type) <= 16) {
8467                         break
8468                 }
8469                 v.reset(OpPPC64SRWconst)
8470                 v.AuxInt = int64ToAuxInt(c)
8471                 v.AddArg(x)
8472                 return true
8473         }
8474         // match: (MOVHZreg (SRDconst [c] x))
8475         // cond: c>=48
8476         // result: (SRDconst [c] x)
8477         for {
8478                 if v_0.Op != OpPPC64SRDconst {
8479                         break
8480                 }
8481                 c := auxIntToInt64(v_0.AuxInt)
8482                 x := v_0.Args[0]
8483                 if !(c >= 48) {
8484                         break
8485                 }
8486                 v.reset(OpPPC64SRDconst)
8487                 v.AuxInt = int64ToAuxInt(c)
8488                 v.AddArg(x)
8489                 return true
8490         }
8491         // match: (MOVHZreg (SRWconst [c] x))
8492         // cond: c>=16
8493         // result: (SRWconst [c] x)
8494         for {
8495                 if v_0.Op != OpPPC64SRWconst {
8496                         break
8497                 }
8498                 c := auxIntToInt64(v_0.AuxInt)
8499                 x := v_0.Args[0]
8500                 if !(c >= 16) {
8501                         break
8502                 }
8503                 v.reset(OpPPC64SRWconst)
8504                 v.AuxInt = int64ToAuxInt(c)
8505                 v.AddArg(x)
8506                 return true
8507         }
8508         // match: (MOVHZreg y:(MOVHZreg _))
8509         // result: y
8510         for {
8511                 y := v_0
8512                 if y.Op != OpPPC64MOVHZreg {
8513                         break
8514                 }
8515                 v.copyOf(y)
8516                 return true
8517         }
8518         // match: (MOVHZreg y:(MOVBZreg _))
8519         // result: y
8520         for {
8521                 y := v_0
8522                 if y.Op != OpPPC64MOVBZreg {
8523                         break
8524                 }
8525                 v.copyOf(y)
8526                 return true
8527         }
8528         // match: (MOVHZreg y:(MOVHBRload _ _))
8529         // result: y
8530         for {
8531                 y := v_0
8532                 if y.Op != OpPPC64MOVHBRload {
8533                         break
8534                 }
8535                 v.copyOf(y)
8536                 return true
8537         }
8538         // match: (MOVHZreg y:(MOVHreg x))
8539         // result: (MOVHZreg x)
8540         for {
8541                 y := v_0
8542                 if y.Op != OpPPC64MOVHreg {
8543                         break
8544                 }
8545                 x := y.Args[0]
8546                 v.reset(OpPPC64MOVHZreg)
8547                 v.AddArg(x)
8548                 return true
8549         }
8550         // match: (MOVHZreg (OR <t> x (MOVWZreg y)))
8551         // result: (MOVHZreg (OR <t> x y))
8552         for {
8553                 if v_0.Op != OpPPC64OR {
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, OpPPC64OR, t)
8568                         v0.AddArg2(x, y)
8569                         v.AddArg(v0)
8570                         return true
8571                 }
8572                 break
8573         }
8574         // match: (MOVHZreg (XOR <t> x (MOVWZreg y)))
8575         // result: (MOVHZreg (XOR <t> x y))
8576         for {
8577                 if v_0.Op != OpPPC64XOR {
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 != OpPPC64MOVWZreg {
8587                                 continue
8588                         }
8589                         y := v_0_1.Args[0]
8590                         v.reset(OpPPC64MOVHZreg)
8591                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
8592                         v0.AddArg2(x, y)
8593                         v.AddArg(v0)
8594                         return true
8595                 }
8596                 break
8597         }
8598         // match: (MOVHZreg (AND <t> x (MOVWZreg y)))
8599         // result: (MOVHZreg (AND <t> x y))
8600         for {
8601                 if v_0.Op != OpPPC64AND {
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 != OpPPC64MOVWZreg {
8611                                 continue
8612                         }
8613                         y := v_0_1.Args[0]
8614                         v.reset(OpPPC64MOVHZreg)
8615                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
8616                         v0.AddArg2(x, y)
8617                         v.AddArg(v0)
8618                         return true
8619                 }
8620                 break
8621         }
8622         // match: (MOVHZreg (OR <t> x (MOVHZreg y)))
8623         // result: (MOVHZreg (OR <t> x y))
8624         for {
8625                 if v_0.Op != OpPPC64OR {
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, OpPPC64OR, t)
8640                         v0.AddArg2(x, y)
8641                         v.AddArg(v0)
8642                         return true
8643                 }
8644                 break
8645         }
8646         // match: (MOVHZreg (XOR <t> x (MOVHZreg y)))
8647         // result: (MOVHZreg (XOR <t> x y))
8648         for {
8649                 if v_0.Op != OpPPC64XOR {
8650                         break
8651                 }
8652                 t := v_0.Type
8653                 _ = v_0.Args[1]
8654                 v_0_0 := v_0.Args[0]
8655                 v_0_1 := v_0.Args[1]
8656                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8657                         x := v_0_0
8658                         if v_0_1.Op != OpPPC64MOVHZreg {
8659                                 continue
8660                         }
8661                         y := v_0_1.Args[0]
8662                         v.reset(OpPPC64MOVHZreg)
8663                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
8664                         v0.AddArg2(x, y)
8665                         v.AddArg(v0)
8666                         return true
8667                 }
8668                 break
8669         }
8670         // match: (MOVHZreg (AND <t> x (MOVHZreg y)))
8671         // result: (MOVHZreg (AND <t> x y))
8672         for {
8673                 if v_0.Op != OpPPC64AND {
8674                         break
8675                 }
8676                 t := v_0.Type
8677                 _ = v_0.Args[1]
8678                 v_0_0 := v_0.Args[0]
8679                 v_0_1 := v_0.Args[1]
8680                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8681                         x := v_0_0
8682                         if v_0_1.Op != OpPPC64MOVHZreg {
8683                                 continue
8684                         }
8685                         y := v_0_1.Args[0]
8686                         v.reset(OpPPC64MOVHZreg)
8687                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
8688                         v0.AddArg2(x, y)
8689                         v.AddArg(v0)
8690                         return true
8691                 }
8692                 break
8693         }
8694         // match: (MOVHZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x))))
8695         // result: z
8696         for {
8697                 z := v_0
8698                 if z.Op != OpSelect0 {
8699                         break
8700                 }
8701                 z_0 := z.Args[0]
8702                 if z_0.Op != OpPPC64ANDCCconst {
8703                         break
8704                 }
8705                 z_0_0 := z_0.Args[0]
8706                 if z_0_0.Op != OpPPC64MOVBZload {
8707                         break
8708                 }
8709                 v.copyOf(z)
8710                 return true
8711         }
8712         // match: (MOVHZreg z:(AND y (MOVHZload ptr x)))
8713         // result: z
8714         for {
8715                 z := v_0
8716                 if z.Op != OpPPC64AND {
8717                         break
8718                 }
8719                 _ = z.Args[1]
8720                 z_0 := z.Args[0]
8721                 z_1 := z.Args[1]
8722                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
8723                         if z_1.Op != OpPPC64MOVHZload {
8724                                 continue
8725                         }
8726                         v.copyOf(z)
8727                         return true
8728                 }
8729                 break
8730         }
8731         // match: (MOVHZreg z:(Select0 (ANDCCconst [c] (MOVHZload ptr x))))
8732         // result: z
8733         for {
8734                 z := v_0
8735                 if z.Op != OpSelect0 {
8736                         break
8737                 }
8738                 z_0 := z.Args[0]
8739                 if z_0.Op != OpPPC64ANDCCconst {
8740                         break
8741                 }
8742                 z_0_0 := z_0.Args[0]
8743                 if z_0_0.Op != OpPPC64MOVHZload {
8744                         break
8745                 }
8746                 v.copyOf(z)
8747                 return true
8748         }
8749         // match: (MOVHZreg x:(MOVBZload _ _))
8750         // result: x
8751         for {
8752                 x := v_0
8753                 if x.Op != OpPPC64MOVBZload {
8754                         break
8755                 }
8756                 v.copyOf(x)
8757                 return true
8758         }
8759         // match: (MOVHZreg x:(MOVBZloadidx _ _ _))
8760         // result: x
8761         for {
8762                 x := v_0
8763                 if x.Op != OpPPC64MOVBZloadidx {
8764                         break
8765                 }
8766                 v.copyOf(x)
8767                 return true
8768         }
8769         // match: (MOVHZreg x:(MOVHZload _ _))
8770         // result: x
8771         for {
8772                 x := v_0
8773                 if x.Op != OpPPC64MOVHZload {
8774                         break
8775                 }
8776                 v.copyOf(x)
8777                 return true
8778         }
8779         // match: (MOVHZreg x:(MOVHZloadidx _ _ _))
8780         // result: x
8781         for {
8782                 x := v_0
8783                 if x.Op != OpPPC64MOVHZloadidx {
8784                         break
8785                 }
8786                 v.copyOf(x)
8787                 return true
8788         }
8789         // match: (MOVHZreg x:(Arg <t>))
8790         // cond: (is8BitInt(t) || is16BitInt(t)) && !t.IsSigned()
8791         // result: x
8792         for {
8793                 x := v_0
8794                 if x.Op != OpArg {
8795                         break
8796                 }
8797                 t := x.Type
8798                 if !((is8BitInt(t) || is16BitInt(t)) && !t.IsSigned()) {
8799                         break
8800                 }
8801                 v.copyOf(x)
8802                 return true
8803         }
8804         // match: (MOVHZreg (MOVDconst [c]))
8805         // result: (MOVDconst [int64(uint16(c))])
8806         for {
8807                 if v_0.Op != OpPPC64MOVDconst {
8808                         break
8809                 }
8810                 c := auxIntToInt64(v_0.AuxInt)
8811                 v.reset(OpPPC64MOVDconst)
8812                 v.AuxInt = int64ToAuxInt(int64(uint16(c)))
8813                 return true
8814         }
8815         return false
8816 }
8817 func rewriteValuePPC64_OpPPC64MOVHload(v *Value) bool {
8818         v_1 := v.Args[1]
8819         v_0 := v.Args[0]
8820         // match: (MOVHload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
8821         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
8822         // result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
8823         for {
8824                 off1 := auxIntToInt32(v.AuxInt)
8825                 sym1 := auxToSym(v.Aux)
8826                 p := v_0
8827                 if p.Op != OpPPC64MOVDaddr {
8828                         break
8829                 }
8830                 off2 := auxIntToInt32(p.AuxInt)
8831                 sym2 := auxToSym(p.Aux)
8832                 ptr := p.Args[0]
8833                 mem := v_1
8834                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8835                         break
8836                 }
8837                 v.reset(OpPPC64MOVHload)
8838                 v.AuxInt = int32ToAuxInt(off1 + off2)
8839                 v.Aux = symToAux(mergeSym(sym1, sym2))
8840                 v.AddArg2(ptr, mem)
8841                 return true
8842         }
8843         // match: (MOVHload [off1] {sym} (ADDconst [off2] x) mem)
8844         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
8845         // result: (MOVHload [off1+int32(off2)] {sym} x mem)
8846         for {
8847                 off1 := auxIntToInt32(v.AuxInt)
8848                 sym := auxToSym(v.Aux)
8849                 if v_0.Op != OpPPC64ADDconst {
8850                         break
8851                 }
8852                 off2 := auxIntToInt64(v_0.AuxInt)
8853                 x := v_0.Args[0]
8854                 mem := v_1
8855                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
8856                         break
8857                 }
8858                 v.reset(OpPPC64MOVHload)
8859                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8860                 v.Aux = symToAux(sym)
8861                 v.AddArg2(x, mem)
8862                 return true
8863         }
8864         // match: (MOVHload [0] {sym} p:(ADD ptr idx) mem)
8865         // cond: sym == nil && p.Uses == 1
8866         // result: (MOVHloadidx ptr idx mem)
8867         for {
8868                 if auxIntToInt32(v.AuxInt) != 0 {
8869                         break
8870                 }
8871                 sym := auxToSym(v.Aux)
8872                 p := v_0
8873                 if p.Op != OpPPC64ADD {
8874                         break
8875                 }
8876                 idx := p.Args[1]
8877                 ptr := p.Args[0]
8878                 mem := v_1
8879                 if !(sym == nil && p.Uses == 1) {
8880                         break
8881                 }
8882                 v.reset(OpPPC64MOVHloadidx)
8883                 v.AddArg3(ptr, idx, mem)
8884                 return true
8885         }
8886         return false
8887 }
8888 func rewriteValuePPC64_OpPPC64MOVHloadidx(v *Value) bool {
8889         v_2 := v.Args[2]
8890         v_1 := v.Args[1]
8891         v_0 := v.Args[0]
8892         // match: (MOVHloadidx ptr (MOVDconst [c]) mem)
8893         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8894         // result: (MOVHload [int32(c)] ptr mem)
8895         for {
8896                 ptr := v_0
8897                 if v_1.Op != OpPPC64MOVDconst {
8898                         break
8899                 }
8900                 c := auxIntToInt64(v_1.AuxInt)
8901                 mem := v_2
8902                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8903                         break
8904                 }
8905                 v.reset(OpPPC64MOVHload)
8906                 v.AuxInt = int32ToAuxInt(int32(c))
8907                 v.AddArg2(ptr, mem)
8908                 return true
8909         }
8910         // match: (MOVHloadidx (MOVDconst [c]) ptr mem)
8911         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8912         // result: (MOVHload [int32(c)] ptr mem)
8913         for {
8914                 if v_0.Op != OpPPC64MOVDconst {
8915                         break
8916                 }
8917                 c := auxIntToInt64(v_0.AuxInt)
8918                 ptr := v_1
8919                 mem := v_2
8920                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8921                         break
8922                 }
8923                 v.reset(OpPPC64MOVHload)
8924                 v.AuxInt = int32ToAuxInt(int32(c))
8925                 v.AddArg2(ptr, mem)
8926                 return true
8927         }
8928         return false
8929 }
8930 func rewriteValuePPC64_OpPPC64MOVHreg(v *Value) bool {
8931         v_0 := v.Args[0]
8932         b := v.Block
8933         typ := &b.Func.Config.Types
8934         // match: (MOVHreg y:(Select0 (ANDCCconst [c] _)))
8935         // cond: uint64(c) <= 0x7FFF
8936         // result: y
8937         for {
8938                 y := v_0
8939                 if y.Op != OpSelect0 {
8940                         break
8941                 }
8942                 y_0 := y.Args[0]
8943                 if y_0.Op != OpPPC64ANDCCconst {
8944                         break
8945                 }
8946                 c := auxIntToInt64(y_0.AuxInt)
8947                 if !(uint64(c) <= 0x7FFF) {
8948                         break
8949                 }
8950                 v.copyOf(y)
8951                 return true
8952         }
8953         // match: (MOVHreg (SRAWconst [c] (MOVBreg x)))
8954         // result: (SRAWconst [c] (MOVBreg x))
8955         for {
8956                 if v_0.Op != OpPPC64SRAWconst {
8957                         break
8958                 }
8959                 c := auxIntToInt64(v_0.AuxInt)
8960                 v_0_0 := v_0.Args[0]
8961                 if v_0_0.Op != OpPPC64MOVBreg {
8962                         break
8963                 }
8964                 x := v_0_0.Args[0]
8965                 v.reset(OpPPC64SRAWconst)
8966                 v.AuxInt = int64ToAuxInt(c)
8967                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
8968                 v0.AddArg(x)
8969                 v.AddArg(v0)
8970                 return true
8971         }
8972         // match: (MOVHreg (SRAWconst [c] (MOVHreg x)))
8973         // result: (SRAWconst [c] (MOVHreg x))
8974         for {
8975                 if v_0.Op != OpPPC64SRAWconst {
8976                         break
8977                 }
8978                 c := auxIntToInt64(v_0.AuxInt)
8979                 v_0_0 := v_0.Args[0]
8980                 if v_0_0.Op != OpPPC64MOVHreg {
8981                         break
8982                 }
8983                 x := v_0_0.Args[0]
8984                 v.reset(OpPPC64SRAWconst)
8985                 v.AuxInt = int64ToAuxInt(c)
8986                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
8987                 v0.AddArg(x)
8988                 v.AddArg(v0)
8989                 return true
8990         }
8991         // match: (MOVHreg (SRAWconst [c] x))
8992         // cond: sizeof(x.Type) <= 16
8993         // result: (SRAWconst [c] x)
8994         for {
8995                 if v_0.Op != OpPPC64SRAWconst {
8996                         break
8997                 }
8998                 c := auxIntToInt64(v_0.AuxInt)
8999                 x := v_0.Args[0]
9000                 if !(sizeof(x.Type) <= 16) {
9001                         break
9002                 }
9003                 v.reset(OpPPC64SRAWconst)
9004                 v.AuxInt = int64ToAuxInt(c)
9005                 v.AddArg(x)
9006                 return true
9007         }
9008         // match: (MOVHreg (SRDconst [c] x))
9009         // cond: c>48
9010         // result: (SRDconst [c] x)
9011         for {
9012                 if v_0.Op != OpPPC64SRDconst {
9013                         break
9014                 }
9015                 c := auxIntToInt64(v_0.AuxInt)
9016                 x := v_0.Args[0]
9017                 if !(c > 48) {
9018                         break
9019                 }
9020                 v.reset(OpPPC64SRDconst)
9021                 v.AuxInt = int64ToAuxInt(c)
9022                 v.AddArg(x)
9023                 return true
9024         }
9025         // match: (MOVHreg (SRDconst [c] x))
9026         // cond: c==48
9027         // result: (SRADconst [c] x)
9028         for {
9029                 if v_0.Op != OpPPC64SRDconst {
9030                         break
9031                 }
9032                 c := auxIntToInt64(v_0.AuxInt)
9033                 x := v_0.Args[0]
9034                 if !(c == 48) {
9035                         break
9036                 }
9037                 v.reset(OpPPC64SRADconst)
9038                 v.AuxInt = int64ToAuxInt(c)
9039                 v.AddArg(x)
9040                 return true
9041         }
9042         // match: (MOVHreg (SRADconst [c] x))
9043         // cond: c>=48
9044         // result: (SRADconst [c] x)
9045         for {
9046                 if v_0.Op != OpPPC64SRADconst {
9047                         break
9048                 }
9049                 c := auxIntToInt64(v_0.AuxInt)
9050                 x := v_0.Args[0]
9051                 if !(c >= 48) {
9052                         break
9053                 }
9054                 v.reset(OpPPC64SRADconst)
9055                 v.AuxInt = int64ToAuxInt(c)
9056                 v.AddArg(x)
9057                 return true
9058         }
9059         // match: (MOVHreg (SRWconst [c] x))
9060         // cond: c>16
9061         // result: (SRWconst [c] x)
9062         for {
9063                 if v_0.Op != OpPPC64SRWconst {
9064                         break
9065                 }
9066                 c := auxIntToInt64(v_0.AuxInt)
9067                 x := v_0.Args[0]
9068                 if !(c > 16) {
9069                         break
9070                 }
9071                 v.reset(OpPPC64SRWconst)
9072                 v.AuxInt = int64ToAuxInt(c)
9073                 v.AddArg(x)
9074                 return true
9075         }
9076         // match: (MOVHreg (SRAWconst [c] x))
9077         // cond: c>=16
9078         // result: (SRAWconst [c] x)
9079         for {
9080                 if v_0.Op != OpPPC64SRAWconst {
9081                         break
9082                 }
9083                 c := auxIntToInt64(v_0.AuxInt)
9084                 x := v_0.Args[0]
9085                 if !(c >= 16) {
9086                         break
9087                 }
9088                 v.reset(OpPPC64SRAWconst)
9089                 v.AuxInt = int64ToAuxInt(c)
9090                 v.AddArg(x)
9091                 return true
9092         }
9093         // match: (MOVHreg (SRWconst [c] x))
9094         // cond: c==16
9095         // result: (SRAWconst [c] x)
9096         for {
9097                 if v_0.Op != OpPPC64SRWconst {
9098                         break
9099                 }
9100                 c := auxIntToInt64(v_0.AuxInt)
9101                 x := v_0.Args[0]
9102                 if !(c == 16) {
9103                         break
9104                 }
9105                 v.reset(OpPPC64SRAWconst)
9106                 v.AuxInt = int64ToAuxInt(c)
9107                 v.AddArg(x)
9108                 return true
9109         }
9110         // match: (MOVHreg y:(MOVHreg _))
9111         // result: y
9112         for {
9113                 y := v_0
9114                 if y.Op != OpPPC64MOVHreg {
9115                         break
9116                 }
9117                 v.copyOf(y)
9118                 return true
9119         }
9120         // match: (MOVHreg y:(MOVBreg _))
9121         // result: y
9122         for {
9123                 y := v_0
9124                 if y.Op != OpPPC64MOVBreg {
9125                         break
9126                 }
9127                 v.copyOf(y)
9128                 return true
9129         }
9130         // match: (MOVHreg y:(MOVHZreg x))
9131         // result: (MOVHreg x)
9132         for {
9133                 y := v_0
9134                 if y.Op != OpPPC64MOVHZreg {
9135                         break
9136                 }
9137                 x := y.Args[0]
9138                 v.reset(OpPPC64MOVHreg)
9139                 v.AddArg(x)
9140                 return true
9141         }
9142         // match: (MOVHreg x:(MOVHload _ _))
9143         // result: x
9144         for {
9145                 x := v_0
9146                 if x.Op != OpPPC64MOVHload {
9147                         break
9148                 }
9149                 v.copyOf(x)
9150                 return true
9151         }
9152         // match: (MOVHreg x:(MOVHloadidx _ _ _))
9153         // result: x
9154         for {
9155                 x := v_0
9156                 if x.Op != OpPPC64MOVHloadidx {
9157                         break
9158                 }
9159                 v.copyOf(x)
9160                 return true
9161         }
9162         // match: (MOVHreg x:(Arg <t>))
9163         // cond: (is8BitInt(t) || is16BitInt(t)) && t.IsSigned()
9164         // result: x
9165         for {
9166                 x := v_0
9167                 if x.Op != OpArg {
9168                         break
9169                 }
9170                 t := x.Type
9171                 if !((is8BitInt(t) || is16BitInt(t)) && t.IsSigned()) {
9172                         break
9173                 }
9174                 v.copyOf(x)
9175                 return true
9176         }
9177         // match: (MOVHreg (MOVDconst [c]))
9178         // result: (MOVDconst [int64(int16(c))])
9179         for {
9180                 if v_0.Op != OpPPC64MOVDconst {
9181                         break
9182                 }
9183                 c := auxIntToInt64(v_0.AuxInt)
9184                 v.reset(OpPPC64MOVDconst)
9185                 v.AuxInt = int64ToAuxInt(int64(int16(c)))
9186                 return true
9187         }
9188         return false
9189 }
9190 func rewriteValuePPC64_OpPPC64MOVHstore(v *Value) bool {
9191         v_2 := v.Args[2]
9192         v_1 := v.Args[1]
9193         v_0 := v.Args[0]
9194         b := v.Block
9195         // match: (MOVHstore [off1] {sym} (ADDconst [off2] x) val mem)
9196         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
9197         // result: (MOVHstore [off1+int32(off2)] {sym} x val mem)
9198         for {
9199                 off1 := auxIntToInt32(v.AuxInt)
9200                 sym := auxToSym(v.Aux)
9201                 if v_0.Op != OpPPC64ADDconst {
9202                         break
9203                 }
9204                 off2 := auxIntToInt64(v_0.AuxInt)
9205                 x := v_0.Args[0]
9206                 val := v_1
9207                 mem := v_2
9208                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
9209                         break
9210                 }
9211                 v.reset(OpPPC64MOVHstore)
9212                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9213                 v.Aux = symToAux(sym)
9214                 v.AddArg3(x, val, mem)
9215                 return true
9216         }
9217         // match: (MOVHstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
9218         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
9219         // result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
9220         for {
9221                 off1 := auxIntToInt32(v.AuxInt)
9222                 sym1 := auxToSym(v.Aux)
9223                 p := v_0
9224                 if p.Op != OpPPC64MOVDaddr {
9225                         break
9226                 }
9227                 off2 := auxIntToInt32(p.AuxInt)
9228                 sym2 := auxToSym(p.Aux)
9229                 ptr := p.Args[0]
9230                 val := v_1
9231                 mem := v_2
9232                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
9233                         break
9234                 }
9235                 v.reset(OpPPC64MOVHstore)
9236                 v.AuxInt = int32ToAuxInt(off1 + off2)
9237                 v.Aux = symToAux(mergeSym(sym1, sym2))
9238                 v.AddArg3(ptr, val, mem)
9239                 return true
9240         }
9241         // match: (MOVHstore [off] {sym} ptr (MOVDconst [0]) mem)
9242         // result: (MOVHstorezero [off] {sym} ptr mem)
9243         for {
9244                 off := auxIntToInt32(v.AuxInt)
9245                 sym := auxToSym(v.Aux)
9246                 ptr := v_0
9247                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
9248                         break
9249                 }
9250                 mem := v_2
9251                 v.reset(OpPPC64MOVHstorezero)
9252                 v.AuxInt = int32ToAuxInt(off)
9253                 v.Aux = symToAux(sym)
9254                 v.AddArg2(ptr, mem)
9255                 return true
9256         }
9257         // match: (MOVHstore [0] {sym} p:(ADD ptr idx) val mem)
9258         // cond: sym == nil && p.Uses == 1
9259         // result: (MOVHstoreidx ptr idx val mem)
9260         for {
9261                 if auxIntToInt32(v.AuxInt) != 0 {
9262                         break
9263                 }
9264                 sym := auxToSym(v.Aux)
9265                 p := v_0
9266                 if p.Op != OpPPC64ADD {
9267                         break
9268                 }
9269                 idx := p.Args[1]
9270                 ptr := p.Args[0]
9271                 val := v_1
9272                 mem := v_2
9273                 if !(sym == nil && p.Uses == 1) {
9274                         break
9275                 }
9276                 v.reset(OpPPC64MOVHstoreidx)
9277                 v.AddArg4(ptr, idx, val, mem)
9278                 return true
9279         }
9280         // match: (MOVHstore [off] {sym} ptr (MOVHreg x) mem)
9281         // result: (MOVHstore [off] {sym} ptr x mem)
9282         for {
9283                 off := auxIntToInt32(v.AuxInt)
9284                 sym := auxToSym(v.Aux)
9285                 ptr := v_0
9286                 if v_1.Op != OpPPC64MOVHreg {
9287                         break
9288                 }
9289                 x := v_1.Args[0]
9290                 mem := v_2
9291                 v.reset(OpPPC64MOVHstore)
9292                 v.AuxInt = int32ToAuxInt(off)
9293                 v.Aux = symToAux(sym)
9294                 v.AddArg3(ptr, x, mem)
9295                 return true
9296         }
9297         // match: (MOVHstore [off] {sym} ptr (MOVHZreg x) mem)
9298         // result: (MOVHstore [off] {sym} ptr x mem)
9299         for {
9300                 off := auxIntToInt32(v.AuxInt)
9301                 sym := auxToSym(v.Aux)
9302                 ptr := v_0
9303                 if v_1.Op != OpPPC64MOVHZreg {
9304                         break
9305                 }
9306                 x := v_1.Args[0]
9307                 mem := v_2
9308                 v.reset(OpPPC64MOVHstore)
9309                 v.AuxInt = int32ToAuxInt(off)
9310                 v.Aux = symToAux(sym)
9311                 v.AddArg3(ptr, x, mem)
9312                 return true
9313         }
9314         // match: (MOVHstore [off] {sym} ptr (MOVWreg x) mem)
9315         // result: (MOVHstore [off] {sym} ptr x mem)
9316         for {
9317                 off := auxIntToInt32(v.AuxInt)
9318                 sym := auxToSym(v.Aux)
9319                 ptr := v_0
9320                 if v_1.Op != OpPPC64MOVWreg {
9321                         break
9322                 }
9323                 x := v_1.Args[0]
9324                 mem := v_2
9325                 v.reset(OpPPC64MOVHstore)
9326                 v.AuxInt = int32ToAuxInt(off)
9327                 v.Aux = symToAux(sym)
9328                 v.AddArg3(ptr, x, mem)
9329                 return true
9330         }
9331         // match: (MOVHstore [off] {sym} ptr (MOVWZreg x) mem)
9332         // result: (MOVHstore [off] {sym} ptr x mem)
9333         for {
9334                 off := auxIntToInt32(v.AuxInt)
9335                 sym := auxToSym(v.Aux)
9336                 ptr := v_0
9337                 if v_1.Op != OpPPC64MOVWZreg {
9338                         break
9339                 }
9340                 x := v_1.Args[0]
9341                 mem := v_2
9342                 v.reset(OpPPC64MOVHstore)
9343                 v.AuxInt = int32ToAuxInt(off)
9344                 v.Aux = symToAux(sym)
9345                 v.AddArg3(ptr, x, mem)
9346                 return true
9347         }
9348         // match: (MOVHstore [off] {sym} ptr r:(BRH val) mem)
9349         // cond: r.Uses == 1
9350         // result: (MOVHBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
9351         for {
9352                 off := auxIntToInt32(v.AuxInt)
9353                 sym := auxToSym(v.Aux)
9354                 ptr := v_0
9355                 r := v_1
9356                 if r.Op != OpPPC64BRH {
9357                         break
9358                 }
9359                 val := r.Args[0]
9360                 mem := v_2
9361                 if !(r.Uses == 1) {
9362                         break
9363                 }
9364                 v.reset(OpPPC64MOVHBRstore)
9365                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
9366                 v0.AuxInt = int32ToAuxInt(off)
9367                 v0.Aux = symToAux(sym)
9368                 v0.AddArg(ptr)
9369                 v.AddArg3(v0, val, mem)
9370                 return true
9371         }
9372         // match: (MOVHstore [off] {sym} ptr (Bswap16 val) mem)
9373         // result: (MOVHBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
9374         for {
9375                 off := auxIntToInt32(v.AuxInt)
9376                 sym := auxToSym(v.Aux)
9377                 ptr := v_0
9378                 if v_1.Op != OpBswap16 {
9379                         break
9380                 }
9381                 val := v_1.Args[0]
9382                 mem := v_2
9383                 v.reset(OpPPC64MOVHBRstore)
9384                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
9385                 v0.AuxInt = int32ToAuxInt(off)
9386                 v0.Aux = symToAux(sym)
9387                 v0.AddArg(ptr)
9388                 v.AddArg3(v0, val, mem)
9389                 return true
9390         }
9391         return false
9392 }
9393 func rewriteValuePPC64_OpPPC64MOVHstoreidx(v *Value) bool {
9394         v_3 := v.Args[3]
9395         v_2 := v.Args[2]
9396         v_1 := v.Args[1]
9397         v_0 := v.Args[0]
9398         // match: (MOVHstoreidx ptr (MOVDconst [c]) val mem)
9399         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9400         // result: (MOVHstore [int32(c)] ptr val mem)
9401         for {
9402                 ptr := v_0
9403                 if v_1.Op != OpPPC64MOVDconst {
9404                         break
9405                 }
9406                 c := auxIntToInt64(v_1.AuxInt)
9407                 val := v_2
9408                 mem := v_3
9409                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9410                         break
9411                 }
9412                 v.reset(OpPPC64MOVHstore)
9413                 v.AuxInt = int32ToAuxInt(int32(c))
9414                 v.AddArg3(ptr, val, mem)
9415                 return true
9416         }
9417         // match: (MOVHstoreidx (MOVDconst [c]) ptr val mem)
9418         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9419         // result: (MOVHstore [int32(c)] ptr val mem)
9420         for {
9421                 if v_0.Op != OpPPC64MOVDconst {
9422                         break
9423                 }
9424                 c := auxIntToInt64(v_0.AuxInt)
9425                 ptr := v_1
9426                 val := v_2
9427                 mem := v_3
9428                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9429                         break
9430                 }
9431                 v.reset(OpPPC64MOVHstore)
9432                 v.AuxInt = int32ToAuxInt(int32(c))
9433                 v.AddArg3(ptr, val, mem)
9434                 return true
9435         }
9436         // match: (MOVHstoreidx ptr idx (MOVHreg x) mem)
9437         // result: (MOVHstoreidx ptr idx x mem)
9438         for {
9439                 ptr := v_0
9440                 idx := v_1
9441                 if v_2.Op != OpPPC64MOVHreg {
9442                         break
9443                 }
9444                 x := v_2.Args[0]
9445                 mem := v_3
9446                 v.reset(OpPPC64MOVHstoreidx)
9447                 v.AddArg4(ptr, idx, x, mem)
9448                 return true
9449         }
9450         // match: (MOVHstoreidx ptr idx (MOVHZreg x) mem)
9451         // result: (MOVHstoreidx ptr idx x mem)
9452         for {
9453                 ptr := v_0
9454                 idx := v_1
9455                 if v_2.Op != OpPPC64MOVHZreg {
9456                         break
9457                 }
9458                 x := v_2.Args[0]
9459                 mem := v_3
9460                 v.reset(OpPPC64MOVHstoreidx)
9461                 v.AddArg4(ptr, idx, x, mem)
9462                 return true
9463         }
9464         // match: (MOVHstoreidx ptr idx (MOVWreg x) mem)
9465         // result: (MOVHstoreidx ptr idx x mem)
9466         for {
9467                 ptr := v_0
9468                 idx := v_1
9469                 if v_2.Op != OpPPC64MOVWreg {
9470                         break
9471                 }
9472                 x := v_2.Args[0]
9473                 mem := v_3
9474                 v.reset(OpPPC64MOVHstoreidx)
9475                 v.AddArg4(ptr, idx, x, mem)
9476                 return true
9477         }
9478         // match: (MOVHstoreidx ptr idx (MOVWZreg x) mem)
9479         // result: (MOVHstoreidx ptr idx x mem)
9480         for {
9481                 ptr := v_0
9482                 idx := v_1
9483                 if v_2.Op != OpPPC64MOVWZreg {
9484                         break
9485                 }
9486                 x := v_2.Args[0]
9487                 mem := v_3
9488                 v.reset(OpPPC64MOVHstoreidx)
9489                 v.AddArg4(ptr, idx, x, mem)
9490                 return true
9491         }
9492         // match: (MOVHstoreidx ptr idx r:(BRH val) mem)
9493         // cond: r.Uses == 1
9494         // result: (MOVHBRstoreidx ptr idx val mem)
9495         for {
9496                 ptr := v_0
9497                 idx := v_1
9498                 r := v_2
9499                 if r.Op != OpPPC64BRH {
9500                         break
9501                 }
9502                 val := r.Args[0]
9503                 mem := v_3
9504                 if !(r.Uses == 1) {
9505                         break
9506                 }
9507                 v.reset(OpPPC64MOVHBRstoreidx)
9508                 v.AddArg4(ptr, idx, val, mem)
9509                 return true
9510         }
9511         // match: (MOVHstoreidx ptr idx (Bswap16 val) mem)
9512         // result: (MOVHBRstoreidx ptr idx val mem)
9513         for {
9514                 ptr := v_0
9515                 idx := v_1
9516                 if v_2.Op != OpBswap16 {
9517                         break
9518                 }
9519                 val := v_2.Args[0]
9520                 mem := v_3
9521                 v.reset(OpPPC64MOVHBRstoreidx)
9522                 v.AddArg4(ptr, idx, val, mem)
9523                 return true
9524         }
9525         return false
9526 }
9527 func rewriteValuePPC64_OpPPC64MOVHstorezero(v *Value) bool {
9528         v_1 := v.Args[1]
9529         v_0 := v.Args[0]
9530         // match: (MOVHstorezero [off1] {sym} (ADDconst [off2] x) mem)
9531         // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2)))
9532         // result: (MOVHstorezero [off1+int32(off2)] {sym} x mem)
9533         for {
9534                 off1 := auxIntToInt32(v.AuxInt)
9535                 sym := auxToSym(v.Aux)
9536                 if v_0.Op != OpPPC64ADDconst {
9537                         break
9538                 }
9539                 off2 := auxIntToInt64(v_0.AuxInt)
9540                 x := v_0.Args[0]
9541                 mem := v_1
9542                 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
9543                         break
9544                 }
9545                 v.reset(OpPPC64MOVHstorezero)
9546                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9547                 v.Aux = symToAux(sym)
9548                 v.AddArg2(x, mem)
9549                 return true
9550         }
9551         // match: (MOVHstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
9552         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
9553         // result: (MOVHstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
9554         for {
9555                 off1 := auxIntToInt32(v.AuxInt)
9556                 sym1 := auxToSym(v.Aux)
9557                 p := v_0
9558                 if p.Op != OpPPC64MOVDaddr {
9559                         break
9560                 }
9561                 off2 := auxIntToInt32(p.AuxInt)
9562                 sym2 := auxToSym(p.Aux)
9563                 x := p.Args[0]
9564                 mem := v_1
9565                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
9566                         break
9567                 }
9568                 v.reset(OpPPC64MOVHstorezero)
9569                 v.AuxInt = int32ToAuxInt(off1 + off2)
9570                 v.Aux = symToAux(mergeSym(sym1, sym2))
9571                 v.AddArg2(x, mem)
9572                 return true
9573         }
9574         return false
9575 }
9576 func rewriteValuePPC64_OpPPC64MOVWBRstore(v *Value) bool {
9577         v_2 := v.Args[2]
9578         v_1 := v.Args[1]
9579         v_0 := v.Args[0]
9580         // match: (MOVWBRstore ptr (MOVWreg x) mem)
9581         // result: (MOVWBRstore ptr x mem)
9582         for {
9583                 ptr := v_0
9584                 if v_1.Op != OpPPC64MOVWreg {
9585                         break
9586                 }
9587                 x := v_1.Args[0]
9588                 mem := v_2
9589                 v.reset(OpPPC64MOVWBRstore)
9590                 v.AddArg3(ptr, x, mem)
9591                 return true
9592         }
9593         // match: (MOVWBRstore ptr (MOVWZreg x) mem)
9594         // result: (MOVWBRstore ptr x mem)
9595         for {
9596                 ptr := v_0
9597                 if v_1.Op != OpPPC64MOVWZreg {
9598                         break
9599                 }
9600                 x := v_1.Args[0]
9601                 mem := v_2
9602                 v.reset(OpPPC64MOVWBRstore)
9603                 v.AddArg3(ptr, x, mem)
9604                 return true
9605         }
9606         return false
9607 }
9608 func rewriteValuePPC64_OpPPC64MOVWZload(v *Value) bool {
9609         v_1 := v.Args[1]
9610         v_0 := v.Args[0]
9611         // match: (MOVWZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
9612         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
9613         // result: (MOVWZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
9614         for {
9615                 off1 := auxIntToInt32(v.AuxInt)
9616                 sym1 := auxToSym(v.Aux)
9617                 p := v_0
9618                 if p.Op != OpPPC64MOVDaddr {
9619                         break
9620                 }
9621                 off2 := auxIntToInt32(p.AuxInt)
9622                 sym2 := auxToSym(p.Aux)
9623                 ptr := p.Args[0]
9624                 mem := v_1
9625                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
9626                         break
9627                 }
9628                 v.reset(OpPPC64MOVWZload)
9629                 v.AuxInt = int32ToAuxInt(off1 + off2)
9630                 v.Aux = symToAux(mergeSym(sym1, sym2))
9631                 v.AddArg2(ptr, mem)
9632                 return true
9633         }
9634         // match: (MOVWZload [off1] {sym} (ADDconst [off2] x) mem)
9635         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
9636         // result: (MOVWZload [off1+int32(off2)] {sym} x mem)
9637         for {
9638                 off1 := auxIntToInt32(v.AuxInt)
9639                 sym := auxToSym(v.Aux)
9640                 if v_0.Op != OpPPC64ADDconst {
9641                         break
9642                 }
9643                 off2 := auxIntToInt64(v_0.AuxInt)
9644                 x := v_0.Args[0]
9645                 mem := v_1
9646                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
9647                         break
9648                 }
9649                 v.reset(OpPPC64MOVWZload)
9650                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9651                 v.Aux = symToAux(sym)
9652                 v.AddArg2(x, mem)
9653                 return true
9654         }
9655         // match: (MOVWZload [0] {sym} p:(ADD ptr idx) mem)
9656         // cond: sym == nil && p.Uses == 1
9657         // result: (MOVWZloadidx ptr idx mem)
9658         for {
9659                 if auxIntToInt32(v.AuxInt) != 0 {
9660                         break
9661                 }
9662                 sym := auxToSym(v.Aux)
9663                 p := v_0
9664                 if p.Op != OpPPC64ADD {
9665                         break
9666                 }
9667                 idx := p.Args[1]
9668                 ptr := p.Args[0]
9669                 mem := v_1
9670                 if !(sym == nil && p.Uses == 1) {
9671                         break
9672                 }
9673                 v.reset(OpPPC64MOVWZloadidx)
9674                 v.AddArg3(ptr, idx, mem)
9675                 return true
9676         }
9677         return false
9678 }
9679 func rewriteValuePPC64_OpPPC64MOVWZloadidx(v *Value) bool {
9680         v_2 := v.Args[2]
9681         v_1 := v.Args[1]
9682         v_0 := v.Args[0]
9683         // match: (MOVWZloadidx ptr (MOVDconst [c]) mem)
9684         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9685         // result: (MOVWZload [int32(c)] ptr mem)
9686         for {
9687                 ptr := v_0
9688                 if v_1.Op != OpPPC64MOVDconst {
9689                         break
9690                 }
9691                 c := auxIntToInt64(v_1.AuxInt)
9692                 mem := v_2
9693                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9694                         break
9695                 }
9696                 v.reset(OpPPC64MOVWZload)
9697                 v.AuxInt = int32ToAuxInt(int32(c))
9698                 v.AddArg2(ptr, mem)
9699                 return true
9700         }
9701         // match: (MOVWZloadidx (MOVDconst [c]) ptr mem)
9702         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9703         // result: (MOVWZload [int32(c)] ptr mem)
9704         for {
9705                 if v_0.Op != OpPPC64MOVDconst {
9706                         break
9707                 }
9708                 c := auxIntToInt64(v_0.AuxInt)
9709                 ptr := v_1
9710                 mem := v_2
9711                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9712                         break
9713                 }
9714                 v.reset(OpPPC64MOVWZload)
9715                 v.AuxInt = int32ToAuxInt(int32(c))
9716                 v.AddArg2(ptr, mem)
9717                 return true
9718         }
9719         return false
9720 }
9721 func rewriteValuePPC64_OpPPC64MOVWZreg(v *Value) bool {
9722         v_0 := v.Args[0]
9723         b := v.Block
9724         typ := &b.Func.Config.Types
9725         // match: (MOVWZreg y:(Select0 (ANDCCconst [c] _)))
9726         // cond: uint64(c) <= 0xFFFFFFFF
9727         // result: y
9728         for {
9729                 y := v_0
9730                 if y.Op != OpSelect0 {
9731                         break
9732                 }
9733                 y_0 := y.Args[0]
9734                 if y_0.Op != OpPPC64ANDCCconst {
9735                         break
9736                 }
9737                 c := auxIntToInt64(y_0.AuxInt)
9738                 if !(uint64(c) <= 0xFFFFFFFF) {
9739                         break
9740                 }
9741                 v.copyOf(y)
9742                 return true
9743         }
9744         // match: (MOVWZreg y:(AND (MOVDconst [c]) _))
9745         // cond: uint64(c) <= 0xFFFFFFFF
9746         // result: y
9747         for {
9748                 y := v_0
9749                 if y.Op != OpPPC64AND {
9750                         break
9751                 }
9752                 y_0 := y.Args[0]
9753                 y_1 := y.Args[1]
9754                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
9755                         if y_0.Op != OpPPC64MOVDconst {
9756                                 continue
9757                         }
9758                         c := auxIntToInt64(y_0.AuxInt)
9759                         if !(uint64(c) <= 0xFFFFFFFF) {
9760                                 continue
9761                         }
9762                         v.copyOf(y)
9763                         return true
9764                 }
9765                 break
9766         }
9767         // match: (MOVWZreg (SRWconst [c] (MOVBZreg x)))
9768         // result: (SRWconst [c] (MOVBZreg x))
9769         for {
9770                 if v_0.Op != OpPPC64SRWconst {
9771                         break
9772                 }
9773                 c := auxIntToInt64(v_0.AuxInt)
9774                 v_0_0 := v_0.Args[0]
9775                 if v_0_0.Op != OpPPC64MOVBZreg {
9776                         break
9777                 }
9778                 x := v_0_0.Args[0]
9779                 v.reset(OpPPC64SRWconst)
9780                 v.AuxInt = int64ToAuxInt(c)
9781                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
9782                 v0.AddArg(x)
9783                 v.AddArg(v0)
9784                 return true
9785         }
9786         // match: (MOVWZreg (SRWconst [c] (MOVHZreg x)))
9787         // result: (SRWconst [c] (MOVHZreg x))
9788         for {
9789                 if v_0.Op != OpPPC64SRWconst {
9790                         break
9791                 }
9792                 c := auxIntToInt64(v_0.AuxInt)
9793                 v_0_0 := v_0.Args[0]
9794                 if v_0_0.Op != OpPPC64MOVHZreg {
9795                         break
9796                 }
9797                 x := v_0_0.Args[0]
9798                 v.reset(OpPPC64SRWconst)
9799                 v.AuxInt = int64ToAuxInt(c)
9800                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
9801                 v0.AddArg(x)
9802                 v.AddArg(v0)
9803                 return true
9804         }
9805         // match: (MOVWZreg (SRWconst [c] (MOVWZreg x)))
9806         // result: (SRWconst [c] (MOVWZreg x))
9807         for {
9808                 if v_0.Op != OpPPC64SRWconst {
9809                         break
9810                 }
9811                 c := auxIntToInt64(v_0.AuxInt)
9812                 v_0_0 := v_0.Args[0]
9813                 if v_0_0.Op != OpPPC64MOVWZreg {
9814                         break
9815                 }
9816                 x := v_0_0.Args[0]
9817                 v.reset(OpPPC64SRWconst)
9818                 v.AuxInt = int64ToAuxInt(c)
9819                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
9820                 v0.AddArg(x)
9821                 v.AddArg(v0)
9822                 return true
9823         }
9824         // match: (MOVWZreg (SRWconst [c] x))
9825         // cond: sizeof(x.Type) <= 32
9826         // result: (SRWconst [c] x)
9827         for {
9828                 if v_0.Op != OpPPC64SRWconst {
9829                         break
9830                 }
9831                 c := auxIntToInt64(v_0.AuxInt)
9832                 x := v_0.Args[0]
9833                 if !(sizeof(x.Type) <= 32) {
9834                         break
9835                 }
9836                 v.reset(OpPPC64SRWconst)
9837                 v.AuxInt = int64ToAuxInt(c)
9838                 v.AddArg(x)
9839                 return true
9840         }
9841         // match: (MOVWZreg (SRDconst [c] x))
9842         // cond: c>=32
9843         // result: (SRDconst [c] x)
9844         for {
9845                 if v_0.Op != OpPPC64SRDconst {
9846                         break
9847                 }
9848                 c := auxIntToInt64(v_0.AuxInt)
9849                 x := v_0.Args[0]
9850                 if !(c >= 32) {
9851                         break
9852                 }
9853                 v.reset(OpPPC64SRDconst)
9854                 v.AuxInt = int64ToAuxInt(c)
9855                 v.AddArg(x)
9856                 return true
9857         }
9858         // match: (MOVWZreg y:(MOVWZreg _))
9859         // result: y
9860         for {
9861                 y := v_0
9862                 if y.Op != OpPPC64MOVWZreg {
9863                         break
9864                 }
9865                 v.copyOf(y)
9866                 return true
9867         }
9868         // match: (MOVWZreg y:(MOVHZreg _))
9869         // result: y
9870         for {
9871                 y := v_0
9872                 if y.Op != OpPPC64MOVHZreg {
9873                         break
9874                 }
9875                 v.copyOf(y)
9876                 return true
9877         }
9878         // match: (MOVWZreg y:(MOVBZreg _))
9879         // result: y
9880         for {
9881                 y := v_0
9882                 if y.Op != OpPPC64MOVBZreg {
9883                         break
9884                 }
9885                 v.copyOf(y)
9886                 return true
9887         }
9888         // match: (MOVWZreg y:(MOVHBRload _ _))
9889         // result: y
9890         for {
9891                 y := v_0
9892                 if y.Op != OpPPC64MOVHBRload {
9893                         break
9894                 }
9895                 v.copyOf(y)
9896                 return true
9897         }
9898         // match: (MOVWZreg y:(MOVWBRload _ _))
9899         // result: y
9900         for {
9901                 y := v_0
9902                 if y.Op != OpPPC64MOVWBRload {
9903                         break
9904                 }
9905                 v.copyOf(y)
9906                 return true
9907         }
9908         // match: (MOVWZreg y:(MOVWreg x))
9909         // result: (MOVWZreg x)
9910         for {
9911                 y := v_0
9912                 if y.Op != OpPPC64MOVWreg {
9913                         break
9914                 }
9915                 x := y.Args[0]
9916                 v.reset(OpPPC64MOVWZreg)
9917                 v.AddArg(x)
9918                 return true
9919         }
9920         // match: (MOVWZreg (OR <t> x (MOVWZreg y)))
9921         // result: (MOVWZreg (OR <t> x y))
9922         for {
9923                 if v_0.Op != OpPPC64OR {
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, OpPPC64OR, t)
9938                         v0.AddArg2(x, y)
9939                         v.AddArg(v0)
9940                         return true
9941                 }
9942                 break
9943         }
9944         // match: (MOVWZreg (XOR <t> x (MOVWZreg y)))
9945         // result: (MOVWZreg (XOR <t> x y))
9946         for {
9947                 if v_0.Op != OpPPC64XOR {
9948                         break
9949                 }
9950                 t := v_0.Type
9951                 _ = v_0.Args[1]
9952                 v_0_0 := v_0.Args[0]
9953                 v_0_1 := v_0.Args[1]
9954                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9955                         x := v_0_0
9956                         if v_0_1.Op != OpPPC64MOVWZreg {
9957                                 continue
9958                         }
9959                         y := v_0_1.Args[0]
9960                         v.reset(OpPPC64MOVWZreg)
9961                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
9962                         v0.AddArg2(x, y)
9963                         v.AddArg(v0)
9964                         return true
9965                 }
9966                 break
9967         }
9968         // match: (MOVWZreg (AND <t> x (MOVWZreg y)))
9969         // result: (MOVWZreg (AND <t> x y))
9970         for {
9971                 if v_0.Op != OpPPC64AND {
9972                         break
9973                 }
9974                 t := v_0.Type
9975                 _ = v_0.Args[1]
9976                 v_0_0 := v_0.Args[0]
9977                 v_0_1 := v_0.Args[1]
9978                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9979                         x := v_0_0
9980                         if v_0_1.Op != OpPPC64MOVWZreg {
9981                                 continue
9982                         }
9983                         y := v_0_1.Args[0]
9984                         v.reset(OpPPC64MOVWZreg)
9985                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
9986                         v0.AddArg2(x, y)
9987                         v.AddArg(v0)
9988                         return true
9989                 }
9990                 break
9991         }
9992         // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x))))
9993         // result: z
9994         for {
9995                 z := v_0
9996                 if z.Op != OpSelect0 {
9997                         break
9998                 }
9999                 z_0 := z.Args[0]
10000                 if z_0.Op != OpPPC64ANDCCconst {
10001                         break
10002                 }
10003                 z_0_0 := z_0.Args[0]
10004                 if z_0_0.Op != OpPPC64MOVBZload {
10005                         break
10006                 }
10007                 v.copyOf(z)
10008                 return true
10009         }
10010         // match: (MOVWZreg z:(AND y (MOVWZload ptr x)))
10011         // result: z
10012         for {
10013                 z := v_0
10014                 if z.Op != OpPPC64AND {
10015                         break
10016                 }
10017                 _ = z.Args[1]
10018                 z_0 := z.Args[0]
10019                 z_1 := z.Args[1]
10020                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
10021                         if z_1.Op != OpPPC64MOVWZload {
10022                                 continue
10023                         }
10024                         v.copyOf(z)
10025                         return true
10026                 }
10027                 break
10028         }
10029         // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVHZload ptr x))))
10030         // result: z
10031         for {
10032                 z := v_0
10033                 if z.Op != OpSelect0 {
10034                         break
10035                 }
10036                 z_0 := z.Args[0]
10037                 if z_0.Op != OpPPC64ANDCCconst {
10038                         break
10039                 }
10040                 z_0_0 := z_0.Args[0]
10041                 if z_0_0.Op != OpPPC64MOVHZload {
10042                         break
10043                 }
10044                 v.copyOf(z)
10045                 return true
10046         }
10047         // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVWZload ptr x))))
10048         // result: z
10049         for {
10050                 z := v_0
10051                 if z.Op != OpSelect0 {
10052                         break
10053                 }
10054                 z_0 := z.Args[0]
10055                 if z_0.Op != OpPPC64ANDCCconst {
10056                         break
10057                 }
10058                 z_0_0 := z_0.Args[0]
10059                 if z_0_0.Op != OpPPC64MOVWZload {
10060                         break
10061                 }
10062                 v.copyOf(z)
10063                 return true
10064         }
10065         // match: (MOVWZreg x:(MOVBZload _ _))
10066         // result: x
10067         for {
10068                 x := v_0
10069                 if x.Op != OpPPC64MOVBZload {
10070                         break
10071                 }
10072                 v.copyOf(x)
10073                 return true
10074         }
10075         // match: (MOVWZreg x:(MOVBZloadidx _ _ _))
10076         // result: x
10077         for {
10078                 x := v_0
10079                 if x.Op != OpPPC64MOVBZloadidx {
10080                         break
10081                 }
10082                 v.copyOf(x)
10083                 return true
10084         }
10085         // match: (MOVWZreg x:(MOVHZload _ _))
10086         // result: x
10087         for {
10088                 x := v_0
10089                 if x.Op != OpPPC64MOVHZload {
10090                         break
10091                 }
10092                 v.copyOf(x)
10093                 return true
10094         }
10095         // match: (MOVWZreg x:(MOVHZloadidx _ _ _))
10096         // result: x
10097         for {
10098                 x := v_0
10099                 if x.Op != OpPPC64MOVHZloadidx {
10100                         break
10101                 }
10102                 v.copyOf(x)
10103                 return true
10104         }
10105         // match: (MOVWZreg x:(MOVWZload _ _))
10106         // result: x
10107         for {
10108                 x := v_0
10109                 if x.Op != OpPPC64MOVWZload {
10110                         break
10111                 }
10112                 v.copyOf(x)
10113                 return true
10114         }
10115         // match: (MOVWZreg x:(MOVWZloadidx _ _ _))
10116         // result: x
10117         for {
10118                 x := v_0
10119                 if x.Op != OpPPC64MOVWZloadidx {
10120                         break
10121                 }
10122                 v.copyOf(x)
10123                 return true
10124         }
10125         // match: (MOVWZreg x:(Select0 (LoweredAtomicLoad32 _ _)))
10126         // result: x
10127         for {
10128                 x := v_0
10129                 if x.Op != OpSelect0 {
10130                         break
10131                 }
10132                 x_0 := x.Args[0]
10133                 if x_0.Op != OpPPC64LoweredAtomicLoad32 {
10134                         break
10135                 }
10136                 v.copyOf(x)
10137                 return true
10138         }
10139         // match: (MOVWZreg x:(Arg <t>))
10140         // cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !t.IsSigned()
10141         // result: x
10142         for {
10143                 x := v_0
10144                 if x.Op != OpArg {
10145                         break
10146                 }
10147                 t := x.Type
10148                 if !((is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !t.IsSigned()) {
10149                         break
10150                 }
10151                 v.copyOf(x)
10152                 return true
10153         }
10154         // match: (MOVWZreg (MOVDconst [c]))
10155         // result: (MOVDconst [int64(uint32(c))])
10156         for {
10157                 if v_0.Op != OpPPC64MOVDconst {
10158                         break
10159                 }
10160                 c := auxIntToInt64(v_0.AuxInt)
10161                 v.reset(OpPPC64MOVDconst)
10162                 v.AuxInt = int64ToAuxInt(int64(uint32(c)))
10163                 return true
10164         }
10165         return false
10166 }
10167 func rewriteValuePPC64_OpPPC64MOVWload(v *Value) bool {
10168         v_1 := v.Args[1]
10169         v_0 := v.Args[0]
10170         // match: (MOVWload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
10171         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
10172         // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
10173         for {
10174                 off1 := auxIntToInt32(v.AuxInt)
10175                 sym1 := auxToSym(v.Aux)
10176                 p := v_0
10177                 if p.Op != OpPPC64MOVDaddr {
10178                         break
10179                 }
10180                 off2 := auxIntToInt32(p.AuxInt)
10181                 sym2 := auxToSym(p.Aux)
10182                 ptr := p.Args[0]
10183                 mem := v_1
10184                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
10185                         break
10186                 }
10187                 v.reset(OpPPC64MOVWload)
10188                 v.AuxInt = int32ToAuxInt(off1 + off2)
10189                 v.Aux = symToAux(mergeSym(sym1, sym2))
10190                 v.AddArg2(ptr, mem)
10191                 return true
10192         }
10193         // match: (MOVWload [off1] {sym} (ADDconst [off2] x) mem)
10194         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
10195         // result: (MOVWload [off1+int32(off2)] {sym} x mem)
10196         for {
10197                 off1 := auxIntToInt32(v.AuxInt)
10198                 sym := auxToSym(v.Aux)
10199                 if v_0.Op != OpPPC64ADDconst {
10200                         break
10201                 }
10202                 off2 := auxIntToInt64(v_0.AuxInt)
10203                 x := v_0.Args[0]
10204                 mem := v_1
10205                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
10206                         break
10207                 }
10208                 v.reset(OpPPC64MOVWload)
10209                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10210                 v.Aux = symToAux(sym)
10211                 v.AddArg2(x, mem)
10212                 return true
10213         }
10214         // match: (MOVWload [0] {sym} p:(ADD ptr idx) mem)
10215         // cond: sym == nil && p.Uses == 1
10216         // result: (MOVWloadidx ptr idx mem)
10217         for {
10218                 if auxIntToInt32(v.AuxInt) != 0 {
10219                         break
10220                 }
10221                 sym := auxToSym(v.Aux)
10222                 p := v_0
10223                 if p.Op != OpPPC64ADD {
10224                         break
10225                 }
10226                 idx := p.Args[1]
10227                 ptr := p.Args[0]
10228                 mem := v_1
10229                 if !(sym == nil && p.Uses == 1) {
10230                         break
10231                 }
10232                 v.reset(OpPPC64MOVWloadidx)
10233                 v.AddArg3(ptr, idx, mem)
10234                 return true
10235         }
10236         return false
10237 }
10238 func rewriteValuePPC64_OpPPC64MOVWloadidx(v *Value) bool {
10239         v_2 := v.Args[2]
10240         v_1 := v.Args[1]
10241         v_0 := v.Args[0]
10242         // match: (MOVWloadidx ptr (MOVDconst [c]) mem)
10243         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
10244         // result: (MOVWload [int32(c)] ptr mem)
10245         for {
10246                 ptr := v_0
10247                 if v_1.Op != OpPPC64MOVDconst {
10248                         break
10249                 }
10250                 c := auxIntToInt64(v_1.AuxInt)
10251                 mem := v_2
10252                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10253                         break
10254                 }
10255                 v.reset(OpPPC64MOVWload)
10256                 v.AuxInt = int32ToAuxInt(int32(c))
10257                 v.AddArg2(ptr, mem)
10258                 return true
10259         }
10260         // match: (MOVWloadidx (MOVDconst [c]) ptr mem)
10261         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
10262         // result: (MOVWload [int32(c)] ptr mem)
10263         for {
10264                 if v_0.Op != OpPPC64MOVDconst {
10265                         break
10266                 }
10267                 c := auxIntToInt64(v_0.AuxInt)
10268                 ptr := v_1
10269                 mem := v_2
10270                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10271                         break
10272                 }
10273                 v.reset(OpPPC64MOVWload)
10274                 v.AuxInt = int32ToAuxInt(int32(c))
10275                 v.AddArg2(ptr, mem)
10276                 return true
10277         }
10278         return false
10279 }
10280 func rewriteValuePPC64_OpPPC64MOVWreg(v *Value) bool {
10281         v_0 := v.Args[0]
10282         b := v.Block
10283         typ := &b.Func.Config.Types
10284         // match: (MOVWreg y:(Select0 (ANDCCconst [c] _)))
10285         // cond: uint64(c) <= 0xFFFF
10286         // result: y
10287         for {
10288                 y := v_0
10289                 if y.Op != OpSelect0 {
10290                         break
10291                 }
10292                 y_0 := y.Args[0]
10293                 if y_0.Op != OpPPC64ANDCCconst {
10294                         break
10295                 }
10296                 c := auxIntToInt64(y_0.AuxInt)
10297                 if !(uint64(c) <= 0xFFFF) {
10298                         break
10299                 }
10300                 v.copyOf(y)
10301                 return true
10302         }
10303         // match: (MOVWreg y:(AND (MOVDconst [c]) _))
10304         // cond: uint64(c) <= 0x7FFFFFFF
10305         // result: y
10306         for {
10307                 y := v_0
10308                 if y.Op != OpPPC64AND {
10309                         break
10310                 }
10311                 y_0 := y.Args[0]
10312                 y_1 := y.Args[1]
10313                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
10314                         if y_0.Op != OpPPC64MOVDconst {
10315                                 continue
10316                         }
10317                         c := auxIntToInt64(y_0.AuxInt)
10318                         if !(uint64(c) <= 0x7FFFFFFF) {
10319                                 continue
10320                         }
10321                         v.copyOf(y)
10322                         return true
10323                 }
10324                 break
10325         }
10326         // match: (MOVWreg (SRAWconst [c] (MOVBreg x)))
10327         // result: (SRAWconst [c] (MOVBreg x))
10328         for {
10329                 if v_0.Op != OpPPC64SRAWconst {
10330                         break
10331                 }
10332                 c := auxIntToInt64(v_0.AuxInt)
10333                 v_0_0 := v_0.Args[0]
10334                 if v_0_0.Op != OpPPC64MOVBreg {
10335                         break
10336                 }
10337                 x := v_0_0.Args[0]
10338                 v.reset(OpPPC64SRAWconst)
10339                 v.AuxInt = int64ToAuxInt(c)
10340                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
10341                 v0.AddArg(x)
10342                 v.AddArg(v0)
10343                 return true
10344         }
10345         // match: (MOVWreg (SRAWconst [c] (MOVHreg x)))
10346         // result: (SRAWconst [c] (MOVHreg x))
10347         for {
10348                 if v_0.Op != OpPPC64SRAWconst {
10349                         break
10350                 }
10351                 c := auxIntToInt64(v_0.AuxInt)
10352                 v_0_0 := v_0.Args[0]
10353                 if v_0_0.Op != OpPPC64MOVHreg {
10354                         break
10355                 }
10356                 x := v_0_0.Args[0]
10357                 v.reset(OpPPC64SRAWconst)
10358                 v.AuxInt = int64ToAuxInt(c)
10359                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
10360                 v0.AddArg(x)
10361                 v.AddArg(v0)
10362                 return true
10363         }
10364         // match: (MOVWreg (SRAWconst [c] (MOVWreg x)))
10365         // result: (SRAWconst [c] (MOVWreg x))
10366         for {
10367                 if v_0.Op != OpPPC64SRAWconst {
10368                         break
10369                 }
10370                 c := auxIntToInt64(v_0.AuxInt)
10371                 v_0_0 := v_0.Args[0]
10372                 if v_0_0.Op != OpPPC64MOVWreg {
10373                         break
10374                 }
10375                 x := v_0_0.Args[0]
10376                 v.reset(OpPPC64SRAWconst)
10377                 v.AuxInt = int64ToAuxInt(c)
10378                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWreg, typ.Int64)
10379                 v0.AddArg(x)
10380                 v.AddArg(v0)
10381                 return true
10382         }
10383         // match: (MOVWreg (SRAWconst [c] x))
10384         // cond: sizeof(x.Type) <= 32
10385         // result: (SRAWconst [c] x)
10386         for {
10387                 if v_0.Op != OpPPC64SRAWconst {
10388                         break
10389                 }
10390                 c := auxIntToInt64(v_0.AuxInt)
10391                 x := v_0.Args[0]
10392                 if !(sizeof(x.Type) <= 32) {
10393                         break
10394                 }
10395                 v.reset(OpPPC64SRAWconst)
10396                 v.AuxInt = int64ToAuxInt(c)
10397                 v.AddArg(x)
10398                 return true
10399         }
10400         // match: (MOVWreg (SRDconst [c] x))
10401         // cond: c>32
10402         // result: (SRDconst [c] x)
10403         for {
10404                 if v_0.Op != OpPPC64SRDconst {
10405                         break
10406                 }
10407                 c := auxIntToInt64(v_0.AuxInt)
10408                 x := v_0.Args[0]
10409                 if !(c > 32) {
10410                         break
10411                 }
10412                 v.reset(OpPPC64SRDconst)
10413                 v.AuxInt = int64ToAuxInt(c)
10414                 v.AddArg(x)
10415                 return true
10416         }
10417         // match: (MOVWreg (SRADconst [c] x))
10418         // cond: c>=32
10419         // result: (SRADconst [c] x)
10420         for {
10421                 if v_0.Op != OpPPC64SRADconst {
10422                         break
10423                 }
10424                 c := auxIntToInt64(v_0.AuxInt)
10425                 x := v_0.Args[0]
10426                 if !(c >= 32) {
10427                         break
10428                 }
10429                 v.reset(OpPPC64SRADconst)
10430                 v.AuxInt = int64ToAuxInt(c)
10431                 v.AddArg(x)
10432                 return true
10433         }
10434         // match: (MOVWreg (SRDconst [c] x))
10435         // cond: c==32
10436         // result: (SRADconst [c] x)
10437         for {
10438                 if v_0.Op != OpPPC64SRDconst {
10439                         break
10440                 }
10441                 c := auxIntToInt64(v_0.AuxInt)
10442                 x := v_0.Args[0]
10443                 if !(c == 32) {
10444                         break
10445                 }
10446                 v.reset(OpPPC64SRADconst)
10447                 v.AuxInt = int64ToAuxInt(c)
10448                 v.AddArg(x)
10449                 return true
10450         }
10451         // match: (MOVWreg y:(MOVWreg _))
10452         // result: y
10453         for {
10454                 y := v_0
10455                 if y.Op != OpPPC64MOVWreg {
10456                         break
10457                 }
10458                 v.copyOf(y)
10459                 return true
10460         }
10461         // match: (MOVWreg y:(MOVHreg _))
10462         // result: y
10463         for {
10464                 y := v_0
10465                 if y.Op != OpPPC64MOVHreg {
10466                         break
10467                 }
10468                 v.copyOf(y)
10469                 return true
10470         }
10471         // match: (MOVWreg y:(MOVBreg _))
10472         // result: y
10473         for {
10474                 y := v_0
10475                 if y.Op != OpPPC64MOVBreg {
10476                         break
10477                 }
10478                 v.copyOf(y)
10479                 return true
10480         }
10481         // match: (MOVWreg y:(MOVWZreg x))
10482         // result: (MOVWreg x)
10483         for {
10484                 y := v_0
10485                 if y.Op != OpPPC64MOVWZreg {
10486                         break
10487                 }
10488                 x := y.Args[0]
10489                 v.reset(OpPPC64MOVWreg)
10490                 v.AddArg(x)
10491                 return true
10492         }
10493         // match: (MOVWreg x:(MOVHload _ _))
10494         // result: x
10495         for {
10496                 x := v_0
10497                 if x.Op != OpPPC64MOVHload {
10498                         break
10499                 }
10500                 v.copyOf(x)
10501                 return true
10502         }
10503         // match: (MOVWreg x:(MOVHloadidx _ _ _))
10504         // result: x
10505         for {
10506                 x := v_0
10507                 if x.Op != OpPPC64MOVHloadidx {
10508                         break
10509                 }
10510                 v.copyOf(x)
10511                 return true
10512         }
10513         // match: (MOVWreg x:(MOVWload _ _))
10514         // result: x
10515         for {
10516                 x := v_0
10517                 if x.Op != OpPPC64MOVWload {
10518                         break
10519                 }
10520                 v.copyOf(x)
10521                 return true
10522         }
10523         // match: (MOVWreg x:(MOVWloadidx _ _ _))
10524         // result: x
10525         for {
10526                 x := v_0
10527                 if x.Op != OpPPC64MOVWloadidx {
10528                         break
10529                 }
10530                 v.copyOf(x)
10531                 return true
10532         }
10533         // match: (MOVWreg x:(Arg <t>))
10534         // cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && t.IsSigned()
10535         // result: x
10536         for {
10537                 x := v_0
10538                 if x.Op != OpArg {
10539                         break
10540                 }
10541                 t := x.Type
10542                 if !((is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && t.IsSigned()) {
10543                         break
10544                 }
10545                 v.copyOf(x)
10546                 return true
10547         }
10548         // match: (MOVWreg (MOVDconst [c]))
10549         // result: (MOVDconst [int64(int32(c))])
10550         for {
10551                 if v_0.Op != OpPPC64MOVDconst {
10552                         break
10553                 }
10554                 c := auxIntToInt64(v_0.AuxInt)
10555                 v.reset(OpPPC64MOVDconst)
10556                 v.AuxInt = int64ToAuxInt(int64(int32(c)))
10557                 return true
10558         }
10559         return false
10560 }
10561 func rewriteValuePPC64_OpPPC64MOVWstore(v *Value) bool {
10562         v_2 := v.Args[2]
10563         v_1 := v.Args[1]
10564         v_0 := v.Args[0]
10565         b := v.Block
10566         // match: (MOVWstore [off1] {sym} (ADDconst [off2] x) val mem)
10567         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
10568         // result: (MOVWstore [off1+int32(off2)] {sym} x val mem)
10569         for {
10570                 off1 := auxIntToInt32(v.AuxInt)
10571                 sym := auxToSym(v.Aux)
10572                 if v_0.Op != OpPPC64ADDconst {
10573                         break
10574                 }
10575                 off2 := auxIntToInt64(v_0.AuxInt)
10576                 x := v_0.Args[0]
10577                 val := v_1
10578                 mem := v_2
10579                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
10580                         break
10581                 }
10582                 v.reset(OpPPC64MOVWstore)
10583                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10584                 v.Aux = symToAux(sym)
10585                 v.AddArg3(x, val, mem)
10586                 return true
10587         }
10588         // match: (MOVWstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
10589         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
10590         // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
10591         for {
10592                 off1 := auxIntToInt32(v.AuxInt)
10593                 sym1 := auxToSym(v.Aux)
10594                 p := v_0
10595                 if p.Op != OpPPC64MOVDaddr {
10596                         break
10597                 }
10598                 off2 := auxIntToInt32(p.AuxInt)
10599                 sym2 := auxToSym(p.Aux)
10600                 ptr := p.Args[0]
10601                 val := v_1
10602                 mem := v_2
10603                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
10604                         break
10605                 }
10606                 v.reset(OpPPC64MOVWstore)
10607                 v.AuxInt = int32ToAuxInt(off1 + off2)
10608                 v.Aux = symToAux(mergeSym(sym1, sym2))
10609                 v.AddArg3(ptr, val, mem)
10610                 return true
10611         }
10612         // match: (MOVWstore [off] {sym} ptr (MOVDconst [0]) mem)
10613         // result: (MOVWstorezero [off] {sym} ptr mem)
10614         for {
10615                 off := auxIntToInt32(v.AuxInt)
10616                 sym := auxToSym(v.Aux)
10617                 ptr := v_0
10618                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
10619                         break
10620                 }
10621                 mem := v_2
10622                 v.reset(OpPPC64MOVWstorezero)
10623                 v.AuxInt = int32ToAuxInt(off)
10624                 v.Aux = symToAux(sym)
10625                 v.AddArg2(ptr, mem)
10626                 return true
10627         }
10628         // match: (MOVWstore [0] {sym} p:(ADD ptr idx) val mem)
10629         // cond: sym == nil && p.Uses == 1
10630         // result: (MOVWstoreidx ptr idx val mem)
10631         for {
10632                 if auxIntToInt32(v.AuxInt) != 0 {
10633                         break
10634                 }
10635                 sym := auxToSym(v.Aux)
10636                 p := v_0
10637                 if p.Op != OpPPC64ADD {
10638                         break
10639                 }
10640                 idx := p.Args[1]
10641                 ptr := p.Args[0]
10642                 val := v_1
10643                 mem := v_2
10644                 if !(sym == nil && p.Uses == 1) {
10645                         break
10646                 }
10647                 v.reset(OpPPC64MOVWstoreidx)
10648                 v.AddArg4(ptr, idx, val, mem)
10649                 return true
10650         }
10651         // match: (MOVWstore [off] {sym} ptr (MOVWreg x) mem)
10652         // result: (MOVWstore [off] {sym} ptr x mem)
10653         for {
10654                 off := auxIntToInt32(v.AuxInt)
10655                 sym := auxToSym(v.Aux)
10656                 ptr := v_0
10657                 if v_1.Op != OpPPC64MOVWreg {
10658                         break
10659                 }
10660                 x := v_1.Args[0]
10661                 mem := v_2
10662                 v.reset(OpPPC64MOVWstore)
10663                 v.AuxInt = int32ToAuxInt(off)
10664                 v.Aux = symToAux(sym)
10665                 v.AddArg3(ptr, x, mem)
10666                 return true
10667         }
10668         // match: (MOVWstore [off] {sym} ptr (MOVWZreg x) mem)
10669         // result: (MOVWstore [off] {sym} ptr x mem)
10670         for {
10671                 off := auxIntToInt32(v.AuxInt)
10672                 sym := auxToSym(v.Aux)
10673                 ptr := v_0
10674                 if v_1.Op != OpPPC64MOVWZreg {
10675                         break
10676                 }
10677                 x := v_1.Args[0]
10678                 mem := v_2
10679                 v.reset(OpPPC64MOVWstore)
10680                 v.AuxInt = int32ToAuxInt(off)
10681                 v.Aux = symToAux(sym)
10682                 v.AddArg3(ptr, x, mem)
10683                 return true
10684         }
10685         // match: (MOVWstore [off] {sym} ptr r:(BRW val) mem)
10686         // cond: r.Uses == 1
10687         // result: (MOVWBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
10688         for {
10689                 off := auxIntToInt32(v.AuxInt)
10690                 sym := auxToSym(v.Aux)
10691                 ptr := v_0
10692                 r := v_1
10693                 if r.Op != OpPPC64BRW {
10694                         break
10695                 }
10696                 val := r.Args[0]
10697                 mem := v_2
10698                 if !(r.Uses == 1) {
10699                         break
10700                 }
10701                 v.reset(OpPPC64MOVWBRstore)
10702                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
10703                 v0.AuxInt = int32ToAuxInt(off)
10704                 v0.Aux = symToAux(sym)
10705                 v0.AddArg(ptr)
10706                 v.AddArg3(v0, val, mem)
10707                 return true
10708         }
10709         // match: (MOVWstore [off] {sym} ptr (Bswap32 val) mem)
10710         // result: (MOVWBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
10711         for {
10712                 off := auxIntToInt32(v.AuxInt)
10713                 sym := auxToSym(v.Aux)
10714                 ptr := v_0
10715                 if v_1.Op != OpBswap32 {
10716                         break
10717                 }
10718                 val := v_1.Args[0]
10719                 mem := v_2
10720                 v.reset(OpPPC64MOVWBRstore)
10721                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
10722                 v0.AuxInt = int32ToAuxInt(off)
10723                 v0.Aux = symToAux(sym)
10724                 v0.AddArg(ptr)
10725                 v.AddArg3(v0, val, mem)
10726                 return true
10727         }
10728         return false
10729 }
10730 func rewriteValuePPC64_OpPPC64MOVWstoreidx(v *Value) bool {
10731         v_3 := v.Args[3]
10732         v_2 := v.Args[2]
10733         v_1 := v.Args[1]
10734         v_0 := v.Args[0]
10735         // match: (MOVWstoreidx ptr (MOVDconst [c]) val mem)
10736         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
10737         // result: (MOVWstore [int32(c)] ptr val mem)
10738         for {
10739                 ptr := v_0
10740                 if v_1.Op != OpPPC64MOVDconst {
10741                         break
10742                 }
10743                 c := auxIntToInt64(v_1.AuxInt)
10744                 val := v_2
10745                 mem := v_3
10746                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10747                         break
10748                 }
10749                 v.reset(OpPPC64MOVWstore)
10750                 v.AuxInt = int32ToAuxInt(int32(c))
10751                 v.AddArg3(ptr, val, mem)
10752                 return true
10753         }
10754         // match: (MOVWstoreidx (MOVDconst [c]) ptr val mem)
10755         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
10756         // result: (MOVWstore [int32(c)] ptr val mem)
10757         for {
10758                 if v_0.Op != OpPPC64MOVDconst {
10759                         break
10760                 }
10761                 c := auxIntToInt64(v_0.AuxInt)
10762                 ptr := v_1
10763                 val := v_2
10764                 mem := v_3
10765                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10766                         break
10767                 }
10768                 v.reset(OpPPC64MOVWstore)
10769                 v.AuxInt = int32ToAuxInt(int32(c))
10770                 v.AddArg3(ptr, val, mem)
10771                 return true
10772         }
10773         // match: (MOVWstoreidx ptr idx (MOVWreg x) mem)
10774         // result: (MOVWstoreidx ptr idx x mem)
10775         for {
10776                 ptr := v_0
10777                 idx := v_1
10778                 if v_2.Op != OpPPC64MOVWreg {
10779                         break
10780                 }
10781                 x := v_2.Args[0]
10782                 mem := v_3
10783                 v.reset(OpPPC64MOVWstoreidx)
10784                 v.AddArg4(ptr, idx, x, mem)
10785                 return true
10786         }
10787         // match: (MOVWstoreidx ptr idx (MOVWZreg x) mem)
10788         // result: (MOVWstoreidx ptr idx x mem)
10789         for {
10790                 ptr := v_0
10791                 idx := v_1
10792                 if v_2.Op != OpPPC64MOVWZreg {
10793                         break
10794                 }
10795                 x := v_2.Args[0]
10796                 mem := v_3
10797                 v.reset(OpPPC64MOVWstoreidx)
10798                 v.AddArg4(ptr, idx, x, mem)
10799                 return true
10800         }
10801         // match: (MOVWstoreidx ptr idx r:(BRW val) mem)
10802         // cond: r.Uses == 1
10803         // result: (MOVWBRstoreidx ptr idx val mem)
10804         for {
10805                 ptr := v_0
10806                 idx := v_1
10807                 r := v_2
10808                 if r.Op != OpPPC64BRW {
10809                         break
10810                 }
10811                 val := r.Args[0]
10812                 mem := v_3
10813                 if !(r.Uses == 1) {
10814                         break
10815                 }
10816                 v.reset(OpPPC64MOVWBRstoreidx)
10817                 v.AddArg4(ptr, idx, val, mem)
10818                 return true
10819         }
10820         // match: (MOVWstoreidx ptr idx (Bswap32 val) mem)
10821         // result: (MOVWBRstoreidx ptr idx val mem)
10822         for {
10823                 ptr := v_0
10824                 idx := v_1
10825                 if v_2.Op != OpBswap32 {
10826                         break
10827                 }
10828                 val := v_2.Args[0]
10829                 mem := v_3
10830                 v.reset(OpPPC64MOVWBRstoreidx)
10831                 v.AddArg4(ptr, idx, val, mem)
10832                 return true
10833         }
10834         return false
10835 }
10836 func rewriteValuePPC64_OpPPC64MOVWstorezero(v *Value) bool {
10837         v_1 := v.Args[1]
10838         v_0 := v.Args[0]
10839         // match: (MOVWstorezero [off1] {sym} (ADDconst [off2] x) mem)
10840         // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2)))
10841         // result: (MOVWstorezero [off1+int32(off2)] {sym} x mem)
10842         for {
10843                 off1 := auxIntToInt32(v.AuxInt)
10844                 sym := auxToSym(v.Aux)
10845                 if v_0.Op != OpPPC64ADDconst {
10846                         break
10847                 }
10848                 off2 := auxIntToInt64(v_0.AuxInt)
10849                 x := v_0.Args[0]
10850                 mem := v_1
10851                 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
10852                         break
10853                 }
10854                 v.reset(OpPPC64MOVWstorezero)
10855                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10856                 v.Aux = symToAux(sym)
10857                 v.AddArg2(x, mem)
10858                 return true
10859         }
10860         // match: (MOVWstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
10861         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
10862         // result: (MOVWstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
10863         for {
10864                 off1 := auxIntToInt32(v.AuxInt)
10865                 sym1 := auxToSym(v.Aux)
10866                 p := v_0
10867                 if p.Op != OpPPC64MOVDaddr {
10868                         break
10869                 }
10870                 off2 := auxIntToInt32(p.AuxInt)
10871                 sym2 := auxToSym(p.Aux)
10872                 x := p.Args[0]
10873                 mem := v_1
10874                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
10875                         break
10876                 }
10877                 v.reset(OpPPC64MOVWstorezero)
10878                 v.AuxInt = int32ToAuxInt(off1 + off2)
10879                 v.Aux = symToAux(mergeSym(sym1, sym2))
10880                 v.AddArg2(x, mem)
10881                 return true
10882         }
10883         return false
10884 }
10885 func rewriteValuePPC64_OpPPC64MTVSRD(v *Value) bool {
10886         v_0 := v.Args[0]
10887         b := v.Block
10888         typ := &b.Func.Config.Types
10889         // match: (MTVSRD (MOVDconst [c]))
10890         // cond: !math.IsNaN(math.Float64frombits(uint64(c)))
10891         // result: (FMOVDconst [math.Float64frombits(uint64(c))])
10892         for {
10893                 if v_0.Op != OpPPC64MOVDconst {
10894                         break
10895                 }
10896                 c := auxIntToInt64(v_0.AuxInt)
10897                 if !(!math.IsNaN(math.Float64frombits(uint64(c)))) {
10898                         break
10899                 }
10900                 v.reset(OpPPC64FMOVDconst)
10901                 v.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c)))
10902                 return true
10903         }
10904         // match: (MTVSRD x:(MOVDload [off] {sym} ptr mem))
10905         // cond: x.Uses == 1 && clobber(x)
10906         // result: @x.Block (FMOVDload [off] {sym} ptr mem)
10907         for {
10908                 x := v_0
10909                 if x.Op != OpPPC64MOVDload {
10910                         break
10911                 }
10912                 off := auxIntToInt32(x.AuxInt)
10913                 sym := auxToSym(x.Aux)
10914                 mem := x.Args[1]
10915                 ptr := x.Args[0]
10916                 if !(x.Uses == 1 && clobber(x)) {
10917                         break
10918                 }
10919                 b = x.Block
10920                 v0 := b.NewValue0(x.Pos, OpPPC64FMOVDload, typ.Float64)
10921                 v.copyOf(v0)
10922                 v0.AuxInt = int32ToAuxInt(off)
10923                 v0.Aux = symToAux(sym)
10924                 v0.AddArg2(ptr, mem)
10925                 return true
10926         }
10927         return false
10928 }
10929 func rewriteValuePPC64_OpPPC64MULLD(v *Value) bool {
10930         v_1 := v.Args[1]
10931         v_0 := v.Args[0]
10932         // match: (MULLD x (MOVDconst [c]))
10933         // cond: is16Bit(c)
10934         // result: (MULLDconst [int32(c)] x)
10935         for {
10936                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10937                         x := v_0
10938                         if v_1.Op != OpPPC64MOVDconst {
10939                                 continue
10940                         }
10941                         c := auxIntToInt64(v_1.AuxInt)
10942                         if !(is16Bit(c)) {
10943                                 continue
10944                         }
10945                         v.reset(OpPPC64MULLDconst)
10946                         v.AuxInt = int32ToAuxInt(int32(c))
10947                         v.AddArg(x)
10948                         return true
10949                 }
10950                 break
10951         }
10952         return false
10953 }
10954 func rewriteValuePPC64_OpPPC64MULLW(v *Value) bool {
10955         v_1 := v.Args[1]
10956         v_0 := v.Args[0]
10957         // match: (MULLW x (MOVDconst [c]))
10958         // cond: is16Bit(c)
10959         // result: (MULLWconst [int32(c)] x)
10960         for {
10961                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10962                         x := v_0
10963                         if v_1.Op != OpPPC64MOVDconst {
10964                                 continue
10965                         }
10966                         c := auxIntToInt64(v_1.AuxInt)
10967                         if !(is16Bit(c)) {
10968                                 continue
10969                         }
10970                         v.reset(OpPPC64MULLWconst)
10971                         v.AuxInt = int32ToAuxInt(int32(c))
10972                         v.AddArg(x)
10973                         return true
10974                 }
10975                 break
10976         }
10977         return false
10978 }
10979 func rewriteValuePPC64_OpPPC64NEG(v *Value) bool {
10980         v_0 := v.Args[0]
10981         // match: (NEG (ADDconst [c] x))
10982         // cond: is32Bit(-c)
10983         // result: (SUBFCconst [-c] x)
10984         for {
10985                 if v_0.Op != OpPPC64ADDconst {
10986                         break
10987                 }
10988                 c := auxIntToInt64(v_0.AuxInt)
10989                 x := v_0.Args[0]
10990                 if !(is32Bit(-c)) {
10991                         break
10992                 }
10993                 v.reset(OpPPC64SUBFCconst)
10994                 v.AuxInt = int64ToAuxInt(-c)
10995                 v.AddArg(x)
10996                 return true
10997         }
10998         // match: (NEG (SUBFCconst [c] x))
10999         // cond: is32Bit(-c)
11000         // result: (ADDconst [-c] x)
11001         for {
11002                 if v_0.Op != OpPPC64SUBFCconst {
11003                         break
11004                 }
11005                 c := auxIntToInt64(v_0.AuxInt)
11006                 x := v_0.Args[0]
11007                 if !(is32Bit(-c)) {
11008                         break
11009                 }
11010                 v.reset(OpPPC64ADDconst)
11011                 v.AuxInt = int64ToAuxInt(-c)
11012                 v.AddArg(x)
11013                 return true
11014         }
11015         // match: (NEG (SUB x y))
11016         // result: (SUB y x)
11017         for {
11018                 if v_0.Op != OpPPC64SUB {
11019                         break
11020                 }
11021                 y := v_0.Args[1]
11022                 x := v_0.Args[0]
11023                 v.reset(OpPPC64SUB)
11024                 v.AddArg2(y, x)
11025                 return true
11026         }
11027         // match: (NEG (NEG x))
11028         // result: x
11029         for {
11030                 if v_0.Op != OpPPC64NEG {
11031                         break
11032                 }
11033                 x := v_0.Args[0]
11034                 v.copyOf(x)
11035                 return true
11036         }
11037         return false
11038 }
11039 func rewriteValuePPC64_OpPPC64NOR(v *Value) bool {
11040         v_1 := v.Args[1]
11041         v_0 := v.Args[0]
11042         // match: (NOR (MOVDconst [c]) (MOVDconst [d]))
11043         // result: (MOVDconst [^(c|d)])
11044         for {
11045                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11046                         if v_0.Op != OpPPC64MOVDconst {
11047                                 continue
11048                         }
11049                         c := auxIntToInt64(v_0.AuxInt)
11050                         if v_1.Op != OpPPC64MOVDconst {
11051                                 continue
11052                         }
11053                         d := auxIntToInt64(v_1.AuxInt)
11054                         v.reset(OpPPC64MOVDconst)
11055                         v.AuxInt = int64ToAuxInt(^(c | d))
11056                         return true
11057                 }
11058                 break
11059         }
11060         return false
11061 }
11062 func rewriteValuePPC64_OpPPC64NotEqual(v *Value) bool {
11063         v_0 := v.Args[0]
11064         // match: (NotEqual (FlagEQ))
11065         // result: (MOVDconst [0])
11066         for {
11067                 if v_0.Op != OpPPC64FlagEQ {
11068                         break
11069                 }
11070                 v.reset(OpPPC64MOVDconst)
11071                 v.AuxInt = int64ToAuxInt(0)
11072                 return true
11073         }
11074         // match: (NotEqual (FlagLT))
11075         // result: (MOVDconst [1])
11076         for {
11077                 if v_0.Op != OpPPC64FlagLT {
11078                         break
11079                 }
11080                 v.reset(OpPPC64MOVDconst)
11081                 v.AuxInt = int64ToAuxInt(1)
11082                 return true
11083         }
11084         // match: (NotEqual (FlagGT))
11085         // result: (MOVDconst [1])
11086         for {
11087                 if v_0.Op != OpPPC64FlagGT {
11088                         break
11089                 }
11090                 v.reset(OpPPC64MOVDconst)
11091                 v.AuxInt = int64ToAuxInt(1)
11092                 return true
11093         }
11094         // match: (NotEqual (InvertFlags x))
11095         // result: (NotEqual x)
11096         for {
11097                 if v_0.Op != OpPPC64InvertFlags {
11098                         break
11099                 }
11100                 x := v_0.Args[0]
11101                 v.reset(OpPPC64NotEqual)
11102                 v.AddArg(x)
11103                 return true
11104         }
11105         // match: (NotEqual cmp)
11106         // result: (SETBCR [2] cmp)
11107         for {
11108                 cmp := v_0
11109                 v.reset(OpPPC64SETBCR)
11110                 v.AuxInt = int32ToAuxInt(2)
11111                 v.AddArg(cmp)
11112                 return true
11113         }
11114 }
11115 func rewriteValuePPC64_OpPPC64OR(v *Value) bool {
11116         v_1 := v.Args[1]
11117         v_0 := v.Args[0]
11118         // match: (OR x (NOR y y))
11119         // result: (ORN x y)
11120         for {
11121                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11122                         x := v_0
11123                         if v_1.Op != OpPPC64NOR {
11124                                 continue
11125                         }
11126                         y := v_1.Args[1]
11127                         if y != v_1.Args[0] {
11128                                 continue
11129                         }
11130                         v.reset(OpPPC64ORN)
11131                         v.AddArg2(x, y)
11132                         return true
11133                 }
11134                 break
11135         }
11136         // match: (OR (MOVDconst [c]) (MOVDconst [d]))
11137         // result: (MOVDconst [c|d])
11138         for {
11139                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11140                         if v_0.Op != OpPPC64MOVDconst {
11141                                 continue
11142                         }
11143                         c := auxIntToInt64(v_0.AuxInt)
11144                         if v_1.Op != OpPPC64MOVDconst {
11145                                 continue
11146                         }
11147                         d := auxIntToInt64(v_1.AuxInt)
11148                         v.reset(OpPPC64MOVDconst)
11149                         v.AuxInt = int64ToAuxInt(c | d)
11150                         return true
11151                 }
11152                 break
11153         }
11154         // match: (OR x (MOVDconst [c]))
11155         // cond: isU32Bit(c)
11156         // result: (ORconst [c] x)
11157         for {
11158                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11159                         x := v_0
11160                         if v_1.Op != OpPPC64MOVDconst {
11161                                 continue
11162                         }
11163                         c := auxIntToInt64(v_1.AuxInt)
11164                         if !(isU32Bit(c)) {
11165                                 continue
11166                         }
11167                         v.reset(OpPPC64ORconst)
11168                         v.AuxInt = int64ToAuxInt(c)
11169                         v.AddArg(x)
11170                         return true
11171                 }
11172                 break
11173         }
11174         return false
11175 }
11176 func rewriteValuePPC64_OpPPC64ORN(v *Value) bool {
11177         v_1 := v.Args[1]
11178         v_0 := v.Args[0]
11179         // match: (ORN x (MOVDconst [-1]))
11180         // result: x
11181         for {
11182                 x := v_0
11183                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
11184                         break
11185                 }
11186                 v.copyOf(x)
11187                 return true
11188         }
11189         // match: (ORN (MOVDconst [c]) (MOVDconst [d]))
11190         // result: (MOVDconst [c|^d])
11191         for {
11192                 if v_0.Op != OpPPC64MOVDconst {
11193                         break
11194                 }
11195                 c := auxIntToInt64(v_0.AuxInt)
11196                 if v_1.Op != OpPPC64MOVDconst {
11197                         break
11198                 }
11199                 d := auxIntToInt64(v_1.AuxInt)
11200                 v.reset(OpPPC64MOVDconst)
11201                 v.AuxInt = int64ToAuxInt(c | ^d)
11202                 return true
11203         }
11204         return false
11205 }
11206 func rewriteValuePPC64_OpPPC64ORconst(v *Value) bool {
11207         v_0 := v.Args[0]
11208         // match: (ORconst [c] (ORconst [d] x))
11209         // result: (ORconst [c|d] x)
11210         for {
11211                 c := auxIntToInt64(v.AuxInt)
11212                 if v_0.Op != OpPPC64ORconst {
11213                         break
11214                 }
11215                 d := auxIntToInt64(v_0.AuxInt)
11216                 x := v_0.Args[0]
11217                 v.reset(OpPPC64ORconst)
11218                 v.AuxInt = int64ToAuxInt(c | d)
11219                 v.AddArg(x)
11220                 return true
11221         }
11222         // match: (ORconst [-1] _)
11223         // result: (MOVDconst [-1])
11224         for {
11225                 if auxIntToInt64(v.AuxInt) != -1 {
11226                         break
11227                 }
11228                 v.reset(OpPPC64MOVDconst)
11229                 v.AuxInt = int64ToAuxInt(-1)
11230                 return true
11231         }
11232         // match: (ORconst [0] x)
11233         // result: x
11234         for {
11235                 if auxIntToInt64(v.AuxInt) != 0 {
11236                         break
11237                 }
11238                 x := v_0
11239                 v.copyOf(x)
11240                 return true
11241         }
11242         return false
11243 }
11244 func rewriteValuePPC64_OpPPC64ROTL(v *Value) bool {
11245         v_1 := v.Args[1]
11246         v_0 := v.Args[0]
11247         // match: (ROTL x (MOVDconst [c]))
11248         // result: (ROTLconst x [c&63])
11249         for {
11250                 x := v_0
11251                 if v_1.Op != OpPPC64MOVDconst {
11252                         break
11253                 }
11254                 c := auxIntToInt64(v_1.AuxInt)
11255                 v.reset(OpPPC64ROTLconst)
11256                 v.AuxInt = int64ToAuxInt(c & 63)
11257                 v.AddArg(x)
11258                 return true
11259         }
11260         return false
11261 }
11262 func rewriteValuePPC64_OpPPC64ROTLW(v *Value) bool {
11263         v_1 := v.Args[1]
11264         v_0 := v.Args[0]
11265         // match: (ROTLW x (MOVDconst [c]))
11266         // result: (ROTLWconst x [c&31])
11267         for {
11268                 x := v_0
11269                 if v_1.Op != OpPPC64MOVDconst {
11270                         break
11271                 }
11272                 c := auxIntToInt64(v_1.AuxInt)
11273                 v.reset(OpPPC64ROTLWconst)
11274                 v.AuxInt = int64ToAuxInt(c & 31)
11275                 v.AddArg(x)
11276                 return true
11277         }
11278         return false
11279 }
11280 func rewriteValuePPC64_OpPPC64ROTLWconst(v *Value) bool {
11281         v_0 := v.Args[0]
11282         // match: (ROTLWconst [r] (AND (MOVDconst [m]) x))
11283         // cond: isPPC64WordRotateMask(m)
11284         // result: (RLWINM [encodePPC64RotateMask(r,rotateLeft32(m,r),32)] x)
11285         for {
11286                 r := auxIntToInt64(v.AuxInt)
11287                 if v_0.Op != OpPPC64AND {
11288                         break
11289                 }
11290                 _ = v_0.Args[1]
11291                 v_0_0 := v_0.Args[0]
11292                 v_0_1 := v_0.Args[1]
11293                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
11294                         if v_0_0.Op != OpPPC64MOVDconst {
11295                                 continue
11296                         }
11297                         m := auxIntToInt64(v_0_0.AuxInt)
11298                         x := v_0_1
11299                         if !(isPPC64WordRotateMask(m)) {
11300                                 continue
11301                         }
11302                         v.reset(OpPPC64RLWINM)
11303                         v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, rotateLeft32(m, r), 32))
11304                         v.AddArg(x)
11305                         return true
11306                 }
11307                 break
11308         }
11309         // match: (ROTLWconst [r] (Select0 (ANDCCconst [m] x)))
11310         // cond: isPPC64WordRotateMask(m)
11311         // result: (RLWINM [encodePPC64RotateMask(r,rotateLeft32(m,r),32)] x)
11312         for {
11313                 r := auxIntToInt64(v.AuxInt)
11314                 if v_0.Op != OpSelect0 {
11315                         break
11316                 }
11317                 v_0_0 := v_0.Args[0]
11318                 if v_0_0.Op != OpPPC64ANDCCconst {
11319                         break
11320                 }
11321                 m := auxIntToInt64(v_0_0.AuxInt)
11322                 x := v_0_0.Args[0]
11323                 if !(isPPC64WordRotateMask(m)) {
11324                         break
11325                 }
11326                 v.reset(OpPPC64RLWINM)
11327                 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, rotateLeft32(m, r), 32))
11328                 v.AddArg(x)
11329                 return true
11330         }
11331         return false
11332 }
11333 func rewriteValuePPC64_OpPPC64SETBC(v *Value) bool {
11334         v_0 := v.Args[0]
11335         b := v.Block
11336         typ := &b.Func.Config.Types
11337         // match: (SETBC [0] (FlagLT))
11338         // result: (MOVDconst [1])
11339         for {
11340                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagLT {
11341                         break
11342                 }
11343                 v.reset(OpPPC64MOVDconst)
11344                 v.AuxInt = int64ToAuxInt(1)
11345                 return true
11346         }
11347         // match: (SETBC [0] (FlagGT))
11348         // result: (MOVDconst [0])
11349         for {
11350                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagGT {
11351                         break
11352                 }
11353                 v.reset(OpPPC64MOVDconst)
11354                 v.AuxInt = int64ToAuxInt(0)
11355                 return true
11356         }
11357         // match: (SETBC [0] (FlagEQ))
11358         // result: (MOVDconst [0])
11359         for {
11360                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagEQ {
11361                         break
11362                 }
11363                 v.reset(OpPPC64MOVDconst)
11364                 v.AuxInt = int64ToAuxInt(0)
11365                 return true
11366         }
11367         // match: (SETBC [1] (FlagGT))
11368         // result: (MOVDconst [1])
11369         for {
11370                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagGT {
11371                         break
11372                 }
11373                 v.reset(OpPPC64MOVDconst)
11374                 v.AuxInt = int64ToAuxInt(1)
11375                 return true
11376         }
11377         // match: (SETBC [1] (FlagLT))
11378         // result: (MOVDconst [0])
11379         for {
11380                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagLT {
11381                         break
11382                 }
11383                 v.reset(OpPPC64MOVDconst)
11384                 v.AuxInt = int64ToAuxInt(0)
11385                 return true
11386         }
11387         // match: (SETBC [1] (FlagEQ))
11388         // result: (MOVDconst [0])
11389         for {
11390                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagEQ {
11391                         break
11392                 }
11393                 v.reset(OpPPC64MOVDconst)
11394                 v.AuxInt = int64ToAuxInt(0)
11395                 return true
11396         }
11397         // match: (SETBC [2] (FlagEQ))
11398         // result: (MOVDconst [1])
11399         for {
11400                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagEQ {
11401                         break
11402                 }
11403                 v.reset(OpPPC64MOVDconst)
11404                 v.AuxInt = int64ToAuxInt(1)
11405                 return true
11406         }
11407         // match: (SETBC [2] (FlagLT))
11408         // result: (MOVDconst [0])
11409         for {
11410                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagLT {
11411                         break
11412                 }
11413                 v.reset(OpPPC64MOVDconst)
11414                 v.AuxInt = int64ToAuxInt(0)
11415                 return true
11416         }
11417         // match: (SETBC [2] (FlagGT))
11418         // result: (MOVDconst [0])
11419         for {
11420                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagGT {
11421                         break
11422                 }
11423                 v.reset(OpPPC64MOVDconst)
11424                 v.AuxInt = int64ToAuxInt(0)
11425                 return true
11426         }
11427         // match: (SETBC [0] (InvertFlags bool))
11428         // result: (SETBC [1] bool)
11429         for {
11430                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64InvertFlags {
11431                         break
11432                 }
11433                 bool := v_0.Args[0]
11434                 v.reset(OpPPC64SETBC)
11435                 v.AuxInt = int32ToAuxInt(1)
11436                 v.AddArg(bool)
11437                 return true
11438         }
11439         // match: (SETBC [1] (InvertFlags bool))
11440         // result: (SETBC [0] bool)
11441         for {
11442                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64InvertFlags {
11443                         break
11444                 }
11445                 bool := v_0.Args[0]
11446                 v.reset(OpPPC64SETBC)
11447                 v.AuxInt = int32ToAuxInt(0)
11448                 v.AddArg(bool)
11449                 return true
11450         }
11451         // match: (SETBC [2] (InvertFlags bool))
11452         // result: (SETBC [2] bool)
11453         for {
11454                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64InvertFlags {
11455                         break
11456                 }
11457                 bool := v_0.Args[0]
11458                 v.reset(OpPPC64SETBC)
11459                 v.AuxInt = int32ToAuxInt(2)
11460                 v.AddArg(bool)
11461                 return true
11462         }
11463         // match: (SETBC [n] (InvertFlags bool))
11464         // result: (SETBCR [n] bool)
11465         for {
11466                 n := auxIntToInt32(v.AuxInt)
11467                 if v_0.Op != OpPPC64InvertFlags {
11468                         break
11469                 }
11470                 bool := v_0.Args[0]
11471                 v.reset(OpPPC64SETBCR)
11472                 v.AuxInt = int32ToAuxInt(n)
11473                 v.AddArg(bool)
11474                 return true
11475         }
11476         // match: (SETBC [2] (CMPconst [0] (Select0 (ANDCCconst [1] z))))
11477         // result: (XORconst [1] (Select0 <typ.UInt64> (ANDCCconst [1] z )))
11478         for {
11479                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11480                         break
11481                 }
11482                 v_0_0 := v_0.Args[0]
11483                 if v_0_0.Op != OpSelect0 {
11484                         break
11485                 }
11486                 v_0_0_0 := v_0_0.Args[0]
11487                 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
11488                         break
11489                 }
11490                 z := v_0_0_0.Args[0]
11491                 v.reset(OpPPC64XORconst)
11492                 v.AuxInt = int64ToAuxInt(1)
11493                 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
11494                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11495                 v1.AuxInt = int64ToAuxInt(1)
11496                 v1.AddArg(z)
11497                 v0.AddArg(v1)
11498                 v.AddArg(v0)
11499                 return true
11500         }
11501         // match: (SETBC [2] (CMPWconst [0] (Select0 (ANDCCconst [1] z))))
11502         // result: (XORconst [1] (Select0 <typ.UInt64> (ANDCCconst [1] z )))
11503         for {
11504                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11505                         break
11506                 }
11507                 v_0_0 := v_0.Args[0]
11508                 if v_0_0.Op != OpSelect0 {
11509                         break
11510                 }
11511                 v_0_0_0 := v_0_0.Args[0]
11512                 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
11513                         break
11514                 }
11515                 z := v_0_0_0.Args[0]
11516                 v.reset(OpPPC64XORconst)
11517                 v.AuxInt = int64ToAuxInt(1)
11518                 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
11519                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11520                 v1.AuxInt = int64ToAuxInt(1)
11521                 v1.AddArg(z)
11522                 v0.AddArg(v1)
11523                 v.AddArg(v0)
11524                 return true
11525         }
11526         // match: (SETBC [2] (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
11527         // result: (SETBC [2] (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
11528         for {
11529                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11530                         break
11531                 }
11532                 v_0_0 := v_0.Args[0]
11533                 if v_0_0.Op != OpSelect0 {
11534                         break
11535                 }
11536                 v_0_0_0 := v_0_0.Args[0]
11537                 if v_0_0_0.Op != OpPPC64ANDCCconst {
11538                         break
11539                 }
11540                 n := auxIntToInt64(v_0_0_0.AuxInt)
11541                 z := v_0_0_0.Args[0]
11542                 v.reset(OpPPC64SETBC)
11543                 v.AuxInt = int32ToAuxInt(2)
11544                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11545                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11546                 v1.AuxInt = int64ToAuxInt(n)
11547                 v1.AddArg(z)
11548                 v0.AddArg(v1)
11549                 v.AddArg(v0)
11550                 return true
11551         }
11552         // match: (SETBC [2] (CMPconst [0] a:(AND y z)))
11553         // cond: a.Uses == 1
11554         // result: (SETBC [2] (Select1 <types.TypeFlags> (ANDCC y z )))
11555         for {
11556                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11557                         break
11558                 }
11559                 a := v_0.Args[0]
11560                 if a.Op != OpPPC64AND {
11561                         break
11562                 }
11563                 z := a.Args[1]
11564                 y := a.Args[0]
11565                 if !(a.Uses == 1) {
11566                         break
11567                 }
11568                 v.reset(OpPPC64SETBC)
11569                 v.AuxInt = int32ToAuxInt(2)
11570                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11571                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
11572                 v1.AddArg2(y, z)
11573                 v0.AddArg(v1)
11574                 v.AddArg(v0)
11575                 return true
11576         }
11577         // match: (SETBC [2] (CMPconst [0] o:(OR y z)))
11578         // cond: o.Uses == 1
11579         // result: (SETBC [2] (Select1 <types.TypeFlags> (ORCC y z )))
11580         for {
11581                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11582                         break
11583                 }
11584                 o := v_0.Args[0]
11585                 if o.Op != OpPPC64OR {
11586                         break
11587                 }
11588                 z := o.Args[1]
11589                 y := o.Args[0]
11590                 if !(o.Uses == 1) {
11591                         break
11592                 }
11593                 v.reset(OpPPC64SETBC)
11594                 v.AuxInt = int32ToAuxInt(2)
11595                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11596                 v1 := b.NewValue0(v.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
11597                 v1.AddArg2(y, z)
11598                 v0.AddArg(v1)
11599                 v.AddArg(v0)
11600                 return true
11601         }
11602         // match: (SETBC [2] (CMPconst [0] a:(XOR y z)))
11603         // cond: a.Uses == 1
11604         // result: (SETBC [2] (Select1 <types.TypeFlags> (XORCC y z )))
11605         for {
11606                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11607                         break
11608                 }
11609                 a := v_0.Args[0]
11610                 if a.Op != OpPPC64XOR {
11611                         break
11612                 }
11613                 z := a.Args[1]
11614                 y := a.Args[0]
11615                 if !(a.Uses == 1) {
11616                         break
11617                 }
11618                 v.reset(OpPPC64SETBC)
11619                 v.AuxInt = int32ToAuxInt(2)
11620                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11621                 v1 := b.NewValue0(v.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
11622                 v1.AddArg2(y, z)
11623                 v0.AddArg(v1)
11624                 v.AddArg(v0)
11625                 return true
11626         }
11627         return false
11628 }
11629 func rewriteValuePPC64_OpPPC64SETBCR(v *Value) bool {
11630         v_0 := v.Args[0]
11631         b := v.Block
11632         typ := &b.Func.Config.Types
11633         // match: (SETBCR [0] (FlagLT))
11634         // result: (MOVDconst [0])
11635         for {
11636                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagLT {
11637                         break
11638                 }
11639                 v.reset(OpPPC64MOVDconst)
11640                 v.AuxInt = int64ToAuxInt(0)
11641                 return true
11642         }
11643         // match: (SETBCR [0] (FlagGT))
11644         // result: (MOVDconst [1])
11645         for {
11646                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagGT {
11647                         break
11648                 }
11649                 v.reset(OpPPC64MOVDconst)
11650                 v.AuxInt = int64ToAuxInt(1)
11651                 return true
11652         }
11653         // match: (SETBCR [0] (FlagEQ))
11654         // result: (MOVDconst [1])
11655         for {
11656                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagEQ {
11657                         break
11658                 }
11659                 v.reset(OpPPC64MOVDconst)
11660                 v.AuxInt = int64ToAuxInt(1)
11661                 return true
11662         }
11663         // match: (SETBCR [1] (FlagGT))
11664         // result: (MOVDconst [0])
11665         for {
11666                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagGT {
11667                         break
11668                 }
11669                 v.reset(OpPPC64MOVDconst)
11670                 v.AuxInt = int64ToAuxInt(0)
11671                 return true
11672         }
11673         // match: (SETBCR [1] (FlagLT))
11674         // result: (MOVDconst [1])
11675         for {
11676                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagLT {
11677                         break
11678                 }
11679                 v.reset(OpPPC64MOVDconst)
11680                 v.AuxInt = int64ToAuxInt(1)
11681                 return true
11682         }
11683         // match: (SETBCR [1] (FlagEQ))
11684         // result: (MOVDconst [1])
11685         for {
11686                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagEQ {
11687                         break
11688                 }
11689                 v.reset(OpPPC64MOVDconst)
11690                 v.AuxInt = int64ToAuxInt(1)
11691                 return true
11692         }
11693         // match: (SETBCR [2] (FlagEQ))
11694         // result: (MOVDconst [0])
11695         for {
11696                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagEQ {
11697                         break
11698                 }
11699                 v.reset(OpPPC64MOVDconst)
11700                 v.AuxInt = int64ToAuxInt(0)
11701                 return true
11702         }
11703         // match: (SETBCR [2] (FlagLT))
11704         // result: (MOVDconst [1])
11705         for {
11706                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagLT {
11707                         break
11708                 }
11709                 v.reset(OpPPC64MOVDconst)
11710                 v.AuxInt = int64ToAuxInt(1)
11711                 return true
11712         }
11713         // match: (SETBCR [2] (FlagGT))
11714         // result: (MOVDconst [1])
11715         for {
11716                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagGT {
11717                         break
11718                 }
11719                 v.reset(OpPPC64MOVDconst)
11720                 v.AuxInt = int64ToAuxInt(1)
11721                 return true
11722         }
11723         // match: (SETBCR [0] (InvertFlags bool))
11724         // result: (SETBCR [1] bool)
11725         for {
11726                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64InvertFlags {
11727                         break
11728                 }
11729                 bool := v_0.Args[0]
11730                 v.reset(OpPPC64SETBCR)
11731                 v.AuxInt = int32ToAuxInt(1)
11732                 v.AddArg(bool)
11733                 return true
11734         }
11735         // match: (SETBCR [1] (InvertFlags bool))
11736         // result: (SETBCR [0] bool)
11737         for {
11738                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64InvertFlags {
11739                         break
11740                 }
11741                 bool := v_0.Args[0]
11742                 v.reset(OpPPC64SETBCR)
11743                 v.AuxInt = int32ToAuxInt(0)
11744                 v.AddArg(bool)
11745                 return true
11746         }
11747         // match: (SETBCR [2] (InvertFlags bool))
11748         // result: (SETBCR [2] bool)
11749         for {
11750                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64InvertFlags {
11751                         break
11752                 }
11753                 bool := v_0.Args[0]
11754                 v.reset(OpPPC64SETBCR)
11755                 v.AuxInt = int32ToAuxInt(2)
11756                 v.AddArg(bool)
11757                 return true
11758         }
11759         // match: (SETBCR [n] (InvertFlags bool))
11760         // result: (SETBC [n] bool)
11761         for {
11762                 n := auxIntToInt32(v.AuxInt)
11763                 if v_0.Op != OpPPC64InvertFlags {
11764                         break
11765                 }
11766                 bool := v_0.Args[0]
11767                 v.reset(OpPPC64SETBC)
11768                 v.AuxInt = int32ToAuxInt(n)
11769                 v.AddArg(bool)
11770                 return true
11771         }
11772         // match: (SETBCR [2] (CMPconst [0] (Select0 (ANDCCconst [1] z))))
11773         // result: (Select0 <typ.UInt64> (ANDCCconst [1] z ))
11774         for {
11775                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11776                         break
11777                 }
11778                 v_0_0 := v_0.Args[0]
11779                 if v_0_0.Op != OpSelect0 {
11780                         break
11781                 }
11782                 v_0_0_0 := v_0_0.Args[0]
11783                 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
11784                         break
11785                 }
11786                 z := v_0_0_0.Args[0]
11787                 v.reset(OpSelect0)
11788                 v.Type = typ.UInt64
11789                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11790                 v0.AuxInt = int64ToAuxInt(1)
11791                 v0.AddArg(z)
11792                 v.AddArg(v0)
11793                 return true
11794         }
11795         // match: (SETBCR [2] (CMPWconst [0] (Select0 (ANDCCconst [1] z))))
11796         // result: (Select0 <typ.UInt64> (ANDCCconst [1] z ))
11797         for {
11798                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11799                         break
11800                 }
11801                 v_0_0 := v_0.Args[0]
11802                 if v_0_0.Op != OpSelect0 {
11803                         break
11804                 }
11805                 v_0_0_0 := v_0_0.Args[0]
11806                 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
11807                         break
11808                 }
11809                 z := v_0_0_0.Args[0]
11810                 v.reset(OpSelect0)
11811                 v.Type = typ.UInt64
11812                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11813                 v0.AuxInt = int64ToAuxInt(1)
11814                 v0.AddArg(z)
11815                 v.AddArg(v0)
11816                 return true
11817         }
11818         // match: (SETBCR [2] (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
11819         // result: (SETBCR [2] (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
11820         for {
11821                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11822                         break
11823                 }
11824                 v_0_0 := v_0.Args[0]
11825                 if v_0_0.Op != OpSelect0 {
11826                         break
11827                 }
11828                 v_0_0_0 := v_0_0.Args[0]
11829                 if v_0_0_0.Op != OpPPC64ANDCCconst {
11830                         break
11831                 }
11832                 n := auxIntToInt64(v_0_0_0.AuxInt)
11833                 z := v_0_0_0.Args[0]
11834                 v.reset(OpPPC64SETBCR)
11835                 v.AuxInt = int32ToAuxInt(2)
11836                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11837                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11838                 v1.AuxInt = int64ToAuxInt(n)
11839                 v1.AddArg(z)
11840                 v0.AddArg(v1)
11841                 v.AddArg(v0)
11842                 return true
11843         }
11844         // match: (SETBCR [2] (CMPconst [0] a:(AND y z)))
11845         // cond: a.Uses == 1
11846         // result: (SETBCR [2] (Select1 <types.TypeFlags> (ANDCC y z )))
11847         for {
11848                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11849                         break
11850                 }
11851                 a := v_0.Args[0]
11852                 if a.Op != OpPPC64AND {
11853                         break
11854                 }
11855                 z := a.Args[1]
11856                 y := a.Args[0]
11857                 if !(a.Uses == 1) {
11858                         break
11859                 }
11860                 v.reset(OpPPC64SETBCR)
11861                 v.AuxInt = int32ToAuxInt(2)
11862                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11863                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
11864                 v1.AddArg2(y, z)
11865                 v0.AddArg(v1)
11866                 v.AddArg(v0)
11867                 return true
11868         }
11869         // match: (SETBCR [2] (CMPconst [0] o:(OR y z)))
11870         // cond: o.Uses == 1
11871         // result: (SETBCR [2] (Select1 <types.TypeFlags> (ORCC y z )))
11872         for {
11873                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11874                         break
11875                 }
11876                 o := v_0.Args[0]
11877                 if o.Op != OpPPC64OR {
11878                         break
11879                 }
11880                 z := o.Args[1]
11881                 y := o.Args[0]
11882                 if !(o.Uses == 1) {
11883                         break
11884                 }
11885                 v.reset(OpPPC64SETBCR)
11886                 v.AuxInt = int32ToAuxInt(2)
11887                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11888                 v1 := b.NewValue0(v.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
11889                 v1.AddArg2(y, z)
11890                 v0.AddArg(v1)
11891                 v.AddArg(v0)
11892                 return true
11893         }
11894         // match: (SETBCR [2] (CMPconst [0] a:(XOR y z)))
11895         // cond: a.Uses == 1
11896         // result: (SETBCR [2] (Select1 <types.TypeFlags> (XORCC y z )))
11897         for {
11898                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11899                         break
11900                 }
11901                 a := v_0.Args[0]
11902                 if a.Op != OpPPC64XOR {
11903                         break
11904                 }
11905                 z := a.Args[1]
11906                 y := a.Args[0]
11907                 if !(a.Uses == 1) {
11908                         break
11909                 }
11910                 v.reset(OpPPC64SETBCR)
11911                 v.AuxInt = int32ToAuxInt(2)
11912                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11913                 v1 := b.NewValue0(v.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
11914                 v1.AddArg2(y, z)
11915                 v0.AddArg(v1)
11916                 v.AddArg(v0)
11917                 return true
11918         }
11919         return false
11920 }
11921 func rewriteValuePPC64_OpPPC64SLD(v *Value) bool {
11922         v_1 := v.Args[1]
11923         v_0 := v.Args[0]
11924         // match: (SLD x (MOVDconst [c]))
11925         // result: (SLDconst [c&63 | (c>>6&1*63)] x)
11926         for {
11927                 x := v_0
11928                 if v_1.Op != OpPPC64MOVDconst {
11929                         break
11930                 }
11931                 c := auxIntToInt64(v_1.AuxInt)
11932                 v.reset(OpPPC64SLDconst)
11933                 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
11934                 v.AddArg(x)
11935                 return true
11936         }
11937         return false
11938 }
11939 func rewriteValuePPC64_OpPPC64SLDconst(v *Value) bool {
11940         v_0 := v.Args[0]
11941         // match: (SLDconst [l] (SRWconst [r] x))
11942         // cond: mergePPC64SldiSrw(l,r) != 0
11943         // result: (RLWINM [mergePPC64SldiSrw(l,r)] x)
11944         for {
11945                 l := auxIntToInt64(v.AuxInt)
11946                 if v_0.Op != OpPPC64SRWconst {
11947                         break
11948                 }
11949                 r := auxIntToInt64(v_0.AuxInt)
11950                 x := v_0.Args[0]
11951                 if !(mergePPC64SldiSrw(l, r) != 0) {
11952                         break
11953                 }
11954                 v.reset(OpPPC64RLWINM)
11955                 v.AuxInt = int64ToAuxInt(mergePPC64SldiSrw(l, r))
11956                 v.AddArg(x)
11957                 return true
11958         }
11959         // match: (SLDconst [c] z:(MOVBZreg x))
11960         // cond: c < 8 && z.Uses == 1
11961         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,56,63,64)] x)
11962         for {
11963                 c := auxIntToInt64(v.AuxInt)
11964                 z := v_0
11965                 if z.Op != OpPPC64MOVBZreg {
11966                         break
11967                 }
11968                 x := z.Args[0]
11969                 if !(c < 8 && z.Uses == 1) {
11970                         break
11971                 }
11972                 v.reset(OpPPC64CLRLSLDI)
11973                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 56, 63, 64))
11974                 v.AddArg(x)
11975                 return true
11976         }
11977         // match: (SLDconst [c] z:(MOVHZreg x))
11978         // cond: c < 16 && z.Uses == 1
11979         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,48,63,64)] x)
11980         for {
11981                 c := auxIntToInt64(v.AuxInt)
11982                 z := v_0
11983                 if z.Op != OpPPC64MOVHZreg {
11984                         break
11985                 }
11986                 x := z.Args[0]
11987                 if !(c < 16 && z.Uses == 1) {
11988                         break
11989                 }
11990                 v.reset(OpPPC64CLRLSLDI)
11991                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 48, 63, 64))
11992                 v.AddArg(x)
11993                 return true
11994         }
11995         // match: (SLDconst [c] z:(MOVWZreg x))
11996         // cond: c < 32 && z.Uses == 1
11997         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,32,63,64)] x)
11998         for {
11999                 c := auxIntToInt64(v.AuxInt)
12000                 z := v_0
12001                 if z.Op != OpPPC64MOVWZreg {
12002                         break
12003                 }
12004                 x := z.Args[0]
12005                 if !(c < 32 && z.Uses == 1) {
12006                         break
12007                 }
12008                 v.reset(OpPPC64CLRLSLDI)
12009                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32, 63, 64))
12010                 v.AddArg(x)
12011                 return true
12012         }
12013         // match: (SLDconst [c] z:(Select0 (ANDCCconst [d] x)))
12014         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))
12015         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,64-getPPC64ShiftMaskLength(d),63,64)] x)
12016         for {
12017                 c := auxIntToInt64(v.AuxInt)
12018                 z := v_0
12019                 if z.Op != OpSelect0 {
12020                         break
12021                 }
12022                 z_0 := z.Args[0]
12023                 if z_0.Op != OpPPC64ANDCCconst {
12024                         break
12025                 }
12026                 d := auxIntToInt64(z_0.AuxInt)
12027                 x := z_0.Args[0]
12028                 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))) {
12029                         break
12030                 }
12031                 v.reset(OpPPC64CLRLSLDI)
12032                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 64-getPPC64ShiftMaskLength(d), 63, 64))
12033                 v.AddArg(x)
12034                 return true
12035         }
12036         // match: (SLDconst [c] z:(AND (MOVDconst [d]) x))
12037         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(64-getPPC64ShiftMaskLength(d))
12038         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,64-getPPC64ShiftMaskLength(d),63,64)] x)
12039         for {
12040                 c := auxIntToInt64(v.AuxInt)
12041                 z := v_0
12042                 if z.Op != OpPPC64AND {
12043                         break
12044                 }
12045                 _ = z.Args[1]
12046                 z_0 := z.Args[0]
12047                 z_1 := z.Args[1]
12048                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
12049                         if z_0.Op != OpPPC64MOVDconst {
12050                                 continue
12051                         }
12052                         d := auxIntToInt64(z_0.AuxInt)
12053                         x := z_1
12054                         if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))) {
12055                                 continue
12056                         }
12057                         v.reset(OpPPC64CLRLSLDI)
12058                         v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 64-getPPC64ShiftMaskLength(d), 63, 64))
12059                         v.AddArg(x)
12060                         return true
12061                 }
12062                 break
12063         }
12064         // match: (SLDconst [c] z:(MOVWreg x))
12065         // cond: c < 32 && buildcfg.GOPPC64 >= 9
12066         // result: (EXTSWSLconst [c] x)
12067         for {
12068                 c := auxIntToInt64(v.AuxInt)
12069                 z := v_0
12070                 if z.Op != OpPPC64MOVWreg {
12071                         break
12072                 }
12073                 x := z.Args[0]
12074                 if !(c < 32 && buildcfg.GOPPC64 >= 9) {
12075                         break
12076                 }
12077                 v.reset(OpPPC64EXTSWSLconst)
12078                 v.AuxInt = int64ToAuxInt(c)
12079                 v.AddArg(x)
12080                 return true
12081         }
12082         return false
12083 }
12084 func rewriteValuePPC64_OpPPC64SLW(v *Value) bool {
12085         v_1 := v.Args[1]
12086         v_0 := v.Args[0]
12087         // match: (SLW x (MOVDconst [c]))
12088         // result: (SLWconst [c&31 | (c>>5&1*31)] x)
12089         for {
12090                 x := v_0
12091                 if v_1.Op != OpPPC64MOVDconst {
12092                         break
12093                 }
12094                 c := auxIntToInt64(v_1.AuxInt)
12095                 v.reset(OpPPC64SLWconst)
12096                 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
12097                 v.AddArg(x)
12098                 return true
12099         }
12100         return false
12101 }
12102 func rewriteValuePPC64_OpPPC64SLWconst(v *Value) bool {
12103         v_0 := v.Args[0]
12104         // match: (SLWconst [c] z:(MOVBZreg x))
12105         // cond: z.Uses == 1 && c < 8
12106         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,24,31,32)] x)
12107         for {
12108                 c := auxIntToInt64(v.AuxInt)
12109                 z := v_0
12110                 if z.Op != OpPPC64MOVBZreg {
12111                         break
12112                 }
12113                 x := z.Args[0]
12114                 if !(z.Uses == 1 && c < 8) {
12115                         break
12116                 }
12117                 v.reset(OpPPC64CLRLSLWI)
12118                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 24, 31, 32))
12119                 v.AddArg(x)
12120                 return true
12121         }
12122         // match: (SLWconst [c] z:(MOVHZreg x))
12123         // cond: z.Uses == 1 && c < 16
12124         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,16,31,32)] x)
12125         for {
12126                 c := auxIntToInt64(v.AuxInt)
12127                 z := v_0
12128                 if z.Op != OpPPC64MOVHZreg {
12129                         break
12130                 }
12131                 x := z.Args[0]
12132                 if !(z.Uses == 1 && c < 16) {
12133                         break
12134                 }
12135                 v.reset(OpPPC64CLRLSLWI)
12136                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 16, 31, 32))
12137                 v.AddArg(x)
12138                 return true
12139         }
12140         // match: (SLWconst [c] z:(Select0 (ANDCCconst [d] x)))
12141         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(32-getPPC64ShiftMaskLength(d))
12142         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,32-getPPC64ShiftMaskLength(d),31,32)] x)
12143         for {
12144                 c := auxIntToInt64(v.AuxInt)
12145                 z := v_0
12146                 if z.Op != OpSelect0 {
12147                         break
12148                 }
12149                 z_0 := z.Args[0]
12150                 if z_0.Op != OpPPC64ANDCCconst {
12151                         break
12152                 }
12153                 d := auxIntToInt64(z_0.AuxInt)
12154                 x := z_0.Args[0]
12155                 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (32-getPPC64ShiftMaskLength(d))) {
12156                         break
12157                 }
12158                 v.reset(OpPPC64CLRLSLWI)
12159                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32-getPPC64ShiftMaskLength(d), 31, 32))
12160                 v.AddArg(x)
12161                 return true
12162         }
12163         // match: (SLWconst [c] z:(AND (MOVDconst [d]) x))
12164         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(32-getPPC64ShiftMaskLength(d))
12165         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,32-getPPC64ShiftMaskLength(d),31,32)] x)
12166         for {
12167                 c := auxIntToInt64(v.AuxInt)
12168                 z := v_0
12169                 if z.Op != OpPPC64AND {
12170                         break
12171                 }
12172                 _ = z.Args[1]
12173                 z_0 := z.Args[0]
12174                 z_1 := z.Args[1]
12175                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
12176                         if z_0.Op != OpPPC64MOVDconst {
12177                                 continue
12178                         }
12179                         d := auxIntToInt64(z_0.AuxInt)
12180                         x := z_1
12181                         if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (32-getPPC64ShiftMaskLength(d))) {
12182                                 continue
12183                         }
12184                         v.reset(OpPPC64CLRLSLWI)
12185                         v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32-getPPC64ShiftMaskLength(d), 31, 32))
12186                         v.AddArg(x)
12187                         return true
12188                 }
12189                 break
12190         }
12191         // match: (SLWconst [c] z:(MOVWreg x))
12192         // cond: c < 32 && buildcfg.GOPPC64 >= 9
12193         // result: (EXTSWSLconst [c] x)
12194         for {
12195                 c := auxIntToInt64(v.AuxInt)
12196                 z := v_0
12197                 if z.Op != OpPPC64MOVWreg {
12198                         break
12199                 }
12200                 x := z.Args[0]
12201                 if !(c < 32 && buildcfg.GOPPC64 >= 9) {
12202                         break
12203                 }
12204                 v.reset(OpPPC64EXTSWSLconst)
12205                 v.AuxInt = int64ToAuxInt(c)
12206                 v.AddArg(x)
12207                 return true
12208         }
12209         return false
12210 }
12211 func rewriteValuePPC64_OpPPC64SRAD(v *Value) bool {
12212         v_1 := v.Args[1]
12213         v_0 := v.Args[0]
12214         // match: (SRAD x (MOVDconst [c]))
12215         // result: (SRADconst [c&63 | (c>>6&1*63)] x)
12216         for {
12217                 x := v_0
12218                 if v_1.Op != OpPPC64MOVDconst {
12219                         break
12220                 }
12221                 c := auxIntToInt64(v_1.AuxInt)
12222                 v.reset(OpPPC64SRADconst)
12223                 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
12224                 v.AddArg(x)
12225                 return true
12226         }
12227         return false
12228 }
12229 func rewriteValuePPC64_OpPPC64SRAW(v *Value) bool {
12230         v_1 := v.Args[1]
12231         v_0 := v.Args[0]
12232         // match: (SRAW x (MOVDconst [c]))
12233         // result: (SRAWconst [c&31 | (c>>5&1*31)] x)
12234         for {
12235                 x := v_0
12236                 if v_1.Op != OpPPC64MOVDconst {
12237                         break
12238                 }
12239                 c := auxIntToInt64(v_1.AuxInt)
12240                 v.reset(OpPPC64SRAWconst)
12241                 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
12242                 v.AddArg(x)
12243                 return true
12244         }
12245         return false
12246 }
12247 func rewriteValuePPC64_OpPPC64SRD(v *Value) bool {
12248         v_1 := v.Args[1]
12249         v_0 := v.Args[0]
12250         // match: (SRD x (MOVDconst [c]))
12251         // result: (SRDconst [c&63 | (c>>6&1*63)] x)
12252         for {
12253                 x := v_0
12254                 if v_1.Op != OpPPC64MOVDconst {
12255                         break
12256                 }
12257                 c := auxIntToInt64(v_1.AuxInt)
12258                 v.reset(OpPPC64SRDconst)
12259                 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
12260                 v.AddArg(x)
12261                 return true
12262         }
12263         return false
12264 }
12265 func rewriteValuePPC64_OpPPC64SRW(v *Value) bool {
12266         v_1 := v.Args[1]
12267         v_0 := v.Args[0]
12268         // match: (SRW x (MOVDconst [c]))
12269         // result: (SRWconst [c&31 | (c>>5&1*31)] x)
12270         for {
12271                 x := v_0
12272                 if v_1.Op != OpPPC64MOVDconst {
12273                         break
12274                 }
12275                 c := auxIntToInt64(v_1.AuxInt)
12276                 v.reset(OpPPC64SRWconst)
12277                 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
12278                 v.AddArg(x)
12279                 return true
12280         }
12281         return false
12282 }
12283 func rewriteValuePPC64_OpPPC64SRWconst(v *Value) bool {
12284         v_0 := v.Args[0]
12285         // match: (SRWconst (Select0 (ANDCCconst [m] x)) [s])
12286         // cond: mergePPC64RShiftMask(m>>uint(s),s,32) == 0
12287         // result: (MOVDconst [0])
12288         for {
12289                 s := auxIntToInt64(v.AuxInt)
12290                 if v_0.Op != OpSelect0 {
12291                         break
12292                 }
12293                 v_0_0 := v_0.Args[0]
12294                 if v_0_0.Op != OpPPC64ANDCCconst {
12295                         break
12296                 }
12297                 m := auxIntToInt64(v_0_0.AuxInt)
12298                 if !(mergePPC64RShiftMask(m>>uint(s), s, 32) == 0) {
12299                         break
12300                 }
12301                 v.reset(OpPPC64MOVDconst)
12302                 v.AuxInt = int64ToAuxInt(0)
12303                 return true
12304         }
12305         // match: (SRWconst (Select0 (ANDCCconst [m] x)) [s])
12306         // cond: mergePPC64AndSrwi(m>>uint(s),s) != 0
12307         // result: (RLWINM [mergePPC64AndSrwi(m>>uint(s),s)] x)
12308         for {
12309                 s := auxIntToInt64(v.AuxInt)
12310                 if v_0.Op != OpSelect0 {
12311                         break
12312                 }
12313                 v_0_0 := v_0.Args[0]
12314                 if v_0_0.Op != OpPPC64ANDCCconst {
12315                         break
12316                 }
12317                 m := auxIntToInt64(v_0_0.AuxInt)
12318                 x := v_0_0.Args[0]
12319                 if !(mergePPC64AndSrwi(m>>uint(s), s) != 0) {
12320                         break
12321                 }
12322                 v.reset(OpPPC64RLWINM)
12323                 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m>>uint(s), s))
12324                 v.AddArg(x)
12325                 return true
12326         }
12327         // match: (SRWconst (AND (MOVDconst [m]) x) [s])
12328         // cond: mergePPC64RShiftMask(m>>uint(s),s,32) == 0
12329         // result: (MOVDconst [0])
12330         for {
12331                 s := auxIntToInt64(v.AuxInt)
12332                 if v_0.Op != OpPPC64AND {
12333                         break
12334                 }
12335                 _ = v_0.Args[1]
12336                 v_0_0 := v_0.Args[0]
12337                 v_0_1 := v_0.Args[1]
12338                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
12339                         if v_0_0.Op != OpPPC64MOVDconst {
12340                                 continue
12341                         }
12342                         m := auxIntToInt64(v_0_0.AuxInt)
12343                         if !(mergePPC64RShiftMask(m>>uint(s), s, 32) == 0) {
12344                                 continue
12345                         }
12346                         v.reset(OpPPC64MOVDconst)
12347                         v.AuxInt = int64ToAuxInt(0)
12348                         return true
12349                 }
12350                 break
12351         }
12352         // match: (SRWconst (AND (MOVDconst [m]) x) [s])
12353         // cond: mergePPC64AndSrwi(m>>uint(s),s) != 0
12354         // result: (RLWINM [mergePPC64AndSrwi(m>>uint(s),s)] x)
12355         for {
12356                 s := auxIntToInt64(v.AuxInt)
12357                 if v_0.Op != OpPPC64AND {
12358                         break
12359                 }
12360                 _ = v_0.Args[1]
12361                 v_0_0 := v_0.Args[0]
12362                 v_0_1 := v_0.Args[1]
12363                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
12364                         if v_0_0.Op != OpPPC64MOVDconst {
12365                                 continue
12366                         }
12367                         m := auxIntToInt64(v_0_0.AuxInt)
12368                         x := v_0_1
12369                         if !(mergePPC64AndSrwi(m>>uint(s), s) != 0) {
12370                                 continue
12371                         }
12372                         v.reset(OpPPC64RLWINM)
12373                         v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m>>uint(s), s))
12374                         v.AddArg(x)
12375                         return true
12376                 }
12377                 break
12378         }
12379         return false
12380 }
12381 func rewriteValuePPC64_OpPPC64SUB(v *Value) bool {
12382         v_1 := v.Args[1]
12383         v_0 := v.Args[0]
12384         // match: (SUB x (MOVDconst [c]))
12385         // cond: is32Bit(-c)
12386         // result: (ADDconst [-c] x)
12387         for {
12388                 x := v_0
12389                 if v_1.Op != OpPPC64MOVDconst {
12390                         break
12391                 }
12392                 c := auxIntToInt64(v_1.AuxInt)
12393                 if !(is32Bit(-c)) {
12394                         break
12395                 }
12396                 v.reset(OpPPC64ADDconst)
12397                 v.AuxInt = int64ToAuxInt(-c)
12398                 v.AddArg(x)
12399                 return true
12400         }
12401         // match: (SUB (MOVDconst [c]) x)
12402         // cond: is32Bit(c)
12403         // result: (SUBFCconst [c] x)
12404         for {
12405                 if v_0.Op != OpPPC64MOVDconst {
12406                         break
12407                 }
12408                 c := auxIntToInt64(v_0.AuxInt)
12409                 x := v_1
12410                 if !(is32Bit(c)) {
12411                         break
12412                 }
12413                 v.reset(OpPPC64SUBFCconst)
12414                 v.AuxInt = int64ToAuxInt(c)
12415                 v.AddArg(x)
12416                 return true
12417         }
12418         return false
12419 }
12420 func rewriteValuePPC64_OpPPC64SUBE(v *Value) bool {
12421         v_2 := v.Args[2]
12422         v_1 := v.Args[1]
12423         v_0 := v.Args[0]
12424         b := v.Block
12425         typ := &b.Func.Config.Types
12426         // match: (SUBE x y (Select1 <typ.UInt64> (SUBCconst (MOVDconst [0]) [0])))
12427         // result: (SUBC x y)
12428         for {
12429                 x := v_0
12430                 y := v_1
12431                 if v_2.Op != OpSelect1 || v_2.Type != typ.UInt64 {
12432                         break
12433                 }
12434                 v_2_0 := v_2.Args[0]
12435                 if v_2_0.Op != OpPPC64SUBCconst || auxIntToInt64(v_2_0.AuxInt) != 0 {
12436                         break
12437                 }
12438                 v_2_0_0 := v_2_0.Args[0]
12439                 if v_2_0_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 {
12440                         break
12441                 }
12442                 v.reset(OpPPC64SUBC)
12443                 v.AddArg2(x, y)
12444                 return true
12445         }
12446         return false
12447 }
12448 func rewriteValuePPC64_OpPPC64SUBFCconst(v *Value) bool {
12449         v_0 := v.Args[0]
12450         // match: (SUBFCconst [c] (NEG x))
12451         // result: (ADDconst [c] x)
12452         for {
12453                 c := auxIntToInt64(v.AuxInt)
12454                 if v_0.Op != OpPPC64NEG {
12455                         break
12456                 }
12457                 x := v_0.Args[0]
12458                 v.reset(OpPPC64ADDconst)
12459                 v.AuxInt = int64ToAuxInt(c)
12460                 v.AddArg(x)
12461                 return true
12462         }
12463         // match: (SUBFCconst [c] (SUBFCconst [d] x))
12464         // cond: is32Bit(c-d)
12465         // result: (ADDconst [c-d] x)
12466         for {
12467                 c := auxIntToInt64(v.AuxInt)
12468                 if v_0.Op != OpPPC64SUBFCconst {
12469                         break
12470                 }
12471                 d := auxIntToInt64(v_0.AuxInt)
12472                 x := v_0.Args[0]
12473                 if !(is32Bit(c - d)) {
12474                         break
12475                 }
12476                 v.reset(OpPPC64ADDconst)
12477                 v.AuxInt = int64ToAuxInt(c - d)
12478                 v.AddArg(x)
12479                 return true
12480         }
12481         // match: (SUBFCconst [0] x)
12482         // result: (NEG x)
12483         for {
12484                 if auxIntToInt64(v.AuxInt) != 0 {
12485                         break
12486                 }
12487                 x := v_0
12488                 v.reset(OpPPC64NEG)
12489                 v.AddArg(x)
12490                 return true
12491         }
12492         return false
12493 }
12494 func rewriteValuePPC64_OpPPC64XOR(v *Value) bool {
12495         v_1 := v.Args[1]
12496         v_0 := v.Args[0]
12497         // match: (XOR (MOVDconst [c]) (MOVDconst [d]))
12498         // result: (MOVDconst [c^d])
12499         for {
12500                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12501                         if v_0.Op != OpPPC64MOVDconst {
12502                                 continue
12503                         }
12504                         c := auxIntToInt64(v_0.AuxInt)
12505                         if v_1.Op != OpPPC64MOVDconst {
12506                                 continue
12507                         }
12508                         d := auxIntToInt64(v_1.AuxInt)
12509                         v.reset(OpPPC64MOVDconst)
12510                         v.AuxInt = int64ToAuxInt(c ^ d)
12511                         return true
12512                 }
12513                 break
12514         }
12515         // match: (XOR x (MOVDconst [c]))
12516         // cond: isU32Bit(c)
12517         // result: (XORconst [c] x)
12518         for {
12519                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12520                         x := v_0
12521                         if v_1.Op != OpPPC64MOVDconst {
12522                                 continue
12523                         }
12524                         c := auxIntToInt64(v_1.AuxInt)
12525                         if !(isU32Bit(c)) {
12526                                 continue
12527                         }
12528                         v.reset(OpPPC64XORconst)
12529                         v.AuxInt = int64ToAuxInt(c)
12530                         v.AddArg(x)
12531                         return true
12532                 }
12533                 break
12534         }
12535         return false
12536 }
12537 func rewriteValuePPC64_OpPPC64XORconst(v *Value) bool {
12538         v_0 := v.Args[0]
12539         // match: (XORconst [c] (XORconst [d] x))
12540         // result: (XORconst [c^d] x)
12541         for {
12542                 c := auxIntToInt64(v.AuxInt)
12543                 if v_0.Op != OpPPC64XORconst {
12544                         break
12545                 }
12546                 d := auxIntToInt64(v_0.AuxInt)
12547                 x := v_0.Args[0]
12548                 v.reset(OpPPC64XORconst)
12549                 v.AuxInt = int64ToAuxInt(c ^ d)
12550                 v.AddArg(x)
12551                 return true
12552         }
12553         // match: (XORconst [0] x)
12554         // result: x
12555         for {
12556                 if auxIntToInt64(v.AuxInt) != 0 {
12557                         break
12558                 }
12559                 x := v_0
12560                 v.copyOf(x)
12561                 return true
12562         }
12563         // match: (XORconst [1] (SETBCR [n] cmp))
12564         // result: (SETBC [n] cmp)
12565         for {
12566                 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpPPC64SETBCR {
12567                         break
12568                 }
12569                 n := auxIntToInt32(v_0.AuxInt)
12570                 cmp := v_0.Args[0]
12571                 v.reset(OpPPC64SETBC)
12572                 v.AuxInt = int32ToAuxInt(n)
12573                 v.AddArg(cmp)
12574                 return true
12575         }
12576         // match: (XORconst [1] (SETBC [n] cmp))
12577         // result: (SETBCR [n] cmp)
12578         for {
12579                 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpPPC64SETBC {
12580                         break
12581                 }
12582                 n := auxIntToInt32(v_0.AuxInt)
12583                 cmp := v_0.Args[0]
12584                 v.reset(OpPPC64SETBCR)
12585                 v.AuxInt = int32ToAuxInt(n)
12586                 v.AddArg(cmp)
12587                 return true
12588         }
12589         return false
12590 }
12591 func rewriteValuePPC64_OpPanicBounds(v *Value) bool {
12592         v_2 := v.Args[2]
12593         v_1 := v.Args[1]
12594         v_0 := v.Args[0]
12595         // match: (PanicBounds [kind] x y mem)
12596         // cond: boundsABI(kind) == 0
12597         // result: (LoweredPanicBoundsA [kind] x y mem)
12598         for {
12599                 kind := auxIntToInt64(v.AuxInt)
12600                 x := v_0
12601                 y := v_1
12602                 mem := v_2
12603                 if !(boundsABI(kind) == 0) {
12604                         break
12605                 }
12606                 v.reset(OpPPC64LoweredPanicBoundsA)
12607                 v.AuxInt = int64ToAuxInt(kind)
12608                 v.AddArg3(x, y, mem)
12609                 return true
12610         }
12611         // match: (PanicBounds [kind] x y mem)
12612         // cond: boundsABI(kind) == 1
12613         // result: (LoweredPanicBoundsB [kind] x y mem)
12614         for {
12615                 kind := auxIntToInt64(v.AuxInt)
12616                 x := v_0
12617                 y := v_1
12618                 mem := v_2
12619                 if !(boundsABI(kind) == 1) {
12620                         break
12621                 }
12622                 v.reset(OpPPC64LoweredPanicBoundsB)
12623                 v.AuxInt = int64ToAuxInt(kind)
12624                 v.AddArg3(x, y, mem)
12625                 return true
12626         }
12627         // match: (PanicBounds [kind] x y mem)
12628         // cond: boundsABI(kind) == 2
12629         // result: (LoweredPanicBoundsC [kind] x y mem)
12630         for {
12631                 kind := auxIntToInt64(v.AuxInt)
12632                 x := v_0
12633                 y := v_1
12634                 mem := v_2
12635                 if !(boundsABI(kind) == 2) {
12636                         break
12637                 }
12638                 v.reset(OpPPC64LoweredPanicBoundsC)
12639                 v.AuxInt = int64ToAuxInt(kind)
12640                 v.AddArg3(x, y, mem)
12641                 return true
12642         }
12643         return false
12644 }
12645 func rewriteValuePPC64_OpPopCount16(v *Value) bool {
12646         v_0 := v.Args[0]
12647         b := v.Block
12648         typ := &b.Func.Config.Types
12649         // match: (PopCount16 x)
12650         // result: (POPCNTW (MOVHZreg x))
12651         for {
12652                 x := v_0
12653                 v.reset(OpPPC64POPCNTW)
12654                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12655                 v0.AddArg(x)
12656                 v.AddArg(v0)
12657                 return true
12658         }
12659 }
12660 func rewriteValuePPC64_OpPopCount32(v *Value) bool {
12661         v_0 := v.Args[0]
12662         b := v.Block
12663         typ := &b.Func.Config.Types
12664         // match: (PopCount32 x)
12665         // result: (POPCNTW (MOVWZreg x))
12666         for {
12667                 x := v_0
12668                 v.reset(OpPPC64POPCNTW)
12669                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
12670                 v0.AddArg(x)
12671                 v.AddArg(v0)
12672                 return true
12673         }
12674 }
12675 func rewriteValuePPC64_OpPopCount8(v *Value) bool {
12676         v_0 := v.Args[0]
12677         b := v.Block
12678         typ := &b.Func.Config.Types
12679         // match: (PopCount8 x)
12680         // result: (POPCNTB (MOVBZreg x))
12681         for {
12682                 x := v_0
12683                 v.reset(OpPPC64POPCNTB)
12684                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
12685                 v0.AddArg(x)
12686                 v.AddArg(v0)
12687                 return true
12688         }
12689 }
12690 func rewriteValuePPC64_OpPrefetchCache(v *Value) bool {
12691         v_1 := v.Args[1]
12692         v_0 := v.Args[0]
12693         // match: (PrefetchCache ptr mem)
12694         // result: (DCBT ptr mem [0])
12695         for {
12696                 ptr := v_0
12697                 mem := v_1
12698                 v.reset(OpPPC64DCBT)
12699                 v.AuxInt = int64ToAuxInt(0)
12700                 v.AddArg2(ptr, mem)
12701                 return true
12702         }
12703 }
12704 func rewriteValuePPC64_OpPrefetchCacheStreamed(v *Value) bool {
12705         v_1 := v.Args[1]
12706         v_0 := v.Args[0]
12707         // match: (PrefetchCacheStreamed ptr mem)
12708         // result: (DCBT ptr mem [16])
12709         for {
12710                 ptr := v_0
12711                 mem := v_1
12712                 v.reset(OpPPC64DCBT)
12713                 v.AuxInt = int64ToAuxInt(16)
12714                 v.AddArg2(ptr, mem)
12715                 return true
12716         }
12717 }
12718 func rewriteValuePPC64_OpRotateLeft16(v *Value) bool {
12719         v_1 := v.Args[1]
12720         v_0 := v.Args[0]
12721         b := v.Block
12722         typ := &b.Func.Config.Types
12723         // match: (RotateLeft16 <t> x (MOVDconst [c]))
12724         // result: (Or16 (Lsh16x64 <t> x (MOVDconst [c&15])) (Rsh16Ux64 <t> x (MOVDconst [-c&15])))
12725         for {
12726                 t := v.Type
12727                 x := v_0
12728                 if v_1.Op != OpPPC64MOVDconst {
12729                         break
12730                 }
12731                 c := auxIntToInt64(v_1.AuxInt)
12732                 v.reset(OpOr16)
12733                 v0 := b.NewValue0(v.Pos, OpLsh16x64, t)
12734                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12735                 v1.AuxInt = int64ToAuxInt(c & 15)
12736                 v0.AddArg2(x, v1)
12737                 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t)
12738                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12739                 v3.AuxInt = int64ToAuxInt(-c & 15)
12740                 v2.AddArg2(x, v3)
12741                 v.AddArg2(v0, v2)
12742                 return true
12743         }
12744         return false
12745 }
12746 func rewriteValuePPC64_OpRotateLeft8(v *Value) bool {
12747         v_1 := v.Args[1]
12748         v_0 := v.Args[0]
12749         b := v.Block
12750         typ := &b.Func.Config.Types
12751         // match: (RotateLeft8 <t> x (MOVDconst [c]))
12752         // result: (Or8 (Lsh8x64 <t> x (MOVDconst [c&7])) (Rsh8Ux64 <t> x (MOVDconst [-c&7])))
12753         for {
12754                 t := v.Type
12755                 x := v_0
12756                 if v_1.Op != OpPPC64MOVDconst {
12757                         break
12758                 }
12759                 c := auxIntToInt64(v_1.AuxInt)
12760                 v.reset(OpOr8)
12761                 v0 := b.NewValue0(v.Pos, OpLsh8x64, t)
12762                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12763                 v1.AuxInt = int64ToAuxInt(c & 7)
12764                 v0.AddArg2(x, v1)
12765                 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t)
12766                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12767                 v3.AuxInt = int64ToAuxInt(-c & 7)
12768                 v2.AddArg2(x, v3)
12769                 v.AddArg2(v0, v2)
12770                 return true
12771         }
12772         return false
12773 }
12774 func rewriteValuePPC64_OpRsh16Ux16(v *Value) bool {
12775         v_1 := v.Args[1]
12776         v_0 := v.Args[0]
12777         b := v.Block
12778         typ := &b.Func.Config.Types
12779         // match: (Rsh16Ux16 x y)
12780         // cond: shiftIsBounded(v)
12781         // result: (SRD (MOVHZreg x) y)
12782         for {
12783                 x := v_0
12784                 y := v_1
12785                 if !(shiftIsBounded(v)) {
12786                         break
12787                 }
12788                 v.reset(OpPPC64SRD)
12789                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12790                 v0.AddArg(x)
12791                 v.AddArg2(v0, y)
12792                 return true
12793         }
12794         // match: (Rsh16Ux16 <t> x y)
12795         // result: (ISEL [2] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y)))
12796         for {
12797                 t := v.Type
12798                 x := v_0
12799                 y := v_1
12800                 v.reset(OpPPC64ISEL)
12801                 v.AuxInt = int32ToAuxInt(2)
12802                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
12803                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12804                 v1.AddArg(x)
12805                 v0.AddArg2(v1, y)
12806                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12807                 v2.AuxInt = int64ToAuxInt(0)
12808                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
12809                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
12810                 v4.AuxInt = int64ToAuxInt(0xFFF0)
12811                 v4.AddArg(y)
12812                 v3.AddArg(v4)
12813                 v.AddArg3(v0, v2, v3)
12814                 return true
12815         }
12816 }
12817 func rewriteValuePPC64_OpRsh16Ux32(v *Value) bool {
12818         v_1 := v.Args[1]
12819         v_0 := v.Args[0]
12820         b := v.Block
12821         typ := &b.Func.Config.Types
12822         // match: (Rsh16Ux32 x y)
12823         // cond: shiftIsBounded(v)
12824         // result: (SRD (MOVHZreg x) y)
12825         for {
12826                 x := v_0
12827                 y := v_1
12828                 if !(shiftIsBounded(v)) {
12829                         break
12830                 }
12831                 v.reset(OpPPC64SRD)
12832                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12833                 v0.AddArg(x)
12834                 v.AddArg2(v0, y)
12835                 return true
12836         }
12837         // match: (Rsh16Ux32 <t> x y)
12838         // result: (ISEL [0] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [16]))
12839         for {
12840                 t := v.Type
12841                 x := v_0
12842                 y := v_1
12843                 v.reset(OpPPC64ISEL)
12844                 v.AuxInt = int32ToAuxInt(0)
12845                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
12846                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12847                 v1.AddArg(x)
12848                 v0.AddArg2(v1, y)
12849                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12850                 v2.AuxInt = int64ToAuxInt(0)
12851                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
12852                 v3.AuxInt = int32ToAuxInt(16)
12853                 v3.AddArg(y)
12854                 v.AddArg3(v0, v2, v3)
12855                 return true
12856         }
12857 }
12858 func rewriteValuePPC64_OpRsh16Ux64(v *Value) bool {
12859         v_1 := v.Args[1]
12860         v_0 := v.Args[0]
12861         b := v.Block
12862         typ := &b.Func.Config.Types
12863         // match: (Rsh16Ux64 x (MOVDconst [c]))
12864         // cond: uint64(c) < 16
12865         // result: (SRWconst (ZeroExt16to32 x) [c])
12866         for {
12867                 x := v_0
12868                 if v_1.Op != OpPPC64MOVDconst {
12869                         break
12870                 }
12871                 c := auxIntToInt64(v_1.AuxInt)
12872                 if !(uint64(c) < 16) {
12873                         break
12874                 }
12875                 v.reset(OpPPC64SRWconst)
12876                 v.AuxInt = int64ToAuxInt(c)
12877                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
12878                 v0.AddArg(x)
12879                 v.AddArg(v0)
12880                 return true
12881         }
12882         // match: (Rsh16Ux64 x y)
12883         // cond: shiftIsBounded(v)
12884         // result: (SRD (MOVHZreg x) y)
12885         for {
12886                 x := v_0
12887                 y := v_1
12888                 if !(shiftIsBounded(v)) {
12889                         break
12890                 }
12891                 v.reset(OpPPC64SRD)
12892                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12893                 v0.AddArg(x)
12894                 v.AddArg2(v0, y)
12895                 return true
12896         }
12897         // match: (Rsh16Ux64 <t> x y)
12898         // result: (ISEL [0] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [16]))
12899         for {
12900                 t := v.Type
12901                 x := v_0
12902                 y := v_1
12903                 v.reset(OpPPC64ISEL)
12904                 v.AuxInt = int32ToAuxInt(0)
12905                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
12906                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12907                 v1.AddArg(x)
12908                 v0.AddArg2(v1, y)
12909                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12910                 v2.AuxInt = int64ToAuxInt(0)
12911                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
12912                 v3.AuxInt = int64ToAuxInt(16)
12913                 v3.AddArg(y)
12914                 v.AddArg3(v0, v2, v3)
12915                 return true
12916         }
12917 }
12918 func rewriteValuePPC64_OpRsh16Ux8(v *Value) bool {
12919         v_1 := v.Args[1]
12920         v_0 := v.Args[0]
12921         b := v.Block
12922         typ := &b.Func.Config.Types
12923         // match: (Rsh16Ux8 x y)
12924         // cond: shiftIsBounded(v)
12925         // result: (SRD (MOVHZreg x) y)
12926         for {
12927                 x := v_0
12928                 y := v_1
12929                 if !(shiftIsBounded(v)) {
12930                         break
12931                 }
12932                 v.reset(OpPPC64SRD)
12933                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12934                 v0.AddArg(x)
12935                 v.AddArg2(v0, y)
12936                 return true
12937         }
12938         // match: (Rsh16Ux8 <t> x y)
12939         // result: (ISEL [2] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y)))
12940         for {
12941                 t := v.Type
12942                 x := v_0
12943                 y := v_1
12944                 v.reset(OpPPC64ISEL)
12945                 v.AuxInt = int32ToAuxInt(2)
12946                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
12947                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12948                 v1.AddArg(x)
12949                 v0.AddArg2(v1, y)
12950                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12951                 v2.AuxInt = int64ToAuxInt(0)
12952                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
12953                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
12954                 v4.AuxInt = int64ToAuxInt(0x00F0)
12955                 v4.AddArg(y)
12956                 v3.AddArg(v4)
12957                 v.AddArg3(v0, v2, v3)
12958                 return true
12959         }
12960 }
12961 func rewriteValuePPC64_OpRsh16x16(v *Value) bool {
12962         v_1 := v.Args[1]
12963         v_0 := v.Args[0]
12964         b := v.Block
12965         typ := &b.Func.Config.Types
12966         // match: (Rsh16x16 x y)
12967         // cond: shiftIsBounded(v)
12968         // result: (SRAD (MOVHreg x) y)
12969         for {
12970                 x := v_0
12971                 y := v_1
12972                 if !(shiftIsBounded(v)) {
12973                         break
12974                 }
12975                 v.reset(OpPPC64SRAD)
12976                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
12977                 v0.AddArg(x)
12978                 v.AddArg2(v0, y)
12979                 return true
12980         }
12981         // match: (Rsh16x16 <t> x y)
12982         // result: (ISEL [2] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y)))
12983         for {
12984                 t := v.Type
12985                 x := v_0
12986                 y := v_1
12987                 v.reset(OpPPC64ISEL)
12988                 v.AuxInt = int32ToAuxInt(2)
12989                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
12990                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
12991                 v1.AddArg(x)
12992                 v0.AddArg2(v1, y)
12993                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
12994                 v2.AuxInt = int64ToAuxInt(15)
12995                 v2.AddArg(v1)
12996                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
12997                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
12998                 v4.AuxInt = int64ToAuxInt(0xFFF0)
12999                 v4.AddArg(y)
13000                 v3.AddArg(v4)
13001                 v.AddArg3(v0, v2, v3)
13002                 return true
13003         }
13004 }
13005 func rewriteValuePPC64_OpRsh16x32(v *Value) bool {
13006         v_1 := v.Args[1]
13007         v_0 := v.Args[0]
13008         b := v.Block
13009         typ := &b.Func.Config.Types
13010         // match: (Rsh16x32 x y)
13011         // cond: shiftIsBounded(v)
13012         // result: (SRAD (MOVHreg x) y)
13013         for {
13014                 x := v_0
13015                 y := v_1
13016                 if !(shiftIsBounded(v)) {
13017                         break
13018                 }
13019                 v.reset(OpPPC64SRAD)
13020                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13021                 v0.AddArg(x)
13022                 v.AddArg2(v0, y)
13023                 return true
13024         }
13025         // match: (Rsh16x32 <t> x y)
13026         // result: (ISEL [0] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (CMPWUconst y [16]))
13027         for {
13028                 t := v.Type
13029                 x := v_0
13030                 y := v_1
13031                 v.reset(OpPPC64ISEL)
13032                 v.AuxInt = int32ToAuxInt(0)
13033                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13034                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13035                 v1.AddArg(x)
13036                 v0.AddArg2(v1, y)
13037                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13038                 v2.AuxInt = int64ToAuxInt(15)
13039                 v2.AddArg(v1)
13040                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13041                 v3.AuxInt = int32ToAuxInt(16)
13042                 v3.AddArg(y)
13043                 v.AddArg3(v0, v2, v3)
13044                 return true
13045         }
13046 }
13047 func rewriteValuePPC64_OpRsh16x64(v *Value) bool {
13048         v_1 := v.Args[1]
13049         v_0 := v.Args[0]
13050         b := v.Block
13051         typ := &b.Func.Config.Types
13052         // match: (Rsh16x64 x (MOVDconst [c]))
13053         // cond: uint64(c) >= 16
13054         // result: (SRAWconst (SignExt16to32 x) [63])
13055         for {
13056                 x := v_0
13057                 if v_1.Op != OpPPC64MOVDconst {
13058                         break
13059                 }
13060                 c := auxIntToInt64(v_1.AuxInt)
13061                 if !(uint64(c) >= 16) {
13062                         break
13063                 }
13064                 v.reset(OpPPC64SRAWconst)
13065                 v.AuxInt = int64ToAuxInt(63)
13066                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
13067                 v0.AddArg(x)
13068                 v.AddArg(v0)
13069                 return true
13070         }
13071         // match: (Rsh16x64 x (MOVDconst [c]))
13072         // cond: uint64(c) < 16
13073         // result: (SRAWconst (SignExt16to32 x) [c])
13074         for {
13075                 x := v_0
13076                 if v_1.Op != OpPPC64MOVDconst {
13077                         break
13078                 }
13079                 c := auxIntToInt64(v_1.AuxInt)
13080                 if !(uint64(c) < 16) {
13081                         break
13082                 }
13083                 v.reset(OpPPC64SRAWconst)
13084                 v.AuxInt = int64ToAuxInt(c)
13085                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
13086                 v0.AddArg(x)
13087                 v.AddArg(v0)
13088                 return true
13089         }
13090         // match: (Rsh16x64 x y)
13091         // cond: shiftIsBounded(v)
13092         // result: (SRAD (MOVHreg x) y)
13093         for {
13094                 x := v_0
13095                 y := v_1
13096                 if !(shiftIsBounded(v)) {
13097                         break
13098                 }
13099                 v.reset(OpPPC64SRAD)
13100                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13101                 v0.AddArg(x)
13102                 v.AddArg2(v0, y)
13103                 return true
13104         }
13105         // match: (Rsh16x64 <t> x y)
13106         // result: (ISEL [0] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (CMPUconst y [16]))
13107         for {
13108                 t := v.Type
13109                 x := v_0
13110                 y := v_1
13111                 v.reset(OpPPC64ISEL)
13112                 v.AuxInt = int32ToAuxInt(0)
13113                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13114                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13115                 v1.AddArg(x)
13116                 v0.AddArg2(v1, y)
13117                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13118                 v2.AuxInt = int64ToAuxInt(15)
13119                 v2.AddArg(v1)
13120                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13121                 v3.AuxInt = int64ToAuxInt(16)
13122                 v3.AddArg(y)
13123                 v.AddArg3(v0, v2, v3)
13124                 return true
13125         }
13126 }
13127 func rewriteValuePPC64_OpRsh16x8(v *Value) bool {
13128         v_1 := v.Args[1]
13129         v_0 := v.Args[0]
13130         b := v.Block
13131         typ := &b.Func.Config.Types
13132         // match: (Rsh16x8 x y)
13133         // cond: shiftIsBounded(v)
13134         // result: (SRAD (MOVHreg x) y)
13135         for {
13136                 x := v_0
13137                 y := v_1
13138                 if !(shiftIsBounded(v)) {
13139                         break
13140                 }
13141                 v.reset(OpPPC64SRAD)
13142                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13143                 v0.AddArg(x)
13144                 v.AddArg2(v0, y)
13145                 return true
13146         }
13147         // match: (Rsh16x8 <t> x y)
13148         // result: (ISEL [2] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y)))
13149         for {
13150                 t := v.Type
13151                 x := v_0
13152                 y := v_1
13153                 v.reset(OpPPC64ISEL)
13154                 v.AuxInt = int32ToAuxInt(2)
13155                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13156                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13157                 v1.AddArg(x)
13158                 v0.AddArg2(v1, y)
13159                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13160                 v2.AuxInt = int64ToAuxInt(15)
13161                 v2.AddArg(v1)
13162                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13163                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13164                 v4.AuxInt = int64ToAuxInt(0x00F0)
13165                 v4.AddArg(y)
13166                 v3.AddArg(v4)
13167                 v.AddArg3(v0, v2, v3)
13168                 return true
13169         }
13170 }
13171 func rewriteValuePPC64_OpRsh32Ux16(v *Value) bool {
13172         v_1 := v.Args[1]
13173         v_0 := v.Args[0]
13174         b := v.Block
13175         typ := &b.Func.Config.Types
13176         // match: (Rsh32Ux16 x y)
13177         // cond: shiftIsBounded(v)
13178         // result: (SRW x y)
13179         for {
13180                 x := v_0
13181                 y := v_1
13182                 if !(shiftIsBounded(v)) {
13183                         break
13184                 }
13185                 v.reset(OpPPC64SRW)
13186                 v.AddArg2(x, y)
13187                 return true
13188         }
13189         // match: (Rsh32Ux16 <t> x y)
13190         // result: (ISEL [2] (SRW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y)))
13191         for {
13192                 t := v.Type
13193                 x := v_0
13194                 y := v_1
13195                 v.reset(OpPPC64ISEL)
13196                 v.AuxInt = int32ToAuxInt(2)
13197                 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
13198                 v0.AddArg2(x, y)
13199                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13200                 v1.AuxInt = int64ToAuxInt(0)
13201                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13202                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13203                 v3.AuxInt = int64ToAuxInt(0xFFE0)
13204                 v3.AddArg(y)
13205                 v2.AddArg(v3)
13206                 v.AddArg3(v0, v1, v2)
13207                 return true
13208         }
13209 }
13210 func rewriteValuePPC64_OpRsh32Ux32(v *Value) bool {
13211         v_1 := v.Args[1]
13212         v_0 := v.Args[0]
13213         b := v.Block
13214         typ := &b.Func.Config.Types
13215         // match: (Rsh32Ux32 x y)
13216         // cond: shiftIsBounded(v)
13217         // result: (SRW x y)
13218         for {
13219                 x := v_0
13220                 y := v_1
13221                 if !(shiftIsBounded(v)) {
13222                         break
13223                 }
13224                 v.reset(OpPPC64SRW)
13225                 v.AddArg2(x, y)
13226                 return true
13227         }
13228         // match: (Rsh32Ux32 <t> x y)
13229         // result: (ISEL [0] (SRW <t> x y) (MOVDconst [0]) (CMPWUconst y [32]))
13230         for {
13231                 t := v.Type
13232                 x := v_0
13233                 y := v_1
13234                 v.reset(OpPPC64ISEL)
13235                 v.AuxInt = int32ToAuxInt(0)
13236                 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
13237                 v0.AddArg2(x, y)
13238                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13239                 v1.AuxInt = int64ToAuxInt(0)
13240                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13241                 v2.AuxInt = int32ToAuxInt(32)
13242                 v2.AddArg(y)
13243                 v.AddArg3(v0, v1, v2)
13244                 return true
13245         }
13246 }
13247 func rewriteValuePPC64_OpRsh32Ux64(v *Value) bool {
13248         v_1 := v.Args[1]
13249         v_0 := v.Args[0]
13250         b := v.Block
13251         typ := &b.Func.Config.Types
13252         // match: (Rsh32Ux64 x (MOVDconst [c]))
13253         // cond: uint64(c) < 32
13254         // result: (SRWconst x [c])
13255         for {
13256                 x := v_0
13257                 if v_1.Op != OpPPC64MOVDconst {
13258                         break
13259                 }
13260                 c := auxIntToInt64(v_1.AuxInt)
13261                 if !(uint64(c) < 32) {
13262                         break
13263                 }
13264                 v.reset(OpPPC64SRWconst)
13265                 v.AuxInt = int64ToAuxInt(c)
13266                 v.AddArg(x)
13267                 return true
13268         }
13269         // match: (Rsh32Ux64 x y)
13270         // cond: shiftIsBounded(v)
13271         // result: (SRW x y)
13272         for {
13273                 x := v_0
13274                 y := v_1
13275                 if !(shiftIsBounded(v)) {
13276                         break
13277                 }
13278                 v.reset(OpPPC64SRW)
13279                 v.AddArg2(x, y)
13280                 return true
13281         }
13282         // match: (Rsh32Ux64 <t> x y)
13283         // result: (ISEL [0] (SRW <t> x y) (MOVDconst [0]) (CMPUconst y [32]))
13284         for {
13285                 t := v.Type
13286                 x := v_0
13287                 y := v_1
13288                 v.reset(OpPPC64ISEL)
13289                 v.AuxInt = int32ToAuxInt(0)
13290                 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
13291                 v0.AddArg2(x, y)
13292                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13293                 v1.AuxInt = int64ToAuxInt(0)
13294                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13295                 v2.AuxInt = int64ToAuxInt(32)
13296                 v2.AddArg(y)
13297                 v.AddArg3(v0, v1, v2)
13298                 return true
13299         }
13300 }
13301 func rewriteValuePPC64_OpRsh32Ux8(v *Value) bool {
13302         v_1 := v.Args[1]
13303         v_0 := v.Args[0]
13304         b := v.Block
13305         typ := &b.Func.Config.Types
13306         // match: (Rsh32Ux8 x y)
13307         // cond: shiftIsBounded(v)
13308         // result: (SRW x y)
13309         for {
13310                 x := v_0
13311                 y := v_1
13312                 if !(shiftIsBounded(v)) {
13313                         break
13314                 }
13315                 v.reset(OpPPC64SRW)
13316                 v.AddArg2(x, y)
13317                 return true
13318         }
13319         // match: (Rsh32Ux8 <t> x y)
13320         // result: (ISEL [2] (SRW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y)))
13321         for {
13322                 t := v.Type
13323                 x := v_0
13324                 y := v_1
13325                 v.reset(OpPPC64ISEL)
13326                 v.AuxInt = int32ToAuxInt(2)
13327                 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
13328                 v0.AddArg2(x, y)
13329                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13330                 v1.AuxInt = int64ToAuxInt(0)
13331                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13332                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13333                 v3.AuxInt = int64ToAuxInt(0x00E0)
13334                 v3.AddArg(y)
13335                 v2.AddArg(v3)
13336                 v.AddArg3(v0, v1, v2)
13337                 return true
13338         }
13339 }
13340 func rewriteValuePPC64_OpRsh32x16(v *Value) bool {
13341         v_1 := v.Args[1]
13342         v_0 := v.Args[0]
13343         b := v.Block
13344         typ := &b.Func.Config.Types
13345         // match: (Rsh32x16 x y)
13346         // cond: shiftIsBounded(v)
13347         // result: (SRAW x y)
13348         for {
13349                 x := v_0
13350                 y := v_1
13351                 if !(shiftIsBounded(v)) {
13352                         break
13353                 }
13354                 v.reset(OpPPC64SRAW)
13355                 v.AddArg2(x, y)
13356                 return true
13357         }
13358         // match: (Rsh32x16 <t> x y)
13359         // result: (ISEL [2] (SRAW <t> x y) (SRAWconst <t> x [31]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y)))
13360         for {
13361                 t := v.Type
13362                 x := v_0
13363                 y := v_1
13364                 v.reset(OpPPC64ISEL)
13365                 v.AuxInt = int32ToAuxInt(2)
13366                 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13367                 v0.AddArg2(x, y)
13368                 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13369                 v1.AuxInt = int64ToAuxInt(31)
13370                 v1.AddArg(x)
13371                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13372                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13373                 v3.AuxInt = int64ToAuxInt(0xFFE0)
13374                 v3.AddArg(y)
13375                 v2.AddArg(v3)
13376                 v.AddArg3(v0, v1, v2)
13377                 return true
13378         }
13379 }
13380 func rewriteValuePPC64_OpRsh32x32(v *Value) bool {
13381         v_1 := v.Args[1]
13382         v_0 := v.Args[0]
13383         b := v.Block
13384         // match: (Rsh32x32 x y)
13385         // cond: shiftIsBounded(v)
13386         // result: (SRAW x y)
13387         for {
13388                 x := v_0
13389                 y := v_1
13390                 if !(shiftIsBounded(v)) {
13391                         break
13392                 }
13393                 v.reset(OpPPC64SRAW)
13394                 v.AddArg2(x, y)
13395                 return true
13396         }
13397         // match: (Rsh32x32 <t> x y)
13398         // result: (ISEL [0] (SRAW <t> x y) (SRAWconst <t> x [31]) (CMPWUconst y [32]))
13399         for {
13400                 t := v.Type
13401                 x := v_0
13402                 y := v_1
13403                 v.reset(OpPPC64ISEL)
13404                 v.AuxInt = int32ToAuxInt(0)
13405                 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13406                 v0.AddArg2(x, y)
13407                 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13408                 v1.AuxInt = int64ToAuxInt(31)
13409                 v1.AddArg(x)
13410                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13411                 v2.AuxInt = int32ToAuxInt(32)
13412                 v2.AddArg(y)
13413                 v.AddArg3(v0, v1, v2)
13414                 return true
13415         }
13416 }
13417 func rewriteValuePPC64_OpRsh32x64(v *Value) bool {
13418         v_1 := v.Args[1]
13419         v_0 := v.Args[0]
13420         b := v.Block
13421         // match: (Rsh32x64 x (MOVDconst [c]))
13422         // cond: uint64(c) >= 32
13423         // result: (SRAWconst x [63])
13424         for {
13425                 x := v_0
13426                 if v_1.Op != OpPPC64MOVDconst {
13427                         break
13428                 }
13429                 c := auxIntToInt64(v_1.AuxInt)
13430                 if !(uint64(c) >= 32) {
13431                         break
13432                 }
13433                 v.reset(OpPPC64SRAWconst)
13434                 v.AuxInt = int64ToAuxInt(63)
13435                 v.AddArg(x)
13436                 return true
13437         }
13438         // match: (Rsh32x64 x (MOVDconst [c]))
13439         // cond: uint64(c) < 32
13440         // result: (SRAWconst x [c])
13441         for {
13442                 x := v_0
13443                 if v_1.Op != OpPPC64MOVDconst {
13444                         break
13445                 }
13446                 c := auxIntToInt64(v_1.AuxInt)
13447                 if !(uint64(c) < 32) {
13448                         break
13449                 }
13450                 v.reset(OpPPC64SRAWconst)
13451                 v.AuxInt = int64ToAuxInt(c)
13452                 v.AddArg(x)
13453                 return true
13454         }
13455         // match: (Rsh32x64 x y)
13456         // cond: shiftIsBounded(v)
13457         // result: (SRAW x y)
13458         for {
13459                 x := v_0
13460                 y := v_1
13461                 if !(shiftIsBounded(v)) {
13462                         break
13463                 }
13464                 v.reset(OpPPC64SRAW)
13465                 v.AddArg2(x, y)
13466                 return true
13467         }
13468         // match: (Rsh32x64 <t> x y)
13469         // result: (ISEL [0] (SRAW <t> x y) (SRAWconst <t> x [31]) (CMPUconst y [32]))
13470         for {
13471                 t := v.Type
13472                 x := v_0
13473                 y := v_1
13474                 v.reset(OpPPC64ISEL)
13475                 v.AuxInt = int32ToAuxInt(0)
13476                 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13477                 v0.AddArg2(x, y)
13478                 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13479                 v1.AuxInt = int64ToAuxInt(31)
13480                 v1.AddArg(x)
13481                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13482                 v2.AuxInt = int64ToAuxInt(32)
13483                 v2.AddArg(y)
13484                 v.AddArg3(v0, v1, v2)
13485                 return true
13486         }
13487 }
13488 func rewriteValuePPC64_OpRsh32x8(v *Value) bool {
13489         v_1 := v.Args[1]
13490         v_0 := v.Args[0]
13491         b := v.Block
13492         typ := &b.Func.Config.Types
13493         // match: (Rsh32x8 x y)
13494         // cond: shiftIsBounded(v)
13495         // result: (SRAW x y)
13496         for {
13497                 x := v_0
13498                 y := v_1
13499                 if !(shiftIsBounded(v)) {
13500                         break
13501                 }
13502                 v.reset(OpPPC64SRAW)
13503                 v.AddArg2(x, y)
13504                 return true
13505         }
13506         // match: (Rsh32x8 <t> x y)
13507         // result: (ISEL [2] (SRAW <t> x y) (SRAWconst <t> x [31]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y)))
13508         for {
13509                 t := v.Type
13510                 x := v_0
13511                 y := v_1
13512                 v.reset(OpPPC64ISEL)
13513                 v.AuxInt = int32ToAuxInt(2)
13514                 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13515                 v0.AddArg2(x, y)
13516                 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13517                 v1.AuxInt = int64ToAuxInt(31)
13518                 v1.AddArg(x)
13519                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13520                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13521                 v3.AuxInt = int64ToAuxInt(0x00E0)
13522                 v3.AddArg(y)
13523                 v2.AddArg(v3)
13524                 v.AddArg3(v0, v1, v2)
13525                 return true
13526         }
13527 }
13528 func rewriteValuePPC64_OpRsh64Ux16(v *Value) bool {
13529         v_1 := v.Args[1]
13530         v_0 := v.Args[0]
13531         b := v.Block
13532         typ := &b.Func.Config.Types
13533         // match: (Rsh64Ux16 x y)
13534         // cond: shiftIsBounded(v)
13535         // result: (SRD x y)
13536         for {
13537                 x := v_0
13538                 y := v_1
13539                 if !(shiftIsBounded(v)) {
13540                         break
13541                 }
13542                 v.reset(OpPPC64SRD)
13543                 v.AddArg2(x, y)
13544                 return true
13545         }
13546         // match: (Rsh64Ux16 <t> x y)
13547         // result: (ISEL [2] (SRD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y)))
13548         for {
13549                 t := v.Type
13550                 x := v_0
13551                 y := v_1
13552                 v.reset(OpPPC64ISEL)
13553                 v.AuxInt = int32ToAuxInt(2)
13554                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13555                 v0.AddArg2(x, y)
13556                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13557                 v1.AuxInt = int64ToAuxInt(0)
13558                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13559                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13560                 v3.AuxInt = int64ToAuxInt(0xFFC0)
13561                 v3.AddArg(y)
13562                 v2.AddArg(v3)
13563                 v.AddArg3(v0, v1, v2)
13564                 return true
13565         }
13566 }
13567 func rewriteValuePPC64_OpRsh64Ux32(v *Value) bool {
13568         v_1 := v.Args[1]
13569         v_0 := v.Args[0]
13570         b := v.Block
13571         typ := &b.Func.Config.Types
13572         // match: (Rsh64Ux32 x y)
13573         // cond: shiftIsBounded(v)
13574         // result: (SRD x y)
13575         for {
13576                 x := v_0
13577                 y := v_1
13578                 if !(shiftIsBounded(v)) {
13579                         break
13580                 }
13581                 v.reset(OpPPC64SRD)
13582                 v.AddArg2(x, y)
13583                 return true
13584         }
13585         // match: (Rsh64Ux32 <t> x y)
13586         // result: (ISEL [0] (SRD <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
13587         for {
13588                 t := v.Type
13589                 x := v_0
13590                 y := v_1
13591                 v.reset(OpPPC64ISEL)
13592                 v.AuxInt = int32ToAuxInt(0)
13593                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13594                 v0.AddArg2(x, y)
13595                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13596                 v1.AuxInt = int64ToAuxInt(0)
13597                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13598                 v2.AuxInt = int32ToAuxInt(64)
13599                 v2.AddArg(y)
13600                 v.AddArg3(v0, v1, v2)
13601                 return true
13602         }
13603 }
13604 func rewriteValuePPC64_OpRsh64Ux64(v *Value) bool {
13605         v_1 := v.Args[1]
13606         v_0 := v.Args[0]
13607         b := v.Block
13608         typ := &b.Func.Config.Types
13609         // match: (Rsh64Ux64 x (MOVDconst [c]))
13610         // cond: uint64(c) < 64
13611         // result: (SRDconst x [c])
13612         for {
13613                 x := v_0
13614                 if v_1.Op != OpPPC64MOVDconst {
13615                         break
13616                 }
13617                 c := auxIntToInt64(v_1.AuxInt)
13618                 if !(uint64(c) < 64) {
13619                         break
13620                 }
13621                 v.reset(OpPPC64SRDconst)
13622                 v.AuxInt = int64ToAuxInt(c)
13623                 v.AddArg(x)
13624                 return true
13625         }
13626         // match: (Rsh64Ux64 x y)
13627         // cond: shiftIsBounded(v)
13628         // result: (SRD x y)
13629         for {
13630                 x := v_0
13631                 y := v_1
13632                 if !(shiftIsBounded(v)) {
13633                         break
13634                 }
13635                 v.reset(OpPPC64SRD)
13636                 v.AddArg2(x, y)
13637                 return true
13638         }
13639         // match: (Rsh64Ux64 <t> x y)
13640         // result: (ISEL [0] (SRD <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
13641         for {
13642                 t := v.Type
13643                 x := v_0
13644                 y := v_1
13645                 v.reset(OpPPC64ISEL)
13646                 v.AuxInt = int32ToAuxInt(0)
13647                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13648                 v0.AddArg2(x, y)
13649                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13650                 v1.AuxInt = int64ToAuxInt(0)
13651                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13652                 v2.AuxInt = int64ToAuxInt(64)
13653                 v2.AddArg(y)
13654                 v.AddArg3(v0, v1, v2)
13655                 return true
13656         }
13657 }
13658 func rewriteValuePPC64_OpRsh64Ux8(v *Value) bool {
13659         v_1 := v.Args[1]
13660         v_0 := v.Args[0]
13661         b := v.Block
13662         typ := &b.Func.Config.Types
13663         // match: (Rsh64Ux8 x y)
13664         // cond: shiftIsBounded(v)
13665         // result: (SRD x y)
13666         for {
13667                 x := v_0
13668                 y := v_1
13669                 if !(shiftIsBounded(v)) {
13670                         break
13671                 }
13672                 v.reset(OpPPC64SRD)
13673                 v.AddArg2(x, y)
13674                 return true
13675         }
13676         // match: (Rsh64Ux8 <t> x y)
13677         // result: (ISEL [2] (SRD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y)))
13678         for {
13679                 t := v.Type
13680                 x := v_0
13681                 y := v_1
13682                 v.reset(OpPPC64ISEL)
13683                 v.AuxInt = int32ToAuxInt(2)
13684                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13685                 v0.AddArg2(x, y)
13686                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13687                 v1.AuxInt = int64ToAuxInt(0)
13688                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13689                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13690                 v3.AuxInt = int64ToAuxInt(0x00C0)
13691                 v3.AddArg(y)
13692                 v2.AddArg(v3)
13693                 v.AddArg3(v0, v1, v2)
13694                 return true
13695         }
13696 }
13697 func rewriteValuePPC64_OpRsh64x16(v *Value) bool {
13698         v_1 := v.Args[1]
13699         v_0 := v.Args[0]
13700         b := v.Block
13701         typ := &b.Func.Config.Types
13702         // match: (Rsh64x16 x y)
13703         // cond: shiftIsBounded(v)
13704         // result: (SRAD x y)
13705         for {
13706                 x := v_0
13707                 y := v_1
13708                 if !(shiftIsBounded(v)) {
13709                         break
13710                 }
13711                 v.reset(OpPPC64SRAD)
13712                 v.AddArg2(x, y)
13713                 return true
13714         }
13715         // match: (Rsh64x16 <t> x y)
13716         // result: (ISEL [2] (SRAD <t> x y) (SRADconst <t> x [63]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y)))
13717         for {
13718                 t := v.Type
13719                 x := v_0
13720                 y := v_1
13721                 v.reset(OpPPC64ISEL)
13722                 v.AuxInt = int32ToAuxInt(2)
13723                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13724                 v0.AddArg2(x, y)
13725                 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13726                 v1.AuxInt = int64ToAuxInt(63)
13727                 v1.AddArg(x)
13728                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13729                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13730                 v3.AuxInt = int64ToAuxInt(0xFFC0)
13731                 v3.AddArg(y)
13732                 v2.AddArg(v3)
13733                 v.AddArg3(v0, v1, v2)
13734                 return true
13735         }
13736 }
13737 func rewriteValuePPC64_OpRsh64x32(v *Value) bool {
13738         v_1 := v.Args[1]
13739         v_0 := v.Args[0]
13740         b := v.Block
13741         // match: (Rsh64x32 x y)
13742         // cond: shiftIsBounded(v)
13743         // result: (SRAD x y)
13744         for {
13745                 x := v_0
13746                 y := v_1
13747                 if !(shiftIsBounded(v)) {
13748                         break
13749                 }
13750                 v.reset(OpPPC64SRAD)
13751                 v.AddArg2(x, y)
13752                 return true
13753         }
13754         // match: (Rsh64x32 <t> x y)
13755         // result: (ISEL [0] (SRAD <t> x y) (SRADconst <t> x [63]) (CMPWUconst y [64]))
13756         for {
13757                 t := v.Type
13758                 x := v_0
13759                 y := v_1
13760                 v.reset(OpPPC64ISEL)
13761                 v.AuxInt = int32ToAuxInt(0)
13762                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13763                 v0.AddArg2(x, y)
13764                 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13765                 v1.AuxInt = int64ToAuxInt(63)
13766                 v1.AddArg(x)
13767                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13768                 v2.AuxInt = int32ToAuxInt(64)
13769                 v2.AddArg(y)
13770                 v.AddArg3(v0, v1, v2)
13771                 return true
13772         }
13773 }
13774 func rewriteValuePPC64_OpRsh64x64(v *Value) bool {
13775         v_1 := v.Args[1]
13776         v_0 := v.Args[0]
13777         b := v.Block
13778         // match: (Rsh64x64 x (MOVDconst [c]))
13779         // cond: uint64(c) >= 64
13780         // result: (SRADconst x [63])
13781         for {
13782                 x := v_0
13783                 if v_1.Op != OpPPC64MOVDconst {
13784                         break
13785                 }
13786                 c := auxIntToInt64(v_1.AuxInt)
13787                 if !(uint64(c) >= 64) {
13788                         break
13789                 }
13790                 v.reset(OpPPC64SRADconst)
13791                 v.AuxInt = int64ToAuxInt(63)
13792                 v.AddArg(x)
13793                 return true
13794         }
13795         // match: (Rsh64x64 x (MOVDconst [c]))
13796         // cond: uint64(c) < 64
13797         // result: (SRADconst x [c])
13798         for {
13799                 x := v_0
13800                 if v_1.Op != OpPPC64MOVDconst {
13801                         break
13802                 }
13803                 c := auxIntToInt64(v_1.AuxInt)
13804                 if !(uint64(c) < 64) {
13805                         break
13806                 }
13807                 v.reset(OpPPC64SRADconst)
13808                 v.AuxInt = int64ToAuxInt(c)
13809                 v.AddArg(x)
13810                 return true
13811         }
13812         // match: (Rsh64x64 x y)
13813         // cond: shiftIsBounded(v)
13814         // result: (SRAD x y)
13815         for {
13816                 x := v_0
13817                 y := v_1
13818                 if !(shiftIsBounded(v)) {
13819                         break
13820                 }
13821                 v.reset(OpPPC64SRAD)
13822                 v.AddArg2(x, y)
13823                 return true
13824         }
13825         // match: (Rsh64x64 <t> x y)
13826         // result: (ISEL [0] (SRAD <t> x y) (SRADconst <t> x [63]) (CMPUconst y [64]))
13827         for {
13828                 t := v.Type
13829                 x := v_0
13830                 y := v_1
13831                 v.reset(OpPPC64ISEL)
13832                 v.AuxInt = int32ToAuxInt(0)
13833                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13834                 v0.AddArg2(x, y)
13835                 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13836                 v1.AuxInt = int64ToAuxInt(63)
13837                 v1.AddArg(x)
13838                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13839                 v2.AuxInt = int64ToAuxInt(64)
13840                 v2.AddArg(y)
13841                 v.AddArg3(v0, v1, v2)
13842                 return true
13843         }
13844 }
13845 func rewriteValuePPC64_OpRsh64x8(v *Value) bool {
13846         v_1 := v.Args[1]
13847         v_0 := v.Args[0]
13848         b := v.Block
13849         typ := &b.Func.Config.Types
13850         // match: (Rsh64x8 x y)
13851         // cond: shiftIsBounded(v)
13852         // result: (SRAD x y)
13853         for {
13854                 x := v_0
13855                 y := v_1
13856                 if !(shiftIsBounded(v)) {
13857                         break
13858                 }
13859                 v.reset(OpPPC64SRAD)
13860                 v.AddArg2(x, y)
13861                 return true
13862         }
13863         // match: (Rsh64x8 <t> x y)
13864         // result: (ISEL [2] (SRAD <t> x y) (SRADconst <t> x [63]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y)))
13865         for {
13866                 t := v.Type
13867                 x := v_0
13868                 y := v_1
13869                 v.reset(OpPPC64ISEL)
13870                 v.AuxInt = int32ToAuxInt(2)
13871                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13872                 v0.AddArg2(x, y)
13873                 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13874                 v1.AuxInt = int64ToAuxInt(63)
13875                 v1.AddArg(x)
13876                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13877                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13878                 v3.AuxInt = int64ToAuxInt(0x00C0)
13879                 v3.AddArg(y)
13880                 v2.AddArg(v3)
13881                 v.AddArg3(v0, v1, v2)
13882                 return true
13883         }
13884 }
13885 func rewriteValuePPC64_OpRsh8Ux16(v *Value) bool {
13886         v_1 := v.Args[1]
13887         v_0 := v.Args[0]
13888         b := v.Block
13889         typ := &b.Func.Config.Types
13890         // match: (Rsh8Ux16 x y)
13891         // cond: shiftIsBounded(v)
13892         // result: (SRD (MOVBZreg x) y)
13893         for {
13894                 x := v_0
13895                 y := v_1
13896                 if !(shiftIsBounded(v)) {
13897                         break
13898                 }
13899                 v.reset(OpPPC64SRD)
13900                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13901                 v0.AddArg(x)
13902                 v.AddArg2(v0, y)
13903                 return true
13904         }
13905         // match: (Rsh8Ux16 <t> x y)
13906         // result: (ISEL [2] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y)))
13907         for {
13908                 t := v.Type
13909                 x := v_0
13910                 y := v_1
13911                 v.reset(OpPPC64ISEL)
13912                 v.AuxInt = int32ToAuxInt(2)
13913                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13914                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13915                 v1.AddArg(x)
13916                 v0.AddArg2(v1, y)
13917                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13918                 v2.AuxInt = int64ToAuxInt(0)
13919                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13920                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13921                 v4.AuxInt = int64ToAuxInt(0xFFF8)
13922                 v4.AddArg(y)
13923                 v3.AddArg(v4)
13924                 v.AddArg3(v0, v2, v3)
13925                 return true
13926         }
13927 }
13928 func rewriteValuePPC64_OpRsh8Ux32(v *Value) bool {
13929         v_1 := v.Args[1]
13930         v_0 := v.Args[0]
13931         b := v.Block
13932         typ := &b.Func.Config.Types
13933         // match: (Rsh8Ux32 x y)
13934         // cond: shiftIsBounded(v)
13935         // result: (SRD (MOVBZreg x) y)
13936         for {
13937                 x := v_0
13938                 y := v_1
13939                 if !(shiftIsBounded(v)) {
13940                         break
13941                 }
13942                 v.reset(OpPPC64SRD)
13943                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13944                 v0.AddArg(x)
13945                 v.AddArg2(v0, y)
13946                 return true
13947         }
13948         // match: (Rsh8Ux32 <t> x y)
13949         // result: (ISEL [0] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [8]))
13950         for {
13951                 t := v.Type
13952                 x := v_0
13953                 y := v_1
13954                 v.reset(OpPPC64ISEL)
13955                 v.AuxInt = int32ToAuxInt(0)
13956                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13957                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13958                 v1.AddArg(x)
13959                 v0.AddArg2(v1, y)
13960                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13961                 v2.AuxInt = int64ToAuxInt(0)
13962                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13963                 v3.AuxInt = int32ToAuxInt(8)
13964                 v3.AddArg(y)
13965                 v.AddArg3(v0, v2, v3)
13966                 return true
13967         }
13968 }
13969 func rewriteValuePPC64_OpRsh8Ux64(v *Value) bool {
13970         v_1 := v.Args[1]
13971         v_0 := v.Args[0]
13972         b := v.Block
13973         typ := &b.Func.Config.Types
13974         // match: (Rsh8Ux64 x (MOVDconst [c]))
13975         // cond: uint64(c) < 8
13976         // result: (SRWconst (ZeroExt8to32 x) [c])
13977         for {
13978                 x := v_0
13979                 if v_1.Op != OpPPC64MOVDconst {
13980                         break
13981                 }
13982                 c := auxIntToInt64(v_1.AuxInt)
13983                 if !(uint64(c) < 8) {
13984                         break
13985                 }
13986                 v.reset(OpPPC64SRWconst)
13987                 v.AuxInt = int64ToAuxInt(c)
13988                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
13989                 v0.AddArg(x)
13990                 v.AddArg(v0)
13991                 return true
13992         }
13993         // match: (Rsh8Ux64 x y)
13994         // cond: shiftIsBounded(v)
13995         // result: (SRD (MOVBZreg x) y)
13996         for {
13997                 x := v_0
13998                 y := v_1
13999                 if !(shiftIsBounded(v)) {
14000                         break
14001                 }
14002                 v.reset(OpPPC64SRD)
14003                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
14004                 v0.AddArg(x)
14005                 v.AddArg2(v0, y)
14006                 return true
14007         }
14008         // match: (Rsh8Ux64 <t> x y)
14009         // result: (ISEL [0] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [8]))
14010         for {
14011                 t := v.Type
14012                 x := v_0
14013                 y := v_1
14014                 v.reset(OpPPC64ISEL)
14015                 v.AuxInt = int32ToAuxInt(0)
14016                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
14017                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
14018                 v1.AddArg(x)
14019                 v0.AddArg2(v1, y)
14020                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14021                 v2.AuxInt = int64ToAuxInt(0)
14022                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
14023                 v3.AuxInt = int64ToAuxInt(8)
14024                 v3.AddArg(y)
14025                 v.AddArg3(v0, v2, v3)
14026                 return true
14027         }
14028 }
14029 func rewriteValuePPC64_OpRsh8Ux8(v *Value) bool {
14030         v_1 := v.Args[1]
14031         v_0 := v.Args[0]
14032         b := v.Block
14033         typ := &b.Func.Config.Types
14034         // match: (Rsh8Ux8 x y)
14035         // cond: shiftIsBounded(v)
14036         // result: (SRD (MOVBZreg x) y)
14037         for {
14038                 x := v_0
14039                 y := v_1
14040                 if !(shiftIsBounded(v)) {
14041                         break
14042                 }
14043                 v.reset(OpPPC64SRD)
14044                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
14045                 v0.AddArg(x)
14046                 v.AddArg2(v0, y)
14047                 return true
14048         }
14049         // match: (Rsh8Ux8 <t> x y)
14050         // result: (ISEL [2] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y)))
14051         for {
14052                 t := v.Type
14053                 x := v_0
14054                 y := v_1
14055                 v.reset(OpPPC64ISEL)
14056                 v.AuxInt = int32ToAuxInt(2)
14057                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
14058                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
14059                 v1.AddArg(x)
14060                 v0.AddArg2(v1, y)
14061                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14062                 v2.AuxInt = int64ToAuxInt(0)
14063                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14064                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14065                 v4.AuxInt = int64ToAuxInt(0x00F8)
14066                 v4.AddArg(y)
14067                 v3.AddArg(v4)
14068                 v.AddArg3(v0, v2, v3)
14069                 return true
14070         }
14071 }
14072 func rewriteValuePPC64_OpRsh8x16(v *Value) bool {
14073         v_1 := v.Args[1]
14074         v_0 := v.Args[0]
14075         b := v.Block
14076         typ := &b.Func.Config.Types
14077         // match: (Rsh8x16 x y)
14078         // cond: shiftIsBounded(v)
14079         // result: (SRAD (MOVBreg x) y)
14080         for {
14081                 x := v_0
14082                 y := v_1
14083                 if !(shiftIsBounded(v)) {
14084                         break
14085                 }
14086                 v.reset(OpPPC64SRAD)
14087                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14088                 v0.AddArg(x)
14089                 v.AddArg2(v0, y)
14090                 return true
14091         }
14092         // match: (Rsh8x16 <t> x y)
14093         // result: (ISEL [2] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y)))
14094         for {
14095                 t := v.Type
14096                 x := v_0
14097                 y := v_1
14098                 v.reset(OpPPC64ISEL)
14099                 v.AuxInt = int32ToAuxInt(2)
14100                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
14101                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14102                 v1.AddArg(x)
14103                 v0.AddArg2(v1, y)
14104                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14105                 v2.AuxInt = int64ToAuxInt(7)
14106                 v2.AddArg(v1)
14107                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14108                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14109                 v4.AuxInt = int64ToAuxInt(0xFFF8)
14110                 v4.AddArg(y)
14111                 v3.AddArg(v4)
14112                 v.AddArg3(v0, v2, v3)
14113                 return true
14114         }
14115 }
14116 func rewriteValuePPC64_OpRsh8x32(v *Value) bool {
14117         v_1 := v.Args[1]
14118         v_0 := v.Args[0]
14119         b := v.Block
14120         typ := &b.Func.Config.Types
14121         // match: (Rsh8x32 x y)
14122         // cond: shiftIsBounded(v)
14123         // result: (SRAD (MOVBreg x) y)
14124         for {
14125                 x := v_0
14126                 y := v_1
14127                 if !(shiftIsBounded(v)) {
14128                         break
14129                 }
14130                 v.reset(OpPPC64SRAD)
14131                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14132                 v0.AddArg(x)
14133                 v.AddArg2(v0, y)
14134                 return true
14135         }
14136         // match: (Rsh8x32 <t> x y)
14137         // result: (ISEL [0] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (CMPWUconst y [8]))
14138         for {
14139                 t := v.Type
14140                 x := v_0
14141                 y := v_1
14142                 v.reset(OpPPC64ISEL)
14143                 v.AuxInt = int32ToAuxInt(0)
14144                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
14145                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14146                 v1.AddArg(x)
14147                 v0.AddArg2(v1, y)
14148                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14149                 v2.AuxInt = int64ToAuxInt(7)
14150                 v2.AddArg(v1)
14151                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
14152                 v3.AuxInt = int32ToAuxInt(8)
14153                 v3.AddArg(y)
14154                 v.AddArg3(v0, v2, v3)
14155                 return true
14156         }
14157 }
14158 func rewriteValuePPC64_OpRsh8x64(v *Value) bool {
14159         v_1 := v.Args[1]
14160         v_0 := v.Args[0]
14161         b := v.Block
14162         typ := &b.Func.Config.Types
14163         // match: (Rsh8x64 x (MOVDconst [c]))
14164         // cond: uint64(c) >= 8
14165         // result: (SRAWconst (SignExt8to32 x) [63])
14166         for {
14167                 x := v_0
14168                 if v_1.Op != OpPPC64MOVDconst {
14169                         break
14170                 }
14171                 c := auxIntToInt64(v_1.AuxInt)
14172                 if !(uint64(c) >= 8) {
14173                         break
14174                 }
14175                 v.reset(OpPPC64SRAWconst)
14176                 v.AuxInt = int64ToAuxInt(63)
14177                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
14178                 v0.AddArg(x)
14179                 v.AddArg(v0)
14180                 return true
14181         }
14182         // match: (Rsh8x64 x (MOVDconst [c]))
14183         // cond: uint64(c) < 8
14184         // result: (SRAWconst (SignExt8to32 x) [c])
14185         for {
14186                 x := v_0
14187                 if v_1.Op != OpPPC64MOVDconst {
14188                         break
14189                 }
14190                 c := auxIntToInt64(v_1.AuxInt)
14191                 if !(uint64(c) < 8) {
14192                         break
14193                 }
14194                 v.reset(OpPPC64SRAWconst)
14195                 v.AuxInt = int64ToAuxInt(c)
14196                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
14197                 v0.AddArg(x)
14198                 v.AddArg(v0)
14199                 return true
14200         }
14201         // match: (Rsh8x64 x y)
14202         // cond: shiftIsBounded(v)
14203         // result: (SRAD (MOVBreg x) y)
14204         for {
14205                 x := v_0
14206                 y := v_1
14207                 if !(shiftIsBounded(v)) {
14208                         break
14209                 }
14210                 v.reset(OpPPC64SRAD)
14211                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14212                 v0.AddArg(x)
14213                 v.AddArg2(v0, y)
14214                 return true
14215         }
14216         // match: (Rsh8x64 <t> x y)
14217         // result: (ISEL [0] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (CMPUconst y [8]))
14218         for {
14219                 t := v.Type
14220                 x := v_0
14221                 y := v_1
14222                 v.reset(OpPPC64ISEL)
14223                 v.AuxInt = int32ToAuxInt(0)
14224                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
14225                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14226                 v1.AddArg(x)
14227                 v0.AddArg2(v1, y)
14228                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14229                 v2.AuxInt = int64ToAuxInt(7)
14230                 v2.AddArg(v1)
14231                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
14232                 v3.AuxInt = int64ToAuxInt(8)
14233                 v3.AddArg(y)
14234                 v.AddArg3(v0, v2, v3)
14235                 return true
14236         }
14237 }
14238 func rewriteValuePPC64_OpRsh8x8(v *Value) bool {
14239         v_1 := v.Args[1]
14240         v_0 := v.Args[0]
14241         b := v.Block
14242         typ := &b.Func.Config.Types
14243         // match: (Rsh8x8 x y)
14244         // cond: shiftIsBounded(v)
14245         // result: (SRAD (MOVBreg x) y)
14246         for {
14247                 x := v_0
14248                 y := v_1
14249                 if !(shiftIsBounded(v)) {
14250                         break
14251                 }
14252                 v.reset(OpPPC64SRAD)
14253                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14254                 v0.AddArg(x)
14255                 v.AddArg2(v0, y)
14256                 return true
14257         }
14258         // match: (Rsh8x8 <t> x y)
14259         // result: (ISEL [2] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y)))
14260         for {
14261                 t := v.Type
14262                 x := v_0
14263                 y := v_1
14264                 v.reset(OpPPC64ISEL)
14265                 v.AuxInt = int32ToAuxInt(2)
14266                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
14267                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14268                 v1.AddArg(x)
14269                 v0.AddArg2(v1, y)
14270                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14271                 v2.AuxInt = int64ToAuxInt(7)
14272                 v2.AddArg(v1)
14273                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14274                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14275                 v4.AuxInt = int64ToAuxInt(0x00F8)
14276                 v4.AddArg(y)
14277                 v3.AddArg(v4)
14278                 v.AddArg3(v0, v2, v3)
14279                 return true
14280         }
14281 }
14282 func rewriteValuePPC64_OpSelect0(v *Value) bool {
14283         v_0 := v.Args[0]
14284         b := v.Block
14285         typ := &b.Func.Config.Types
14286         // match: (Select0 (Mul64uhilo x y))
14287         // result: (MULHDU x y)
14288         for {
14289                 if v_0.Op != OpMul64uhilo {
14290                         break
14291                 }
14292                 y := v_0.Args[1]
14293                 x := v_0.Args[0]
14294                 v.reset(OpPPC64MULHDU)
14295                 v.AddArg2(x, y)
14296                 return true
14297         }
14298         // match: (Select0 (Add64carry x y c))
14299         // result: (Select0 <typ.UInt64> (ADDE x y (Select1 <typ.UInt64> (ADDCconst c [-1]))))
14300         for {
14301                 if v_0.Op != OpAdd64carry {
14302                         break
14303                 }
14304                 c := v_0.Args[2]
14305                 x := v_0.Args[0]
14306                 y := v_0.Args[1]
14307                 v.reset(OpSelect0)
14308                 v.Type = typ.UInt64
14309                 v0 := b.NewValue0(v.Pos, OpPPC64ADDE, types.NewTuple(typ.UInt64, typ.UInt64))
14310                 v1 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14311                 v2 := b.NewValue0(v.Pos, OpPPC64ADDCconst, types.NewTuple(typ.UInt64, typ.UInt64))
14312                 v2.AuxInt = int64ToAuxInt(-1)
14313                 v2.AddArg(c)
14314                 v1.AddArg(v2)
14315                 v0.AddArg3(x, y, v1)
14316                 v.AddArg(v0)
14317                 return true
14318         }
14319         // match: (Select0 (Sub64borrow x y c))
14320         // result: (Select0 <typ.UInt64> (SUBE x y (Select1 <typ.UInt64> (SUBCconst c [0]))))
14321         for {
14322                 if v_0.Op != OpSub64borrow {
14323                         break
14324                 }
14325                 c := v_0.Args[2]
14326                 x := v_0.Args[0]
14327                 y := v_0.Args[1]
14328                 v.reset(OpSelect0)
14329                 v.Type = typ.UInt64
14330                 v0 := b.NewValue0(v.Pos, OpPPC64SUBE, types.NewTuple(typ.UInt64, typ.UInt64))
14331                 v1 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14332                 v2 := b.NewValue0(v.Pos, OpPPC64SUBCconst, types.NewTuple(typ.UInt64, typ.UInt64))
14333                 v2.AuxInt = int64ToAuxInt(0)
14334                 v2.AddArg(c)
14335                 v1.AddArg(v2)
14336                 v0.AddArg3(x, y, v1)
14337                 v.AddArg(v0)
14338                 return true
14339         }
14340         // match: (Select0 (ANDCCconst [m] (ROTLWconst [r] x)))
14341         // cond: isPPC64WordRotateMask(m)
14342         // result: (RLWINM [encodePPC64RotateMask(r,m,32)] x)
14343         for {
14344                 if v_0.Op != OpPPC64ANDCCconst {
14345                         break
14346                 }
14347                 m := auxIntToInt64(v_0.AuxInt)
14348                 v_0_0 := v_0.Args[0]
14349                 if v_0_0.Op != OpPPC64ROTLWconst {
14350                         break
14351                 }
14352                 r := auxIntToInt64(v_0_0.AuxInt)
14353                 x := v_0_0.Args[0]
14354                 if !(isPPC64WordRotateMask(m)) {
14355                         break
14356                 }
14357                 v.reset(OpPPC64RLWINM)
14358                 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, m, 32))
14359                 v.AddArg(x)
14360                 return true
14361         }
14362         // match: (Select0 (ANDCCconst [m] (ROTLW x r)))
14363         // cond: isPPC64WordRotateMask(m)
14364         // result: (RLWNM [encodePPC64RotateMask(0,m,32)] x r)
14365         for {
14366                 if v_0.Op != OpPPC64ANDCCconst {
14367                         break
14368                 }
14369                 m := auxIntToInt64(v_0.AuxInt)
14370                 v_0_0 := v_0.Args[0]
14371                 if v_0_0.Op != OpPPC64ROTLW {
14372                         break
14373                 }
14374                 r := v_0_0.Args[1]
14375                 x := v_0_0.Args[0]
14376                 if !(isPPC64WordRotateMask(m)) {
14377                         break
14378                 }
14379                 v.reset(OpPPC64RLWNM)
14380                 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32))
14381                 v.AddArg2(x, r)
14382                 return true
14383         }
14384         // match: (Select0 (ANDCCconst [m] (SRWconst x [s])))
14385         // cond: mergePPC64RShiftMask(m,s,32) == 0
14386         // result: (MOVDconst [0])
14387         for {
14388                 if v_0.Op != OpPPC64ANDCCconst {
14389                         break
14390                 }
14391                 m := auxIntToInt64(v_0.AuxInt)
14392                 v_0_0 := v_0.Args[0]
14393                 if v_0_0.Op != OpPPC64SRWconst {
14394                         break
14395                 }
14396                 s := auxIntToInt64(v_0_0.AuxInt)
14397                 if !(mergePPC64RShiftMask(m, s, 32) == 0) {
14398                         break
14399                 }
14400                 v.reset(OpPPC64MOVDconst)
14401                 v.AuxInt = int64ToAuxInt(0)
14402                 return true
14403         }
14404         // match: (Select0 (ANDCCconst [m] (SRWconst x [s])))
14405         // cond: mergePPC64AndSrwi(m,s) != 0
14406         // result: (RLWINM [mergePPC64AndSrwi(m,s)] x)
14407         for {
14408                 if v_0.Op != OpPPC64ANDCCconst {
14409                         break
14410                 }
14411                 m := auxIntToInt64(v_0.AuxInt)
14412                 v_0_0 := v_0.Args[0]
14413                 if v_0_0.Op != OpPPC64SRWconst {
14414                         break
14415                 }
14416                 s := auxIntToInt64(v_0_0.AuxInt)
14417                 x := v_0_0.Args[0]
14418                 if !(mergePPC64AndSrwi(m, s) != 0) {
14419                         break
14420                 }
14421                 v.reset(OpPPC64RLWINM)
14422                 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m, s))
14423                 v.AddArg(x)
14424                 return true
14425         }
14426         // match: (Select0 (ANDCCconst [-1] x))
14427         // result: x
14428         for {
14429                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != -1 {
14430                         break
14431                 }
14432                 x := v_0.Args[0]
14433                 v.copyOf(x)
14434                 return true
14435         }
14436         // match: (Select0 (ANDCCconst [0] _))
14437         // result: (MOVDconst [0])
14438         for {
14439                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0 {
14440                         break
14441                 }
14442                 v.reset(OpPPC64MOVDconst)
14443                 v.AuxInt = int64ToAuxInt(0)
14444                 return true
14445         }
14446         // match: (Select0 (ANDCCconst [c] y:(MOVBZreg _)))
14447         // cond: c&0xFF == 0xFF
14448         // result: y
14449         for {
14450                 if v_0.Op != OpPPC64ANDCCconst {
14451                         break
14452                 }
14453                 c := auxIntToInt64(v_0.AuxInt)
14454                 y := v_0.Args[0]
14455                 if y.Op != OpPPC64MOVBZreg || !(c&0xFF == 0xFF) {
14456                         break
14457                 }
14458                 v.copyOf(y)
14459                 return true
14460         }
14461         // match: (Select0 (ANDCCconst [0xFF] (MOVBreg x)))
14462         // result: (MOVBZreg x)
14463         for {
14464                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0xFF {
14465                         break
14466                 }
14467                 v_0_0 := v_0.Args[0]
14468                 if v_0_0.Op != OpPPC64MOVBreg {
14469                         break
14470                 }
14471                 x := v_0_0.Args[0]
14472                 v.reset(OpPPC64MOVBZreg)
14473                 v.AddArg(x)
14474                 return true
14475         }
14476         // match: (Select0 (ANDCCconst [c] y:(MOVHZreg _)))
14477         // cond: c&0xFFFF == 0xFFFF
14478         // result: y
14479         for {
14480                 if v_0.Op != OpPPC64ANDCCconst {
14481                         break
14482                 }
14483                 c := auxIntToInt64(v_0.AuxInt)
14484                 y := v_0.Args[0]
14485                 if y.Op != OpPPC64MOVHZreg || !(c&0xFFFF == 0xFFFF) {
14486                         break
14487                 }
14488                 v.copyOf(y)
14489                 return true
14490         }
14491         // match: (Select0 (ANDCCconst [0xFFFF] (MOVHreg x)))
14492         // result: (MOVHZreg x)
14493         for {
14494                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0xFFFF {
14495                         break
14496                 }
14497                 v_0_0 := v_0.Args[0]
14498                 if v_0_0.Op != OpPPC64MOVHreg {
14499                         break
14500                 }
14501                 x := v_0_0.Args[0]
14502                 v.reset(OpPPC64MOVHZreg)
14503                 v.AddArg(x)
14504                 return true
14505         }
14506         // match: (Select0 (ANDCCconst [c] (MOVBZreg x)))
14507         // result: (Select0 (ANDCCconst [c&0xFF] x))
14508         for {
14509                 if v_0.Op != OpPPC64ANDCCconst {
14510                         break
14511                 }
14512                 c := auxIntToInt64(v_0.AuxInt)
14513                 v_0_0 := v_0.Args[0]
14514                 if v_0_0.Op != OpPPC64MOVBZreg {
14515                         break
14516                 }
14517                 x := v_0_0.Args[0]
14518                 v.reset(OpSelect0)
14519                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14520                 v0.AuxInt = int64ToAuxInt(c & 0xFF)
14521                 v0.AddArg(x)
14522                 v.AddArg(v0)
14523                 return true
14524         }
14525         // match: (Select0 (ANDCCconst [c] (MOVHZreg x)))
14526         // result: (Select0 (ANDCCconst [c&0xFFFF] x))
14527         for {
14528                 if v_0.Op != OpPPC64ANDCCconst {
14529                         break
14530                 }
14531                 c := auxIntToInt64(v_0.AuxInt)
14532                 v_0_0 := v_0.Args[0]
14533                 if v_0_0.Op != OpPPC64MOVHZreg {
14534                         break
14535                 }
14536                 x := v_0_0.Args[0]
14537                 v.reset(OpSelect0)
14538                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14539                 v0.AuxInt = int64ToAuxInt(c & 0xFFFF)
14540                 v0.AddArg(x)
14541                 v.AddArg(v0)
14542                 return true
14543         }
14544         // match: (Select0 (ANDCCconst [c] (MOVWZreg x)))
14545         // result: (Select0 (ANDCCconst [c&0xFFFFFFFF] x))
14546         for {
14547                 if v_0.Op != OpPPC64ANDCCconst {
14548                         break
14549                 }
14550                 c := auxIntToInt64(v_0.AuxInt)
14551                 v_0_0 := v_0.Args[0]
14552                 if v_0_0.Op != OpPPC64MOVWZreg {
14553                         break
14554                 }
14555                 x := v_0_0.Args[0]
14556                 v.reset(OpSelect0)
14557                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14558                 v0.AuxInt = int64ToAuxInt(c & 0xFFFFFFFF)
14559                 v0.AddArg(x)
14560                 v.AddArg(v0)
14561                 return true
14562         }
14563         return false
14564 }
14565 func rewriteValuePPC64_OpSelect1(v *Value) bool {
14566         v_0 := v.Args[0]
14567         b := v.Block
14568         typ := &b.Func.Config.Types
14569         // match: (Select1 (Mul64uhilo x y))
14570         // result: (MULLD x y)
14571         for {
14572                 if v_0.Op != OpMul64uhilo {
14573                         break
14574                 }
14575                 y := v_0.Args[1]
14576                 x := v_0.Args[0]
14577                 v.reset(OpPPC64MULLD)
14578                 v.AddArg2(x, y)
14579                 return true
14580         }
14581         // match: (Select1 (Add64carry x y c))
14582         // result: (ADDZEzero (Select1 <typ.UInt64> (ADDE x y (Select1 <typ.UInt64> (ADDCconst c [-1])))))
14583         for {
14584                 if v_0.Op != OpAdd64carry {
14585                         break
14586                 }
14587                 c := v_0.Args[2]
14588                 x := v_0.Args[0]
14589                 y := v_0.Args[1]
14590                 v.reset(OpPPC64ADDZEzero)
14591                 v0 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14592                 v1 := b.NewValue0(v.Pos, OpPPC64ADDE, types.NewTuple(typ.UInt64, typ.UInt64))
14593                 v2 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14594                 v3 := b.NewValue0(v.Pos, OpPPC64ADDCconst, types.NewTuple(typ.UInt64, typ.UInt64))
14595                 v3.AuxInt = int64ToAuxInt(-1)
14596                 v3.AddArg(c)
14597                 v2.AddArg(v3)
14598                 v1.AddArg3(x, y, v2)
14599                 v0.AddArg(v1)
14600                 v.AddArg(v0)
14601                 return true
14602         }
14603         // match: (Select1 (ADDCconst n:(ADDZEzero x) [-1]))
14604         // cond: n.Uses <= 2
14605         // result: x
14606         for {
14607                 if v_0.Op != OpPPC64ADDCconst || auxIntToInt64(v_0.AuxInt) != -1 {
14608                         break
14609                 }
14610                 n := v_0.Args[0]
14611                 if n.Op != OpPPC64ADDZEzero {
14612                         break
14613                 }
14614                 x := n.Args[0]
14615                 if !(n.Uses <= 2) {
14616                         break
14617                 }
14618                 v.copyOf(x)
14619                 return true
14620         }
14621         // match: (Select1 (Sub64borrow x y c))
14622         // result: (NEG (SUBZEzero (Select1 <typ.UInt64> (SUBE x y (Select1 <typ.UInt64> (SUBCconst c [0]))))))
14623         for {
14624                 if v_0.Op != OpSub64borrow {
14625                         break
14626                 }
14627                 c := v_0.Args[2]
14628                 x := v_0.Args[0]
14629                 y := v_0.Args[1]
14630                 v.reset(OpPPC64NEG)
14631                 v0 := b.NewValue0(v.Pos, OpPPC64SUBZEzero, typ.UInt64)
14632                 v1 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14633                 v2 := b.NewValue0(v.Pos, OpPPC64SUBE, types.NewTuple(typ.UInt64, typ.UInt64))
14634                 v3 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14635                 v4 := b.NewValue0(v.Pos, OpPPC64SUBCconst, types.NewTuple(typ.UInt64, typ.UInt64))
14636                 v4.AuxInt = int64ToAuxInt(0)
14637                 v4.AddArg(c)
14638                 v3.AddArg(v4)
14639                 v2.AddArg3(x, y, v3)
14640                 v1.AddArg(v2)
14641                 v0.AddArg(v1)
14642                 v.AddArg(v0)
14643                 return true
14644         }
14645         // match: (Select1 (SUBCconst n:(NEG (SUBZEzero x)) [0]))
14646         // cond: n.Uses <= 2
14647         // result: x
14648         for {
14649                 if v_0.Op != OpPPC64SUBCconst || auxIntToInt64(v_0.AuxInt) != 0 {
14650                         break
14651                 }
14652                 n := v_0.Args[0]
14653                 if n.Op != OpPPC64NEG {
14654                         break
14655                 }
14656                 n_0 := n.Args[0]
14657                 if n_0.Op != OpPPC64SUBZEzero {
14658                         break
14659                 }
14660                 x := n_0.Args[0]
14661                 if !(n.Uses <= 2) {
14662                         break
14663                 }
14664                 v.copyOf(x)
14665                 return true
14666         }
14667         // match: (Select1 (ANDCCconst [0] _))
14668         // result: (FlagEQ)
14669         for {
14670                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0 {
14671                         break
14672                 }
14673                 v.reset(OpPPC64FlagEQ)
14674                 return true
14675         }
14676         return false
14677 }
14678 func rewriteValuePPC64_OpSelectN(v *Value) bool {
14679         v_0 := v.Args[0]
14680         b := v.Block
14681         config := b.Func.Config
14682         // match: (SelectN [0] call:(CALLstatic {sym} s1:(MOVDstore _ (MOVDconst [sz]) s2:(MOVDstore _ src s3:(MOVDstore {t} _ dst mem)))))
14683         // 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)
14684         // result: (Move [sz] dst src mem)
14685         for {
14686                 if auxIntToInt64(v.AuxInt) != 0 {
14687                         break
14688                 }
14689                 call := v_0
14690                 if call.Op != OpPPC64CALLstatic || len(call.Args) != 1 {
14691                         break
14692                 }
14693                 sym := auxToCall(call.Aux)
14694                 s1 := call.Args[0]
14695                 if s1.Op != OpPPC64MOVDstore {
14696                         break
14697                 }
14698                 _ = s1.Args[2]
14699                 s1_1 := s1.Args[1]
14700                 if s1_1.Op != OpPPC64MOVDconst {
14701                         break
14702                 }
14703                 sz := auxIntToInt64(s1_1.AuxInt)
14704                 s2 := s1.Args[2]
14705                 if s2.Op != OpPPC64MOVDstore {
14706                         break
14707                 }
14708                 _ = s2.Args[2]
14709                 src := s2.Args[1]
14710                 s3 := s2.Args[2]
14711                 if s3.Op != OpPPC64MOVDstore {
14712                         break
14713                 }
14714                 mem := s3.Args[2]
14715                 dst := s3.Args[1]
14716                 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)) {
14717                         break
14718                 }
14719                 v.reset(OpMove)
14720                 v.AuxInt = int64ToAuxInt(sz)
14721                 v.AddArg3(dst, src, mem)
14722                 return true
14723         }
14724         // match: (SelectN [0] call:(CALLstatic {sym} dst src (MOVDconst [sz]) mem))
14725         // cond: sz >= 0 && isSameCall(sym, "runtime.memmove") && call.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(call)
14726         // result: (Move [sz] dst src mem)
14727         for {
14728                 if auxIntToInt64(v.AuxInt) != 0 {
14729                         break
14730                 }
14731                 call := v_0
14732                 if call.Op != OpPPC64CALLstatic || len(call.Args) != 4 {
14733                         break
14734                 }
14735                 sym := auxToCall(call.Aux)
14736                 mem := call.Args[3]
14737                 dst := call.Args[0]
14738                 src := call.Args[1]
14739                 call_2 := call.Args[2]
14740                 if call_2.Op != OpPPC64MOVDconst {
14741                         break
14742                 }
14743                 sz := auxIntToInt64(call_2.AuxInt)
14744                 if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && call.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(call)) {
14745                         break
14746                 }
14747                 v.reset(OpMove)
14748                 v.AuxInt = int64ToAuxInt(sz)
14749                 v.AddArg3(dst, src, mem)
14750                 return true
14751         }
14752         return false
14753 }
14754 func rewriteValuePPC64_OpSlicemask(v *Value) bool {
14755         v_0 := v.Args[0]
14756         b := v.Block
14757         // match: (Slicemask <t> x)
14758         // result: (SRADconst (NEG <t> x) [63])
14759         for {
14760                 t := v.Type
14761                 x := v_0
14762                 v.reset(OpPPC64SRADconst)
14763                 v.AuxInt = int64ToAuxInt(63)
14764                 v0 := b.NewValue0(v.Pos, OpPPC64NEG, t)
14765                 v0.AddArg(x)
14766                 v.AddArg(v0)
14767                 return true
14768         }
14769 }
14770 func rewriteValuePPC64_OpStore(v *Value) bool {
14771         v_2 := v.Args[2]
14772         v_1 := v.Args[1]
14773         v_0 := v.Args[0]
14774         // match: (Store {t} ptr val mem)
14775         // cond: t.Size() == 8 && t.IsFloat()
14776         // result: (FMOVDstore ptr val mem)
14777         for {
14778                 t := auxToType(v.Aux)
14779                 ptr := v_0
14780                 val := v_1
14781                 mem := v_2
14782                 if !(t.Size() == 8 && t.IsFloat()) {
14783                         break
14784                 }
14785                 v.reset(OpPPC64FMOVDstore)
14786                 v.AddArg3(ptr, val, mem)
14787                 return true
14788         }
14789         // match: (Store {t} ptr val mem)
14790         // cond: t.Size() == 4 && t.IsFloat()
14791         // result: (FMOVSstore ptr val mem)
14792         for {
14793                 t := auxToType(v.Aux)
14794                 ptr := v_0
14795                 val := v_1
14796                 mem := v_2
14797                 if !(t.Size() == 4 && t.IsFloat()) {
14798                         break
14799                 }
14800                 v.reset(OpPPC64FMOVSstore)
14801                 v.AddArg3(ptr, val, mem)
14802                 return true
14803         }
14804         // match: (Store {t} ptr val mem)
14805         // cond: t.Size() == 8 && !t.IsFloat()
14806         // result: (MOVDstore ptr val mem)
14807         for {
14808                 t := auxToType(v.Aux)
14809                 ptr := v_0
14810                 val := v_1
14811                 mem := v_2
14812                 if !(t.Size() == 8 && !t.IsFloat()) {
14813                         break
14814                 }
14815                 v.reset(OpPPC64MOVDstore)
14816                 v.AddArg3(ptr, val, mem)
14817                 return true
14818         }
14819         // match: (Store {t} ptr val mem)
14820         // cond: t.Size() == 4 && !t.IsFloat()
14821         // result: (MOVWstore ptr val mem)
14822         for {
14823                 t := auxToType(v.Aux)
14824                 ptr := v_0
14825                 val := v_1
14826                 mem := v_2
14827                 if !(t.Size() == 4 && !t.IsFloat()) {
14828                         break
14829                 }
14830                 v.reset(OpPPC64MOVWstore)
14831                 v.AddArg3(ptr, val, mem)
14832                 return true
14833         }
14834         // match: (Store {t} ptr val mem)
14835         // cond: t.Size() == 2
14836         // result: (MOVHstore ptr val mem)
14837         for {
14838                 t := auxToType(v.Aux)
14839                 ptr := v_0
14840                 val := v_1
14841                 mem := v_2
14842                 if !(t.Size() == 2) {
14843                         break
14844                 }
14845                 v.reset(OpPPC64MOVHstore)
14846                 v.AddArg3(ptr, val, mem)
14847                 return true
14848         }
14849         // match: (Store {t} ptr val mem)
14850         // cond: t.Size() == 1
14851         // result: (MOVBstore ptr val mem)
14852         for {
14853                 t := auxToType(v.Aux)
14854                 ptr := v_0
14855                 val := v_1
14856                 mem := v_2
14857                 if !(t.Size() == 1) {
14858                         break
14859                 }
14860                 v.reset(OpPPC64MOVBstore)
14861                 v.AddArg3(ptr, val, mem)
14862                 return true
14863         }
14864         return false
14865 }
14866 func rewriteValuePPC64_OpTrunc16to8(v *Value) bool {
14867         v_0 := v.Args[0]
14868         // match: (Trunc16to8 <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: (Trunc16to8 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_OpTrunc32to16(v *Value) bool {
14891         v_0 := v.Args[0]
14892         // match: (Trunc32to16 <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: (Trunc32to16 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_OpTrunc32to8(v *Value) bool {
14915         v_0 := v.Args[0]
14916         // match: (Trunc32to8 <t> x)
14917         // cond: t.IsSigned()
14918         // result: (MOVBreg x)
14919         for {
14920                 t := v.Type
14921                 x := v_0
14922                 if !(t.IsSigned()) {
14923                         break
14924                 }
14925                 v.reset(OpPPC64MOVBreg)
14926                 v.AddArg(x)
14927                 return true
14928         }
14929         // match: (Trunc32to8 x)
14930         // result: (MOVBZreg x)
14931         for {
14932                 x := v_0
14933                 v.reset(OpPPC64MOVBZreg)
14934                 v.AddArg(x)
14935                 return true
14936         }
14937 }
14938 func rewriteValuePPC64_OpTrunc64to16(v *Value) bool {
14939         v_0 := v.Args[0]
14940         // match: (Trunc64to16 <t> x)
14941         // cond: t.IsSigned()
14942         // result: (MOVHreg x)
14943         for {
14944                 t := v.Type
14945                 x := v_0
14946                 if !(t.IsSigned()) {
14947                         break
14948                 }
14949                 v.reset(OpPPC64MOVHreg)
14950                 v.AddArg(x)
14951                 return true
14952         }
14953         // match: (Trunc64to16 x)
14954         // result: (MOVHZreg x)
14955         for {
14956                 x := v_0
14957                 v.reset(OpPPC64MOVHZreg)
14958                 v.AddArg(x)
14959                 return true
14960         }
14961 }
14962 func rewriteValuePPC64_OpTrunc64to32(v *Value) bool {
14963         v_0 := v.Args[0]
14964         // match: (Trunc64to32 <t> x)
14965         // cond: t.IsSigned()
14966         // result: (MOVWreg x)
14967         for {
14968                 t := v.Type
14969                 x := v_0
14970                 if !(t.IsSigned()) {
14971                         break
14972                 }
14973                 v.reset(OpPPC64MOVWreg)
14974                 v.AddArg(x)
14975                 return true
14976         }
14977         // match: (Trunc64to32 x)
14978         // result: (MOVWZreg x)
14979         for {
14980                 x := v_0
14981                 v.reset(OpPPC64MOVWZreg)
14982                 v.AddArg(x)
14983                 return true
14984         }
14985 }
14986 func rewriteValuePPC64_OpTrunc64to8(v *Value) bool {
14987         v_0 := v.Args[0]
14988         // match: (Trunc64to8 <t> x)
14989         // cond: t.IsSigned()
14990         // result: (MOVBreg x)
14991         for {
14992                 t := v.Type
14993                 x := v_0
14994                 if !(t.IsSigned()) {
14995                         break
14996                 }
14997                 v.reset(OpPPC64MOVBreg)
14998                 v.AddArg(x)
14999                 return true
15000         }
15001         // match: (Trunc64to8 x)
15002         // result: (MOVBZreg x)
15003         for {
15004                 x := v_0
15005                 v.reset(OpPPC64MOVBZreg)
15006                 v.AddArg(x)
15007                 return true
15008         }
15009 }
15010 func rewriteValuePPC64_OpZero(v *Value) bool {
15011         v_1 := v.Args[1]
15012         v_0 := v.Args[0]
15013         b := v.Block
15014         // match: (Zero [0] _ mem)
15015         // result: mem
15016         for {
15017                 if auxIntToInt64(v.AuxInt) != 0 {
15018                         break
15019                 }
15020                 mem := v_1
15021                 v.copyOf(mem)
15022                 return true
15023         }
15024         // match: (Zero [1] destptr mem)
15025         // result: (MOVBstorezero destptr mem)
15026         for {
15027                 if auxIntToInt64(v.AuxInt) != 1 {
15028                         break
15029                 }
15030                 destptr := v_0
15031                 mem := v_1
15032                 v.reset(OpPPC64MOVBstorezero)
15033                 v.AddArg2(destptr, mem)
15034                 return true
15035         }
15036         // match: (Zero [2] destptr mem)
15037         // result: (MOVHstorezero destptr mem)
15038         for {
15039                 if auxIntToInt64(v.AuxInt) != 2 {
15040                         break
15041                 }
15042                 destptr := v_0
15043                 mem := v_1
15044                 v.reset(OpPPC64MOVHstorezero)
15045                 v.AddArg2(destptr, mem)
15046                 return true
15047         }
15048         // match: (Zero [3] destptr mem)
15049         // result: (MOVBstorezero [2] destptr (MOVHstorezero destptr mem))
15050         for {
15051                 if auxIntToInt64(v.AuxInt) != 3 {
15052                         break
15053                 }
15054                 destptr := v_0
15055                 mem := v_1
15056                 v.reset(OpPPC64MOVBstorezero)
15057                 v.AuxInt = int32ToAuxInt(2)
15058                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHstorezero, types.TypeMem)
15059                 v0.AddArg2(destptr, mem)
15060                 v.AddArg2(destptr, v0)
15061                 return true
15062         }
15063         // match: (Zero [4] destptr mem)
15064         // result: (MOVWstorezero destptr mem)
15065         for {
15066                 if auxIntToInt64(v.AuxInt) != 4 {
15067                         break
15068                 }
15069                 destptr := v_0
15070                 mem := v_1
15071                 v.reset(OpPPC64MOVWstorezero)
15072                 v.AddArg2(destptr, mem)
15073                 return true
15074         }
15075         // match: (Zero [5] destptr mem)
15076         // result: (MOVBstorezero [4] destptr (MOVWstorezero destptr mem))
15077         for {
15078                 if auxIntToInt64(v.AuxInt) != 5 {
15079                         break
15080                 }
15081                 destptr := v_0
15082                 mem := v_1
15083                 v.reset(OpPPC64MOVBstorezero)
15084                 v.AuxInt = int32ToAuxInt(4)
15085                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem)
15086                 v0.AddArg2(destptr, mem)
15087                 v.AddArg2(destptr, v0)
15088                 return true
15089         }
15090         // match: (Zero [6] destptr mem)
15091         // result: (MOVHstorezero [4] destptr (MOVWstorezero destptr mem))
15092         for {
15093                 if auxIntToInt64(v.AuxInt) != 6 {
15094                         break
15095                 }
15096                 destptr := v_0
15097                 mem := v_1
15098                 v.reset(OpPPC64MOVHstorezero)
15099                 v.AuxInt = int32ToAuxInt(4)
15100                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem)
15101                 v0.AddArg2(destptr, mem)
15102                 v.AddArg2(destptr, v0)
15103                 return true
15104         }
15105         // match: (Zero [7] destptr mem)
15106         // result: (MOVBstorezero [6] destptr (MOVHstorezero [4] destptr (MOVWstorezero destptr mem)))
15107         for {
15108                 if auxIntToInt64(v.AuxInt) != 7 {
15109                         break
15110                 }
15111                 destptr := v_0
15112                 mem := v_1
15113                 v.reset(OpPPC64MOVBstorezero)
15114                 v.AuxInt = int32ToAuxInt(6)
15115                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHstorezero, types.TypeMem)
15116                 v0.AuxInt = int32ToAuxInt(4)
15117                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem)
15118                 v1.AddArg2(destptr, mem)
15119                 v0.AddArg2(destptr, v1)
15120                 v.AddArg2(destptr, v0)
15121                 return true
15122         }
15123         // match: (Zero [8] {t} destptr mem)
15124         // result: (MOVDstorezero destptr mem)
15125         for {
15126                 if auxIntToInt64(v.AuxInt) != 8 {
15127                         break
15128                 }
15129                 destptr := v_0
15130                 mem := v_1
15131                 v.reset(OpPPC64MOVDstorezero)
15132                 v.AddArg2(destptr, mem)
15133                 return true
15134         }
15135         // match: (Zero [12] {t} destptr mem)
15136         // result: (MOVWstorezero [8] destptr (MOVDstorezero [0] destptr mem))
15137         for {
15138                 if auxIntToInt64(v.AuxInt) != 12 {
15139                         break
15140                 }
15141                 destptr := v_0
15142                 mem := v_1
15143                 v.reset(OpPPC64MOVWstorezero)
15144                 v.AuxInt = int32ToAuxInt(8)
15145                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15146                 v0.AuxInt = int32ToAuxInt(0)
15147                 v0.AddArg2(destptr, mem)
15148                 v.AddArg2(destptr, v0)
15149                 return true
15150         }
15151         // match: (Zero [16] {t} destptr mem)
15152         // result: (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem))
15153         for {
15154                 if auxIntToInt64(v.AuxInt) != 16 {
15155                         break
15156                 }
15157                 destptr := v_0
15158                 mem := v_1
15159                 v.reset(OpPPC64MOVDstorezero)
15160                 v.AuxInt = int32ToAuxInt(8)
15161                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15162                 v0.AuxInt = int32ToAuxInt(0)
15163                 v0.AddArg2(destptr, mem)
15164                 v.AddArg2(destptr, v0)
15165                 return true
15166         }
15167         // match: (Zero [24] {t} destptr mem)
15168         // result: (MOVDstorezero [16] destptr (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem)))
15169         for {
15170                 if auxIntToInt64(v.AuxInt) != 24 {
15171                         break
15172                 }
15173                 destptr := v_0
15174                 mem := v_1
15175                 v.reset(OpPPC64MOVDstorezero)
15176                 v.AuxInt = int32ToAuxInt(16)
15177                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15178                 v0.AuxInt = int32ToAuxInt(8)
15179                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15180                 v1.AuxInt = int32ToAuxInt(0)
15181                 v1.AddArg2(destptr, mem)
15182                 v0.AddArg2(destptr, v1)
15183                 v.AddArg2(destptr, v0)
15184                 return true
15185         }
15186         // match: (Zero [32] {t} destptr mem)
15187         // result: (MOVDstorezero [24] destptr (MOVDstorezero [16] destptr (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem))))
15188         for {
15189                 if auxIntToInt64(v.AuxInt) != 32 {
15190                         break
15191                 }
15192                 destptr := v_0
15193                 mem := v_1
15194                 v.reset(OpPPC64MOVDstorezero)
15195                 v.AuxInt = int32ToAuxInt(24)
15196                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15197                 v0.AuxInt = int32ToAuxInt(16)
15198                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15199                 v1.AuxInt = int32ToAuxInt(8)
15200                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15201                 v2.AuxInt = int32ToAuxInt(0)
15202                 v2.AddArg2(destptr, mem)
15203                 v1.AddArg2(destptr, v2)
15204                 v0.AddArg2(destptr, v1)
15205                 v.AddArg2(destptr, v0)
15206                 return true
15207         }
15208         // match: (Zero [s] ptr mem)
15209         // cond: buildcfg.GOPPC64 <= 8 && s < 64
15210         // result: (LoweredZeroShort [s] ptr mem)
15211         for {
15212                 s := auxIntToInt64(v.AuxInt)
15213                 ptr := v_0
15214                 mem := v_1
15215                 if !(buildcfg.GOPPC64 <= 8 && s < 64) {
15216                         break
15217                 }
15218                 v.reset(OpPPC64LoweredZeroShort)
15219                 v.AuxInt = int64ToAuxInt(s)
15220                 v.AddArg2(ptr, mem)
15221                 return true
15222         }
15223         // match: (Zero [s] ptr mem)
15224         // cond: buildcfg.GOPPC64 <= 8
15225         // result: (LoweredZero [s] ptr mem)
15226         for {
15227                 s := auxIntToInt64(v.AuxInt)
15228                 ptr := v_0
15229                 mem := v_1
15230                 if !(buildcfg.GOPPC64 <= 8) {
15231                         break
15232                 }
15233                 v.reset(OpPPC64LoweredZero)
15234                 v.AuxInt = int64ToAuxInt(s)
15235                 v.AddArg2(ptr, mem)
15236                 return true
15237         }
15238         // match: (Zero [s] ptr mem)
15239         // cond: s < 128 && buildcfg.GOPPC64 >= 9
15240         // result: (LoweredQuadZeroShort [s] ptr mem)
15241         for {
15242                 s := auxIntToInt64(v.AuxInt)
15243                 ptr := v_0
15244                 mem := v_1
15245                 if !(s < 128 && buildcfg.GOPPC64 >= 9) {
15246                         break
15247                 }
15248                 v.reset(OpPPC64LoweredQuadZeroShort)
15249                 v.AuxInt = int64ToAuxInt(s)
15250                 v.AddArg2(ptr, mem)
15251                 return true
15252         }
15253         // match: (Zero [s] ptr mem)
15254         // cond: buildcfg.GOPPC64 >= 9
15255         // result: (LoweredQuadZero [s] ptr mem)
15256         for {
15257                 s := auxIntToInt64(v.AuxInt)
15258                 ptr := v_0
15259                 mem := v_1
15260                 if !(buildcfg.GOPPC64 >= 9) {
15261                         break
15262                 }
15263                 v.reset(OpPPC64LoweredQuadZero)
15264                 v.AuxInt = int64ToAuxInt(s)
15265                 v.AddArg2(ptr, mem)
15266                 return true
15267         }
15268         return false
15269 }
15270 func rewriteBlockPPC64(b *Block) bool {
15271         typ := &b.Func.Config.Types
15272         switch b.Kind {
15273         case BlockPPC64EQ:
15274                 // match: (EQ (FlagEQ) yes no)
15275                 // result: (First yes no)
15276                 for b.Controls[0].Op == OpPPC64FlagEQ {
15277                         b.Reset(BlockFirst)
15278                         return true
15279                 }
15280                 // match: (EQ (FlagLT) yes no)
15281                 // result: (First no yes)
15282                 for b.Controls[0].Op == OpPPC64FlagLT {
15283                         b.Reset(BlockFirst)
15284                         b.swapSuccessors()
15285                         return true
15286                 }
15287                 // match: (EQ (FlagGT) yes no)
15288                 // result: (First no yes)
15289                 for b.Controls[0].Op == OpPPC64FlagGT {
15290                         b.Reset(BlockFirst)
15291                         b.swapSuccessors()
15292                         return true
15293                 }
15294                 // match: (EQ (InvertFlags cmp) yes no)
15295                 // result: (EQ cmp yes no)
15296                 for b.Controls[0].Op == OpPPC64InvertFlags {
15297                         v_0 := b.Controls[0]
15298                         cmp := v_0.Args[0]
15299                         b.resetWithControl(BlockPPC64EQ, cmp)
15300                         return true
15301                 }
15302                 // match: (EQ (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15303                 // result: (EQ (Select1 <types.TypeFlags> z) yes no)
15304                 for b.Controls[0].Op == OpPPC64CMPconst {
15305                         v_0 := b.Controls[0]
15306                         if auxIntToInt64(v_0.AuxInt) != 0 {
15307                                 break
15308                         }
15309                         v_0_0 := v_0.Args[0]
15310                         if v_0_0.Op != OpSelect0 {
15311                                 break
15312                         }
15313                         z := v_0_0.Args[0]
15314                         if z.Op != OpPPC64ANDCCconst {
15315                                 break
15316                         }
15317                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15318                         v0.AddArg(z)
15319                         b.resetWithControl(BlockPPC64EQ, v0)
15320                         return true
15321                 }
15322                 // match: (EQ (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15323                 // result: (EQ (Select1 <types.TypeFlags> z) yes no)
15324                 for b.Controls[0].Op == OpPPC64CMPWconst {
15325                         v_0 := b.Controls[0]
15326                         if auxIntToInt32(v_0.AuxInt) != 0 {
15327                                 break
15328                         }
15329                         v_0_0 := v_0.Args[0]
15330                         if v_0_0.Op != OpSelect0 {
15331                                 break
15332                         }
15333                         z := v_0_0.Args[0]
15334                         if z.Op != OpPPC64ANDCCconst {
15335                                 break
15336                         }
15337                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15338                         v0.AddArg(z)
15339                         b.resetWithControl(BlockPPC64EQ, v0)
15340                         return true
15341                 }
15342                 // match: (EQ (CMPconst [0] z:(AND x y)) yes no)
15343                 // cond: z.Uses == 1
15344                 // result: (EQ (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
15345                 for b.Controls[0].Op == OpPPC64CMPconst {
15346                         v_0 := b.Controls[0]
15347                         if auxIntToInt64(v_0.AuxInt) != 0 {
15348                                 break
15349                         }
15350                         z := v_0.Args[0]
15351                         if z.Op != OpPPC64AND {
15352                                 break
15353                         }
15354                         _ = z.Args[1]
15355                         z_0 := z.Args[0]
15356                         z_1 := z.Args[1]
15357                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15358                                 x := z_0
15359                                 y := z_1
15360                                 if !(z.Uses == 1) {
15361                                         continue
15362                                 }
15363                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15364                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15365                                 v1.AddArg2(x, y)
15366                                 v0.AddArg(v1)
15367                                 b.resetWithControl(BlockPPC64EQ, v0)
15368                                 return true
15369                         }
15370                         break
15371                 }
15372                 // match: (EQ (CMPconst [0] z:(OR x y)) yes no)
15373                 // cond: z.Uses == 1
15374                 // result: (EQ (Select1 <types.TypeFlags> (ORCC x y)) yes no)
15375                 for b.Controls[0].Op == OpPPC64CMPconst {
15376                         v_0 := b.Controls[0]
15377                         if auxIntToInt64(v_0.AuxInt) != 0 {
15378                                 break
15379                         }
15380                         z := v_0.Args[0]
15381                         if z.Op != OpPPC64OR {
15382                                 break
15383                         }
15384                         _ = z.Args[1]
15385                         z_0 := z.Args[0]
15386                         z_1 := z.Args[1]
15387                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15388                                 x := z_0
15389                                 y := z_1
15390                                 if !(z.Uses == 1) {
15391                                         continue
15392                                 }
15393                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15394                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15395                                 v1.AddArg2(x, y)
15396                                 v0.AddArg(v1)
15397                                 b.resetWithControl(BlockPPC64EQ, v0)
15398                                 return true
15399                         }
15400                         break
15401                 }
15402                 // match: (EQ (CMPconst [0] z:(XOR x y)) yes no)
15403                 // cond: z.Uses == 1
15404                 // result: (EQ (Select1 <types.TypeFlags> (XORCC x y)) yes no)
15405                 for b.Controls[0].Op == OpPPC64CMPconst {
15406                         v_0 := b.Controls[0]
15407                         if auxIntToInt64(v_0.AuxInt) != 0 {
15408                                 break
15409                         }
15410                         z := v_0.Args[0]
15411                         if z.Op != OpPPC64XOR {
15412                                 break
15413                         }
15414                         _ = z.Args[1]
15415                         z_0 := z.Args[0]
15416                         z_1 := z.Args[1]
15417                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15418                                 x := z_0
15419                                 y := z_1
15420                                 if !(z.Uses == 1) {
15421                                         continue
15422                                 }
15423                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15424                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15425                                 v1.AddArg2(x, y)
15426                                 v0.AddArg(v1)
15427                                 b.resetWithControl(BlockPPC64EQ, v0)
15428                                 return true
15429                         }
15430                         break
15431                 }
15432         case BlockPPC64GE:
15433                 // match: (GE (FlagEQ) yes no)
15434                 // result: (First yes no)
15435                 for b.Controls[0].Op == OpPPC64FlagEQ {
15436                         b.Reset(BlockFirst)
15437                         return true
15438                 }
15439                 // match: (GE (FlagLT) yes no)
15440                 // result: (First no yes)
15441                 for b.Controls[0].Op == OpPPC64FlagLT {
15442                         b.Reset(BlockFirst)
15443                         b.swapSuccessors()
15444                         return true
15445                 }
15446                 // match: (GE (FlagGT) yes no)
15447                 // result: (First yes no)
15448                 for b.Controls[0].Op == OpPPC64FlagGT {
15449                         b.Reset(BlockFirst)
15450                         return true
15451                 }
15452                 // match: (GE (InvertFlags cmp) yes no)
15453                 // result: (LE cmp yes no)
15454                 for b.Controls[0].Op == OpPPC64InvertFlags {
15455                         v_0 := b.Controls[0]
15456                         cmp := v_0.Args[0]
15457                         b.resetWithControl(BlockPPC64LE, cmp)
15458                         return true
15459                 }
15460                 // match: (GE (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15461                 // result: (GE (Select1 <types.TypeFlags> z) yes no)
15462                 for b.Controls[0].Op == OpPPC64CMPconst {
15463                         v_0 := b.Controls[0]
15464                         if auxIntToInt64(v_0.AuxInt) != 0 {
15465                                 break
15466                         }
15467                         v_0_0 := v_0.Args[0]
15468                         if v_0_0.Op != OpSelect0 {
15469                                 break
15470                         }
15471                         z := v_0_0.Args[0]
15472                         if z.Op != OpPPC64ANDCCconst {
15473                                 break
15474                         }
15475                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15476                         v0.AddArg(z)
15477                         b.resetWithControl(BlockPPC64GE, v0)
15478                         return true
15479                 }
15480                 // match: (GE (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15481                 // result: (GE (Select1 <types.TypeFlags> z) yes no)
15482                 for b.Controls[0].Op == OpPPC64CMPWconst {
15483                         v_0 := b.Controls[0]
15484                         if auxIntToInt32(v_0.AuxInt) != 0 {
15485                                 break
15486                         }
15487                         v_0_0 := v_0.Args[0]
15488                         if v_0_0.Op != OpSelect0 {
15489                                 break
15490                         }
15491                         z := v_0_0.Args[0]
15492                         if z.Op != OpPPC64ANDCCconst {
15493                                 break
15494                         }
15495                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15496                         v0.AddArg(z)
15497                         b.resetWithControl(BlockPPC64GE, v0)
15498                         return true
15499                 }
15500                 // match: (GE (CMPconst [0] z:(AND x y)) yes no)
15501                 // cond: z.Uses == 1
15502                 // result: (GE (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
15503                 for b.Controls[0].Op == OpPPC64CMPconst {
15504                         v_0 := b.Controls[0]
15505                         if auxIntToInt64(v_0.AuxInt) != 0 {
15506                                 break
15507                         }
15508                         z := v_0.Args[0]
15509                         if z.Op != OpPPC64AND {
15510                                 break
15511                         }
15512                         _ = z.Args[1]
15513                         z_0 := z.Args[0]
15514                         z_1 := z.Args[1]
15515                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15516                                 x := z_0
15517                                 y := z_1
15518                                 if !(z.Uses == 1) {
15519                                         continue
15520                                 }
15521                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15522                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15523                                 v1.AddArg2(x, y)
15524                                 v0.AddArg(v1)
15525                                 b.resetWithControl(BlockPPC64GE, v0)
15526                                 return true
15527                         }
15528                         break
15529                 }
15530                 // match: (GE (CMPconst [0] z:(OR x y)) yes no)
15531                 // cond: z.Uses == 1
15532                 // result: (GE (Select1 <types.TypeFlags> (ORCC x y)) yes no)
15533                 for b.Controls[0].Op == OpPPC64CMPconst {
15534                         v_0 := b.Controls[0]
15535                         if auxIntToInt64(v_0.AuxInt) != 0 {
15536                                 break
15537                         }
15538                         z := v_0.Args[0]
15539                         if z.Op != OpPPC64OR {
15540                                 break
15541                         }
15542                         _ = z.Args[1]
15543                         z_0 := z.Args[0]
15544                         z_1 := z.Args[1]
15545                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15546                                 x := z_0
15547                                 y := z_1
15548                                 if !(z.Uses == 1) {
15549                                         continue
15550                                 }
15551                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15552                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15553                                 v1.AddArg2(x, y)
15554                                 v0.AddArg(v1)
15555                                 b.resetWithControl(BlockPPC64GE, v0)
15556                                 return true
15557                         }
15558                         break
15559                 }
15560                 // match: (GE (CMPconst [0] z:(XOR x y)) yes no)
15561                 // cond: z.Uses == 1
15562                 // result: (GE (Select1 <types.TypeFlags> (XORCC x y)) yes no)
15563                 for b.Controls[0].Op == OpPPC64CMPconst {
15564                         v_0 := b.Controls[0]
15565                         if auxIntToInt64(v_0.AuxInt) != 0 {
15566                                 break
15567                         }
15568                         z := v_0.Args[0]
15569                         if z.Op != OpPPC64XOR {
15570                                 break
15571                         }
15572                         _ = z.Args[1]
15573                         z_0 := z.Args[0]
15574                         z_1 := z.Args[1]
15575                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15576                                 x := z_0
15577                                 y := z_1
15578                                 if !(z.Uses == 1) {
15579                                         continue
15580                                 }
15581                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15582                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15583                                 v1.AddArg2(x, y)
15584                                 v0.AddArg(v1)
15585                                 b.resetWithControl(BlockPPC64GE, v0)
15586                                 return true
15587                         }
15588                         break
15589                 }
15590         case BlockPPC64GT:
15591                 // match: (GT (FlagEQ) yes no)
15592                 // result: (First no yes)
15593                 for b.Controls[0].Op == OpPPC64FlagEQ {
15594                         b.Reset(BlockFirst)
15595                         b.swapSuccessors()
15596                         return true
15597                 }
15598                 // match: (GT (FlagLT) yes no)
15599                 // result: (First no yes)
15600                 for b.Controls[0].Op == OpPPC64FlagLT {
15601                         b.Reset(BlockFirst)
15602                         b.swapSuccessors()
15603                         return true
15604                 }
15605                 // match: (GT (FlagGT) yes no)
15606                 // result: (First yes no)
15607                 for b.Controls[0].Op == OpPPC64FlagGT {
15608                         b.Reset(BlockFirst)
15609                         return true
15610                 }
15611                 // match: (GT (InvertFlags cmp) yes no)
15612                 // result: (LT cmp yes no)
15613                 for b.Controls[0].Op == OpPPC64InvertFlags {
15614                         v_0 := b.Controls[0]
15615                         cmp := v_0.Args[0]
15616                         b.resetWithControl(BlockPPC64LT, cmp)
15617                         return true
15618                 }
15619                 // match: (GT (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15620                 // result: (GT (Select1 <types.TypeFlags> z) yes no)
15621                 for b.Controls[0].Op == OpPPC64CMPconst {
15622                         v_0 := b.Controls[0]
15623                         if auxIntToInt64(v_0.AuxInt) != 0 {
15624                                 break
15625                         }
15626                         v_0_0 := v_0.Args[0]
15627                         if v_0_0.Op != OpSelect0 {
15628                                 break
15629                         }
15630                         z := v_0_0.Args[0]
15631                         if z.Op != OpPPC64ANDCCconst {
15632                                 break
15633                         }
15634                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15635                         v0.AddArg(z)
15636                         b.resetWithControl(BlockPPC64GT, v0)
15637                         return true
15638                 }
15639                 // match: (GT (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15640                 // result: (GT (Select1 <types.TypeFlags> z) yes no)
15641                 for b.Controls[0].Op == OpPPC64CMPWconst {
15642                         v_0 := b.Controls[0]
15643                         if auxIntToInt32(v_0.AuxInt) != 0 {
15644                                 break
15645                         }
15646                         v_0_0 := v_0.Args[0]
15647                         if v_0_0.Op != OpSelect0 {
15648                                 break
15649                         }
15650                         z := v_0_0.Args[0]
15651                         if z.Op != OpPPC64ANDCCconst {
15652                                 break
15653                         }
15654                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15655                         v0.AddArg(z)
15656                         b.resetWithControl(BlockPPC64GT, v0)
15657                         return true
15658                 }
15659                 // match: (GT (CMPconst [0] z:(AND x y)) yes no)
15660                 // cond: z.Uses == 1
15661                 // result: (GT (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
15662                 for b.Controls[0].Op == OpPPC64CMPconst {
15663                         v_0 := b.Controls[0]
15664                         if auxIntToInt64(v_0.AuxInt) != 0 {
15665                                 break
15666                         }
15667                         z := v_0.Args[0]
15668                         if z.Op != OpPPC64AND {
15669                                 break
15670                         }
15671                         _ = z.Args[1]
15672                         z_0 := z.Args[0]
15673                         z_1 := z.Args[1]
15674                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15675                                 x := z_0
15676                                 y := z_1
15677                                 if !(z.Uses == 1) {
15678                                         continue
15679                                 }
15680                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15681                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15682                                 v1.AddArg2(x, y)
15683                                 v0.AddArg(v1)
15684                                 b.resetWithControl(BlockPPC64GT, v0)
15685                                 return true
15686                         }
15687                         break
15688                 }
15689                 // match: (GT (CMPconst [0] z:(OR x y)) yes no)
15690                 // cond: z.Uses == 1
15691                 // result: (GT (Select1 <types.TypeFlags> (ORCC x y)) yes no)
15692                 for b.Controls[0].Op == OpPPC64CMPconst {
15693                         v_0 := b.Controls[0]
15694                         if auxIntToInt64(v_0.AuxInt) != 0 {
15695                                 break
15696                         }
15697                         z := v_0.Args[0]
15698                         if z.Op != OpPPC64OR {
15699                                 break
15700                         }
15701                         _ = z.Args[1]
15702                         z_0 := z.Args[0]
15703                         z_1 := z.Args[1]
15704                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15705                                 x := z_0
15706                                 y := z_1
15707                                 if !(z.Uses == 1) {
15708                                         continue
15709                                 }
15710                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15711                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15712                                 v1.AddArg2(x, y)
15713                                 v0.AddArg(v1)
15714                                 b.resetWithControl(BlockPPC64GT, v0)
15715                                 return true
15716                         }
15717                         break
15718                 }
15719                 // match: (GT (CMPconst [0] z:(XOR x y)) yes no)
15720                 // cond: z.Uses == 1
15721                 // result: (GT (Select1 <types.TypeFlags> (XORCC x y)) yes no)
15722                 for b.Controls[0].Op == OpPPC64CMPconst {
15723                         v_0 := b.Controls[0]
15724                         if auxIntToInt64(v_0.AuxInt) != 0 {
15725                                 break
15726                         }
15727                         z := v_0.Args[0]
15728                         if z.Op != OpPPC64XOR {
15729                                 break
15730                         }
15731                         _ = z.Args[1]
15732                         z_0 := z.Args[0]
15733                         z_1 := z.Args[1]
15734                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15735                                 x := z_0
15736                                 y := z_1
15737                                 if !(z.Uses == 1) {
15738                                         continue
15739                                 }
15740                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15741                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15742                                 v1.AddArg2(x, y)
15743                                 v0.AddArg(v1)
15744                                 b.resetWithControl(BlockPPC64GT, v0)
15745                                 return true
15746                         }
15747                         break
15748                 }
15749         case BlockIf:
15750                 // match: (If (Equal cc) yes no)
15751                 // result: (EQ cc yes no)
15752                 for b.Controls[0].Op == OpPPC64Equal {
15753                         v_0 := b.Controls[0]
15754                         cc := v_0.Args[0]
15755                         b.resetWithControl(BlockPPC64EQ, cc)
15756                         return true
15757                 }
15758                 // match: (If (NotEqual cc) yes no)
15759                 // result: (NE cc yes no)
15760                 for b.Controls[0].Op == OpPPC64NotEqual {
15761                         v_0 := b.Controls[0]
15762                         cc := v_0.Args[0]
15763                         b.resetWithControl(BlockPPC64NE, cc)
15764                         return true
15765                 }
15766                 // match: (If (LessThan cc) yes no)
15767                 // result: (LT cc yes no)
15768                 for b.Controls[0].Op == OpPPC64LessThan {
15769                         v_0 := b.Controls[0]
15770                         cc := v_0.Args[0]
15771                         b.resetWithControl(BlockPPC64LT, cc)
15772                         return true
15773                 }
15774                 // match: (If (LessEqual cc) yes no)
15775                 // result: (LE cc yes no)
15776                 for b.Controls[0].Op == OpPPC64LessEqual {
15777                         v_0 := b.Controls[0]
15778                         cc := v_0.Args[0]
15779                         b.resetWithControl(BlockPPC64LE, cc)
15780                         return true
15781                 }
15782                 // match: (If (GreaterThan cc) yes no)
15783                 // result: (GT cc yes no)
15784                 for b.Controls[0].Op == OpPPC64GreaterThan {
15785                         v_0 := b.Controls[0]
15786                         cc := v_0.Args[0]
15787                         b.resetWithControl(BlockPPC64GT, cc)
15788                         return true
15789                 }
15790                 // match: (If (GreaterEqual cc) yes no)
15791                 // result: (GE cc yes no)
15792                 for b.Controls[0].Op == OpPPC64GreaterEqual {
15793                         v_0 := b.Controls[0]
15794                         cc := v_0.Args[0]
15795                         b.resetWithControl(BlockPPC64GE, cc)
15796                         return true
15797                 }
15798                 // match: (If (FLessThan cc) yes no)
15799                 // result: (FLT cc yes no)
15800                 for b.Controls[0].Op == OpPPC64FLessThan {
15801                         v_0 := b.Controls[0]
15802                         cc := v_0.Args[0]
15803                         b.resetWithControl(BlockPPC64FLT, cc)
15804                         return true
15805                 }
15806                 // match: (If (FLessEqual cc) yes no)
15807                 // result: (FLE cc yes no)
15808                 for b.Controls[0].Op == OpPPC64FLessEqual {
15809                         v_0 := b.Controls[0]
15810                         cc := v_0.Args[0]
15811                         b.resetWithControl(BlockPPC64FLE, cc)
15812                         return true
15813                 }
15814                 // match: (If (FGreaterThan cc) yes no)
15815                 // result: (FGT cc yes no)
15816                 for b.Controls[0].Op == OpPPC64FGreaterThan {
15817                         v_0 := b.Controls[0]
15818                         cc := v_0.Args[0]
15819                         b.resetWithControl(BlockPPC64FGT, cc)
15820                         return true
15821                 }
15822                 // match: (If (FGreaterEqual cc) yes no)
15823                 // result: (FGE cc yes no)
15824                 for b.Controls[0].Op == OpPPC64FGreaterEqual {
15825                         v_0 := b.Controls[0]
15826                         cc := v_0.Args[0]
15827                         b.resetWithControl(BlockPPC64FGE, cc)
15828                         return true
15829                 }
15830                 // match: (If cond yes no)
15831                 // result: (NE (CMPWconst [0] (Select0 <typ.UInt32> (ANDCCconst [1] cond))) yes no)
15832                 for {
15833                         cond := b.Controls[0]
15834                         v0 := b.NewValue0(cond.Pos, OpPPC64CMPWconst, types.TypeFlags)
15835                         v0.AuxInt = int32ToAuxInt(0)
15836                         v1 := b.NewValue0(cond.Pos, OpSelect0, typ.UInt32)
15837                         v2 := b.NewValue0(cond.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15838                         v2.AuxInt = int64ToAuxInt(1)
15839                         v2.AddArg(cond)
15840                         v1.AddArg(v2)
15841                         v0.AddArg(v1)
15842                         b.resetWithControl(BlockPPC64NE, v0)
15843                         return true
15844                 }
15845         case BlockPPC64LE:
15846                 // match: (LE (FlagEQ) yes no)
15847                 // result: (First yes no)
15848                 for b.Controls[0].Op == OpPPC64FlagEQ {
15849                         b.Reset(BlockFirst)
15850                         return true
15851                 }
15852                 // match: (LE (FlagLT) yes no)
15853                 // result: (First yes no)
15854                 for b.Controls[0].Op == OpPPC64FlagLT {
15855                         b.Reset(BlockFirst)
15856                         return true
15857                 }
15858                 // match: (LE (FlagGT) yes no)
15859                 // result: (First no yes)
15860                 for b.Controls[0].Op == OpPPC64FlagGT {
15861                         b.Reset(BlockFirst)
15862                         b.swapSuccessors()
15863                         return true
15864                 }
15865                 // match: (LE (InvertFlags cmp) yes no)
15866                 // result: (GE cmp yes no)
15867                 for b.Controls[0].Op == OpPPC64InvertFlags {
15868                         v_0 := b.Controls[0]
15869                         cmp := v_0.Args[0]
15870                         b.resetWithControl(BlockPPC64GE, cmp)
15871                         return true
15872                 }
15873                 // match: (LE (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15874                 // result: (LE (Select1 <types.TypeFlags> z) yes no)
15875                 for b.Controls[0].Op == OpPPC64CMPconst {
15876                         v_0 := b.Controls[0]
15877                         if auxIntToInt64(v_0.AuxInt) != 0 {
15878                                 break
15879                         }
15880                         v_0_0 := v_0.Args[0]
15881                         if v_0_0.Op != OpSelect0 {
15882                                 break
15883                         }
15884                         z := v_0_0.Args[0]
15885                         if z.Op != OpPPC64ANDCCconst {
15886                                 break
15887                         }
15888                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15889                         v0.AddArg(z)
15890                         b.resetWithControl(BlockPPC64LE, v0)
15891                         return true
15892                 }
15893                 // match: (LE (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15894                 // result: (LE (Select1 <types.TypeFlags> z) yes no)
15895                 for b.Controls[0].Op == OpPPC64CMPWconst {
15896                         v_0 := b.Controls[0]
15897                         if auxIntToInt32(v_0.AuxInt) != 0 {
15898                                 break
15899                         }
15900                         v_0_0 := v_0.Args[0]
15901                         if v_0_0.Op != OpSelect0 {
15902                                 break
15903                         }
15904                         z := v_0_0.Args[0]
15905                         if z.Op != OpPPC64ANDCCconst {
15906                                 break
15907                         }
15908                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15909                         v0.AddArg(z)
15910                         b.resetWithControl(BlockPPC64LE, v0)
15911                         return true
15912                 }
15913                 // match: (LE (CMPconst [0] z:(AND x y)) yes no)
15914                 // cond: z.Uses == 1
15915                 // result: (LE (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
15916                 for b.Controls[0].Op == OpPPC64CMPconst {
15917                         v_0 := b.Controls[0]
15918                         if auxIntToInt64(v_0.AuxInt) != 0 {
15919                                 break
15920                         }
15921                         z := v_0.Args[0]
15922                         if z.Op != OpPPC64AND {
15923                                 break
15924                         }
15925                         _ = z.Args[1]
15926                         z_0 := z.Args[0]
15927                         z_1 := z.Args[1]
15928                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15929                                 x := z_0
15930                                 y := z_1
15931                                 if !(z.Uses == 1) {
15932                                         continue
15933                                 }
15934                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15935                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15936                                 v1.AddArg2(x, y)
15937                                 v0.AddArg(v1)
15938                                 b.resetWithControl(BlockPPC64LE, v0)
15939                                 return true
15940                         }
15941                         break
15942                 }
15943                 // match: (LE (CMPconst [0] z:(OR x y)) yes no)
15944                 // cond: z.Uses == 1
15945                 // result: (LE (Select1 <types.TypeFlags> (ORCC x y)) yes no)
15946                 for b.Controls[0].Op == OpPPC64CMPconst {
15947                         v_0 := b.Controls[0]
15948                         if auxIntToInt64(v_0.AuxInt) != 0 {
15949                                 break
15950                         }
15951                         z := v_0.Args[0]
15952                         if z.Op != OpPPC64OR {
15953                                 break
15954                         }
15955                         _ = z.Args[1]
15956                         z_0 := z.Args[0]
15957                         z_1 := z.Args[1]
15958                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15959                                 x := z_0
15960                                 y := z_1
15961                                 if !(z.Uses == 1) {
15962                                         continue
15963                                 }
15964                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15965                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15966                                 v1.AddArg2(x, y)
15967                                 v0.AddArg(v1)
15968                                 b.resetWithControl(BlockPPC64LE, v0)
15969                                 return true
15970                         }
15971                         break
15972                 }
15973                 // match: (LE (CMPconst [0] z:(XOR x y)) yes no)
15974                 // cond: z.Uses == 1
15975                 // result: (LE (Select1 <types.TypeFlags> (XORCC x y)) yes no)
15976                 for b.Controls[0].Op == OpPPC64CMPconst {
15977                         v_0 := b.Controls[0]
15978                         if auxIntToInt64(v_0.AuxInt) != 0 {
15979                                 break
15980                         }
15981                         z := v_0.Args[0]
15982                         if z.Op != OpPPC64XOR {
15983                                 break
15984                         }
15985                         _ = z.Args[1]
15986                         z_0 := z.Args[0]
15987                         z_1 := z.Args[1]
15988                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15989                                 x := z_0
15990                                 y := z_1
15991                                 if !(z.Uses == 1) {
15992                                         continue
15993                                 }
15994                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15995                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15996                                 v1.AddArg2(x, y)
15997                                 v0.AddArg(v1)
15998                                 b.resetWithControl(BlockPPC64LE, v0)
15999                                 return true
16000                         }
16001                         break
16002                 }
16003         case BlockPPC64LT:
16004                 // match: (LT (FlagEQ) yes no)
16005                 // result: (First no yes)
16006                 for b.Controls[0].Op == OpPPC64FlagEQ {
16007                         b.Reset(BlockFirst)
16008                         b.swapSuccessors()
16009                         return true
16010                 }
16011                 // match: (LT (FlagLT) yes no)
16012                 // result: (First yes no)
16013                 for b.Controls[0].Op == OpPPC64FlagLT {
16014                         b.Reset(BlockFirst)
16015                         return true
16016                 }
16017                 // match: (LT (FlagGT) yes no)
16018                 // result: (First no yes)
16019                 for b.Controls[0].Op == OpPPC64FlagGT {
16020                         b.Reset(BlockFirst)
16021                         b.swapSuccessors()
16022                         return true
16023                 }
16024                 // match: (LT (InvertFlags cmp) yes no)
16025                 // result: (GT cmp yes no)
16026                 for b.Controls[0].Op == OpPPC64InvertFlags {
16027                         v_0 := b.Controls[0]
16028                         cmp := v_0.Args[0]
16029                         b.resetWithControl(BlockPPC64GT, cmp)
16030                         return true
16031                 }
16032                 // match: (LT (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
16033                 // result: (LT (Select1 <types.TypeFlags> z) yes no)
16034                 for b.Controls[0].Op == OpPPC64CMPconst {
16035                         v_0 := b.Controls[0]
16036                         if auxIntToInt64(v_0.AuxInt) != 0 {
16037                                 break
16038                         }
16039                         v_0_0 := v_0.Args[0]
16040                         if v_0_0.Op != OpSelect0 {
16041                                 break
16042                         }
16043                         z := v_0_0.Args[0]
16044                         if z.Op != OpPPC64ANDCCconst {
16045                                 break
16046                         }
16047                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16048                         v0.AddArg(z)
16049                         b.resetWithControl(BlockPPC64LT, v0)
16050                         return true
16051                 }
16052                 // match: (LT (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
16053                 // result: (LT (Select1 <types.TypeFlags> z) yes no)
16054                 for b.Controls[0].Op == OpPPC64CMPWconst {
16055                         v_0 := b.Controls[0]
16056                         if auxIntToInt32(v_0.AuxInt) != 0 {
16057                                 break
16058                         }
16059                         v_0_0 := v_0.Args[0]
16060                         if v_0_0.Op != OpSelect0 {
16061                                 break
16062                         }
16063                         z := v_0_0.Args[0]
16064                         if z.Op != OpPPC64ANDCCconst {
16065                                 break
16066                         }
16067                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16068                         v0.AddArg(z)
16069                         b.resetWithControl(BlockPPC64LT, v0)
16070                         return true
16071                 }
16072                 // match: (LT (CMPconst [0] z:(AND x y)) yes no)
16073                 // cond: z.Uses == 1
16074                 // result: (LT (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
16075                 for b.Controls[0].Op == OpPPC64CMPconst {
16076                         v_0 := b.Controls[0]
16077                         if auxIntToInt64(v_0.AuxInt) != 0 {
16078                                 break
16079                         }
16080                         z := v_0.Args[0]
16081                         if z.Op != OpPPC64AND {
16082                                 break
16083                         }
16084                         _ = z.Args[1]
16085                         z_0 := z.Args[0]
16086                         z_1 := z.Args[1]
16087                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16088                                 x := z_0
16089                                 y := z_1
16090                                 if !(z.Uses == 1) {
16091                                         continue
16092                                 }
16093                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16094                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
16095                                 v1.AddArg2(x, y)
16096                                 v0.AddArg(v1)
16097                                 b.resetWithControl(BlockPPC64LT, v0)
16098                                 return true
16099                         }
16100                         break
16101                 }
16102                 // match: (LT (CMPconst [0] z:(OR x y)) yes no)
16103                 // cond: z.Uses == 1
16104                 // result: (LT (Select1 <types.TypeFlags> (ORCC x y)) yes no)
16105                 for b.Controls[0].Op == OpPPC64CMPconst {
16106                         v_0 := b.Controls[0]
16107                         if auxIntToInt64(v_0.AuxInt) != 0 {
16108                                 break
16109                         }
16110                         z := v_0.Args[0]
16111                         if z.Op != OpPPC64OR {
16112                                 break
16113                         }
16114                         _ = z.Args[1]
16115                         z_0 := z.Args[0]
16116                         z_1 := z.Args[1]
16117                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16118                                 x := z_0
16119                                 y := z_1
16120                                 if !(z.Uses == 1) {
16121                                         continue
16122                                 }
16123                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16124                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
16125                                 v1.AddArg2(x, y)
16126                                 v0.AddArg(v1)
16127                                 b.resetWithControl(BlockPPC64LT, v0)
16128                                 return true
16129                         }
16130                         break
16131                 }
16132                 // match: (LT (CMPconst [0] z:(XOR x y)) yes no)
16133                 // cond: z.Uses == 1
16134                 // result: (LT (Select1 <types.TypeFlags> (XORCC x y)) yes no)
16135                 for b.Controls[0].Op == OpPPC64CMPconst {
16136                         v_0 := b.Controls[0]
16137                         if auxIntToInt64(v_0.AuxInt) != 0 {
16138                                 break
16139                         }
16140                         z := v_0.Args[0]
16141                         if z.Op != OpPPC64XOR {
16142                                 break
16143                         }
16144                         _ = z.Args[1]
16145                         z_0 := z.Args[0]
16146                         z_1 := z.Args[1]
16147                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16148                                 x := z_0
16149                                 y := z_1
16150                                 if !(z.Uses == 1) {
16151                                         continue
16152                                 }
16153                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16154                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
16155                                 v1.AddArg2(x, y)
16156                                 v0.AddArg(v1)
16157                                 b.resetWithControl(BlockPPC64LT, v0)
16158                                 return true
16159                         }
16160                         break
16161                 }
16162         case BlockPPC64NE:
16163                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (Equal cc)))) yes no)
16164                 // result: (EQ cc yes no)
16165                 for b.Controls[0].Op == OpPPC64CMPWconst {
16166                         v_0 := b.Controls[0]
16167                         if auxIntToInt32(v_0.AuxInt) != 0 {
16168                                 break
16169                         }
16170                         v_0_0 := v_0.Args[0]
16171                         if v_0_0.Op != OpSelect0 {
16172                                 break
16173                         }
16174                         v_0_0_0 := v_0_0.Args[0]
16175                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16176                                 break
16177                         }
16178                         v_0_0_0_0 := v_0_0_0.Args[0]
16179                         if v_0_0_0_0.Op != OpPPC64Equal {
16180                                 break
16181                         }
16182                         cc := v_0_0_0_0.Args[0]
16183                         b.resetWithControl(BlockPPC64EQ, cc)
16184                         return true
16185                 }
16186                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (NotEqual cc)))) yes no)
16187                 // result: (NE cc yes no)
16188                 for b.Controls[0].Op == OpPPC64CMPWconst {
16189                         v_0 := b.Controls[0]
16190                         if auxIntToInt32(v_0.AuxInt) != 0 {
16191                                 break
16192                         }
16193                         v_0_0 := v_0.Args[0]
16194                         if v_0_0.Op != OpSelect0 {
16195                                 break
16196                         }
16197                         v_0_0_0 := v_0_0.Args[0]
16198                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16199                                 break
16200                         }
16201                         v_0_0_0_0 := v_0_0_0.Args[0]
16202                         if v_0_0_0_0.Op != OpPPC64NotEqual {
16203                                 break
16204                         }
16205                         cc := v_0_0_0_0.Args[0]
16206                         b.resetWithControl(BlockPPC64NE, cc)
16207                         return true
16208                 }
16209                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (LessThan cc)))) yes no)
16210                 // result: (LT cc yes no)
16211                 for b.Controls[0].Op == OpPPC64CMPWconst {
16212                         v_0 := b.Controls[0]
16213                         if auxIntToInt32(v_0.AuxInt) != 0 {
16214                                 break
16215                         }
16216                         v_0_0 := v_0.Args[0]
16217                         if v_0_0.Op != OpSelect0 {
16218                                 break
16219                         }
16220                         v_0_0_0 := v_0_0.Args[0]
16221                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16222                                 break
16223                         }
16224                         v_0_0_0_0 := v_0_0_0.Args[0]
16225                         if v_0_0_0_0.Op != OpPPC64LessThan {
16226                                 break
16227                         }
16228                         cc := v_0_0_0_0.Args[0]
16229                         b.resetWithControl(BlockPPC64LT, cc)
16230                         return true
16231                 }
16232                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (LessEqual cc)))) yes no)
16233                 // result: (LE cc yes no)
16234                 for b.Controls[0].Op == OpPPC64CMPWconst {
16235                         v_0 := b.Controls[0]
16236                         if auxIntToInt32(v_0.AuxInt) != 0 {
16237                                 break
16238                         }
16239                         v_0_0 := v_0.Args[0]
16240                         if v_0_0.Op != OpSelect0 {
16241                                 break
16242                         }
16243                         v_0_0_0 := v_0_0.Args[0]
16244                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16245                                 break
16246                         }
16247                         v_0_0_0_0 := v_0_0_0.Args[0]
16248                         if v_0_0_0_0.Op != OpPPC64LessEqual {
16249                                 break
16250                         }
16251                         cc := v_0_0_0_0.Args[0]
16252                         b.resetWithControl(BlockPPC64LE, cc)
16253                         return true
16254                 }
16255                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (GreaterThan cc)))) yes no)
16256                 // result: (GT cc yes no)
16257                 for b.Controls[0].Op == OpPPC64CMPWconst {
16258                         v_0 := b.Controls[0]
16259                         if auxIntToInt32(v_0.AuxInt) != 0 {
16260                                 break
16261                         }
16262                         v_0_0 := v_0.Args[0]
16263                         if v_0_0.Op != OpSelect0 {
16264                                 break
16265                         }
16266                         v_0_0_0 := v_0_0.Args[0]
16267                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16268                                 break
16269                         }
16270                         v_0_0_0_0 := v_0_0_0.Args[0]
16271                         if v_0_0_0_0.Op != OpPPC64GreaterThan {
16272                                 break
16273                         }
16274                         cc := v_0_0_0_0.Args[0]
16275                         b.resetWithControl(BlockPPC64GT, cc)
16276                         return true
16277                 }
16278                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (GreaterEqual cc)))) yes no)
16279                 // result: (GE cc yes no)
16280                 for b.Controls[0].Op == OpPPC64CMPWconst {
16281                         v_0 := b.Controls[0]
16282                         if auxIntToInt32(v_0.AuxInt) != 0 {
16283                                 break
16284                         }
16285                         v_0_0 := v_0.Args[0]
16286                         if v_0_0.Op != OpSelect0 {
16287                                 break
16288                         }
16289                         v_0_0_0 := v_0_0.Args[0]
16290                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16291                                 break
16292                         }
16293                         v_0_0_0_0 := v_0_0_0.Args[0]
16294                         if v_0_0_0_0.Op != OpPPC64GreaterEqual {
16295                                 break
16296                         }
16297                         cc := v_0_0_0_0.Args[0]
16298                         b.resetWithControl(BlockPPC64GE, cc)
16299                         return true
16300                 }
16301                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FLessThan cc)))) yes no)
16302                 // result: (FLT cc yes no)
16303                 for b.Controls[0].Op == OpPPC64CMPWconst {
16304                         v_0 := b.Controls[0]
16305                         if auxIntToInt32(v_0.AuxInt) != 0 {
16306                                 break
16307                         }
16308                         v_0_0 := v_0.Args[0]
16309                         if v_0_0.Op != OpSelect0 {
16310                                 break
16311                         }
16312                         v_0_0_0 := v_0_0.Args[0]
16313                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16314                                 break
16315                         }
16316                         v_0_0_0_0 := v_0_0_0.Args[0]
16317                         if v_0_0_0_0.Op != OpPPC64FLessThan {
16318                                 break
16319                         }
16320                         cc := v_0_0_0_0.Args[0]
16321                         b.resetWithControl(BlockPPC64FLT, cc)
16322                         return true
16323                 }
16324                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FLessEqual cc)))) yes no)
16325                 // result: (FLE cc yes no)
16326                 for b.Controls[0].Op == OpPPC64CMPWconst {
16327                         v_0 := b.Controls[0]
16328                         if auxIntToInt32(v_0.AuxInt) != 0 {
16329                                 break
16330                         }
16331                         v_0_0 := v_0.Args[0]
16332                         if v_0_0.Op != OpSelect0 {
16333                                 break
16334                         }
16335                         v_0_0_0 := v_0_0.Args[0]
16336                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16337                                 break
16338                         }
16339                         v_0_0_0_0 := v_0_0_0.Args[0]
16340                         if v_0_0_0_0.Op != OpPPC64FLessEqual {
16341                                 break
16342                         }
16343                         cc := v_0_0_0_0.Args[0]
16344                         b.resetWithControl(BlockPPC64FLE, cc)
16345                         return true
16346                 }
16347                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FGreaterThan cc)))) yes no)
16348                 // result: (FGT cc yes no)
16349                 for b.Controls[0].Op == OpPPC64CMPWconst {
16350                         v_0 := b.Controls[0]
16351                         if auxIntToInt32(v_0.AuxInt) != 0 {
16352                                 break
16353                         }
16354                         v_0_0 := v_0.Args[0]
16355                         if v_0_0.Op != OpSelect0 {
16356                                 break
16357                         }
16358                         v_0_0_0 := v_0_0.Args[0]
16359                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16360                                 break
16361                         }
16362                         v_0_0_0_0 := v_0_0_0.Args[0]
16363                         if v_0_0_0_0.Op != OpPPC64FGreaterThan {
16364                                 break
16365                         }
16366                         cc := v_0_0_0_0.Args[0]
16367                         b.resetWithControl(BlockPPC64FGT, cc)
16368                         return true
16369                 }
16370                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FGreaterEqual cc)))) yes no)
16371                 // result: (FGE cc yes no)
16372                 for b.Controls[0].Op == OpPPC64CMPWconst {
16373                         v_0 := b.Controls[0]
16374                         if auxIntToInt32(v_0.AuxInt) != 0 {
16375                                 break
16376                         }
16377                         v_0_0 := v_0.Args[0]
16378                         if v_0_0.Op != OpSelect0 {
16379                                 break
16380                         }
16381                         v_0_0_0 := v_0_0.Args[0]
16382                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16383                                 break
16384                         }
16385                         v_0_0_0_0 := v_0_0_0.Args[0]
16386                         if v_0_0_0_0.Op != OpPPC64FGreaterEqual {
16387                                 break
16388                         }
16389                         cc := v_0_0_0_0.Args[0]
16390                         b.resetWithControl(BlockPPC64FGE, cc)
16391                         return true
16392                 }
16393                 // match: (NE (FlagEQ) yes no)
16394                 // result: (First no yes)
16395                 for b.Controls[0].Op == OpPPC64FlagEQ {
16396                         b.Reset(BlockFirst)
16397                         b.swapSuccessors()
16398                         return true
16399                 }
16400                 // match: (NE (FlagLT) yes no)
16401                 // result: (First yes no)
16402                 for b.Controls[0].Op == OpPPC64FlagLT {
16403                         b.Reset(BlockFirst)
16404                         return true
16405                 }
16406                 // match: (NE (FlagGT) yes no)
16407                 // result: (First yes no)
16408                 for b.Controls[0].Op == OpPPC64FlagGT {
16409                         b.Reset(BlockFirst)
16410                         return true
16411                 }
16412                 // match: (NE (InvertFlags cmp) yes no)
16413                 // result: (NE cmp yes no)
16414                 for b.Controls[0].Op == OpPPC64InvertFlags {
16415                         v_0 := b.Controls[0]
16416                         cmp := v_0.Args[0]
16417                         b.resetWithControl(BlockPPC64NE, cmp)
16418                         return true
16419                 }
16420                 // match: (NE (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
16421                 // result: (NE (Select1 <types.TypeFlags> z) yes no)
16422                 for b.Controls[0].Op == OpPPC64CMPconst {
16423                         v_0 := b.Controls[0]
16424                         if auxIntToInt64(v_0.AuxInt) != 0 {
16425                                 break
16426                         }
16427                         v_0_0 := v_0.Args[0]
16428                         if v_0_0.Op != OpSelect0 {
16429                                 break
16430                         }
16431                         z := v_0_0.Args[0]
16432                         if z.Op != OpPPC64ANDCCconst {
16433                                 break
16434                         }
16435                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16436                         v0.AddArg(z)
16437                         b.resetWithControl(BlockPPC64NE, v0)
16438                         return true
16439                 }
16440                 // match: (NE (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
16441                 // result: (NE (Select1 <types.TypeFlags> z) yes no)
16442                 for b.Controls[0].Op == OpPPC64CMPWconst {
16443                         v_0 := b.Controls[0]
16444                         if auxIntToInt32(v_0.AuxInt) != 0 {
16445                                 break
16446                         }
16447                         v_0_0 := v_0.Args[0]
16448                         if v_0_0.Op != OpSelect0 {
16449                                 break
16450                         }
16451                         z := v_0_0.Args[0]
16452                         if z.Op != OpPPC64ANDCCconst {
16453                                 break
16454                         }
16455                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16456                         v0.AddArg(z)
16457                         b.resetWithControl(BlockPPC64NE, v0)
16458                         return true
16459                 }
16460                 // match: (NE (CMPconst [0] z:(AND x y)) yes no)
16461                 // cond: z.Uses == 1
16462                 // result: (NE (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
16463                 for b.Controls[0].Op == OpPPC64CMPconst {
16464                         v_0 := b.Controls[0]
16465                         if auxIntToInt64(v_0.AuxInt) != 0 {
16466                                 break
16467                         }
16468                         z := v_0.Args[0]
16469                         if z.Op != OpPPC64AND {
16470                                 break
16471                         }
16472                         _ = z.Args[1]
16473                         z_0 := z.Args[0]
16474                         z_1 := z.Args[1]
16475                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16476                                 x := z_0
16477                                 y := z_1
16478                                 if !(z.Uses == 1) {
16479                                         continue
16480                                 }
16481                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16482                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
16483                                 v1.AddArg2(x, y)
16484                                 v0.AddArg(v1)
16485                                 b.resetWithControl(BlockPPC64NE, v0)
16486                                 return true
16487                         }
16488                         break
16489                 }
16490                 // match: (NE (CMPconst [0] z:(OR x y)) yes no)
16491                 // cond: z.Uses == 1
16492                 // result: (NE (Select1 <types.TypeFlags> (ORCC x y)) yes no)
16493                 for b.Controls[0].Op == OpPPC64CMPconst {
16494                         v_0 := b.Controls[0]
16495                         if auxIntToInt64(v_0.AuxInt) != 0 {
16496                                 break
16497                         }
16498                         z := v_0.Args[0]
16499                         if z.Op != OpPPC64OR {
16500                                 break
16501                         }
16502                         _ = z.Args[1]
16503                         z_0 := z.Args[0]
16504                         z_1 := z.Args[1]
16505                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16506                                 x := z_0
16507                                 y := z_1
16508                                 if !(z.Uses == 1) {
16509                                         continue
16510                                 }
16511                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16512                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
16513                                 v1.AddArg2(x, y)
16514                                 v0.AddArg(v1)
16515                                 b.resetWithControl(BlockPPC64NE, v0)
16516                                 return true
16517                         }
16518                         break
16519                 }
16520                 // match: (NE (CMPconst [0] z:(XOR x y)) yes no)
16521                 // cond: z.Uses == 1
16522                 // result: (NE (Select1 <types.TypeFlags> (XORCC x y)) yes no)
16523                 for b.Controls[0].Op == OpPPC64CMPconst {
16524                         v_0 := b.Controls[0]
16525                         if auxIntToInt64(v_0.AuxInt) != 0 {
16526                                 break
16527                         }
16528                         z := v_0.Args[0]
16529                         if z.Op != OpPPC64XOR {
16530                                 break
16531                         }
16532                         _ = z.Args[1]
16533                         z_0 := z.Args[0]
16534                         z_1 := z.Args[1]
16535                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16536                                 x := z_0
16537                                 y := z_1
16538                                 if !(z.Uses == 1) {
16539                                         continue
16540                                 }
16541                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16542                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
16543                                 v1.AddArg2(x, y)
16544                                 v0.AddArg(v1)
16545                                 b.resetWithControl(BlockPPC64NE, v0)
16546                                 return true
16547                         }
16548                         break
16549                 }
16550         }
16551         return false
16552 }