[llvm-commits] [llvm] r67363 - in /llvm/trunk: include/llvm/Target/TargetOptions.h lib/Target/TargetMachine.cpp

Mon P Wang wangmp at apple.com
Thu Mar 19 22:06:58 PDT 2009


Author: wangmp
Date: Fri Mar 20 00:06:58 2009
New Revision: 67363

URL: http://llvm.org/viewvc/llvm-project?rev=67363&view=rev
Log:
Added option to enable generating less precise mad (multiply addition)
for those architectures that support the instruction.

Modified:
    llvm/trunk/include/llvm/Target/TargetOptions.h
    llvm/trunk/lib/Target/TargetMachine.cpp

Modified: llvm/trunk/include/llvm/Target/TargetOptions.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Target/TargetOptions.h?rev=67363&r1=67362&r2=67363&view=diff

==============================================================================
--- llvm/trunk/include/llvm/Target/TargetOptions.h (original)
+++ llvm/trunk/include/llvm/Target/TargetOptions.h Fri Mar 20 00:06:58 2009
@@ -26,6 +26,14 @@
   /// elimination optimization, this option should disable it.
   extern bool NoFramePointerElim;
 
+  /// LessPreciseFPMAD - This flag is enabled when the
+  /// -enable-fp-mad is specified on the command line.  When this flag is off
+  /// (the default), the code generator is not allowed to generate mad
+  /// (multiply add) if the result is "less precise" than doing those operations
+  /// individually.
+  extern bool LessPreciseFPMADOption;
+  extern bool LessPreciseFPMAD();
+
   /// NoExcessFPPrecision - This flag is enabled when the
   /// -disable-excess-fp-precision flag is specified on the command line.  When
   /// this flag is off (the default), the code generator is allowed to produce
@@ -39,7 +47,7 @@
   /// 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.
-  /// UnsafeFPMath implies FiniteOnlyFPMath.
+  /// UnsafeFPMath implies FiniteOnlyFPMath and LessPreciseFPMAD.
   extern bool UnsafeFPMath;
 
   /// FiniteOnlyFPMath - This returns true when the -enable-finite-only-fp-math

Modified: llvm/trunk/lib/Target/TargetMachine.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/TargetMachine.cpp?rev=67363&r1=67362&r2=67363&view=diff

==============================================================================
--- llvm/trunk/lib/Target/TargetMachine.cpp (original)
+++ llvm/trunk/lib/Target/TargetMachine.cpp Fri Mar 20 00:06:58 2009
@@ -22,6 +22,7 @@
 //
 
 namespace llvm {
+  bool LessPreciseFPMADOption;
   bool PrintMachineCode;
   bool NoFramePointerElim;
   bool NoExcessFPPrecision;
@@ -59,6 +60,11 @@
   cl::location(NoExcessFPPrecision),
   cl::init(false));
 static cl::opt<bool, true>
+EnableFPMAD("enable-fp-mad",
+  cl::desc("Enable less precise MAD instructions to be generated"),
+  cl::location(LessPreciseFPMADOption),
+  cl::init(false));
+static cl::opt<bool, true>
 EnableUnsafeFPMath("enable-unsafe-fp-math",
   cl::desc("Enable optimizations that may decrease FP precision"),
   cl::location(UnsafeFPMath),
@@ -198,6 +204,12 @@
 }
 
 namespace llvm {
+  /// LessPreciseFPMAD - This flag return true when -enable-fp-mad option
+  /// is specified on the command line.  When this flag is off(default), the
+  /// code generator is not allowed to generate mad (multiply add) if the
+  /// result is "less precise" than doing those operations individually.
+  bool LessPreciseFPMAD() { return UnsafeFPMath || LessPreciseFPMADOption; }
+
   /// FiniteOnlyFPMath - This returns true when the -enable-finite-only-fp-math
   /// option is specified on the command line. If this returns false (default),
   /// the code generator is not allowed to assume that FP arithmetic arguments





More information about the llvm-commits mailing list