[RISCV] Use uint64_t countTrailingZeros/Ones instead of APInt. NFC
authorCraig Topper <craig.topper@sifive.com>
Tue, 30 Aug 2022 19:37:00 +0000 (12:37 -0700)
committerCraig Topper <craig.topper@sifive.com>
Tue, 30 Aug 2022 19:39:36 +0000 (12:39 -0700)
We know the type is 32 or 64 bits, we can use getZExtValue and
bypass the slow path check in APInt.

llvm/lib/Target/RISCV/RISCVInstrInfo.td

index ab68210..4a1acd5 100644 (file)
@@ -431,13 +431,13 @@ def AddiPairImmLarge : SDNodeXForm<imm, [{
 }]>;
 
 def TrailingZeros : SDNodeXForm<imm, [{
-  return CurDAG->getTargetConstant(N->getAPIntValue().countTrailingZeros(),
+  return CurDAG->getTargetConstant(countTrailingZeros(N->getZExtValue()),
                                    SDLoc(N), N->getValueType(0));
 }]>;
 
 def XLenSubTrailingOnes : SDNodeXForm<imm, [{
   uint64_t XLen = Subtarget->getXLen();
-  uint64_t TrailingOnes = N->getAPIntValue().countTrailingOnes();
+  uint64_t TrailingOnes = countTrailingOnes(N->getZExtValue());
   return CurDAG->getTargetConstant(XLen - TrailingOnes, SDLoc(N),
                                    N->getValueType(0));
 }]>;