@@ -279,13 +279,14 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
279
279
.clampScalar (0 , s32, (XLen == 64 || ST.hasStdExtD ()) ? s64 : s32)
280
280
.clampScalar (1 , sXLen , sXLen );
281
281
282
- auto &LoadStoreActions = getActionDefinitionsBuilder ({G_LOAD, G_STORE});
282
+ auto &LoadStoreActions =
283
+ getActionDefinitionsBuilder ({G_LOAD, G_STORE})
284
+ .legalForTypesWithMemDesc ({{s32, p0, s8, 8 },
285
+ {s32, p0, s16, 16 },
286
+ {s32, p0, s32, 32 },
287
+ {p0, p0, sXLen , XLen}});
283
288
if (ST.hasVInstructions ())
284
- LoadStoreActions.legalForTypesWithMemDesc ({{s32, p0, s8, 8 },
285
- {s32, p0, s16, 16 },
286
- {s32, p0, s32, 32 },
287
- {p0, p0, sXLen , XLen},
288
- {nxv2s8, p0, nxv2s8, 8 },
289
+ LoadStoreActions.legalForTypesWithMemDesc ({{nxv2s8, p0, nxv2s8, 8 },
289
290
{nxv4s8, p0, nxv4s8, 8 },
290
291
{nxv8s8, p0, nxv8s8, 8 },
291
292
{nxv16s8, p0, nxv16s8, 8 },
@@ -321,19 +322,18 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
321
322
322
323
if (ST.hasVInstructionsI64 ())
323
324
LoadStoreActions.legalForTypesWithMemDesc ({{nxv1s64, p0, nxv1s64, 64 },
325
+
324
326
{nxv2s64, p0, nxv2s64, 64 },
325
327
{nxv4s64, p0, nxv4s64, 64 },
326
328
{nxv8s64, p0, nxv8s64, 64 }});
327
329
328
330
LoadStoreActions.widenScalarToNextPow2 (0 , /* MinSize = */ 8 )
329
331
.lowerIfMemSizeNotByteSizePow2 ()
330
- .customIf (all (LegalityPredicate ([=](const LegalityQuery &Query) {
331
- LLT Type = Query.Types [0 ];
332
- return Type.isScalableVector ();
333
- }),
334
- LegalityPredicate (LegalityPredicates::any (
335
- typeIsLegalIntOrFPVec (0 , IntOrFPVecTys, ST),
336
- typeIsLegalPtrVec (0 , PtrVecTys, ST)))))
332
+ // we will take the custom lowering logic if we have scalable vector types
333
+ // with non-standard alignments
334
+ .customIf (LegalityPredicate (
335
+ LegalityPredicates::any (typeIsLegalIntOrFPVec (0 , IntOrFPVecTys, ST),
336
+ typeIsLegalPtrVec (0 , PtrVecTys, ST))))
337
337
.clampScalar (0 , s32, sXLen )
338
338
.lower ();
339
339
@@ -743,10 +743,7 @@ bool RISCVLegalizerInfo::legalizeLoadStore(MachineInstr &MI,
743
743
DataTy.getElementCount ().getKnownMinValue () * (EltSizeBits / 8 );
744
744
LLT NewDataTy = LLT::scalable_vector (NumElements, 8 );
745
745
746
- if (isa<GLoad>(MI))
747
- Helper.bitcast (MI, 0 , NewDataTy);
748
- else
749
- Helper.bitcast (MI, 0 , NewDataTy);
746
+ Helper.bitcast (MI, 0 , NewDataTy);
750
747
751
748
return true ;
752
749
}
0 commit comments