diff options
| author | Melanie Blower <melanie.blower@intel.com> | 2020-05-01 09:26:15 -0700 |
|---|---|---|
| committer | Melanie Blower <melanie.blower@intel.com> | 2020-05-01 10:03:30 -0700 |
| commit | 69aacaf699922ffe0450f567e21208c10c84731f (patch) | |
| tree | d497d3a99a0440c7f631ecf5a6f12878634c624e /clang/test/CodeGen/fp-floatcontrol-class.cpp | |
| parent | d805ab7d039d6f3e7a8f7ab92e84c9d42a51ef66 (diff) | |
Reapply "Add support for #pragma float_control" with improvements to
test cases
Add support for #pragma float_control
Reviewers: rjmccall, erichkeane, sepavloff
Differential Revision: https://reviews.llvm.org/D72841
This reverts commit 85dc033caccaa6ab919d57f9759290be41240146, and makes
corrections to the test cases that failed on buildbots.
Diffstat (limited to 'clang/test/CodeGen/fp-floatcontrol-class.cpp')
| -rw-r--r-- | clang/test/CodeGen/fp-floatcontrol-class.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/test/CodeGen/fp-floatcontrol-class.cpp b/clang/test/CodeGen/fp-floatcontrol-class.cpp new file mode 100644 index 000000000000..ce4e0eb01390 --- /dev/null +++ b/clang/test/CodeGen/fp-floatcontrol-class.cpp @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -ffp-contract=on -triple %itanium_abi_triple -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -ffp-contract=on -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -ffp-contract=on -triple x86_64-unknown-unknown -emit-llvm -o - %s | FileCheck %s +// Verify that float_control does not pertain to initializer expressions + +float y(); +float z(); +#pragma float_control(except, on) +class ON { + float w = 2 + y() * z(); + // CHECK-LABEL: define {{.*}} void @_ZN2ONC2Ev{{.*}} + //CHECK: call contract float {{.*}}llvm.fmuladd +}; +ON on; +#pragma float_control(except, off) +class OFF { + float w = 2 + y() * z(); + // CHECK-LABEL: define {{.*}} void @_ZN3OFFC2Ev{{.*}} + //CHECK: call contract float {{.*}}llvm.fmuladd +}; +OFF off; |
