This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Fix the Predicates for enabling pcrelative-memops and PLXVP/PSTXVP definitions
ClosedPublic

Authored by NeHuang on Oct 19 2020, 1:44 PM.

Details

Summary

In this patch, Predicates fix added to

  • disable prefix-instrs will disable pcrelative-memops (pcrelative-memops imply prefix-instrs)
  • set two predicates PairedVectorMemops and PrefixInstrs for PLXVP/PSTXVP definitions. (previously only guarded by PrefixInstrs)

Diff Detail

Event Timeline

NeHuang created this revision.Oct 19 2020, 1:44 PM
NeHuang requested review of this revision.Oct 19 2020, 1:44 PM
NeHuang added a reviewer: steven.zhang.
amyk accepted this revision.Oct 19 2020, 4:59 PM
amyk added a subscriber: amyk.

I think it overall LGTM.

llvm/lib/Target/PowerPC/PPCInstrPrefix.td
1412

Question: is the hasSideEffects necessary?

This revision is now accepted and ready to land.Oct 19 2020, 4:59 PM

Test is missing. Please add a test to turn off the prefix instr to see if PLXVP disappear. And we have code like this, please double confirm if it is guarded by proper feature.

// If we encounter an LXVP/STXVP with an offset that doesn't fit, we can
// transform it to the prefixed version so we don't have to use the XForm.
if ((OpC == PPC::LXVP || OpC == PPC::STXVP) &&
    (!isInt<16>(Offset) || (Offset % offsetMinAlign(MI)) != 0)) {
  unsigned NewOpc = OpC == PPC::LXVP ? PPC::PLXVP : PPC::PSTXVP;
  MI.setDesc(TII.get(NewOpc));
  OpC = NewOpc;
}
llvm/lib/Target/PowerPC/PPCInstrPrefix.td
1412

Yes, it is needed as load/store instr also may have the sideeffects.

amyk added a comment.Oct 20 2020, 12:07 AM

Agreed that a test should be added.

llvm/lib/Target/PowerPC/PPCInstrPrefix.td
1412

Right. Thanks for clarifying.

NeHuang edited the summary of this revision. (Show Details)Oct 20 2020, 1:06 PM
NeHuang edited the summary of this revision. (Show Details)Oct 20 2020, 3:06 PM
NeHuang updated this revision to Diff 299487.Oct 20 2020, 3:10 PM

Add a test to disable prefix-instrs.

steven.zhang added inline comments.Oct 20 2020, 9:39 PM
llvm/lib/Target/PowerPC/PPCInstrPrefix.td
1412

I don't think there is any semantics difference with this change except that, we clear the sideeffect bit for PLXVP, which is not relative with what you want to do.

NeHuang updated this revision to Diff 299680.Oct 21 2020, 7:21 AM
NeHuang marked 4 inline comments as done.Oct 21 2020, 7:24 AM
NeHuang added inline comments.
llvm/lib/Target/PowerPC/PPCInstrPrefix.td
1412

Agree. Removed hasSideEffects.

steven.zhang added inline comments.Oct 21 2020, 5:00 PM
llvm/lib/Target/PowerPC/PPCInstrPrefix.td
1412

So, do we need to change these lines any more?

steven.zhang accepted this revision.Oct 21 2020, 7:59 PM

LGTM now.

llvm/lib/Target/PowerPC/PPCInstrPrefix.td
1412

Well, it is needed as the different predicates. In fact, what we need to do is just to change the predicates. But it is up to you.

This revision was landed with ongoing or failed builds.Oct 23 2020, 9:34 AM
This revision was automatically updated to reflect the committed changes.
NeHuang marked 3 inline comments as done.