2 // RUN: %clang_cc1 -Wno-implicit-function-declaration \
3 // RUN: -triple x86_64-unknown-unknown -fmath-errno -ffp-contract=on \
4 // RUN: -fno-rounding-math -O2 -emit-llvm -o - %s \
8 // RUN: %clang_cc1 -Wno-implicit-function-declaration \
9 // RUN: -triple x86_64-unknown-unknown -menable-no-infs -menable-no-nans \
10 // RUN: -fapprox-func -funsafe-math-optimizations -fno-signed-zeros -mreassociate \
11 // RUN: -freciprocal-math -ffp-contract=fast -fno-rounding-math -ffast-math \
12 // RUN: -ffinite-math-only -ffast-math -emit-llvm -o - %s \
13 // RUN: | FileCheck %s -check-prefix=FAST
16 // RUN: %clang_cc1 -Wno-implicit-function-declaration \
17 // RUN: -triple x86_64-unknown-unknown -fmath-errno -ffp-contract=on \
18 // RUN: -fno-rounding-math -O0 \
19 // RUN: -emit-llvm -o - %s | FileCheck %s -check-prefix=NOOPT
21 #pragma float_control(precise,on)
26 // CHECK-LABEL: define {{.*}} float @f1
27 // CHECK: tail call float @sqrtf(float noundef {{.*}}) #[[ATTR4_O2:[0-9]+]]
29 // FAST-LABEL: define {{.*}} nofpclass(nan inf) float @f1
30 // FAST: call fast nofpclass(nan inf) float @sqrtf(float noundef nofpclass(nan inf) {{.*}}) #[[ATTR3_FAST:[0-9]+]]
32 // NOOPT-LABEL: define {{.*}} float @f1
33 // NOOPT: call float @sqrtf(float noundef {{.*}}) #[[ATTR4_NOOPT:[0-9]+]]
35 #pragma float_control(precise,off)
40 // CHECK-LABEL: define {{.*}} float @f2
41 // CHECK: tail call fast float @llvm.sqrt.f32(float {{.*}})
43 // FAST-LABEL: define {{.*}} nofpclass(nan inf) float @f2
44 // FAST: call fast float @llvm.sqrt.f32(float {{.*}})
46 // NOOPT-LABEL: define {{.*}} float @f2
47 // NOOPT: call float @sqrtf(float {{.*}}) #[[ATTR4_NOOPT:[0-9]+]]
49 __attribute__((optnone
))
55 // CHECK-LABEL: define {{.*}} float @f3
56 // CHECK: call float @sqrtf(float noundef {{.*}})
58 // FAST-LABEL: define {{.*}} nofpclass(nan inf) float @f3
59 // FAST: call fast nofpclass(nan inf) float @sqrtf(float noundef nofpclass(nan inf) {{.*}}) #[[ATTR4_FAST:[0-9]+]]
61 // NOOPT-LABEL: define {{.*}} float @f3
62 // NOOPT: call float @sqrtf(float noundef %0) #[[ATTR4_NOOPT:[0-9]+]]
64 // CHECK: [[ATTR4_O2]] = { nounwind }
65 // FAST: [[ATTR3_FAST]] = { nounwind willreturn memory(none) }
66 // NOOPT: [[ATTR4_NOOPT]] = { nounwind }