search for: isneg

Displaying 20 results from an estimated 26 matches for "isneg".

Did you mean: sneg
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 APInt::udivrem(-LHS, RHS, Quotient, Remainder); Quotient = -Quotient; Remainder = -Remainder; } else if (RHS.isNegative()) { APInt::udivrem(LHS, -RHS, Quotient, Remainder)...
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 << ")\n"; * if (r == 0) return q; else {
2013 Apr 17
3
[LLVMdev] Patch to compile LLVM with MSVC 2010
...ADT/StringExtras.h===================================================================--- include/llvm/ADT/StringExtras.h (revision 179701)+++ include/llvm/ADT/StringExtras.h (working copy)@@ -84,7 +84,7 @@ return std::string(BufPtr, Buffer+11); } -static inline std::string utostr(uint64_t X, bool isNeg = false) {+static __declspec(noinline) inline std::string utostr(uint64_t X, bool isNeg = false) { char Buffer[21]; char *BufPtr = Buffer+21; Index: lib/Support/Host.cpp===================================================================--- lib/Support/Host.cpp (revision 179701)+++ lib/Support/H...
2013 Apr 18
0
[LLVMdev] Patch to compile LLVM with MSVC 2010
...============================================= > --- include/llvm/ADT/StringExtras.h (revision 179701) > +++ include/llvm/ADT/StringExtras.h (working copy) > @@ -84,7 +84,7 @@ > return std::string(BufPtr, Buffer+11); > } > > -static inline std::string utostr(uint64_t X, bool isNeg = false) { > +static __declspec(noinline) inline std::string utostr(uint64_t X, bool > isNeg = false) { > char Buffer[21]; > char *BufPtr = Buffer+21; > > Index: lib/Support/Host.cpp > =================================================================== > --- lib/Suppor...
2013 Apr 18
2
[LLVMdev] Patch to compile LLVM with MSVC 2010
...========== > > --- include/llvm/ADT/StringExtras.h (revision 179701) > > +++ include/llvm/ADT/StringExtras.h (working copy) > > @@ -84,7 +84,7 @@ > > return std::string(BufPtr, Buffer+11); > > } > > > > -static inline std::string utostr(uint64_t X, bool isNeg = false) { > > +static __declspec(noinline) inline std::string utostr(uint64_t X, bool > > isNeg = false) { > > char Buffer[21]; > > char *BufPtr = Buffer+21; > > > > Index: lib/Support/Host.cpp > > ====================================================...
2013 Apr 18
0
[LLVMdev] Patch to compile LLVM with MSVC 2010
...============== > > --- include/llvm/ADT/StringExtras.h (revision 179701) > > +++ include/llvm/ADT/StringExtras.h (working copy) > > @@ -84,7 +84,7 @@ > > return std::string(BufPtr, Buffer+11); > > } > > > > -static inline std::string utostr(uint64_t X, bool isNeg = false) { > > +static __declspec(noinline) inline std::string utostr(uint64_t X, bool > > isNeg = false) { > > char Buffer[21]; > > char *BufPtr = Buffer+21; > > > > Index: lib/Support/Host.cpp > > ==========================================================...
2009 Jan 02
2
[LLVMdev] new warnings in -r61596
...const std::string&, const char*, unsigned int, bool, unsigned int)': /Volumes/mrs5/net/llvm/llvm/lib/AsmParser/LLParser.cpp:446: warning: 'IsConstant' may be used uninitialized in this function Volumes/mrs5/net/llvm/llvm/lib/Analysis/ScalarEvolution.cpp: In function 'bool isNegative(llvm::SCEVHandle)': /Volumes/mrs5/net/llvm/llvm/lib/Analysis/ScalarEvolution.cpp:2911: warning: control reaches end of non-void function
2015 Mar 25
0
[PATCH] nv50/ir: take postFactor into account when doing peephole optimizations
...ateValue(prog, 0u)); i->src(0).mod = Modifier(0); + i->postFactor = 0; i->setSrc(1, NULL); } else - if (imm0.isInteger(1) || imm0.isInteger(-1)) { + if (!i->postFactor && (imm0.isInteger(1) || imm0.isInteger(-1))) { if (imm0.isNegative()) i->src(t).mod = i->src(t).mod ^ Modifier(NV50_IR_MOD_NEG); i->op = i->src(t).mod.getOp(); @@ -797,7 +801,7 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s) i->src(0).mod = 0; i->setSrc(1, NULL);...
2012 Apr 16
2
[LLVMdev] Representing -ffast-math at the IR level
...ating point number then it must be 'fast'. + return !isa<ConstantFP>(MD->getOperand(0)); Here as well. + if (ConstantFP *CFP0 = dyn_cast_or_null<ConstantFP>(Op0)) { + APFloat Accuracy = CFP0->getValueAPF(); + Assert1(Accuracy.isNormal() && !Accuracy.isNegative(), + "fpmath accuracy not a positive number!", &I); To be pedantic for a moment, zero is not a positive number. What about asserting these individually to give us more clear asserts if they fire? That also makes the string easier to write: "fpmath accuracy is a...
2018 Sep 26
2
[FPEnv] FNEG instruction
...g at foldShuffledBinop(...), so maybe a naive question, but why not do similar shuffle canonicalizations on unary (or ternary) operations? That may be a better fix in the long run. > But glancing at Reassociate.cpp is scarier. It does a lot of stuff like > this: > if (BinaryOperator::isNeg(TheOp) || BinaryOperator::isFNeg(TheOp)) > X = BinaryOperator::getNegArgument(TheOp); > > I think that's going to fail without a (terrible) hack to treat the > proposed fneg as a binop. So that's probably a preliminary requirement: > find all uses of BinaryOperator::isF...
2013 Jul 11
1
[LLVMdev] Scalar Evolution and Loop Trip Count.
...End = A.sge(One) ? (Range.getUpper() - One) : Range.getLower(); // The exit value should be (End+A)/A. APInt ExitVal = (End + A).udiv(A); ConstantInt *ExitValue = ConstantInt::get(SE.getContext(), ExitVal); In gdb, $6 = {BitWidth = 8, {VAL = 254, pVal = 0xfe}} (gdb) p ExitVal.isNegative() $7 = true (gdb) p ExitValue->dump() i8 -2 $8 = void It looks like whenever the value of ExitVal is greater than 128, ExitValue is going to be negative. This makes getBackedgeTakenCount return a negative number, which does not make sense. Any thoughts ? Pranav -- Qualcomm Innovation...
2018 Sep 25
2
[FPEnv] FNEG instruction
On Tue, Sep 25, 2018 at 1:39 PM Sanjay Patel <spatel at rotateright.com> wrote: > I have 1 concern about adding an explicit fneg op to IR: > > Currently, fneg qualifies as a binop in IR (since there's no other way to > represent it), and we have IR transforms that are based on matching that > pattern (m_BinOp). With a proper unary fneg instruction, those transforms >
2015 Jan 01
0
[PATCH] nv50/ir: fold MAD when one of the multiplicands is const
...; } break; + case OP_MAD: + if (imm0.isInteger(0)) { + i->op = OP_MOV; + i->setSrc(0, i->getSrc(2)); + i->setSrc(1, NULL); + i->setSrc(2, NULL); + } else + if (imm0.isInteger(1) || imm0.isInteger(-1)) { + if (imm0.isNegative()) + i->src(t).mod = i->src(t).mod ^ Modifier(NV50_IR_MOD_NEG); + if (s == 0) { + i->setSrc(0, i->getSrc(1)); + i->src(0).mod = i->src(1).mod; + } + i->setSrc(1, i->getSrc(2)); + i->src(1).mod = 0; +...
2012 Apr 16
0
[LLVMdev] Representing -ffast-math at the IR level
...e 'fast'. > + return !isa<ConstantFP>(MD->getOperand(0)); > > Here as well. > > + if (ConstantFP *CFP0 = dyn_cast_or_null<ConstantFP>(Op0)) { > + APFloat Accuracy = CFP0->getValueAPF(); > + Assert1(Accuracy.isNormal() && !Accuracy.isNegative(), > + "fpmath accuracy not a positive number!", &I); > > To be pedantic for a moment, zero is not a positive number. Zero is not allowed. The isNormal call will return false for zero. What about asserting > these individually to give us more clear asserts if the...
2012 Apr 16
0
[LLVMdev] Representing -ffast-math at the IR level
Here's a revised patch, plus patches showing how fpmath metadata could be turned on in clang and dragonegg (it seemed safest for the moment to condition on -ffast-math rather than on one of the flags implied by -ffast-math). Major changes: - The FPMathOperator class can no longer be used to change math settings, only to read them. Currently it can be queried for accuracy info. I split the
2019 Jan 31
2
Behaviour of APInt
I'm having trouble understanding how APInts should be used. The APInt documentation states that it 'is a functional replacement for common case unsigned integer type', but I'm not seeing this because the internal logic is that the value is always treated as negative if the most significant bit is set. I'm interested in an add or sub that could be using a negative value. I
2012 Oct 12
2
[LLVMdev] cmake+ninja build error for compiler-rt sources
...n::Value::isMinusOne() const’: /local/home/mahesha/src/12th_Sep/llvm/projects/compiler-rt/lib/ubsan/ubsan_value.h:158:58: error: ‘getSIntValue’ was not declared in this scope /local/home/mahesha/src/12th_Sep/llvm/projects/compiler-rt/lib/ubsan/ubsan_value.h: In member function ‘bool __ubsan::Value::isNegative() const’: /local/home/mahesha/src/12th_Sep/llvm/projects/compiler-rt/lib/ubsan/ubsan_value.h:163:58: error: ‘getSIntValue’ was not declared in this scope /local/home/mahesha/src/12th_Sep/llvm/projects/compiler-rt/lib/ubsan/ubsan_value.cc: At global scope: /local/home/mahesha/src/12th_Sep/llvm/...
2012 Oct 13
2
[LLVMdev] [cfe-dev] cmake+ninja build error for compiler-rt sources
...al/home/mahesha/src/12th_Sep/llvm/projects/compiler-rt/lib/ubsan/ubsan_value.h:158:58: > > error: ‘getSIntValue’ was not declared in this scope > > > /local/home/mahesha/src/12th_Sep/llvm/projects/compiler-rt/lib/ubsan/ubsan_value.h: > > In member function ‘bool __ubsan::Value::isNegative() const’: > > > /local/home/mahesha/src/12th_Sep/llvm/projects/compiler-rt/lib/ubsan/ubsan_value.h:163:58: > > error: ‘getSIntValue’ was not declared in this scope > > > /local/home/mahesha/src/12th_Sep/llvm/projects/compiler-rt/lib/ubsan/ubsan_value.cc: > > At gl...
2012 Oct 12
0
[LLVMdev] cmake+ninja build error for compiler-rt sources
...() const’: > /local/home/mahesha/src/12th_Sep/llvm/projects/compiler-rt/lib/ubsan/ubsan_value.h:158:58: > error: ‘getSIntValue’ was not declared in this scope > /local/home/mahesha/src/12th_Sep/llvm/projects/compiler-rt/lib/ubsan/ubsan_value.h: > In member function ‘bool __ubsan::Value::isNegative() const’: > /local/home/mahesha/src/12th_Sep/llvm/projects/compiler-rt/lib/ubsan/ubsan_value.h:163:58: > error: ‘getSIntValue’ was not declared in this scope > /local/home/mahesha/src/12th_Sep/llvm/projects/compiler-rt/lib/ubsan/ubsan_value.cc: > At global scope: > /local/home/m...
2014 May 18
1
[PATCH 1/2] nv50/ir: fix s32 x s32 -> high s32 multiply logic
Retrieving the high 32 bits of a signed multiply is rather annoying. It appears that the simplest way to do this is to compute the absolute value of the arguments, and perform a u32 x u32 -> u64 operation. If the arguments' signs differ, then negate the result. Since there is no u64 support in the cvt instruction, we have the perform the 2's complement negation "by hand".