@@ -634,92 +634,92 @@ def : PatGpr<bswap, REV8_RV64, i64>;
634634
635635let Predicates = [HasStdExtZbkb] in {
636636def : Pat<(or (and (shl GPR:$rs2, (XLenVT 8)), 0xFFFF),
637- ( zexti8 (XLenVT GPR :$rs1)) ),
638- (PACKH GPR :$rs1, GPR:$rs2)>;
639- def : Pat<(or (shl ( zexti8 (XLenVT GPR :$rs2)) , (XLenVT 8)),
640- ( zexti8 (XLenVT GPR :$rs1)) ),
641- (PACKH GPR :$rs1, GPR :$rs2)>;
637+ zexti8:$rs1),
638+ (PACKH zexti8 :$rs1, GPR:$rs2)>;
639+ def : Pat<(or (shl zexti8:$rs2, (XLenVT 8)),
640+ zexti8:$rs1),
641+ (PACKH zexti8 :$rs1, zexti8 :$rs2)>;
642642def : Pat<(and (or (shl GPR:$rs2, (XLenVT 8)),
643- ( zexti8 (XLenVT GPR :$rs1)) ), 0xFFFF),
644- (PACKH GPR :$rs1, GPR:$rs2)>;
643+ zexti8:$rs1), 0xFFFF),
644+ (PACKH zexti8 :$rs1, GPR:$rs2)>;
645645
646646def : Pat<(binop_allhusers<or> (shl GPR:$rs2, (XLenVT 8)),
647- ( zexti8 (XLenVT GPR :$rs1)) ),
648- (PACKH GPR :$rs1, GPR:$rs2)>;
647+ zexti8:$rs1),
648+ (PACKH zexti8 :$rs1, GPR:$rs2)>;
649649} // Predicates = [HasStdExtZbkb]
650650
651651let Predicates = [HasStdExtZbkb, IsRV32] in {
652- def : Pat<(i32 (or ( zexti16 (i32 GPR :$rs1)) , (shl GPR:$rs2, (i32 16)))),
653- (PACK GPR :$rs1, GPR:$rs2)>;
652+ def : Pat<(i32 (or zexti16:$rs1, (shl GPR:$rs2, (i32 16)))),
653+ (PACK zexti16 :$rs1, GPR:$rs2)>;
654654
655- def : Pat<(or (shl GPR:$rs2, (XLenVT 24)),
656- (shl (zexti8 (XLenVT GPR :$rs1)) , (XLenVT 16))),
657- (SLLI (XLenVT (PACKH GPR :$rs1, GPR:$rs2)), (XLenVT 16))>;
655+ def : Pat<(i32 ( or (shl GPR:$rs2, (XLenVT 24)),
656+ (shl zexti8 :$rs1, (XLenVT 16) ))),
657+ (SLLI (XLenVT (PACKH zexti8 :$rs1, GPR:$rs2)), (XLenVT 16))>;
658658
659659// Match a pattern of 2 bytes being inserted into bits [31:16], with bits
660660// bits [15:0] coming from a zero extended value. We can use pack with packh for
661661// bits [31:16]. If bits [15:0] can also be a packh, it can be matched
662662// separately.
663- def : Pat<(or (or (shl GPR:$op1rs2, (XLenVT 24)),
664- (shl (zexti8 (XLenVT GPR :$op1rs1)) , (XLenVT 16))),
665- (zexti16 (XLenVT GPR :$rs1) )),
666- (PACK (XLenVT GPR :$rs1) ,
667- (XLenVT (PACKH GPR :$op1rs1, GPR:$op1rs2)))>;
663+ def : Pat<(i32 ( or (or (shl GPR:$op1rs2, (XLenVT 24)),
664+ (shl zexti8 :$op1rs1, (XLenVT 16))),
665+ zexti16 :$rs1)),
666+ (PACK zexti16 :$rs1,
667+ (XLenVT (PACKH zexti8 :$op1rs1, GPR:$op1rs2)))>;
668668}
669669
670670let Predicates = [HasStdExtZbkb, IsRV64] in {
671- def : Pat<(i64 (or ( zexti32 (i64 GPR :$rs1)) , (shl GPR:$rs2, (i64 32)))),
672- (PACK GPR :$rs1, GPR:$rs2)>;
671+ def : Pat<(i64 (or zexti32:$rs1, (shl GPR:$rs2, (i64 32)))),
672+ (PACK zexti32 :$rs1, GPR:$rs2)>;
673673
674- def : Pat<(or (shl ( zexti8 (XLenVT GPR :$rs2)) , (XLenVT 24)),
675- (shl (zexti8 (XLenVT GPR :$rs1)) , (XLenVT 16))),
676- (SLLI (XLenVT (PACKH GPR :$rs1, GPR :$rs2)), (XLenVT 16))>;
674+ def : Pat<(i64 ( or (shl zexti8:$rs2, (XLenVT 24)),
675+ (shl zexti8 :$rs1, (XLenVT 16) ))),
676+ (SLLI (XLenVT (PACKH zexti8 :$rs1, zexti8 :$rs2)), (XLenVT 16))>;
677677def : Pat<(binop_allwusers<or> (shl GPR:$rs2, (XLenVT 24)),
678- (shl ( zexti8 (XLenVT GPR :$rs1)) , (XLenVT 16))),
679- (SLLI (XLenVT (PACKH GPR :$rs1, GPR:$rs2)), (XLenVT 16))>;
678+ (shl zexti8:$rs1, (XLenVT 16))),
679+ (SLLI (XLenVT (PACKH zexti8 :$rs1, GPR:$rs2)), (XLenVT 16))>;
680680
681681def : Pat<(binop_allwusers<or> (shl GPR:$rs2, (i64 16)),
682- ( zexti16 (i64 GPR :$rs1)) ),
683- (PACKW GPR :$rs1, GPR:$rs2)>;
682+ zexti16:$rs1),
683+ (PACKW zexti16 :$rs1, GPR:$rs2)>;
684684def : Pat<(i64 (or (sext_inreg (shl GPR:$rs2, (i64 16)), i32),
685- ( zexti16 (i64 GPR :$rs1)) )),
686- (PACKW GPR :$rs1, GPR:$rs2)>;
685+ zexti16:$rs1)),
686+ (PACKW zexti16 :$rs1, GPR:$rs2)>;
687687
688688// Match a pattern of 2 bytes being inserted into bits [31:16], with bits
689689// bits [15:0] coming from a zero extended value, and bits [63:32] being
690690// ignored. We can use packw with packh for bits [31:16]. If bits [15:0] can
691691// also be a packh, it can be matched separately.
692692def : Pat<(binop_allwusers<or>
693693 (or (shl GPR:$op1rs2, (XLenVT 24)),
694- (shl ( zexti8 (XLenVT GPR :$op1rs1)) , (XLenVT 16))),
695- ( zexti16 (XLenVT GPR :$rs1)) ),
696- (PACKW GPR :$rs1, (XLenVT (PACKH GPR :$op1rs1, GPR:$op1rs2)))>;
694+ (shl zexti8:$op1rs1, (XLenVT 16))),
695+ zexti16:$rs1),
696+ (PACKW zexti16 :$rs1, (XLenVT (PACKH zexti8 :$op1rs1, GPR:$op1rs2)))>;
697697// We need to manually reassociate the patterns because of the binop_allwusers.
698698def : Pat<(binop_allwusers<or>
699- (or ( zexti16 (XLenVT GPR :$rs1)) ,
700- (shl ( zexti8 (XLenVT GPR :$op1rs1)) , (XLenVT 16))),
699+ (or zexti16:$rs1,
700+ (shl zexti8:$op1rs1, (XLenVT 16))),
701701 (shl GPR:$op1rs2, (XLenVT 24))),
702- (PACKW GPR :$rs1, (XLenVT (PACKH GPR :$op1rs1, GPR:$op1rs2)))>;
702+ (PACKW zexti16 :$rs1, (XLenVT (PACKH zexti8 :$op1rs1, GPR:$op1rs2)))>;
703703def : Pat<(binop_allwusers<or>
704- (or ( zexti16 (XLenVT GPR :$rs1)) ,
704+ (or zexti16:$rs1,
705705 (shl GPR:$op1rs2, (XLenVT 24))),
706- (shl ( zexti8 (XLenVT GPR :$op1rs1)) , (XLenVT 16))),
707- (PACKW GPR :$rs1, (XLenVT (PACKH GPR :$op1rs1, GPR:$op1rs2)))>;
706+ (shl zexti8:$op1rs1, (XLenVT 16))),
707+ (PACKW zexti16 :$rs1, (XLenVT (PACKH zexti8 :$op1rs1, GPR:$op1rs2)))>;
708708
709709def : Pat<(i64 (or (or (zexti16 (XLenVT GPR:$rs1)),
710- (shl ( zexti8 (XLenVT GPR :$op1rs1)) , (XLenVT 16))),
710+ (shl zexti8:$op1rs1, (XLenVT 16))),
711711 (sext_inreg (shl GPR:$op1rs2, (XLenVT 24)), i32))),
712- (PACKW GPR:$rs1, (XLenVT (PACKH GPR :$op1rs1, GPR:$op1rs2)))>;
712+ (PACKW GPR:$rs1, (XLenVT (PACKH zexti8 :$op1rs1, GPR:$op1rs2)))>;
713713
714714// Match a pattern of 2 halfwords being inserted into bits [63:32], with bits
715715// bits [31:0] coming from a zero extended value. We can use pack with packw for
716716// bits [63:32]. If bits [63:31] can also be a packw, it can be matched
717717// separately.
718718def : Pat<(or (or (shl GPR:$op1rs2, (i64 48)),
719- (shl ( zexti16 (i64 GPR :$op1rs1)) , (i64 32))),
720- ( zexti32 (i64 GPR :$rs1)) ),
721- (PACK (XLenVT GPR :$rs1) ,
722- (XLenVT (PACKW GPR :$op1rs1, GPR:$op1rs2)))>;
719+ (shl zexti16:$op1rs1, (i64 32))),
720+ zexti32:$rs1),
721+ (PACK zexti32 :$rs1,
722+ (XLenVT (PACKW zexti16 :$op1rs1, GPR:$op1rs2)))>;
723723} // Predicates = [HasStdExtZbkb, IsRV64]
724724
725725let Predicates = [HasStdExtZbb, IsRV32] in
0 commit comments