Skip to content

Commit d5248a4

Browse files
[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).
1 parent b3de316 commit d5248a4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

llvm/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ SDValue SystemZSelectionDAGInfo::EmitTargetCodeForMemset(
108108
if (ByteVal == 0 || ByteVal == 255
109109
? Bytes <= 16 && llvm::popcount(Bytes) <= 2
110110
: Bytes <= 4) {
111-
unsigned Size1 = Bytes == 16 ? 8 : 1 << findLastSet(Bytes);
111+
unsigned Size1 = Bytes == 16 ? 8 : llvm::bit_floor(Bytes);
112112
unsigned Size2 = Bytes - Size1;
113113
SDValue Chain1 = memsetStore(DAG, DL, Chain, Dst, ByteVal, Size1,
114114
Alignment, DstPtrInfo);

0 commit comments

Comments
 (0)