1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-23 03:02:36 +01:00

[SVE] Upgrade VectorType tests to test new types

Reviewers: efriedma, sdesmalen, c-rhodes, ddunbar

Reviewed By: sdesmalen

Subscribers: huntergr, tschuett, rkruppe, psnobl, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D78831
This commit is contained in:
Christopher Tetreault 2020-04-29 11:21:04 -07:00
parent b3af96584e
commit bab428d88d
2 changed files with 191 additions and 86 deletions

View File

@ -519,9 +519,8 @@ public:
/// input type and the same element type.
static VectorType *getDoubleElementsVectorType(VectorType *VTy) {
auto EltCnt = VTy->getElementCount();
assert((VTy->getNumElements() * 2ull) <= UINT_MAX &&
"Too many elements in vector");
return VectorType::get(VTy->getElementType(), EltCnt*2);
assert((EltCnt.Min * 2ull) <= UINT_MAX && "Too many elements in vector");
return VectorType::get(VTy->getElementType(), EltCnt * 2);
}
/// Return true if the specified type is valid as a element type.

View File

@ -14,72 +14,110 @@
using namespace llvm;
namespace {
#define EXPECT_VTY_EQ(LHS, RHS) \
ASSERT_NE(LHS, nullptr) << #LHS << " must not be null"; \
ASSERT_NE(RHS, nullptr) << #RHS << " must not be null"; \
EXPECT_EQ(LHS, RHS) << "Expect that " << #LHS << " == " << #RHS << " where " \
<< #LHS << " = " << *LHS << " and " << #RHS << " = " \
<< *RHS;
#define EXPECT_VTY_NE(LHS, RHS) \
ASSERT_NE(LHS, nullptr) << #LHS << " must not be null"; \
ASSERT_NE(RHS, nullptr) << #RHS << " must not be null"; \
EXPECT_NE(LHS, RHS) << "Expect that " << #LHS << " != " << #RHS << " where " \
<< #LHS << " = " << *LHS << " and " << #RHS << " = " \
<< *RHS;
TEST(VectorTypesTest, FixedLength) {
LLVMContext Ctx;
Type *Int8Ty = Type::getInt8Ty(Ctx);
Type *Int16Ty = Type::getInt16Ty(Ctx);
Type *Int32Ty = Type::getInt32Ty(Ctx);
Type *Int64Ty = Type::getInt64Ty(Ctx);
Type *Float64Ty = Type::getDoubleTy(Ctx);
VectorType *V8Int32Ty = VectorType::get(Int32Ty, 8);
ASSERT_TRUE(isa<FixedVectorType>(V8Int32Ty));
auto *V16Int8Ty = FixedVectorType::get(Int8Ty, 16);
ASSERT_NE(nullptr, V16Int8Ty);
EXPECT_EQ(V16Int8Ty->getNumElements(), 16U);
EXPECT_EQ(V16Int8Ty->getElementType()->getScalarSizeInBits(), 8U);
auto *V8Int32Ty = dyn_cast<FixedVectorType>(VectorType::get(Int32Ty, 8));
ASSERT_NE(nullptr, V8Int32Ty);
EXPECT_EQ(V8Int32Ty->getNumElements(), 8U);
EXPECT_EQ(V8Int32Ty->getElementType()->getScalarSizeInBits(), 32U);
VectorType *V8Int16Ty = VectorType::get(Int16Ty, {8, false});
ASSERT_TRUE(isa<FixedVectorType>(V8Int16Ty));
auto *V8Int32TyExplicitFalse =
dyn_cast<FixedVectorType>(VectorType::get(Int32Ty, 8, false));
EXPECT_VTY_EQ(V8Int32Ty, V8Int32TyExplicitFalse);
auto *V8Int8Ty =
dyn_cast<FixedVectorType>(VectorType::get(Int8Ty, V8Int32Ty));
EXPECT_VTY_NE(V8Int32Ty, V8Int8Ty);
EXPECT_EQ(V8Int8Ty->getElementCount(), V8Int32Ty->getElementCount());
EXPECT_EQ(V8Int8Ty->getElementType()->getScalarSizeInBits(), 8U);
auto *V8Int32Ty2 =
dyn_cast<FixedVectorType>(VectorType::get(Int32Ty, V8Int32Ty));
EXPECT_VTY_EQ(V8Int32Ty, V8Int32Ty2);
auto *V8Int16Ty =
dyn_cast<FixedVectorType>(VectorType::get(Int16Ty, {8, false}));
ASSERT_NE(nullptr, V8Int16Ty);
EXPECT_EQ(V8Int16Ty->getNumElements(), 8U);
EXPECT_EQ(V8Int16Ty->getElementType()->getScalarSizeInBits(), 16U);
ElementCount EltCnt(4, false);
VectorType *V4Int64Ty = VectorType::get(Int64Ty, EltCnt);
ASSERT_TRUE(isa<FixedVectorType>(V4Int64Ty));
auto *V4Int64Ty = dyn_cast<FixedVectorType>(VectorType::get(Int64Ty, EltCnt));
ASSERT_NE(nullptr, V4Int64Ty);
EXPECT_EQ(V4Int64Ty->getNumElements(), 4U);
EXPECT_EQ(V4Int64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *V2Int64Ty = VectorType::get(Int64Ty, EltCnt/2);
ASSERT_TRUE(isa<FixedVectorType>(V2Int64Ty));
auto *V2Int64Ty =
dyn_cast<FixedVectorType>(VectorType::get(Int64Ty, EltCnt / 2));
ASSERT_NE(nullptr, V2Int64Ty);
EXPECT_EQ(V2Int64Ty->getNumElements(), 2U);
EXPECT_EQ(V2Int64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *V8Int64Ty = VectorType::get(Int64Ty, EltCnt*2);
ASSERT_TRUE(isa<FixedVectorType>(V8Int64Ty));
auto *V8Int64Ty =
dyn_cast<FixedVectorType>(VectorType::get(Int64Ty, EltCnt * 2));
ASSERT_NE(nullptr, V8Int64Ty);
EXPECT_EQ(V8Int64Ty->getNumElements(), 8U);
EXPECT_EQ(V8Int64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *V4Float64Ty = VectorType::get(Float64Ty, EltCnt);
ASSERT_TRUE(isa<FixedVectorType>(V4Float64Ty));
auto *V4Float64Ty =
dyn_cast<FixedVectorType>(VectorType::get(Float64Ty, EltCnt));
ASSERT_NE(nullptr, V4Float64Ty);
EXPECT_EQ(V4Float64Ty->getNumElements(), 4U);
EXPECT_EQ(V4Float64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ExtTy = VectorType::getExtendedElementVectorType(V8Int16Ty);
EXPECT_EQ(ExtTy, V8Int32Ty);
ASSERT_TRUE(isa<FixedVectorType>(ExtTy));
auto *ExtTy = dyn_cast<FixedVectorType>(
VectorType::getExtendedElementVectorType(V8Int16Ty));
EXPECT_VTY_EQ(ExtTy, V8Int32Ty);
EXPECT_EQ(ExtTy->getNumElements(), 8U);
EXPECT_EQ(ExtTy->getElementType()->getScalarSizeInBits(), 32U);
VectorType *TruncTy = VectorType::getTruncatedElementVectorType(V8Int32Ty);
EXPECT_EQ(TruncTy, V8Int16Ty);
ASSERT_TRUE(isa<FixedVectorType>(TruncTy));
auto *TruncTy = dyn_cast<FixedVectorType>(
VectorType::getTruncatedElementVectorType(V8Int32Ty));
EXPECT_VTY_EQ(TruncTy, V8Int16Ty);
EXPECT_EQ(TruncTy->getNumElements(), 8U);
EXPECT_EQ(TruncTy->getElementType()->getScalarSizeInBits(), 16U);
VectorType *HalvedTy = VectorType::getHalfElementsVectorType(V4Int64Ty);
EXPECT_EQ(HalvedTy, V2Int64Ty);
ASSERT_TRUE(isa<FixedVectorType>(HalvedTy));
auto *HalvedTy = dyn_cast<FixedVectorType>(
VectorType::getHalfElementsVectorType(V4Int64Ty));
EXPECT_VTY_EQ(HalvedTy, V2Int64Ty);
EXPECT_EQ(HalvedTy->getNumElements(), 2U);
EXPECT_EQ(HalvedTy->getElementType()->getScalarSizeInBits(), 64U);
VectorType *DoubledTy = VectorType::getDoubleElementsVectorType(V4Int64Ty);
EXPECT_EQ(DoubledTy, V8Int64Ty);
ASSERT_TRUE(isa<FixedVectorType>(DoubledTy));
auto *DoubledTy = dyn_cast<FixedVectorType>(
VectorType::getDoubleElementsVectorType(V4Int64Ty));
EXPECT_VTY_EQ(DoubledTy, V8Int64Ty);
EXPECT_EQ(DoubledTy->getNumElements(), 8U);
EXPECT_EQ(DoubledTy->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ConvTy = VectorType::getInteger(V4Float64Ty);
EXPECT_EQ(ConvTy, V4Int64Ty);
ASSERT_TRUE(isa<FixedVectorType>(ConvTy));
auto *ConvTy = dyn_cast<FixedVectorType>(VectorType::getInteger(V4Float64Ty));
EXPECT_VTY_EQ(ConvTy, V4Int64Ty);
EXPECT_EQ(ConvTy->getNumElements(), 4U);
EXPECT_EQ(ConvTy->getElementType()->getScalarSizeInBits(), 64U);
@ -91,70 +129,92 @@ TEST(VectorTypesTest, FixedLength) {
TEST(VectorTypesTest, Scalable) {
LLVMContext Ctx;
Type *Int8Ty = Type::getInt8Ty(Ctx);
Type *Int16Ty = Type::getInt16Ty(Ctx);
Type *Int32Ty = Type::getInt32Ty(Ctx);
Type *Int64Ty = Type::getInt64Ty(Ctx);
Type *Float64Ty = Type::getDoubleTy(Ctx);
VectorType *ScV8Int32Ty = VectorType::get(Int32Ty, 8, true);
ASSERT_TRUE(isa<ScalableVectorType>(ScV8Int32Ty));
EXPECT_EQ(ScV8Int32Ty->getNumElements(), 8U);
auto *ScV16Int8Ty = ScalableVectorType::get(Int8Ty, 16);
ASSERT_NE(nullptr, ScV16Int8Ty);
EXPECT_EQ(ScV16Int8Ty->getMinNumElements(), 16U);
EXPECT_EQ(ScV16Int8Ty->getScalarSizeInBits(), 8U);
auto *ScV8Int32Ty =
dyn_cast<ScalableVectorType>(VectorType::get(Int32Ty, 8, true));
ASSERT_NE(nullptr, ScV8Int32Ty);
EXPECT_EQ(ScV8Int32Ty->getMinNumElements(), 8U);
EXPECT_EQ(ScV8Int32Ty->getElementType()->getScalarSizeInBits(), 32U);
VectorType *ScV8Int16Ty = VectorType::get(Int16Ty, {8, true});
ASSERT_TRUE(isa<ScalableVectorType>(ScV8Int16Ty));
EXPECT_EQ(ScV8Int16Ty->getNumElements(), 8U);
auto *ScV8Int8Ty =
dyn_cast<ScalableVectorType>(VectorType::get(Int8Ty, ScV8Int32Ty));
EXPECT_VTY_NE(ScV8Int32Ty, ScV8Int8Ty);
EXPECT_EQ(ScV8Int8Ty->getElementCount(), ScV8Int32Ty->getElementCount());
EXPECT_EQ(ScV8Int8Ty->getElementType()->getScalarSizeInBits(), 8U);
auto *ScV8Int32Ty2 =
dyn_cast<ScalableVectorType>(VectorType::get(Int32Ty, ScV8Int32Ty));
EXPECT_VTY_EQ(ScV8Int32Ty, ScV8Int32Ty2);
auto *ScV8Int16Ty =
dyn_cast<ScalableVectorType>(VectorType::get(Int16Ty, {8, true}));
ASSERT_NE(nullptr, ScV8Int16Ty);
EXPECT_EQ(ScV8Int16Ty->getMinNumElements(), 8U);
EXPECT_EQ(ScV8Int16Ty->getElementType()->getScalarSizeInBits(), 16U);
ElementCount EltCnt(4, true);
VectorType *ScV4Int64Ty = VectorType::get(Int64Ty, EltCnt);
ASSERT_TRUE(isa<ScalableVectorType>(ScV4Int64Ty));
EXPECT_EQ(ScV4Int64Ty->getNumElements(), 4U);
auto *ScV4Int64Ty =
dyn_cast<ScalableVectorType>(VectorType::get(Int64Ty, EltCnt));
ASSERT_NE(nullptr, ScV4Int64Ty);
EXPECT_EQ(ScV4Int64Ty->getMinNumElements(), 4U);
EXPECT_EQ(ScV4Int64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ScV2Int64Ty = VectorType::get(Int64Ty, EltCnt/2);
ASSERT_TRUE(isa<ScalableVectorType>(ScV2Int64Ty));
EXPECT_EQ(ScV2Int64Ty->getNumElements(), 2U);
auto *ScV2Int64Ty =
dyn_cast<ScalableVectorType>(VectorType::get(Int64Ty, EltCnt / 2));
ASSERT_NE(nullptr, ScV2Int64Ty);
EXPECT_EQ(ScV2Int64Ty->getMinNumElements(), 2U);
EXPECT_EQ(ScV2Int64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ScV8Int64Ty = VectorType::get(Int64Ty, EltCnt*2);
ASSERT_TRUE(isa<ScalableVectorType>(ScV8Int64Ty));
EXPECT_EQ(ScV8Int64Ty->getNumElements(), 8U);
auto *ScV8Int64Ty =
dyn_cast<ScalableVectorType>(VectorType::get(Int64Ty, EltCnt * 2));
ASSERT_NE(nullptr, ScV8Int64Ty);
EXPECT_EQ(ScV8Int64Ty->getMinNumElements(), 8U);
EXPECT_EQ(ScV8Int64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ScV4Float64Ty = VectorType::get(Float64Ty, EltCnt);
ASSERT_TRUE(isa<ScalableVectorType>(ScV4Float64Ty));
EXPECT_EQ(ScV4Float64Ty->getNumElements(), 4U);
auto *ScV4Float64Ty =
dyn_cast<ScalableVectorType>(VectorType::get(Float64Ty, EltCnt));
ASSERT_NE(nullptr, ScV4Float64Ty);
EXPECT_EQ(ScV4Float64Ty->getMinNumElements(), 4U);
EXPECT_EQ(ScV4Float64Ty->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ExtTy = VectorType::getExtendedElementVectorType(ScV8Int16Ty);
EXPECT_EQ(ExtTy, ScV8Int32Ty);
ASSERT_TRUE(isa<ScalableVectorType>(ExtTy));
EXPECT_EQ(ExtTy->getNumElements(), 8U);
auto *ExtTy = dyn_cast<ScalableVectorType>(
VectorType::getExtendedElementVectorType(ScV8Int16Ty));
EXPECT_VTY_EQ(ExtTy, ScV8Int32Ty);
EXPECT_EQ(ExtTy->getMinNumElements(), 8U);
EXPECT_EQ(ExtTy->getElementType()->getScalarSizeInBits(), 32U);
VectorType *TruncTy = VectorType::getTruncatedElementVectorType(ScV8Int32Ty);
EXPECT_EQ(TruncTy, ScV8Int16Ty);
ASSERT_TRUE(isa<ScalableVectorType>(TruncTy));
EXPECT_EQ(TruncTy->getNumElements(), 8U);
auto *TruncTy = dyn_cast<ScalableVectorType>(
VectorType::getTruncatedElementVectorType(ScV8Int32Ty));
EXPECT_VTY_EQ(TruncTy, ScV8Int16Ty);
EXPECT_EQ(TruncTy->getMinNumElements(), 8U);
EXPECT_EQ(TruncTy->getElementType()->getScalarSizeInBits(), 16U);
VectorType *HalvedTy = VectorType::getHalfElementsVectorType(ScV4Int64Ty);
EXPECT_EQ(HalvedTy, ScV2Int64Ty);
ASSERT_TRUE(isa<ScalableVectorType>(HalvedTy));
EXPECT_EQ(HalvedTy->getNumElements(), 2U);
auto *HalvedTy = dyn_cast<ScalableVectorType>(
VectorType::getHalfElementsVectorType(ScV4Int64Ty));
EXPECT_VTY_EQ(HalvedTy, ScV2Int64Ty);
EXPECT_EQ(HalvedTy->getMinNumElements(), 2U);
EXPECT_EQ(HalvedTy->getElementType()->getScalarSizeInBits(), 64U);
VectorType *DoubledTy = VectorType::getDoubleElementsVectorType(ScV4Int64Ty);
EXPECT_EQ(DoubledTy, ScV8Int64Ty);
ASSERT_TRUE(isa<ScalableVectorType>(DoubledTy));
EXPECT_EQ(DoubledTy->getNumElements(), 8U);
auto *DoubledTy = dyn_cast<ScalableVectorType>(
VectorType::getDoubleElementsVectorType(ScV4Int64Ty));
EXPECT_VTY_EQ(DoubledTy, ScV8Int64Ty);
EXPECT_EQ(DoubledTy->getMinNumElements(), 8U);
EXPECT_EQ(DoubledTy->getElementType()->getScalarSizeInBits(), 64U);
VectorType *ConvTy = VectorType::getInteger(ScV4Float64Ty);
EXPECT_EQ(ConvTy, ScV4Int64Ty);
ASSERT_TRUE(isa<ScalableVectorType>(ConvTy));
EXPECT_EQ(ConvTy->getNumElements(), 4U);
auto *ConvTy =
dyn_cast<ScalableVectorType>(VectorType::getInteger(ScV4Float64Ty));
EXPECT_VTY_EQ(ConvTy, ScV4Int64Ty);
EXPECT_EQ(ConvTy->getMinNumElements(), 4U);
EXPECT_EQ(ConvTy->getElementType()->getScalarSizeInBits(), 64U);
EltCnt = ScV8Int64Ty->getElementCount();
@ -162,6 +222,57 @@ TEST(VectorTypesTest, Scalable) {
ASSERT_TRUE(EltCnt.Scalable);
}
TEST(VectorTypesTest, BaseVectorType) {
LLVMContext Ctx;
Type *Int16Ty = Type::getInt16Ty(Ctx);
Type *Int32Ty = Type::getInt32Ty(Ctx);
std::array<VectorType *, 8> VTys = {VectorType::get(Int16Ty, {4, true}),
VectorType::get(Int16Ty, {4, false}),
VectorType::get(Int16Ty, {2, true}),
VectorType::get(Int16Ty, {2, false}),
VectorType::get(Int32Ty, {4, true}),
VectorType::get(Int32Ty, {4, false}),
VectorType::get(Int32Ty, {2, true}),
VectorType::get(Int32Ty, {2, false})};
/*
The comparison matrix is symmetric, so we only check the upper triangle:
(0,0) (0,1) (0,2) ... (0,7)
(1,0) (1,1) (1,2) .
(2,0) (2,1) (2,2) .
. . .
. .
. .
(7,0) ... (7,7)
*/
for (size_t I = 0, IEnd = VTys.size(); I < IEnd; ++I) {
// test I == J
VectorType *VI = VTys[I];
ElementCount ECI = VI->getElementCount();
EXPECT_EQ(isa<ScalableVectorType>(VI), ECI.Scalable);
for (size_t J = I + 1, JEnd = VTys.size(); J < JEnd; ++J) {
// test I < J
VectorType *VJ = VTys[J];
ElementCount ECJ = VJ->getElementCount();
EXPECT_VTY_NE(VI, VJ);
VectorType *VJPrime = VectorType::get(VI->getElementType(), VJ);
if (VI->getElementType() == VJ->getElementType()) {
EXPECT_VTY_EQ(VJ, VJPrime);
} else {
EXPECT_VTY_NE(VJ, VJPrime);
}
EXPECT_EQ(VJ->getTypeID(), VJPrime->getTypeID())
<< "VJ and VJPrime are the same sort of vector";
}
}
}
TEST(VectorTypesTest, FixedLenComparisons) {
LLVMContext Ctx;
DataLayout DL("");
@ -169,10 +280,10 @@ TEST(VectorTypesTest, FixedLenComparisons) {
Type *Int32Ty = Type::getInt32Ty(Ctx);
Type *Int64Ty = Type::getInt64Ty(Ctx);
VectorType *V2Int32Ty = VectorType::get(Int32Ty, 2);
VectorType *V4Int32Ty = VectorType::get(Int32Ty, 4);
auto *V2Int32Ty = FixedVectorType::get(Int32Ty, 2);
auto *V4Int32Ty = FixedVectorType::get(Int32Ty, 4);
VectorType *V2Int64Ty = VectorType::get(Int64Ty, 2);
auto *V2Int64Ty = FixedVectorType::get(Int64Ty, 2);
TypeSize V2I32Len = V2Int32Ty->getPrimitiveSizeInBits();
EXPECT_EQ(V2I32Len.getKnownMinSize(), 64U);
@ -192,18 +303,15 @@ TEST(VectorTypesTest, FixedLenComparisons) {
V4Int32Ty->getPrimitiveSizeInBits().getFixedSize());
// Check the DataLayout interfaces.
EXPECT_EQ(DL.getTypeSizeInBits(V2Int64Ty),
DL.getTypeSizeInBits(V4Int32Ty));
EXPECT_EQ(DL.getTypeSizeInBits(V2Int64Ty), DL.getTypeSizeInBits(V4Int32Ty));
EXPECT_EQ(DL.getTypeSizeInBits(V2Int32Ty), 64U);
EXPECT_EQ(DL.getTypeSizeInBits(V2Int64Ty), 128U);
EXPECT_EQ(DL.getTypeStoreSize(V2Int64Ty),
DL.getTypeStoreSize(V4Int32Ty));
EXPECT_EQ(DL.getTypeStoreSize(V2Int64Ty), DL.getTypeStoreSize(V4Int32Ty));
EXPECT_NE(DL.getTypeStoreSizeInBits(V2Int32Ty),
DL.getTypeStoreSizeInBits(V2Int64Ty));
EXPECT_EQ(DL.getTypeStoreSizeInBits(V2Int32Ty), 64U);
EXPECT_EQ(DL.getTypeStoreSize(V2Int64Ty), 16U);
EXPECT_EQ(DL.getTypeAllocSize(V4Int32Ty),
DL.getTypeAllocSize(V2Int64Ty));
EXPECT_EQ(DL.getTypeAllocSize(V4Int32Ty), DL.getTypeAllocSize(V2Int64Ty));
EXPECT_NE(DL.getTypeAllocSizeInBits(V2Int32Ty),
DL.getTypeAllocSizeInBits(V2Int64Ty));
EXPECT_EQ(DL.getTypeAllocSizeInBits(V4Int32Ty), 128U);
@ -218,10 +326,10 @@ TEST(VectorTypesTest, ScalableComparisons) {
Type *Int32Ty = Type::getInt32Ty(Ctx);
Type *Int64Ty = Type::getInt64Ty(Ctx);
VectorType *ScV2Int32Ty = VectorType::get(Int32Ty, {2, true});
VectorType *ScV4Int32Ty = VectorType::get(Int32Ty, {4, true});
auto *ScV2Int32Ty = ScalableVectorType::get(Int32Ty, 2);
auto *ScV4Int32Ty = ScalableVectorType::get(Int32Ty, 4);
VectorType *ScV2Int64Ty = VectorType::get(Int64Ty, {2, true});
auto *ScV2Int64Ty = ScalableVectorType::get(Int64Ty, 2);
TypeSize ScV2I32Len = ScV2Int32Ty->getPrimitiveSizeInBits();
EXPECT_EQ(ScV2I32Len.getKnownMinSize(), 64U);
@ -240,14 +348,12 @@ TEST(VectorTypesTest, ScalableComparisons) {
EXPECT_EQ(DL.getTypeSizeInBits(ScV2Int64Ty),
DL.getTypeSizeInBits(ScV4Int32Ty));
EXPECT_EQ(DL.getTypeSizeInBits(ScV2Int32Ty).getKnownMinSize(), 64U);
EXPECT_EQ(DL.getTypeStoreSize(ScV2Int64Ty),
DL.getTypeStoreSize(ScV4Int32Ty));
EXPECT_EQ(DL.getTypeStoreSize(ScV2Int64Ty), DL.getTypeStoreSize(ScV4Int32Ty));
EXPECT_NE(DL.getTypeStoreSizeInBits(ScV2Int32Ty),
DL.getTypeStoreSizeInBits(ScV2Int64Ty));
EXPECT_EQ(DL.getTypeStoreSizeInBits(ScV2Int32Ty).getKnownMinSize(), 64U);
EXPECT_EQ(DL.getTypeStoreSize(ScV2Int64Ty).getKnownMinSize(), 16U);
EXPECT_EQ(DL.getTypeAllocSize(ScV4Int32Ty),
DL.getTypeAllocSize(ScV2Int64Ty));
EXPECT_EQ(DL.getTypeAllocSize(ScV4Int32Ty), DL.getTypeAllocSize(ScV2Int64Ty));
EXPECT_NE(DL.getTypeAllocSizeInBits(ScV2Int32Ty),
DL.getTypeAllocSizeInBits(ScV2Int64Ty));
EXPECT_EQ(DL.getTypeAllocSizeInBits(ScV4Int32Ty).getKnownMinSize(), 128U);
@ -260,8 +366,8 @@ TEST(VectorTypesTest, CrossComparisons) {
Type *Int32Ty = Type::getInt32Ty(Ctx);
VectorType *V4Int32Ty = VectorType::get(Int32Ty, {4, false});
VectorType *ScV4Int32Ty = VectorType::get(Int32Ty, {4, true});
auto *V4Int32Ty = FixedVectorType::get(Int32Ty, 4);
auto *ScV4Int32Ty = ScalableVectorType::get(Int32Ty, 4);
// Even though the minimum size is the same, a scalable vector could be
// larger so we don't consider them to be the same size.