-
Notifications
You must be signed in to change notification settings - Fork 13.6k
[ConstantFolding] Add folding for [de]interleave2, insert and extract #141301
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
@@ -1619,6 +1619,10 @@ bool llvm::canConstantFoldCallTo(const CallBase *Call, const Function *F) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::vector_reduce_smax: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::vector_reduce_umin: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::vector_reduce_umax: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::vector_extract: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::vector_insert: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::vector_interleave2: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::vector_deinterleave2: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Target intrinsics | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::amdgcn_perm: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::amdgcn_wave_reduce_umin: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -3734,6 +3738,98 @@ static Constant *ConstantFoldFixedVectorCall( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::vector_extract: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
auto *Vec = dyn_cast<Constant>(Operands[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
auto *Idx = cast<ConstantInt>(Operands[1]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!Vec || !Idx || !isa<FixedVectorType>(Vec->getType())) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
npanchen marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
unsigned NumElements = FVTy->getNumElements(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
unsigned VecNumElements = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cast<FixedVectorType>(Vec->getType())->getNumElements(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
npanchen marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
unsigned StartingIndex = Idx->getZExtValue(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Extracting entire vector is nop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (NumElements == VecNumElements && StartingIndex == 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return Vec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
const unsigned NonPoisonNumElements = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
std::min(StartingIndex + NumElements, VecNumElements); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for (unsigned I = StartingIndex; I < NonPoisonNumElements; ++I) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constant *Elt = Vec->getAggregateElement(I); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!Elt) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Result[I - StartingIndex] = Elt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+3756
to
+3763
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stylistic nit, you could avoid
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Remaining elements are poison since they are out of bounds. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for (unsigned I = NonPoisonNumElements, E = StartingIndex + NumElements; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
I < E; ++I) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Result[I - StartingIndex] = PoisonValue::get(FVTy->getElementType()); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return ConstantVector::get(Result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::vector_insert: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
auto *Vec = dyn_cast<Constant>(Operands[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
auto *SubVec = dyn_cast<Constant>(Operands[1]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+3773
to
+3774
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here, I think you can drop the dyn_casts
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
auto *Idx = dyn_cast<ConstantInt>(Operands[2]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
npanchen marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!Vec || !SubVec || !Idx || !isa<FixedVectorType>(Vec->getType())) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
npanchen marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
unsigned SubVecNumElements = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cast<FixedVectorType>(SubVec->getType())->getNumElements(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
unsigned VecNumElements = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cast<FixedVectorType>(Vec->getType())->getNumElements(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lukel97 marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
unsigned IdxN = Idx->getZExtValue(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Replacing entire vector with a subvec is nop | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (SubVecNumElements == VecNumElements && IdxN == 0) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return SubVec; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
npanchen marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// Make sure indices are in the range [0, VecNumElements), otherwise the | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// result is a poison value. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (IdxN >= VecNumElements || IdxN + SubVecNumElements > VecNumElements || | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SubVecNumElements is always >= 1 so if
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
(IdxN && (SubVecNumElements % IdxN) != 0)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
dtcxzyw marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't this be if the index isn't a multiple of the vector length? I.e.
Suggested change
Is it possible to add a test for this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. that's not correct when
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. IdxN must be 0,6,12,18... right? So 3 should be poison and 3%6=3 would be true for this check |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return PoisonValue::get(FVTy); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
unsigned I = 0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for (; I < IdxN; ++I) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constant *Elt = Vec->getAggregateElement(I); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!Elt) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Result[I] = Elt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for (; I < IdxN + SubVecNumElements; ++I) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constant *Elt = SubVec->getAggregateElement(I - IdxN); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!Elt) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Result[I] = Elt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for (; I < VecNumElements; ++I) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constant *Elt = Vec->getAggregateElement(I); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!Elt) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Result[I] = Elt; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+3794
to
+3812
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Stylistic, I think it's easier to read if they're merged into one loop
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return ConstantVector::get(Result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::vector_interleave2: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
auto *Vec0 = dyn_cast<Constant>(Operands[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
auto *Vec1 = dyn_cast<Constant>(Operands[1]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!Vec0 || !Vec1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+3816
to
+3819
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Operands is an |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
unsigned NumElements = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cast<FixedVectorType>(Vec0->getType())->getNumElements(); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for (unsigned I = 0; I < NumElements; ++I) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constant *Elt0 = Vec0->getAggregateElement(I); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constant *Elt1 = Vec1->getAggregateElement(I); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!Elt0 || !Elt1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Result[2 * I] = Elt0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Result[2 * I + 1] = Elt1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return ConstantVector::get(Result); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
default: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
break; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@@ -3872,6 +3968,26 @@ ConstantFoldStructCall(StringRef Name, Intrinsic::ID IntrinsicID, | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return ConstantStruct::get(StTy, SinResult, CosResult); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
case Intrinsic::vector_deinterleave2: { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
auto *Vec = dyn_cast<Constant>(Operands[0]); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!Vec) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Comment on lines
+3972
to
+3974
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
unsigned NumElements = | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
cast<VectorType>(Vec->getType())->getElementCount().getKnownMinValue() / | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
lukel97 marked this conversation as resolved.
Show resolved
Hide resolved
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If Vec can be scalable here, should we check if it's scalable and bail? Otherwise we're relying on getAggregateElement to return nullptr |
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
2; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
SmallVector<Constant *, 4> Res0(NumElements), Res1(NumElements); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
for (unsigned I = 0; I < NumElements; ++I) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constant *Elt0 = Vec->getAggregateElement(2 * I); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Constant *Elt1 = Vec->getAggregateElement(2 * I + 1); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
if (!Elt0 || !Elt1) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return nullptr; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Res0[I] = Elt0; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Res1[I] = Elt1; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
return ConstantStruct::get(StTy, ConstantVector::get(Res0), | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
ConstantVector::get(Res1)); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
} | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
default: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// TODO: Constant folding of vector intrinsics that fall through here does | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
// not work (e.g. overflow intrinsics) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,100 @@ | ||||||
; NOTE: Assertions have been autogenerated by utils/update_test_checks.py UTC_ARGS: --version 5 | ||||||
; RUN: opt < %s -passes=instsimplify,verify -disable-verify -S | FileCheck %s | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||||||
|
||||||
define <3 x i32> @fold_vector_extract() { | ||||||
; CHECK-LABEL: define <3 x i32> @fold_vector_extract() { | ||||||
; CHECK-NEXT: ret <3 x i32> <i32 3, i32 4, i32 5> | ||||||
; | ||||||
%1 = call <3 x i32> @llvm.vector.extract.v3i32.v8i32(<8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>, i64 3) | ||||||
ret <3 x i32> %1 | ||||||
} | ||||||
|
||||||
@a = external global i16, align 1 | ||||||
|
||||||
define <3 x i32> @fold_vector_extract_constexpr() { | ||||||
; CHECK-LABEL: define <3 x i32> @fold_vector_extract_constexpr() { | ||||||
; CHECK-NEXT: ret <3 x i32> <i32 ptrtoint (ptr @a to i32), i32 1, i32 2> | ||||||
; | ||||||
%1 = call <3 x i32> @llvm.vector.extract.v3i32.v8i32(<8 x i32> <i32 ptrtoint (ptr @a to i32), i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>, i64 0) | ||||||
ret <3 x i32> %1 | ||||||
} | ||||||
|
||||||
define <3 x i32> @fold_vector_extract_last_poison() { | ||||||
; CHECK-LABEL: define <3 x i32> @fold_vector_extract_last_poison() { | ||||||
; CHECK-NEXT: ret <3 x i32> <i32 6, i32 7, i32 poison> | ||||||
; | ||||||
%1 = call <3 x i32> @llvm.vector.extract.v3i32.v8i32(<8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>, i64 6) | ||||||
ret <3 x i32> %1 | ||||||
} | ||||||
|
||||||
define <3 x i32> @fold_vector_extract_poison() { | ||||||
; CHECK-LABEL: define <3 x i32> @fold_vector_extract_poison() { | ||||||
; CHECK-NEXT: ret <3 x i32> poison | ||||||
; | ||||||
%1 = call <3 x i32> @llvm.vector.extract.v3i32.v8i32(<8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>, i64 8) | ||||||
ret <3 x i32> %1 | ||||||
} | ||||||
|
||||||
define <8 x i32> @fold_vector_extract_nop() { | ||||||
; CHECK-LABEL: define <8 x i32> @fold_vector_extract_nop() { | ||||||
; CHECK-NEXT: ret <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7> | ||||||
; | ||||||
%1 = call <8 x i32> @llvm.vector.extract.v3i32.v8i32(<8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>, i64 0) | ||||||
ret <8 x i32> %1 | ||||||
} | ||||||
|
||||||
define <8 x i32> @fold_vector_insert() { | ||||||
; CHECK-LABEL: define <8 x i32> @fold_vector_insert() { | ||||||
; CHECK-NEXT: ret <8 x i32> <i32 9, i32 10, i32 11, i32 12, i32 5, i32 6, i32 7, i32 8> | ||||||
; | ||||||
%1 = call <8 x i32> @llvm.vector.insert.v8i32(<8 x i32> <i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8>, <4 x i32> <i32 9, i32 10, i32 11, i32 12>, i64 0) | ||||||
ret <8 x i32> %1 | ||||||
} | ||||||
|
||||||
define <8 x i32> @fold_vector_insert_nop() { | ||||||
; CHECK-LABEL: define <8 x i32> @fold_vector_insert_nop() { | ||||||
; CHECK-NEXT: ret <8 x i32> <i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18> | ||||||
; | ||||||
%1 = call <8 x i32> @llvm.vector.insert.v8i32(<8 x i32> <i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8>, <8 x i32> <i32 11, i32 12, i32 13, i32 14, i32 15, i32 16, i32 17, i32 18>, i64 0) | ||||||
ret <8 x i32> %1 | ||||||
} | ||||||
|
||||||
define <8 x i32> @fold_vector_insert_poison_idx_range() { | ||||||
; CHECK-LABEL: define <8 x i32> @fold_vector_insert_poison_idx_range() { | ||||||
; CHECK-NEXT: ret <8 x i32> poison | ||||||
; | ||||||
%1 = call <8 x i32> @llvm.vector.insert.v8i32(<8 x i32> <i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8>, <6 x i32> <i32 9, i32 10, i32 11, i32 12, i32 13, i32 14>, i64 6) | ||||||
ret <8 x i32> %1 | ||||||
} | ||||||
|
||||||
define <8 x i32> @fold_vector_insert_poison_large_idx() { | ||||||
; CHECK-LABEL: define <8 x i32> @fold_vector_insert_poison_large_idx() { | ||||||
; CHECK-NEXT: ret <8 x i32> poison | ||||||
; | ||||||
%1 = call <8 x i32> @llvm.vector.insert.v8i32(<8 x i32> <i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7, i32 8>, <6 x i32> <i32 9, i32 10, i32 11, i32 12, i32 13, i32 14>, i64 -2) | ||||||
ret <8 x i32> %1 | ||||||
} | ||||||
|
||||||
define <8 x i32> @fold_vector_interleave2() { | ||||||
; CHECK-LABEL: define <8 x i32> @fold_vector_interleave2() { | ||||||
; CHECK-NEXT: ret <8 x i32> <i32 1, i32 5, i32 2, i32 6, i32 3, i32 7, i32 4, i32 8> | ||||||
; | ||||||
%1 = call<8 x i32> @llvm.vector.interleave2.v8i32(<4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32> <i32 5, i32 6, i32 7, i32 8>) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
ret <8 x i32> %1 | ||||||
} | ||||||
|
||||||
define {<4 x i32>, <4 x i32>} @fold_vector_deinterleav2() { | ||||||
; CHECK-LABEL: define { <4 x i32>, <4 x i32> } @fold_vector_deinterleav2() { | ||||||
; CHECK-NEXT: ret { <4 x i32>, <4 x i32> } { <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32> <i32 5, i32 6, i32 7, i32 8> } | ||||||
; | ||||||
%1 = call {<4 x i32>, <4 x i32>} @llvm.vector.deinterleave2.v4i32.v8i32(<8 x i32> <i32 1, i32 5, i32 2, i32 6, i32 3, i32 7, i32 4, i32 8>) | ||||||
ret {<4 x i32>, <4 x i32>} %1 | ||||||
} | ||||||
|
||||||
define {<vscale x 4 x i32>, <vscale x 4 x i32>} @fold_scalable_vector_deinterleav2() { | ||||||
; CHECK-LABEL: define { <vscale x 4 x i32>, <vscale x 4 x i32> } @fold_scalable_vector_deinterleav2() { | ||||||
; CHECK-NEXT: ret { <vscale x 4 x i32>, <vscale x 4 x i32> } zeroinitializer | ||||||
; | ||||||
%1 = call {<vscale x 4 x i32>, <vscale x 4 x i32>} @llvm.vector.deinterleave2.v4i32.v8i32(<vscale x 8 x i32> zeroinitializer) | ||||||
ret {<vscale x 4 x i32>, <vscale x 4 x i32>} %1 | ||||||
} |
Uh oh!
There was an error while loading. Please reload this page.