[llvm] [NFC] Add unit tests for TypeSize:isXBitVector (PR #73131)
Maciej Gabka via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 22 07:07:42 PST 2023
https://github.com/mgabka created https://github.com/llvm/llvm-project/pull/73131
The tests are showing that the current behaviour isn't correct.
>From 3aa7dca3f5fc272a625c1f5a2cb2f1787a138c04 Mon Sep 17 00:00:00 2001
From: Maciej Gabka <maciej.gabka at arm.com>
Date: Wed, 22 Nov 2023 13:42:08 +0000
Subject: [PATCH] [NFC] Add unit tests for TypeSize:isXBitVector
---
llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp b/llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
index 424abb03dc129c9..bddcfaa088b176f 100644
--- a/llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
+++ b/llvm/unittests/CodeGen/ScalableVectorMVTsTest.cpp
@@ -135,6 +135,16 @@ TEST(ScalableVectorMVTsTest, SizeQueries) {
EVT v2i64 = EVT::getVectorVT(Ctx, MVT::i64, 2);
EVT v2f64 = EVT::getVectorVT(Ctx, MVT::f64, 2);
+ EVT nxv5i32 = EVT::getVectorVT(Ctx, MVT::i32, 5, /*Scalable=*/ true);
+ ASSERT_FALSE(nxv5i32.is16BitVector());
+ ASSERT_FALSE(nxv5i32.is32BitVector());
+ ASSERT_FALSE(nxv5i32.is64BitVector());
+ ASSERT_FALSE(nxv5i32.is128BitVector());
+ ASSERT_FALSE(nxv5i32.is256BitVector());
+ ASSERT_FALSE(nxv5i32.is512BitVector());
+ ASSERT_FALSE(nxv5i32.is1024BitVector());
+ ASSERT_FALSE(nxv5i32.is2048BitVector());
+
// Check equivalence and ordering on scalable types.
EXPECT_EQ(nxv4i32.getSizeInBits(), nxv2i64.getSizeInBits());
EXPECT_EQ(nxv2f64.getSizeInBits(), nxv2i64.getSizeInBits());
More information about the llvm-commits
mailing list