[PATCH] D55876: [LIR] Add CTTZ support

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 20 13:15:23 PST 2018


craig.topper added inline comments.


================
Comment at: lib/Transforms/Scalar/LoopIdiomRecognize.cpp:1624
+  NewCount = Builder.CreateZExtOrTrunc(
+                      IsCntPhiUsedOutsideLoop ? CountPrev : Count,
+                      cast<IntegerType>(CntInst->getType()));
----------------
Can you add a test case for CntPhiUsedOutsideLoop==true with shl?


================
Comment at: test/Transforms/LoopIdiom/X86/cttz.ll:27
+  %c = icmp sgt i32 %n, 0
+  %negn = sub nsw i32 0, %n
+  %abs_n = select i1 %c, i32 %n, i32 %negn
----------------
Drop the absolute value. Its not necessary. It was only in the existing tests to make ashr work correctly.


Repository:
  rL LLVM

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

https://reviews.llvm.org/D55876





More information about the llvm-commits mailing list