1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 02:33:06 +01:00

[SVE] Remove reliance on TypeSize comparison operators in unit tests

The EXPECT_XY comparison functions all rely upon using the existing
TypeSize comparison operators, which we are deprecating in favour
of isKnownXY. I've changed all such cases to compare either the known
minimum size or the fixed size.

Differential Revision: https://reviews.llvm.org/D89531
This commit is contained in:
David Sherwood 2020-10-09 14:29:15 +01:00
parent 35541c396e
commit fcc8ea3de2
2 changed files with 25 additions and 21 deletions

View File

@ -139,19 +139,23 @@ TEST(ScalableVectorMVTsTest, SizeQueries) {
EXPECT_EQ(nxv4i32.getSizeInBits(), nxv2i64.getSizeInBits());
EXPECT_EQ(nxv2f64.getSizeInBits(), nxv2i64.getSizeInBits());
EXPECT_NE(nxv2i32.getSizeInBits(), nxv4i32.getSizeInBits());
EXPECT_LT(nxv2i32.getSizeInBits(), nxv2i64.getSizeInBits());
EXPECT_LE(nxv4i32.getSizeInBits(), nxv2i64.getSizeInBits());
EXPECT_GT(nxv4i32.getSizeInBits(), nxv2i32.getSizeInBits());
EXPECT_GE(nxv2i64.getSizeInBits(), nxv4i32.getSizeInBits());
EXPECT_LT(nxv2i32.getSizeInBits().getKnownMinSize(),
nxv2i64.getSizeInBits().getKnownMinSize());
EXPECT_LE(nxv4i32.getSizeInBits().getKnownMinSize(),
nxv2i64.getSizeInBits().getKnownMinSize());
EXPECT_GT(nxv4i32.getSizeInBits().getKnownMinSize(),
nxv2i32.getSizeInBits().getKnownMinSize());
EXPECT_GE(nxv2i64.getSizeInBits().getKnownMinSize(),
nxv4i32.getSizeInBits().getKnownMinSize());
// Check equivalence and ordering on fixed types.
EXPECT_EQ(v4i32.getSizeInBits(), v2i64.getSizeInBits());
EXPECT_EQ(v2f64.getSizeInBits(), v2i64.getSizeInBits());
EXPECT_NE(v2i32.getSizeInBits(), v4i32.getSizeInBits());
EXPECT_LT(v2i32.getSizeInBits(), v2i64.getSizeInBits());
EXPECT_LE(v4i32.getSizeInBits(), v2i64.getSizeInBits());
EXPECT_GT(v4i32.getSizeInBits(), v2i32.getSizeInBits());
EXPECT_GE(v2i64.getSizeInBits(), v4i32.getSizeInBits());
EXPECT_LT(v2i32.getFixedSizeInBits(), v2i64.getFixedSizeInBits());
EXPECT_LE(v4i32.getFixedSizeInBits(), v2i64.getFixedSizeInBits());
EXPECT_GT(v4i32.getFixedSizeInBits(), v2i32.getFixedSizeInBits());
EXPECT_GE(v2i64.getFixedSizeInBits(), v4i32.getFixedSizeInBits());
// Check that scalable and non-scalable types with the same minimum size
// are not considered equal.
@ -159,7 +163,7 @@ TEST(ScalableVectorMVTsTest, SizeQueries) {
ASSERT_FALSE(v2i64.getSizeInBits() == nxv2f64.getSizeInBits());
// Check that we can obtain a known-exact size from a non-scalable type.
EXPECT_EQ(v4i32.getSizeInBits(), 128U);
EXPECT_EQ(v4i32.getFixedSizeInBits(), 128U);
EXPECT_EQ(v2i64.getFixedSizeInBits(), 128U);
// Check that we can query the known minimum size for both scalable and

View File

@ -286,10 +286,10 @@ TEST(VectorTypesTest, FixedLenComparisons) {
EXPECT_EQ(V2I32Len.getKnownMinSize(), 64U);
EXPECT_FALSE(V2I32Len.isScalable());
EXPECT_LT(V2Int32Ty->getPrimitiveSizeInBits(),
V4Int32Ty->getPrimitiveSizeInBits());
EXPECT_GT(V2Int64Ty->getPrimitiveSizeInBits(),
V2Int32Ty->getPrimitiveSizeInBits());
EXPECT_LT(V2Int32Ty->getPrimitiveSizeInBits().getFixedSize(),
V4Int32Ty->getPrimitiveSizeInBits().getFixedSize());
EXPECT_GT(V2Int64Ty->getPrimitiveSizeInBits().getFixedSize(),
V2Int32Ty->getPrimitiveSizeInBits().getFixedSize());
EXPECT_EQ(V4Int32Ty->getPrimitiveSizeInBits(),
V2Int64Ty->getPrimitiveSizeInBits());
EXPECT_NE(V2Int32Ty->getPrimitiveSizeInBits(),
@ -332,14 +332,14 @@ TEST(VectorTypesTest, ScalableComparisons) {
EXPECT_EQ(ScV2I32Len.getKnownMinSize(), 64U);
EXPECT_TRUE(ScV2I32Len.isScalable());
EXPECT_LT(ScV2Int32Ty->getPrimitiveSizeInBits(),
ScV4Int32Ty->getPrimitiveSizeInBits());
EXPECT_GT(ScV2Int64Ty->getPrimitiveSizeInBits(),
ScV2Int32Ty->getPrimitiveSizeInBits());
EXPECT_EQ(ScV4Int32Ty->getPrimitiveSizeInBits(),
ScV2Int64Ty->getPrimitiveSizeInBits());
EXPECT_NE(ScV2Int32Ty->getPrimitiveSizeInBits(),
ScV2Int64Ty->getPrimitiveSizeInBits());
EXPECT_LT(ScV2Int32Ty->getPrimitiveSizeInBits().getKnownMinSize(),
ScV4Int32Ty->getPrimitiveSizeInBits().getKnownMinSize());
EXPECT_GT(ScV2Int64Ty->getPrimitiveSizeInBits().getKnownMinSize(),
ScV2Int32Ty->getPrimitiveSizeInBits().getKnownMinSize());
EXPECT_EQ(ScV4Int32Ty->getPrimitiveSizeInBits().getKnownMinSize(),
ScV2Int64Ty->getPrimitiveSizeInBits().getKnownMinSize());
EXPECT_NE(ScV2Int32Ty->getPrimitiveSizeInBits().getKnownMinSize(),
ScV2Int64Ty->getPrimitiveSizeInBits().getKnownMinSize());
// Check the DataLayout interfaces.
EXPECT_EQ(DL.getTypeSizeInBits(ScV2Int64Ty),