From: Kazu Hirata Date: Wed, 25 Jan 2023 06:10:02 +0000 (-0800) Subject: [SystemZ] Use llvm::bit_floor (NFC) X-Git-Tag: upstream/17.0.6~19711 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d5248a46faed9071adffc65f82cac9bc0769b882;p=platform%2Fupstream%2Fllvm.git [SystemZ] Use llvm::bit_floor (NFC) If x is known to be nonzero, findLastSet(x) returns the index of the highest set bit counting from the LSB, so 1 << findLastSet(x) is the same as llvm::bit_floor(x). --- diff --git a/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp b/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp index 20bab89..4eb58e2 100644 --- a/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp +++ b/llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp @@ -108,7 +108,7 @@ SDValue SystemZSelectionDAGInfo::EmitTargetCodeForMemset( if (ByteVal == 0 || ByteVal == 255 ? Bytes <= 16 && llvm::popcount(Bytes) <= 2 : Bytes <= 4) { - unsigned Size1 = Bytes == 16 ? 8 : 1 << findLastSet(Bytes); + unsigned Size1 = Bytes == 16 ? 8 : llvm::bit_floor(Bytes); unsigned Size2 = Bytes - Size1; SDValue Chain1 = memsetStore(DAG, DL, Chain, Dst, ByteVal, Size1, Alignment, DstPtrInfo);