Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 17 additions & 6 deletions llvm/lib/CodeGen/InterleavedAccessPass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ static bool isReInterleaveMask(ShuffleVectorInst *SVI, unsigned &Factor,
static Value *getMaskOperand(IntrinsicInst *II) {
switch (II->getIntrinsicID()) {
default:
llvm_unreachable("Unexpected intrinsic");
return nullptr;
case Intrinsic::vp_load:
return II->getOperand(1);
case Intrinsic::masked_load:
Expand Down Expand Up @@ -382,8 +382,11 @@ bool InterleavedAccessImpl::lowerInterleavedLoad(
if (LI) {
LLVM_DEBUG(dbgs() << "IA: Found an interleaved load: " << *Load << "\n");
} else {
Value *MaskOperand = getMaskOperand(II);
if (!MaskOperand)
llvm_unreachable("unsupported intrinsic");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I we do it this way, I would use an assert here.

// Check mask operand. Handle both all-true/false and interleaved mask.
Mask = getMask(getMaskOperand(II), Factor, VecTy);
Mask = getMask(MaskOperand, Factor, VecTy);
if (!Mask)
return false;

Expand Down Expand Up @@ -534,10 +537,12 @@ bool InterleavedAccessImpl::lowerInterleavedStore(
if (SI) {
LLVM_DEBUG(dbgs() << "IA: Found an interleaved store: " << *Store << "\n");
} else {
Value *MaskOperand = getMaskOperand(II);
if (!MaskOperand)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I we do it this way, I would use an assert here.

llvm_unreachable("unsupported intrinsic");
// Check mask operand. Handle both all-true/false and interleaved mask.
unsigned LaneMaskLen = NumStoredElements / Factor;
Mask = getMask(getMaskOperand(II), Factor,
ElementCount::getFixed(LaneMaskLen));
Mask = getMask(MaskOperand, Factor, ElementCount::getFixed(LaneMaskLen));
if (!Mask)
return false;

Expand Down Expand Up @@ -634,9 +639,12 @@ bool InterleavedAccessImpl::lowerDeinterleaveIntrinsic(
<< " and factor = " << Factor << "\n");
} else {
assert(II);
Value *MaskOperand = getMaskOperand(II);
if (!MaskOperand)
return false;

// Check mask operand. Handle both all-true/false and interleaved mask.
Mask = getMask(getMaskOperand(II), Factor, getDeinterleavedVectorType(DI));
Mask = getMask(MaskOperand, Factor, getDeinterleavedVectorType(DI));
if (!Mask)
return false;

Expand Down Expand Up @@ -673,8 +681,11 @@ bool InterleavedAccessImpl::lowerInterleaveIntrinsic(

Value *Mask = nullptr;
if (II) {
Value *MaskOperand = getMaskOperand(II);
if (!MaskOperand)
return false;
// Check mask operand. Handle both all-true/false and interleaved mask.
Mask = getMask(getMaskOperand(II), Factor,
Mask = getMask(MaskOperand, Factor,
cast<VectorType>(InterleaveValues[0]->getType()));
if (!Mask)
return false;
Expand Down
12 changes: 12 additions & 0 deletions llvm/test/CodeGen/X86/x86-interleaved-access.ll
Original file line number Diff line number Diff line change
Expand Up @@ -1897,3 +1897,15 @@ define <2 x i64> @PR37616(ptr %a0) nounwind {
%shuffle = shufflevector <16 x i64> %load, <16 x i64> undef, <2 x i32> <i32 2, i32 6>
ret <2 x i64> %shuffle
}

define { <8 x float>, <8 x float> } @interleave_deinterleave2() {
; AVX-LABEL: interleave_deinterleave2:
; AVX: # %bb.0: # %.entry
; AVX-NEXT: vxorps %xmm0, %xmm0, %xmm0
; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
; AVX-NEXT: retq
.entry:
%0 = call <16 x float> @llvm.vector.interleave2.v16f32(<8 x float> zeroinitializer, <8 x float> zeroinitializer)
%1 = call { <8 x float>, <8 x float> } @llvm.vector.deinterleave2.v16f32(<16 x float> %0)
ret { <8 x float>, <8 x float> } %1
}