901540f118 
								
							 
						 
						
							
							
								
								Fixed bug in APInt::Profile() where the BitWidth field was not included in the  
							
							... 
							
							
							
							profile of the APSInt object. This caused unexpected Profile collisions where
none should have occurred.
llvm-svn: 47338 
							
						 
						
							2008-02-19 20:50:41 +00:00  
				
					
						
							
							
								 
						
							
								c354ebddd1 
								
							 
						 
						
							
							
								
								Fix a warning about comparison between signed and unsigned,  
							
							... 
							
							
							
							being consistent with the rest of the APInt implementation.
llvm-svn: 47138 
							
						 
						
							2008-02-14 22:38:45 +00:00  
				
					
						
							
							
								 
						
							
								8b4fa9dc0a 
								
							 
						 
						
							
							
								
								Add countTrailingOnes member functions to APInt.  
							
							... 
							
							
							
							llvm-svn: 47086 
							
						 
						
							2008-02-13 21:11:05 +00:00  
				
					
						
							
							
								 
						
							
								5c75d54c5b 
								
							 
						 
						
							
							
								
								Added FoldingSet style 'profiling' support for APInt.  
							
							... 
							
							
							
							llvm-svn: 46188 
							
						 
						
							2008-01-19 04:23:33 +00:00  
				
					
						
							
							
								 
						
							
								f3ebc3f3d2 
								
							 
						 
						
							
							
								
								Remove attribution from file headers, per discussion on llvmdev.  
							
							... 
							
							
							
							llvm-svn: 45418 
							
						 
						
							2007-12-29 20:36:04 +00:00  
				
					
						
							
							
								 
						
							
								ee6af40c95 
								
							 
						 
						
							
							
								
								Cygwin defines uint32_t as unsigned long. Unbreak call to std::min in this case  
							
							... 
							
							
							
							llvm-svn: 45342 
							
						 
						
							2007-12-24 11:16:47 +00:00  
				
					
						
							
							
								 
						
							
								0b1df1d3da 
								
							 
						 
						
							
							
								
								Don't have APInt.cpp depend upon DerivedTypes.h. This helps with splitting the  
							
							... 
							
							
							
							Support libraries separately into their own module.
llvm-svn: 44852 
							
						 
						
							2007-12-11 06:53:58 +00:00  
				
					
						
							
							
								 
						
							
								893fe3bbd1 
								
							 
						 
						
							
							
								
								Fix PR1816, by correcting the broken definition of APInt::countTrailingZeros.  
							
							... 
							
							
							
							llvm-svn: 44296 
							
						 
						
							2007-11-23 22:42:31 +00:00  
				
					
						
							
							
								 
						
							
								c2c4c7456c 
								
							 
						 
						
							
							
								
								Fix APInt::countTrailingZeros to return BitWidth if the input is zero instead of returning some random large number.  
							
							... 
							
							
							
							llvm-svn: 44294 
							
						 
						
							2007-11-23 22:36:25 +00:00  
				
					
						
							
							
								 
						
							
								7e74b17ad2 
								
							 
						 
						
							
							
								
								Don't attempt to mask no bits  
							
							... 
							
							
							
							llvm-svn: 42909 
							
						 
						
							2007-10-12 15:31:31 +00:00  
				
					
						
							
							
								 
						
							
								b618216e56 
								
							 
						 
						
							
							
								
								Add a new function tcExtract for extracting a bignum from an  
							
							... 
							
							
							
							arbitrary range of bits embedded in the middle of another bignum.
This kind of operation is desirable in many cases of software
floating point, e.g. converting bignum integers to floating point
numbers of fixed precision (you want to extract the precision most
significant bits).
Elsewhere, add an assertion, and exit the shift functions early if
the shift count is zero.
llvm-svn: 42745 
							
						 
						
							2007-10-08 13:47:12 +00:00  
				
					
						
							
							
								 
						
							
								c8b650ab14 
								
							 
						 
						
							
							
								
								Fix and clarify some comments.  
							
							... 
							
							
							
							llvm-svn: 42670 
							
						 
						
							2007-10-06 00:43:45 +00:00  
				
					
						
							
							
								 
						
							
								0ea72a9a91 
								
							 
						 
						
							
							
								
								Generalize tcFullMultiply so that the operands can be of differing  
							
							... 
							
							
							
							part widths.  Also, return the number of parts actually required to
hold the result's value.
Remove an over-cautious condition from rounding of float->hex conversion.
llvm-svn: 42669 
							
						 
						
							2007-10-06 00:24:48 +00:00  
				
					
						
							
							
								 
						
							
								4230512f32 
								
							 
						 
						
							
							
								
								Change APFloat::convertFromInteger to take the incoming  
							
							... 
							
							
							
							bit width instead of number of words allocated, which
makes it actually work for int->APF conversions.
Adjust callers.  Add const to one of the APInt constructors
to prevent surprising match when called with const
argument.
llvm-svn: 42210 
							
						 
						
							2007-09-21 22:09:37 +00:00  
				
					
						
							
							
								 
						
							
								00064e1bab 
								
							 
						 
						
							
							
								
								Do not hide APInt::dump() inside #ifndef NDEBUG.  
							
							... 
							
							
							
							llvm-svn: 42068 
							
						 
						
							2007-09-17 22:24:00 +00:00  
				
					
						
							
							
								 
						
							
								98d3a08d8f 
								
							 
						 
						
							
							
								
								Remove the assumption that FP's are either float or  
							
							... 
							
							
							
							double from some of the many places in the optimizers
it appears, and do something reasonable with x86
long double.
Make APInt::dump() public, remove newline, use it to
dump ConstantSDNode's.
Allow APFloats in FoldingSet.
Expand X86 backend handling of long doubles (conversions
to/from int, mostly).
llvm-svn: 41967 
							
						 
						
							2007-09-14 22:26:36 +00:00  
				
					
						
							
							
								 
						
							
								b0f158cfdf 
								
							 
						 
						
							
							
								
								rename APInt::toString -> toStringUnsigned for symmetry with toStringSigned()  
							
							... 
							
							
							
							Add an APSInt::toString() method.
llvm-svn: 41309 
							
						 
						
							2007-08-23 05:15:32 +00:00  
				
					
						
							
							
								 
						
							
								fe02c1f97f 
								
							 
						 
						
							
							
								
								initial checkin of Neil's APFloat work.  
							
							... 
							
							
							
							llvm-svn: 41203 
							
						 
						
							2007-08-20 22:49:32 +00:00  
				
					
						
							
							
								 
						
							
								6b69568f85 
								
							 
						 
						
							
							
								
								This adds a bunch of static functions that implement unsigned  
							
							... 
							
							
							
							two's complement bignum arithmetic.  They could be used to
implement much of APInt, but the idea is they are enough to
implement APFloat as well, which the current APInt interface
is not suited for.
Patch by Neil Booth!
llvm-svn: 41124 
							
						 
						
							2007-08-16 15:56:55 +00:00  
				
					
						
							
							
								 
						
							
								b6af1aae35 
								
							 
						 
						
							
							
								
								Fix an assertion introduced by my last change to the toString method. We  
							
							... 
							
							
							
							can't use getZExtValue() to extract the low order bits for each digit.
Instead, we need to access the low order word directly.
llvm-svn: 37242 
							
						 
						
							2007-05-19 00:29:55 +00:00  
				
					
						
							
							
								 
						
							
								5c138133b7 
								
							 
						 
						
							
							
								
								Get rid of leading zeros in the output of toString.  
							
							... 
							
							
							
							llvm-svn: 37175 
							
						 
						
							2007-05-17 19:23:02 +00:00  
				
					
						
							
							
								 
						
							
								fffdf10566 
								
							 
						 
						
							
							
								
								For lshr by 0 bits, just return *this as a short cut. This also prevents  
							
							... 
							
							
							
							undefined behavior when the width > 64 bits.
llvm-svn: 37153 
							
						 
						
							2007-05-17 06:26:29 +00:00  
				
					
						
							
							
								 
						
							
								a93c981f66 
								
							 
						 
						
							
							
								
								Fix a bug in the "fromString" method where radix 2,8 and 16 values were  
							
							... 
							
							
							
							not being generated correctly because the shl operator does not mutate its
object but returns a new value. Also, make the distinction between radix
16 and the others more clear.
llvm-svn: 37111 
							
						 
						
							2007-05-16 19:18:22 +00:00  
				
					
						
							
							
								 
						
							
								98ed7db7ab 
								
							 
						 
						
							
							
								
								Make the results for the rotate functions correct when rotateAmt == 0.  
							
							... 
							
							
							
							llvm-svn: 37026 
							
						 
						
							2007-05-14 00:15:28 +00:00  
				
					
						
							
							
								 
						
							
								4c50b52f63 
								
							 
						 
						
							
							
								
								Add some things needed by the llvm-gcc version supporting bit accurate integer  
							
							... 
							
							
							
							types:
1. Functions to compute div/rem at the same time.
2. Further assurance that an APInt with 0 bitwidth cannot be constructed.
3. Left and right rotate operations.
4. An exactLogBase2 function which requires an exact power of two or it
   returns -1.
llvm-svn: 37025 
							
						 
						
							2007-05-13 23:44:59 +00:00  
				
					
						
							
							
								 
						
							
								81ee020f64 
								
							 
						 
						
							
							
								
								Fix shl to produce the correct result when the bitwidth is > 64 and the  
							
							... 
							
							
							
							shift amount is 0. Previously this code would do a lshr by the bit width
which can lead to incorrect results.
llvm-svn: 37010 
							
						 
						
							2007-05-12 18:01:57 +00:00  
				
					
						
							
							
								 
						
							
								dad2d0939c 
								
							 
						 
						
							
							
								
								silence some annoying gcc 4.3 warnings  
							
							... 
							
							
							
							llvm-svn: 36680 
							
						 
						
							2007-05-03 18:15:36 +00:00  
				
					
						
							
							
								 
						
							
								67378b22bb 
								
							 
						 
						
							
							
								
								We want the number of bits needed, not the power of 2.  
							
							... 
							
							
							
							llvm-svn: 35977 
							
						 
						
							2007-04-14 00:00:10 +00:00  
				
					
						
							
							
								 
						
							
								9329e7b626 
								
							 
						 
						
							
							
								
								Implement a getBitsNeeded method to determine how many bits are needed to  
							
							... 
							
							
							
							represent a string in binary form by an APInt.
llvm-svn: 35968 
							
						 
						
							2007-04-13 19:19:07 +00:00  
				
					
						
							
							
								 
						
							
								c49f2ef236 
								
							 
						 
						
							
							
								
								Fix an approximate calculation in an assertion not to give false negatives.  
							
							... 
							
							
							
							llvm-svn: 35901 
							
						 
						
							2007-04-11 13:00:04 +00:00  
				
					
						
							
							
								 
						
							
								0458c1db71 
								
							 
						 
						
							
							
								
								Fix a bug in getAllOnesValue() which broke  
							
							... 
							
							
							
							some test cases for bitwidth > 64.
llvm-svn: 35232 
							
						 
						
							2007-03-21 04:34:37 +00:00  
				
					
						
							
							
								 
						
							
								e06855e684 
								
							 
						 
						
							
							
								
								Fix (and simplify) 48-bit byte swap.  
							
							... 
							
							
							
							Get pos/neg infinity the correct way.
llvm-svn: 35223 
							
						 
						
							2007-03-20 20:42:36 +00:00  
				
					
						
							
							
								 
						
							
								b1ec2e8ec7 
								
							 
						 
						
							
							
								
								Fix coding standards violation.  
							
							... 
							
							
							
							llvm-svn: 35189 
							
						 
						
							2007-03-19 21:19:02 +00:00  
				
					
						
							
							
								 
						
							
								6fae35acd3 
								
							 
						 
						
							
							
								
								Implement extension of sign bits for negative values in the uint64_t  
							
							... 
							
							
							
							constructor. This helps to fix test/Assembler/2007-03-19-NegValue.ll
llvm-svn: 35180 
							
						 
						
							2007-03-19 20:37:47 +00:00  
				
					
						
							
							
								 
						
							
								6223c05805 
								
							 
						 
						
							
							
								
								Revert the last patch as it violates the conditions of sext/zext.  
							
							... 
							
							
							
							llvm-svn: 35068 
							
						 
						
							2007-03-12 18:37:25 +00:00  
				
					
						
							
							
								 
						
							
								3999ffa0c8 
								
							 
						 
						
							
							
								
								For APInt::z/sext(width), if width == BitWidth, just return *this.  
							
							... 
							
							
							
							llvm-svn: 35065 
							
						 
						
							2007-03-12 17:47:45 +00:00  
				
					
						
							
							
								 
						
							
								b622c11f77 
								
							 
						 
						
							
							
								
								Unbreak VC++ build.  
							
							... 
							
							
							
							llvm-svn: 34917 
							
						 
						
							2007-03-05 00:00:42 +00:00  
				
					
						
							
							
								 
						
							
								1825dd0d7c 
								
							 
						 
						
							
							
								
								Fix ashr for bitwidths > 64. This is now validated up to 1024 bits.  
							
							... 
							
							
							
							llvm-svn: 34852 
							
						 
						
							2007-03-02 22:39:11 +00:00  
				
					
						
							
							
								 
						
							
								cf8175617d 
								
							 
						 
						
							
							
								
								Use a better algorithm for rounding sqrt results. Change the FIXME about  
							
							... 
							
							
							
							this to a NOTE: because pari/gp results start to get rounded incorrectly
after 192 bits of precision. APInt and pari/gp never differ by more than
1, but APInt is more accurate because it does not lose precision after 192
bits as does pari/gp.
llvm-svn: 34834 
							
						 
						
							2007-03-02 04:21:55 +00:00  
				
					
						
							
							
								 
						
							
								c44bdae16b 
								
							 
						 
						
							
							
								
								Add a FIXME  
							
							... 
							
							
							
							llvm-svn: 34828 
							
						 
						
							2007-03-02 02:01:34 +00:00  
				
					
						
							
							
								 
						
							
								c442c84c8f 
								
							 
						 
						
							
							
								
								Fix a problem where shifting by 64-bits leads to incorrect results on PPC  
							
							... 
							
							
							
							but not on X86 becuase shift by word size is "undefined".
llvm-svn: 34825 
							
						 
						
							2007-03-02 01:19:42 +00:00  
				
					
						
							
							
								 
						
							
								1b8dfcbaaa 
								
							 
						 
						
							
							
								
								Combine two lines that can be.  
							
							... 
							
							
							
							llvm-svn: 34818 
							
						 
						
							2007-03-01 23:30:25 +00:00  
				
					
						
							
							
								 
						
							
								2f6ad4d3c3 
								
							 
						 
						
							
							
								
								Make the static table of results in sqrt const.  
							
							... 
							
							
							
							llvm-svn: 34791 
							
						 
						
							2007-03-01 17:47:31 +00:00  
				
					
						
							
							
								 
						
							
								742d1704e1 
								
							 
						 
						
							
							
								
								Add methods for bit width modification: sextOrTrunc, zextOrTrunc.  
							
							... 
							
							
							
							llvm-svn: 34789 
							
						 
						
							2007-03-01 17:15:32 +00:00  
				
					
						
							
							
								 
						
							
								c8841d2ea2 
								
							 
						 
						
							
							
								
								Use a real table in sqrt to shorten and quicken the code.  
							
							... 
							
							
							
							Thanks for the idea Chris.
llvm-svn: 34779 
							
						 
						
							2007-03-01 06:23:32 +00:00  
				
					
						
							
							
								 
						
							
								d99feafd5f 
								
							 
						 
						
							
							
								
								Add a square root function.  
							
							... 
							
							
							
							llvm-svn: 34775 
							
						 
						
							2007-03-01 05:39:56 +00:00  
				
					
						
							
							
								 
						
							
								91d3b3fce9 
								
							 
						 
						
							
							
								
								Make the trunc/sext/zext methods return APInt& so that these operations  
							
							... 
							
							
							
							can be chained together with other operations.
llvm-svn: 34743 
							
						 
						
							2007-02-28 17:34:32 +00:00  
				
					
						
							
							
								 
						
							
								66d0d572c2 
								
							 
						 
						
							
							
								
								Fix a bug in RoundDoubleToAPInt where it would force the size to 64 bits  
							
							... 
							
							
							
							instead of honoring the client's requested bit width.
llvm-svn: 34712 
							
						 
						
							2007-02-28 01:30:08 +00:00  
				
					
						
							
							
								 
						
							
								c2d433d47a 
								
							 
						 
						
							
							
								
								Join two lines that can be joined.  
							
							... 
							
							
							
							llvm-svn: 34705 
							
						 
						
							2007-02-27 23:49:07 +00:00  
				
					
						
							
							
								 
						
							
								31acef50ad 
								
							 
						 
						
							
							
								
								Implement countLeadingOnes() and getMinSignedBits(). This helps to minimize  
							
							... 
							
							
							
							the bit width of negative numbers by computing the minimum bit width for a
negative value. E.g. 0x1800000000000000 could be just 0x8000000000000000
llvm-svn: 34695 
							
						 
						
							2007-02-27 21:59:26 +00:00