diff options
author | Melanie Blower <melanie.blower@intel.com> | 2020-05-01 10:32:06 -0700 |
---|---|---|
committer | Melanie Blower <melanie.blower@intel.com> | 2020-05-04 05:51:25 -0700 |
commit | f5360d4bb3376347479d86547d21b95d80be786d (patch) | |
tree | 2b0aea0b2e02617572187f640570a8c9fc1c1f92 /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | 67b466deda1dcee2ba4bea8ad3579415df678249 (diff) | |
download | llvm-f5360d4bb3376347479d86547d21b95d80be786d.zip llvm-f5360d4bb3376347479d86547d21b95d80be786d.tar.gz llvm-f5360d4bb3376347479d86547d21b95d80be786d.tar.bz2 |
Reapply "Add support for #pragma float_control" with buildbot fixes
Add support for #pragma float_control
Reviewers: rjmccall, erichkeane, sepavloff
Differential Revision: https://reviews.llvm.org/D72841
This reverts commit fce82c0ed310174fe48e2402ac731b6340098389.
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 24e01c4..4fcf31a 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -117,8 +117,8 @@ CodeGenFunction::~CodeGenFunction() { // Map the LangOption for exception behavior into // the corresponding enum in the IR. -static llvm::fp::ExceptionBehavior ToConstrainedExceptMD( - LangOptions::FPExceptionModeKind Kind) { +llvm::fp::ExceptionBehavior +clang::ToConstrainedExceptMD(LangOptions::FPExceptionModeKind Kind) { switch (Kind) { case LangOptions::FPE_Ignore: return llvm::fp::ebIgnore; @@ -133,15 +133,10 @@ void CodeGenFunction::SetFPModel() { auto fpExceptionBehavior = ToConstrainedExceptMD( getLangOpts().getFPExceptionMode()); - if (fpExceptionBehavior == llvm::fp::ebIgnore && - RM == llvm::RoundingMode::NearestTiesToEven) - // Constrained intrinsics are not used. - ; - else { - Builder.setIsFPConstrained(true); - Builder.setDefaultConstrainedRounding(RM); - Builder.setDefaultConstrainedExcept(fpExceptionBehavior); - } + Builder.setDefaultConstrainedRounding(RM); + Builder.setDefaultConstrainedExcept(fpExceptionBehavior); + Builder.setIsFPConstrained(fpExceptionBehavior != llvm::fp::ebIgnore || + RM != llvm::RoundingMode::NearestTiesToEven); } CharUnits CodeGenFunction::getNaturalPointeeTypeAlignment(QualType T, @@ -919,9 +914,11 @@ void CodeGenFunction::StartFunction(GlobalDecl GD, QualType RetTy, Fn->addFnAttr(llvm::Attribute::NoRecurse); } - if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D)) + if (const FunctionDecl *FD = dyn_cast_or_null<FunctionDecl>(D)) { + Builder.setIsFPConstrained(FD->usesFPIntrin()); if (FD->usesFPIntrin()) Fn->addFnAttr(llvm::Attribute::StrictFP); + } // If a custom alignment is used, force realigning to this alignment on // any main function which certainly will need it. |