[llvm] 13d58ff - [RISCV] Replace call to APInt::countTrailingZeros with uint64_t verson. NFC

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Sun Jul 3 09:01:10 PDT 2022


Author: Craig Topper
Date: 2022-07-03T09:00:01-07:00
New Revision: 13d58ff9f373d812d6e873fbb1d704a47705ebbe

URL: https://github.com/llvm/llvm-project/commit/13d58ff9f373d812d6e873fbb1d704a47705ebbe
DIFF: https://github.com/llvm/llvm-project/commit/13d58ff9f373d812d6e873fbb1d704a47705ebbe.diff

LOG: [RISCV] Replace call to APInt::countTrailingZeros with uint64_t verson. NFC

We know the number of bits is 64 or 32 so we can use the uint64_t
version directly. This saves the APInt needing to check for the
small vs large size.

Added: 
    

Modified: 
    llvm/lib/Target/RISCV/RISCVInstrInfoZb.td

Removed: 
    


################################################################################
diff  --git a/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td b/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
index 9532d1dd3dd2..2b3f736976a4 100644
--- a/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
+++ b/llvm/lib/Target/RISCV/RISCVInstrInfoZb.td
@@ -83,13 +83,13 @@ def shfl_uimm : Operand<XLenVT>, ImmLeaf<XLenVT, [{
 
 def BCLRXForm : SDNodeXForm<imm, [{
   // Find the lowest 0.
-  return CurDAG->getTargetConstant(N->getAPIntValue().countTrailingOnes(),
+  return CurDAG->getTargetConstant(countTrailingOnes(N->getZExtValue()),
                                    SDLoc(N), N->getValueType(0));
 }]>;
 
 def BSETINVXForm : SDNodeXForm<imm, [{
   // Find the lowest 1.
-  return CurDAG->getTargetConstant(N->getAPIntValue().countTrailingZeros(),
+  return CurDAG->getTargetConstant(countTrailingZeros(N->getZExtValue()),
                                    SDLoc(N), N->getValueType(0));
 }]>;
 


        


More information about the llvm-commits mailing list