[PATCH] D133671: [GlobalISel][Legalizer] Fix minScalarEltSameAsIf to handle p0 element types.
Amara Emerson via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 12 16:01:47 PDT 2022
This revision was automatically updated to reflect the committed changes.
Closed by commit rG25bcc8c7974e: [GlobalISel][Legalizer] Fix minScalarEltSameAsIf to handle p0 element types. (authored by aemerson).
Changed prior to commit:
https://reviews.llvm.org/D133671?vs=459374&id=459584#toc
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D133671/new/
https://reviews.llvm.org/D133671
Files:
llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
llvm/unittests/CodeGen/GlobalISel/LegalizerInfoTest.cpp
Index: llvm/unittests/CodeGen/GlobalISel/LegalizerInfoTest.cpp
===================================================================
--- llvm/unittests/CodeGen/GlobalISel/LegalizerInfoTest.cpp
+++ llvm/unittests/CodeGen/GlobalISel/LegalizerInfoTest.cpp
@@ -241,6 +241,7 @@
const LLT v2s64 = LLT::fixed_vector(2, 64);
const LLT p0 = LLT::pointer(0, 32);
+ const LLT v2p0 = LLT::fixed_vector(2, p0);
const LLT v3p0 = LLT::fixed_vector(3, p0);
const LLT v4p0 = LLT::fixed_vector(4, p0);
@@ -427,6 +428,21 @@
EXPECT_ACTION(FewerElements, 0, s16,
LegalityQuery(G_ADD, {LLT::scalable_vector(8, 16)}));
}
+
+ // Test minScalarEltSameAsIf
+ {
+ LegalizerInfo LI;
+ auto &LegacyInfo = LI.getLegacyLegalizerInfo();
+
+ LI.getActionDefinitionsBuilder(G_SELECT).minScalarEltSameAsIf(
+ all(isVector(0), isVector(1)), 1, 0);
+ LegacyInfo.computeTables();
+ LLT p1 = LLT::pointer(1, 32);
+ LLT v2p1 = LLT::fixed_vector(2, p1);
+
+ EXPECT_ACTION(WidenScalar, 1, v2s32, LegalityQuery(G_SELECT, {v2p0, v2s1}));
+ EXPECT_ACTION(WidenScalar, 1, v2s32, LegalityQuery(G_SELECT, {v2p1, v2s1}));
+ }
}
TEST(LegalizerInfoTest, MMOAlignment) {
Index: llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
===================================================================
--- llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
+++ llvm/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h
@@ -1040,6 +1040,8 @@
},
[=](const LegalityQuery &Query) {
LLT T = Query.Types[LargeTypeIdx];
+ if (T.isVector() && T.getElementType().isPointer())
+ T = T.changeElementType(LLT::scalar(T.getScalarSizeInBits()));
return std::make_pair(TypeIdx, T);
});
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D133671.459584.patch
Type: text/x-patch
Size: 1767 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220912/43505be0/attachment.bin>
More information about the llvm-commits
mailing list