[PATCH] D139417: [AArch64] add GlobalIsel support for scalar CNT instruction

Amara Emerson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 5 00:35:41 PST 2023


aemerson accepted this revision.
aemerson added a comment.
This revision is now accepted and ready to land.

LGTM with some simplifications.



================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp:1301
+    auto CTPOP2 = MIRBuilder.buildCTPOP(s64, Split->getOperand(1));
+    auto Add = MIRBuilder.buildAdd(s64, CTPOP1.getReg(0), CTPOP2.getReg(0));
+
----------------
I think you can simplify even further and just do:
`auto Add = MIRBuilder.buildAdd(s64, CTPOP1, CTPOP2);`


================
Comment at: llvm/lib/Target/AArch64/GISel/AArch64LegalizerInfo.cpp:1303
+
+    MIRBuilder.buildZExt(Dst, Add.getReg(0));
+    MI.eraseFromParent();
----------------
Same here, don't need the `getReg(0)`


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D139417



More information about the llvm-commits mailing list