Hi Hal, Elena,<div><br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<div>> Does anybody have any comments or suggestions? Otherwise I'll commit<br>> shortly.<br><br></div>Does this change the non-SSE x86 behavior as well?</blockquote><div><br></div><div>The only users of this option at the moment are FMA guards - non-SSE behavior shouldn't be affected. I've heard it was used to toggle some fp80 options at some point, but it doesn't appear to be used for that these days.</div>
<div>  </div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">We should also document this prominently on the clang<br>
web page (especially if this differs from gcc's default behavior).<br></blockquote><div><br></div><div>Agreed. </div><div> </div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Will we have a need for the existing patterns, or should they all<br>be rewritten in terms of fma and fneg?</blockquote><div><br></div><div>I had a quick look - I think the existing patterns will be redundant when this patch lands. You'll want to switch to fma + fneg patterns as you suggested.</div>
<div><br></div><div>You'll also need to override TargetLowering::isFMAFasterThanMulAndAdd.</div><div><br></div><div>I'll give you a heads up when I commit this so you can make the changes.</div><div> </div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
Whatever you call it, just make sure that fast-math turns it on ;)<br></blockquote><div> </div><div>Sounds good to me.</div><div> </div><div><blockquote class="gmail_quote" style="margin-top:0px;margin-right:0px;margin-bottom:0px;margin-left:0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On X86 will need to translate ISD::FMA + ISD:NEG to FMSUB or FMNADD instructions. And it should be in td file.</blockquote><div> </div></div><div>Absolutely. This patch is orthogonal to that work - this will form the FMA + FNEG, and we can add patterns to the TD files to match those to the X86 FMA instructions.</div>
<div><br></div><div>- Lang.</div></div></div><br><div class="gmail_quote">On Tue, Jun 19, 2012 at 6:04 AM, Hal Finkel <span dir="ltr"><<a href="mailto:hfinkel@anl.gov" target="_blank">hfinkel@anl.gov</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im">On Tue, 19 Jun 2012 12:01:54 +0000<br>
"Demikhovsky, Elena" <<a href="mailto:elena.demikhovsky@intel.com">elena.demikhovsky@intel.com</a>> wrote:<br>
<br>
> On X86 will need to translate ISD::FMA + ISD:NEG to FMSUB or FMNADD<br>
> instructions. And it should be in td file.<br>
<br>
</div>True. If that was meant to be an answer to my question, let me clarify:<br>
My understanding was that excess precision was enabled by default so<br>
that when using the x87 floating-point instructions, we can do multiple<br>
consecutive operations without specifically rounding after each one. If<br>
DisableExcessFPPrecision has now become AllowExcessFPPrecision (which<br>
is now off by default), has that changed?<br>
<br>
Thanks again,<br>
Hal<br>
<div class="HOEnZb"><div class="h5"><br>
><br>
> - Elena<br>
> -----Original Message-----<br>
> From: <a href="mailto:llvm-commits-bounces@cs.uiuc.edu">llvm-commits-bounces@cs.uiuc.edu</a><br>
> [mailto:<a href="mailto:llvm-commits-bounces@cs.uiuc.edu">llvm-commits-bounces@cs.uiuc.edu</a>] On Behalf Of Hal Finkel<br>
> Sent: Tuesday, June 19, 2012 07:59 To: Lang Hames<br>
> Cc: <a href="mailto:Stephen@dcs-maillist.cs.uiuc.edu">Stephen@dcs-maillist.cs.uiuc.edu</a>; Commit Messages and Patches for<br>
> LLVM Subject: Re: [llvm-commits] [PATCH] Aggressive FMA formation<br>
> mode.<br>
><br>
> On Mon, 18 Jun 2012 20:41:56 -0700<br>
> Lang Hames <<a href="mailto:lhames@gmail.com">lhames@gmail.com</a>> wrote:<br>
><br>
> > Hi All,<br>
> ><br>
> > Attached is a patch to aggressively form FMAs from pairs of mul+add<br>
> > and mul+sub instructions during DAG combine. It forms these<br>
> > instructions when: (a) AllowExcessFPPrecision is true*.<br>
> > (b) FMA is legal for the target.<br>
> > (c) FMA is cheaper than a separate mul and add.<br>
> ><br>
> > * I've hijacked and renamed "DisableExcessFPPrecision" for this<br>
> > patch (new llc command line option: -enable-excess-fp-precision).<br>
> > The comments for that DisableExcessFPPrecision suggest that this<br>
> > was its intended purpose. Under my patch the option still defaults<br>
> > to false, so aggressive FMA formation is now OFF by default.<br>
> > Previously the ARM and PPC targets had been forming FMAs<br>
> > aggressively where the instructions were available (at least on<br>
> > non-Darwin platforms).<br>
> ><br>
> > Does anybody have any comments or suggestions? Otherwise I'll<br>
> > commit shortly.<br>
><br>
> Does this change the non-SSE x86 behavior as well?<br>
><br>
> ><br>
> > Hal - I've updated the guards on FMA formation for PPC, but by<br>
> > default FMAs will no longer be formed. If this is a problem, would<br>
> > it be possible to have your FMA-formation guard rely on a PPC<br>
> > specific "disable-FMA" option? I'd like to keep<br>
> > AllowExcessFPPrecision as the guard for target independent FMA<br>
> > formation, and that should be off by default.<br>
><br>
> We can have it off by default. In the name of having a uniform policy<br>
> which defaults to IEEE compliance, that's fine, and I can explain<br>
> that to my users, etc. We should also document this prominently on<br>
> the clang web page (especially if this differs from gcc's default<br>
> behavior).<br>
><br>
> Will we have a need for the existing patterns, or should they all be<br>
> rewritten in terms of fma and fneg?<br>
><br>
> ><br>
> > - Lang.<br>
> ><br>
> > p.s Will be adding a clang command line option for this just as<br>
> > soon as I work out what to call it. Taking suggestions...<br>
><br>
> Whatever you call it, just make sure that fast-math turns it on ;)<br>
><br>
> Thanks again,<br>
> Hal<br>
><br>
> --<br>
> Hal Finkel<br>
> Postdoctoral Appointee<br>
> Leadership Computing Facility<br>
> Argonne National Laboratory<br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
> ---------------------------------------------------------------------<br>
> Intel Israel (74) Limited<br>
><br>
> This e-mail and any attachments may contain confidential material for<br>
> the sole use of the intended recipient(s). Any review or distribution<br>
> by others is strictly prohibited. If you are not the intended<br>
> recipient, please contact the sender and delete all copies.<br>
><br>
<br>
<br>
<br>
--<br>
Hal Finkel<br>
Postdoctoral Appointee<br>
Leadership Computing Facility<br>
Argonne National Laboratory<br>
</div></div></blockquote></div><br>