From 7973346d1672dda58c5ba33918ef38bf707daa42 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Tue, 30 Aug 2022 12:37:00 -0700 Subject: [PATCH] [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. --- llvm/lib/Target/RISCV/RISCVInstrInfo.td | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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)); }]>; -- 2.7.4