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

WÁNG Xuěruì via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 10 01:52:54 PDT 2022


xen0n 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));
----------------
`switch (NumOp)`?


================
Comment at: llvm/lib/Target/LoongArch/LoongArchISelLowering.h:47
 
+  // Byte counting operations
+  CLZW,
----------------
nit: `Bit counting`


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


================
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)>;
----------------
no need to guard with `Predicates = [IsLA32]`?


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