Skip to content

Commit 4688b4c

Browse files
Mel-Chenpreames
andcommitted
Pick some good change from llvm#150074, thanks
Co-authored-by: Philip Reames <[email protected]>
1 parent a74859d commit 4688b4c

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -979,10 +979,13 @@ InstructionCost RISCVTTIImpl::getInterleavedMemoryOpCost(
979979
Align Alignment, unsigned AddressSpace, TTI::TargetCostKind CostKind,
980980
bool UseMaskForCond, bool UseMaskForGaps) const {
981981

982-
// The interleaved memory access pass will lower interleaved memory ops (i.e
983-
// a load and store followed by a specific shuffle) to vlseg/vsseg
984-
// intrinsics.
985-
if (!UseMaskForGaps && Factor <= TLI->getMaxSupportedInterleaveFactor()) {
982+
// The interleaved memory access pass will lower (de)interleave ops combined
983+
// with an adjacent appropriate memory to vlseg/vsseg intrinsics. vlseg/vsseg
984+
// only support masking per-iteration (i.e. condition), not per-segment (i.e.
985+
// gap).
986+
// TODO: Support masked interleaved access for fixed length vector.
987+
if ((isa<ScalableVectorType>(VecTy) || !UseMaskForCond) && !UseMaskForGaps &&
988+
Factor <= TLI->getMaxSupportedInterleaveFactor()) {
986989
auto *VTy = cast<VectorType>(VecTy);
987990
std::pair<InstructionCost, MVT> LT = getTypeLegalizationCost(VTy);
988991
// Need to make sure type has't been scalarized

llvm/lib/Target/RISCV/RISCVTargetTransformInfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,7 @@ class RISCVTTIImpl final : public BasicTTIImplBase<RISCVTTIImpl> {
399399
bool enableInterleavedAccessVectorization() const override { return true; }
400400

401401
bool enableMaskedInterleavedAccessVectorization() const override {
402-
return true;
402+
return ST->hasVInstructions();
403403
}
404404

405405
unsigned getMinTripCountTailFoldingThreshold() const override;

0 commit comments

Comments
 (0)