]> Cypherpunks.ru repositories - gostls13.git/blob - src/cmd/compile/internal/ssa/rewritePPC64.go
cmd/compile: adding rule to eliminate ANDCCconst
[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 (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, OpPPC64MOVHBRloadidx, typ.Int16)
1192                 v.copyOf(v0)
1193                 v0.AddArg3(ptr, idx, mem)
1194                 return true
1195         }
1196         return false
1197 }
1198 func rewriteValuePPC64_OpBswap32(v *Value) bool {
1199         v_0 := v.Args[0]
1200         b := v.Block
1201         typ := &b.Func.Config.Types
1202         // match: (Bswap32 x)
1203         // cond: buildcfg.GOPPC64>=10
1204         // result: (BRW x)
1205         for {
1206                 x := v_0
1207                 if !(buildcfg.GOPPC64 >= 10) {
1208                         break
1209                 }
1210                 v.reset(OpPPC64BRW)
1211                 v.AddArg(x)
1212                 return true
1213         }
1214         // match: (Bswap32 x:(MOVWZload [off] {sym} ptr mem))
1215         // result: @x.Block (MOVWBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
1216         for {
1217                 x := v_0
1218                 if x.Op != OpPPC64MOVWZload {
1219                         break
1220                 }
1221                 off := auxIntToInt32(x.AuxInt)
1222                 sym := auxToSym(x.Aux)
1223                 mem := x.Args[1]
1224                 ptr := x.Args[0]
1225                 b = x.Block
1226                 v0 := b.NewValue0(x.Pos, OpPPC64MOVWBRload, typ.UInt32)
1227                 v.copyOf(v0)
1228                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
1229                 v1.AuxInt = int32ToAuxInt(off)
1230                 v1.Aux = symToAux(sym)
1231                 v1.AddArg(ptr)
1232                 v0.AddArg2(v1, mem)
1233                 return true
1234         }
1235         // match: (Bswap32 x:(MOVWZloadidx ptr idx mem))
1236         // result: @x.Block (MOVWBRloadidx ptr idx mem)
1237         for {
1238                 x := v_0
1239                 if x.Op != OpPPC64MOVWZloadidx {
1240                         break
1241                 }
1242                 mem := x.Args[2]
1243                 ptr := x.Args[0]
1244                 idx := x.Args[1]
1245                 b = x.Block
1246                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRloadidx, typ.Int32)
1247                 v.copyOf(v0)
1248                 v0.AddArg3(ptr, idx, mem)
1249                 return true
1250         }
1251         return false
1252 }
1253 func rewriteValuePPC64_OpBswap64(v *Value) bool {
1254         v_0 := v.Args[0]
1255         b := v.Block
1256         typ := &b.Func.Config.Types
1257         // match: (Bswap64 x)
1258         // cond: buildcfg.GOPPC64>=10
1259         // result: (BRD x)
1260         for {
1261                 x := v_0
1262                 if !(buildcfg.GOPPC64 >= 10) {
1263                         break
1264                 }
1265                 v.reset(OpPPC64BRD)
1266                 v.AddArg(x)
1267                 return true
1268         }
1269         // match: (Bswap64 x:(MOVDload [off] {sym} ptr mem))
1270         // result: @x.Block (MOVDBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
1271         for {
1272                 x := v_0
1273                 if x.Op != OpPPC64MOVDload {
1274                         break
1275                 }
1276                 off := auxIntToInt32(x.AuxInt)
1277                 sym := auxToSym(x.Aux)
1278                 mem := x.Args[1]
1279                 ptr := x.Args[0]
1280                 b = x.Block
1281                 v0 := b.NewValue0(x.Pos, OpPPC64MOVDBRload, typ.UInt64)
1282                 v.copyOf(v0)
1283                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
1284                 v1.AuxInt = int32ToAuxInt(off)
1285                 v1.Aux = symToAux(sym)
1286                 v1.AddArg(ptr)
1287                 v0.AddArg2(v1, mem)
1288                 return true
1289         }
1290         // match: (Bswap64 x:(MOVDloadidx ptr idx mem))
1291         // result: @x.Block (MOVDBRloadidx ptr idx mem)
1292         for {
1293                 x := v_0
1294                 if x.Op != OpPPC64MOVDloadidx {
1295                         break
1296                 }
1297                 mem := x.Args[2]
1298                 ptr := x.Args[0]
1299                 idx := x.Args[1]
1300                 b = x.Block
1301                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRloadidx, typ.Int64)
1302                 v.copyOf(v0)
1303                 v0.AddArg3(ptr, idx, mem)
1304                 return true
1305         }
1306         return false
1307 }
1308 func rewriteValuePPC64_OpCom16(v *Value) bool {
1309         v_0 := v.Args[0]
1310         // match: (Com16 x)
1311         // result: (NOR x x)
1312         for {
1313                 x := v_0
1314                 v.reset(OpPPC64NOR)
1315                 v.AddArg2(x, x)
1316                 return true
1317         }
1318 }
1319 func rewriteValuePPC64_OpCom32(v *Value) bool {
1320         v_0 := v.Args[0]
1321         // match: (Com32 x)
1322         // result: (NOR x x)
1323         for {
1324                 x := v_0
1325                 v.reset(OpPPC64NOR)
1326                 v.AddArg2(x, x)
1327                 return true
1328         }
1329 }
1330 func rewriteValuePPC64_OpCom64(v *Value) bool {
1331         v_0 := v.Args[0]
1332         // match: (Com64 x)
1333         // result: (NOR x x)
1334         for {
1335                 x := v_0
1336                 v.reset(OpPPC64NOR)
1337                 v.AddArg2(x, x)
1338                 return true
1339         }
1340 }
1341 func rewriteValuePPC64_OpCom8(v *Value) bool {
1342         v_0 := v.Args[0]
1343         // match: (Com8 x)
1344         // result: (NOR x x)
1345         for {
1346                 x := v_0
1347                 v.reset(OpPPC64NOR)
1348                 v.AddArg2(x, x)
1349                 return true
1350         }
1351 }
1352 func rewriteValuePPC64_OpCondSelect(v *Value) bool {
1353         v_2 := v.Args[2]
1354         v_1 := v.Args[1]
1355         v_0 := v.Args[0]
1356         b := v.Block
1357         typ := &b.Func.Config.Types
1358         // match: (CondSelect x y (SETBC [a] cmp))
1359         // result: (ISEL [a] x y cmp)
1360         for {
1361                 x := v_0
1362                 y := v_1
1363                 if v_2.Op != OpPPC64SETBC {
1364                         break
1365                 }
1366                 a := auxIntToInt32(v_2.AuxInt)
1367                 cmp := v_2.Args[0]
1368                 v.reset(OpPPC64ISEL)
1369                 v.AuxInt = int32ToAuxInt(a)
1370                 v.AddArg3(x, y, cmp)
1371                 return true
1372         }
1373         // match: (CondSelect x y (SETBCR [a] cmp))
1374         // result: (ISEL [a+4] x y cmp)
1375         for {
1376                 x := v_0
1377                 y := v_1
1378                 if v_2.Op != OpPPC64SETBCR {
1379                         break
1380                 }
1381                 a := auxIntToInt32(v_2.AuxInt)
1382                 cmp := v_2.Args[0]
1383                 v.reset(OpPPC64ISEL)
1384                 v.AuxInt = int32ToAuxInt(a + 4)
1385                 v.AddArg3(x, y, cmp)
1386                 return true
1387         }
1388         // match: (CondSelect x y bool)
1389         // cond: flagArg(bool) == nil
1390         // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [1] bool)))
1391         for {
1392                 x := v_0
1393                 y := v_1
1394                 bool := v_2
1395                 if !(flagArg(bool) == nil) {
1396                         break
1397                 }
1398                 v.reset(OpPPC64ISEL)
1399                 v.AuxInt = int32ToAuxInt(6)
1400                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
1401                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
1402                 v1.AuxInt = int64ToAuxInt(1)
1403                 v1.AddArg(bool)
1404                 v0.AddArg(v1)
1405                 v.AddArg3(x, y, v0)
1406                 return true
1407         }
1408         return false
1409 }
1410 func rewriteValuePPC64_OpConst16(v *Value) bool {
1411         // match: (Const16 [val])
1412         // result: (MOVDconst [int64(val)])
1413         for {
1414                 val := auxIntToInt16(v.AuxInt)
1415                 v.reset(OpPPC64MOVDconst)
1416                 v.AuxInt = int64ToAuxInt(int64(val))
1417                 return true
1418         }
1419 }
1420 func rewriteValuePPC64_OpConst32(v *Value) bool {
1421         // match: (Const32 [val])
1422         // result: (MOVDconst [int64(val)])
1423         for {
1424                 val := auxIntToInt32(v.AuxInt)
1425                 v.reset(OpPPC64MOVDconst)
1426                 v.AuxInt = int64ToAuxInt(int64(val))
1427                 return true
1428         }
1429 }
1430 func rewriteValuePPC64_OpConst64(v *Value) bool {
1431         // match: (Const64 [val])
1432         // result: (MOVDconst [int64(val)])
1433         for {
1434                 val := auxIntToInt64(v.AuxInt)
1435                 v.reset(OpPPC64MOVDconst)
1436                 v.AuxInt = int64ToAuxInt(int64(val))
1437                 return true
1438         }
1439 }
1440 func rewriteValuePPC64_OpConst8(v *Value) bool {
1441         // match: (Const8 [val])
1442         // result: (MOVDconst [int64(val)])
1443         for {
1444                 val := auxIntToInt8(v.AuxInt)
1445                 v.reset(OpPPC64MOVDconst)
1446                 v.AuxInt = int64ToAuxInt(int64(val))
1447                 return true
1448         }
1449 }
1450 func rewriteValuePPC64_OpConstBool(v *Value) bool {
1451         // match: (ConstBool [t])
1452         // result: (MOVDconst [b2i(t)])
1453         for {
1454                 t := auxIntToBool(v.AuxInt)
1455                 v.reset(OpPPC64MOVDconst)
1456                 v.AuxInt = int64ToAuxInt(b2i(t))
1457                 return true
1458         }
1459 }
1460 func rewriteValuePPC64_OpConstNil(v *Value) bool {
1461         // match: (ConstNil)
1462         // result: (MOVDconst [0])
1463         for {
1464                 v.reset(OpPPC64MOVDconst)
1465                 v.AuxInt = int64ToAuxInt(0)
1466                 return true
1467         }
1468 }
1469 func rewriteValuePPC64_OpCopysign(v *Value) bool {
1470         v_1 := v.Args[1]
1471         v_0 := v.Args[0]
1472         // match: (Copysign x y)
1473         // result: (FCPSGN y x)
1474         for {
1475                 x := v_0
1476                 y := v_1
1477                 v.reset(OpPPC64FCPSGN)
1478                 v.AddArg2(y, x)
1479                 return true
1480         }
1481 }
1482 func rewriteValuePPC64_OpCtz16(v *Value) bool {
1483         v_0 := v.Args[0]
1484         b := v.Block
1485         typ := &b.Func.Config.Types
1486         // match: (Ctz16 x)
1487         // result: (POPCNTW (MOVHZreg (ANDN <typ.Int16> (ADDconst <typ.Int16> [-1] x) x)))
1488         for {
1489                 x := v_0
1490                 v.reset(OpPPC64POPCNTW)
1491                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
1492                 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int16)
1493                 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int16)
1494                 v2.AuxInt = int64ToAuxInt(-1)
1495                 v2.AddArg(x)
1496                 v1.AddArg2(v2, x)
1497                 v0.AddArg(v1)
1498                 v.AddArg(v0)
1499                 return true
1500         }
1501 }
1502 func rewriteValuePPC64_OpCtz32(v *Value) bool {
1503         v_0 := v.Args[0]
1504         b := v.Block
1505         typ := &b.Func.Config.Types
1506         // match: (Ctz32 x)
1507         // cond: buildcfg.GOPPC64<=8
1508         // result: (POPCNTW (MOVWZreg (ANDN <typ.Int> (ADDconst <typ.Int> [-1] x) x)))
1509         for {
1510                 x := v_0
1511                 if !(buildcfg.GOPPC64 <= 8) {
1512                         break
1513                 }
1514                 v.reset(OpPPC64POPCNTW)
1515                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
1516                 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int)
1517                 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int)
1518                 v2.AuxInt = int64ToAuxInt(-1)
1519                 v2.AddArg(x)
1520                 v1.AddArg2(v2, x)
1521                 v0.AddArg(v1)
1522                 v.AddArg(v0)
1523                 return true
1524         }
1525         // match: (Ctz32 x)
1526         // result: (CNTTZW (MOVWZreg x))
1527         for {
1528                 x := v_0
1529                 v.reset(OpPPC64CNTTZW)
1530                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
1531                 v0.AddArg(x)
1532                 v.AddArg(v0)
1533                 return true
1534         }
1535 }
1536 func rewriteValuePPC64_OpCtz64(v *Value) bool {
1537         v_0 := v.Args[0]
1538         b := v.Block
1539         typ := &b.Func.Config.Types
1540         // match: (Ctz64 x)
1541         // cond: buildcfg.GOPPC64<=8
1542         // result: (POPCNTD (ANDN <typ.Int64> (ADDconst <typ.Int64> [-1] x) x))
1543         for {
1544                 x := v_0
1545                 if !(buildcfg.GOPPC64 <= 8) {
1546                         break
1547                 }
1548                 v.reset(OpPPC64POPCNTD)
1549                 v0 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.Int64)
1550                 v1 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.Int64)
1551                 v1.AuxInt = int64ToAuxInt(-1)
1552                 v1.AddArg(x)
1553                 v0.AddArg2(v1, x)
1554                 v.AddArg(v0)
1555                 return true
1556         }
1557         // match: (Ctz64 x)
1558         // result: (CNTTZD x)
1559         for {
1560                 x := v_0
1561                 v.reset(OpPPC64CNTTZD)
1562                 v.AddArg(x)
1563                 return true
1564         }
1565 }
1566 func rewriteValuePPC64_OpCtz8(v *Value) bool {
1567         v_0 := v.Args[0]
1568         b := v.Block
1569         typ := &b.Func.Config.Types
1570         // match: (Ctz8 x)
1571         // result: (POPCNTB (MOVBZreg (ANDN <typ.UInt8> (ADDconst <typ.UInt8> [-1] x) x)))
1572         for {
1573                 x := v_0
1574                 v.reset(OpPPC64POPCNTB)
1575                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
1576                 v1 := b.NewValue0(v.Pos, OpPPC64ANDN, typ.UInt8)
1577                 v2 := b.NewValue0(v.Pos, OpPPC64ADDconst, typ.UInt8)
1578                 v2.AuxInt = int64ToAuxInt(-1)
1579                 v2.AddArg(x)
1580                 v1.AddArg2(v2, x)
1581                 v0.AddArg(v1)
1582                 v.AddArg(v0)
1583                 return true
1584         }
1585 }
1586 func rewriteValuePPC64_OpCvt32Fto32(v *Value) bool {
1587         v_0 := v.Args[0]
1588         b := v.Block
1589         typ := &b.Func.Config.Types
1590         // match: (Cvt32Fto32 x)
1591         // result: (MFVSRD (FCTIWZ x))
1592         for {
1593                 x := v_0
1594                 v.reset(OpPPC64MFVSRD)
1595                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIWZ, typ.Float64)
1596                 v0.AddArg(x)
1597                 v.AddArg(v0)
1598                 return true
1599         }
1600 }
1601 func rewriteValuePPC64_OpCvt32Fto64(v *Value) bool {
1602         v_0 := v.Args[0]
1603         b := v.Block
1604         typ := &b.Func.Config.Types
1605         // match: (Cvt32Fto64 x)
1606         // result: (MFVSRD (FCTIDZ x))
1607         for {
1608                 x := v_0
1609                 v.reset(OpPPC64MFVSRD)
1610                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIDZ, typ.Float64)
1611                 v0.AddArg(x)
1612                 v.AddArg(v0)
1613                 return true
1614         }
1615 }
1616 func rewriteValuePPC64_OpCvt32to32F(v *Value) bool {
1617         v_0 := v.Args[0]
1618         b := v.Block
1619         typ := &b.Func.Config.Types
1620         // match: (Cvt32to32F x)
1621         // result: (FCFIDS (MTVSRD (SignExt32to64 x)))
1622         for {
1623                 x := v_0
1624                 v.reset(OpPPC64FCFIDS)
1625                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1626                 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
1627                 v1.AddArg(x)
1628                 v0.AddArg(v1)
1629                 v.AddArg(v0)
1630                 return true
1631         }
1632 }
1633 func rewriteValuePPC64_OpCvt32to64F(v *Value) bool {
1634         v_0 := v.Args[0]
1635         b := v.Block
1636         typ := &b.Func.Config.Types
1637         // match: (Cvt32to64F x)
1638         // result: (FCFID (MTVSRD (SignExt32to64 x)))
1639         for {
1640                 x := v_0
1641                 v.reset(OpPPC64FCFID)
1642                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1643                 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
1644                 v1.AddArg(x)
1645                 v0.AddArg(v1)
1646                 v.AddArg(v0)
1647                 return true
1648         }
1649 }
1650 func rewriteValuePPC64_OpCvt64Fto32(v *Value) bool {
1651         v_0 := v.Args[0]
1652         b := v.Block
1653         typ := &b.Func.Config.Types
1654         // match: (Cvt64Fto32 x)
1655         // result: (MFVSRD (FCTIWZ x))
1656         for {
1657                 x := v_0
1658                 v.reset(OpPPC64MFVSRD)
1659                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIWZ, typ.Float64)
1660                 v0.AddArg(x)
1661                 v.AddArg(v0)
1662                 return true
1663         }
1664 }
1665 func rewriteValuePPC64_OpCvt64Fto64(v *Value) bool {
1666         v_0 := v.Args[0]
1667         b := v.Block
1668         typ := &b.Func.Config.Types
1669         // match: (Cvt64Fto64 x)
1670         // result: (MFVSRD (FCTIDZ x))
1671         for {
1672                 x := v_0
1673                 v.reset(OpPPC64MFVSRD)
1674                 v0 := b.NewValue0(v.Pos, OpPPC64FCTIDZ, typ.Float64)
1675                 v0.AddArg(x)
1676                 v.AddArg(v0)
1677                 return true
1678         }
1679 }
1680 func rewriteValuePPC64_OpCvt64to32F(v *Value) bool {
1681         v_0 := v.Args[0]
1682         b := v.Block
1683         typ := &b.Func.Config.Types
1684         // match: (Cvt64to32F x)
1685         // result: (FCFIDS (MTVSRD x))
1686         for {
1687                 x := v_0
1688                 v.reset(OpPPC64FCFIDS)
1689                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1690                 v0.AddArg(x)
1691                 v.AddArg(v0)
1692                 return true
1693         }
1694 }
1695 func rewriteValuePPC64_OpCvt64to64F(v *Value) bool {
1696         v_0 := v.Args[0]
1697         b := v.Block
1698         typ := &b.Func.Config.Types
1699         // match: (Cvt64to64F x)
1700         // result: (FCFID (MTVSRD x))
1701         for {
1702                 x := v_0
1703                 v.reset(OpPPC64FCFID)
1704                 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1705                 v0.AddArg(x)
1706                 v.AddArg(v0)
1707                 return true
1708         }
1709 }
1710 func rewriteValuePPC64_OpDiv16(v *Value) bool {
1711         v_1 := v.Args[1]
1712         v_0 := v.Args[0]
1713         b := v.Block
1714         typ := &b.Func.Config.Types
1715         // match: (Div16 [false] x y)
1716         // result: (DIVW (SignExt16to32 x) (SignExt16to32 y))
1717         for {
1718                 if auxIntToBool(v.AuxInt) != false {
1719                         break
1720                 }
1721                 x := v_0
1722                 y := v_1
1723                 v.reset(OpPPC64DIVW)
1724                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1725                 v0.AddArg(x)
1726                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1727                 v1.AddArg(y)
1728                 v.AddArg2(v0, v1)
1729                 return true
1730         }
1731         return false
1732 }
1733 func rewriteValuePPC64_OpDiv16u(v *Value) bool {
1734         v_1 := v.Args[1]
1735         v_0 := v.Args[0]
1736         b := v.Block
1737         typ := &b.Func.Config.Types
1738         // match: (Div16u x y)
1739         // result: (DIVWU (ZeroExt16to32 x) (ZeroExt16to32 y))
1740         for {
1741                 x := v_0
1742                 y := v_1
1743                 v.reset(OpPPC64DIVWU)
1744                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1745                 v0.AddArg(x)
1746                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1747                 v1.AddArg(y)
1748                 v.AddArg2(v0, v1)
1749                 return true
1750         }
1751 }
1752 func rewriteValuePPC64_OpDiv32(v *Value) bool {
1753         v_1 := v.Args[1]
1754         v_0 := v.Args[0]
1755         // match: (Div32 [false] x y)
1756         // result: (DIVW x y)
1757         for {
1758                 if auxIntToBool(v.AuxInt) != false {
1759                         break
1760                 }
1761                 x := v_0
1762                 y := v_1
1763                 v.reset(OpPPC64DIVW)
1764                 v.AddArg2(x, y)
1765                 return true
1766         }
1767         return false
1768 }
1769 func rewriteValuePPC64_OpDiv64(v *Value) bool {
1770         v_1 := v.Args[1]
1771         v_0 := v.Args[0]
1772         // match: (Div64 [false] x y)
1773         // result: (DIVD x y)
1774         for {
1775                 if auxIntToBool(v.AuxInt) != false {
1776                         break
1777                 }
1778                 x := v_0
1779                 y := v_1
1780                 v.reset(OpPPC64DIVD)
1781                 v.AddArg2(x, y)
1782                 return true
1783         }
1784         return false
1785 }
1786 func rewriteValuePPC64_OpDiv8(v *Value) bool {
1787         v_1 := v.Args[1]
1788         v_0 := v.Args[0]
1789         b := v.Block
1790         typ := &b.Func.Config.Types
1791         // match: (Div8 x y)
1792         // result: (DIVW (SignExt8to32 x) (SignExt8to32 y))
1793         for {
1794                 x := v_0
1795                 y := v_1
1796                 v.reset(OpPPC64DIVW)
1797                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1798                 v0.AddArg(x)
1799                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1800                 v1.AddArg(y)
1801                 v.AddArg2(v0, v1)
1802                 return true
1803         }
1804 }
1805 func rewriteValuePPC64_OpDiv8u(v *Value) bool {
1806         v_1 := v.Args[1]
1807         v_0 := v.Args[0]
1808         b := v.Block
1809         typ := &b.Func.Config.Types
1810         // match: (Div8u x y)
1811         // result: (DIVWU (ZeroExt8to32 x) (ZeroExt8to32 y))
1812         for {
1813                 x := v_0
1814                 y := v_1
1815                 v.reset(OpPPC64DIVWU)
1816                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1817                 v0.AddArg(x)
1818                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1819                 v1.AddArg(y)
1820                 v.AddArg2(v0, v1)
1821                 return true
1822         }
1823 }
1824 func rewriteValuePPC64_OpEq16(v *Value) bool {
1825         v_1 := v.Args[1]
1826         v_0 := v.Args[0]
1827         b := v.Block
1828         typ := &b.Func.Config.Types
1829         // match: (Eq16 x y)
1830         // cond: x.Type.IsSigned() && y.Type.IsSigned()
1831         // result: (Equal (CMPW (SignExt16to32 x) (SignExt16to32 y)))
1832         for {
1833                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1834                         x := v_0
1835                         y := v_1
1836                         if !(x.Type.IsSigned() && y.Type.IsSigned()) {
1837                                 continue
1838                         }
1839                         v.reset(OpPPC64Equal)
1840                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1841                         v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1842                         v1.AddArg(x)
1843                         v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1844                         v2.AddArg(y)
1845                         v0.AddArg2(v1, v2)
1846                         v.AddArg(v0)
1847                         return true
1848                 }
1849                 break
1850         }
1851         // match: (Eq16 x y)
1852         // result: (Equal (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
1853         for {
1854                 x := v_0
1855                 y := v_1
1856                 v.reset(OpPPC64Equal)
1857                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1858                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1859                 v1.AddArg(x)
1860                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1861                 v2.AddArg(y)
1862                 v0.AddArg2(v1, v2)
1863                 v.AddArg(v0)
1864                 return true
1865         }
1866 }
1867 func rewriteValuePPC64_OpEq32(v *Value) bool {
1868         v_1 := v.Args[1]
1869         v_0 := v.Args[0]
1870         b := v.Block
1871         // match: (Eq32 x y)
1872         // result: (Equal (CMPW x y))
1873         for {
1874                 x := v_0
1875                 y := v_1
1876                 v.reset(OpPPC64Equal)
1877                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1878                 v0.AddArg2(x, y)
1879                 v.AddArg(v0)
1880                 return true
1881         }
1882 }
1883 func rewriteValuePPC64_OpEq32F(v *Value) bool {
1884         v_1 := v.Args[1]
1885         v_0 := v.Args[0]
1886         b := v.Block
1887         // match: (Eq32F x y)
1888         // result: (Equal (FCMPU x y))
1889         for {
1890                 x := v_0
1891                 y := v_1
1892                 v.reset(OpPPC64Equal)
1893                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
1894                 v0.AddArg2(x, y)
1895                 v.AddArg(v0)
1896                 return true
1897         }
1898 }
1899 func rewriteValuePPC64_OpEq64(v *Value) bool {
1900         v_1 := v.Args[1]
1901         v_0 := v.Args[0]
1902         b := v.Block
1903         // match: (Eq64 x y)
1904         // result: (Equal (CMP x y))
1905         for {
1906                 x := v_0
1907                 y := v_1
1908                 v.reset(OpPPC64Equal)
1909                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
1910                 v0.AddArg2(x, y)
1911                 v.AddArg(v0)
1912                 return true
1913         }
1914 }
1915 func rewriteValuePPC64_OpEq64F(v *Value) bool {
1916         v_1 := v.Args[1]
1917         v_0 := v.Args[0]
1918         b := v.Block
1919         // match: (Eq64F x y)
1920         // result: (Equal (FCMPU x y))
1921         for {
1922                 x := v_0
1923                 y := v_1
1924                 v.reset(OpPPC64Equal)
1925                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
1926                 v0.AddArg2(x, y)
1927                 v.AddArg(v0)
1928                 return true
1929         }
1930 }
1931 func rewriteValuePPC64_OpEq8(v *Value) bool {
1932         v_1 := v.Args[1]
1933         v_0 := v.Args[0]
1934         b := v.Block
1935         typ := &b.Func.Config.Types
1936         // match: (Eq8 x y)
1937         // cond: x.Type.IsSigned() && y.Type.IsSigned()
1938         // result: (Equal (CMPW (SignExt8to32 x) (SignExt8to32 y)))
1939         for {
1940                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1941                         x := v_0
1942                         y := v_1
1943                         if !(x.Type.IsSigned() && y.Type.IsSigned()) {
1944                                 continue
1945                         }
1946                         v.reset(OpPPC64Equal)
1947                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1948                         v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1949                         v1.AddArg(x)
1950                         v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1951                         v2.AddArg(y)
1952                         v0.AddArg2(v1, v2)
1953                         v.AddArg(v0)
1954                         return true
1955                 }
1956                 break
1957         }
1958         // match: (Eq8 x y)
1959         // result: (Equal (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
1960         for {
1961                 x := v_0
1962                 y := v_1
1963                 v.reset(OpPPC64Equal)
1964                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1965                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1966                 v1.AddArg(x)
1967                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1968                 v2.AddArg(y)
1969                 v0.AddArg2(v1, v2)
1970                 v.AddArg(v0)
1971                 return true
1972         }
1973 }
1974 func rewriteValuePPC64_OpEqB(v *Value) bool {
1975         v_1 := v.Args[1]
1976         v_0 := v.Args[0]
1977         b := v.Block
1978         typ := &b.Func.Config.Types
1979         // match: (EqB x y)
1980         // result: (Select0 <typ.Int> (ANDCCconst [1] (EQV x y)))
1981         for {
1982                 x := v_0
1983                 y := v_1
1984                 v.reset(OpSelect0)
1985                 v.Type = typ.Int
1986                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
1987                 v0.AuxInt = int64ToAuxInt(1)
1988                 v1 := b.NewValue0(v.Pos, OpPPC64EQV, typ.Int64)
1989                 v1.AddArg2(x, y)
1990                 v0.AddArg(v1)
1991                 v.AddArg(v0)
1992                 return true
1993         }
1994 }
1995 func rewriteValuePPC64_OpEqPtr(v *Value) bool {
1996         v_1 := v.Args[1]
1997         v_0 := v.Args[0]
1998         b := v.Block
1999         // match: (EqPtr x y)
2000         // result: (Equal (CMP x y))
2001         for {
2002                 x := v_0
2003                 y := v_1
2004                 v.reset(OpPPC64Equal)
2005                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2006                 v0.AddArg2(x, y)
2007                 v.AddArg(v0)
2008                 return true
2009         }
2010 }
2011 func rewriteValuePPC64_OpIsInBounds(v *Value) bool {
2012         v_1 := v.Args[1]
2013         v_0 := v.Args[0]
2014         b := v.Block
2015         // match: (IsInBounds idx len)
2016         // result: (LessThan (CMPU idx len))
2017         for {
2018                 idx := v_0
2019                 len := v_1
2020                 v.reset(OpPPC64LessThan)
2021                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2022                 v0.AddArg2(idx, len)
2023                 v.AddArg(v0)
2024                 return true
2025         }
2026 }
2027 func rewriteValuePPC64_OpIsNonNil(v *Value) bool {
2028         v_0 := v.Args[0]
2029         b := v.Block
2030         // match: (IsNonNil ptr)
2031         // result: (NotEqual (CMPconst [0] ptr))
2032         for {
2033                 ptr := v_0
2034                 v.reset(OpPPC64NotEqual)
2035                 v0 := b.NewValue0(v.Pos, OpPPC64CMPconst, types.TypeFlags)
2036                 v0.AuxInt = int64ToAuxInt(0)
2037                 v0.AddArg(ptr)
2038                 v.AddArg(v0)
2039                 return true
2040         }
2041 }
2042 func rewriteValuePPC64_OpIsSliceInBounds(v *Value) bool {
2043         v_1 := v.Args[1]
2044         v_0 := v.Args[0]
2045         b := v.Block
2046         // match: (IsSliceInBounds idx len)
2047         // result: (LessEqual (CMPU idx len))
2048         for {
2049                 idx := v_0
2050                 len := v_1
2051                 v.reset(OpPPC64LessEqual)
2052                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2053                 v0.AddArg2(idx, len)
2054                 v.AddArg(v0)
2055                 return true
2056         }
2057 }
2058 func rewriteValuePPC64_OpLeq16(v *Value) bool {
2059         v_1 := v.Args[1]
2060         v_0 := v.Args[0]
2061         b := v.Block
2062         typ := &b.Func.Config.Types
2063         // match: (Leq16 x y)
2064         // result: (LessEqual (CMPW (SignExt16to32 x) (SignExt16to32 y)))
2065         for {
2066                 x := v_0
2067                 y := v_1
2068                 v.reset(OpPPC64LessEqual)
2069                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2070                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2071                 v1.AddArg(x)
2072                 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2073                 v2.AddArg(y)
2074                 v0.AddArg2(v1, v2)
2075                 v.AddArg(v0)
2076                 return true
2077         }
2078 }
2079 func rewriteValuePPC64_OpLeq16U(v *Value) bool {
2080         v_1 := v.Args[1]
2081         v_0 := v.Args[0]
2082         b := v.Block
2083         typ := &b.Func.Config.Types
2084         // match: (Leq16U x y)
2085         // result: (LessEqual (CMPWU (ZeroExt16to32 x) (ZeroExt16to32 y)))
2086         for {
2087                 x := v_0
2088                 y := v_1
2089                 v.reset(OpPPC64LessEqual)
2090                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2091                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2092                 v1.AddArg(x)
2093                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2094                 v2.AddArg(y)
2095                 v0.AddArg2(v1, v2)
2096                 v.AddArg(v0)
2097                 return true
2098         }
2099 }
2100 func rewriteValuePPC64_OpLeq32(v *Value) bool {
2101         v_1 := v.Args[1]
2102         v_0 := v.Args[0]
2103         b := v.Block
2104         // match: (Leq32 x y)
2105         // result: (LessEqual (CMPW x y))
2106         for {
2107                 x := v_0
2108                 y := v_1
2109                 v.reset(OpPPC64LessEqual)
2110                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2111                 v0.AddArg2(x, y)
2112                 v.AddArg(v0)
2113                 return true
2114         }
2115 }
2116 func rewriteValuePPC64_OpLeq32F(v *Value) bool {
2117         v_1 := v.Args[1]
2118         v_0 := v.Args[0]
2119         b := v.Block
2120         // match: (Leq32F x y)
2121         // result: (FLessEqual (FCMPU x y))
2122         for {
2123                 x := v_0
2124                 y := v_1
2125                 v.reset(OpPPC64FLessEqual)
2126                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2127                 v0.AddArg2(x, y)
2128                 v.AddArg(v0)
2129                 return true
2130         }
2131 }
2132 func rewriteValuePPC64_OpLeq32U(v *Value) bool {
2133         v_1 := v.Args[1]
2134         v_0 := v.Args[0]
2135         b := v.Block
2136         // match: (Leq32U x y)
2137         // result: (LessEqual (CMPWU x y))
2138         for {
2139                 x := v_0
2140                 y := v_1
2141                 v.reset(OpPPC64LessEqual)
2142                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2143                 v0.AddArg2(x, y)
2144                 v.AddArg(v0)
2145                 return true
2146         }
2147 }
2148 func rewriteValuePPC64_OpLeq64(v *Value) bool {
2149         v_1 := v.Args[1]
2150         v_0 := v.Args[0]
2151         b := v.Block
2152         // match: (Leq64 x y)
2153         // result: (LessEqual (CMP x y))
2154         for {
2155                 x := v_0
2156                 y := v_1
2157                 v.reset(OpPPC64LessEqual)
2158                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2159                 v0.AddArg2(x, y)
2160                 v.AddArg(v0)
2161                 return true
2162         }
2163 }
2164 func rewriteValuePPC64_OpLeq64F(v *Value) bool {
2165         v_1 := v.Args[1]
2166         v_0 := v.Args[0]
2167         b := v.Block
2168         // match: (Leq64F x y)
2169         // result: (FLessEqual (FCMPU x y))
2170         for {
2171                 x := v_0
2172                 y := v_1
2173                 v.reset(OpPPC64FLessEqual)
2174                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2175                 v0.AddArg2(x, y)
2176                 v.AddArg(v0)
2177                 return true
2178         }
2179 }
2180 func rewriteValuePPC64_OpLeq64U(v *Value) bool {
2181         v_1 := v.Args[1]
2182         v_0 := v.Args[0]
2183         b := v.Block
2184         // match: (Leq64U x y)
2185         // result: (LessEqual (CMPU x y))
2186         for {
2187                 x := v_0
2188                 y := v_1
2189                 v.reset(OpPPC64LessEqual)
2190                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2191                 v0.AddArg2(x, y)
2192                 v.AddArg(v0)
2193                 return true
2194         }
2195 }
2196 func rewriteValuePPC64_OpLeq8(v *Value) bool {
2197         v_1 := v.Args[1]
2198         v_0 := v.Args[0]
2199         b := v.Block
2200         typ := &b.Func.Config.Types
2201         // match: (Leq8 x y)
2202         // result: (LessEqual (CMPW (SignExt8to32 x) (SignExt8to32 y)))
2203         for {
2204                 x := v_0
2205                 y := v_1
2206                 v.reset(OpPPC64LessEqual)
2207                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2208                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2209                 v1.AddArg(x)
2210                 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2211                 v2.AddArg(y)
2212                 v0.AddArg2(v1, v2)
2213                 v.AddArg(v0)
2214                 return true
2215         }
2216 }
2217 func rewriteValuePPC64_OpLeq8U(v *Value) bool {
2218         v_1 := v.Args[1]
2219         v_0 := v.Args[0]
2220         b := v.Block
2221         typ := &b.Func.Config.Types
2222         // match: (Leq8U x y)
2223         // result: (LessEqual (CMPWU (ZeroExt8to32 x) (ZeroExt8to32 y)))
2224         for {
2225                 x := v_0
2226                 y := v_1
2227                 v.reset(OpPPC64LessEqual)
2228                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2229                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2230                 v1.AddArg(x)
2231                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2232                 v2.AddArg(y)
2233                 v0.AddArg2(v1, v2)
2234                 v.AddArg(v0)
2235                 return true
2236         }
2237 }
2238 func rewriteValuePPC64_OpLess16(v *Value) bool {
2239         v_1 := v.Args[1]
2240         v_0 := v.Args[0]
2241         b := v.Block
2242         typ := &b.Func.Config.Types
2243         // match: (Less16 x y)
2244         // result: (LessThan (CMPW (SignExt16to32 x) (SignExt16to32 y)))
2245         for {
2246                 x := v_0
2247                 y := v_1
2248                 v.reset(OpPPC64LessThan)
2249                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2250                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2251                 v1.AddArg(x)
2252                 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2253                 v2.AddArg(y)
2254                 v0.AddArg2(v1, v2)
2255                 v.AddArg(v0)
2256                 return true
2257         }
2258 }
2259 func rewriteValuePPC64_OpLess16U(v *Value) bool {
2260         v_1 := v.Args[1]
2261         v_0 := v.Args[0]
2262         b := v.Block
2263         typ := &b.Func.Config.Types
2264         // match: (Less16U x y)
2265         // result: (LessThan (CMPWU (ZeroExt16to32 x) (ZeroExt16to32 y)))
2266         for {
2267                 x := v_0
2268                 y := v_1
2269                 v.reset(OpPPC64LessThan)
2270                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2271                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2272                 v1.AddArg(x)
2273                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2274                 v2.AddArg(y)
2275                 v0.AddArg2(v1, v2)
2276                 v.AddArg(v0)
2277                 return true
2278         }
2279 }
2280 func rewriteValuePPC64_OpLess32(v *Value) bool {
2281         v_1 := v.Args[1]
2282         v_0 := v.Args[0]
2283         b := v.Block
2284         // match: (Less32 x y)
2285         // result: (LessThan (CMPW x y))
2286         for {
2287                 x := v_0
2288                 y := v_1
2289                 v.reset(OpPPC64LessThan)
2290                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2291                 v0.AddArg2(x, y)
2292                 v.AddArg(v0)
2293                 return true
2294         }
2295 }
2296 func rewriteValuePPC64_OpLess32F(v *Value) bool {
2297         v_1 := v.Args[1]
2298         v_0 := v.Args[0]
2299         b := v.Block
2300         // match: (Less32F x y)
2301         // result: (FLessThan (FCMPU x y))
2302         for {
2303                 x := v_0
2304                 y := v_1
2305                 v.reset(OpPPC64FLessThan)
2306                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2307                 v0.AddArg2(x, y)
2308                 v.AddArg(v0)
2309                 return true
2310         }
2311 }
2312 func rewriteValuePPC64_OpLess32U(v *Value) bool {
2313         v_1 := v.Args[1]
2314         v_0 := v.Args[0]
2315         b := v.Block
2316         // match: (Less32U x y)
2317         // result: (LessThan (CMPWU x y))
2318         for {
2319                 x := v_0
2320                 y := v_1
2321                 v.reset(OpPPC64LessThan)
2322                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2323                 v0.AddArg2(x, y)
2324                 v.AddArg(v0)
2325                 return true
2326         }
2327 }
2328 func rewriteValuePPC64_OpLess64(v *Value) bool {
2329         v_1 := v.Args[1]
2330         v_0 := v.Args[0]
2331         b := v.Block
2332         // match: (Less64 x y)
2333         // result: (LessThan (CMP x y))
2334         for {
2335                 x := v_0
2336                 y := v_1
2337                 v.reset(OpPPC64LessThan)
2338                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2339                 v0.AddArg2(x, y)
2340                 v.AddArg(v0)
2341                 return true
2342         }
2343 }
2344 func rewriteValuePPC64_OpLess64F(v *Value) bool {
2345         v_1 := v.Args[1]
2346         v_0 := v.Args[0]
2347         b := v.Block
2348         // match: (Less64F x y)
2349         // result: (FLessThan (FCMPU x y))
2350         for {
2351                 x := v_0
2352                 y := v_1
2353                 v.reset(OpPPC64FLessThan)
2354                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2355                 v0.AddArg2(x, y)
2356                 v.AddArg(v0)
2357                 return true
2358         }
2359 }
2360 func rewriteValuePPC64_OpLess64U(v *Value) bool {
2361         v_1 := v.Args[1]
2362         v_0 := v.Args[0]
2363         b := v.Block
2364         // match: (Less64U x y)
2365         // result: (LessThan (CMPU x y))
2366         for {
2367                 x := v_0
2368                 y := v_1
2369                 v.reset(OpPPC64LessThan)
2370                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2371                 v0.AddArg2(x, y)
2372                 v.AddArg(v0)
2373                 return true
2374         }
2375 }
2376 func rewriteValuePPC64_OpLess8(v *Value) bool {
2377         v_1 := v.Args[1]
2378         v_0 := v.Args[0]
2379         b := v.Block
2380         typ := &b.Func.Config.Types
2381         // match: (Less8 x y)
2382         // result: (LessThan (CMPW (SignExt8to32 x) (SignExt8to32 y)))
2383         for {
2384                 x := v_0
2385                 y := v_1
2386                 v.reset(OpPPC64LessThan)
2387                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2388                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2389                 v1.AddArg(x)
2390                 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2391                 v2.AddArg(y)
2392                 v0.AddArg2(v1, v2)
2393                 v.AddArg(v0)
2394                 return true
2395         }
2396 }
2397 func rewriteValuePPC64_OpLess8U(v *Value) bool {
2398         v_1 := v.Args[1]
2399         v_0 := v.Args[0]
2400         b := v.Block
2401         typ := &b.Func.Config.Types
2402         // match: (Less8U x y)
2403         // result: (LessThan (CMPWU (ZeroExt8to32 x) (ZeroExt8to32 y)))
2404         for {
2405                 x := v_0
2406                 y := v_1
2407                 v.reset(OpPPC64LessThan)
2408                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2409                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2410                 v1.AddArg(x)
2411                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2412                 v2.AddArg(y)
2413                 v0.AddArg2(v1, v2)
2414                 v.AddArg(v0)
2415                 return true
2416         }
2417 }
2418 func rewriteValuePPC64_OpLoad(v *Value) bool {
2419         v_1 := v.Args[1]
2420         v_0 := v.Args[0]
2421         b := v.Block
2422         typ := &b.Func.Config.Types
2423         // match: (Load <t> ptr mem)
2424         // cond: (is64BitInt(t) || isPtr(t))
2425         // result: (MOVDload ptr mem)
2426         for {
2427                 t := v.Type
2428                 ptr := v_0
2429                 mem := v_1
2430                 if !(is64BitInt(t) || isPtr(t)) {
2431                         break
2432                 }
2433                 v.reset(OpPPC64MOVDload)
2434                 v.AddArg2(ptr, mem)
2435                 return true
2436         }
2437         // match: (Load <t> ptr mem)
2438         // cond: is32BitInt(t) && t.IsSigned()
2439         // result: (MOVWload ptr mem)
2440         for {
2441                 t := v.Type
2442                 ptr := v_0
2443                 mem := v_1
2444                 if !(is32BitInt(t) && t.IsSigned()) {
2445                         break
2446                 }
2447                 v.reset(OpPPC64MOVWload)
2448                 v.AddArg2(ptr, mem)
2449                 return true
2450         }
2451         // match: (Load <t> ptr mem)
2452         // cond: is32BitInt(t) && !t.IsSigned()
2453         // result: (MOVWZload ptr mem)
2454         for {
2455                 t := v.Type
2456                 ptr := v_0
2457                 mem := v_1
2458                 if !(is32BitInt(t) && !t.IsSigned()) {
2459                         break
2460                 }
2461                 v.reset(OpPPC64MOVWZload)
2462                 v.AddArg2(ptr, mem)
2463                 return true
2464         }
2465         // match: (Load <t> ptr mem)
2466         // cond: is16BitInt(t) && t.IsSigned()
2467         // result: (MOVHload ptr mem)
2468         for {
2469                 t := v.Type
2470                 ptr := v_0
2471                 mem := v_1
2472                 if !(is16BitInt(t) && t.IsSigned()) {
2473                         break
2474                 }
2475                 v.reset(OpPPC64MOVHload)
2476                 v.AddArg2(ptr, mem)
2477                 return true
2478         }
2479         // match: (Load <t> ptr mem)
2480         // cond: is16BitInt(t) && !t.IsSigned()
2481         // result: (MOVHZload ptr mem)
2482         for {
2483                 t := v.Type
2484                 ptr := v_0
2485                 mem := v_1
2486                 if !(is16BitInt(t) && !t.IsSigned()) {
2487                         break
2488                 }
2489                 v.reset(OpPPC64MOVHZload)
2490                 v.AddArg2(ptr, mem)
2491                 return true
2492         }
2493         // match: (Load <t> ptr mem)
2494         // cond: t.IsBoolean()
2495         // result: (MOVBZload ptr mem)
2496         for {
2497                 t := v.Type
2498                 ptr := v_0
2499                 mem := v_1
2500                 if !(t.IsBoolean()) {
2501                         break
2502                 }
2503                 v.reset(OpPPC64MOVBZload)
2504                 v.AddArg2(ptr, mem)
2505                 return true
2506         }
2507         // match: (Load <t> ptr mem)
2508         // cond: is8BitInt(t) && t.IsSigned()
2509         // result: (MOVBreg (MOVBZload ptr mem))
2510         for {
2511                 t := v.Type
2512                 ptr := v_0
2513                 mem := v_1
2514                 if !(is8BitInt(t) && t.IsSigned()) {
2515                         break
2516                 }
2517                 v.reset(OpPPC64MOVBreg)
2518                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
2519                 v0.AddArg2(ptr, mem)
2520                 v.AddArg(v0)
2521                 return true
2522         }
2523         // match: (Load <t> ptr mem)
2524         // cond: is8BitInt(t) && !t.IsSigned()
2525         // result: (MOVBZload ptr mem)
2526         for {
2527                 t := v.Type
2528                 ptr := v_0
2529                 mem := v_1
2530                 if !(is8BitInt(t) && !t.IsSigned()) {
2531                         break
2532                 }
2533                 v.reset(OpPPC64MOVBZload)
2534                 v.AddArg2(ptr, mem)
2535                 return true
2536         }
2537         // match: (Load <t> ptr mem)
2538         // cond: is32BitFloat(t)
2539         // result: (FMOVSload ptr mem)
2540         for {
2541                 t := v.Type
2542                 ptr := v_0
2543                 mem := v_1
2544                 if !(is32BitFloat(t)) {
2545                         break
2546                 }
2547                 v.reset(OpPPC64FMOVSload)
2548                 v.AddArg2(ptr, mem)
2549                 return true
2550         }
2551         // match: (Load <t> ptr mem)
2552         // cond: is64BitFloat(t)
2553         // result: (FMOVDload ptr mem)
2554         for {
2555                 t := v.Type
2556                 ptr := v_0
2557                 mem := v_1
2558                 if !(is64BitFloat(t)) {
2559                         break
2560                 }
2561                 v.reset(OpPPC64FMOVDload)
2562                 v.AddArg2(ptr, mem)
2563                 return true
2564         }
2565         return false
2566 }
2567 func rewriteValuePPC64_OpLocalAddr(v *Value) bool {
2568         v_1 := v.Args[1]
2569         v_0 := v.Args[0]
2570         b := v.Block
2571         typ := &b.Func.Config.Types
2572         // match: (LocalAddr <t> {sym} base mem)
2573         // cond: t.Elem().HasPointers()
2574         // result: (MOVDaddr {sym} (SPanchored base mem))
2575         for {
2576                 t := v.Type
2577                 sym := auxToSym(v.Aux)
2578                 base := v_0
2579                 mem := v_1
2580                 if !(t.Elem().HasPointers()) {
2581                         break
2582                 }
2583                 v.reset(OpPPC64MOVDaddr)
2584                 v.Aux = symToAux(sym)
2585                 v0 := b.NewValue0(v.Pos, OpSPanchored, typ.Uintptr)
2586                 v0.AddArg2(base, mem)
2587                 v.AddArg(v0)
2588                 return true
2589         }
2590         // match: (LocalAddr <t> {sym} base _)
2591         // cond: !t.Elem().HasPointers()
2592         // result: (MOVDaddr {sym} base)
2593         for {
2594                 t := v.Type
2595                 sym := auxToSym(v.Aux)
2596                 base := v_0
2597                 if !(!t.Elem().HasPointers()) {
2598                         break
2599                 }
2600                 v.reset(OpPPC64MOVDaddr)
2601                 v.Aux = symToAux(sym)
2602                 v.AddArg(base)
2603                 return true
2604         }
2605         return false
2606 }
2607 func rewriteValuePPC64_OpLsh16x16(v *Value) bool {
2608         v_1 := v.Args[1]
2609         v_0 := v.Args[0]
2610         b := v.Block
2611         typ := &b.Func.Config.Types
2612         // match: (Lsh16x16 x y)
2613         // cond: shiftIsBounded(v)
2614         // result: (SLD x y)
2615         for {
2616                 x := v_0
2617                 y := v_1
2618                 if !(shiftIsBounded(v)) {
2619                         break
2620                 }
2621                 v.reset(OpPPC64SLD)
2622                 v.AddArg2(x, y)
2623                 return true
2624         }
2625         // match: (Lsh16x16 <t> x y)
2626         // result: (ISEL [2] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y)))
2627         for {
2628                 t := v.Type
2629                 x := v_0
2630                 y := v_1
2631                 v.reset(OpPPC64ISEL)
2632                 v.AuxInt = int32ToAuxInt(2)
2633                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2634                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
2635                 v1.AddArg(x)
2636                 v0.AddArg2(v1, y)
2637                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2638                 v2.AuxInt = int64ToAuxInt(0)
2639                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2640                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2641                 v4.AuxInt = int64ToAuxInt(0xFFF0)
2642                 v4.AddArg(y)
2643                 v3.AddArg(v4)
2644                 v.AddArg3(v0, v2, v3)
2645                 return true
2646         }
2647 }
2648 func rewriteValuePPC64_OpLsh16x32(v *Value) bool {
2649         v_1 := v.Args[1]
2650         v_0 := v.Args[0]
2651         b := v.Block
2652         typ := &b.Func.Config.Types
2653         // match: (Lsh16x32 x y)
2654         // cond: shiftIsBounded(v)
2655         // result: (SLD x y)
2656         for {
2657                 x := v_0
2658                 y := v_1
2659                 if !(shiftIsBounded(v)) {
2660                         break
2661                 }
2662                 v.reset(OpPPC64SLD)
2663                 v.AddArg2(x, y)
2664                 return true
2665         }
2666         // match: (Lsh16x32 <t> x y)
2667         // result: (ISEL [0] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [16]))
2668         for {
2669                 t := v.Type
2670                 x := v_0
2671                 y := v_1
2672                 v.reset(OpPPC64ISEL)
2673                 v.AuxInt = int32ToAuxInt(0)
2674                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2675                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
2676                 v1.AddArg(x)
2677                 v0.AddArg2(v1, y)
2678                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2679                 v2.AuxInt = int64ToAuxInt(0)
2680                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
2681                 v3.AuxInt = int32ToAuxInt(16)
2682                 v3.AddArg(y)
2683                 v.AddArg3(v0, v2, v3)
2684                 return true
2685         }
2686 }
2687 func rewriteValuePPC64_OpLsh16x64(v *Value) bool {
2688         v_1 := v.Args[1]
2689         v_0 := v.Args[0]
2690         b := v.Block
2691         typ := &b.Func.Config.Types
2692         // match: (Lsh16x64 x (MOVDconst [c]))
2693         // cond: uint64(c) < 16
2694         // result: (SLWconst x [c])
2695         for {
2696                 x := v_0
2697                 if v_1.Op != OpPPC64MOVDconst {
2698                         break
2699                 }
2700                 c := auxIntToInt64(v_1.AuxInt)
2701                 if !(uint64(c) < 16) {
2702                         break
2703                 }
2704                 v.reset(OpPPC64SLWconst)
2705                 v.AuxInt = int64ToAuxInt(c)
2706                 v.AddArg(x)
2707                 return true
2708         }
2709         // match: (Lsh16x64 x y)
2710         // cond: shiftIsBounded(v)
2711         // result: (SLD x y)
2712         for {
2713                 x := v_0
2714                 y := v_1
2715                 if !(shiftIsBounded(v)) {
2716                         break
2717                 }
2718                 v.reset(OpPPC64SLD)
2719                 v.AddArg2(x, y)
2720                 return true
2721         }
2722         // match: (Lsh16x64 <t> x y)
2723         // result: (ISEL [0] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [16]))
2724         for {
2725                 t := v.Type
2726                 x := v_0
2727                 y := v_1
2728                 v.reset(OpPPC64ISEL)
2729                 v.AuxInt = int32ToAuxInt(0)
2730                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2731                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
2732                 v1.AddArg(x)
2733                 v0.AddArg2(v1, y)
2734                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2735                 v2.AuxInt = int64ToAuxInt(0)
2736                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
2737                 v3.AuxInt = int64ToAuxInt(16)
2738                 v3.AddArg(y)
2739                 v.AddArg3(v0, v2, v3)
2740                 return true
2741         }
2742 }
2743 func rewriteValuePPC64_OpLsh16x8(v *Value) bool {
2744         v_1 := v.Args[1]
2745         v_0 := v.Args[0]
2746         b := v.Block
2747         typ := &b.Func.Config.Types
2748         // match: (Lsh16x8 x y)
2749         // cond: shiftIsBounded(v)
2750         // result: (SLD x y)
2751         for {
2752                 x := v_0
2753                 y := v_1
2754                 if !(shiftIsBounded(v)) {
2755                         break
2756                 }
2757                 v.reset(OpPPC64SLD)
2758                 v.AddArg2(x, y)
2759                 return true
2760         }
2761         // match: (Lsh16x8 <t> x y)
2762         // result: (ISEL [2] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y)))
2763         for {
2764                 t := v.Type
2765                 x := v_0
2766                 y := v_1
2767                 v.reset(OpPPC64ISEL)
2768                 v.AuxInt = int32ToAuxInt(2)
2769                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2770                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
2771                 v1.AddArg(x)
2772                 v0.AddArg2(v1, y)
2773                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2774                 v2.AuxInt = int64ToAuxInt(0)
2775                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2776                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2777                 v4.AuxInt = int64ToAuxInt(0x00F0)
2778                 v4.AddArg(y)
2779                 v3.AddArg(v4)
2780                 v.AddArg3(v0, v2, v3)
2781                 return true
2782         }
2783 }
2784 func rewriteValuePPC64_OpLsh32x16(v *Value) bool {
2785         v_1 := v.Args[1]
2786         v_0 := v.Args[0]
2787         b := v.Block
2788         typ := &b.Func.Config.Types
2789         // match: (Lsh32x16 x y)
2790         // cond: shiftIsBounded(v)
2791         // result: (SLW x y)
2792         for {
2793                 x := v_0
2794                 y := v_1
2795                 if !(shiftIsBounded(v)) {
2796                         break
2797                 }
2798                 v.reset(OpPPC64SLW)
2799                 v.AddArg2(x, y)
2800                 return true
2801         }
2802         // match: (Lsh32x16 <t> x y)
2803         // result: (ISEL [2] (SLW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y)))
2804         for {
2805                 t := v.Type
2806                 x := v_0
2807                 y := v_1
2808                 v.reset(OpPPC64ISEL)
2809                 v.AuxInt = int32ToAuxInt(2)
2810                 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
2811                 v0.AddArg2(x, y)
2812                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2813                 v1.AuxInt = int64ToAuxInt(0)
2814                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2815                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2816                 v3.AuxInt = int64ToAuxInt(0xFFE0)
2817                 v3.AddArg(y)
2818                 v2.AddArg(v3)
2819                 v.AddArg3(v0, v1, v2)
2820                 return true
2821         }
2822 }
2823 func rewriteValuePPC64_OpLsh32x32(v *Value) bool {
2824         v_1 := v.Args[1]
2825         v_0 := v.Args[0]
2826         b := v.Block
2827         typ := &b.Func.Config.Types
2828         // match: (Lsh32x32 x y)
2829         // cond: shiftIsBounded(v)
2830         // result: (SLW x y)
2831         for {
2832                 x := v_0
2833                 y := v_1
2834                 if !(shiftIsBounded(v)) {
2835                         break
2836                 }
2837                 v.reset(OpPPC64SLW)
2838                 v.AddArg2(x, y)
2839                 return true
2840         }
2841         // match: (Lsh32x32 <t> x y)
2842         // result: (ISEL [0] (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [32]))
2843         for {
2844                 t := v.Type
2845                 x := v_0
2846                 y := v_1
2847                 v.reset(OpPPC64ISEL)
2848                 v.AuxInt = int32ToAuxInt(0)
2849                 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
2850                 v0.AddArg2(x, y)
2851                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2852                 v1.AuxInt = int64ToAuxInt(0)
2853                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
2854                 v2.AuxInt = int32ToAuxInt(32)
2855                 v2.AddArg(y)
2856                 v.AddArg3(v0, v1, v2)
2857                 return true
2858         }
2859 }
2860 func rewriteValuePPC64_OpLsh32x64(v *Value) bool {
2861         v_1 := v.Args[1]
2862         v_0 := v.Args[0]
2863         b := v.Block
2864         typ := &b.Func.Config.Types
2865         // match: (Lsh32x64 x (MOVDconst [c]))
2866         // cond: uint64(c) < 32
2867         // result: (SLWconst x [c])
2868         for {
2869                 x := v_0
2870                 if v_1.Op != OpPPC64MOVDconst {
2871                         break
2872                 }
2873                 c := auxIntToInt64(v_1.AuxInt)
2874                 if !(uint64(c) < 32) {
2875                         break
2876                 }
2877                 v.reset(OpPPC64SLWconst)
2878                 v.AuxInt = int64ToAuxInt(c)
2879                 v.AddArg(x)
2880                 return true
2881         }
2882         // match: (Lsh32x64 x y)
2883         // cond: shiftIsBounded(v)
2884         // result: (SLW x y)
2885         for {
2886                 x := v_0
2887                 y := v_1
2888                 if !(shiftIsBounded(v)) {
2889                         break
2890                 }
2891                 v.reset(OpPPC64SLW)
2892                 v.AddArg2(x, y)
2893                 return true
2894         }
2895         // match: (Lsh32x64 <t> x y)
2896         // result: (ISEL [0] (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [32]))
2897         for {
2898                 t := v.Type
2899                 x := v_0
2900                 y := v_1
2901                 v.reset(OpPPC64ISEL)
2902                 v.AuxInt = int32ToAuxInt(0)
2903                 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
2904                 v0.AddArg2(x, y)
2905                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2906                 v1.AuxInt = int64ToAuxInt(0)
2907                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
2908                 v2.AuxInt = int64ToAuxInt(32)
2909                 v2.AddArg(y)
2910                 v.AddArg3(v0, v1, v2)
2911                 return true
2912         }
2913 }
2914 func rewriteValuePPC64_OpLsh32x8(v *Value) bool {
2915         v_1 := v.Args[1]
2916         v_0 := v.Args[0]
2917         b := v.Block
2918         typ := &b.Func.Config.Types
2919         // match: (Lsh32x8 x y)
2920         // cond: shiftIsBounded(v)
2921         // result: (SLW x y)
2922         for {
2923                 x := v_0
2924                 y := v_1
2925                 if !(shiftIsBounded(v)) {
2926                         break
2927                 }
2928                 v.reset(OpPPC64SLW)
2929                 v.AddArg2(x, y)
2930                 return true
2931         }
2932         // match: (Lsh32x8 <t> x y)
2933         // result: (ISEL [2] (SLW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y)))
2934         for {
2935                 t := v.Type
2936                 x := v_0
2937                 y := v_1
2938                 v.reset(OpPPC64ISEL)
2939                 v.AuxInt = int32ToAuxInt(2)
2940                 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
2941                 v0.AddArg2(x, y)
2942                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2943                 v1.AuxInt = int64ToAuxInt(0)
2944                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2945                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2946                 v3.AuxInt = int64ToAuxInt(0x00E0)
2947                 v3.AddArg(y)
2948                 v2.AddArg(v3)
2949                 v.AddArg3(v0, v1, v2)
2950                 return true
2951         }
2952 }
2953 func rewriteValuePPC64_OpLsh64x16(v *Value) bool {
2954         v_1 := v.Args[1]
2955         v_0 := v.Args[0]
2956         b := v.Block
2957         typ := &b.Func.Config.Types
2958         // match: (Lsh64x16 x y)
2959         // cond: shiftIsBounded(v)
2960         // result: (SLD x y)
2961         for {
2962                 x := v_0
2963                 y := v_1
2964                 if !(shiftIsBounded(v)) {
2965                         break
2966                 }
2967                 v.reset(OpPPC64SLD)
2968                 v.AddArg2(x, y)
2969                 return true
2970         }
2971         // match: (Lsh64x16 <t> x y)
2972         // result: (ISEL [2] (SLD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y)))
2973         for {
2974                 t := v.Type
2975                 x := v_0
2976                 y := v_1
2977                 v.reset(OpPPC64ISEL)
2978                 v.AuxInt = int32ToAuxInt(2)
2979                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
2980                 v0.AddArg2(x, y)
2981                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
2982                 v1.AuxInt = int64ToAuxInt(0)
2983                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
2984                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
2985                 v3.AuxInt = int64ToAuxInt(0xFFC0)
2986                 v3.AddArg(y)
2987                 v2.AddArg(v3)
2988                 v.AddArg3(v0, v1, v2)
2989                 return true
2990         }
2991 }
2992 func rewriteValuePPC64_OpLsh64x32(v *Value) bool {
2993         v_1 := v.Args[1]
2994         v_0 := v.Args[0]
2995         b := v.Block
2996         typ := &b.Func.Config.Types
2997         // match: (Lsh64x32 x y)
2998         // cond: shiftIsBounded(v)
2999         // result: (SLD x y)
3000         for {
3001                 x := v_0
3002                 y := v_1
3003                 if !(shiftIsBounded(v)) {
3004                         break
3005                 }
3006                 v.reset(OpPPC64SLD)
3007                 v.AddArg2(x, y)
3008                 return true
3009         }
3010         // match: (Lsh64x32 <t> x y)
3011         // result: (ISEL [0] (SLD <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
3012         for {
3013                 t := v.Type
3014                 x := v_0
3015                 y := v_1
3016                 v.reset(OpPPC64ISEL)
3017                 v.AuxInt = int32ToAuxInt(0)
3018                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3019                 v0.AddArg2(x, y)
3020                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3021                 v1.AuxInt = int64ToAuxInt(0)
3022                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
3023                 v2.AuxInt = int32ToAuxInt(64)
3024                 v2.AddArg(y)
3025                 v.AddArg3(v0, v1, v2)
3026                 return true
3027         }
3028 }
3029 func rewriteValuePPC64_OpLsh64x64(v *Value) bool {
3030         v_1 := v.Args[1]
3031         v_0 := v.Args[0]
3032         b := v.Block
3033         typ := &b.Func.Config.Types
3034         // match: (Lsh64x64 x (MOVDconst [c]))
3035         // cond: uint64(c) < 64
3036         // result: (SLDconst x [c])
3037         for {
3038                 x := v_0
3039                 if v_1.Op != OpPPC64MOVDconst {
3040                         break
3041                 }
3042                 c := auxIntToInt64(v_1.AuxInt)
3043                 if !(uint64(c) < 64) {
3044                         break
3045                 }
3046                 v.reset(OpPPC64SLDconst)
3047                 v.AuxInt = int64ToAuxInt(c)
3048                 v.AddArg(x)
3049                 return true
3050         }
3051         // match: (Lsh64x64 x y)
3052         // cond: shiftIsBounded(v)
3053         // result: (SLD x y)
3054         for {
3055                 x := v_0
3056                 y := v_1
3057                 if !(shiftIsBounded(v)) {
3058                         break
3059                 }
3060                 v.reset(OpPPC64SLD)
3061                 v.AddArg2(x, y)
3062                 return true
3063         }
3064         // match: (Lsh64x64 <t> x y)
3065         // result: (ISEL [0] (SLD <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
3066         for {
3067                 t := v.Type
3068                 x := v_0
3069                 y := v_1
3070                 v.reset(OpPPC64ISEL)
3071                 v.AuxInt = int32ToAuxInt(0)
3072                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3073                 v0.AddArg2(x, y)
3074                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3075                 v1.AuxInt = int64ToAuxInt(0)
3076                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
3077                 v2.AuxInt = int64ToAuxInt(64)
3078                 v2.AddArg(y)
3079                 v.AddArg3(v0, v1, v2)
3080                 return true
3081         }
3082 }
3083 func rewriteValuePPC64_OpLsh64x8(v *Value) bool {
3084         v_1 := v.Args[1]
3085         v_0 := v.Args[0]
3086         b := v.Block
3087         typ := &b.Func.Config.Types
3088         // match: (Lsh64x8 x y)
3089         // cond: shiftIsBounded(v)
3090         // result: (SLD x y)
3091         for {
3092                 x := v_0
3093                 y := v_1
3094                 if !(shiftIsBounded(v)) {
3095                         break
3096                 }
3097                 v.reset(OpPPC64SLD)
3098                 v.AddArg2(x, y)
3099                 return true
3100         }
3101         // match: (Lsh64x8 <t> x y)
3102         // result: (ISEL [2] (SLD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y)))
3103         for {
3104                 t := v.Type
3105                 x := v_0
3106                 y := v_1
3107                 v.reset(OpPPC64ISEL)
3108                 v.AuxInt = int32ToAuxInt(2)
3109                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3110                 v0.AddArg2(x, y)
3111                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3112                 v1.AuxInt = int64ToAuxInt(0)
3113                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
3114                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
3115                 v3.AuxInt = int64ToAuxInt(0x00C0)
3116                 v3.AddArg(y)
3117                 v2.AddArg(v3)
3118                 v.AddArg3(v0, v1, v2)
3119                 return true
3120         }
3121 }
3122 func rewriteValuePPC64_OpLsh8x16(v *Value) bool {
3123         v_1 := v.Args[1]
3124         v_0 := v.Args[0]
3125         b := v.Block
3126         typ := &b.Func.Config.Types
3127         // match: (Lsh8x16 x y)
3128         // cond: shiftIsBounded(v)
3129         // result: (SLD x y)
3130         for {
3131                 x := v_0
3132                 y := v_1
3133                 if !(shiftIsBounded(v)) {
3134                         break
3135                 }
3136                 v.reset(OpPPC64SLD)
3137                 v.AddArg2(x, y)
3138                 return true
3139         }
3140         // match: (Lsh8x16 <t> x y)
3141         // result: (ISEL [2] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y)))
3142         for {
3143                 t := v.Type
3144                 x := v_0
3145                 y := v_1
3146                 v.reset(OpPPC64ISEL)
3147                 v.AuxInt = int32ToAuxInt(2)
3148                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3149                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
3150                 v1.AddArg(x)
3151                 v0.AddArg2(v1, y)
3152                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3153                 v2.AuxInt = int64ToAuxInt(0)
3154                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
3155                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
3156                 v4.AuxInt = int64ToAuxInt(0xFFF8)
3157                 v4.AddArg(y)
3158                 v3.AddArg(v4)
3159                 v.AddArg3(v0, v2, v3)
3160                 return true
3161         }
3162 }
3163 func rewriteValuePPC64_OpLsh8x32(v *Value) bool {
3164         v_1 := v.Args[1]
3165         v_0 := v.Args[0]
3166         b := v.Block
3167         typ := &b.Func.Config.Types
3168         // match: (Lsh8x32 x y)
3169         // cond: shiftIsBounded(v)
3170         // result: (SLD x y)
3171         for {
3172                 x := v_0
3173                 y := v_1
3174                 if !(shiftIsBounded(v)) {
3175                         break
3176                 }
3177                 v.reset(OpPPC64SLD)
3178                 v.AddArg2(x, y)
3179                 return true
3180         }
3181         // match: (Lsh8x32 <t> x y)
3182         // result: (ISEL [0] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [8]))
3183         for {
3184                 t := v.Type
3185                 x := v_0
3186                 y := v_1
3187                 v.reset(OpPPC64ISEL)
3188                 v.AuxInt = int32ToAuxInt(0)
3189                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3190                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
3191                 v1.AddArg(x)
3192                 v0.AddArg2(v1, y)
3193                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3194                 v2.AuxInt = int64ToAuxInt(0)
3195                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
3196                 v3.AuxInt = int32ToAuxInt(8)
3197                 v3.AddArg(y)
3198                 v.AddArg3(v0, v2, v3)
3199                 return true
3200         }
3201 }
3202 func rewriteValuePPC64_OpLsh8x64(v *Value) bool {
3203         v_1 := v.Args[1]
3204         v_0 := v.Args[0]
3205         b := v.Block
3206         typ := &b.Func.Config.Types
3207         // match: (Lsh8x64 x (MOVDconst [c]))
3208         // cond: uint64(c) < 8
3209         // result: (SLWconst x [c])
3210         for {
3211                 x := v_0
3212                 if v_1.Op != OpPPC64MOVDconst {
3213                         break
3214                 }
3215                 c := auxIntToInt64(v_1.AuxInt)
3216                 if !(uint64(c) < 8) {
3217                         break
3218                 }
3219                 v.reset(OpPPC64SLWconst)
3220                 v.AuxInt = int64ToAuxInt(c)
3221                 v.AddArg(x)
3222                 return true
3223         }
3224         // match: (Lsh8x64 x y)
3225         // cond: shiftIsBounded(v)
3226         // result: (SLD x y)
3227         for {
3228                 x := v_0
3229                 y := v_1
3230                 if !(shiftIsBounded(v)) {
3231                         break
3232                 }
3233                 v.reset(OpPPC64SLD)
3234                 v.AddArg2(x, y)
3235                 return true
3236         }
3237         // match: (Lsh8x64 <t> x y)
3238         // result: (ISEL [0] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [8]))
3239         for {
3240                 t := v.Type
3241                 x := v_0
3242                 y := v_1
3243                 v.reset(OpPPC64ISEL)
3244                 v.AuxInt = int32ToAuxInt(0)
3245                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3246                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
3247                 v1.AddArg(x)
3248                 v0.AddArg2(v1, y)
3249                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3250                 v2.AuxInt = int64ToAuxInt(0)
3251                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
3252                 v3.AuxInt = int64ToAuxInt(8)
3253                 v3.AddArg(y)
3254                 v.AddArg3(v0, v2, v3)
3255                 return true
3256         }
3257 }
3258 func rewriteValuePPC64_OpLsh8x8(v *Value) bool {
3259         v_1 := v.Args[1]
3260         v_0 := v.Args[0]
3261         b := v.Block
3262         typ := &b.Func.Config.Types
3263         // match: (Lsh8x8 x y)
3264         // cond: shiftIsBounded(v)
3265         // result: (SLD x y)
3266         for {
3267                 x := v_0
3268                 y := v_1
3269                 if !(shiftIsBounded(v)) {
3270                         break
3271                 }
3272                 v.reset(OpPPC64SLD)
3273                 v.AddArg2(x, y)
3274                 return true
3275         }
3276         // match: (Lsh8x8 <t> x y)
3277         // result: (ISEL [2] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y)))
3278         for {
3279                 t := v.Type
3280                 x := v_0
3281                 y := v_1
3282                 v.reset(OpPPC64ISEL)
3283                 v.AuxInt = int32ToAuxInt(2)
3284                 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
3285                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
3286                 v1.AddArg(x)
3287                 v0.AddArg2(v1, y)
3288                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3289                 v2.AuxInt = int64ToAuxInt(0)
3290                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
3291                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
3292                 v4.AuxInt = int64ToAuxInt(0x00F8)
3293                 v4.AddArg(y)
3294                 v3.AddArg(v4)
3295                 v.AddArg3(v0, v2, v3)
3296                 return true
3297         }
3298 }
3299 func rewriteValuePPC64_OpMod16(v *Value) bool {
3300         v_1 := v.Args[1]
3301         v_0 := v.Args[0]
3302         b := v.Block
3303         typ := &b.Func.Config.Types
3304         // match: (Mod16 x y)
3305         // result: (Mod32 (SignExt16to32 x) (SignExt16to32 y))
3306         for {
3307                 x := v_0
3308                 y := v_1
3309                 v.reset(OpMod32)
3310                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3311                 v0.AddArg(x)
3312                 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3313                 v1.AddArg(y)
3314                 v.AddArg2(v0, v1)
3315                 return true
3316         }
3317 }
3318 func rewriteValuePPC64_OpMod16u(v *Value) bool {
3319         v_1 := v.Args[1]
3320         v_0 := v.Args[0]
3321         b := v.Block
3322         typ := &b.Func.Config.Types
3323         // match: (Mod16u x y)
3324         // result: (Mod32u (ZeroExt16to32 x) (ZeroExt16to32 y))
3325         for {
3326                 x := v_0
3327                 y := v_1
3328                 v.reset(OpMod32u)
3329                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3330                 v0.AddArg(x)
3331                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3332                 v1.AddArg(y)
3333                 v.AddArg2(v0, v1)
3334                 return true
3335         }
3336 }
3337 func rewriteValuePPC64_OpMod32(v *Value) bool {
3338         v_1 := v.Args[1]
3339         v_0 := v.Args[0]
3340         b := v.Block
3341         typ := &b.Func.Config.Types
3342         // match: (Mod32 x y)
3343         // cond: buildcfg.GOPPC64 >= 9
3344         // result: (MODSW x y)
3345         for {
3346                 x := v_0
3347                 y := v_1
3348                 if !(buildcfg.GOPPC64 >= 9) {
3349                         break
3350                 }
3351                 v.reset(OpPPC64MODSW)
3352                 v.AddArg2(x, y)
3353                 return true
3354         }
3355         // match: (Mod32 x y)
3356         // cond: buildcfg.GOPPC64 <= 8
3357         // result: (SUB x (MULLW y (DIVW x y)))
3358         for {
3359                 x := v_0
3360                 y := v_1
3361                 if !(buildcfg.GOPPC64 <= 8) {
3362                         break
3363                 }
3364                 v.reset(OpPPC64SUB)
3365                 v0 := b.NewValue0(v.Pos, OpPPC64MULLW, typ.Int32)
3366                 v1 := b.NewValue0(v.Pos, OpPPC64DIVW, typ.Int32)
3367                 v1.AddArg2(x, y)
3368                 v0.AddArg2(y, v1)
3369                 v.AddArg2(x, v0)
3370                 return true
3371         }
3372         return false
3373 }
3374 func rewriteValuePPC64_OpMod32u(v *Value) bool {
3375         v_1 := v.Args[1]
3376         v_0 := v.Args[0]
3377         b := v.Block
3378         typ := &b.Func.Config.Types
3379         // match: (Mod32u x y)
3380         // cond: buildcfg.GOPPC64 >= 9
3381         // result: (MODUW x y)
3382         for {
3383                 x := v_0
3384                 y := v_1
3385                 if !(buildcfg.GOPPC64 >= 9) {
3386                         break
3387                 }
3388                 v.reset(OpPPC64MODUW)
3389                 v.AddArg2(x, y)
3390                 return true
3391         }
3392         // match: (Mod32u x y)
3393         // cond: buildcfg.GOPPC64 <= 8
3394         // result: (SUB x (MULLW y (DIVWU x y)))
3395         for {
3396                 x := v_0
3397                 y := v_1
3398                 if !(buildcfg.GOPPC64 <= 8) {
3399                         break
3400                 }
3401                 v.reset(OpPPC64SUB)
3402                 v0 := b.NewValue0(v.Pos, OpPPC64MULLW, typ.Int32)
3403                 v1 := b.NewValue0(v.Pos, OpPPC64DIVWU, typ.Int32)
3404                 v1.AddArg2(x, y)
3405                 v0.AddArg2(y, v1)
3406                 v.AddArg2(x, v0)
3407                 return true
3408         }
3409         return false
3410 }
3411 func rewriteValuePPC64_OpMod64(v *Value) bool {
3412         v_1 := v.Args[1]
3413         v_0 := v.Args[0]
3414         b := v.Block
3415         typ := &b.Func.Config.Types
3416         // match: (Mod64 x y)
3417         // cond: buildcfg.GOPPC64 >=9
3418         // result: (MODSD x y)
3419         for {
3420                 x := v_0
3421                 y := v_1
3422                 if !(buildcfg.GOPPC64 >= 9) {
3423                         break
3424                 }
3425                 v.reset(OpPPC64MODSD)
3426                 v.AddArg2(x, y)
3427                 return true
3428         }
3429         // match: (Mod64 x y)
3430         // cond: buildcfg.GOPPC64 <=8
3431         // result: (SUB x (MULLD y (DIVD x y)))
3432         for {
3433                 x := v_0
3434                 y := v_1
3435                 if !(buildcfg.GOPPC64 <= 8) {
3436                         break
3437                 }
3438                 v.reset(OpPPC64SUB)
3439                 v0 := b.NewValue0(v.Pos, OpPPC64MULLD, typ.Int64)
3440                 v1 := b.NewValue0(v.Pos, OpPPC64DIVD, typ.Int64)
3441                 v1.AddArg2(x, y)
3442                 v0.AddArg2(y, v1)
3443                 v.AddArg2(x, v0)
3444                 return true
3445         }
3446         return false
3447 }
3448 func rewriteValuePPC64_OpMod64u(v *Value) bool {
3449         v_1 := v.Args[1]
3450         v_0 := v.Args[0]
3451         b := v.Block
3452         typ := &b.Func.Config.Types
3453         // match: (Mod64u x y)
3454         // cond: buildcfg.GOPPC64 >= 9
3455         // result: (MODUD x y)
3456         for {
3457                 x := v_0
3458                 y := v_1
3459                 if !(buildcfg.GOPPC64 >= 9) {
3460                         break
3461                 }
3462                 v.reset(OpPPC64MODUD)
3463                 v.AddArg2(x, y)
3464                 return true
3465         }
3466         // match: (Mod64u x y)
3467         // cond: buildcfg.GOPPC64 <= 8
3468         // result: (SUB x (MULLD y (DIVDU x y)))
3469         for {
3470                 x := v_0
3471                 y := v_1
3472                 if !(buildcfg.GOPPC64 <= 8) {
3473                         break
3474                 }
3475                 v.reset(OpPPC64SUB)
3476                 v0 := b.NewValue0(v.Pos, OpPPC64MULLD, typ.Int64)
3477                 v1 := b.NewValue0(v.Pos, OpPPC64DIVDU, typ.Int64)
3478                 v1.AddArg2(x, y)
3479                 v0.AddArg2(y, v1)
3480                 v.AddArg2(x, v0)
3481                 return true
3482         }
3483         return false
3484 }
3485 func rewriteValuePPC64_OpMod8(v *Value) bool {
3486         v_1 := v.Args[1]
3487         v_0 := v.Args[0]
3488         b := v.Block
3489         typ := &b.Func.Config.Types
3490         // match: (Mod8 x y)
3491         // result: (Mod32 (SignExt8to32 x) (SignExt8to32 y))
3492         for {
3493                 x := v_0
3494                 y := v_1
3495                 v.reset(OpMod32)
3496                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3497                 v0.AddArg(x)
3498                 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3499                 v1.AddArg(y)
3500                 v.AddArg2(v0, v1)
3501                 return true
3502         }
3503 }
3504 func rewriteValuePPC64_OpMod8u(v *Value) bool {
3505         v_1 := v.Args[1]
3506         v_0 := v.Args[0]
3507         b := v.Block
3508         typ := &b.Func.Config.Types
3509         // match: (Mod8u x y)
3510         // result: (Mod32u (ZeroExt8to32 x) (ZeroExt8to32 y))
3511         for {
3512                 x := v_0
3513                 y := v_1
3514                 v.reset(OpMod32u)
3515                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3516                 v0.AddArg(x)
3517                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3518                 v1.AddArg(y)
3519                 v.AddArg2(v0, v1)
3520                 return true
3521         }
3522 }
3523 func rewriteValuePPC64_OpMove(v *Value) bool {
3524         v_2 := v.Args[2]
3525         v_1 := v.Args[1]
3526         v_0 := v.Args[0]
3527         b := v.Block
3528         typ := &b.Func.Config.Types
3529         // match: (Move [0] _ _ mem)
3530         // result: mem
3531         for {
3532                 if auxIntToInt64(v.AuxInt) != 0 {
3533                         break
3534                 }
3535                 mem := v_2
3536                 v.copyOf(mem)
3537                 return true
3538         }
3539         // match: (Move [1] dst src mem)
3540         // result: (MOVBstore dst (MOVBZload src mem) mem)
3541         for {
3542                 if auxIntToInt64(v.AuxInt) != 1 {
3543                         break
3544                 }
3545                 dst := v_0
3546                 src := v_1
3547                 mem := v_2
3548                 v.reset(OpPPC64MOVBstore)
3549                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3550                 v0.AddArg2(src, mem)
3551                 v.AddArg3(dst, v0, mem)
3552                 return true
3553         }
3554         // match: (Move [2] dst src mem)
3555         // result: (MOVHstore dst (MOVHZload src mem) mem)
3556         for {
3557                 if auxIntToInt64(v.AuxInt) != 2 {
3558                         break
3559                 }
3560                 dst := v_0
3561                 src := v_1
3562                 mem := v_2
3563                 v.reset(OpPPC64MOVHstore)
3564                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16)
3565                 v0.AddArg2(src, mem)
3566                 v.AddArg3(dst, v0, mem)
3567                 return true
3568         }
3569         // match: (Move [4] dst src mem)
3570         // result: (MOVWstore dst (MOVWZload src mem) mem)
3571         for {
3572                 if auxIntToInt64(v.AuxInt) != 4 {
3573                         break
3574                 }
3575                 dst := v_0
3576                 src := v_1
3577                 mem := v_2
3578                 v.reset(OpPPC64MOVWstore)
3579                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3580                 v0.AddArg2(src, mem)
3581                 v.AddArg3(dst, v0, mem)
3582                 return true
3583         }
3584         // match: (Move [8] {t} dst src mem)
3585         // result: (MOVDstore dst (MOVDload src mem) mem)
3586         for {
3587                 if auxIntToInt64(v.AuxInt) != 8 {
3588                         break
3589                 }
3590                 dst := v_0
3591                 src := v_1
3592                 mem := v_2
3593                 v.reset(OpPPC64MOVDstore)
3594                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, typ.Int64)
3595                 v0.AddArg2(src, mem)
3596                 v.AddArg3(dst, v0, mem)
3597                 return true
3598         }
3599         // match: (Move [3] dst src mem)
3600         // result: (MOVBstore [2] dst (MOVBZload [2] src mem) (MOVHstore dst (MOVHload src mem) mem))
3601         for {
3602                 if auxIntToInt64(v.AuxInt) != 3 {
3603                         break
3604                 }
3605                 dst := v_0
3606                 src := v_1
3607                 mem := v_2
3608                 v.reset(OpPPC64MOVBstore)
3609                 v.AuxInt = int32ToAuxInt(2)
3610                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3611                 v0.AuxInt = int32ToAuxInt(2)
3612                 v0.AddArg2(src, mem)
3613                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHstore, types.TypeMem)
3614                 v2 := b.NewValue0(v.Pos, OpPPC64MOVHload, typ.Int16)
3615                 v2.AddArg2(src, mem)
3616                 v1.AddArg3(dst, v2, mem)
3617                 v.AddArg3(dst, v0, v1)
3618                 return true
3619         }
3620         // match: (Move [5] dst src mem)
3621         // result: (MOVBstore [4] dst (MOVBZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3622         for {
3623                 if auxIntToInt64(v.AuxInt) != 5 {
3624                         break
3625                 }
3626                 dst := v_0
3627                 src := v_1
3628                 mem := v_2
3629                 v.reset(OpPPC64MOVBstore)
3630                 v.AuxInt = int32ToAuxInt(4)
3631                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3632                 v0.AuxInt = int32ToAuxInt(4)
3633                 v0.AddArg2(src, mem)
3634                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem)
3635                 v2 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3636                 v2.AddArg2(src, mem)
3637                 v1.AddArg3(dst, v2, mem)
3638                 v.AddArg3(dst, v0, v1)
3639                 return true
3640         }
3641         // match: (Move [6] dst src mem)
3642         // result: (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3643         for {
3644                 if auxIntToInt64(v.AuxInt) != 6 {
3645                         break
3646                 }
3647                 dst := v_0
3648                 src := v_1
3649                 mem := v_2
3650                 v.reset(OpPPC64MOVHstore)
3651                 v.AuxInt = int32ToAuxInt(4)
3652                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16)
3653                 v0.AuxInt = int32ToAuxInt(4)
3654                 v0.AddArg2(src, mem)
3655                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem)
3656                 v2 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3657                 v2.AddArg2(src, mem)
3658                 v1.AddArg3(dst, v2, mem)
3659                 v.AddArg3(dst, v0, v1)
3660                 return true
3661         }
3662         // match: (Move [7] dst src mem)
3663         // result: (MOVBstore [6] dst (MOVBZload [6] src mem) (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem)))
3664         for {
3665                 if auxIntToInt64(v.AuxInt) != 7 {
3666                         break
3667                 }
3668                 dst := v_0
3669                 src := v_1
3670                 mem := v_2
3671                 v.reset(OpPPC64MOVBstore)
3672                 v.AuxInt = int32ToAuxInt(6)
3673                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3674                 v0.AuxInt = int32ToAuxInt(6)
3675                 v0.AddArg2(src, mem)
3676                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHstore, types.TypeMem)
3677                 v1.AuxInt = int32ToAuxInt(4)
3678                 v2 := b.NewValue0(v.Pos, OpPPC64MOVHZload, typ.UInt16)
3679                 v2.AuxInt = int32ToAuxInt(4)
3680                 v2.AddArg2(src, mem)
3681                 v3 := b.NewValue0(v.Pos, OpPPC64MOVWstore, types.TypeMem)
3682                 v4 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3683                 v4.AddArg2(src, mem)
3684                 v3.AddArg3(dst, v4, mem)
3685                 v1.AddArg3(dst, v2, v3)
3686                 v.AddArg3(dst, v0, v1)
3687                 return true
3688         }
3689         // match: (Move [s] dst src mem)
3690         // cond: s > 8 && buildcfg.GOPPC64 <= 8 && logLargeCopy(v, s)
3691         // result: (LoweredMove [s] dst src mem)
3692         for {
3693                 s := auxIntToInt64(v.AuxInt)
3694                 dst := v_0
3695                 src := v_1
3696                 mem := v_2
3697                 if !(s > 8 && buildcfg.GOPPC64 <= 8 && logLargeCopy(v, s)) {
3698                         break
3699                 }
3700                 v.reset(OpPPC64LoweredMove)
3701                 v.AuxInt = int64ToAuxInt(s)
3702                 v.AddArg3(dst, src, mem)
3703                 return true
3704         }
3705         // match: (Move [s] dst src mem)
3706         // cond: s > 8 && s <= 64 && buildcfg.GOPPC64 >= 9
3707         // result: (LoweredQuadMoveShort [s] dst src mem)
3708         for {
3709                 s := auxIntToInt64(v.AuxInt)
3710                 dst := v_0
3711                 src := v_1
3712                 mem := v_2
3713                 if !(s > 8 && s <= 64 && buildcfg.GOPPC64 >= 9) {
3714                         break
3715                 }
3716                 v.reset(OpPPC64LoweredQuadMoveShort)
3717                 v.AuxInt = int64ToAuxInt(s)
3718                 v.AddArg3(dst, src, mem)
3719                 return true
3720         }
3721         // match: (Move [s] dst src mem)
3722         // cond: s > 8 && buildcfg.GOPPC64 >= 9 && logLargeCopy(v, s)
3723         // result: (LoweredQuadMove [s] dst src mem)
3724         for {
3725                 s := auxIntToInt64(v.AuxInt)
3726                 dst := v_0
3727                 src := v_1
3728                 mem := v_2
3729                 if !(s > 8 && buildcfg.GOPPC64 >= 9 && logLargeCopy(v, s)) {
3730                         break
3731                 }
3732                 v.reset(OpPPC64LoweredQuadMove)
3733                 v.AuxInt = int64ToAuxInt(s)
3734                 v.AddArg3(dst, src, mem)
3735                 return true
3736         }
3737         return false
3738 }
3739 func rewriteValuePPC64_OpNeq16(v *Value) bool {
3740         v_1 := v.Args[1]
3741         v_0 := v.Args[0]
3742         b := v.Block
3743         typ := &b.Func.Config.Types
3744         // match: (Neq16 x y)
3745         // cond: x.Type.IsSigned() && y.Type.IsSigned()
3746         // result: (NotEqual (CMPW (SignExt16to32 x) (SignExt16to32 y)))
3747         for {
3748                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3749                         x := v_0
3750                         y := v_1
3751                         if !(x.Type.IsSigned() && y.Type.IsSigned()) {
3752                                 continue
3753                         }
3754                         v.reset(OpPPC64NotEqual)
3755                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3756                         v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3757                         v1.AddArg(x)
3758                         v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3759                         v2.AddArg(y)
3760                         v0.AddArg2(v1, v2)
3761                         v.AddArg(v0)
3762                         return true
3763                 }
3764                 break
3765         }
3766         // match: (Neq16 x y)
3767         // result: (NotEqual (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
3768         for {
3769                 x := v_0
3770                 y := v_1
3771                 v.reset(OpPPC64NotEqual)
3772                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3773                 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3774                 v1.AddArg(x)
3775                 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3776                 v2.AddArg(y)
3777                 v0.AddArg2(v1, v2)
3778                 v.AddArg(v0)
3779                 return true
3780         }
3781 }
3782 func rewriteValuePPC64_OpNeq32(v *Value) bool {
3783         v_1 := v.Args[1]
3784         v_0 := v.Args[0]
3785         b := v.Block
3786         // match: (Neq32 x y)
3787         // result: (NotEqual (CMPW x y))
3788         for {
3789                 x := v_0
3790                 y := v_1
3791                 v.reset(OpPPC64NotEqual)
3792                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3793                 v0.AddArg2(x, y)
3794                 v.AddArg(v0)
3795                 return true
3796         }
3797 }
3798 func rewriteValuePPC64_OpNeq32F(v *Value) bool {
3799         v_1 := v.Args[1]
3800         v_0 := v.Args[0]
3801         b := v.Block
3802         // match: (Neq32F x y)
3803         // result: (NotEqual (FCMPU x y))
3804         for {
3805                 x := v_0
3806                 y := v_1
3807                 v.reset(OpPPC64NotEqual)
3808                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
3809                 v0.AddArg2(x, y)
3810                 v.AddArg(v0)
3811                 return true
3812         }
3813 }
3814 func rewriteValuePPC64_OpNeq64(v *Value) bool {
3815         v_1 := v.Args[1]
3816         v_0 := v.Args[0]
3817         b := v.Block
3818         // match: (Neq64 x y)
3819         // result: (NotEqual (CMP x y))
3820         for {
3821                 x := v_0
3822                 y := v_1
3823                 v.reset(OpPPC64NotEqual)
3824                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
3825                 v0.AddArg2(x, y)
3826                 v.AddArg(v0)
3827                 return true
3828         }
3829 }
3830 func rewriteValuePPC64_OpNeq64F(v *Value) bool {
3831         v_1 := v.Args[1]
3832         v_0 := v.Args[0]
3833         b := v.Block
3834         // match: (Neq64F x y)
3835         // result: (NotEqual (FCMPU x y))
3836         for {
3837                 x := v_0
3838                 y := v_1
3839                 v.reset(OpPPC64NotEqual)
3840                 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
3841                 v0.AddArg2(x, y)
3842                 v.AddArg(v0)
3843                 return true
3844         }
3845 }
3846 func rewriteValuePPC64_OpNeq8(v *Value) bool {
3847         v_1 := v.Args[1]
3848         v_0 := v.Args[0]
3849         b := v.Block
3850         typ := &b.Func.Config.Types
3851         // match: (Neq8 x y)
3852         // cond: x.Type.IsSigned() && y.Type.IsSigned()
3853         // result: (NotEqual (CMPW (SignExt8to32 x) (SignExt8to32 y)))
3854         for {
3855                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3856                         x := v_0
3857                         y := v_1
3858                         if !(x.Type.IsSigned() && y.Type.IsSigned()) {
3859                                 continue
3860                         }
3861                         v.reset(OpPPC64NotEqual)
3862                         v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3863                         v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3864                         v1.AddArg(x)
3865                         v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3866                         v2.AddArg(y)
3867                         v0.AddArg2(v1, v2)
3868                         v.AddArg(v0)
3869                         return true
3870                 }
3871                 break
3872         }
3873         // match: (Neq8 x y)
3874         // result: (NotEqual (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
3875         for {
3876                 x := v_0
3877                 y := v_1
3878                 v.reset(OpPPC64NotEqual)
3879                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3880                 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3881                 v1.AddArg(x)
3882                 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3883                 v2.AddArg(y)
3884                 v0.AddArg2(v1, v2)
3885                 v.AddArg(v0)
3886                 return true
3887         }
3888 }
3889 func rewriteValuePPC64_OpNeqPtr(v *Value) bool {
3890         v_1 := v.Args[1]
3891         v_0 := v.Args[0]
3892         b := v.Block
3893         // match: (NeqPtr x y)
3894         // result: (NotEqual (CMP x y))
3895         for {
3896                 x := v_0
3897                 y := v_1
3898                 v.reset(OpPPC64NotEqual)
3899                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
3900                 v0.AddArg2(x, y)
3901                 v.AddArg(v0)
3902                 return true
3903         }
3904 }
3905 func rewriteValuePPC64_OpNot(v *Value) bool {
3906         v_0 := v.Args[0]
3907         // match: (Not x)
3908         // result: (XORconst [1] x)
3909         for {
3910                 x := v_0
3911                 v.reset(OpPPC64XORconst)
3912                 v.AuxInt = int64ToAuxInt(1)
3913                 v.AddArg(x)
3914                 return true
3915         }
3916 }
3917 func rewriteValuePPC64_OpOffPtr(v *Value) bool {
3918         v_0 := v.Args[0]
3919         b := v.Block
3920         typ := &b.Func.Config.Types
3921         // match: (OffPtr [off] ptr)
3922         // result: (ADD (MOVDconst <typ.Int64> [off]) ptr)
3923         for {
3924                 off := auxIntToInt64(v.AuxInt)
3925                 ptr := v_0
3926                 v.reset(OpPPC64ADD)
3927                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3928                 v0.AuxInt = int64ToAuxInt(off)
3929                 v.AddArg2(v0, ptr)
3930                 return true
3931         }
3932 }
3933 func rewriteValuePPC64_OpPPC64ADD(v *Value) bool {
3934         v_1 := v.Args[1]
3935         v_0 := v.Args[0]
3936         // match: (ADD l:(MULLD x y) z)
3937         // cond: buildcfg.GOPPC64 >= 9 && l.Uses == 1 && clobber(l)
3938         // result: (MADDLD x y z)
3939         for {
3940                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3941                         l := v_0
3942                         if l.Op != OpPPC64MULLD {
3943                                 continue
3944                         }
3945                         y := l.Args[1]
3946                         x := l.Args[0]
3947                         z := v_1
3948                         if !(buildcfg.GOPPC64 >= 9 && l.Uses == 1 && clobber(l)) {
3949                                 continue
3950                         }
3951                         v.reset(OpPPC64MADDLD)
3952                         v.AddArg3(x, y, z)
3953                         return true
3954                 }
3955                 break
3956         }
3957         // match: (ADD x (MOVDconst <t> [c]))
3958         // cond: is32Bit(c) && !t.IsPtr()
3959         // result: (ADDconst [c] x)
3960         for {
3961                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3962                         x := v_0
3963                         if v_1.Op != OpPPC64MOVDconst {
3964                                 continue
3965                         }
3966                         t := v_1.Type
3967                         c := auxIntToInt64(v_1.AuxInt)
3968                         if !(is32Bit(c) && !t.IsPtr()) {
3969                                 continue
3970                         }
3971                         v.reset(OpPPC64ADDconst)
3972                         v.AuxInt = int64ToAuxInt(c)
3973                         v.AddArg(x)
3974                         return true
3975                 }
3976                 break
3977         }
3978         return false
3979 }
3980 func rewriteValuePPC64_OpPPC64ADDE(v *Value) bool {
3981         v_2 := v.Args[2]
3982         v_1 := v.Args[1]
3983         v_0 := v.Args[0]
3984         b := v.Block
3985         typ := &b.Func.Config.Types
3986         // match: (ADDE x y (Select1 <typ.UInt64> (ADDCconst (MOVDconst [0]) [-1])))
3987         // result: (ADDC x y)
3988         for {
3989                 x := v_0
3990                 y := v_1
3991                 if v_2.Op != OpSelect1 || v_2.Type != typ.UInt64 {
3992                         break
3993                 }
3994                 v_2_0 := v_2.Args[0]
3995                 if v_2_0.Op != OpPPC64ADDCconst || auxIntToInt64(v_2_0.AuxInt) != -1 {
3996                         break
3997                 }
3998                 v_2_0_0 := v_2_0.Args[0]
3999                 if v_2_0_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 {
4000                         break
4001                 }
4002                 v.reset(OpPPC64ADDC)
4003                 v.AddArg2(x, y)
4004                 return true
4005         }
4006         return false
4007 }
4008 func rewriteValuePPC64_OpPPC64ADDconst(v *Value) bool {
4009         v_0 := v.Args[0]
4010         // match: (ADDconst [c] (ADDconst [d] x))
4011         // cond: is32Bit(c+d)
4012         // result: (ADDconst [c+d] x)
4013         for {
4014                 c := auxIntToInt64(v.AuxInt)
4015                 if v_0.Op != OpPPC64ADDconst {
4016                         break
4017                 }
4018                 d := auxIntToInt64(v_0.AuxInt)
4019                 x := v_0.Args[0]
4020                 if !(is32Bit(c + d)) {
4021                         break
4022                 }
4023                 v.reset(OpPPC64ADDconst)
4024                 v.AuxInt = int64ToAuxInt(c + d)
4025                 v.AddArg(x)
4026                 return true
4027         }
4028         // match: (ADDconst [0] x)
4029         // result: x
4030         for {
4031                 if auxIntToInt64(v.AuxInt) != 0 {
4032                         break
4033                 }
4034                 x := v_0
4035                 v.copyOf(x)
4036                 return true
4037         }
4038         // match: (ADDconst [c] (MOVDaddr [d] {sym} x))
4039         // cond: is32Bit(c+int64(d))
4040         // result: (MOVDaddr [int32(c+int64(d))] {sym} x)
4041         for {
4042                 c := auxIntToInt64(v.AuxInt)
4043                 if v_0.Op != OpPPC64MOVDaddr {
4044                         break
4045                 }
4046                 d := auxIntToInt32(v_0.AuxInt)
4047                 sym := auxToSym(v_0.Aux)
4048                 x := v_0.Args[0]
4049                 if !(is32Bit(c + int64(d))) {
4050                         break
4051                 }
4052                 v.reset(OpPPC64MOVDaddr)
4053                 v.AuxInt = int32ToAuxInt(int32(c + int64(d)))
4054                 v.Aux = symToAux(sym)
4055                 v.AddArg(x)
4056                 return true
4057         }
4058         // match: (ADDconst [c] x:(SP))
4059         // cond: is32Bit(c)
4060         // result: (MOVDaddr [int32(c)] x)
4061         for {
4062                 c := auxIntToInt64(v.AuxInt)
4063                 x := v_0
4064                 if x.Op != OpSP || !(is32Bit(c)) {
4065                         break
4066                 }
4067                 v.reset(OpPPC64MOVDaddr)
4068                 v.AuxInt = int32ToAuxInt(int32(c))
4069                 v.AddArg(x)
4070                 return true
4071         }
4072         // match: (ADDconst [c] (SUBFCconst [d] x))
4073         // cond: is32Bit(c+d)
4074         // result: (SUBFCconst [c+d] x)
4075         for {
4076                 c := auxIntToInt64(v.AuxInt)
4077                 if v_0.Op != OpPPC64SUBFCconst {
4078                         break
4079                 }
4080                 d := auxIntToInt64(v_0.AuxInt)
4081                 x := v_0.Args[0]
4082                 if !(is32Bit(c + d)) {
4083                         break
4084                 }
4085                 v.reset(OpPPC64SUBFCconst)
4086                 v.AuxInt = int64ToAuxInt(c + d)
4087                 v.AddArg(x)
4088                 return true
4089         }
4090         return false
4091 }
4092 func rewriteValuePPC64_OpPPC64AND(v *Value) bool {
4093         v_1 := v.Args[1]
4094         v_0 := v.Args[0]
4095         b := v.Block
4096         typ := &b.Func.Config.Types
4097         // match: (AND (MOVDconst [m]) (ROTLWconst [r] x))
4098         // cond: isPPC64WordRotateMask(m)
4099         // result: (RLWINM [encodePPC64RotateMask(r,m,32)] x)
4100         for {
4101                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4102                         if v_0.Op != OpPPC64MOVDconst {
4103                                 continue
4104                         }
4105                         m := auxIntToInt64(v_0.AuxInt)
4106                         if v_1.Op != OpPPC64ROTLWconst {
4107                                 continue
4108                         }
4109                         r := auxIntToInt64(v_1.AuxInt)
4110                         x := v_1.Args[0]
4111                         if !(isPPC64WordRotateMask(m)) {
4112                                 continue
4113                         }
4114                         v.reset(OpPPC64RLWINM)
4115                         v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, m, 32))
4116                         v.AddArg(x)
4117                         return true
4118                 }
4119                 break
4120         }
4121         // match: (AND (MOVDconst [m]) (ROTLW x r))
4122         // cond: isPPC64WordRotateMask(m)
4123         // result: (RLWNM [encodePPC64RotateMask(0,m,32)] x r)
4124         for {
4125                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4126                         if v_0.Op != OpPPC64MOVDconst {
4127                                 continue
4128                         }
4129                         m := auxIntToInt64(v_0.AuxInt)
4130                         if v_1.Op != OpPPC64ROTLW {
4131                                 continue
4132                         }
4133                         r := v_1.Args[1]
4134                         x := v_1.Args[0]
4135                         if !(isPPC64WordRotateMask(m)) {
4136                                 continue
4137                         }
4138                         v.reset(OpPPC64RLWNM)
4139                         v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32))
4140                         v.AddArg2(x, r)
4141                         return true
4142                 }
4143                 break
4144         }
4145         // match: (AND (MOVDconst [m]) (SRWconst x [s]))
4146         // cond: mergePPC64RShiftMask(m,s,32) == 0
4147         // result: (MOVDconst [0])
4148         for {
4149                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4150                         if v_0.Op != OpPPC64MOVDconst {
4151                                 continue
4152                         }
4153                         m := auxIntToInt64(v_0.AuxInt)
4154                         if v_1.Op != OpPPC64SRWconst {
4155                                 continue
4156                         }
4157                         s := auxIntToInt64(v_1.AuxInt)
4158                         if !(mergePPC64RShiftMask(m, s, 32) == 0) {
4159                                 continue
4160                         }
4161                         v.reset(OpPPC64MOVDconst)
4162                         v.AuxInt = int64ToAuxInt(0)
4163                         return true
4164                 }
4165                 break
4166         }
4167         // match: (AND (MOVDconst [m]) (SRWconst x [s]))
4168         // cond: mergePPC64AndSrwi(m,s) != 0
4169         // result: (RLWINM [mergePPC64AndSrwi(m,s)] x)
4170         for {
4171                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4172                         if v_0.Op != OpPPC64MOVDconst {
4173                                 continue
4174                         }
4175                         m := auxIntToInt64(v_0.AuxInt)
4176                         if v_1.Op != OpPPC64SRWconst {
4177                                 continue
4178                         }
4179                         s := auxIntToInt64(v_1.AuxInt)
4180                         x := v_1.Args[0]
4181                         if !(mergePPC64AndSrwi(m, s) != 0) {
4182                                 continue
4183                         }
4184                         v.reset(OpPPC64RLWINM)
4185                         v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m, s))
4186                         v.AddArg(x)
4187                         return true
4188                 }
4189                 break
4190         }
4191         // match: (AND x (NOR y y))
4192         // result: (ANDN x y)
4193         for {
4194                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4195                         x := v_0
4196                         if v_1.Op != OpPPC64NOR {
4197                                 continue
4198                         }
4199                         y := v_1.Args[1]
4200                         if y != v_1.Args[0] {
4201                                 continue
4202                         }
4203                         v.reset(OpPPC64ANDN)
4204                         v.AddArg2(x, y)
4205                         return true
4206                 }
4207                 break
4208         }
4209         // match: (AND (MOVDconst [c]) (MOVDconst [d]))
4210         // result: (MOVDconst [c&d])
4211         for {
4212                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4213                         if v_0.Op != OpPPC64MOVDconst {
4214                                 continue
4215                         }
4216                         c := auxIntToInt64(v_0.AuxInt)
4217                         if v_1.Op != OpPPC64MOVDconst {
4218                                 continue
4219                         }
4220                         d := auxIntToInt64(v_1.AuxInt)
4221                         v.reset(OpPPC64MOVDconst)
4222                         v.AuxInt = int64ToAuxInt(c & d)
4223                         return true
4224                 }
4225                 break
4226         }
4227         // match: (AND x (MOVDconst [-1]))
4228         // result: x
4229         for {
4230                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4231                         x := v_0
4232                         if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
4233                                 continue
4234                         }
4235                         v.copyOf(x)
4236                         return true
4237                 }
4238                 break
4239         }
4240         // match: (AND x (MOVDconst [c]))
4241         // cond: isU16Bit(c)
4242         // result: (Select0 (ANDCCconst [c] x))
4243         for {
4244                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4245                         x := v_0
4246                         if v_1.Op != OpPPC64MOVDconst {
4247                                 continue
4248                         }
4249                         c := auxIntToInt64(v_1.AuxInt)
4250                         if !(isU16Bit(c)) {
4251                                 continue
4252                         }
4253                         v.reset(OpSelect0)
4254                         v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
4255                         v0.AuxInt = int64ToAuxInt(c)
4256                         v0.AddArg(x)
4257                         v.AddArg(v0)
4258                         return true
4259                 }
4260                 break
4261         }
4262         // match: (AND (MOVDconst [c]) y:(MOVWZreg _))
4263         // cond: c&0xFFFFFFFF == 0xFFFFFFFF
4264         // result: y
4265         for {
4266                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4267                         if v_0.Op != OpPPC64MOVDconst {
4268                                 continue
4269                         }
4270                         c := auxIntToInt64(v_0.AuxInt)
4271                         y := v_1
4272                         if y.Op != OpPPC64MOVWZreg || !(c&0xFFFFFFFF == 0xFFFFFFFF) {
4273                                 continue
4274                         }
4275                         v.copyOf(y)
4276                         return true
4277                 }
4278                 break
4279         }
4280         // match: (AND (MOVDconst [0xFFFFFFFF]) y:(MOVWreg x))
4281         // result: (MOVWZreg x)
4282         for {
4283                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4284                         if v_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_0.AuxInt) != 0xFFFFFFFF {
4285                                 continue
4286                         }
4287                         y := v_1
4288                         if y.Op != OpPPC64MOVWreg {
4289                                 continue
4290                         }
4291                         x := y.Args[0]
4292                         v.reset(OpPPC64MOVWZreg)
4293                         v.AddArg(x)
4294                         return true
4295                 }
4296                 break
4297         }
4298         // match: (AND (MOVDconst [c]) x:(MOVBZload _ _))
4299         // result: (Select0 (ANDCCconst [c&0xFF] x))
4300         for {
4301                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4302                         if v_0.Op != OpPPC64MOVDconst {
4303                                 continue
4304                         }
4305                         c := auxIntToInt64(v_0.AuxInt)
4306                         x := v_1
4307                         if x.Op != OpPPC64MOVBZload {
4308                                 continue
4309                         }
4310                         v.reset(OpSelect0)
4311                         v0 := b.NewValue0(x.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
4312                         v0.AuxInt = int64ToAuxInt(c & 0xFF)
4313                         v0.AddArg(x)
4314                         v.AddArg(v0)
4315                         return true
4316                 }
4317                 break
4318         }
4319         return false
4320 }
4321 func rewriteValuePPC64_OpPPC64ANDCCconst(v *Value) bool {
4322         v_0 := v.Args[0]
4323         // match: (ANDCCconst [c] (Select0 (ANDCCconst [d] x)))
4324         // result: (ANDCCconst [c&d] x)
4325         for {
4326                 c := auxIntToInt64(v.AuxInt)
4327                 if v_0.Op != OpSelect0 {
4328                         break
4329                 }
4330                 v_0_0 := v_0.Args[0]
4331                 if v_0_0.Op != OpPPC64ANDCCconst {
4332                         break
4333                 }
4334                 d := auxIntToInt64(v_0_0.AuxInt)
4335                 x := v_0_0.Args[0]
4336                 v.reset(OpPPC64ANDCCconst)
4337                 v.AuxInt = int64ToAuxInt(c & d)
4338                 v.AddArg(x)
4339                 return true
4340         }
4341         return false
4342 }
4343 func rewriteValuePPC64_OpPPC64ANDN(v *Value) bool {
4344         v_1 := v.Args[1]
4345         v_0 := v.Args[0]
4346         // match: (ANDN (MOVDconst [c]) (MOVDconst [d]))
4347         // result: (MOVDconst [c&^d])
4348         for {
4349                 if v_0.Op != OpPPC64MOVDconst {
4350                         break
4351                 }
4352                 c := auxIntToInt64(v_0.AuxInt)
4353                 if v_1.Op != OpPPC64MOVDconst {
4354                         break
4355                 }
4356                 d := auxIntToInt64(v_1.AuxInt)
4357                 v.reset(OpPPC64MOVDconst)
4358                 v.AuxInt = int64ToAuxInt(c &^ d)
4359                 return true
4360         }
4361         return false
4362 }
4363 func rewriteValuePPC64_OpPPC64BRD(v *Value) bool {
4364         v_0 := v.Args[0]
4365         b := v.Block
4366         typ := &b.Func.Config.Types
4367         // match: (BRD x:(MOVDload [off] {sym} ptr mem))
4368         // cond: x.Uses == 1
4369         // result: @x.Block (MOVDBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
4370         for {
4371                 x := v_0
4372                 if x.Op != OpPPC64MOVDload {
4373                         break
4374                 }
4375                 off := auxIntToInt32(x.AuxInt)
4376                 sym := auxToSym(x.Aux)
4377                 mem := x.Args[1]
4378                 ptr := x.Args[0]
4379                 if !(x.Uses == 1) {
4380                         break
4381                 }
4382                 b = x.Block
4383                 v0 := b.NewValue0(x.Pos, OpPPC64MOVDBRload, typ.UInt64)
4384                 v.copyOf(v0)
4385                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
4386                 v1.AuxInt = int32ToAuxInt(off)
4387                 v1.Aux = symToAux(sym)
4388                 v1.AddArg(ptr)
4389                 v0.AddArg2(v1, mem)
4390                 return true
4391         }
4392         // match: (BRD x:(MOVDloadidx ptr idx mem))
4393         // cond: x.Uses == 1
4394         // result: @x.Block (MOVDBRloadidx ptr idx mem)
4395         for {
4396                 x := v_0
4397                 if x.Op != OpPPC64MOVDloadidx {
4398                         break
4399                 }
4400                 mem := x.Args[2]
4401                 ptr := x.Args[0]
4402                 idx := x.Args[1]
4403                 if !(x.Uses == 1) {
4404                         break
4405                 }
4406                 b = x.Block
4407                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRloadidx, typ.Int64)
4408                 v.copyOf(v0)
4409                 v0.AddArg3(ptr, idx, mem)
4410                 return true
4411         }
4412         return false
4413 }
4414 func rewriteValuePPC64_OpPPC64BRH(v *Value) bool {
4415         v_0 := v.Args[0]
4416         b := v.Block
4417         typ := &b.Func.Config.Types
4418         // match: (BRH x:(MOVHZload [off] {sym} ptr mem))
4419         // cond: x.Uses == 1
4420         // result: @x.Block (MOVHBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
4421         for {
4422                 x := v_0
4423                 if x.Op != OpPPC64MOVHZload {
4424                         break
4425                 }
4426                 off := auxIntToInt32(x.AuxInt)
4427                 sym := auxToSym(x.Aux)
4428                 mem := x.Args[1]
4429                 ptr := x.Args[0]
4430                 if !(x.Uses == 1) {
4431                         break
4432                 }
4433                 b = x.Block
4434                 v0 := b.NewValue0(x.Pos, OpPPC64MOVHBRload, typ.UInt16)
4435                 v.copyOf(v0)
4436                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
4437                 v1.AuxInt = int32ToAuxInt(off)
4438                 v1.Aux = symToAux(sym)
4439                 v1.AddArg(ptr)
4440                 v0.AddArg2(v1, mem)
4441                 return true
4442         }
4443         // match: (BRH x:(MOVHZloadidx ptr idx mem))
4444         // cond: x.Uses == 1
4445         // result: @x.Block (MOVHBRloadidx ptr idx mem)
4446         for {
4447                 x := v_0
4448                 if x.Op != OpPPC64MOVHZloadidx {
4449                         break
4450                 }
4451                 mem := x.Args[2]
4452                 ptr := x.Args[0]
4453                 idx := x.Args[1]
4454                 if !(x.Uses == 1) {
4455                         break
4456                 }
4457                 b = x.Block
4458                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHBRloadidx, typ.Int16)
4459                 v.copyOf(v0)
4460                 v0.AddArg3(ptr, idx, mem)
4461                 return true
4462         }
4463         return false
4464 }
4465 func rewriteValuePPC64_OpPPC64BRW(v *Value) bool {
4466         v_0 := v.Args[0]
4467         b := v.Block
4468         typ := &b.Func.Config.Types
4469         // match: (BRW x:(MOVWZload [off] {sym} ptr mem))
4470         // cond: x.Uses == 1
4471         // result: @x.Block (MOVWBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
4472         for {
4473                 x := v_0
4474                 if x.Op != OpPPC64MOVWZload {
4475                         break
4476                 }
4477                 off := auxIntToInt32(x.AuxInt)
4478                 sym := auxToSym(x.Aux)
4479                 mem := x.Args[1]
4480                 ptr := x.Args[0]
4481                 if !(x.Uses == 1) {
4482                         break
4483                 }
4484                 b = x.Block
4485                 v0 := b.NewValue0(x.Pos, OpPPC64MOVWBRload, typ.UInt32)
4486                 v.copyOf(v0)
4487                 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
4488                 v1.AuxInt = int32ToAuxInt(off)
4489                 v1.Aux = symToAux(sym)
4490                 v1.AddArg(ptr)
4491                 v0.AddArg2(v1, mem)
4492                 return true
4493         }
4494         // match: (BRW x:(MOVWZloadidx ptr idx mem))
4495         // cond: x.Uses == 1
4496         // result: @x.Block (MOVWBRloadidx ptr idx mem)
4497         for {
4498                 x := v_0
4499                 if x.Op != OpPPC64MOVWZloadidx {
4500                         break
4501                 }
4502                 mem := x.Args[2]
4503                 ptr := x.Args[0]
4504                 idx := x.Args[1]
4505                 if !(x.Uses == 1) {
4506                         break
4507                 }
4508                 b = x.Block
4509                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRloadidx, typ.Int32)
4510                 v.copyOf(v0)
4511                 v0.AddArg3(ptr, idx, mem)
4512                 return true
4513         }
4514         return false
4515 }
4516 func rewriteValuePPC64_OpPPC64CLRLSLDI(v *Value) bool {
4517         v_0 := v.Args[0]
4518         // match: (CLRLSLDI [c] (SRWconst [s] x))
4519         // cond: mergePPC64ClrlsldiSrw(int64(c),s) != 0
4520         // result: (RLWINM [mergePPC64ClrlsldiSrw(int64(c),s)] x)
4521         for {
4522                 c := auxIntToInt32(v.AuxInt)
4523                 if v_0.Op != OpPPC64SRWconst {
4524                         break
4525                 }
4526                 s := auxIntToInt64(v_0.AuxInt)
4527                 x := v_0.Args[0]
4528                 if !(mergePPC64ClrlsldiSrw(int64(c), s) != 0) {
4529                         break
4530                 }
4531                 v.reset(OpPPC64RLWINM)
4532                 v.AuxInt = int64ToAuxInt(mergePPC64ClrlsldiSrw(int64(c), s))
4533                 v.AddArg(x)
4534                 return true
4535         }
4536         // match: (CLRLSLDI [c] i:(RLWINM [s] x))
4537         // cond: mergePPC64ClrlsldiRlwinm(c,s) != 0
4538         // result: (RLWINM [mergePPC64ClrlsldiRlwinm(c,s)] x)
4539         for {
4540                 c := auxIntToInt32(v.AuxInt)
4541                 i := v_0
4542                 if i.Op != OpPPC64RLWINM {
4543                         break
4544                 }
4545                 s := auxIntToInt64(i.AuxInt)
4546                 x := i.Args[0]
4547                 if !(mergePPC64ClrlsldiRlwinm(c, s) != 0) {
4548                         break
4549                 }
4550                 v.reset(OpPPC64RLWINM)
4551                 v.AuxInt = int64ToAuxInt(mergePPC64ClrlsldiRlwinm(c, s))
4552                 v.AddArg(x)
4553                 return true
4554         }
4555         return false
4556 }
4557 func rewriteValuePPC64_OpPPC64CMP(v *Value) bool {
4558         v_1 := v.Args[1]
4559         v_0 := v.Args[0]
4560         b := v.Block
4561         // match: (CMP x (MOVDconst [c]))
4562         // cond: is16Bit(c)
4563         // result: (CMPconst x [c])
4564         for {
4565                 x := v_0
4566                 if v_1.Op != OpPPC64MOVDconst {
4567                         break
4568                 }
4569                 c := auxIntToInt64(v_1.AuxInt)
4570                 if !(is16Bit(c)) {
4571                         break
4572                 }
4573                 v.reset(OpPPC64CMPconst)
4574                 v.AuxInt = int64ToAuxInt(c)
4575                 v.AddArg(x)
4576                 return true
4577         }
4578         // match: (CMP (MOVDconst [c]) y)
4579         // cond: is16Bit(c)
4580         // result: (InvertFlags (CMPconst y [c]))
4581         for {
4582                 if v_0.Op != OpPPC64MOVDconst {
4583                         break
4584                 }
4585                 c := auxIntToInt64(v_0.AuxInt)
4586                 y := v_1
4587                 if !(is16Bit(c)) {
4588                         break
4589                 }
4590                 v.reset(OpPPC64InvertFlags)
4591                 v0 := b.NewValue0(v.Pos, OpPPC64CMPconst, types.TypeFlags)
4592                 v0.AuxInt = int64ToAuxInt(c)
4593                 v0.AddArg(y)
4594                 v.AddArg(v0)
4595                 return true
4596         }
4597         // match: (CMP x y)
4598         // cond: canonLessThan(x,y)
4599         // result: (InvertFlags (CMP y x))
4600         for {
4601                 x := v_0
4602                 y := v_1
4603                 if !(canonLessThan(x, y)) {
4604                         break
4605                 }
4606                 v.reset(OpPPC64InvertFlags)
4607                 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
4608                 v0.AddArg2(y, x)
4609                 v.AddArg(v0)
4610                 return true
4611         }
4612         return false
4613 }
4614 func rewriteValuePPC64_OpPPC64CMPU(v *Value) bool {
4615         v_1 := v.Args[1]
4616         v_0 := v.Args[0]
4617         b := v.Block
4618         // match: (CMPU x (MOVDconst [c]))
4619         // cond: isU16Bit(c)
4620         // result: (CMPUconst x [c])
4621         for {
4622                 x := v_0
4623                 if v_1.Op != OpPPC64MOVDconst {
4624                         break
4625                 }
4626                 c := auxIntToInt64(v_1.AuxInt)
4627                 if !(isU16Bit(c)) {
4628                         break
4629                 }
4630                 v.reset(OpPPC64CMPUconst)
4631                 v.AuxInt = int64ToAuxInt(c)
4632                 v.AddArg(x)
4633                 return true
4634         }
4635         // match: (CMPU (MOVDconst [c]) y)
4636         // cond: isU16Bit(c)
4637         // result: (InvertFlags (CMPUconst y [c]))
4638         for {
4639                 if v_0.Op != OpPPC64MOVDconst {
4640                         break
4641                 }
4642                 c := auxIntToInt64(v_0.AuxInt)
4643                 y := v_1
4644                 if !(isU16Bit(c)) {
4645                         break
4646                 }
4647                 v.reset(OpPPC64InvertFlags)
4648                 v0 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
4649                 v0.AuxInt = int64ToAuxInt(c)
4650                 v0.AddArg(y)
4651                 v.AddArg(v0)
4652                 return true
4653         }
4654         // match: (CMPU x y)
4655         // cond: canonLessThan(x,y)
4656         // result: (InvertFlags (CMPU y x))
4657         for {
4658                 x := v_0
4659                 y := v_1
4660                 if !(canonLessThan(x, y)) {
4661                         break
4662                 }
4663                 v.reset(OpPPC64InvertFlags)
4664                 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
4665                 v0.AddArg2(y, x)
4666                 v.AddArg(v0)
4667                 return true
4668         }
4669         return false
4670 }
4671 func rewriteValuePPC64_OpPPC64CMPUconst(v *Value) bool {
4672         v_0 := v.Args[0]
4673         // match: (CMPUconst [d] (Select0 (ANDCCconst z [c])))
4674         // cond: uint64(d) > uint64(c)
4675         // result: (FlagLT)
4676         for {
4677                 d := auxIntToInt64(v.AuxInt)
4678                 if v_0.Op != OpSelect0 {
4679                         break
4680                 }
4681                 v_0_0 := v_0.Args[0]
4682                 if v_0_0.Op != OpPPC64ANDCCconst {
4683                         break
4684                 }
4685                 c := auxIntToInt64(v_0_0.AuxInt)
4686                 if !(uint64(d) > uint64(c)) {
4687                         break
4688                 }
4689                 v.reset(OpPPC64FlagLT)
4690                 return true
4691         }
4692         // match: (CMPUconst (MOVDconst [x]) [y])
4693         // cond: x==y
4694         // result: (FlagEQ)
4695         for {
4696                 y := auxIntToInt64(v.AuxInt)
4697                 if v_0.Op != OpPPC64MOVDconst {
4698                         break
4699                 }
4700                 x := auxIntToInt64(v_0.AuxInt)
4701                 if !(x == y) {
4702                         break
4703                 }
4704                 v.reset(OpPPC64FlagEQ)
4705                 return true
4706         }
4707         // match: (CMPUconst (MOVDconst [x]) [y])
4708         // cond: uint64(x)<uint64(y)
4709         // result: (FlagLT)
4710         for {
4711                 y := auxIntToInt64(v.AuxInt)
4712                 if v_0.Op != OpPPC64MOVDconst {
4713                         break
4714                 }
4715                 x := auxIntToInt64(v_0.AuxInt)
4716                 if !(uint64(x) < uint64(y)) {
4717                         break
4718                 }
4719                 v.reset(OpPPC64FlagLT)
4720                 return true
4721         }
4722         // match: (CMPUconst (MOVDconst [x]) [y])
4723         // cond: uint64(x)>uint64(y)
4724         // result: (FlagGT)
4725         for {
4726                 y := auxIntToInt64(v.AuxInt)
4727                 if v_0.Op != OpPPC64MOVDconst {
4728                         break
4729                 }
4730                 x := auxIntToInt64(v_0.AuxInt)
4731                 if !(uint64(x) > uint64(y)) {
4732                         break
4733                 }
4734                 v.reset(OpPPC64FlagGT)
4735                 return true
4736         }
4737         return false
4738 }
4739 func rewriteValuePPC64_OpPPC64CMPW(v *Value) bool {
4740         v_1 := v.Args[1]
4741         v_0 := v.Args[0]
4742         b := v.Block
4743         // match: (CMPW x (MOVWreg y))
4744         // result: (CMPW x y)
4745         for {
4746                 x := v_0
4747                 if v_1.Op != OpPPC64MOVWreg {
4748                         break
4749                 }
4750                 y := v_1.Args[0]
4751                 v.reset(OpPPC64CMPW)
4752                 v.AddArg2(x, y)
4753                 return true
4754         }
4755         // match: (CMPW (MOVWreg x) y)
4756         // result: (CMPW x y)
4757         for {
4758                 if v_0.Op != OpPPC64MOVWreg {
4759                         break
4760                 }
4761                 x := v_0.Args[0]
4762                 y := v_1
4763                 v.reset(OpPPC64CMPW)
4764                 v.AddArg2(x, y)
4765                 return true
4766         }
4767         // match: (CMPW x (MOVDconst [c]))
4768         // cond: is16Bit(c)
4769         // result: (CMPWconst x [int32(c)])
4770         for {
4771                 x := v_0
4772                 if v_1.Op != OpPPC64MOVDconst {
4773                         break
4774                 }
4775                 c := auxIntToInt64(v_1.AuxInt)
4776                 if !(is16Bit(c)) {
4777                         break
4778                 }
4779                 v.reset(OpPPC64CMPWconst)
4780                 v.AuxInt = int32ToAuxInt(int32(c))
4781                 v.AddArg(x)
4782                 return true
4783         }
4784         // match: (CMPW (MOVDconst [c]) y)
4785         // cond: is16Bit(c)
4786         // result: (InvertFlags (CMPWconst y [int32(c)]))
4787         for {
4788                 if v_0.Op != OpPPC64MOVDconst {
4789                         break
4790                 }
4791                 c := auxIntToInt64(v_0.AuxInt)
4792                 y := v_1
4793                 if !(is16Bit(c)) {
4794                         break
4795                 }
4796                 v.reset(OpPPC64InvertFlags)
4797                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWconst, types.TypeFlags)
4798                 v0.AuxInt = int32ToAuxInt(int32(c))
4799                 v0.AddArg(y)
4800                 v.AddArg(v0)
4801                 return true
4802         }
4803         // match: (CMPW x y)
4804         // cond: canonLessThan(x,y)
4805         // result: (InvertFlags (CMPW y x))
4806         for {
4807                 x := v_0
4808                 y := v_1
4809                 if !(canonLessThan(x, y)) {
4810                         break
4811                 }
4812                 v.reset(OpPPC64InvertFlags)
4813                 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
4814                 v0.AddArg2(y, x)
4815                 v.AddArg(v0)
4816                 return true
4817         }
4818         return false
4819 }
4820 func rewriteValuePPC64_OpPPC64CMPWU(v *Value) bool {
4821         v_1 := v.Args[1]
4822         v_0 := v.Args[0]
4823         b := v.Block
4824         // match: (CMPWU x (MOVWZreg y))
4825         // result: (CMPWU x y)
4826         for {
4827                 x := v_0
4828                 if v_1.Op != OpPPC64MOVWZreg {
4829                         break
4830                 }
4831                 y := v_1.Args[0]
4832                 v.reset(OpPPC64CMPWU)
4833                 v.AddArg2(x, y)
4834                 return true
4835         }
4836         // match: (CMPWU (MOVWZreg x) y)
4837         // result: (CMPWU x y)
4838         for {
4839                 if v_0.Op != OpPPC64MOVWZreg {
4840                         break
4841                 }
4842                 x := v_0.Args[0]
4843                 y := v_1
4844                 v.reset(OpPPC64CMPWU)
4845                 v.AddArg2(x, y)
4846                 return true
4847         }
4848         // match: (CMPWU x (MOVDconst [c]))
4849         // cond: isU16Bit(c)
4850         // result: (CMPWUconst x [int32(c)])
4851         for {
4852                 x := v_0
4853                 if v_1.Op != OpPPC64MOVDconst {
4854                         break
4855                 }
4856                 c := auxIntToInt64(v_1.AuxInt)
4857                 if !(isU16Bit(c)) {
4858                         break
4859                 }
4860                 v.reset(OpPPC64CMPWUconst)
4861                 v.AuxInt = int32ToAuxInt(int32(c))
4862                 v.AddArg(x)
4863                 return true
4864         }
4865         // match: (CMPWU (MOVDconst [c]) y)
4866         // cond: isU16Bit(c)
4867         // result: (InvertFlags (CMPWUconst y [int32(c)]))
4868         for {
4869                 if v_0.Op != OpPPC64MOVDconst {
4870                         break
4871                 }
4872                 c := auxIntToInt64(v_0.AuxInt)
4873                 y := v_1
4874                 if !(isU16Bit(c)) {
4875                         break
4876                 }
4877                 v.reset(OpPPC64InvertFlags)
4878                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
4879                 v0.AuxInt = int32ToAuxInt(int32(c))
4880                 v0.AddArg(y)
4881                 v.AddArg(v0)
4882                 return true
4883         }
4884         // match: (CMPWU x y)
4885         // cond: canonLessThan(x,y)
4886         // result: (InvertFlags (CMPWU y x))
4887         for {
4888                 x := v_0
4889                 y := v_1
4890                 if !(canonLessThan(x, y)) {
4891                         break
4892                 }
4893                 v.reset(OpPPC64InvertFlags)
4894                 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
4895                 v0.AddArg2(y, x)
4896                 v.AddArg(v0)
4897                 return true
4898         }
4899         return false
4900 }
4901 func rewriteValuePPC64_OpPPC64CMPWUconst(v *Value) bool {
4902         v_0 := v.Args[0]
4903         // match: (CMPWUconst [d] (Select0 (ANDCCconst z [c])))
4904         // cond: uint64(d) > uint64(c)
4905         // result: (FlagLT)
4906         for {
4907                 d := auxIntToInt32(v.AuxInt)
4908                 if v_0.Op != OpSelect0 {
4909                         break
4910                 }
4911                 v_0_0 := v_0.Args[0]
4912                 if v_0_0.Op != OpPPC64ANDCCconst {
4913                         break
4914                 }
4915                 c := auxIntToInt64(v_0_0.AuxInt)
4916                 if !(uint64(d) > uint64(c)) {
4917                         break
4918                 }
4919                 v.reset(OpPPC64FlagLT)
4920                 return true
4921         }
4922         // match: (CMPWUconst (MOVDconst [x]) [y])
4923         // cond: int32(x)==int32(y)
4924         // result: (FlagEQ)
4925         for {
4926                 y := auxIntToInt32(v.AuxInt)
4927                 if v_0.Op != OpPPC64MOVDconst {
4928                         break
4929                 }
4930                 x := auxIntToInt64(v_0.AuxInt)
4931                 if !(int32(x) == int32(y)) {
4932                         break
4933                 }
4934                 v.reset(OpPPC64FlagEQ)
4935                 return true
4936         }
4937         // match: (CMPWUconst (MOVDconst [x]) [y])
4938         // cond: uint32(x)<uint32(y)
4939         // result: (FlagLT)
4940         for {
4941                 y := auxIntToInt32(v.AuxInt)
4942                 if v_0.Op != OpPPC64MOVDconst {
4943                         break
4944                 }
4945                 x := auxIntToInt64(v_0.AuxInt)
4946                 if !(uint32(x) < uint32(y)) {
4947                         break
4948                 }
4949                 v.reset(OpPPC64FlagLT)
4950                 return true
4951         }
4952         // match: (CMPWUconst (MOVDconst [x]) [y])
4953         // cond: uint32(x)>uint32(y)
4954         // result: (FlagGT)
4955         for {
4956                 y := auxIntToInt32(v.AuxInt)
4957                 if v_0.Op != OpPPC64MOVDconst {
4958                         break
4959                 }
4960                 x := auxIntToInt64(v_0.AuxInt)
4961                 if !(uint32(x) > uint32(y)) {
4962                         break
4963                 }
4964                 v.reset(OpPPC64FlagGT)
4965                 return true
4966         }
4967         return false
4968 }
4969 func rewriteValuePPC64_OpPPC64CMPWconst(v *Value) bool {
4970         v_0 := v.Args[0]
4971         // match: (CMPWconst (MOVDconst [x]) [y])
4972         // cond: int32(x)==int32(y)
4973         // result: (FlagEQ)
4974         for {
4975                 y := auxIntToInt32(v.AuxInt)
4976                 if v_0.Op != OpPPC64MOVDconst {
4977                         break
4978                 }
4979                 x := auxIntToInt64(v_0.AuxInt)
4980                 if !(int32(x) == int32(y)) {
4981                         break
4982                 }
4983                 v.reset(OpPPC64FlagEQ)
4984                 return true
4985         }
4986         // match: (CMPWconst (MOVDconst [x]) [y])
4987         // cond: int32(x)<int32(y)
4988         // result: (FlagLT)
4989         for {
4990                 y := auxIntToInt32(v.AuxInt)
4991                 if v_0.Op != OpPPC64MOVDconst {
4992                         break
4993                 }
4994                 x := auxIntToInt64(v_0.AuxInt)
4995                 if !(int32(x) < int32(y)) {
4996                         break
4997                 }
4998                 v.reset(OpPPC64FlagLT)
4999                 return true
5000         }
5001         // match: (CMPWconst (MOVDconst [x]) [y])
5002         // cond: int32(x)>int32(y)
5003         // result: (FlagGT)
5004         for {
5005                 y := auxIntToInt32(v.AuxInt)
5006                 if v_0.Op != OpPPC64MOVDconst {
5007                         break
5008                 }
5009                 x := auxIntToInt64(v_0.AuxInt)
5010                 if !(int32(x) > int32(y)) {
5011                         break
5012                 }
5013                 v.reset(OpPPC64FlagGT)
5014                 return true
5015         }
5016         return false
5017 }
5018 func rewriteValuePPC64_OpPPC64CMPconst(v *Value) bool {
5019         v_0 := v.Args[0]
5020         // match: (CMPconst (MOVDconst [x]) [y])
5021         // cond: x==y
5022         // result: (FlagEQ)
5023         for {
5024                 y := auxIntToInt64(v.AuxInt)
5025                 if v_0.Op != OpPPC64MOVDconst {
5026                         break
5027                 }
5028                 x := auxIntToInt64(v_0.AuxInt)
5029                 if !(x == y) {
5030                         break
5031                 }
5032                 v.reset(OpPPC64FlagEQ)
5033                 return true
5034         }
5035         // match: (CMPconst (MOVDconst [x]) [y])
5036         // cond: x<y
5037         // result: (FlagLT)
5038         for {
5039                 y := auxIntToInt64(v.AuxInt)
5040                 if v_0.Op != OpPPC64MOVDconst {
5041                         break
5042                 }
5043                 x := auxIntToInt64(v_0.AuxInt)
5044                 if !(x < y) {
5045                         break
5046                 }
5047                 v.reset(OpPPC64FlagLT)
5048                 return true
5049         }
5050         // match: (CMPconst (MOVDconst [x]) [y])
5051         // cond: x>y
5052         // result: (FlagGT)
5053         for {
5054                 y := auxIntToInt64(v.AuxInt)
5055                 if v_0.Op != OpPPC64MOVDconst {
5056                         break
5057                 }
5058                 x := auxIntToInt64(v_0.AuxInt)
5059                 if !(x > y) {
5060                         break
5061                 }
5062                 v.reset(OpPPC64FlagGT)
5063                 return true
5064         }
5065         return false
5066 }
5067 func rewriteValuePPC64_OpPPC64Equal(v *Value) bool {
5068         v_0 := v.Args[0]
5069         // match: (Equal (FlagEQ))
5070         // result: (MOVDconst [1])
5071         for {
5072                 if v_0.Op != OpPPC64FlagEQ {
5073                         break
5074                 }
5075                 v.reset(OpPPC64MOVDconst)
5076                 v.AuxInt = int64ToAuxInt(1)
5077                 return true
5078         }
5079         // match: (Equal (FlagLT))
5080         // result: (MOVDconst [0])
5081         for {
5082                 if v_0.Op != OpPPC64FlagLT {
5083                         break
5084                 }
5085                 v.reset(OpPPC64MOVDconst)
5086                 v.AuxInt = int64ToAuxInt(0)
5087                 return true
5088         }
5089         // match: (Equal (FlagGT))
5090         // result: (MOVDconst [0])
5091         for {
5092                 if v_0.Op != OpPPC64FlagGT {
5093                         break
5094                 }
5095                 v.reset(OpPPC64MOVDconst)
5096                 v.AuxInt = int64ToAuxInt(0)
5097                 return true
5098         }
5099         // match: (Equal (InvertFlags x))
5100         // result: (Equal x)
5101         for {
5102                 if v_0.Op != OpPPC64InvertFlags {
5103                         break
5104                 }
5105                 x := v_0.Args[0]
5106                 v.reset(OpPPC64Equal)
5107                 v.AddArg(x)
5108                 return true
5109         }
5110         // match: (Equal cmp)
5111         // result: (SETBC [2] cmp)
5112         for {
5113                 cmp := v_0
5114                 v.reset(OpPPC64SETBC)
5115                 v.AuxInt = int32ToAuxInt(2)
5116                 v.AddArg(cmp)
5117                 return true
5118         }
5119 }
5120 func rewriteValuePPC64_OpPPC64FABS(v *Value) bool {
5121         v_0 := v.Args[0]
5122         // match: (FABS (FMOVDconst [x]))
5123         // result: (FMOVDconst [math.Abs(x)])
5124         for {
5125                 if v_0.Op != OpPPC64FMOVDconst {
5126                         break
5127                 }
5128                 x := auxIntToFloat64(v_0.AuxInt)
5129                 v.reset(OpPPC64FMOVDconst)
5130                 v.AuxInt = float64ToAuxInt(math.Abs(x))
5131                 return true
5132         }
5133         return false
5134 }
5135 func rewriteValuePPC64_OpPPC64FADD(v *Value) bool {
5136         v_1 := v.Args[1]
5137         v_0 := v.Args[0]
5138         // match: (FADD (FMUL x y) z)
5139         // cond: x.Block.Func.useFMA(v)
5140         // result: (FMADD x y z)
5141         for {
5142                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5143                         if v_0.Op != OpPPC64FMUL {
5144                                 continue
5145                         }
5146                         _ = v_0.Args[1]
5147                         v_0_0 := v_0.Args[0]
5148                         v_0_1 := v_0.Args[1]
5149                         for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 {
5150                                 x := v_0_0
5151                                 y := v_0_1
5152                                 z := v_1
5153                                 if !(x.Block.Func.useFMA(v)) {
5154                                         continue
5155                                 }
5156                                 v.reset(OpPPC64FMADD)
5157                                 v.AddArg3(x, y, z)
5158                                 return true
5159                         }
5160                 }
5161                 break
5162         }
5163         return false
5164 }
5165 func rewriteValuePPC64_OpPPC64FADDS(v *Value) bool {
5166         v_1 := v.Args[1]
5167         v_0 := v.Args[0]
5168         // match: (FADDS (FMULS x y) z)
5169         // cond: x.Block.Func.useFMA(v)
5170         // result: (FMADDS x y z)
5171         for {
5172                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5173                         if v_0.Op != OpPPC64FMULS {
5174                                 continue
5175                         }
5176                         _ = v_0.Args[1]
5177                         v_0_0 := v_0.Args[0]
5178                         v_0_1 := v_0.Args[1]
5179                         for _i1 := 0; _i1 <= 1; _i1, v_0_0, v_0_1 = _i1+1, v_0_1, v_0_0 {
5180                                 x := v_0_0
5181                                 y := v_0_1
5182                                 z := v_1
5183                                 if !(x.Block.Func.useFMA(v)) {
5184                                         continue
5185                                 }
5186                                 v.reset(OpPPC64FMADDS)
5187                                 v.AddArg3(x, y, z)
5188                                 return true
5189                         }
5190                 }
5191                 break
5192         }
5193         return false
5194 }
5195 func rewriteValuePPC64_OpPPC64FCEIL(v *Value) bool {
5196         v_0 := v.Args[0]
5197         // match: (FCEIL (FMOVDconst [x]))
5198         // result: (FMOVDconst [math.Ceil(x)])
5199         for {
5200                 if v_0.Op != OpPPC64FMOVDconst {
5201                         break
5202                 }
5203                 x := auxIntToFloat64(v_0.AuxInt)
5204                 v.reset(OpPPC64FMOVDconst)
5205                 v.AuxInt = float64ToAuxInt(math.Ceil(x))
5206                 return true
5207         }
5208         return false
5209 }
5210 func rewriteValuePPC64_OpPPC64FFLOOR(v *Value) bool {
5211         v_0 := v.Args[0]
5212         // match: (FFLOOR (FMOVDconst [x]))
5213         // result: (FMOVDconst [math.Floor(x)])
5214         for {
5215                 if v_0.Op != OpPPC64FMOVDconst {
5216                         break
5217                 }
5218                 x := auxIntToFloat64(v_0.AuxInt)
5219                 v.reset(OpPPC64FMOVDconst)
5220                 v.AuxInt = float64ToAuxInt(math.Floor(x))
5221                 return true
5222         }
5223         return false
5224 }
5225 func rewriteValuePPC64_OpPPC64FGreaterEqual(v *Value) bool {
5226         v_0 := v.Args[0]
5227         b := v.Block
5228         typ := &b.Func.Config.Types
5229         // match: (FGreaterEqual cmp)
5230         // result: (OR (SETBC [2] cmp) (SETBC [1] cmp))
5231         for {
5232                 cmp := v_0
5233                 v.reset(OpPPC64OR)
5234                 v0 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5235                 v0.AuxInt = int32ToAuxInt(2)
5236                 v0.AddArg(cmp)
5237                 v1 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5238                 v1.AuxInt = int32ToAuxInt(1)
5239                 v1.AddArg(cmp)
5240                 v.AddArg2(v0, v1)
5241                 return true
5242         }
5243 }
5244 func rewriteValuePPC64_OpPPC64FGreaterThan(v *Value) bool {
5245         v_0 := v.Args[0]
5246         // match: (FGreaterThan cmp)
5247         // result: (SETBC [1] cmp)
5248         for {
5249                 cmp := v_0
5250                 v.reset(OpPPC64SETBC)
5251                 v.AuxInt = int32ToAuxInt(1)
5252                 v.AddArg(cmp)
5253                 return true
5254         }
5255 }
5256 func rewriteValuePPC64_OpPPC64FLessEqual(v *Value) bool {
5257         v_0 := v.Args[0]
5258         b := v.Block
5259         typ := &b.Func.Config.Types
5260         // match: (FLessEqual cmp)
5261         // result: (OR (SETBC [2] cmp) (SETBC [0] cmp))
5262         for {
5263                 cmp := v_0
5264                 v.reset(OpPPC64OR)
5265                 v0 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5266                 v0.AuxInt = int32ToAuxInt(2)
5267                 v0.AddArg(cmp)
5268                 v1 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5269                 v1.AuxInt = int32ToAuxInt(0)
5270                 v1.AddArg(cmp)
5271                 v.AddArg2(v0, v1)
5272                 return true
5273         }
5274 }
5275 func rewriteValuePPC64_OpPPC64FLessThan(v *Value) bool {
5276         v_0 := v.Args[0]
5277         // match: (FLessThan cmp)
5278         // result: (SETBC [0] cmp)
5279         for {
5280                 cmp := v_0
5281                 v.reset(OpPPC64SETBC)
5282                 v.AuxInt = int32ToAuxInt(0)
5283                 v.AddArg(cmp)
5284                 return true
5285         }
5286 }
5287 func rewriteValuePPC64_OpPPC64FMOVDload(v *Value) bool {
5288         v_1 := v.Args[1]
5289         v_0 := v.Args[0]
5290         // match: (FMOVDload [off] {sym} ptr (MOVDstore [off] {sym} ptr x _))
5291         // result: (MTVSRD x)
5292         for {
5293                 off := auxIntToInt32(v.AuxInt)
5294                 sym := auxToSym(v.Aux)
5295                 ptr := v_0
5296                 if v_1.Op != OpPPC64MOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
5297                         break
5298                 }
5299                 x := v_1.Args[1]
5300                 if ptr != v_1.Args[0] {
5301                         break
5302                 }
5303                 v.reset(OpPPC64MTVSRD)
5304                 v.AddArg(x)
5305                 return true
5306         }
5307         // match: (FMOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
5308         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
5309         // result: (FMOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
5310         for {
5311                 off1 := auxIntToInt32(v.AuxInt)
5312                 sym1 := auxToSym(v.Aux)
5313                 p := v_0
5314                 if p.Op != OpPPC64MOVDaddr {
5315                         break
5316                 }
5317                 off2 := auxIntToInt32(p.AuxInt)
5318                 sym2 := auxToSym(p.Aux)
5319                 ptr := p.Args[0]
5320                 mem := v_1
5321                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5322                         break
5323                 }
5324                 v.reset(OpPPC64FMOVDload)
5325                 v.AuxInt = int32ToAuxInt(off1 + off2)
5326                 v.Aux = symToAux(mergeSym(sym1, sym2))
5327                 v.AddArg2(ptr, mem)
5328                 return true
5329         }
5330         // match: (FMOVDload [off1] {sym} (ADDconst [off2] ptr) mem)
5331         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
5332         // result: (FMOVDload [off1+int32(off2)] {sym} ptr mem)
5333         for {
5334                 off1 := auxIntToInt32(v.AuxInt)
5335                 sym := auxToSym(v.Aux)
5336                 if v_0.Op != OpPPC64ADDconst {
5337                         break
5338                 }
5339                 off2 := auxIntToInt64(v_0.AuxInt)
5340                 ptr := v_0.Args[0]
5341                 mem := v_1
5342                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5343                         break
5344                 }
5345                 v.reset(OpPPC64FMOVDload)
5346                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5347                 v.Aux = symToAux(sym)
5348                 v.AddArg2(ptr, mem)
5349                 return true
5350         }
5351         return false
5352 }
5353 func rewriteValuePPC64_OpPPC64FMOVDstore(v *Value) bool {
5354         v_2 := v.Args[2]
5355         v_1 := v.Args[1]
5356         v_0 := v.Args[0]
5357         // match: (FMOVDstore [off] {sym} ptr (MTVSRD x) mem)
5358         // result: (MOVDstore [off] {sym} ptr x mem)
5359         for {
5360                 off := auxIntToInt32(v.AuxInt)
5361                 sym := auxToSym(v.Aux)
5362                 ptr := v_0
5363                 if v_1.Op != OpPPC64MTVSRD {
5364                         break
5365                 }
5366                 x := v_1.Args[0]
5367                 mem := v_2
5368                 v.reset(OpPPC64MOVDstore)
5369                 v.AuxInt = int32ToAuxInt(off)
5370                 v.Aux = symToAux(sym)
5371                 v.AddArg3(ptr, x, mem)
5372                 return true
5373         }
5374         // match: (FMOVDstore [off1] {sym} (ADDconst [off2] ptr) val mem)
5375         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
5376         // result: (FMOVDstore [off1+int32(off2)] {sym} ptr val mem)
5377         for {
5378                 off1 := auxIntToInt32(v.AuxInt)
5379                 sym := auxToSym(v.Aux)
5380                 if v_0.Op != OpPPC64ADDconst {
5381                         break
5382                 }
5383                 off2 := auxIntToInt64(v_0.AuxInt)
5384                 ptr := v_0.Args[0]
5385                 val := v_1
5386                 mem := v_2
5387                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5388                         break
5389                 }
5390                 v.reset(OpPPC64FMOVDstore)
5391                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5392                 v.Aux = symToAux(sym)
5393                 v.AddArg3(ptr, val, mem)
5394                 return true
5395         }
5396         // match: (FMOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
5397         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
5398         // result: (FMOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
5399         for {
5400                 off1 := auxIntToInt32(v.AuxInt)
5401                 sym1 := auxToSym(v.Aux)
5402                 p := v_0
5403                 if p.Op != OpPPC64MOVDaddr {
5404                         break
5405                 }
5406                 off2 := auxIntToInt32(p.AuxInt)
5407                 sym2 := auxToSym(p.Aux)
5408                 ptr := p.Args[0]
5409                 val := v_1
5410                 mem := v_2
5411                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5412                         break
5413                 }
5414                 v.reset(OpPPC64FMOVDstore)
5415                 v.AuxInt = int32ToAuxInt(off1 + off2)
5416                 v.Aux = symToAux(mergeSym(sym1, sym2))
5417                 v.AddArg3(ptr, val, mem)
5418                 return true
5419         }
5420         return false
5421 }
5422 func rewriteValuePPC64_OpPPC64FMOVSload(v *Value) bool {
5423         v_1 := v.Args[1]
5424         v_0 := v.Args[0]
5425         // match: (FMOVSload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
5426         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
5427         // result: (FMOVSload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
5428         for {
5429                 off1 := auxIntToInt32(v.AuxInt)
5430                 sym1 := auxToSym(v.Aux)
5431                 p := v_0
5432                 if p.Op != OpPPC64MOVDaddr {
5433                         break
5434                 }
5435                 off2 := auxIntToInt32(p.AuxInt)
5436                 sym2 := auxToSym(p.Aux)
5437                 ptr := p.Args[0]
5438                 mem := v_1
5439                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5440                         break
5441                 }
5442                 v.reset(OpPPC64FMOVSload)
5443                 v.AuxInt = int32ToAuxInt(off1 + off2)
5444                 v.Aux = symToAux(mergeSym(sym1, sym2))
5445                 v.AddArg2(ptr, mem)
5446                 return true
5447         }
5448         // match: (FMOVSload [off1] {sym} (ADDconst [off2] ptr) mem)
5449         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
5450         // result: (FMOVSload [off1+int32(off2)] {sym} ptr mem)
5451         for {
5452                 off1 := auxIntToInt32(v.AuxInt)
5453                 sym := auxToSym(v.Aux)
5454                 if v_0.Op != OpPPC64ADDconst {
5455                         break
5456                 }
5457                 off2 := auxIntToInt64(v_0.AuxInt)
5458                 ptr := v_0.Args[0]
5459                 mem := v_1
5460                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5461                         break
5462                 }
5463                 v.reset(OpPPC64FMOVSload)
5464                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5465                 v.Aux = symToAux(sym)
5466                 v.AddArg2(ptr, mem)
5467                 return true
5468         }
5469         return false
5470 }
5471 func rewriteValuePPC64_OpPPC64FMOVSstore(v *Value) bool {
5472         v_2 := v.Args[2]
5473         v_1 := v.Args[1]
5474         v_0 := v.Args[0]
5475         // match: (FMOVSstore [off1] {sym} (ADDconst [off2] ptr) val mem)
5476         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
5477         // result: (FMOVSstore [off1+int32(off2)] {sym} ptr val mem)
5478         for {
5479                 off1 := auxIntToInt32(v.AuxInt)
5480                 sym := auxToSym(v.Aux)
5481                 if v_0.Op != OpPPC64ADDconst {
5482                         break
5483                 }
5484                 off2 := auxIntToInt64(v_0.AuxInt)
5485                 ptr := v_0.Args[0]
5486                 val := v_1
5487                 mem := v_2
5488                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5489                         break
5490                 }
5491                 v.reset(OpPPC64FMOVSstore)
5492                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5493                 v.Aux = symToAux(sym)
5494                 v.AddArg3(ptr, val, mem)
5495                 return true
5496         }
5497         // match: (FMOVSstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
5498         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
5499         // result: (FMOVSstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
5500         for {
5501                 off1 := auxIntToInt32(v.AuxInt)
5502                 sym1 := auxToSym(v.Aux)
5503                 p := v_0
5504                 if p.Op != OpPPC64MOVDaddr {
5505                         break
5506                 }
5507                 off2 := auxIntToInt32(p.AuxInt)
5508                 sym2 := auxToSym(p.Aux)
5509                 ptr := p.Args[0]
5510                 val := v_1
5511                 mem := v_2
5512                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5513                         break
5514                 }
5515                 v.reset(OpPPC64FMOVSstore)
5516                 v.AuxInt = int32ToAuxInt(off1 + off2)
5517                 v.Aux = symToAux(mergeSym(sym1, sym2))
5518                 v.AddArg3(ptr, val, mem)
5519                 return true
5520         }
5521         return false
5522 }
5523 func rewriteValuePPC64_OpPPC64FNEG(v *Value) bool {
5524         v_0 := v.Args[0]
5525         // match: (FNEG (FABS x))
5526         // result: (FNABS x)
5527         for {
5528                 if v_0.Op != OpPPC64FABS {
5529                         break
5530                 }
5531                 x := v_0.Args[0]
5532                 v.reset(OpPPC64FNABS)
5533                 v.AddArg(x)
5534                 return true
5535         }
5536         // match: (FNEG (FNABS x))
5537         // result: (FABS x)
5538         for {
5539                 if v_0.Op != OpPPC64FNABS {
5540                         break
5541                 }
5542                 x := v_0.Args[0]
5543                 v.reset(OpPPC64FABS)
5544                 v.AddArg(x)
5545                 return true
5546         }
5547         return false
5548 }
5549 func rewriteValuePPC64_OpPPC64FSQRT(v *Value) bool {
5550         v_0 := v.Args[0]
5551         // match: (FSQRT (FMOVDconst [x]))
5552         // cond: x >= 0
5553         // result: (FMOVDconst [math.Sqrt(x)])
5554         for {
5555                 if v_0.Op != OpPPC64FMOVDconst {
5556                         break
5557                 }
5558                 x := auxIntToFloat64(v_0.AuxInt)
5559                 if !(x >= 0) {
5560                         break
5561                 }
5562                 v.reset(OpPPC64FMOVDconst)
5563                 v.AuxInt = float64ToAuxInt(math.Sqrt(x))
5564                 return true
5565         }
5566         return false
5567 }
5568 func rewriteValuePPC64_OpPPC64FSUB(v *Value) bool {
5569         v_1 := v.Args[1]
5570         v_0 := v.Args[0]
5571         // match: (FSUB (FMUL x y) z)
5572         // cond: x.Block.Func.useFMA(v)
5573         // result: (FMSUB x y z)
5574         for {
5575                 if v_0.Op != OpPPC64FMUL {
5576                         break
5577                 }
5578                 _ = v_0.Args[1]
5579                 v_0_0 := v_0.Args[0]
5580                 v_0_1 := v_0.Args[1]
5581                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
5582                         x := v_0_0
5583                         y := v_0_1
5584                         z := v_1
5585                         if !(x.Block.Func.useFMA(v)) {
5586                                 continue
5587                         }
5588                         v.reset(OpPPC64FMSUB)
5589                         v.AddArg3(x, y, z)
5590                         return true
5591                 }
5592                 break
5593         }
5594         return false
5595 }
5596 func rewriteValuePPC64_OpPPC64FSUBS(v *Value) bool {
5597         v_1 := v.Args[1]
5598         v_0 := v.Args[0]
5599         // match: (FSUBS (FMULS x y) z)
5600         // cond: x.Block.Func.useFMA(v)
5601         // result: (FMSUBS x y z)
5602         for {
5603                 if v_0.Op != OpPPC64FMULS {
5604                         break
5605                 }
5606                 _ = v_0.Args[1]
5607                 v_0_0 := v_0.Args[0]
5608                 v_0_1 := v_0.Args[1]
5609                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
5610                         x := v_0_0
5611                         y := v_0_1
5612                         z := v_1
5613                         if !(x.Block.Func.useFMA(v)) {
5614                                 continue
5615                         }
5616                         v.reset(OpPPC64FMSUBS)
5617                         v.AddArg3(x, y, z)
5618                         return true
5619                 }
5620                 break
5621         }
5622         return false
5623 }
5624 func rewriteValuePPC64_OpPPC64FTRUNC(v *Value) bool {
5625         v_0 := v.Args[0]
5626         // match: (FTRUNC (FMOVDconst [x]))
5627         // result: (FMOVDconst [math.Trunc(x)])
5628         for {
5629                 if v_0.Op != OpPPC64FMOVDconst {
5630                         break
5631                 }
5632                 x := auxIntToFloat64(v_0.AuxInt)
5633                 v.reset(OpPPC64FMOVDconst)
5634                 v.AuxInt = float64ToAuxInt(math.Trunc(x))
5635                 return true
5636         }
5637         return false
5638 }
5639 func rewriteValuePPC64_OpPPC64GreaterEqual(v *Value) bool {
5640         v_0 := v.Args[0]
5641         // match: (GreaterEqual (FlagEQ))
5642         // result: (MOVDconst [1])
5643         for {
5644                 if v_0.Op != OpPPC64FlagEQ {
5645                         break
5646                 }
5647                 v.reset(OpPPC64MOVDconst)
5648                 v.AuxInt = int64ToAuxInt(1)
5649                 return true
5650         }
5651         // match: (GreaterEqual (FlagLT))
5652         // result: (MOVDconst [0])
5653         for {
5654                 if v_0.Op != OpPPC64FlagLT {
5655                         break
5656                 }
5657                 v.reset(OpPPC64MOVDconst)
5658                 v.AuxInt = int64ToAuxInt(0)
5659                 return true
5660         }
5661         // match: (GreaterEqual (FlagGT))
5662         // result: (MOVDconst [1])
5663         for {
5664                 if v_0.Op != OpPPC64FlagGT {
5665                         break
5666                 }
5667                 v.reset(OpPPC64MOVDconst)
5668                 v.AuxInt = int64ToAuxInt(1)
5669                 return true
5670         }
5671         // match: (GreaterEqual (InvertFlags x))
5672         // result: (LessEqual x)
5673         for {
5674                 if v_0.Op != OpPPC64InvertFlags {
5675                         break
5676                 }
5677                 x := v_0.Args[0]
5678                 v.reset(OpPPC64LessEqual)
5679                 v.AddArg(x)
5680                 return true
5681         }
5682         // match: (GreaterEqual cmp)
5683         // result: (SETBCR [0] cmp)
5684         for {
5685                 cmp := v_0
5686                 v.reset(OpPPC64SETBCR)
5687                 v.AuxInt = int32ToAuxInt(0)
5688                 v.AddArg(cmp)
5689                 return true
5690         }
5691 }
5692 func rewriteValuePPC64_OpPPC64GreaterThan(v *Value) bool {
5693         v_0 := v.Args[0]
5694         // match: (GreaterThan (FlagEQ))
5695         // result: (MOVDconst [0])
5696         for {
5697                 if v_0.Op != OpPPC64FlagEQ {
5698                         break
5699                 }
5700                 v.reset(OpPPC64MOVDconst)
5701                 v.AuxInt = int64ToAuxInt(0)
5702                 return true
5703         }
5704         // match: (GreaterThan (FlagLT))
5705         // result: (MOVDconst [0])
5706         for {
5707                 if v_0.Op != OpPPC64FlagLT {
5708                         break
5709                 }
5710                 v.reset(OpPPC64MOVDconst)
5711                 v.AuxInt = int64ToAuxInt(0)
5712                 return true
5713         }
5714         // match: (GreaterThan (FlagGT))
5715         // result: (MOVDconst [1])
5716         for {
5717                 if v_0.Op != OpPPC64FlagGT {
5718                         break
5719                 }
5720                 v.reset(OpPPC64MOVDconst)
5721                 v.AuxInt = int64ToAuxInt(1)
5722                 return true
5723         }
5724         // match: (GreaterThan (InvertFlags x))
5725         // result: (LessThan x)
5726         for {
5727                 if v_0.Op != OpPPC64InvertFlags {
5728                         break
5729                 }
5730                 x := v_0.Args[0]
5731                 v.reset(OpPPC64LessThan)
5732                 v.AddArg(x)
5733                 return true
5734         }
5735         // match: (GreaterThan cmp)
5736         // result: (SETBC [1] cmp)
5737         for {
5738                 cmp := v_0
5739                 v.reset(OpPPC64SETBC)
5740                 v.AuxInt = int32ToAuxInt(1)
5741                 v.AddArg(cmp)
5742                 return true
5743         }
5744 }
5745 func rewriteValuePPC64_OpPPC64ISEL(v *Value) bool {
5746         v_2 := v.Args[2]
5747         v_1 := v.Args[1]
5748         v_0 := v.Args[0]
5749         b := v.Block
5750         typ := &b.Func.Config.Types
5751         // match: (ISEL [6] x y (Select1 (ANDCCconst [1] (SETBC [c] cmp))))
5752         // result: (ISEL [c] x y cmp)
5753         for {
5754                 if auxIntToInt32(v.AuxInt) != 6 {
5755                         break
5756                 }
5757                 x := v_0
5758                 y := v_1
5759                 if v_2.Op != OpSelect1 {
5760                         break
5761                 }
5762                 v_2_0 := v_2.Args[0]
5763                 if v_2_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_2_0.AuxInt) != 1 {
5764                         break
5765                 }
5766                 v_2_0_0 := v_2_0.Args[0]
5767                 if v_2_0_0.Op != OpPPC64SETBC {
5768                         break
5769                 }
5770                 c := auxIntToInt32(v_2_0_0.AuxInt)
5771                 cmp := v_2_0_0.Args[0]
5772                 v.reset(OpPPC64ISEL)
5773                 v.AuxInt = int32ToAuxInt(c)
5774                 v.AddArg3(x, y, cmp)
5775                 return true
5776         }
5777         // match: (ISEL [6] x y (CMPconst [0] (SETBC [c] cmp)))
5778         // result: (ISEL [c] x y cmp)
5779         for {
5780                 if auxIntToInt32(v.AuxInt) != 6 {
5781                         break
5782                 }
5783                 x := v_0
5784                 y := v_1
5785                 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
5786                         break
5787                 }
5788                 v_2_0 := v_2.Args[0]
5789                 if v_2_0.Op != OpPPC64SETBC {
5790                         break
5791                 }
5792                 c := auxIntToInt32(v_2_0.AuxInt)
5793                 cmp := v_2_0.Args[0]
5794                 v.reset(OpPPC64ISEL)
5795                 v.AuxInt = int32ToAuxInt(c)
5796                 v.AddArg3(x, y, cmp)
5797                 return true
5798         }
5799         // match: (ISEL [6] x y (CMPWconst [0] (SETBC [c] cmp)))
5800         // result: (ISEL [c] x y cmp)
5801         for {
5802                 if auxIntToInt32(v.AuxInt) != 6 {
5803                         break
5804                 }
5805                 x := v_0
5806                 y := v_1
5807                 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
5808                         break
5809                 }
5810                 v_2_0 := v_2.Args[0]
5811                 if v_2_0.Op != OpPPC64SETBC {
5812                         break
5813                 }
5814                 c := auxIntToInt32(v_2_0.AuxInt)
5815                 cmp := v_2_0.Args[0]
5816                 v.reset(OpPPC64ISEL)
5817                 v.AuxInt = int32ToAuxInt(c)
5818                 v.AddArg3(x, y, cmp)
5819                 return true
5820         }
5821         // match: (ISEL [6] x y (CMPconst [0] (SETBCR [c] cmp)))
5822         // result: (ISEL [c+4] x y cmp)
5823         for {
5824                 if auxIntToInt32(v.AuxInt) != 6 {
5825                         break
5826                 }
5827                 x := v_0
5828                 y := v_1
5829                 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
5830                         break
5831                 }
5832                 v_2_0 := v_2.Args[0]
5833                 if v_2_0.Op != OpPPC64SETBCR {
5834                         break
5835                 }
5836                 c := auxIntToInt32(v_2_0.AuxInt)
5837                 cmp := v_2_0.Args[0]
5838                 v.reset(OpPPC64ISEL)
5839                 v.AuxInt = int32ToAuxInt(c + 4)
5840                 v.AddArg3(x, y, cmp)
5841                 return true
5842         }
5843         // match: (ISEL [6] x y (CMPWconst [0] (SETBCR [c] cmp)))
5844         // result: (ISEL [c+4] x y cmp)
5845         for {
5846                 if auxIntToInt32(v.AuxInt) != 6 {
5847                         break
5848                 }
5849                 x := v_0
5850                 y := v_1
5851                 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
5852                         break
5853                 }
5854                 v_2_0 := v_2.Args[0]
5855                 if v_2_0.Op != OpPPC64SETBCR {
5856                         break
5857                 }
5858                 c := auxIntToInt32(v_2_0.AuxInt)
5859                 cmp := v_2_0.Args[0]
5860                 v.reset(OpPPC64ISEL)
5861                 v.AuxInt = int32ToAuxInt(c + 4)
5862                 v.AddArg3(x, y, cmp)
5863                 return true
5864         }
5865         // match: (ISEL [2] x _ (FlagEQ))
5866         // result: x
5867         for {
5868                 if auxIntToInt32(v.AuxInt) != 2 {
5869                         break
5870                 }
5871                 x := v_0
5872                 if v_2.Op != OpPPC64FlagEQ {
5873                         break
5874                 }
5875                 v.copyOf(x)
5876                 return true
5877         }
5878         // match: (ISEL [2] _ y (FlagLT))
5879         // result: y
5880         for {
5881                 if auxIntToInt32(v.AuxInt) != 2 {
5882                         break
5883                 }
5884                 y := v_1
5885                 if v_2.Op != OpPPC64FlagLT {
5886                         break
5887                 }
5888                 v.copyOf(y)
5889                 return true
5890         }
5891         // match: (ISEL [2] _ y (FlagGT))
5892         // result: y
5893         for {
5894                 if auxIntToInt32(v.AuxInt) != 2 {
5895                         break
5896                 }
5897                 y := v_1
5898                 if v_2.Op != OpPPC64FlagGT {
5899                         break
5900                 }
5901                 v.copyOf(y)
5902                 return true
5903         }
5904         // match: (ISEL [6] _ y (FlagEQ))
5905         // result: y
5906         for {
5907                 if auxIntToInt32(v.AuxInt) != 6 {
5908                         break
5909                 }
5910                 y := v_1
5911                 if v_2.Op != OpPPC64FlagEQ {
5912                         break
5913                 }
5914                 v.copyOf(y)
5915                 return true
5916         }
5917         // match: (ISEL [6] x _ (FlagLT))
5918         // result: x
5919         for {
5920                 if auxIntToInt32(v.AuxInt) != 6 {
5921                         break
5922                 }
5923                 x := v_0
5924                 if v_2.Op != OpPPC64FlagLT {
5925                         break
5926                 }
5927                 v.copyOf(x)
5928                 return true
5929         }
5930         // match: (ISEL [6] x _ (FlagGT))
5931         // result: x
5932         for {
5933                 if auxIntToInt32(v.AuxInt) != 6 {
5934                         break
5935                 }
5936                 x := v_0
5937                 if v_2.Op != OpPPC64FlagGT {
5938                         break
5939                 }
5940                 v.copyOf(x)
5941                 return true
5942         }
5943         // match: (ISEL [0] _ y (FlagEQ))
5944         // result: y
5945         for {
5946                 if auxIntToInt32(v.AuxInt) != 0 {
5947                         break
5948                 }
5949                 y := v_1
5950                 if v_2.Op != OpPPC64FlagEQ {
5951                         break
5952                 }
5953                 v.copyOf(y)
5954                 return true
5955         }
5956         // match: (ISEL [0] _ y (FlagGT))
5957         // result: y
5958         for {
5959                 if auxIntToInt32(v.AuxInt) != 0 {
5960                         break
5961                 }
5962                 y := v_1
5963                 if v_2.Op != OpPPC64FlagGT {
5964                         break
5965                 }
5966                 v.copyOf(y)
5967                 return true
5968         }
5969         // match: (ISEL [0] x _ (FlagLT))
5970         // result: x
5971         for {
5972                 if auxIntToInt32(v.AuxInt) != 0 {
5973                         break
5974                 }
5975                 x := v_0
5976                 if v_2.Op != OpPPC64FlagLT {
5977                         break
5978                 }
5979                 v.copyOf(x)
5980                 return true
5981         }
5982         // match: (ISEL [5] _ x (FlagEQ))
5983         // result: x
5984         for {
5985                 if auxIntToInt32(v.AuxInt) != 5 {
5986                         break
5987                 }
5988                 x := v_1
5989                 if v_2.Op != OpPPC64FlagEQ {
5990                         break
5991                 }
5992                 v.copyOf(x)
5993                 return true
5994         }
5995         // match: (ISEL [5] _ x (FlagLT))
5996         // result: x
5997         for {
5998                 if auxIntToInt32(v.AuxInt) != 5 {
5999                         break
6000                 }
6001                 x := v_1
6002                 if v_2.Op != OpPPC64FlagLT {
6003                         break
6004                 }
6005                 v.copyOf(x)
6006                 return true
6007         }
6008         // match: (ISEL [5] y _ (FlagGT))
6009         // result: y
6010         for {
6011                 if auxIntToInt32(v.AuxInt) != 5 {
6012                         break
6013                 }
6014                 y := v_0
6015                 if v_2.Op != OpPPC64FlagGT {
6016                         break
6017                 }
6018                 v.copyOf(y)
6019                 return true
6020         }
6021         // match: (ISEL [1] _ y (FlagEQ))
6022         // result: y
6023         for {
6024                 if auxIntToInt32(v.AuxInt) != 1 {
6025                         break
6026                 }
6027                 y := v_1
6028                 if v_2.Op != OpPPC64FlagEQ {
6029                         break
6030                 }
6031                 v.copyOf(y)
6032                 return true
6033         }
6034         // match: (ISEL [1] _ y (FlagLT))
6035         // result: y
6036         for {
6037                 if auxIntToInt32(v.AuxInt) != 1 {
6038                         break
6039                 }
6040                 y := v_1
6041                 if v_2.Op != OpPPC64FlagLT {
6042                         break
6043                 }
6044                 v.copyOf(y)
6045                 return true
6046         }
6047         // match: (ISEL [1] x _ (FlagGT))
6048         // result: x
6049         for {
6050                 if auxIntToInt32(v.AuxInt) != 1 {
6051                         break
6052                 }
6053                 x := v_0
6054                 if v_2.Op != OpPPC64FlagGT {
6055                         break
6056                 }
6057                 v.copyOf(x)
6058                 return true
6059         }
6060         // match: (ISEL [4] x _ (FlagEQ))
6061         // result: x
6062         for {
6063                 if auxIntToInt32(v.AuxInt) != 4 {
6064                         break
6065                 }
6066                 x := v_0
6067                 if v_2.Op != OpPPC64FlagEQ {
6068                         break
6069                 }
6070                 v.copyOf(x)
6071                 return true
6072         }
6073         // match: (ISEL [4] x _ (FlagGT))
6074         // result: x
6075         for {
6076                 if auxIntToInt32(v.AuxInt) != 4 {
6077                         break
6078                 }
6079                 x := v_0
6080                 if v_2.Op != OpPPC64FlagGT {
6081                         break
6082                 }
6083                 v.copyOf(x)
6084                 return true
6085         }
6086         // match: (ISEL [4] _ y (FlagLT))
6087         // result: y
6088         for {
6089                 if auxIntToInt32(v.AuxInt) != 4 {
6090                         break
6091                 }
6092                 y := v_1
6093                 if v_2.Op != OpPPC64FlagLT {
6094                         break
6095                 }
6096                 v.copyOf(y)
6097                 return true
6098         }
6099         // match: (ISEL [2] x y (CMPconst [0] (Select0 (ANDCCconst [n] z))))
6100         // result: (ISEL [2] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6101         for {
6102                 if auxIntToInt32(v.AuxInt) != 2 {
6103                         break
6104                 }
6105                 x := v_0
6106                 y := v_1
6107                 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
6108                         break
6109                 }
6110                 v_2_0 := v_2.Args[0]
6111                 if v_2_0.Op != OpSelect0 {
6112                         break
6113                 }
6114                 v_2_0_0 := v_2_0.Args[0]
6115                 if v_2_0_0.Op != OpPPC64ANDCCconst {
6116                         break
6117                 }
6118                 n := auxIntToInt64(v_2_0_0.AuxInt)
6119                 z := v_2_0_0.Args[0]
6120                 v.reset(OpPPC64ISEL)
6121                 v.AuxInt = int32ToAuxInt(2)
6122                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
6123                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
6124                 v1.AuxInt = int64ToAuxInt(n)
6125                 v1.AddArg(z)
6126                 v0.AddArg(v1)
6127                 v.AddArg3(x, y, v0)
6128                 return true
6129         }
6130         // match: (ISEL [2] x y (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
6131         // result: (ISEL [2] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6132         for {
6133                 if auxIntToInt32(v.AuxInt) != 2 {
6134                         break
6135                 }
6136                 x := v_0
6137                 y := v_1
6138                 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
6139                         break
6140                 }
6141                 v_2_0 := v_2.Args[0]
6142                 if v_2_0.Op != OpSelect0 {
6143                         break
6144                 }
6145                 v_2_0_0 := v_2_0.Args[0]
6146                 if v_2_0_0.Op != OpPPC64ANDCCconst {
6147                         break
6148                 }
6149                 n := auxIntToInt64(v_2_0_0.AuxInt)
6150                 z := v_2_0_0.Args[0]
6151                 v.reset(OpPPC64ISEL)
6152                 v.AuxInt = int32ToAuxInt(2)
6153                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
6154                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
6155                 v1.AuxInt = int64ToAuxInt(n)
6156                 v1.AddArg(z)
6157                 v0.AddArg(v1)
6158                 v.AddArg3(x, y, v0)
6159                 return true
6160         }
6161         // match: (ISEL [6] x y (CMPconst [0] (Select0 (ANDCCconst [n] z))))
6162         // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6163         for {
6164                 if auxIntToInt32(v.AuxInt) != 6 {
6165                         break
6166                 }
6167                 x := v_0
6168                 y := v_1
6169                 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
6170                         break
6171                 }
6172                 v_2_0 := v_2.Args[0]
6173                 if v_2_0.Op != OpSelect0 {
6174                         break
6175                 }
6176                 v_2_0_0 := v_2_0.Args[0]
6177                 if v_2_0_0.Op != OpPPC64ANDCCconst {
6178                         break
6179                 }
6180                 n := auxIntToInt64(v_2_0_0.AuxInt)
6181                 z := v_2_0_0.Args[0]
6182                 v.reset(OpPPC64ISEL)
6183                 v.AuxInt = int32ToAuxInt(6)
6184                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
6185                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
6186                 v1.AuxInt = int64ToAuxInt(n)
6187                 v1.AddArg(z)
6188                 v0.AddArg(v1)
6189                 v.AddArg3(x, y, v0)
6190                 return true
6191         }
6192         // match: (ISEL [6] x y (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
6193         // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6194         for {
6195                 if auxIntToInt32(v.AuxInt) != 6 {
6196                         break
6197                 }
6198                 x := v_0
6199                 y := v_1
6200                 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
6201                         break
6202                 }
6203                 v_2_0 := v_2.Args[0]
6204                 if v_2_0.Op != OpSelect0 {
6205                         break
6206                 }
6207                 v_2_0_0 := v_2_0.Args[0]
6208                 if v_2_0_0.Op != OpPPC64ANDCCconst {
6209                         break
6210                 }
6211                 n := auxIntToInt64(v_2_0_0.AuxInt)
6212                 z := v_2_0_0.Args[0]
6213                 v.reset(OpPPC64ISEL)
6214                 v.AuxInt = int32ToAuxInt(6)
6215                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
6216                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
6217                 v1.AuxInt = int64ToAuxInt(n)
6218                 v1.AddArg(z)
6219                 v0.AddArg(v1)
6220                 v.AddArg3(x, y, v0)
6221                 return true
6222         }
6223         // match: (ISEL [n] x y (InvertFlags bool))
6224         // cond: n%4 == 0
6225         // result: (ISEL [n+1] x y bool)
6226         for {
6227                 n := auxIntToInt32(v.AuxInt)
6228                 x := v_0
6229                 y := v_1
6230                 if v_2.Op != OpPPC64InvertFlags {
6231                         break
6232                 }
6233                 bool := v_2.Args[0]
6234                 if !(n%4 == 0) {
6235                         break
6236                 }
6237                 v.reset(OpPPC64ISEL)
6238                 v.AuxInt = int32ToAuxInt(n + 1)
6239                 v.AddArg3(x, y, bool)
6240                 return true
6241         }
6242         // match: (ISEL [n] x y (InvertFlags bool))
6243         // cond: n%4 == 1
6244         // result: (ISEL [n-1] x y bool)
6245         for {
6246                 n := auxIntToInt32(v.AuxInt)
6247                 x := v_0
6248                 y := v_1
6249                 if v_2.Op != OpPPC64InvertFlags {
6250                         break
6251                 }
6252                 bool := v_2.Args[0]
6253                 if !(n%4 == 1) {
6254                         break
6255                 }
6256                 v.reset(OpPPC64ISEL)
6257                 v.AuxInt = int32ToAuxInt(n - 1)
6258                 v.AddArg3(x, y, bool)
6259                 return true
6260         }
6261         // match: (ISEL [n] x y (InvertFlags bool))
6262         // cond: n%4 == 2
6263         // result: (ISEL [n] x y bool)
6264         for {
6265                 n := auxIntToInt32(v.AuxInt)
6266                 x := v_0
6267                 y := v_1
6268                 if v_2.Op != OpPPC64InvertFlags {
6269                         break
6270                 }
6271                 bool := v_2.Args[0]
6272                 if !(n%4 == 2) {
6273                         break
6274                 }
6275                 v.reset(OpPPC64ISEL)
6276                 v.AuxInt = int32ToAuxInt(n)
6277                 v.AddArg3(x, y, bool)
6278                 return true
6279         }
6280         return false
6281 }
6282 func rewriteValuePPC64_OpPPC64LessEqual(v *Value) bool {
6283         v_0 := v.Args[0]
6284         // match: (LessEqual (FlagEQ))
6285         // result: (MOVDconst [1])
6286         for {
6287                 if v_0.Op != OpPPC64FlagEQ {
6288                         break
6289                 }
6290                 v.reset(OpPPC64MOVDconst)
6291                 v.AuxInt = int64ToAuxInt(1)
6292                 return true
6293         }
6294         // match: (LessEqual (FlagLT))
6295         // result: (MOVDconst [1])
6296         for {
6297                 if v_0.Op != OpPPC64FlagLT {
6298                         break
6299                 }
6300                 v.reset(OpPPC64MOVDconst)
6301                 v.AuxInt = int64ToAuxInt(1)
6302                 return true
6303         }
6304         // match: (LessEqual (FlagGT))
6305         // result: (MOVDconst [0])
6306         for {
6307                 if v_0.Op != OpPPC64FlagGT {
6308                         break
6309                 }
6310                 v.reset(OpPPC64MOVDconst)
6311                 v.AuxInt = int64ToAuxInt(0)
6312                 return true
6313         }
6314         // match: (LessEqual (InvertFlags x))
6315         // result: (GreaterEqual x)
6316         for {
6317                 if v_0.Op != OpPPC64InvertFlags {
6318                         break
6319                 }
6320                 x := v_0.Args[0]
6321                 v.reset(OpPPC64GreaterEqual)
6322                 v.AddArg(x)
6323                 return true
6324         }
6325         // match: (LessEqual cmp)
6326         // result: (SETBCR [1] cmp)
6327         for {
6328                 cmp := v_0
6329                 v.reset(OpPPC64SETBCR)
6330                 v.AuxInt = int32ToAuxInt(1)
6331                 v.AddArg(cmp)
6332                 return true
6333         }
6334 }
6335 func rewriteValuePPC64_OpPPC64LessThan(v *Value) bool {
6336         v_0 := v.Args[0]
6337         // match: (LessThan (FlagEQ))
6338         // result: (MOVDconst [0])
6339         for {
6340                 if v_0.Op != OpPPC64FlagEQ {
6341                         break
6342                 }
6343                 v.reset(OpPPC64MOVDconst)
6344                 v.AuxInt = int64ToAuxInt(0)
6345                 return true
6346         }
6347         // match: (LessThan (FlagLT))
6348         // result: (MOVDconst [1])
6349         for {
6350                 if v_0.Op != OpPPC64FlagLT {
6351                         break
6352                 }
6353                 v.reset(OpPPC64MOVDconst)
6354                 v.AuxInt = int64ToAuxInt(1)
6355                 return true
6356         }
6357         // match: (LessThan (FlagGT))
6358         // result: (MOVDconst [0])
6359         for {
6360                 if v_0.Op != OpPPC64FlagGT {
6361                         break
6362                 }
6363                 v.reset(OpPPC64MOVDconst)
6364                 v.AuxInt = int64ToAuxInt(0)
6365                 return true
6366         }
6367         // match: (LessThan (InvertFlags x))
6368         // result: (GreaterThan x)
6369         for {
6370                 if v_0.Op != OpPPC64InvertFlags {
6371                         break
6372                 }
6373                 x := v_0.Args[0]
6374                 v.reset(OpPPC64GreaterThan)
6375                 v.AddArg(x)
6376                 return true
6377         }
6378         // match: (LessThan cmp)
6379         // result: (SETBC [0] cmp)
6380         for {
6381                 cmp := v_0
6382                 v.reset(OpPPC64SETBC)
6383                 v.AuxInt = int32ToAuxInt(0)
6384                 v.AddArg(cmp)
6385                 return true
6386         }
6387 }
6388 func rewriteValuePPC64_OpPPC64MFVSRD(v *Value) bool {
6389         v_0 := v.Args[0]
6390         b := v.Block
6391         typ := &b.Func.Config.Types
6392         // match: (MFVSRD (FMOVDconst [c]))
6393         // result: (MOVDconst [int64(math.Float64bits(c))])
6394         for {
6395                 if v_0.Op != OpPPC64FMOVDconst {
6396                         break
6397                 }
6398                 c := auxIntToFloat64(v_0.AuxInt)
6399                 v.reset(OpPPC64MOVDconst)
6400                 v.AuxInt = int64ToAuxInt(int64(math.Float64bits(c)))
6401                 return true
6402         }
6403         // match: (MFVSRD x:(FMOVDload [off] {sym} ptr mem))
6404         // cond: x.Uses == 1 && clobber(x)
6405         // result: @x.Block (MOVDload [off] {sym} ptr mem)
6406         for {
6407                 x := v_0
6408                 if x.Op != OpPPC64FMOVDload {
6409                         break
6410                 }
6411                 off := auxIntToInt32(x.AuxInt)
6412                 sym := auxToSym(x.Aux)
6413                 mem := x.Args[1]
6414                 ptr := x.Args[0]
6415                 if !(x.Uses == 1 && clobber(x)) {
6416                         break
6417                 }
6418                 b = x.Block
6419                 v0 := b.NewValue0(x.Pos, OpPPC64MOVDload, typ.Int64)
6420                 v.copyOf(v0)
6421                 v0.AuxInt = int32ToAuxInt(off)
6422                 v0.Aux = symToAux(sym)
6423                 v0.AddArg2(ptr, mem)
6424                 return true
6425         }
6426         return false
6427 }
6428 func rewriteValuePPC64_OpPPC64MOVBZload(v *Value) bool {
6429         v_1 := v.Args[1]
6430         v_0 := v.Args[0]
6431         // match: (MOVBZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
6432         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
6433         // result: (MOVBZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
6434         for {
6435                 off1 := auxIntToInt32(v.AuxInt)
6436                 sym1 := auxToSym(v.Aux)
6437                 p := v_0
6438                 if p.Op != OpPPC64MOVDaddr {
6439                         break
6440                 }
6441                 off2 := auxIntToInt32(p.AuxInt)
6442                 sym2 := auxToSym(p.Aux)
6443                 ptr := p.Args[0]
6444                 mem := v_1
6445                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
6446                         break
6447                 }
6448                 v.reset(OpPPC64MOVBZload)
6449                 v.AuxInt = int32ToAuxInt(off1 + off2)
6450                 v.Aux = symToAux(mergeSym(sym1, sym2))
6451                 v.AddArg2(ptr, mem)
6452                 return true
6453         }
6454         // match: (MOVBZload [off1] {sym} (ADDconst [off2] x) mem)
6455         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
6456         // result: (MOVBZload [off1+int32(off2)] {sym} x mem)
6457         for {
6458                 off1 := auxIntToInt32(v.AuxInt)
6459                 sym := auxToSym(v.Aux)
6460                 if v_0.Op != OpPPC64ADDconst {
6461                         break
6462                 }
6463                 off2 := auxIntToInt64(v_0.AuxInt)
6464                 x := v_0.Args[0]
6465                 mem := v_1
6466                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
6467                         break
6468                 }
6469                 v.reset(OpPPC64MOVBZload)
6470                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
6471                 v.Aux = symToAux(sym)
6472                 v.AddArg2(x, mem)
6473                 return true
6474         }
6475         // match: (MOVBZload [0] {sym} p:(ADD ptr idx) mem)
6476         // cond: sym == nil && p.Uses == 1
6477         // result: (MOVBZloadidx ptr idx mem)
6478         for {
6479                 if auxIntToInt32(v.AuxInt) != 0 {
6480                         break
6481                 }
6482                 sym := auxToSym(v.Aux)
6483                 p := v_0
6484                 if p.Op != OpPPC64ADD {
6485                         break
6486                 }
6487                 idx := p.Args[1]
6488                 ptr := p.Args[0]
6489                 mem := v_1
6490                 if !(sym == nil && p.Uses == 1) {
6491                         break
6492                 }
6493                 v.reset(OpPPC64MOVBZloadidx)
6494                 v.AddArg3(ptr, idx, mem)
6495                 return true
6496         }
6497         return false
6498 }
6499 func rewriteValuePPC64_OpPPC64MOVBZloadidx(v *Value) bool {
6500         v_2 := v.Args[2]
6501         v_1 := v.Args[1]
6502         v_0 := v.Args[0]
6503         // match: (MOVBZloadidx ptr (MOVDconst [c]) mem)
6504         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
6505         // result: (MOVBZload [int32(c)] ptr mem)
6506         for {
6507                 ptr := v_0
6508                 if v_1.Op != OpPPC64MOVDconst {
6509                         break
6510                 }
6511                 c := auxIntToInt64(v_1.AuxInt)
6512                 mem := v_2
6513                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
6514                         break
6515                 }
6516                 v.reset(OpPPC64MOVBZload)
6517                 v.AuxInt = int32ToAuxInt(int32(c))
6518                 v.AddArg2(ptr, mem)
6519                 return true
6520         }
6521         // match: (MOVBZloadidx (MOVDconst [c]) ptr mem)
6522         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
6523         // result: (MOVBZload [int32(c)] ptr mem)
6524         for {
6525                 if v_0.Op != OpPPC64MOVDconst {
6526                         break
6527                 }
6528                 c := auxIntToInt64(v_0.AuxInt)
6529                 ptr := v_1
6530                 mem := v_2
6531                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
6532                         break
6533                 }
6534                 v.reset(OpPPC64MOVBZload)
6535                 v.AuxInt = int32ToAuxInt(int32(c))
6536                 v.AddArg2(ptr, mem)
6537                 return true
6538         }
6539         return false
6540 }
6541 func rewriteValuePPC64_OpPPC64MOVBZreg(v *Value) bool {
6542         v_0 := v.Args[0]
6543         b := v.Block
6544         typ := &b.Func.Config.Types
6545         // match: (MOVBZreg y:(Select0 (ANDCCconst [c] _)))
6546         // cond: uint64(c) <= 0xFF
6547         // result: y
6548         for {
6549                 y := v_0
6550                 if y.Op != OpSelect0 {
6551                         break
6552                 }
6553                 y_0 := y.Args[0]
6554                 if y_0.Op != OpPPC64ANDCCconst {
6555                         break
6556                 }
6557                 c := auxIntToInt64(y_0.AuxInt)
6558                 if !(uint64(c) <= 0xFF) {
6559                         break
6560                 }
6561                 v.copyOf(y)
6562                 return true
6563         }
6564         // match: (MOVBZreg (SRWconst [c] (MOVBZreg x)))
6565         // result: (SRWconst [c] (MOVBZreg x))
6566         for {
6567                 if v_0.Op != OpPPC64SRWconst {
6568                         break
6569                 }
6570                 c := auxIntToInt64(v_0.AuxInt)
6571                 v_0_0 := v_0.Args[0]
6572                 if v_0_0.Op != OpPPC64MOVBZreg {
6573                         break
6574                 }
6575                 x := v_0_0.Args[0]
6576                 v.reset(OpPPC64SRWconst)
6577                 v.AuxInt = int64ToAuxInt(c)
6578                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
6579                 v0.AddArg(x)
6580                 v.AddArg(v0)
6581                 return true
6582         }
6583         // match: (MOVBZreg (SRWconst [c] x))
6584         // cond: sizeof(x.Type) == 8
6585         // result: (SRWconst [c] x)
6586         for {
6587                 if v_0.Op != OpPPC64SRWconst {
6588                         break
6589                 }
6590                 c := auxIntToInt64(v_0.AuxInt)
6591                 x := v_0.Args[0]
6592                 if !(sizeof(x.Type) == 8) {
6593                         break
6594                 }
6595                 v.reset(OpPPC64SRWconst)
6596                 v.AuxInt = int64ToAuxInt(c)
6597                 v.AddArg(x)
6598                 return true
6599         }
6600         // match: (MOVBZreg (SRDconst [c] x))
6601         // cond: c>=56
6602         // result: (SRDconst [c] x)
6603         for {
6604                 if v_0.Op != OpPPC64SRDconst {
6605                         break
6606                 }
6607                 c := auxIntToInt64(v_0.AuxInt)
6608                 x := v_0.Args[0]
6609                 if !(c >= 56) {
6610                         break
6611                 }
6612                 v.reset(OpPPC64SRDconst)
6613                 v.AuxInt = int64ToAuxInt(c)
6614                 v.AddArg(x)
6615                 return true
6616         }
6617         // match: (MOVBZreg (SRWconst [c] x))
6618         // cond: c>=24
6619         // result: (SRWconst [c] x)
6620         for {
6621                 if v_0.Op != OpPPC64SRWconst {
6622                         break
6623                 }
6624                 c := auxIntToInt64(v_0.AuxInt)
6625                 x := v_0.Args[0]
6626                 if !(c >= 24) {
6627                         break
6628                 }
6629                 v.reset(OpPPC64SRWconst)
6630                 v.AuxInt = int64ToAuxInt(c)
6631                 v.AddArg(x)
6632                 return true
6633         }
6634         // match: (MOVBZreg y:(MOVBZreg _))
6635         // result: y
6636         for {
6637                 y := v_0
6638                 if y.Op != OpPPC64MOVBZreg {
6639                         break
6640                 }
6641                 v.copyOf(y)
6642                 return true
6643         }
6644         // match: (MOVBZreg (MOVBreg x))
6645         // result: (MOVBZreg x)
6646         for {
6647                 if v_0.Op != OpPPC64MOVBreg {
6648                         break
6649                 }
6650                 x := v_0.Args[0]
6651                 v.reset(OpPPC64MOVBZreg)
6652                 v.AddArg(x)
6653                 return true
6654         }
6655         // match: (MOVBZreg (OR <t> x (MOVWZreg y)))
6656         // result: (MOVBZreg (OR <t> x y))
6657         for {
6658                 if v_0.Op != OpPPC64OR {
6659                         break
6660                 }
6661                 t := v_0.Type
6662                 _ = v_0.Args[1]
6663                 v_0_0 := v_0.Args[0]
6664                 v_0_1 := v_0.Args[1]
6665                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6666                         x := v_0_0
6667                         if v_0_1.Op != OpPPC64MOVWZreg {
6668                                 continue
6669                         }
6670                         y := v_0_1.Args[0]
6671                         v.reset(OpPPC64MOVBZreg)
6672                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6673                         v0.AddArg2(x, y)
6674                         v.AddArg(v0)
6675                         return true
6676                 }
6677                 break
6678         }
6679         // match: (MOVBZreg (XOR <t> x (MOVWZreg y)))
6680         // result: (MOVBZreg (XOR <t> x y))
6681         for {
6682                 if v_0.Op != OpPPC64XOR {
6683                         break
6684                 }
6685                 t := v_0.Type
6686                 _ = v_0.Args[1]
6687                 v_0_0 := v_0.Args[0]
6688                 v_0_1 := v_0.Args[1]
6689                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6690                         x := v_0_0
6691                         if v_0_1.Op != OpPPC64MOVWZreg {
6692                                 continue
6693                         }
6694                         y := v_0_1.Args[0]
6695                         v.reset(OpPPC64MOVBZreg)
6696                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6697                         v0.AddArg2(x, y)
6698                         v.AddArg(v0)
6699                         return true
6700                 }
6701                 break
6702         }
6703         // match: (MOVBZreg (AND <t> x (MOVWZreg y)))
6704         // result: (MOVBZreg (AND <t> x y))
6705         for {
6706                 if v_0.Op != OpPPC64AND {
6707                         break
6708                 }
6709                 t := v_0.Type
6710                 _ = v_0.Args[1]
6711                 v_0_0 := v_0.Args[0]
6712                 v_0_1 := v_0.Args[1]
6713                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6714                         x := v_0_0
6715                         if v_0_1.Op != OpPPC64MOVWZreg {
6716                                 continue
6717                         }
6718                         y := v_0_1.Args[0]
6719                         v.reset(OpPPC64MOVBZreg)
6720                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6721                         v0.AddArg2(x, y)
6722                         v.AddArg(v0)
6723                         return true
6724                 }
6725                 break
6726         }
6727         // match: (MOVBZreg (OR <t> x (MOVHZreg y)))
6728         // result: (MOVBZreg (OR <t> x y))
6729         for {
6730                 if v_0.Op != OpPPC64OR {
6731                         break
6732                 }
6733                 t := v_0.Type
6734                 _ = v_0.Args[1]
6735                 v_0_0 := v_0.Args[0]
6736                 v_0_1 := v_0.Args[1]
6737                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6738                         x := v_0_0
6739                         if v_0_1.Op != OpPPC64MOVHZreg {
6740                                 continue
6741                         }
6742                         y := v_0_1.Args[0]
6743                         v.reset(OpPPC64MOVBZreg)
6744                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6745                         v0.AddArg2(x, y)
6746                         v.AddArg(v0)
6747                         return true
6748                 }
6749                 break
6750         }
6751         // match: (MOVBZreg (XOR <t> x (MOVHZreg y)))
6752         // result: (MOVBZreg (XOR <t> x y))
6753         for {
6754                 if v_0.Op != OpPPC64XOR {
6755                         break
6756                 }
6757                 t := v_0.Type
6758                 _ = v_0.Args[1]
6759                 v_0_0 := v_0.Args[0]
6760                 v_0_1 := v_0.Args[1]
6761                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6762                         x := v_0_0
6763                         if v_0_1.Op != OpPPC64MOVHZreg {
6764                                 continue
6765                         }
6766                         y := v_0_1.Args[0]
6767                         v.reset(OpPPC64MOVBZreg)
6768                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6769                         v0.AddArg2(x, y)
6770                         v.AddArg(v0)
6771                         return true
6772                 }
6773                 break
6774         }
6775         // match: (MOVBZreg (AND <t> x (MOVHZreg y)))
6776         // result: (MOVBZreg (AND <t> x y))
6777         for {
6778                 if v_0.Op != OpPPC64AND {
6779                         break
6780                 }
6781                 t := v_0.Type
6782                 _ = v_0.Args[1]
6783                 v_0_0 := v_0.Args[0]
6784                 v_0_1 := v_0.Args[1]
6785                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6786                         x := v_0_0
6787                         if v_0_1.Op != OpPPC64MOVHZreg {
6788                                 continue
6789                         }
6790                         y := v_0_1.Args[0]
6791                         v.reset(OpPPC64MOVBZreg)
6792                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6793                         v0.AddArg2(x, y)
6794                         v.AddArg(v0)
6795                         return true
6796                 }
6797                 break
6798         }
6799         // match: (MOVBZreg (OR <t> x (MOVBZreg y)))
6800         // result: (MOVBZreg (OR <t> x y))
6801         for {
6802                 if v_0.Op != OpPPC64OR {
6803                         break
6804                 }
6805                 t := v_0.Type
6806                 _ = v_0.Args[1]
6807                 v_0_0 := v_0.Args[0]
6808                 v_0_1 := v_0.Args[1]
6809                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6810                         x := v_0_0
6811                         if v_0_1.Op != OpPPC64MOVBZreg {
6812                                 continue
6813                         }
6814                         y := v_0_1.Args[0]
6815                         v.reset(OpPPC64MOVBZreg)
6816                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6817                         v0.AddArg2(x, y)
6818                         v.AddArg(v0)
6819                         return true
6820                 }
6821                 break
6822         }
6823         // match: (MOVBZreg (XOR <t> x (MOVBZreg y)))
6824         // result: (MOVBZreg (XOR <t> x y))
6825         for {
6826                 if v_0.Op != OpPPC64XOR {
6827                         break
6828                 }
6829                 t := v_0.Type
6830                 _ = v_0.Args[1]
6831                 v_0_0 := v_0.Args[0]
6832                 v_0_1 := v_0.Args[1]
6833                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6834                         x := v_0_0
6835                         if v_0_1.Op != OpPPC64MOVBZreg {
6836                                 continue
6837                         }
6838                         y := v_0_1.Args[0]
6839                         v.reset(OpPPC64MOVBZreg)
6840                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6841                         v0.AddArg2(x, y)
6842                         v.AddArg(v0)
6843                         return true
6844                 }
6845                 break
6846         }
6847         // match: (MOVBZreg (AND <t> x (MOVBZreg y)))
6848         // result: (MOVBZreg (AND <t> x y))
6849         for {
6850                 if v_0.Op != OpPPC64AND {
6851                         break
6852                 }
6853                 t := v_0.Type
6854                 _ = v_0.Args[1]
6855                 v_0_0 := v_0.Args[0]
6856                 v_0_1 := v_0.Args[1]
6857                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
6858                         x := v_0_0
6859                         if v_0_1.Op != OpPPC64MOVBZreg {
6860                                 continue
6861                         }
6862                         y := v_0_1.Args[0]
6863                         v.reset(OpPPC64MOVBZreg)
6864                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6865                         v0.AddArg2(x, y)
6866                         v.AddArg(v0)
6867                         return true
6868                 }
6869                 break
6870         }
6871         // match: (MOVBZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x))))
6872         // result: z
6873         for {
6874                 z := v_0
6875                 if z.Op != OpSelect0 {
6876                         break
6877                 }
6878                 z_0 := z.Args[0]
6879                 if z_0.Op != OpPPC64ANDCCconst {
6880                         break
6881                 }
6882                 z_0_0 := z_0.Args[0]
6883                 if z_0_0.Op != OpPPC64MOVBZload {
6884                         break
6885                 }
6886                 v.copyOf(z)
6887                 return true
6888         }
6889         // match: (MOVBZreg z:(AND y (MOVBZload ptr x)))
6890         // result: z
6891         for {
6892                 z := v_0
6893                 if z.Op != OpPPC64AND {
6894                         break
6895                 }
6896                 _ = z.Args[1]
6897                 z_0 := z.Args[0]
6898                 z_1 := z.Args[1]
6899                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
6900                         if z_1.Op != OpPPC64MOVBZload {
6901                                 continue
6902                         }
6903                         v.copyOf(z)
6904                         return true
6905                 }
6906                 break
6907         }
6908         // match: (MOVBZreg x:(MOVBZload _ _))
6909         // result: x
6910         for {
6911                 x := v_0
6912                 if x.Op != OpPPC64MOVBZload {
6913                         break
6914                 }
6915                 v.copyOf(x)
6916                 return true
6917         }
6918         // match: (MOVBZreg x:(MOVBZloadidx _ _ _))
6919         // result: x
6920         for {
6921                 x := v_0
6922                 if x.Op != OpPPC64MOVBZloadidx {
6923                         break
6924                 }
6925                 v.copyOf(x)
6926                 return true
6927         }
6928         // match: (MOVBZreg x:(Select0 (LoweredAtomicLoad8 _ _)))
6929         // result: x
6930         for {
6931                 x := v_0
6932                 if x.Op != OpSelect0 {
6933                         break
6934                 }
6935                 x_0 := x.Args[0]
6936                 if x_0.Op != OpPPC64LoweredAtomicLoad8 {
6937                         break
6938                 }
6939                 v.copyOf(x)
6940                 return true
6941         }
6942         // match: (MOVBZreg x:(Arg <t>))
6943         // cond: is8BitInt(t) && !t.IsSigned()
6944         // result: x
6945         for {
6946                 x := v_0
6947                 if x.Op != OpArg {
6948                         break
6949                 }
6950                 t := x.Type
6951                 if !(is8BitInt(t) && !t.IsSigned()) {
6952                         break
6953                 }
6954                 v.copyOf(x)
6955                 return true
6956         }
6957         // match: (MOVBZreg (MOVDconst [c]))
6958         // result: (MOVDconst [int64(uint8(c))])
6959         for {
6960                 if v_0.Op != OpPPC64MOVDconst {
6961                         break
6962                 }
6963                 c := auxIntToInt64(v_0.AuxInt)
6964                 v.reset(OpPPC64MOVDconst)
6965                 v.AuxInt = int64ToAuxInt(int64(uint8(c)))
6966                 return true
6967         }
6968         return false
6969 }
6970 func rewriteValuePPC64_OpPPC64MOVBreg(v *Value) bool {
6971         v_0 := v.Args[0]
6972         b := v.Block
6973         typ := &b.Func.Config.Types
6974         // match: (MOVBreg y:(Select0 (ANDCCconst [c] _)))
6975         // cond: uint64(c) <= 0x7F
6976         // result: y
6977         for {
6978                 y := v_0
6979                 if y.Op != OpSelect0 {
6980                         break
6981                 }
6982                 y_0 := y.Args[0]
6983                 if y_0.Op != OpPPC64ANDCCconst {
6984                         break
6985                 }
6986                 c := auxIntToInt64(y_0.AuxInt)
6987                 if !(uint64(c) <= 0x7F) {
6988                         break
6989                 }
6990                 v.copyOf(y)
6991                 return true
6992         }
6993         // match: (MOVBreg (SRAWconst [c] (MOVBreg x)))
6994         // result: (SRAWconst [c] (MOVBreg x))
6995         for {
6996                 if v_0.Op != OpPPC64SRAWconst {
6997                         break
6998                 }
6999                 c := auxIntToInt64(v_0.AuxInt)
7000                 v_0_0 := v_0.Args[0]
7001                 if v_0_0.Op != OpPPC64MOVBreg {
7002                         break
7003                 }
7004                 x := v_0_0.Args[0]
7005                 v.reset(OpPPC64SRAWconst)
7006                 v.AuxInt = int64ToAuxInt(c)
7007                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
7008                 v0.AddArg(x)
7009                 v.AddArg(v0)
7010                 return true
7011         }
7012         // match: (MOVBreg (SRAWconst [c] x))
7013         // cond: sizeof(x.Type) == 8
7014         // result: (SRAWconst [c] x)
7015         for {
7016                 if v_0.Op != OpPPC64SRAWconst {
7017                         break
7018                 }
7019                 c := auxIntToInt64(v_0.AuxInt)
7020                 x := v_0.Args[0]
7021                 if !(sizeof(x.Type) == 8) {
7022                         break
7023                 }
7024                 v.reset(OpPPC64SRAWconst)
7025                 v.AuxInt = int64ToAuxInt(c)
7026                 v.AddArg(x)
7027                 return true
7028         }
7029         // match: (MOVBreg (SRDconst [c] x))
7030         // cond: c>56
7031         // result: (SRDconst [c] x)
7032         for {
7033                 if v_0.Op != OpPPC64SRDconst {
7034                         break
7035                 }
7036                 c := auxIntToInt64(v_0.AuxInt)
7037                 x := v_0.Args[0]
7038                 if !(c > 56) {
7039                         break
7040                 }
7041                 v.reset(OpPPC64SRDconst)
7042                 v.AuxInt = int64ToAuxInt(c)
7043                 v.AddArg(x)
7044                 return true
7045         }
7046         // match: (MOVBreg (SRDconst [c] x))
7047         // cond: c==56
7048         // result: (SRADconst [c] x)
7049         for {
7050                 if v_0.Op != OpPPC64SRDconst {
7051                         break
7052                 }
7053                 c := auxIntToInt64(v_0.AuxInt)
7054                 x := v_0.Args[0]
7055                 if !(c == 56) {
7056                         break
7057                 }
7058                 v.reset(OpPPC64SRADconst)
7059                 v.AuxInt = int64ToAuxInt(c)
7060                 v.AddArg(x)
7061                 return true
7062         }
7063         // match: (MOVBreg (SRADconst [c] x))
7064         // cond: c>=56
7065         // result: (SRADconst [c] x)
7066         for {
7067                 if v_0.Op != OpPPC64SRADconst {
7068                         break
7069                 }
7070                 c := auxIntToInt64(v_0.AuxInt)
7071                 x := v_0.Args[0]
7072                 if !(c >= 56) {
7073                         break
7074                 }
7075                 v.reset(OpPPC64SRADconst)
7076                 v.AuxInt = int64ToAuxInt(c)
7077                 v.AddArg(x)
7078                 return true
7079         }
7080         // match: (MOVBreg (SRWconst [c] x))
7081         // cond: c>24
7082         // result: (SRWconst [c] x)
7083         for {
7084                 if v_0.Op != OpPPC64SRWconst {
7085                         break
7086                 }
7087                 c := auxIntToInt64(v_0.AuxInt)
7088                 x := v_0.Args[0]
7089                 if !(c > 24) {
7090                         break
7091                 }
7092                 v.reset(OpPPC64SRWconst)
7093                 v.AuxInt = int64ToAuxInt(c)
7094                 v.AddArg(x)
7095                 return true
7096         }
7097         // match: (MOVBreg (SRWconst [c] x))
7098         // cond: c==24
7099         // result: (SRAWconst [c] x)
7100         for {
7101                 if v_0.Op != OpPPC64SRWconst {
7102                         break
7103                 }
7104                 c := auxIntToInt64(v_0.AuxInt)
7105                 x := v_0.Args[0]
7106                 if !(c == 24) {
7107                         break
7108                 }
7109                 v.reset(OpPPC64SRAWconst)
7110                 v.AuxInt = int64ToAuxInt(c)
7111                 v.AddArg(x)
7112                 return true
7113         }
7114         // match: (MOVBreg (SRAWconst [c] x))
7115         // cond: c>=24
7116         // result: (SRAWconst [c] x)
7117         for {
7118                 if v_0.Op != OpPPC64SRAWconst {
7119                         break
7120                 }
7121                 c := auxIntToInt64(v_0.AuxInt)
7122                 x := v_0.Args[0]
7123                 if !(c >= 24) {
7124                         break
7125                 }
7126                 v.reset(OpPPC64SRAWconst)
7127                 v.AuxInt = int64ToAuxInt(c)
7128                 v.AddArg(x)
7129                 return true
7130         }
7131         // match: (MOVBreg y:(MOVBreg _))
7132         // result: y
7133         for {
7134                 y := v_0
7135                 if y.Op != OpPPC64MOVBreg {
7136                         break
7137                 }
7138                 v.copyOf(y)
7139                 return true
7140         }
7141         // match: (MOVBreg (MOVBZreg x))
7142         // result: (MOVBreg x)
7143         for {
7144                 if v_0.Op != OpPPC64MOVBZreg {
7145                         break
7146                 }
7147                 x := v_0.Args[0]
7148                 v.reset(OpPPC64MOVBreg)
7149                 v.AddArg(x)
7150                 return true
7151         }
7152         // match: (MOVBreg x:(Arg <t>))
7153         // cond: is8BitInt(t) && t.IsSigned()
7154         // result: x
7155         for {
7156                 x := v_0
7157                 if x.Op != OpArg {
7158                         break
7159                 }
7160                 t := x.Type
7161                 if !(is8BitInt(t) && t.IsSigned()) {
7162                         break
7163                 }
7164                 v.copyOf(x)
7165                 return true
7166         }
7167         // match: (MOVBreg (MOVDconst [c]))
7168         // result: (MOVDconst [int64(int8(c))])
7169         for {
7170                 if v_0.Op != OpPPC64MOVDconst {
7171                         break
7172                 }
7173                 c := auxIntToInt64(v_0.AuxInt)
7174                 v.reset(OpPPC64MOVDconst)
7175                 v.AuxInt = int64ToAuxInt(int64(int8(c)))
7176                 return true
7177         }
7178         return false
7179 }
7180 func rewriteValuePPC64_OpPPC64MOVBstore(v *Value) bool {
7181         v_2 := v.Args[2]
7182         v_1 := v.Args[1]
7183         v_0 := v.Args[0]
7184         b := v.Block
7185         typ := &b.Func.Config.Types
7186         // match: (MOVBstore [off1] {sym} (ADDconst [off2] x) val mem)
7187         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
7188         // result: (MOVBstore [off1+int32(off2)] {sym} x val mem)
7189         for {
7190                 off1 := auxIntToInt32(v.AuxInt)
7191                 sym := auxToSym(v.Aux)
7192                 if v_0.Op != OpPPC64ADDconst {
7193                         break
7194                 }
7195                 off2 := auxIntToInt64(v_0.AuxInt)
7196                 x := v_0.Args[0]
7197                 val := v_1
7198                 mem := v_2
7199                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
7200                         break
7201                 }
7202                 v.reset(OpPPC64MOVBstore)
7203                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7204                 v.Aux = symToAux(sym)
7205                 v.AddArg3(x, val, mem)
7206                 return true
7207         }
7208         // match: (MOVBstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
7209         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
7210         // result: (MOVBstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
7211         for {
7212                 off1 := auxIntToInt32(v.AuxInt)
7213                 sym1 := auxToSym(v.Aux)
7214                 p := v_0
7215                 if p.Op != OpPPC64MOVDaddr {
7216                         break
7217                 }
7218                 off2 := auxIntToInt32(p.AuxInt)
7219                 sym2 := auxToSym(p.Aux)
7220                 ptr := p.Args[0]
7221                 val := v_1
7222                 mem := v_2
7223                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7224                         break
7225                 }
7226                 v.reset(OpPPC64MOVBstore)
7227                 v.AuxInt = int32ToAuxInt(off1 + off2)
7228                 v.Aux = symToAux(mergeSym(sym1, sym2))
7229                 v.AddArg3(ptr, val, mem)
7230                 return true
7231         }
7232         // match: (MOVBstore [off] {sym} ptr (MOVDconst [0]) mem)
7233         // result: (MOVBstorezero [off] {sym} ptr mem)
7234         for {
7235                 off := auxIntToInt32(v.AuxInt)
7236                 sym := auxToSym(v.Aux)
7237                 ptr := v_0
7238                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
7239                         break
7240                 }
7241                 mem := v_2
7242                 v.reset(OpPPC64MOVBstorezero)
7243                 v.AuxInt = int32ToAuxInt(off)
7244                 v.Aux = symToAux(sym)
7245                 v.AddArg2(ptr, mem)
7246                 return true
7247         }
7248         // match: (MOVBstore [0] {sym} p:(ADD ptr idx) val mem)
7249         // cond: sym == nil && p.Uses == 1
7250         // result: (MOVBstoreidx ptr idx val mem)
7251         for {
7252                 if auxIntToInt32(v.AuxInt) != 0 {
7253                         break
7254                 }
7255                 sym := auxToSym(v.Aux)
7256                 p := v_0
7257                 if p.Op != OpPPC64ADD {
7258                         break
7259                 }
7260                 idx := p.Args[1]
7261                 ptr := p.Args[0]
7262                 val := v_1
7263                 mem := v_2
7264                 if !(sym == nil && p.Uses == 1) {
7265                         break
7266                 }
7267                 v.reset(OpPPC64MOVBstoreidx)
7268                 v.AddArg4(ptr, idx, val, mem)
7269                 return true
7270         }
7271         // match: (MOVBstore [off] {sym} ptr (MOVBreg x) mem)
7272         // result: (MOVBstore [off] {sym} ptr x mem)
7273         for {
7274                 off := auxIntToInt32(v.AuxInt)
7275                 sym := auxToSym(v.Aux)
7276                 ptr := v_0
7277                 if v_1.Op != OpPPC64MOVBreg {
7278                         break
7279                 }
7280                 x := v_1.Args[0]
7281                 mem := v_2
7282                 v.reset(OpPPC64MOVBstore)
7283                 v.AuxInt = int32ToAuxInt(off)
7284                 v.Aux = symToAux(sym)
7285                 v.AddArg3(ptr, x, mem)
7286                 return true
7287         }
7288         // match: (MOVBstore [off] {sym} ptr (MOVBZreg x) mem)
7289         // result: (MOVBstore [off] {sym} ptr x mem)
7290         for {
7291                 off := auxIntToInt32(v.AuxInt)
7292                 sym := auxToSym(v.Aux)
7293                 ptr := v_0
7294                 if v_1.Op != OpPPC64MOVBZreg {
7295                         break
7296                 }
7297                 x := v_1.Args[0]
7298                 mem := v_2
7299                 v.reset(OpPPC64MOVBstore)
7300                 v.AuxInt = int32ToAuxInt(off)
7301                 v.Aux = symToAux(sym)
7302                 v.AddArg3(ptr, x, mem)
7303                 return true
7304         }
7305         // match: (MOVBstore [off] {sym} ptr (MOVHreg x) mem)
7306         // result: (MOVBstore [off] {sym} ptr x mem)
7307         for {
7308                 off := auxIntToInt32(v.AuxInt)
7309                 sym := auxToSym(v.Aux)
7310                 ptr := v_0
7311                 if v_1.Op != OpPPC64MOVHreg {
7312                         break
7313                 }
7314                 x := v_1.Args[0]
7315                 mem := v_2
7316                 v.reset(OpPPC64MOVBstore)
7317                 v.AuxInt = int32ToAuxInt(off)
7318                 v.Aux = symToAux(sym)
7319                 v.AddArg3(ptr, x, mem)
7320                 return true
7321         }
7322         // match: (MOVBstore [off] {sym} ptr (MOVHZreg x) mem)
7323         // result: (MOVBstore [off] {sym} ptr x mem)
7324         for {
7325                 off := auxIntToInt32(v.AuxInt)
7326                 sym := auxToSym(v.Aux)
7327                 ptr := v_0
7328                 if v_1.Op != OpPPC64MOVHZreg {
7329                         break
7330                 }
7331                 x := v_1.Args[0]
7332                 mem := v_2
7333                 v.reset(OpPPC64MOVBstore)
7334                 v.AuxInt = int32ToAuxInt(off)
7335                 v.Aux = symToAux(sym)
7336                 v.AddArg3(ptr, x, mem)
7337                 return true
7338         }
7339         // match: (MOVBstore [off] {sym} ptr (MOVWreg x) mem)
7340         // result: (MOVBstore [off] {sym} ptr x mem)
7341         for {
7342                 off := auxIntToInt32(v.AuxInt)
7343                 sym := auxToSym(v.Aux)
7344                 ptr := v_0
7345                 if v_1.Op != OpPPC64MOVWreg {
7346                         break
7347                 }
7348                 x := v_1.Args[0]
7349                 mem := v_2
7350                 v.reset(OpPPC64MOVBstore)
7351                 v.AuxInt = int32ToAuxInt(off)
7352                 v.Aux = symToAux(sym)
7353                 v.AddArg3(ptr, x, mem)
7354                 return true
7355         }
7356         // match: (MOVBstore [off] {sym} ptr (MOVWZreg x) mem)
7357         // result: (MOVBstore [off] {sym} ptr x mem)
7358         for {
7359                 off := auxIntToInt32(v.AuxInt)
7360                 sym := auxToSym(v.Aux)
7361                 ptr := v_0
7362                 if v_1.Op != OpPPC64MOVWZreg {
7363                         break
7364                 }
7365                 x := v_1.Args[0]
7366                 mem := v_2
7367                 v.reset(OpPPC64MOVBstore)
7368                 v.AuxInt = int32ToAuxInt(off)
7369                 v.Aux = symToAux(sym)
7370                 v.AddArg3(ptr, x, mem)
7371                 return true
7372         }
7373         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVHreg x) [c]) mem)
7374         // cond: c <= 8
7375         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7376         for {
7377                 off := auxIntToInt32(v.AuxInt)
7378                 sym := auxToSym(v.Aux)
7379                 ptr := v_0
7380                 if v_1.Op != OpPPC64SRWconst {
7381                         break
7382                 }
7383                 c := auxIntToInt64(v_1.AuxInt)
7384                 v_1_0 := v_1.Args[0]
7385                 if v_1_0.Op != OpPPC64MOVHreg {
7386                         break
7387                 }
7388                 x := v_1_0.Args[0]
7389                 mem := v_2
7390                 if !(c <= 8) {
7391                         break
7392                 }
7393                 v.reset(OpPPC64MOVBstore)
7394                 v.AuxInt = int32ToAuxInt(off)
7395                 v.Aux = symToAux(sym)
7396                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7397                 v0.AuxInt = int64ToAuxInt(c)
7398                 v0.AddArg(x)
7399                 v.AddArg3(ptr, v0, mem)
7400                 return true
7401         }
7402         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVHZreg x) [c]) mem)
7403         // cond: c <= 8
7404         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7405         for {
7406                 off := auxIntToInt32(v.AuxInt)
7407                 sym := auxToSym(v.Aux)
7408                 ptr := v_0
7409                 if v_1.Op != OpPPC64SRWconst {
7410                         break
7411                 }
7412                 c := auxIntToInt64(v_1.AuxInt)
7413                 v_1_0 := v_1.Args[0]
7414                 if v_1_0.Op != OpPPC64MOVHZreg {
7415                         break
7416                 }
7417                 x := v_1_0.Args[0]
7418                 mem := v_2
7419                 if !(c <= 8) {
7420                         break
7421                 }
7422                 v.reset(OpPPC64MOVBstore)
7423                 v.AuxInt = int32ToAuxInt(off)
7424                 v.Aux = symToAux(sym)
7425                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7426                 v0.AuxInt = int64ToAuxInt(c)
7427                 v0.AddArg(x)
7428                 v.AddArg3(ptr, v0, mem)
7429                 return true
7430         }
7431         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVWreg x) [c]) mem)
7432         // cond: c <= 24
7433         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7434         for {
7435                 off := auxIntToInt32(v.AuxInt)
7436                 sym := auxToSym(v.Aux)
7437                 ptr := v_0
7438                 if v_1.Op != OpPPC64SRWconst {
7439                         break
7440                 }
7441                 c := auxIntToInt64(v_1.AuxInt)
7442                 v_1_0 := v_1.Args[0]
7443                 if v_1_0.Op != OpPPC64MOVWreg {
7444                         break
7445                 }
7446                 x := v_1_0.Args[0]
7447                 mem := v_2
7448                 if !(c <= 24) {
7449                         break
7450                 }
7451                 v.reset(OpPPC64MOVBstore)
7452                 v.AuxInt = int32ToAuxInt(off)
7453                 v.Aux = symToAux(sym)
7454                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7455                 v0.AuxInt = int64ToAuxInt(c)
7456                 v0.AddArg(x)
7457                 v.AddArg3(ptr, v0, mem)
7458                 return true
7459         }
7460         // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVWZreg x) [c]) mem)
7461         // cond: c <= 24
7462         // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7463         for {
7464                 off := auxIntToInt32(v.AuxInt)
7465                 sym := auxToSym(v.Aux)
7466                 ptr := v_0
7467                 if v_1.Op != OpPPC64SRWconst {
7468                         break
7469                 }
7470                 c := auxIntToInt64(v_1.AuxInt)
7471                 v_1_0 := v_1.Args[0]
7472                 if v_1_0.Op != OpPPC64MOVWZreg {
7473                         break
7474                 }
7475                 x := v_1_0.Args[0]
7476                 mem := v_2
7477                 if !(c <= 24) {
7478                         break
7479                 }
7480                 v.reset(OpPPC64MOVBstore)
7481                 v.AuxInt = int32ToAuxInt(off)
7482                 v.Aux = symToAux(sym)
7483                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7484                 v0.AuxInt = int64ToAuxInt(c)
7485                 v0.AddArg(x)
7486                 v.AddArg3(ptr, v0, mem)
7487                 return true
7488         }
7489         return false
7490 }
7491 func rewriteValuePPC64_OpPPC64MOVBstoreidx(v *Value) bool {
7492         v_3 := v.Args[3]
7493         v_2 := v.Args[2]
7494         v_1 := v.Args[1]
7495         v_0 := v.Args[0]
7496         b := v.Block
7497         typ := &b.Func.Config.Types
7498         // match: (MOVBstoreidx ptr (MOVDconst [c]) val mem)
7499         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
7500         // result: (MOVBstore [int32(c)] ptr val mem)
7501         for {
7502                 ptr := v_0
7503                 if v_1.Op != OpPPC64MOVDconst {
7504                         break
7505                 }
7506                 c := auxIntToInt64(v_1.AuxInt)
7507                 val := v_2
7508                 mem := v_3
7509                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7510                         break
7511                 }
7512                 v.reset(OpPPC64MOVBstore)
7513                 v.AuxInt = int32ToAuxInt(int32(c))
7514                 v.AddArg3(ptr, val, mem)
7515                 return true
7516         }
7517         // match: (MOVBstoreidx (MOVDconst [c]) ptr val mem)
7518         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
7519         // result: (MOVBstore [int32(c)] ptr val mem)
7520         for {
7521                 if v_0.Op != OpPPC64MOVDconst {
7522                         break
7523                 }
7524                 c := auxIntToInt64(v_0.AuxInt)
7525                 ptr := v_1
7526                 val := v_2
7527                 mem := v_3
7528                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7529                         break
7530                 }
7531                 v.reset(OpPPC64MOVBstore)
7532                 v.AuxInt = int32ToAuxInt(int32(c))
7533                 v.AddArg3(ptr, val, mem)
7534                 return true
7535         }
7536         // match: (MOVBstoreidx ptr idx (MOVBreg x) mem)
7537         // result: (MOVBstoreidx ptr idx x mem)
7538         for {
7539                 ptr := v_0
7540                 idx := v_1
7541                 if v_2.Op != OpPPC64MOVBreg {
7542                         break
7543                 }
7544                 x := v_2.Args[0]
7545                 mem := v_3
7546                 v.reset(OpPPC64MOVBstoreidx)
7547                 v.AddArg4(ptr, idx, x, mem)
7548                 return true
7549         }
7550         // match: (MOVBstoreidx ptr idx (MOVBZreg x) mem)
7551         // result: (MOVBstoreidx ptr idx x mem)
7552         for {
7553                 ptr := v_0
7554                 idx := v_1
7555                 if v_2.Op != OpPPC64MOVBZreg {
7556                         break
7557                 }
7558                 x := v_2.Args[0]
7559                 mem := v_3
7560                 v.reset(OpPPC64MOVBstoreidx)
7561                 v.AddArg4(ptr, idx, x, mem)
7562                 return true
7563         }
7564         // match: (MOVBstoreidx ptr idx (MOVHreg x) mem)
7565         // result: (MOVBstoreidx ptr idx x mem)
7566         for {
7567                 ptr := v_0
7568                 idx := v_1
7569                 if v_2.Op != OpPPC64MOVHreg {
7570                         break
7571                 }
7572                 x := v_2.Args[0]
7573                 mem := v_3
7574                 v.reset(OpPPC64MOVBstoreidx)
7575                 v.AddArg4(ptr, idx, x, mem)
7576                 return true
7577         }
7578         // match: (MOVBstoreidx ptr idx (MOVHZreg x) mem)
7579         // result: (MOVBstoreidx ptr idx x mem)
7580         for {
7581                 ptr := v_0
7582                 idx := v_1
7583                 if v_2.Op != OpPPC64MOVHZreg {
7584                         break
7585                 }
7586                 x := v_2.Args[0]
7587                 mem := v_3
7588                 v.reset(OpPPC64MOVBstoreidx)
7589                 v.AddArg4(ptr, idx, x, mem)
7590                 return true
7591         }
7592         // match: (MOVBstoreidx ptr idx (MOVWreg x) mem)
7593         // result: (MOVBstoreidx ptr idx x mem)
7594         for {
7595                 ptr := v_0
7596                 idx := v_1
7597                 if v_2.Op != OpPPC64MOVWreg {
7598                         break
7599                 }
7600                 x := v_2.Args[0]
7601                 mem := v_3
7602                 v.reset(OpPPC64MOVBstoreidx)
7603                 v.AddArg4(ptr, idx, x, mem)
7604                 return true
7605         }
7606         // match: (MOVBstoreidx ptr idx (MOVWZreg x) mem)
7607         // result: (MOVBstoreidx ptr idx x mem)
7608         for {
7609                 ptr := v_0
7610                 idx := v_1
7611                 if v_2.Op != OpPPC64MOVWZreg {
7612                         break
7613                 }
7614                 x := v_2.Args[0]
7615                 mem := v_3
7616                 v.reset(OpPPC64MOVBstoreidx)
7617                 v.AddArg4(ptr, idx, x, mem)
7618                 return true
7619         }
7620         // match: (MOVBstoreidx ptr idx (SRWconst (MOVHreg x) [c]) mem)
7621         // cond: c <= 8
7622         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7623         for {
7624                 ptr := v_0
7625                 idx := v_1
7626                 if v_2.Op != OpPPC64SRWconst {
7627                         break
7628                 }
7629                 c := auxIntToInt64(v_2.AuxInt)
7630                 v_2_0 := v_2.Args[0]
7631                 if v_2_0.Op != OpPPC64MOVHreg {
7632                         break
7633                 }
7634                 x := v_2_0.Args[0]
7635                 mem := v_3
7636                 if !(c <= 8) {
7637                         break
7638                 }
7639                 v.reset(OpPPC64MOVBstoreidx)
7640                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7641                 v0.AuxInt = int64ToAuxInt(c)
7642                 v0.AddArg(x)
7643                 v.AddArg4(ptr, idx, v0, mem)
7644                 return true
7645         }
7646         // match: (MOVBstoreidx ptr idx (SRWconst (MOVHZreg x) [c]) mem)
7647         // cond: c <= 8
7648         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7649         for {
7650                 ptr := v_0
7651                 idx := v_1
7652                 if v_2.Op != OpPPC64SRWconst {
7653                         break
7654                 }
7655                 c := auxIntToInt64(v_2.AuxInt)
7656                 v_2_0 := v_2.Args[0]
7657                 if v_2_0.Op != OpPPC64MOVHZreg {
7658                         break
7659                 }
7660                 x := v_2_0.Args[0]
7661                 mem := v_3
7662                 if !(c <= 8) {
7663                         break
7664                 }
7665                 v.reset(OpPPC64MOVBstoreidx)
7666                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7667                 v0.AuxInt = int64ToAuxInt(c)
7668                 v0.AddArg(x)
7669                 v.AddArg4(ptr, idx, v0, mem)
7670                 return true
7671         }
7672         // match: (MOVBstoreidx ptr idx (SRWconst (MOVWreg x) [c]) mem)
7673         // cond: c <= 24
7674         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7675         for {
7676                 ptr := v_0
7677                 idx := v_1
7678                 if v_2.Op != OpPPC64SRWconst {
7679                         break
7680                 }
7681                 c := auxIntToInt64(v_2.AuxInt)
7682                 v_2_0 := v_2.Args[0]
7683                 if v_2_0.Op != OpPPC64MOVWreg {
7684                         break
7685                 }
7686                 x := v_2_0.Args[0]
7687                 mem := v_3
7688                 if !(c <= 24) {
7689                         break
7690                 }
7691                 v.reset(OpPPC64MOVBstoreidx)
7692                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7693                 v0.AuxInt = int64ToAuxInt(c)
7694                 v0.AddArg(x)
7695                 v.AddArg4(ptr, idx, v0, mem)
7696                 return true
7697         }
7698         // match: (MOVBstoreidx ptr idx (SRWconst (MOVWZreg x) [c]) mem)
7699         // cond: c <= 24
7700         // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7701         for {
7702                 ptr := v_0
7703                 idx := v_1
7704                 if v_2.Op != OpPPC64SRWconst {
7705                         break
7706                 }
7707                 c := auxIntToInt64(v_2.AuxInt)
7708                 v_2_0 := v_2.Args[0]
7709                 if v_2_0.Op != OpPPC64MOVWZreg {
7710                         break
7711                 }
7712                 x := v_2_0.Args[0]
7713                 mem := v_3
7714                 if !(c <= 24) {
7715                         break
7716                 }
7717                 v.reset(OpPPC64MOVBstoreidx)
7718                 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7719                 v0.AuxInt = int64ToAuxInt(c)
7720                 v0.AddArg(x)
7721                 v.AddArg4(ptr, idx, v0, mem)
7722                 return true
7723         }
7724         return false
7725 }
7726 func rewriteValuePPC64_OpPPC64MOVBstorezero(v *Value) bool {
7727         v_1 := v.Args[1]
7728         v_0 := v.Args[0]
7729         // match: (MOVBstorezero [off1] {sym} (ADDconst [off2] x) mem)
7730         // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2)))
7731         // result: (MOVBstorezero [off1+int32(off2)] {sym} x mem)
7732         for {
7733                 off1 := auxIntToInt32(v.AuxInt)
7734                 sym := auxToSym(v.Aux)
7735                 if v_0.Op != OpPPC64ADDconst {
7736                         break
7737                 }
7738                 off2 := auxIntToInt64(v_0.AuxInt)
7739                 x := v_0.Args[0]
7740                 mem := v_1
7741                 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
7742                         break
7743                 }
7744                 v.reset(OpPPC64MOVBstorezero)
7745                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7746                 v.Aux = symToAux(sym)
7747                 v.AddArg2(x, mem)
7748                 return true
7749         }
7750         // match: (MOVBstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
7751         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
7752         // result: (MOVBstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
7753         for {
7754                 off1 := auxIntToInt32(v.AuxInt)
7755                 sym1 := auxToSym(v.Aux)
7756                 p := v_0
7757                 if p.Op != OpPPC64MOVDaddr {
7758                         break
7759                 }
7760                 off2 := auxIntToInt32(p.AuxInt)
7761                 sym2 := auxToSym(p.Aux)
7762                 x := p.Args[0]
7763                 mem := v_1
7764                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7765                         break
7766                 }
7767                 v.reset(OpPPC64MOVBstorezero)
7768                 v.AuxInt = int32ToAuxInt(off1 + off2)
7769                 v.Aux = symToAux(mergeSym(sym1, sym2))
7770                 v.AddArg2(x, mem)
7771                 return true
7772         }
7773         return false
7774 }
7775 func rewriteValuePPC64_OpPPC64MOVDaddr(v *Value) bool {
7776         v_0 := v.Args[0]
7777         // match: (MOVDaddr {sym} [n] p:(ADD x y))
7778         // cond: sym == nil && n == 0
7779         // result: p
7780         for {
7781                 n := auxIntToInt32(v.AuxInt)
7782                 sym := auxToSym(v.Aux)
7783                 p := v_0
7784                 if p.Op != OpPPC64ADD {
7785                         break
7786                 }
7787                 if !(sym == nil && n == 0) {
7788                         break
7789                 }
7790                 v.copyOf(p)
7791                 return true
7792         }
7793         // match: (MOVDaddr {sym} [n] ptr)
7794         // cond: sym == nil && n == 0 && (ptr.Op == OpArgIntReg || ptr.Op == OpPhi)
7795         // result: ptr
7796         for {
7797                 n := auxIntToInt32(v.AuxInt)
7798                 sym := auxToSym(v.Aux)
7799                 ptr := v_0
7800                 if !(sym == nil && n == 0 && (ptr.Op == OpArgIntReg || ptr.Op == OpPhi)) {
7801                         break
7802                 }
7803                 v.copyOf(ptr)
7804                 return true
7805         }
7806         return false
7807 }
7808 func rewriteValuePPC64_OpPPC64MOVDload(v *Value) bool {
7809         v_1 := v.Args[1]
7810         v_0 := v.Args[0]
7811         // match: (MOVDload [off] {sym} ptr (FMOVDstore [off] {sym} ptr x _))
7812         // result: (MFVSRD x)
7813         for {
7814                 off := auxIntToInt32(v.AuxInt)
7815                 sym := auxToSym(v.Aux)
7816                 ptr := v_0
7817                 if v_1.Op != OpPPC64FMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
7818                         break
7819                 }
7820                 x := v_1.Args[1]
7821                 if ptr != v_1.Args[0] {
7822                         break
7823                 }
7824                 v.reset(OpPPC64MFVSRD)
7825                 v.AddArg(x)
7826                 return true
7827         }
7828         // match: (MOVDload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
7829         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
7830         // result: (MOVDload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
7831         for {
7832                 off1 := auxIntToInt32(v.AuxInt)
7833                 sym1 := auxToSym(v.Aux)
7834                 p := v_0
7835                 if p.Op != OpPPC64MOVDaddr {
7836                         break
7837                 }
7838                 off2 := auxIntToInt32(p.AuxInt)
7839                 sym2 := auxToSym(p.Aux)
7840                 ptr := p.Args[0]
7841                 mem := v_1
7842                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7843                         break
7844                 }
7845                 v.reset(OpPPC64MOVDload)
7846                 v.AuxInt = int32ToAuxInt(off1 + off2)
7847                 v.Aux = symToAux(mergeSym(sym1, sym2))
7848                 v.AddArg2(ptr, mem)
7849                 return true
7850         }
7851         // match: (MOVDload [off1] {sym} (ADDconst [off2] x) mem)
7852         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
7853         // result: (MOVDload [off1+int32(off2)] {sym} x mem)
7854         for {
7855                 off1 := auxIntToInt32(v.AuxInt)
7856                 sym := auxToSym(v.Aux)
7857                 if v_0.Op != OpPPC64ADDconst {
7858                         break
7859                 }
7860                 off2 := auxIntToInt64(v_0.AuxInt)
7861                 x := v_0.Args[0]
7862                 mem := v_1
7863                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
7864                         break
7865                 }
7866                 v.reset(OpPPC64MOVDload)
7867                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7868                 v.Aux = symToAux(sym)
7869                 v.AddArg2(x, mem)
7870                 return true
7871         }
7872         // match: (MOVDload [0] {sym} p:(ADD ptr idx) mem)
7873         // cond: sym == nil && p.Uses == 1
7874         // result: (MOVDloadidx ptr idx mem)
7875         for {
7876                 if auxIntToInt32(v.AuxInt) != 0 {
7877                         break
7878                 }
7879                 sym := auxToSym(v.Aux)
7880                 p := v_0
7881                 if p.Op != OpPPC64ADD {
7882                         break
7883                 }
7884                 idx := p.Args[1]
7885                 ptr := p.Args[0]
7886                 mem := v_1
7887                 if !(sym == nil && p.Uses == 1) {
7888                         break
7889                 }
7890                 v.reset(OpPPC64MOVDloadidx)
7891                 v.AddArg3(ptr, idx, mem)
7892                 return true
7893         }
7894         return false
7895 }
7896 func rewriteValuePPC64_OpPPC64MOVDloadidx(v *Value) bool {
7897         v_2 := v.Args[2]
7898         v_1 := v.Args[1]
7899         v_0 := v.Args[0]
7900         // match: (MOVDloadidx ptr (MOVDconst [c]) mem)
7901         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
7902         // result: (MOVDload [int32(c)] ptr mem)
7903         for {
7904                 ptr := v_0
7905                 if v_1.Op != OpPPC64MOVDconst {
7906                         break
7907                 }
7908                 c := auxIntToInt64(v_1.AuxInt)
7909                 mem := v_2
7910                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7911                         break
7912                 }
7913                 v.reset(OpPPC64MOVDload)
7914                 v.AuxInt = int32ToAuxInt(int32(c))
7915                 v.AddArg2(ptr, mem)
7916                 return true
7917         }
7918         // match: (MOVDloadidx (MOVDconst [c]) ptr mem)
7919         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
7920         // result: (MOVDload [int32(c)] ptr mem)
7921         for {
7922                 if v_0.Op != OpPPC64MOVDconst {
7923                         break
7924                 }
7925                 c := auxIntToInt64(v_0.AuxInt)
7926                 ptr := v_1
7927                 mem := v_2
7928                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7929                         break
7930                 }
7931                 v.reset(OpPPC64MOVDload)
7932                 v.AuxInt = int32ToAuxInt(int32(c))
7933                 v.AddArg2(ptr, mem)
7934                 return true
7935         }
7936         return false
7937 }
7938 func rewriteValuePPC64_OpPPC64MOVDstore(v *Value) bool {
7939         v_2 := v.Args[2]
7940         v_1 := v.Args[1]
7941         v_0 := v.Args[0]
7942         b := v.Block
7943         // match: (MOVDstore [off] {sym} ptr (MFVSRD x) mem)
7944         // result: (FMOVDstore [off] {sym} ptr x mem)
7945         for {
7946                 off := auxIntToInt32(v.AuxInt)
7947                 sym := auxToSym(v.Aux)
7948                 ptr := v_0
7949                 if v_1.Op != OpPPC64MFVSRD {
7950                         break
7951                 }
7952                 x := v_1.Args[0]
7953                 mem := v_2
7954                 v.reset(OpPPC64FMOVDstore)
7955                 v.AuxInt = int32ToAuxInt(off)
7956                 v.Aux = symToAux(sym)
7957                 v.AddArg3(ptr, x, mem)
7958                 return true
7959         }
7960         // match: (MOVDstore [off1] {sym} (ADDconst [off2] x) val mem)
7961         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
7962         // result: (MOVDstore [off1+int32(off2)] {sym} x val mem)
7963         for {
7964                 off1 := auxIntToInt32(v.AuxInt)
7965                 sym := auxToSym(v.Aux)
7966                 if v_0.Op != OpPPC64ADDconst {
7967                         break
7968                 }
7969                 off2 := auxIntToInt64(v_0.AuxInt)
7970                 x := v_0.Args[0]
7971                 val := v_1
7972                 mem := v_2
7973                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
7974                         break
7975                 }
7976                 v.reset(OpPPC64MOVDstore)
7977                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7978                 v.Aux = symToAux(sym)
7979                 v.AddArg3(x, val, mem)
7980                 return true
7981         }
7982         // match: (MOVDstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
7983         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
7984         // result: (MOVDstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
7985         for {
7986                 off1 := auxIntToInt32(v.AuxInt)
7987                 sym1 := auxToSym(v.Aux)
7988                 p := v_0
7989                 if p.Op != OpPPC64MOVDaddr {
7990                         break
7991                 }
7992                 off2 := auxIntToInt32(p.AuxInt)
7993                 sym2 := auxToSym(p.Aux)
7994                 ptr := p.Args[0]
7995                 val := v_1
7996                 mem := v_2
7997                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7998                         break
7999                 }
8000                 v.reset(OpPPC64MOVDstore)
8001                 v.AuxInt = int32ToAuxInt(off1 + off2)
8002                 v.Aux = symToAux(mergeSym(sym1, sym2))
8003                 v.AddArg3(ptr, val, mem)
8004                 return true
8005         }
8006         // match: (MOVDstore [off] {sym} ptr (MOVDconst [0]) mem)
8007         // result: (MOVDstorezero [off] {sym} ptr mem)
8008         for {
8009                 off := auxIntToInt32(v.AuxInt)
8010                 sym := auxToSym(v.Aux)
8011                 ptr := v_0
8012                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
8013                         break
8014                 }
8015                 mem := v_2
8016                 v.reset(OpPPC64MOVDstorezero)
8017                 v.AuxInt = int32ToAuxInt(off)
8018                 v.Aux = symToAux(sym)
8019                 v.AddArg2(ptr, mem)
8020                 return true
8021         }
8022         // match: (MOVDstore [0] {sym} p:(ADD ptr idx) val mem)
8023         // cond: sym == nil && p.Uses == 1
8024         // result: (MOVDstoreidx ptr idx val mem)
8025         for {
8026                 if auxIntToInt32(v.AuxInt) != 0 {
8027                         break
8028                 }
8029                 sym := auxToSym(v.Aux)
8030                 p := v_0
8031                 if p.Op != OpPPC64ADD {
8032                         break
8033                 }
8034                 idx := p.Args[1]
8035                 ptr := p.Args[0]
8036                 val := v_1
8037                 mem := v_2
8038                 if !(sym == nil && p.Uses == 1) {
8039                         break
8040                 }
8041                 v.reset(OpPPC64MOVDstoreidx)
8042                 v.AddArg4(ptr, idx, val, mem)
8043                 return true
8044         }
8045         // match: (MOVDstore [off] {sym} ptr r:(BRD val) mem)
8046         // cond: r.Uses == 1
8047         // result: (MOVDBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
8048         for {
8049                 off := auxIntToInt32(v.AuxInt)
8050                 sym := auxToSym(v.Aux)
8051                 ptr := v_0
8052                 r := v_1
8053                 if r.Op != OpPPC64BRD {
8054                         break
8055                 }
8056                 val := r.Args[0]
8057                 mem := v_2
8058                 if !(r.Uses == 1) {
8059                         break
8060                 }
8061                 v.reset(OpPPC64MOVDBRstore)
8062                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
8063                 v0.AuxInt = int32ToAuxInt(off)
8064                 v0.Aux = symToAux(sym)
8065                 v0.AddArg(ptr)
8066                 v.AddArg3(v0, val, mem)
8067                 return true
8068         }
8069         // match: (MOVDstore [off] {sym} ptr (Bswap64 val) mem)
8070         // result: (MOVDBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
8071         for {
8072                 off := auxIntToInt32(v.AuxInt)
8073                 sym := auxToSym(v.Aux)
8074                 ptr := v_0
8075                 if v_1.Op != OpBswap64 {
8076                         break
8077                 }
8078                 val := v_1.Args[0]
8079                 mem := v_2
8080                 v.reset(OpPPC64MOVDBRstore)
8081                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
8082                 v0.AuxInt = int32ToAuxInt(off)
8083                 v0.Aux = symToAux(sym)
8084                 v0.AddArg(ptr)
8085                 v.AddArg3(v0, val, mem)
8086                 return true
8087         }
8088         return false
8089 }
8090 func rewriteValuePPC64_OpPPC64MOVDstoreidx(v *Value) bool {
8091         v_3 := v.Args[3]
8092         v_2 := v.Args[2]
8093         v_1 := v.Args[1]
8094         v_0 := v.Args[0]
8095         // match: (MOVDstoreidx ptr (MOVDconst [c]) val mem)
8096         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8097         // result: (MOVDstore [int32(c)] ptr val mem)
8098         for {
8099                 ptr := v_0
8100                 if v_1.Op != OpPPC64MOVDconst {
8101                         break
8102                 }
8103                 c := auxIntToInt64(v_1.AuxInt)
8104                 val := v_2
8105                 mem := v_3
8106                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8107                         break
8108                 }
8109                 v.reset(OpPPC64MOVDstore)
8110                 v.AuxInt = int32ToAuxInt(int32(c))
8111                 v.AddArg3(ptr, val, mem)
8112                 return true
8113         }
8114         // match: (MOVDstoreidx (MOVDconst [c]) ptr val mem)
8115         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8116         // result: (MOVDstore [int32(c)] ptr val mem)
8117         for {
8118                 if v_0.Op != OpPPC64MOVDconst {
8119                         break
8120                 }
8121                 c := auxIntToInt64(v_0.AuxInt)
8122                 ptr := v_1
8123                 val := v_2
8124                 mem := v_3
8125                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8126                         break
8127                 }
8128                 v.reset(OpPPC64MOVDstore)
8129                 v.AuxInt = int32ToAuxInt(int32(c))
8130                 v.AddArg3(ptr, val, mem)
8131                 return true
8132         }
8133         // match: (MOVDstoreidx ptr idx r:(BRD val) mem)
8134         // cond: r.Uses == 1
8135         // result: (MOVDBRstoreidx ptr idx val mem)
8136         for {
8137                 ptr := v_0
8138                 idx := v_1
8139                 r := v_2
8140                 if r.Op != OpPPC64BRD {
8141                         break
8142                 }
8143                 val := r.Args[0]
8144                 mem := v_3
8145                 if !(r.Uses == 1) {
8146                         break
8147                 }
8148                 v.reset(OpPPC64MOVDBRstoreidx)
8149                 v.AddArg4(ptr, idx, val, mem)
8150                 return true
8151         }
8152         // match: (MOVDstoreidx ptr idx (Bswap64 val) mem)
8153         // result: (MOVDBRstoreidx ptr idx val mem)
8154         for {
8155                 ptr := v_0
8156                 idx := v_1
8157                 if v_2.Op != OpBswap64 {
8158                         break
8159                 }
8160                 val := v_2.Args[0]
8161                 mem := v_3
8162                 v.reset(OpPPC64MOVDBRstoreidx)
8163                 v.AddArg4(ptr, idx, val, mem)
8164                 return true
8165         }
8166         return false
8167 }
8168 func rewriteValuePPC64_OpPPC64MOVDstorezero(v *Value) bool {
8169         v_1 := v.Args[1]
8170         v_0 := v.Args[0]
8171         // match: (MOVDstorezero [off1] {sym} (ADDconst [off2] x) mem)
8172         // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2)))
8173         // result: (MOVDstorezero [off1+int32(off2)] {sym} x mem)
8174         for {
8175                 off1 := auxIntToInt32(v.AuxInt)
8176                 sym := auxToSym(v.Aux)
8177                 if v_0.Op != OpPPC64ADDconst {
8178                         break
8179                 }
8180                 off2 := auxIntToInt64(v_0.AuxInt)
8181                 x := v_0.Args[0]
8182                 mem := v_1
8183                 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
8184                         break
8185                 }
8186                 v.reset(OpPPC64MOVDstorezero)
8187                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8188                 v.Aux = symToAux(sym)
8189                 v.AddArg2(x, mem)
8190                 return true
8191         }
8192         // match: (MOVDstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
8193         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
8194         // result: (MOVDstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
8195         for {
8196                 off1 := auxIntToInt32(v.AuxInt)
8197                 sym1 := auxToSym(v.Aux)
8198                 p := v_0
8199                 if p.Op != OpPPC64MOVDaddr {
8200                         break
8201                 }
8202                 off2 := auxIntToInt32(p.AuxInt)
8203                 sym2 := auxToSym(p.Aux)
8204                 x := p.Args[0]
8205                 mem := v_1
8206                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8207                         break
8208                 }
8209                 v.reset(OpPPC64MOVDstorezero)
8210                 v.AuxInt = int32ToAuxInt(off1 + off2)
8211                 v.Aux = symToAux(mergeSym(sym1, sym2))
8212                 v.AddArg2(x, mem)
8213                 return true
8214         }
8215         return false
8216 }
8217 func rewriteValuePPC64_OpPPC64MOVHBRstore(v *Value) bool {
8218         v_2 := v.Args[2]
8219         v_1 := v.Args[1]
8220         v_0 := v.Args[0]
8221         // match: (MOVHBRstore ptr (MOVHreg x) mem)
8222         // result: (MOVHBRstore ptr x mem)
8223         for {
8224                 ptr := v_0
8225                 if v_1.Op != OpPPC64MOVHreg {
8226                         break
8227                 }
8228                 x := v_1.Args[0]
8229                 mem := v_2
8230                 v.reset(OpPPC64MOVHBRstore)
8231                 v.AddArg3(ptr, x, mem)
8232                 return true
8233         }
8234         // match: (MOVHBRstore ptr (MOVHZreg x) mem)
8235         // result: (MOVHBRstore ptr x mem)
8236         for {
8237                 ptr := v_0
8238                 if v_1.Op != OpPPC64MOVHZreg {
8239                         break
8240                 }
8241                 x := v_1.Args[0]
8242                 mem := v_2
8243                 v.reset(OpPPC64MOVHBRstore)
8244                 v.AddArg3(ptr, x, mem)
8245                 return true
8246         }
8247         // match: (MOVHBRstore ptr (MOVWreg x) mem)
8248         // result: (MOVHBRstore ptr x mem)
8249         for {
8250                 ptr := v_0
8251                 if v_1.Op != OpPPC64MOVWreg {
8252                         break
8253                 }
8254                 x := v_1.Args[0]
8255                 mem := v_2
8256                 v.reset(OpPPC64MOVHBRstore)
8257                 v.AddArg3(ptr, x, mem)
8258                 return true
8259         }
8260         // match: (MOVHBRstore ptr (MOVWZreg x) mem)
8261         // result: (MOVHBRstore ptr x mem)
8262         for {
8263                 ptr := v_0
8264                 if v_1.Op != OpPPC64MOVWZreg {
8265                         break
8266                 }
8267                 x := v_1.Args[0]
8268                 mem := v_2
8269                 v.reset(OpPPC64MOVHBRstore)
8270                 v.AddArg3(ptr, x, mem)
8271                 return true
8272         }
8273         return false
8274 }
8275 func rewriteValuePPC64_OpPPC64MOVHZload(v *Value) bool {
8276         v_1 := v.Args[1]
8277         v_0 := v.Args[0]
8278         // match: (MOVHZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
8279         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
8280         // result: (MOVHZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
8281         for {
8282                 off1 := auxIntToInt32(v.AuxInt)
8283                 sym1 := auxToSym(v.Aux)
8284                 p := v_0
8285                 if p.Op != OpPPC64MOVDaddr {
8286                         break
8287                 }
8288                 off2 := auxIntToInt32(p.AuxInt)
8289                 sym2 := auxToSym(p.Aux)
8290                 ptr := p.Args[0]
8291                 mem := v_1
8292                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8293                         break
8294                 }
8295                 v.reset(OpPPC64MOVHZload)
8296                 v.AuxInt = int32ToAuxInt(off1 + off2)
8297                 v.Aux = symToAux(mergeSym(sym1, sym2))
8298                 v.AddArg2(ptr, mem)
8299                 return true
8300         }
8301         // match: (MOVHZload [off1] {sym} (ADDconst [off2] x) mem)
8302         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
8303         // result: (MOVHZload [off1+int32(off2)] {sym} x mem)
8304         for {
8305                 off1 := auxIntToInt32(v.AuxInt)
8306                 sym := auxToSym(v.Aux)
8307                 if v_0.Op != OpPPC64ADDconst {
8308                         break
8309                 }
8310                 off2 := auxIntToInt64(v_0.AuxInt)
8311                 x := v_0.Args[0]
8312                 mem := v_1
8313                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
8314                         break
8315                 }
8316                 v.reset(OpPPC64MOVHZload)
8317                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8318                 v.Aux = symToAux(sym)
8319                 v.AddArg2(x, mem)
8320                 return true
8321         }
8322         // match: (MOVHZload [0] {sym} p:(ADD ptr idx) mem)
8323         // cond: sym == nil && p.Uses == 1
8324         // result: (MOVHZloadidx ptr idx mem)
8325         for {
8326                 if auxIntToInt32(v.AuxInt) != 0 {
8327                         break
8328                 }
8329                 sym := auxToSym(v.Aux)
8330                 p := v_0
8331                 if p.Op != OpPPC64ADD {
8332                         break
8333                 }
8334                 idx := p.Args[1]
8335                 ptr := p.Args[0]
8336                 mem := v_1
8337                 if !(sym == nil && p.Uses == 1) {
8338                         break
8339                 }
8340                 v.reset(OpPPC64MOVHZloadidx)
8341                 v.AddArg3(ptr, idx, mem)
8342                 return true
8343         }
8344         return false
8345 }
8346 func rewriteValuePPC64_OpPPC64MOVHZloadidx(v *Value) bool {
8347         v_2 := v.Args[2]
8348         v_1 := v.Args[1]
8349         v_0 := v.Args[0]
8350         // match: (MOVHZloadidx ptr (MOVDconst [c]) mem)
8351         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8352         // result: (MOVHZload [int32(c)] ptr mem)
8353         for {
8354                 ptr := v_0
8355                 if v_1.Op != OpPPC64MOVDconst {
8356                         break
8357                 }
8358                 c := auxIntToInt64(v_1.AuxInt)
8359                 mem := v_2
8360                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8361                         break
8362                 }
8363                 v.reset(OpPPC64MOVHZload)
8364                 v.AuxInt = int32ToAuxInt(int32(c))
8365                 v.AddArg2(ptr, mem)
8366                 return true
8367         }
8368         // match: (MOVHZloadidx (MOVDconst [c]) ptr mem)
8369         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8370         // result: (MOVHZload [int32(c)] ptr mem)
8371         for {
8372                 if v_0.Op != OpPPC64MOVDconst {
8373                         break
8374                 }
8375                 c := auxIntToInt64(v_0.AuxInt)
8376                 ptr := v_1
8377                 mem := v_2
8378                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8379                         break
8380                 }
8381                 v.reset(OpPPC64MOVHZload)
8382                 v.AuxInt = int32ToAuxInt(int32(c))
8383                 v.AddArg2(ptr, mem)
8384                 return true
8385         }
8386         return false
8387 }
8388 func rewriteValuePPC64_OpPPC64MOVHZreg(v *Value) bool {
8389         v_0 := v.Args[0]
8390         b := v.Block
8391         typ := &b.Func.Config.Types
8392         // match: (MOVHZreg y:(Select0 (ANDCCconst [c] _)))
8393         // cond: uint64(c) <= 0xFFFF
8394         // result: y
8395         for {
8396                 y := v_0
8397                 if y.Op != OpSelect0 {
8398                         break
8399                 }
8400                 y_0 := y.Args[0]
8401                 if y_0.Op != OpPPC64ANDCCconst {
8402                         break
8403                 }
8404                 c := auxIntToInt64(y_0.AuxInt)
8405                 if !(uint64(c) <= 0xFFFF) {
8406                         break
8407                 }
8408                 v.copyOf(y)
8409                 return true
8410         }
8411         // match: (MOVHZreg (SRWconst [c] (MOVBZreg x)))
8412         // result: (SRWconst [c] (MOVBZreg x))
8413         for {
8414                 if v_0.Op != OpPPC64SRWconst {
8415                         break
8416                 }
8417                 c := auxIntToInt64(v_0.AuxInt)
8418                 v_0_0 := v_0.Args[0]
8419                 if v_0_0.Op != OpPPC64MOVBZreg {
8420                         break
8421                 }
8422                 x := v_0_0.Args[0]
8423                 v.reset(OpPPC64SRWconst)
8424                 v.AuxInt = int64ToAuxInt(c)
8425                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
8426                 v0.AddArg(x)
8427                 v.AddArg(v0)
8428                 return true
8429         }
8430         // match: (MOVHZreg (SRWconst [c] (MOVHZreg x)))
8431         // result: (SRWconst [c] (MOVHZreg x))
8432         for {
8433                 if v_0.Op != OpPPC64SRWconst {
8434                         break
8435                 }
8436                 c := auxIntToInt64(v_0.AuxInt)
8437                 v_0_0 := v_0.Args[0]
8438                 if v_0_0.Op != OpPPC64MOVHZreg {
8439                         break
8440                 }
8441                 x := v_0_0.Args[0]
8442                 v.reset(OpPPC64SRWconst)
8443                 v.AuxInt = int64ToAuxInt(c)
8444                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
8445                 v0.AddArg(x)
8446                 v.AddArg(v0)
8447                 return true
8448         }
8449         // match: (MOVHZreg (SRWconst [c] x))
8450         // cond: sizeof(x.Type) <= 16
8451         // result: (SRWconst [c] x)
8452         for {
8453                 if v_0.Op != OpPPC64SRWconst {
8454                         break
8455                 }
8456                 c := auxIntToInt64(v_0.AuxInt)
8457                 x := v_0.Args[0]
8458                 if !(sizeof(x.Type) <= 16) {
8459                         break
8460                 }
8461                 v.reset(OpPPC64SRWconst)
8462                 v.AuxInt = int64ToAuxInt(c)
8463                 v.AddArg(x)
8464                 return true
8465         }
8466         // match: (MOVHZreg (SRDconst [c] x))
8467         // cond: c>=48
8468         // result: (SRDconst [c] x)
8469         for {
8470                 if v_0.Op != OpPPC64SRDconst {
8471                         break
8472                 }
8473                 c := auxIntToInt64(v_0.AuxInt)
8474                 x := v_0.Args[0]
8475                 if !(c >= 48) {
8476                         break
8477                 }
8478                 v.reset(OpPPC64SRDconst)
8479                 v.AuxInt = int64ToAuxInt(c)
8480                 v.AddArg(x)
8481                 return true
8482         }
8483         // match: (MOVHZreg (SRWconst [c] x))
8484         // cond: c>=16
8485         // result: (SRWconst [c] x)
8486         for {
8487                 if v_0.Op != OpPPC64SRWconst {
8488                         break
8489                 }
8490                 c := auxIntToInt64(v_0.AuxInt)
8491                 x := v_0.Args[0]
8492                 if !(c >= 16) {
8493                         break
8494                 }
8495                 v.reset(OpPPC64SRWconst)
8496                 v.AuxInt = int64ToAuxInt(c)
8497                 v.AddArg(x)
8498                 return true
8499         }
8500         // match: (MOVHZreg y:(MOVHZreg _))
8501         // result: y
8502         for {
8503                 y := v_0
8504                 if y.Op != OpPPC64MOVHZreg {
8505                         break
8506                 }
8507                 v.copyOf(y)
8508                 return true
8509         }
8510         // match: (MOVHZreg y:(MOVBZreg _))
8511         // result: y
8512         for {
8513                 y := v_0
8514                 if y.Op != OpPPC64MOVBZreg {
8515                         break
8516                 }
8517                 v.copyOf(y)
8518                 return true
8519         }
8520         // match: (MOVHZreg y:(MOVHBRload _ _))
8521         // result: y
8522         for {
8523                 y := v_0
8524                 if y.Op != OpPPC64MOVHBRload {
8525                         break
8526                 }
8527                 v.copyOf(y)
8528                 return true
8529         }
8530         // match: (MOVHZreg y:(MOVHreg x))
8531         // result: (MOVHZreg x)
8532         for {
8533                 y := v_0
8534                 if y.Op != OpPPC64MOVHreg {
8535                         break
8536                 }
8537                 x := y.Args[0]
8538                 v.reset(OpPPC64MOVHZreg)
8539                 v.AddArg(x)
8540                 return true
8541         }
8542         // match: (MOVHZreg (OR <t> x (MOVWZreg y)))
8543         // result: (MOVHZreg (OR <t> x y))
8544         for {
8545                 if v_0.Op != OpPPC64OR {
8546                         break
8547                 }
8548                 t := v_0.Type
8549                 _ = v_0.Args[1]
8550                 v_0_0 := v_0.Args[0]
8551                 v_0_1 := v_0.Args[1]
8552                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8553                         x := v_0_0
8554                         if v_0_1.Op != OpPPC64MOVWZreg {
8555                                 continue
8556                         }
8557                         y := v_0_1.Args[0]
8558                         v.reset(OpPPC64MOVHZreg)
8559                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
8560                         v0.AddArg2(x, y)
8561                         v.AddArg(v0)
8562                         return true
8563                 }
8564                 break
8565         }
8566         // match: (MOVHZreg (XOR <t> x (MOVWZreg y)))
8567         // result: (MOVHZreg (XOR <t> x y))
8568         for {
8569                 if v_0.Op != OpPPC64XOR {
8570                         break
8571                 }
8572                 t := v_0.Type
8573                 _ = v_0.Args[1]
8574                 v_0_0 := v_0.Args[0]
8575                 v_0_1 := v_0.Args[1]
8576                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8577                         x := v_0_0
8578                         if v_0_1.Op != OpPPC64MOVWZreg {
8579                                 continue
8580                         }
8581                         y := v_0_1.Args[0]
8582                         v.reset(OpPPC64MOVHZreg)
8583                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
8584                         v0.AddArg2(x, y)
8585                         v.AddArg(v0)
8586                         return true
8587                 }
8588                 break
8589         }
8590         // match: (MOVHZreg (AND <t> x (MOVWZreg y)))
8591         // result: (MOVHZreg (AND <t> x y))
8592         for {
8593                 if v_0.Op != OpPPC64AND {
8594                         break
8595                 }
8596                 t := v_0.Type
8597                 _ = v_0.Args[1]
8598                 v_0_0 := v_0.Args[0]
8599                 v_0_1 := v_0.Args[1]
8600                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8601                         x := v_0_0
8602                         if v_0_1.Op != OpPPC64MOVWZreg {
8603                                 continue
8604                         }
8605                         y := v_0_1.Args[0]
8606                         v.reset(OpPPC64MOVHZreg)
8607                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
8608                         v0.AddArg2(x, y)
8609                         v.AddArg(v0)
8610                         return true
8611                 }
8612                 break
8613         }
8614         // match: (MOVHZreg (OR <t> x (MOVHZreg y)))
8615         // result: (MOVHZreg (OR <t> x y))
8616         for {
8617                 if v_0.Op != OpPPC64OR {
8618                         break
8619                 }
8620                 t := v_0.Type
8621                 _ = v_0.Args[1]
8622                 v_0_0 := v_0.Args[0]
8623                 v_0_1 := v_0.Args[1]
8624                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8625                         x := v_0_0
8626                         if v_0_1.Op != OpPPC64MOVHZreg {
8627                                 continue
8628                         }
8629                         y := v_0_1.Args[0]
8630                         v.reset(OpPPC64MOVHZreg)
8631                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
8632                         v0.AddArg2(x, y)
8633                         v.AddArg(v0)
8634                         return true
8635                 }
8636                 break
8637         }
8638         // match: (MOVHZreg (XOR <t> x (MOVHZreg y)))
8639         // result: (MOVHZreg (XOR <t> x y))
8640         for {
8641                 if v_0.Op != OpPPC64XOR {
8642                         break
8643                 }
8644                 t := v_0.Type
8645                 _ = v_0.Args[1]
8646                 v_0_0 := v_0.Args[0]
8647                 v_0_1 := v_0.Args[1]
8648                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8649                         x := v_0_0
8650                         if v_0_1.Op != OpPPC64MOVHZreg {
8651                                 continue
8652                         }
8653                         y := v_0_1.Args[0]
8654                         v.reset(OpPPC64MOVHZreg)
8655                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
8656                         v0.AddArg2(x, y)
8657                         v.AddArg(v0)
8658                         return true
8659                 }
8660                 break
8661         }
8662         // match: (MOVHZreg (AND <t> x (MOVHZreg y)))
8663         // result: (MOVHZreg (AND <t> x y))
8664         for {
8665                 if v_0.Op != OpPPC64AND {
8666                         break
8667                 }
8668                 t := v_0.Type
8669                 _ = v_0.Args[1]
8670                 v_0_0 := v_0.Args[0]
8671                 v_0_1 := v_0.Args[1]
8672                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
8673                         x := v_0_0
8674                         if v_0_1.Op != OpPPC64MOVHZreg {
8675                                 continue
8676                         }
8677                         y := v_0_1.Args[0]
8678                         v.reset(OpPPC64MOVHZreg)
8679                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
8680                         v0.AddArg2(x, y)
8681                         v.AddArg(v0)
8682                         return true
8683                 }
8684                 break
8685         }
8686         // match: (MOVHZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x))))
8687         // result: z
8688         for {
8689                 z := v_0
8690                 if z.Op != OpSelect0 {
8691                         break
8692                 }
8693                 z_0 := z.Args[0]
8694                 if z_0.Op != OpPPC64ANDCCconst {
8695                         break
8696                 }
8697                 z_0_0 := z_0.Args[0]
8698                 if z_0_0.Op != OpPPC64MOVBZload {
8699                         break
8700                 }
8701                 v.copyOf(z)
8702                 return true
8703         }
8704         // match: (MOVHZreg z:(AND y (MOVHZload ptr x)))
8705         // result: z
8706         for {
8707                 z := v_0
8708                 if z.Op != OpPPC64AND {
8709                         break
8710                 }
8711                 _ = z.Args[1]
8712                 z_0 := z.Args[0]
8713                 z_1 := z.Args[1]
8714                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
8715                         if z_1.Op != OpPPC64MOVHZload {
8716                                 continue
8717                         }
8718                         v.copyOf(z)
8719                         return true
8720                 }
8721                 break
8722         }
8723         // match: (MOVHZreg z:(Select0 (ANDCCconst [c] (MOVHZload ptr x))))
8724         // result: z
8725         for {
8726                 z := v_0
8727                 if z.Op != OpSelect0 {
8728                         break
8729                 }
8730                 z_0 := z.Args[0]
8731                 if z_0.Op != OpPPC64ANDCCconst {
8732                         break
8733                 }
8734                 z_0_0 := z_0.Args[0]
8735                 if z_0_0.Op != OpPPC64MOVHZload {
8736                         break
8737                 }
8738                 v.copyOf(z)
8739                 return true
8740         }
8741         // match: (MOVHZreg x:(MOVBZload _ _))
8742         // result: x
8743         for {
8744                 x := v_0
8745                 if x.Op != OpPPC64MOVBZload {
8746                         break
8747                 }
8748                 v.copyOf(x)
8749                 return true
8750         }
8751         // match: (MOVHZreg x:(MOVBZloadidx _ _ _))
8752         // result: x
8753         for {
8754                 x := v_0
8755                 if x.Op != OpPPC64MOVBZloadidx {
8756                         break
8757                 }
8758                 v.copyOf(x)
8759                 return true
8760         }
8761         // match: (MOVHZreg x:(MOVHZload _ _))
8762         // result: x
8763         for {
8764                 x := v_0
8765                 if x.Op != OpPPC64MOVHZload {
8766                         break
8767                 }
8768                 v.copyOf(x)
8769                 return true
8770         }
8771         // match: (MOVHZreg x:(MOVHZloadidx _ _ _))
8772         // result: x
8773         for {
8774                 x := v_0
8775                 if x.Op != OpPPC64MOVHZloadidx {
8776                         break
8777                 }
8778                 v.copyOf(x)
8779                 return true
8780         }
8781         // match: (MOVHZreg x:(Arg <t>))
8782         // cond: (is8BitInt(t) || is16BitInt(t)) && !t.IsSigned()
8783         // result: x
8784         for {
8785                 x := v_0
8786                 if x.Op != OpArg {
8787                         break
8788                 }
8789                 t := x.Type
8790                 if !((is8BitInt(t) || is16BitInt(t)) && !t.IsSigned()) {
8791                         break
8792                 }
8793                 v.copyOf(x)
8794                 return true
8795         }
8796         // match: (MOVHZreg (MOVDconst [c]))
8797         // result: (MOVDconst [int64(uint16(c))])
8798         for {
8799                 if v_0.Op != OpPPC64MOVDconst {
8800                         break
8801                 }
8802                 c := auxIntToInt64(v_0.AuxInt)
8803                 v.reset(OpPPC64MOVDconst)
8804                 v.AuxInt = int64ToAuxInt(int64(uint16(c)))
8805                 return true
8806         }
8807         return false
8808 }
8809 func rewriteValuePPC64_OpPPC64MOVHload(v *Value) bool {
8810         v_1 := v.Args[1]
8811         v_0 := v.Args[0]
8812         // match: (MOVHload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
8813         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
8814         // result: (MOVHload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
8815         for {
8816                 off1 := auxIntToInt32(v.AuxInt)
8817                 sym1 := auxToSym(v.Aux)
8818                 p := v_0
8819                 if p.Op != OpPPC64MOVDaddr {
8820                         break
8821                 }
8822                 off2 := auxIntToInt32(p.AuxInt)
8823                 sym2 := auxToSym(p.Aux)
8824                 ptr := p.Args[0]
8825                 mem := v_1
8826                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8827                         break
8828                 }
8829                 v.reset(OpPPC64MOVHload)
8830                 v.AuxInt = int32ToAuxInt(off1 + off2)
8831                 v.Aux = symToAux(mergeSym(sym1, sym2))
8832                 v.AddArg2(ptr, mem)
8833                 return true
8834         }
8835         // match: (MOVHload [off1] {sym} (ADDconst [off2] x) mem)
8836         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
8837         // result: (MOVHload [off1+int32(off2)] {sym} x mem)
8838         for {
8839                 off1 := auxIntToInt32(v.AuxInt)
8840                 sym := auxToSym(v.Aux)
8841                 if v_0.Op != OpPPC64ADDconst {
8842                         break
8843                 }
8844                 off2 := auxIntToInt64(v_0.AuxInt)
8845                 x := v_0.Args[0]
8846                 mem := v_1
8847                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
8848                         break
8849                 }
8850                 v.reset(OpPPC64MOVHload)
8851                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8852                 v.Aux = symToAux(sym)
8853                 v.AddArg2(x, mem)
8854                 return true
8855         }
8856         // match: (MOVHload [0] {sym} p:(ADD ptr idx) mem)
8857         // cond: sym == nil && p.Uses == 1
8858         // result: (MOVHloadidx ptr idx mem)
8859         for {
8860                 if auxIntToInt32(v.AuxInt) != 0 {
8861                         break
8862                 }
8863                 sym := auxToSym(v.Aux)
8864                 p := v_0
8865                 if p.Op != OpPPC64ADD {
8866                         break
8867                 }
8868                 idx := p.Args[1]
8869                 ptr := p.Args[0]
8870                 mem := v_1
8871                 if !(sym == nil && p.Uses == 1) {
8872                         break
8873                 }
8874                 v.reset(OpPPC64MOVHloadidx)
8875                 v.AddArg3(ptr, idx, mem)
8876                 return true
8877         }
8878         return false
8879 }
8880 func rewriteValuePPC64_OpPPC64MOVHloadidx(v *Value) bool {
8881         v_2 := v.Args[2]
8882         v_1 := v.Args[1]
8883         v_0 := v.Args[0]
8884         // match: (MOVHloadidx ptr (MOVDconst [c]) mem)
8885         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8886         // result: (MOVHload [int32(c)] ptr mem)
8887         for {
8888                 ptr := v_0
8889                 if v_1.Op != OpPPC64MOVDconst {
8890                         break
8891                 }
8892                 c := auxIntToInt64(v_1.AuxInt)
8893                 mem := v_2
8894                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8895                         break
8896                 }
8897                 v.reset(OpPPC64MOVHload)
8898                 v.AuxInt = int32ToAuxInt(int32(c))
8899                 v.AddArg2(ptr, mem)
8900                 return true
8901         }
8902         // match: (MOVHloadidx (MOVDconst [c]) ptr mem)
8903         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8904         // result: (MOVHload [int32(c)] ptr mem)
8905         for {
8906                 if v_0.Op != OpPPC64MOVDconst {
8907                         break
8908                 }
8909                 c := auxIntToInt64(v_0.AuxInt)
8910                 ptr := v_1
8911                 mem := v_2
8912                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8913                         break
8914                 }
8915                 v.reset(OpPPC64MOVHload)
8916                 v.AuxInt = int32ToAuxInt(int32(c))
8917                 v.AddArg2(ptr, mem)
8918                 return true
8919         }
8920         return false
8921 }
8922 func rewriteValuePPC64_OpPPC64MOVHreg(v *Value) bool {
8923         v_0 := v.Args[0]
8924         b := v.Block
8925         typ := &b.Func.Config.Types
8926         // match: (MOVHreg y:(Select0 (ANDCCconst [c] _)))
8927         // cond: uint64(c) <= 0x7FFF
8928         // result: y
8929         for {
8930                 y := v_0
8931                 if y.Op != OpSelect0 {
8932                         break
8933                 }
8934                 y_0 := y.Args[0]
8935                 if y_0.Op != OpPPC64ANDCCconst {
8936                         break
8937                 }
8938                 c := auxIntToInt64(y_0.AuxInt)
8939                 if !(uint64(c) <= 0x7FFF) {
8940                         break
8941                 }
8942                 v.copyOf(y)
8943                 return true
8944         }
8945         // match: (MOVHreg (SRAWconst [c] (MOVBreg x)))
8946         // result: (SRAWconst [c] (MOVBreg x))
8947         for {
8948                 if v_0.Op != OpPPC64SRAWconst {
8949                         break
8950                 }
8951                 c := auxIntToInt64(v_0.AuxInt)
8952                 v_0_0 := v_0.Args[0]
8953                 if v_0_0.Op != OpPPC64MOVBreg {
8954                         break
8955                 }
8956                 x := v_0_0.Args[0]
8957                 v.reset(OpPPC64SRAWconst)
8958                 v.AuxInt = int64ToAuxInt(c)
8959                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
8960                 v0.AddArg(x)
8961                 v.AddArg(v0)
8962                 return true
8963         }
8964         // match: (MOVHreg (SRAWconst [c] (MOVHreg x)))
8965         // result: (SRAWconst [c] (MOVHreg x))
8966         for {
8967                 if v_0.Op != OpPPC64SRAWconst {
8968                         break
8969                 }
8970                 c := auxIntToInt64(v_0.AuxInt)
8971                 v_0_0 := v_0.Args[0]
8972                 if v_0_0.Op != OpPPC64MOVHreg {
8973                         break
8974                 }
8975                 x := v_0_0.Args[0]
8976                 v.reset(OpPPC64SRAWconst)
8977                 v.AuxInt = int64ToAuxInt(c)
8978                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
8979                 v0.AddArg(x)
8980                 v.AddArg(v0)
8981                 return true
8982         }
8983         // match: (MOVHreg (SRAWconst [c] x))
8984         // cond: sizeof(x.Type) <= 16
8985         // result: (SRAWconst [c] x)
8986         for {
8987                 if v_0.Op != OpPPC64SRAWconst {
8988                         break
8989                 }
8990                 c := auxIntToInt64(v_0.AuxInt)
8991                 x := v_0.Args[0]
8992                 if !(sizeof(x.Type) <= 16) {
8993                         break
8994                 }
8995                 v.reset(OpPPC64SRAWconst)
8996                 v.AuxInt = int64ToAuxInt(c)
8997                 v.AddArg(x)
8998                 return true
8999         }
9000         // match: (MOVHreg (SRDconst [c] x))
9001         // cond: c>48
9002         // result: (SRDconst [c] x)
9003         for {
9004                 if v_0.Op != OpPPC64SRDconst {
9005                         break
9006                 }
9007                 c := auxIntToInt64(v_0.AuxInt)
9008                 x := v_0.Args[0]
9009                 if !(c > 48) {
9010                         break
9011                 }
9012                 v.reset(OpPPC64SRDconst)
9013                 v.AuxInt = int64ToAuxInt(c)
9014                 v.AddArg(x)
9015                 return true
9016         }
9017         // match: (MOVHreg (SRDconst [c] x))
9018         // cond: c==48
9019         // result: (SRADconst [c] x)
9020         for {
9021                 if v_0.Op != OpPPC64SRDconst {
9022                         break
9023                 }
9024                 c := auxIntToInt64(v_0.AuxInt)
9025                 x := v_0.Args[0]
9026                 if !(c == 48) {
9027                         break
9028                 }
9029                 v.reset(OpPPC64SRADconst)
9030                 v.AuxInt = int64ToAuxInt(c)
9031                 v.AddArg(x)
9032                 return true
9033         }
9034         // match: (MOVHreg (SRADconst [c] x))
9035         // cond: c>=48
9036         // result: (SRADconst [c] x)
9037         for {
9038                 if v_0.Op != OpPPC64SRADconst {
9039                         break
9040                 }
9041                 c := auxIntToInt64(v_0.AuxInt)
9042                 x := v_0.Args[0]
9043                 if !(c >= 48) {
9044                         break
9045                 }
9046                 v.reset(OpPPC64SRADconst)
9047                 v.AuxInt = int64ToAuxInt(c)
9048                 v.AddArg(x)
9049                 return true
9050         }
9051         // match: (MOVHreg (SRWconst [c] x))
9052         // cond: c>16
9053         // result: (SRWconst [c] x)
9054         for {
9055                 if v_0.Op != OpPPC64SRWconst {
9056                         break
9057                 }
9058                 c := auxIntToInt64(v_0.AuxInt)
9059                 x := v_0.Args[0]
9060                 if !(c > 16) {
9061                         break
9062                 }
9063                 v.reset(OpPPC64SRWconst)
9064                 v.AuxInt = int64ToAuxInt(c)
9065                 v.AddArg(x)
9066                 return true
9067         }
9068         // match: (MOVHreg (SRAWconst [c] x))
9069         // cond: c>=16
9070         // result: (SRAWconst [c] x)
9071         for {
9072                 if v_0.Op != OpPPC64SRAWconst {
9073                         break
9074                 }
9075                 c := auxIntToInt64(v_0.AuxInt)
9076                 x := v_0.Args[0]
9077                 if !(c >= 16) {
9078                         break
9079                 }
9080                 v.reset(OpPPC64SRAWconst)
9081                 v.AuxInt = int64ToAuxInt(c)
9082                 v.AddArg(x)
9083                 return true
9084         }
9085         // match: (MOVHreg (SRWconst [c] x))
9086         // cond: c==16
9087         // result: (SRAWconst [c] x)
9088         for {
9089                 if v_0.Op != OpPPC64SRWconst {
9090                         break
9091                 }
9092                 c := auxIntToInt64(v_0.AuxInt)
9093                 x := v_0.Args[0]
9094                 if !(c == 16) {
9095                         break
9096                 }
9097                 v.reset(OpPPC64SRAWconst)
9098                 v.AuxInt = int64ToAuxInt(c)
9099                 v.AddArg(x)
9100                 return true
9101         }
9102         // match: (MOVHreg y:(MOVHreg _))
9103         // result: y
9104         for {
9105                 y := v_0
9106                 if y.Op != OpPPC64MOVHreg {
9107                         break
9108                 }
9109                 v.copyOf(y)
9110                 return true
9111         }
9112         // match: (MOVHreg y:(MOVBreg _))
9113         // result: y
9114         for {
9115                 y := v_0
9116                 if y.Op != OpPPC64MOVBreg {
9117                         break
9118                 }
9119                 v.copyOf(y)
9120                 return true
9121         }
9122         // match: (MOVHreg y:(MOVHZreg x))
9123         // result: (MOVHreg x)
9124         for {
9125                 y := v_0
9126                 if y.Op != OpPPC64MOVHZreg {
9127                         break
9128                 }
9129                 x := y.Args[0]
9130                 v.reset(OpPPC64MOVHreg)
9131                 v.AddArg(x)
9132                 return true
9133         }
9134         // match: (MOVHreg x:(MOVHload _ _))
9135         // result: x
9136         for {
9137                 x := v_0
9138                 if x.Op != OpPPC64MOVHload {
9139                         break
9140                 }
9141                 v.copyOf(x)
9142                 return true
9143         }
9144         // match: (MOVHreg x:(MOVHloadidx _ _ _))
9145         // result: x
9146         for {
9147                 x := v_0
9148                 if x.Op != OpPPC64MOVHloadidx {
9149                         break
9150                 }
9151                 v.copyOf(x)
9152                 return true
9153         }
9154         // match: (MOVHreg x:(Arg <t>))
9155         // cond: (is8BitInt(t) || is16BitInt(t)) && t.IsSigned()
9156         // result: x
9157         for {
9158                 x := v_0
9159                 if x.Op != OpArg {
9160                         break
9161                 }
9162                 t := x.Type
9163                 if !((is8BitInt(t) || is16BitInt(t)) && t.IsSigned()) {
9164                         break
9165                 }
9166                 v.copyOf(x)
9167                 return true
9168         }
9169         // match: (MOVHreg (MOVDconst [c]))
9170         // result: (MOVDconst [int64(int16(c))])
9171         for {
9172                 if v_0.Op != OpPPC64MOVDconst {
9173                         break
9174                 }
9175                 c := auxIntToInt64(v_0.AuxInt)
9176                 v.reset(OpPPC64MOVDconst)
9177                 v.AuxInt = int64ToAuxInt(int64(int16(c)))
9178                 return true
9179         }
9180         return false
9181 }
9182 func rewriteValuePPC64_OpPPC64MOVHstore(v *Value) bool {
9183         v_2 := v.Args[2]
9184         v_1 := v.Args[1]
9185         v_0 := v.Args[0]
9186         b := v.Block
9187         // match: (MOVHstore [off1] {sym} (ADDconst [off2] x) val mem)
9188         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
9189         // result: (MOVHstore [off1+int32(off2)] {sym} x val mem)
9190         for {
9191                 off1 := auxIntToInt32(v.AuxInt)
9192                 sym := auxToSym(v.Aux)
9193                 if v_0.Op != OpPPC64ADDconst {
9194                         break
9195                 }
9196                 off2 := auxIntToInt64(v_0.AuxInt)
9197                 x := v_0.Args[0]
9198                 val := v_1
9199                 mem := v_2
9200                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
9201                         break
9202                 }
9203                 v.reset(OpPPC64MOVHstore)
9204                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9205                 v.Aux = symToAux(sym)
9206                 v.AddArg3(x, val, mem)
9207                 return true
9208         }
9209         // match: (MOVHstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
9210         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
9211         // result: (MOVHstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
9212         for {
9213                 off1 := auxIntToInt32(v.AuxInt)
9214                 sym1 := auxToSym(v.Aux)
9215                 p := v_0
9216                 if p.Op != OpPPC64MOVDaddr {
9217                         break
9218                 }
9219                 off2 := auxIntToInt32(p.AuxInt)
9220                 sym2 := auxToSym(p.Aux)
9221                 ptr := p.Args[0]
9222                 val := v_1
9223                 mem := v_2
9224                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
9225                         break
9226                 }
9227                 v.reset(OpPPC64MOVHstore)
9228                 v.AuxInt = int32ToAuxInt(off1 + off2)
9229                 v.Aux = symToAux(mergeSym(sym1, sym2))
9230                 v.AddArg3(ptr, val, mem)
9231                 return true
9232         }
9233         // match: (MOVHstore [off] {sym} ptr (MOVDconst [0]) mem)
9234         // result: (MOVHstorezero [off] {sym} ptr mem)
9235         for {
9236                 off := auxIntToInt32(v.AuxInt)
9237                 sym := auxToSym(v.Aux)
9238                 ptr := v_0
9239                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
9240                         break
9241                 }
9242                 mem := v_2
9243                 v.reset(OpPPC64MOVHstorezero)
9244                 v.AuxInt = int32ToAuxInt(off)
9245                 v.Aux = symToAux(sym)
9246                 v.AddArg2(ptr, mem)
9247                 return true
9248         }
9249         // match: (MOVHstore [0] {sym} p:(ADD ptr idx) val mem)
9250         // cond: sym == nil && p.Uses == 1
9251         // result: (MOVHstoreidx ptr idx val mem)
9252         for {
9253                 if auxIntToInt32(v.AuxInt) != 0 {
9254                         break
9255                 }
9256                 sym := auxToSym(v.Aux)
9257                 p := v_0
9258                 if p.Op != OpPPC64ADD {
9259                         break
9260                 }
9261                 idx := p.Args[1]
9262                 ptr := p.Args[0]
9263                 val := v_1
9264                 mem := v_2
9265                 if !(sym == nil && p.Uses == 1) {
9266                         break
9267                 }
9268                 v.reset(OpPPC64MOVHstoreidx)
9269                 v.AddArg4(ptr, idx, val, mem)
9270                 return true
9271         }
9272         // match: (MOVHstore [off] {sym} ptr (MOVHreg x) mem)
9273         // result: (MOVHstore [off] {sym} ptr x mem)
9274         for {
9275                 off := auxIntToInt32(v.AuxInt)
9276                 sym := auxToSym(v.Aux)
9277                 ptr := v_0
9278                 if v_1.Op != OpPPC64MOVHreg {
9279                         break
9280                 }
9281                 x := v_1.Args[0]
9282                 mem := v_2
9283                 v.reset(OpPPC64MOVHstore)
9284                 v.AuxInt = int32ToAuxInt(off)
9285                 v.Aux = symToAux(sym)
9286                 v.AddArg3(ptr, x, mem)
9287                 return true
9288         }
9289         // match: (MOVHstore [off] {sym} ptr (MOVHZreg x) mem)
9290         // result: (MOVHstore [off] {sym} ptr x mem)
9291         for {
9292                 off := auxIntToInt32(v.AuxInt)
9293                 sym := auxToSym(v.Aux)
9294                 ptr := v_0
9295                 if v_1.Op != OpPPC64MOVHZreg {
9296                         break
9297                 }
9298                 x := v_1.Args[0]
9299                 mem := v_2
9300                 v.reset(OpPPC64MOVHstore)
9301                 v.AuxInt = int32ToAuxInt(off)
9302                 v.Aux = symToAux(sym)
9303                 v.AddArg3(ptr, x, mem)
9304                 return true
9305         }
9306         // match: (MOVHstore [off] {sym} ptr (MOVWreg x) mem)
9307         // result: (MOVHstore [off] {sym} ptr x mem)
9308         for {
9309                 off := auxIntToInt32(v.AuxInt)
9310                 sym := auxToSym(v.Aux)
9311                 ptr := v_0
9312                 if v_1.Op != OpPPC64MOVWreg {
9313                         break
9314                 }
9315                 x := v_1.Args[0]
9316                 mem := v_2
9317                 v.reset(OpPPC64MOVHstore)
9318                 v.AuxInt = int32ToAuxInt(off)
9319                 v.Aux = symToAux(sym)
9320                 v.AddArg3(ptr, x, mem)
9321                 return true
9322         }
9323         // match: (MOVHstore [off] {sym} ptr (MOVWZreg x) mem)
9324         // result: (MOVHstore [off] {sym} ptr x mem)
9325         for {
9326                 off := auxIntToInt32(v.AuxInt)
9327                 sym := auxToSym(v.Aux)
9328                 ptr := v_0
9329                 if v_1.Op != OpPPC64MOVWZreg {
9330                         break
9331                 }
9332                 x := v_1.Args[0]
9333                 mem := v_2
9334                 v.reset(OpPPC64MOVHstore)
9335                 v.AuxInt = int32ToAuxInt(off)
9336                 v.Aux = symToAux(sym)
9337                 v.AddArg3(ptr, x, mem)
9338                 return true
9339         }
9340         // match: (MOVHstore [off] {sym} ptr r:(BRH val) mem)
9341         // cond: r.Uses == 1
9342         // result: (MOVHBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
9343         for {
9344                 off := auxIntToInt32(v.AuxInt)
9345                 sym := auxToSym(v.Aux)
9346                 ptr := v_0
9347                 r := v_1
9348                 if r.Op != OpPPC64BRH {
9349                         break
9350                 }
9351                 val := r.Args[0]
9352                 mem := v_2
9353                 if !(r.Uses == 1) {
9354                         break
9355                 }
9356                 v.reset(OpPPC64MOVHBRstore)
9357                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
9358                 v0.AuxInt = int32ToAuxInt(off)
9359                 v0.Aux = symToAux(sym)
9360                 v0.AddArg(ptr)
9361                 v.AddArg3(v0, val, mem)
9362                 return true
9363         }
9364         // match: (MOVHstore [off] {sym} ptr (Bswap16 val) mem)
9365         // result: (MOVHBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
9366         for {
9367                 off := auxIntToInt32(v.AuxInt)
9368                 sym := auxToSym(v.Aux)
9369                 ptr := v_0
9370                 if v_1.Op != OpBswap16 {
9371                         break
9372                 }
9373                 val := v_1.Args[0]
9374                 mem := v_2
9375                 v.reset(OpPPC64MOVHBRstore)
9376                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
9377                 v0.AuxInt = int32ToAuxInt(off)
9378                 v0.Aux = symToAux(sym)
9379                 v0.AddArg(ptr)
9380                 v.AddArg3(v0, val, mem)
9381                 return true
9382         }
9383         return false
9384 }
9385 func rewriteValuePPC64_OpPPC64MOVHstoreidx(v *Value) bool {
9386         v_3 := v.Args[3]
9387         v_2 := v.Args[2]
9388         v_1 := v.Args[1]
9389         v_0 := v.Args[0]
9390         // match: (MOVHstoreidx ptr (MOVDconst [c]) val mem)
9391         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9392         // result: (MOVHstore [int32(c)] ptr val mem)
9393         for {
9394                 ptr := v_0
9395                 if v_1.Op != OpPPC64MOVDconst {
9396                         break
9397                 }
9398                 c := auxIntToInt64(v_1.AuxInt)
9399                 val := v_2
9400                 mem := v_3
9401                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9402                         break
9403                 }
9404                 v.reset(OpPPC64MOVHstore)
9405                 v.AuxInt = int32ToAuxInt(int32(c))
9406                 v.AddArg3(ptr, val, mem)
9407                 return true
9408         }
9409         // match: (MOVHstoreidx (MOVDconst [c]) ptr val mem)
9410         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9411         // result: (MOVHstore [int32(c)] ptr val mem)
9412         for {
9413                 if v_0.Op != OpPPC64MOVDconst {
9414                         break
9415                 }
9416                 c := auxIntToInt64(v_0.AuxInt)
9417                 ptr := v_1
9418                 val := v_2
9419                 mem := v_3
9420                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9421                         break
9422                 }
9423                 v.reset(OpPPC64MOVHstore)
9424                 v.AuxInt = int32ToAuxInt(int32(c))
9425                 v.AddArg3(ptr, val, mem)
9426                 return true
9427         }
9428         // match: (MOVHstoreidx ptr idx (MOVHreg x) mem)
9429         // result: (MOVHstoreidx ptr idx x mem)
9430         for {
9431                 ptr := v_0
9432                 idx := v_1
9433                 if v_2.Op != OpPPC64MOVHreg {
9434                         break
9435                 }
9436                 x := v_2.Args[0]
9437                 mem := v_3
9438                 v.reset(OpPPC64MOVHstoreidx)
9439                 v.AddArg4(ptr, idx, x, mem)
9440                 return true
9441         }
9442         // match: (MOVHstoreidx ptr idx (MOVHZreg x) mem)
9443         // result: (MOVHstoreidx ptr idx x mem)
9444         for {
9445                 ptr := v_0
9446                 idx := v_1
9447                 if v_2.Op != OpPPC64MOVHZreg {
9448                         break
9449                 }
9450                 x := v_2.Args[0]
9451                 mem := v_3
9452                 v.reset(OpPPC64MOVHstoreidx)
9453                 v.AddArg4(ptr, idx, x, mem)
9454                 return true
9455         }
9456         // match: (MOVHstoreidx ptr idx (MOVWreg x) mem)
9457         // result: (MOVHstoreidx ptr idx x mem)
9458         for {
9459                 ptr := v_0
9460                 idx := v_1
9461                 if v_2.Op != OpPPC64MOVWreg {
9462                         break
9463                 }
9464                 x := v_2.Args[0]
9465                 mem := v_3
9466                 v.reset(OpPPC64MOVHstoreidx)
9467                 v.AddArg4(ptr, idx, x, mem)
9468                 return true
9469         }
9470         // match: (MOVHstoreidx ptr idx (MOVWZreg x) mem)
9471         // result: (MOVHstoreidx ptr idx x mem)
9472         for {
9473                 ptr := v_0
9474                 idx := v_1
9475                 if v_2.Op != OpPPC64MOVWZreg {
9476                         break
9477                 }
9478                 x := v_2.Args[0]
9479                 mem := v_3
9480                 v.reset(OpPPC64MOVHstoreidx)
9481                 v.AddArg4(ptr, idx, x, mem)
9482                 return true
9483         }
9484         // match: (MOVHstoreidx ptr idx r:(BRH val) mem)
9485         // cond: r.Uses == 1
9486         // result: (MOVHBRstoreidx ptr idx val mem)
9487         for {
9488                 ptr := v_0
9489                 idx := v_1
9490                 r := v_2
9491                 if r.Op != OpPPC64BRH {
9492                         break
9493                 }
9494                 val := r.Args[0]
9495                 mem := v_3
9496                 if !(r.Uses == 1) {
9497                         break
9498                 }
9499                 v.reset(OpPPC64MOVHBRstoreidx)
9500                 v.AddArg4(ptr, idx, val, mem)
9501                 return true
9502         }
9503         // match: (MOVHstoreidx ptr idx (Bswap16 val) mem)
9504         // result: (MOVHBRstoreidx ptr idx val mem)
9505         for {
9506                 ptr := v_0
9507                 idx := v_1
9508                 if v_2.Op != OpBswap16 {
9509                         break
9510                 }
9511                 val := v_2.Args[0]
9512                 mem := v_3
9513                 v.reset(OpPPC64MOVHBRstoreidx)
9514                 v.AddArg4(ptr, idx, val, mem)
9515                 return true
9516         }
9517         return false
9518 }
9519 func rewriteValuePPC64_OpPPC64MOVHstorezero(v *Value) bool {
9520         v_1 := v.Args[1]
9521         v_0 := v.Args[0]
9522         // match: (MOVHstorezero [off1] {sym} (ADDconst [off2] x) mem)
9523         // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2)))
9524         // result: (MOVHstorezero [off1+int32(off2)] {sym} x mem)
9525         for {
9526                 off1 := auxIntToInt32(v.AuxInt)
9527                 sym := auxToSym(v.Aux)
9528                 if v_0.Op != OpPPC64ADDconst {
9529                         break
9530                 }
9531                 off2 := auxIntToInt64(v_0.AuxInt)
9532                 x := v_0.Args[0]
9533                 mem := v_1
9534                 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
9535                         break
9536                 }
9537                 v.reset(OpPPC64MOVHstorezero)
9538                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9539                 v.Aux = symToAux(sym)
9540                 v.AddArg2(x, mem)
9541                 return true
9542         }
9543         // match: (MOVHstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
9544         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
9545         // result: (MOVHstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
9546         for {
9547                 off1 := auxIntToInt32(v.AuxInt)
9548                 sym1 := auxToSym(v.Aux)
9549                 p := v_0
9550                 if p.Op != OpPPC64MOVDaddr {
9551                         break
9552                 }
9553                 off2 := auxIntToInt32(p.AuxInt)
9554                 sym2 := auxToSym(p.Aux)
9555                 x := p.Args[0]
9556                 mem := v_1
9557                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
9558                         break
9559                 }
9560                 v.reset(OpPPC64MOVHstorezero)
9561                 v.AuxInt = int32ToAuxInt(off1 + off2)
9562                 v.Aux = symToAux(mergeSym(sym1, sym2))
9563                 v.AddArg2(x, mem)
9564                 return true
9565         }
9566         return false
9567 }
9568 func rewriteValuePPC64_OpPPC64MOVWBRstore(v *Value) bool {
9569         v_2 := v.Args[2]
9570         v_1 := v.Args[1]
9571         v_0 := v.Args[0]
9572         // match: (MOVWBRstore ptr (MOVWreg x) mem)
9573         // result: (MOVWBRstore ptr x mem)
9574         for {
9575                 ptr := v_0
9576                 if v_1.Op != OpPPC64MOVWreg {
9577                         break
9578                 }
9579                 x := v_1.Args[0]
9580                 mem := v_2
9581                 v.reset(OpPPC64MOVWBRstore)
9582                 v.AddArg3(ptr, x, mem)
9583                 return true
9584         }
9585         // match: (MOVWBRstore ptr (MOVWZreg x) mem)
9586         // result: (MOVWBRstore ptr x mem)
9587         for {
9588                 ptr := v_0
9589                 if v_1.Op != OpPPC64MOVWZreg {
9590                         break
9591                 }
9592                 x := v_1.Args[0]
9593                 mem := v_2
9594                 v.reset(OpPPC64MOVWBRstore)
9595                 v.AddArg3(ptr, x, mem)
9596                 return true
9597         }
9598         return false
9599 }
9600 func rewriteValuePPC64_OpPPC64MOVWZload(v *Value) bool {
9601         v_1 := v.Args[1]
9602         v_0 := v.Args[0]
9603         // match: (MOVWZload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
9604         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
9605         // result: (MOVWZload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
9606         for {
9607                 off1 := auxIntToInt32(v.AuxInt)
9608                 sym1 := auxToSym(v.Aux)
9609                 p := v_0
9610                 if p.Op != OpPPC64MOVDaddr {
9611                         break
9612                 }
9613                 off2 := auxIntToInt32(p.AuxInt)
9614                 sym2 := auxToSym(p.Aux)
9615                 ptr := p.Args[0]
9616                 mem := v_1
9617                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
9618                         break
9619                 }
9620                 v.reset(OpPPC64MOVWZload)
9621                 v.AuxInt = int32ToAuxInt(off1 + off2)
9622                 v.Aux = symToAux(mergeSym(sym1, sym2))
9623                 v.AddArg2(ptr, mem)
9624                 return true
9625         }
9626         // match: (MOVWZload [off1] {sym} (ADDconst [off2] x) mem)
9627         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
9628         // result: (MOVWZload [off1+int32(off2)] {sym} x mem)
9629         for {
9630                 off1 := auxIntToInt32(v.AuxInt)
9631                 sym := auxToSym(v.Aux)
9632                 if v_0.Op != OpPPC64ADDconst {
9633                         break
9634                 }
9635                 off2 := auxIntToInt64(v_0.AuxInt)
9636                 x := v_0.Args[0]
9637                 mem := v_1
9638                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
9639                         break
9640                 }
9641                 v.reset(OpPPC64MOVWZload)
9642                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9643                 v.Aux = symToAux(sym)
9644                 v.AddArg2(x, mem)
9645                 return true
9646         }
9647         // match: (MOVWZload [0] {sym} p:(ADD ptr idx) mem)
9648         // cond: sym == nil && p.Uses == 1
9649         // result: (MOVWZloadidx ptr idx mem)
9650         for {
9651                 if auxIntToInt32(v.AuxInt) != 0 {
9652                         break
9653                 }
9654                 sym := auxToSym(v.Aux)
9655                 p := v_0
9656                 if p.Op != OpPPC64ADD {
9657                         break
9658                 }
9659                 idx := p.Args[1]
9660                 ptr := p.Args[0]
9661                 mem := v_1
9662                 if !(sym == nil && p.Uses == 1) {
9663                         break
9664                 }
9665                 v.reset(OpPPC64MOVWZloadidx)
9666                 v.AddArg3(ptr, idx, mem)
9667                 return true
9668         }
9669         return false
9670 }
9671 func rewriteValuePPC64_OpPPC64MOVWZloadidx(v *Value) bool {
9672         v_2 := v.Args[2]
9673         v_1 := v.Args[1]
9674         v_0 := v.Args[0]
9675         // match: (MOVWZloadidx ptr (MOVDconst [c]) mem)
9676         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9677         // result: (MOVWZload [int32(c)] ptr mem)
9678         for {
9679                 ptr := v_0
9680                 if v_1.Op != OpPPC64MOVDconst {
9681                         break
9682                 }
9683                 c := auxIntToInt64(v_1.AuxInt)
9684                 mem := v_2
9685                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9686                         break
9687                 }
9688                 v.reset(OpPPC64MOVWZload)
9689                 v.AuxInt = int32ToAuxInt(int32(c))
9690                 v.AddArg2(ptr, mem)
9691                 return true
9692         }
9693         // match: (MOVWZloadidx (MOVDconst [c]) ptr mem)
9694         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9695         // result: (MOVWZload [int32(c)] ptr mem)
9696         for {
9697                 if v_0.Op != OpPPC64MOVDconst {
9698                         break
9699                 }
9700                 c := auxIntToInt64(v_0.AuxInt)
9701                 ptr := v_1
9702                 mem := v_2
9703                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9704                         break
9705                 }
9706                 v.reset(OpPPC64MOVWZload)
9707                 v.AuxInt = int32ToAuxInt(int32(c))
9708                 v.AddArg2(ptr, mem)
9709                 return true
9710         }
9711         return false
9712 }
9713 func rewriteValuePPC64_OpPPC64MOVWZreg(v *Value) bool {
9714         v_0 := v.Args[0]
9715         b := v.Block
9716         typ := &b.Func.Config.Types
9717         // match: (MOVWZreg y:(Select0 (ANDCCconst [c] _)))
9718         // cond: uint64(c) <= 0xFFFFFFFF
9719         // result: y
9720         for {
9721                 y := v_0
9722                 if y.Op != OpSelect0 {
9723                         break
9724                 }
9725                 y_0 := y.Args[0]
9726                 if y_0.Op != OpPPC64ANDCCconst {
9727                         break
9728                 }
9729                 c := auxIntToInt64(y_0.AuxInt)
9730                 if !(uint64(c) <= 0xFFFFFFFF) {
9731                         break
9732                 }
9733                 v.copyOf(y)
9734                 return true
9735         }
9736         // match: (MOVWZreg y:(AND (MOVDconst [c]) _))
9737         // cond: uint64(c) <= 0xFFFFFFFF
9738         // result: y
9739         for {
9740                 y := v_0
9741                 if y.Op != OpPPC64AND {
9742                         break
9743                 }
9744                 y_0 := y.Args[0]
9745                 y_1 := y.Args[1]
9746                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
9747                         if y_0.Op != OpPPC64MOVDconst {
9748                                 continue
9749                         }
9750                         c := auxIntToInt64(y_0.AuxInt)
9751                         if !(uint64(c) <= 0xFFFFFFFF) {
9752                                 continue
9753                         }
9754                         v.copyOf(y)
9755                         return true
9756                 }
9757                 break
9758         }
9759         // match: (MOVWZreg (SRWconst [c] (MOVBZreg x)))
9760         // result: (SRWconst [c] (MOVBZreg x))
9761         for {
9762                 if v_0.Op != OpPPC64SRWconst {
9763                         break
9764                 }
9765                 c := auxIntToInt64(v_0.AuxInt)
9766                 v_0_0 := v_0.Args[0]
9767                 if v_0_0.Op != OpPPC64MOVBZreg {
9768                         break
9769                 }
9770                 x := v_0_0.Args[0]
9771                 v.reset(OpPPC64SRWconst)
9772                 v.AuxInt = int64ToAuxInt(c)
9773                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
9774                 v0.AddArg(x)
9775                 v.AddArg(v0)
9776                 return true
9777         }
9778         // match: (MOVWZreg (SRWconst [c] (MOVHZreg x)))
9779         // result: (SRWconst [c] (MOVHZreg x))
9780         for {
9781                 if v_0.Op != OpPPC64SRWconst {
9782                         break
9783                 }
9784                 c := auxIntToInt64(v_0.AuxInt)
9785                 v_0_0 := v_0.Args[0]
9786                 if v_0_0.Op != OpPPC64MOVHZreg {
9787                         break
9788                 }
9789                 x := v_0_0.Args[0]
9790                 v.reset(OpPPC64SRWconst)
9791                 v.AuxInt = int64ToAuxInt(c)
9792                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
9793                 v0.AddArg(x)
9794                 v.AddArg(v0)
9795                 return true
9796         }
9797         // match: (MOVWZreg (SRWconst [c] (MOVWZreg x)))
9798         // result: (SRWconst [c] (MOVWZreg x))
9799         for {
9800                 if v_0.Op != OpPPC64SRWconst {
9801                         break
9802                 }
9803                 c := auxIntToInt64(v_0.AuxInt)
9804                 v_0_0 := v_0.Args[0]
9805                 if v_0_0.Op != OpPPC64MOVWZreg {
9806                         break
9807                 }
9808                 x := v_0_0.Args[0]
9809                 v.reset(OpPPC64SRWconst)
9810                 v.AuxInt = int64ToAuxInt(c)
9811                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
9812                 v0.AddArg(x)
9813                 v.AddArg(v0)
9814                 return true
9815         }
9816         // match: (MOVWZreg (SRWconst [c] x))
9817         // cond: sizeof(x.Type) <= 32
9818         // result: (SRWconst [c] x)
9819         for {
9820                 if v_0.Op != OpPPC64SRWconst {
9821                         break
9822                 }
9823                 c := auxIntToInt64(v_0.AuxInt)
9824                 x := v_0.Args[0]
9825                 if !(sizeof(x.Type) <= 32) {
9826                         break
9827                 }
9828                 v.reset(OpPPC64SRWconst)
9829                 v.AuxInt = int64ToAuxInt(c)
9830                 v.AddArg(x)
9831                 return true
9832         }
9833         // match: (MOVWZreg (SRDconst [c] x))
9834         // cond: c>=32
9835         // result: (SRDconst [c] x)
9836         for {
9837                 if v_0.Op != OpPPC64SRDconst {
9838                         break
9839                 }
9840                 c := auxIntToInt64(v_0.AuxInt)
9841                 x := v_0.Args[0]
9842                 if !(c >= 32) {
9843                         break
9844                 }
9845                 v.reset(OpPPC64SRDconst)
9846                 v.AuxInt = int64ToAuxInt(c)
9847                 v.AddArg(x)
9848                 return true
9849         }
9850         // match: (MOVWZreg y:(MOVWZreg _))
9851         // result: y
9852         for {
9853                 y := v_0
9854                 if y.Op != OpPPC64MOVWZreg {
9855                         break
9856                 }
9857                 v.copyOf(y)
9858                 return true
9859         }
9860         // match: (MOVWZreg y:(MOVHZreg _))
9861         // result: y
9862         for {
9863                 y := v_0
9864                 if y.Op != OpPPC64MOVHZreg {
9865                         break
9866                 }
9867                 v.copyOf(y)
9868                 return true
9869         }
9870         // match: (MOVWZreg y:(MOVBZreg _))
9871         // result: y
9872         for {
9873                 y := v_0
9874                 if y.Op != OpPPC64MOVBZreg {
9875                         break
9876                 }
9877                 v.copyOf(y)
9878                 return true
9879         }
9880         // match: (MOVWZreg y:(MOVHBRload _ _))
9881         // result: y
9882         for {
9883                 y := v_0
9884                 if y.Op != OpPPC64MOVHBRload {
9885                         break
9886                 }
9887                 v.copyOf(y)
9888                 return true
9889         }
9890         // match: (MOVWZreg y:(MOVWBRload _ _))
9891         // result: y
9892         for {
9893                 y := v_0
9894                 if y.Op != OpPPC64MOVWBRload {
9895                         break
9896                 }
9897                 v.copyOf(y)
9898                 return true
9899         }
9900         // match: (MOVWZreg y:(MOVWreg x))
9901         // result: (MOVWZreg x)
9902         for {
9903                 y := v_0
9904                 if y.Op != OpPPC64MOVWreg {
9905                         break
9906                 }
9907                 x := y.Args[0]
9908                 v.reset(OpPPC64MOVWZreg)
9909                 v.AddArg(x)
9910                 return true
9911         }
9912         // match: (MOVWZreg (OR <t> x (MOVWZreg y)))
9913         // result: (MOVWZreg (OR <t> x y))
9914         for {
9915                 if v_0.Op != OpPPC64OR {
9916                         break
9917                 }
9918                 t := v_0.Type
9919                 _ = v_0.Args[1]
9920                 v_0_0 := v_0.Args[0]
9921                 v_0_1 := v_0.Args[1]
9922                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9923                         x := v_0_0
9924                         if v_0_1.Op != OpPPC64MOVWZreg {
9925                                 continue
9926                         }
9927                         y := v_0_1.Args[0]
9928                         v.reset(OpPPC64MOVWZreg)
9929                         v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
9930                         v0.AddArg2(x, y)
9931                         v.AddArg(v0)
9932                         return true
9933                 }
9934                 break
9935         }
9936         // match: (MOVWZreg (XOR <t> x (MOVWZreg y)))
9937         // result: (MOVWZreg (XOR <t> x y))
9938         for {
9939                 if v_0.Op != OpPPC64XOR {
9940                         break
9941                 }
9942                 t := v_0.Type
9943                 _ = v_0.Args[1]
9944                 v_0_0 := v_0.Args[0]
9945                 v_0_1 := v_0.Args[1]
9946                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9947                         x := v_0_0
9948                         if v_0_1.Op != OpPPC64MOVWZreg {
9949                                 continue
9950                         }
9951                         y := v_0_1.Args[0]
9952                         v.reset(OpPPC64MOVWZreg)
9953                         v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
9954                         v0.AddArg2(x, y)
9955                         v.AddArg(v0)
9956                         return true
9957                 }
9958                 break
9959         }
9960         // match: (MOVWZreg (AND <t> x (MOVWZreg y)))
9961         // result: (MOVWZreg (AND <t> x y))
9962         for {
9963                 if v_0.Op != OpPPC64AND {
9964                         break
9965                 }
9966                 t := v_0.Type
9967                 _ = v_0.Args[1]
9968                 v_0_0 := v_0.Args[0]
9969                 v_0_1 := v_0.Args[1]
9970                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
9971                         x := v_0_0
9972                         if v_0_1.Op != OpPPC64MOVWZreg {
9973                                 continue
9974                         }
9975                         y := v_0_1.Args[0]
9976                         v.reset(OpPPC64MOVWZreg)
9977                         v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
9978                         v0.AddArg2(x, y)
9979                         v.AddArg(v0)
9980                         return true
9981                 }
9982                 break
9983         }
9984         // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x))))
9985         // result: z
9986         for {
9987                 z := v_0
9988                 if z.Op != OpSelect0 {
9989                         break
9990                 }
9991                 z_0 := z.Args[0]
9992                 if z_0.Op != OpPPC64ANDCCconst {
9993                         break
9994                 }
9995                 z_0_0 := z_0.Args[0]
9996                 if z_0_0.Op != OpPPC64MOVBZload {
9997                         break
9998                 }
9999                 v.copyOf(z)
10000                 return true
10001         }
10002         // match: (MOVWZreg z:(AND y (MOVWZload ptr x)))
10003         // result: z
10004         for {
10005                 z := v_0
10006                 if z.Op != OpPPC64AND {
10007                         break
10008                 }
10009                 _ = z.Args[1]
10010                 z_0 := z.Args[0]
10011                 z_1 := z.Args[1]
10012                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
10013                         if z_1.Op != OpPPC64MOVWZload {
10014                                 continue
10015                         }
10016                         v.copyOf(z)
10017                         return true
10018                 }
10019                 break
10020         }
10021         // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVHZload ptr x))))
10022         // result: z
10023         for {
10024                 z := v_0
10025                 if z.Op != OpSelect0 {
10026                         break
10027                 }
10028                 z_0 := z.Args[0]
10029                 if z_0.Op != OpPPC64ANDCCconst {
10030                         break
10031                 }
10032                 z_0_0 := z_0.Args[0]
10033                 if z_0_0.Op != OpPPC64MOVHZload {
10034                         break
10035                 }
10036                 v.copyOf(z)
10037                 return true
10038         }
10039         // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVWZload ptr x))))
10040         // result: z
10041         for {
10042                 z := v_0
10043                 if z.Op != OpSelect0 {
10044                         break
10045                 }
10046                 z_0 := z.Args[0]
10047                 if z_0.Op != OpPPC64ANDCCconst {
10048                         break
10049                 }
10050                 z_0_0 := z_0.Args[0]
10051                 if z_0_0.Op != OpPPC64MOVWZload {
10052                         break
10053                 }
10054                 v.copyOf(z)
10055                 return true
10056         }
10057         // match: (MOVWZreg x:(MOVBZload _ _))
10058         // result: x
10059         for {
10060                 x := v_0
10061                 if x.Op != OpPPC64MOVBZload {
10062                         break
10063                 }
10064                 v.copyOf(x)
10065                 return true
10066         }
10067         // match: (MOVWZreg x:(MOVBZloadidx _ _ _))
10068         // result: x
10069         for {
10070                 x := v_0
10071                 if x.Op != OpPPC64MOVBZloadidx {
10072                         break
10073                 }
10074                 v.copyOf(x)
10075                 return true
10076         }
10077         // match: (MOVWZreg x:(MOVHZload _ _))
10078         // result: x
10079         for {
10080                 x := v_0
10081                 if x.Op != OpPPC64MOVHZload {
10082                         break
10083                 }
10084                 v.copyOf(x)
10085                 return true
10086         }
10087         // match: (MOVWZreg x:(MOVHZloadidx _ _ _))
10088         // result: x
10089         for {
10090                 x := v_0
10091                 if x.Op != OpPPC64MOVHZloadidx {
10092                         break
10093                 }
10094                 v.copyOf(x)
10095                 return true
10096         }
10097         // match: (MOVWZreg x:(MOVWZload _ _))
10098         // result: x
10099         for {
10100                 x := v_0
10101                 if x.Op != OpPPC64MOVWZload {
10102                         break
10103                 }
10104                 v.copyOf(x)
10105                 return true
10106         }
10107         // match: (MOVWZreg x:(MOVWZloadidx _ _ _))
10108         // result: x
10109         for {
10110                 x := v_0
10111                 if x.Op != OpPPC64MOVWZloadidx {
10112                         break
10113                 }
10114                 v.copyOf(x)
10115                 return true
10116         }
10117         // match: (MOVWZreg x:(Select0 (LoweredAtomicLoad32 _ _)))
10118         // result: x
10119         for {
10120                 x := v_0
10121                 if x.Op != OpSelect0 {
10122                         break
10123                 }
10124                 x_0 := x.Args[0]
10125                 if x_0.Op != OpPPC64LoweredAtomicLoad32 {
10126                         break
10127                 }
10128                 v.copyOf(x)
10129                 return true
10130         }
10131         // match: (MOVWZreg x:(Arg <t>))
10132         // cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !t.IsSigned()
10133         // result: x
10134         for {
10135                 x := v_0
10136                 if x.Op != OpArg {
10137                         break
10138                 }
10139                 t := x.Type
10140                 if !((is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !t.IsSigned()) {
10141                         break
10142                 }
10143                 v.copyOf(x)
10144                 return true
10145         }
10146         // match: (MOVWZreg (MOVDconst [c]))
10147         // result: (MOVDconst [int64(uint32(c))])
10148         for {
10149                 if v_0.Op != OpPPC64MOVDconst {
10150                         break
10151                 }
10152                 c := auxIntToInt64(v_0.AuxInt)
10153                 v.reset(OpPPC64MOVDconst)
10154                 v.AuxInt = int64ToAuxInt(int64(uint32(c)))
10155                 return true
10156         }
10157         return false
10158 }
10159 func rewriteValuePPC64_OpPPC64MOVWload(v *Value) bool {
10160         v_1 := v.Args[1]
10161         v_0 := v.Args[0]
10162         // match: (MOVWload [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) mem)
10163         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
10164         // result: (MOVWload [off1+off2] {mergeSym(sym1,sym2)} ptr mem)
10165         for {
10166                 off1 := auxIntToInt32(v.AuxInt)
10167                 sym1 := auxToSym(v.Aux)
10168                 p := v_0
10169                 if p.Op != OpPPC64MOVDaddr {
10170                         break
10171                 }
10172                 off2 := auxIntToInt32(p.AuxInt)
10173                 sym2 := auxToSym(p.Aux)
10174                 ptr := p.Args[0]
10175                 mem := v_1
10176                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
10177                         break
10178                 }
10179                 v.reset(OpPPC64MOVWload)
10180                 v.AuxInt = int32ToAuxInt(off1 + off2)
10181                 v.Aux = symToAux(mergeSym(sym1, sym2))
10182                 v.AddArg2(ptr, mem)
10183                 return true
10184         }
10185         // match: (MOVWload [off1] {sym} (ADDconst [off2] x) mem)
10186         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
10187         // result: (MOVWload [off1+int32(off2)] {sym} x mem)
10188         for {
10189                 off1 := auxIntToInt32(v.AuxInt)
10190                 sym := auxToSym(v.Aux)
10191                 if v_0.Op != OpPPC64ADDconst {
10192                         break
10193                 }
10194                 off2 := auxIntToInt64(v_0.AuxInt)
10195                 x := v_0.Args[0]
10196                 mem := v_1
10197                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
10198                         break
10199                 }
10200                 v.reset(OpPPC64MOVWload)
10201                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10202                 v.Aux = symToAux(sym)
10203                 v.AddArg2(x, mem)
10204                 return true
10205         }
10206         // match: (MOVWload [0] {sym} p:(ADD ptr idx) mem)
10207         // cond: sym == nil && p.Uses == 1
10208         // result: (MOVWloadidx ptr idx mem)
10209         for {
10210                 if auxIntToInt32(v.AuxInt) != 0 {
10211                         break
10212                 }
10213                 sym := auxToSym(v.Aux)
10214                 p := v_0
10215                 if p.Op != OpPPC64ADD {
10216                         break
10217                 }
10218                 idx := p.Args[1]
10219                 ptr := p.Args[0]
10220                 mem := v_1
10221                 if !(sym == nil && p.Uses == 1) {
10222                         break
10223                 }
10224                 v.reset(OpPPC64MOVWloadidx)
10225                 v.AddArg3(ptr, idx, mem)
10226                 return true
10227         }
10228         return false
10229 }
10230 func rewriteValuePPC64_OpPPC64MOVWloadidx(v *Value) bool {
10231         v_2 := v.Args[2]
10232         v_1 := v.Args[1]
10233         v_0 := v.Args[0]
10234         // match: (MOVWloadidx ptr (MOVDconst [c]) mem)
10235         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
10236         // result: (MOVWload [int32(c)] ptr mem)
10237         for {
10238                 ptr := v_0
10239                 if v_1.Op != OpPPC64MOVDconst {
10240                         break
10241                 }
10242                 c := auxIntToInt64(v_1.AuxInt)
10243                 mem := v_2
10244                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10245                         break
10246                 }
10247                 v.reset(OpPPC64MOVWload)
10248                 v.AuxInt = int32ToAuxInt(int32(c))
10249                 v.AddArg2(ptr, mem)
10250                 return true
10251         }
10252         // match: (MOVWloadidx (MOVDconst [c]) ptr mem)
10253         // cond: ((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
10254         // result: (MOVWload [int32(c)] ptr mem)
10255         for {
10256                 if v_0.Op != OpPPC64MOVDconst {
10257                         break
10258                 }
10259                 c := auxIntToInt64(v_0.AuxInt)
10260                 ptr := v_1
10261                 mem := v_2
10262                 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10263                         break
10264                 }
10265                 v.reset(OpPPC64MOVWload)
10266                 v.AuxInt = int32ToAuxInt(int32(c))
10267                 v.AddArg2(ptr, mem)
10268                 return true
10269         }
10270         return false
10271 }
10272 func rewriteValuePPC64_OpPPC64MOVWreg(v *Value) bool {
10273         v_0 := v.Args[0]
10274         b := v.Block
10275         typ := &b.Func.Config.Types
10276         // match: (MOVWreg y:(Select0 (ANDCCconst [c] _)))
10277         // cond: uint64(c) <= 0xFFFF
10278         // result: y
10279         for {
10280                 y := v_0
10281                 if y.Op != OpSelect0 {
10282                         break
10283                 }
10284                 y_0 := y.Args[0]
10285                 if y_0.Op != OpPPC64ANDCCconst {
10286                         break
10287                 }
10288                 c := auxIntToInt64(y_0.AuxInt)
10289                 if !(uint64(c) <= 0xFFFF) {
10290                         break
10291                 }
10292                 v.copyOf(y)
10293                 return true
10294         }
10295         // match: (MOVWreg y:(AND (MOVDconst [c]) _))
10296         // cond: uint64(c) <= 0x7FFFFFFF
10297         // result: y
10298         for {
10299                 y := v_0
10300                 if y.Op != OpPPC64AND {
10301                         break
10302                 }
10303                 y_0 := y.Args[0]
10304                 y_1 := y.Args[1]
10305                 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
10306                         if y_0.Op != OpPPC64MOVDconst {
10307                                 continue
10308                         }
10309                         c := auxIntToInt64(y_0.AuxInt)
10310                         if !(uint64(c) <= 0x7FFFFFFF) {
10311                                 continue
10312                         }
10313                         v.copyOf(y)
10314                         return true
10315                 }
10316                 break
10317         }
10318         // match: (MOVWreg (SRAWconst [c] (MOVBreg x)))
10319         // result: (SRAWconst [c] (MOVBreg x))
10320         for {
10321                 if v_0.Op != OpPPC64SRAWconst {
10322                         break
10323                 }
10324                 c := auxIntToInt64(v_0.AuxInt)
10325                 v_0_0 := v_0.Args[0]
10326                 if v_0_0.Op != OpPPC64MOVBreg {
10327                         break
10328                 }
10329                 x := v_0_0.Args[0]
10330                 v.reset(OpPPC64SRAWconst)
10331                 v.AuxInt = int64ToAuxInt(c)
10332                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
10333                 v0.AddArg(x)
10334                 v.AddArg(v0)
10335                 return true
10336         }
10337         // match: (MOVWreg (SRAWconst [c] (MOVHreg x)))
10338         // result: (SRAWconst [c] (MOVHreg x))
10339         for {
10340                 if v_0.Op != OpPPC64SRAWconst {
10341                         break
10342                 }
10343                 c := auxIntToInt64(v_0.AuxInt)
10344                 v_0_0 := v_0.Args[0]
10345                 if v_0_0.Op != OpPPC64MOVHreg {
10346                         break
10347                 }
10348                 x := v_0_0.Args[0]
10349                 v.reset(OpPPC64SRAWconst)
10350                 v.AuxInt = int64ToAuxInt(c)
10351                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
10352                 v0.AddArg(x)
10353                 v.AddArg(v0)
10354                 return true
10355         }
10356         // match: (MOVWreg (SRAWconst [c] (MOVWreg x)))
10357         // result: (SRAWconst [c] (MOVWreg x))
10358         for {
10359                 if v_0.Op != OpPPC64SRAWconst {
10360                         break
10361                 }
10362                 c := auxIntToInt64(v_0.AuxInt)
10363                 v_0_0 := v_0.Args[0]
10364                 if v_0_0.Op != OpPPC64MOVWreg {
10365                         break
10366                 }
10367                 x := v_0_0.Args[0]
10368                 v.reset(OpPPC64SRAWconst)
10369                 v.AuxInt = int64ToAuxInt(c)
10370                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWreg, typ.Int64)
10371                 v0.AddArg(x)
10372                 v.AddArg(v0)
10373                 return true
10374         }
10375         // match: (MOVWreg (SRAWconst [c] x))
10376         // cond: sizeof(x.Type) <= 32
10377         // result: (SRAWconst [c] x)
10378         for {
10379                 if v_0.Op != OpPPC64SRAWconst {
10380                         break
10381                 }
10382                 c := auxIntToInt64(v_0.AuxInt)
10383                 x := v_0.Args[0]
10384                 if !(sizeof(x.Type) <= 32) {
10385                         break
10386                 }
10387                 v.reset(OpPPC64SRAWconst)
10388                 v.AuxInt = int64ToAuxInt(c)
10389                 v.AddArg(x)
10390                 return true
10391         }
10392         // match: (MOVWreg (SRDconst [c] x))
10393         // cond: c>32
10394         // result: (SRDconst [c] x)
10395         for {
10396                 if v_0.Op != OpPPC64SRDconst {
10397                         break
10398                 }
10399                 c := auxIntToInt64(v_0.AuxInt)
10400                 x := v_0.Args[0]
10401                 if !(c > 32) {
10402                         break
10403                 }
10404                 v.reset(OpPPC64SRDconst)
10405                 v.AuxInt = int64ToAuxInt(c)
10406                 v.AddArg(x)
10407                 return true
10408         }
10409         // match: (MOVWreg (SRADconst [c] x))
10410         // cond: c>=32
10411         // result: (SRADconst [c] x)
10412         for {
10413                 if v_0.Op != OpPPC64SRADconst {
10414                         break
10415                 }
10416                 c := auxIntToInt64(v_0.AuxInt)
10417                 x := v_0.Args[0]
10418                 if !(c >= 32) {
10419                         break
10420                 }
10421                 v.reset(OpPPC64SRADconst)
10422                 v.AuxInt = int64ToAuxInt(c)
10423                 v.AddArg(x)
10424                 return true
10425         }
10426         // match: (MOVWreg (SRDconst [c] x))
10427         // cond: c==32
10428         // result: (SRADconst [c] x)
10429         for {
10430                 if v_0.Op != OpPPC64SRDconst {
10431                         break
10432                 }
10433                 c := auxIntToInt64(v_0.AuxInt)
10434                 x := v_0.Args[0]
10435                 if !(c == 32) {
10436                         break
10437                 }
10438                 v.reset(OpPPC64SRADconst)
10439                 v.AuxInt = int64ToAuxInt(c)
10440                 v.AddArg(x)
10441                 return true
10442         }
10443         // match: (MOVWreg y:(MOVWreg _))
10444         // result: y
10445         for {
10446                 y := v_0
10447                 if y.Op != OpPPC64MOVWreg {
10448                         break
10449                 }
10450                 v.copyOf(y)
10451                 return true
10452         }
10453         // match: (MOVWreg y:(MOVHreg _))
10454         // result: y
10455         for {
10456                 y := v_0
10457                 if y.Op != OpPPC64MOVHreg {
10458                         break
10459                 }
10460                 v.copyOf(y)
10461                 return true
10462         }
10463         // match: (MOVWreg y:(MOVBreg _))
10464         // result: y
10465         for {
10466                 y := v_0
10467                 if y.Op != OpPPC64MOVBreg {
10468                         break
10469                 }
10470                 v.copyOf(y)
10471                 return true
10472         }
10473         // match: (MOVWreg y:(MOVWZreg x))
10474         // result: (MOVWreg x)
10475         for {
10476                 y := v_0
10477                 if y.Op != OpPPC64MOVWZreg {
10478                         break
10479                 }
10480                 x := y.Args[0]
10481                 v.reset(OpPPC64MOVWreg)
10482                 v.AddArg(x)
10483                 return true
10484         }
10485         // match: (MOVWreg x:(MOVHload _ _))
10486         // result: x
10487         for {
10488                 x := v_0
10489                 if x.Op != OpPPC64MOVHload {
10490                         break
10491                 }
10492                 v.copyOf(x)
10493                 return true
10494         }
10495         // match: (MOVWreg x:(MOVHloadidx _ _ _))
10496         // result: x
10497         for {
10498                 x := v_0
10499                 if x.Op != OpPPC64MOVHloadidx {
10500                         break
10501                 }
10502                 v.copyOf(x)
10503                 return true
10504         }
10505         // match: (MOVWreg x:(MOVWload _ _))
10506         // result: x
10507         for {
10508                 x := v_0
10509                 if x.Op != OpPPC64MOVWload {
10510                         break
10511                 }
10512                 v.copyOf(x)
10513                 return true
10514         }
10515         // match: (MOVWreg x:(MOVWloadidx _ _ _))
10516         // result: x
10517         for {
10518                 x := v_0
10519                 if x.Op != OpPPC64MOVWloadidx {
10520                         break
10521                 }
10522                 v.copyOf(x)
10523                 return true
10524         }
10525         // match: (MOVWreg x:(Arg <t>))
10526         // cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && t.IsSigned()
10527         // result: x
10528         for {
10529                 x := v_0
10530                 if x.Op != OpArg {
10531                         break
10532                 }
10533                 t := x.Type
10534                 if !((is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && t.IsSigned()) {
10535                         break
10536                 }
10537                 v.copyOf(x)
10538                 return true
10539         }
10540         // match: (MOVWreg (MOVDconst [c]))
10541         // result: (MOVDconst [int64(int32(c))])
10542         for {
10543                 if v_0.Op != OpPPC64MOVDconst {
10544                         break
10545                 }
10546                 c := auxIntToInt64(v_0.AuxInt)
10547                 v.reset(OpPPC64MOVDconst)
10548                 v.AuxInt = int64ToAuxInt(int64(int32(c)))
10549                 return true
10550         }
10551         return false
10552 }
10553 func rewriteValuePPC64_OpPPC64MOVWstore(v *Value) bool {
10554         v_2 := v.Args[2]
10555         v_1 := v.Args[1]
10556         v_0 := v.Args[0]
10557         b := v.Block
10558         // match: (MOVWstore [off1] {sym} (ADDconst [off2] x) val mem)
10559         // cond: (is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2)))
10560         // result: (MOVWstore [off1+int32(off2)] {sym} x val mem)
10561         for {
10562                 off1 := auxIntToInt32(v.AuxInt)
10563                 sym := auxToSym(v.Aux)
10564                 if v_0.Op != OpPPC64ADDconst {
10565                         break
10566                 }
10567                 off2 := auxIntToInt64(v_0.AuxInt)
10568                 x := v_0.Args[0]
10569                 val := v_1
10570                 mem := v_2
10571                 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
10572                         break
10573                 }
10574                 v.reset(OpPPC64MOVWstore)
10575                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10576                 v.Aux = symToAux(sym)
10577                 v.AddArg3(x, val, mem)
10578                 return true
10579         }
10580         // match: (MOVWstore [off1] {sym1} p:(MOVDaddr [off2] {sym2} ptr) val mem)
10581         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
10582         // result: (MOVWstore [off1+off2] {mergeSym(sym1,sym2)} ptr val mem)
10583         for {
10584                 off1 := auxIntToInt32(v.AuxInt)
10585                 sym1 := auxToSym(v.Aux)
10586                 p := v_0
10587                 if p.Op != OpPPC64MOVDaddr {
10588                         break
10589                 }
10590                 off2 := auxIntToInt32(p.AuxInt)
10591                 sym2 := auxToSym(p.Aux)
10592                 ptr := p.Args[0]
10593                 val := v_1
10594                 mem := v_2
10595                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
10596                         break
10597                 }
10598                 v.reset(OpPPC64MOVWstore)
10599                 v.AuxInt = int32ToAuxInt(off1 + off2)
10600                 v.Aux = symToAux(mergeSym(sym1, sym2))
10601                 v.AddArg3(ptr, val, mem)
10602                 return true
10603         }
10604         // match: (MOVWstore [off] {sym} ptr (MOVDconst [0]) mem)
10605         // result: (MOVWstorezero [off] {sym} ptr mem)
10606         for {
10607                 off := auxIntToInt32(v.AuxInt)
10608                 sym := auxToSym(v.Aux)
10609                 ptr := v_0
10610                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
10611                         break
10612                 }
10613                 mem := v_2
10614                 v.reset(OpPPC64MOVWstorezero)
10615                 v.AuxInt = int32ToAuxInt(off)
10616                 v.Aux = symToAux(sym)
10617                 v.AddArg2(ptr, mem)
10618                 return true
10619         }
10620         // match: (MOVWstore [0] {sym} p:(ADD ptr idx) val mem)
10621         // cond: sym == nil && p.Uses == 1
10622         // result: (MOVWstoreidx ptr idx val mem)
10623         for {
10624                 if auxIntToInt32(v.AuxInt) != 0 {
10625                         break
10626                 }
10627                 sym := auxToSym(v.Aux)
10628                 p := v_0
10629                 if p.Op != OpPPC64ADD {
10630                         break
10631                 }
10632                 idx := p.Args[1]
10633                 ptr := p.Args[0]
10634                 val := v_1
10635                 mem := v_2
10636                 if !(sym == nil && p.Uses == 1) {
10637                         break
10638                 }
10639                 v.reset(OpPPC64MOVWstoreidx)
10640                 v.AddArg4(ptr, idx, val, mem)
10641                 return true
10642         }
10643         // match: (MOVWstore [off] {sym} ptr (MOVWreg x) mem)
10644         // result: (MOVWstore [off] {sym} ptr x mem)
10645         for {
10646                 off := auxIntToInt32(v.AuxInt)
10647                 sym := auxToSym(v.Aux)
10648                 ptr := v_0
10649                 if v_1.Op != OpPPC64MOVWreg {
10650                         break
10651                 }
10652                 x := v_1.Args[0]
10653                 mem := v_2
10654                 v.reset(OpPPC64MOVWstore)
10655                 v.AuxInt = int32ToAuxInt(off)
10656                 v.Aux = symToAux(sym)
10657                 v.AddArg3(ptr, x, mem)
10658                 return true
10659         }
10660         // match: (MOVWstore [off] {sym} ptr (MOVWZreg x) mem)
10661         // result: (MOVWstore [off] {sym} ptr x mem)
10662         for {
10663                 off := auxIntToInt32(v.AuxInt)
10664                 sym := auxToSym(v.Aux)
10665                 ptr := v_0
10666                 if v_1.Op != OpPPC64MOVWZreg {
10667                         break
10668                 }
10669                 x := v_1.Args[0]
10670                 mem := v_2
10671                 v.reset(OpPPC64MOVWstore)
10672                 v.AuxInt = int32ToAuxInt(off)
10673                 v.Aux = symToAux(sym)
10674                 v.AddArg3(ptr, x, mem)
10675                 return true
10676         }
10677         // match: (MOVWstore [off] {sym} ptr r:(BRW val) mem)
10678         // cond: r.Uses == 1
10679         // result: (MOVWBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
10680         for {
10681                 off := auxIntToInt32(v.AuxInt)
10682                 sym := auxToSym(v.Aux)
10683                 ptr := v_0
10684                 r := v_1
10685                 if r.Op != OpPPC64BRW {
10686                         break
10687                 }
10688                 val := r.Args[0]
10689                 mem := v_2
10690                 if !(r.Uses == 1) {
10691                         break
10692                 }
10693                 v.reset(OpPPC64MOVWBRstore)
10694                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
10695                 v0.AuxInt = int32ToAuxInt(off)
10696                 v0.Aux = symToAux(sym)
10697                 v0.AddArg(ptr)
10698                 v.AddArg3(v0, val, mem)
10699                 return true
10700         }
10701         // match: (MOVWstore [off] {sym} ptr (Bswap32 val) mem)
10702         // result: (MOVWBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
10703         for {
10704                 off := auxIntToInt32(v.AuxInt)
10705                 sym := auxToSym(v.Aux)
10706                 ptr := v_0
10707                 if v_1.Op != OpBswap32 {
10708                         break
10709                 }
10710                 val := v_1.Args[0]
10711                 mem := v_2
10712                 v.reset(OpPPC64MOVWBRstore)
10713                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
10714                 v0.AuxInt = int32ToAuxInt(off)
10715                 v0.Aux = symToAux(sym)
10716                 v0.AddArg(ptr)
10717                 v.AddArg3(v0, val, mem)
10718                 return true
10719         }
10720         return false
10721 }
10722 func rewriteValuePPC64_OpPPC64MOVWstoreidx(v *Value) bool {
10723         v_3 := v.Args[3]
10724         v_2 := v.Args[2]
10725         v_1 := v.Args[1]
10726         v_0 := v.Args[0]
10727         // match: (MOVWstoreidx ptr (MOVDconst [c]) val mem)
10728         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
10729         // result: (MOVWstore [int32(c)] ptr val mem)
10730         for {
10731                 ptr := v_0
10732                 if v_1.Op != OpPPC64MOVDconst {
10733                         break
10734                 }
10735                 c := auxIntToInt64(v_1.AuxInt)
10736                 val := v_2
10737                 mem := v_3
10738                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10739                         break
10740                 }
10741                 v.reset(OpPPC64MOVWstore)
10742                 v.AuxInt = int32ToAuxInt(int32(c))
10743                 v.AddArg3(ptr, val, mem)
10744                 return true
10745         }
10746         // match: (MOVWstoreidx (MOVDconst [c]) ptr val mem)
10747         // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
10748         // result: (MOVWstore [int32(c)] ptr val mem)
10749         for {
10750                 if v_0.Op != OpPPC64MOVDconst {
10751                         break
10752                 }
10753                 c := auxIntToInt64(v_0.AuxInt)
10754                 ptr := v_1
10755                 val := v_2
10756                 mem := v_3
10757                 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10758                         break
10759                 }
10760                 v.reset(OpPPC64MOVWstore)
10761                 v.AuxInt = int32ToAuxInt(int32(c))
10762                 v.AddArg3(ptr, val, mem)
10763                 return true
10764         }
10765         // match: (MOVWstoreidx ptr idx (MOVWreg x) mem)
10766         // result: (MOVWstoreidx ptr idx x mem)
10767         for {
10768                 ptr := v_0
10769                 idx := v_1
10770                 if v_2.Op != OpPPC64MOVWreg {
10771                         break
10772                 }
10773                 x := v_2.Args[0]
10774                 mem := v_3
10775                 v.reset(OpPPC64MOVWstoreidx)
10776                 v.AddArg4(ptr, idx, x, mem)
10777                 return true
10778         }
10779         // match: (MOVWstoreidx ptr idx (MOVWZreg x) mem)
10780         // result: (MOVWstoreidx ptr idx x mem)
10781         for {
10782                 ptr := v_0
10783                 idx := v_1
10784                 if v_2.Op != OpPPC64MOVWZreg {
10785                         break
10786                 }
10787                 x := v_2.Args[0]
10788                 mem := v_3
10789                 v.reset(OpPPC64MOVWstoreidx)
10790                 v.AddArg4(ptr, idx, x, mem)
10791                 return true
10792         }
10793         // match: (MOVWstoreidx ptr idx r:(BRW val) mem)
10794         // cond: r.Uses == 1
10795         // result: (MOVWBRstoreidx ptr idx val mem)
10796         for {
10797                 ptr := v_0
10798                 idx := v_1
10799                 r := v_2
10800                 if r.Op != OpPPC64BRW {
10801                         break
10802                 }
10803                 val := r.Args[0]
10804                 mem := v_3
10805                 if !(r.Uses == 1) {
10806                         break
10807                 }
10808                 v.reset(OpPPC64MOVWBRstoreidx)
10809                 v.AddArg4(ptr, idx, val, mem)
10810                 return true
10811         }
10812         // match: (MOVWstoreidx ptr idx (Bswap32 val) mem)
10813         // result: (MOVWBRstoreidx ptr idx val mem)
10814         for {
10815                 ptr := v_0
10816                 idx := v_1
10817                 if v_2.Op != OpBswap32 {
10818                         break
10819                 }
10820                 val := v_2.Args[0]
10821                 mem := v_3
10822                 v.reset(OpPPC64MOVWBRstoreidx)
10823                 v.AddArg4(ptr, idx, val, mem)
10824                 return true
10825         }
10826         return false
10827 }
10828 func rewriteValuePPC64_OpPPC64MOVWstorezero(v *Value) bool {
10829         v_1 := v.Args[1]
10830         v_0 := v.Args[0]
10831         // match: (MOVWstorezero [off1] {sym} (ADDconst [off2] x) mem)
10832         // cond: ((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1)+off2)))
10833         // result: (MOVWstorezero [off1+int32(off2)] {sym} x mem)
10834         for {
10835                 off1 := auxIntToInt32(v.AuxInt)
10836                 sym := auxToSym(v.Aux)
10837                 if v_0.Op != OpPPC64ADDconst {
10838                         break
10839                 }
10840                 off2 := auxIntToInt64(v_0.AuxInt)
10841                 x := v_0.Args[0]
10842                 mem := v_1
10843                 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
10844                         break
10845                 }
10846                 v.reset(OpPPC64MOVWstorezero)
10847                 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10848                 v.Aux = symToAux(sym)
10849                 v.AddArg2(x, mem)
10850                 return true
10851         }
10852         // match: (MOVWstorezero [off1] {sym1} p:(MOVDaddr [off2] {sym2} x) mem)
10853         // cond: canMergeSym(sym1,sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))
10854         // result: (MOVWstorezero [off1+off2] {mergeSym(sym1,sym2)} x mem)
10855         for {
10856                 off1 := auxIntToInt32(v.AuxInt)
10857                 sym1 := auxToSym(v.Aux)
10858                 p := v_0
10859                 if p.Op != OpPPC64MOVDaddr {
10860                         break
10861                 }
10862                 off2 := auxIntToInt32(p.AuxInt)
10863                 sym2 := auxToSym(p.Aux)
10864                 x := p.Args[0]
10865                 mem := v_1
10866                 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
10867                         break
10868                 }
10869                 v.reset(OpPPC64MOVWstorezero)
10870                 v.AuxInt = int32ToAuxInt(off1 + off2)
10871                 v.Aux = symToAux(mergeSym(sym1, sym2))
10872                 v.AddArg2(x, mem)
10873                 return true
10874         }
10875         return false
10876 }
10877 func rewriteValuePPC64_OpPPC64MTVSRD(v *Value) bool {
10878         v_0 := v.Args[0]
10879         b := v.Block
10880         typ := &b.Func.Config.Types
10881         // match: (MTVSRD (MOVDconst [c]))
10882         // cond: !math.IsNaN(math.Float64frombits(uint64(c)))
10883         // result: (FMOVDconst [math.Float64frombits(uint64(c))])
10884         for {
10885                 if v_0.Op != OpPPC64MOVDconst {
10886                         break
10887                 }
10888                 c := auxIntToInt64(v_0.AuxInt)
10889                 if !(!math.IsNaN(math.Float64frombits(uint64(c)))) {
10890                         break
10891                 }
10892                 v.reset(OpPPC64FMOVDconst)
10893                 v.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c)))
10894                 return true
10895         }
10896         // match: (MTVSRD x:(MOVDload [off] {sym} ptr mem))
10897         // cond: x.Uses == 1 && clobber(x)
10898         // result: @x.Block (FMOVDload [off] {sym} ptr mem)
10899         for {
10900                 x := v_0
10901                 if x.Op != OpPPC64MOVDload {
10902                         break
10903                 }
10904                 off := auxIntToInt32(x.AuxInt)
10905                 sym := auxToSym(x.Aux)
10906                 mem := x.Args[1]
10907                 ptr := x.Args[0]
10908                 if !(x.Uses == 1 && clobber(x)) {
10909                         break
10910                 }
10911                 b = x.Block
10912                 v0 := b.NewValue0(x.Pos, OpPPC64FMOVDload, typ.Float64)
10913                 v.copyOf(v0)
10914                 v0.AuxInt = int32ToAuxInt(off)
10915                 v0.Aux = symToAux(sym)
10916                 v0.AddArg2(ptr, mem)
10917                 return true
10918         }
10919         return false
10920 }
10921 func rewriteValuePPC64_OpPPC64MULLD(v *Value) bool {
10922         v_1 := v.Args[1]
10923         v_0 := v.Args[0]
10924         // match: (MULLD x (MOVDconst [c]))
10925         // cond: is16Bit(c)
10926         // result: (MULLDconst [int32(c)] x)
10927         for {
10928                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10929                         x := v_0
10930                         if v_1.Op != OpPPC64MOVDconst {
10931                                 continue
10932                         }
10933                         c := auxIntToInt64(v_1.AuxInt)
10934                         if !(is16Bit(c)) {
10935                                 continue
10936                         }
10937                         v.reset(OpPPC64MULLDconst)
10938                         v.AuxInt = int32ToAuxInt(int32(c))
10939                         v.AddArg(x)
10940                         return true
10941                 }
10942                 break
10943         }
10944         return false
10945 }
10946 func rewriteValuePPC64_OpPPC64MULLW(v *Value) bool {
10947         v_1 := v.Args[1]
10948         v_0 := v.Args[0]
10949         // match: (MULLW x (MOVDconst [c]))
10950         // cond: is16Bit(c)
10951         // result: (MULLWconst [int32(c)] x)
10952         for {
10953                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10954                         x := v_0
10955                         if v_1.Op != OpPPC64MOVDconst {
10956                                 continue
10957                         }
10958                         c := auxIntToInt64(v_1.AuxInt)
10959                         if !(is16Bit(c)) {
10960                                 continue
10961                         }
10962                         v.reset(OpPPC64MULLWconst)
10963                         v.AuxInt = int32ToAuxInt(int32(c))
10964                         v.AddArg(x)
10965                         return true
10966                 }
10967                 break
10968         }
10969         return false
10970 }
10971 func rewriteValuePPC64_OpPPC64NEG(v *Value) bool {
10972         v_0 := v.Args[0]
10973         // match: (NEG (ADDconst [c] x))
10974         // cond: is32Bit(-c)
10975         // result: (SUBFCconst [-c] x)
10976         for {
10977                 if v_0.Op != OpPPC64ADDconst {
10978                         break
10979                 }
10980                 c := auxIntToInt64(v_0.AuxInt)
10981                 x := v_0.Args[0]
10982                 if !(is32Bit(-c)) {
10983                         break
10984                 }
10985                 v.reset(OpPPC64SUBFCconst)
10986                 v.AuxInt = int64ToAuxInt(-c)
10987                 v.AddArg(x)
10988                 return true
10989         }
10990         // match: (NEG (SUBFCconst [c] x))
10991         // cond: is32Bit(-c)
10992         // result: (ADDconst [-c] x)
10993         for {
10994                 if v_0.Op != OpPPC64SUBFCconst {
10995                         break
10996                 }
10997                 c := auxIntToInt64(v_0.AuxInt)
10998                 x := v_0.Args[0]
10999                 if !(is32Bit(-c)) {
11000                         break
11001                 }
11002                 v.reset(OpPPC64ADDconst)
11003                 v.AuxInt = int64ToAuxInt(-c)
11004                 v.AddArg(x)
11005                 return true
11006         }
11007         // match: (NEG (SUB x y))
11008         // result: (SUB y x)
11009         for {
11010                 if v_0.Op != OpPPC64SUB {
11011                         break
11012                 }
11013                 y := v_0.Args[1]
11014                 x := v_0.Args[0]
11015                 v.reset(OpPPC64SUB)
11016                 v.AddArg2(y, x)
11017                 return true
11018         }
11019         // match: (NEG (NEG x))
11020         // result: x
11021         for {
11022                 if v_0.Op != OpPPC64NEG {
11023                         break
11024                 }
11025                 x := v_0.Args[0]
11026                 v.copyOf(x)
11027                 return true
11028         }
11029         return false
11030 }
11031 func rewriteValuePPC64_OpPPC64NOR(v *Value) bool {
11032         v_1 := v.Args[1]
11033         v_0 := v.Args[0]
11034         // match: (NOR (MOVDconst [c]) (MOVDconst [d]))
11035         // result: (MOVDconst [^(c|d)])
11036         for {
11037                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11038                         if v_0.Op != OpPPC64MOVDconst {
11039                                 continue
11040                         }
11041                         c := auxIntToInt64(v_0.AuxInt)
11042                         if v_1.Op != OpPPC64MOVDconst {
11043                                 continue
11044                         }
11045                         d := auxIntToInt64(v_1.AuxInt)
11046                         v.reset(OpPPC64MOVDconst)
11047                         v.AuxInt = int64ToAuxInt(^(c | d))
11048                         return true
11049                 }
11050                 break
11051         }
11052         return false
11053 }
11054 func rewriteValuePPC64_OpPPC64NotEqual(v *Value) bool {
11055         v_0 := v.Args[0]
11056         // match: (NotEqual (FlagEQ))
11057         // result: (MOVDconst [0])
11058         for {
11059                 if v_0.Op != OpPPC64FlagEQ {
11060                         break
11061                 }
11062                 v.reset(OpPPC64MOVDconst)
11063                 v.AuxInt = int64ToAuxInt(0)
11064                 return true
11065         }
11066         // match: (NotEqual (FlagLT))
11067         // result: (MOVDconst [1])
11068         for {
11069                 if v_0.Op != OpPPC64FlagLT {
11070                         break
11071                 }
11072                 v.reset(OpPPC64MOVDconst)
11073                 v.AuxInt = int64ToAuxInt(1)
11074                 return true
11075         }
11076         // match: (NotEqual (FlagGT))
11077         // result: (MOVDconst [1])
11078         for {
11079                 if v_0.Op != OpPPC64FlagGT {
11080                         break
11081                 }
11082                 v.reset(OpPPC64MOVDconst)
11083                 v.AuxInt = int64ToAuxInt(1)
11084                 return true
11085         }
11086         // match: (NotEqual (InvertFlags x))
11087         // result: (NotEqual x)
11088         for {
11089                 if v_0.Op != OpPPC64InvertFlags {
11090                         break
11091                 }
11092                 x := v_0.Args[0]
11093                 v.reset(OpPPC64NotEqual)
11094                 v.AddArg(x)
11095                 return true
11096         }
11097         // match: (NotEqual cmp)
11098         // result: (SETBCR [2] cmp)
11099         for {
11100                 cmp := v_0
11101                 v.reset(OpPPC64SETBCR)
11102                 v.AuxInt = int32ToAuxInt(2)
11103                 v.AddArg(cmp)
11104                 return true
11105         }
11106 }
11107 func rewriteValuePPC64_OpPPC64OR(v *Value) bool {
11108         v_1 := v.Args[1]
11109         v_0 := v.Args[0]
11110         // match: (OR x (NOR y y))
11111         // result: (ORN x y)
11112         for {
11113                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11114                         x := v_0
11115                         if v_1.Op != OpPPC64NOR {
11116                                 continue
11117                         }
11118                         y := v_1.Args[1]
11119                         if y != v_1.Args[0] {
11120                                 continue
11121                         }
11122                         v.reset(OpPPC64ORN)
11123                         v.AddArg2(x, y)
11124                         return true
11125                 }
11126                 break
11127         }
11128         // match: (OR (MOVDconst [c]) (MOVDconst [d]))
11129         // result: (MOVDconst [c|d])
11130         for {
11131                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11132                         if v_0.Op != OpPPC64MOVDconst {
11133                                 continue
11134                         }
11135                         c := auxIntToInt64(v_0.AuxInt)
11136                         if v_1.Op != OpPPC64MOVDconst {
11137                                 continue
11138                         }
11139                         d := auxIntToInt64(v_1.AuxInt)
11140                         v.reset(OpPPC64MOVDconst)
11141                         v.AuxInt = int64ToAuxInt(c | d)
11142                         return true
11143                 }
11144                 break
11145         }
11146         // match: (OR x (MOVDconst [c]))
11147         // cond: isU32Bit(c)
11148         // result: (ORconst [c] x)
11149         for {
11150                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11151                         x := v_0
11152                         if v_1.Op != OpPPC64MOVDconst {
11153                                 continue
11154                         }
11155                         c := auxIntToInt64(v_1.AuxInt)
11156                         if !(isU32Bit(c)) {
11157                                 continue
11158                         }
11159                         v.reset(OpPPC64ORconst)
11160                         v.AuxInt = int64ToAuxInt(c)
11161                         v.AddArg(x)
11162                         return true
11163                 }
11164                 break
11165         }
11166         return false
11167 }
11168 func rewriteValuePPC64_OpPPC64ORN(v *Value) bool {
11169         v_1 := v.Args[1]
11170         v_0 := v.Args[0]
11171         // match: (ORN x (MOVDconst [-1]))
11172         // result: x
11173         for {
11174                 x := v_0
11175                 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
11176                         break
11177                 }
11178                 v.copyOf(x)
11179                 return true
11180         }
11181         // match: (ORN (MOVDconst [c]) (MOVDconst [d]))
11182         // result: (MOVDconst [c|^d])
11183         for {
11184                 if v_0.Op != OpPPC64MOVDconst {
11185                         break
11186                 }
11187                 c := auxIntToInt64(v_0.AuxInt)
11188                 if v_1.Op != OpPPC64MOVDconst {
11189                         break
11190                 }
11191                 d := auxIntToInt64(v_1.AuxInt)
11192                 v.reset(OpPPC64MOVDconst)
11193                 v.AuxInt = int64ToAuxInt(c | ^d)
11194                 return true
11195         }
11196         return false
11197 }
11198 func rewriteValuePPC64_OpPPC64ORconst(v *Value) bool {
11199         v_0 := v.Args[0]
11200         // match: (ORconst [c] (ORconst [d] x))
11201         // result: (ORconst [c|d] x)
11202         for {
11203                 c := auxIntToInt64(v.AuxInt)
11204                 if v_0.Op != OpPPC64ORconst {
11205                         break
11206                 }
11207                 d := auxIntToInt64(v_0.AuxInt)
11208                 x := v_0.Args[0]
11209                 v.reset(OpPPC64ORconst)
11210                 v.AuxInt = int64ToAuxInt(c | d)
11211                 v.AddArg(x)
11212                 return true
11213         }
11214         // match: (ORconst [-1] _)
11215         // result: (MOVDconst [-1])
11216         for {
11217                 if auxIntToInt64(v.AuxInt) != -1 {
11218                         break
11219                 }
11220                 v.reset(OpPPC64MOVDconst)
11221                 v.AuxInt = int64ToAuxInt(-1)
11222                 return true
11223         }
11224         // match: (ORconst [0] x)
11225         // result: x
11226         for {
11227                 if auxIntToInt64(v.AuxInt) != 0 {
11228                         break
11229                 }
11230                 x := v_0
11231                 v.copyOf(x)
11232                 return true
11233         }
11234         return false
11235 }
11236 func rewriteValuePPC64_OpPPC64ROTL(v *Value) bool {
11237         v_1 := v.Args[1]
11238         v_0 := v.Args[0]
11239         // match: (ROTL x (MOVDconst [c]))
11240         // result: (ROTLconst x [c&63])
11241         for {
11242                 x := v_0
11243                 if v_1.Op != OpPPC64MOVDconst {
11244                         break
11245                 }
11246                 c := auxIntToInt64(v_1.AuxInt)
11247                 v.reset(OpPPC64ROTLconst)
11248                 v.AuxInt = int64ToAuxInt(c & 63)
11249                 v.AddArg(x)
11250                 return true
11251         }
11252         return false
11253 }
11254 func rewriteValuePPC64_OpPPC64ROTLW(v *Value) bool {
11255         v_1 := v.Args[1]
11256         v_0 := v.Args[0]
11257         // match: (ROTLW x (MOVDconst [c]))
11258         // result: (ROTLWconst x [c&31])
11259         for {
11260                 x := v_0
11261                 if v_1.Op != OpPPC64MOVDconst {
11262                         break
11263                 }
11264                 c := auxIntToInt64(v_1.AuxInt)
11265                 v.reset(OpPPC64ROTLWconst)
11266                 v.AuxInt = int64ToAuxInt(c & 31)
11267                 v.AddArg(x)
11268                 return true
11269         }
11270         return false
11271 }
11272 func rewriteValuePPC64_OpPPC64ROTLWconst(v *Value) bool {
11273         v_0 := v.Args[0]
11274         // match: (ROTLWconst [r] (AND (MOVDconst [m]) x))
11275         // cond: isPPC64WordRotateMask(m)
11276         // result: (RLWINM [encodePPC64RotateMask(r,rotateLeft32(m,r),32)] x)
11277         for {
11278                 r := auxIntToInt64(v.AuxInt)
11279                 if v_0.Op != OpPPC64AND {
11280                         break
11281                 }
11282                 _ = v_0.Args[1]
11283                 v_0_0 := v_0.Args[0]
11284                 v_0_1 := v_0.Args[1]
11285                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
11286                         if v_0_0.Op != OpPPC64MOVDconst {
11287                                 continue
11288                         }
11289                         m := auxIntToInt64(v_0_0.AuxInt)
11290                         x := v_0_1
11291                         if !(isPPC64WordRotateMask(m)) {
11292                                 continue
11293                         }
11294                         v.reset(OpPPC64RLWINM)
11295                         v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, rotateLeft32(m, r), 32))
11296                         v.AddArg(x)
11297                         return true
11298                 }
11299                 break
11300         }
11301         // match: (ROTLWconst [r] (Select0 (ANDCCconst [m] x)))
11302         // cond: isPPC64WordRotateMask(m)
11303         // result: (RLWINM [encodePPC64RotateMask(r,rotateLeft32(m,r),32)] x)
11304         for {
11305                 r := auxIntToInt64(v.AuxInt)
11306                 if v_0.Op != OpSelect0 {
11307                         break
11308                 }
11309                 v_0_0 := v_0.Args[0]
11310                 if v_0_0.Op != OpPPC64ANDCCconst {
11311                         break
11312                 }
11313                 m := auxIntToInt64(v_0_0.AuxInt)
11314                 x := v_0_0.Args[0]
11315                 if !(isPPC64WordRotateMask(m)) {
11316                         break
11317                 }
11318                 v.reset(OpPPC64RLWINM)
11319                 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, rotateLeft32(m, r), 32))
11320                 v.AddArg(x)
11321                 return true
11322         }
11323         return false
11324 }
11325 func rewriteValuePPC64_OpPPC64SETBC(v *Value) bool {
11326         v_0 := v.Args[0]
11327         b := v.Block
11328         typ := &b.Func.Config.Types
11329         // match: (SETBC [0] (FlagLT))
11330         // result: (MOVDconst [1])
11331         for {
11332                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagLT {
11333                         break
11334                 }
11335                 v.reset(OpPPC64MOVDconst)
11336                 v.AuxInt = int64ToAuxInt(1)
11337                 return true
11338         }
11339         // match: (SETBC [0] (FlagGT))
11340         // result: (MOVDconst [0])
11341         for {
11342                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagGT {
11343                         break
11344                 }
11345                 v.reset(OpPPC64MOVDconst)
11346                 v.AuxInt = int64ToAuxInt(0)
11347                 return true
11348         }
11349         // match: (SETBC [0] (FlagEQ))
11350         // result: (MOVDconst [0])
11351         for {
11352                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagEQ {
11353                         break
11354                 }
11355                 v.reset(OpPPC64MOVDconst)
11356                 v.AuxInt = int64ToAuxInt(0)
11357                 return true
11358         }
11359         // match: (SETBC [1] (FlagGT))
11360         // result: (MOVDconst [1])
11361         for {
11362                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagGT {
11363                         break
11364                 }
11365                 v.reset(OpPPC64MOVDconst)
11366                 v.AuxInt = int64ToAuxInt(1)
11367                 return true
11368         }
11369         // match: (SETBC [1] (FlagLT))
11370         // result: (MOVDconst [0])
11371         for {
11372                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagLT {
11373                         break
11374                 }
11375                 v.reset(OpPPC64MOVDconst)
11376                 v.AuxInt = int64ToAuxInt(0)
11377                 return true
11378         }
11379         // match: (SETBC [1] (FlagEQ))
11380         // result: (MOVDconst [0])
11381         for {
11382                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagEQ {
11383                         break
11384                 }
11385                 v.reset(OpPPC64MOVDconst)
11386                 v.AuxInt = int64ToAuxInt(0)
11387                 return true
11388         }
11389         // match: (SETBC [2] (FlagEQ))
11390         // result: (MOVDconst [1])
11391         for {
11392                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagEQ {
11393                         break
11394                 }
11395                 v.reset(OpPPC64MOVDconst)
11396                 v.AuxInt = int64ToAuxInt(1)
11397                 return true
11398         }
11399         // match: (SETBC [2] (FlagLT))
11400         // result: (MOVDconst [0])
11401         for {
11402                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagLT {
11403                         break
11404                 }
11405                 v.reset(OpPPC64MOVDconst)
11406                 v.AuxInt = int64ToAuxInt(0)
11407                 return true
11408         }
11409         // match: (SETBC [2] (FlagGT))
11410         // result: (MOVDconst [0])
11411         for {
11412                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagGT {
11413                         break
11414                 }
11415                 v.reset(OpPPC64MOVDconst)
11416                 v.AuxInt = int64ToAuxInt(0)
11417                 return true
11418         }
11419         // match: (SETBC [0] (InvertFlags bool))
11420         // result: (SETBC [1] bool)
11421         for {
11422                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64InvertFlags {
11423                         break
11424                 }
11425                 bool := v_0.Args[0]
11426                 v.reset(OpPPC64SETBC)
11427                 v.AuxInt = int32ToAuxInt(1)
11428                 v.AddArg(bool)
11429                 return true
11430         }
11431         // match: (SETBC [1] (InvertFlags bool))
11432         // result: (SETBC [0] bool)
11433         for {
11434                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64InvertFlags {
11435                         break
11436                 }
11437                 bool := v_0.Args[0]
11438                 v.reset(OpPPC64SETBC)
11439                 v.AuxInt = int32ToAuxInt(0)
11440                 v.AddArg(bool)
11441                 return true
11442         }
11443         // match: (SETBC [2] (InvertFlags bool))
11444         // result: (SETBC [2] bool)
11445         for {
11446                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64InvertFlags {
11447                         break
11448                 }
11449                 bool := v_0.Args[0]
11450                 v.reset(OpPPC64SETBC)
11451                 v.AuxInt = int32ToAuxInt(2)
11452                 v.AddArg(bool)
11453                 return true
11454         }
11455         // match: (SETBC [n] (InvertFlags bool))
11456         // result: (SETBCR [n] bool)
11457         for {
11458                 n := auxIntToInt32(v.AuxInt)
11459                 if v_0.Op != OpPPC64InvertFlags {
11460                         break
11461                 }
11462                 bool := v_0.Args[0]
11463                 v.reset(OpPPC64SETBCR)
11464                 v.AuxInt = int32ToAuxInt(n)
11465                 v.AddArg(bool)
11466                 return true
11467         }
11468         // match: (SETBC [2] (CMPconst [0] (Select0 (ANDCCconst [1] z))))
11469         // result: (XORconst [1] (Select0 <typ.UInt64> (ANDCCconst [1] z )))
11470         for {
11471                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11472                         break
11473                 }
11474                 v_0_0 := v_0.Args[0]
11475                 if v_0_0.Op != OpSelect0 {
11476                         break
11477                 }
11478                 v_0_0_0 := v_0_0.Args[0]
11479                 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
11480                         break
11481                 }
11482                 z := v_0_0_0.Args[0]
11483                 v.reset(OpPPC64XORconst)
11484                 v.AuxInt = int64ToAuxInt(1)
11485                 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
11486                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11487                 v1.AuxInt = int64ToAuxInt(1)
11488                 v1.AddArg(z)
11489                 v0.AddArg(v1)
11490                 v.AddArg(v0)
11491                 return true
11492         }
11493         // match: (SETBC [2] (CMPWconst [0] (Select0 (ANDCCconst [1] z))))
11494         // result: (XORconst [1] (Select0 <typ.UInt64> (ANDCCconst [1] z )))
11495         for {
11496                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11497                         break
11498                 }
11499                 v_0_0 := v_0.Args[0]
11500                 if v_0_0.Op != OpSelect0 {
11501                         break
11502                 }
11503                 v_0_0_0 := v_0_0.Args[0]
11504                 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
11505                         break
11506                 }
11507                 z := v_0_0_0.Args[0]
11508                 v.reset(OpPPC64XORconst)
11509                 v.AuxInt = int64ToAuxInt(1)
11510                 v0 := b.NewValue0(v.Pos, OpSelect0, typ.UInt64)
11511                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11512                 v1.AuxInt = int64ToAuxInt(1)
11513                 v1.AddArg(z)
11514                 v0.AddArg(v1)
11515                 v.AddArg(v0)
11516                 return true
11517         }
11518         // match: (SETBC [2] (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
11519         // result: (SETBC [2] (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
11520         for {
11521                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11522                         break
11523                 }
11524                 v_0_0 := v_0.Args[0]
11525                 if v_0_0.Op != OpSelect0 {
11526                         break
11527                 }
11528                 v_0_0_0 := v_0_0.Args[0]
11529                 if v_0_0_0.Op != OpPPC64ANDCCconst {
11530                         break
11531                 }
11532                 n := auxIntToInt64(v_0_0_0.AuxInt)
11533                 z := v_0_0_0.Args[0]
11534                 v.reset(OpPPC64SETBC)
11535                 v.AuxInt = int32ToAuxInt(2)
11536                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11537                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11538                 v1.AuxInt = int64ToAuxInt(n)
11539                 v1.AddArg(z)
11540                 v0.AddArg(v1)
11541                 v.AddArg(v0)
11542                 return true
11543         }
11544         // match: (SETBC [2] (CMPconst [0] a:(AND y z)))
11545         // cond: a.Uses == 1
11546         // result: (SETBC [2] (Select1 <types.TypeFlags> (ANDCC y z )))
11547         for {
11548                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11549                         break
11550                 }
11551                 a := v_0.Args[0]
11552                 if a.Op != OpPPC64AND {
11553                         break
11554                 }
11555                 z := a.Args[1]
11556                 y := a.Args[0]
11557                 if !(a.Uses == 1) {
11558                         break
11559                 }
11560                 v.reset(OpPPC64SETBC)
11561                 v.AuxInt = int32ToAuxInt(2)
11562                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11563                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
11564                 v1.AddArg2(y, z)
11565                 v0.AddArg(v1)
11566                 v.AddArg(v0)
11567                 return true
11568         }
11569         // match: (SETBC [2] (CMPconst [0] o:(OR y z)))
11570         // cond: o.Uses == 1
11571         // result: (SETBC [2] (Select1 <types.TypeFlags> (ORCC y z )))
11572         for {
11573                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11574                         break
11575                 }
11576                 o := v_0.Args[0]
11577                 if o.Op != OpPPC64OR {
11578                         break
11579                 }
11580                 z := o.Args[1]
11581                 y := o.Args[0]
11582                 if !(o.Uses == 1) {
11583                         break
11584                 }
11585                 v.reset(OpPPC64SETBC)
11586                 v.AuxInt = int32ToAuxInt(2)
11587                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11588                 v1 := b.NewValue0(v.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
11589                 v1.AddArg2(y, z)
11590                 v0.AddArg(v1)
11591                 v.AddArg(v0)
11592                 return true
11593         }
11594         // match: (SETBC [2] (CMPconst [0] a:(XOR y z)))
11595         // cond: a.Uses == 1
11596         // result: (SETBC [2] (Select1 <types.TypeFlags> (XORCC y z )))
11597         for {
11598                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11599                         break
11600                 }
11601                 a := v_0.Args[0]
11602                 if a.Op != OpPPC64XOR {
11603                         break
11604                 }
11605                 z := a.Args[1]
11606                 y := a.Args[0]
11607                 if !(a.Uses == 1) {
11608                         break
11609                 }
11610                 v.reset(OpPPC64SETBC)
11611                 v.AuxInt = int32ToAuxInt(2)
11612                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11613                 v1 := b.NewValue0(v.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
11614                 v1.AddArg2(y, z)
11615                 v0.AddArg(v1)
11616                 v.AddArg(v0)
11617                 return true
11618         }
11619         return false
11620 }
11621 func rewriteValuePPC64_OpPPC64SETBCR(v *Value) bool {
11622         v_0 := v.Args[0]
11623         b := v.Block
11624         typ := &b.Func.Config.Types
11625         // match: (SETBCR [0] (FlagLT))
11626         // result: (MOVDconst [0])
11627         for {
11628                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagLT {
11629                         break
11630                 }
11631                 v.reset(OpPPC64MOVDconst)
11632                 v.AuxInt = int64ToAuxInt(0)
11633                 return true
11634         }
11635         // match: (SETBCR [0] (FlagGT))
11636         // result: (MOVDconst [1])
11637         for {
11638                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagGT {
11639                         break
11640                 }
11641                 v.reset(OpPPC64MOVDconst)
11642                 v.AuxInt = int64ToAuxInt(1)
11643                 return true
11644         }
11645         // match: (SETBCR [0] (FlagEQ))
11646         // result: (MOVDconst [1])
11647         for {
11648                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagEQ {
11649                         break
11650                 }
11651                 v.reset(OpPPC64MOVDconst)
11652                 v.AuxInt = int64ToAuxInt(1)
11653                 return true
11654         }
11655         // match: (SETBCR [1] (FlagGT))
11656         // result: (MOVDconst [0])
11657         for {
11658                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagGT {
11659                         break
11660                 }
11661                 v.reset(OpPPC64MOVDconst)
11662                 v.AuxInt = int64ToAuxInt(0)
11663                 return true
11664         }
11665         // match: (SETBCR [1] (FlagLT))
11666         // result: (MOVDconst [1])
11667         for {
11668                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagLT {
11669                         break
11670                 }
11671                 v.reset(OpPPC64MOVDconst)
11672                 v.AuxInt = int64ToAuxInt(1)
11673                 return true
11674         }
11675         // match: (SETBCR [1] (FlagEQ))
11676         // result: (MOVDconst [1])
11677         for {
11678                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagEQ {
11679                         break
11680                 }
11681                 v.reset(OpPPC64MOVDconst)
11682                 v.AuxInt = int64ToAuxInt(1)
11683                 return true
11684         }
11685         // match: (SETBCR [2] (FlagEQ))
11686         // result: (MOVDconst [0])
11687         for {
11688                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagEQ {
11689                         break
11690                 }
11691                 v.reset(OpPPC64MOVDconst)
11692                 v.AuxInt = int64ToAuxInt(0)
11693                 return true
11694         }
11695         // match: (SETBCR [2] (FlagLT))
11696         // result: (MOVDconst [1])
11697         for {
11698                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagLT {
11699                         break
11700                 }
11701                 v.reset(OpPPC64MOVDconst)
11702                 v.AuxInt = int64ToAuxInt(1)
11703                 return true
11704         }
11705         // match: (SETBCR [2] (FlagGT))
11706         // result: (MOVDconst [1])
11707         for {
11708                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagGT {
11709                         break
11710                 }
11711                 v.reset(OpPPC64MOVDconst)
11712                 v.AuxInt = int64ToAuxInt(1)
11713                 return true
11714         }
11715         // match: (SETBCR [0] (InvertFlags bool))
11716         // result: (SETBCR [1] bool)
11717         for {
11718                 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64InvertFlags {
11719                         break
11720                 }
11721                 bool := v_0.Args[0]
11722                 v.reset(OpPPC64SETBCR)
11723                 v.AuxInt = int32ToAuxInt(1)
11724                 v.AddArg(bool)
11725                 return true
11726         }
11727         // match: (SETBCR [1] (InvertFlags bool))
11728         // result: (SETBCR [0] bool)
11729         for {
11730                 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64InvertFlags {
11731                         break
11732                 }
11733                 bool := v_0.Args[0]
11734                 v.reset(OpPPC64SETBCR)
11735                 v.AuxInt = int32ToAuxInt(0)
11736                 v.AddArg(bool)
11737                 return true
11738         }
11739         // match: (SETBCR [2] (InvertFlags bool))
11740         // result: (SETBCR [2] bool)
11741         for {
11742                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64InvertFlags {
11743                         break
11744                 }
11745                 bool := v_0.Args[0]
11746                 v.reset(OpPPC64SETBCR)
11747                 v.AuxInt = int32ToAuxInt(2)
11748                 v.AddArg(bool)
11749                 return true
11750         }
11751         // match: (SETBCR [n] (InvertFlags bool))
11752         // result: (SETBC [n] bool)
11753         for {
11754                 n := auxIntToInt32(v.AuxInt)
11755                 if v_0.Op != OpPPC64InvertFlags {
11756                         break
11757                 }
11758                 bool := v_0.Args[0]
11759                 v.reset(OpPPC64SETBC)
11760                 v.AuxInt = int32ToAuxInt(n)
11761                 v.AddArg(bool)
11762                 return true
11763         }
11764         // match: (SETBCR [2] (CMPconst [0] (Select0 (ANDCCconst [1] z))))
11765         // result: (Select0 <typ.UInt64> (ANDCCconst [1] z ))
11766         for {
11767                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11768                         break
11769                 }
11770                 v_0_0 := v_0.Args[0]
11771                 if v_0_0.Op != OpSelect0 {
11772                         break
11773                 }
11774                 v_0_0_0 := v_0_0.Args[0]
11775                 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
11776                         break
11777                 }
11778                 z := v_0_0_0.Args[0]
11779                 v.reset(OpSelect0)
11780                 v.Type = typ.UInt64
11781                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11782                 v0.AuxInt = int64ToAuxInt(1)
11783                 v0.AddArg(z)
11784                 v.AddArg(v0)
11785                 return true
11786         }
11787         // match: (SETBCR [2] (CMPWconst [0] (Select0 (ANDCCconst [1] z))))
11788         // result: (Select0 <typ.UInt64> (ANDCCconst [1] z ))
11789         for {
11790                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11791                         break
11792                 }
11793                 v_0_0 := v_0.Args[0]
11794                 if v_0_0.Op != OpSelect0 {
11795                         break
11796                 }
11797                 v_0_0_0 := v_0_0.Args[0]
11798                 if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
11799                         break
11800                 }
11801                 z := v_0_0_0.Args[0]
11802                 v.reset(OpSelect0)
11803                 v.Type = typ.UInt64
11804                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11805                 v0.AuxInt = int64ToAuxInt(1)
11806                 v0.AddArg(z)
11807                 v.AddArg(v0)
11808                 return true
11809         }
11810         // match: (SETBCR [2] (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
11811         // result: (SETBCR [2] (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
11812         for {
11813                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11814                         break
11815                 }
11816                 v_0_0 := v_0.Args[0]
11817                 if v_0_0.Op != OpSelect0 {
11818                         break
11819                 }
11820                 v_0_0_0 := v_0_0.Args[0]
11821                 if v_0_0_0.Op != OpPPC64ANDCCconst {
11822                         break
11823                 }
11824                 n := auxIntToInt64(v_0_0_0.AuxInt)
11825                 z := v_0_0_0.Args[0]
11826                 v.reset(OpPPC64SETBCR)
11827                 v.AuxInt = int32ToAuxInt(2)
11828                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11829                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11830                 v1.AuxInt = int64ToAuxInt(n)
11831                 v1.AddArg(z)
11832                 v0.AddArg(v1)
11833                 v.AddArg(v0)
11834                 return true
11835         }
11836         // match: (SETBCR [2] (CMPconst [0] a:(AND y z)))
11837         // cond: a.Uses == 1
11838         // result: (SETBCR [2] (Select1 <types.TypeFlags> (ANDCC y z )))
11839         for {
11840                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11841                         break
11842                 }
11843                 a := v_0.Args[0]
11844                 if a.Op != OpPPC64AND {
11845                         break
11846                 }
11847                 z := a.Args[1]
11848                 y := a.Args[0]
11849                 if !(a.Uses == 1) {
11850                         break
11851                 }
11852                 v.reset(OpPPC64SETBCR)
11853                 v.AuxInt = int32ToAuxInt(2)
11854                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11855                 v1 := b.NewValue0(v.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
11856                 v1.AddArg2(y, z)
11857                 v0.AddArg(v1)
11858                 v.AddArg(v0)
11859                 return true
11860         }
11861         // match: (SETBCR [2] (CMPconst [0] o:(OR y z)))
11862         // cond: o.Uses == 1
11863         // result: (SETBCR [2] (Select1 <types.TypeFlags> (ORCC y z )))
11864         for {
11865                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11866                         break
11867                 }
11868                 o := v_0.Args[0]
11869                 if o.Op != OpPPC64OR {
11870                         break
11871                 }
11872                 z := o.Args[1]
11873                 y := o.Args[0]
11874                 if !(o.Uses == 1) {
11875                         break
11876                 }
11877                 v.reset(OpPPC64SETBCR)
11878                 v.AuxInt = int32ToAuxInt(2)
11879                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11880                 v1 := b.NewValue0(v.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
11881                 v1.AddArg2(y, z)
11882                 v0.AddArg(v1)
11883                 v.AddArg(v0)
11884                 return true
11885         }
11886         // match: (SETBCR [2] (CMPconst [0] a:(XOR y z)))
11887         // cond: a.Uses == 1
11888         // result: (SETBCR [2] (Select1 <types.TypeFlags> (XORCC y z )))
11889         for {
11890                 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11891                         break
11892                 }
11893                 a := v_0.Args[0]
11894                 if a.Op != OpPPC64XOR {
11895                         break
11896                 }
11897                 z := a.Args[1]
11898                 y := a.Args[0]
11899                 if !(a.Uses == 1) {
11900                         break
11901                 }
11902                 v.reset(OpPPC64SETBCR)
11903                 v.AuxInt = int32ToAuxInt(2)
11904                 v0 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
11905                 v1 := b.NewValue0(v.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
11906                 v1.AddArg2(y, z)
11907                 v0.AddArg(v1)
11908                 v.AddArg(v0)
11909                 return true
11910         }
11911         return false
11912 }
11913 func rewriteValuePPC64_OpPPC64SLD(v *Value) bool {
11914         v_1 := v.Args[1]
11915         v_0 := v.Args[0]
11916         // match: (SLD x (MOVDconst [c]))
11917         // result: (SLDconst [c&63 | (c>>6&1*63)] x)
11918         for {
11919                 x := v_0
11920                 if v_1.Op != OpPPC64MOVDconst {
11921                         break
11922                 }
11923                 c := auxIntToInt64(v_1.AuxInt)
11924                 v.reset(OpPPC64SLDconst)
11925                 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
11926                 v.AddArg(x)
11927                 return true
11928         }
11929         return false
11930 }
11931 func rewriteValuePPC64_OpPPC64SLDconst(v *Value) bool {
11932         v_0 := v.Args[0]
11933         // match: (SLDconst [l] (SRWconst [r] x))
11934         // cond: mergePPC64SldiSrw(l,r) != 0
11935         // result: (RLWINM [mergePPC64SldiSrw(l,r)] x)
11936         for {
11937                 l := auxIntToInt64(v.AuxInt)
11938                 if v_0.Op != OpPPC64SRWconst {
11939                         break
11940                 }
11941                 r := auxIntToInt64(v_0.AuxInt)
11942                 x := v_0.Args[0]
11943                 if !(mergePPC64SldiSrw(l, r) != 0) {
11944                         break
11945                 }
11946                 v.reset(OpPPC64RLWINM)
11947                 v.AuxInt = int64ToAuxInt(mergePPC64SldiSrw(l, r))
11948                 v.AddArg(x)
11949                 return true
11950         }
11951         // match: (SLDconst [c] z:(MOVBZreg x))
11952         // cond: c < 8 && z.Uses == 1
11953         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,56,63,64)] x)
11954         for {
11955                 c := auxIntToInt64(v.AuxInt)
11956                 z := v_0
11957                 if z.Op != OpPPC64MOVBZreg {
11958                         break
11959                 }
11960                 x := z.Args[0]
11961                 if !(c < 8 && z.Uses == 1) {
11962                         break
11963                 }
11964                 v.reset(OpPPC64CLRLSLDI)
11965                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 56, 63, 64))
11966                 v.AddArg(x)
11967                 return true
11968         }
11969         // match: (SLDconst [c] z:(MOVHZreg x))
11970         // cond: c < 16 && z.Uses == 1
11971         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,48,63,64)] x)
11972         for {
11973                 c := auxIntToInt64(v.AuxInt)
11974                 z := v_0
11975                 if z.Op != OpPPC64MOVHZreg {
11976                         break
11977                 }
11978                 x := z.Args[0]
11979                 if !(c < 16 && z.Uses == 1) {
11980                         break
11981                 }
11982                 v.reset(OpPPC64CLRLSLDI)
11983                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 48, 63, 64))
11984                 v.AddArg(x)
11985                 return true
11986         }
11987         // match: (SLDconst [c] z:(MOVWZreg x))
11988         // cond: c < 32 && z.Uses == 1
11989         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,32,63,64)] x)
11990         for {
11991                 c := auxIntToInt64(v.AuxInt)
11992                 z := v_0
11993                 if z.Op != OpPPC64MOVWZreg {
11994                         break
11995                 }
11996                 x := z.Args[0]
11997                 if !(c < 32 && z.Uses == 1) {
11998                         break
11999                 }
12000                 v.reset(OpPPC64CLRLSLDI)
12001                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32, 63, 64))
12002                 v.AddArg(x)
12003                 return true
12004         }
12005         // match: (SLDconst [c] z:(Select0 (ANDCCconst [d] x)))
12006         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))
12007         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,64-getPPC64ShiftMaskLength(d),63,64)] x)
12008         for {
12009                 c := auxIntToInt64(v.AuxInt)
12010                 z := v_0
12011                 if z.Op != OpSelect0 {
12012                         break
12013                 }
12014                 z_0 := z.Args[0]
12015                 if z_0.Op != OpPPC64ANDCCconst {
12016                         break
12017                 }
12018                 d := auxIntToInt64(z_0.AuxInt)
12019                 x := z_0.Args[0]
12020                 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))) {
12021                         break
12022                 }
12023                 v.reset(OpPPC64CLRLSLDI)
12024                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 64-getPPC64ShiftMaskLength(d), 63, 64))
12025                 v.AddArg(x)
12026                 return true
12027         }
12028         // match: (SLDconst [c] z:(AND (MOVDconst [d]) x))
12029         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(64-getPPC64ShiftMaskLength(d))
12030         // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,64-getPPC64ShiftMaskLength(d),63,64)] x)
12031         for {
12032                 c := auxIntToInt64(v.AuxInt)
12033                 z := v_0
12034                 if z.Op != OpPPC64AND {
12035                         break
12036                 }
12037                 _ = z.Args[1]
12038                 z_0 := z.Args[0]
12039                 z_1 := z.Args[1]
12040                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
12041                         if z_0.Op != OpPPC64MOVDconst {
12042                                 continue
12043                         }
12044                         d := auxIntToInt64(z_0.AuxInt)
12045                         x := z_1
12046                         if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))) {
12047                                 continue
12048                         }
12049                         v.reset(OpPPC64CLRLSLDI)
12050                         v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 64-getPPC64ShiftMaskLength(d), 63, 64))
12051                         v.AddArg(x)
12052                         return true
12053                 }
12054                 break
12055         }
12056         // match: (SLDconst [c] z:(MOVWreg x))
12057         // cond: c < 32 && buildcfg.GOPPC64 >= 9
12058         // result: (EXTSWSLconst [c] x)
12059         for {
12060                 c := auxIntToInt64(v.AuxInt)
12061                 z := v_0
12062                 if z.Op != OpPPC64MOVWreg {
12063                         break
12064                 }
12065                 x := z.Args[0]
12066                 if !(c < 32 && buildcfg.GOPPC64 >= 9) {
12067                         break
12068                 }
12069                 v.reset(OpPPC64EXTSWSLconst)
12070                 v.AuxInt = int64ToAuxInt(c)
12071                 v.AddArg(x)
12072                 return true
12073         }
12074         return false
12075 }
12076 func rewriteValuePPC64_OpPPC64SLW(v *Value) bool {
12077         v_1 := v.Args[1]
12078         v_0 := v.Args[0]
12079         // match: (SLW x (MOVDconst [c]))
12080         // result: (SLWconst [c&31 | (c>>5&1*31)] x)
12081         for {
12082                 x := v_0
12083                 if v_1.Op != OpPPC64MOVDconst {
12084                         break
12085                 }
12086                 c := auxIntToInt64(v_1.AuxInt)
12087                 v.reset(OpPPC64SLWconst)
12088                 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
12089                 v.AddArg(x)
12090                 return true
12091         }
12092         return false
12093 }
12094 func rewriteValuePPC64_OpPPC64SLWconst(v *Value) bool {
12095         v_0 := v.Args[0]
12096         // match: (SLWconst [c] z:(MOVBZreg x))
12097         // cond: z.Uses == 1 && c < 8
12098         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,24,31,32)] x)
12099         for {
12100                 c := auxIntToInt64(v.AuxInt)
12101                 z := v_0
12102                 if z.Op != OpPPC64MOVBZreg {
12103                         break
12104                 }
12105                 x := z.Args[0]
12106                 if !(z.Uses == 1 && c < 8) {
12107                         break
12108                 }
12109                 v.reset(OpPPC64CLRLSLWI)
12110                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 24, 31, 32))
12111                 v.AddArg(x)
12112                 return true
12113         }
12114         // match: (SLWconst [c] z:(MOVHZreg x))
12115         // cond: z.Uses == 1 && c < 16
12116         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,16,31,32)] x)
12117         for {
12118                 c := auxIntToInt64(v.AuxInt)
12119                 z := v_0
12120                 if z.Op != OpPPC64MOVHZreg {
12121                         break
12122                 }
12123                 x := z.Args[0]
12124                 if !(z.Uses == 1 && c < 16) {
12125                         break
12126                 }
12127                 v.reset(OpPPC64CLRLSLWI)
12128                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 16, 31, 32))
12129                 v.AddArg(x)
12130                 return true
12131         }
12132         // match: (SLWconst [c] z:(Select0 (ANDCCconst [d] x)))
12133         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(32-getPPC64ShiftMaskLength(d))
12134         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,32-getPPC64ShiftMaskLength(d),31,32)] x)
12135         for {
12136                 c := auxIntToInt64(v.AuxInt)
12137                 z := v_0
12138                 if z.Op != OpSelect0 {
12139                         break
12140                 }
12141                 z_0 := z.Args[0]
12142                 if z_0.Op != OpPPC64ANDCCconst {
12143                         break
12144                 }
12145                 d := auxIntToInt64(z_0.AuxInt)
12146                 x := z_0.Args[0]
12147                 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (32-getPPC64ShiftMaskLength(d))) {
12148                         break
12149                 }
12150                 v.reset(OpPPC64CLRLSLWI)
12151                 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32-getPPC64ShiftMaskLength(d), 31, 32))
12152                 v.AddArg(x)
12153                 return true
12154         }
12155         // match: (SLWconst [c] z:(AND (MOVDconst [d]) x))
12156         // cond: z.Uses == 1 && isPPC64ValidShiftMask(d) && c<=(32-getPPC64ShiftMaskLength(d))
12157         // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,32-getPPC64ShiftMaskLength(d),31,32)] x)
12158         for {
12159                 c := auxIntToInt64(v.AuxInt)
12160                 z := v_0
12161                 if z.Op != OpPPC64AND {
12162                         break
12163                 }
12164                 _ = z.Args[1]
12165                 z_0 := z.Args[0]
12166                 z_1 := z.Args[1]
12167                 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
12168                         if z_0.Op != OpPPC64MOVDconst {
12169                                 continue
12170                         }
12171                         d := auxIntToInt64(z_0.AuxInt)
12172                         x := z_1
12173                         if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (32-getPPC64ShiftMaskLength(d))) {
12174                                 continue
12175                         }
12176                         v.reset(OpPPC64CLRLSLWI)
12177                         v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32-getPPC64ShiftMaskLength(d), 31, 32))
12178                         v.AddArg(x)
12179                         return true
12180                 }
12181                 break
12182         }
12183         // match: (SLWconst [c] z:(MOVWreg x))
12184         // cond: c < 32 && buildcfg.GOPPC64 >= 9
12185         // result: (EXTSWSLconst [c] x)
12186         for {
12187                 c := auxIntToInt64(v.AuxInt)
12188                 z := v_0
12189                 if z.Op != OpPPC64MOVWreg {
12190                         break
12191                 }
12192                 x := z.Args[0]
12193                 if !(c < 32 && buildcfg.GOPPC64 >= 9) {
12194                         break
12195                 }
12196                 v.reset(OpPPC64EXTSWSLconst)
12197                 v.AuxInt = int64ToAuxInt(c)
12198                 v.AddArg(x)
12199                 return true
12200         }
12201         return false
12202 }
12203 func rewriteValuePPC64_OpPPC64SRAD(v *Value) bool {
12204         v_1 := v.Args[1]
12205         v_0 := v.Args[0]
12206         // match: (SRAD x (MOVDconst [c]))
12207         // result: (SRADconst [c&63 | (c>>6&1*63)] x)
12208         for {
12209                 x := v_0
12210                 if v_1.Op != OpPPC64MOVDconst {
12211                         break
12212                 }
12213                 c := auxIntToInt64(v_1.AuxInt)
12214                 v.reset(OpPPC64SRADconst)
12215                 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
12216                 v.AddArg(x)
12217                 return true
12218         }
12219         return false
12220 }
12221 func rewriteValuePPC64_OpPPC64SRAW(v *Value) bool {
12222         v_1 := v.Args[1]
12223         v_0 := v.Args[0]
12224         // match: (SRAW x (MOVDconst [c]))
12225         // result: (SRAWconst [c&31 | (c>>5&1*31)] x)
12226         for {
12227                 x := v_0
12228                 if v_1.Op != OpPPC64MOVDconst {
12229                         break
12230                 }
12231                 c := auxIntToInt64(v_1.AuxInt)
12232                 v.reset(OpPPC64SRAWconst)
12233                 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
12234                 v.AddArg(x)
12235                 return true
12236         }
12237         return false
12238 }
12239 func rewriteValuePPC64_OpPPC64SRD(v *Value) bool {
12240         v_1 := v.Args[1]
12241         v_0 := v.Args[0]
12242         // match: (SRD x (MOVDconst [c]))
12243         // result: (SRDconst [c&63 | (c>>6&1*63)] x)
12244         for {
12245                 x := v_0
12246                 if v_1.Op != OpPPC64MOVDconst {
12247                         break
12248                 }
12249                 c := auxIntToInt64(v_1.AuxInt)
12250                 v.reset(OpPPC64SRDconst)
12251                 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
12252                 v.AddArg(x)
12253                 return true
12254         }
12255         return false
12256 }
12257 func rewriteValuePPC64_OpPPC64SRW(v *Value) bool {
12258         v_1 := v.Args[1]
12259         v_0 := v.Args[0]
12260         // match: (SRW x (MOVDconst [c]))
12261         // result: (SRWconst [c&31 | (c>>5&1*31)] x)
12262         for {
12263                 x := v_0
12264                 if v_1.Op != OpPPC64MOVDconst {
12265                         break
12266                 }
12267                 c := auxIntToInt64(v_1.AuxInt)
12268                 v.reset(OpPPC64SRWconst)
12269                 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
12270                 v.AddArg(x)
12271                 return true
12272         }
12273         return false
12274 }
12275 func rewriteValuePPC64_OpPPC64SRWconst(v *Value) bool {
12276         v_0 := v.Args[0]
12277         // match: (SRWconst (Select0 (ANDCCconst [m] x)) [s])
12278         // cond: mergePPC64RShiftMask(m>>uint(s),s,32) == 0
12279         // result: (MOVDconst [0])
12280         for {
12281                 s := auxIntToInt64(v.AuxInt)
12282                 if v_0.Op != OpSelect0 {
12283                         break
12284                 }
12285                 v_0_0 := v_0.Args[0]
12286                 if v_0_0.Op != OpPPC64ANDCCconst {
12287                         break
12288                 }
12289                 m := auxIntToInt64(v_0_0.AuxInt)
12290                 if !(mergePPC64RShiftMask(m>>uint(s), s, 32) == 0) {
12291                         break
12292                 }
12293                 v.reset(OpPPC64MOVDconst)
12294                 v.AuxInt = int64ToAuxInt(0)
12295                 return true
12296         }
12297         // match: (SRWconst (Select0 (ANDCCconst [m] x)) [s])
12298         // cond: mergePPC64AndSrwi(m>>uint(s),s) != 0
12299         // result: (RLWINM [mergePPC64AndSrwi(m>>uint(s),s)] x)
12300         for {
12301                 s := auxIntToInt64(v.AuxInt)
12302                 if v_0.Op != OpSelect0 {
12303                         break
12304                 }
12305                 v_0_0 := v_0.Args[0]
12306                 if v_0_0.Op != OpPPC64ANDCCconst {
12307                         break
12308                 }
12309                 m := auxIntToInt64(v_0_0.AuxInt)
12310                 x := v_0_0.Args[0]
12311                 if !(mergePPC64AndSrwi(m>>uint(s), s) != 0) {
12312                         break
12313                 }
12314                 v.reset(OpPPC64RLWINM)
12315                 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m>>uint(s), s))
12316                 v.AddArg(x)
12317                 return true
12318         }
12319         // match: (SRWconst (AND (MOVDconst [m]) x) [s])
12320         // cond: mergePPC64RShiftMask(m>>uint(s),s,32) == 0
12321         // result: (MOVDconst [0])
12322         for {
12323                 s := auxIntToInt64(v.AuxInt)
12324                 if v_0.Op != OpPPC64AND {
12325                         break
12326                 }
12327                 _ = v_0.Args[1]
12328                 v_0_0 := v_0.Args[0]
12329                 v_0_1 := v_0.Args[1]
12330                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
12331                         if v_0_0.Op != OpPPC64MOVDconst {
12332                                 continue
12333                         }
12334                         m := auxIntToInt64(v_0_0.AuxInt)
12335                         if !(mergePPC64RShiftMask(m>>uint(s), s, 32) == 0) {
12336                                 continue
12337                         }
12338                         v.reset(OpPPC64MOVDconst)
12339                         v.AuxInt = int64ToAuxInt(0)
12340                         return true
12341                 }
12342                 break
12343         }
12344         // match: (SRWconst (AND (MOVDconst [m]) x) [s])
12345         // cond: mergePPC64AndSrwi(m>>uint(s),s) != 0
12346         // result: (RLWINM [mergePPC64AndSrwi(m>>uint(s),s)] x)
12347         for {
12348                 s := auxIntToInt64(v.AuxInt)
12349                 if v_0.Op != OpPPC64AND {
12350                         break
12351                 }
12352                 _ = v_0.Args[1]
12353                 v_0_0 := v_0.Args[0]
12354                 v_0_1 := v_0.Args[1]
12355                 for _i0 := 0; _i0 <= 1; _i0, v_0_0, v_0_1 = _i0+1, v_0_1, v_0_0 {
12356                         if v_0_0.Op != OpPPC64MOVDconst {
12357                                 continue
12358                         }
12359                         m := auxIntToInt64(v_0_0.AuxInt)
12360                         x := v_0_1
12361                         if !(mergePPC64AndSrwi(m>>uint(s), s) != 0) {
12362                                 continue
12363                         }
12364                         v.reset(OpPPC64RLWINM)
12365                         v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m>>uint(s), s))
12366                         v.AddArg(x)
12367                         return true
12368                 }
12369                 break
12370         }
12371         return false
12372 }
12373 func rewriteValuePPC64_OpPPC64SUB(v *Value) bool {
12374         v_1 := v.Args[1]
12375         v_0 := v.Args[0]
12376         // match: (SUB x (MOVDconst [c]))
12377         // cond: is32Bit(-c)
12378         // result: (ADDconst [-c] x)
12379         for {
12380                 x := v_0
12381                 if v_1.Op != OpPPC64MOVDconst {
12382                         break
12383                 }
12384                 c := auxIntToInt64(v_1.AuxInt)
12385                 if !(is32Bit(-c)) {
12386                         break
12387                 }
12388                 v.reset(OpPPC64ADDconst)
12389                 v.AuxInt = int64ToAuxInt(-c)
12390                 v.AddArg(x)
12391                 return true
12392         }
12393         // match: (SUB (MOVDconst [c]) x)
12394         // cond: is32Bit(c)
12395         // result: (SUBFCconst [c] x)
12396         for {
12397                 if v_0.Op != OpPPC64MOVDconst {
12398                         break
12399                 }
12400                 c := auxIntToInt64(v_0.AuxInt)
12401                 x := v_1
12402                 if !(is32Bit(c)) {
12403                         break
12404                 }
12405                 v.reset(OpPPC64SUBFCconst)
12406                 v.AuxInt = int64ToAuxInt(c)
12407                 v.AddArg(x)
12408                 return true
12409         }
12410         return false
12411 }
12412 func rewriteValuePPC64_OpPPC64SUBE(v *Value) bool {
12413         v_2 := v.Args[2]
12414         v_1 := v.Args[1]
12415         v_0 := v.Args[0]
12416         b := v.Block
12417         typ := &b.Func.Config.Types
12418         // match: (SUBE x y (Select1 <typ.UInt64> (SUBCconst (MOVDconst [0]) [0])))
12419         // result: (SUBC x y)
12420         for {
12421                 x := v_0
12422                 y := v_1
12423                 if v_2.Op != OpSelect1 || v_2.Type != typ.UInt64 {
12424                         break
12425                 }
12426                 v_2_0 := v_2.Args[0]
12427                 if v_2_0.Op != OpPPC64SUBCconst || auxIntToInt64(v_2_0.AuxInt) != 0 {
12428                         break
12429                 }
12430                 v_2_0_0 := v_2_0.Args[0]
12431                 if v_2_0_0.Op != OpPPC64MOVDconst || auxIntToInt64(v_2_0_0.AuxInt) != 0 {
12432                         break
12433                 }
12434                 v.reset(OpPPC64SUBC)
12435                 v.AddArg2(x, y)
12436                 return true
12437         }
12438         return false
12439 }
12440 func rewriteValuePPC64_OpPPC64SUBFCconst(v *Value) bool {
12441         v_0 := v.Args[0]
12442         // match: (SUBFCconst [c] (NEG x))
12443         // result: (ADDconst [c] x)
12444         for {
12445                 c := auxIntToInt64(v.AuxInt)
12446                 if v_0.Op != OpPPC64NEG {
12447                         break
12448                 }
12449                 x := v_0.Args[0]
12450                 v.reset(OpPPC64ADDconst)
12451                 v.AuxInt = int64ToAuxInt(c)
12452                 v.AddArg(x)
12453                 return true
12454         }
12455         // match: (SUBFCconst [c] (SUBFCconst [d] x))
12456         // cond: is32Bit(c-d)
12457         // result: (ADDconst [c-d] x)
12458         for {
12459                 c := auxIntToInt64(v.AuxInt)
12460                 if v_0.Op != OpPPC64SUBFCconst {
12461                         break
12462                 }
12463                 d := auxIntToInt64(v_0.AuxInt)
12464                 x := v_0.Args[0]
12465                 if !(is32Bit(c - d)) {
12466                         break
12467                 }
12468                 v.reset(OpPPC64ADDconst)
12469                 v.AuxInt = int64ToAuxInt(c - d)
12470                 v.AddArg(x)
12471                 return true
12472         }
12473         // match: (SUBFCconst [0] x)
12474         // result: (NEG x)
12475         for {
12476                 if auxIntToInt64(v.AuxInt) != 0 {
12477                         break
12478                 }
12479                 x := v_0
12480                 v.reset(OpPPC64NEG)
12481                 v.AddArg(x)
12482                 return true
12483         }
12484         return false
12485 }
12486 func rewriteValuePPC64_OpPPC64XOR(v *Value) bool {
12487         v_1 := v.Args[1]
12488         v_0 := v.Args[0]
12489         // match: (XOR (MOVDconst [c]) (MOVDconst [d]))
12490         // result: (MOVDconst [c^d])
12491         for {
12492                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12493                         if v_0.Op != OpPPC64MOVDconst {
12494                                 continue
12495                         }
12496                         c := auxIntToInt64(v_0.AuxInt)
12497                         if v_1.Op != OpPPC64MOVDconst {
12498                                 continue
12499                         }
12500                         d := auxIntToInt64(v_1.AuxInt)
12501                         v.reset(OpPPC64MOVDconst)
12502                         v.AuxInt = int64ToAuxInt(c ^ d)
12503                         return true
12504                 }
12505                 break
12506         }
12507         // match: (XOR x (MOVDconst [c]))
12508         // cond: isU32Bit(c)
12509         // result: (XORconst [c] x)
12510         for {
12511                 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12512                         x := v_0
12513                         if v_1.Op != OpPPC64MOVDconst {
12514                                 continue
12515                         }
12516                         c := auxIntToInt64(v_1.AuxInt)
12517                         if !(isU32Bit(c)) {
12518                                 continue
12519                         }
12520                         v.reset(OpPPC64XORconst)
12521                         v.AuxInt = int64ToAuxInt(c)
12522                         v.AddArg(x)
12523                         return true
12524                 }
12525                 break
12526         }
12527         return false
12528 }
12529 func rewriteValuePPC64_OpPPC64XORconst(v *Value) bool {
12530         v_0 := v.Args[0]
12531         // match: (XORconst [c] (XORconst [d] x))
12532         // result: (XORconst [c^d] x)
12533         for {
12534                 c := auxIntToInt64(v.AuxInt)
12535                 if v_0.Op != OpPPC64XORconst {
12536                         break
12537                 }
12538                 d := auxIntToInt64(v_0.AuxInt)
12539                 x := v_0.Args[0]
12540                 v.reset(OpPPC64XORconst)
12541                 v.AuxInt = int64ToAuxInt(c ^ d)
12542                 v.AddArg(x)
12543                 return true
12544         }
12545         // match: (XORconst [0] x)
12546         // result: x
12547         for {
12548                 if auxIntToInt64(v.AuxInt) != 0 {
12549                         break
12550                 }
12551                 x := v_0
12552                 v.copyOf(x)
12553                 return true
12554         }
12555         // match: (XORconst [1] (SETBCR [n] cmp))
12556         // result: (SETBC [n] cmp)
12557         for {
12558                 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpPPC64SETBCR {
12559                         break
12560                 }
12561                 n := auxIntToInt32(v_0.AuxInt)
12562                 cmp := v_0.Args[0]
12563                 v.reset(OpPPC64SETBC)
12564                 v.AuxInt = int32ToAuxInt(n)
12565                 v.AddArg(cmp)
12566                 return true
12567         }
12568         // match: (XORconst [1] (SETBC [n] cmp))
12569         // result: (SETBCR [n] cmp)
12570         for {
12571                 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpPPC64SETBC {
12572                         break
12573                 }
12574                 n := auxIntToInt32(v_0.AuxInt)
12575                 cmp := v_0.Args[0]
12576                 v.reset(OpPPC64SETBCR)
12577                 v.AuxInt = int32ToAuxInt(n)
12578                 v.AddArg(cmp)
12579                 return true
12580         }
12581         return false
12582 }
12583 func rewriteValuePPC64_OpPanicBounds(v *Value) bool {
12584         v_2 := v.Args[2]
12585         v_1 := v.Args[1]
12586         v_0 := v.Args[0]
12587         // match: (PanicBounds [kind] x y mem)
12588         // cond: boundsABI(kind) == 0
12589         // result: (LoweredPanicBoundsA [kind] x y mem)
12590         for {
12591                 kind := auxIntToInt64(v.AuxInt)
12592                 x := v_0
12593                 y := v_1
12594                 mem := v_2
12595                 if !(boundsABI(kind) == 0) {
12596                         break
12597                 }
12598                 v.reset(OpPPC64LoweredPanicBoundsA)
12599                 v.AuxInt = int64ToAuxInt(kind)
12600                 v.AddArg3(x, y, mem)
12601                 return true
12602         }
12603         // match: (PanicBounds [kind] x y mem)
12604         // cond: boundsABI(kind) == 1
12605         // result: (LoweredPanicBoundsB [kind] x y mem)
12606         for {
12607                 kind := auxIntToInt64(v.AuxInt)
12608                 x := v_0
12609                 y := v_1
12610                 mem := v_2
12611                 if !(boundsABI(kind) == 1) {
12612                         break
12613                 }
12614                 v.reset(OpPPC64LoweredPanicBoundsB)
12615                 v.AuxInt = int64ToAuxInt(kind)
12616                 v.AddArg3(x, y, mem)
12617                 return true
12618         }
12619         // match: (PanicBounds [kind] x y mem)
12620         // cond: boundsABI(kind) == 2
12621         // result: (LoweredPanicBoundsC [kind] x y mem)
12622         for {
12623                 kind := auxIntToInt64(v.AuxInt)
12624                 x := v_0
12625                 y := v_1
12626                 mem := v_2
12627                 if !(boundsABI(kind) == 2) {
12628                         break
12629                 }
12630                 v.reset(OpPPC64LoweredPanicBoundsC)
12631                 v.AuxInt = int64ToAuxInt(kind)
12632                 v.AddArg3(x, y, mem)
12633                 return true
12634         }
12635         return false
12636 }
12637 func rewriteValuePPC64_OpPopCount16(v *Value) bool {
12638         v_0 := v.Args[0]
12639         b := v.Block
12640         typ := &b.Func.Config.Types
12641         // match: (PopCount16 x)
12642         // result: (POPCNTW (MOVHZreg x))
12643         for {
12644                 x := v_0
12645                 v.reset(OpPPC64POPCNTW)
12646                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12647                 v0.AddArg(x)
12648                 v.AddArg(v0)
12649                 return true
12650         }
12651 }
12652 func rewriteValuePPC64_OpPopCount32(v *Value) bool {
12653         v_0 := v.Args[0]
12654         b := v.Block
12655         typ := &b.Func.Config.Types
12656         // match: (PopCount32 x)
12657         // result: (POPCNTW (MOVWZreg x))
12658         for {
12659                 x := v_0
12660                 v.reset(OpPPC64POPCNTW)
12661                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
12662                 v0.AddArg(x)
12663                 v.AddArg(v0)
12664                 return true
12665         }
12666 }
12667 func rewriteValuePPC64_OpPopCount8(v *Value) bool {
12668         v_0 := v.Args[0]
12669         b := v.Block
12670         typ := &b.Func.Config.Types
12671         // match: (PopCount8 x)
12672         // result: (POPCNTB (MOVBZreg x))
12673         for {
12674                 x := v_0
12675                 v.reset(OpPPC64POPCNTB)
12676                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
12677                 v0.AddArg(x)
12678                 v.AddArg(v0)
12679                 return true
12680         }
12681 }
12682 func rewriteValuePPC64_OpPrefetchCache(v *Value) bool {
12683         v_1 := v.Args[1]
12684         v_0 := v.Args[0]
12685         // match: (PrefetchCache ptr mem)
12686         // result: (DCBT ptr mem [0])
12687         for {
12688                 ptr := v_0
12689                 mem := v_1
12690                 v.reset(OpPPC64DCBT)
12691                 v.AuxInt = int64ToAuxInt(0)
12692                 v.AddArg2(ptr, mem)
12693                 return true
12694         }
12695 }
12696 func rewriteValuePPC64_OpPrefetchCacheStreamed(v *Value) bool {
12697         v_1 := v.Args[1]
12698         v_0 := v.Args[0]
12699         // match: (PrefetchCacheStreamed ptr mem)
12700         // result: (DCBT ptr mem [16])
12701         for {
12702                 ptr := v_0
12703                 mem := v_1
12704                 v.reset(OpPPC64DCBT)
12705                 v.AuxInt = int64ToAuxInt(16)
12706                 v.AddArg2(ptr, mem)
12707                 return true
12708         }
12709 }
12710 func rewriteValuePPC64_OpRotateLeft16(v *Value) bool {
12711         v_1 := v.Args[1]
12712         v_0 := v.Args[0]
12713         b := v.Block
12714         typ := &b.Func.Config.Types
12715         // match: (RotateLeft16 <t> x (MOVDconst [c]))
12716         // result: (Or16 (Lsh16x64 <t> x (MOVDconst [c&15])) (Rsh16Ux64 <t> x (MOVDconst [-c&15])))
12717         for {
12718                 t := v.Type
12719                 x := v_0
12720                 if v_1.Op != OpPPC64MOVDconst {
12721                         break
12722                 }
12723                 c := auxIntToInt64(v_1.AuxInt)
12724                 v.reset(OpOr16)
12725                 v0 := b.NewValue0(v.Pos, OpLsh16x64, t)
12726                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12727                 v1.AuxInt = int64ToAuxInt(c & 15)
12728                 v0.AddArg2(x, v1)
12729                 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t)
12730                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12731                 v3.AuxInt = int64ToAuxInt(-c & 15)
12732                 v2.AddArg2(x, v3)
12733                 v.AddArg2(v0, v2)
12734                 return true
12735         }
12736         return false
12737 }
12738 func rewriteValuePPC64_OpRotateLeft8(v *Value) bool {
12739         v_1 := v.Args[1]
12740         v_0 := v.Args[0]
12741         b := v.Block
12742         typ := &b.Func.Config.Types
12743         // match: (RotateLeft8 <t> x (MOVDconst [c]))
12744         // result: (Or8 (Lsh8x64 <t> x (MOVDconst [c&7])) (Rsh8Ux64 <t> x (MOVDconst [-c&7])))
12745         for {
12746                 t := v.Type
12747                 x := v_0
12748                 if v_1.Op != OpPPC64MOVDconst {
12749                         break
12750                 }
12751                 c := auxIntToInt64(v_1.AuxInt)
12752                 v.reset(OpOr8)
12753                 v0 := b.NewValue0(v.Pos, OpLsh8x64, t)
12754                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12755                 v1.AuxInt = int64ToAuxInt(c & 7)
12756                 v0.AddArg2(x, v1)
12757                 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t)
12758                 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12759                 v3.AuxInt = int64ToAuxInt(-c & 7)
12760                 v2.AddArg2(x, v3)
12761                 v.AddArg2(v0, v2)
12762                 return true
12763         }
12764         return false
12765 }
12766 func rewriteValuePPC64_OpRsh16Ux16(v *Value) bool {
12767         v_1 := v.Args[1]
12768         v_0 := v.Args[0]
12769         b := v.Block
12770         typ := &b.Func.Config.Types
12771         // match: (Rsh16Ux16 x y)
12772         // cond: shiftIsBounded(v)
12773         // result: (SRD (MOVHZreg x) y)
12774         for {
12775                 x := v_0
12776                 y := v_1
12777                 if !(shiftIsBounded(v)) {
12778                         break
12779                 }
12780                 v.reset(OpPPC64SRD)
12781                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12782                 v0.AddArg(x)
12783                 v.AddArg2(v0, y)
12784                 return true
12785         }
12786         // match: (Rsh16Ux16 <t> x y)
12787         // result: (ISEL [2] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y)))
12788         for {
12789                 t := v.Type
12790                 x := v_0
12791                 y := v_1
12792                 v.reset(OpPPC64ISEL)
12793                 v.AuxInt = int32ToAuxInt(2)
12794                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
12795                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12796                 v1.AddArg(x)
12797                 v0.AddArg2(v1, y)
12798                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12799                 v2.AuxInt = int64ToAuxInt(0)
12800                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
12801                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
12802                 v4.AuxInt = int64ToAuxInt(0xFFF0)
12803                 v4.AddArg(y)
12804                 v3.AddArg(v4)
12805                 v.AddArg3(v0, v2, v3)
12806                 return true
12807         }
12808 }
12809 func rewriteValuePPC64_OpRsh16Ux32(v *Value) bool {
12810         v_1 := v.Args[1]
12811         v_0 := v.Args[0]
12812         b := v.Block
12813         typ := &b.Func.Config.Types
12814         // match: (Rsh16Ux32 x y)
12815         // cond: shiftIsBounded(v)
12816         // result: (SRD (MOVHZreg x) y)
12817         for {
12818                 x := v_0
12819                 y := v_1
12820                 if !(shiftIsBounded(v)) {
12821                         break
12822                 }
12823                 v.reset(OpPPC64SRD)
12824                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12825                 v0.AddArg(x)
12826                 v.AddArg2(v0, y)
12827                 return true
12828         }
12829         // match: (Rsh16Ux32 <t> x y)
12830         // result: (ISEL [0] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [16]))
12831         for {
12832                 t := v.Type
12833                 x := v_0
12834                 y := v_1
12835                 v.reset(OpPPC64ISEL)
12836                 v.AuxInt = int32ToAuxInt(0)
12837                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
12838                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12839                 v1.AddArg(x)
12840                 v0.AddArg2(v1, y)
12841                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12842                 v2.AuxInt = int64ToAuxInt(0)
12843                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
12844                 v3.AuxInt = int32ToAuxInt(16)
12845                 v3.AddArg(y)
12846                 v.AddArg3(v0, v2, v3)
12847                 return true
12848         }
12849 }
12850 func rewriteValuePPC64_OpRsh16Ux64(v *Value) bool {
12851         v_1 := v.Args[1]
12852         v_0 := v.Args[0]
12853         b := v.Block
12854         typ := &b.Func.Config.Types
12855         // match: (Rsh16Ux64 x (MOVDconst [c]))
12856         // cond: uint64(c) < 16
12857         // result: (SRWconst (ZeroExt16to32 x) [c])
12858         for {
12859                 x := v_0
12860                 if v_1.Op != OpPPC64MOVDconst {
12861                         break
12862                 }
12863                 c := auxIntToInt64(v_1.AuxInt)
12864                 if !(uint64(c) < 16) {
12865                         break
12866                 }
12867                 v.reset(OpPPC64SRWconst)
12868                 v.AuxInt = int64ToAuxInt(c)
12869                 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
12870                 v0.AddArg(x)
12871                 v.AddArg(v0)
12872                 return true
12873         }
12874         // match: (Rsh16Ux64 x y)
12875         // cond: shiftIsBounded(v)
12876         // result: (SRD (MOVHZreg x) y)
12877         for {
12878                 x := v_0
12879                 y := v_1
12880                 if !(shiftIsBounded(v)) {
12881                         break
12882                 }
12883                 v.reset(OpPPC64SRD)
12884                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12885                 v0.AddArg(x)
12886                 v.AddArg2(v0, y)
12887                 return true
12888         }
12889         // match: (Rsh16Ux64 <t> x y)
12890         // result: (ISEL [0] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [16]))
12891         for {
12892                 t := v.Type
12893                 x := v_0
12894                 y := v_1
12895                 v.reset(OpPPC64ISEL)
12896                 v.AuxInt = int32ToAuxInt(0)
12897                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
12898                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12899                 v1.AddArg(x)
12900                 v0.AddArg2(v1, y)
12901                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12902                 v2.AuxInt = int64ToAuxInt(0)
12903                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
12904                 v3.AuxInt = int64ToAuxInt(16)
12905                 v3.AddArg(y)
12906                 v.AddArg3(v0, v2, v3)
12907                 return true
12908         }
12909 }
12910 func rewriteValuePPC64_OpRsh16Ux8(v *Value) bool {
12911         v_1 := v.Args[1]
12912         v_0 := v.Args[0]
12913         b := v.Block
12914         typ := &b.Func.Config.Types
12915         // match: (Rsh16Ux8 x y)
12916         // cond: shiftIsBounded(v)
12917         // result: (SRD (MOVHZreg x) y)
12918         for {
12919                 x := v_0
12920                 y := v_1
12921                 if !(shiftIsBounded(v)) {
12922                         break
12923                 }
12924                 v.reset(OpPPC64SRD)
12925                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12926                 v0.AddArg(x)
12927                 v.AddArg2(v0, y)
12928                 return true
12929         }
12930         // match: (Rsh16Ux8 <t> x y)
12931         // result: (ISEL [2] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y)))
12932         for {
12933                 t := v.Type
12934                 x := v_0
12935                 y := v_1
12936                 v.reset(OpPPC64ISEL)
12937                 v.AuxInt = int32ToAuxInt(2)
12938                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
12939                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12940                 v1.AddArg(x)
12941                 v0.AddArg2(v1, y)
12942                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12943                 v2.AuxInt = int64ToAuxInt(0)
12944                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
12945                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
12946                 v4.AuxInt = int64ToAuxInt(0x00F0)
12947                 v4.AddArg(y)
12948                 v3.AddArg(v4)
12949                 v.AddArg3(v0, v2, v3)
12950                 return true
12951         }
12952 }
12953 func rewriteValuePPC64_OpRsh16x16(v *Value) bool {
12954         v_1 := v.Args[1]
12955         v_0 := v.Args[0]
12956         b := v.Block
12957         typ := &b.Func.Config.Types
12958         // match: (Rsh16x16 x y)
12959         // cond: shiftIsBounded(v)
12960         // result: (SRAD (MOVHreg x) y)
12961         for {
12962                 x := v_0
12963                 y := v_1
12964                 if !(shiftIsBounded(v)) {
12965                         break
12966                 }
12967                 v.reset(OpPPC64SRAD)
12968                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
12969                 v0.AddArg(x)
12970                 v.AddArg2(v0, y)
12971                 return true
12972         }
12973         // match: (Rsh16x16 <t> x y)
12974         // result: (ISEL [2] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y)))
12975         for {
12976                 t := v.Type
12977                 x := v_0
12978                 y := v_1
12979                 v.reset(OpPPC64ISEL)
12980                 v.AuxInt = int32ToAuxInt(2)
12981                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
12982                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
12983                 v1.AddArg(x)
12984                 v0.AddArg2(v1, y)
12985                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
12986                 v2.AuxInt = int64ToAuxInt(15)
12987                 v2.AddArg(v1)
12988                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
12989                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
12990                 v4.AuxInt = int64ToAuxInt(0xFFF0)
12991                 v4.AddArg(y)
12992                 v3.AddArg(v4)
12993                 v.AddArg3(v0, v2, v3)
12994                 return true
12995         }
12996 }
12997 func rewriteValuePPC64_OpRsh16x32(v *Value) bool {
12998         v_1 := v.Args[1]
12999         v_0 := v.Args[0]
13000         b := v.Block
13001         typ := &b.Func.Config.Types
13002         // match: (Rsh16x32 x y)
13003         // cond: shiftIsBounded(v)
13004         // result: (SRAD (MOVHreg x) y)
13005         for {
13006                 x := v_0
13007                 y := v_1
13008                 if !(shiftIsBounded(v)) {
13009                         break
13010                 }
13011                 v.reset(OpPPC64SRAD)
13012                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13013                 v0.AddArg(x)
13014                 v.AddArg2(v0, y)
13015                 return true
13016         }
13017         // match: (Rsh16x32 <t> x y)
13018         // result: (ISEL [0] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (CMPWUconst y [16]))
13019         for {
13020                 t := v.Type
13021                 x := v_0
13022                 y := v_1
13023                 v.reset(OpPPC64ISEL)
13024                 v.AuxInt = int32ToAuxInt(0)
13025                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13026                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13027                 v1.AddArg(x)
13028                 v0.AddArg2(v1, y)
13029                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13030                 v2.AuxInt = int64ToAuxInt(15)
13031                 v2.AddArg(v1)
13032                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13033                 v3.AuxInt = int32ToAuxInt(16)
13034                 v3.AddArg(y)
13035                 v.AddArg3(v0, v2, v3)
13036                 return true
13037         }
13038 }
13039 func rewriteValuePPC64_OpRsh16x64(v *Value) bool {
13040         v_1 := v.Args[1]
13041         v_0 := v.Args[0]
13042         b := v.Block
13043         typ := &b.Func.Config.Types
13044         // match: (Rsh16x64 x (MOVDconst [c]))
13045         // cond: uint64(c) >= 16
13046         // result: (SRAWconst (SignExt16to32 x) [63])
13047         for {
13048                 x := v_0
13049                 if v_1.Op != OpPPC64MOVDconst {
13050                         break
13051                 }
13052                 c := auxIntToInt64(v_1.AuxInt)
13053                 if !(uint64(c) >= 16) {
13054                         break
13055                 }
13056                 v.reset(OpPPC64SRAWconst)
13057                 v.AuxInt = int64ToAuxInt(63)
13058                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
13059                 v0.AddArg(x)
13060                 v.AddArg(v0)
13061                 return true
13062         }
13063         // match: (Rsh16x64 x (MOVDconst [c]))
13064         // cond: uint64(c) < 16
13065         // result: (SRAWconst (SignExt16to32 x) [c])
13066         for {
13067                 x := v_0
13068                 if v_1.Op != OpPPC64MOVDconst {
13069                         break
13070                 }
13071                 c := auxIntToInt64(v_1.AuxInt)
13072                 if !(uint64(c) < 16) {
13073                         break
13074                 }
13075                 v.reset(OpPPC64SRAWconst)
13076                 v.AuxInt = int64ToAuxInt(c)
13077                 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
13078                 v0.AddArg(x)
13079                 v.AddArg(v0)
13080                 return true
13081         }
13082         // match: (Rsh16x64 x y)
13083         // cond: shiftIsBounded(v)
13084         // result: (SRAD (MOVHreg x) y)
13085         for {
13086                 x := v_0
13087                 y := v_1
13088                 if !(shiftIsBounded(v)) {
13089                         break
13090                 }
13091                 v.reset(OpPPC64SRAD)
13092                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13093                 v0.AddArg(x)
13094                 v.AddArg2(v0, y)
13095                 return true
13096         }
13097         // match: (Rsh16x64 <t> x y)
13098         // result: (ISEL [0] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (CMPUconst y [16]))
13099         for {
13100                 t := v.Type
13101                 x := v_0
13102                 y := v_1
13103                 v.reset(OpPPC64ISEL)
13104                 v.AuxInt = int32ToAuxInt(0)
13105                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13106                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13107                 v1.AddArg(x)
13108                 v0.AddArg2(v1, y)
13109                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13110                 v2.AuxInt = int64ToAuxInt(15)
13111                 v2.AddArg(v1)
13112                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13113                 v3.AuxInt = int64ToAuxInt(16)
13114                 v3.AddArg(y)
13115                 v.AddArg3(v0, v2, v3)
13116                 return true
13117         }
13118 }
13119 func rewriteValuePPC64_OpRsh16x8(v *Value) bool {
13120         v_1 := v.Args[1]
13121         v_0 := v.Args[0]
13122         b := v.Block
13123         typ := &b.Func.Config.Types
13124         // match: (Rsh16x8 x y)
13125         // cond: shiftIsBounded(v)
13126         // result: (SRAD (MOVHreg x) y)
13127         for {
13128                 x := v_0
13129                 y := v_1
13130                 if !(shiftIsBounded(v)) {
13131                         break
13132                 }
13133                 v.reset(OpPPC64SRAD)
13134                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13135                 v0.AddArg(x)
13136                 v.AddArg2(v0, y)
13137                 return true
13138         }
13139         // match: (Rsh16x8 <t> x y)
13140         // result: (ISEL [2] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y)))
13141         for {
13142                 t := v.Type
13143                 x := v_0
13144                 y := v_1
13145                 v.reset(OpPPC64ISEL)
13146                 v.AuxInt = int32ToAuxInt(2)
13147                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13148                 v1 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13149                 v1.AddArg(x)
13150                 v0.AddArg2(v1, y)
13151                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13152                 v2.AuxInt = int64ToAuxInt(15)
13153                 v2.AddArg(v1)
13154                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13155                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13156                 v4.AuxInt = int64ToAuxInt(0x00F0)
13157                 v4.AddArg(y)
13158                 v3.AddArg(v4)
13159                 v.AddArg3(v0, v2, v3)
13160                 return true
13161         }
13162 }
13163 func rewriteValuePPC64_OpRsh32Ux16(v *Value) bool {
13164         v_1 := v.Args[1]
13165         v_0 := v.Args[0]
13166         b := v.Block
13167         typ := &b.Func.Config.Types
13168         // match: (Rsh32Ux16 x y)
13169         // cond: shiftIsBounded(v)
13170         // result: (SRW x y)
13171         for {
13172                 x := v_0
13173                 y := v_1
13174                 if !(shiftIsBounded(v)) {
13175                         break
13176                 }
13177                 v.reset(OpPPC64SRW)
13178                 v.AddArg2(x, y)
13179                 return true
13180         }
13181         // match: (Rsh32Ux16 <t> x y)
13182         // result: (ISEL [2] (SRW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y)))
13183         for {
13184                 t := v.Type
13185                 x := v_0
13186                 y := v_1
13187                 v.reset(OpPPC64ISEL)
13188                 v.AuxInt = int32ToAuxInt(2)
13189                 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
13190                 v0.AddArg2(x, y)
13191                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13192                 v1.AuxInt = int64ToAuxInt(0)
13193                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13194                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13195                 v3.AuxInt = int64ToAuxInt(0xFFE0)
13196                 v3.AddArg(y)
13197                 v2.AddArg(v3)
13198                 v.AddArg3(v0, v1, v2)
13199                 return true
13200         }
13201 }
13202 func rewriteValuePPC64_OpRsh32Ux32(v *Value) bool {
13203         v_1 := v.Args[1]
13204         v_0 := v.Args[0]
13205         b := v.Block
13206         typ := &b.Func.Config.Types
13207         // match: (Rsh32Ux32 x y)
13208         // cond: shiftIsBounded(v)
13209         // result: (SRW x y)
13210         for {
13211                 x := v_0
13212                 y := v_1
13213                 if !(shiftIsBounded(v)) {
13214                         break
13215                 }
13216                 v.reset(OpPPC64SRW)
13217                 v.AddArg2(x, y)
13218                 return true
13219         }
13220         // match: (Rsh32Ux32 <t> x y)
13221         // result: (ISEL [0] (SRW <t> x y) (MOVDconst [0]) (CMPWUconst y [32]))
13222         for {
13223                 t := v.Type
13224                 x := v_0
13225                 y := v_1
13226                 v.reset(OpPPC64ISEL)
13227                 v.AuxInt = int32ToAuxInt(0)
13228                 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
13229                 v0.AddArg2(x, y)
13230                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13231                 v1.AuxInt = int64ToAuxInt(0)
13232                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13233                 v2.AuxInt = int32ToAuxInt(32)
13234                 v2.AddArg(y)
13235                 v.AddArg3(v0, v1, v2)
13236                 return true
13237         }
13238 }
13239 func rewriteValuePPC64_OpRsh32Ux64(v *Value) bool {
13240         v_1 := v.Args[1]
13241         v_0 := v.Args[0]
13242         b := v.Block
13243         typ := &b.Func.Config.Types
13244         // match: (Rsh32Ux64 x (MOVDconst [c]))
13245         // cond: uint64(c) < 32
13246         // result: (SRWconst x [c])
13247         for {
13248                 x := v_0
13249                 if v_1.Op != OpPPC64MOVDconst {
13250                         break
13251                 }
13252                 c := auxIntToInt64(v_1.AuxInt)
13253                 if !(uint64(c) < 32) {
13254                         break
13255                 }
13256                 v.reset(OpPPC64SRWconst)
13257                 v.AuxInt = int64ToAuxInt(c)
13258                 v.AddArg(x)
13259                 return true
13260         }
13261         // match: (Rsh32Ux64 x y)
13262         // cond: shiftIsBounded(v)
13263         // result: (SRW x y)
13264         for {
13265                 x := v_0
13266                 y := v_1
13267                 if !(shiftIsBounded(v)) {
13268                         break
13269                 }
13270                 v.reset(OpPPC64SRW)
13271                 v.AddArg2(x, y)
13272                 return true
13273         }
13274         // match: (Rsh32Ux64 <t> x y)
13275         // result: (ISEL [0] (SRW <t> x y) (MOVDconst [0]) (CMPUconst y [32]))
13276         for {
13277                 t := v.Type
13278                 x := v_0
13279                 y := v_1
13280                 v.reset(OpPPC64ISEL)
13281                 v.AuxInt = int32ToAuxInt(0)
13282                 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
13283                 v0.AddArg2(x, y)
13284                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13285                 v1.AuxInt = int64ToAuxInt(0)
13286                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13287                 v2.AuxInt = int64ToAuxInt(32)
13288                 v2.AddArg(y)
13289                 v.AddArg3(v0, v1, v2)
13290                 return true
13291         }
13292 }
13293 func rewriteValuePPC64_OpRsh32Ux8(v *Value) bool {
13294         v_1 := v.Args[1]
13295         v_0 := v.Args[0]
13296         b := v.Block
13297         typ := &b.Func.Config.Types
13298         // match: (Rsh32Ux8 x y)
13299         // cond: shiftIsBounded(v)
13300         // result: (SRW x y)
13301         for {
13302                 x := v_0
13303                 y := v_1
13304                 if !(shiftIsBounded(v)) {
13305                         break
13306                 }
13307                 v.reset(OpPPC64SRW)
13308                 v.AddArg2(x, y)
13309                 return true
13310         }
13311         // match: (Rsh32Ux8 <t> x y)
13312         // result: (ISEL [2] (SRW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y)))
13313         for {
13314                 t := v.Type
13315                 x := v_0
13316                 y := v_1
13317                 v.reset(OpPPC64ISEL)
13318                 v.AuxInt = int32ToAuxInt(2)
13319                 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
13320                 v0.AddArg2(x, y)
13321                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13322                 v1.AuxInt = int64ToAuxInt(0)
13323                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13324                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13325                 v3.AuxInt = int64ToAuxInt(0x00E0)
13326                 v3.AddArg(y)
13327                 v2.AddArg(v3)
13328                 v.AddArg3(v0, v1, v2)
13329                 return true
13330         }
13331 }
13332 func rewriteValuePPC64_OpRsh32x16(v *Value) bool {
13333         v_1 := v.Args[1]
13334         v_0 := v.Args[0]
13335         b := v.Block
13336         typ := &b.Func.Config.Types
13337         // match: (Rsh32x16 x y)
13338         // cond: shiftIsBounded(v)
13339         // result: (SRAW x y)
13340         for {
13341                 x := v_0
13342                 y := v_1
13343                 if !(shiftIsBounded(v)) {
13344                         break
13345                 }
13346                 v.reset(OpPPC64SRAW)
13347                 v.AddArg2(x, y)
13348                 return true
13349         }
13350         // match: (Rsh32x16 <t> x y)
13351         // result: (ISEL [2] (SRAW <t> x y) (SRAWconst <t> x [31]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y)))
13352         for {
13353                 t := v.Type
13354                 x := v_0
13355                 y := v_1
13356                 v.reset(OpPPC64ISEL)
13357                 v.AuxInt = int32ToAuxInt(2)
13358                 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13359                 v0.AddArg2(x, y)
13360                 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13361                 v1.AuxInt = int64ToAuxInt(31)
13362                 v1.AddArg(x)
13363                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13364                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13365                 v3.AuxInt = int64ToAuxInt(0xFFE0)
13366                 v3.AddArg(y)
13367                 v2.AddArg(v3)
13368                 v.AddArg3(v0, v1, v2)
13369                 return true
13370         }
13371 }
13372 func rewriteValuePPC64_OpRsh32x32(v *Value) bool {
13373         v_1 := v.Args[1]
13374         v_0 := v.Args[0]
13375         b := v.Block
13376         // match: (Rsh32x32 x y)
13377         // cond: shiftIsBounded(v)
13378         // result: (SRAW x y)
13379         for {
13380                 x := v_0
13381                 y := v_1
13382                 if !(shiftIsBounded(v)) {
13383                         break
13384                 }
13385                 v.reset(OpPPC64SRAW)
13386                 v.AddArg2(x, y)
13387                 return true
13388         }
13389         // match: (Rsh32x32 <t> x y)
13390         // result: (ISEL [0] (SRAW <t> x y) (SRAWconst <t> x [31]) (CMPWUconst y [32]))
13391         for {
13392                 t := v.Type
13393                 x := v_0
13394                 y := v_1
13395                 v.reset(OpPPC64ISEL)
13396                 v.AuxInt = int32ToAuxInt(0)
13397                 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13398                 v0.AddArg2(x, y)
13399                 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13400                 v1.AuxInt = int64ToAuxInt(31)
13401                 v1.AddArg(x)
13402                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13403                 v2.AuxInt = int32ToAuxInt(32)
13404                 v2.AddArg(y)
13405                 v.AddArg3(v0, v1, v2)
13406                 return true
13407         }
13408 }
13409 func rewriteValuePPC64_OpRsh32x64(v *Value) bool {
13410         v_1 := v.Args[1]
13411         v_0 := v.Args[0]
13412         b := v.Block
13413         // match: (Rsh32x64 x (MOVDconst [c]))
13414         // cond: uint64(c) >= 32
13415         // result: (SRAWconst x [63])
13416         for {
13417                 x := v_0
13418                 if v_1.Op != OpPPC64MOVDconst {
13419                         break
13420                 }
13421                 c := auxIntToInt64(v_1.AuxInt)
13422                 if !(uint64(c) >= 32) {
13423                         break
13424                 }
13425                 v.reset(OpPPC64SRAWconst)
13426                 v.AuxInt = int64ToAuxInt(63)
13427                 v.AddArg(x)
13428                 return true
13429         }
13430         // match: (Rsh32x64 x (MOVDconst [c]))
13431         // cond: uint64(c) < 32
13432         // result: (SRAWconst x [c])
13433         for {
13434                 x := v_0
13435                 if v_1.Op != OpPPC64MOVDconst {
13436                         break
13437                 }
13438                 c := auxIntToInt64(v_1.AuxInt)
13439                 if !(uint64(c) < 32) {
13440                         break
13441                 }
13442                 v.reset(OpPPC64SRAWconst)
13443                 v.AuxInt = int64ToAuxInt(c)
13444                 v.AddArg(x)
13445                 return true
13446         }
13447         // match: (Rsh32x64 x y)
13448         // cond: shiftIsBounded(v)
13449         // result: (SRAW x y)
13450         for {
13451                 x := v_0
13452                 y := v_1
13453                 if !(shiftIsBounded(v)) {
13454                         break
13455                 }
13456                 v.reset(OpPPC64SRAW)
13457                 v.AddArg2(x, y)
13458                 return true
13459         }
13460         // match: (Rsh32x64 <t> x y)
13461         // result: (ISEL [0] (SRAW <t> x y) (SRAWconst <t> x [31]) (CMPUconst y [32]))
13462         for {
13463                 t := v.Type
13464                 x := v_0
13465                 y := v_1
13466                 v.reset(OpPPC64ISEL)
13467                 v.AuxInt = int32ToAuxInt(0)
13468                 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13469                 v0.AddArg2(x, y)
13470                 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13471                 v1.AuxInt = int64ToAuxInt(31)
13472                 v1.AddArg(x)
13473                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13474                 v2.AuxInt = int64ToAuxInt(32)
13475                 v2.AddArg(y)
13476                 v.AddArg3(v0, v1, v2)
13477                 return true
13478         }
13479 }
13480 func rewriteValuePPC64_OpRsh32x8(v *Value) bool {
13481         v_1 := v.Args[1]
13482         v_0 := v.Args[0]
13483         b := v.Block
13484         typ := &b.Func.Config.Types
13485         // match: (Rsh32x8 x y)
13486         // cond: shiftIsBounded(v)
13487         // result: (SRAW x y)
13488         for {
13489                 x := v_0
13490                 y := v_1
13491                 if !(shiftIsBounded(v)) {
13492                         break
13493                 }
13494                 v.reset(OpPPC64SRAW)
13495                 v.AddArg2(x, y)
13496                 return true
13497         }
13498         // match: (Rsh32x8 <t> x y)
13499         // result: (ISEL [2] (SRAW <t> x y) (SRAWconst <t> x [31]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y)))
13500         for {
13501                 t := v.Type
13502                 x := v_0
13503                 y := v_1
13504                 v.reset(OpPPC64ISEL)
13505                 v.AuxInt = int32ToAuxInt(2)
13506                 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13507                 v0.AddArg2(x, y)
13508                 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13509                 v1.AuxInt = int64ToAuxInt(31)
13510                 v1.AddArg(x)
13511                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13512                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13513                 v3.AuxInt = int64ToAuxInt(0x00E0)
13514                 v3.AddArg(y)
13515                 v2.AddArg(v3)
13516                 v.AddArg3(v0, v1, v2)
13517                 return true
13518         }
13519 }
13520 func rewriteValuePPC64_OpRsh64Ux16(v *Value) bool {
13521         v_1 := v.Args[1]
13522         v_0 := v.Args[0]
13523         b := v.Block
13524         typ := &b.Func.Config.Types
13525         // match: (Rsh64Ux16 x y)
13526         // cond: shiftIsBounded(v)
13527         // result: (SRD x y)
13528         for {
13529                 x := v_0
13530                 y := v_1
13531                 if !(shiftIsBounded(v)) {
13532                         break
13533                 }
13534                 v.reset(OpPPC64SRD)
13535                 v.AddArg2(x, y)
13536                 return true
13537         }
13538         // match: (Rsh64Ux16 <t> x y)
13539         // result: (ISEL [2] (SRD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y)))
13540         for {
13541                 t := v.Type
13542                 x := v_0
13543                 y := v_1
13544                 v.reset(OpPPC64ISEL)
13545                 v.AuxInt = int32ToAuxInt(2)
13546                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13547                 v0.AddArg2(x, y)
13548                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13549                 v1.AuxInt = int64ToAuxInt(0)
13550                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13551                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13552                 v3.AuxInt = int64ToAuxInt(0xFFC0)
13553                 v3.AddArg(y)
13554                 v2.AddArg(v3)
13555                 v.AddArg3(v0, v1, v2)
13556                 return true
13557         }
13558 }
13559 func rewriteValuePPC64_OpRsh64Ux32(v *Value) bool {
13560         v_1 := v.Args[1]
13561         v_0 := v.Args[0]
13562         b := v.Block
13563         typ := &b.Func.Config.Types
13564         // match: (Rsh64Ux32 x y)
13565         // cond: shiftIsBounded(v)
13566         // result: (SRD x y)
13567         for {
13568                 x := v_0
13569                 y := v_1
13570                 if !(shiftIsBounded(v)) {
13571                         break
13572                 }
13573                 v.reset(OpPPC64SRD)
13574                 v.AddArg2(x, y)
13575                 return true
13576         }
13577         // match: (Rsh64Ux32 <t> x y)
13578         // result: (ISEL [0] (SRD <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
13579         for {
13580                 t := v.Type
13581                 x := v_0
13582                 y := v_1
13583                 v.reset(OpPPC64ISEL)
13584                 v.AuxInt = int32ToAuxInt(0)
13585                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13586                 v0.AddArg2(x, y)
13587                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13588                 v1.AuxInt = int64ToAuxInt(0)
13589                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13590                 v2.AuxInt = int32ToAuxInt(64)
13591                 v2.AddArg(y)
13592                 v.AddArg3(v0, v1, v2)
13593                 return true
13594         }
13595 }
13596 func rewriteValuePPC64_OpRsh64Ux64(v *Value) bool {
13597         v_1 := v.Args[1]
13598         v_0 := v.Args[0]
13599         b := v.Block
13600         typ := &b.Func.Config.Types
13601         // match: (Rsh64Ux64 x (MOVDconst [c]))
13602         // cond: uint64(c) < 64
13603         // result: (SRDconst x [c])
13604         for {
13605                 x := v_0
13606                 if v_1.Op != OpPPC64MOVDconst {
13607                         break
13608                 }
13609                 c := auxIntToInt64(v_1.AuxInt)
13610                 if !(uint64(c) < 64) {
13611                         break
13612                 }
13613                 v.reset(OpPPC64SRDconst)
13614                 v.AuxInt = int64ToAuxInt(c)
13615                 v.AddArg(x)
13616                 return true
13617         }
13618         // match: (Rsh64Ux64 x y)
13619         // cond: shiftIsBounded(v)
13620         // result: (SRD x y)
13621         for {
13622                 x := v_0
13623                 y := v_1
13624                 if !(shiftIsBounded(v)) {
13625                         break
13626                 }
13627                 v.reset(OpPPC64SRD)
13628                 v.AddArg2(x, y)
13629                 return true
13630         }
13631         // match: (Rsh64Ux64 <t> x y)
13632         // result: (ISEL [0] (SRD <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
13633         for {
13634                 t := v.Type
13635                 x := v_0
13636                 y := v_1
13637                 v.reset(OpPPC64ISEL)
13638                 v.AuxInt = int32ToAuxInt(0)
13639                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13640                 v0.AddArg2(x, y)
13641                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13642                 v1.AuxInt = int64ToAuxInt(0)
13643                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13644                 v2.AuxInt = int64ToAuxInt(64)
13645                 v2.AddArg(y)
13646                 v.AddArg3(v0, v1, v2)
13647                 return true
13648         }
13649 }
13650 func rewriteValuePPC64_OpRsh64Ux8(v *Value) bool {
13651         v_1 := v.Args[1]
13652         v_0 := v.Args[0]
13653         b := v.Block
13654         typ := &b.Func.Config.Types
13655         // match: (Rsh64Ux8 x y)
13656         // cond: shiftIsBounded(v)
13657         // result: (SRD x y)
13658         for {
13659                 x := v_0
13660                 y := v_1
13661                 if !(shiftIsBounded(v)) {
13662                         break
13663                 }
13664                 v.reset(OpPPC64SRD)
13665                 v.AddArg2(x, y)
13666                 return true
13667         }
13668         // match: (Rsh64Ux8 <t> x y)
13669         // result: (ISEL [2] (SRD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y)))
13670         for {
13671                 t := v.Type
13672                 x := v_0
13673                 y := v_1
13674                 v.reset(OpPPC64ISEL)
13675                 v.AuxInt = int32ToAuxInt(2)
13676                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13677                 v0.AddArg2(x, y)
13678                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13679                 v1.AuxInt = int64ToAuxInt(0)
13680                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13681                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13682                 v3.AuxInt = int64ToAuxInt(0x00C0)
13683                 v3.AddArg(y)
13684                 v2.AddArg(v3)
13685                 v.AddArg3(v0, v1, v2)
13686                 return true
13687         }
13688 }
13689 func rewriteValuePPC64_OpRsh64x16(v *Value) bool {
13690         v_1 := v.Args[1]
13691         v_0 := v.Args[0]
13692         b := v.Block
13693         typ := &b.Func.Config.Types
13694         // match: (Rsh64x16 x y)
13695         // cond: shiftIsBounded(v)
13696         // result: (SRAD x y)
13697         for {
13698                 x := v_0
13699                 y := v_1
13700                 if !(shiftIsBounded(v)) {
13701                         break
13702                 }
13703                 v.reset(OpPPC64SRAD)
13704                 v.AddArg2(x, y)
13705                 return true
13706         }
13707         // match: (Rsh64x16 <t> x y)
13708         // result: (ISEL [2] (SRAD <t> x y) (SRADconst <t> x [63]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y)))
13709         for {
13710                 t := v.Type
13711                 x := v_0
13712                 y := v_1
13713                 v.reset(OpPPC64ISEL)
13714                 v.AuxInt = int32ToAuxInt(2)
13715                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13716                 v0.AddArg2(x, y)
13717                 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13718                 v1.AuxInt = int64ToAuxInt(63)
13719                 v1.AddArg(x)
13720                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13721                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13722                 v3.AuxInt = int64ToAuxInt(0xFFC0)
13723                 v3.AddArg(y)
13724                 v2.AddArg(v3)
13725                 v.AddArg3(v0, v1, v2)
13726                 return true
13727         }
13728 }
13729 func rewriteValuePPC64_OpRsh64x32(v *Value) bool {
13730         v_1 := v.Args[1]
13731         v_0 := v.Args[0]
13732         b := v.Block
13733         // match: (Rsh64x32 x y)
13734         // cond: shiftIsBounded(v)
13735         // result: (SRAD x y)
13736         for {
13737                 x := v_0
13738                 y := v_1
13739                 if !(shiftIsBounded(v)) {
13740                         break
13741                 }
13742                 v.reset(OpPPC64SRAD)
13743                 v.AddArg2(x, y)
13744                 return true
13745         }
13746         // match: (Rsh64x32 <t> x y)
13747         // result: (ISEL [0] (SRAD <t> x y) (SRADconst <t> x [63]) (CMPWUconst y [64]))
13748         for {
13749                 t := v.Type
13750                 x := v_0
13751                 y := v_1
13752                 v.reset(OpPPC64ISEL)
13753                 v.AuxInt = int32ToAuxInt(0)
13754                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13755                 v0.AddArg2(x, y)
13756                 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13757                 v1.AuxInt = int64ToAuxInt(63)
13758                 v1.AddArg(x)
13759                 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13760                 v2.AuxInt = int32ToAuxInt(64)
13761                 v2.AddArg(y)
13762                 v.AddArg3(v0, v1, v2)
13763                 return true
13764         }
13765 }
13766 func rewriteValuePPC64_OpRsh64x64(v *Value) bool {
13767         v_1 := v.Args[1]
13768         v_0 := v.Args[0]
13769         b := v.Block
13770         // match: (Rsh64x64 x (MOVDconst [c]))
13771         // cond: uint64(c) >= 64
13772         // result: (SRADconst x [63])
13773         for {
13774                 x := v_0
13775                 if v_1.Op != OpPPC64MOVDconst {
13776                         break
13777                 }
13778                 c := auxIntToInt64(v_1.AuxInt)
13779                 if !(uint64(c) >= 64) {
13780                         break
13781                 }
13782                 v.reset(OpPPC64SRADconst)
13783                 v.AuxInt = int64ToAuxInt(63)
13784                 v.AddArg(x)
13785                 return true
13786         }
13787         // match: (Rsh64x64 x (MOVDconst [c]))
13788         // cond: uint64(c) < 64
13789         // result: (SRADconst x [c])
13790         for {
13791                 x := v_0
13792                 if v_1.Op != OpPPC64MOVDconst {
13793                         break
13794                 }
13795                 c := auxIntToInt64(v_1.AuxInt)
13796                 if !(uint64(c) < 64) {
13797                         break
13798                 }
13799                 v.reset(OpPPC64SRADconst)
13800                 v.AuxInt = int64ToAuxInt(c)
13801                 v.AddArg(x)
13802                 return true
13803         }
13804         // match: (Rsh64x64 x y)
13805         // cond: shiftIsBounded(v)
13806         // result: (SRAD x y)
13807         for {
13808                 x := v_0
13809                 y := v_1
13810                 if !(shiftIsBounded(v)) {
13811                         break
13812                 }
13813                 v.reset(OpPPC64SRAD)
13814                 v.AddArg2(x, y)
13815                 return true
13816         }
13817         // match: (Rsh64x64 <t> x y)
13818         // result: (ISEL [0] (SRAD <t> x y) (SRADconst <t> x [63]) (CMPUconst y [64]))
13819         for {
13820                 t := v.Type
13821                 x := v_0
13822                 y := v_1
13823                 v.reset(OpPPC64ISEL)
13824                 v.AuxInt = int32ToAuxInt(0)
13825                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13826                 v0.AddArg2(x, y)
13827                 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13828                 v1.AuxInt = int64ToAuxInt(63)
13829                 v1.AddArg(x)
13830                 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13831                 v2.AuxInt = int64ToAuxInt(64)
13832                 v2.AddArg(y)
13833                 v.AddArg3(v0, v1, v2)
13834                 return true
13835         }
13836 }
13837 func rewriteValuePPC64_OpRsh64x8(v *Value) bool {
13838         v_1 := v.Args[1]
13839         v_0 := v.Args[0]
13840         b := v.Block
13841         typ := &b.Func.Config.Types
13842         // match: (Rsh64x8 x y)
13843         // cond: shiftIsBounded(v)
13844         // result: (SRAD x y)
13845         for {
13846                 x := v_0
13847                 y := v_1
13848                 if !(shiftIsBounded(v)) {
13849                         break
13850                 }
13851                 v.reset(OpPPC64SRAD)
13852                 v.AddArg2(x, y)
13853                 return true
13854         }
13855         // match: (Rsh64x8 <t> x y)
13856         // result: (ISEL [2] (SRAD <t> x y) (SRADconst <t> x [63]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y)))
13857         for {
13858                 t := v.Type
13859                 x := v_0
13860                 y := v_1
13861                 v.reset(OpPPC64ISEL)
13862                 v.AuxInt = int32ToAuxInt(2)
13863                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13864                 v0.AddArg2(x, y)
13865                 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13866                 v1.AuxInt = int64ToAuxInt(63)
13867                 v1.AddArg(x)
13868                 v2 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13869                 v3 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13870                 v3.AuxInt = int64ToAuxInt(0x00C0)
13871                 v3.AddArg(y)
13872                 v2.AddArg(v3)
13873                 v.AddArg3(v0, v1, v2)
13874                 return true
13875         }
13876 }
13877 func rewriteValuePPC64_OpRsh8Ux16(v *Value) bool {
13878         v_1 := v.Args[1]
13879         v_0 := v.Args[0]
13880         b := v.Block
13881         typ := &b.Func.Config.Types
13882         // match: (Rsh8Ux16 x y)
13883         // cond: shiftIsBounded(v)
13884         // result: (SRD (MOVBZreg x) y)
13885         for {
13886                 x := v_0
13887                 y := v_1
13888                 if !(shiftIsBounded(v)) {
13889                         break
13890                 }
13891                 v.reset(OpPPC64SRD)
13892                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13893                 v0.AddArg(x)
13894                 v.AddArg2(v0, y)
13895                 return true
13896         }
13897         // match: (Rsh8Ux16 <t> x y)
13898         // result: (ISEL [2] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y)))
13899         for {
13900                 t := v.Type
13901                 x := v_0
13902                 y := v_1
13903                 v.reset(OpPPC64ISEL)
13904                 v.AuxInt = int32ToAuxInt(2)
13905                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13906                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13907                 v1.AddArg(x)
13908                 v0.AddArg2(v1, y)
13909                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13910                 v2.AuxInt = int64ToAuxInt(0)
13911                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
13912                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
13913                 v4.AuxInt = int64ToAuxInt(0xFFF8)
13914                 v4.AddArg(y)
13915                 v3.AddArg(v4)
13916                 v.AddArg3(v0, v2, v3)
13917                 return true
13918         }
13919 }
13920 func rewriteValuePPC64_OpRsh8Ux32(v *Value) bool {
13921         v_1 := v.Args[1]
13922         v_0 := v.Args[0]
13923         b := v.Block
13924         typ := &b.Func.Config.Types
13925         // match: (Rsh8Ux32 x y)
13926         // cond: shiftIsBounded(v)
13927         // result: (SRD (MOVBZreg x) y)
13928         for {
13929                 x := v_0
13930                 y := v_1
13931                 if !(shiftIsBounded(v)) {
13932                         break
13933                 }
13934                 v.reset(OpPPC64SRD)
13935                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13936                 v0.AddArg(x)
13937                 v.AddArg2(v0, y)
13938                 return true
13939         }
13940         // match: (Rsh8Ux32 <t> x y)
13941         // result: (ISEL [0] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [8]))
13942         for {
13943                 t := v.Type
13944                 x := v_0
13945                 y := v_1
13946                 v.reset(OpPPC64ISEL)
13947                 v.AuxInt = int32ToAuxInt(0)
13948                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
13949                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13950                 v1.AddArg(x)
13951                 v0.AddArg2(v1, y)
13952                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
13953                 v2.AuxInt = int64ToAuxInt(0)
13954                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13955                 v3.AuxInt = int32ToAuxInt(8)
13956                 v3.AddArg(y)
13957                 v.AddArg3(v0, v2, v3)
13958                 return true
13959         }
13960 }
13961 func rewriteValuePPC64_OpRsh8Ux64(v *Value) bool {
13962         v_1 := v.Args[1]
13963         v_0 := v.Args[0]
13964         b := v.Block
13965         typ := &b.Func.Config.Types
13966         // match: (Rsh8Ux64 x (MOVDconst [c]))
13967         // cond: uint64(c) < 8
13968         // result: (SRWconst (ZeroExt8to32 x) [c])
13969         for {
13970                 x := v_0
13971                 if v_1.Op != OpPPC64MOVDconst {
13972                         break
13973                 }
13974                 c := auxIntToInt64(v_1.AuxInt)
13975                 if !(uint64(c) < 8) {
13976                         break
13977                 }
13978                 v.reset(OpPPC64SRWconst)
13979                 v.AuxInt = int64ToAuxInt(c)
13980                 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
13981                 v0.AddArg(x)
13982                 v.AddArg(v0)
13983                 return true
13984         }
13985         // match: (Rsh8Ux64 x y)
13986         // cond: shiftIsBounded(v)
13987         // result: (SRD (MOVBZreg x) y)
13988         for {
13989                 x := v_0
13990                 y := v_1
13991                 if !(shiftIsBounded(v)) {
13992                         break
13993                 }
13994                 v.reset(OpPPC64SRD)
13995                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13996                 v0.AddArg(x)
13997                 v.AddArg2(v0, y)
13998                 return true
13999         }
14000         // match: (Rsh8Ux64 <t> x y)
14001         // result: (ISEL [0] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [8]))
14002         for {
14003                 t := v.Type
14004                 x := v_0
14005                 y := v_1
14006                 v.reset(OpPPC64ISEL)
14007                 v.AuxInt = int32ToAuxInt(0)
14008                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
14009                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
14010                 v1.AddArg(x)
14011                 v0.AddArg2(v1, y)
14012                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14013                 v2.AuxInt = int64ToAuxInt(0)
14014                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
14015                 v3.AuxInt = int64ToAuxInt(8)
14016                 v3.AddArg(y)
14017                 v.AddArg3(v0, v2, v3)
14018                 return true
14019         }
14020 }
14021 func rewriteValuePPC64_OpRsh8Ux8(v *Value) bool {
14022         v_1 := v.Args[1]
14023         v_0 := v.Args[0]
14024         b := v.Block
14025         typ := &b.Func.Config.Types
14026         // match: (Rsh8Ux8 x y)
14027         // cond: shiftIsBounded(v)
14028         // result: (SRD (MOVBZreg x) y)
14029         for {
14030                 x := v_0
14031                 y := v_1
14032                 if !(shiftIsBounded(v)) {
14033                         break
14034                 }
14035                 v.reset(OpPPC64SRD)
14036                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
14037                 v0.AddArg(x)
14038                 v.AddArg2(v0, y)
14039                 return true
14040         }
14041         // match: (Rsh8Ux8 <t> x y)
14042         // result: (ISEL [2] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y)))
14043         for {
14044                 t := v.Type
14045                 x := v_0
14046                 y := v_1
14047                 v.reset(OpPPC64ISEL)
14048                 v.AuxInt = int32ToAuxInt(2)
14049                 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
14050                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
14051                 v1.AddArg(x)
14052                 v0.AddArg2(v1, y)
14053                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
14054                 v2.AuxInt = int64ToAuxInt(0)
14055                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14056                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14057                 v4.AuxInt = int64ToAuxInt(0x00F8)
14058                 v4.AddArg(y)
14059                 v3.AddArg(v4)
14060                 v.AddArg3(v0, v2, v3)
14061                 return true
14062         }
14063 }
14064 func rewriteValuePPC64_OpRsh8x16(v *Value) bool {
14065         v_1 := v.Args[1]
14066         v_0 := v.Args[0]
14067         b := v.Block
14068         typ := &b.Func.Config.Types
14069         // match: (Rsh8x16 x y)
14070         // cond: shiftIsBounded(v)
14071         // result: (SRAD (MOVBreg x) y)
14072         for {
14073                 x := v_0
14074                 y := v_1
14075                 if !(shiftIsBounded(v)) {
14076                         break
14077                 }
14078                 v.reset(OpPPC64SRAD)
14079                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14080                 v0.AddArg(x)
14081                 v.AddArg2(v0, y)
14082                 return true
14083         }
14084         // match: (Rsh8x16 <t> x y)
14085         // result: (ISEL [2] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y)))
14086         for {
14087                 t := v.Type
14088                 x := v_0
14089                 y := v_1
14090                 v.reset(OpPPC64ISEL)
14091                 v.AuxInt = int32ToAuxInt(2)
14092                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
14093                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14094                 v1.AddArg(x)
14095                 v0.AddArg2(v1, y)
14096                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14097                 v2.AuxInt = int64ToAuxInt(7)
14098                 v2.AddArg(v1)
14099                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14100                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14101                 v4.AuxInt = int64ToAuxInt(0xFFF8)
14102                 v4.AddArg(y)
14103                 v3.AddArg(v4)
14104                 v.AddArg3(v0, v2, v3)
14105                 return true
14106         }
14107 }
14108 func rewriteValuePPC64_OpRsh8x32(v *Value) bool {
14109         v_1 := v.Args[1]
14110         v_0 := v.Args[0]
14111         b := v.Block
14112         typ := &b.Func.Config.Types
14113         // match: (Rsh8x32 x y)
14114         // cond: shiftIsBounded(v)
14115         // result: (SRAD (MOVBreg x) y)
14116         for {
14117                 x := v_0
14118                 y := v_1
14119                 if !(shiftIsBounded(v)) {
14120                         break
14121                 }
14122                 v.reset(OpPPC64SRAD)
14123                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14124                 v0.AddArg(x)
14125                 v.AddArg2(v0, y)
14126                 return true
14127         }
14128         // match: (Rsh8x32 <t> x y)
14129         // result: (ISEL [0] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (CMPWUconst y [8]))
14130         for {
14131                 t := v.Type
14132                 x := v_0
14133                 y := v_1
14134                 v.reset(OpPPC64ISEL)
14135                 v.AuxInt = int32ToAuxInt(0)
14136                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
14137                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14138                 v1.AddArg(x)
14139                 v0.AddArg2(v1, y)
14140                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14141                 v2.AuxInt = int64ToAuxInt(7)
14142                 v2.AddArg(v1)
14143                 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
14144                 v3.AuxInt = int32ToAuxInt(8)
14145                 v3.AddArg(y)
14146                 v.AddArg3(v0, v2, v3)
14147                 return true
14148         }
14149 }
14150 func rewriteValuePPC64_OpRsh8x64(v *Value) bool {
14151         v_1 := v.Args[1]
14152         v_0 := v.Args[0]
14153         b := v.Block
14154         typ := &b.Func.Config.Types
14155         // match: (Rsh8x64 x (MOVDconst [c]))
14156         // cond: uint64(c) >= 8
14157         // result: (SRAWconst (SignExt8to32 x) [63])
14158         for {
14159                 x := v_0
14160                 if v_1.Op != OpPPC64MOVDconst {
14161                         break
14162                 }
14163                 c := auxIntToInt64(v_1.AuxInt)
14164                 if !(uint64(c) >= 8) {
14165                         break
14166                 }
14167                 v.reset(OpPPC64SRAWconst)
14168                 v.AuxInt = int64ToAuxInt(63)
14169                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
14170                 v0.AddArg(x)
14171                 v.AddArg(v0)
14172                 return true
14173         }
14174         // match: (Rsh8x64 x (MOVDconst [c]))
14175         // cond: uint64(c) < 8
14176         // result: (SRAWconst (SignExt8to32 x) [c])
14177         for {
14178                 x := v_0
14179                 if v_1.Op != OpPPC64MOVDconst {
14180                         break
14181                 }
14182                 c := auxIntToInt64(v_1.AuxInt)
14183                 if !(uint64(c) < 8) {
14184                         break
14185                 }
14186                 v.reset(OpPPC64SRAWconst)
14187                 v.AuxInt = int64ToAuxInt(c)
14188                 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
14189                 v0.AddArg(x)
14190                 v.AddArg(v0)
14191                 return true
14192         }
14193         // match: (Rsh8x64 x y)
14194         // cond: shiftIsBounded(v)
14195         // result: (SRAD (MOVBreg x) y)
14196         for {
14197                 x := v_0
14198                 y := v_1
14199                 if !(shiftIsBounded(v)) {
14200                         break
14201                 }
14202                 v.reset(OpPPC64SRAD)
14203                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14204                 v0.AddArg(x)
14205                 v.AddArg2(v0, y)
14206                 return true
14207         }
14208         // match: (Rsh8x64 <t> x y)
14209         // result: (ISEL [0] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (CMPUconst y [8]))
14210         for {
14211                 t := v.Type
14212                 x := v_0
14213                 y := v_1
14214                 v.reset(OpPPC64ISEL)
14215                 v.AuxInt = int32ToAuxInt(0)
14216                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
14217                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14218                 v1.AddArg(x)
14219                 v0.AddArg2(v1, y)
14220                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14221                 v2.AuxInt = int64ToAuxInt(7)
14222                 v2.AddArg(v1)
14223                 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
14224                 v3.AuxInt = int64ToAuxInt(8)
14225                 v3.AddArg(y)
14226                 v.AddArg3(v0, v2, v3)
14227                 return true
14228         }
14229 }
14230 func rewriteValuePPC64_OpRsh8x8(v *Value) bool {
14231         v_1 := v.Args[1]
14232         v_0 := v.Args[0]
14233         b := v.Block
14234         typ := &b.Func.Config.Types
14235         // match: (Rsh8x8 x y)
14236         // cond: shiftIsBounded(v)
14237         // result: (SRAD (MOVBreg x) y)
14238         for {
14239                 x := v_0
14240                 y := v_1
14241                 if !(shiftIsBounded(v)) {
14242                         break
14243                 }
14244                 v.reset(OpPPC64SRAD)
14245                 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14246                 v0.AddArg(x)
14247                 v.AddArg2(v0, y)
14248                 return true
14249         }
14250         // match: (Rsh8x8 <t> x y)
14251         // result: (ISEL [2] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y)))
14252         for {
14253                 t := v.Type
14254                 x := v_0
14255                 y := v_1
14256                 v.reset(OpPPC64ISEL)
14257                 v.AuxInt = int32ToAuxInt(2)
14258                 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
14259                 v1 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14260                 v1.AddArg(x)
14261                 v0.AddArg2(v1, y)
14262                 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14263                 v2.AuxInt = int64ToAuxInt(7)
14264                 v2.AddArg(v1)
14265                 v3 := b.NewValue0(v.Pos, OpSelect1, types.TypeFlags)
14266                 v4 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14267                 v4.AuxInt = int64ToAuxInt(0x00F8)
14268                 v4.AddArg(y)
14269                 v3.AddArg(v4)
14270                 v.AddArg3(v0, v2, v3)
14271                 return true
14272         }
14273 }
14274 func rewriteValuePPC64_OpSelect0(v *Value) bool {
14275         v_0 := v.Args[0]
14276         b := v.Block
14277         typ := &b.Func.Config.Types
14278         // match: (Select0 (Mul64uhilo x y))
14279         // result: (MULHDU x y)
14280         for {
14281                 if v_0.Op != OpMul64uhilo {
14282                         break
14283                 }
14284                 y := v_0.Args[1]
14285                 x := v_0.Args[0]
14286                 v.reset(OpPPC64MULHDU)
14287                 v.AddArg2(x, y)
14288                 return true
14289         }
14290         // match: (Select0 (Add64carry x y c))
14291         // result: (Select0 <typ.UInt64> (ADDE x y (Select1 <typ.UInt64> (ADDCconst c [-1]))))
14292         for {
14293                 if v_0.Op != OpAdd64carry {
14294                         break
14295                 }
14296                 c := v_0.Args[2]
14297                 x := v_0.Args[0]
14298                 y := v_0.Args[1]
14299                 v.reset(OpSelect0)
14300                 v.Type = typ.UInt64
14301                 v0 := b.NewValue0(v.Pos, OpPPC64ADDE, types.NewTuple(typ.UInt64, typ.UInt64))
14302                 v1 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14303                 v2 := b.NewValue0(v.Pos, OpPPC64ADDCconst, types.NewTuple(typ.UInt64, typ.UInt64))
14304                 v2.AuxInt = int64ToAuxInt(-1)
14305                 v2.AddArg(c)
14306                 v1.AddArg(v2)
14307                 v0.AddArg3(x, y, v1)
14308                 v.AddArg(v0)
14309                 return true
14310         }
14311         // match: (Select0 (Sub64borrow x y c))
14312         // result: (Select0 <typ.UInt64> (SUBE x y (Select1 <typ.UInt64> (SUBCconst c [0]))))
14313         for {
14314                 if v_0.Op != OpSub64borrow {
14315                         break
14316                 }
14317                 c := v_0.Args[2]
14318                 x := v_0.Args[0]
14319                 y := v_0.Args[1]
14320                 v.reset(OpSelect0)
14321                 v.Type = typ.UInt64
14322                 v0 := b.NewValue0(v.Pos, OpPPC64SUBE, types.NewTuple(typ.UInt64, typ.UInt64))
14323                 v1 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14324                 v2 := b.NewValue0(v.Pos, OpPPC64SUBCconst, types.NewTuple(typ.UInt64, typ.UInt64))
14325                 v2.AuxInt = int64ToAuxInt(0)
14326                 v2.AddArg(c)
14327                 v1.AddArg(v2)
14328                 v0.AddArg3(x, y, v1)
14329                 v.AddArg(v0)
14330                 return true
14331         }
14332         // match: (Select0 (ANDCCconst [m] (ROTLWconst [r] x)))
14333         // cond: isPPC64WordRotateMask(m)
14334         // result: (RLWINM [encodePPC64RotateMask(r,m,32)] x)
14335         for {
14336                 if v_0.Op != OpPPC64ANDCCconst {
14337                         break
14338                 }
14339                 m := auxIntToInt64(v_0.AuxInt)
14340                 v_0_0 := v_0.Args[0]
14341                 if v_0_0.Op != OpPPC64ROTLWconst {
14342                         break
14343                 }
14344                 r := auxIntToInt64(v_0_0.AuxInt)
14345                 x := v_0_0.Args[0]
14346                 if !(isPPC64WordRotateMask(m)) {
14347                         break
14348                 }
14349                 v.reset(OpPPC64RLWINM)
14350                 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, m, 32))
14351                 v.AddArg(x)
14352                 return true
14353         }
14354         // match: (Select0 (ANDCCconst [m] (ROTLW x r)))
14355         // cond: isPPC64WordRotateMask(m)
14356         // result: (RLWNM [encodePPC64RotateMask(0,m,32)] x r)
14357         for {
14358                 if v_0.Op != OpPPC64ANDCCconst {
14359                         break
14360                 }
14361                 m := auxIntToInt64(v_0.AuxInt)
14362                 v_0_0 := v_0.Args[0]
14363                 if v_0_0.Op != OpPPC64ROTLW {
14364                         break
14365                 }
14366                 r := v_0_0.Args[1]
14367                 x := v_0_0.Args[0]
14368                 if !(isPPC64WordRotateMask(m)) {
14369                         break
14370                 }
14371                 v.reset(OpPPC64RLWNM)
14372                 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32))
14373                 v.AddArg2(x, r)
14374                 return true
14375         }
14376         // match: (Select0 (ANDCCconst [m] (SRWconst x [s])))
14377         // cond: mergePPC64RShiftMask(m,s,32) == 0
14378         // result: (MOVDconst [0])
14379         for {
14380                 if v_0.Op != OpPPC64ANDCCconst {
14381                         break
14382                 }
14383                 m := auxIntToInt64(v_0.AuxInt)
14384                 v_0_0 := v_0.Args[0]
14385                 if v_0_0.Op != OpPPC64SRWconst {
14386                         break
14387                 }
14388                 s := auxIntToInt64(v_0_0.AuxInt)
14389                 if !(mergePPC64RShiftMask(m, s, 32) == 0) {
14390                         break
14391                 }
14392                 v.reset(OpPPC64MOVDconst)
14393                 v.AuxInt = int64ToAuxInt(0)
14394                 return true
14395         }
14396         // match: (Select0 (ANDCCconst [m] (SRWconst x [s])))
14397         // cond: mergePPC64AndSrwi(m,s) != 0
14398         // result: (RLWINM [mergePPC64AndSrwi(m,s)] x)
14399         for {
14400                 if v_0.Op != OpPPC64ANDCCconst {
14401                         break
14402                 }
14403                 m := auxIntToInt64(v_0.AuxInt)
14404                 v_0_0 := v_0.Args[0]
14405                 if v_0_0.Op != OpPPC64SRWconst {
14406                         break
14407                 }
14408                 s := auxIntToInt64(v_0_0.AuxInt)
14409                 x := v_0_0.Args[0]
14410                 if !(mergePPC64AndSrwi(m, s) != 0) {
14411                         break
14412                 }
14413                 v.reset(OpPPC64RLWINM)
14414                 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m, s))
14415                 v.AddArg(x)
14416                 return true
14417         }
14418         // match: (Select0 (ANDCCconst [-1] x))
14419         // result: x
14420         for {
14421                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != -1 {
14422                         break
14423                 }
14424                 x := v_0.Args[0]
14425                 v.copyOf(x)
14426                 return true
14427         }
14428         // match: (Select0 (ANDCCconst [0] _))
14429         // result: (MOVDconst [0])
14430         for {
14431                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0 {
14432                         break
14433                 }
14434                 v.reset(OpPPC64MOVDconst)
14435                 v.AuxInt = int64ToAuxInt(0)
14436                 return true
14437         }
14438         // match: (Select0 (ANDCCconst [c] y:(MOVBZreg _)))
14439         // cond: c&0xFF == 0xFF
14440         // result: y
14441         for {
14442                 if v_0.Op != OpPPC64ANDCCconst {
14443                         break
14444                 }
14445                 c := auxIntToInt64(v_0.AuxInt)
14446                 y := v_0.Args[0]
14447                 if y.Op != OpPPC64MOVBZreg || !(c&0xFF == 0xFF) {
14448                         break
14449                 }
14450                 v.copyOf(y)
14451                 return true
14452         }
14453         // match: (Select0 (ANDCCconst [0xFF] (MOVBreg x)))
14454         // result: (MOVBZreg x)
14455         for {
14456                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0xFF {
14457                         break
14458                 }
14459                 v_0_0 := v_0.Args[0]
14460                 if v_0_0.Op != OpPPC64MOVBreg {
14461                         break
14462                 }
14463                 x := v_0_0.Args[0]
14464                 v.reset(OpPPC64MOVBZreg)
14465                 v.AddArg(x)
14466                 return true
14467         }
14468         // match: (Select0 (ANDCCconst [c] y:(MOVHZreg _)))
14469         // cond: c&0xFFFF == 0xFFFF
14470         // result: y
14471         for {
14472                 if v_0.Op != OpPPC64ANDCCconst {
14473                         break
14474                 }
14475                 c := auxIntToInt64(v_0.AuxInt)
14476                 y := v_0.Args[0]
14477                 if y.Op != OpPPC64MOVHZreg || !(c&0xFFFF == 0xFFFF) {
14478                         break
14479                 }
14480                 v.copyOf(y)
14481                 return true
14482         }
14483         // match: (Select0 (ANDCCconst [0xFFFF] (MOVHreg x)))
14484         // result: (MOVHZreg x)
14485         for {
14486                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0xFFFF {
14487                         break
14488                 }
14489                 v_0_0 := v_0.Args[0]
14490                 if v_0_0.Op != OpPPC64MOVHreg {
14491                         break
14492                 }
14493                 x := v_0_0.Args[0]
14494                 v.reset(OpPPC64MOVHZreg)
14495                 v.AddArg(x)
14496                 return true
14497         }
14498         // match: (Select0 (ANDCCconst [c] (MOVBZreg x)))
14499         // result: (Select0 (ANDCCconst [c&0xFF] x))
14500         for {
14501                 if v_0.Op != OpPPC64ANDCCconst {
14502                         break
14503                 }
14504                 c := auxIntToInt64(v_0.AuxInt)
14505                 v_0_0 := v_0.Args[0]
14506                 if v_0_0.Op != OpPPC64MOVBZreg {
14507                         break
14508                 }
14509                 x := v_0_0.Args[0]
14510                 v.reset(OpSelect0)
14511                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14512                 v0.AuxInt = int64ToAuxInt(c & 0xFF)
14513                 v0.AddArg(x)
14514                 v.AddArg(v0)
14515                 return true
14516         }
14517         // match: (Select0 (ANDCCconst [c] (MOVHZreg x)))
14518         // result: (Select0 (ANDCCconst [c&0xFFFF] x))
14519         for {
14520                 if v_0.Op != OpPPC64ANDCCconst {
14521                         break
14522                 }
14523                 c := auxIntToInt64(v_0.AuxInt)
14524                 v_0_0 := v_0.Args[0]
14525                 if v_0_0.Op != OpPPC64MOVHZreg {
14526                         break
14527                 }
14528                 x := v_0_0.Args[0]
14529                 v.reset(OpSelect0)
14530                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14531                 v0.AuxInt = int64ToAuxInt(c & 0xFFFF)
14532                 v0.AddArg(x)
14533                 v.AddArg(v0)
14534                 return true
14535         }
14536         // match: (Select0 (ANDCCconst [c] (MOVWZreg x)))
14537         // result: (Select0 (ANDCCconst [c&0xFFFFFFFF] x))
14538         for {
14539                 if v_0.Op != OpPPC64ANDCCconst {
14540                         break
14541                 }
14542                 c := auxIntToInt64(v_0.AuxInt)
14543                 v_0_0 := v_0.Args[0]
14544                 if v_0_0.Op != OpPPC64MOVWZreg {
14545                         break
14546                 }
14547                 x := v_0_0.Args[0]
14548                 v.reset(OpSelect0)
14549                 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14550                 v0.AuxInt = int64ToAuxInt(c & 0xFFFFFFFF)
14551                 v0.AddArg(x)
14552                 v.AddArg(v0)
14553                 return true
14554         }
14555         // match: (Select0 (ANDCCconst [1] z:(SRADconst [63] x)))
14556         // cond: z.Uses == 1
14557         // result: (SRDconst [63] x)
14558         for {
14559                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 1 {
14560                         break
14561                 }
14562                 z := v_0.Args[0]
14563                 if z.Op != OpPPC64SRADconst || auxIntToInt64(z.AuxInt) != 63 {
14564                         break
14565                 }
14566                 x := z.Args[0]
14567                 if !(z.Uses == 1) {
14568                         break
14569                 }
14570                 v.reset(OpPPC64SRDconst)
14571                 v.AuxInt = int64ToAuxInt(63)
14572                 v.AddArg(x)
14573                 return true
14574         }
14575         return false
14576 }
14577 func rewriteValuePPC64_OpSelect1(v *Value) bool {
14578         v_0 := v.Args[0]
14579         b := v.Block
14580         typ := &b.Func.Config.Types
14581         // match: (Select1 (Mul64uhilo x y))
14582         // result: (MULLD x y)
14583         for {
14584                 if v_0.Op != OpMul64uhilo {
14585                         break
14586                 }
14587                 y := v_0.Args[1]
14588                 x := v_0.Args[0]
14589                 v.reset(OpPPC64MULLD)
14590                 v.AddArg2(x, y)
14591                 return true
14592         }
14593         // match: (Select1 (Add64carry x y c))
14594         // result: (ADDZEzero (Select1 <typ.UInt64> (ADDE x y (Select1 <typ.UInt64> (ADDCconst c [-1])))))
14595         for {
14596                 if v_0.Op != OpAdd64carry {
14597                         break
14598                 }
14599                 c := v_0.Args[2]
14600                 x := v_0.Args[0]
14601                 y := v_0.Args[1]
14602                 v.reset(OpPPC64ADDZEzero)
14603                 v0 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14604                 v1 := b.NewValue0(v.Pos, OpPPC64ADDE, types.NewTuple(typ.UInt64, typ.UInt64))
14605                 v2 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14606                 v3 := b.NewValue0(v.Pos, OpPPC64ADDCconst, types.NewTuple(typ.UInt64, typ.UInt64))
14607                 v3.AuxInt = int64ToAuxInt(-1)
14608                 v3.AddArg(c)
14609                 v2.AddArg(v3)
14610                 v1.AddArg3(x, y, v2)
14611                 v0.AddArg(v1)
14612                 v.AddArg(v0)
14613                 return true
14614         }
14615         // match: (Select1 (ADDCconst n:(ADDZEzero x) [-1]))
14616         // cond: n.Uses <= 2
14617         // result: x
14618         for {
14619                 if v_0.Op != OpPPC64ADDCconst || auxIntToInt64(v_0.AuxInt) != -1 {
14620                         break
14621                 }
14622                 n := v_0.Args[0]
14623                 if n.Op != OpPPC64ADDZEzero {
14624                         break
14625                 }
14626                 x := n.Args[0]
14627                 if !(n.Uses <= 2) {
14628                         break
14629                 }
14630                 v.copyOf(x)
14631                 return true
14632         }
14633         // match: (Select1 (Sub64borrow x y c))
14634         // result: (NEG (SUBZEzero (Select1 <typ.UInt64> (SUBE x y (Select1 <typ.UInt64> (SUBCconst c [0]))))))
14635         for {
14636                 if v_0.Op != OpSub64borrow {
14637                         break
14638                 }
14639                 c := v_0.Args[2]
14640                 x := v_0.Args[0]
14641                 y := v_0.Args[1]
14642                 v.reset(OpPPC64NEG)
14643                 v0 := b.NewValue0(v.Pos, OpPPC64SUBZEzero, typ.UInt64)
14644                 v1 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14645                 v2 := b.NewValue0(v.Pos, OpPPC64SUBE, types.NewTuple(typ.UInt64, typ.UInt64))
14646                 v3 := b.NewValue0(v.Pos, OpSelect1, typ.UInt64)
14647                 v4 := b.NewValue0(v.Pos, OpPPC64SUBCconst, types.NewTuple(typ.UInt64, typ.UInt64))
14648                 v4.AuxInt = int64ToAuxInt(0)
14649                 v4.AddArg(c)
14650                 v3.AddArg(v4)
14651                 v2.AddArg3(x, y, v3)
14652                 v1.AddArg(v2)
14653                 v0.AddArg(v1)
14654                 v.AddArg(v0)
14655                 return true
14656         }
14657         // match: (Select1 (SUBCconst n:(NEG (SUBZEzero x)) [0]))
14658         // cond: n.Uses <= 2
14659         // result: x
14660         for {
14661                 if v_0.Op != OpPPC64SUBCconst || auxIntToInt64(v_0.AuxInt) != 0 {
14662                         break
14663                 }
14664                 n := v_0.Args[0]
14665                 if n.Op != OpPPC64NEG {
14666                         break
14667                 }
14668                 n_0 := n.Args[0]
14669                 if n_0.Op != OpPPC64SUBZEzero {
14670                         break
14671                 }
14672                 x := n_0.Args[0]
14673                 if !(n.Uses <= 2) {
14674                         break
14675                 }
14676                 v.copyOf(x)
14677                 return true
14678         }
14679         // match: (Select1 (ANDCCconst [0] _))
14680         // result: (FlagEQ)
14681         for {
14682                 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0 {
14683                         break
14684                 }
14685                 v.reset(OpPPC64FlagEQ)
14686                 return true
14687         }
14688         return false
14689 }
14690 func rewriteValuePPC64_OpSelectN(v *Value) bool {
14691         v_0 := v.Args[0]
14692         b := v.Block
14693         config := b.Func.Config
14694         // match: (SelectN [0] call:(CALLstatic {sym} s1:(MOVDstore _ (MOVDconst [sz]) s2:(MOVDstore _ src s3:(MOVDstore {t} _ dst mem)))))
14695         // 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)
14696         // result: (Move [sz] dst src mem)
14697         for {
14698                 if auxIntToInt64(v.AuxInt) != 0 {
14699                         break
14700                 }
14701                 call := v_0
14702                 if call.Op != OpPPC64CALLstatic || len(call.Args) != 1 {
14703                         break
14704                 }
14705                 sym := auxToCall(call.Aux)
14706                 s1 := call.Args[0]
14707                 if s1.Op != OpPPC64MOVDstore {
14708                         break
14709                 }
14710                 _ = s1.Args[2]
14711                 s1_1 := s1.Args[1]
14712                 if s1_1.Op != OpPPC64MOVDconst {
14713                         break
14714                 }
14715                 sz := auxIntToInt64(s1_1.AuxInt)
14716                 s2 := s1.Args[2]
14717                 if s2.Op != OpPPC64MOVDstore {
14718                         break
14719                 }
14720                 _ = s2.Args[2]
14721                 src := s2.Args[1]
14722                 s3 := s2.Args[2]
14723                 if s3.Op != OpPPC64MOVDstore {
14724                         break
14725                 }
14726                 mem := s3.Args[2]
14727                 dst := s3.Args[1]
14728                 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)) {
14729                         break
14730                 }
14731                 v.reset(OpMove)
14732                 v.AuxInt = int64ToAuxInt(sz)
14733                 v.AddArg3(dst, src, mem)
14734                 return true
14735         }
14736         // match: (SelectN [0] call:(CALLstatic {sym} dst src (MOVDconst [sz]) mem))
14737         // cond: sz >= 0 && isSameCall(sym, "runtime.memmove") && call.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(call)
14738         // result: (Move [sz] dst src mem)
14739         for {
14740                 if auxIntToInt64(v.AuxInt) != 0 {
14741                         break
14742                 }
14743                 call := v_0
14744                 if call.Op != OpPPC64CALLstatic || len(call.Args) != 4 {
14745                         break
14746                 }
14747                 sym := auxToCall(call.Aux)
14748                 mem := call.Args[3]
14749                 dst := call.Args[0]
14750                 src := call.Args[1]
14751                 call_2 := call.Args[2]
14752                 if call_2.Op != OpPPC64MOVDconst {
14753                         break
14754                 }
14755                 sz := auxIntToInt64(call_2.AuxInt)
14756                 if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && call.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(call)) {
14757                         break
14758                 }
14759                 v.reset(OpMove)
14760                 v.AuxInt = int64ToAuxInt(sz)
14761                 v.AddArg3(dst, src, mem)
14762                 return true
14763         }
14764         return false
14765 }
14766 func rewriteValuePPC64_OpSlicemask(v *Value) bool {
14767         v_0 := v.Args[0]
14768         b := v.Block
14769         // match: (Slicemask <t> x)
14770         // result: (SRADconst (NEG <t> x) [63])
14771         for {
14772                 t := v.Type
14773                 x := v_0
14774                 v.reset(OpPPC64SRADconst)
14775                 v.AuxInt = int64ToAuxInt(63)
14776                 v0 := b.NewValue0(v.Pos, OpPPC64NEG, t)
14777                 v0.AddArg(x)
14778                 v.AddArg(v0)
14779                 return true
14780         }
14781 }
14782 func rewriteValuePPC64_OpStore(v *Value) bool {
14783         v_2 := v.Args[2]
14784         v_1 := v.Args[1]
14785         v_0 := v.Args[0]
14786         // match: (Store {t} ptr val mem)
14787         // cond: t.Size() == 8 && t.IsFloat()
14788         // result: (FMOVDstore ptr val mem)
14789         for {
14790                 t := auxToType(v.Aux)
14791                 ptr := v_0
14792                 val := v_1
14793                 mem := v_2
14794                 if !(t.Size() == 8 && t.IsFloat()) {
14795                         break
14796                 }
14797                 v.reset(OpPPC64FMOVDstore)
14798                 v.AddArg3(ptr, val, mem)
14799                 return true
14800         }
14801         // match: (Store {t} ptr val mem)
14802         // cond: t.Size() == 4 && t.IsFloat()
14803         // result: (FMOVSstore ptr val mem)
14804         for {
14805                 t := auxToType(v.Aux)
14806                 ptr := v_0
14807                 val := v_1
14808                 mem := v_2
14809                 if !(t.Size() == 4 && t.IsFloat()) {
14810                         break
14811                 }
14812                 v.reset(OpPPC64FMOVSstore)
14813                 v.AddArg3(ptr, val, mem)
14814                 return true
14815         }
14816         // match: (Store {t} ptr val mem)
14817         // cond: t.Size() == 8 && !t.IsFloat()
14818         // result: (MOVDstore ptr val mem)
14819         for {
14820                 t := auxToType(v.Aux)
14821                 ptr := v_0
14822                 val := v_1
14823                 mem := v_2
14824                 if !(t.Size() == 8 && !t.IsFloat()) {
14825                         break
14826                 }
14827                 v.reset(OpPPC64MOVDstore)
14828                 v.AddArg3(ptr, val, mem)
14829                 return true
14830         }
14831         // match: (Store {t} ptr val mem)
14832         // cond: t.Size() == 4 && !t.IsFloat()
14833         // result: (MOVWstore ptr val mem)
14834         for {
14835                 t := auxToType(v.Aux)
14836                 ptr := v_0
14837                 val := v_1
14838                 mem := v_2
14839                 if !(t.Size() == 4 && !t.IsFloat()) {
14840                         break
14841                 }
14842                 v.reset(OpPPC64MOVWstore)
14843                 v.AddArg3(ptr, val, mem)
14844                 return true
14845         }
14846         // match: (Store {t} ptr val mem)
14847         // cond: t.Size() == 2
14848         // result: (MOVHstore ptr val mem)
14849         for {
14850                 t := auxToType(v.Aux)
14851                 ptr := v_0
14852                 val := v_1
14853                 mem := v_2
14854                 if !(t.Size() == 2) {
14855                         break
14856                 }
14857                 v.reset(OpPPC64MOVHstore)
14858                 v.AddArg3(ptr, val, mem)
14859                 return true
14860         }
14861         // match: (Store {t} ptr val mem)
14862         // cond: t.Size() == 1
14863         // result: (MOVBstore ptr val mem)
14864         for {
14865                 t := auxToType(v.Aux)
14866                 ptr := v_0
14867                 val := v_1
14868                 mem := v_2
14869                 if !(t.Size() == 1) {
14870                         break
14871                 }
14872                 v.reset(OpPPC64MOVBstore)
14873                 v.AddArg3(ptr, val, mem)
14874                 return true
14875         }
14876         return false
14877 }
14878 func rewriteValuePPC64_OpTrunc16to8(v *Value) bool {
14879         v_0 := v.Args[0]
14880         // match: (Trunc16to8 <t> x)
14881         // cond: t.IsSigned()
14882         // result: (MOVBreg x)
14883         for {
14884                 t := v.Type
14885                 x := v_0
14886                 if !(t.IsSigned()) {
14887                         break
14888                 }
14889                 v.reset(OpPPC64MOVBreg)
14890                 v.AddArg(x)
14891                 return true
14892         }
14893         // match: (Trunc16to8 x)
14894         // result: (MOVBZreg x)
14895         for {
14896                 x := v_0
14897                 v.reset(OpPPC64MOVBZreg)
14898                 v.AddArg(x)
14899                 return true
14900         }
14901 }
14902 func rewriteValuePPC64_OpTrunc32to16(v *Value) bool {
14903         v_0 := v.Args[0]
14904         // match: (Trunc32to16 <t> x)
14905         // cond: t.IsSigned()
14906         // result: (MOVHreg x)
14907         for {
14908                 t := v.Type
14909                 x := v_0
14910                 if !(t.IsSigned()) {
14911                         break
14912                 }
14913                 v.reset(OpPPC64MOVHreg)
14914                 v.AddArg(x)
14915                 return true
14916         }
14917         // match: (Trunc32to16 x)
14918         // result: (MOVHZreg x)
14919         for {
14920                 x := v_0
14921                 v.reset(OpPPC64MOVHZreg)
14922                 v.AddArg(x)
14923                 return true
14924         }
14925 }
14926 func rewriteValuePPC64_OpTrunc32to8(v *Value) bool {
14927         v_0 := v.Args[0]
14928         // match: (Trunc32to8 <t> x)
14929         // cond: t.IsSigned()
14930         // result: (MOVBreg x)
14931         for {
14932                 t := v.Type
14933                 x := v_0
14934                 if !(t.IsSigned()) {
14935                         break
14936                 }
14937                 v.reset(OpPPC64MOVBreg)
14938                 v.AddArg(x)
14939                 return true
14940         }
14941         // match: (Trunc32to8 x)
14942         // result: (MOVBZreg x)
14943         for {
14944                 x := v_0
14945                 v.reset(OpPPC64MOVBZreg)
14946                 v.AddArg(x)
14947                 return true
14948         }
14949 }
14950 func rewriteValuePPC64_OpTrunc64to16(v *Value) bool {
14951         v_0 := v.Args[0]
14952         // match: (Trunc64to16 <t> x)
14953         // cond: t.IsSigned()
14954         // result: (MOVHreg x)
14955         for {
14956                 t := v.Type
14957                 x := v_0
14958                 if !(t.IsSigned()) {
14959                         break
14960                 }
14961                 v.reset(OpPPC64MOVHreg)
14962                 v.AddArg(x)
14963                 return true
14964         }
14965         // match: (Trunc64to16 x)
14966         // result: (MOVHZreg x)
14967         for {
14968                 x := v_0
14969                 v.reset(OpPPC64MOVHZreg)
14970                 v.AddArg(x)
14971                 return true
14972         }
14973 }
14974 func rewriteValuePPC64_OpTrunc64to32(v *Value) bool {
14975         v_0 := v.Args[0]
14976         // match: (Trunc64to32 <t> x)
14977         // cond: t.IsSigned()
14978         // result: (MOVWreg x)
14979         for {
14980                 t := v.Type
14981                 x := v_0
14982                 if !(t.IsSigned()) {
14983                         break
14984                 }
14985                 v.reset(OpPPC64MOVWreg)
14986                 v.AddArg(x)
14987                 return true
14988         }
14989         // match: (Trunc64to32 x)
14990         // result: (MOVWZreg x)
14991         for {
14992                 x := v_0
14993                 v.reset(OpPPC64MOVWZreg)
14994                 v.AddArg(x)
14995                 return true
14996         }
14997 }
14998 func rewriteValuePPC64_OpTrunc64to8(v *Value) bool {
14999         v_0 := v.Args[0]
15000         // match: (Trunc64to8 <t> x)
15001         // cond: t.IsSigned()
15002         // result: (MOVBreg x)
15003         for {
15004                 t := v.Type
15005                 x := v_0
15006                 if !(t.IsSigned()) {
15007                         break
15008                 }
15009                 v.reset(OpPPC64MOVBreg)
15010                 v.AddArg(x)
15011                 return true
15012         }
15013         // match: (Trunc64to8 x)
15014         // result: (MOVBZreg x)
15015         for {
15016                 x := v_0
15017                 v.reset(OpPPC64MOVBZreg)
15018                 v.AddArg(x)
15019                 return true
15020         }
15021 }
15022 func rewriteValuePPC64_OpZero(v *Value) bool {
15023         v_1 := v.Args[1]
15024         v_0 := v.Args[0]
15025         b := v.Block
15026         // match: (Zero [0] _ mem)
15027         // result: mem
15028         for {
15029                 if auxIntToInt64(v.AuxInt) != 0 {
15030                         break
15031                 }
15032                 mem := v_1
15033                 v.copyOf(mem)
15034                 return true
15035         }
15036         // match: (Zero [1] destptr mem)
15037         // result: (MOVBstorezero destptr mem)
15038         for {
15039                 if auxIntToInt64(v.AuxInt) != 1 {
15040                         break
15041                 }
15042                 destptr := v_0
15043                 mem := v_1
15044                 v.reset(OpPPC64MOVBstorezero)
15045                 v.AddArg2(destptr, mem)
15046                 return true
15047         }
15048         // match: (Zero [2] destptr mem)
15049         // result: (MOVHstorezero destptr mem)
15050         for {
15051                 if auxIntToInt64(v.AuxInt) != 2 {
15052                         break
15053                 }
15054                 destptr := v_0
15055                 mem := v_1
15056                 v.reset(OpPPC64MOVHstorezero)
15057                 v.AddArg2(destptr, mem)
15058                 return true
15059         }
15060         // match: (Zero [3] destptr mem)
15061         // result: (MOVBstorezero [2] destptr (MOVHstorezero destptr mem))
15062         for {
15063                 if auxIntToInt64(v.AuxInt) != 3 {
15064                         break
15065                 }
15066                 destptr := v_0
15067                 mem := v_1
15068                 v.reset(OpPPC64MOVBstorezero)
15069                 v.AuxInt = int32ToAuxInt(2)
15070                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHstorezero, types.TypeMem)
15071                 v0.AddArg2(destptr, mem)
15072                 v.AddArg2(destptr, v0)
15073                 return true
15074         }
15075         // match: (Zero [4] destptr mem)
15076         // result: (MOVWstorezero destptr mem)
15077         for {
15078                 if auxIntToInt64(v.AuxInt) != 4 {
15079                         break
15080                 }
15081                 destptr := v_0
15082                 mem := v_1
15083                 v.reset(OpPPC64MOVWstorezero)
15084                 v.AddArg2(destptr, mem)
15085                 return true
15086         }
15087         // match: (Zero [5] destptr mem)
15088         // result: (MOVBstorezero [4] destptr (MOVWstorezero destptr mem))
15089         for {
15090                 if auxIntToInt64(v.AuxInt) != 5 {
15091                         break
15092                 }
15093                 destptr := v_0
15094                 mem := v_1
15095                 v.reset(OpPPC64MOVBstorezero)
15096                 v.AuxInt = int32ToAuxInt(4)
15097                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem)
15098                 v0.AddArg2(destptr, mem)
15099                 v.AddArg2(destptr, v0)
15100                 return true
15101         }
15102         // match: (Zero [6] destptr mem)
15103         // result: (MOVHstorezero [4] destptr (MOVWstorezero destptr mem))
15104         for {
15105                 if auxIntToInt64(v.AuxInt) != 6 {
15106                         break
15107                 }
15108                 destptr := v_0
15109                 mem := v_1
15110                 v.reset(OpPPC64MOVHstorezero)
15111                 v.AuxInt = int32ToAuxInt(4)
15112                 v0 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem)
15113                 v0.AddArg2(destptr, mem)
15114                 v.AddArg2(destptr, v0)
15115                 return true
15116         }
15117         // match: (Zero [7] destptr mem)
15118         // result: (MOVBstorezero [6] destptr (MOVHstorezero [4] destptr (MOVWstorezero destptr mem)))
15119         for {
15120                 if auxIntToInt64(v.AuxInt) != 7 {
15121                         break
15122                 }
15123                 destptr := v_0
15124                 mem := v_1
15125                 v.reset(OpPPC64MOVBstorezero)
15126                 v.AuxInt = int32ToAuxInt(6)
15127                 v0 := b.NewValue0(v.Pos, OpPPC64MOVHstorezero, types.TypeMem)
15128                 v0.AuxInt = int32ToAuxInt(4)
15129                 v1 := b.NewValue0(v.Pos, OpPPC64MOVWstorezero, types.TypeMem)
15130                 v1.AddArg2(destptr, mem)
15131                 v0.AddArg2(destptr, v1)
15132                 v.AddArg2(destptr, v0)
15133                 return true
15134         }
15135         // match: (Zero [8] {t} destptr mem)
15136         // result: (MOVDstorezero destptr mem)
15137         for {
15138                 if auxIntToInt64(v.AuxInt) != 8 {
15139                         break
15140                 }
15141                 destptr := v_0
15142                 mem := v_1
15143                 v.reset(OpPPC64MOVDstorezero)
15144                 v.AddArg2(destptr, mem)
15145                 return true
15146         }
15147         // match: (Zero [12] {t} destptr mem)
15148         // result: (MOVWstorezero [8] destptr (MOVDstorezero [0] destptr mem))
15149         for {
15150                 if auxIntToInt64(v.AuxInt) != 12 {
15151                         break
15152                 }
15153                 destptr := v_0
15154                 mem := v_1
15155                 v.reset(OpPPC64MOVWstorezero)
15156                 v.AuxInt = int32ToAuxInt(8)
15157                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15158                 v0.AuxInt = int32ToAuxInt(0)
15159                 v0.AddArg2(destptr, mem)
15160                 v.AddArg2(destptr, v0)
15161                 return true
15162         }
15163         // match: (Zero [16] {t} destptr mem)
15164         // result: (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem))
15165         for {
15166                 if auxIntToInt64(v.AuxInt) != 16 {
15167                         break
15168                 }
15169                 destptr := v_0
15170                 mem := v_1
15171                 v.reset(OpPPC64MOVDstorezero)
15172                 v.AuxInt = int32ToAuxInt(8)
15173                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15174                 v0.AuxInt = int32ToAuxInt(0)
15175                 v0.AddArg2(destptr, mem)
15176                 v.AddArg2(destptr, v0)
15177                 return true
15178         }
15179         // match: (Zero [24] {t} destptr mem)
15180         // result: (MOVDstorezero [16] destptr (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem)))
15181         for {
15182                 if auxIntToInt64(v.AuxInt) != 24 {
15183                         break
15184                 }
15185                 destptr := v_0
15186                 mem := v_1
15187                 v.reset(OpPPC64MOVDstorezero)
15188                 v.AuxInt = int32ToAuxInt(16)
15189                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15190                 v0.AuxInt = int32ToAuxInt(8)
15191                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15192                 v1.AuxInt = int32ToAuxInt(0)
15193                 v1.AddArg2(destptr, mem)
15194                 v0.AddArg2(destptr, v1)
15195                 v.AddArg2(destptr, v0)
15196                 return true
15197         }
15198         // match: (Zero [32] {t} destptr mem)
15199         // result: (MOVDstorezero [24] destptr (MOVDstorezero [16] destptr (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem))))
15200         for {
15201                 if auxIntToInt64(v.AuxInt) != 32 {
15202                         break
15203                 }
15204                 destptr := v_0
15205                 mem := v_1
15206                 v.reset(OpPPC64MOVDstorezero)
15207                 v.AuxInt = int32ToAuxInt(24)
15208                 v0 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15209                 v0.AuxInt = int32ToAuxInt(16)
15210                 v1 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15211                 v1.AuxInt = int32ToAuxInt(8)
15212                 v2 := b.NewValue0(v.Pos, OpPPC64MOVDstorezero, types.TypeMem)
15213                 v2.AuxInt = int32ToAuxInt(0)
15214                 v2.AddArg2(destptr, mem)
15215                 v1.AddArg2(destptr, v2)
15216                 v0.AddArg2(destptr, v1)
15217                 v.AddArg2(destptr, v0)
15218                 return true
15219         }
15220         // match: (Zero [s] ptr mem)
15221         // cond: buildcfg.GOPPC64 <= 8 && s < 64
15222         // result: (LoweredZeroShort [s] ptr mem)
15223         for {
15224                 s := auxIntToInt64(v.AuxInt)
15225                 ptr := v_0
15226                 mem := v_1
15227                 if !(buildcfg.GOPPC64 <= 8 && s < 64) {
15228                         break
15229                 }
15230                 v.reset(OpPPC64LoweredZeroShort)
15231                 v.AuxInt = int64ToAuxInt(s)
15232                 v.AddArg2(ptr, mem)
15233                 return true
15234         }
15235         // match: (Zero [s] ptr mem)
15236         // cond: buildcfg.GOPPC64 <= 8
15237         // result: (LoweredZero [s] ptr mem)
15238         for {
15239                 s := auxIntToInt64(v.AuxInt)
15240                 ptr := v_0
15241                 mem := v_1
15242                 if !(buildcfg.GOPPC64 <= 8) {
15243                         break
15244                 }
15245                 v.reset(OpPPC64LoweredZero)
15246                 v.AuxInt = int64ToAuxInt(s)
15247                 v.AddArg2(ptr, mem)
15248                 return true
15249         }
15250         // match: (Zero [s] ptr mem)
15251         // cond: s < 128 && buildcfg.GOPPC64 >= 9
15252         // result: (LoweredQuadZeroShort [s] ptr mem)
15253         for {
15254                 s := auxIntToInt64(v.AuxInt)
15255                 ptr := v_0
15256                 mem := v_1
15257                 if !(s < 128 && buildcfg.GOPPC64 >= 9) {
15258                         break
15259                 }
15260                 v.reset(OpPPC64LoweredQuadZeroShort)
15261                 v.AuxInt = int64ToAuxInt(s)
15262                 v.AddArg2(ptr, mem)
15263                 return true
15264         }
15265         // match: (Zero [s] ptr mem)
15266         // cond: buildcfg.GOPPC64 >= 9
15267         // result: (LoweredQuadZero [s] ptr mem)
15268         for {
15269                 s := auxIntToInt64(v.AuxInt)
15270                 ptr := v_0
15271                 mem := v_1
15272                 if !(buildcfg.GOPPC64 >= 9) {
15273                         break
15274                 }
15275                 v.reset(OpPPC64LoweredQuadZero)
15276                 v.AuxInt = int64ToAuxInt(s)
15277                 v.AddArg2(ptr, mem)
15278                 return true
15279         }
15280         return false
15281 }
15282 func rewriteBlockPPC64(b *Block) bool {
15283         typ := &b.Func.Config.Types
15284         switch b.Kind {
15285         case BlockPPC64EQ:
15286                 // match: (EQ (FlagEQ) yes no)
15287                 // result: (First yes no)
15288                 for b.Controls[0].Op == OpPPC64FlagEQ {
15289                         b.Reset(BlockFirst)
15290                         return true
15291                 }
15292                 // match: (EQ (FlagLT) yes no)
15293                 // result: (First no yes)
15294                 for b.Controls[0].Op == OpPPC64FlagLT {
15295                         b.Reset(BlockFirst)
15296                         b.swapSuccessors()
15297                         return true
15298                 }
15299                 // match: (EQ (FlagGT) yes no)
15300                 // result: (First no yes)
15301                 for b.Controls[0].Op == OpPPC64FlagGT {
15302                         b.Reset(BlockFirst)
15303                         b.swapSuccessors()
15304                         return true
15305                 }
15306                 // match: (EQ (InvertFlags cmp) yes no)
15307                 // result: (EQ cmp yes no)
15308                 for b.Controls[0].Op == OpPPC64InvertFlags {
15309                         v_0 := b.Controls[0]
15310                         cmp := v_0.Args[0]
15311                         b.resetWithControl(BlockPPC64EQ, cmp)
15312                         return true
15313                 }
15314                 // match: (EQ (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15315                 // result: (EQ (Select1 <types.TypeFlags> z) yes no)
15316                 for b.Controls[0].Op == OpPPC64CMPconst {
15317                         v_0 := b.Controls[0]
15318                         if auxIntToInt64(v_0.AuxInt) != 0 {
15319                                 break
15320                         }
15321                         v_0_0 := v_0.Args[0]
15322                         if v_0_0.Op != OpSelect0 {
15323                                 break
15324                         }
15325                         z := v_0_0.Args[0]
15326                         if z.Op != OpPPC64ANDCCconst {
15327                                 break
15328                         }
15329                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15330                         v0.AddArg(z)
15331                         b.resetWithControl(BlockPPC64EQ, v0)
15332                         return true
15333                 }
15334                 // match: (EQ (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15335                 // result: (EQ (Select1 <types.TypeFlags> z) yes no)
15336                 for b.Controls[0].Op == OpPPC64CMPWconst {
15337                         v_0 := b.Controls[0]
15338                         if auxIntToInt32(v_0.AuxInt) != 0 {
15339                                 break
15340                         }
15341                         v_0_0 := v_0.Args[0]
15342                         if v_0_0.Op != OpSelect0 {
15343                                 break
15344                         }
15345                         z := v_0_0.Args[0]
15346                         if z.Op != OpPPC64ANDCCconst {
15347                                 break
15348                         }
15349                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15350                         v0.AddArg(z)
15351                         b.resetWithControl(BlockPPC64EQ, v0)
15352                         return true
15353                 }
15354                 // match: (EQ (CMPconst [0] z:(AND x y)) yes no)
15355                 // cond: z.Uses == 1
15356                 // result: (EQ (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
15357                 for b.Controls[0].Op == OpPPC64CMPconst {
15358                         v_0 := b.Controls[0]
15359                         if auxIntToInt64(v_0.AuxInt) != 0 {
15360                                 break
15361                         }
15362                         z := v_0.Args[0]
15363                         if z.Op != OpPPC64AND {
15364                                 break
15365                         }
15366                         _ = z.Args[1]
15367                         z_0 := z.Args[0]
15368                         z_1 := z.Args[1]
15369                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15370                                 x := z_0
15371                                 y := z_1
15372                                 if !(z.Uses == 1) {
15373                                         continue
15374                                 }
15375                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15376                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15377                                 v1.AddArg2(x, y)
15378                                 v0.AddArg(v1)
15379                                 b.resetWithControl(BlockPPC64EQ, v0)
15380                                 return true
15381                         }
15382                         break
15383                 }
15384                 // match: (EQ (CMPconst [0] z:(OR x y)) yes no)
15385                 // cond: z.Uses == 1
15386                 // result: (EQ (Select1 <types.TypeFlags> (ORCC x y)) yes no)
15387                 for b.Controls[0].Op == OpPPC64CMPconst {
15388                         v_0 := b.Controls[0]
15389                         if auxIntToInt64(v_0.AuxInt) != 0 {
15390                                 break
15391                         }
15392                         z := v_0.Args[0]
15393                         if z.Op != OpPPC64OR {
15394                                 break
15395                         }
15396                         _ = z.Args[1]
15397                         z_0 := z.Args[0]
15398                         z_1 := z.Args[1]
15399                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15400                                 x := z_0
15401                                 y := z_1
15402                                 if !(z.Uses == 1) {
15403                                         continue
15404                                 }
15405                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15406                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15407                                 v1.AddArg2(x, y)
15408                                 v0.AddArg(v1)
15409                                 b.resetWithControl(BlockPPC64EQ, v0)
15410                                 return true
15411                         }
15412                         break
15413                 }
15414                 // match: (EQ (CMPconst [0] z:(XOR x y)) yes no)
15415                 // cond: z.Uses == 1
15416                 // result: (EQ (Select1 <types.TypeFlags> (XORCC x y)) yes no)
15417                 for b.Controls[0].Op == OpPPC64CMPconst {
15418                         v_0 := b.Controls[0]
15419                         if auxIntToInt64(v_0.AuxInt) != 0 {
15420                                 break
15421                         }
15422                         z := v_0.Args[0]
15423                         if z.Op != OpPPC64XOR {
15424                                 break
15425                         }
15426                         _ = z.Args[1]
15427                         z_0 := z.Args[0]
15428                         z_1 := z.Args[1]
15429                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15430                                 x := z_0
15431                                 y := z_1
15432                                 if !(z.Uses == 1) {
15433                                         continue
15434                                 }
15435                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15436                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15437                                 v1.AddArg2(x, y)
15438                                 v0.AddArg(v1)
15439                                 b.resetWithControl(BlockPPC64EQ, v0)
15440                                 return true
15441                         }
15442                         break
15443                 }
15444         case BlockPPC64GE:
15445                 // match: (GE (FlagEQ) yes no)
15446                 // result: (First yes no)
15447                 for b.Controls[0].Op == OpPPC64FlagEQ {
15448                         b.Reset(BlockFirst)
15449                         return true
15450                 }
15451                 // match: (GE (FlagLT) yes no)
15452                 // result: (First no yes)
15453                 for b.Controls[0].Op == OpPPC64FlagLT {
15454                         b.Reset(BlockFirst)
15455                         b.swapSuccessors()
15456                         return true
15457                 }
15458                 // match: (GE (FlagGT) yes no)
15459                 // result: (First yes no)
15460                 for b.Controls[0].Op == OpPPC64FlagGT {
15461                         b.Reset(BlockFirst)
15462                         return true
15463                 }
15464                 // match: (GE (InvertFlags cmp) yes no)
15465                 // result: (LE cmp yes no)
15466                 for b.Controls[0].Op == OpPPC64InvertFlags {
15467                         v_0 := b.Controls[0]
15468                         cmp := v_0.Args[0]
15469                         b.resetWithControl(BlockPPC64LE, cmp)
15470                         return true
15471                 }
15472                 // match: (GE (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15473                 // result: (GE (Select1 <types.TypeFlags> z) yes no)
15474                 for b.Controls[0].Op == OpPPC64CMPconst {
15475                         v_0 := b.Controls[0]
15476                         if auxIntToInt64(v_0.AuxInt) != 0 {
15477                                 break
15478                         }
15479                         v_0_0 := v_0.Args[0]
15480                         if v_0_0.Op != OpSelect0 {
15481                                 break
15482                         }
15483                         z := v_0_0.Args[0]
15484                         if z.Op != OpPPC64ANDCCconst {
15485                                 break
15486                         }
15487                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15488                         v0.AddArg(z)
15489                         b.resetWithControl(BlockPPC64GE, v0)
15490                         return true
15491                 }
15492                 // match: (GE (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15493                 // result: (GE (Select1 <types.TypeFlags> z) yes no)
15494                 for b.Controls[0].Op == OpPPC64CMPWconst {
15495                         v_0 := b.Controls[0]
15496                         if auxIntToInt32(v_0.AuxInt) != 0 {
15497                                 break
15498                         }
15499                         v_0_0 := v_0.Args[0]
15500                         if v_0_0.Op != OpSelect0 {
15501                                 break
15502                         }
15503                         z := v_0_0.Args[0]
15504                         if z.Op != OpPPC64ANDCCconst {
15505                                 break
15506                         }
15507                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15508                         v0.AddArg(z)
15509                         b.resetWithControl(BlockPPC64GE, v0)
15510                         return true
15511                 }
15512                 // match: (GE (CMPconst [0] z:(AND x y)) yes no)
15513                 // cond: z.Uses == 1
15514                 // result: (GE (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
15515                 for b.Controls[0].Op == OpPPC64CMPconst {
15516                         v_0 := b.Controls[0]
15517                         if auxIntToInt64(v_0.AuxInt) != 0 {
15518                                 break
15519                         }
15520                         z := v_0.Args[0]
15521                         if z.Op != OpPPC64AND {
15522                                 break
15523                         }
15524                         _ = z.Args[1]
15525                         z_0 := z.Args[0]
15526                         z_1 := z.Args[1]
15527                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15528                                 x := z_0
15529                                 y := z_1
15530                                 if !(z.Uses == 1) {
15531                                         continue
15532                                 }
15533                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15534                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15535                                 v1.AddArg2(x, y)
15536                                 v0.AddArg(v1)
15537                                 b.resetWithControl(BlockPPC64GE, v0)
15538                                 return true
15539                         }
15540                         break
15541                 }
15542                 // match: (GE (CMPconst [0] z:(OR x y)) yes no)
15543                 // cond: z.Uses == 1
15544                 // result: (GE (Select1 <types.TypeFlags> (ORCC x y)) yes no)
15545                 for b.Controls[0].Op == OpPPC64CMPconst {
15546                         v_0 := b.Controls[0]
15547                         if auxIntToInt64(v_0.AuxInt) != 0 {
15548                                 break
15549                         }
15550                         z := v_0.Args[0]
15551                         if z.Op != OpPPC64OR {
15552                                 break
15553                         }
15554                         _ = z.Args[1]
15555                         z_0 := z.Args[0]
15556                         z_1 := z.Args[1]
15557                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15558                                 x := z_0
15559                                 y := z_1
15560                                 if !(z.Uses == 1) {
15561                                         continue
15562                                 }
15563                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15564                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15565                                 v1.AddArg2(x, y)
15566                                 v0.AddArg(v1)
15567                                 b.resetWithControl(BlockPPC64GE, v0)
15568                                 return true
15569                         }
15570                         break
15571                 }
15572                 // match: (GE (CMPconst [0] z:(XOR x y)) yes no)
15573                 // cond: z.Uses == 1
15574                 // result: (GE (Select1 <types.TypeFlags> (XORCC x y)) yes no)
15575                 for b.Controls[0].Op == OpPPC64CMPconst {
15576                         v_0 := b.Controls[0]
15577                         if auxIntToInt64(v_0.AuxInt) != 0 {
15578                                 break
15579                         }
15580                         z := v_0.Args[0]
15581                         if z.Op != OpPPC64XOR {
15582                                 break
15583                         }
15584                         _ = z.Args[1]
15585                         z_0 := z.Args[0]
15586                         z_1 := z.Args[1]
15587                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15588                                 x := z_0
15589                                 y := z_1
15590                                 if !(z.Uses == 1) {
15591                                         continue
15592                                 }
15593                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15594                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15595                                 v1.AddArg2(x, y)
15596                                 v0.AddArg(v1)
15597                                 b.resetWithControl(BlockPPC64GE, v0)
15598                                 return true
15599                         }
15600                         break
15601                 }
15602         case BlockPPC64GT:
15603                 // match: (GT (FlagEQ) yes no)
15604                 // result: (First no yes)
15605                 for b.Controls[0].Op == OpPPC64FlagEQ {
15606                         b.Reset(BlockFirst)
15607                         b.swapSuccessors()
15608                         return true
15609                 }
15610                 // match: (GT (FlagLT) yes no)
15611                 // result: (First no yes)
15612                 for b.Controls[0].Op == OpPPC64FlagLT {
15613                         b.Reset(BlockFirst)
15614                         b.swapSuccessors()
15615                         return true
15616                 }
15617                 // match: (GT (FlagGT) yes no)
15618                 // result: (First yes no)
15619                 for b.Controls[0].Op == OpPPC64FlagGT {
15620                         b.Reset(BlockFirst)
15621                         return true
15622                 }
15623                 // match: (GT (InvertFlags cmp) yes no)
15624                 // result: (LT cmp yes no)
15625                 for b.Controls[0].Op == OpPPC64InvertFlags {
15626                         v_0 := b.Controls[0]
15627                         cmp := v_0.Args[0]
15628                         b.resetWithControl(BlockPPC64LT, cmp)
15629                         return true
15630                 }
15631                 // match: (GT (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15632                 // result: (GT (Select1 <types.TypeFlags> z) yes no)
15633                 for b.Controls[0].Op == OpPPC64CMPconst {
15634                         v_0 := b.Controls[0]
15635                         if auxIntToInt64(v_0.AuxInt) != 0 {
15636                                 break
15637                         }
15638                         v_0_0 := v_0.Args[0]
15639                         if v_0_0.Op != OpSelect0 {
15640                                 break
15641                         }
15642                         z := v_0_0.Args[0]
15643                         if z.Op != OpPPC64ANDCCconst {
15644                                 break
15645                         }
15646                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15647                         v0.AddArg(z)
15648                         b.resetWithControl(BlockPPC64GT, v0)
15649                         return true
15650                 }
15651                 // match: (GT (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15652                 // result: (GT (Select1 <types.TypeFlags> z) yes no)
15653                 for b.Controls[0].Op == OpPPC64CMPWconst {
15654                         v_0 := b.Controls[0]
15655                         if auxIntToInt32(v_0.AuxInt) != 0 {
15656                                 break
15657                         }
15658                         v_0_0 := v_0.Args[0]
15659                         if v_0_0.Op != OpSelect0 {
15660                                 break
15661                         }
15662                         z := v_0_0.Args[0]
15663                         if z.Op != OpPPC64ANDCCconst {
15664                                 break
15665                         }
15666                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15667                         v0.AddArg(z)
15668                         b.resetWithControl(BlockPPC64GT, v0)
15669                         return true
15670                 }
15671                 // match: (GT (CMPconst [0] z:(AND x y)) yes no)
15672                 // cond: z.Uses == 1
15673                 // result: (GT (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
15674                 for b.Controls[0].Op == OpPPC64CMPconst {
15675                         v_0 := b.Controls[0]
15676                         if auxIntToInt64(v_0.AuxInt) != 0 {
15677                                 break
15678                         }
15679                         z := v_0.Args[0]
15680                         if z.Op != OpPPC64AND {
15681                                 break
15682                         }
15683                         _ = z.Args[1]
15684                         z_0 := z.Args[0]
15685                         z_1 := z.Args[1]
15686                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15687                                 x := z_0
15688                                 y := z_1
15689                                 if !(z.Uses == 1) {
15690                                         continue
15691                                 }
15692                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15693                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15694                                 v1.AddArg2(x, y)
15695                                 v0.AddArg(v1)
15696                                 b.resetWithControl(BlockPPC64GT, v0)
15697                                 return true
15698                         }
15699                         break
15700                 }
15701                 // match: (GT (CMPconst [0] z:(OR x y)) yes no)
15702                 // cond: z.Uses == 1
15703                 // result: (GT (Select1 <types.TypeFlags> (ORCC x y)) yes no)
15704                 for b.Controls[0].Op == OpPPC64CMPconst {
15705                         v_0 := b.Controls[0]
15706                         if auxIntToInt64(v_0.AuxInt) != 0 {
15707                                 break
15708                         }
15709                         z := v_0.Args[0]
15710                         if z.Op != OpPPC64OR {
15711                                 break
15712                         }
15713                         _ = z.Args[1]
15714                         z_0 := z.Args[0]
15715                         z_1 := z.Args[1]
15716                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15717                                 x := z_0
15718                                 y := z_1
15719                                 if !(z.Uses == 1) {
15720                                         continue
15721                                 }
15722                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15723                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15724                                 v1.AddArg2(x, y)
15725                                 v0.AddArg(v1)
15726                                 b.resetWithControl(BlockPPC64GT, v0)
15727                                 return true
15728                         }
15729                         break
15730                 }
15731                 // match: (GT (CMPconst [0] z:(XOR x y)) yes no)
15732                 // cond: z.Uses == 1
15733                 // result: (GT (Select1 <types.TypeFlags> (XORCC x y)) yes no)
15734                 for b.Controls[0].Op == OpPPC64CMPconst {
15735                         v_0 := b.Controls[0]
15736                         if auxIntToInt64(v_0.AuxInt) != 0 {
15737                                 break
15738                         }
15739                         z := v_0.Args[0]
15740                         if z.Op != OpPPC64XOR {
15741                                 break
15742                         }
15743                         _ = z.Args[1]
15744                         z_0 := z.Args[0]
15745                         z_1 := z.Args[1]
15746                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15747                                 x := z_0
15748                                 y := z_1
15749                                 if !(z.Uses == 1) {
15750                                         continue
15751                                 }
15752                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15753                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15754                                 v1.AddArg2(x, y)
15755                                 v0.AddArg(v1)
15756                                 b.resetWithControl(BlockPPC64GT, v0)
15757                                 return true
15758                         }
15759                         break
15760                 }
15761         case BlockIf:
15762                 // match: (If (Equal cc) yes no)
15763                 // result: (EQ cc yes no)
15764                 for b.Controls[0].Op == OpPPC64Equal {
15765                         v_0 := b.Controls[0]
15766                         cc := v_0.Args[0]
15767                         b.resetWithControl(BlockPPC64EQ, cc)
15768                         return true
15769                 }
15770                 // match: (If (NotEqual cc) yes no)
15771                 // result: (NE cc yes no)
15772                 for b.Controls[0].Op == OpPPC64NotEqual {
15773                         v_0 := b.Controls[0]
15774                         cc := v_0.Args[0]
15775                         b.resetWithControl(BlockPPC64NE, cc)
15776                         return true
15777                 }
15778                 // match: (If (LessThan cc) yes no)
15779                 // result: (LT cc yes no)
15780                 for b.Controls[0].Op == OpPPC64LessThan {
15781                         v_0 := b.Controls[0]
15782                         cc := v_0.Args[0]
15783                         b.resetWithControl(BlockPPC64LT, cc)
15784                         return true
15785                 }
15786                 // match: (If (LessEqual cc) yes no)
15787                 // result: (LE cc yes no)
15788                 for b.Controls[0].Op == OpPPC64LessEqual {
15789                         v_0 := b.Controls[0]
15790                         cc := v_0.Args[0]
15791                         b.resetWithControl(BlockPPC64LE, cc)
15792                         return true
15793                 }
15794                 // match: (If (GreaterThan cc) yes no)
15795                 // result: (GT cc yes no)
15796                 for b.Controls[0].Op == OpPPC64GreaterThan {
15797                         v_0 := b.Controls[0]
15798                         cc := v_0.Args[0]
15799                         b.resetWithControl(BlockPPC64GT, cc)
15800                         return true
15801                 }
15802                 // match: (If (GreaterEqual cc) yes no)
15803                 // result: (GE cc yes no)
15804                 for b.Controls[0].Op == OpPPC64GreaterEqual {
15805                         v_0 := b.Controls[0]
15806                         cc := v_0.Args[0]
15807                         b.resetWithControl(BlockPPC64GE, cc)
15808                         return true
15809                 }
15810                 // match: (If (FLessThan cc) yes no)
15811                 // result: (FLT cc yes no)
15812                 for b.Controls[0].Op == OpPPC64FLessThan {
15813                         v_0 := b.Controls[0]
15814                         cc := v_0.Args[0]
15815                         b.resetWithControl(BlockPPC64FLT, cc)
15816                         return true
15817                 }
15818                 // match: (If (FLessEqual cc) yes no)
15819                 // result: (FLE cc yes no)
15820                 for b.Controls[0].Op == OpPPC64FLessEqual {
15821                         v_0 := b.Controls[0]
15822                         cc := v_0.Args[0]
15823                         b.resetWithControl(BlockPPC64FLE, cc)
15824                         return true
15825                 }
15826                 // match: (If (FGreaterThan cc) yes no)
15827                 // result: (FGT cc yes no)
15828                 for b.Controls[0].Op == OpPPC64FGreaterThan {
15829                         v_0 := b.Controls[0]
15830                         cc := v_0.Args[0]
15831                         b.resetWithControl(BlockPPC64FGT, cc)
15832                         return true
15833                 }
15834                 // match: (If (FGreaterEqual cc) yes no)
15835                 // result: (FGE cc yes no)
15836                 for b.Controls[0].Op == OpPPC64FGreaterEqual {
15837                         v_0 := b.Controls[0]
15838                         cc := v_0.Args[0]
15839                         b.resetWithControl(BlockPPC64FGE, cc)
15840                         return true
15841                 }
15842                 // match: (If cond yes no)
15843                 // result: (NE (CMPWconst [0] (Select0 <typ.UInt32> (ANDCCconst [1] cond))) yes no)
15844                 for {
15845                         cond := b.Controls[0]
15846                         v0 := b.NewValue0(cond.Pos, OpPPC64CMPWconst, types.TypeFlags)
15847                         v0.AuxInt = int32ToAuxInt(0)
15848                         v1 := b.NewValue0(cond.Pos, OpSelect0, typ.UInt32)
15849                         v2 := b.NewValue0(cond.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
15850                         v2.AuxInt = int64ToAuxInt(1)
15851                         v2.AddArg(cond)
15852                         v1.AddArg(v2)
15853                         v0.AddArg(v1)
15854                         b.resetWithControl(BlockPPC64NE, v0)
15855                         return true
15856                 }
15857         case BlockPPC64LE:
15858                 // match: (LE (FlagEQ) yes no)
15859                 // result: (First yes no)
15860                 for b.Controls[0].Op == OpPPC64FlagEQ {
15861                         b.Reset(BlockFirst)
15862                         return true
15863                 }
15864                 // match: (LE (FlagLT) yes no)
15865                 // result: (First yes no)
15866                 for b.Controls[0].Op == OpPPC64FlagLT {
15867                         b.Reset(BlockFirst)
15868                         return true
15869                 }
15870                 // match: (LE (FlagGT) yes no)
15871                 // result: (First no yes)
15872                 for b.Controls[0].Op == OpPPC64FlagGT {
15873                         b.Reset(BlockFirst)
15874                         b.swapSuccessors()
15875                         return true
15876                 }
15877                 // match: (LE (InvertFlags cmp) yes no)
15878                 // result: (GE cmp yes no)
15879                 for b.Controls[0].Op == OpPPC64InvertFlags {
15880                         v_0 := b.Controls[0]
15881                         cmp := v_0.Args[0]
15882                         b.resetWithControl(BlockPPC64GE, cmp)
15883                         return true
15884                 }
15885                 // match: (LE (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15886                 // result: (LE (Select1 <types.TypeFlags> z) yes no)
15887                 for b.Controls[0].Op == OpPPC64CMPconst {
15888                         v_0 := b.Controls[0]
15889                         if auxIntToInt64(v_0.AuxInt) != 0 {
15890                                 break
15891                         }
15892                         v_0_0 := v_0.Args[0]
15893                         if v_0_0.Op != OpSelect0 {
15894                                 break
15895                         }
15896                         z := v_0_0.Args[0]
15897                         if z.Op != OpPPC64ANDCCconst {
15898                                 break
15899                         }
15900                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15901                         v0.AddArg(z)
15902                         b.resetWithControl(BlockPPC64LE, v0)
15903                         return true
15904                 }
15905                 // match: (LE (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
15906                 // result: (LE (Select1 <types.TypeFlags> z) yes no)
15907                 for b.Controls[0].Op == OpPPC64CMPWconst {
15908                         v_0 := b.Controls[0]
15909                         if auxIntToInt32(v_0.AuxInt) != 0 {
15910                                 break
15911                         }
15912                         v_0_0 := v_0.Args[0]
15913                         if v_0_0.Op != OpSelect0 {
15914                                 break
15915                         }
15916                         z := v_0_0.Args[0]
15917                         if z.Op != OpPPC64ANDCCconst {
15918                                 break
15919                         }
15920                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15921                         v0.AddArg(z)
15922                         b.resetWithControl(BlockPPC64LE, v0)
15923                         return true
15924                 }
15925                 // match: (LE (CMPconst [0] z:(AND x y)) yes no)
15926                 // cond: z.Uses == 1
15927                 // result: (LE (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
15928                 for b.Controls[0].Op == OpPPC64CMPconst {
15929                         v_0 := b.Controls[0]
15930                         if auxIntToInt64(v_0.AuxInt) != 0 {
15931                                 break
15932                         }
15933                         z := v_0.Args[0]
15934                         if z.Op != OpPPC64AND {
15935                                 break
15936                         }
15937                         _ = z.Args[1]
15938                         z_0 := z.Args[0]
15939                         z_1 := z.Args[1]
15940                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15941                                 x := z_0
15942                                 y := z_1
15943                                 if !(z.Uses == 1) {
15944                                         continue
15945                                 }
15946                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15947                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15948                                 v1.AddArg2(x, y)
15949                                 v0.AddArg(v1)
15950                                 b.resetWithControl(BlockPPC64LE, v0)
15951                                 return true
15952                         }
15953                         break
15954                 }
15955                 // match: (LE (CMPconst [0] z:(OR x y)) yes no)
15956                 // cond: z.Uses == 1
15957                 // result: (LE (Select1 <types.TypeFlags> (ORCC x y)) yes no)
15958                 for b.Controls[0].Op == OpPPC64CMPconst {
15959                         v_0 := b.Controls[0]
15960                         if auxIntToInt64(v_0.AuxInt) != 0 {
15961                                 break
15962                         }
15963                         z := v_0.Args[0]
15964                         if z.Op != OpPPC64OR {
15965                                 break
15966                         }
15967                         _ = z.Args[1]
15968                         z_0 := z.Args[0]
15969                         z_1 := z.Args[1]
15970                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15971                                 x := z_0
15972                                 y := z_1
15973                                 if !(z.Uses == 1) {
15974                                         continue
15975                                 }
15976                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15977                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15978                                 v1.AddArg2(x, y)
15979                                 v0.AddArg(v1)
15980                                 b.resetWithControl(BlockPPC64LE, v0)
15981                                 return true
15982                         }
15983                         break
15984                 }
15985                 // match: (LE (CMPconst [0] z:(XOR x y)) yes no)
15986                 // cond: z.Uses == 1
15987                 // result: (LE (Select1 <types.TypeFlags> (XORCC x y)) yes no)
15988                 for b.Controls[0].Op == OpPPC64CMPconst {
15989                         v_0 := b.Controls[0]
15990                         if auxIntToInt64(v_0.AuxInt) != 0 {
15991                                 break
15992                         }
15993                         z := v_0.Args[0]
15994                         if z.Op != OpPPC64XOR {
15995                                 break
15996                         }
15997                         _ = z.Args[1]
15998                         z_0 := z.Args[0]
15999                         z_1 := z.Args[1]
16000                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16001                                 x := z_0
16002                                 y := z_1
16003                                 if !(z.Uses == 1) {
16004                                         continue
16005                                 }
16006                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16007                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
16008                                 v1.AddArg2(x, y)
16009                                 v0.AddArg(v1)
16010                                 b.resetWithControl(BlockPPC64LE, v0)
16011                                 return true
16012                         }
16013                         break
16014                 }
16015         case BlockPPC64LT:
16016                 // match: (LT (FlagEQ) yes no)
16017                 // result: (First no yes)
16018                 for b.Controls[0].Op == OpPPC64FlagEQ {
16019                         b.Reset(BlockFirst)
16020                         b.swapSuccessors()
16021                         return true
16022                 }
16023                 // match: (LT (FlagLT) yes no)
16024                 // result: (First yes no)
16025                 for b.Controls[0].Op == OpPPC64FlagLT {
16026                         b.Reset(BlockFirst)
16027                         return true
16028                 }
16029                 // match: (LT (FlagGT) yes no)
16030                 // result: (First no yes)
16031                 for b.Controls[0].Op == OpPPC64FlagGT {
16032                         b.Reset(BlockFirst)
16033                         b.swapSuccessors()
16034                         return true
16035                 }
16036                 // match: (LT (InvertFlags cmp) yes no)
16037                 // result: (GT cmp yes no)
16038                 for b.Controls[0].Op == OpPPC64InvertFlags {
16039                         v_0 := b.Controls[0]
16040                         cmp := v_0.Args[0]
16041                         b.resetWithControl(BlockPPC64GT, cmp)
16042                         return true
16043                 }
16044                 // match: (LT (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
16045                 // result: (LT (Select1 <types.TypeFlags> z) yes no)
16046                 for b.Controls[0].Op == OpPPC64CMPconst {
16047                         v_0 := b.Controls[0]
16048                         if auxIntToInt64(v_0.AuxInt) != 0 {
16049                                 break
16050                         }
16051                         v_0_0 := v_0.Args[0]
16052                         if v_0_0.Op != OpSelect0 {
16053                                 break
16054                         }
16055                         z := v_0_0.Args[0]
16056                         if z.Op != OpPPC64ANDCCconst {
16057                                 break
16058                         }
16059                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16060                         v0.AddArg(z)
16061                         b.resetWithControl(BlockPPC64LT, v0)
16062                         return true
16063                 }
16064                 // match: (LT (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
16065                 // result: (LT (Select1 <types.TypeFlags> z) yes no)
16066                 for b.Controls[0].Op == OpPPC64CMPWconst {
16067                         v_0 := b.Controls[0]
16068                         if auxIntToInt32(v_0.AuxInt) != 0 {
16069                                 break
16070                         }
16071                         v_0_0 := v_0.Args[0]
16072                         if v_0_0.Op != OpSelect0 {
16073                                 break
16074                         }
16075                         z := v_0_0.Args[0]
16076                         if z.Op != OpPPC64ANDCCconst {
16077                                 break
16078                         }
16079                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16080                         v0.AddArg(z)
16081                         b.resetWithControl(BlockPPC64LT, v0)
16082                         return true
16083                 }
16084                 // match: (LT (CMPconst [0] z:(AND x y)) yes no)
16085                 // cond: z.Uses == 1
16086                 // result: (LT (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
16087                 for b.Controls[0].Op == OpPPC64CMPconst {
16088                         v_0 := b.Controls[0]
16089                         if auxIntToInt64(v_0.AuxInt) != 0 {
16090                                 break
16091                         }
16092                         z := v_0.Args[0]
16093                         if z.Op != OpPPC64AND {
16094                                 break
16095                         }
16096                         _ = z.Args[1]
16097                         z_0 := z.Args[0]
16098                         z_1 := z.Args[1]
16099                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16100                                 x := z_0
16101                                 y := z_1
16102                                 if !(z.Uses == 1) {
16103                                         continue
16104                                 }
16105                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16106                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
16107                                 v1.AddArg2(x, y)
16108                                 v0.AddArg(v1)
16109                                 b.resetWithControl(BlockPPC64LT, v0)
16110                                 return true
16111                         }
16112                         break
16113                 }
16114                 // match: (LT (CMPconst [0] z:(OR x y)) yes no)
16115                 // cond: z.Uses == 1
16116                 // result: (LT (Select1 <types.TypeFlags> (ORCC x y)) yes no)
16117                 for b.Controls[0].Op == OpPPC64CMPconst {
16118                         v_0 := b.Controls[0]
16119                         if auxIntToInt64(v_0.AuxInt) != 0 {
16120                                 break
16121                         }
16122                         z := v_0.Args[0]
16123                         if z.Op != OpPPC64OR {
16124                                 break
16125                         }
16126                         _ = z.Args[1]
16127                         z_0 := z.Args[0]
16128                         z_1 := z.Args[1]
16129                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16130                                 x := z_0
16131                                 y := z_1
16132                                 if !(z.Uses == 1) {
16133                                         continue
16134                                 }
16135                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16136                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
16137                                 v1.AddArg2(x, y)
16138                                 v0.AddArg(v1)
16139                                 b.resetWithControl(BlockPPC64LT, v0)
16140                                 return true
16141                         }
16142                         break
16143                 }
16144                 // match: (LT (CMPconst [0] z:(XOR x y)) yes no)
16145                 // cond: z.Uses == 1
16146                 // result: (LT (Select1 <types.TypeFlags> (XORCC x y)) yes no)
16147                 for b.Controls[0].Op == OpPPC64CMPconst {
16148                         v_0 := b.Controls[0]
16149                         if auxIntToInt64(v_0.AuxInt) != 0 {
16150                                 break
16151                         }
16152                         z := v_0.Args[0]
16153                         if z.Op != OpPPC64XOR {
16154                                 break
16155                         }
16156                         _ = z.Args[1]
16157                         z_0 := z.Args[0]
16158                         z_1 := z.Args[1]
16159                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16160                                 x := z_0
16161                                 y := z_1
16162                                 if !(z.Uses == 1) {
16163                                         continue
16164                                 }
16165                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16166                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
16167                                 v1.AddArg2(x, y)
16168                                 v0.AddArg(v1)
16169                                 b.resetWithControl(BlockPPC64LT, v0)
16170                                 return true
16171                         }
16172                         break
16173                 }
16174         case BlockPPC64NE:
16175                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (Equal cc)))) yes no)
16176                 // result: (EQ cc yes no)
16177                 for b.Controls[0].Op == OpPPC64CMPWconst {
16178                         v_0 := b.Controls[0]
16179                         if auxIntToInt32(v_0.AuxInt) != 0 {
16180                                 break
16181                         }
16182                         v_0_0 := v_0.Args[0]
16183                         if v_0_0.Op != OpSelect0 {
16184                                 break
16185                         }
16186                         v_0_0_0 := v_0_0.Args[0]
16187                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16188                                 break
16189                         }
16190                         v_0_0_0_0 := v_0_0_0.Args[0]
16191                         if v_0_0_0_0.Op != OpPPC64Equal {
16192                                 break
16193                         }
16194                         cc := v_0_0_0_0.Args[0]
16195                         b.resetWithControl(BlockPPC64EQ, cc)
16196                         return true
16197                 }
16198                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (NotEqual cc)))) yes no)
16199                 // result: (NE cc yes no)
16200                 for b.Controls[0].Op == OpPPC64CMPWconst {
16201                         v_0 := b.Controls[0]
16202                         if auxIntToInt32(v_0.AuxInt) != 0 {
16203                                 break
16204                         }
16205                         v_0_0 := v_0.Args[0]
16206                         if v_0_0.Op != OpSelect0 {
16207                                 break
16208                         }
16209                         v_0_0_0 := v_0_0.Args[0]
16210                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16211                                 break
16212                         }
16213                         v_0_0_0_0 := v_0_0_0.Args[0]
16214                         if v_0_0_0_0.Op != OpPPC64NotEqual {
16215                                 break
16216                         }
16217                         cc := v_0_0_0_0.Args[0]
16218                         b.resetWithControl(BlockPPC64NE, cc)
16219                         return true
16220                 }
16221                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (LessThan cc)))) yes no)
16222                 // result: (LT cc yes no)
16223                 for b.Controls[0].Op == OpPPC64CMPWconst {
16224                         v_0 := b.Controls[0]
16225                         if auxIntToInt32(v_0.AuxInt) != 0 {
16226                                 break
16227                         }
16228                         v_0_0 := v_0.Args[0]
16229                         if v_0_0.Op != OpSelect0 {
16230                                 break
16231                         }
16232                         v_0_0_0 := v_0_0.Args[0]
16233                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16234                                 break
16235                         }
16236                         v_0_0_0_0 := v_0_0_0.Args[0]
16237                         if v_0_0_0_0.Op != OpPPC64LessThan {
16238                                 break
16239                         }
16240                         cc := v_0_0_0_0.Args[0]
16241                         b.resetWithControl(BlockPPC64LT, cc)
16242                         return true
16243                 }
16244                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (LessEqual cc)))) yes no)
16245                 // result: (LE cc yes no)
16246                 for b.Controls[0].Op == OpPPC64CMPWconst {
16247                         v_0 := b.Controls[0]
16248                         if auxIntToInt32(v_0.AuxInt) != 0 {
16249                                 break
16250                         }
16251                         v_0_0 := v_0.Args[0]
16252                         if v_0_0.Op != OpSelect0 {
16253                                 break
16254                         }
16255                         v_0_0_0 := v_0_0.Args[0]
16256                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16257                                 break
16258                         }
16259                         v_0_0_0_0 := v_0_0_0.Args[0]
16260                         if v_0_0_0_0.Op != OpPPC64LessEqual {
16261                                 break
16262                         }
16263                         cc := v_0_0_0_0.Args[0]
16264                         b.resetWithControl(BlockPPC64LE, cc)
16265                         return true
16266                 }
16267                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (GreaterThan cc)))) yes no)
16268                 // result: (GT cc yes no)
16269                 for b.Controls[0].Op == OpPPC64CMPWconst {
16270                         v_0 := b.Controls[0]
16271                         if auxIntToInt32(v_0.AuxInt) != 0 {
16272                                 break
16273                         }
16274                         v_0_0 := v_0.Args[0]
16275                         if v_0_0.Op != OpSelect0 {
16276                                 break
16277                         }
16278                         v_0_0_0 := v_0_0.Args[0]
16279                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16280                                 break
16281                         }
16282                         v_0_0_0_0 := v_0_0_0.Args[0]
16283                         if v_0_0_0_0.Op != OpPPC64GreaterThan {
16284                                 break
16285                         }
16286                         cc := v_0_0_0_0.Args[0]
16287                         b.resetWithControl(BlockPPC64GT, cc)
16288                         return true
16289                 }
16290                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (GreaterEqual cc)))) yes no)
16291                 // result: (GE cc yes no)
16292                 for b.Controls[0].Op == OpPPC64CMPWconst {
16293                         v_0 := b.Controls[0]
16294                         if auxIntToInt32(v_0.AuxInt) != 0 {
16295                                 break
16296                         }
16297                         v_0_0 := v_0.Args[0]
16298                         if v_0_0.Op != OpSelect0 {
16299                                 break
16300                         }
16301                         v_0_0_0 := v_0_0.Args[0]
16302                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16303                                 break
16304                         }
16305                         v_0_0_0_0 := v_0_0_0.Args[0]
16306                         if v_0_0_0_0.Op != OpPPC64GreaterEqual {
16307                                 break
16308                         }
16309                         cc := v_0_0_0_0.Args[0]
16310                         b.resetWithControl(BlockPPC64GE, cc)
16311                         return true
16312                 }
16313                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FLessThan cc)))) yes no)
16314                 // result: (FLT cc yes no)
16315                 for b.Controls[0].Op == OpPPC64CMPWconst {
16316                         v_0 := b.Controls[0]
16317                         if auxIntToInt32(v_0.AuxInt) != 0 {
16318                                 break
16319                         }
16320                         v_0_0 := v_0.Args[0]
16321                         if v_0_0.Op != OpSelect0 {
16322                                 break
16323                         }
16324                         v_0_0_0 := v_0_0.Args[0]
16325                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16326                                 break
16327                         }
16328                         v_0_0_0_0 := v_0_0_0.Args[0]
16329                         if v_0_0_0_0.Op != OpPPC64FLessThan {
16330                                 break
16331                         }
16332                         cc := v_0_0_0_0.Args[0]
16333                         b.resetWithControl(BlockPPC64FLT, cc)
16334                         return true
16335                 }
16336                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FLessEqual cc)))) yes no)
16337                 // result: (FLE cc yes no)
16338                 for b.Controls[0].Op == OpPPC64CMPWconst {
16339                         v_0 := b.Controls[0]
16340                         if auxIntToInt32(v_0.AuxInt) != 0 {
16341                                 break
16342                         }
16343                         v_0_0 := v_0.Args[0]
16344                         if v_0_0.Op != OpSelect0 {
16345                                 break
16346                         }
16347                         v_0_0_0 := v_0_0.Args[0]
16348                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16349                                 break
16350                         }
16351                         v_0_0_0_0 := v_0_0_0.Args[0]
16352                         if v_0_0_0_0.Op != OpPPC64FLessEqual {
16353                                 break
16354                         }
16355                         cc := v_0_0_0_0.Args[0]
16356                         b.resetWithControl(BlockPPC64FLE, cc)
16357                         return true
16358                 }
16359                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FGreaterThan cc)))) yes no)
16360                 // result: (FGT cc yes no)
16361                 for b.Controls[0].Op == OpPPC64CMPWconst {
16362                         v_0 := b.Controls[0]
16363                         if auxIntToInt32(v_0.AuxInt) != 0 {
16364                                 break
16365                         }
16366                         v_0_0 := v_0.Args[0]
16367                         if v_0_0.Op != OpSelect0 {
16368                                 break
16369                         }
16370                         v_0_0_0 := v_0_0.Args[0]
16371                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16372                                 break
16373                         }
16374                         v_0_0_0_0 := v_0_0_0.Args[0]
16375                         if v_0_0_0_0.Op != OpPPC64FGreaterThan {
16376                                 break
16377                         }
16378                         cc := v_0_0_0_0.Args[0]
16379                         b.resetWithControl(BlockPPC64FGT, cc)
16380                         return true
16381                 }
16382                 // match: (NE (CMPWconst [0] (Select0 (ANDCCconst [1] (FGreaterEqual cc)))) yes no)
16383                 // result: (FGE cc yes no)
16384                 for b.Controls[0].Op == OpPPC64CMPWconst {
16385                         v_0 := b.Controls[0]
16386                         if auxIntToInt32(v_0.AuxInt) != 0 {
16387                                 break
16388                         }
16389                         v_0_0 := v_0.Args[0]
16390                         if v_0_0.Op != OpSelect0 {
16391                                 break
16392                         }
16393                         v_0_0_0 := v_0_0.Args[0]
16394                         if v_0_0_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0_0_0.AuxInt) != 1 {
16395                                 break
16396                         }
16397                         v_0_0_0_0 := v_0_0_0.Args[0]
16398                         if v_0_0_0_0.Op != OpPPC64FGreaterEqual {
16399                                 break
16400                         }
16401                         cc := v_0_0_0_0.Args[0]
16402                         b.resetWithControl(BlockPPC64FGE, cc)
16403                         return true
16404                 }
16405                 // match: (NE (FlagEQ) yes no)
16406                 // result: (First no yes)
16407                 for b.Controls[0].Op == OpPPC64FlagEQ {
16408                         b.Reset(BlockFirst)
16409                         b.swapSuccessors()
16410                         return true
16411                 }
16412                 // match: (NE (FlagLT) yes no)
16413                 // result: (First yes no)
16414                 for b.Controls[0].Op == OpPPC64FlagLT {
16415                         b.Reset(BlockFirst)
16416                         return true
16417                 }
16418                 // match: (NE (FlagGT) yes no)
16419                 // result: (First yes no)
16420                 for b.Controls[0].Op == OpPPC64FlagGT {
16421                         b.Reset(BlockFirst)
16422                         return true
16423                 }
16424                 // match: (NE (InvertFlags cmp) yes no)
16425                 // result: (NE cmp yes no)
16426                 for b.Controls[0].Op == OpPPC64InvertFlags {
16427                         v_0 := b.Controls[0]
16428                         cmp := v_0.Args[0]
16429                         b.resetWithControl(BlockPPC64NE, cmp)
16430                         return true
16431                 }
16432                 // match: (NE (CMPconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
16433                 // result: (NE (Select1 <types.TypeFlags> z) yes no)
16434                 for b.Controls[0].Op == OpPPC64CMPconst {
16435                         v_0 := b.Controls[0]
16436                         if auxIntToInt64(v_0.AuxInt) != 0 {
16437                                 break
16438                         }
16439                         v_0_0 := v_0.Args[0]
16440                         if v_0_0.Op != OpSelect0 {
16441                                 break
16442                         }
16443                         z := v_0_0.Args[0]
16444                         if z.Op != OpPPC64ANDCCconst {
16445                                 break
16446                         }
16447                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16448                         v0.AddArg(z)
16449                         b.resetWithControl(BlockPPC64NE, v0)
16450                         return true
16451                 }
16452                 // match: (NE (CMPWconst [0] (Select0 z:(ANDCCconst [c] x))) yes no)
16453                 // result: (NE (Select1 <types.TypeFlags> z) yes no)
16454                 for b.Controls[0].Op == OpPPC64CMPWconst {
16455                         v_0 := b.Controls[0]
16456                         if auxIntToInt32(v_0.AuxInt) != 0 {
16457                                 break
16458                         }
16459                         v_0_0 := v_0.Args[0]
16460                         if v_0_0.Op != OpSelect0 {
16461                                 break
16462                         }
16463                         z := v_0_0.Args[0]
16464                         if z.Op != OpPPC64ANDCCconst {
16465                                 break
16466                         }
16467                         v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16468                         v0.AddArg(z)
16469                         b.resetWithControl(BlockPPC64NE, v0)
16470                         return true
16471                 }
16472                 // match: (NE (CMPconst [0] z:(AND x y)) yes no)
16473                 // cond: z.Uses == 1
16474                 // result: (NE (Select1 <types.TypeFlags> (ANDCC x y)) yes no)
16475                 for b.Controls[0].Op == OpPPC64CMPconst {
16476                         v_0 := b.Controls[0]
16477                         if auxIntToInt64(v_0.AuxInt) != 0 {
16478                                 break
16479                         }
16480                         z := v_0.Args[0]
16481                         if z.Op != OpPPC64AND {
16482                                 break
16483                         }
16484                         _ = z.Args[1]
16485                         z_0 := z.Args[0]
16486                         z_1 := z.Args[1]
16487                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16488                                 x := z_0
16489                                 y := z_1
16490                                 if !(z.Uses == 1) {
16491                                         continue
16492                                 }
16493                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16494                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
16495                                 v1.AddArg2(x, y)
16496                                 v0.AddArg(v1)
16497                                 b.resetWithControl(BlockPPC64NE, v0)
16498                                 return true
16499                         }
16500                         break
16501                 }
16502                 // match: (NE (CMPconst [0] z:(OR x y)) yes no)
16503                 // cond: z.Uses == 1
16504                 // result: (NE (Select1 <types.TypeFlags> (ORCC x y)) yes no)
16505                 for b.Controls[0].Op == OpPPC64CMPconst {
16506                         v_0 := b.Controls[0]
16507                         if auxIntToInt64(v_0.AuxInt) != 0 {
16508                                 break
16509                         }
16510                         z := v_0.Args[0]
16511                         if z.Op != OpPPC64OR {
16512                                 break
16513                         }
16514                         _ = z.Args[1]
16515                         z_0 := z.Args[0]
16516                         z_1 := z.Args[1]
16517                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16518                                 x := z_0
16519                                 y := z_1
16520                                 if !(z.Uses == 1) {
16521                                         continue
16522                                 }
16523                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16524                                 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
16525                                 v1.AddArg2(x, y)
16526                                 v0.AddArg(v1)
16527                                 b.resetWithControl(BlockPPC64NE, v0)
16528                                 return true
16529                         }
16530                         break
16531                 }
16532                 // match: (NE (CMPconst [0] z:(XOR x y)) yes no)
16533                 // cond: z.Uses == 1
16534                 // result: (NE (Select1 <types.TypeFlags> (XORCC x y)) yes no)
16535                 for b.Controls[0].Op == OpPPC64CMPconst {
16536                         v_0 := b.Controls[0]
16537                         if auxIntToInt64(v_0.AuxInt) != 0 {
16538                                 break
16539                         }
16540                         z := v_0.Args[0]
16541                         if z.Op != OpPPC64XOR {
16542                                 break
16543                         }
16544                         _ = z.Args[1]
16545                         z_0 := z.Args[0]
16546                         z_1 := z.Args[1]
16547                         for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16548                                 x := z_0
16549                                 y := z_1
16550                                 if !(z.Uses == 1) {
16551                                         continue
16552                                 }
16553                                 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16554                                 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
16555                                 v1.AddArg2(x, y)
16556                                 v0.AddArg(v1)
16557                                 b.resetWithControl(BlockPPC64NE, v0)
16558                                 return true
16559                         }
16560                         break
16561                 }
16562         }
16563         return false
16564 }