Kevin P. Neal | d4ce862 | 2020-07-10 08:46:09 -0400 | [diff] [blame] | 1 | // RUN: %clang_cc1 -x c++ -ftrapping-math -fexceptions -fcxx-exceptions -frounding-math -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT
|
Melanie Blower | 7f9b513 | 2019-12-04 12:23:46 -0800 | [diff] [blame] | 2 | // RUN: %clang_cc1 -x c++ -ffp-contract=fast -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s -check-prefix=PRECISE
|
| 3 | // RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
|
Melanie Blower | f5360d4 | 2020-05-01 10:32:06 -0700 | [diff] [blame] | 4 | // RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s -check-prefix=FASTNOCONTRACT
|
Melanie Blower | 7f9b513 | 2019-12-04 12:23:46 -0800 | [diff] [blame] | 5 | // RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=ignore -emit-llvm -o - %s | FileCheck %s -check-prefix=FAST
|
Kevin P. Neal | d4ce862 | 2020-07-10 08:46:09 -0400 | [diff] [blame] | 6 | // RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=strict -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=EXCEPT
|
| 7 | // RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=maytrap -fexperimental-strict-floating-point -emit-llvm -o - %s | FileCheck %s -check-prefix=MAYTRAP
|
| 8 | |
Melanie Blower | 7f9b513 | 2019-12-04 12:23:46 -0800 | [diff] [blame] | 9 | float f0, f1, f2;
|
| 10 |
|
| 11 | template <class>
|
| 12 | class aaaa {
|
| 13 | public:
|
| 14 | ~aaaa();
|
| 15 | void b();
|
| 16 | };
|
| 17 |
|
| 18 | template <class c>
|
| 19 | aaaa<c>::~aaaa() { try {
|
| 20 | b();
|
| 21 | // CHECK-LABEL: define {{.*}}void @_ZN4aaaaIiED2Ev{{.*}}
|
| 22 |
|
| 23 | } catch (...) {
|
Melanie Blower | f5360d4 | 2020-05-01 10:32:06 -0700 | [diff] [blame] | 24 | // MAYTRAP: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
|
| 25 | // EXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
|
| 26 | // FPMODELSTRICT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
|
| 27 | // STRICTEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
|
| 28 | // STRICTNOEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.ignore")
|
| 29 | // PRECISE: fadd contract float %{{.*}}, %{{.*}}
|
| 30 | // FAST: fadd fast
|
| 31 | // FASTNOCONTRACT: fadd reassoc nnan ninf nsz arcp afn float
|
| 32 | f0 = f1 + f2;
|
Melanie Blower | 7f9b513 | 2019-12-04 12:23:46 -0800 | [diff] [blame] | 33 |
|
Melanie Blower | f5360d4 | 2020-05-01 10:32:06 -0700 | [diff] [blame] | 34 | // CHECK: ret void
|
Melanie Blower | 7f9b513 | 2019-12-04 12:23:46 -0800 | [diff] [blame] | 35 | }
|
| 36 | }
|
| 37 |
|
| 38 | class d {
|
| 39 | public:
|
| 40 | d(const char *, int);
|
| 41 | aaaa<int> e;
|
| 42 | };
|
| 43 |
|
| 44 | float foo() {
|
| 45 | d x("", 1);
|
| 46 | aaaa<int> a;
|
| 47 | return f0;
|
| 48 | }
|
| 49 |
|