summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/ARMISelLowering.cpp
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2013-05-19 22:01:57 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2013-05-19 22:01:57 +0000
commit8bad66e586103a2ca59c98f423f270dbfec131e0 (patch)
tree852ecfd84a1fcb7e10c4c3880c500d9e9246e4b4 /llvm/lib/Target/ARM/ARMISelLowering.cpp
parent86c5469d2675da06ee340f2f55d014ad1c652e16 (diff)
downloadbcm5719-llvm-8bad66e586103a2ca59c98f423f270dbfec131e0.tar.gz
bcm5719-llvm-8bad66e586103a2ca59c98f423f270dbfec131e0.zip
Replace some bit operations with simpler ones. No functionality change.
llvm-svn: 182226
Diffstat (limited to 'llvm/lib/Target/ARM/ARMISelLowering.cpp')
-rw-r--r--llvm/lib/Target/ARM/ARMISelLowering.cpp16
1 files changed, 7 insertions, 9 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelLowering.cpp b/llvm/lib/Target/ARM/ARMISelLowering.cpp
index 479fb777a47..c9ee5fb2029 100644
--- a/llvm/lib/Target/ARM/ARMISelLowering.cpp
+++ b/llvm/lib/Target/ARM/ARMISelLowering.cpp
@@ -10434,17 +10434,15 @@ ARMTargetLowering::isOffsetFoldingLegal(const GlobalAddressSDNode *GA) const {
bool ARM::isBitFieldInvertedMask(unsigned v) {
if (v == 0xffffffff)
- return 0;
+ return false;
+
// there can be 1's on either or both "outsides", all the "inside"
// bits must be 0's
- unsigned int lsb = 0, msb = 31;
- while (v & (1 << msb)) --msb;
- while (v & (1 << lsb)) ++lsb;
- for (unsigned int i = lsb; i <= msb; ++i) {
- if (v & (1 << i))
- return 0;
- }
- return 1;
+ unsigned TO = CountTrailingOnes_32(v);
+ unsigned LO = CountLeadingOnes_32(v);
+ v = (v >> TO) << TO;
+ v = (v << LO) >> LO;
+ return v == 0;
}
/// isFPImmLegal - Returns true if the target can instruction select the
OpenPOWER on IntegriCloud