1 // Code generated from _gen/PPC64.rules using 'go generate'; DO NOT EDIT.
5 import "internal/buildcfg"
7 import "cmd/compile/internal/types"
9 func rewriteValuePPC64(v *Value) bool {
36 return rewriteValuePPC64_OpAddr(v)
53 v.Op = OpPPC64LoweredAtomicAdd32
56 v.Op = OpPPC64LoweredAtomicAdd64
59 v.Op = OpPPC64LoweredAtomicAnd32
62 v.Op = OpPPC64LoweredAtomicAnd8
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
73 case OpAtomicExchange64:
74 v.Op = OpPPC64LoweredAtomicExchange64
77 return rewriteValuePPC64_OpAtomicLoad32(v)
79 return rewriteValuePPC64_OpAtomicLoad64(v)
81 return rewriteValuePPC64_OpAtomicLoad8(v)
82 case OpAtomicLoadAcq32:
83 return rewriteValuePPC64_OpAtomicLoadAcq32(v)
84 case OpAtomicLoadAcq64:
85 return rewriteValuePPC64_OpAtomicLoadAcq64(v)
87 return rewriteValuePPC64_OpAtomicLoadPtr(v)
89 v.Op = OpPPC64LoweredAtomicOr32
92 v.Op = OpPPC64LoweredAtomicOr8
95 return rewriteValuePPC64_OpAtomicStore32(v)
97 return rewriteValuePPC64_OpAtomicStore64(v)
99 return rewriteValuePPC64_OpAtomicStore8(v)
100 case OpAtomicStoreRel32:
101 return rewriteValuePPC64_OpAtomicStoreRel32(v)
102 case OpAtomicStoreRel64:
103 return rewriteValuePPC64_OpAtomicStoreRel64(v)
105 return rewriteValuePPC64_OpAvg64u(v)
107 return rewriteValuePPC64_OpBitLen32(v)
109 return rewriteValuePPC64_OpBitLen64(v)
111 return rewriteValuePPC64_OpBswap16(v)
113 return rewriteValuePPC64_OpBswap32(v)
115 return rewriteValuePPC64_OpBswap64(v)
120 v.Op = OpPPC64CALLclosure
123 return rewriteValuePPC64_OpCom16(v)
125 return rewriteValuePPC64_OpCom32(v)
127 return rewriteValuePPC64_OpCom64(v)
129 return rewriteValuePPC64_OpCom8(v)
131 return rewriteValuePPC64_OpCondSelect(v)
133 return rewriteValuePPC64_OpConst16(v)
135 return rewriteValuePPC64_OpConst32(v)
137 v.Op = OpPPC64FMOVSconst
140 return rewriteValuePPC64_OpConst64(v)
142 v.Op = OpPPC64FMOVDconst
145 return rewriteValuePPC64_OpConst8(v)
147 return rewriteValuePPC64_OpConstBool(v)
149 return rewriteValuePPC64_OpConstNil(v)
151 return rewriteValuePPC64_OpCopysign(v)
153 return rewriteValuePPC64_OpCtz16(v)
155 return rewriteValuePPC64_OpCtz32(v)
160 return rewriteValuePPC64_OpCtz64(v)
165 return rewriteValuePPC64_OpCtz8(v)
167 return rewriteValuePPC64_OpCvt32Fto32(v)
169 return rewriteValuePPC64_OpCvt32Fto64(v)
174 return rewriteValuePPC64_OpCvt32to32F(v)
176 return rewriteValuePPC64_OpCvt32to64F(v)
178 return rewriteValuePPC64_OpCvt64Fto32(v)
183 return rewriteValuePPC64_OpCvt64Fto64(v)
185 return rewriteValuePPC64_OpCvt64to32F(v)
187 return rewriteValuePPC64_OpCvt64to64F(v)
188 case OpCvtBoolToUint8:
192 return rewriteValuePPC64_OpDiv16(v)
194 return rewriteValuePPC64_OpDiv16u(v)
196 return rewriteValuePPC64_OpDiv32(v)
204 return rewriteValuePPC64_OpDiv64(v)
212 return rewriteValuePPC64_OpDiv8(v)
214 return rewriteValuePPC64_OpDiv8u(v)
216 return rewriteValuePPC64_OpEq16(v)
218 return rewriteValuePPC64_OpEq32(v)
220 return rewriteValuePPC64_OpEq32F(v)
222 return rewriteValuePPC64_OpEq64(v)
224 return rewriteValuePPC64_OpEq64F(v)
226 return rewriteValuePPC64_OpEq8(v)
228 return rewriteValuePPC64_OpEqB(v)
230 return rewriteValuePPC64_OpEqPtr(v)
238 v.Op = OpPPC64LoweredGetCallerPC
241 v.Op = OpPPC64LoweredGetCallerSP
243 case OpGetClosurePtr:
244 v.Op = OpPPC64LoweredGetClosurePtr
259 v.Op = OpPPC64CALLinter
262 return rewriteValuePPC64_OpIsInBounds(v)
264 return rewriteValuePPC64_OpIsNonNil(v)
265 case OpIsSliceInBounds:
266 return rewriteValuePPC64_OpIsSliceInBounds(v)
268 return rewriteValuePPC64_OpLeq16(v)
270 return rewriteValuePPC64_OpLeq16U(v)
272 return rewriteValuePPC64_OpLeq32(v)
274 return rewriteValuePPC64_OpLeq32F(v)
276 return rewriteValuePPC64_OpLeq32U(v)
278 return rewriteValuePPC64_OpLeq64(v)
280 return rewriteValuePPC64_OpLeq64F(v)
282 return rewriteValuePPC64_OpLeq64U(v)
284 return rewriteValuePPC64_OpLeq8(v)
286 return rewriteValuePPC64_OpLeq8U(v)
288 return rewriteValuePPC64_OpLess16(v)
290 return rewriteValuePPC64_OpLess16U(v)
292 return rewriteValuePPC64_OpLess32(v)
294 return rewriteValuePPC64_OpLess32F(v)
296 return rewriteValuePPC64_OpLess32U(v)
298 return rewriteValuePPC64_OpLess64(v)
300 return rewriteValuePPC64_OpLess64F(v)
302 return rewriteValuePPC64_OpLess64U(v)
304 return rewriteValuePPC64_OpLess8(v)
306 return rewriteValuePPC64_OpLess8U(v)
308 return rewriteValuePPC64_OpLoad(v)
310 return rewriteValuePPC64_OpLocalAddr(v)
312 return rewriteValuePPC64_OpLsh16x16(v)
314 return rewriteValuePPC64_OpLsh16x32(v)
316 return rewriteValuePPC64_OpLsh16x64(v)
318 return rewriteValuePPC64_OpLsh16x8(v)
320 return rewriteValuePPC64_OpLsh32x16(v)
322 return rewriteValuePPC64_OpLsh32x32(v)
324 return rewriteValuePPC64_OpLsh32x64(v)
326 return rewriteValuePPC64_OpLsh32x8(v)
328 return rewriteValuePPC64_OpLsh64x16(v)
330 return rewriteValuePPC64_OpLsh64x32(v)
332 return rewriteValuePPC64_OpLsh64x64(v)
334 return rewriteValuePPC64_OpLsh64x8(v)
336 return rewriteValuePPC64_OpLsh8x16(v)
338 return rewriteValuePPC64_OpLsh8x32(v)
340 return rewriteValuePPC64_OpLsh8x64(v)
342 return rewriteValuePPC64_OpLsh8x8(v)
344 return rewriteValuePPC64_OpMod16(v)
346 return rewriteValuePPC64_OpMod16u(v)
348 return rewriteValuePPC64_OpMod32(v)
350 return rewriteValuePPC64_OpMod32u(v)
352 return rewriteValuePPC64_OpMod64(v)
354 return rewriteValuePPC64_OpMod64u(v)
356 return rewriteValuePPC64_OpMod8(v)
358 return rewriteValuePPC64_OpMod8u(v)
360 return rewriteValuePPC64_OpMove(v)
398 return rewriteValuePPC64_OpNeq16(v)
400 return rewriteValuePPC64_OpNeq32(v)
402 return rewriteValuePPC64_OpNeq32F(v)
404 return rewriteValuePPC64_OpNeq64(v)
406 return rewriteValuePPC64_OpNeq64F(v)
408 return rewriteValuePPC64_OpNeq8(v)
413 return rewriteValuePPC64_OpNeqPtr(v)
415 v.Op = OpPPC64LoweredNilCheck
418 return rewriteValuePPC64_OpNot(v)
420 return rewriteValuePPC64_OpOffPtr(v)
437 return rewriteValuePPC64_OpPPC64ADD(v)
439 return rewriteValuePPC64_OpPPC64ADDE(v)
440 case OpPPC64ADDconst:
441 return rewriteValuePPC64_OpPPC64ADDconst(v)
443 return rewriteValuePPC64_OpPPC64AND(v)
444 case OpPPC64ANDCCconst:
445 return rewriteValuePPC64_OpPPC64ANDCCconst(v)
447 return rewriteValuePPC64_OpPPC64ANDN(v)
449 return rewriteValuePPC64_OpPPC64BRD(v)
451 return rewriteValuePPC64_OpPPC64BRH(v)
453 return rewriteValuePPC64_OpPPC64BRW(v)
454 case OpPPC64CLRLSLDI:
455 return rewriteValuePPC64_OpPPC64CLRLSLDI(v)
457 return rewriteValuePPC64_OpPPC64CMP(v)
459 return rewriteValuePPC64_OpPPC64CMPU(v)
460 case OpPPC64CMPUconst:
461 return rewriteValuePPC64_OpPPC64CMPUconst(v)
463 return rewriteValuePPC64_OpPPC64CMPW(v)
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)
473 return rewriteValuePPC64_OpPPC64Equal(v)
475 return rewriteValuePPC64_OpPPC64FABS(v)
477 return rewriteValuePPC64_OpPPC64FADD(v)
479 return rewriteValuePPC64_OpPPC64FADDS(v)
481 return rewriteValuePPC64_OpPPC64FCEIL(v)
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)
501 return rewriteValuePPC64_OpPPC64FNEG(v)
503 return rewriteValuePPC64_OpPPC64FSQRT(v)
505 return rewriteValuePPC64_OpPPC64FSUB(v)
507 return rewriteValuePPC64_OpPPC64FSUBS(v)
509 return rewriteValuePPC64_OpPPC64FTRUNC(v)
510 case OpPPC64GreaterEqual:
511 return rewriteValuePPC64_OpPPC64GreaterEqual(v)
512 case OpPPC64GreaterThan:
513 return rewriteValuePPC64_OpPPC64GreaterThan(v)
515 return rewriteValuePPC64_OpPPC64ISEL(v)
516 case OpPPC64LessEqual:
517 return rewriteValuePPC64_OpPPC64LessEqual(v)
518 case OpPPC64LessThan:
519 return rewriteValuePPC64_OpPPC64LessThan(v)
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)
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)
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)
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)
589 return rewriteValuePPC64_OpPPC64MTVSRD(v)
591 return rewriteValuePPC64_OpPPC64MULLD(v)
593 return rewriteValuePPC64_OpPPC64MULLW(v)
595 return rewriteValuePPC64_OpPPC64NEG(v)
597 return rewriteValuePPC64_OpPPC64NOR(v)
598 case OpPPC64NotEqual:
599 return rewriteValuePPC64_OpPPC64NotEqual(v)
601 return rewriteValuePPC64_OpPPC64OR(v)
603 return rewriteValuePPC64_OpPPC64ORN(v)
605 return rewriteValuePPC64_OpPPC64ORconst(v)
607 return rewriteValuePPC64_OpPPC64ROTL(v)
609 return rewriteValuePPC64_OpPPC64ROTLW(v)
610 case OpPPC64ROTLWconst:
611 return rewriteValuePPC64_OpPPC64ROTLWconst(v)
613 return rewriteValuePPC64_OpPPC64SETBC(v)
615 return rewriteValuePPC64_OpPPC64SETBCR(v)
617 return rewriteValuePPC64_OpPPC64SLD(v)
618 case OpPPC64SLDconst:
619 return rewriteValuePPC64_OpPPC64SLDconst(v)
621 return rewriteValuePPC64_OpPPC64SLW(v)
622 case OpPPC64SLWconst:
623 return rewriteValuePPC64_OpPPC64SLWconst(v)
625 return rewriteValuePPC64_OpPPC64SRAD(v)
627 return rewriteValuePPC64_OpPPC64SRAW(v)
629 return rewriteValuePPC64_OpPPC64SRD(v)
631 return rewriteValuePPC64_OpPPC64SRW(v)
632 case OpPPC64SRWconst:
633 return rewriteValuePPC64_OpPPC64SRWconst(v)
635 return rewriteValuePPC64_OpPPC64SUB(v)
637 return rewriteValuePPC64_OpPPC64SUBE(v)
638 case OpPPC64SUBFCconst:
639 return rewriteValuePPC64_OpPPC64SUBFCconst(v)
641 return rewriteValuePPC64_OpPPC64XOR(v)
642 case OpPPC64XORconst:
643 return rewriteValuePPC64_OpPPC64XORconst(v)
645 return rewriteValuePPC64_OpPanicBounds(v)
647 return rewriteValuePPC64_OpPopCount16(v)
649 return rewriteValuePPC64_OpPopCount32(v)
651 v.Op = OpPPC64POPCNTD
654 return rewriteValuePPC64_OpPopCount8(v)
655 case OpPrefetchCache:
656 return rewriteValuePPC64_OpPrefetchCache(v)
657 case OpPrefetchCacheStreamed:
658 return rewriteValuePPC64_OpPrefetchCacheStreamed(v)
660 v.Op = OpPPC64LoweredPubBarrier
663 return rewriteValuePPC64_OpRotateLeft16(v)
671 return rewriteValuePPC64_OpRotateLeft8(v)
676 v.Op = OpPPC64LoweredRound32F
679 v.Op = OpPPC64LoweredRound64F
682 return rewriteValuePPC64_OpRsh16Ux16(v)
684 return rewriteValuePPC64_OpRsh16Ux32(v)
686 return rewriteValuePPC64_OpRsh16Ux64(v)
688 return rewriteValuePPC64_OpRsh16Ux8(v)
690 return rewriteValuePPC64_OpRsh16x16(v)
692 return rewriteValuePPC64_OpRsh16x32(v)
694 return rewriteValuePPC64_OpRsh16x64(v)
696 return rewriteValuePPC64_OpRsh16x8(v)
698 return rewriteValuePPC64_OpRsh32Ux16(v)
700 return rewriteValuePPC64_OpRsh32Ux32(v)
702 return rewriteValuePPC64_OpRsh32Ux64(v)
704 return rewriteValuePPC64_OpRsh32Ux8(v)
706 return rewriteValuePPC64_OpRsh32x16(v)
708 return rewriteValuePPC64_OpRsh32x32(v)
710 return rewriteValuePPC64_OpRsh32x64(v)
712 return rewriteValuePPC64_OpRsh32x8(v)
714 return rewriteValuePPC64_OpRsh64Ux16(v)
716 return rewriteValuePPC64_OpRsh64Ux32(v)
718 return rewriteValuePPC64_OpRsh64Ux64(v)
720 return rewriteValuePPC64_OpRsh64Ux8(v)
722 return rewriteValuePPC64_OpRsh64x16(v)
724 return rewriteValuePPC64_OpRsh64x32(v)
726 return rewriteValuePPC64_OpRsh64x64(v)
728 return rewriteValuePPC64_OpRsh64x8(v)
730 return rewriteValuePPC64_OpRsh8Ux16(v)
732 return rewriteValuePPC64_OpRsh8Ux32(v)
734 return rewriteValuePPC64_OpRsh8Ux64(v)
736 return rewriteValuePPC64_OpRsh8Ux8(v)
738 return rewriteValuePPC64_OpRsh8x16(v)
740 return rewriteValuePPC64_OpRsh8x32(v)
742 return rewriteValuePPC64_OpRsh8x64(v)
744 return rewriteValuePPC64_OpRsh8x8(v)
746 return rewriteValuePPC64_OpSelect0(v)
748 return rewriteValuePPC64_OpSelect1(v)
750 return rewriteValuePPC64_OpSelectN(v)
751 case OpSignExt16to32:
752 v.Op = OpPPC64MOVHreg
754 case OpSignExt16to64:
755 v.Op = OpPPC64MOVHreg
757 case OpSignExt32to64:
758 v.Op = OpPPC64MOVWreg
761 v.Op = OpPPC64MOVBreg
764 v.Op = OpPPC64MOVBreg
767 v.Op = OpPPC64MOVBreg
770 return rewriteValuePPC64_OpSlicemask(v)
778 v.Op = OpPPC64CALLstatic
781 return rewriteValuePPC64_OpStore(v)
804 v.Op = OpPPC64CALLtail
810 return rewriteValuePPC64_OpTrunc16to8(v)
812 return rewriteValuePPC64_OpTrunc32to16(v)
814 return rewriteValuePPC64_OpTrunc32to8(v)
816 return rewriteValuePPC64_OpTrunc64to16(v)
818 return rewriteValuePPC64_OpTrunc64to32(v)
820 return rewriteValuePPC64_OpTrunc64to8(v)
822 v.Op = OpPPC64LoweredWB
837 return rewriteValuePPC64_OpZero(v)
838 case OpZeroExt16to32:
839 v.Op = OpPPC64MOVHZreg
841 case OpZeroExt16to64:
842 v.Op = OpPPC64MOVHZreg
844 case OpZeroExt32to64:
845 v.Op = OpPPC64MOVWZreg
848 v.Op = OpPPC64MOVBZreg
851 v.Op = OpPPC64MOVBZreg
854 v.Op = OpPPC64MOVBZreg
859 func rewriteValuePPC64_OpAddr(v *Value) bool {
861 // match: (Addr {sym} base)
862 // result: (MOVDaddr {sym} [0] base)
864 sym := auxToSym(v.Aux)
866 v.reset(OpPPC64MOVDaddr)
867 v.AuxInt = int32ToAuxInt(0)
868 v.Aux = symToAux(sym)
873 func rewriteValuePPC64_OpAtomicCompareAndSwap32(v *Value) bool {
878 // match: (AtomicCompareAndSwap32 ptr old new_ mem)
879 // result: (LoweredAtomicCas32 [1] ptr old new_ mem)
885 v.reset(OpPPC64LoweredAtomicCas32)
886 v.AuxInt = int64ToAuxInt(1)
887 v.AddArg4(ptr, old, new_, mem)
891 func rewriteValuePPC64_OpAtomicCompareAndSwap64(v *Value) bool {
896 // match: (AtomicCompareAndSwap64 ptr old new_ mem)
897 // result: (LoweredAtomicCas64 [1] ptr old new_ mem)
903 v.reset(OpPPC64LoweredAtomicCas64)
904 v.AuxInt = int64ToAuxInt(1)
905 v.AddArg4(ptr, old, new_, mem)
909 func rewriteValuePPC64_OpAtomicCompareAndSwapRel32(v *Value) bool {
914 // match: (AtomicCompareAndSwapRel32 ptr old new_ mem)
915 // result: (LoweredAtomicCas32 [0] ptr old new_ mem)
921 v.reset(OpPPC64LoweredAtomicCas32)
922 v.AuxInt = int64ToAuxInt(0)
923 v.AddArg4(ptr, old, new_, mem)
927 func rewriteValuePPC64_OpAtomicLoad32(v *Value) bool {
930 // match: (AtomicLoad32 ptr mem)
931 // result: (LoweredAtomicLoad32 [1] ptr mem)
935 v.reset(OpPPC64LoweredAtomicLoad32)
936 v.AuxInt = int64ToAuxInt(1)
941 func rewriteValuePPC64_OpAtomicLoad64(v *Value) bool {
944 // match: (AtomicLoad64 ptr mem)
945 // result: (LoweredAtomicLoad64 [1] ptr mem)
949 v.reset(OpPPC64LoweredAtomicLoad64)
950 v.AuxInt = int64ToAuxInt(1)
955 func rewriteValuePPC64_OpAtomicLoad8(v *Value) bool {
958 // match: (AtomicLoad8 ptr mem)
959 // result: (LoweredAtomicLoad8 [1] ptr mem)
963 v.reset(OpPPC64LoweredAtomicLoad8)
964 v.AuxInt = int64ToAuxInt(1)
969 func rewriteValuePPC64_OpAtomicLoadAcq32(v *Value) bool {
972 // match: (AtomicLoadAcq32 ptr mem)
973 // result: (LoweredAtomicLoad32 [0] ptr mem)
977 v.reset(OpPPC64LoweredAtomicLoad32)
978 v.AuxInt = int64ToAuxInt(0)
983 func rewriteValuePPC64_OpAtomicLoadAcq64(v *Value) bool {
986 // match: (AtomicLoadAcq64 ptr mem)
987 // result: (LoweredAtomicLoad64 [0] ptr mem)
991 v.reset(OpPPC64LoweredAtomicLoad64)
992 v.AuxInt = int64ToAuxInt(0)
997 func rewriteValuePPC64_OpAtomicLoadPtr(v *Value) bool {
1000 // match: (AtomicLoadPtr ptr mem)
1001 // result: (LoweredAtomicLoadPtr [1] ptr mem)
1005 v.reset(OpPPC64LoweredAtomicLoadPtr)
1006 v.AuxInt = int64ToAuxInt(1)
1011 func rewriteValuePPC64_OpAtomicStore32(v *Value) bool {
1015 // match: (AtomicStore32 ptr val mem)
1016 // result: (LoweredAtomicStore32 [1] ptr val mem)
1021 v.reset(OpPPC64LoweredAtomicStore32)
1022 v.AuxInt = int64ToAuxInt(1)
1023 v.AddArg3(ptr, val, mem)
1027 func rewriteValuePPC64_OpAtomicStore64(v *Value) bool {
1031 // match: (AtomicStore64 ptr val mem)
1032 // result: (LoweredAtomicStore64 [1] ptr val mem)
1037 v.reset(OpPPC64LoweredAtomicStore64)
1038 v.AuxInt = int64ToAuxInt(1)
1039 v.AddArg3(ptr, val, mem)
1043 func rewriteValuePPC64_OpAtomicStore8(v *Value) bool {
1047 // match: (AtomicStore8 ptr val mem)
1048 // result: (LoweredAtomicStore8 [1] ptr val mem)
1053 v.reset(OpPPC64LoweredAtomicStore8)
1054 v.AuxInt = int64ToAuxInt(1)
1055 v.AddArg3(ptr, val, mem)
1059 func rewriteValuePPC64_OpAtomicStoreRel32(v *Value) bool {
1063 // match: (AtomicStoreRel32 ptr val mem)
1064 // result: (LoweredAtomicStore32 [0] ptr val mem)
1069 v.reset(OpPPC64LoweredAtomicStore32)
1070 v.AuxInt = int64ToAuxInt(0)
1071 v.AddArg3(ptr, val, mem)
1075 func rewriteValuePPC64_OpAtomicStoreRel64(v *Value) bool {
1079 // match: (AtomicStoreRel64 ptr val mem)
1080 // result: (LoweredAtomicStore64 [0] ptr val mem)
1085 v.reset(OpPPC64LoweredAtomicStore64)
1086 v.AuxInt = int64ToAuxInt(0)
1087 v.AddArg3(ptr, val, mem)
1091 func rewriteValuePPC64_OpAvg64u(v *Value) bool {
1095 // match: (Avg64u <t> x y)
1096 // result: (ADD (SRDconst <t> (SUB <t> x y) [1]) y)
1102 v0 := b.NewValue0(v.Pos, OpPPC64SRDconst, t)
1103 v0.AuxInt = int64ToAuxInt(1)
1104 v1 := b.NewValue0(v.Pos, OpPPC64SUB, t)
1111 func rewriteValuePPC64_OpBitLen32(v *Value) bool {
1114 typ := &b.Func.Config.Types
1115 // match: (BitLen32 x)
1116 // result: (SUBFCconst [32] (CNTLZW <typ.Int> x))
1119 v.reset(OpPPC64SUBFCconst)
1120 v.AuxInt = int64ToAuxInt(32)
1121 v0 := b.NewValue0(v.Pos, OpPPC64CNTLZW, typ.Int)
1127 func rewriteValuePPC64_OpBitLen64(v *Value) bool {
1130 typ := &b.Func.Config.Types
1131 // match: (BitLen64 x)
1132 // result: (SUBFCconst [64] (CNTLZD <typ.Int> x))
1135 v.reset(OpPPC64SUBFCconst)
1136 v.AuxInt = int64ToAuxInt(64)
1137 v0 := b.NewValue0(v.Pos, OpPPC64CNTLZD, typ.Int)
1143 func rewriteValuePPC64_OpBswap16(v *Value) bool {
1146 typ := &b.Func.Config.Types
1147 // match: (Bswap16 x)
1148 // cond: buildcfg.GOPPC64>=10
1152 if !(buildcfg.GOPPC64 >= 10) {
1159 // match: (Bswap16 x:(MOVHZload [off] {sym} ptr mem))
1160 // result: @x.Block (MOVHBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
1163 if x.Op != OpPPC64MOVHZload {
1166 off := auxIntToInt32(x.AuxInt)
1167 sym := auxToSym(x.Aux)
1171 v0 := b.NewValue0(x.Pos, OpPPC64MOVHBRload, typ.UInt16)
1173 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
1174 v1.AuxInt = int32ToAuxInt(off)
1175 v1.Aux = symToAux(sym)
1180 // match: (Bswap16 x:(MOVHZloadidx ptr idx mem))
1181 // result: @x.Block (MOVHBRloadidx ptr idx mem)
1184 if x.Op != OpPPC64MOVHZloadidx {
1191 v0 := b.NewValue0(v.Pos, OpPPC64MOVHBRloadidx, typ.Int16)
1193 v0.AddArg3(ptr, idx, mem)
1198 func rewriteValuePPC64_OpBswap32(v *Value) bool {
1201 typ := &b.Func.Config.Types
1202 // match: (Bswap32 x)
1203 // cond: buildcfg.GOPPC64>=10
1207 if !(buildcfg.GOPPC64 >= 10) {
1214 // match: (Bswap32 x:(MOVWZload [off] {sym} ptr mem))
1215 // result: @x.Block (MOVWBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
1218 if x.Op != OpPPC64MOVWZload {
1221 off := auxIntToInt32(x.AuxInt)
1222 sym := auxToSym(x.Aux)
1226 v0 := b.NewValue0(x.Pos, OpPPC64MOVWBRload, typ.UInt32)
1228 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
1229 v1.AuxInt = int32ToAuxInt(off)
1230 v1.Aux = symToAux(sym)
1235 // match: (Bswap32 x:(MOVWZloadidx ptr idx mem))
1236 // result: @x.Block (MOVWBRloadidx ptr idx mem)
1239 if x.Op != OpPPC64MOVWZloadidx {
1246 v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRloadidx, typ.Int32)
1248 v0.AddArg3(ptr, idx, mem)
1253 func rewriteValuePPC64_OpBswap64(v *Value) bool {
1256 typ := &b.Func.Config.Types
1257 // match: (Bswap64 x)
1258 // cond: buildcfg.GOPPC64>=10
1262 if !(buildcfg.GOPPC64 >= 10) {
1269 // match: (Bswap64 x:(MOVDload [off] {sym} ptr mem))
1270 // result: @x.Block (MOVDBRload (MOVDaddr <ptr.Type> [off] {sym} ptr) mem)
1273 if x.Op != OpPPC64MOVDload {
1276 off := auxIntToInt32(x.AuxInt)
1277 sym := auxToSym(x.Aux)
1281 v0 := b.NewValue0(x.Pos, OpPPC64MOVDBRload, typ.UInt64)
1283 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
1284 v1.AuxInt = int32ToAuxInt(off)
1285 v1.Aux = symToAux(sym)
1290 // match: (Bswap64 x:(MOVDloadidx ptr idx mem))
1291 // result: @x.Block (MOVDBRloadidx ptr idx mem)
1294 if x.Op != OpPPC64MOVDloadidx {
1301 v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRloadidx, typ.Int64)
1303 v0.AddArg3(ptr, idx, mem)
1308 func rewriteValuePPC64_OpCom16(v *Value) bool {
1311 // result: (NOR x x)
1319 func rewriteValuePPC64_OpCom32(v *Value) bool {
1322 // result: (NOR x x)
1330 func rewriteValuePPC64_OpCom64(v *Value) bool {
1333 // result: (NOR x x)
1341 func rewriteValuePPC64_OpCom8(v *Value) bool {
1344 // result: (NOR x x)
1352 func rewriteValuePPC64_OpCondSelect(v *Value) bool {
1357 typ := &b.Func.Config.Types
1358 // match: (CondSelect x y (SETBC [a] cmp))
1359 // result: (ISEL [a] x y cmp)
1363 if v_2.Op != OpPPC64SETBC {
1366 a := auxIntToInt32(v_2.AuxInt)
1368 v.reset(OpPPC64ISEL)
1369 v.AuxInt = int32ToAuxInt(a)
1370 v.AddArg3(x, y, cmp)
1373 // match: (CondSelect x y (SETBCR [a] cmp))
1374 // result: (ISEL [a+4] x y cmp)
1378 if v_2.Op != OpPPC64SETBCR {
1381 a := auxIntToInt32(v_2.AuxInt)
1383 v.reset(OpPPC64ISEL)
1384 v.AuxInt = int32ToAuxInt(a + 4)
1385 v.AddArg3(x, y, cmp)
1388 // match: (CondSelect x y bool)
1389 // cond: flagArg(bool) == nil
1390 // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [1] bool)))
1395 if !(flagArg(bool) == nil) {
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)
1410 func rewriteValuePPC64_OpConst16(v *Value) bool {
1411 // match: (Const16 [val])
1412 // result: (MOVDconst [int64(val)])
1414 val := auxIntToInt16(v.AuxInt)
1415 v.reset(OpPPC64MOVDconst)
1416 v.AuxInt = int64ToAuxInt(int64(val))
1420 func rewriteValuePPC64_OpConst32(v *Value) bool {
1421 // match: (Const32 [val])
1422 // result: (MOVDconst [int64(val)])
1424 val := auxIntToInt32(v.AuxInt)
1425 v.reset(OpPPC64MOVDconst)
1426 v.AuxInt = int64ToAuxInt(int64(val))
1430 func rewriteValuePPC64_OpConst64(v *Value) bool {
1431 // match: (Const64 [val])
1432 // result: (MOVDconst [int64(val)])
1434 val := auxIntToInt64(v.AuxInt)
1435 v.reset(OpPPC64MOVDconst)
1436 v.AuxInt = int64ToAuxInt(int64(val))
1440 func rewriteValuePPC64_OpConst8(v *Value) bool {
1441 // match: (Const8 [val])
1442 // result: (MOVDconst [int64(val)])
1444 val := auxIntToInt8(v.AuxInt)
1445 v.reset(OpPPC64MOVDconst)
1446 v.AuxInt = int64ToAuxInt(int64(val))
1450 func rewriteValuePPC64_OpConstBool(v *Value) bool {
1451 // match: (ConstBool [t])
1452 // result: (MOVDconst [b2i(t)])
1454 t := auxIntToBool(v.AuxInt)
1455 v.reset(OpPPC64MOVDconst)
1456 v.AuxInt = int64ToAuxInt(b2i(t))
1460 func rewriteValuePPC64_OpConstNil(v *Value) bool {
1461 // match: (ConstNil)
1462 // result: (MOVDconst [0])
1464 v.reset(OpPPC64MOVDconst)
1465 v.AuxInt = int64ToAuxInt(0)
1469 func rewriteValuePPC64_OpCopysign(v *Value) bool {
1472 // match: (Copysign x y)
1473 // result: (FCPSGN y x)
1477 v.reset(OpPPC64FCPSGN)
1482 func rewriteValuePPC64_OpCtz16(v *Value) bool {
1485 typ := &b.Func.Config.Types
1487 // result: (POPCNTW (MOVHZreg (ANDN <typ.Int16> (ADDconst <typ.Int16> [-1] x) x)))
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)
1502 func rewriteValuePPC64_OpCtz32(v *Value) bool {
1505 typ := &b.Func.Config.Types
1507 // cond: buildcfg.GOPPC64<=8
1508 // result: (POPCNTW (MOVWZreg (ANDN <typ.Int> (ADDconst <typ.Int> [-1] x) x)))
1511 if !(buildcfg.GOPPC64 <= 8) {
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)
1526 // result: (CNTTZW (MOVWZreg x))
1529 v.reset(OpPPC64CNTTZW)
1530 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
1536 func rewriteValuePPC64_OpCtz64(v *Value) bool {
1539 typ := &b.Func.Config.Types
1541 // cond: buildcfg.GOPPC64<=8
1542 // result: (POPCNTD (ANDN <typ.Int64> (ADDconst <typ.Int64> [-1] x) x))
1545 if !(buildcfg.GOPPC64 <= 8) {
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)
1558 // result: (CNTTZD x)
1561 v.reset(OpPPC64CNTTZD)
1566 func rewriteValuePPC64_OpCtz8(v *Value) bool {
1569 typ := &b.Func.Config.Types
1571 // result: (POPCNTB (MOVBZreg (ANDN <typ.UInt8> (ADDconst <typ.UInt8> [-1] x) x)))
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)
1586 func rewriteValuePPC64_OpCvt32Fto32(v *Value) bool {
1589 typ := &b.Func.Config.Types
1590 // match: (Cvt32Fto32 x)
1591 // result: (MFVSRD (FCTIWZ x))
1594 v.reset(OpPPC64MFVSRD)
1595 v0 := b.NewValue0(v.Pos, OpPPC64FCTIWZ, typ.Float64)
1601 func rewriteValuePPC64_OpCvt32Fto64(v *Value) bool {
1604 typ := &b.Func.Config.Types
1605 // match: (Cvt32Fto64 x)
1606 // result: (MFVSRD (FCTIDZ x))
1609 v.reset(OpPPC64MFVSRD)
1610 v0 := b.NewValue0(v.Pos, OpPPC64FCTIDZ, typ.Float64)
1616 func rewriteValuePPC64_OpCvt32to32F(v *Value) bool {
1619 typ := &b.Func.Config.Types
1620 // match: (Cvt32to32F x)
1621 // result: (FCFIDS (MTVSRD (SignExt32to64 x)))
1624 v.reset(OpPPC64FCFIDS)
1625 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1626 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
1633 func rewriteValuePPC64_OpCvt32to64F(v *Value) bool {
1636 typ := &b.Func.Config.Types
1637 // match: (Cvt32to64F x)
1638 // result: (FCFID (MTVSRD (SignExt32to64 x)))
1641 v.reset(OpPPC64FCFID)
1642 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1643 v1 := b.NewValue0(v.Pos, OpSignExt32to64, typ.Int64)
1650 func rewriteValuePPC64_OpCvt64Fto32(v *Value) bool {
1653 typ := &b.Func.Config.Types
1654 // match: (Cvt64Fto32 x)
1655 // result: (MFVSRD (FCTIWZ x))
1658 v.reset(OpPPC64MFVSRD)
1659 v0 := b.NewValue0(v.Pos, OpPPC64FCTIWZ, typ.Float64)
1665 func rewriteValuePPC64_OpCvt64Fto64(v *Value) bool {
1668 typ := &b.Func.Config.Types
1669 // match: (Cvt64Fto64 x)
1670 // result: (MFVSRD (FCTIDZ x))
1673 v.reset(OpPPC64MFVSRD)
1674 v0 := b.NewValue0(v.Pos, OpPPC64FCTIDZ, typ.Float64)
1680 func rewriteValuePPC64_OpCvt64to32F(v *Value) bool {
1683 typ := &b.Func.Config.Types
1684 // match: (Cvt64to32F x)
1685 // result: (FCFIDS (MTVSRD x))
1688 v.reset(OpPPC64FCFIDS)
1689 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1695 func rewriteValuePPC64_OpCvt64to64F(v *Value) bool {
1698 typ := &b.Func.Config.Types
1699 // match: (Cvt64to64F x)
1700 // result: (FCFID (MTVSRD x))
1703 v.reset(OpPPC64FCFID)
1704 v0 := b.NewValue0(v.Pos, OpPPC64MTVSRD, typ.Float64)
1710 func rewriteValuePPC64_OpDiv16(v *Value) bool {
1714 typ := &b.Func.Config.Types
1715 // match: (Div16 [false] x y)
1716 // result: (DIVW (SignExt16to32 x) (SignExt16to32 y))
1718 if auxIntToBool(v.AuxInt) != false {
1723 v.reset(OpPPC64DIVW)
1724 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1726 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1733 func rewriteValuePPC64_OpDiv16u(v *Value) bool {
1737 typ := &b.Func.Config.Types
1738 // match: (Div16u x y)
1739 // result: (DIVWU (ZeroExt16to32 x) (ZeroExt16to32 y))
1743 v.reset(OpPPC64DIVWU)
1744 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1746 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1752 func rewriteValuePPC64_OpDiv32(v *Value) bool {
1755 // match: (Div32 [false] x y)
1756 // result: (DIVW x y)
1758 if auxIntToBool(v.AuxInt) != false {
1763 v.reset(OpPPC64DIVW)
1769 func rewriteValuePPC64_OpDiv64(v *Value) bool {
1772 // match: (Div64 [false] x y)
1773 // result: (DIVD x y)
1775 if auxIntToBool(v.AuxInt) != false {
1780 v.reset(OpPPC64DIVD)
1786 func rewriteValuePPC64_OpDiv8(v *Value) bool {
1790 typ := &b.Func.Config.Types
1791 // match: (Div8 x y)
1792 // result: (DIVW (SignExt8to32 x) (SignExt8to32 y))
1796 v.reset(OpPPC64DIVW)
1797 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1799 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1805 func rewriteValuePPC64_OpDiv8u(v *Value) bool {
1809 typ := &b.Func.Config.Types
1810 // match: (Div8u x y)
1811 // result: (DIVWU (ZeroExt8to32 x) (ZeroExt8to32 y))
1815 v.reset(OpPPC64DIVWU)
1816 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1818 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1824 func rewriteValuePPC64_OpEq16(v *Value) bool {
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)))
1833 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1836 if !(x.Type.IsSigned() && y.Type.IsSigned()) {
1839 v.reset(OpPPC64Equal)
1840 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1841 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1843 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
1851 // match: (Eq16 x y)
1852 // result: (Equal (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
1856 v.reset(OpPPC64Equal)
1857 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1858 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1860 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
1867 func rewriteValuePPC64_OpEq32(v *Value) bool {
1871 // match: (Eq32 x y)
1872 // result: (Equal (CMPW x y))
1876 v.reset(OpPPC64Equal)
1877 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1883 func rewriteValuePPC64_OpEq32F(v *Value) bool {
1887 // match: (Eq32F x y)
1888 // result: (Equal (FCMPU x y))
1892 v.reset(OpPPC64Equal)
1893 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
1899 func rewriteValuePPC64_OpEq64(v *Value) bool {
1903 // match: (Eq64 x y)
1904 // result: (Equal (CMP x y))
1908 v.reset(OpPPC64Equal)
1909 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
1915 func rewriteValuePPC64_OpEq64F(v *Value) bool {
1919 // match: (Eq64F x y)
1920 // result: (Equal (FCMPU x y))
1924 v.reset(OpPPC64Equal)
1925 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
1931 func rewriteValuePPC64_OpEq8(v *Value) bool {
1935 typ := &b.Func.Config.Types
1937 // cond: x.Type.IsSigned() && y.Type.IsSigned()
1938 // result: (Equal (CMPW (SignExt8to32 x) (SignExt8to32 y)))
1940 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
1943 if !(x.Type.IsSigned() && y.Type.IsSigned()) {
1946 v.reset(OpPPC64Equal)
1947 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1948 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1950 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
1959 // result: (Equal (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
1963 v.reset(OpPPC64Equal)
1964 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
1965 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1967 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
1974 func rewriteValuePPC64_OpEqB(v *Value) bool {
1978 typ := &b.Func.Config.Types
1980 // result: (Select0 <typ.Int> (ANDCCconst [1] (EQV x y)))
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)
1995 func rewriteValuePPC64_OpEqPtr(v *Value) bool {
1999 // match: (EqPtr x y)
2000 // result: (Equal (CMP x y))
2004 v.reset(OpPPC64Equal)
2005 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2011 func rewriteValuePPC64_OpIsInBounds(v *Value) bool {
2015 // match: (IsInBounds idx len)
2016 // result: (LessThan (CMPU idx len))
2020 v.reset(OpPPC64LessThan)
2021 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2022 v0.AddArg2(idx, len)
2027 func rewriteValuePPC64_OpIsNonNil(v *Value) bool {
2030 // match: (IsNonNil ptr)
2031 // result: (NotEqual (CMPconst [0] ptr))
2034 v.reset(OpPPC64NotEqual)
2035 v0 := b.NewValue0(v.Pos, OpPPC64CMPconst, types.TypeFlags)
2036 v0.AuxInt = int64ToAuxInt(0)
2042 func rewriteValuePPC64_OpIsSliceInBounds(v *Value) bool {
2046 // match: (IsSliceInBounds idx len)
2047 // result: (LessEqual (CMPU idx len))
2051 v.reset(OpPPC64LessEqual)
2052 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2053 v0.AddArg2(idx, len)
2058 func rewriteValuePPC64_OpLeq16(v *Value) bool {
2062 typ := &b.Func.Config.Types
2063 // match: (Leq16 x y)
2064 // result: (LessEqual (CMPW (SignExt16to32 x) (SignExt16to32 y)))
2068 v.reset(OpPPC64LessEqual)
2069 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2070 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2072 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2079 func rewriteValuePPC64_OpLeq16U(v *Value) bool {
2083 typ := &b.Func.Config.Types
2084 // match: (Leq16U x y)
2085 // result: (LessEqual (CMPWU (ZeroExt16to32 x) (ZeroExt16to32 y)))
2089 v.reset(OpPPC64LessEqual)
2090 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2091 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2093 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2100 func rewriteValuePPC64_OpLeq32(v *Value) bool {
2104 // match: (Leq32 x y)
2105 // result: (LessEqual (CMPW x y))
2109 v.reset(OpPPC64LessEqual)
2110 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2116 func rewriteValuePPC64_OpLeq32F(v *Value) bool {
2120 // match: (Leq32F x y)
2121 // result: (FLessEqual (FCMPU x y))
2125 v.reset(OpPPC64FLessEqual)
2126 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2132 func rewriteValuePPC64_OpLeq32U(v *Value) bool {
2136 // match: (Leq32U x y)
2137 // result: (LessEqual (CMPWU x y))
2141 v.reset(OpPPC64LessEqual)
2142 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2148 func rewriteValuePPC64_OpLeq64(v *Value) bool {
2152 // match: (Leq64 x y)
2153 // result: (LessEqual (CMP x y))
2157 v.reset(OpPPC64LessEqual)
2158 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2164 func rewriteValuePPC64_OpLeq64F(v *Value) bool {
2168 // match: (Leq64F x y)
2169 // result: (FLessEqual (FCMPU x y))
2173 v.reset(OpPPC64FLessEqual)
2174 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2180 func rewriteValuePPC64_OpLeq64U(v *Value) bool {
2184 // match: (Leq64U x y)
2185 // result: (LessEqual (CMPU x y))
2189 v.reset(OpPPC64LessEqual)
2190 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2196 func rewriteValuePPC64_OpLeq8(v *Value) bool {
2200 typ := &b.Func.Config.Types
2201 // match: (Leq8 x y)
2202 // result: (LessEqual (CMPW (SignExt8to32 x) (SignExt8to32 y)))
2206 v.reset(OpPPC64LessEqual)
2207 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2208 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2210 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2217 func rewriteValuePPC64_OpLeq8U(v *Value) bool {
2221 typ := &b.Func.Config.Types
2222 // match: (Leq8U x y)
2223 // result: (LessEqual (CMPWU (ZeroExt8to32 x) (ZeroExt8to32 y)))
2227 v.reset(OpPPC64LessEqual)
2228 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2229 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2231 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2238 func rewriteValuePPC64_OpLess16(v *Value) bool {
2242 typ := &b.Func.Config.Types
2243 // match: (Less16 x y)
2244 // result: (LessThan (CMPW (SignExt16to32 x) (SignExt16to32 y)))
2248 v.reset(OpPPC64LessThan)
2249 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2250 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2252 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
2259 func rewriteValuePPC64_OpLess16U(v *Value) bool {
2263 typ := &b.Func.Config.Types
2264 // match: (Less16U x y)
2265 // result: (LessThan (CMPWU (ZeroExt16to32 x) (ZeroExt16to32 y)))
2269 v.reset(OpPPC64LessThan)
2270 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2271 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2273 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
2280 func rewriteValuePPC64_OpLess32(v *Value) bool {
2284 // match: (Less32 x y)
2285 // result: (LessThan (CMPW x y))
2289 v.reset(OpPPC64LessThan)
2290 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2296 func rewriteValuePPC64_OpLess32F(v *Value) bool {
2300 // match: (Less32F x y)
2301 // result: (FLessThan (FCMPU x y))
2305 v.reset(OpPPC64FLessThan)
2306 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2312 func rewriteValuePPC64_OpLess32U(v *Value) bool {
2316 // match: (Less32U x y)
2317 // result: (LessThan (CMPWU x y))
2321 v.reset(OpPPC64LessThan)
2322 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2328 func rewriteValuePPC64_OpLess64(v *Value) bool {
2332 // match: (Less64 x y)
2333 // result: (LessThan (CMP x y))
2337 v.reset(OpPPC64LessThan)
2338 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
2344 func rewriteValuePPC64_OpLess64F(v *Value) bool {
2348 // match: (Less64F x y)
2349 // result: (FLessThan (FCMPU x y))
2353 v.reset(OpPPC64FLessThan)
2354 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
2360 func rewriteValuePPC64_OpLess64U(v *Value) bool {
2364 // match: (Less64U x y)
2365 // result: (LessThan (CMPU x y))
2369 v.reset(OpPPC64LessThan)
2370 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
2376 func rewriteValuePPC64_OpLess8(v *Value) bool {
2380 typ := &b.Func.Config.Types
2381 // match: (Less8 x y)
2382 // result: (LessThan (CMPW (SignExt8to32 x) (SignExt8to32 y)))
2386 v.reset(OpPPC64LessThan)
2387 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
2388 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2390 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
2397 func rewriteValuePPC64_OpLess8U(v *Value) bool {
2401 typ := &b.Func.Config.Types
2402 // match: (Less8U x y)
2403 // result: (LessThan (CMPWU (ZeroExt8to32 x) (ZeroExt8to32 y)))
2407 v.reset(OpPPC64LessThan)
2408 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
2409 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2411 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
2418 func rewriteValuePPC64_OpLoad(v *Value) bool {
2422 typ := &b.Func.Config.Types
2423 // match: (Load <t> ptr mem)
2424 // cond: (is64BitInt(t) || isPtr(t))
2425 // result: (MOVDload ptr mem)
2430 if !(is64BitInt(t) || isPtr(t)) {
2433 v.reset(OpPPC64MOVDload)
2437 // match: (Load <t> ptr mem)
2438 // cond: is32BitInt(t) && t.IsSigned()
2439 // result: (MOVWload ptr mem)
2444 if !(is32BitInt(t) && t.IsSigned()) {
2447 v.reset(OpPPC64MOVWload)
2451 // match: (Load <t> ptr mem)
2452 // cond: is32BitInt(t) && !t.IsSigned()
2453 // result: (MOVWZload ptr mem)
2458 if !(is32BitInt(t) && !t.IsSigned()) {
2461 v.reset(OpPPC64MOVWZload)
2465 // match: (Load <t> ptr mem)
2466 // cond: is16BitInt(t) && t.IsSigned()
2467 // result: (MOVHload ptr mem)
2472 if !(is16BitInt(t) && t.IsSigned()) {
2475 v.reset(OpPPC64MOVHload)
2479 // match: (Load <t> ptr mem)
2480 // cond: is16BitInt(t) && !t.IsSigned()
2481 // result: (MOVHZload ptr mem)
2486 if !(is16BitInt(t) && !t.IsSigned()) {
2489 v.reset(OpPPC64MOVHZload)
2493 // match: (Load <t> ptr mem)
2494 // cond: t.IsBoolean()
2495 // result: (MOVBZload ptr mem)
2500 if !(t.IsBoolean()) {
2503 v.reset(OpPPC64MOVBZload)
2507 // match: (Load <t> ptr mem)
2508 // cond: is8BitInt(t) && t.IsSigned()
2509 // result: (MOVBreg (MOVBZload ptr mem))
2514 if !(is8BitInt(t) && t.IsSigned()) {
2517 v.reset(OpPPC64MOVBreg)
2518 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
2519 v0.AddArg2(ptr, mem)
2523 // match: (Load <t> ptr mem)
2524 // cond: is8BitInt(t) && !t.IsSigned()
2525 // result: (MOVBZload ptr mem)
2530 if !(is8BitInt(t) && !t.IsSigned()) {
2533 v.reset(OpPPC64MOVBZload)
2537 // match: (Load <t> ptr mem)
2538 // cond: is32BitFloat(t)
2539 // result: (FMOVSload ptr mem)
2544 if !(is32BitFloat(t)) {
2547 v.reset(OpPPC64FMOVSload)
2551 // match: (Load <t> ptr mem)
2552 // cond: is64BitFloat(t)
2553 // result: (FMOVDload ptr mem)
2558 if !(is64BitFloat(t)) {
2561 v.reset(OpPPC64FMOVDload)
2567 func rewriteValuePPC64_OpLocalAddr(v *Value) bool {
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))
2577 sym := auxToSym(v.Aux)
2580 if !(t.Elem().HasPointers()) {
2583 v.reset(OpPPC64MOVDaddr)
2584 v.Aux = symToAux(sym)
2585 v0 := b.NewValue0(v.Pos, OpSPanchored, typ.Uintptr)
2586 v0.AddArg2(base, mem)
2590 // match: (LocalAddr <t> {sym} base _)
2591 // cond: !t.Elem().HasPointers()
2592 // result: (MOVDaddr {sym} base)
2595 sym := auxToSym(v.Aux)
2597 if !(!t.Elem().HasPointers()) {
2600 v.reset(OpPPC64MOVDaddr)
2601 v.Aux = symToAux(sym)
2607 func rewriteValuePPC64_OpLsh16x16(v *Value) bool {
2611 typ := &b.Func.Config.Types
2612 // match: (Lsh16x16 x y)
2613 // cond: shiftIsBounded(v)
2614 // result: (SLD x y)
2618 if !(shiftIsBounded(v)) {
2625 // match: (Lsh16x16 <t> x y)
2626 // result: (ISEL [2] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y)))
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)
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)
2644 v.AddArg3(v0, v2, v3)
2648 func rewriteValuePPC64_OpLsh16x32(v *Value) bool {
2652 typ := &b.Func.Config.Types
2653 // match: (Lsh16x32 x y)
2654 // cond: shiftIsBounded(v)
2655 // result: (SLD x y)
2659 if !(shiftIsBounded(v)) {
2666 // match: (Lsh16x32 <t> x y)
2667 // result: (ISEL [0] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [16]))
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)
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)
2683 v.AddArg3(v0, v2, v3)
2687 func rewriteValuePPC64_OpLsh16x64(v *Value) bool {
2691 typ := &b.Func.Config.Types
2692 // match: (Lsh16x64 x (MOVDconst [c]))
2693 // cond: uint64(c) < 16
2694 // result: (SLWconst x [c])
2697 if v_1.Op != OpPPC64MOVDconst {
2700 c := auxIntToInt64(v_1.AuxInt)
2701 if !(uint64(c) < 16) {
2704 v.reset(OpPPC64SLWconst)
2705 v.AuxInt = int64ToAuxInt(c)
2709 // match: (Lsh16x64 x y)
2710 // cond: shiftIsBounded(v)
2711 // result: (SLD x y)
2715 if !(shiftIsBounded(v)) {
2722 // match: (Lsh16x64 <t> x y)
2723 // result: (ISEL [0] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [16]))
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)
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)
2739 v.AddArg3(v0, v2, v3)
2743 func rewriteValuePPC64_OpLsh16x8(v *Value) bool {
2747 typ := &b.Func.Config.Types
2748 // match: (Lsh16x8 x y)
2749 // cond: shiftIsBounded(v)
2750 // result: (SLD x y)
2754 if !(shiftIsBounded(v)) {
2761 // match: (Lsh16x8 <t> x y)
2762 // result: (ISEL [2] (SLD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y)))
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)
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)
2780 v.AddArg3(v0, v2, v3)
2784 func rewriteValuePPC64_OpLsh32x16(v *Value) bool {
2788 typ := &b.Func.Config.Types
2789 // match: (Lsh32x16 x y)
2790 // cond: shiftIsBounded(v)
2791 // result: (SLW x y)
2795 if !(shiftIsBounded(v)) {
2802 // match: (Lsh32x16 <t> x y)
2803 // result: (ISEL [2] (SLW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y)))
2808 v.reset(OpPPC64ISEL)
2809 v.AuxInt = int32ToAuxInt(2)
2810 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
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)
2819 v.AddArg3(v0, v1, v2)
2823 func rewriteValuePPC64_OpLsh32x32(v *Value) bool {
2827 typ := &b.Func.Config.Types
2828 // match: (Lsh32x32 x y)
2829 // cond: shiftIsBounded(v)
2830 // result: (SLW x y)
2834 if !(shiftIsBounded(v)) {
2841 // match: (Lsh32x32 <t> x y)
2842 // result: (ISEL [0] (SLW <t> x y) (MOVDconst [0]) (CMPWUconst y [32]))
2847 v.reset(OpPPC64ISEL)
2848 v.AuxInt = int32ToAuxInt(0)
2849 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
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)
2856 v.AddArg3(v0, v1, v2)
2860 func rewriteValuePPC64_OpLsh32x64(v *Value) bool {
2864 typ := &b.Func.Config.Types
2865 // match: (Lsh32x64 x (MOVDconst [c]))
2866 // cond: uint64(c) < 32
2867 // result: (SLWconst x [c])
2870 if v_1.Op != OpPPC64MOVDconst {
2873 c := auxIntToInt64(v_1.AuxInt)
2874 if !(uint64(c) < 32) {
2877 v.reset(OpPPC64SLWconst)
2878 v.AuxInt = int64ToAuxInt(c)
2882 // match: (Lsh32x64 x y)
2883 // cond: shiftIsBounded(v)
2884 // result: (SLW x y)
2888 if !(shiftIsBounded(v)) {
2895 // match: (Lsh32x64 <t> x y)
2896 // result: (ISEL [0] (SLW <t> x y) (MOVDconst [0]) (CMPUconst y [32]))
2901 v.reset(OpPPC64ISEL)
2902 v.AuxInt = int32ToAuxInt(0)
2903 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
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)
2910 v.AddArg3(v0, v1, v2)
2914 func rewriteValuePPC64_OpLsh32x8(v *Value) bool {
2918 typ := &b.Func.Config.Types
2919 // match: (Lsh32x8 x y)
2920 // cond: shiftIsBounded(v)
2921 // result: (SLW x y)
2925 if !(shiftIsBounded(v)) {
2932 // match: (Lsh32x8 <t> x y)
2933 // result: (ISEL [2] (SLW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y)))
2938 v.reset(OpPPC64ISEL)
2939 v.AuxInt = int32ToAuxInt(2)
2940 v0 := b.NewValue0(v.Pos, OpPPC64SLW, t)
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)
2949 v.AddArg3(v0, v1, v2)
2953 func rewriteValuePPC64_OpLsh64x16(v *Value) bool {
2957 typ := &b.Func.Config.Types
2958 // match: (Lsh64x16 x y)
2959 // cond: shiftIsBounded(v)
2960 // result: (SLD x y)
2964 if !(shiftIsBounded(v)) {
2971 // match: (Lsh64x16 <t> x y)
2972 // result: (ISEL [2] (SLD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y)))
2977 v.reset(OpPPC64ISEL)
2978 v.AuxInt = int32ToAuxInt(2)
2979 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
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)
2988 v.AddArg3(v0, v1, v2)
2992 func rewriteValuePPC64_OpLsh64x32(v *Value) bool {
2996 typ := &b.Func.Config.Types
2997 // match: (Lsh64x32 x y)
2998 // cond: shiftIsBounded(v)
2999 // result: (SLD x y)
3003 if !(shiftIsBounded(v)) {
3010 // match: (Lsh64x32 <t> x y)
3011 // result: (ISEL [0] (SLD <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
3016 v.reset(OpPPC64ISEL)
3017 v.AuxInt = int32ToAuxInt(0)
3018 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
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)
3025 v.AddArg3(v0, v1, v2)
3029 func rewriteValuePPC64_OpLsh64x64(v *Value) bool {
3033 typ := &b.Func.Config.Types
3034 // match: (Lsh64x64 x (MOVDconst [c]))
3035 // cond: uint64(c) < 64
3036 // result: (SLDconst x [c])
3039 if v_1.Op != OpPPC64MOVDconst {
3042 c := auxIntToInt64(v_1.AuxInt)
3043 if !(uint64(c) < 64) {
3046 v.reset(OpPPC64SLDconst)
3047 v.AuxInt = int64ToAuxInt(c)
3051 // match: (Lsh64x64 x y)
3052 // cond: shiftIsBounded(v)
3053 // result: (SLD x y)
3057 if !(shiftIsBounded(v)) {
3064 // match: (Lsh64x64 <t> x y)
3065 // result: (ISEL [0] (SLD <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
3070 v.reset(OpPPC64ISEL)
3071 v.AuxInt = int32ToAuxInt(0)
3072 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
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)
3079 v.AddArg3(v0, v1, v2)
3083 func rewriteValuePPC64_OpLsh64x8(v *Value) bool {
3087 typ := &b.Func.Config.Types
3088 // match: (Lsh64x8 x y)
3089 // cond: shiftIsBounded(v)
3090 // result: (SLD x y)
3094 if !(shiftIsBounded(v)) {
3101 // match: (Lsh64x8 <t> x y)
3102 // result: (ISEL [2] (SLD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y)))
3107 v.reset(OpPPC64ISEL)
3108 v.AuxInt = int32ToAuxInt(2)
3109 v0 := b.NewValue0(v.Pos, OpPPC64SLD, t)
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)
3118 v.AddArg3(v0, v1, v2)
3122 func rewriteValuePPC64_OpLsh8x16(v *Value) bool {
3126 typ := &b.Func.Config.Types
3127 // match: (Lsh8x16 x y)
3128 // cond: shiftIsBounded(v)
3129 // result: (SLD x y)
3133 if !(shiftIsBounded(v)) {
3140 // match: (Lsh8x16 <t> x y)
3141 // result: (ISEL [2] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y)))
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)
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)
3159 v.AddArg3(v0, v2, v3)
3163 func rewriteValuePPC64_OpLsh8x32(v *Value) bool {
3167 typ := &b.Func.Config.Types
3168 // match: (Lsh8x32 x y)
3169 // cond: shiftIsBounded(v)
3170 // result: (SLD x y)
3174 if !(shiftIsBounded(v)) {
3181 // match: (Lsh8x32 <t> x y)
3182 // result: (ISEL [0] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [8]))
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)
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)
3198 v.AddArg3(v0, v2, v3)
3202 func rewriteValuePPC64_OpLsh8x64(v *Value) bool {
3206 typ := &b.Func.Config.Types
3207 // match: (Lsh8x64 x (MOVDconst [c]))
3208 // cond: uint64(c) < 8
3209 // result: (SLWconst x [c])
3212 if v_1.Op != OpPPC64MOVDconst {
3215 c := auxIntToInt64(v_1.AuxInt)
3216 if !(uint64(c) < 8) {
3219 v.reset(OpPPC64SLWconst)
3220 v.AuxInt = int64ToAuxInt(c)
3224 // match: (Lsh8x64 x y)
3225 // cond: shiftIsBounded(v)
3226 // result: (SLD x y)
3230 if !(shiftIsBounded(v)) {
3237 // match: (Lsh8x64 <t> x y)
3238 // result: (ISEL [0] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [8]))
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)
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)
3254 v.AddArg3(v0, v2, v3)
3258 func rewriteValuePPC64_OpLsh8x8(v *Value) bool {
3262 typ := &b.Func.Config.Types
3263 // match: (Lsh8x8 x y)
3264 // cond: shiftIsBounded(v)
3265 // result: (SLD x y)
3269 if !(shiftIsBounded(v)) {
3276 // match: (Lsh8x8 <t> x y)
3277 // result: (ISEL [2] (SLD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y)))
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)
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)
3295 v.AddArg3(v0, v2, v3)
3299 func rewriteValuePPC64_OpMod16(v *Value) bool {
3303 typ := &b.Func.Config.Types
3304 // match: (Mod16 x y)
3305 // result: (Mod32 (SignExt16to32 x) (SignExt16to32 y))
3310 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3312 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3318 func rewriteValuePPC64_OpMod16u(v *Value) bool {
3322 typ := &b.Func.Config.Types
3323 // match: (Mod16u x y)
3324 // result: (Mod32u (ZeroExt16to32 x) (ZeroExt16to32 y))
3329 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3331 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3337 func rewriteValuePPC64_OpMod32(v *Value) bool {
3341 typ := &b.Func.Config.Types
3342 // match: (Mod32 x y)
3343 // cond: buildcfg.GOPPC64 >= 9
3344 // result: (MODSW x y)
3348 if !(buildcfg.GOPPC64 >= 9) {
3351 v.reset(OpPPC64MODSW)
3355 // match: (Mod32 x y)
3356 // cond: buildcfg.GOPPC64 <= 8
3357 // result: (SUB x (MULLW y (DIVW x y)))
3361 if !(buildcfg.GOPPC64 <= 8) {
3365 v0 := b.NewValue0(v.Pos, OpPPC64MULLW, typ.Int32)
3366 v1 := b.NewValue0(v.Pos, OpPPC64DIVW, typ.Int32)
3374 func rewriteValuePPC64_OpMod32u(v *Value) bool {
3378 typ := &b.Func.Config.Types
3379 // match: (Mod32u x y)
3380 // cond: buildcfg.GOPPC64 >= 9
3381 // result: (MODUW x y)
3385 if !(buildcfg.GOPPC64 >= 9) {
3388 v.reset(OpPPC64MODUW)
3392 // match: (Mod32u x y)
3393 // cond: buildcfg.GOPPC64 <= 8
3394 // result: (SUB x (MULLW y (DIVWU x y)))
3398 if !(buildcfg.GOPPC64 <= 8) {
3402 v0 := b.NewValue0(v.Pos, OpPPC64MULLW, typ.Int32)
3403 v1 := b.NewValue0(v.Pos, OpPPC64DIVWU, typ.Int32)
3411 func rewriteValuePPC64_OpMod64(v *Value) bool {
3415 typ := &b.Func.Config.Types
3416 // match: (Mod64 x y)
3417 // cond: buildcfg.GOPPC64 >=9
3418 // result: (MODSD x y)
3422 if !(buildcfg.GOPPC64 >= 9) {
3425 v.reset(OpPPC64MODSD)
3429 // match: (Mod64 x y)
3430 // cond: buildcfg.GOPPC64 <=8
3431 // result: (SUB x (MULLD y (DIVD x y)))
3435 if !(buildcfg.GOPPC64 <= 8) {
3439 v0 := b.NewValue0(v.Pos, OpPPC64MULLD, typ.Int64)
3440 v1 := b.NewValue0(v.Pos, OpPPC64DIVD, typ.Int64)
3448 func rewriteValuePPC64_OpMod64u(v *Value) bool {
3452 typ := &b.Func.Config.Types
3453 // match: (Mod64u x y)
3454 // cond: buildcfg.GOPPC64 >= 9
3455 // result: (MODUD x y)
3459 if !(buildcfg.GOPPC64 >= 9) {
3462 v.reset(OpPPC64MODUD)
3466 // match: (Mod64u x y)
3467 // cond: buildcfg.GOPPC64 <= 8
3468 // result: (SUB x (MULLD y (DIVDU x y)))
3472 if !(buildcfg.GOPPC64 <= 8) {
3476 v0 := b.NewValue0(v.Pos, OpPPC64MULLD, typ.Int64)
3477 v1 := b.NewValue0(v.Pos, OpPPC64DIVDU, typ.Int64)
3485 func rewriteValuePPC64_OpMod8(v *Value) bool {
3489 typ := &b.Func.Config.Types
3490 // match: (Mod8 x y)
3491 // result: (Mod32 (SignExt8to32 x) (SignExt8to32 y))
3496 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3498 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3504 func rewriteValuePPC64_OpMod8u(v *Value) bool {
3508 typ := &b.Func.Config.Types
3509 // match: (Mod8u x y)
3510 // result: (Mod32u (ZeroExt8to32 x) (ZeroExt8to32 y))
3515 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3517 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3523 func rewriteValuePPC64_OpMove(v *Value) bool {
3528 typ := &b.Func.Config.Types
3529 // match: (Move [0] _ _ mem)
3532 if auxIntToInt64(v.AuxInt) != 0 {
3539 // match: (Move [1] dst src mem)
3540 // result: (MOVBstore dst (MOVBZload src mem) mem)
3542 if auxIntToInt64(v.AuxInt) != 1 {
3548 v.reset(OpPPC64MOVBstore)
3549 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZload, typ.UInt8)
3550 v0.AddArg2(src, mem)
3551 v.AddArg3(dst, v0, mem)
3554 // match: (Move [2] dst src mem)
3555 // result: (MOVHstore dst (MOVHZload src mem) mem)
3557 if auxIntToInt64(v.AuxInt) != 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)
3569 // match: (Move [4] dst src mem)
3570 // result: (MOVWstore dst (MOVWZload src mem) mem)
3572 if auxIntToInt64(v.AuxInt) != 4 {
3578 v.reset(OpPPC64MOVWstore)
3579 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZload, typ.UInt32)
3580 v0.AddArg2(src, mem)
3581 v.AddArg3(dst, v0, mem)
3584 // match: (Move [8] {t} dst src mem)
3585 // result: (MOVDstore dst (MOVDload src mem) mem)
3587 if auxIntToInt64(v.AuxInt) != 8 {
3593 v.reset(OpPPC64MOVDstore)
3594 v0 := b.NewValue0(v.Pos, OpPPC64MOVDload, typ.Int64)
3595 v0.AddArg2(src, mem)
3596 v.AddArg3(dst, v0, mem)
3599 // match: (Move [3] dst src mem)
3600 // result: (MOVBstore [2] dst (MOVBZload [2] src mem) (MOVHstore dst (MOVHload src mem) mem))
3602 if auxIntToInt64(v.AuxInt) != 3 {
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)
3620 // match: (Move [5] dst src mem)
3621 // result: (MOVBstore [4] dst (MOVBZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3623 if auxIntToInt64(v.AuxInt) != 5 {
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)
3641 // match: (Move [6] dst src mem)
3642 // result: (MOVHstore [4] dst (MOVHZload [4] src mem) (MOVWstore dst (MOVWZload src mem) mem))
3644 if auxIntToInt64(v.AuxInt) != 6 {
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)
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)))
3665 if auxIntToInt64(v.AuxInt) != 7 {
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)
3689 // match: (Move [s] dst src mem)
3690 // cond: s > 8 && buildcfg.GOPPC64 <= 8 && logLargeCopy(v, s)
3691 // result: (LoweredMove [s] dst src mem)
3693 s := auxIntToInt64(v.AuxInt)
3697 if !(s > 8 && buildcfg.GOPPC64 <= 8 && logLargeCopy(v, s)) {
3700 v.reset(OpPPC64LoweredMove)
3701 v.AuxInt = int64ToAuxInt(s)
3702 v.AddArg3(dst, src, mem)
3705 // match: (Move [s] dst src mem)
3706 // cond: s > 8 && s <= 64 && buildcfg.GOPPC64 >= 9
3707 // result: (LoweredQuadMoveShort [s] dst src mem)
3709 s := auxIntToInt64(v.AuxInt)
3713 if !(s > 8 && s <= 64 && buildcfg.GOPPC64 >= 9) {
3716 v.reset(OpPPC64LoweredQuadMoveShort)
3717 v.AuxInt = int64ToAuxInt(s)
3718 v.AddArg3(dst, src, mem)
3721 // match: (Move [s] dst src mem)
3722 // cond: s > 8 && buildcfg.GOPPC64 >= 9 && logLargeCopy(v, s)
3723 // result: (LoweredQuadMove [s] dst src mem)
3725 s := auxIntToInt64(v.AuxInt)
3729 if !(s > 8 && buildcfg.GOPPC64 >= 9 && logLargeCopy(v, s)) {
3732 v.reset(OpPPC64LoweredQuadMove)
3733 v.AuxInt = int64ToAuxInt(s)
3734 v.AddArg3(dst, src, mem)
3739 func rewriteValuePPC64_OpNeq16(v *Value) bool {
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)))
3748 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3751 if !(x.Type.IsSigned() && y.Type.IsSigned()) {
3754 v.reset(OpPPC64NotEqual)
3755 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3756 v1 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3758 v2 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
3766 // match: (Neq16 x y)
3767 // result: (NotEqual (CMPW (ZeroExt16to32 x) (ZeroExt16to32 y)))
3771 v.reset(OpPPC64NotEqual)
3772 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3773 v1 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3775 v2 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
3782 func rewriteValuePPC64_OpNeq32(v *Value) bool {
3786 // match: (Neq32 x y)
3787 // result: (NotEqual (CMPW x y))
3791 v.reset(OpPPC64NotEqual)
3792 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3798 func rewriteValuePPC64_OpNeq32F(v *Value) bool {
3802 // match: (Neq32F x y)
3803 // result: (NotEqual (FCMPU x y))
3807 v.reset(OpPPC64NotEqual)
3808 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
3814 func rewriteValuePPC64_OpNeq64(v *Value) bool {
3818 // match: (Neq64 x y)
3819 // result: (NotEqual (CMP x y))
3823 v.reset(OpPPC64NotEqual)
3824 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
3830 func rewriteValuePPC64_OpNeq64F(v *Value) bool {
3834 // match: (Neq64F x y)
3835 // result: (NotEqual (FCMPU x y))
3839 v.reset(OpPPC64NotEqual)
3840 v0 := b.NewValue0(v.Pos, OpPPC64FCMPU, types.TypeFlags)
3846 func rewriteValuePPC64_OpNeq8(v *Value) bool {
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)))
3855 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3858 if !(x.Type.IsSigned() && y.Type.IsSigned()) {
3861 v.reset(OpPPC64NotEqual)
3862 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3863 v1 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3865 v2 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
3873 // match: (Neq8 x y)
3874 // result: (NotEqual (CMPW (ZeroExt8to32 x) (ZeroExt8to32 y)))
3878 v.reset(OpPPC64NotEqual)
3879 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
3880 v1 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3882 v2 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
3889 func rewriteValuePPC64_OpNeqPtr(v *Value) bool {
3893 // match: (NeqPtr x y)
3894 // result: (NotEqual (CMP x y))
3898 v.reset(OpPPC64NotEqual)
3899 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
3905 func rewriteValuePPC64_OpNot(v *Value) bool {
3908 // result: (XORconst [1] x)
3911 v.reset(OpPPC64XORconst)
3912 v.AuxInt = int64ToAuxInt(1)
3917 func rewriteValuePPC64_OpOffPtr(v *Value) bool {
3920 typ := &b.Func.Config.Types
3921 // match: (OffPtr [off] ptr)
3922 // result: (ADD (MOVDconst <typ.Int64> [off]) ptr)
3924 off := auxIntToInt64(v.AuxInt)
3927 v0 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
3928 v0.AuxInt = int64ToAuxInt(off)
3933 func rewriteValuePPC64_OpPPC64ADD(v *Value) bool {
3936 // match: (ADD l:(MULLD x y) z)
3937 // cond: buildcfg.GOPPC64 >= 9 && l.Uses == 1 && clobber(l)
3938 // result: (MADDLD x y z)
3940 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3942 if l.Op != OpPPC64MULLD {
3948 if !(buildcfg.GOPPC64 >= 9 && l.Uses == 1 && clobber(l)) {
3951 v.reset(OpPPC64MADDLD)
3957 // match: (ADD x (MOVDconst <t> [c]))
3958 // cond: is32Bit(c) && !t.IsPtr()
3959 // result: (ADDconst [c] x)
3961 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
3963 if v_1.Op != OpPPC64MOVDconst {
3967 c := auxIntToInt64(v_1.AuxInt)
3968 if !(is32Bit(c) && !t.IsPtr()) {
3971 v.reset(OpPPC64ADDconst)
3972 v.AuxInt = int64ToAuxInt(c)
3980 func rewriteValuePPC64_OpPPC64ADDE(v *Value) bool {
3985 typ := &b.Func.Config.Types
3986 // match: (ADDE x y (Select1 <typ.UInt64> (ADDCconst (MOVDconst [0]) [-1])))
3987 // result: (ADDC x y)
3991 if v_2.Op != OpSelect1 || v_2.Type != typ.UInt64 {
3994 v_2_0 := v_2.Args[0]
3995 if v_2_0.Op != OpPPC64ADDCconst || auxIntToInt64(v_2_0.AuxInt) != -1 {
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 {
4002 v.reset(OpPPC64ADDC)
4008 func rewriteValuePPC64_OpPPC64ADDconst(v *Value) bool {
4010 // match: (ADDconst [c] (ADDconst [d] x))
4011 // cond: is32Bit(c+d)
4012 // result: (ADDconst [c+d] x)
4014 c := auxIntToInt64(v.AuxInt)
4015 if v_0.Op != OpPPC64ADDconst {
4018 d := auxIntToInt64(v_0.AuxInt)
4020 if !(is32Bit(c + d)) {
4023 v.reset(OpPPC64ADDconst)
4024 v.AuxInt = int64ToAuxInt(c + d)
4028 // match: (ADDconst [0] x)
4031 if auxIntToInt64(v.AuxInt) != 0 {
4038 // match: (ADDconst [c] (MOVDaddr [d] {sym} x))
4039 // cond: is32Bit(c+int64(d))
4040 // result: (MOVDaddr [int32(c+int64(d))] {sym} x)
4042 c := auxIntToInt64(v.AuxInt)
4043 if v_0.Op != OpPPC64MOVDaddr {
4046 d := auxIntToInt32(v_0.AuxInt)
4047 sym := auxToSym(v_0.Aux)
4049 if !(is32Bit(c + int64(d))) {
4052 v.reset(OpPPC64MOVDaddr)
4053 v.AuxInt = int32ToAuxInt(int32(c + int64(d)))
4054 v.Aux = symToAux(sym)
4058 // match: (ADDconst [c] x:(SP))
4060 // result: (MOVDaddr [int32(c)] x)
4062 c := auxIntToInt64(v.AuxInt)
4064 if x.Op != OpSP || !(is32Bit(c)) {
4067 v.reset(OpPPC64MOVDaddr)
4068 v.AuxInt = int32ToAuxInt(int32(c))
4072 // match: (ADDconst [c] (SUBFCconst [d] x))
4073 // cond: is32Bit(c+d)
4074 // result: (SUBFCconst [c+d] x)
4076 c := auxIntToInt64(v.AuxInt)
4077 if v_0.Op != OpPPC64SUBFCconst {
4080 d := auxIntToInt64(v_0.AuxInt)
4082 if !(is32Bit(c + d)) {
4085 v.reset(OpPPC64SUBFCconst)
4086 v.AuxInt = int64ToAuxInt(c + d)
4092 func rewriteValuePPC64_OpPPC64AND(v *Value) bool {
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)
4101 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4102 if v_0.Op != OpPPC64MOVDconst {
4105 m := auxIntToInt64(v_0.AuxInt)
4106 if v_1.Op != OpPPC64ROTLWconst {
4109 r := auxIntToInt64(v_1.AuxInt)
4111 if !(isPPC64WordRotateMask(m)) {
4114 v.reset(OpPPC64RLWINM)
4115 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, m, 32))
4121 // match: (AND (MOVDconst [m]) (ROTLW x r))
4122 // cond: isPPC64WordRotateMask(m)
4123 // result: (RLWNM [encodePPC64RotateMask(0,m,32)] x r)
4125 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4126 if v_0.Op != OpPPC64MOVDconst {
4129 m := auxIntToInt64(v_0.AuxInt)
4130 if v_1.Op != OpPPC64ROTLW {
4135 if !(isPPC64WordRotateMask(m)) {
4138 v.reset(OpPPC64RLWNM)
4139 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32))
4145 // match: (AND (MOVDconst [m]) (SRWconst x [s]))
4146 // cond: mergePPC64RShiftMask(m,s,32) == 0
4147 // result: (MOVDconst [0])
4149 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4150 if v_0.Op != OpPPC64MOVDconst {
4153 m := auxIntToInt64(v_0.AuxInt)
4154 if v_1.Op != OpPPC64SRWconst {
4157 s := auxIntToInt64(v_1.AuxInt)
4158 if !(mergePPC64RShiftMask(m, s, 32) == 0) {
4161 v.reset(OpPPC64MOVDconst)
4162 v.AuxInt = int64ToAuxInt(0)
4167 // match: (AND (MOVDconst [m]) (SRWconst x [s]))
4168 // cond: mergePPC64AndSrwi(m,s) != 0
4169 // result: (RLWINM [mergePPC64AndSrwi(m,s)] x)
4171 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4172 if v_0.Op != OpPPC64MOVDconst {
4175 m := auxIntToInt64(v_0.AuxInt)
4176 if v_1.Op != OpPPC64SRWconst {
4179 s := auxIntToInt64(v_1.AuxInt)
4181 if !(mergePPC64AndSrwi(m, s) != 0) {
4184 v.reset(OpPPC64RLWINM)
4185 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m, s))
4191 // match: (AND x (NOR y y))
4192 // result: (ANDN x y)
4194 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4196 if v_1.Op != OpPPC64NOR {
4200 if y != v_1.Args[0] {
4203 v.reset(OpPPC64ANDN)
4209 // match: (AND (MOVDconst [c]) (MOVDconst [d]))
4210 // result: (MOVDconst [c&d])
4212 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4213 if v_0.Op != OpPPC64MOVDconst {
4216 c := auxIntToInt64(v_0.AuxInt)
4217 if v_1.Op != OpPPC64MOVDconst {
4220 d := auxIntToInt64(v_1.AuxInt)
4221 v.reset(OpPPC64MOVDconst)
4222 v.AuxInt = int64ToAuxInt(c & d)
4227 // match: (AND x (MOVDconst [-1]))
4230 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4232 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
4240 // match: (AND x (MOVDconst [c]))
4241 // cond: isU16Bit(c)
4242 // result: (Select0 (ANDCCconst [c] x))
4244 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4246 if v_1.Op != OpPPC64MOVDconst {
4249 c := auxIntToInt64(v_1.AuxInt)
4254 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
4255 v0.AuxInt = int64ToAuxInt(c)
4262 // match: (AND (MOVDconst [c]) y:(MOVWZreg _))
4263 // cond: c&0xFFFFFFFF == 0xFFFFFFFF
4266 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4267 if v_0.Op != OpPPC64MOVDconst {
4270 c := auxIntToInt64(v_0.AuxInt)
4272 if y.Op != OpPPC64MOVWZreg || !(c&0xFFFFFFFF == 0xFFFFFFFF) {
4280 // match: (AND (MOVDconst [0xFFFFFFFF]) y:(MOVWreg x))
4281 // result: (MOVWZreg x)
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 {
4288 if y.Op != OpPPC64MOVWreg {
4292 v.reset(OpPPC64MOVWZreg)
4298 // match: (AND (MOVDconst [c]) x:(MOVBZload _ _))
4299 // result: (Select0 (ANDCCconst [c&0xFF] x))
4301 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
4302 if v_0.Op != OpPPC64MOVDconst {
4305 c := auxIntToInt64(v_0.AuxInt)
4307 if x.Op != OpPPC64MOVBZload {
4311 v0 := b.NewValue0(x.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
4312 v0.AuxInt = int64ToAuxInt(c & 0xFF)
4321 func rewriteValuePPC64_OpPPC64ANDCCconst(v *Value) bool {
4323 // match: (ANDCCconst [c] (Select0 (ANDCCconst [d] x)))
4324 // result: (ANDCCconst [c&d] x)
4326 c := auxIntToInt64(v.AuxInt)
4327 if v_0.Op != OpSelect0 {
4330 v_0_0 := v_0.Args[0]
4331 if v_0_0.Op != OpPPC64ANDCCconst {
4334 d := auxIntToInt64(v_0_0.AuxInt)
4336 v.reset(OpPPC64ANDCCconst)
4337 v.AuxInt = int64ToAuxInt(c & d)
4343 func rewriteValuePPC64_OpPPC64ANDN(v *Value) bool {
4346 // match: (ANDN (MOVDconst [c]) (MOVDconst [d]))
4347 // result: (MOVDconst [c&^d])
4349 if v_0.Op != OpPPC64MOVDconst {
4352 c := auxIntToInt64(v_0.AuxInt)
4353 if v_1.Op != OpPPC64MOVDconst {
4356 d := auxIntToInt64(v_1.AuxInt)
4357 v.reset(OpPPC64MOVDconst)
4358 v.AuxInt = int64ToAuxInt(c &^ d)
4363 func rewriteValuePPC64_OpPPC64BRD(v *Value) bool {
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)
4372 if x.Op != OpPPC64MOVDload {
4375 off := auxIntToInt32(x.AuxInt)
4376 sym := auxToSym(x.Aux)
4383 v0 := b.NewValue0(x.Pos, OpPPC64MOVDBRload, typ.UInt64)
4385 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
4386 v1.AuxInt = int32ToAuxInt(off)
4387 v1.Aux = symToAux(sym)
4392 // match: (BRD x:(MOVDloadidx ptr idx mem))
4393 // cond: x.Uses == 1
4394 // result: @x.Block (MOVDBRloadidx ptr idx mem)
4397 if x.Op != OpPPC64MOVDloadidx {
4407 v0 := b.NewValue0(v.Pos, OpPPC64MOVDBRloadidx, typ.Int64)
4409 v0.AddArg3(ptr, idx, mem)
4414 func rewriteValuePPC64_OpPPC64BRH(v *Value) bool {
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)
4423 if x.Op != OpPPC64MOVHZload {
4426 off := auxIntToInt32(x.AuxInt)
4427 sym := auxToSym(x.Aux)
4434 v0 := b.NewValue0(x.Pos, OpPPC64MOVHBRload, typ.UInt16)
4436 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
4437 v1.AuxInt = int32ToAuxInt(off)
4438 v1.Aux = symToAux(sym)
4443 // match: (BRH x:(MOVHZloadidx ptr idx mem))
4444 // cond: x.Uses == 1
4445 // result: @x.Block (MOVHBRloadidx ptr idx mem)
4448 if x.Op != OpPPC64MOVHZloadidx {
4458 v0 := b.NewValue0(v.Pos, OpPPC64MOVHBRloadidx, typ.Int16)
4460 v0.AddArg3(ptr, idx, mem)
4465 func rewriteValuePPC64_OpPPC64BRW(v *Value) bool {
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)
4474 if x.Op != OpPPC64MOVWZload {
4477 off := auxIntToInt32(x.AuxInt)
4478 sym := auxToSym(x.Aux)
4485 v0 := b.NewValue0(x.Pos, OpPPC64MOVWBRload, typ.UInt32)
4487 v1 := b.NewValue0(x.Pos, OpPPC64MOVDaddr, ptr.Type)
4488 v1.AuxInt = int32ToAuxInt(off)
4489 v1.Aux = symToAux(sym)
4494 // match: (BRW x:(MOVWZloadidx ptr idx mem))
4495 // cond: x.Uses == 1
4496 // result: @x.Block (MOVWBRloadidx ptr idx mem)
4499 if x.Op != OpPPC64MOVWZloadidx {
4509 v0 := b.NewValue0(v.Pos, OpPPC64MOVWBRloadidx, typ.Int32)
4511 v0.AddArg3(ptr, idx, mem)
4516 func rewriteValuePPC64_OpPPC64CLRLSLDI(v *Value) bool {
4518 // match: (CLRLSLDI [c] (SRWconst [s] x))
4519 // cond: mergePPC64ClrlsldiSrw(int64(c),s) != 0
4520 // result: (RLWINM [mergePPC64ClrlsldiSrw(int64(c),s)] x)
4522 c := auxIntToInt32(v.AuxInt)
4523 if v_0.Op != OpPPC64SRWconst {
4526 s := auxIntToInt64(v_0.AuxInt)
4528 if !(mergePPC64ClrlsldiSrw(int64(c), s) != 0) {
4531 v.reset(OpPPC64RLWINM)
4532 v.AuxInt = int64ToAuxInt(mergePPC64ClrlsldiSrw(int64(c), s))
4536 // match: (CLRLSLDI [c] i:(RLWINM [s] x))
4537 // cond: mergePPC64ClrlsldiRlwinm(c,s) != 0
4538 // result: (RLWINM [mergePPC64ClrlsldiRlwinm(c,s)] x)
4540 c := auxIntToInt32(v.AuxInt)
4542 if i.Op != OpPPC64RLWINM {
4545 s := auxIntToInt64(i.AuxInt)
4547 if !(mergePPC64ClrlsldiRlwinm(c, s) != 0) {
4550 v.reset(OpPPC64RLWINM)
4551 v.AuxInt = int64ToAuxInt(mergePPC64ClrlsldiRlwinm(c, s))
4557 func rewriteValuePPC64_OpPPC64CMP(v *Value) bool {
4561 // match: (CMP x (MOVDconst [c]))
4563 // result: (CMPconst x [c])
4566 if v_1.Op != OpPPC64MOVDconst {
4569 c := auxIntToInt64(v_1.AuxInt)
4573 v.reset(OpPPC64CMPconst)
4574 v.AuxInt = int64ToAuxInt(c)
4578 // match: (CMP (MOVDconst [c]) y)
4580 // result: (InvertFlags (CMPconst y [c]))
4582 if v_0.Op != OpPPC64MOVDconst {
4585 c := auxIntToInt64(v_0.AuxInt)
4590 v.reset(OpPPC64InvertFlags)
4591 v0 := b.NewValue0(v.Pos, OpPPC64CMPconst, types.TypeFlags)
4592 v0.AuxInt = int64ToAuxInt(c)
4598 // cond: canonLessThan(x,y)
4599 // result: (InvertFlags (CMP y x))
4603 if !(canonLessThan(x, y)) {
4606 v.reset(OpPPC64InvertFlags)
4607 v0 := b.NewValue0(v.Pos, OpPPC64CMP, types.TypeFlags)
4614 func rewriteValuePPC64_OpPPC64CMPU(v *Value) bool {
4618 // match: (CMPU x (MOVDconst [c]))
4619 // cond: isU16Bit(c)
4620 // result: (CMPUconst x [c])
4623 if v_1.Op != OpPPC64MOVDconst {
4626 c := auxIntToInt64(v_1.AuxInt)
4630 v.reset(OpPPC64CMPUconst)
4631 v.AuxInt = int64ToAuxInt(c)
4635 // match: (CMPU (MOVDconst [c]) y)
4636 // cond: isU16Bit(c)
4637 // result: (InvertFlags (CMPUconst y [c]))
4639 if v_0.Op != OpPPC64MOVDconst {
4642 c := auxIntToInt64(v_0.AuxInt)
4647 v.reset(OpPPC64InvertFlags)
4648 v0 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
4649 v0.AuxInt = int64ToAuxInt(c)
4654 // match: (CMPU x y)
4655 // cond: canonLessThan(x,y)
4656 // result: (InvertFlags (CMPU y x))
4660 if !(canonLessThan(x, y)) {
4663 v.reset(OpPPC64InvertFlags)
4664 v0 := b.NewValue0(v.Pos, OpPPC64CMPU, types.TypeFlags)
4671 func rewriteValuePPC64_OpPPC64CMPUconst(v *Value) bool {
4673 // match: (CMPUconst [d] (Select0 (ANDCCconst z [c])))
4674 // cond: uint64(d) > uint64(c)
4677 d := auxIntToInt64(v.AuxInt)
4678 if v_0.Op != OpSelect0 {
4681 v_0_0 := v_0.Args[0]
4682 if v_0_0.Op != OpPPC64ANDCCconst {
4685 c := auxIntToInt64(v_0_0.AuxInt)
4686 if !(uint64(d) > uint64(c)) {
4689 v.reset(OpPPC64FlagLT)
4692 // match: (CMPUconst (MOVDconst [x]) [y])
4696 y := auxIntToInt64(v.AuxInt)
4697 if v_0.Op != OpPPC64MOVDconst {
4700 x := auxIntToInt64(v_0.AuxInt)
4704 v.reset(OpPPC64FlagEQ)
4707 // match: (CMPUconst (MOVDconst [x]) [y])
4708 // cond: uint64(x)<uint64(y)
4711 y := auxIntToInt64(v.AuxInt)
4712 if v_0.Op != OpPPC64MOVDconst {
4715 x := auxIntToInt64(v_0.AuxInt)
4716 if !(uint64(x) < uint64(y)) {
4719 v.reset(OpPPC64FlagLT)
4722 // match: (CMPUconst (MOVDconst [x]) [y])
4723 // cond: uint64(x)>uint64(y)
4726 y := auxIntToInt64(v.AuxInt)
4727 if v_0.Op != OpPPC64MOVDconst {
4730 x := auxIntToInt64(v_0.AuxInt)
4731 if !(uint64(x) > uint64(y)) {
4734 v.reset(OpPPC64FlagGT)
4739 func rewriteValuePPC64_OpPPC64CMPW(v *Value) bool {
4743 // match: (CMPW x (MOVWreg y))
4744 // result: (CMPW x y)
4747 if v_1.Op != OpPPC64MOVWreg {
4751 v.reset(OpPPC64CMPW)
4755 // match: (CMPW (MOVWreg x) y)
4756 // result: (CMPW x y)
4758 if v_0.Op != OpPPC64MOVWreg {
4763 v.reset(OpPPC64CMPW)
4767 // match: (CMPW x (MOVDconst [c]))
4769 // result: (CMPWconst x [int32(c)])
4772 if v_1.Op != OpPPC64MOVDconst {
4775 c := auxIntToInt64(v_1.AuxInt)
4779 v.reset(OpPPC64CMPWconst)
4780 v.AuxInt = int32ToAuxInt(int32(c))
4784 // match: (CMPW (MOVDconst [c]) y)
4786 // result: (InvertFlags (CMPWconst y [int32(c)]))
4788 if v_0.Op != OpPPC64MOVDconst {
4791 c := auxIntToInt64(v_0.AuxInt)
4796 v.reset(OpPPC64InvertFlags)
4797 v0 := b.NewValue0(v.Pos, OpPPC64CMPWconst, types.TypeFlags)
4798 v0.AuxInt = int32ToAuxInt(int32(c))
4803 // match: (CMPW x y)
4804 // cond: canonLessThan(x,y)
4805 // result: (InvertFlags (CMPW y x))
4809 if !(canonLessThan(x, y)) {
4812 v.reset(OpPPC64InvertFlags)
4813 v0 := b.NewValue0(v.Pos, OpPPC64CMPW, types.TypeFlags)
4820 func rewriteValuePPC64_OpPPC64CMPWU(v *Value) bool {
4824 // match: (CMPWU x (MOVWZreg y))
4825 // result: (CMPWU x y)
4828 if v_1.Op != OpPPC64MOVWZreg {
4832 v.reset(OpPPC64CMPWU)
4836 // match: (CMPWU (MOVWZreg x) y)
4837 // result: (CMPWU x y)
4839 if v_0.Op != OpPPC64MOVWZreg {
4844 v.reset(OpPPC64CMPWU)
4848 // match: (CMPWU x (MOVDconst [c]))
4849 // cond: isU16Bit(c)
4850 // result: (CMPWUconst x [int32(c)])
4853 if v_1.Op != OpPPC64MOVDconst {
4856 c := auxIntToInt64(v_1.AuxInt)
4860 v.reset(OpPPC64CMPWUconst)
4861 v.AuxInt = int32ToAuxInt(int32(c))
4865 // match: (CMPWU (MOVDconst [c]) y)
4866 // cond: isU16Bit(c)
4867 // result: (InvertFlags (CMPWUconst y [int32(c)]))
4869 if v_0.Op != OpPPC64MOVDconst {
4872 c := auxIntToInt64(v_0.AuxInt)
4877 v.reset(OpPPC64InvertFlags)
4878 v0 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
4879 v0.AuxInt = int32ToAuxInt(int32(c))
4884 // match: (CMPWU x y)
4885 // cond: canonLessThan(x,y)
4886 // result: (InvertFlags (CMPWU y x))
4890 if !(canonLessThan(x, y)) {
4893 v.reset(OpPPC64InvertFlags)
4894 v0 := b.NewValue0(v.Pos, OpPPC64CMPWU, types.TypeFlags)
4901 func rewriteValuePPC64_OpPPC64CMPWUconst(v *Value) bool {
4903 // match: (CMPWUconst [d] (Select0 (ANDCCconst z [c])))
4904 // cond: uint64(d) > uint64(c)
4907 d := auxIntToInt32(v.AuxInt)
4908 if v_0.Op != OpSelect0 {
4911 v_0_0 := v_0.Args[0]
4912 if v_0_0.Op != OpPPC64ANDCCconst {
4915 c := auxIntToInt64(v_0_0.AuxInt)
4916 if !(uint64(d) > uint64(c)) {
4919 v.reset(OpPPC64FlagLT)
4922 // match: (CMPWUconst (MOVDconst [x]) [y])
4923 // cond: int32(x)==int32(y)
4926 y := auxIntToInt32(v.AuxInt)
4927 if v_0.Op != OpPPC64MOVDconst {
4930 x := auxIntToInt64(v_0.AuxInt)
4931 if !(int32(x) == int32(y)) {
4934 v.reset(OpPPC64FlagEQ)
4937 // match: (CMPWUconst (MOVDconst [x]) [y])
4938 // cond: uint32(x)<uint32(y)
4941 y := auxIntToInt32(v.AuxInt)
4942 if v_0.Op != OpPPC64MOVDconst {
4945 x := auxIntToInt64(v_0.AuxInt)
4946 if !(uint32(x) < uint32(y)) {
4949 v.reset(OpPPC64FlagLT)
4952 // match: (CMPWUconst (MOVDconst [x]) [y])
4953 // cond: uint32(x)>uint32(y)
4956 y := auxIntToInt32(v.AuxInt)
4957 if v_0.Op != OpPPC64MOVDconst {
4960 x := auxIntToInt64(v_0.AuxInt)
4961 if !(uint32(x) > uint32(y)) {
4964 v.reset(OpPPC64FlagGT)
4969 func rewriteValuePPC64_OpPPC64CMPWconst(v *Value) bool {
4971 // match: (CMPWconst (MOVDconst [x]) [y])
4972 // cond: int32(x)==int32(y)
4975 y := auxIntToInt32(v.AuxInt)
4976 if v_0.Op != OpPPC64MOVDconst {
4979 x := auxIntToInt64(v_0.AuxInt)
4980 if !(int32(x) == int32(y)) {
4983 v.reset(OpPPC64FlagEQ)
4986 // match: (CMPWconst (MOVDconst [x]) [y])
4987 // cond: int32(x)<int32(y)
4990 y := auxIntToInt32(v.AuxInt)
4991 if v_0.Op != OpPPC64MOVDconst {
4994 x := auxIntToInt64(v_0.AuxInt)
4995 if !(int32(x) < int32(y)) {
4998 v.reset(OpPPC64FlagLT)
5001 // match: (CMPWconst (MOVDconst [x]) [y])
5002 // cond: int32(x)>int32(y)
5005 y := auxIntToInt32(v.AuxInt)
5006 if v_0.Op != OpPPC64MOVDconst {
5009 x := auxIntToInt64(v_0.AuxInt)
5010 if !(int32(x) > int32(y)) {
5013 v.reset(OpPPC64FlagGT)
5018 func rewriteValuePPC64_OpPPC64CMPconst(v *Value) bool {
5020 // match: (CMPconst (MOVDconst [x]) [y])
5024 y := auxIntToInt64(v.AuxInt)
5025 if v_0.Op != OpPPC64MOVDconst {
5028 x := auxIntToInt64(v_0.AuxInt)
5032 v.reset(OpPPC64FlagEQ)
5035 // match: (CMPconst (MOVDconst [x]) [y])
5039 y := auxIntToInt64(v.AuxInt)
5040 if v_0.Op != OpPPC64MOVDconst {
5043 x := auxIntToInt64(v_0.AuxInt)
5047 v.reset(OpPPC64FlagLT)
5050 // match: (CMPconst (MOVDconst [x]) [y])
5054 y := auxIntToInt64(v.AuxInt)
5055 if v_0.Op != OpPPC64MOVDconst {
5058 x := auxIntToInt64(v_0.AuxInt)
5062 v.reset(OpPPC64FlagGT)
5067 func rewriteValuePPC64_OpPPC64Equal(v *Value) bool {
5069 // match: (Equal (FlagEQ))
5070 // result: (MOVDconst [1])
5072 if v_0.Op != OpPPC64FlagEQ {
5075 v.reset(OpPPC64MOVDconst)
5076 v.AuxInt = int64ToAuxInt(1)
5079 // match: (Equal (FlagLT))
5080 // result: (MOVDconst [0])
5082 if v_0.Op != OpPPC64FlagLT {
5085 v.reset(OpPPC64MOVDconst)
5086 v.AuxInt = int64ToAuxInt(0)
5089 // match: (Equal (FlagGT))
5090 // result: (MOVDconst [0])
5092 if v_0.Op != OpPPC64FlagGT {
5095 v.reset(OpPPC64MOVDconst)
5096 v.AuxInt = int64ToAuxInt(0)
5099 // match: (Equal (InvertFlags x))
5100 // result: (Equal x)
5102 if v_0.Op != OpPPC64InvertFlags {
5106 v.reset(OpPPC64Equal)
5110 // match: (Equal cmp)
5111 // result: (SETBC [2] cmp)
5114 v.reset(OpPPC64SETBC)
5115 v.AuxInt = int32ToAuxInt(2)
5120 func rewriteValuePPC64_OpPPC64FABS(v *Value) bool {
5122 // match: (FABS (FMOVDconst [x]))
5123 // result: (FMOVDconst [math.Abs(x)])
5125 if v_0.Op != OpPPC64FMOVDconst {
5128 x := auxIntToFloat64(v_0.AuxInt)
5129 v.reset(OpPPC64FMOVDconst)
5130 v.AuxInt = float64ToAuxInt(math.Abs(x))
5135 func rewriteValuePPC64_OpPPC64FADD(v *Value) bool {
5138 // match: (FADD (FMUL x y) z)
5139 // cond: x.Block.Func.useFMA(v)
5140 // result: (FMADD x y z)
5142 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5143 if v_0.Op != OpPPC64FMUL {
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 {
5153 if !(x.Block.Func.useFMA(v)) {
5156 v.reset(OpPPC64FMADD)
5165 func rewriteValuePPC64_OpPPC64FADDS(v *Value) bool {
5168 // match: (FADDS (FMULS x y) z)
5169 // cond: x.Block.Func.useFMA(v)
5170 // result: (FMADDS x y z)
5172 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
5173 if v_0.Op != OpPPC64FMULS {
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 {
5183 if !(x.Block.Func.useFMA(v)) {
5186 v.reset(OpPPC64FMADDS)
5195 func rewriteValuePPC64_OpPPC64FCEIL(v *Value) bool {
5197 // match: (FCEIL (FMOVDconst [x]))
5198 // result: (FMOVDconst [math.Ceil(x)])
5200 if v_0.Op != OpPPC64FMOVDconst {
5203 x := auxIntToFloat64(v_0.AuxInt)
5204 v.reset(OpPPC64FMOVDconst)
5205 v.AuxInt = float64ToAuxInt(math.Ceil(x))
5210 func rewriteValuePPC64_OpPPC64FFLOOR(v *Value) bool {
5212 // match: (FFLOOR (FMOVDconst [x]))
5213 // result: (FMOVDconst [math.Floor(x)])
5215 if v_0.Op != OpPPC64FMOVDconst {
5218 x := auxIntToFloat64(v_0.AuxInt)
5219 v.reset(OpPPC64FMOVDconst)
5220 v.AuxInt = float64ToAuxInt(math.Floor(x))
5225 func rewriteValuePPC64_OpPPC64FGreaterEqual(v *Value) bool {
5228 typ := &b.Func.Config.Types
5229 // match: (FGreaterEqual cmp)
5230 // result: (OR (SETBC [2] cmp) (SETBC [1] cmp))
5234 v0 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5235 v0.AuxInt = int32ToAuxInt(2)
5237 v1 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5238 v1.AuxInt = int32ToAuxInt(1)
5244 func rewriteValuePPC64_OpPPC64FGreaterThan(v *Value) bool {
5246 // match: (FGreaterThan cmp)
5247 // result: (SETBC [1] cmp)
5250 v.reset(OpPPC64SETBC)
5251 v.AuxInt = int32ToAuxInt(1)
5256 func rewriteValuePPC64_OpPPC64FLessEqual(v *Value) bool {
5259 typ := &b.Func.Config.Types
5260 // match: (FLessEqual cmp)
5261 // result: (OR (SETBC [2] cmp) (SETBC [0] cmp))
5265 v0 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5266 v0.AuxInt = int32ToAuxInt(2)
5268 v1 := b.NewValue0(v.Pos, OpPPC64SETBC, typ.Int32)
5269 v1.AuxInt = int32ToAuxInt(0)
5275 func rewriteValuePPC64_OpPPC64FLessThan(v *Value) bool {
5277 // match: (FLessThan cmp)
5278 // result: (SETBC [0] cmp)
5281 v.reset(OpPPC64SETBC)
5282 v.AuxInt = int32ToAuxInt(0)
5287 func rewriteValuePPC64_OpPPC64FMOVDload(v *Value) bool {
5290 // match: (FMOVDload [off] {sym} ptr (MOVDstore [off] {sym} ptr x _))
5291 // result: (MTVSRD x)
5293 off := auxIntToInt32(v.AuxInt)
5294 sym := auxToSym(v.Aux)
5296 if v_1.Op != OpPPC64MOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
5300 if ptr != v_1.Args[0] {
5303 v.reset(OpPPC64MTVSRD)
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)
5311 off1 := auxIntToInt32(v.AuxInt)
5312 sym1 := auxToSym(v.Aux)
5314 if p.Op != OpPPC64MOVDaddr {
5317 off2 := auxIntToInt32(p.AuxInt)
5318 sym2 := auxToSym(p.Aux)
5321 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5324 v.reset(OpPPC64FMOVDload)
5325 v.AuxInt = int32ToAuxInt(off1 + off2)
5326 v.Aux = symToAux(mergeSym(sym1, sym2))
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)
5334 off1 := auxIntToInt32(v.AuxInt)
5335 sym := auxToSym(v.Aux)
5336 if v_0.Op != OpPPC64ADDconst {
5339 off2 := auxIntToInt64(v_0.AuxInt)
5342 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5345 v.reset(OpPPC64FMOVDload)
5346 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5347 v.Aux = symToAux(sym)
5353 func rewriteValuePPC64_OpPPC64FMOVDstore(v *Value) bool {
5357 // match: (FMOVDstore [off] {sym} ptr (MTVSRD x) mem)
5358 // result: (MOVDstore [off] {sym} ptr x mem)
5360 off := auxIntToInt32(v.AuxInt)
5361 sym := auxToSym(v.Aux)
5363 if v_1.Op != OpPPC64MTVSRD {
5368 v.reset(OpPPC64MOVDstore)
5369 v.AuxInt = int32ToAuxInt(off)
5370 v.Aux = symToAux(sym)
5371 v.AddArg3(ptr, x, mem)
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)
5378 off1 := auxIntToInt32(v.AuxInt)
5379 sym := auxToSym(v.Aux)
5380 if v_0.Op != OpPPC64ADDconst {
5383 off2 := auxIntToInt64(v_0.AuxInt)
5387 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5390 v.reset(OpPPC64FMOVDstore)
5391 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5392 v.Aux = symToAux(sym)
5393 v.AddArg3(ptr, val, mem)
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)
5400 off1 := auxIntToInt32(v.AuxInt)
5401 sym1 := auxToSym(v.Aux)
5403 if p.Op != OpPPC64MOVDaddr {
5406 off2 := auxIntToInt32(p.AuxInt)
5407 sym2 := auxToSym(p.Aux)
5411 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5414 v.reset(OpPPC64FMOVDstore)
5415 v.AuxInt = int32ToAuxInt(off1 + off2)
5416 v.Aux = symToAux(mergeSym(sym1, sym2))
5417 v.AddArg3(ptr, val, mem)
5422 func rewriteValuePPC64_OpPPC64FMOVSload(v *Value) bool {
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)
5429 off1 := auxIntToInt32(v.AuxInt)
5430 sym1 := auxToSym(v.Aux)
5432 if p.Op != OpPPC64MOVDaddr {
5435 off2 := auxIntToInt32(p.AuxInt)
5436 sym2 := auxToSym(p.Aux)
5439 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5442 v.reset(OpPPC64FMOVSload)
5443 v.AuxInt = int32ToAuxInt(off1 + off2)
5444 v.Aux = symToAux(mergeSym(sym1, sym2))
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)
5452 off1 := auxIntToInt32(v.AuxInt)
5453 sym := auxToSym(v.Aux)
5454 if v_0.Op != OpPPC64ADDconst {
5457 off2 := auxIntToInt64(v_0.AuxInt)
5460 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5463 v.reset(OpPPC64FMOVSload)
5464 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5465 v.Aux = symToAux(sym)
5471 func rewriteValuePPC64_OpPPC64FMOVSstore(v *Value) bool {
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)
5479 off1 := auxIntToInt32(v.AuxInt)
5480 sym := auxToSym(v.Aux)
5481 if v_0.Op != OpPPC64ADDconst {
5484 off2 := auxIntToInt64(v_0.AuxInt)
5488 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
5491 v.reset(OpPPC64FMOVSstore)
5492 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
5493 v.Aux = symToAux(sym)
5494 v.AddArg3(ptr, val, mem)
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)
5501 off1 := auxIntToInt32(v.AuxInt)
5502 sym1 := auxToSym(v.Aux)
5504 if p.Op != OpPPC64MOVDaddr {
5507 off2 := auxIntToInt32(p.AuxInt)
5508 sym2 := auxToSym(p.Aux)
5512 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
5515 v.reset(OpPPC64FMOVSstore)
5516 v.AuxInt = int32ToAuxInt(off1 + off2)
5517 v.Aux = symToAux(mergeSym(sym1, sym2))
5518 v.AddArg3(ptr, val, mem)
5523 func rewriteValuePPC64_OpPPC64FNEG(v *Value) bool {
5525 // match: (FNEG (FABS x))
5526 // result: (FNABS x)
5528 if v_0.Op != OpPPC64FABS {
5532 v.reset(OpPPC64FNABS)
5536 // match: (FNEG (FNABS x))
5539 if v_0.Op != OpPPC64FNABS {
5543 v.reset(OpPPC64FABS)
5549 func rewriteValuePPC64_OpPPC64FSQRT(v *Value) bool {
5551 // match: (FSQRT (FMOVDconst [x]))
5553 // result: (FMOVDconst [math.Sqrt(x)])
5555 if v_0.Op != OpPPC64FMOVDconst {
5558 x := auxIntToFloat64(v_0.AuxInt)
5562 v.reset(OpPPC64FMOVDconst)
5563 v.AuxInt = float64ToAuxInt(math.Sqrt(x))
5568 func rewriteValuePPC64_OpPPC64FSUB(v *Value) bool {
5571 // match: (FSUB (FMUL x y) z)
5572 // cond: x.Block.Func.useFMA(v)
5573 // result: (FMSUB x y z)
5575 if v_0.Op != OpPPC64FMUL {
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 {
5585 if !(x.Block.Func.useFMA(v)) {
5588 v.reset(OpPPC64FMSUB)
5596 func rewriteValuePPC64_OpPPC64FSUBS(v *Value) bool {
5599 // match: (FSUBS (FMULS x y) z)
5600 // cond: x.Block.Func.useFMA(v)
5601 // result: (FMSUBS x y z)
5603 if v_0.Op != OpPPC64FMULS {
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 {
5613 if !(x.Block.Func.useFMA(v)) {
5616 v.reset(OpPPC64FMSUBS)
5624 func rewriteValuePPC64_OpPPC64FTRUNC(v *Value) bool {
5626 // match: (FTRUNC (FMOVDconst [x]))
5627 // result: (FMOVDconst [math.Trunc(x)])
5629 if v_0.Op != OpPPC64FMOVDconst {
5632 x := auxIntToFloat64(v_0.AuxInt)
5633 v.reset(OpPPC64FMOVDconst)
5634 v.AuxInt = float64ToAuxInt(math.Trunc(x))
5639 func rewriteValuePPC64_OpPPC64GreaterEqual(v *Value) bool {
5641 // match: (GreaterEqual (FlagEQ))
5642 // result: (MOVDconst [1])
5644 if v_0.Op != OpPPC64FlagEQ {
5647 v.reset(OpPPC64MOVDconst)
5648 v.AuxInt = int64ToAuxInt(1)
5651 // match: (GreaterEqual (FlagLT))
5652 // result: (MOVDconst [0])
5654 if v_0.Op != OpPPC64FlagLT {
5657 v.reset(OpPPC64MOVDconst)
5658 v.AuxInt = int64ToAuxInt(0)
5661 // match: (GreaterEqual (FlagGT))
5662 // result: (MOVDconst [1])
5664 if v_0.Op != OpPPC64FlagGT {
5667 v.reset(OpPPC64MOVDconst)
5668 v.AuxInt = int64ToAuxInt(1)
5671 // match: (GreaterEqual (InvertFlags x))
5672 // result: (LessEqual x)
5674 if v_0.Op != OpPPC64InvertFlags {
5678 v.reset(OpPPC64LessEqual)
5682 // match: (GreaterEqual cmp)
5683 // result: (SETBCR [0] cmp)
5686 v.reset(OpPPC64SETBCR)
5687 v.AuxInt = int32ToAuxInt(0)
5692 func rewriteValuePPC64_OpPPC64GreaterThan(v *Value) bool {
5694 // match: (GreaterThan (FlagEQ))
5695 // result: (MOVDconst [0])
5697 if v_0.Op != OpPPC64FlagEQ {
5700 v.reset(OpPPC64MOVDconst)
5701 v.AuxInt = int64ToAuxInt(0)
5704 // match: (GreaterThan (FlagLT))
5705 // result: (MOVDconst [0])
5707 if v_0.Op != OpPPC64FlagLT {
5710 v.reset(OpPPC64MOVDconst)
5711 v.AuxInt = int64ToAuxInt(0)
5714 // match: (GreaterThan (FlagGT))
5715 // result: (MOVDconst [1])
5717 if v_0.Op != OpPPC64FlagGT {
5720 v.reset(OpPPC64MOVDconst)
5721 v.AuxInt = int64ToAuxInt(1)
5724 // match: (GreaterThan (InvertFlags x))
5725 // result: (LessThan x)
5727 if v_0.Op != OpPPC64InvertFlags {
5731 v.reset(OpPPC64LessThan)
5735 // match: (GreaterThan cmp)
5736 // result: (SETBC [1] cmp)
5739 v.reset(OpPPC64SETBC)
5740 v.AuxInt = int32ToAuxInt(1)
5745 func rewriteValuePPC64_OpPPC64ISEL(v *Value) bool {
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)
5754 if auxIntToInt32(v.AuxInt) != 6 {
5759 if v_2.Op != OpSelect1 {
5762 v_2_0 := v_2.Args[0]
5763 if v_2_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_2_0.AuxInt) != 1 {
5766 v_2_0_0 := v_2_0.Args[0]
5767 if v_2_0_0.Op != OpPPC64SETBC {
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)
5777 // match: (ISEL [6] x y (CMPconst [0] (SETBC [c] cmp)))
5778 // result: (ISEL [c] x y cmp)
5780 if auxIntToInt32(v.AuxInt) != 6 {
5785 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
5788 v_2_0 := v_2.Args[0]
5789 if v_2_0.Op != OpPPC64SETBC {
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)
5799 // match: (ISEL [6] x y (CMPWconst [0] (SETBC [c] cmp)))
5800 // result: (ISEL [c] x y cmp)
5802 if auxIntToInt32(v.AuxInt) != 6 {
5807 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
5810 v_2_0 := v_2.Args[0]
5811 if v_2_0.Op != OpPPC64SETBC {
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)
5821 // match: (ISEL [6] x y (CMPconst [0] (SETBCR [c] cmp)))
5822 // result: (ISEL [c+4] x y cmp)
5824 if auxIntToInt32(v.AuxInt) != 6 {
5829 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
5832 v_2_0 := v_2.Args[0]
5833 if v_2_0.Op != OpPPC64SETBCR {
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)
5843 // match: (ISEL [6] x y (CMPWconst [0] (SETBCR [c] cmp)))
5844 // result: (ISEL [c+4] x y cmp)
5846 if auxIntToInt32(v.AuxInt) != 6 {
5851 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
5854 v_2_0 := v_2.Args[0]
5855 if v_2_0.Op != OpPPC64SETBCR {
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)
5865 // match: (ISEL [2] x _ (FlagEQ))
5868 if auxIntToInt32(v.AuxInt) != 2 {
5872 if v_2.Op != OpPPC64FlagEQ {
5878 // match: (ISEL [2] _ y (FlagLT))
5881 if auxIntToInt32(v.AuxInt) != 2 {
5885 if v_2.Op != OpPPC64FlagLT {
5891 // match: (ISEL [2] _ y (FlagGT))
5894 if auxIntToInt32(v.AuxInt) != 2 {
5898 if v_2.Op != OpPPC64FlagGT {
5904 // match: (ISEL [6] _ y (FlagEQ))
5907 if auxIntToInt32(v.AuxInt) != 6 {
5911 if v_2.Op != OpPPC64FlagEQ {
5917 // match: (ISEL [6] x _ (FlagLT))
5920 if auxIntToInt32(v.AuxInt) != 6 {
5924 if v_2.Op != OpPPC64FlagLT {
5930 // match: (ISEL [6] x _ (FlagGT))
5933 if auxIntToInt32(v.AuxInt) != 6 {
5937 if v_2.Op != OpPPC64FlagGT {
5943 // match: (ISEL [0] _ y (FlagEQ))
5946 if auxIntToInt32(v.AuxInt) != 0 {
5950 if v_2.Op != OpPPC64FlagEQ {
5956 // match: (ISEL [0] _ y (FlagGT))
5959 if auxIntToInt32(v.AuxInt) != 0 {
5963 if v_2.Op != OpPPC64FlagGT {
5969 // match: (ISEL [0] x _ (FlagLT))
5972 if auxIntToInt32(v.AuxInt) != 0 {
5976 if v_2.Op != OpPPC64FlagLT {
5982 // match: (ISEL [5] _ x (FlagEQ))
5985 if auxIntToInt32(v.AuxInt) != 5 {
5989 if v_2.Op != OpPPC64FlagEQ {
5995 // match: (ISEL [5] _ x (FlagLT))
5998 if auxIntToInt32(v.AuxInt) != 5 {
6002 if v_2.Op != OpPPC64FlagLT {
6008 // match: (ISEL [5] y _ (FlagGT))
6011 if auxIntToInt32(v.AuxInt) != 5 {
6015 if v_2.Op != OpPPC64FlagGT {
6021 // match: (ISEL [1] _ y (FlagEQ))
6024 if auxIntToInt32(v.AuxInt) != 1 {
6028 if v_2.Op != OpPPC64FlagEQ {
6034 // match: (ISEL [1] _ y (FlagLT))
6037 if auxIntToInt32(v.AuxInt) != 1 {
6041 if v_2.Op != OpPPC64FlagLT {
6047 // match: (ISEL [1] x _ (FlagGT))
6050 if auxIntToInt32(v.AuxInt) != 1 {
6054 if v_2.Op != OpPPC64FlagGT {
6060 // match: (ISEL [4] x _ (FlagEQ))
6063 if auxIntToInt32(v.AuxInt) != 4 {
6067 if v_2.Op != OpPPC64FlagEQ {
6073 // match: (ISEL [4] x _ (FlagGT))
6076 if auxIntToInt32(v.AuxInt) != 4 {
6080 if v_2.Op != OpPPC64FlagGT {
6086 // match: (ISEL [4] _ y (FlagLT))
6089 if auxIntToInt32(v.AuxInt) != 4 {
6093 if v_2.Op != OpPPC64FlagLT {
6099 // match: (ISEL [2] x y (CMPconst [0] (Select0 (ANDCCconst [n] z))))
6100 // result: (ISEL [2] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6102 if auxIntToInt32(v.AuxInt) != 2 {
6107 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
6110 v_2_0 := v_2.Args[0]
6111 if v_2_0.Op != OpSelect0 {
6114 v_2_0_0 := v_2_0.Args[0]
6115 if v_2_0_0.Op != OpPPC64ANDCCconst {
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)
6130 // match: (ISEL [2] x y (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
6131 // result: (ISEL [2] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6133 if auxIntToInt32(v.AuxInt) != 2 {
6138 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
6141 v_2_0 := v_2.Args[0]
6142 if v_2_0.Op != OpSelect0 {
6145 v_2_0_0 := v_2_0.Args[0]
6146 if v_2_0_0.Op != OpPPC64ANDCCconst {
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)
6161 // match: (ISEL [6] x y (CMPconst [0] (Select0 (ANDCCconst [n] z))))
6162 // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6164 if auxIntToInt32(v.AuxInt) != 6 {
6169 if v_2.Op != OpPPC64CMPconst || auxIntToInt64(v_2.AuxInt) != 0 {
6172 v_2_0 := v_2.Args[0]
6173 if v_2_0.Op != OpSelect0 {
6176 v_2_0_0 := v_2_0.Args[0]
6177 if v_2_0_0.Op != OpPPC64ANDCCconst {
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)
6192 // match: (ISEL [6] x y (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
6193 // result: (ISEL [6] x y (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
6195 if auxIntToInt32(v.AuxInt) != 6 {
6200 if v_2.Op != OpPPC64CMPWconst || auxIntToInt32(v_2.AuxInt) != 0 {
6203 v_2_0 := v_2.Args[0]
6204 if v_2_0.Op != OpSelect0 {
6207 v_2_0_0 := v_2_0.Args[0]
6208 if v_2_0_0.Op != OpPPC64ANDCCconst {
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)
6223 // match: (ISEL [n] x y (InvertFlags bool))
6225 // result: (ISEL [n+1] x y bool)
6227 n := auxIntToInt32(v.AuxInt)
6230 if v_2.Op != OpPPC64InvertFlags {
6237 v.reset(OpPPC64ISEL)
6238 v.AuxInt = int32ToAuxInt(n + 1)
6239 v.AddArg3(x, y, bool)
6242 // match: (ISEL [n] x y (InvertFlags bool))
6244 // result: (ISEL [n-1] x y bool)
6246 n := auxIntToInt32(v.AuxInt)
6249 if v_2.Op != OpPPC64InvertFlags {
6256 v.reset(OpPPC64ISEL)
6257 v.AuxInt = int32ToAuxInt(n - 1)
6258 v.AddArg3(x, y, bool)
6261 // match: (ISEL [n] x y (InvertFlags bool))
6263 // result: (ISEL [n] x y bool)
6265 n := auxIntToInt32(v.AuxInt)
6268 if v_2.Op != OpPPC64InvertFlags {
6275 v.reset(OpPPC64ISEL)
6276 v.AuxInt = int32ToAuxInt(n)
6277 v.AddArg3(x, y, bool)
6282 func rewriteValuePPC64_OpPPC64LessEqual(v *Value) bool {
6284 // match: (LessEqual (FlagEQ))
6285 // result: (MOVDconst [1])
6287 if v_0.Op != OpPPC64FlagEQ {
6290 v.reset(OpPPC64MOVDconst)
6291 v.AuxInt = int64ToAuxInt(1)
6294 // match: (LessEqual (FlagLT))
6295 // result: (MOVDconst [1])
6297 if v_0.Op != OpPPC64FlagLT {
6300 v.reset(OpPPC64MOVDconst)
6301 v.AuxInt = int64ToAuxInt(1)
6304 // match: (LessEqual (FlagGT))
6305 // result: (MOVDconst [0])
6307 if v_0.Op != OpPPC64FlagGT {
6310 v.reset(OpPPC64MOVDconst)
6311 v.AuxInt = int64ToAuxInt(0)
6314 // match: (LessEqual (InvertFlags x))
6315 // result: (GreaterEqual x)
6317 if v_0.Op != OpPPC64InvertFlags {
6321 v.reset(OpPPC64GreaterEqual)
6325 // match: (LessEqual cmp)
6326 // result: (SETBCR [1] cmp)
6329 v.reset(OpPPC64SETBCR)
6330 v.AuxInt = int32ToAuxInt(1)
6335 func rewriteValuePPC64_OpPPC64LessThan(v *Value) bool {
6337 // match: (LessThan (FlagEQ))
6338 // result: (MOVDconst [0])
6340 if v_0.Op != OpPPC64FlagEQ {
6343 v.reset(OpPPC64MOVDconst)
6344 v.AuxInt = int64ToAuxInt(0)
6347 // match: (LessThan (FlagLT))
6348 // result: (MOVDconst [1])
6350 if v_0.Op != OpPPC64FlagLT {
6353 v.reset(OpPPC64MOVDconst)
6354 v.AuxInt = int64ToAuxInt(1)
6357 // match: (LessThan (FlagGT))
6358 // result: (MOVDconst [0])
6360 if v_0.Op != OpPPC64FlagGT {
6363 v.reset(OpPPC64MOVDconst)
6364 v.AuxInt = int64ToAuxInt(0)
6367 // match: (LessThan (InvertFlags x))
6368 // result: (GreaterThan x)
6370 if v_0.Op != OpPPC64InvertFlags {
6374 v.reset(OpPPC64GreaterThan)
6378 // match: (LessThan cmp)
6379 // result: (SETBC [0] cmp)
6382 v.reset(OpPPC64SETBC)
6383 v.AuxInt = int32ToAuxInt(0)
6388 func rewriteValuePPC64_OpPPC64MFVSRD(v *Value) bool {
6391 typ := &b.Func.Config.Types
6392 // match: (MFVSRD (FMOVDconst [c]))
6393 // result: (MOVDconst [int64(math.Float64bits(c))])
6395 if v_0.Op != OpPPC64FMOVDconst {
6398 c := auxIntToFloat64(v_0.AuxInt)
6399 v.reset(OpPPC64MOVDconst)
6400 v.AuxInt = int64ToAuxInt(int64(math.Float64bits(c)))
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)
6408 if x.Op != OpPPC64FMOVDload {
6411 off := auxIntToInt32(x.AuxInt)
6412 sym := auxToSym(x.Aux)
6415 if !(x.Uses == 1 && clobber(x)) {
6419 v0 := b.NewValue0(x.Pos, OpPPC64MOVDload, typ.Int64)
6421 v0.AuxInt = int32ToAuxInt(off)
6422 v0.Aux = symToAux(sym)
6423 v0.AddArg2(ptr, mem)
6428 func rewriteValuePPC64_OpPPC64MOVBZload(v *Value) bool {
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)
6435 off1 := auxIntToInt32(v.AuxInt)
6436 sym1 := auxToSym(v.Aux)
6438 if p.Op != OpPPC64MOVDaddr {
6441 off2 := auxIntToInt32(p.AuxInt)
6442 sym2 := auxToSym(p.Aux)
6445 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
6448 v.reset(OpPPC64MOVBZload)
6449 v.AuxInt = int32ToAuxInt(off1 + off2)
6450 v.Aux = symToAux(mergeSym(sym1, sym2))
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)
6458 off1 := auxIntToInt32(v.AuxInt)
6459 sym := auxToSym(v.Aux)
6460 if v_0.Op != OpPPC64ADDconst {
6463 off2 := auxIntToInt64(v_0.AuxInt)
6466 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
6469 v.reset(OpPPC64MOVBZload)
6470 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
6471 v.Aux = symToAux(sym)
6475 // match: (MOVBZload [0] {sym} p:(ADD ptr idx) mem)
6476 // cond: sym == nil && p.Uses == 1
6477 // result: (MOVBZloadidx ptr idx mem)
6479 if auxIntToInt32(v.AuxInt) != 0 {
6482 sym := auxToSym(v.Aux)
6484 if p.Op != OpPPC64ADD {
6490 if !(sym == nil && p.Uses == 1) {
6493 v.reset(OpPPC64MOVBZloadidx)
6494 v.AddArg3(ptr, idx, mem)
6499 func rewriteValuePPC64_OpPPC64MOVBZloadidx(v *Value) bool {
6503 // match: (MOVBZloadidx ptr (MOVDconst [c]) mem)
6504 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
6505 // result: (MOVBZload [int32(c)] ptr mem)
6508 if v_1.Op != OpPPC64MOVDconst {
6511 c := auxIntToInt64(v_1.AuxInt)
6513 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
6516 v.reset(OpPPC64MOVBZload)
6517 v.AuxInt = int32ToAuxInt(int32(c))
6521 // match: (MOVBZloadidx (MOVDconst [c]) ptr mem)
6522 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
6523 // result: (MOVBZload [int32(c)] ptr mem)
6525 if v_0.Op != OpPPC64MOVDconst {
6528 c := auxIntToInt64(v_0.AuxInt)
6531 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
6534 v.reset(OpPPC64MOVBZload)
6535 v.AuxInt = int32ToAuxInt(int32(c))
6541 func rewriteValuePPC64_OpPPC64MOVBZreg(v *Value) bool {
6544 typ := &b.Func.Config.Types
6545 // match: (MOVBZreg y:(Select0 (ANDCCconst [c] _)))
6546 // cond: uint64(c) <= 0xFF
6550 if y.Op != OpSelect0 {
6554 if y_0.Op != OpPPC64ANDCCconst {
6557 c := auxIntToInt64(y_0.AuxInt)
6558 if !(uint64(c) <= 0xFF) {
6564 // match: (MOVBZreg (SRWconst [c] (MOVBZreg x)))
6565 // result: (SRWconst [c] (MOVBZreg x))
6567 if v_0.Op != OpPPC64SRWconst {
6570 c := auxIntToInt64(v_0.AuxInt)
6571 v_0_0 := v_0.Args[0]
6572 if v_0_0.Op != OpPPC64MOVBZreg {
6576 v.reset(OpPPC64SRWconst)
6577 v.AuxInt = int64ToAuxInt(c)
6578 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
6583 // match: (MOVBZreg (SRWconst [c] x))
6584 // cond: sizeof(x.Type) == 8
6585 // result: (SRWconst [c] x)
6587 if v_0.Op != OpPPC64SRWconst {
6590 c := auxIntToInt64(v_0.AuxInt)
6592 if !(sizeof(x.Type) == 8) {
6595 v.reset(OpPPC64SRWconst)
6596 v.AuxInt = int64ToAuxInt(c)
6600 // match: (MOVBZreg (SRDconst [c] x))
6602 // result: (SRDconst [c] x)
6604 if v_0.Op != OpPPC64SRDconst {
6607 c := auxIntToInt64(v_0.AuxInt)
6612 v.reset(OpPPC64SRDconst)
6613 v.AuxInt = int64ToAuxInt(c)
6617 // match: (MOVBZreg (SRWconst [c] x))
6619 // result: (SRWconst [c] x)
6621 if v_0.Op != OpPPC64SRWconst {
6624 c := auxIntToInt64(v_0.AuxInt)
6629 v.reset(OpPPC64SRWconst)
6630 v.AuxInt = int64ToAuxInt(c)
6634 // match: (MOVBZreg y:(MOVBZreg _))
6638 if y.Op != OpPPC64MOVBZreg {
6644 // match: (MOVBZreg (MOVBreg x))
6645 // result: (MOVBZreg x)
6647 if v_0.Op != OpPPC64MOVBreg {
6651 v.reset(OpPPC64MOVBZreg)
6655 // match: (MOVBZreg (OR <t> x (MOVWZreg y)))
6656 // result: (MOVBZreg (OR <t> x y))
6658 if v_0.Op != OpPPC64OR {
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 {
6667 if v_0_1.Op != OpPPC64MOVWZreg {
6671 v.reset(OpPPC64MOVBZreg)
6672 v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6679 // match: (MOVBZreg (XOR <t> x (MOVWZreg y)))
6680 // result: (MOVBZreg (XOR <t> x y))
6682 if v_0.Op != OpPPC64XOR {
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 {
6691 if v_0_1.Op != OpPPC64MOVWZreg {
6695 v.reset(OpPPC64MOVBZreg)
6696 v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6703 // match: (MOVBZreg (AND <t> x (MOVWZreg y)))
6704 // result: (MOVBZreg (AND <t> x y))
6706 if v_0.Op != OpPPC64AND {
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 {
6715 if v_0_1.Op != OpPPC64MOVWZreg {
6719 v.reset(OpPPC64MOVBZreg)
6720 v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6727 // match: (MOVBZreg (OR <t> x (MOVHZreg y)))
6728 // result: (MOVBZreg (OR <t> x y))
6730 if v_0.Op != OpPPC64OR {
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 {
6739 if v_0_1.Op != OpPPC64MOVHZreg {
6743 v.reset(OpPPC64MOVBZreg)
6744 v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6751 // match: (MOVBZreg (XOR <t> x (MOVHZreg y)))
6752 // result: (MOVBZreg (XOR <t> x y))
6754 if v_0.Op != OpPPC64XOR {
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 {
6763 if v_0_1.Op != OpPPC64MOVHZreg {
6767 v.reset(OpPPC64MOVBZreg)
6768 v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6775 // match: (MOVBZreg (AND <t> x (MOVHZreg y)))
6776 // result: (MOVBZreg (AND <t> x y))
6778 if v_0.Op != OpPPC64AND {
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 {
6787 if v_0_1.Op != OpPPC64MOVHZreg {
6791 v.reset(OpPPC64MOVBZreg)
6792 v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6799 // match: (MOVBZreg (OR <t> x (MOVBZreg y)))
6800 // result: (MOVBZreg (OR <t> x y))
6802 if v_0.Op != OpPPC64OR {
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 {
6811 if v_0_1.Op != OpPPC64MOVBZreg {
6815 v.reset(OpPPC64MOVBZreg)
6816 v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
6823 // match: (MOVBZreg (XOR <t> x (MOVBZreg y)))
6824 // result: (MOVBZreg (XOR <t> x y))
6826 if v_0.Op != OpPPC64XOR {
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 {
6835 if v_0_1.Op != OpPPC64MOVBZreg {
6839 v.reset(OpPPC64MOVBZreg)
6840 v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
6847 // match: (MOVBZreg (AND <t> x (MOVBZreg y)))
6848 // result: (MOVBZreg (AND <t> x y))
6850 if v_0.Op != OpPPC64AND {
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 {
6859 if v_0_1.Op != OpPPC64MOVBZreg {
6863 v.reset(OpPPC64MOVBZreg)
6864 v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
6871 // match: (MOVBZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x))))
6875 if z.Op != OpSelect0 {
6879 if z_0.Op != OpPPC64ANDCCconst {
6882 z_0_0 := z_0.Args[0]
6883 if z_0_0.Op != OpPPC64MOVBZload {
6889 // match: (MOVBZreg z:(AND y (MOVBZload ptr x)))
6893 if z.Op != OpPPC64AND {
6899 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
6900 if z_1.Op != OpPPC64MOVBZload {
6908 // match: (MOVBZreg x:(MOVBZload _ _))
6912 if x.Op != OpPPC64MOVBZload {
6918 // match: (MOVBZreg x:(MOVBZloadidx _ _ _))
6922 if x.Op != OpPPC64MOVBZloadidx {
6928 // match: (MOVBZreg x:(Select0 (LoweredAtomicLoad8 _ _)))
6932 if x.Op != OpSelect0 {
6936 if x_0.Op != OpPPC64LoweredAtomicLoad8 {
6942 // match: (MOVBZreg x:(Arg <t>))
6943 // cond: is8BitInt(t) && !t.IsSigned()
6951 if !(is8BitInt(t) && !t.IsSigned()) {
6957 // match: (MOVBZreg (MOVDconst [c]))
6958 // result: (MOVDconst [int64(uint8(c))])
6960 if v_0.Op != OpPPC64MOVDconst {
6963 c := auxIntToInt64(v_0.AuxInt)
6964 v.reset(OpPPC64MOVDconst)
6965 v.AuxInt = int64ToAuxInt(int64(uint8(c)))
6970 func rewriteValuePPC64_OpPPC64MOVBreg(v *Value) bool {
6973 typ := &b.Func.Config.Types
6974 // match: (MOVBreg y:(Select0 (ANDCCconst [c] _)))
6975 // cond: uint64(c) <= 0x7F
6979 if y.Op != OpSelect0 {
6983 if y_0.Op != OpPPC64ANDCCconst {
6986 c := auxIntToInt64(y_0.AuxInt)
6987 if !(uint64(c) <= 0x7F) {
6993 // match: (MOVBreg (SRAWconst [c] (MOVBreg x)))
6994 // result: (SRAWconst [c] (MOVBreg x))
6996 if v_0.Op != OpPPC64SRAWconst {
6999 c := auxIntToInt64(v_0.AuxInt)
7000 v_0_0 := v_0.Args[0]
7001 if v_0_0.Op != OpPPC64MOVBreg {
7005 v.reset(OpPPC64SRAWconst)
7006 v.AuxInt = int64ToAuxInt(c)
7007 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
7012 // match: (MOVBreg (SRAWconst [c] x))
7013 // cond: sizeof(x.Type) == 8
7014 // result: (SRAWconst [c] x)
7016 if v_0.Op != OpPPC64SRAWconst {
7019 c := auxIntToInt64(v_0.AuxInt)
7021 if !(sizeof(x.Type) == 8) {
7024 v.reset(OpPPC64SRAWconst)
7025 v.AuxInt = int64ToAuxInt(c)
7029 // match: (MOVBreg (SRDconst [c] x))
7031 // result: (SRDconst [c] x)
7033 if v_0.Op != OpPPC64SRDconst {
7036 c := auxIntToInt64(v_0.AuxInt)
7041 v.reset(OpPPC64SRDconst)
7042 v.AuxInt = int64ToAuxInt(c)
7046 // match: (MOVBreg (SRDconst [c] x))
7048 // result: (SRADconst [c] x)
7050 if v_0.Op != OpPPC64SRDconst {
7053 c := auxIntToInt64(v_0.AuxInt)
7058 v.reset(OpPPC64SRADconst)
7059 v.AuxInt = int64ToAuxInt(c)
7063 // match: (MOVBreg (SRADconst [c] x))
7065 // result: (SRADconst [c] x)
7067 if v_0.Op != OpPPC64SRADconst {
7070 c := auxIntToInt64(v_0.AuxInt)
7075 v.reset(OpPPC64SRADconst)
7076 v.AuxInt = int64ToAuxInt(c)
7080 // match: (MOVBreg (SRWconst [c] x))
7082 // result: (SRWconst [c] x)
7084 if v_0.Op != OpPPC64SRWconst {
7087 c := auxIntToInt64(v_0.AuxInt)
7092 v.reset(OpPPC64SRWconst)
7093 v.AuxInt = int64ToAuxInt(c)
7097 // match: (MOVBreg (SRWconst [c] x))
7099 // result: (SRAWconst [c] x)
7101 if v_0.Op != OpPPC64SRWconst {
7104 c := auxIntToInt64(v_0.AuxInt)
7109 v.reset(OpPPC64SRAWconst)
7110 v.AuxInt = int64ToAuxInt(c)
7114 // match: (MOVBreg (SRAWconst [c] x))
7116 // result: (SRAWconst [c] x)
7118 if v_0.Op != OpPPC64SRAWconst {
7121 c := auxIntToInt64(v_0.AuxInt)
7126 v.reset(OpPPC64SRAWconst)
7127 v.AuxInt = int64ToAuxInt(c)
7131 // match: (MOVBreg y:(MOVBreg _))
7135 if y.Op != OpPPC64MOVBreg {
7141 // match: (MOVBreg (MOVBZreg x))
7142 // result: (MOVBreg x)
7144 if v_0.Op != OpPPC64MOVBZreg {
7148 v.reset(OpPPC64MOVBreg)
7152 // match: (MOVBreg x:(Arg <t>))
7153 // cond: is8BitInt(t) && t.IsSigned()
7161 if !(is8BitInt(t) && t.IsSigned()) {
7167 // match: (MOVBreg (MOVDconst [c]))
7168 // result: (MOVDconst [int64(int8(c))])
7170 if v_0.Op != OpPPC64MOVDconst {
7173 c := auxIntToInt64(v_0.AuxInt)
7174 v.reset(OpPPC64MOVDconst)
7175 v.AuxInt = int64ToAuxInt(int64(int8(c)))
7180 func rewriteValuePPC64_OpPPC64MOVBstore(v *Value) bool {
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)
7190 off1 := auxIntToInt32(v.AuxInt)
7191 sym := auxToSym(v.Aux)
7192 if v_0.Op != OpPPC64ADDconst {
7195 off2 := auxIntToInt64(v_0.AuxInt)
7199 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
7202 v.reset(OpPPC64MOVBstore)
7203 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7204 v.Aux = symToAux(sym)
7205 v.AddArg3(x, val, mem)
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)
7212 off1 := auxIntToInt32(v.AuxInt)
7213 sym1 := auxToSym(v.Aux)
7215 if p.Op != OpPPC64MOVDaddr {
7218 off2 := auxIntToInt32(p.AuxInt)
7219 sym2 := auxToSym(p.Aux)
7223 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7226 v.reset(OpPPC64MOVBstore)
7227 v.AuxInt = int32ToAuxInt(off1 + off2)
7228 v.Aux = symToAux(mergeSym(sym1, sym2))
7229 v.AddArg3(ptr, val, mem)
7232 // match: (MOVBstore [off] {sym} ptr (MOVDconst [0]) mem)
7233 // result: (MOVBstorezero [off] {sym} ptr mem)
7235 off := auxIntToInt32(v.AuxInt)
7236 sym := auxToSym(v.Aux)
7238 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
7242 v.reset(OpPPC64MOVBstorezero)
7243 v.AuxInt = int32ToAuxInt(off)
7244 v.Aux = symToAux(sym)
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)
7252 if auxIntToInt32(v.AuxInt) != 0 {
7255 sym := auxToSym(v.Aux)
7257 if p.Op != OpPPC64ADD {
7264 if !(sym == nil && p.Uses == 1) {
7267 v.reset(OpPPC64MOVBstoreidx)
7268 v.AddArg4(ptr, idx, val, mem)
7271 // match: (MOVBstore [off] {sym} ptr (MOVBreg x) mem)
7272 // result: (MOVBstore [off] {sym} ptr x mem)
7274 off := auxIntToInt32(v.AuxInt)
7275 sym := auxToSym(v.Aux)
7277 if v_1.Op != OpPPC64MOVBreg {
7282 v.reset(OpPPC64MOVBstore)
7283 v.AuxInt = int32ToAuxInt(off)
7284 v.Aux = symToAux(sym)
7285 v.AddArg3(ptr, x, mem)
7288 // match: (MOVBstore [off] {sym} ptr (MOVBZreg x) mem)
7289 // result: (MOVBstore [off] {sym} ptr x mem)
7291 off := auxIntToInt32(v.AuxInt)
7292 sym := auxToSym(v.Aux)
7294 if v_1.Op != OpPPC64MOVBZreg {
7299 v.reset(OpPPC64MOVBstore)
7300 v.AuxInt = int32ToAuxInt(off)
7301 v.Aux = symToAux(sym)
7302 v.AddArg3(ptr, x, mem)
7305 // match: (MOVBstore [off] {sym} ptr (MOVHreg x) mem)
7306 // result: (MOVBstore [off] {sym} ptr x mem)
7308 off := auxIntToInt32(v.AuxInt)
7309 sym := auxToSym(v.Aux)
7311 if v_1.Op != OpPPC64MOVHreg {
7316 v.reset(OpPPC64MOVBstore)
7317 v.AuxInt = int32ToAuxInt(off)
7318 v.Aux = symToAux(sym)
7319 v.AddArg3(ptr, x, mem)
7322 // match: (MOVBstore [off] {sym} ptr (MOVHZreg x) mem)
7323 // result: (MOVBstore [off] {sym} ptr x mem)
7325 off := auxIntToInt32(v.AuxInt)
7326 sym := auxToSym(v.Aux)
7328 if v_1.Op != OpPPC64MOVHZreg {
7333 v.reset(OpPPC64MOVBstore)
7334 v.AuxInt = int32ToAuxInt(off)
7335 v.Aux = symToAux(sym)
7336 v.AddArg3(ptr, x, mem)
7339 // match: (MOVBstore [off] {sym} ptr (MOVWreg x) mem)
7340 // result: (MOVBstore [off] {sym} ptr x mem)
7342 off := auxIntToInt32(v.AuxInt)
7343 sym := auxToSym(v.Aux)
7345 if v_1.Op != OpPPC64MOVWreg {
7350 v.reset(OpPPC64MOVBstore)
7351 v.AuxInt = int32ToAuxInt(off)
7352 v.Aux = symToAux(sym)
7353 v.AddArg3(ptr, x, mem)
7356 // match: (MOVBstore [off] {sym} ptr (MOVWZreg x) mem)
7357 // result: (MOVBstore [off] {sym} ptr x mem)
7359 off := auxIntToInt32(v.AuxInt)
7360 sym := auxToSym(v.Aux)
7362 if v_1.Op != OpPPC64MOVWZreg {
7367 v.reset(OpPPC64MOVBstore)
7368 v.AuxInt = int32ToAuxInt(off)
7369 v.Aux = symToAux(sym)
7370 v.AddArg3(ptr, x, mem)
7373 // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVHreg x) [c]) mem)
7375 // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7377 off := auxIntToInt32(v.AuxInt)
7378 sym := auxToSym(v.Aux)
7380 if v_1.Op != OpPPC64SRWconst {
7383 c := auxIntToInt64(v_1.AuxInt)
7384 v_1_0 := v_1.Args[0]
7385 if v_1_0.Op != OpPPC64MOVHreg {
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)
7399 v.AddArg3(ptr, v0, mem)
7402 // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVHZreg x) [c]) mem)
7404 // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7406 off := auxIntToInt32(v.AuxInt)
7407 sym := auxToSym(v.Aux)
7409 if v_1.Op != OpPPC64SRWconst {
7412 c := auxIntToInt64(v_1.AuxInt)
7413 v_1_0 := v_1.Args[0]
7414 if v_1_0.Op != OpPPC64MOVHZreg {
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)
7428 v.AddArg3(ptr, v0, mem)
7431 // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVWreg x) [c]) mem)
7433 // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7435 off := auxIntToInt32(v.AuxInt)
7436 sym := auxToSym(v.Aux)
7438 if v_1.Op != OpPPC64SRWconst {
7441 c := auxIntToInt64(v_1.AuxInt)
7442 v_1_0 := v_1.Args[0]
7443 if v_1_0.Op != OpPPC64MOVWreg {
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)
7457 v.AddArg3(ptr, v0, mem)
7460 // match: (MOVBstore [off] {sym} ptr (SRWconst (MOVWZreg x) [c]) mem)
7462 // result: (MOVBstore [off] {sym} ptr (SRWconst <typ.UInt32> x [c]) mem)
7464 off := auxIntToInt32(v.AuxInt)
7465 sym := auxToSym(v.Aux)
7467 if v_1.Op != OpPPC64SRWconst {
7470 c := auxIntToInt64(v_1.AuxInt)
7471 v_1_0 := v_1.Args[0]
7472 if v_1_0.Op != OpPPC64MOVWZreg {
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)
7486 v.AddArg3(ptr, v0, mem)
7491 func rewriteValuePPC64_OpPPC64MOVBstoreidx(v *Value) bool {
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)
7503 if v_1.Op != OpPPC64MOVDconst {
7506 c := auxIntToInt64(v_1.AuxInt)
7509 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7512 v.reset(OpPPC64MOVBstore)
7513 v.AuxInt = int32ToAuxInt(int32(c))
7514 v.AddArg3(ptr, val, mem)
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)
7521 if v_0.Op != OpPPC64MOVDconst {
7524 c := auxIntToInt64(v_0.AuxInt)
7528 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7531 v.reset(OpPPC64MOVBstore)
7532 v.AuxInt = int32ToAuxInt(int32(c))
7533 v.AddArg3(ptr, val, mem)
7536 // match: (MOVBstoreidx ptr idx (MOVBreg x) mem)
7537 // result: (MOVBstoreidx ptr idx x mem)
7541 if v_2.Op != OpPPC64MOVBreg {
7546 v.reset(OpPPC64MOVBstoreidx)
7547 v.AddArg4(ptr, idx, x, mem)
7550 // match: (MOVBstoreidx ptr idx (MOVBZreg x) mem)
7551 // result: (MOVBstoreidx ptr idx x mem)
7555 if v_2.Op != OpPPC64MOVBZreg {
7560 v.reset(OpPPC64MOVBstoreidx)
7561 v.AddArg4(ptr, idx, x, mem)
7564 // match: (MOVBstoreidx ptr idx (MOVHreg x) mem)
7565 // result: (MOVBstoreidx ptr idx x mem)
7569 if v_2.Op != OpPPC64MOVHreg {
7574 v.reset(OpPPC64MOVBstoreidx)
7575 v.AddArg4(ptr, idx, x, mem)
7578 // match: (MOVBstoreidx ptr idx (MOVHZreg x) mem)
7579 // result: (MOVBstoreidx ptr idx x mem)
7583 if v_2.Op != OpPPC64MOVHZreg {
7588 v.reset(OpPPC64MOVBstoreidx)
7589 v.AddArg4(ptr, idx, x, mem)
7592 // match: (MOVBstoreidx ptr idx (MOVWreg x) mem)
7593 // result: (MOVBstoreidx ptr idx x mem)
7597 if v_2.Op != OpPPC64MOVWreg {
7602 v.reset(OpPPC64MOVBstoreidx)
7603 v.AddArg4(ptr, idx, x, mem)
7606 // match: (MOVBstoreidx ptr idx (MOVWZreg x) mem)
7607 // result: (MOVBstoreidx ptr idx x mem)
7611 if v_2.Op != OpPPC64MOVWZreg {
7616 v.reset(OpPPC64MOVBstoreidx)
7617 v.AddArg4(ptr, idx, x, mem)
7620 // match: (MOVBstoreidx ptr idx (SRWconst (MOVHreg x) [c]) mem)
7622 // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7626 if v_2.Op != OpPPC64SRWconst {
7629 c := auxIntToInt64(v_2.AuxInt)
7630 v_2_0 := v_2.Args[0]
7631 if v_2_0.Op != OpPPC64MOVHreg {
7639 v.reset(OpPPC64MOVBstoreidx)
7640 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7641 v0.AuxInt = int64ToAuxInt(c)
7643 v.AddArg4(ptr, idx, v0, mem)
7646 // match: (MOVBstoreidx ptr idx (SRWconst (MOVHZreg x) [c]) mem)
7648 // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7652 if v_2.Op != OpPPC64SRWconst {
7655 c := auxIntToInt64(v_2.AuxInt)
7656 v_2_0 := v_2.Args[0]
7657 if v_2_0.Op != OpPPC64MOVHZreg {
7665 v.reset(OpPPC64MOVBstoreidx)
7666 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7667 v0.AuxInt = int64ToAuxInt(c)
7669 v.AddArg4(ptr, idx, v0, mem)
7672 // match: (MOVBstoreidx ptr idx (SRWconst (MOVWreg x) [c]) mem)
7674 // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7678 if v_2.Op != OpPPC64SRWconst {
7681 c := auxIntToInt64(v_2.AuxInt)
7682 v_2_0 := v_2.Args[0]
7683 if v_2_0.Op != OpPPC64MOVWreg {
7691 v.reset(OpPPC64MOVBstoreidx)
7692 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7693 v0.AuxInt = int64ToAuxInt(c)
7695 v.AddArg4(ptr, idx, v0, mem)
7698 // match: (MOVBstoreidx ptr idx (SRWconst (MOVWZreg x) [c]) mem)
7700 // result: (MOVBstoreidx ptr idx (SRWconst <typ.UInt32> x [c]) mem)
7704 if v_2.Op != OpPPC64SRWconst {
7707 c := auxIntToInt64(v_2.AuxInt)
7708 v_2_0 := v_2.Args[0]
7709 if v_2_0.Op != OpPPC64MOVWZreg {
7717 v.reset(OpPPC64MOVBstoreidx)
7718 v0 := b.NewValue0(v.Pos, OpPPC64SRWconst, typ.UInt32)
7719 v0.AuxInt = int64ToAuxInt(c)
7721 v.AddArg4(ptr, idx, v0, mem)
7726 func rewriteValuePPC64_OpPPC64MOVBstorezero(v *Value) bool {
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)
7733 off1 := auxIntToInt32(v.AuxInt)
7734 sym := auxToSym(v.Aux)
7735 if v_0.Op != OpPPC64ADDconst {
7738 off2 := auxIntToInt64(v_0.AuxInt)
7741 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
7744 v.reset(OpPPC64MOVBstorezero)
7745 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7746 v.Aux = symToAux(sym)
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)
7754 off1 := auxIntToInt32(v.AuxInt)
7755 sym1 := auxToSym(v.Aux)
7757 if p.Op != OpPPC64MOVDaddr {
7760 off2 := auxIntToInt32(p.AuxInt)
7761 sym2 := auxToSym(p.Aux)
7764 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7767 v.reset(OpPPC64MOVBstorezero)
7768 v.AuxInt = int32ToAuxInt(off1 + off2)
7769 v.Aux = symToAux(mergeSym(sym1, sym2))
7775 func rewriteValuePPC64_OpPPC64MOVDaddr(v *Value) bool {
7777 // match: (MOVDaddr {sym} [n] p:(ADD x y))
7778 // cond: sym == nil && n == 0
7781 n := auxIntToInt32(v.AuxInt)
7782 sym := auxToSym(v.Aux)
7784 if p.Op != OpPPC64ADD {
7787 if !(sym == nil && n == 0) {
7793 // match: (MOVDaddr {sym} [n] ptr)
7794 // cond: sym == nil && n == 0 && (ptr.Op == OpArgIntReg || ptr.Op == OpPhi)
7797 n := auxIntToInt32(v.AuxInt)
7798 sym := auxToSym(v.Aux)
7800 if !(sym == nil && n == 0 && (ptr.Op == OpArgIntReg || ptr.Op == OpPhi)) {
7808 func rewriteValuePPC64_OpPPC64MOVDload(v *Value) bool {
7811 // match: (MOVDload [off] {sym} ptr (FMOVDstore [off] {sym} ptr x _))
7812 // result: (MFVSRD x)
7814 off := auxIntToInt32(v.AuxInt)
7815 sym := auxToSym(v.Aux)
7817 if v_1.Op != OpPPC64FMOVDstore || auxIntToInt32(v_1.AuxInt) != off || auxToSym(v_1.Aux) != sym {
7821 if ptr != v_1.Args[0] {
7824 v.reset(OpPPC64MFVSRD)
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)
7832 off1 := auxIntToInt32(v.AuxInt)
7833 sym1 := auxToSym(v.Aux)
7835 if p.Op != OpPPC64MOVDaddr {
7838 off2 := auxIntToInt32(p.AuxInt)
7839 sym2 := auxToSym(p.Aux)
7842 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
7845 v.reset(OpPPC64MOVDload)
7846 v.AuxInt = int32ToAuxInt(off1 + off2)
7847 v.Aux = symToAux(mergeSym(sym1, sym2))
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)
7855 off1 := auxIntToInt32(v.AuxInt)
7856 sym := auxToSym(v.Aux)
7857 if v_0.Op != OpPPC64ADDconst {
7860 off2 := auxIntToInt64(v_0.AuxInt)
7863 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
7866 v.reset(OpPPC64MOVDload)
7867 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7868 v.Aux = symToAux(sym)
7872 // match: (MOVDload [0] {sym} p:(ADD ptr idx) mem)
7873 // cond: sym == nil && p.Uses == 1
7874 // result: (MOVDloadidx ptr idx mem)
7876 if auxIntToInt32(v.AuxInt) != 0 {
7879 sym := auxToSym(v.Aux)
7881 if p.Op != OpPPC64ADD {
7887 if !(sym == nil && p.Uses == 1) {
7890 v.reset(OpPPC64MOVDloadidx)
7891 v.AddArg3(ptr, idx, mem)
7896 func rewriteValuePPC64_OpPPC64MOVDloadidx(v *Value) bool {
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)
7905 if v_1.Op != OpPPC64MOVDconst {
7908 c := auxIntToInt64(v_1.AuxInt)
7910 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7913 v.reset(OpPPC64MOVDload)
7914 v.AuxInt = int32ToAuxInt(int32(c))
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)
7922 if v_0.Op != OpPPC64MOVDconst {
7925 c := auxIntToInt64(v_0.AuxInt)
7928 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
7931 v.reset(OpPPC64MOVDload)
7932 v.AuxInt = int32ToAuxInt(int32(c))
7938 func rewriteValuePPC64_OpPPC64MOVDstore(v *Value) bool {
7943 // match: (MOVDstore [off] {sym} ptr (MFVSRD x) mem)
7944 // result: (FMOVDstore [off] {sym} ptr x mem)
7946 off := auxIntToInt32(v.AuxInt)
7947 sym := auxToSym(v.Aux)
7949 if v_1.Op != OpPPC64MFVSRD {
7954 v.reset(OpPPC64FMOVDstore)
7955 v.AuxInt = int32ToAuxInt(off)
7956 v.Aux = symToAux(sym)
7957 v.AddArg3(ptr, x, mem)
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)
7964 off1 := auxIntToInt32(v.AuxInt)
7965 sym := auxToSym(v.Aux)
7966 if v_0.Op != OpPPC64ADDconst {
7969 off2 := auxIntToInt64(v_0.AuxInt)
7973 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
7976 v.reset(OpPPC64MOVDstore)
7977 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
7978 v.Aux = symToAux(sym)
7979 v.AddArg3(x, val, mem)
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)
7986 off1 := auxIntToInt32(v.AuxInt)
7987 sym1 := auxToSym(v.Aux)
7989 if p.Op != OpPPC64MOVDaddr {
7992 off2 := auxIntToInt32(p.AuxInt)
7993 sym2 := auxToSym(p.Aux)
7997 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8000 v.reset(OpPPC64MOVDstore)
8001 v.AuxInt = int32ToAuxInt(off1 + off2)
8002 v.Aux = symToAux(mergeSym(sym1, sym2))
8003 v.AddArg3(ptr, val, mem)
8006 // match: (MOVDstore [off] {sym} ptr (MOVDconst [0]) mem)
8007 // result: (MOVDstorezero [off] {sym} ptr mem)
8009 off := auxIntToInt32(v.AuxInt)
8010 sym := auxToSym(v.Aux)
8012 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
8016 v.reset(OpPPC64MOVDstorezero)
8017 v.AuxInt = int32ToAuxInt(off)
8018 v.Aux = symToAux(sym)
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)
8026 if auxIntToInt32(v.AuxInt) != 0 {
8029 sym := auxToSym(v.Aux)
8031 if p.Op != OpPPC64ADD {
8038 if !(sym == nil && p.Uses == 1) {
8041 v.reset(OpPPC64MOVDstoreidx)
8042 v.AddArg4(ptr, idx, val, mem)
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)
8049 off := auxIntToInt32(v.AuxInt)
8050 sym := auxToSym(v.Aux)
8053 if r.Op != OpPPC64BRD {
8061 v.reset(OpPPC64MOVDBRstore)
8062 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
8063 v0.AuxInt = int32ToAuxInt(off)
8064 v0.Aux = symToAux(sym)
8066 v.AddArg3(v0, val, mem)
8069 // match: (MOVDstore [off] {sym} ptr (Bswap64 val) mem)
8070 // result: (MOVDBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
8072 off := auxIntToInt32(v.AuxInt)
8073 sym := auxToSym(v.Aux)
8075 if v_1.Op != OpBswap64 {
8080 v.reset(OpPPC64MOVDBRstore)
8081 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
8082 v0.AuxInt = int32ToAuxInt(off)
8083 v0.Aux = symToAux(sym)
8085 v.AddArg3(v0, val, mem)
8090 func rewriteValuePPC64_OpPPC64MOVDstoreidx(v *Value) bool {
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)
8100 if v_1.Op != OpPPC64MOVDconst {
8103 c := auxIntToInt64(v_1.AuxInt)
8106 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8109 v.reset(OpPPC64MOVDstore)
8110 v.AuxInt = int32ToAuxInt(int32(c))
8111 v.AddArg3(ptr, val, mem)
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)
8118 if v_0.Op != OpPPC64MOVDconst {
8121 c := auxIntToInt64(v_0.AuxInt)
8125 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8128 v.reset(OpPPC64MOVDstore)
8129 v.AuxInt = int32ToAuxInt(int32(c))
8130 v.AddArg3(ptr, val, mem)
8133 // match: (MOVDstoreidx ptr idx r:(BRD val) mem)
8134 // cond: r.Uses == 1
8135 // result: (MOVDBRstoreidx ptr idx val mem)
8140 if r.Op != OpPPC64BRD {
8148 v.reset(OpPPC64MOVDBRstoreidx)
8149 v.AddArg4(ptr, idx, val, mem)
8152 // match: (MOVDstoreidx ptr idx (Bswap64 val) mem)
8153 // result: (MOVDBRstoreidx ptr idx val mem)
8157 if v_2.Op != OpBswap64 {
8162 v.reset(OpPPC64MOVDBRstoreidx)
8163 v.AddArg4(ptr, idx, val, mem)
8168 func rewriteValuePPC64_OpPPC64MOVDstorezero(v *Value) bool {
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)
8175 off1 := auxIntToInt32(v.AuxInt)
8176 sym := auxToSym(v.Aux)
8177 if v_0.Op != OpPPC64ADDconst {
8180 off2 := auxIntToInt64(v_0.AuxInt)
8183 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
8186 v.reset(OpPPC64MOVDstorezero)
8187 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8188 v.Aux = symToAux(sym)
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)
8196 off1 := auxIntToInt32(v.AuxInt)
8197 sym1 := auxToSym(v.Aux)
8199 if p.Op != OpPPC64MOVDaddr {
8202 off2 := auxIntToInt32(p.AuxInt)
8203 sym2 := auxToSym(p.Aux)
8206 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8209 v.reset(OpPPC64MOVDstorezero)
8210 v.AuxInt = int32ToAuxInt(off1 + off2)
8211 v.Aux = symToAux(mergeSym(sym1, sym2))
8217 func rewriteValuePPC64_OpPPC64MOVHBRstore(v *Value) bool {
8221 // match: (MOVHBRstore ptr (MOVHreg x) mem)
8222 // result: (MOVHBRstore ptr x mem)
8225 if v_1.Op != OpPPC64MOVHreg {
8230 v.reset(OpPPC64MOVHBRstore)
8231 v.AddArg3(ptr, x, mem)
8234 // match: (MOVHBRstore ptr (MOVHZreg x) mem)
8235 // result: (MOVHBRstore ptr x mem)
8238 if v_1.Op != OpPPC64MOVHZreg {
8243 v.reset(OpPPC64MOVHBRstore)
8244 v.AddArg3(ptr, x, mem)
8247 // match: (MOVHBRstore ptr (MOVWreg x) mem)
8248 // result: (MOVHBRstore ptr x mem)
8251 if v_1.Op != OpPPC64MOVWreg {
8256 v.reset(OpPPC64MOVHBRstore)
8257 v.AddArg3(ptr, x, mem)
8260 // match: (MOVHBRstore ptr (MOVWZreg x) mem)
8261 // result: (MOVHBRstore ptr x mem)
8264 if v_1.Op != OpPPC64MOVWZreg {
8269 v.reset(OpPPC64MOVHBRstore)
8270 v.AddArg3(ptr, x, mem)
8275 func rewriteValuePPC64_OpPPC64MOVHZload(v *Value) bool {
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)
8282 off1 := auxIntToInt32(v.AuxInt)
8283 sym1 := auxToSym(v.Aux)
8285 if p.Op != OpPPC64MOVDaddr {
8288 off2 := auxIntToInt32(p.AuxInt)
8289 sym2 := auxToSym(p.Aux)
8292 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8295 v.reset(OpPPC64MOVHZload)
8296 v.AuxInt = int32ToAuxInt(off1 + off2)
8297 v.Aux = symToAux(mergeSym(sym1, sym2))
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)
8305 off1 := auxIntToInt32(v.AuxInt)
8306 sym := auxToSym(v.Aux)
8307 if v_0.Op != OpPPC64ADDconst {
8310 off2 := auxIntToInt64(v_0.AuxInt)
8313 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
8316 v.reset(OpPPC64MOVHZload)
8317 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8318 v.Aux = symToAux(sym)
8322 // match: (MOVHZload [0] {sym} p:(ADD ptr idx) mem)
8323 // cond: sym == nil && p.Uses == 1
8324 // result: (MOVHZloadidx ptr idx mem)
8326 if auxIntToInt32(v.AuxInt) != 0 {
8329 sym := auxToSym(v.Aux)
8331 if p.Op != OpPPC64ADD {
8337 if !(sym == nil && p.Uses == 1) {
8340 v.reset(OpPPC64MOVHZloadidx)
8341 v.AddArg3(ptr, idx, mem)
8346 func rewriteValuePPC64_OpPPC64MOVHZloadidx(v *Value) bool {
8350 // match: (MOVHZloadidx ptr (MOVDconst [c]) mem)
8351 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8352 // result: (MOVHZload [int32(c)] ptr mem)
8355 if v_1.Op != OpPPC64MOVDconst {
8358 c := auxIntToInt64(v_1.AuxInt)
8360 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8363 v.reset(OpPPC64MOVHZload)
8364 v.AuxInt = int32ToAuxInt(int32(c))
8368 // match: (MOVHZloadidx (MOVDconst [c]) ptr mem)
8369 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8370 // result: (MOVHZload [int32(c)] ptr mem)
8372 if v_0.Op != OpPPC64MOVDconst {
8375 c := auxIntToInt64(v_0.AuxInt)
8378 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8381 v.reset(OpPPC64MOVHZload)
8382 v.AuxInt = int32ToAuxInt(int32(c))
8388 func rewriteValuePPC64_OpPPC64MOVHZreg(v *Value) bool {
8391 typ := &b.Func.Config.Types
8392 // match: (MOVHZreg y:(Select0 (ANDCCconst [c] _)))
8393 // cond: uint64(c) <= 0xFFFF
8397 if y.Op != OpSelect0 {
8401 if y_0.Op != OpPPC64ANDCCconst {
8404 c := auxIntToInt64(y_0.AuxInt)
8405 if !(uint64(c) <= 0xFFFF) {
8411 // match: (MOVHZreg (SRWconst [c] (MOVBZreg x)))
8412 // result: (SRWconst [c] (MOVBZreg x))
8414 if v_0.Op != OpPPC64SRWconst {
8417 c := auxIntToInt64(v_0.AuxInt)
8418 v_0_0 := v_0.Args[0]
8419 if v_0_0.Op != OpPPC64MOVBZreg {
8423 v.reset(OpPPC64SRWconst)
8424 v.AuxInt = int64ToAuxInt(c)
8425 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
8430 // match: (MOVHZreg (SRWconst [c] (MOVHZreg x)))
8431 // result: (SRWconst [c] (MOVHZreg x))
8433 if v_0.Op != OpPPC64SRWconst {
8436 c := auxIntToInt64(v_0.AuxInt)
8437 v_0_0 := v_0.Args[0]
8438 if v_0_0.Op != OpPPC64MOVHZreg {
8442 v.reset(OpPPC64SRWconst)
8443 v.AuxInt = int64ToAuxInt(c)
8444 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
8449 // match: (MOVHZreg (SRWconst [c] x))
8450 // cond: sizeof(x.Type) <= 16
8451 // result: (SRWconst [c] x)
8453 if v_0.Op != OpPPC64SRWconst {
8456 c := auxIntToInt64(v_0.AuxInt)
8458 if !(sizeof(x.Type) <= 16) {
8461 v.reset(OpPPC64SRWconst)
8462 v.AuxInt = int64ToAuxInt(c)
8466 // match: (MOVHZreg (SRDconst [c] x))
8468 // result: (SRDconst [c] x)
8470 if v_0.Op != OpPPC64SRDconst {
8473 c := auxIntToInt64(v_0.AuxInt)
8478 v.reset(OpPPC64SRDconst)
8479 v.AuxInt = int64ToAuxInt(c)
8483 // match: (MOVHZreg (SRWconst [c] x))
8485 // result: (SRWconst [c] x)
8487 if v_0.Op != OpPPC64SRWconst {
8490 c := auxIntToInt64(v_0.AuxInt)
8495 v.reset(OpPPC64SRWconst)
8496 v.AuxInt = int64ToAuxInt(c)
8500 // match: (MOVHZreg y:(MOVHZreg _))
8504 if y.Op != OpPPC64MOVHZreg {
8510 // match: (MOVHZreg y:(MOVBZreg _))
8514 if y.Op != OpPPC64MOVBZreg {
8520 // match: (MOVHZreg y:(MOVHBRload _ _))
8524 if y.Op != OpPPC64MOVHBRload {
8530 // match: (MOVHZreg y:(MOVHreg x))
8531 // result: (MOVHZreg x)
8534 if y.Op != OpPPC64MOVHreg {
8538 v.reset(OpPPC64MOVHZreg)
8542 // match: (MOVHZreg (OR <t> x (MOVWZreg y)))
8543 // result: (MOVHZreg (OR <t> x y))
8545 if v_0.Op != OpPPC64OR {
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 {
8554 if v_0_1.Op != OpPPC64MOVWZreg {
8558 v.reset(OpPPC64MOVHZreg)
8559 v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
8566 // match: (MOVHZreg (XOR <t> x (MOVWZreg y)))
8567 // result: (MOVHZreg (XOR <t> x y))
8569 if v_0.Op != OpPPC64XOR {
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 {
8578 if v_0_1.Op != OpPPC64MOVWZreg {
8582 v.reset(OpPPC64MOVHZreg)
8583 v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
8590 // match: (MOVHZreg (AND <t> x (MOVWZreg y)))
8591 // result: (MOVHZreg (AND <t> x y))
8593 if v_0.Op != OpPPC64AND {
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 {
8602 if v_0_1.Op != OpPPC64MOVWZreg {
8606 v.reset(OpPPC64MOVHZreg)
8607 v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
8614 // match: (MOVHZreg (OR <t> x (MOVHZreg y)))
8615 // result: (MOVHZreg (OR <t> x y))
8617 if v_0.Op != OpPPC64OR {
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 {
8626 if v_0_1.Op != OpPPC64MOVHZreg {
8630 v.reset(OpPPC64MOVHZreg)
8631 v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
8638 // match: (MOVHZreg (XOR <t> x (MOVHZreg y)))
8639 // result: (MOVHZreg (XOR <t> x y))
8641 if v_0.Op != OpPPC64XOR {
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 {
8650 if v_0_1.Op != OpPPC64MOVHZreg {
8654 v.reset(OpPPC64MOVHZreg)
8655 v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
8662 // match: (MOVHZreg (AND <t> x (MOVHZreg y)))
8663 // result: (MOVHZreg (AND <t> x y))
8665 if v_0.Op != OpPPC64AND {
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 {
8674 if v_0_1.Op != OpPPC64MOVHZreg {
8678 v.reset(OpPPC64MOVHZreg)
8679 v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
8686 // match: (MOVHZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x))))
8690 if z.Op != OpSelect0 {
8694 if z_0.Op != OpPPC64ANDCCconst {
8697 z_0_0 := z_0.Args[0]
8698 if z_0_0.Op != OpPPC64MOVBZload {
8704 // match: (MOVHZreg z:(AND y (MOVHZload ptr x)))
8708 if z.Op != OpPPC64AND {
8714 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
8715 if z_1.Op != OpPPC64MOVHZload {
8723 // match: (MOVHZreg z:(Select0 (ANDCCconst [c] (MOVHZload ptr x))))
8727 if z.Op != OpSelect0 {
8731 if z_0.Op != OpPPC64ANDCCconst {
8734 z_0_0 := z_0.Args[0]
8735 if z_0_0.Op != OpPPC64MOVHZload {
8741 // match: (MOVHZreg x:(MOVBZload _ _))
8745 if x.Op != OpPPC64MOVBZload {
8751 // match: (MOVHZreg x:(MOVBZloadidx _ _ _))
8755 if x.Op != OpPPC64MOVBZloadidx {
8761 // match: (MOVHZreg x:(MOVHZload _ _))
8765 if x.Op != OpPPC64MOVHZload {
8771 // match: (MOVHZreg x:(MOVHZloadidx _ _ _))
8775 if x.Op != OpPPC64MOVHZloadidx {
8781 // match: (MOVHZreg x:(Arg <t>))
8782 // cond: (is8BitInt(t) || is16BitInt(t)) && !t.IsSigned()
8790 if !((is8BitInt(t) || is16BitInt(t)) && !t.IsSigned()) {
8796 // match: (MOVHZreg (MOVDconst [c]))
8797 // result: (MOVDconst [int64(uint16(c))])
8799 if v_0.Op != OpPPC64MOVDconst {
8802 c := auxIntToInt64(v_0.AuxInt)
8803 v.reset(OpPPC64MOVDconst)
8804 v.AuxInt = int64ToAuxInt(int64(uint16(c)))
8809 func rewriteValuePPC64_OpPPC64MOVHload(v *Value) bool {
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)
8816 off1 := auxIntToInt32(v.AuxInt)
8817 sym1 := auxToSym(v.Aux)
8819 if p.Op != OpPPC64MOVDaddr {
8822 off2 := auxIntToInt32(p.AuxInt)
8823 sym2 := auxToSym(p.Aux)
8826 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
8829 v.reset(OpPPC64MOVHload)
8830 v.AuxInt = int32ToAuxInt(off1 + off2)
8831 v.Aux = symToAux(mergeSym(sym1, sym2))
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)
8839 off1 := auxIntToInt32(v.AuxInt)
8840 sym := auxToSym(v.Aux)
8841 if v_0.Op != OpPPC64ADDconst {
8844 off2 := auxIntToInt64(v_0.AuxInt)
8847 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
8850 v.reset(OpPPC64MOVHload)
8851 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
8852 v.Aux = symToAux(sym)
8856 // match: (MOVHload [0] {sym} p:(ADD ptr idx) mem)
8857 // cond: sym == nil && p.Uses == 1
8858 // result: (MOVHloadidx ptr idx mem)
8860 if auxIntToInt32(v.AuxInt) != 0 {
8863 sym := auxToSym(v.Aux)
8865 if p.Op != OpPPC64ADD {
8871 if !(sym == nil && p.Uses == 1) {
8874 v.reset(OpPPC64MOVHloadidx)
8875 v.AddArg3(ptr, idx, mem)
8880 func rewriteValuePPC64_OpPPC64MOVHloadidx(v *Value) bool {
8884 // match: (MOVHloadidx ptr (MOVDconst [c]) mem)
8885 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8886 // result: (MOVHload [int32(c)] ptr mem)
8889 if v_1.Op != OpPPC64MOVDconst {
8892 c := auxIntToInt64(v_1.AuxInt)
8894 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8897 v.reset(OpPPC64MOVHload)
8898 v.AuxInt = int32ToAuxInt(int32(c))
8902 // match: (MOVHloadidx (MOVDconst [c]) ptr mem)
8903 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
8904 // result: (MOVHload [int32(c)] ptr mem)
8906 if v_0.Op != OpPPC64MOVDconst {
8909 c := auxIntToInt64(v_0.AuxInt)
8912 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
8915 v.reset(OpPPC64MOVHload)
8916 v.AuxInt = int32ToAuxInt(int32(c))
8922 func rewriteValuePPC64_OpPPC64MOVHreg(v *Value) bool {
8925 typ := &b.Func.Config.Types
8926 // match: (MOVHreg y:(Select0 (ANDCCconst [c] _)))
8927 // cond: uint64(c) <= 0x7FFF
8931 if y.Op != OpSelect0 {
8935 if y_0.Op != OpPPC64ANDCCconst {
8938 c := auxIntToInt64(y_0.AuxInt)
8939 if !(uint64(c) <= 0x7FFF) {
8945 // match: (MOVHreg (SRAWconst [c] (MOVBreg x)))
8946 // result: (SRAWconst [c] (MOVBreg x))
8948 if v_0.Op != OpPPC64SRAWconst {
8951 c := auxIntToInt64(v_0.AuxInt)
8952 v_0_0 := v_0.Args[0]
8953 if v_0_0.Op != OpPPC64MOVBreg {
8957 v.reset(OpPPC64SRAWconst)
8958 v.AuxInt = int64ToAuxInt(c)
8959 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
8964 // match: (MOVHreg (SRAWconst [c] (MOVHreg x)))
8965 // result: (SRAWconst [c] (MOVHreg x))
8967 if v_0.Op != OpPPC64SRAWconst {
8970 c := auxIntToInt64(v_0.AuxInt)
8971 v_0_0 := v_0.Args[0]
8972 if v_0_0.Op != OpPPC64MOVHreg {
8976 v.reset(OpPPC64SRAWconst)
8977 v.AuxInt = int64ToAuxInt(c)
8978 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
8983 // match: (MOVHreg (SRAWconst [c] x))
8984 // cond: sizeof(x.Type) <= 16
8985 // result: (SRAWconst [c] x)
8987 if v_0.Op != OpPPC64SRAWconst {
8990 c := auxIntToInt64(v_0.AuxInt)
8992 if !(sizeof(x.Type) <= 16) {
8995 v.reset(OpPPC64SRAWconst)
8996 v.AuxInt = int64ToAuxInt(c)
9000 // match: (MOVHreg (SRDconst [c] x))
9002 // result: (SRDconst [c] x)
9004 if v_0.Op != OpPPC64SRDconst {
9007 c := auxIntToInt64(v_0.AuxInt)
9012 v.reset(OpPPC64SRDconst)
9013 v.AuxInt = int64ToAuxInt(c)
9017 // match: (MOVHreg (SRDconst [c] x))
9019 // result: (SRADconst [c] x)
9021 if v_0.Op != OpPPC64SRDconst {
9024 c := auxIntToInt64(v_0.AuxInt)
9029 v.reset(OpPPC64SRADconst)
9030 v.AuxInt = int64ToAuxInt(c)
9034 // match: (MOVHreg (SRADconst [c] x))
9036 // result: (SRADconst [c] x)
9038 if v_0.Op != OpPPC64SRADconst {
9041 c := auxIntToInt64(v_0.AuxInt)
9046 v.reset(OpPPC64SRADconst)
9047 v.AuxInt = int64ToAuxInt(c)
9051 // match: (MOVHreg (SRWconst [c] x))
9053 // result: (SRWconst [c] x)
9055 if v_0.Op != OpPPC64SRWconst {
9058 c := auxIntToInt64(v_0.AuxInt)
9063 v.reset(OpPPC64SRWconst)
9064 v.AuxInt = int64ToAuxInt(c)
9068 // match: (MOVHreg (SRAWconst [c] x))
9070 // result: (SRAWconst [c] x)
9072 if v_0.Op != OpPPC64SRAWconst {
9075 c := auxIntToInt64(v_0.AuxInt)
9080 v.reset(OpPPC64SRAWconst)
9081 v.AuxInt = int64ToAuxInt(c)
9085 // match: (MOVHreg (SRWconst [c] x))
9087 // result: (SRAWconst [c] x)
9089 if v_0.Op != OpPPC64SRWconst {
9092 c := auxIntToInt64(v_0.AuxInt)
9097 v.reset(OpPPC64SRAWconst)
9098 v.AuxInt = int64ToAuxInt(c)
9102 // match: (MOVHreg y:(MOVHreg _))
9106 if y.Op != OpPPC64MOVHreg {
9112 // match: (MOVHreg y:(MOVBreg _))
9116 if y.Op != OpPPC64MOVBreg {
9122 // match: (MOVHreg y:(MOVHZreg x))
9123 // result: (MOVHreg x)
9126 if y.Op != OpPPC64MOVHZreg {
9130 v.reset(OpPPC64MOVHreg)
9134 // match: (MOVHreg x:(MOVHload _ _))
9138 if x.Op != OpPPC64MOVHload {
9144 // match: (MOVHreg x:(MOVHloadidx _ _ _))
9148 if x.Op != OpPPC64MOVHloadidx {
9154 // match: (MOVHreg x:(Arg <t>))
9155 // cond: (is8BitInt(t) || is16BitInt(t)) && t.IsSigned()
9163 if !((is8BitInt(t) || is16BitInt(t)) && t.IsSigned()) {
9169 // match: (MOVHreg (MOVDconst [c]))
9170 // result: (MOVDconst [int64(int16(c))])
9172 if v_0.Op != OpPPC64MOVDconst {
9175 c := auxIntToInt64(v_0.AuxInt)
9176 v.reset(OpPPC64MOVDconst)
9177 v.AuxInt = int64ToAuxInt(int64(int16(c)))
9182 func rewriteValuePPC64_OpPPC64MOVHstore(v *Value) bool {
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)
9191 off1 := auxIntToInt32(v.AuxInt)
9192 sym := auxToSym(v.Aux)
9193 if v_0.Op != OpPPC64ADDconst {
9196 off2 := auxIntToInt64(v_0.AuxInt)
9200 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
9203 v.reset(OpPPC64MOVHstore)
9204 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9205 v.Aux = symToAux(sym)
9206 v.AddArg3(x, val, mem)
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)
9213 off1 := auxIntToInt32(v.AuxInt)
9214 sym1 := auxToSym(v.Aux)
9216 if p.Op != OpPPC64MOVDaddr {
9219 off2 := auxIntToInt32(p.AuxInt)
9220 sym2 := auxToSym(p.Aux)
9224 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
9227 v.reset(OpPPC64MOVHstore)
9228 v.AuxInt = int32ToAuxInt(off1 + off2)
9229 v.Aux = symToAux(mergeSym(sym1, sym2))
9230 v.AddArg3(ptr, val, mem)
9233 // match: (MOVHstore [off] {sym} ptr (MOVDconst [0]) mem)
9234 // result: (MOVHstorezero [off] {sym} ptr mem)
9236 off := auxIntToInt32(v.AuxInt)
9237 sym := auxToSym(v.Aux)
9239 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
9243 v.reset(OpPPC64MOVHstorezero)
9244 v.AuxInt = int32ToAuxInt(off)
9245 v.Aux = symToAux(sym)
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)
9253 if auxIntToInt32(v.AuxInt) != 0 {
9256 sym := auxToSym(v.Aux)
9258 if p.Op != OpPPC64ADD {
9265 if !(sym == nil && p.Uses == 1) {
9268 v.reset(OpPPC64MOVHstoreidx)
9269 v.AddArg4(ptr, idx, val, mem)
9272 // match: (MOVHstore [off] {sym} ptr (MOVHreg x) mem)
9273 // result: (MOVHstore [off] {sym} ptr x mem)
9275 off := auxIntToInt32(v.AuxInt)
9276 sym := auxToSym(v.Aux)
9278 if v_1.Op != OpPPC64MOVHreg {
9283 v.reset(OpPPC64MOVHstore)
9284 v.AuxInt = int32ToAuxInt(off)
9285 v.Aux = symToAux(sym)
9286 v.AddArg3(ptr, x, mem)
9289 // match: (MOVHstore [off] {sym} ptr (MOVHZreg x) mem)
9290 // result: (MOVHstore [off] {sym} ptr x mem)
9292 off := auxIntToInt32(v.AuxInt)
9293 sym := auxToSym(v.Aux)
9295 if v_1.Op != OpPPC64MOVHZreg {
9300 v.reset(OpPPC64MOVHstore)
9301 v.AuxInt = int32ToAuxInt(off)
9302 v.Aux = symToAux(sym)
9303 v.AddArg3(ptr, x, mem)
9306 // match: (MOVHstore [off] {sym} ptr (MOVWreg x) mem)
9307 // result: (MOVHstore [off] {sym} ptr x mem)
9309 off := auxIntToInt32(v.AuxInt)
9310 sym := auxToSym(v.Aux)
9312 if v_1.Op != OpPPC64MOVWreg {
9317 v.reset(OpPPC64MOVHstore)
9318 v.AuxInt = int32ToAuxInt(off)
9319 v.Aux = symToAux(sym)
9320 v.AddArg3(ptr, x, mem)
9323 // match: (MOVHstore [off] {sym} ptr (MOVWZreg x) mem)
9324 // result: (MOVHstore [off] {sym} ptr x mem)
9326 off := auxIntToInt32(v.AuxInt)
9327 sym := auxToSym(v.Aux)
9329 if v_1.Op != OpPPC64MOVWZreg {
9334 v.reset(OpPPC64MOVHstore)
9335 v.AuxInt = int32ToAuxInt(off)
9336 v.Aux = symToAux(sym)
9337 v.AddArg3(ptr, x, mem)
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)
9344 off := auxIntToInt32(v.AuxInt)
9345 sym := auxToSym(v.Aux)
9348 if r.Op != OpPPC64BRH {
9356 v.reset(OpPPC64MOVHBRstore)
9357 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
9358 v0.AuxInt = int32ToAuxInt(off)
9359 v0.Aux = symToAux(sym)
9361 v.AddArg3(v0, val, mem)
9364 // match: (MOVHstore [off] {sym} ptr (Bswap16 val) mem)
9365 // result: (MOVHBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
9367 off := auxIntToInt32(v.AuxInt)
9368 sym := auxToSym(v.Aux)
9370 if v_1.Op != OpBswap16 {
9375 v.reset(OpPPC64MOVHBRstore)
9376 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
9377 v0.AuxInt = int32ToAuxInt(off)
9378 v0.Aux = symToAux(sym)
9380 v.AddArg3(v0, val, mem)
9385 func rewriteValuePPC64_OpPPC64MOVHstoreidx(v *Value) bool {
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)
9395 if v_1.Op != OpPPC64MOVDconst {
9398 c := auxIntToInt64(v_1.AuxInt)
9401 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9404 v.reset(OpPPC64MOVHstore)
9405 v.AuxInt = int32ToAuxInt(int32(c))
9406 v.AddArg3(ptr, val, mem)
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)
9413 if v_0.Op != OpPPC64MOVDconst {
9416 c := auxIntToInt64(v_0.AuxInt)
9420 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9423 v.reset(OpPPC64MOVHstore)
9424 v.AuxInt = int32ToAuxInt(int32(c))
9425 v.AddArg3(ptr, val, mem)
9428 // match: (MOVHstoreidx ptr idx (MOVHreg x) mem)
9429 // result: (MOVHstoreidx ptr idx x mem)
9433 if v_2.Op != OpPPC64MOVHreg {
9438 v.reset(OpPPC64MOVHstoreidx)
9439 v.AddArg4(ptr, idx, x, mem)
9442 // match: (MOVHstoreidx ptr idx (MOVHZreg x) mem)
9443 // result: (MOVHstoreidx ptr idx x mem)
9447 if v_2.Op != OpPPC64MOVHZreg {
9452 v.reset(OpPPC64MOVHstoreidx)
9453 v.AddArg4(ptr, idx, x, mem)
9456 // match: (MOVHstoreidx ptr idx (MOVWreg x) mem)
9457 // result: (MOVHstoreidx ptr idx x mem)
9461 if v_2.Op != OpPPC64MOVWreg {
9466 v.reset(OpPPC64MOVHstoreidx)
9467 v.AddArg4(ptr, idx, x, mem)
9470 // match: (MOVHstoreidx ptr idx (MOVWZreg x) mem)
9471 // result: (MOVHstoreidx ptr idx x mem)
9475 if v_2.Op != OpPPC64MOVWZreg {
9480 v.reset(OpPPC64MOVHstoreidx)
9481 v.AddArg4(ptr, idx, x, mem)
9484 // match: (MOVHstoreidx ptr idx r:(BRH val) mem)
9485 // cond: r.Uses == 1
9486 // result: (MOVHBRstoreidx ptr idx val mem)
9491 if r.Op != OpPPC64BRH {
9499 v.reset(OpPPC64MOVHBRstoreidx)
9500 v.AddArg4(ptr, idx, val, mem)
9503 // match: (MOVHstoreidx ptr idx (Bswap16 val) mem)
9504 // result: (MOVHBRstoreidx ptr idx val mem)
9508 if v_2.Op != OpBswap16 {
9513 v.reset(OpPPC64MOVHBRstoreidx)
9514 v.AddArg4(ptr, idx, val, mem)
9519 func rewriteValuePPC64_OpPPC64MOVHstorezero(v *Value) bool {
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)
9526 off1 := auxIntToInt32(v.AuxInt)
9527 sym := auxToSym(v.Aux)
9528 if v_0.Op != OpPPC64ADDconst {
9531 off2 := auxIntToInt64(v_0.AuxInt)
9534 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
9537 v.reset(OpPPC64MOVHstorezero)
9538 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9539 v.Aux = symToAux(sym)
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)
9547 off1 := auxIntToInt32(v.AuxInt)
9548 sym1 := auxToSym(v.Aux)
9550 if p.Op != OpPPC64MOVDaddr {
9553 off2 := auxIntToInt32(p.AuxInt)
9554 sym2 := auxToSym(p.Aux)
9557 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
9560 v.reset(OpPPC64MOVHstorezero)
9561 v.AuxInt = int32ToAuxInt(off1 + off2)
9562 v.Aux = symToAux(mergeSym(sym1, sym2))
9568 func rewriteValuePPC64_OpPPC64MOVWBRstore(v *Value) bool {
9572 // match: (MOVWBRstore ptr (MOVWreg x) mem)
9573 // result: (MOVWBRstore ptr x mem)
9576 if v_1.Op != OpPPC64MOVWreg {
9581 v.reset(OpPPC64MOVWBRstore)
9582 v.AddArg3(ptr, x, mem)
9585 // match: (MOVWBRstore ptr (MOVWZreg x) mem)
9586 // result: (MOVWBRstore ptr x mem)
9589 if v_1.Op != OpPPC64MOVWZreg {
9594 v.reset(OpPPC64MOVWBRstore)
9595 v.AddArg3(ptr, x, mem)
9600 func rewriteValuePPC64_OpPPC64MOVWZload(v *Value) bool {
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)
9607 off1 := auxIntToInt32(v.AuxInt)
9608 sym1 := auxToSym(v.Aux)
9610 if p.Op != OpPPC64MOVDaddr {
9613 off2 := auxIntToInt32(p.AuxInt)
9614 sym2 := auxToSym(p.Aux)
9617 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
9620 v.reset(OpPPC64MOVWZload)
9621 v.AuxInt = int32ToAuxInt(off1 + off2)
9622 v.Aux = symToAux(mergeSym(sym1, sym2))
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)
9630 off1 := auxIntToInt32(v.AuxInt)
9631 sym := auxToSym(v.Aux)
9632 if v_0.Op != OpPPC64ADDconst {
9635 off2 := auxIntToInt64(v_0.AuxInt)
9638 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
9641 v.reset(OpPPC64MOVWZload)
9642 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
9643 v.Aux = symToAux(sym)
9647 // match: (MOVWZload [0] {sym} p:(ADD ptr idx) mem)
9648 // cond: sym == nil && p.Uses == 1
9649 // result: (MOVWZloadidx ptr idx mem)
9651 if auxIntToInt32(v.AuxInt) != 0 {
9654 sym := auxToSym(v.Aux)
9656 if p.Op != OpPPC64ADD {
9662 if !(sym == nil && p.Uses == 1) {
9665 v.reset(OpPPC64MOVWZloadidx)
9666 v.AddArg3(ptr, idx, mem)
9671 func rewriteValuePPC64_OpPPC64MOVWZloadidx(v *Value) bool {
9675 // match: (MOVWZloadidx ptr (MOVDconst [c]) mem)
9676 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9677 // result: (MOVWZload [int32(c)] ptr mem)
9680 if v_1.Op != OpPPC64MOVDconst {
9683 c := auxIntToInt64(v_1.AuxInt)
9685 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9688 v.reset(OpPPC64MOVWZload)
9689 v.AuxInt = int32ToAuxInt(int32(c))
9693 // match: (MOVWZloadidx (MOVDconst [c]) ptr mem)
9694 // cond: (is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c)))
9695 // result: (MOVWZload [int32(c)] ptr mem)
9697 if v_0.Op != OpPPC64MOVDconst {
9700 c := auxIntToInt64(v_0.AuxInt)
9703 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
9706 v.reset(OpPPC64MOVWZload)
9707 v.AuxInt = int32ToAuxInt(int32(c))
9713 func rewriteValuePPC64_OpPPC64MOVWZreg(v *Value) bool {
9716 typ := &b.Func.Config.Types
9717 // match: (MOVWZreg y:(Select0 (ANDCCconst [c] _)))
9718 // cond: uint64(c) <= 0xFFFFFFFF
9722 if y.Op != OpSelect0 {
9726 if y_0.Op != OpPPC64ANDCCconst {
9729 c := auxIntToInt64(y_0.AuxInt)
9730 if !(uint64(c) <= 0xFFFFFFFF) {
9736 // match: (MOVWZreg y:(AND (MOVDconst [c]) _))
9737 // cond: uint64(c) <= 0xFFFFFFFF
9741 if y.Op != OpPPC64AND {
9746 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
9747 if y_0.Op != OpPPC64MOVDconst {
9750 c := auxIntToInt64(y_0.AuxInt)
9751 if !(uint64(c) <= 0xFFFFFFFF) {
9759 // match: (MOVWZreg (SRWconst [c] (MOVBZreg x)))
9760 // result: (SRWconst [c] (MOVBZreg x))
9762 if v_0.Op != OpPPC64SRWconst {
9765 c := auxIntToInt64(v_0.AuxInt)
9766 v_0_0 := v_0.Args[0]
9767 if v_0_0.Op != OpPPC64MOVBZreg {
9771 v.reset(OpPPC64SRWconst)
9772 v.AuxInt = int64ToAuxInt(c)
9773 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
9778 // match: (MOVWZreg (SRWconst [c] (MOVHZreg x)))
9779 // result: (SRWconst [c] (MOVHZreg x))
9781 if v_0.Op != OpPPC64SRWconst {
9784 c := auxIntToInt64(v_0.AuxInt)
9785 v_0_0 := v_0.Args[0]
9786 if v_0_0.Op != OpPPC64MOVHZreg {
9790 v.reset(OpPPC64SRWconst)
9791 v.AuxInt = int64ToAuxInt(c)
9792 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
9797 // match: (MOVWZreg (SRWconst [c] (MOVWZreg x)))
9798 // result: (SRWconst [c] (MOVWZreg x))
9800 if v_0.Op != OpPPC64SRWconst {
9803 c := auxIntToInt64(v_0.AuxInt)
9804 v_0_0 := v_0.Args[0]
9805 if v_0_0.Op != OpPPC64MOVWZreg {
9809 v.reset(OpPPC64SRWconst)
9810 v.AuxInt = int64ToAuxInt(c)
9811 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
9816 // match: (MOVWZreg (SRWconst [c] x))
9817 // cond: sizeof(x.Type) <= 32
9818 // result: (SRWconst [c] x)
9820 if v_0.Op != OpPPC64SRWconst {
9823 c := auxIntToInt64(v_0.AuxInt)
9825 if !(sizeof(x.Type) <= 32) {
9828 v.reset(OpPPC64SRWconst)
9829 v.AuxInt = int64ToAuxInt(c)
9833 // match: (MOVWZreg (SRDconst [c] x))
9835 // result: (SRDconst [c] x)
9837 if v_0.Op != OpPPC64SRDconst {
9840 c := auxIntToInt64(v_0.AuxInt)
9845 v.reset(OpPPC64SRDconst)
9846 v.AuxInt = int64ToAuxInt(c)
9850 // match: (MOVWZreg y:(MOVWZreg _))
9854 if y.Op != OpPPC64MOVWZreg {
9860 // match: (MOVWZreg y:(MOVHZreg _))
9864 if y.Op != OpPPC64MOVHZreg {
9870 // match: (MOVWZreg y:(MOVBZreg _))
9874 if y.Op != OpPPC64MOVBZreg {
9880 // match: (MOVWZreg y:(MOVHBRload _ _))
9884 if y.Op != OpPPC64MOVHBRload {
9890 // match: (MOVWZreg y:(MOVWBRload _ _))
9894 if y.Op != OpPPC64MOVWBRload {
9900 // match: (MOVWZreg y:(MOVWreg x))
9901 // result: (MOVWZreg x)
9904 if y.Op != OpPPC64MOVWreg {
9908 v.reset(OpPPC64MOVWZreg)
9912 // match: (MOVWZreg (OR <t> x (MOVWZreg y)))
9913 // result: (MOVWZreg (OR <t> x y))
9915 if v_0.Op != OpPPC64OR {
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 {
9924 if v_0_1.Op != OpPPC64MOVWZreg {
9928 v.reset(OpPPC64MOVWZreg)
9929 v0 := b.NewValue0(v.Pos, OpPPC64OR, t)
9936 // match: (MOVWZreg (XOR <t> x (MOVWZreg y)))
9937 // result: (MOVWZreg (XOR <t> x y))
9939 if v_0.Op != OpPPC64XOR {
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 {
9948 if v_0_1.Op != OpPPC64MOVWZreg {
9952 v.reset(OpPPC64MOVWZreg)
9953 v0 := b.NewValue0(v.Pos, OpPPC64XOR, t)
9960 // match: (MOVWZreg (AND <t> x (MOVWZreg y)))
9961 // result: (MOVWZreg (AND <t> x y))
9963 if v_0.Op != OpPPC64AND {
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 {
9972 if v_0_1.Op != OpPPC64MOVWZreg {
9976 v.reset(OpPPC64MOVWZreg)
9977 v0 := b.NewValue0(v.Pos, OpPPC64AND, t)
9984 // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVBZload ptr x))))
9988 if z.Op != OpSelect0 {
9992 if z_0.Op != OpPPC64ANDCCconst {
9995 z_0_0 := z_0.Args[0]
9996 if z_0_0.Op != OpPPC64MOVBZload {
10002 // match: (MOVWZreg z:(AND y (MOVWZload ptr x)))
10006 if z.Op != OpPPC64AND {
10012 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
10013 if z_1.Op != OpPPC64MOVWZload {
10021 // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVHZload ptr x))))
10025 if z.Op != OpSelect0 {
10029 if z_0.Op != OpPPC64ANDCCconst {
10032 z_0_0 := z_0.Args[0]
10033 if z_0_0.Op != OpPPC64MOVHZload {
10039 // match: (MOVWZreg z:(Select0 (ANDCCconst [c] (MOVWZload ptr x))))
10043 if z.Op != OpSelect0 {
10047 if z_0.Op != OpPPC64ANDCCconst {
10050 z_0_0 := z_0.Args[0]
10051 if z_0_0.Op != OpPPC64MOVWZload {
10057 // match: (MOVWZreg x:(MOVBZload _ _))
10061 if x.Op != OpPPC64MOVBZload {
10067 // match: (MOVWZreg x:(MOVBZloadidx _ _ _))
10071 if x.Op != OpPPC64MOVBZloadidx {
10077 // match: (MOVWZreg x:(MOVHZload _ _))
10081 if x.Op != OpPPC64MOVHZload {
10087 // match: (MOVWZreg x:(MOVHZloadidx _ _ _))
10091 if x.Op != OpPPC64MOVHZloadidx {
10097 // match: (MOVWZreg x:(MOVWZload _ _))
10101 if x.Op != OpPPC64MOVWZload {
10107 // match: (MOVWZreg x:(MOVWZloadidx _ _ _))
10111 if x.Op != OpPPC64MOVWZloadidx {
10117 // match: (MOVWZreg x:(Select0 (LoweredAtomicLoad32 _ _)))
10121 if x.Op != OpSelect0 {
10125 if x_0.Op != OpPPC64LoweredAtomicLoad32 {
10131 // match: (MOVWZreg x:(Arg <t>))
10132 // cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !t.IsSigned()
10140 if !((is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && !t.IsSigned()) {
10146 // match: (MOVWZreg (MOVDconst [c]))
10147 // result: (MOVDconst [int64(uint32(c))])
10149 if v_0.Op != OpPPC64MOVDconst {
10152 c := auxIntToInt64(v_0.AuxInt)
10153 v.reset(OpPPC64MOVDconst)
10154 v.AuxInt = int64ToAuxInt(int64(uint32(c)))
10159 func rewriteValuePPC64_OpPPC64MOVWload(v *Value) bool {
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)
10166 off1 := auxIntToInt32(v.AuxInt)
10167 sym1 := auxToSym(v.Aux)
10169 if p.Op != OpPPC64MOVDaddr {
10172 off2 := auxIntToInt32(p.AuxInt)
10173 sym2 := auxToSym(p.Aux)
10176 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
10179 v.reset(OpPPC64MOVWload)
10180 v.AuxInt = int32ToAuxInt(off1 + off2)
10181 v.Aux = symToAux(mergeSym(sym1, sym2))
10182 v.AddArg2(ptr, mem)
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)
10189 off1 := auxIntToInt32(v.AuxInt)
10190 sym := auxToSym(v.Aux)
10191 if v_0.Op != OpPPC64ADDconst {
10194 off2 := auxIntToInt64(v_0.AuxInt)
10197 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
10200 v.reset(OpPPC64MOVWload)
10201 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10202 v.Aux = symToAux(sym)
10206 // match: (MOVWload [0] {sym} p:(ADD ptr idx) mem)
10207 // cond: sym == nil && p.Uses == 1
10208 // result: (MOVWloadidx ptr idx mem)
10210 if auxIntToInt32(v.AuxInt) != 0 {
10213 sym := auxToSym(v.Aux)
10215 if p.Op != OpPPC64ADD {
10221 if !(sym == nil && p.Uses == 1) {
10224 v.reset(OpPPC64MOVWloadidx)
10225 v.AddArg3(ptr, idx, mem)
10230 func rewriteValuePPC64_OpPPC64MOVWloadidx(v *Value) bool {
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)
10239 if v_1.Op != OpPPC64MOVDconst {
10242 c := auxIntToInt64(v_1.AuxInt)
10244 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10247 v.reset(OpPPC64MOVWload)
10248 v.AuxInt = int32ToAuxInt(int32(c))
10249 v.AddArg2(ptr, mem)
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)
10256 if v_0.Op != OpPPC64MOVDconst {
10259 c := auxIntToInt64(v_0.AuxInt)
10262 if !((is16Bit(c) && c%4 == 0) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10265 v.reset(OpPPC64MOVWload)
10266 v.AuxInt = int32ToAuxInt(int32(c))
10267 v.AddArg2(ptr, mem)
10272 func rewriteValuePPC64_OpPPC64MOVWreg(v *Value) bool {
10275 typ := &b.Func.Config.Types
10276 // match: (MOVWreg y:(Select0 (ANDCCconst [c] _)))
10277 // cond: uint64(c) <= 0xFFFF
10281 if y.Op != OpSelect0 {
10285 if y_0.Op != OpPPC64ANDCCconst {
10288 c := auxIntToInt64(y_0.AuxInt)
10289 if !(uint64(c) <= 0xFFFF) {
10295 // match: (MOVWreg y:(AND (MOVDconst [c]) _))
10296 // cond: uint64(c) <= 0x7FFFFFFF
10300 if y.Op != OpPPC64AND {
10305 for _i0 := 0; _i0 <= 1; _i0, y_0, y_1 = _i0+1, y_1, y_0 {
10306 if y_0.Op != OpPPC64MOVDconst {
10309 c := auxIntToInt64(y_0.AuxInt)
10310 if !(uint64(c) <= 0x7FFFFFFF) {
10318 // match: (MOVWreg (SRAWconst [c] (MOVBreg x)))
10319 // result: (SRAWconst [c] (MOVBreg x))
10321 if v_0.Op != OpPPC64SRAWconst {
10324 c := auxIntToInt64(v_0.AuxInt)
10325 v_0_0 := v_0.Args[0]
10326 if v_0_0.Op != OpPPC64MOVBreg {
10330 v.reset(OpPPC64SRAWconst)
10331 v.AuxInt = int64ToAuxInt(c)
10332 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
10337 // match: (MOVWreg (SRAWconst [c] (MOVHreg x)))
10338 // result: (SRAWconst [c] (MOVHreg x))
10340 if v_0.Op != OpPPC64SRAWconst {
10343 c := auxIntToInt64(v_0.AuxInt)
10344 v_0_0 := v_0.Args[0]
10345 if v_0_0.Op != OpPPC64MOVHreg {
10349 v.reset(OpPPC64SRAWconst)
10350 v.AuxInt = int64ToAuxInt(c)
10351 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
10356 // match: (MOVWreg (SRAWconst [c] (MOVWreg x)))
10357 // result: (SRAWconst [c] (MOVWreg x))
10359 if v_0.Op != OpPPC64SRAWconst {
10362 c := auxIntToInt64(v_0.AuxInt)
10363 v_0_0 := v_0.Args[0]
10364 if v_0_0.Op != OpPPC64MOVWreg {
10368 v.reset(OpPPC64SRAWconst)
10369 v.AuxInt = int64ToAuxInt(c)
10370 v0 := b.NewValue0(v.Pos, OpPPC64MOVWreg, typ.Int64)
10375 // match: (MOVWreg (SRAWconst [c] x))
10376 // cond: sizeof(x.Type) <= 32
10377 // result: (SRAWconst [c] x)
10379 if v_0.Op != OpPPC64SRAWconst {
10382 c := auxIntToInt64(v_0.AuxInt)
10384 if !(sizeof(x.Type) <= 32) {
10387 v.reset(OpPPC64SRAWconst)
10388 v.AuxInt = int64ToAuxInt(c)
10392 // match: (MOVWreg (SRDconst [c] x))
10394 // result: (SRDconst [c] x)
10396 if v_0.Op != OpPPC64SRDconst {
10399 c := auxIntToInt64(v_0.AuxInt)
10404 v.reset(OpPPC64SRDconst)
10405 v.AuxInt = int64ToAuxInt(c)
10409 // match: (MOVWreg (SRADconst [c] x))
10411 // result: (SRADconst [c] x)
10413 if v_0.Op != OpPPC64SRADconst {
10416 c := auxIntToInt64(v_0.AuxInt)
10421 v.reset(OpPPC64SRADconst)
10422 v.AuxInt = int64ToAuxInt(c)
10426 // match: (MOVWreg (SRDconst [c] x))
10428 // result: (SRADconst [c] x)
10430 if v_0.Op != OpPPC64SRDconst {
10433 c := auxIntToInt64(v_0.AuxInt)
10438 v.reset(OpPPC64SRADconst)
10439 v.AuxInt = int64ToAuxInt(c)
10443 // match: (MOVWreg y:(MOVWreg _))
10447 if y.Op != OpPPC64MOVWreg {
10453 // match: (MOVWreg y:(MOVHreg _))
10457 if y.Op != OpPPC64MOVHreg {
10463 // match: (MOVWreg y:(MOVBreg _))
10467 if y.Op != OpPPC64MOVBreg {
10473 // match: (MOVWreg y:(MOVWZreg x))
10474 // result: (MOVWreg x)
10477 if y.Op != OpPPC64MOVWZreg {
10481 v.reset(OpPPC64MOVWreg)
10485 // match: (MOVWreg x:(MOVHload _ _))
10489 if x.Op != OpPPC64MOVHload {
10495 // match: (MOVWreg x:(MOVHloadidx _ _ _))
10499 if x.Op != OpPPC64MOVHloadidx {
10505 // match: (MOVWreg x:(MOVWload _ _))
10509 if x.Op != OpPPC64MOVWload {
10515 // match: (MOVWreg x:(MOVWloadidx _ _ _))
10519 if x.Op != OpPPC64MOVWloadidx {
10525 // match: (MOVWreg x:(Arg <t>))
10526 // cond: (is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && t.IsSigned()
10534 if !((is8BitInt(t) || is16BitInt(t) || is32BitInt(t)) && t.IsSigned()) {
10540 // match: (MOVWreg (MOVDconst [c]))
10541 // result: (MOVDconst [int64(int32(c))])
10543 if v_0.Op != OpPPC64MOVDconst {
10546 c := auxIntToInt64(v_0.AuxInt)
10547 v.reset(OpPPC64MOVDconst)
10548 v.AuxInt = int64ToAuxInt(int64(int32(c)))
10553 func rewriteValuePPC64_OpPPC64MOVWstore(v *Value) bool {
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)
10562 off1 := auxIntToInt32(v.AuxInt)
10563 sym := auxToSym(v.Aux)
10564 if v_0.Op != OpPPC64ADDconst {
10567 off2 := auxIntToInt64(v_0.AuxInt)
10571 if !(is16Bit(int64(off1)+off2) || (supportsPPC64PCRel() && is32Bit(int64(off1)+off2))) {
10574 v.reset(OpPPC64MOVWstore)
10575 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10576 v.Aux = symToAux(sym)
10577 v.AddArg3(x, val, mem)
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)
10584 off1 := auxIntToInt32(v.AuxInt)
10585 sym1 := auxToSym(v.Aux)
10587 if p.Op != OpPPC64MOVDaddr {
10590 off2 := auxIntToInt32(p.AuxInt)
10591 sym2 := auxToSym(p.Aux)
10595 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (ptr.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
10598 v.reset(OpPPC64MOVWstore)
10599 v.AuxInt = int32ToAuxInt(off1 + off2)
10600 v.Aux = symToAux(mergeSym(sym1, sym2))
10601 v.AddArg3(ptr, val, mem)
10604 // match: (MOVWstore [off] {sym} ptr (MOVDconst [0]) mem)
10605 // result: (MOVWstorezero [off] {sym} ptr mem)
10607 off := auxIntToInt32(v.AuxInt)
10608 sym := auxToSym(v.Aux)
10610 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != 0 {
10614 v.reset(OpPPC64MOVWstorezero)
10615 v.AuxInt = int32ToAuxInt(off)
10616 v.Aux = symToAux(sym)
10617 v.AddArg2(ptr, mem)
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)
10624 if auxIntToInt32(v.AuxInt) != 0 {
10627 sym := auxToSym(v.Aux)
10629 if p.Op != OpPPC64ADD {
10636 if !(sym == nil && p.Uses == 1) {
10639 v.reset(OpPPC64MOVWstoreidx)
10640 v.AddArg4(ptr, idx, val, mem)
10643 // match: (MOVWstore [off] {sym} ptr (MOVWreg x) mem)
10644 // result: (MOVWstore [off] {sym} ptr x mem)
10646 off := auxIntToInt32(v.AuxInt)
10647 sym := auxToSym(v.Aux)
10649 if v_1.Op != OpPPC64MOVWreg {
10654 v.reset(OpPPC64MOVWstore)
10655 v.AuxInt = int32ToAuxInt(off)
10656 v.Aux = symToAux(sym)
10657 v.AddArg3(ptr, x, mem)
10660 // match: (MOVWstore [off] {sym} ptr (MOVWZreg x) mem)
10661 // result: (MOVWstore [off] {sym} ptr x mem)
10663 off := auxIntToInt32(v.AuxInt)
10664 sym := auxToSym(v.Aux)
10666 if v_1.Op != OpPPC64MOVWZreg {
10671 v.reset(OpPPC64MOVWstore)
10672 v.AuxInt = int32ToAuxInt(off)
10673 v.Aux = symToAux(sym)
10674 v.AddArg3(ptr, x, mem)
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)
10681 off := auxIntToInt32(v.AuxInt)
10682 sym := auxToSym(v.Aux)
10685 if r.Op != OpPPC64BRW {
10690 if !(r.Uses == 1) {
10693 v.reset(OpPPC64MOVWBRstore)
10694 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
10695 v0.AuxInt = int32ToAuxInt(off)
10696 v0.Aux = symToAux(sym)
10698 v.AddArg3(v0, val, mem)
10701 // match: (MOVWstore [off] {sym} ptr (Bswap32 val) mem)
10702 // result: (MOVWBRstore (MOVDaddr <ptr.Type> [off] {sym} ptr) val mem)
10704 off := auxIntToInt32(v.AuxInt)
10705 sym := auxToSym(v.Aux)
10707 if v_1.Op != OpBswap32 {
10712 v.reset(OpPPC64MOVWBRstore)
10713 v0 := b.NewValue0(v.Pos, OpPPC64MOVDaddr, ptr.Type)
10714 v0.AuxInt = int32ToAuxInt(off)
10715 v0.Aux = symToAux(sym)
10717 v.AddArg3(v0, val, mem)
10722 func rewriteValuePPC64_OpPPC64MOVWstoreidx(v *Value) bool {
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)
10732 if v_1.Op != OpPPC64MOVDconst {
10735 c := auxIntToInt64(v_1.AuxInt)
10738 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10741 v.reset(OpPPC64MOVWstore)
10742 v.AuxInt = int32ToAuxInt(int32(c))
10743 v.AddArg3(ptr, val, mem)
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)
10750 if v_0.Op != OpPPC64MOVDconst {
10753 c := auxIntToInt64(v_0.AuxInt)
10757 if !(is16Bit(c) || (buildcfg.GOPPC64 >= 10 && is32Bit(c))) {
10760 v.reset(OpPPC64MOVWstore)
10761 v.AuxInt = int32ToAuxInt(int32(c))
10762 v.AddArg3(ptr, val, mem)
10765 // match: (MOVWstoreidx ptr idx (MOVWreg x) mem)
10766 // result: (MOVWstoreidx ptr idx x mem)
10770 if v_2.Op != OpPPC64MOVWreg {
10775 v.reset(OpPPC64MOVWstoreidx)
10776 v.AddArg4(ptr, idx, x, mem)
10779 // match: (MOVWstoreidx ptr idx (MOVWZreg x) mem)
10780 // result: (MOVWstoreidx ptr idx x mem)
10784 if v_2.Op != OpPPC64MOVWZreg {
10789 v.reset(OpPPC64MOVWstoreidx)
10790 v.AddArg4(ptr, idx, x, mem)
10793 // match: (MOVWstoreidx ptr idx r:(BRW val) mem)
10794 // cond: r.Uses == 1
10795 // result: (MOVWBRstoreidx ptr idx val mem)
10800 if r.Op != OpPPC64BRW {
10805 if !(r.Uses == 1) {
10808 v.reset(OpPPC64MOVWBRstoreidx)
10809 v.AddArg4(ptr, idx, val, mem)
10812 // match: (MOVWstoreidx ptr idx (Bswap32 val) mem)
10813 // result: (MOVWBRstoreidx ptr idx val mem)
10817 if v_2.Op != OpBswap32 {
10822 v.reset(OpPPC64MOVWBRstoreidx)
10823 v.AddArg4(ptr, idx, val, mem)
10828 func rewriteValuePPC64_OpPPC64MOVWstorezero(v *Value) bool {
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)
10835 off1 := auxIntToInt32(v.AuxInt)
10836 sym := auxToSym(v.Aux)
10837 if v_0.Op != OpPPC64ADDconst {
10840 off2 := auxIntToInt64(v_0.AuxInt)
10843 if !((supportsPPC64PCRel() && is32Bit(int64(off1)+off2)) || (is16Bit(int64(off1) + off2))) {
10846 v.reset(OpPPC64MOVWstorezero)
10847 v.AuxInt = int32ToAuxInt(off1 + int32(off2))
10848 v.Aux = symToAux(sym)
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)
10856 off1 := auxIntToInt32(v.AuxInt)
10857 sym1 := auxToSym(v.Aux)
10859 if p.Op != OpPPC64MOVDaddr {
10862 off2 := auxIntToInt32(p.AuxInt)
10863 sym2 := auxToSym(p.Aux)
10866 if !(canMergeSym(sym1, sym2) && ((is16Bit(int64(off1+off2)) && (x.Op != OpSB || p.Uses == 1)) || (supportsPPC64PCRel() && is32Bit(int64(off1+off2))))) {
10869 v.reset(OpPPC64MOVWstorezero)
10870 v.AuxInt = int32ToAuxInt(off1 + off2)
10871 v.Aux = symToAux(mergeSym(sym1, sym2))
10877 func rewriteValuePPC64_OpPPC64MTVSRD(v *Value) bool {
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))])
10885 if v_0.Op != OpPPC64MOVDconst {
10888 c := auxIntToInt64(v_0.AuxInt)
10889 if !(!math.IsNaN(math.Float64frombits(uint64(c)))) {
10892 v.reset(OpPPC64FMOVDconst)
10893 v.AuxInt = float64ToAuxInt(math.Float64frombits(uint64(c)))
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)
10901 if x.Op != OpPPC64MOVDload {
10904 off := auxIntToInt32(x.AuxInt)
10905 sym := auxToSym(x.Aux)
10908 if !(x.Uses == 1 && clobber(x)) {
10912 v0 := b.NewValue0(x.Pos, OpPPC64FMOVDload, typ.Float64)
10914 v0.AuxInt = int32ToAuxInt(off)
10915 v0.Aux = symToAux(sym)
10916 v0.AddArg2(ptr, mem)
10921 func rewriteValuePPC64_OpPPC64MULLD(v *Value) bool {
10924 // match: (MULLD x (MOVDconst [c]))
10925 // cond: is16Bit(c)
10926 // result: (MULLDconst [int32(c)] x)
10928 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10930 if v_1.Op != OpPPC64MOVDconst {
10933 c := auxIntToInt64(v_1.AuxInt)
10937 v.reset(OpPPC64MULLDconst)
10938 v.AuxInt = int32ToAuxInt(int32(c))
10946 func rewriteValuePPC64_OpPPC64MULLW(v *Value) bool {
10949 // match: (MULLW x (MOVDconst [c]))
10950 // cond: is16Bit(c)
10951 // result: (MULLWconst [int32(c)] x)
10953 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
10955 if v_1.Op != OpPPC64MOVDconst {
10958 c := auxIntToInt64(v_1.AuxInt)
10962 v.reset(OpPPC64MULLWconst)
10963 v.AuxInt = int32ToAuxInt(int32(c))
10971 func rewriteValuePPC64_OpPPC64NEG(v *Value) bool {
10973 // match: (NEG (ADDconst [c] x))
10974 // cond: is32Bit(-c)
10975 // result: (SUBFCconst [-c] x)
10977 if v_0.Op != OpPPC64ADDconst {
10980 c := auxIntToInt64(v_0.AuxInt)
10982 if !(is32Bit(-c)) {
10985 v.reset(OpPPC64SUBFCconst)
10986 v.AuxInt = int64ToAuxInt(-c)
10990 // match: (NEG (SUBFCconst [c] x))
10991 // cond: is32Bit(-c)
10992 // result: (ADDconst [-c] x)
10994 if v_0.Op != OpPPC64SUBFCconst {
10997 c := auxIntToInt64(v_0.AuxInt)
10999 if !(is32Bit(-c)) {
11002 v.reset(OpPPC64ADDconst)
11003 v.AuxInt = int64ToAuxInt(-c)
11007 // match: (NEG (SUB x y))
11008 // result: (SUB y x)
11010 if v_0.Op != OpPPC64SUB {
11015 v.reset(OpPPC64SUB)
11019 // match: (NEG (NEG x))
11022 if v_0.Op != OpPPC64NEG {
11031 func rewriteValuePPC64_OpPPC64NOR(v *Value) bool {
11034 // match: (NOR (MOVDconst [c]) (MOVDconst [d]))
11035 // result: (MOVDconst [^(c|d)])
11037 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11038 if v_0.Op != OpPPC64MOVDconst {
11041 c := auxIntToInt64(v_0.AuxInt)
11042 if v_1.Op != OpPPC64MOVDconst {
11045 d := auxIntToInt64(v_1.AuxInt)
11046 v.reset(OpPPC64MOVDconst)
11047 v.AuxInt = int64ToAuxInt(^(c | d))
11054 func rewriteValuePPC64_OpPPC64NotEqual(v *Value) bool {
11056 // match: (NotEqual (FlagEQ))
11057 // result: (MOVDconst [0])
11059 if v_0.Op != OpPPC64FlagEQ {
11062 v.reset(OpPPC64MOVDconst)
11063 v.AuxInt = int64ToAuxInt(0)
11066 // match: (NotEqual (FlagLT))
11067 // result: (MOVDconst [1])
11069 if v_0.Op != OpPPC64FlagLT {
11072 v.reset(OpPPC64MOVDconst)
11073 v.AuxInt = int64ToAuxInt(1)
11076 // match: (NotEqual (FlagGT))
11077 // result: (MOVDconst [1])
11079 if v_0.Op != OpPPC64FlagGT {
11082 v.reset(OpPPC64MOVDconst)
11083 v.AuxInt = int64ToAuxInt(1)
11086 // match: (NotEqual (InvertFlags x))
11087 // result: (NotEqual x)
11089 if v_0.Op != OpPPC64InvertFlags {
11093 v.reset(OpPPC64NotEqual)
11097 // match: (NotEqual cmp)
11098 // result: (SETBCR [2] cmp)
11101 v.reset(OpPPC64SETBCR)
11102 v.AuxInt = int32ToAuxInt(2)
11107 func rewriteValuePPC64_OpPPC64OR(v *Value) bool {
11110 // match: (OR x (NOR y y))
11111 // result: (ORN x y)
11113 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11115 if v_1.Op != OpPPC64NOR {
11119 if y != v_1.Args[0] {
11122 v.reset(OpPPC64ORN)
11128 // match: (OR (MOVDconst [c]) (MOVDconst [d]))
11129 // result: (MOVDconst [c|d])
11131 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11132 if v_0.Op != OpPPC64MOVDconst {
11135 c := auxIntToInt64(v_0.AuxInt)
11136 if v_1.Op != OpPPC64MOVDconst {
11139 d := auxIntToInt64(v_1.AuxInt)
11140 v.reset(OpPPC64MOVDconst)
11141 v.AuxInt = int64ToAuxInt(c | d)
11146 // match: (OR x (MOVDconst [c]))
11147 // cond: isU32Bit(c)
11148 // result: (ORconst [c] x)
11150 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
11152 if v_1.Op != OpPPC64MOVDconst {
11155 c := auxIntToInt64(v_1.AuxInt)
11156 if !(isU32Bit(c)) {
11159 v.reset(OpPPC64ORconst)
11160 v.AuxInt = int64ToAuxInt(c)
11168 func rewriteValuePPC64_OpPPC64ORN(v *Value) bool {
11171 // match: (ORN x (MOVDconst [-1]))
11175 if v_1.Op != OpPPC64MOVDconst || auxIntToInt64(v_1.AuxInt) != -1 {
11181 // match: (ORN (MOVDconst [c]) (MOVDconst [d]))
11182 // result: (MOVDconst [c|^d])
11184 if v_0.Op != OpPPC64MOVDconst {
11187 c := auxIntToInt64(v_0.AuxInt)
11188 if v_1.Op != OpPPC64MOVDconst {
11191 d := auxIntToInt64(v_1.AuxInt)
11192 v.reset(OpPPC64MOVDconst)
11193 v.AuxInt = int64ToAuxInt(c | ^d)
11198 func rewriteValuePPC64_OpPPC64ORconst(v *Value) bool {
11200 // match: (ORconst [c] (ORconst [d] x))
11201 // result: (ORconst [c|d] x)
11203 c := auxIntToInt64(v.AuxInt)
11204 if v_0.Op != OpPPC64ORconst {
11207 d := auxIntToInt64(v_0.AuxInt)
11209 v.reset(OpPPC64ORconst)
11210 v.AuxInt = int64ToAuxInt(c | d)
11214 // match: (ORconst [-1] _)
11215 // result: (MOVDconst [-1])
11217 if auxIntToInt64(v.AuxInt) != -1 {
11220 v.reset(OpPPC64MOVDconst)
11221 v.AuxInt = int64ToAuxInt(-1)
11224 // match: (ORconst [0] x)
11227 if auxIntToInt64(v.AuxInt) != 0 {
11236 func rewriteValuePPC64_OpPPC64ROTL(v *Value) bool {
11239 // match: (ROTL x (MOVDconst [c]))
11240 // result: (ROTLconst x [c&63])
11243 if v_1.Op != OpPPC64MOVDconst {
11246 c := auxIntToInt64(v_1.AuxInt)
11247 v.reset(OpPPC64ROTLconst)
11248 v.AuxInt = int64ToAuxInt(c & 63)
11254 func rewriteValuePPC64_OpPPC64ROTLW(v *Value) bool {
11257 // match: (ROTLW x (MOVDconst [c]))
11258 // result: (ROTLWconst x [c&31])
11261 if v_1.Op != OpPPC64MOVDconst {
11264 c := auxIntToInt64(v_1.AuxInt)
11265 v.reset(OpPPC64ROTLWconst)
11266 v.AuxInt = int64ToAuxInt(c & 31)
11272 func rewriteValuePPC64_OpPPC64ROTLWconst(v *Value) bool {
11274 // match: (ROTLWconst [r] (AND (MOVDconst [m]) x))
11275 // cond: isPPC64WordRotateMask(m)
11276 // result: (RLWINM [encodePPC64RotateMask(r,rotateLeft32(m,r),32)] x)
11278 r := auxIntToInt64(v.AuxInt)
11279 if v_0.Op != OpPPC64AND {
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 {
11289 m := auxIntToInt64(v_0_0.AuxInt)
11291 if !(isPPC64WordRotateMask(m)) {
11294 v.reset(OpPPC64RLWINM)
11295 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, rotateLeft32(m, r), 32))
11301 // match: (ROTLWconst [r] (Select0 (ANDCCconst [m] x)))
11302 // cond: isPPC64WordRotateMask(m)
11303 // result: (RLWINM [encodePPC64RotateMask(r,rotateLeft32(m,r),32)] x)
11305 r := auxIntToInt64(v.AuxInt)
11306 if v_0.Op != OpSelect0 {
11309 v_0_0 := v_0.Args[0]
11310 if v_0_0.Op != OpPPC64ANDCCconst {
11313 m := auxIntToInt64(v_0_0.AuxInt)
11315 if !(isPPC64WordRotateMask(m)) {
11318 v.reset(OpPPC64RLWINM)
11319 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, rotateLeft32(m, r), 32))
11325 func rewriteValuePPC64_OpPPC64SETBC(v *Value) bool {
11328 typ := &b.Func.Config.Types
11329 // match: (SETBC [0] (FlagLT))
11330 // result: (MOVDconst [1])
11332 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagLT {
11335 v.reset(OpPPC64MOVDconst)
11336 v.AuxInt = int64ToAuxInt(1)
11339 // match: (SETBC [0] (FlagGT))
11340 // result: (MOVDconst [0])
11342 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagGT {
11345 v.reset(OpPPC64MOVDconst)
11346 v.AuxInt = int64ToAuxInt(0)
11349 // match: (SETBC [0] (FlagEQ))
11350 // result: (MOVDconst [0])
11352 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagEQ {
11355 v.reset(OpPPC64MOVDconst)
11356 v.AuxInt = int64ToAuxInt(0)
11359 // match: (SETBC [1] (FlagGT))
11360 // result: (MOVDconst [1])
11362 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagGT {
11365 v.reset(OpPPC64MOVDconst)
11366 v.AuxInt = int64ToAuxInt(1)
11369 // match: (SETBC [1] (FlagLT))
11370 // result: (MOVDconst [0])
11372 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagLT {
11375 v.reset(OpPPC64MOVDconst)
11376 v.AuxInt = int64ToAuxInt(0)
11379 // match: (SETBC [1] (FlagEQ))
11380 // result: (MOVDconst [0])
11382 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagEQ {
11385 v.reset(OpPPC64MOVDconst)
11386 v.AuxInt = int64ToAuxInt(0)
11389 // match: (SETBC [2] (FlagEQ))
11390 // result: (MOVDconst [1])
11392 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagEQ {
11395 v.reset(OpPPC64MOVDconst)
11396 v.AuxInt = int64ToAuxInt(1)
11399 // match: (SETBC [2] (FlagLT))
11400 // result: (MOVDconst [0])
11402 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagLT {
11405 v.reset(OpPPC64MOVDconst)
11406 v.AuxInt = int64ToAuxInt(0)
11409 // match: (SETBC [2] (FlagGT))
11410 // result: (MOVDconst [0])
11412 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagGT {
11415 v.reset(OpPPC64MOVDconst)
11416 v.AuxInt = int64ToAuxInt(0)
11419 // match: (SETBC [0] (InvertFlags bool))
11420 // result: (SETBC [1] bool)
11422 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64InvertFlags {
11425 bool := v_0.Args[0]
11426 v.reset(OpPPC64SETBC)
11427 v.AuxInt = int32ToAuxInt(1)
11431 // match: (SETBC [1] (InvertFlags bool))
11432 // result: (SETBC [0] bool)
11434 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64InvertFlags {
11437 bool := v_0.Args[0]
11438 v.reset(OpPPC64SETBC)
11439 v.AuxInt = int32ToAuxInt(0)
11443 // match: (SETBC [2] (InvertFlags bool))
11444 // result: (SETBC [2] bool)
11446 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64InvertFlags {
11449 bool := v_0.Args[0]
11450 v.reset(OpPPC64SETBC)
11451 v.AuxInt = int32ToAuxInt(2)
11455 // match: (SETBC [n] (InvertFlags bool))
11456 // result: (SETBCR [n] bool)
11458 n := auxIntToInt32(v.AuxInt)
11459 if v_0.Op != OpPPC64InvertFlags {
11462 bool := v_0.Args[0]
11463 v.reset(OpPPC64SETBCR)
11464 v.AuxInt = int32ToAuxInt(n)
11468 // match: (SETBC [2] (CMPconst [0] (Select0 (ANDCCconst [1] z))))
11469 // result: (XORconst [1] (Select0 <typ.UInt64> (ANDCCconst [1] z )))
11471 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11474 v_0_0 := v_0.Args[0]
11475 if v_0_0.Op != OpSelect0 {
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 {
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)
11493 // match: (SETBC [2] (CMPWconst [0] (Select0 (ANDCCconst [1] z))))
11494 // result: (XORconst [1] (Select0 <typ.UInt64> (ANDCCconst [1] z )))
11496 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11499 v_0_0 := v_0.Args[0]
11500 if v_0_0.Op != OpSelect0 {
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 {
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)
11518 // match: (SETBC [2] (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
11519 // result: (SETBC [2] (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
11521 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11524 v_0_0 := v_0.Args[0]
11525 if v_0_0.Op != OpSelect0 {
11528 v_0_0_0 := v_0_0.Args[0]
11529 if v_0_0_0.Op != OpPPC64ANDCCconst {
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)
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 )))
11548 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11552 if a.Op != OpPPC64AND {
11557 if !(a.Uses == 1) {
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))
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 )))
11573 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11577 if o.Op != OpPPC64OR {
11582 if !(o.Uses == 1) {
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))
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 )))
11598 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11602 if a.Op != OpPPC64XOR {
11607 if !(a.Uses == 1) {
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))
11621 func rewriteValuePPC64_OpPPC64SETBCR(v *Value) bool {
11624 typ := &b.Func.Config.Types
11625 // match: (SETBCR [0] (FlagLT))
11626 // result: (MOVDconst [0])
11628 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagLT {
11631 v.reset(OpPPC64MOVDconst)
11632 v.AuxInt = int64ToAuxInt(0)
11635 // match: (SETBCR [0] (FlagGT))
11636 // result: (MOVDconst [1])
11638 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagGT {
11641 v.reset(OpPPC64MOVDconst)
11642 v.AuxInt = int64ToAuxInt(1)
11645 // match: (SETBCR [0] (FlagEQ))
11646 // result: (MOVDconst [1])
11648 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64FlagEQ {
11651 v.reset(OpPPC64MOVDconst)
11652 v.AuxInt = int64ToAuxInt(1)
11655 // match: (SETBCR [1] (FlagGT))
11656 // result: (MOVDconst [0])
11658 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagGT {
11661 v.reset(OpPPC64MOVDconst)
11662 v.AuxInt = int64ToAuxInt(0)
11665 // match: (SETBCR [1] (FlagLT))
11666 // result: (MOVDconst [1])
11668 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagLT {
11671 v.reset(OpPPC64MOVDconst)
11672 v.AuxInt = int64ToAuxInt(1)
11675 // match: (SETBCR [1] (FlagEQ))
11676 // result: (MOVDconst [1])
11678 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64FlagEQ {
11681 v.reset(OpPPC64MOVDconst)
11682 v.AuxInt = int64ToAuxInt(1)
11685 // match: (SETBCR [2] (FlagEQ))
11686 // result: (MOVDconst [0])
11688 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagEQ {
11691 v.reset(OpPPC64MOVDconst)
11692 v.AuxInt = int64ToAuxInt(0)
11695 // match: (SETBCR [2] (FlagLT))
11696 // result: (MOVDconst [1])
11698 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagLT {
11701 v.reset(OpPPC64MOVDconst)
11702 v.AuxInt = int64ToAuxInt(1)
11705 // match: (SETBCR [2] (FlagGT))
11706 // result: (MOVDconst [1])
11708 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64FlagGT {
11711 v.reset(OpPPC64MOVDconst)
11712 v.AuxInt = int64ToAuxInt(1)
11715 // match: (SETBCR [0] (InvertFlags bool))
11716 // result: (SETBCR [1] bool)
11718 if auxIntToInt32(v.AuxInt) != 0 || v_0.Op != OpPPC64InvertFlags {
11721 bool := v_0.Args[0]
11722 v.reset(OpPPC64SETBCR)
11723 v.AuxInt = int32ToAuxInt(1)
11727 // match: (SETBCR [1] (InvertFlags bool))
11728 // result: (SETBCR [0] bool)
11730 if auxIntToInt32(v.AuxInt) != 1 || v_0.Op != OpPPC64InvertFlags {
11733 bool := v_0.Args[0]
11734 v.reset(OpPPC64SETBCR)
11735 v.AuxInt = int32ToAuxInt(0)
11739 // match: (SETBCR [2] (InvertFlags bool))
11740 // result: (SETBCR [2] bool)
11742 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64InvertFlags {
11745 bool := v_0.Args[0]
11746 v.reset(OpPPC64SETBCR)
11747 v.AuxInt = int32ToAuxInt(2)
11751 // match: (SETBCR [n] (InvertFlags bool))
11752 // result: (SETBC [n] bool)
11754 n := auxIntToInt32(v.AuxInt)
11755 if v_0.Op != OpPPC64InvertFlags {
11758 bool := v_0.Args[0]
11759 v.reset(OpPPC64SETBC)
11760 v.AuxInt = int32ToAuxInt(n)
11764 // match: (SETBCR [2] (CMPconst [0] (Select0 (ANDCCconst [1] z))))
11765 // result: (Select0 <typ.UInt64> (ANDCCconst [1] z ))
11767 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11770 v_0_0 := v_0.Args[0]
11771 if v_0_0.Op != OpSelect0 {
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 {
11778 z := v_0_0_0.Args[0]
11780 v.Type = typ.UInt64
11781 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11782 v0.AuxInt = int64ToAuxInt(1)
11787 // match: (SETBCR [2] (CMPWconst [0] (Select0 (ANDCCconst [1] z))))
11788 // result: (Select0 <typ.UInt64> (ANDCCconst [1] z ))
11790 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11793 v_0_0 := v_0.Args[0]
11794 if v_0_0.Op != OpSelect0 {
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 {
11801 z := v_0_0_0.Args[0]
11803 v.Type = typ.UInt64
11804 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
11805 v0.AuxInt = int64ToAuxInt(1)
11810 // match: (SETBCR [2] (CMPWconst [0] (Select0 (ANDCCconst [n] z))))
11811 // result: (SETBCR [2] (Select1 <types.TypeFlags> (ANDCCconst [n] z )))
11813 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPWconst || auxIntToInt32(v_0.AuxInt) != 0 {
11816 v_0_0 := v_0.Args[0]
11817 if v_0_0.Op != OpSelect0 {
11820 v_0_0_0 := v_0_0.Args[0]
11821 if v_0_0_0.Op != OpPPC64ANDCCconst {
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)
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 )))
11840 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11844 if a.Op != OpPPC64AND {
11849 if !(a.Uses == 1) {
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))
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 )))
11865 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11869 if o.Op != OpPPC64OR {
11874 if !(o.Uses == 1) {
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))
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 )))
11890 if auxIntToInt32(v.AuxInt) != 2 || v_0.Op != OpPPC64CMPconst || auxIntToInt64(v_0.AuxInt) != 0 {
11894 if a.Op != OpPPC64XOR {
11899 if !(a.Uses == 1) {
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))
11913 func rewriteValuePPC64_OpPPC64SLD(v *Value) bool {
11916 // match: (SLD x (MOVDconst [c]))
11917 // result: (SLDconst [c&63 | (c>>6&1*63)] x)
11920 if v_1.Op != OpPPC64MOVDconst {
11923 c := auxIntToInt64(v_1.AuxInt)
11924 v.reset(OpPPC64SLDconst)
11925 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
11931 func rewriteValuePPC64_OpPPC64SLDconst(v *Value) bool {
11933 // match: (SLDconst [l] (SRWconst [r] x))
11934 // cond: mergePPC64SldiSrw(l,r) != 0
11935 // result: (RLWINM [mergePPC64SldiSrw(l,r)] x)
11937 l := auxIntToInt64(v.AuxInt)
11938 if v_0.Op != OpPPC64SRWconst {
11941 r := auxIntToInt64(v_0.AuxInt)
11943 if !(mergePPC64SldiSrw(l, r) != 0) {
11946 v.reset(OpPPC64RLWINM)
11947 v.AuxInt = int64ToAuxInt(mergePPC64SldiSrw(l, r))
11951 // match: (SLDconst [c] z:(MOVBZreg x))
11952 // cond: c < 8 && z.Uses == 1
11953 // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,56,63,64)] x)
11955 c := auxIntToInt64(v.AuxInt)
11957 if z.Op != OpPPC64MOVBZreg {
11961 if !(c < 8 && z.Uses == 1) {
11964 v.reset(OpPPC64CLRLSLDI)
11965 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 56, 63, 64))
11969 // match: (SLDconst [c] z:(MOVHZreg x))
11970 // cond: c < 16 && z.Uses == 1
11971 // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,48,63,64)] x)
11973 c := auxIntToInt64(v.AuxInt)
11975 if z.Op != OpPPC64MOVHZreg {
11979 if !(c < 16 && z.Uses == 1) {
11982 v.reset(OpPPC64CLRLSLDI)
11983 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 48, 63, 64))
11987 // match: (SLDconst [c] z:(MOVWZreg x))
11988 // cond: c < 32 && z.Uses == 1
11989 // result: (CLRLSLDI [newPPC64ShiftAuxInt(c,32,63,64)] x)
11991 c := auxIntToInt64(v.AuxInt)
11993 if z.Op != OpPPC64MOVWZreg {
11997 if !(c < 32 && z.Uses == 1) {
12000 v.reset(OpPPC64CLRLSLDI)
12001 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32, 63, 64))
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)
12009 c := auxIntToInt64(v.AuxInt)
12011 if z.Op != OpSelect0 {
12015 if z_0.Op != OpPPC64ANDCCconst {
12018 d := auxIntToInt64(z_0.AuxInt)
12020 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))) {
12023 v.reset(OpPPC64CLRLSLDI)
12024 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 64-getPPC64ShiftMaskLength(d), 63, 64))
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)
12032 c := auxIntToInt64(v.AuxInt)
12034 if z.Op != OpPPC64AND {
12040 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
12041 if z_0.Op != OpPPC64MOVDconst {
12044 d := auxIntToInt64(z_0.AuxInt)
12046 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (64-getPPC64ShiftMaskLength(d))) {
12049 v.reset(OpPPC64CLRLSLDI)
12050 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 64-getPPC64ShiftMaskLength(d), 63, 64))
12056 // match: (SLDconst [c] z:(MOVWreg x))
12057 // cond: c < 32 && buildcfg.GOPPC64 >= 9
12058 // result: (EXTSWSLconst [c] x)
12060 c := auxIntToInt64(v.AuxInt)
12062 if z.Op != OpPPC64MOVWreg {
12066 if !(c < 32 && buildcfg.GOPPC64 >= 9) {
12069 v.reset(OpPPC64EXTSWSLconst)
12070 v.AuxInt = int64ToAuxInt(c)
12076 func rewriteValuePPC64_OpPPC64SLW(v *Value) bool {
12079 // match: (SLW x (MOVDconst [c]))
12080 // result: (SLWconst [c&31 | (c>>5&1*31)] x)
12083 if v_1.Op != OpPPC64MOVDconst {
12086 c := auxIntToInt64(v_1.AuxInt)
12087 v.reset(OpPPC64SLWconst)
12088 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
12094 func rewriteValuePPC64_OpPPC64SLWconst(v *Value) bool {
12096 // match: (SLWconst [c] z:(MOVBZreg x))
12097 // cond: z.Uses == 1 && c < 8
12098 // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,24,31,32)] x)
12100 c := auxIntToInt64(v.AuxInt)
12102 if z.Op != OpPPC64MOVBZreg {
12106 if !(z.Uses == 1 && c < 8) {
12109 v.reset(OpPPC64CLRLSLWI)
12110 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 24, 31, 32))
12114 // match: (SLWconst [c] z:(MOVHZreg x))
12115 // cond: z.Uses == 1 && c < 16
12116 // result: (CLRLSLWI [newPPC64ShiftAuxInt(c,16,31,32)] x)
12118 c := auxIntToInt64(v.AuxInt)
12120 if z.Op != OpPPC64MOVHZreg {
12124 if !(z.Uses == 1 && c < 16) {
12127 v.reset(OpPPC64CLRLSLWI)
12128 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 16, 31, 32))
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)
12136 c := auxIntToInt64(v.AuxInt)
12138 if z.Op != OpSelect0 {
12142 if z_0.Op != OpPPC64ANDCCconst {
12145 d := auxIntToInt64(z_0.AuxInt)
12147 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (32-getPPC64ShiftMaskLength(d))) {
12150 v.reset(OpPPC64CLRLSLWI)
12151 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32-getPPC64ShiftMaskLength(d), 31, 32))
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)
12159 c := auxIntToInt64(v.AuxInt)
12161 if z.Op != OpPPC64AND {
12167 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
12168 if z_0.Op != OpPPC64MOVDconst {
12171 d := auxIntToInt64(z_0.AuxInt)
12173 if !(z.Uses == 1 && isPPC64ValidShiftMask(d) && c <= (32-getPPC64ShiftMaskLength(d))) {
12176 v.reset(OpPPC64CLRLSLWI)
12177 v.AuxInt = int32ToAuxInt(newPPC64ShiftAuxInt(c, 32-getPPC64ShiftMaskLength(d), 31, 32))
12183 // match: (SLWconst [c] z:(MOVWreg x))
12184 // cond: c < 32 && buildcfg.GOPPC64 >= 9
12185 // result: (EXTSWSLconst [c] x)
12187 c := auxIntToInt64(v.AuxInt)
12189 if z.Op != OpPPC64MOVWreg {
12193 if !(c < 32 && buildcfg.GOPPC64 >= 9) {
12196 v.reset(OpPPC64EXTSWSLconst)
12197 v.AuxInt = int64ToAuxInt(c)
12203 func rewriteValuePPC64_OpPPC64SRAD(v *Value) bool {
12206 // match: (SRAD x (MOVDconst [c]))
12207 // result: (SRADconst [c&63 | (c>>6&1*63)] x)
12210 if v_1.Op != OpPPC64MOVDconst {
12213 c := auxIntToInt64(v_1.AuxInt)
12214 v.reset(OpPPC64SRADconst)
12215 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
12221 func rewriteValuePPC64_OpPPC64SRAW(v *Value) bool {
12224 // match: (SRAW x (MOVDconst [c]))
12225 // result: (SRAWconst [c&31 | (c>>5&1*31)] x)
12228 if v_1.Op != OpPPC64MOVDconst {
12231 c := auxIntToInt64(v_1.AuxInt)
12232 v.reset(OpPPC64SRAWconst)
12233 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
12239 func rewriteValuePPC64_OpPPC64SRD(v *Value) bool {
12242 // match: (SRD x (MOVDconst [c]))
12243 // result: (SRDconst [c&63 | (c>>6&1*63)] x)
12246 if v_1.Op != OpPPC64MOVDconst {
12249 c := auxIntToInt64(v_1.AuxInt)
12250 v.reset(OpPPC64SRDconst)
12251 v.AuxInt = int64ToAuxInt(c&63 | (c >> 6 & 1 * 63))
12257 func rewriteValuePPC64_OpPPC64SRW(v *Value) bool {
12260 // match: (SRW x (MOVDconst [c]))
12261 // result: (SRWconst [c&31 | (c>>5&1*31)] x)
12264 if v_1.Op != OpPPC64MOVDconst {
12267 c := auxIntToInt64(v_1.AuxInt)
12268 v.reset(OpPPC64SRWconst)
12269 v.AuxInt = int64ToAuxInt(c&31 | (c >> 5 & 1 * 31))
12275 func rewriteValuePPC64_OpPPC64SRWconst(v *Value) bool {
12277 // match: (SRWconst (Select0 (ANDCCconst [m] x)) [s])
12278 // cond: mergePPC64RShiftMask(m>>uint(s),s,32) == 0
12279 // result: (MOVDconst [0])
12281 s := auxIntToInt64(v.AuxInt)
12282 if v_0.Op != OpSelect0 {
12285 v_0_0 := v_0.Args[0]
12286 if v_0_0.Op != OpPPC64ANDCCconst {
12289 m := auxIntToInt64(v_0_0.AuxInt)
12290 if !(mergePPC64RShiftMask(m>>uint(s), s, 32) == 0) {
12293 v.reset(OpPPC64MOVDconst)
12294 v.AuxInt = int64ToAuxInt(0)
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)
12301 s := auxIntToInt64(v.AuxInt)
12302 if v_0.Op != OpSelect0 {
12305 v_0_0 := v_0.Args[0]
12306 if v_0_0.Op != OpPPC64ANDCCconst {
12309 m := auxIntToInt64(v_0_0.AuxInt)
12311 if !(mergePPC64AndSrwi(m>>uint(s), s) != 0) {
12314 v.reset(OpPPC64RLWINM)
12315 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m>>uint(s), s))
12319 // match: (SRWconst (AND (MOVDconst [m]) x) [s])
12320 // cond: mergePPC64RShiftMask(m>>uint(s),s,32) == 0
12321 // result: (MOVDconst [0])
12323 s := auxIntToInt64(v.AuxInt)
12324 if v_0.Op != OpPPC64AND {
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 {
12334 m := auxIntToInt64(v_0_0.AuxInt)
12335 if !(mergePPC64RShiftMask(m>>uint(s), s, 32) == 0) {
12338 v.reset(OpPPC64MOVDconst)
12339 v.AuxInt = int64ToAuxInt(0)
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)
12348 s := auxIntToInt64(v.AuxInt)
12349 if v_0.Op != OpPPC64AND {
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 {
12359 m := auxIntToInt64(v_0_0.AuxInt)
12361 if !(mergePPC64AndSrwi(m>>uint(s), s) != 0) {
12364 v.reset(OpPPC64RLWINM)
12365 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m>>uint(s), s))
12373 func rewriteValuePPC64_OpPPC64SUB(v *Value) bool {
12376 // match: (SUB x (MOVDconst [c]))
12377 // cond: is32Bit(-c)
12378 // result: (ADDconst [-c] x)
12381 if v_1.Op != OpPPC64MOVDconst {
12384 c := auxIntToInt64(v_1.AuxInt)
12385 if !(is32Bit(-c)) {
12388 v.reset(OpPPC64ADDconst)
12389 v.AuxInt = int64ToAuxInt(-c)
12393 // match: (SUB (MOVDconst [c]) x)
12394 // cond: is32Bit(c)
12395 // result: (SUBFCconst [c] x)
12397 if v_0.Op != OpPPC64MOVDconst {
12400 c := auxIntToInt64(v_0.AuxInt)
12405 v.reset(OpPPC64SUBFCconst)
12406 v.AuxInt = int64ToAuxInt(c)
12412 func rewriteValuePPC64_OpPPC64SUBE(v *Value) bool {
12417 typ := &b.Func.Config.Types
12418 // match: (SUBE x y (Select1 <typ.UInt64> (SUBCconst (MOVDconst [0]) [0])))
12419 // result: (SUBC x y)
12423 if v_2.Op != OpSelect1 || v_2.Type != typ.UInt64 {
12426 v_2_0 := v_2.Args[0]
12427 if v_2_0.Op != OpPPC64SUBCconst || auxIntToInt64(v_2_0.AuxInt) != 0 {
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 {
12434 v.reset(OpPPC64SUBC)
12440 func rewriteValuePPC64_OpPPC64SUBFCconst(v *Value) bool {
12442 // match: (SUBFCconst [c] (NEG x))
12443 // result: (ADDconst [c] x)
12445 c := auxIntToInt64(v.AuxInt)
12446 if v_0.Op != OpPPC64NEG {
12450 v.reset(OpPPC64ADDconst)
12451 v.AuxInt = int64ToAuxInt(c)
12455 // match: (SUBFCconst [c] (SUBFCconst [d] x))
12456 // cond: is32Bit(c-d)
12457 // result: (ADDconst [c-d] x)
12459 c := auxIntToInt64(v.AuxInt)
12460 if v_0.Op != OpPPC64SUBFCconst {
12463 d := auxIntToInt64(v_0.AuxInt)
12465 if !(is32Bit(c - d)) {
12468 v.reset(OpPPC64ADDconst)
12469 v.AuxInt = int64ToAuxInt(c - d)
12473 // match: (SUBFCconst [0] x)
12476 if auxIntToInt64(v.AuxInt) != 0 {
12480 v.reset(OpPPC64NEG)
12486 func rewriteValuePPC64_OpPPC64XOR(v *Value) bool {
12489 // match: (XOR (MOVDconst [c]) (MOVDconst [d]))
12490 // result: (MOVDconst [c^d])
12492 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12493 if v_0.Op != OpPPC64MOVDconst {
12496 c := auxIntToInt64(v_0.AuxInt)
12497 if v_1.Op != OpPPC64MOVDconst {
12500 d := auxIntToInt64(v_1.AuxInt)
12501 v.reset(OpPPC64MOVDconst)
12502 v.AuxInt = int64ToAuxInt(c ^ d)
12507 // match: (XOR x (MOVDconst [c]))
12508 // cond: isU32Bit(c)
12509 // result: (XORconst [c] x)
12511 for _i0 := 0; _i0 <= 1; _i0, v_0, v_1 = _i0+1, v_1, v_0 {
12513 if v_1.Op != OpPPC64MOVDconst {
12516 c := auxIntToInt64(v_1.AuxInt)
12517 if !(isU32Bit(c)) {
12520 v.reset(OpPPC64XORconst)
12521 v.AuxInt = int64ToAuxInt(c)
12529 func rewriteValuePPC64_OpPPC64XORconst(v *Value) bool {
12531 // match: (XORconst [c] (XORconst [d] x))
12532 // result: (XORconst [c^d] x)
12534 c := auxIntToInt64(v.AuxInt)
12535 if v_0.Op != OpPPC64XORconst {
12538 d := auxIntToInt64(v_0.AuxInt)
12540 v.reset(OpPPC64XORconst)
12541 v.AuxInt = int64ToAuxInt(c ^ d)
12545 // match: (XORconst [0] x)
12548 if auxIntToInt64(v.AuxInt) != 0 {
12555 // match: (XORconst [1] (SETBCR [n] cmp))
12556 // result: (SETBC [n] cmp)
12558 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpPPC64SETBCR {
12561 n := auxIntToInt32(v_0.AuxInt)
12563 v.reset(OpPPC64SETBC)
12564 v.AuxInt = int32ToAuxInt(n)
12568 // match: (XORconst [1] (SETBC [n] cmp))
12569 // result: (SETBCR [n] cmp)
12571 if auxIntToInt64(v.AuxInt) != 1 || v_0.Op != OpPPC64SETBC {
12574 n := auxIntToInt32(v_0.AuxInt)
12576 v.reset(OpPPC64SETBCR)
12577 v.AuxInt = int32ToAuxInt(n)
12583 func rewriteValuePPC64_OpPanicBounds(v *Value) bool {
12587 // match: (PanicBounds [kind] x y mem)
12588 // cond: boundsABI(kind) == 0
12589 // result: (LoweredPanicBoundsA [kind] x y mem)
12591 kind := auxIntToInt64(v.AuxInt)
12595 if !(boundsABI(kind) == 0) {
12598 v.reset(OpPPC64LoweredPanicBoundsA)
12599 v.AuxInt = int64ToAuxInt(kind)
12600 v.AddArg3(x, y, mem)
12603 // match: (PanicBounds [kind] x y mem)
12604 // cond: boundsABI(kind) == 1
12605 // result: (LoweredPanicBoundsB [kind] x y mem)
12607 kind := auxIntToInt64(v.AuxInt)
12611 if !(boundsABI(kind) == 1) {
12614 v.reset(OpPPC64LoweredPanicBoundsB)
12615 v.AuxInt = int64ToAuxInt(kind)
12616 v.AddArg3(x, y, mem)
12619 // match: (PanicBounds [kind] x y mem)
12620 // cond: boundsABI(kind) == 2
12621 // result: (LoweredPanicBoundsC [kind] x y mem)
12623 kind := auxIntToInt64(v.AuxInt)
12627 if !(boundsABI(kind) == 2) {
12630 v.reset(OpPPC64LoweredPanicBoundsC)
12631 v.AuxInt = int64ToAuxInt(kind)
12632 v.AddArg3(x, y, mem)
12637 func rewriteValuePPC64_OpPopCount16(v *Value) bool {
12640 typ := &b.Func.Config.Types
12641 // match: (PopCount16 x)
12642 // result: (POPCNTW (MOVHZreg x))
12645 v.reset(OpPPC64POPCNTW)
12646 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12652 func rewriteValuePPC64_OpPopCount32(v *Value) bool {
12655 typ := &b.Func.Config.Types
12656 // match: (PopCount32 x)
12657 // result: (POPCNTW (MOVWZreg x))
12660 v.reset(OpPPC64POPCNTW)
12661 v0 := b.NewValue0(v.Pos, OpPPC64MOVWZreg, typ.Int64)
12667 func rewriteValuePPC64_OpPopCount8(v *Value) bool {
12670 typ := &b.Func.Config.Types
12671 // match: (PopCount8 x)
12672 // result: (POPCNTB (MOVBZreg x))
12675 v.reset(OpPPC64POPCNTB)
12676 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
12682 func rewriteValuePPC64_OpPrefetchCache(v *Value) bool {
12685 // match: (PrefetchCache ptr mem)
12686 // result: (DCBT ptr mem [0])
12690 v.reset(OpPPC64DCBT)
12691 v.AuxInt = int64ToAuxInt(0)
12692 v.AddArg2(ptr, mem)
12696 func rewriteValuePPC64_OpPrefetchCacheStreamed(v *Value) bool {
12699 // match: (PrefetchCacheStreamed ptr mem)
12700 // result: (DCBT ptr mem [16])
12704 v.reset(OpPPC64DCBT)
12705 v.AuxInt = int64ToAuxInt(16)
12706 v.AddArg2(ptr, mem)
12710 func rewriteValuePPC64_OpRotateLeft16(v *Value) bool {
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])))
12720 if v_1.Op != OpPPC64MOVDconst {
12723 c := auxIntToInt64(v_1.AuxInt)
12725 v0 := b.NewValue0(v.Pos, OpLsh16x64, t)
12726 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12727 v1.AuxInt = int64ToAuxInt(c & 15)
12729 v2 := b.NewValue0(v.Pos, OpRsh16Ux64, t)
12730 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12731 v3.AuxInt = int64ToAuxInt(-c & 15)
12738 func rewriteValuePPC64_OpRotateLeft8(v *Value) bool {
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])))
12748 if v_1.Op != OpPPC64MOVDconst {
12751 c := auxIntToInt64(v_1.AuxInt)
12753 v0 := b.NewValue0(v.Pos, OpLsh8x64, t)
12754 v1 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12755 v1.AuxInt = int64ToAuxInt(c & 7)
12757 v2 := b.NewValue0(v.Pos, OpRsh8Ux64, t)
12758 v3 := b.NewValue0(v.Pos, OpPPC64MOVDconst, typ.Int64)
12759 v3.AuxInt = int64ToAuxInt(-c & 7)
12766 func rewriteValuePPC64_OpRsh16Ux16(v *Value) bool {
12770 typ := &b.Func.Config.Types
12771 // match: (Rsh16Ux16 x y)
12772 // cond: shiftIsBounded(v)
12773 // result: (SRD (MOVHZreg x) y)
12777 if !(shiftIsBounded(v)) {
12780 v.reset(OpPPC64SRD)
12781 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12786 // match: (Rsh16Ux16 <t> x y)
12787 // result: (ISEL [2] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF0] y)))
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)
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)
12805 v.AddArg3(v0, v2, v3)
12809 func rewriteValuePPC64_OpRsh16Ux32(v *Value) bool {
12813 typ := &b.Func.Config.Types
12814 // match: (Rsh16Ux32 x y)
12815 // cond: shiftIsBounded(v)
12816 // result: (SRD (MOVHZreg x) y)
12820 if !(shiftIsBounded(v)) {
12823 v.reset(OpPPC64SRD)
12824 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12829 // match: (Rsh16Ux32 <t> x y)
12830 // result: (ISEL [0] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPWUconst y [16]))
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)
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)
12846 v.AddArg3(v0, v2, v3)
12850 func rewriteValuePPC64_OpRsh16Ux64(v *Value) bool {
12854 typ := &b.Func.Config.Types
12855 // match: (Rsh16Ux64 x (MOVDconst [c]))
12856 // cond: uint64(c) < 16
12857 // result: (SRWconst (ZeroExt16to32 x) [c])
12860 if v_1.Op != OpPPC64MOVDconst {
12863 c := auxIntToInt64(v_1.AuxInt)
12864 if !(uint64(c) < 16) {
12867 v.reset(OpPPC64SRWconst)
12868 v.AuxInt = int64ToAuxInt(c)
12869 v0 := b.NewValue0(v.Pos, OpZeroExt16to32, typ.UInt32)
12874 // match: (Rsh16Ux64 x y)
12875 // cond: shiftIsBounded(v)
12876 // result: (SRD (MOVHZreg x) y)
12880 if !(shiftIsBounded(v)) {
12883 v.reset(OpPPC64SRD)
12884 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12889 // match: (Rsh16Ux64 <t> x y)
12890 // result: (ISEL [0] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (CMPUconst y [16]))
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)
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)
12906 v.AddArg3(v0, v2, v3)
12910 func rewriteValuePPC64_OpRsh16Ux8(v *Value) bool {
12914 typ := &b.Func.Config.Types
12915 // match: (Rsh16Ux8 x y)
12916 // cond: shiftIsBounded(v)
12917 // result: (SRD (MOVHZreg x) y)
12921 if !(shiftIsBounded(v)) {
12924 v.reset(OpPPC64SRD)
12925 v0 := b.NewValue0(v.Pos, OpPPC64MOVHZreg, typ.Int64)
12930 // match: (Rsh16Ux8 <t> x y)
12931 // result: (ISEL [2] (SRD <t> (MOVHZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F0] y)))
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)
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)
12949 v.AddArg3(v0, v2, v3)
12953 func rewriteValuePPC64_OpRsh16x16(v *Value) bool {
12957 typ := &b.Func.Config.Types
12958 // match: (Rsh16x16 x y)
12959 // cond: shiftIsBounded(v)
12960 // result: (SRAD (MOVHreg x) y)
12964 if !(shiftIsBounded(v)) {
12967 v.reset(OpPPC64SRAD)
12968 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
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)))
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)
12985 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
12986 v2.AuxInt = int64ToAuxInt(15)
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)
12993 v.AddArg3(v0, v2, v3)
12997 func rewriteValuePPC64_OpRsh16x32(v *Value) bool {
13001 typ := &b.Func.Config.Types
13002 // match: (Rsh16x32 x y)
13003 // cond: shiftIsBounded(v)
13004 // result: (SRAD (MOVHreg x) y)
13008 if !(shiftIsBounded(v)) {
13011 v.reset(OpPPC64SRAD)
13012 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13017 // match: (Rsh16x32 <t> x y)
13018 // result: (ISEL [0] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (CMPWUconst y [16]))
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)
13029 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13030 v2.AuxInt = int64ToAuxInt(15)
13032 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13033 v3.AuxInt = int32ToAuxInt(16)
13035 v.AddArg3(v0, v2, v3)
13039 func rewriteValuePPC64_OpRsh16x64(v *Value) bool {
13043 typ := &b.Func.Config.Types
13044 // match: (Rsh16x64 x (MOVDconst [c]))
13045 // cond: uint64(c) >= 16
13046 // result: (SRAWconst (SignExt16to32 x) [63])
13049 if v_1.Op != OpPPC64MOVDconst {
13052 c := auxIntToInt64(v_1.AuxInt)
13053 if !(uint64(c) >= 16) {
13056 v.reset(OpPPC64SRAWconst)
13057 v.AuxInt = int64ToAuxInt(63)
13058 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
13063 // match: (Rsh16x64 x (MOVDconst [c]))
13064 // cond: uint64(c) < 16
13065 // result: (SRAWconst (SignExt16to32 x) [c])
13068 if v_1.Op != OpPPC64MOVDconst {
13071 c := auxIntToInt64(v_1.AuxInt)
13072 if !(uint64(c) < 16) {
13075 v.reset(OpPPC64SRAWconst)
13076 v.AuxInt = int64ToAuxInt(c)
13077 v0 := b.NewValue0(v.Pos, OpSignExt16to32, typ.Int32)
13082 // match: (Rsh16x64 x y)
13083 // cond: shiftIsBounded(v)
13084 // result: (SRAD (MOVHreg x) y)
13088 if !(shiftIsBounded(v)) {
13091 v.reset(OpPPC64SRAD)
13092 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
13097 // match: (Rsh16x64 <t> x y)
13098 // result: (ISEL [0] (SRAD <t> (MOVHreg x) y) (SRADconst <t> (MOVHreg x) [15]) (CMPUconst y [16]))
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)
13109 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13110 v2.AuxInt = int64ToAuxInt(15)
13112 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13113 v3.AuxInt = int64ToAuxInt(16)
13115 v.AddArg3(v0, v2, v3)
13119 func rewriteValuePPC64_OpRsh16x8(v *Value) bool {
13123 typ := &b.Func.Config.Types
13124 // match: (Rsh16x8 x y)
13125 // cond: shiftIsBounded(v)
13126 // result: (SRAD (MOVHreg x) y)
13130 if !(shiftIsBounded(v)) {
13133 v.reset(OpPPC64SRAD)
13134 v0 := b.NewValue0(v.Pos, OpPPC64MOVHreg, typ.Int64)
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)))
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)
13151 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13152 v2.AuxInt = int64ToAuxInt(15)
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)
13159 v.AddArg3(v0, v2, v3)
13163 func rewriteValuePPC64_OpRsh32Ux16(v *Value) bool {
13167 typ := &b.Func.Config.Types
13168 // match: (Rsh32Ux16 x y)
13169 // cond: shiftIsBounded(v)
13170 // result: (SRW x y)
13174 if !(shiftIsBounded(v)) {
13177 v.reset(OpPPC64SRW)
13181 // match: (Rsh32Ux16 <t> x y)
13182 // result: (ISEL [2] (SRW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y)))
13187 v.reset(OpPPC64ISEL)
13188 v.AuxInt = int32ToAuxInt(2)
13189 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
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)
13198 v.AddArg3(v0, v1, v2)
13202 func rewriteValuePPC64_OpRsh32Ux32(v *Value) bool {
13206 typ := &b.Func.Config.Types
13207 // match: (Rsh32Ux32 x y)
13208 // cond: shiftIsBounded(v)
13209 // result: (SRW x y)
13213 if !(shiftIsBounded(v)) {
13216 v.reset(OpPPC64SRW)
13220 // match: (Rsh32Ux32 <t> x y)
13221 // result: (ISEL [0] (SRW <t> x y) (MOVDconst [0]) (CMPWUconst y [32]))
13226 v.reset(OpPPC64ISEL)
13227 v.AuxInt = int32ToAuxInt(0)
13228 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
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)
13235 v.AddArg3(v0, v1, v2)
13239 func rewriteValuePPC64_OpRsh32Ux64(v *Value) bool {
13243 typ := &b.Func.Config.Types
13244 // match: (Rsh32Ux64 x (MOVDconst [c]))
13245 // cond: uint64(c) < 32
13246 // result: (SRWconst x [c])
13249 if v_1.Op != OpPPC64MOVDconst {
13252 c := auxIntToInt64(v_1.AuxInt)
13253 if !(uint64(c) < 32) {
13256 v.reset(OpPPC64SRWconst)
13257 v.AuxInt = int64ToAuxInt(c)
13261 // match: (Rsh32Ux64 x y)
13262 // cond: shiftIsBounded(v)
13263 // result: (SRW x y)
13267 if !(shiftIsBounded(v)) {
13270 v.reset(OpPPC64SRW)
13274 // match: (Rsh32Ux64 <t> x y)
13275 // result: (ISEL [0] (SRW <t> x y) (MOVDconst [0]) (CMPUconst y [32]))
13280 v.reset(OpPPC64ISEL)
13281 v.AuxInt = int32ToAuxInt(0)
13282 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
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)
13289 v.AddArg3(v0, v1, v2)
13293 func rewriteValuePPC64_OpRsh32Ux8(v *Value) bool {
13297 typ := &b.Func.Config.Types
13298 // match: (Rsh32Ux8 x y)
13299 // cond: shiftIsBounded(v)
13300 // result: (SRW x y)
13304 if !(shiftIsBounded(v)) {
13307 v.reset(OpPPC64SRW)
13311 // match: (Rsh32Ux8 <t> x y)
13312 // result: (ISEL [2] (SRW <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y)))
13317 v.reset(OpPPC64ISEL)
13318 v.AuxInt = int32ToAuxInt(2)
13319 v0 := b.NewValue0(v.Pos, OpPPC64SRW, t)
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)
13328 v.AddArg3(v0, v1, v2)
13332 func rewriteValuePPC64_OpRsh32x16(v *Value) bool {
13336 typ := &b.Func.Config.Types
13337 // match: (Rsh32x16 x y)
13338 // cond: shiftIsBounded(v)
13339 // result: (SRAW x y)
13343 if !(shiftIsBounded(v)) {
13346 v.reset(OpPPC64SRAW)
13350 // match: (Rsh32x16 <t> x y)
13351 // result: (ISEL [2] (SRAW <t> x y) (SRAWconst <t> x [31]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFE0] y)))
13356 v.reset(OpPPC64ISEL)
13357 v.AuxInt = int32ToAuxInt(2)
13358 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13360 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13361 v1.AuxInt = int64ToAuxInt(31)
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)
13368 v.AddArg3(v0, v1, v2)
13372 func rewriteValuePPC64_OpRsh32x32(v *Value) bool {
13376 // match: (Rsh32x32 x y)
13377 // cond: shiftIsBounded(v)
13378 // result: (SRAW x y)
13382 if !(shiftIsBounded(v)) {
13385 v.reset(OpPPC64SRAW)
13389 // match: (Rsh32x32 <t> x y)
13390 // result: (ISEL [0] (SRAW <t> x y) (SRAWconst <t> x [31]) (CMPWUconst y [32]))
13395 v.reset(OpPPC64ISEL)
13396 v.AuxInt = int32ToAuxInt(0)
13397 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13399 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13400 v1.AuxInt = int64ToAuxInt(31)
13402 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13403 v2.AuxInt = int32ToAuxInt(32)
13405 v.AddArg3(v0, v1, v2)
13409 func rewriteValuePPC64_OpRsh32x64(v *Value) bool {
13413 // match: (Rsh32x64 x (MOVDconst [c]))
13414 // cond: uint64(c) >= 32
13415 // result: (SRAWconst x [63])
13418 if v_1.Op != OpPPC64MOVDconst {
13421 c := auxIntToInt64(v_1.AuxInt)
13422 if !(uint64(c) >= 32) {
13425 v.reset(OpPPC64SRAWconst)
13426 v.AuxInt = int64ToAuxInt(63)
13430 // match: (Rsh32x64 x (MOVDconst [c]))
13431 // cond: uint64(c) < 32
13432 // result: (SRAWconst x [c])
13435 if v_1.Op != OpPPC64MOVDconst {
13438 c := auxIntToInt64(v_1.AuxInt)
13439 if !(uint64(c) < 32) {
13442 v.reset(OpPPC64SRAWconst)
13443 v.AuxInt = int64ToAuxInt(c)
13447 // match: (Rsh32x64 x y)
13448 // cond: shiftIsBounded(v)
13449 // result: (SRAW x y)
13453 if !(shiftIsBounded(v)) {
13456 v.reset(OpPPC64SRAW)
13460 // match: (Rsh32x64 <t> x y)
13461 // result: (ISEL [0] (SRAW <t> x y) (SRAWconst <t> x [31]) (CMPUconst y [32]))
13466 v.reset(OpPPC64ISEL)
13467 v.AuxInt = int32ToAuxInt(0)
13468 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13470 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13471 v1.AuxInt = int64ToAuxInt(31)
13473 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13474 v2.AuxInt = int64ToAuxInt(32)
13476 v.AddArg3(v0, v1, v2)
13480 func rewriteValuePPC64_OpRsh32x8(v *Value) bool {
13484 typ := &b.Func.Config.Types
13485 // match: (Rsh32x8 x y)
13486 // cond: shiftIsBounded(v)
13487 // result: (SRAW x y)
13491 if !(shiftIsBounded(v)) {
13494 v.reset(OpPPC64SRAW)
13498 // match: (Rsh32x8 <t> x y)
13499 // result: (ISEL [2] (SRAW <t> x y) (SRAWconst <t> x [31]) (Select1 <types.TypeFlags> (ANDCCconst [0x00E0] y)))
13504 v.reset(OpPPC64ISEL)
13505 v.AuxInt = int32ToAuxInt(2)
13506 v0 := b.NewValue0(v.Pos, OpPPC64SRAW, t)
13508 v1 := b.NewValue0(v.Pos, OpPPC64SRAWconst, t)
13509 v1.AuxInt = int64ToAuxInt(31)
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)
13516 v.AddArg3(v0, v1, v2)
13520 func rewriteValuePPC64_OpRsh64Ux16(v *Value) bool {
13524 typ := &b.Func.Config.Types
13525 // match: (Rsh64Ux16 x y)
13526 // cond: shiftIsBounded(v)
13527 // result: (SRD x y)
13531 if !(shiftIsBounded(v)) {
13534 v.reset(OpPPC64SRD)
13538 // match: (Rsh64Ux16 <t> x y)
13539 // result: (ISEL [2] (SRD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y)))
13544 v.reset(OpPPC64ISEL)
13545 v.AuxInt = int32ToAuxInt(2)
13546 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
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)
13555 v.AddArg3(v0, v1, v2)
13559 func rewriteValuePPC64_OpRsh64Ux32(v *Value) bool {
13563 typ := &b.Func.Config.Types
13564 // match: (Rsh64Ux32 x y)
13565 // cond: shiftIsBounded(v)
13566 // result: (SRD x y)
13570 if !(shiftIsBounded(v)) {
13573 v.reset(OpPPC64SRD)
13577 // match: (Rsh64Ux32 <t> x y)
13578 // result: (ISEL [0] (SRD <t> x y) (MOVDconst [0]) (CMPWUconst y [64]))
13583 v.reset(OpPPC64ISEL)
13584 v.AuxInt = int32ToAuxInt(0)
13585 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
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)
13592 v.AddArg3(v0, v1, v2)
13596 func rewriteValuePPC64_OpRsh64Ux64(v *Value) bool {
13600 typ := &b.Func.Config.Types
13601 // match: (Rsh64Ux64 x (MOVDconst [c]))
13602 // cond: uint64(c) < 64
13603 // result: (SRDconst x [c])
13606 if v_1.Op != OpPPC64MOVDconst {
13609 c := auxIntToInt64(v_1.AuxInt)
13610 if !(uint64(c) < 64) {
13613 v.reset(OpPPC64SRDconst)
13614 v.AuxInt = int64ToAuxInt(c)
13618 // match: (Rsh64Ux64 x y)
13619 // cond: shiftIsBounded(v)
13620 // result: (SRD x y)
13624 if !(shiftIsBounded(v)) {
13627 v.reset(OpPPC64SRD)
13631 // match: (Rsh64Ux64 <t> x y)
13632 // result: (ISEL [0] (SRD <t> x y) (MOVDconst [0]) (CMPUconst y [64]))
13637 v.reset(OpPPC64ISEL)
13638 v.AuxInt = int32ToAuxInt(0)
13639 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
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)
13646 v.AddArg3(v0, v1, v2)
13650 func rewriteValuePPC64_OpRsh64Ux8(v *Value) bool {
13654 typ := &b.Func.Config.Types
13655 // match: (Rsh64Ux8 x y)
13656 // cond: shiftIsBounded(v)
13657 // result: (SRD x y)
13661 if !(shiftIsBounded(v)) {
13664 v.reset(OpPPC64SRD)
13668 // match: (Rsh64Ux8 <t> x y)
13669 // result: (ISEL [2] (SRD <t> x y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y)))
13674 v.reset(OpPPC64ISEL)
13675 v.AuxInt = int32ToAuxInt(2)
13676 v0 := b.NewValue0(v.Pos, OpPPC64SRD, t)
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)
13685 v.AddArg3(v0, v1, v2)
13689 func rewriteValuePPC64_OpRsh64x16(v *Value) bool {
13693 typ := &b.Func.Config.Types
13694 // match: (Rsh64x16 x y)
13695 // cond: shiftIsBounded(v)
13696 // result: (SRAD x y)
13700 if !(shiftIsBounded(v)) {
13703 v.reset(OpPPC64SRAD)
13707 // match: (Rsh64x16 <t> x y)
13708 // result: (ISEL [2] (SRAD <t> x y) (SRADconst <t> x [63]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFC0] y)))
13713 v.reset(OpPPC64ISEL)
13714 v.AuxInt = int32ToAuxInt(2)
13715 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13717 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13718 v1.AuxInt = int64ToAuxInt(63)
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)
13725 v.AddArg3(v0, v1, v2)
13729 func rewriteValuePPC64_OpRsh64x32(v *Value) bool {
13733 // match: (Rsh64x32 x y)
13734 // cond: shiftIsBounded(v)
13735 // result: (SRAD x y)
13739 if !(shiftIsBounded(v)) {
13742 v.reset(OpPPC64SRAD)
13746 // match: (Rsh64x32 <t> x y)
13747 // result: (ISEL [0] (SRAD <t> x y) (SRADconst <t> x [63]) (CMPWUconst y [64]))
13752 v.reset(OpPPC64ISEL)
13753 v.AuxInt = int32ToAuxInt(0)
13754 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13756 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13757 v1.AuxInt = int64ToAuxInt(63)
13759 v2 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
13760 v2.AuxInt = int32ToAuxInt(64)
13762 v.AddArg3(v0, v1, v2)
13766 func rewriteValuePPC64_OpRsh64x64(v *Value) bool {
13770 // match: (Rsh64x64 x (MOVDconst [c]))
13771 // cond: uint64(c) >= 64
13772 // result: (SRADconst x [63])
13775 if v_1.Op != OpPPC64MOVDconst {
13778 c := auxIntToInt64(v_1.AuxInt)
13779 if !(uint64(c) >= 64) {
13782 v.reset(OpPPC64SRADconst)
13783 v.AuxInt = int64ToAuxInt(63)
13787 // match: (Rsh64x64 x (MOVDconst [c]))
13788 // cond: uint64(c) < 64
13789 // result: (SRADconst x [c])
13792 if v_1.Op != OpPPC64MOVDconst {
13795 c := auxIntToInt64(v_1.AuxInt)
13796 if !(uint64(c) < 64) {
13799 v.reset(OpPPC64SRADconst)
13800 v.AuxInt = int64ToAuxInt(c)
13804 // match: (Rsh64x64 x y)
13805 // cond: shiftIsBounded(v)
13806 // result: (SRAD x y)
13810 if !(shiftIsBounded(v)) {
13813 v.reset(OpPPC64SRAD)
13817 // match: (Rsh64x64 <t> x y)
13818 // result: (ISEL [0] (SRAD <t> x y) (SRADconst <t> x [63]) (CMPUconst y [64]))
13823 v.reset(OpPPC64ISEL)
13824 v.AuxInt = int32ToAuxInt(0)
13825 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13827 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13828 v1.AuxInt = int64ToAuxInt(63)
13830 v2 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
13831 v2.AuxInt = int64ToAuxInt(64)
13833 v.AddArg3(v0, v1, v2)
13837 func rewriteValuePPC64_OpRsh64x8(v *Value) bool {
13841 typ := &b.Func.Config.Types
13842 // match: (Rsh64x8 x y)
13843 // cond: shiftIsBounded(v)
13844 // result: (SRAD x y)
13848 if !(shiftIsBounded(v)) {
13851 v.reset(OpPPC64SRAD)
13855 // match: (Rsh64x8 <t> x y)
13856 // result: (ISEL [2] (SRAD <t> x y) (SRADconst <t> x [63]) (Select1 <types.TypeFlags> (ANDCCconst [0x00C0] y)))
13861 v.reset(OpPPC64ISEL)
13862 v.AuxInt = int32ToAuxInt(2)
13863 v0 := b.NewValue0(v.Pos, OpPPC64SRAD, t)
13865 v1 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
13866 v1.AuxInt = int64ToAuxInt(63)
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)
13873 v.AddArg3(v0, v1, v2)
13877 func rewriteValuePPC64_OpRsh8Ux16(v *Value) bool {
13881 typ := &b.Func.Config.Types
13882 // match: (Rsh8Ux16 x y)
13883 // cond: shiftIsBounded(v)
13884 // result: (SRD (MOVBZreg x) y)
13888 if !(shiftIsBounded(v)) {
13891 v.reset(OpPPC64SRD)
13892 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13897 // match: (Rsh8Ux16 <t> x y)
13898 // result: (ISEL [2] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0xFFF8] y)))
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)
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)
13916 v.AddArg3(v0, v2, v3)
13920 func rewriteValuePPC64_OpRsh8Ux32(v *Value) bool {
13924 typ := &b.Func.Config.Types
13925 // match: (Rsh8Ux32 x y)
13926 // cond: shiftIsBounded(v)
13927 // result: (SRD (MOVBZreg x) y)
13931 if !(shiftIsBounded(v)) {
13934 v.reset(OpPPC64SRD)
13935 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
13940 // match: (Rsh8Ux32 <t> x y)
13941 // result: (ISEL [0] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPWUconst y [8]))
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)
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)
13957 v.AddArg3(v0, v2, v3)
13961 func rewriteValuePPC64_OpRsh8Ux64(v *Value) bool {
13965 typ := &b.Func.Config.Types
13966 // match: (Rsh8Ux64 x (MOVDconst [c]))
13967 // cond: uint64(c) < 8
13968 // result: (SRWconst (ZeroExt8to32 x) [c])
13971 if v_1.Op != OpPPC64MOVDconst {
13974 c := auxIntToInt64(v_1.AuxInt)
13975 if !(uint64(c) < 8) {
13978 v.reset(OpPPC64SRWconst)
13979 v.AuxInt = int64ToAuxInt(c)
13980 v0 := b.NewValue0(v.Pos, OpZeroExt8to32, typ.UInt32)
13985 // match: (Rsh8Ux64 x y)
13986 // cond: shiftIsBounded(v)
13987 // result: (SRD (MOVBZreg x) y)
13991 if !(shiftIsBounded(v)) {
13994 v.reset(OpPPC64SRD)
13995 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
14000 // match: (Rsh8Ux64 <t> x y)
14001 // result: (ISEL [0] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (CMPUconst y [8]))
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)
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)
14017 v.AddArg3(v0, v2, v3)
14021 func rewriteValuePPC64_OpRsh8Ux8(v *Value) bool {
14025 typ := &b.Func.Config.Types
14026 // match: (Rsh8Ux8 x y)
14027 // cond: shiftIsBounded(v)
14028 // result: (SRD (MOVBZreg x) y)
14032 if !(shiftIsBounded(v)) {
14035 v.reset(OpPPC64SRD)
14036 v0 := b.NewValue0(v.Pos, OpPPC64MOVBZreg, typ.Int64)
14041 // match: (Rsh8Ux8 <t> x y)
14042 // result: (ISEL [2] (SRD <t> (MOVBZreg x) y) (MOVDconst [0]) (Select1 <types.TypeFlags> (ANDCCconst [0x00F8] y)))
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)
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)
14060 v.AddArg3(v0, v2, v3)
14064 func rewriteValuePPC64_OpRsh8x16(v *Value) bool {
14068 typ := &b.Func.Config.Types
14069 // match: (Rsh8x16 x y)
14070 // cond: shiftIsBounded(v)
14071 // result: (SRAD (MOVBreg x) y)
14075 if !(shiftIsBounded(v)) {
14078 v.reset(OpPPC64SRAD)
14079 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
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)))
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)
14096 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14097 v2.AuxInt = int64ToAuxInt(7)
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)
14104 v.AddArg3(v0, v2, v3)
14108 func rewriteValuePPC64_OpRsh8x32(v *Value) bool {
14112 typ := &b.Func.Config.Types
14113 // match: (Rsh8x32 x y)
14114 // cond: shiftIsBounded(v)
14115 // result: (SRAD (MOVBreg x) y)
14119 if !(shiftIsBounded(v)) {
14122 v.reset(OpPPC64SRAD)
14123 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14128 // match: (Rsh8x32 <t> x y)
14129 // result: (ISEL [0] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (CMPWUconst y [8]))
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)
14140 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14141 v2.AuxInt = int64ToAuxInt(7)
14143 v3 := b.NewValue0(v.Pos, OpPPC64CMPWUconst, types.TypeFlags)
14144 v3.AuxInt = int32ToAuxInt(8)
14146 v.AddArg3(v0, v2, v3)
14150 func rewriteValuePPC64_OpRsh8x64(v *Value) bool {
14154 typ := &b.Func.Config.Types
14155 // match: (Rsh8x64 x (MOVDconst [c]))
14156 // cond: uint64(c) >= 8
14157 // result: (SRAWconst (SignExt8to32 x) [63])
14160 if v_1.Op != OpPPC64MOVDconst {
14163 c := auxIntToInt64(v_1.AuxInt)
14164 if !(uint64(c) >= 8) {
14167 v.reset(OpPPC64SRAWconst)
14168 v.AuxInt = int64ToAuxInt(63)
14169 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
14174 // match: (Rsh8x64 x (MOVDconst [c]))
14175 // cond: uint64(c) < 8
14176 // result: (SRAWconst (SignExt8to32 x) [c])
14179 if v_1.Op != OpPPC64MOVDconst {
14182 c := auxIntToInt64(v_1.AuxInt)
14183 if !(uint64(c) < 8) {
14186 v.reset(OpPPC64SRAWconst)
14187 v.AuxInt = int64ToAuxInt(c)
14188 v0 := b.NewValue0(v.Pos, OpSignExt8to32, typ.Int32)
14193 // match: (Rsh8x64 x y)
14194 // cond: shiftIsBounded(v)
14195 // result: (SRAD (MOVBreg x) y)
14199 if !(shiftIsBounded(v)) {
14202 v.reset(OpPPC64SRAD)
14203 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
14208 // match: (Rsh8x64 <t> x y)
14209 // result: (ISEL [0] (SRAD <t> (MOVBreg x) y) (SRADconst <t> (MOVBreg x) [7]) (CMPUconst y [8]))
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)
14220 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14221 v2.AuxInt = int64ToAuxInt(7)
14223 v3 := b.NewValue0(v.Pos, OpPPC64CMPUconst, types.TypeFlags)
14224 v3.AuxInt = int64ToAuxInt(8)
14226 v.AddArg3(v0, v2, v3)
14230 func rewriteValuePPC64_OpRsh8x8(v *Value) bool {
14234 typ := &b.Func.Config.Types
14235 // match: (Rsh8x8 x y)
14236 // cond: shiftIsBounded(v)
14237 // result: (SRAD (MOVBreg x) y)
14241 if !(shiftIsBounded(v)) {
14244 v.reset(OpPPC64SRAD)
14245 v0 := b.NewValue0(v.Pos, OpPPC64MOVBreg, typ.Int64)
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)))
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)
14262 v2 := b.NewValue0(v.Pos, OpPPC64SRADconst, t)
14263 v2.AuxInt = int64ToAuxInt(7)
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)
14270 v.AddArg3(v0, v2, v3)
14274 func rewriteValuePPC64_OpSelect0(v *Value) bool {
14277 typ := &b.Func.Config.Types
14278 // match: (Select0 (Mul64uhilo x y))
14279 // result: (MULHDU x y)
14281 if v_0.Op != OpMul64uhilo {
14286 v.reset(OpPPC64MULHDU)
14290 // match: (Select0 (Add64carry x y c))
14291 // result: (Select0 <typ.UInt64> (ADDE x y (Select1 <typ.UInt64> (ADDCconst c [-1]))))
14293 if v_0.Op != OpAdd64carry {
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)
14307 v0.AddArg3(x, y, v1)
14311 // match: (Select0 (Sub64borrow x y c))
14312 // result: (Select0 <typ.UInt64> (SUBE x y (Select1 <typ.UInt64> (SUBCconst c [0]))))
14314 if v_0.Op != OpSub64borrow {
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)
14328 v0.AddArg3(x, y, v1)
14332 // match: (Select0 (ANDCCconst [m] (ROTLWconst [r] x)))
14333 // cond: isPPC64WordRotateMask(m)
14334 // result: (RLWINM [encodePPC64RotateMask(r,m,32)] x)
14336 if v_0.Op != OpPPC64ANDCCconst {
14339 m := auxIntToInt64(v_0.AuxInt)
14340 v_0_0 := v_0.Args[0]
14341 if v_0_0.Op != OpPPC64ROTLWconst {
14344 r := auxIntToInt64(v_0_0.AuxInt)
14346 if !(isPPC64WordRotateMask(m)) {
14349 v.reset(OpPPC64RLWINM)
14350 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(r, m, 32))
14354 // match: (Select0 (ANDCCconst [m] (ROTLW x r)))
14355 // cond: isPPC64WordRotateMask(m)
14356 // result: (RLWNM [encodePPC64RotateMask(0,m,32)] x r)
14358 if v_0.Op != OpPPC64ANDCCconst {
14361 m := auxIntToInt64(v_0.AuxInt)
14362 v_0_0 := v_0.Args[0]
14363 if v_0_0.Op != OpPPC64ROTLW {
14368 if !(isPPC64WordRotateMask(m)) {
14371 v.reset(OpPPC64RLWNM)
14372 v.AuxInt = int64ToAuxInt(encodePPC64RotateMask(0, m, 32))
14376 // match: (Select0 (ANDCCconst [m] (SRWconst x [s])))
14377 // cond: mergePPC64RShiftMask(m,s,32) == 0
14378 // result: (MOVDconst [0])
14380 if v_0.Op != OpPPC64ANDCCconst {
14383 m := auxIntToInt64(v_0.AuxInt)
14384 v_0_0 := v_0.Args[0]
14385 if v_0_0.Op != OpPPC64SRWconst {
14388 s := auxIntToInt64(v_0_0.AuxInt)
14389 if !(mergePPC64RShiftMask(m, s, 32) == 0) {
14392 v.reset(OpPPC64MOVDconst)
14393 v.AuxInt = int64ToAuxInt(0)
14396 // match: (Select0 (ANDCCconst [m] (SRWconst x [s])))
14397 // cond: mergePPC64AndSrwi(m,s) != 0
14398 // result: (RLWINM [mergePPC64AndSrwi(m,s)] x)
14400 if v_0.Op != OpPPC64ANDCCconst {
14403 m := auxIntToInt64(v_0.AuxInt)
14404 v_0_0 := v_0.Args[0]
14405 if v_0_0.Op != OpPPC64SRWconst {
14408 s := auxIntToInt64(v_0_0.AuxInt)
14410 if !(mergePPC64AndSrwi(m, s) != 0) {
14413 v.reset(OpPPC64RLWINM)
14414 v.AuxInt = int64ToAuxInt(mergePPC64AndSrwi(m, s))
14418 // match: (Select0 (ANDCCconst [-1] x))
14421 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != -1 {
14428 // match: (Select0 (ANDCCconst [0] _))
14429 // result: (MOVDconst [0])
14431 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0 {
14434 v.reset(OpPPC64MOVDconst)
14435 v.AuxInt = int64ToAuxInt(0)
14438 // match: (Select0 (ANDCCconst [c] y:(MOVBZreg _)))
14439 // cond: c&0xFF == 0xFF
14442 if v_0.Op != OpPPC64ANDCCconst {
14445 c := auxIntToInt64(v_0.AuxInt)
14447 if y.Op != OpPPC64MOVBZreg || !(c&0xFF == 0xFF) {
14453 // match: (Select0 (ANDCCconst [0xFF] (MOVBreg x)))
14454 // result: (MOVBZreg x)
14456 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0xFF {
14459 v_0_0 := v_0.Args[0]
14460 if v_0_0.Op != OpPPC64MOVBreg {
14464 v.reset(OpPPC64MOVBZreg)
14468 // match: (Select0 (ANDCCconst [c] y:(MOVHZreg _)))
14469 // cond: c&0xFFFF == 0xFFFF
14472 if v_0.Op != OpPPC64ANDCCconst {
14475 c := auxIntToInt64(v_0.AuxInt)
14477 if y.Op != OpPPC64MOVHZreg || !(c&0xFFFF == 0xFFFF) {
14483 // match: (Select0 (ANDCCconst [0xFFFF] (MOVHreg x)))
14484 // result: (MOVHZreg x)
14486 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0xFFFF {
14489 v_0_0 := v_0.Args[0]
14490 if v_0_0.Op != OpPPC64MOVHreg {
14494 v.reset(OpPPC64MOVHZreg)
14498 // match: (Select0 (ANDCCconst [c] (MOVBZreg x)))
14499 // result: (Select0 (ANDCCconst [c&0xFF] x))
14501 if v_0.Op != OpPPC64ANDCCconst {
14504 c := auxIntToInt64(v_0.AuxInt)
14505 v_0_0 := v_0.Args[0]
14506 if v_0_0.Op != OpPPC64MOVBZreg {
14511 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14512 v0.AuxInt = int64ToAuxInt(c & 0xFF)
14517 // match: (Select0 (ANDCCconst [c] (MOVHZreg x)))
14518 // result: (Select0 (ANDCCconst [c&0xFFFF] x))
14520 if v_0.Op != OpPPC64ANDCCconst {
14523 c := auxIntToInt64(v_0.AuxInt)
14524 v_0_0 := v_0.Args[0]
14525 if v_0_0.Op != OpPPC64MOVHZreg {
14530 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14531 v0.AuxInt = int64ToAuxInt(c & 0xFFFF)
14536 // match: (Select0 (ANDCCconst [c] (MOVWZreg x)))
14537 // result: (Select0 (ANDCCconst [c&0xFFFFFFFF] x))
14539 if v_0.Op != OpPPC64ANDCCconst {
14542 c := auxIntToInt64(v_0.AuxInt)
14543 v_0_0 := v_0.Args[0]
14544 if v_0_0.Op != OpPPC64MOVWZreg {
14549 v0 := b.NewValue0(v.Pos, OpPPC64ANDCCconst, types.NewTuple(typ.Int, types.TypeFlags))
14550 v0.AuxInt = int64ToAuxInt(c & 0xFFFFFFFF)
14555 // match: (Select0 (ANDCCconst [1] z:(SRADconst [63] x)))
14556 // cond: z.Uses == 1
14557 // result: (SRDconst [63] x)
14559 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 1 {
14563 if z.Op != OpPPC64SRADconst || auxIntToInt64(z.AuxInt) != 63 {
14567 if !(z.Uses == 1) {
14570 v.reset(OpPPC64SRDconst)
14571 v.AuxInt = int64ToAuxInt(63)
14577 func rewriteValuePPC64_OpSelect1(v *Value) bool {
14580 typ := &b.Func.Config.Types
14581 // match: (Select1 (Mul64uhilo x y))
14582 // result: (MULLD x y)
14584 if v_0.Op != OpMul64uhilo {
14589 v.reset(OpPPC64MULLD)
14593 // match: (Select1 (Add64carry x y c))
14594 // result: (ADDZEzero (Select1 <typ.UInt64> (ADDE x y (Select1 <typ.UInt64> (ADDCconst c [-1])))))
14596 if v_0.Op != OpAdd64carry {
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)
14610 v1.AddArg3(x, y, v2)
14615 // match: (Select1 (ADDCconst n:(ADDZEzero x) [-1]))
14616 // cond: n.Uses <= 2
14619 if v_0.Op != OpPPC64ADDCconst || auxIntToInt64(v_0.AuxInt) != -1 {
14623 if n.Op != OpPPC64ADDZEzero {
14627 if !(n.Uses <= 2) {
14633 // match: (Select1 (Sub64borrow x y c))
14634 // result: (NEG (SUBZEzero (Select1 <typ.UInt64> (SUBE x y (Select1 <typ.UInt64> (SUBCconst c [0]))))))
14636 if v_0.Op != OpSub64borrow {
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)
14651 v2.AddArg3(x, y, v3)
14657 // match: (Select1 (SUBCconst n:(NEG (SUBZEzero x)) [0]))
14658 // cond: n.Uses <= 2
14661 if v_0.Op != OpPPC64SUBCconst || auxIntToInt64(v_0.AuxInt) != 0 {
14665 if n.Op != OpPPC64NEG {
14669 if n_0.Op != OpPPC64SUBZEzero {
14673 if !(n.Uses <= 2) {
14679 // match: (Select1 (ANDCCconst [0] _))
14680 // result: (FlagEQ)
14682 if v_0.Op != OpPPC64ANDCCconst || auxIntToInt64(v_0.AuxInt) != 0 {
14685 v.reset(OpPPC64FlagEQ)
14690 func rewriteValuePPC64_OpSelectN(v *Value) bool {
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)
14698 if auxIntToInt64(v.AuxInt) != 0 {
14702 if call.Op != OpPPC64CALLstatic || len(call.Args) != 1 {
14705 sym := auxToCall(call.Aux)
14707 if s1.Op != OpPPC64MOVDstore {
14712 if s1_1.Op != OpPPC64MOVDconst {
14715 sz := auxIntToInt64(s1_1.AuxInt)
14717 if s2.Op != OpPPC64MOVDstore {
14723 if s3.Op != OpPPC64MOVDstore {
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)) {
14732 v.AuxInt = int64ToAuxInt(sz)
14733 v.AddArg3(dst, src, mem)
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)
14740 if auxIntToInt64(v.AuxInt) != 0 {
14744 if call.Op != OpPPC64CALLstatic || len(call.Args) != 4 {
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 {
14755 sz := auxIntToInt64(call_2.AuxInt)
14756 if !(sz >= 0 && isSameCall(sym, "runtime.memmove") && call.Uses == 1 && isInlinableMemmove(dst, src, sz, config) && clobber(call)) {
14760 v.AuxInt = int64ToAuxInt(sz)
14761 v.AddArg3(dst, src, mem)
14766 func rewriteValuePPC64_OpSlicemask(v *Value) bool {
14769 // match: (Slicemask <t> x)
14770 // result: (SRADconst (NEG <t> x) [63])
14774 v.reset(OpPPC64SRADconst)
14775 v.AuxInt = int64ToAuxInt(63)
14776 v0 := b.NewValue0(v.Pos, OpPPC64NEG, t)
14782 func rewriteValuePPC64_OpStore(v *Value) bool {
14786 // match: (Store {t} ptr val mem)
14787 // cond: t.Size() == 8 && t.IsFloat()
14788 // result: (FMOVDstore ptr val mem)
14790 t := auxToType(v.Aux)
14794 if !(t.Size() == 8 && t.IsFloat()) {
14797 v.reset(OpPPC64FMOVDstore)
14798 v.AddArg3(ptr, val, mem)
14801 // match: (Store {t} ptr val mem)
14802 // cond: t.Size() == 4 && t.IsFloat()
14803 // result: (FMOVSstore ptr val mem)
14805 t := auxToType(v.Aux)
14809 if !(t.Size() == 4 && t.IsFloat()) {
14812 v.reset(OpPPC64FMOVSstore)
14813 v.AddArg3(ptr, val, mem)
14816 // match: (Store {t} ptr val mem)
14817 // cond: t.Size() == 8 && !t.IsFloat()
14818 // result: (MOVDstore ptr val mem)
14820 t := auxToType(v.Aux)
14824 if !(t.Size() == 8 && !t.IsFloat()) {
14827 v.reset(OpPPC64MOVDstore)
14828 v.AddArg3(ptr, val, mem)
14831 // match: (Store {t} ptr val mem)
14832 // cond: t.Size() == 4 && !t.IsFloat()
14833 // result: (MOVWstore ptr val mem)
14835 t := auxToType(v.Aux)
14839 if !(t.Size() == 4 && !t.IsFloat()) {
14842 v.reset(OpPPC64MOVWstore)
14843 v.AddArg3(ptr, val, mem)
14846 // match: (Store {t} ptr val mem)
14847 // cond: t.Size() == 2
14848 // result: (MOVHstore ptr val mem)
14850 t := auxToType(v.Aux)
14854 if !(t.Size() == 2) {
14857 v.reset(OpPPC64MOVHstore)
14858 v.AddArg3(ptr, val, mem)
14861 // match: (Store {t} ptr val mem)
14862 // cond: t.Size() == 1
14863 // result: (MOVBstore ptr val mem)
14865 t := auxToType(v.Aux)
14869 if !(t.Size() == 1) {
14872 v.reset(OpPPC64MOVBstore)
14873 v.AddArg3(ptr, val, mem)
14878 func rewriteValuePPC64_OpTrunc16to8(v *Value) bool {
14880 // match: (Trunc16to8 <t> x)
14881 // cond: t.IsSigned()
14882 // result: (MOVBreg x)
14886 if !(t.IsSigned()) {
14889 v.reset(OpPPC64MOVBreg)
14893 // match: (Trunc16to8 x)
14894 // result: (MOVBZreg x)
14897 v.reset(OpPPC64MOVBZreg)
14902 func rewriteValuePPC64_OpTrunc32to16(v *Value) bool {
14904 // match: (Trunc32to16 <t> x)
14905 // cond: t.IsSigned()
14906 // result: (MOVHreg x)
14910 if !(t.IsSigned()) {
14913 v.reset(OpPPC64MOVHreg)
14917 // match: (Trunc32to16 x)
14918 // result: (MOVHZreg x)
14921 v.reset(OpPPC64MOVHZreg)
14926 func rewriteValuePPC64_OpTrunc32to8(v *Value) bool {
14928 // match: (Trunc32to8 <t> x)
14929 // cond: t.IsSigned()
14930 // result: (MOVBreg x)
14934 if !(t.IsSigned()) {
14937 v.reset(OpPPC64MOVBreg)
14941 // match: (Trunc32to8 x)
14942 // result: (MOVBZreg x)
14945 v.reset(OpPPC64MOVBZreg)
14950 func rewriteValuePPC64_OpTrunc64to16(v *Value) bool {
14952 // match: (Trunc64to16 <t> x)
14953 // cond: t.IsSigned()
14954 // result: (MOVHreg x)
14958 if !(t.IsSigned()) {
14961 v.reset(OpPPC64MOVHreg)
14965 // match: (Trunc64to16 x)
14966 // result: (MOVHZreg x)
14969 v.reset(OpPPC64MOVHZreg)
14974 func rewriteValuePPC64_OpTrunc64to32(v *Value) bool {
14976 // match: (Trunc64to32 <t> x)
14977 // cond: t.IsSigned()
14978 // result: (MOVWreg x)
14982 if !(t.IsSigned()) {
14985 v.reset(OpPPC64MOVWreg)
14989 // match: (Trunc64to32 x)
14990 // result: (MOVWZreg x)
14993 v.reset(OpPPC64MOVWZreg)
14998 func rewriteValuePPC64_OpTrunc64to8(v *Value) bool {
15000 // match: (Trunc64to8 <t> x)
15001 // cond: t.IsSigned()
15002 // result: (MOVBreg x)
15006 if !(t.IsSigned()) {
15009 v.reset(OpPPC64MOVBreg)
15013 // match: (Trunc64to8 x)
15014 // result: (MOVBZreg x)
15017 v.reset(OpPPC64MOVBZreg)
15022 func rewriteValuePPC64_OpZero(v *Value) bool {
15026 // match: (Zero [0] _ mem)
15029 if auxIntToInt64(v.AuxInt) != 0 {
15036 // match: (Zero [1] destptr mem)
15037 // result: (MOVBstorezero destptr mem)
15039 if auxIntToInt64(v.AuxInt) != 1 {
15044 v.reset(OpPPC64MOVBstorezero)
15045 v.AddArg2(destptr, mem)
15048 // match: (Zero [2] destptr mem)
15049 // result: (MOVHstorezero destptr mem)
15051 if auxIntToInt64(v.AuxInt) != 2 {
15056 v.reset(OpPPC64MOVHstorezero)
15057 v.AddArg2(destptr, mem)
15060 // match: (Zero [3] destptr mem)
15061 // result: (MOVBstorezero [2] destptr (MOVHstorezero destptr mem))
15063 if auxIntToInt64(v.AuxInt) != 3 {
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)
15075 // match: (Zero [4] destptr mem)
15076 // result: (MOVWstorezero destptr mem)
15078 if auxIntToInt64(v.AuxInt) != 4 {
15083 v.reset(OpPPC64MOVWstorezero)
15084 v.AddArg2(destptr, mem)
15087 // match: (Zero [5] destptr mem)
15088 // result: (MOVBstorezero [4] destptr (MOVWstorezero destptr mem))
15090 if auxIntToInt64(v.AuxInt) != 5 {
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)
15102 // match: (Zero [6] destptr mem)
15103 // result: (MOVHstorezero [4] destptr (MOVWstorezero destptr mem))
15105 if auxIntToInt64(v.AuxInt) != 6 {
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)
15117 // match: (Zero [7] destptr mem)
15118 // result: (MOVBstorezero [6] destptr (MOVHstorezero [4] destptr (MOVWstorezero destptr mem)))
15120 if auxIntToInt64(v.AuxInt) != 7 {
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)
15135 // match: (Zero [8] {t} destptr mem)
15136 // result: (MOVDstorezero destptr mem)
15138 if auxIntToInt64(v.AuxInt) != 8 {
15143 v.reset(OpPPC64MOVDstorezero)
15144 v.AddArg2(destptr, mem)
15147 // match: (Zero [12] {t} destptr mem)
15148 // result: (MOVWstorezero [8] destptr (MOVDstorezero [0] destptr mem))
15150 if auxIntToInt64(v.AuxInt) != 12 {
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)
15163 // match: (Zero [16] {t} destptr mem)
15164 // result: (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem))
15166 if auxIntToInt64(v.AuxInt) != 16 {
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)
15179 // match: (Zero [24] {t} destptr mem)
15180 // result: (MOVDstorezero [16] destptr (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem)))
15182 if auxIntToInt64(v.AuxInt) != 24 {
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)
15198 // match: (Zero [32] {t} destptr mem)
15199 // result: (MOVDstorezero [24] destptr (MOVDstorezero [16] destptr (MOVDstorezero [8] destptr (MOVDstorezero [0] destptr mem))))
15201 if auxIntToInt64(v.AuxInt) != 32 {
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)
15220 // match: (Zero [s] ptr mem)
15221 // cond: buildcfg.GOPPC64 <= 8 && s < 64
15222 // result: (LoweredZeroShort [s] ptr mem)
15224 s := auxIntToInt64(v.AuxInt)
15227 if !(buildcfg.GOPPC64 <= 8 && s < 64) {
15230 v.reset(OpPPC64LoweredZeroShort)
15231 v.AuxInt = int64ToAuxInt(s)
15232 v.AddArg2(ptr, mem)
15235 // match: (Zero [s] ptr mem)
15236 // cond: buildcfg.GOPPC64 <= 8
15237 // result: (LoweredZero [s] ptr mem)
15239 s := auxIntToInt64(v.AuxInt)
15242 if !(buildcfg.GOPPC64 <= 8) {
15245 v.reset(OpPPC64LoweredZero)
15246 v.AuxInt = int64ToAuxInt(s)
15247 v.AddArg2(ptr, mem)
15250 // match: (Zero [s] ptr mem)
15251 // cond: s < 128 && buildcfg.GOPPC64 >= 9
15252 // result: (LoweredQuadZeroShort [s] ptr mem)
15254 s := auxIntToInt64(v.AuxInt)
15257 if !(s < 128 && buildcfg.GOPPC64 >= 9) {
15260 v.reset(OpPPC64LoweredQuadZeroShort)
15261 v.AuxInt = int64ToAuxInt(s)
15262 v.AddArg2(ptr, mem)
15265 // match: (Zero [s] ptr mem)
15266 // cond: buildcfg.GOPPC64 >= 9
15267 // result: (LoweredQuadZero [s] ptr mem)
15269 s := auxIntToInt64(v.AuxInt)
15272 if !(buildcfg.GOPPC64 >= 9) {
15275 v.reset(OpPPC64LoweredQuadZero)
15276 v.AuxInt = int64ToAuxInt(s)
15277 v.AddArg2(ptr, mem)
15282 func rewriteBlockPPC64(b *Block) bool {
15283 typ := &b.Func.Config.Types
15286 // match: (EQ (FlagEQ) yes no)
15287 // result: (First yes no)
15288 for b.Controls[0].Op == OpPPC64FlagEQ {
15289 b.Reset(BlockFirst)
15292 // match: (EQ (FlagLT) yes no)
15293 // result: (First no yes)
15294 for b.Controls[0].Op == OpPPC64FlagLT {
15295 b.Reset(BlockFirst)
15299 // match: (EQ (FlagGT) yes no)
15300 // result: (First no yes)
15301 for b.Controls[0].Op == OpPPC64FlagGT {
15302 b.Reset(BlockFirst)
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]
15311 b.resetWithControl(BlockPPC64EQ, cmp)
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 {
15321 v_0_0 := v_0.Args[0]
15322 if v_0_0.Op != OpSelect0 {
15326 if z.Op != OpPPC64ANDCCconst {
15329 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15331 b.resetWithControl(BlockPPC64EQ, v0)
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 {
15341 v_0_0 := v_0.Args[0]
15342 if v_0_0.Op != OpSelect0 {
15346 if z.Op != OpPPC64ANDCCconst {
15349 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15351 b.resetWithControl(BlockPPC64EQ, v0)
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 {
15363 if z.Op != OpPPC64AND {
15369 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15372 if !(z.Uses == 1) {
15375 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15376 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15379 b.resetWithControl(BlockPPC64EQ, v0)
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 {
15393 if z.Op != OpPPC64OR {
15399 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15402 if !(z.Uses == 1) {
15405 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15406 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15409 b.resetWithControl(BlockPPC64EQ, v0)
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 {
15423 if z.Op != OpPPC64XOR {
15429 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15432 if !(z.Uses == 1) {
15435 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15436 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15439 b.resetWithControl(BlockPPC64EQ, v0)
15445 // match: (GE (FlagEQ) yes no)
15446 // result: (First yes no)
15447 for b.Controls[0].Op == OpPPC64FlagEQ {
15448 b.Reset(BlockFirst)
15451 // match: (GE (FlagLT) yes no)
15452 // result: (First no yes)
15453 for b.Controls[0].Op == OpPPC64FlagLT {
15454 b.Reset(BlockFirst)
15458 // match: (GE (FlagGT) yes no)
15459 // result: (First yes no)
15460 for b.Controls[0].Op == OpPPC64FlagGT {
15461 b.Reset(BlockFirst)
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]
15469 b.resetWithControl(BlockPPC64LE, cmp)
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 {
15479 v_0_0 := v_0.Args[0]
15480 if v_0_0.Op != OpSelect0 {
15484 if z.Op != OpPPC64ANDCCconst {
15487 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15489 b.resetWithControl(BlockPPC64GE, v0)
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 {
15499 v_0_0 := v_0.Args[0]
15500 if v_0_0.Op != OpSelect0 {
15504 if z.Op != OpPPC64ANDCCconst {
15507 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15509 b.resetWithControl(BlockPPC64GE, v0)
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 {
15521 if z.Op != OpPPC64AND {
15527 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15530 if !(z.Uses == 1) {
15533 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15534 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15537 b.resetWithControl(BlockPPC64GE, v0)
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 {
15551 if z.Op != OpPPC64OR {
15557 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15560 if !(z.Uses == 1) {
15563 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15564 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15567 b.resetWithControl(BlockPPC64GE, v0)
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 {
15581 if z.Op != OpPPC64XOR {
15587 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15590 if !(z.Uses == 1) {
15593 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15594 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15597 b.resetWithControl(BlockPPC64GE, v0)
15603 // match: (GT (FlagEQ) yes no)
15604 // result: (First no yes)
15605 for b.Controls[0].Op == OpPPC64FlagEQ {
15606 b.Reset(BlockFirst)
15610 // match: (GT (FlagLT) yes no)
15611 // result: (First no yes)
15612 for b.Controls[0].Op == OpPPC64FlagLT {
15613 b.Reset(BlockFirst)
15617 // match: (GT (FlagGT) yes no)
15618 // result: (First yes no)
15619 for b.Controls[0].Op == OpPPC64FlagGT {
15620 b.Reset(BlockFirst)
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]
15628 b.resetWithControl(BlockPPC64LT, cmp)
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 {
15638 v_0_0 := v_0.Args[0]
15639 if v_0_0.Op != OpSelect0 {
15643 if z.Op != OpPPC64ANDCCconst {
15646 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15648 b.resetWithControl(BlockPPC64GT, v0)
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 {
15658 v_0_0 := v_0.Args[0]
15659 if v_0_0.Op != OpSelect0 {
15663 if z.Op != OpPPC64ANDCCconst {
15666 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15668 b.resetWithControl(BlockPPC64GT, v0)
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 {
15680 if z.Op != OpPPC64AND {
15686 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15689 if !(z.Uses == 1) {
15692 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15693 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15696 b.resetWithControl(BlockPPC64GT, v0)
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 {
15710 if z.Op != OpPPC64OR {
15716 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15719 if !(z.Uses == 1) {
15722 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15723 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15726 b.resetWithControl(BlockPPC64GT, v0)
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 {
15740 if z.Op != OpPPC64XOR {
15746 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15749 if !(z.Uses == 1) {
15752 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15753 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
15756 b.resetWithControl(BlockPPC64GT, v0)
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]
15767 b.resetWithControl(BlockPPC64EQ, cc)
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]
15775 b.resetWithControl(BlockPPC64NE, cc)
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]
15783 b.resetWithControl(BlockPPC64LT, cc)
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]
15791 b.resetWithControl(BlockPPC64LE, cc)
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]
15799 b.resetWithControl(BlockPPC64GT, cc)
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]
15807 b.resetWithControl(BlockPPC64GE, cc)
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]
15815 b.resetWithControl(BlockPPC64FLT, cc)
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]
15823 b.resetWithControl(BlockPPC64FLE, cc)
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]
15831 b.resetWithControl(BlockPPC64FGT, cc)
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]
15839 b.resetWithControl(BlockPPC64FGE, cc)
15842 // match: (If cond yes no)
15843 // result: (NE (CMPWconst [0] (Select0 <typ.UInt32> (ANDCCconst [1] cond))) yes no)
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)
15854 b.resetWithControl(BlockPPC64NE, v0)
15858 // match: (LE (FlagEQ) yes no)
15859 // result: (First yes no)
15860 for b.Controls[0].Op == OpPPC64FlagEQ {
15861 b.Reset(BlockFirst)
15864 // match: (LE (FlagLT) yes no)
15865 // result: (First yes no)
15866 for b.Controls[0].Op == OpPPC64FlagLT {
15867 b.Reset(BlockFirst)
15870 // match: (LE (FlagGT) yes no)
15871 // result: (First no yes)
15872 for b.Controls[0].Op == OpPPC64FlagGT {
15873 b.Reset(BlockFirst)
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]
15882 b.resetWithControl(BlockPPC64GE, cmp)
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 {
15892 v_0_0 := v_0.Args[0]
15893 if v_0_0.Op != OpSelect0 {
15897 if z.Op != OpPPC64ANDCCconst {
15900 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15902 b.resetWithControl(BlockPPC64LE, v0)
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 {
15912 v_0_0 := v_0.Args[0]
15913 if v_0_0.Op != OpSelect0 {
15917 if z.Op != OpPPC64ANDCCconst {
15920 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15922 b.resetWithControl(BlockPPC64LE, v0)
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 {
15934 if z.Op != OpPPC64AND {
15940 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15943 if !(z.Uses == 1) {
15946 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15947 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
15950 b.resetWithControl(BlockPPC64LE, v0)
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 {
15964 if z.Op != OpPPC64OR {
15970 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
15973 if !(z.Uses == 1) {
15976 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
15977 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
15980 b.resetWithControl(BlockPPC64LE, v0)
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 {
15994 if z.Op != OpPPC64XOR {
16000 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16003 if !(z.Uses == 1) {
16006 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16007 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
16010 b.resetWithControl(BlockPPC64LE, v0)
16016 // match: (LT (FlagEQ) yes no)
16017 // result: (First no yes)
16018 for b.Controls[0].Op == OpPPC64FlagEQ {
16019 b.Reset(BlockFirst)
16023 // match: (LT (FlagLT) yes no)
16024 // result: (First yes no)
16025 for b.Controls[0].Op == OpPPC64FlagLT {
16026 b.Reset(BlockFirst)
16029 // match: (LT (FlagGT) yes no)
16030 // result: (First no yes)
16031 for b.Controls[0].Op == OpPPC64FlagGT {
16032 b.Reset(BlockFirst)
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]
16041 b.resetWithControl(BlockPPC64GT, cmp)
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 {
16051 v_0_0 := v_0.Args[0]
16052 if v_0_0.Op != OpSelect0 {
16056 if z.Op != OpPPC64ANDCCconst {
16059 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16061 b.resetWithControl(BlockPPC64LT, v0)
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 {
16071 v_0_0 := v_0.Args[0]
16072 if v_0_0.Op != OpSelect0 {
16076 if z.Op != OpPPC64ANDCCconst {
16079 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16081 b.resetWithControl(BlockPPC64LT, v0)
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 {
16093 if z.Op != OpPPC64AND {
16099 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16102 if !(z.Uses == 1) {
16105 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16106 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
16109 b.resetWithControl(BlockPPC64LT, v0)
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 {
16123 if z.Op != OpPPC64OR {
16129 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16132 if !(z.Uses == 1) {
16135 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16136 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
16139 b.resetWithControl(BlockPPC64LT, v0)
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 {
16153 if z.Op != OpPPC64XOR {
16159 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16162 if !(z.Uses == 1) {
16165 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16166 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
16169 b.resetWithControl(BlockPPC64LT, v0)
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 {
16182 v_0_0 := v_0.Args[0]
16183 if v_0_0.Op != OpSelect0 {
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 {
16190 v_0_0_0_0 := v_0_0_0.Args[0]
16191 if v_0_0_0_0.Op != OpPPC64Equal {
16194 cc := v_0_0_0_0.Args[0]
16195 b.resetWithControl(BlockPPC64EQ, cc)
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 {
16205 v_0_0 := v_0.Args[0]
16206 if v_0_0.Op != OpSelect0 {
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 {
16213 v_0_0_0_0 := v_0_0_0.Args[0]
16214 if v_0_0_0_0.Op != OpPPC64NotEqual {
16217 cc := v_0_0_0_0.Args[0]
16218 b.resetWithControl(BlockPPC64NE, cc)
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 {
16228 v_0_0 := v_0.Args[0]
16229 if v_0_0.Op != OpSelect0 {
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 {
16236 v_0_0_0_0 := v_0_0_0.Args[0]
16237 if v_0_0_0_0.Op != OpPPC64LessThan {
16240 cc := v_0_0_0_0.Args[0]
16241 b.resetWithControl(BlockPPC64LT, cc)
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 {
16251 v_0_0 := v_0.Args[0]
16252 if v_0_0.Op != OpSelect0 {
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 {
16259 v_0_0_0_0 := v_0_0_0.Args[0]
16260 if v_0_0_0_0.Op != OpPPC64LessEqual {
16263 cc := v_0_0_0_0.Args[0]
16264 b.resetWithControl(BlockPPC64LE, cc)
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 {
16274 v_0_0 := v_0.Args[0]
16275 if v_0_0.Op != OpSelect0 {
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 {
16282 v_0_0_0_0 := v_0_0_0.Args[0]
16283 if v_0_0_0_0.Op != OpPPC64GreaterThan {
16286 cc := v_0_0_0_0.Args[0]
16287 b.resetWithControl(BlockPPC64GT, cc)
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 {
16297 v_0_0 := v_0.Args[0]
16298 if v_0_0.Op != OpSelect0 {
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 {
16305 v_0_0_0_0 := v_0_0_0.Args[0]
16306 if v_0_0_0_0.Op != OpPPC64GreaterEqual {
16309 cc := v_0_0_0_0.Args[0]
16310 b.resetWithControl(BlockPPC64GE, cc)
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 {
16320 v_0_0 := v_0.Args[0]
16321 if v_0_0.Op != OpSelect0 {
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 {
16328 v_0_0_0_0 := v_0_0_0.Args[0]
16329 if v_0_0_0_0.Op != OpPPC64FLessThan {
16332 cc := v_0_0_0_0.Args[0]
16333 b.resetWithControl(BlockPPC64FLT, cc)
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 {
16343 v_0_0 := v_0.Args[0]
16344 if v_0_0.Op != OpSelect0 {
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 {
16351 v_0_0_0_0 := v_0_0_0.Args[0]
16352 if v_0_0_0_0.Op != OpPPC64FLessEqual {
16355 cc := v_0_0_0_0.Args[0]
16356 b.resetWithControl(BlockPPC64FLE, cc)
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 {
16366 v_0_0 := v_0.Args[0]
16367 if v_0_0.Op != OpSelect0 {
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 {
16374 v_0_0_0_0 := v_0_0_0.Args[0]
16375 if v_0_0_0_0.Op != OpPPC64FGreaterThan {
16378 cc := v_0_0_0_0.Args[0]
16379 b.resetWithControl(BlockPPC64FGT, cc)
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 {
16389 v_0_0 := v_0.Args[0]
16390 if v_0_0.Op != OpSelect0 {
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 {
16397 v_0_0_0_0 := v_0_0_0.Args[0]
16398 if v_0_0_0_0.Op != OpPPC64FGreaterEqual {
16401 cc := v_0_0_0_0.Args[0]
16402 b.resetWithControl(BlockPPC64FGE, cc)
16405 // match: (NE (FlagEQ) yes no)
16406 // result: (First no yes)
16407 for b.Controls[0].Op == OpPPC64FlagEQ {
16408 b.Reset(BlockFirst)
16412 // match: (NE (FlagLT) yes no)
16413 // result: (First yes no)
16414 for b.Controls[0].Op == OpPPC64FlagLT {
16415 b.Reset(BlockFirst)
16418 // match: (NE (FlagGT) yes no)
16419 // result: (First yes no)
16420 for b.Controls[0].Op == OpPPC64FlagGT {
16421 b.Reset(BlockFirst)
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]
16429 b.resetWithControl(BlockPPC64NE, cmp)
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 {
16439 v_0_0 := v_0.Args[0]
16440 if v_0_0.Op != OpSelect0 {
16444 if z.Op != OpPPC64ANDCCconst {
16447 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16449 b.resetWithControl(BlockPPC64NE, v0)
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 {
16459 v_0_0 := v_0.Args[0]
16460 if v_0_0.Op != OpSelect0 {
16464 if z.Op != OpPPC64ANDCCconst {
16467 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16469 b.resetWithControl(BlockPPC64NE, v0)
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 {
16481 if z.Op != OpPPC64AND {
16487 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16490 if !(z.Uses == 1) {
16493 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16494 v1 := b.NewValue0(v_0.Pos, OpPPC64ANDCC, types.NewTuple(typ.Int64, types.TypeFlags))
16497 b.resetWithControl(BlockPPC64NE, v0)
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 {
16511 if z.Op != OpPPC64OR {
16517 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16520 if !(z.Uses == 1) {
16523 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16524 v1 := b.NewValue0(v_0.Pos, OpPPC64ORCC, types.NewTuple(typ.Int, types.TypeFlags))
16527 b.resetWithControl(BlockPPC64NE, v0)
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 {
16541 if z.Op != OpPPC64XOR {
16547 for _i0 := 0; _i0 <= 1; _i0, z_0, z_1 = _i0+1, z_1, z_0 {
16550 if !(z.Uses == 1) {
16553 v0 := b.NewValue0(v_0.Pos, OpSelect1, types.TypeFlags)
16554 v1 := b.NewValue0(v_0.Pos, OpPPC64XORCC, types.NewTuple(typ.Int, types.TypeFlags))
16557 b.resetWithControl(BlockPPC64NE, v0)