[PATCH] D78827: Add support for #pragma clang fp reassociate(on|off) -- floating point control of associative math transformations

Melanie Blower via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon May 4 12:22:16 PDT 2020


mibintc marked an inline comment as done.
mibintc added a comment.

A reply to @scanon



================
Comment at: clang/docs/LanguageExtensions.rst:3182
+enabled for the translation unit with the ``-fassociative-math`` flag.
+The pragma can take two values: ``on`` and ``off``.
+
----------------
scanon wrote:
> rjmccall wrote:
> > Do you want to add an example here?
> Is the intention that this allows reassociation only within statements (like fp contract on)? Based on the ir in the tests, I think the answer is "no".
> 
> If so, should "on" be called "fast" instead, since its semantics match the "fast" semantics for contract, and reserve "on" for reassociation within a statement (that seems like it would also be useful, potentially)?
> 
> Otherwise, please add some tests with multiple statements.
> 
> I agree with John that `pragma clang fp reassociate` is a reasonable spelling.
The intention is that the pragma can be placed at either file scope or at the start of a compound statement, if at file scope it affects the functions following the pragma.  If at compound statement it is effective for the compound statement, i can modify the test to have multiple statements.  I disagree with the suggestion of "fast" instead of on/off.  at the command line you can use -f[no-]associative-math; of course that command line option isn't specific to floating point, but the point is it's on/off ; i can't speak to whether "fast" would be a useful setting.  Thanks for your review


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D78827/new/

https://reviews.llvm.org/D78827





More information about the cfe-commits mailing list