Added option -enable-finite-only-fp-math. When on, the codegen can assume that
authorEvan Cheng <evan.cheng@apple.com>
Tue, 23 May 2006 06:39:12 +0000 (06:39 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Tue, 23 May 2006 06:39:12 +0000 (06:39 +0000)
FP arithmetic arguments and results are never NaNs or +=Infs. This includes
ignoring parity flag (PF) when checking for FP equality.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28432 91177308-0d34-0410-b5e6-96231b3b80d8

include/llvm/Target/TargetOptions.h
lib/Target/TargetMachine.cpp

index e208eba6418c76ad370886b1bdca5e58d89657c6..2131ecaf3d88e57785726825a8d8de7ed28f4528 100644 (file)
@@ -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;
   /// 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
 } // End llvm namespace
 
 #endif
index 24e1e5a547a6e0f63267282f0429ec6df0f0cc7c..28f3ae88a72516e486f3ff5d75f710bed5b83762 100644 (file)
@@ -26,6 +26,7 @@ namespace llvm {
   bool NoFramePointerElim;
   bool NoExcessFPPrecision;
   bool UnsafeFPMath;
   bool NoFramePointerElim;
   bool NoExcessFPPrecision;
   bool UnsafeFPMath;
+  bool FiniteOnlyFPMath;
   Reloc::Model RelocationModel;
 };
 namespace {
   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::desc("Enable optimizations that may decrease FP precision"),
                cl::location(UnsafeFPMath),
                cl::init(false));
+  cl::opt<bool, true>
+  EnableFiniteOnltFPMath("enable-finite-only-fp-math",
+               cl::desc("Enable optimizations that assumes non- NaNs / +-Infs"),
+               cl::location(FiniteOnlyFPMath),
+               cl::init(false));
   cl::opt<llvm::Reloc::Model, true>
   DefRelocationModel(
     "relocation-model",
   cl::opt<llvm::Reloc::Model, true>
   DefRelocationModel(
     "relocation-model",