[llvm][VFABI] Add more testing for LLVM internal mangling.
authorFrancesco Petrogalli <francesco.petrogalli@arm.com>
Fri, 6 Dec 2019 20:32:18 +0000 (20:32 +0000)
committerFrancesco Petrogalli <francesco.petrogalli@arm.com>
Mon, 9 Dec 2019 15:49:45 +0000 (15:49 +0000)
Summary:
The tests cover the internal mangling for:

1. Masked signatures.
2. Scalable signatures.
3. Masked scalable signatures with linear.

Reviewers: andwar

Subscribers: llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D71146

llvm/unittests/Analysis/VectorFunctionABITest.cpp

index ccf996b..6aaa38c 100644 (file)
@@ -447,6 +447,45 @@ TEST_F(VFABIParserTest, ParseMaskingAVX512) {
   EXPECT_EQ(ScalarName, "sin");
 }
 
+TEST_F(VFABIParserTest, ParseMaskingLLVM) {
+  EXPECT_TRUE(invokeParser("_ZGV_LLVM_M2v_sin(custom_vector_sin)"));
+  EXPECT_EQ(VF, (unsigned)2);
+  EXPECT_TRUE(IsMasked());
+  EXPECT_FALSE(IsScalable);
+  EXPECT_EQ(ISA, VFISAKind::LLVM);
+  EXPECT_EQ(Parameters.size(), (unsigned)2);
+  EXPECT_EQ(Parameters[0], VFParameter({0, VFParamKind::Vector}));
+  EXPECT_EQ(Parameters[1], VFParameter({1, VFParamKind::GlobalPredicate}));
+  EXPECT_EQ(ScalarName, "sin");
+  EXPECT_EQ(VectorName, "custom_vector_sin");
+}
+
+TEST_F(VFABIParserTest, ParseScalableMaskingLLVM) {
+  EXPECT_TRUE(invokeParser("_ZGV_LLVM_Mxv_sin(custom_vector_sin)"));
+  EXPECT_TRUE(IsMasked());
+  EXPECT_TRUE(IsScalable);
+  EXPECT_EQ(ISA, VFISAKind::LLVM);
+  EXPECT_EQ(Parameters.size(), (unsigned)2);
+  EXPECT_EQ(Parameters[0], VFParameter({0, VFParamKind::Vector}));
+  EXPECT_EQ(Parameters[1], VFParameter({1, VFParamKind::GlobalPredicate}));
+  EXPECT_EQ(ScalarName, "sin");
+  EXPECT_EQ(VectorName, "custom_vector_sin");
+}
+
+TEST_F(VFABIParserTest, ParseScalableMaskingLLVMSincos) {
+  EXPECT_TRUE(invokeParser("_ZGV_LLVM_Mxvl8l8_sincos(custom_vector_sincos)"));
+  EXPECT_TRUE(IsMasked());
+  EXPECT_TRUE(IsScalable);
+  EXPECT_EQ(ISA, VFISAKind::LLVM);
+  EXPECT_EQ(Parameters.size(), (unsigned)4);
+  EXPECT_EQ(Parameters[0], VFParameter({0, VFParamKind::Vector}));
+  EXPECT_EQ(Parameters[1], VFParameter({1, VFParamKind::OMP_Linear, 8}));
+  EXPECT_EQ(Parameters[2], VFParameter({2, VFParamKind::OMP_Linear, 8}));
+  EXPECT_EQ(Parameters[3], VFParameter({3, VFParamKind::GlobalPredicate}));
+  EXPECT_EQ(ScalarName, "sincos");
+  EXPECT_EQ(VectorName, "custom_vector_sincos");
+}
+
 class VFABIAttrTest : public testing::Test {
 protected:
   void SetUp() override {