Skip to content

Commit 12b0386

Browse files
committed
minor changes
1 parent 4824e6f commit 12b0386

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,14 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
279279
.clampScalar(0, s32, (XLen == 64 || ST.hasStdExtD()) ? s64 : s32)
280280
.clampScalar(1, sXLen, sXLen);
281281

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}});
283288
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},
289290
{nxv4s8, p0, nxv4s8, 8},
290291
{nxv8s8, p0, nxv8s8, 8},
291292
{nxv16s8, p0, nxv16s8, 8},
@@ -321,19 +322,18 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
321322

322323
if (ST.hasVInstructionsI64())
323324
LoadStoreActions.legalForTypesWithMemDesc({{nxv1s64, p0, nxv1s64, 64},
325+
324326
{nxv2s64, p0, nxv2s64, 64},
325327
{nxv4s64, p0, nxv4s64, 64},
326328
{nxv8s64, p0, nxv8s64, 64}});
327329

328330
LoadStoreActions.widenScalarToNextPow2(0, /* MinSize = */ 8)
329331
.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))))
337337
.clampScalar(0, s32, sXLen)
338338
.lower();
339339

@@ -743,10 +743,7 @@ bool RISCVLegalizerInfo::legalizeLoadStore(MachineInstr &MI,
743743
DataTy.getElementCount().getKnownMinValue() * (EltSizeBits / 8);
744744
LLT NewDataTy = LLT::scalable_vector(NumElements, 8);
745745

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);
750747

751748
return true;
752749
}

0 commit comments

Comments
 (0)