Expose an option allowing unsafe math optimizations. Patch contributed by
authorChris Lattner <sabre@nondot.org>
Sat, 30 Apr 2005 04:09:52 +0000 (04:09 +0000)
committerChris Lattner <sabre@nondot.org>
Sat, 30 Apr 2005 04:09:52 +0000 (04:09 +0000)
Morten Ofstad!

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

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

index 19b83d5eefd6e8077a6117ef9105b5f102df1e4a..0018377c0f6b946ff2a82f1bbe5f753e430bd1e9 100644 (file)
@@ -41,6 +41,12 @@ namespace llvm {
   /// pattern ISel if available.
   extern int PatternISelTriState;
 
+  /// UnsafeFPMath - This flag is enabled when the
+  /// -enable-unsafe-fp-math flag is specified on the command line.  When
+  /// this flag is off (the default), the code generator is not allowed to
+  /// 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;
 } // End llvm namespace
 
 #endif
index 8e965767ce92da52f4641d0c6d7759b09c6d0395..b6bab7297632ace1ccd88395ca8b51fac76fda82 100644 (file)
@@ -26,6 +26,7 @@ namespace llvm {
   bool NoFramePointerElim;
   bool NoExcessFPPrecision;
   int  PatternISelTriState;
+  bool UnsafeFPMath;
 };
 namespace {
   cl::opt<bool, true> PrintCode("print-machineinstrs",
@@ -46,6 +47,11 @@ namespace {
                     cl::desc("sets the pattern ISel off(0), on(1), default(2)"),
                     cl::location(PatternISelTriState),
                     cl::init(2));
+  cl::opt<bool, true>
+  EnableUnsafeFPMath("enable-unsafe-fp-math",
+               cl::desc("Enable optimizations that may decrease FP precision"),
+               cl::location(UnsafeFPMath),
+               cl::init(false));
 };
 
 //---------------------------------------------------------------------------