blob: e914abcc692684290536edc61d68563ce0326700 [file] [log] [blame]
Melanie Blower7f9b5132019-12-04 12:23:46 -08001// RUN: %clang_cc1 -x c++ -ftrapping-math -fexceptions -fcxx-exceptions -frounding-math -ffp-exception-behavior=strict -emit-llvm -o - %s | FileCheck %s -check-prefix=FPMODELSTRICT
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 Blowerf5360d42020-05-01 10:32:06 -07004// RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -emit-llvm -o - %s | FileCheck %s -check-prefix=FASTNOCONTRACT
Melanie Blower7f9b5132019-12-04 12:23:46 -08005// 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
6// RUN: %clang_cc1 -x c++ -ffast-math -fexceptions -fcxx-exceptions -ffp-contract=fast -ffp-exception-behavior=strict -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 -emit-llvm -o - %s | FileCheck %s -check-prefix=MAYTRAP
8float f0, f1, f2;
9
10 template <class>
11 class aaaa {
12 public:
13 ~aaaa();
14 void b();
15 };
16
17 template <class c>
18 aaaa<c>::~aaaa() { try {
19 b();
20 // CHECK-LABEL: define {{.*}}void @_ZN4aaaaIiED2Ev{{.*}}
21
22 } catch (...) {
Melanie Blowerf5360d42020-05-01 10:32:06 -070023 // MAYTRAP: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.maytrap")
24 // EXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.tonearest", metadata !"fpexcept.strict")
25 // FPMODELSTRICT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
26 // STRICTEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.strict")
27 // STRICTNOEXCEPT: llvm.experimental.constrained.fadd.f32(float %{{.*}}, float %{{.*}}, metadata !"round.dynamic", metadata !"fpexcept.ignore")
28 // PRECISE: fadd contract float %{{.*}}, %{{.*}}
29 // FAST: fadd fast
30 // FASTNOCONTRACT: fadd reassoc nnan ninf nsz arcp afn float
31 f0 = f1 + f2;
Melanie Blower7f9b5132019-12-04 12:23:46 -080032
Melanie Blowerf5360d42020-05-01 10:32:06 -070033 // CHECK: ret void
Melanie Blower7f9b5132019-12-04 12:23:46 -080034 }
35 }
36
37 class d {
38 public:
39 d(const char *, int);
40 aaaa<int> e;
41 };
42
43float foo() {
44 d x("", 1);
45 aaaa<int> a;
46 return f0;
47}
48