Skip to content

Commit e86058f

Browse files
committed
minor changes
1 parent 4824e6f commit e86058f

File tree

1 file changed

+10
-16
lines changed

1 file changed

+10
-16
lines changed

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

Lines changed: 10 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -279,13 +279,13 @@ 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});
283-
if (ST.hasVInstructions())
284-
LoadStoreActions.legalForTypesWithMemDesc({{s32, p0, s8, 8},
282+
auto &LoadStoreActions = getActionDefinitionsBuilder({G_LOAD, G_STORE}).
283+
legalForTypesWithMemDesc({{s32, p0, s8, 8},
285284
{s32, p0, s16, 16},
286285
{s32, p0, s32, 32},
287-
{p0, p0, sXLen, XLen},
288-
{nxv2s8, p0, nxv2s8, 8},
286+
{p0, p0, sXLen, XLen}});
287+
if (ST.hasVInstructions())
288+
LoadStoreActions.legalForTypesWithMemDesc({{nxv2s8, p0, nxv2s8, 8},
289289
{nxv4s8, p0, nxv4s8, 8},
290290
{nxv8s8, p0, nxv8s8, 8},
291291
{nxv16s8, p0, nxv16s8, 8},
@@ -327,13 +327,10 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST)
327327

328328
LoadStoreActions.widenScalarToNextPow2(0, /* MinSize = */ 8)
329329
.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)))))
330+
// we will take the custom lowering logic if we have scalable vector types with non-standard alignments
331+
.customIf(LegalityPredicate(LegalityPredicates::any(
332+
typeIsLegalIntOrFPVec(0, IntOrFPVecTys, ST),
333+
typeIsLegalPtrVec(0, PtrVecTys, ST))))
337334
.clampScalar(0, s32, sXLen)
338335
.lower();
339336

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

746-
if (isa<GLoad>(MI))
747-
Helper.bitcast(MI, 0, NewDataTy);
748-
else
749-
Helper.bitcast(MI, 0, NewDataTy);
743+
Helper.bitcast(MI, 0, NewDataTy);
750744

751745
return true;
752746
}

0 commit comments

Comments
 (0)