Skip to content

Commit 05f87b2

Browse files
authored
[RISCV] Lower fixed-length mload/mstore for zvfhmin/zvfbfmin (#115145)
This is the same idea as #114945.
1 parent 7cb6677 commit 05f87b2

File tree

4 files changed

+181
-25141
lines changed

4 files changed

+181
-25141
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,9 +1339,9 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
13391339
ISD::VECTOR_SHUFFLE, ISD::VECTOR_COMPRESS},
13401340
VT, Custom);
13411341

1342-
// FIXME: mload, mstore, vp_gather/scatter can be
1343-
// hoisted to here.
1344-
setOperationAction({ISD::LOAD, ISD::STORE, ISD::MGATHER, ISD::MSCATTER},
1342+
// FIXME: vp_gather/scatter can be hoisted to here.
1343+
setOperationAction({ISD::LOAD, ISD::STORE, ISD::MLOAD, ISD::MSTORE,
1344+
ISD::MGATHER, ISD::MSCATTER},
13451345
VT, Custom);
13461346
setOperationAction({ISD::VP_LOAD, ISD::VP_STORE,
13471347
ISD::EXPERIMENTAL_VP_STRIDED_LOAD,
@@ -1409,8 +1409,6 @@ RISCVTargetLowering::RISCVTargetLowering(const TargetMachine &TM,
14091409
setOperationAction({ISD::BUILD_VECTOR, ISD::SCALAR_TO_VECTOR}, VT,
14101410
Custom);
14111411

1412-
setOperationAction({ISD::MLOAD, ISD::MSTORE}, VT, Custom);
1413-
14141412
setOperationAction({ISD::VP_GATHER, ISD::VP_SCATTER}, VT, Custom);
14151413

14161414
setOperationAction({ISD::FADD, ISD::FSUB, ISD::FMUL, ISD::FDIV,

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,8 +239,12 @@ class RISCVTTIImpl : public BasicTTIImplBase<RISCVTTIImpl> {
239239
if (!ST->enableUnalignedVectorMem() && Alignment < ElemType.getStoreSize())
240240
return false;
241241

242-
return TLI->isLegalElementTypeForRVV(ElemType);
243-
242+
// TODO: Move bf16/f16 support into isLegalElementTypeForRVV
243+
return TLI->isLegalElementTypeForRVV(ElemType) ||
244+
(DataTypeVT.getVectorElementType() == MVT::bf16 &&
245+
ST->hasVInstructionsBF16Minimal()) ||
246+
(DataTypeVT.getVectorElementType() == MVT::f16 &&
247+
ST->hasVInstructionsF16Minimal());
244248
}
245249

246250
bool isLegalMaskedLoad(Type *DataType, Align Alignment) {

0 commit comments

Comments
 (0)