summaryrefslogtreecommitdiff
path: root/lib/Target/Alpha
diff options
context:
space:
mode:
authorEli Friedman <eli.friedman@gmail.com>2011-10-13 23:13:35 +0000
committerEli Friedman <eli.friedman@gmail.com>2011-10-13 23:13:35 +0000
commit5bd7ff2128085ae818b0c21457415cf678011b2a (patch)
tree119372730867f48c1dbcdb9c5256dcd4907fae6b /lib/Target/Alpha
parent7d2bc08254d73c7a083dc5022ebb7c6e8ef9096f (diff)
downloadllvm-5bd7ff2128085ae818b0c21457415cf678011b2a.tar.gz
llvm-5bd7ff2128085ae818b0c21457415cf678011b2a.tar.bz2
llvm-5bd7ff2128085ae818b0c21457415cf678011b2a.tar.xz
Fix undefined shifts and abs in Alpha backend. Based on patch by Ahmed Charles.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@141909 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/Alpha')
-rw-r--r--lib/Target/Alpha/AlphaISelDAGToDAG.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/lib/Target/Alpha/AlphaISelDAGToDAG.cpp b/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
index 7b91fea54a..f877c65cd6 100644
--- a/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
+++ b/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
@@ -80,7 +80,7 @@ namespace {
// Otherwise we don't know that the it's okay to zapnot this entire
// byte. Only do this iff we can prove that the missing bits are
// already null, so the bytezap doesn't need to really null them.
- BitsToCheck |= ~Constant & (0xFF << 8*i);
+ BitsToCheck |= ~Constant & (0xFFULL << 8*i);
}
}
}
@@ -114,9 +114,8 @@ namespace {
if (!x) return 0;
unsigned at = CountLeadingZeros_64(x);
uint64_t complow = 1ULL << (63 - at);
- uint64_t comphigh = 1ULL << (64 - at);
- //cerr << x << ":" << complow << ":" << comphigh << "\n";
- if (abs64(complow - x) <= abs64(comphigh - x))
+ uint64_t comphigh = complow << 1;
+ if (x - complow <= comphigh - x)
return complow;
else
return comphigh;