[PATCH] D131550: [LoongArch] Add codegen support for ISD::CTPOP, ISD::CTTZ and ISD::CTLZ

Gong LingQin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 02:29:47 PDT 2022


gonglingqin added inline comments.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchISelLowering.cpp:394
+
+  if (NumOp == 2) {
+    NewOp0 = DAG.getNode(ExtOpc, DL, MVT::i64, N->getOperand(0));
----------------
xen0n wrote:
> `switch (NumOp)`?
Thanks, I will change that.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchISelLowering.h:47
 
+  // Byte counting operations
+  CLZW,
----------------
xen0n wrote:
> nit: `Bit counting`
Thanks, I will change that.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchISelLowering.h:49
+  CLZW,
+  CTZW,
+
----------------
xen0n wrote:
> Other `*.w` nodes are named `*_W`, so add an underscore for consistency?
Thanks, I will add an underscore.


================
Comment at: llvm/lib/Target/LoongArch/LoongArchInstrInfo.td:698-701
+def : PatGpr<ctlz, CLZ_W>;
+def : PatGpr<cttz, CTZ_W>;
+def : Pat<(ctlz (not GPR:$rj)), (CLO_W GPR:$rj)>;
+def : Pat<(cttz (not GPR:$rj)), (CTO_W GPR:$rj)>;
----------------
xen0n wrote:
> no need to guard with `Predicates = [IsLA32]`?
It needs to guard with Predicates = [IsLA32], I will fix it, thanks.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D131550



More information about the llvm-commits mailing list