search for: visitfadd

Displaying 10 results from an estimated 10 matches for "visitfadd".

2017 Mar 20
2
Is it a valid fp transformation?
...dn’t be at issue here. The transform of (float)x + 1 => (float)(x + 1) is bogus. > On Mar 20, 2017, at 10:41 AM, Sanjay Patel via llvm-dev <llvm-dev at lists.llvm.org> wrote: > > Looks broken to me; I don't think there's UB in the original program. > > The fold in visitFAdd() should check if the sitofp is guaranteed to produce an exact result? Ie, if the int value input to the sitofp could possibly be different when converted back using fptosi, then the transform does not work. > > define float @test(i32 %x) { > %mul = mul i32 %x, 58 > %conv = sitofp...
2010 Jul 24
2
[LLVMdev] X + 0.0
Hi! in visitFAdd I found this comment: // Check for X+0.0. Simplify it to X if we know X is not -0.0. Why is it not allowed to simplify X + 0.0 = X when X may be -0.0? Because -0.0 + 0.0 is 0.0 and not -0.0? For me it would be great if strict floating point processing could be switched off (also for X * 0.0 = 0...
2015 Jan 08
3
[LLVMdev] Floating-point range checks
...Take a look at ComputeSignBit in ValueTracking.cpp. This doesn't apply (?) to floating point numbers, but we'd need something equivalent for them. It looks like there may already be a start in the form of: CannotBeNegativeZero Other places to look would be SimplifyFAdd and InstCombine::visitFAdd. For this particular example, you're probably going to want a pattern in SimplifyFCmp of the form: matcher: sqrt_call( fadd(Value(X), SpecificValue(X)), fadd(Value(Y), SpecificValue(Y))) && CannotBeNegativeZero(X) && CannotBeNegativeZero(Y) You might also look at LazyValueInfo...
2017 Mar 20
2
Is it a valid fp transformation?
This C program produces different results with -O0 and -O3 optimization levels. #include <stdio.h> float test(unsigned int arg) { return (float)((int)(arg * 58)) + 1; } int main() { printf("%d\n", (int)test((unsigned int)-831710640)); } O0 result is -994576896 O3 result is -994576832 It happens because LLVM (specifically instcombine) does the following transformation:
2015 Jan 07
2
[LLVMdev] Floating-point range checks
The Julia language implements sqrt(x) with conditional branch taken if x<0. Alas this prevents vectorization of loops with sqrt. Often the argument can be proven to be non-negative. E.g., sqrt(x*x+y*y). Is there an existing LLVM pass or analysis that does floating-point range propagation to eliminate such unnecessary checks? Arch D. Robison Intel Corporation -------------- next part
2015 Jan 08
2
[LLVMdev] Floating-point range checks
...ignBit in ValueTracking.cpp. This doesn't apply > (?) to floating point numbers, but we'd need something equivalent for > them. It looks like there may already be a start in the form of: > CannotBeNegativeZero > > Other places to look would be SimplifyFAdd and InstCombine::visitFAdd. > > For this particular example, you're probably going to want a pattern > in SimplifyFCmp of the form: > matcher: sqrt_call( fadd(Value(X), SpecificValue(X)), fadd(Value(Y), > SpecificValue(Y))) > && CannotBeNegativeZero(X) && CannotBeNegativeZero(Y) >...
2015 Jan 08
2
[LLVMdev] Floating-point range checks
...; (?) to floating point numbers, but we'd need something equivalent >>> for >>> them. It looks like there may already be a start in the form of: >>> CannotBeNegativeZero >>> >>> Other places to look would be SimplifyFAdd and >>> InstCombine::visitFAdd. >>> >>> For this particular example, you're probably going to want a >>> pattern >>> in SimplifyFCmp of the form: >>> matcher: sqrt_call( fadd(Value(X), SpecificValue(X)), >>> fadd(Value(Y), >>> SpecificValue(Y))) >>> &amp...
2010 Jul 26
0
[LLVMdev] X + 0.0
On Jul 24, 2010, at 2:59 AMPDT, Jochen Wilhelmy wrote: > Hi! > > in visitFAdd I found this comment: > > // Check for X+0.0. Simplify it to X if we know X is not -0.0. > > Why is it not allowed to simplify X + 0.0 = X when X may be > -0.0? Because -0.0 + 0.0 is 0.0 and not -0.0? > > For me it would be great if strict floating point processing could >...
2012 Apr 12
0
[LLVMdev] detection of constant diagonal matrix * vector
...s = int(elements.size()); for (int i = 0; i < numElements; ++i) { if (llvm::ConstantInt* element = llvm::dyn_cast<llvm::ConstantInt>(elements[i])) values[i] = int(element->getZExtValue()); } } } at the end of InstCombiner::visitFAdd: // check for constant diagonal matrix * vector: a.xx * [2 0] + a.yy * [0 3] --> a * [2 3] BinaryOperator* leftMul = dyn_cast<BinaryOperator>(LHS); BinaryOperator* rightMul = dyn_cast<BinaryOperator>(RHS); if (leftMul != NULL && rightMul != NULL && lef...
2015 Jan 08
2
[LLVMdev] Floating-point range checks
...but we'd need something equivalent > >>> for them. It looks like there may already be a start in the form > >>> of: > >>> CannotBeNegativeZero > >>> > >>> Other places to look would be SimplifyFAdd and > >>> InstCombine::visitFAdd. > >>> > >>> For this particular example, you're probably going to want a > >>> pattern in SimplifyFCmp of the form: > >>> matcher: sqrt_call( fadd(Value(X), SpecificValue(X)), > >>> fadd(Value(Y), > >>> SpecificValue(Y))...