llvm.org GIT mirror llvm / dff6e8d
[IR] reduce duplication in unittest for shuffles; NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@342650 91177308-0d34-0410-b5e6-96231b3b80d8 Sanjay Patel 2 years ago
1 changed file(s) with 12 addition(s) and 16 deletion(s). Raw diff Collapse all Expand all
837837 EXPECT_TRUE(ShuffleVectorInst::isTransposeMask(ConstantVector::get({C1, C5, C3, C7})));
838838 EXPECT_TRUE(ShuffleVectorInst::isTransposeMask(ConstantVector::get({C1, C3})));
839839
840 // Nothing special about the values here - just re-using inputs to reduce code.
841 Constant *V0 = ConstantVector::get({C0, C1, C2, C3});
842 Constant *V1 = ConstantVector::get({C3, C2, C1, C0});
843
840844 // Identity with undef elts.
841 ShuffleVectorInst *Id1 = new ShuffleVectorInst(ConstantVector::get({C0, C1, C3, C3}),
842 ConstantVector::get({C0, C1, C2, C3}),
845 ShuffleVectorInst *Id1 = new ShuffleVectorInst(V0, V1,
843846 ConstantVector::get({C0, C1, CU, CU}));
844847 EXPECT_TRUE(Id1->isIdentity());
845848 EXPECT_FALSE(Id1->isIdentityWithPadding());
847850 delete Id1;
848851
849852 // Result has less elements than operands.
850 ShuffleVectorInst *Id2 = new ShuffleVectorInst(ConstantVector::get({C0, C1, C2, C3}),
851 ConstantVector::get({C0, C1, C2, C3}),
853 ShuffleVectorInst *Id2 = new ShuffleVectorInst(V0, V1,
852854 ConstantVector::get({C0, C1, C2}));
853855 EXPECT_FALSE(Id2->isIdentity());
854856 EXPECT_FALSE(Id2->isIdentityWithPadding());
856858 delete Id2;
857859
858860 // Result has less elements than operands; choose from Op1.
859 ShuffleVectorInst *Id3 = new ShuffleVectorInst(ConstantVector::get({C0, C1, C2, C3}),
860 ConstantVector::get({C0, C1, C2, C3}),
861 ShuffleVectorInst *Id3 = new ShuffleVectorInst(V0, V1,
861862 ConstantVector::get({C4, CU, C6}));
862863 EXPECT_FALSE(Id3->isIdentity());
863864 EXPECT_FALSE(Id3->isIdentityWithPadding());
865866 delete Id3;
866867
867868 // Result has less elements than operands; choose from Op0 and Op1 is not identity.
868 ShuffleVectorInst *Id4 = new ShuffleVectorInst(ConstantVector::get({C0, C1, C2, C3}),
869 ConstantVector::get({C0, C1, C2, C3}),
869 ShuffleVectorInst *Id4 = new ShuffleVectorInst(V0, V1,
870870 ConstantVector::get({C4, C1, C6}));
871871 EXPECT_FALSE(Id4->isIdentity());
872872 EXPECT_FALSE(Id4->isIdentityWithPadding());
874874 delete Id4;
875875
876876 // Result has more elements than operands, and extra elements are undef.
877 ShuffleVectorInst *Id5 = new ShuffleVectorInst(ConstantVector::get({C0, C1, C2, C3}),
878 ConstantVector::get({C0, C1, C2, C3}),
877 ShuffleVectorInst *Id5 = new ShuffleVectorInst(V0, V1,
879878 ConstantVector::get({CU, C1, C2, C3, CU, CU}));
880879 EXPECT_FALSE(Id5->isIdentity());
881880 EXPECT_TRUE(Id5->isIdentityWithPadding());
883882 delete Id5;
884883
885884 // Result has more elements than operands, and extra elements are undef; choose from Op1.
886 ShuffleVectorInst *Id6 = new ShuffleVectorInst(ConstantVector::get({C0, C1, C2, C3}),
887 ConstantVector::get({C0, C1, C2, C3}),
885 ShuffleVectorInst *Id6 = new ShuffleVectorInst(V0, V1,
888886 ConstantVector::get({C4, C5, C6, CU, CU, CU}));
889887 EXPECT_FALSE(Id6->isIdentity());
890888 EXPECT_TRUE(Id6->isIdentityWithPadding());
892890 delete Id6;
893891
894892 // Result has more elements than operands, but extra elements are not undef.
895 ShuffleVectorInst *Id7 = new ShuffleVectorInst(ConstantVector::get({C0, C1, C2, C3}),
896 ConstantVector::get({C0, C1, C2, C3}),
893 ShuffleVectorInst *Id7 = new ShuffleVectorInst(V0, V1,
897894 ConstantVector::get({C0, C1, C2, C3, CU, C1}));
898895 EXPECT_FALSE(Id7->isIdentity());
899896 EXPECT_FALSE(Id7->isIdentityWithPadding());
901898 delete Id7;
902899
903900 // Result has more elements than operands; choose from Op0 and Op1 is not identity.
904 ShuffleVectorInst *Id8 = new ShuffleVectorInst(ConstantVector::get({C0, C1, C2, C3}),
905 ConstantVector::get({C0, C1, C2, C3}),
901 ShuffleVectorInst *Id8 = new ShuffleVectorInst(V0, V1,
906902 ConstantVector::get({C4, CU, C2, C3, CU, CU}));
907903 EXPECT_FALSE(Id8->isIdentity());
908904 EXPECT_FALSE(Id8->isIdentityWithPadding());