67 lines · c
1// -O22// 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 \5// RUN: | FileCheck %s6 7// -ffast-math8// 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=FAST14 15// -O016// 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=NOOPT20 21#pragma float_control(precise,on)22float f1(float x) {23 return sqrtf(x);24}25 26// CHECK-LABEL: define {{.*}} float @f127// CHECK: tail call float @sqrtf(float noundef {{.*}}) #[[ATTR4_O2:[0-9]+]]28 29// FAST-LABEL: define {{.*}} nofpclass(nan inf) float @f130// FAST: call nofpclass(nan inf) float @sqrtf(float noundef nofpclass(nan inf) {{.*}}) #[[ATTR3_FAST:[0-9]+]]31 32// NOOPT-LABEL: define {{.*}} float @f133// NOOPT: call float @sqrtf(float noundef {{.*}}) #[[ATTR4_NOOPT:[0-9]+]]34 35#pragma float_control(precise,off)36float f2(float x) {37 return sqrtf(x);38}39 40// CHECK-LABEL: define {{.*}} float @f241// CHECK: tail call fast float @llvm.sqrt.f32(float {{.*}})42 43// FAST-LABEL: define {{.*}} nofpclass(nan inf) float @f244// FAST: call fast float @llvm.sqrt.f32(float {{.*}})45 46// NOOPT-LABEL: define {{.*}} float @f247// NOOPT: call fast float @sqrtf(float {{.*}}) #[[ATTR4_NOOPT:[0-9]+]]48 49__attribute__((optnone))50float f3(float x) {51 x = sqrtf(x);52 return x;53}54 55// CHECK-LABEL: define {{.*}} float @f356// CHECK: call float @sqrtf(float noundef {{.*}})57 58// FAST-LABEL: define {{.*}} nofpclass(nan inf) float @f359// FAST: call nofpclass(nan inf) float @sqrtf(float noundef nofpclass(nan inf) {{.*}}) #[[ATTR4_FAST:[0-9]+]]60 61// NOOPT-LABEL: define {{.*}} float @f362// NOOPT: call float @sqrtf(float noundef %0) #[[ATTR4_NOOPT:[0-9]+]]63 64// CHECK: [[ATTR4_O2]] = { nounwind }65// FAST: [[ATTR3_FAST]] = { nounwind willreturn memory(none) }66// NOOPT: [[ATTR4_NOOPT]] = { nounwind }67