@@ -1483,7 +1483,11 @@ class LLVM_ABI TargetLoweringBase {
14831483 unsigned Shift = 4 * ExtType;
14841484
14851485 if (!LoadExtActions.count (AddrSpace)) {
1486- return Legal; // default
1486+ if (MemVT == MVT::i2 || MemVT == MVT::i4 || MemVT == MVT::v128i2 ||
1487+ MemVT == MVT::v64i4)
1488+ return Expand;
1489+
1490+ return Legal;
14871491 }
14881492 return (
14891493 LegalizeAction)((LoadExtActions.at (AddrSpace)[ValI][MemI] >> Shift) &
@@ -2641,25 +2645,38 @@ class LLVM_ABI TargetLoweringBase {
26412645 // / Indicate that the specified load with extension does not work with the
26422646 // / specified type and indicate what to do about it.
26432647 void setLoadExtAction (unsigned ExtType, MVT ValVT, MVT MemVT,
2644- LegalizeAction Action, unsigned AddrSpace) {
2648+ LegalizeAction Action, unsigned AddrSpace = 0 ) {
26452649 assert (ExtType < ISD::LAST_LOADEXT_TYPE && ValVT.isValid () &&
26462650 MemVT.isValid () && " Table isn't big enough!" );
26472651 assert ((unsigned )Action < 0x10 && " too many bits for bitfield array" );
2652+
2653+ if (!LoadExtActions.count (AddrSpace)) {
2654+ LoadExtActions[AddrSpace]; // Initialize the map for the addrspace
2655+
2656+ for (MVT AVT : MVT::all_valuetypes ()) {
2657+ for (MVT VT : {MVT::i2, MVT::i4, MVT::v128i2, MVT::v64i4}) {
2658+ setLoadExtAction (ISD::EXTLOAD, AVT, VT, Expand, AddrSpace);
2659+ setLoadExtAction (ISD::ZEXTLOAD, AVT, VT, Expand, AddrSpace);
2660+ }
2661+ }
2662+ }
2663+
26482664 unsigned Shift = 4 * ExtType;
26492665 LoadExtActions[AddrSpace][ValVT.SimpleTy ][MemVT.SimpleTy ] &=
26502666 ~((uint16_t )0xF << Shift);
26512667 LoadExtActions[AddrSpace][ValVT.SimpleTy ][MemVT.SimpleTy ] |=
26522668 (uint16_t )Action << Shift;
26532669 }
26542670 void setLoadExtAction (ArrayRef<unsigned > ExtTypes, MVT ValVT, MVT MemVT,
2655- LegalizeAction Action) {
2671+ LegalizeAction Action, unsigned AddrSpace = 0 ) {
26562672 for (auto ExtType : ExtTypes)
2657- setLoadExtAction (ExtType, ValVT, MemVT, Action);
2673+ setLoadExtAction (ExtType, ValVT, MemVT, Action, AddrSpace );
26582674 }
26592675 void setLoadExtAction (ArrayRef<unsigned > ExtTypes, MVT ValVT,
2660- ArrayRef<MVT> MemVTs, LegalizeAction Action) {
2676+ ArrayRef<MVT> MemVTs, LegalizeAction Action,
2677+ unsigned AddrSpace = 0 ) {
26612678 for (auto MemVT : MemVTs)
2662- setLoadExtAction (ExtTypes, ValVT, MemVT, Action);
2679+ setLoadExtAction (ExtTypes, ValVT, MemVT, Action, AddrSpace );
26632680 }
26642681
26652682 // / Let target indicate that an extending atomic load of the specified type
@@ -3135,7 +3152,7 @@ class LLVM_ABI TargetLoweringBase {
31353152 LType = ISD::SEXTLOAD;
31363153 }
31373154
3138- return isLoadExtLegal (LType, VT, LoadVT);
3155+ return isLoadExtLegal (LType, VT, LoadVT, Load-> getPointerAddressSpace () );
31393156 }
31403157
31413158 // / Return true if any actual instruction that defines a value of type FromTy
0 commit comments