Skip to content

[Vectorize] Update comment of getSubdividedVectorType #107632

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

Merged
merged 2 commits into from
Sep 6, 2024
Merged
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
6 changes: 3 additions & 3 deletions llvm/include/llvm/IR/DerivedTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -492,9 +492,9 @@ class VectorType : public Type {
return VectorType::get(EltTy, VTy->getElementCount());
}

// This static method returns a VectorType with a smaller number of elements
// of a larger type than the input element type. For example, a <16 x i8>
// subdivided twice would return <4 x i32>
// This static method returns a VectorType with a larger number of elements
// of a smaller type than the input element type. For example, a <4 x i64>
// subdivided twice would return <16 x i16>
static VectorType *getSubdividedVectorType(VectorType *VTy, int NumSubdivs) {
for (int i = 0; i < NumSubdivs; ++i) {
VTy = VectorType::getDoubleElementsVectorType(VTy);
Expand Down
4 changes: 4 additions & 0 deletions llvm/unittests/IR/VectorTypesTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ TEST(VectorTypesTest, FixedLength) {
EltCnt = V8Int64Ty->getElementCount();
EXPECT_EQ(EltCnt.getKnownMinValue(), 8U);
ASSERT_FALSE(EltCnt.isScalable());

auto *SubTy = VectorType::getSubdividedVectorType(V4Int64Ty, 2);
EXPECT_EQ(SubTy->getElementCount(), ElementCount::getFixed(16));
EXPECT_TRUE(SubTy->getElementType()->isIntegerTy(16));
}

TEST(VectorTypesTest, Scalable) {
Expand Down
Loading