Displaying 20 results from an estimated 4000 matches similar to: "[LLVMdev] Convert fdiv - X/Y -> X*1/Y"
2013 Aug 08
3
[LLVMdev] Convert fdiv - X/Y -> X*1/Y
I remember why I didn't implement this rule in Instcombine. It add one
instruction. So,
this xform should be driven by a redundancy eliminator if you care code
size.
On 8/8/13 10:13 AM, Shuxin Yang wrote:
> I did few transformation in Instruction *InstCombiner::visitFDiv() in
> an attempt to remove some divs.
> I may miss this case. If you need to implement this rule, it is
>
2013 Aug 08
0
[LLVMdev] Convert fdiv - X/Y -> X*1/Y
Hi Chad,
This is a great transform to do, but you’re right that it’s only safe under fast-math. This is particularly interesting when the original divisor is a constant so you can materialize the reciprocal at compile-time. You’re right that in either case, this optimization should only kick in when there is more than one divide instruction that will be changed to a mul.
I don’t have a strong
2013 Aug 08
0
[LLVMdev] Convert fdiv - X/Y -> X*1/Y
I did few transformation in Instruction *InstCombiner::visitFDiv() in an
attempt to remove some divs.
I may miss this case. If you need to implement this rule, it is better
done in Instcombine than in DAG combine.
Doing such xform early expose the redundancy of 1/y, which have positive
impact to neighboring code,
while DAG combine is bit blind.
You should be very careful, reciprocal is very
2013 Aug 08
0
[LLVMdev] Convert fdiv - X/Y -> X*1/Y
On 08.08.2013, at 18:25, Chad Rosier <chad.rosier at gmail.com> wrote:
> I would like to transform X/Y -> X*1/Y. Specifically, I would like to convert:
>
> define void @t1a(double %a, double %b, double %d) {
> entry:
> %div = fdiv fast double %a, %d
> %div1 = fdiv fast double %b, %d
> %call = tail call i32 @foo(double %div, double %div1)
> ret void
>
2013 Aug 08
2
[LLVMdev] Convert fdiv - X/Y -> X*1/Y
On Aug 8, 2013, at 9:56 AM, Jim Grosbach <grosbach at apple.com> wrote:
> Hi Chad,
>
> This is a great transform to do, but you’re right that it’s only safe under fast-math. This is particularly interesting when the original divisor is a constant so you can materialize the reciprocal at compile-time. You’re right that in either case, this optimization should only kick in when
2013 Aug 08
0
[LLVMdev] Convert fdiv - X/Y -> X*1/Y
I believe we were under the impression that InstCombine, as a canonicalized/optimizer, should not increase code size but only reduce it.
Minor aside, but you don't need all of fast-math for the IR, just the "arcp" flag, which allows for replacement of division with reciprocal-multiply.
On Aug 8, 2013, at 10:21 AM, Shuxin Yang <shuxin.llvm at gmail.com> wrote:
> I remember
2013 Aug 08
0
[LLVMdev] Convert fdiv - X/Y -> X*1/Y
On Thu, Aug 8, 2013 at 1:56 PM, Mark Lacey <mark.lacey at apple.com> wrote:
>
> On Aug 8, 2013, at 9:56 AM, Jim Grosbach <grosbach at apple.com> wrote:
>
> Hi Chad,
>
> This is a great transform to do, but you’re right that it’s only safe
> under fast-math. This is particularly interesting when the original divisor
> is a constant so you can materialize the
2013 Aug 08
0
[LLVMdev] Convert fdiv - X/Y -> X*1/Y
Seems incorrect but I forget the IEEE fp rules.
What if both x and y are infinity?
in that case x/y = NAN but you transformation will yield 0 as the result.
On 08/08/2013 09:25 AM, Chad Rosier wrote:
> I would like to transform X/Y -> X*1/Y. Specifically, I would like to
> convert:
>
> define void @t1a(double %a, double %b, double %d) {
> entry:
> %div = fdiv fast
2013 Aug 08
3
[LLVMdev] Convert fdiv - X/Y -> X*1/Y
On Thu, Aug 8, 2013 at 2:07 PM, Chad Rosier <chad.rosier at gmail.com> wrote:
> On Thu, Aug 8, 2013 at 1:56 PM, Mark Lacey <mark.lacey at apple.com> wrote:
>
>>
>> On Aug 8, 2013, at 9:56 AM, Jim Grosbach <grosbach at apple.com> wrote:
>>
>> Hi Chad,
>>
>> This is a great transform to do, but you’re right that it’s only safe
>>
2008 May 28
4
Help on Calculating day differences
Hello R Freaks,
I calculate the difference in days between two events with the following
litte R expresseion:
T1a <- strptime(T1,"%m/%d/%y %H:%M:%S");
T2a <- strptime(T2,"%m/%d/%y %H:%M:%S");
T1b <- as.Date(T1a);
T2b <- as.Date(T2a);
days <- T2b-T1b;
time <- T2a - T1a;
In the project I would like to calculate only working day.
I the a possibility to count
2013 Aug 08
0
[LLVMdev] Convert fdiv - X/Y -> X*1/Y
Point #1 makes sense to me.
For point #2, wouldn't that be somewhat orthogonal to the discussion, as it has/needs no knowledge that an IR-level transformation happened? Also, reciprocal-multiply will be the preferred option for many (most) backends if the IR says to do that. But, I suppose some backend might want to be allowed to do the reverse transformation if allowed by fast-math flags in
2018 Feb 28
3
how to simplify FP ops with an undef operand?
%y = fadd float %x, undef
Can we simplify this?
Currently in IR, we do nothing for fadd/fsub/fmul. For fdiv/frem, we
propagate undef. The code comment for fdiv/frem says:
"the undef could be a snan"
If that's correct, then shouldn't it be the same for fadd/fsub/fmul? But
this can't be correct because we support targets that don't raise
exceptions...and even targets
2010 Sep 29
3
[LLVMdev] spilling & xmm register usage
Hello everybody,
I have stumbled upon a test case (the attached module is a slightly
reduced version) that shows extremely reduced performance on linux
compared to windows when executed using LLVM's JIT.
We narrowed the problem down to the actual code being generated, the
source IR on both systems is the same.
Try compiling the attached module:
llc -O3 -filetype=asm -o BAD.s BAD.ll
Under
2014 Sep 22
2
[LLVMdev] Bug 16257 - fmul of undef ConstantExpr not folded to undef
Hi Duncan,
On 17.09.2014 21:10, Duncan Sands wrote:
> Hi Oleg,
>
> On 17/09/14 18:45, Oleg Ranevskyy wrote:
>> Hi,
>>
>> Thank you for all your helpful comments.
>>
>> To sum up, below is the list of correct folding examples for fadd:
>> (1) fadd %x, -0.0 -> %x
>> (2) fadd undef, undef -> undef
2014 Aug 27
2
[LLVMdev] Bug 16257 - fmul of undef ConstantExpr not folded to undef
Hi Duncan,
Thank you a lot for your time to provide that great and informative
explanation.
Now the "undef" logic makes much more sense for me.
>> /You are wrong to say that "div undef, %X" is folded to "undef" by
InstructionSimplify, it is folded to zero./
My mistake. I meant to say "*f****div* undef, %X" is folded to "undef"
(not
2018 Feb 28
2
how to simplify FP ops with an undef operand?
Yes, if %x is a NaN, we should expect that NaN is propagated.
I'm still not sure what to do here. We can take comfort in knowing that
whatever we do is likely an improvement over the current situation though.
:)
That's because the code in InstSimplify is inconsistent with the LangRef:
http://llvm.org/docs/LangRef.html#undefined-values (UB for fdiv by 0?)
...and both of those are
2014 Aug 26
2
[LLVMdev] Bug 16257 - fmul of undef ConstantExpr not folded to undef
Hi Duncan,
Thank you for your comment to the bug 16257.
I am new to LLVM, so not all the aspects of LLVM's /"undef"/ seem clear
to me yet.
I read and understood the examples from the LLVM documentation:
http://llvm.org/docs/LangRef.html#undefined-values
However, those examples do not cover all of the possible contexts where
/"undef"/ can appear.
E.g., I can't
2018 Aug 21
4
different output with fast-math flag
This is of course not homework. I am trying to understand how fast math
optimizations work in llvm. When I compared IR for both the programs, the
only thing I have noticed is that fdiv and fmul are replaced with fdiv fast
and fmul fast. Not sure what happens in fdiv fast and fmul fast.
I feel that its because d/max is really small number and fast-math does not
care about small numbers and consider
2009 Jun 16
3
[LLVMdev] Upcoming API change: FAdd, FSub, FMul
On Jun 16, 2009, at 7:34 AM, Aaron Gray wrote:
>> The LLVM IR opcodes Add, Sub, and Mul have been each split into
>> two. Add, Sub, and Mul now only handle integer types, and three
>> new opcodes, FAdd, FSub, and FMul now handle floating-point types.
>
> Dan,
>
> Wondering the reason why there is no FDiv ?
FDiv already exists; div was split quite a while ago.
Dan
2012 Jul 15
2
[LLVMdev] Issue with Machine Verifier and earlyclobber
On Jul 15, 2012, at 9:20 AM, Borja Ferrer <borja.ferav at gmail.com> wrote:
> Jakob, one more hint, I've placed some asserts around the code you added and noticed that the InlineSpiller::insertReload() function is not being called.
>
> 2012/7/14 Borja Ferrer <borja.ferav at gmail.com>
> Hello Jakob,
>
> I'm still getting the error, I can give you any other