summaryrefslogtreecommitdiff
path: root/test/CodeGen/builtin-sqrt.c
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2017-12-18 20:11:37 +0000
committerDimitry Andric <dim@FreeBSD.org>2017-12-18 20:11:37 +0000
commit461a67fa15370a9ec88f8f8a240bf7c123bb2029 (patch)
tree6942083d7d56bba40ec790a453ca58ad3baf6832 /test/CodeGen/builtin-sqrt.c
parent75c3240472ba6ac2669ee72ca67eb72d4e2851fc (diff)
Diffstat (limited to 'test/CodeGen/builtin-sqrt.c')
-rw-r--r--test/CodeGen/builtin-sqrt.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/CodeGen/builtin-sqrt.c b/test/CodeGen/builtin-sqrt.c
new file mode 100644
index 0000000000000..5b275bf9066db
--- /dev/null
+++ b/test/CodeGen/builtin-sqrt.c
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fmath-errno -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s --check-prefix=HAS_ERRNO
+// RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s --check-prefix=NO_ERRNO
+
+float foo(float X) {
+ // HAS_ERRNO: call float @sqrtf(float
+ // NO_ERRNO: call float @llvm.sqrt.f32(float
+ return __builtin_sqrtf(X);
+}
+
+// HAS_ERRNO: declare float @sqrtf(float) [[ATTR:#[0-9]+]]
+// HAS_ERRNO-NOT: attributes [[ATTR]] = {{{.*}} readnone
+
+// NO_ERRNO: declare float @llvm.sqrt.f32(float) [[ATTR:#[0-9]+]]
+// NO_ERRNO: attributes [[ATTR]] = { nounwind readnone {{.*}}}
+