[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 03:41:33 PDT 2022
xen0n added a comment.
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.
================
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)>;
----------------
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.
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