This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Expand BitPermutation to handle cases of the single immediate 'and'.
Needs ReviewPublic

Authored by Esme on Dec 29 2020, 2:27 AM.

Details

Reviewers
steven.zhang
shchenz
hfinkel
nemanjai
qiucf
lkail
jsji
Group Reviewers
Restricted Project
Summary

We have an overall procedure, the BitPermutation, to optimize ROTL, SHL, SRL, AND and OR. It builds up a list of collected and sorted bit groups and then ISel the entire permutation using a combination of masked rotations.

Currently BitPermutation excludes the input of a single immediate 'and', which will be transformed later through analyzing the patterns, ie. handled by the tryAs__() functions. However these patterns can only cover some specific cases, and for some other cases, BitPermutation can use fewer instructions for matching. Besides, I think it's reasonable to perform these transformations within BitPermutation since they have similar semantics with the BitPermutation.

This patch is trying to expand the BitPermutation to handle the case of single immediate 'and', therefore we can optimize more cases than the enumerated patterns.

Diff Detail

Event Timeline

Esme created this revision.Dec 29 2020, 2:27 AM
Esme requested review of this revision.Dec 29 2020, 2:27 AM
Herald added a project: Restricted Project. · View Herald TranscriptDec 29 2020, 2:27 AM
qiucf added inline comments.Feb 22 2021, 1:04 AM
llvm/lib/Target/PowerPC/PPCISelDAGToDAG.cpp
1700

stratege -> strategy?

1714

Although it's nit, I believe it's better to remove +1 on both sides, and simply comment here that andc is needed for NumSelect case.

2119

Use if instead of else if? since each conditional block in this function always returns.

4517

This case "can't be handled by BitPerm" && "can't be handled by TableGen"?

jsji resigned from this revision.Jun 2 2022, 7:46 AM
Herald added a project: Restricted Project. · View Herald TranscriptJun 2 2022, 7:46 AM