Add a new option.
authorChris Lattner <sabre@nondot.org>
Thu, 3 May 2007 00:16:07 +0000 (00:16 +0000)
committerChris Lattner <sabre@nondot.org>
Thu, 3 May 2007 00:16:07 +0000 (00:16 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@36657 91177308-0d34-0410-b5e6-96231b3b80d8

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

index fcf2aa15bb1713838c2638cf21d5c42797a02b0b..288da94ec479888b8ed22733297759d82172bfbd 100644 (file)
@@ -49,6 +49,22 @@ namespace llvm {
   extern bool FiniteOnlyFPMathOption;
   extern bool FiniteOnlyFPMath();
   
+  /// 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
+  /// rounding behavior is the default (round-to-zero for all floating point to
+  /// integer conversions, and round-to-nearest for all other arithmetic
+  /// truncations).  If this is enabled (set to true), the code generator must
+  /// assume that the rounding mode may dynamically change.
+  extern bool HonorSignDependentRoundingFPMathOption;
+  extern bool HonorSignDependentRoundingFPMath();
+  
+  /// option is specified on the command line. If this returns false (default),
+  /// the code generator is not allowed to assume that FP arithmetic arguments
+  /// and results are never NaNs or +-Infs.
+  extern bool FiniteOnlyFPMathOption;
+  extern bool FiniteOnlyFPMath();
+  
   /// UseSoftFloat - This flag is enabled when the -soft-float flag is specified
   /// on the command line.  When this flag is on, the code generator will
   /// generate libcalls to the software floating point library instead of
index 4e7048253a942a4ea97b9a6f124776de0fd90ad1..b79b87b47943acc4512f49b025c184bee64dce58 100644 (file)
@@ -54,20 +54,27 @@ namespace {
                cl::location(UnsafeFPMath),
                cl::init(false));
   cl::opt<bool, true>
-  EnableFiniteOnltFPMath("enable-finite-only-fp-math",
+  EnableFiniteOnlyFPMath("enable-finite-only-fp-math",
                cl::desc("Enable optimizations that assumes non- NaNs / +-Infs"),
                cl::location(FiniteOnlyFPMathOption),
                cl::init(false));
   cl::opt<bool, true>
+  EnableHonorSignDependentRoundingFPMath(cl::Hidden,
+               "enable-sign-dependent-rounding-fp-math",
+       cl::desc("Force codegen to assume rounding mode can change dynamically"),
+               cl::location(HonorSignDependentRoundingFPMathOption),
+               cl::init(false));
+
+  cl::opt<bool, true>
   GenerateSoftFloatCalls("soft-float",
                cl::desc("Generate software floating point library calls"),
                cl::location(UseSoftFloat),
                cl::init(false));
   cl::opt<bool, true>
   DontPlaceZerosInBSS("nozero-initialized-in-bss",
-               cl::desc("Don't place zero-initialized symbols into bss section"),
-               cl::location(NoZerosInBSS),
-               cl::init(false));
+              cl::desc("Don't place zero-initialized symbols into bss section"),
+              cl::location(NoZerosInBSS),
+              cl::init(false));
   cl::opt<bool, true>
   EnableExceptionHandling("enable-eh",
                cl::desc("Exception handling should be emitted."),
@@ -146,5 +153,11 @@ namespace llvm {
   /// the code generator is not allowed to assume that FP arithmetic arguments
   /// and results are never NaNs or +-Infs.
   bool FiniteOnlyFPMath() { return UnsafeFPMath || FiniteOnlyFPMathOption; }
+  
+  /// HonorSignDependentRoundingFPMath - Return true if the codegen must assume
+  /// that the rounding mode of the FPU can change from its default.
+  bool HonorSignDependentRoundingFPMath() {
+    return !UnsafeFPMath && HonorSignDependentRoundingFPMathOption;
+  }
 }