File tree Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Expand file tree Collapse file tree 2 files changed +24
-2
lines changed Original file line number Diff line number Diff line change @@ -57,6 +57,20 @@ class RISCVInstructionSelector : public InstructionSelector {
5757 const TargetRegisterClass *
5858 getRegClassForTypeOnBank (LLT Ty, const RegisterBank &RB) const ;
5959
60+ static constexpr unsigned MaxRecursionDepth = 6 ;
61+
62+ bool hasAllNBitUsers (const MachineInstr &MI, unsigned Bits,
63+ const unsigned Depth = 0 ) const ;
64+ bool hasAllBUsers (const MachineInstr &MI) const {
65+ return hasAllNBitUsers (MI, 8 );
66+ }
67+ bool hasAllHUsers (const MachineInstr &MI) const {
68+ return hasAllNBitUsers (MI, 16 );
69+ }
70+ bool hasAllWUsers (const MachineInstr &MI) const {
71+ return hasAllNBitUsers (MI, 32 );
72+ }
73+
6074 bool isRegInGprb (Register Reg) const ;
6175 bool isRegInFprb (Register Reg) const ;
6276
@@ -184,6 +198,10 @@ RISCVInstructionSelector::RISCVInstructionSelector(
184198{
185199}
186200
201+ bool RISCVInstructionSelector::hasAllNBitUsers (const MachineInstr &MI, unsigned Bits, const unsigned Depth) const {
202+ return false ;
203+ };
204+
187205InstructionSelector::ComplexRendererFns
188206RISCVInstructionSelector::selectShiftMask (MachineOperand &Root,
189207 unsigned ShiftWidth) const {
Original file line number Diff line number Diff line change @@ -1949,15 +1949,19 @@ class binop_allhusers<SDPatternOperator operator>
19491949 : PatFrag<(ops node:$lhs, node:$rhs),
19501950 (XLenVT (operator node:$lhs, node:$rhs)), [{
19511951 return hasAllHUsers(Node);
1952- }]>;
1952+ }]> {
1953+ let GISelPredicateCode = [{ return hasAllHUsers(MI); }];
1954+ }
19531955
19541956// PatFrag to allow ADDW/SUBW/MULW/SLLW to be selected from i64 add/sub/mul/shl
19551957// if only the lower 32 bits of their result is used.
19561958class binop_allwusers<SDPatternOperator operator>
19571959 : PatFrag<(ops node:$lhs, node:$rhs),
19581960 (i64 (operator node:$lhs, node:$rhs)), [{
19591961 return hasAllWUsers(Node);
1960- }]>;
1962+ }]> {
1963+ let GISelPredicateCode = [{ return hasAllWUsers(MI); }];
1964+ }
19611965
19621966def sexti32_allwusers : PatFrag<(ops node:$src),
19631967 (sext_inreg node:$src, i32), [{
You can’t perform that action at this time.
0 commit comments