This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Reduce symmetrical swaps for lane-insensitive vector ops
ClosedPublic

Authored by qiucf on Feb 28 2021, 10:04 PM.

Details

Summary

This patch simplifies pattern (xxswap (vec-op (xxswap a) (xxswap b))) into (vec-op a b) if vec-op is lane-insensitive. The motivating case is ScalarToVector-VecOp-ExtractElement sequence on LE, but the peephole itself is not related to endianness, so BE may also benefit from this.

The changed case is diffed for easier review. Remove that part when applying this patch.

Diff Detail

Event Timeline

qiucf created this revision.Feb 28 2021, 10:04 PM
qiucf requested review of this revision.Feb 28 2021, 10:04 PM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 28 2021, 10:04 PM
nemanjai accepted this revision.Mar 8 2021, 5:21 AM

LGTM other than a couple little nits. Thanks for implementing this.

llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
6725

Since the conditions are non-trivial to parse in one's head, a quick and helpful comment goes a long way:

// Single-operand XXPERMDI or the regular XXPERMDI/XXSLDWI where
// the immediate operand is 2.
6789

Is there not an equivalent of lookThruCopyLike() for SDAG?

This revision is now accepted and ready to land.Mar 8 2021, 5:21 AM
qiucf marked an inline comment as done.Mar 9 2021, 11:28 PM
qiucf added inline comments.
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
6789

I did not see such method in DAG level yet. Will leave a TODO here in case we need it again in the future.

This revision was landed with ongoing or failed builds.Mar 9 2021, 11:29 PM
This revision was automatically updated to reflect the committed changes.