From 46b5b8838759324c25affab9e6d0285898d9ae0a Mon Sep 17 00:00:00 2001 From: Sjoerd Meijer Date: Wed, 31 Aug 2016 14:17:38 +0000 Subject: Clang patch r280064 introduced ways to set the FP exceptions and denormal types. This is the LLVM counterpart and it adds options that map onto FP exceptions and denormal build attributes allowing better fp math library selections. Differential Revision: https://reviews.llvm.org/D24070 llvm-svn: 280246 --- llvm/lib/Target/TargetMachine.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'llvm/lib/Target/TargetMachine.cpp') diff --git a/llvm/lib/Target/TargetMachine.cpp b/llvm/lib/Target/TargetMachine.cpp index 82c68505c4e..60505f49a6b 100644 --- a/llvm/lib/Target/TargetMachine.cpp +++ b/llvm/lib/Target/TargetMachine.cpp @@ -77,6 +77,16 @@ void TargetMachine::resetTargetOptions(const Function &F) const { RESET_OPTION(UnsafeFPMath, "unsafe-fp-math"); RESET_OPTION(NoInfsFPMath, "no-infs-fp-math"); RESET_OPTION(NoNaNsFPMath, "no-nans-fp-math"); + RESET_OPTION(NoTrappingFPMath, "no-trapping-math"); + + StringRef Denormal = + F.getFnAttribute("denormal-fp-math").getValueAsString(); + if (Denormal == "ieee") + Options.FPDenormalType = FPDenormal::IEEE; + else if (Denormal == "preserve-sign") + Options.FPDenormalType = FPDenormal::PreserveSign; + else if (Denormal == "positive-zero") + Options.FPDenormalType = FPDenormal::PositiveZero; } /// Returns the code generation relocation model. The choices are static, PIC, -- cgit v1.2.3