From: Craig Topper Date: Tue, 30 Aug 2022 19:37:00 +0000 (-0700) Subject: [RISCV] Use uint64_t countTrailingZeros/Ones instead of APInt. NFC X-Git-Tag: upstream/17.0.6~34921 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7973346d1672dda58c5ba33918ef38bf707daa42;p=platform%2Fupstream%2Fllvm.git [RISCV] Use uint64_t countTrailingZeros/Ones instead of APInt. NFC We know the type is 32 or 64 bits, we can use getZExtValue and bypass the slow path check in APInt. --- diff --git a/llvm/lib/Target/RISCV/RISCVInstrInfo.td b/llvm/lib/Target/RISCV/RISCVInstrInfo.td index ab68210..4a1acd5 100644 --- a/llvm/lib/Target/RISCV/RISCVInstrInfo.td +++ b/llvm/lib/Target/RISCV/RISCVInstrInfo.td @@ -431,13 +431,13 @@ def AddiPairImmLarge : SDNodeXForm; def TrailingZeros : SDNodeXFormgetTargetConstant(N->getAPIntValue().countTrailingZeros(), + return CurDAG->getTargetConstant(countTrailingZeros(N->getZExtValue()), SDLoc(N), N->getValueType(0)); }]>; def XLenSubTrailingOnes : SDNodeXFormgetXLen(); - uint64_t TrailingOnes = N->getAPIntValue().countTrailingOnes(); + uint64_t TrailingOnes = countTrailingOnes(N->getZExtValue()); return CurDAG->getTargetConstant(XLen - TrailingOnes, SDLoc(N), N->getValueType(0)); }]>;