[PATCH] D139491: [PowerPC] remove XXSWAPD after load from CP which is a splat value

Ting Wang via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 7 21:09:10 PST 2022


tingwang added inline comments.


================
Comment at: llvm/lib/Target/PowerPC/PPCMIPeephole.cpp:654
               .add(MI.getOperand(1));
+        } else if (Immed == 2 && TII->isLoadFromConstantPool(DefMI)) {
+          const Constant *C = TII->getConstantFromConstantPool(DefMI);
----------------
shchenz wrote:
> 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?
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.


================
Comment at: llvm/lib/Target/PowerPC/PPCMIPeephole.cpp:672
       case PPC::VSPLTH:
       case PPC::XXSPLTW: {
         unsigned MyOpcode = MI.getOpcode();
----------------
shchenz wrote:
> Can we also improve these opcodes with splat constant inputs?
Sure. I will address those in separate patch if there is any opportunity. Thank you!


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D139491/new/

https://reviews.llvm.org/D139491



More information about the llvm-commits mailing list