diff --git a/include/llvm/Target/TargetOptions.h b/include/llvm/Target/TargetOptions.h index e208eba6418..2131ecaf3d8 100644 --- a/include/llvm/Target/TargetOptions.h +++ b/include/llvm/Target/TargetOptions.h @@ -40,6 +40,13 @@ namespace llvm { /// produce results that are "less precise" than IEEE allows. This includes /// use of X86 instructions like FSIN and FCOS instead of libcalls. extern bool UnsafeFPMath; + + /// FiniteOnlyFPMath - This is enabled when the -enable-finite-only-fp-math + /// flag is specified on the command line. When this flag is off (default), + /// the code generator is not allowed to assume that FP arithmetic arguments + /// and results are never NaNs or +-Infs. This includes ignoring parity flag + /// (PF) when checking for FP equality. + extern bool FiniteOnlyFPMath; } // End llvm namespace #endif diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index 24e1e5a547a..28f3ae88a72 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -26,6 +26,7 @@ namespace llvm { bool NoFramePointerElim; bool NoExcessFPPrecision; bool UnsafeFPMath; + bool FiniteOnlyFPMath; Reloc::Model RelocationModel; }; namespace { @@ -48,6 +49,11 @@ namespace { cl::desc("Enable optimizations that may decrease FP precision"), cl::location(UnsafeFPMath), cl::init(false)); + cl::opt + EnableFiniteOnltFPMath("enable-finite-only-fp-math", + cl::desc("Enable optimizations that assumes non- NaNs / +-Infs"), + cl::location(FiniteOnlyFPMath), + cl::init(false)); cl::opt DefRelocationModel( "relocation-model",