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

Hal Finkel hfinkel at anl.gov
Wed Sep 26 19:50:47 PDT 2012


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



More information about the cfe-commits mailing list