This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] Enable canCombineStoreAndExtract target hook
AbandonedPublic

Authored by tingwang on Mar 21 2023, 8:30 PM.

Details

Reviewers
shchenz
nemanjai
lkail
qiucf
Group Reviewers
Restricted Project
Summary

PowerPC can do store(extract-element) in one instruction. Enable this hook first, and then combiner may explore this kind of opportunities.

Diff Detail

Event Timeline

tingwang created this revision.Mar 21 2023, 8:30 PM
Herald added a project: Restricted Project. · View Herald TranscriptMar 21 2023, 8:30 PM
tingwang requested review of this revision.Mar 21 2023, 8:30 PM

Thank you. Implementing this function for PPC makes sense to me.

Should we add an opt test since the function is only called in an IR pass? And maybe also good to show the final assembly change with a llc test. See example when the function was introduced in ARM target https://reviews.llvm.org/D5921.

tingwang updated this revision to Diff 509986.Mar 31 2023, 4:20 AM

Address comment: add test case to show the change.

For the most part, the code produced for vector-promotion.ll is worse as we're forcing the operations into the vector space rather than doing it in scalar registers. Perhaps we should return false from this query if the input vector is the result of a load and the only user is the extract instruction. This would of course require that we change the interface of the query to take the extract instruction rather than the type.
The idea is that if we are loading the vector, extracting an element, performing an operation and then storing, we won't really load the vector but will load only the single element. Promoting the operation will force us to load the vector which is counter productive.

llvm/lib/Target/PowerPC/PPCISelLowering.cpp
1632

Why an integer type? stxsd[x]/stfiwx/stxsiwx don't really care about whether the input vector is integer or floating point.

tingwang abandoned this revision.Apr 5 2023, 5:24 PM

Pattern change not good.