search for: apint

Displaying 20 results from an estimated 418 matches for "apint".

2009 Jan 20
0
[LLVMdev] cygwin build patch
On Jan 20, 2009, at 1:22 AM, Jay Foad wrote: >>> I realise that the DataTypes.h.in part might be controversial. Also, >>> there's probably a better place to put it, but I'm not sure where. >> >> I didn't apply this part. What problems does it cause to not have >> this? Can we fix uses of max and min? > > I could try to fix this by changing
2009 Jan 20
4
[LLVMdev] cygwin build patch
>> I realise that the DataTypes.h.in part might be controversial. Also, >> there's probably a better place to put it, but I'm not sure where. > > I didn't apply this part. What problems does it cause to not have > this? Can we fix uses of max and min? I get these errors in lib: .../lib/Analysis/ValueTracking.cpp:162: error: no matching function for call to
2012 May 21
3
[LLVMdev] APInt::sdivrem error?
I wrote the following bit of code static APInt FloorOfQuotient(APInt a, APInt b) { unsigned bits = a.getBitWidth(); APInt q(bits, 1), r(bits, 1); APInt::sdivrem(a, b, q, r); * errs() << "sdivrem(" << a << ", " << b << ") = (" << q << ", " << r << &...
2012 May 21
0
[LLVMdev] APInt::sdivrem error?
OK, the code for sdivrem in APInt.h is wrong. Here's what's written: static void sdivrem(const APInt &LHS, const APInt &RHS, APInt &Quotient, APInt &Remainder) { if (LHS.isNegative()) { if (RHS.isNegative()) APInt::udivrem(-LHS, -RHS, Quotient, Remainder); else...
2008 Jan 23
0
[LLVMdev] help - needed - compiling llvm-gcc4.2 frontend on cygwin
...char **** I am getting the following error when i am doing 'make all' **** libbackend.a(llvm-convert.o): In function `_ZN18TreeConstantToLLVM15ConvertREAL_CSTEP9tree_node': /cygdrive/d/llvm-svn/llvm-gcc-objdir/gcc/../../llvm-gcc/gcc/llvm-convert.cpp:5939: undefined referece to `llvm::APInt::APInt(unsigned int, unsigned int, unsigned long long const*)' /cygdrive/d/llvm-svn/llvm-gcc-objdir/gcc/../../llvm-gcc/gcc/llvm-convert.cpp:5949: undefined referece to `llvm::APInt::APInt(unsigned int, unsigned int, unsigned long long const*)' libbackend.a(llvm-convert.o): In function `...
2011 Sep 06
2
[LLVMdev] bitwise AND
Hi, I want to compute the bitwise 'and' between two values of type int1:  %x = and %a, %b  . Which is the LLVM instruction that creates this? I only found the APInt class, whose constructor is:  APInt(unsigned numBits, uint64_t val, bool isSigned = false) and which provides the bitwise AND operation: APInt  llvm::APIntOps::And (const APInt &LHS, const APInt &RHS)   Bitwise AND function for APInt. Is this the best way to build the 'and' i...
2009 Aug 20
2
[LLVMdev] error api for APInt / APFloat
I'm breaking this out from LLVM asserts thread. Here are all the assertions in APInt I consider should be recoverable: APInt::APInt: bitwidth too small Null pointer detected! APInt::getBitsNeeded: Invalid string length string is only a minus! Invalid radix APInt::fromString: Radix should be 2, 8, 10, or 16! Invalid string length string is only a minus Insufficient bit width Inva...
2007 Aug 14
1
[LLVMdev] Static functions for APInt
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. Neil. -------------- next part -------------- Index: include/llvm/ADT/APInt.h =================================================================== --- include/llvm/ADT/APInt.h (revisi...
2011 Dec 01
3
[LLVMdev] anchoring explicit template instantiations
...errs() << ProgramName - << ": Bad ValueMask flag! CommandLine usage error:" - << Handler->getValueExpectedFlag() << "\n"; - llvm_unreachable(0); + llvm_unreachable("Bad ValueMask flag!"); } and --- a/lib/Support/APInt.cpp +++ b/lib/Support/APInt.cpp @@ -1440,16 +1440,14 @@ APInt APInt::sqrt() const { APInt nextSquare((x_old + 1) * (x_old +1)); if (this->ult(square)) return x_old; - else if (this->ule(nextSquare)) { + if (this->ule(nextSquare)) { APInt midpoint((nextSquare - square).udi...
2019 Jan 09
2
Assertion error in APInt.cpp
Hi all, I'm experimenting with the Interpreter and all look good so far :) Unfortunately when I play with the visitBinartOperator() method I have the following assertion error: Support/APInt.cpp:233: llvm::APInt llvm::APInt::operator*(const llvm::APInt &) const: Assertion `BitWidth == RHS.BitWidth && "Bit widths must be the same"' failed. I have recompiled llvm and printer the 2 widths. BitWidth is 1 and RHS.BitWidth is 32. I would clarify that in the visitB...
2008 Jan 23
4
[LLVMdev] Complex constant expressions?
...t;> the functionality that's already in LLVM. For example, consider just >> the problem of float to int conversions: >> >> char B[ (int)3.0 ]; >> >> Generating code for this is relatively simple; Converting >> arbitrary-sized APFloats to arbitrary-sized APInts isn't quite as >> easy. >> > > APFloat::convertToInteger does just this. Why can't you use it? > Well, I may be using it wrong. But looking at APFloat.h, I see four functions that purport to convert to integer: opStatus convertToInteger(integerPart *, u...
2011 Jun 22
2
[LLVMdev] ConstantRange::sub
Sure. I will submit a patch. BTW, what's the difference between the bounds I was expecting APInt NewLower = getLower() - Other.getUpper() + 1; APInt NewUpper = getUpper() - Other.getLower(); and the two you mentioned NewLower = Lower - (Upper-1) NewUpper = (Upper-1) - Lower + 1 They look equivalent to me. Did I miss anything? Thanks. - xi On Jun 22, 2011, at 2:39 PM, Nick Lewycky wrote:...
2011 Jun 21
2
[LLVMdev] ConstantRange::sub
Hi, I have a question about ConstantRange::sub(const ConstantRange &Other) at lib/Support/ConstantRange.cpp:524. The code computes the new bounds as follows. APInt NewLower = getLower() - Other.getLower(); APInt NewUpper = getUpper() - Other.getUpper() + 1; Could someone explain this to me? I was expecting something like APInt NewLower = getLower() - Other.getUpper() + 1; APInt NewUpper = getUpper() - Other.getLower(); Thanks. - xi
2011 Dec 01
0
[LLVMdev] anchoring explicit template instantiations
...ommandLine usage error:" > - << Handler->getValueExpectedFlag() << "\n"; > - llvm_unreachable(0); > + llvm_unreachable("Bad ValueMask flag!"); This patch would lose the expected flag value, which is unfortunate. > +++ b/lib/Support/APInt.cpp > @@ -1440,16 +1440,14 @@ APInt APInt::sqrt() const { > APInt nextSquare((x_old + 1) * (x_old +1)); > if (this->ult(square)) > return x_old; > + if (this->ule(nextSquare)) { > APInt midpoint((nextSquare - square).udiv(two)); > APInt offset(*this - squ...
2008 Jan 23
0
[LLVMdev] Complex constant expressions?
...SignExtendedInteger(const integerPart *, > unsigned int, > bool, roundingMode); > opStatus convertFromZeroExtendedInteger(const integerPart *, > unsigned int, > bool, roundingMode); > APInt convertToAPInt() const; > > The first three convert to an array of integer parts, which (as far as I > can tell) is not easily convertible into an APInt via any public methods > I have been able to discover so far. > > The last function doesn't appear to convert the APFloa...
2011 Jul 13
2
[LLVMdev] overflow check
Hi, I have three constants (B, C and V) and V = B + C. I want to find out if B + C wraps around. The way I'll do it is, assuming B and C are both positive, to check if V < B or C. For this I need the values of B, C and V. I tried using APInt as below. *** If (isa<Constant> (B) && isa<Constant> (C) && isa<Constant>(V)) { ConstantInt *CV = dyn_cast<ConstantInt>(V); ConstantInt *CB = dyn_cast<ConstantInt>(B); ConstantInt *CC = dyn_cast<ConstantInt>(C); if (CV &amp...
2009 Aug 20
0
[LLVMdev] error api for APInt / APFloat
On Aug 19, 2009, at 9:36 PM, Erick Tryzelaar wrote: > I'm breaking this out from LLVM asserts thread. Here are all the > assertions in APInt I consider should be recoverable: > > APInt::APInt: > bitwidth too small > Null pointer detected! Hi Eric, As we discussed on IRC, I don't think there is any reason for the implementation of these methods to check these invariants. These are clear API invariants that the call...
2008 Aug 15
3
[LLVMdev] install question
...sing cygwin cygwin% gcc --version gcc (GCC) 3.4.4 (cygming special, gdc 0.12, using dmd 0.125) I downloaded both the top of tree via svn I ran ./configure make make[1]: Entering directory `/cygdrive/c/llvm/lib/Support' llvm[1]: Compiling APFloat.cpp for Debug build llvm[1]: Compiling APInt.cpp for Debug build APInt.cpp: In member function `void llvm::APInt::Profile(llvm::FoldingSetNodeID&) const': APInt.cpp:170: error: call of overloaded `AddInteger(const uint32_t&)' is ambiguous /cygdrive/c/llvm/include/llvm/ADT/FoldingSet.h:216: note: candidates are: void llvm::Fol...
2016 Jul 20
2
Hitting assertion failure related to vectorization + instcombine
...t manage -- but I do have this reduced opt command line (repro.ll also attached, just generated from repro.c at -O0): bin/opt -instcombine -licm -simplifycfg -instcombine -loop-rotate -loop-vectorize -instcombine < repro.ll The failure is: opt: /scratch/1/ismail/llvm-upstream/include/llvm/ADT/APInt.h:983: bool llvm::APInt::operator==(const llvm::APInt&) const: Assertion `BitWidth == RHS.BitWidth && "Comparison requires equal bit widths"' failed. ...snip... #8 0x00000000013a8553 llvm::APInt::operator==(llvm::APInt const&) const /scratch/1/ismail/llvm-upstream/incl...
2008 Aug 21
3
[LLVMdev] Fix build on GCC 4.3
Index: include/llvm/ADT/APInt.h =================================================================== --- include/llvm/ADT/APInt.h (revision 55101) +++ include/llvm/ADT/APInt.h (working copy) @@ -20,6 +20,7 @@ #include <cassert> #include <iosfwd> #include <string> +#include <cstring> namespace l...