From bc65ca8de591e278fc613b5dc0e178b2ddcd215e Mon Sep 17 00:00:00 2001 From: Mon P Wang Date: Fri, 20 Mar 2009 05:06:58 +0000 Subject: Added option to enable generating less precise mad (multiply addition) for those architectures that support the instruction. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67363 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/TargetMachine.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'lib') diff --git a/lib/Target/TargetMachine.cpp b/lib/Target/TargetMachine.cpp index 2aed083341..870fe61bc8 100644 --- a/lib/Target/TargetMachine.cpp +++ b/lib/Target/TargetMachine.cpp @@ -22,6 +22,7 @@ using namespace llvm; // namespace llvm { + bool LessPreciseFPMADOption; bool PrintMachineCode; bool NoFramePointerElim; bool NoExcessFPPrecision; @@ -59,6 +60,11 @@ DisableExcessPrecision("disable-excess-fp-precision", cl::location(NoExcessFPPrecision), cl::init(false)); static cl::opt +EnableFPMAD("enable-fp-mad", + cl::desc("Enable less precise MAD instructions to be generated"), + cl::location(LessPreciseFPMADOption), + cl::init(false)); +static cl::opt EnableUnsafeFPMath("enable-unsafe-fp-math", cl::desc("Enable optimizations that may decrease FP precision"), cl::location(UnsafeFPMath), @@ -198,6 +204,12 @@ void TargetMachine::setCodeModel(CodeModel::Model Model) { } 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 -- cgit v1.2.3-70-g09d2