[cfe-commits] [PATCH] FP_CONTRACT pragma support.

Hal Finkel hfinkel at anl.gov
Wed Sep 26 22:43:49 PDT 2012


On Wed, 26 Sep 2012 22:22:11 -0700
Lang Hames <lhames at gmail.com> wrote:

> Hi Hal,
> 
> Sorry - that was an oversight on my part. I've now added support for
> expressions of the form (a * b - c) and (c - a * b). Adding that
> feature also prompted me to refactor some of the codegen logic, and
> testing helped me find a couple of bugs where I'd failed to propagate
> the contractable bit during template instantiation.

Great, thanks!

 -Hal

> 
> Updated patch attached.
> 
> Cheers,
> Lang.
> 
> On Wed, Sep 26, 2012 at 7:50 PM, Hal Finkel <hfinkel at anl.gov> wrote:
> 
> > Lang,
> >
> > Great, thanks!
> >
> > Can you please add support for making a*c - b into fma(a, c, -b),
> > etc. This is very important for performance on PPC (because this
> > gets pattern-matched into a single instruction).
> >
> >  -Hal
> >
> > On Wed, 26 Sep 2012 17:12:50 -0700
> > Lang Hames <lhames at gmail.com> wrote:
> >
> > > Hi All,
> > >
> > > This patch adds support for the FP_CONTRACT pragma to clang. It
> > > adds a bit to BinaryOperator and CXXOperatorCallExpr to track the
> > > FP_CONTRACT pragma state as each AST node is constructed. Pragma
> > > state is made to follow scope correctly by having an RAII object
> > > save and restore the state when the parser encounters a new
> > > compound statement body. The -ffp-contract option is tested
> > > during codegen, and fmuladd intrinsics (representing fusing
> > > opportunities) are output only if --ffp-contract=on.
> > >
> > > This patch does NOT include warnings/errors for specifying
> > > FP_CONTRACT in invalid contexts that could be confusing (e.g.
> > > introducing FP_CONTRACT at class scope). I think it's reasonable
> > > to start by supporting valid use cases, and add
> > > restrictions/diagnostics in a follow-up patch.
> > >
> > > Comments and feedback most welcome.
> > >
> > > Cheers,
> > > Lang.
> >
> >
> >
> > --
> > Hal Finkel
> > Postdoctoral Appointee
> > Leadership Computing Facility
> > Argonne National Laboratory
> >



-- 
Hal Finkel
Postdoctoral Appointee
Leadership Computing Facility
Argonne National Laboratory



More information about the cfe-commits mailing list