1 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -triple x86_64-linux-gnu -emit-llvm -fdelayed-template-parsing -o - %s | FileCheck %s
6 #pragma STDC FENV_ACCESS ON
10 float func_01(float x
, float y
) {
11 return templ_01(x
, y
);
14 // CHECK-LABEL: define {{.*}} @_Z8templ_01IfET_S0_S0_
15 // CHECK-SAME: (float noundef %{{.*}}, float noundef %{{.*}}) #[[ATTR01:[0-9]+]]{{.*}} {
16 // CHECK: call float @llvm.experimental.constrained.fadd.f32
19 template <typename Ty
>
20 Ty
templ_02(Ty x
, Ty y
) {
24 #pragma STDC FENV_ROUND FE_UPWARD
26 template <typename Ty
>
27 Ty
templ_03(Ty x
, Ty y
) {
31 #pragma STDC FENV_ROUND FE_TONEAREST
33 float func_02(float x
, float y
) {
34 return templ_02(x
, y
);
37 // CHECK-LABEL: define {{.*}} float @_Z8templ_02IfET_S0_S0_
38 // CHECK: %add = fadd float %0, %1
40 float func_03(float x
, float y
) {
41 return templ_03(x
, y
);
44 // CHECK-LABEL: define {{.*}} float @_Z8templ_03IfET_S0_S0_
45 // CHECK: call float @llvm.experimental.constrained.fsub.f32({{.*}}, metadata !"round.upward", metadata !"fpexcept.ignore")
48 #pragma STDC FENV_ROUND FE_TONEAREST
51 template <class Compare
> float stable_sort(float x
, Compare
) {
53 stable_sort(x
, int());
56 float linkage_wrap() { return stable_sort(0.0, 1); }
59 // CHECK-LABEL: define {{.*}} float @_ZN7PR6354211stable_sortIiEEffT_(
62 // These pragmas set non-default FP environment before delayed parsing occurs.
63 // It is used to check that the parsing uses FP options defined by command line
64 // options or by pragma before the template definition but not by these pragmas.
65 #pragma STDC FENV_ROUND FE_TOWARDZERO
66 #pragma STDC FENV_ACCESS ON
68 // CHECK: attributes #[[ATTR01]] = { {{.*}}strictfp