[llvm-commits] [llvm] r141909 - /llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp

Eli Friedman eli.friedman at gmail.com
Thu Oct 13 16:13:35 PDT 2011


Author: efriedma
Date: Thu Oct 13 18:13:35 2011
New Revision: 141909

URL: http://llvm.org/viewvc/llvm-project?rev=141909&view=rev
Log:
Fix undefined shifts and abs in Alpha backend.  Based on patch by Ahmed Charles.


Modified:
    llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp

Modified: llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp?rev=141909&r1=141908&r2=141909&view=diff
==============================================================================
--- llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/Alpha/AlphaISelDAGToDAG.cpp Thu Oct 13 18:13:35 2011
@@ -80,7 +80,7 @@
             // 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 @@
       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;





More information about the llvm-commits mailing list