[llvm] be2ecee - [SystemZ] Use isShiftedMask_64 instead of isStringOfOnes (NFC)
Kazu Hirata via llvm-commits
llvm-commits at lists.llvm.org
Mon Jan 23 22:48:48 PST 2023
Author: Kazu Hirata
Date: 2023-01-23T22:48:42-08:00
New Revision: be2ecee046baf5afccc0a3d5193f59608adeae7b
URL: https://github.com/llvm/llvm-project/commit/be2ecee046baf5afccc0a3d5193f59608adeae7b
DIFF: https://github.com/llvm/llvm-project/commit/be2ecee046baf5afccc0a3d5193f59608adeae7b.diff
LOG: [SystemZ] Use isShiftedMask_64 instead of isStringOfOnes (NFC)
isStringOfOnes does the same thing as isShiftedMask_64, provided that
the parameter is nonzero, which is the case for both calls in this
patch.
Added:
Modified:
llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
Removed:
################################################################################
diff --git a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
index 1888f63e4467a..2b9210f102de4 100644
--- a/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
+++ b/llvm/lib/Target/SystemZ/SystemZInstrInfo.cpp
@@ -1711,20 +1711,6 @@ unsigned SystemZInstrInfo::getLoadAndTest(unsigned Opcode) const {
}
}
-// Return true if Mask matches the regexp 0*1+0*, given that zero masks
-// have already been filtered out. Store the first set bit in LSB and
-// the number of set bits in Length if so.
-static bool isStringOfOnes(uint64_t Mask, unsigned &LSB, unsigned &Length) {
- unsigned First = findFirstSet(Mask);
- uint64_t Top = (Mask >> First) + 1;
- if ((Top & -Top) == Top) {
- LSB = First;
- Length = findFirstSet(Top);
- return true;
- }
- return false;
-}
-
bool SystemZInstrInfo::isRxSBGMask(uint64_t Mask, unsigned BitSize,
unsigned &Start, unsigned &End) const {
// Reject trivial all-zero masks.
@@ -1735,7 +1721,7 @@ bool SystemZInstrInfo::isRxSBGMask(uint64_t Mask, unsigned BitSize,
// Handle the 1+0+ or 0+1+0* cases. Start then specifies the index of
// the msb and End specifies the index of the lsb.
unsigned LSB, Length;
- if (isStringOfOnes(Mask, LSB, Length)) {
+ if (isShiftedMask_64(Mask, LSB, Length)) {
Start = 63 - (LSB + Length - 1);
End = 63 - LSB;
return true;
@@ -1743,7 +1729,7 @@ bool SystemZInstrInfo::isRxSBGMask(uint64_t Mask, unsigned BitSize,
// Handle the wrap-around 1+0+1+ cases. Start then specifies the msb
// of the low 1s and End specifies the lsb of the high 1s.
- if (isStringOfOnes(Mask ^ allOnes(BitSize), LSB, Length)) {
+ if (isShiftedMask_64(Mask ^ allOnes(BitSize), LSB, Length)) {
assert(LSB > 0 && "Bottom bit must be set");
assert(LSB + Length < BitSize && "Top bit must be set");
Start = 63 - (LSB - 1);
More information about the llvm-commits
mailing list