[llvm-dev] [RFC] FP Environment and Rounding mode handling in LLVM

Mehdi Amini via llvm-dev llvm-dev at lists.llvm.org
Wed Feb 3 15:04:55 PST 2016


Hi everyone,

Sergey (CC’ed) worked on a series of patches to add support for floating-point environment and floating-point rounding modes in LLVM.
This started *in 2014* and the patches after multiple rounds of review in the last months (involving amongst other Steve Canon, Hal Finkel, David Majnemer, and myself) are getting very close (IMO) to be in a state where we can land them.

This is the thread that started this development: “ [LLVMdev] More careful treatment of floating point exceptions" http://marc.info/?l=llvm-dev&m=141113983302113&w=2
And this is the thread where most of the discussion on the design occurred: "[PATCH] Flag to enable IEEE-754 friendly FP optimizations” http://marc.info/?l=llvm-commits&m=141235814915999&w=2

Since Chandler raised some concerns on IRC today, so I figured I should send a heads-up on this topic to allow any one to comment on the current plan.

We plan on adding two new FP env flags to the existing FMF (fast-math flags). Without these flags set, the optimizer has to assume that the FP env can be observed, or the rounding mode can be changed. For clang, these flags would be set unless a command line option would require to preserve the FP env.

Here is the list of patches:

[FPEnv Core 01/14] Add flags and command-line switches for FPEnv: http://reviews.llvm.org/D14066
[FPEnv Core 02/14] Add FPEnv access flags to fast-math flags: http://reviews.llvm.org/D14067
[FPEnv Core 03/14] Make SelectionDAG aware of FPEnv flags: http://reviews.llvm.org/D14068
[FPEnv Core 04/14] Skip constant folding to preserve FPEnv: http://reviews.llvm.org/D14069
[FPEnv Core 05/14] Teach IR builder and folders about new flags: http://reviews.llvm.org/D14070
[FPEnv Core 06/14] Do not fold constants on reading in IR asm/bitcode: http://reviews.llvm.org/D14071
[FPEnv Core 07/14] Prevent undesired folding by InstSimplify: http://reviews.llvm.org/D14072
[FPEnv Core 08/14] Do not simplify expressions with FPEnv access: http://reviews.llvm.org/D14073
[FPEnv Core 09/14] Make Strict flag available for more clients: http://reviews.llvm.org/D14074
[FPEnv Core 10/14] Use Strict in IRBuilder: http://reviews.llvm.org/D14075
[FPEnv Core 11/14] Don't convert fpops to constexprs in SCCP: http://reviews.llvm.org/D14076
[FPEnv Core 13/14] Don't hoist FP-ops with side-effects in LICM: http://reviews.llvm.org/D14078
[FPEnv Core 14/14] Introduce F*_W_CHAIN instrs to prevent reordering: http://reviews.llvm.org/D14079


— 
Mehdi



More information about the llvm-dev mailing list