@@ -1483,7 +1483,11 @@ class LLVM_ABI TargetLoweringBase {
1483
1483
unsigned Shift = 4 * ExtType;
1484
1484
1485
1485
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;
1487
1491
}
1488
1492
return (
1489
1493
LegalizeAction)((LoadExtActions.at (AddrSpace)[ValI][MemI] >> Shift) &
@@ -2641,25 +2645,38 @@ class LLVM_ABI TargetLoweringBase {
2641
2645
// / Indicate that the specified load with extension does not work with the
2642
2646
// / specified type and indicate what to do about it.
2643
2647
void setLoadExtAction (unsigned ExtType, MVT ValVT, MVT MemVT,
2644
- LegalizeAction Action, unsigned AddrSpace) {
2648
+ LegalizeAction Action, unsigned AddrSpace = 0 ) {
2645
2649
assert (ExtType < ISD::LAST_LOADEXT_TYPE && ValVT.isValid () &&
2646
2650
MemVT.isValid () && " Table isn't big enough!" );
2647
2651
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
+
2648
2664
unsigned Shift = 4 * ExtType;
2649
2665
LoadExtActions[AddrSpace][ValVT.SimpleTy ][MemVT.SimpleTy ] &=
2650
2666
~((uint16_t )0xF << Shift);
2651
2667
LoadExtActions[AddrSpace][ValVT.SimpleTy ][MemVT.SimpleTy ] |=
2652
2668
(uint16_t )Action << Shift;
2653
2669
}
2654
2670
void setLoadExtAction (ArrayRef<unsigned > ExtTypes, MVT ValVT, MVT MemVT,
2655
- LegalizeAction Action) {
2671
+ LegalizeAction Action, unsigned AddrSpace = 0 ) {
2656
2672
for (auto ExtType : ExtTypes)
2657
- setLoadExtAction (ExtType, ValVT, MemVT, Action);
2673
+ setLoadExtAction (ExtType, ValVT, MemVT, Action, AddrSpace );
2658
2674
}
2659
2675
void setLoadExtAction (ArrayRef<unsigned > ExtTypes, MVT ValVT,
2660
- ArrayRef<MVT> MemVTs, LegalizeAction Action) {
2676
+ ArrayRef<MVT> MemVTs, LegalizeAction Action,
2677
+ unsigned AddrSpace = 0 ) {
2661
2678
for (auto MemVT : MemVTs)
2662
- setLoadExtAction (ExtTypes, ValVT, MemVT, Action);
2679
+ setLoadExtAction (ExtTypes, ValVT, MemVT, Action, AddrSpace );
2663
2680
}
2664
2681
2665
2682
// / Let target indicate that an extending atomic load of the specified type
@@ -3135,7 +3152,7 @@ class LLVM_ABI TargetLoweringBase {
3135
3152
LType = ISD::SEXTLOAD;
3136
3153
}
3137
3154
3138
- return isLoadExtLegal (LType, VT, LoadVT);
3155
+ return isLoadExtLegal (LType, VT, LoadVT, Load-> getPointerAddressSpace () );
3139
3156
}
3140
3157
3141
3158
// / Return true if any actual instruction that defines a value of type FromTy
0 commit comments