Index: include/llvm/CodeGen/CommandFlags.h =================================================================== --- include/llvm/CodeGen/CommandFlags.h +++ include/llvm/CodeGen/CommandFlags.h @@ -130,6 +130,21 @@ cl::desc("Force codegen to assume rounding mode can change dynamically"), cl::init(false)); +cl::opt +EnableFPEnvAccessFPMath("enable-fpenv-access-fp-math", + cl::desc("Disable FP math optimizations that affect FP environment access"), + cl::init(false)); + +cl::opt +EnableExceptAccessFPMath("enable-except-access-fp-math", + cl::desc("Disable FP math optimizations that affect FP exceptions"), + cl::init(false)); + +cl::opt +EnableRoundAccessFPMath("enable-round-access-fp-math", + cl::desc("Disable FP math optimizations that affect FP rounding"), + cl::init(false)); + cl::opt FloatABIForCalls("float-abi", cl::desc("Choose float ABI type"), @@ -259,6 +274,10 @@ Options.NoNaNsFPMath = EnableNoNaNsFPMath; Options.HonorSignDependentRoundingFPMathOption = EnableHonorSignDependentRoundingFPMath; + Options.AllowFPExceptAccess = EnableExceptAccessFPMath | + EnableFPEnvAccessFPMath; + Options.AllowFPRoundAccess = EnableRoundAccessFPMath | + EnableFPEnvAccessFPMath; if (FloatABIForCalls != FloatABI::Default) Options.FloatABIType = FloatABIForCalls; Options.NoZerosInBSS = DontPlaceZerosInBSS; Index: include/llvm/Target/TargetOptions.h =================================================================== --- include/llvm/Target/TargetOptions.h +++ include/llvm/Target/TargetOptions.h @@ -63,7 +63,8 @@ TargetOptions() : PrintMachineCode(false), LessPreciseFPMADOption(false), UnsafeFPMath(false), - NoInfsFPMath(false), NoNaNsFPMath(false), + NoInfsFPMath(false), NoNaNsFPMath(false), AllowFPExceptAccess(false), + AllowFPRoundAccess(false), HonorSignDependentRoundingFPMathOption(false), NoZerosInBSS(false), GuaranteedTailCallOpt(false), @@ -114,6 +115,20 @@ /// assume the FP arithmetic arguments and results are never NaNs. unsigned NoNaNsFPMath : 1; + /// AllowFPExceptAccess - This flag is enabled when the + /// -enable-except-access-fp-math or -enable-fpenv-access-fp-math flag is + /// specified on the command line. When this flag is off (the default), the + /// code generator is allowed to assume the exceptions part of + /// floating-point environment is not accessed by the program. + unsigned AllowFPExceptAccess : 1; + + /// AllowFPRoundAccess - This flag is enabled when the + /// -enable-round-access-fp-math or -enable-fpenv-access-fp-math flag is + /// specified on the command line. When this flag is off (the default), the + /// code generator is allowed to assume the rounding part of floating-point + /// environment is not accessed by the program. + unsigned AllowFPRoundAccess : 1; + /// HonorSignDependentRoundingFPMath - This returns true when the /// -enable-sign-dependent-rounding-fp-math is specified. If this returns /// false (the default), the code generator is allowed to assume that the