[llvm] r233192 - [Hexagon] Pattern match a CTZ loop into a call to countTrailingZeros.

Benjamin Kramer benny.kra at googlemail.com
Wed Mar 25 08:36:57 PDT 2015


Author: d0k
Date: Wed Mar 25 10:36:57 2015
New Revision: 233192

URL: http://llvm.org/viewvc/llvm-project?rev=233192&view=rev
Log:
[Hexagon] Pattern match a CTZ loop into a call to countTrailingZeros.

No functional change intended.

Modified:
    llvm/trunk/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp

Modified: llvm/trunk/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp?rev=233192&r1=233191&r2=233192&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp Wed Mar 25 10:36:57 2015
@@ -1137,10 +1137,7 @@ SDNode *HexagonDAGToDAGISel::SelectBitOp
       return SelectCode(N);
 
     // Get the bit position.
-    while (!(Val & 1)) {
-      Val >>= 1;
-      ++bitpos;
-    }
+    bitpos = countTrailingZeros(uint64_t(Val));
   } else {
     // For fabs and fneg, it's always the 31st bit.
     bitpos = 31;





More information about the llvm-commits mailing list