This patch adds a DAG combine fold for a sext(masked_load) into a sign extended masked load.
Details
Diff Detail
Event Timeline
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
11131 | I think you need to check for hasOneUse. And maybe with more of the checks from the above fold (sext_inreg (zextload x)) case too, like checking types match and maybe for legal masked loads. | |
llvm/test/CodeGen/Thumb2/sext-masked-load.ll | ||
23 | Can you simplify this down to just a llvm.masked.load.v4i16.p0v4i16 and a sitofp ? If so can you also add some other tests for different types and for uitofp. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
11131 | OK. tryToFoldExtOfMaskedLoad and the load fold above both have a isLoadExtLegal check. That does seem to make some assumptions, but they seem to be valid so far. It would be a strange architecture that included zext/anyext masked loads, but didn't include sext masked loads. But even if just for consistency it sounds like it would be worth included that isLoadExtLegal check too. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
11132 | This needs a bit of a clang-format. | |
llvm/test/CodeGen/Thumb2/sext-masked-load.ll | ||
4 | Can you add tests for these legal types: I think it's worth having some illegal types too, Maybe something like a 4xi32 -> double? And can you then replicate them for uitofp too. If I'm right that might need some fixup too, but it may be better to handle that in a different patch. Oh, and do mind moving the test to llvm/test/CodeGen/Thumb2/mve-sext-masked-load.ll to keep it with the others MVE test. |
Add more tests and clean up checks in visitSIGN_EXTEND_INREG
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
11132 | +1 | |
llvm/test/CodeGen/Thumb2/sext-masked-load.ll | ||
4 | I've added those tests, thanks for the suggestions (I already had a 4xi16 -> float test, if I understand correctly). I'd prefer to handle the uitofp cases in a separate patch too. |
llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp | ||
---|---|---|
11132 | Hmm. One last thing... If the extension type is a SEXTLOAD, should we be removing the sign_ext_inreg anyway? | |
llvm/test/CodeGen/Thumb2/mve-sext-masked-load.ll | ||
2 ↗ | (On Diff #280917) | You likely don't need -tail-predication=enabled any more. |
Remove -tail-predication option from test and change SEXTLOAD to NON_EXTLOAD in DAGCombiner check.
I think you need to check for hasOneUse. And maybe with more of the checks from the above fold (sext_inreg (zextload x)) case too, like checking types match and maybe for legal masked loads.