This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Materialize 34-bit constants with pli directly
ClosedPublic

Authored by amyk on Apr 5 2021, 4:23 PM.

Details

Summary

D92879 introduced emitting pli whenever a constant fits within 34-bits on 64-bit mode.

However, the pli instruction is not produced directly. Instead, we materialize
a 34-bit constant in selectI64Imm(), and rely on td pattern matching to instead
produce a pli. This becomes problematic as there is no guarantee that the 34-bit
constant will reach the td pattern selection for pli and it is possible for other
transformations (such as complex bit permutations) to also produce and utilize
the 34-bit constant materialized through selectI64Imm().

This patch instead produces pli on Power10 directly whenever the constant fits
within 34-bits.

Diff Detail

Event Timeline

amyk created this revision.Apr 5 2021, 4:23 PM
amyk requested review of this revision.Apr 5 2021, 4:23 PM
nemanjai accepted this revision.Apr 6 2021, 5:42 AM

LGTM with a comment-related nit.

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

Nit: this clearly doesn't apply any longer. Please updated it.

This revision is now accepted and ready to land.Apr 6 2021, 5:42 AM
nemanjai added inline comments.Apr 6 2021, 5:45 AM
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
4877–4878

This may no longer be necessary, but this isn't something you necessarily have to address in this patch.

amyk updated this revision to Diff 335550.Apr 6 2021, 11:37 AM

Address review comments:

  • Update the comment for emitting pli directly
  • Remove the case to ReplaceNode() if the resulting node from selectI64Imm() is not a constant.
This revision was landed with ongoing or failed builds.Apr 6 2021, 11:38 AM
This revision was automatically updated to reflect the committed changes.