This is an archive of the discontinued LLVM Phabricator instance.

[PowerPC] remove XXSWAPD after load from CP which is a splat value
ClosedPublic

Authored by tingwang on Dec 6 2022, 5:06 PM.

Details

Summary

If the value from constant-pool is a splat value of vector type, do not need swap after load from constant-pool.

Diff Detail

Event Timeline

tingwang created this revision.Dec 6 2022, 5:06 PM
Herald added a project: Restricted Project. · View Herald TranscriptDec 6 2022, 5:06 PM
tingwang requested review of this revision.Dec 6 2022, 5:06 PM
shchenz added inline comments.Dec 7 2022, 12:30 AM
llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
656

Seems for swap XXPERMDI (Immed == 0 || Immed == 3), if the input is a splat constant value, there is also an opportunity to optimize the swap away?

675

Can we also improve these opcodes with splat constant inputs?

tingwang added inline comments.Dec 7 2022, 9:09 PM
llvm/lib/Target/PowerPC/PPCMIPeephole.cpp
656

Sure. I did not see any existing case improved by 0 or 3, and cannot see why we will hit these due to my limited knowledge. Since these two looks no harm to me, I will add them anyway. Thank you for pointing out and let me know if you have any IR case to show.

675

Sure. I will address those in separate patch if there is any opportunity. Thank you!

tingwang updated this revision to Diff 481147.Dec 7 2022, 9:10 PM

Address comment.

shchenz accepted this revision as: shchenz.Dec 13 2022, 5:54 PM

LGTM now. Thanks for the improvement.

This revision is now accepted and ready to land.Dec 13 2022, 5:54 PM
This revision was landed with ongoing or failed builds.Feb 16 2023, 4:22 PM
This revision was automatically updated to reflect the committed changes.