@@ -1659,17 +1659,20 @@ class LLVM_ABI TargetLoweringBase {
1659
1659
// / InputVT should be treated. Either it's legal, needs to be promoted to a
1660
1660
// / larger size, needs to be expanded to some other code sequence, or the
1661
1661
// / target has a custom expander for it.
1662
- LegalizeAction getPartialReduceMLAAction (EVT AccVT, EVT InputVT) const {
1663
- PartialReduceActionTypes TypePair = {AccVT.getSimpleVT ().SimpleTy ,
1664
- InputVT.getSimpleVT ().SimpleTy };
1665
- auto It = PartialReduceMLAActions.find (TypePair);
1662
+ LegalizeAction getPartialReduceMLAAction (unsigned Opc, EVT AccVT,
1663
+ EVT InputVT) const {
1664
+ assert (Opc == ISD::PARTIAL_REDUCE_SMLA || Opc == ISD::PARTIAL_REDUCE_UMLA);
1665
+ PartialReduceActionTypes Key = {Opc, AccVT.getSimpleVT ().SimpleTy ,
1666
+ InputVT.getSimpleVT ().SimpleTy };
1667
+ auto It = PartialReduceMLAActions.find (Key);
1666
1668
return It != PartialReduceMLAActions.end () ? It->second : Expand;
1667
1669
}
1668
1670
1669
1671
// / Return true if a PARTIAL_REDUCE_U/SMLA node with the specified types is
1670
1672
// / legal or custom for this target.
1671
- bool isPartialReduceMLALegalOrCustom (EVT AccVT, EVT InputVT) const {
1672
- LegalizeAction Action = getPartialReduceMLAAction (AccVT, InputVT);
1673
+ bool isPartialReduceMLALegalOrCustom (unsigned Opc, EVT AccVT,
1674
+ EVT InputVT) const {
1675
+ LegalizeAction Action = getPartialReduceMLAAction (Opc, AccVT, InputVT);
1673
1676
return Action == Legal || Action == Custom;
1674
1677
}
1675
1678
@@ -2754,12 +2757,18 @@ class LLVM_ABI TargetLoweringBase {
2754
2757
// / type InputVT should be treated by the target. Either it's legal, needs to
2755
2758
// / be promoted to a larger size, needs to be expanded to some other code
2756
2759
// / sequence, or the target has a custom expander for it.
2757
- void setPartialReduceMLAAction (MVT AccVT, MVT InputVT,
2760
+ void setPartialReduceMLAAction (unsigned Opc, MVT AccVT, MVT InputVT,
2758
2761
LegalizeAction Action) {
2762
+ assert (Opc == ISD::PARTIAL_REDUCE_SMLA || Opc == ISD::PARTIAL_REDUCE_UMLA);
2759
2763
assert (AccVT.isValid () && InputVT.isValid () &&
2760
2764
" setPartialReduceMLAAction types aren't valid" );
2761
- PartialReduceActionTypes TypePair = {AccVT.SimpleTy , InputVT.SimpleTy };
2762
- PartialReduceMLAActions[TypePair] = Action;
2765
+ PartialReduceActionTypes Key = {Opc, AccVT.SimpleTy , InputVT.SimpleTy };
2766
+ PartialReduceMLAActions[Key] = Action;
2767
+ }
2768
+ void setPartialReduceMLAAction (ArrayRef<unsigned > Opcodes, MVT AccVT,
2769
+ MVT InputVT, LegalizeAction Action) {
2770
+ for (unsigned Opc : Opcodes)
2771
+ setPartialReduceMLAAction (Opc, AccVT, InputVT, Action);
2763
2772
}
2764
2773
2765
2774
// / If Opc/OrigVT is specified as being promoted, the promotion code defaults
@@ -3751,10 +3760,10 @@ class LLVM_ABI TargetLoweringBase {
3751
3760
uint32_t CondCodeActions[ISD::SETCC_INVALID][(MVT::VALUETYPE_SIZE + 7 ) / 8 ];
3752
3761
3753
3762
using PartialReduceActionTypes =
3754
- std::pair< MVT::SimpleValueType, MVT::SimpleValueType>;
3755
- // / For each result type and input type for the ISD::PARTIAL_REDUCE_U/SMLA
3756
- // / nodes, keep a LegalizeAction which indicates how instruction selection
3757
- // / should deal with this operation.
3763
+ std::tuple< unsigned , MVT::SimpleValueType, MVT::SimpleValueType>;
3764
+ // / For each partial reduce opcode, result type and input type combination,
3765
+ // / keep a LegalizeAction which indicates how instruction selection should
3766
+ // / deal with this operation.
3758
3767
DenseMap<PartialReduceActionTypes, LegalizeAction> PartialReduceMLAActions;
3759
3768
3760
3769
ValueTypeActionImpl ValueTypeActions;
0 commit comments