search for: isnegative

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

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
In order to get llvm to compile on Windows with MSVC 10, I have to disable inline on utostr to avoid internal compiler failure, and disable _xgetbv call in OsSupportsAVX because it's only defined in MSVC 2012 compiler. The first patch (noinline) is known for many months now. I'm a casual llvm user, and don't know the proper channels to go through to submit a patch. Could someone tell
2013 Apr 18
0
[LLVMdev] Patch to compile LLVM with MSVC 2010
On Wed, Apr 17, 2013 at 11:36 AM, Sergiy Migdalskiy <migdalskiy at hotmail.com> wrote: > In order to get llvm to compile on Windows with MSVC 10, I have to disable > inline on utostr to avoid internal compiler failure, and disable _xgetbv > call in OsSupportsAVX because it's only defined in MSVC 2012 compiler. The > first patch (noinline) is known for many months now. I'm
2013 Apr 18
2
[LLVMdev] Patch to compile LLVM with MSVC 2010
>From the DeveloperPolicy.html document I gathered I need to send a patch to this list (which I did); could you clarify if I misunderstood it? The second patch is really trivial and I think it's worth applying - it seems like a typo by someone who tested on MSVC 11 but not 10; or maybe my local instance of MSVC10 is somehow deficient, of course. The first patch is adding MSVC-specific
2013 Apr 18
0
[LLVMdev] Patch to compile LLVM with MSVC 2010
The original thread on this ICE, including a link to the bug submitted to MS is here: http://lists.cs.uiuc.edu/pipermail/llvmdev/2012-December/056683.html Michael From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On Behalf Of Sergiy Migdalskiy Sent: Thursday, April 18, 2013 10:28 To: David Blaikie Cc: llvmdev at cs.uiuc.edu Subject: Re: [LLVMdev] Patch to compile LLVM
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); } els...
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 nega...
2018 Sep 26
2
[FPEnv] FNEG instruction
On Tue, Sep 25, 2018 at 7:37 PM Sanjay Patel <spatel at rotateright.com> wrote: > > > On Tue, Sep 25, 2018 at 2:28 PM Cameron McInally <cameron.mcinally at nyu.edu> > wrote: > >> 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: >>>
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 Cente...
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 they fir...
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/proje...
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 global...
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/mahesh...
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".