[PATCH] D138811: [AArch64] SelectionDag codegen for gpr CTZ instruction

Sam Elliott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Nov 28 07:48:31 PST 2022


lenary added subscribers: paquette, RKSimon.
lenary added inline comments.


================
Comment at: llvm/lib/Target/AArch64/AArch64InstrInfo.td:8499
+
+let Predicates = [HasCSSC] in {
+  def : Pat<(i32 (ctlz (bitreverse GPR32:$Rn))),
----------------
stuij wrote:
> There's a question here if we should move these into dagcombiner and implement likewise for GlobalIsel, or if we should leave this here and have them be picked up by SelDag and GlobalIsel:
We've talked already and my position is that these should be in dagcombiner/globalisel combines, but I'm interested in the views of e.g. @paquette @RKSimon. I realise combines like this might have to be behind hooks given that on some targets, cttz/ctlz of zero is undefined.


================
Comment at: llvm/test/CodeGen/AArch64/gpr_cttz.ll:146
+define i64 @cttz64combine(i64 %x) nounwind readnone {
+  %rev = tail call i64 @llvm.bitreverse.i64(i64 %x)
+  %ctz = tail call i64 @llvm.ctlz.i64(i64 %rev)
----------------
how does this testcase have no CHECK lines?


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D138811



More information about the llvm-commits mailing list