[PATCH] D71741: Add size of FP environment to DataLayout

Serge Pavlov via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Jun 14 23:58:18 PDT 2020


sepavloff added a comment.

In D71741#2091128 <https://reviews.llvm.org/D71741#2091128>, @efriedma wrote:

> Do we really need this in the datalayout?  I can imagine certain frontends might care, but I can't imagine optimizations inserting new save/restore operations.


There are at least two motivations of having FPEnv size in DataLayout:

- Implementation of a pragma that would set and restore runtime rounding mode, a sequence like this:

  fegetenv(&saved_fpenv);
  fesetroundinf(FE_DOWNWARD);
  ... Operations that require specific rounding mode ...
  fesetenv(&saved_fpenv);



- Some IR transformation like inlining, various loop transformation and some others involve code motion. As a result the moved code may be put into surroundings where FP environment is different or unknown, or changing it is undesirable.

In these cases compiler may need to insert save/restore operations but the type of variable to store the environment is target-dependent.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D71741





More information about the llvm-commits mailing list