[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 18:46:49 PDT 2022


gonglingqin added a comment.

In D131550#3712086 <https://reviews.llvm.org/D131550#3712086>, @xen0n wrote:

> Seems good to me.
>
> P.S. If this lands after D131512 <https://reviews.llvm.org/D131512> you have to refresh your testcases. But I'd happily rebase if that patch lands after this one too.

Thanks for your reminding. I will refresh my testcases after D131512 <https://reviews.llvm.org/D131512> landed.



================
Comment at: llvm/lib/Target/LoongArch/LoongArchInstrInfo.td:678-685
+def : PatGpr<ctlz, CLZ_D>;
+def : PatGpr<cttz, CTZ_D>;
+def : Pat<(ctlz (not GPR:$rj)), (CLO_D GPR:$rj)>;
+def : Pat<(cttz (not GPR:$rj)), (CTO_D GPR:$rj)>;
+def : PatGpr<loongarch_clzw, CLZ_W>;
+def : PatGpr<loongarch_ctzw, CTZ_W>;
+def : Pat<(loongarch_clzw (not GPR:$rj)), (CLO_W GPR:$rj)>;
----------------
xen0n wrote:
> Okay so after you grouped the LA32 bit-counting ops together it may be better to move this block below, and add a `// Bit counting operations` to describe the two groups of operations. Adding these patterns near the multiplications just for saving an `if Predicates = [IsLA64]` block doesn't help with readability.
Thanks, I will change that.


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