Skip to content

Commit 63fcce6

Browse files
authored
[IA][RISCV] Add support for vp.load/vp.store with shufflevector (#135445)
Teach InterleavedAccessPass to recognize vp.load + shufflevector and shufflevector + vp.store. Though this patch only adds RISC-V support to actually lower this pattern. The vp.load/vp.store in this pattern require constant mask.
1 parent 1d073fd commit 63fcce6

File tree

7 files changed

+920
-213
lines changed

7 files changed

+920
-213
lines changed

llvm/include/llvm/CodeGen/TargetLowering.h

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3216,8 +3216,7 @@ class TargetLoweringBase {
32163216
/// \p Load is a vp.load instruction.
32173217
/// \p Mask is a mask value
32183218
/// \p DeinterleaveRes is a list of deinterleaved results.
3219-
virtual bool
3220-
lowerDeinterleavedIntrinsicToVPLoad(VPIntrinsic *Load, Value *Mask,
3219+
virtual bool lowerInterleavedVPLoad(VPIntrinsic *Load, Value *Mask,
32213220
ArrayRef<Value *> DeinterleaveRes) const {
32223221
return false;
32233222
}
@@ -3228,9 +3227,8 @@ class TargetLoweringBase {
32283227
/// \p Store is the vp.store instruction.
32293228
/// \p Mask is a mask value
32303229
/// \p InterleaveOps is a list of values being interleaved.
3231-
virtual bool
3232-
lowerInterleavedIntrinsicToVPStore(VPIntrinsic *Store, Value *Mask,
3233-
ArrayRef<Value *> InterleaveOps) const {
3230+
virtual bool lowerInterleavedVPStore(VPIntrinsic *Store, Value *Mask,
3231+
ArrayRef<Value *> InterleaveOps) const {
32343232
return false;
32353233
}
32363234

llvm/include/llvm/IR/IntrinsicsRISCV.td

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1705,19 +1705,39 @@ let TargetPrefix = "riscv" in {
17051705

17061706
// Segment loads/stores for fixed vectors.
17071707
foreach nf = [2, 3, 4, 5, 6, 7, 8] in {
1708+
// Input: (pointer, vl)
17081709
def int_riscv_seg # nf # _load
17091710
: DefaultAttrsIntrinsic<!listconcat([llvm_anyvector_ty],
17101711
!listsplat(LLVMMatchType<0>,
17111712
!add(nf, -1))),
17121713
[llvm_anyptr_ty, llvm_anyint_ty],
17131714
[NoCapture<ArgIndex<0>>, IntrReadMem]>;
1715+
// Input: (pointer, mask, vl)
1716+
def int_riscv_seg # nf # _load_mask
1717+
: DefaultAttrsIntrinsic<!listconcat([llvm_anyvector_ty],
1718+
!listsplat(LLVMMatchType<0>,
1719+
!add(nf, -1))),
1720+
[llvm_ptr_ty, LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
1721+
llvm_anyint_ty],
1722+
[NoCapture<ArgIndex<0>>, IntrReadMem]>;
1723+
1724+
// Input: (<stored values>, pointer, vl)
17141725
def int_riscv_seg # nf # _store
17151726
: DefaultAttrsIntrinsic<[],
17161727
!listconcat([llvm_anyvector_ty],
17171728
!listsplat(LLVMMatchType<0>,
17181729
!add(nf, -1)),
17191730
[llvm_anyptr_ty, llvm_anyint_ty]),
17201731
[NoCapture<ArgIndex<nf>>, IntrWriteMem]>;
1732+
// Input: (<stored values>, pointer, mask, vl)
1733+
def int_riscv_seg # nf # _store_mask
1734+
: DefaultAttrsIntrinsic<[],
1735+
!listconcat([llvm_anyvector_ty],
1736+
!listsplat(LLVMMatchType<0>,
1737+
!add(nf, -1)),
1738+
[llvm_ptr_ty, LLVMScalarOrSameVectorWidth<0, llvm_i1_ty>,
1739+
llvm_anyint_ty]),
1740+
[NoCapture<ArgIndex<nf>>, IntrWriteMem]>;
17211741
}
17221742

17231743
} // TargetPrefix = "riscv"

0 commit comments

Comments
 (0)