[llvm-commits] [llvm] r51999 - /llvm/trunk/lib/Support/APInt.cpp

Zhou Sheng zhousheng00 at gmail.com
Thu Jun 5 06:27:40 PDT 2008


Author: sheng
Date: Thu Jun  5 08:27:38 2008
New Revision: 51999

URL: http://llvm.org/viewvc/llvm-project?rev=51999&view=rev
Log:
As comments said, for negative value, the arithmetic 
over-shift-right should return -1. So here it should be signed-extended,
when bitwidth larger than 64.

test case: llvm/test/ExecutionEngine/2008-06-05-APInt-OverAShr.ll

Modified:
    llvm/trunk/lib/Support/APInt.cpp

Modified: llvm/trunk/lib/Support/APInt.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Support/APInt.cpp?rev=51999&r1=51998&r2=51999&view=diff

==============================================================================
--- llvm/trunk/lib/Support/APInt.cpp (original)
+++ llvm/trunk/lib/Support/APInt.cpp Thu Jun  5 08:27:38 2008
@@ -1113,7 +1113,7 @@
   // issues in the algorithm below.
   if (shiftAmt == BitWidth) {
     if (isNegative())
-      return APInt(BitWidth, -1ULL);
+      return APInt(BitWidth, -1ULL, true);
     else
       return APInt(BitWidth, 0);
   }





More information about the llvm-commits mailing list