summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/libcalls.c
diff options
context:
space:
mode:
authored <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
committered <ed@FreeBSD.org>2009-06-02 17:58:47 +0000
commitf27e5a09a0d815b8a4814152954ff87dadfdefc0 (patch)
treece7d964cbb5e39695b71481698f10cb099c23d4a /test/CodeGen/libcalls.c
downloadFreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.zip
FreeBSD-src-f27e5a09a0d815b8a4814152954ff87dadfdefc0.tar.gz
Import Clang, at r72732.
Diffstat (limited to 'test/CodeGen/libcalls.c')
-rw-r--r--test/CodeGen/libcalls.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/CodeGen/libcalls.c b/test/CodeGen/libcalls.c
new file mode 100644
index 0000000..6953216
--- /dev/null
+++ b/test/CodeGen/libcalls.c
@@ -0,0 +1,22 @@
+// RUN: clang-cc -fmath-errno=1 -emit-llvm -o %t %s &&
+// RUN: grep "declare " %t | count 6 &&
+// RUN: grep "declare " %t | grep "@llvm." | count 1 &&
+// RUN: clang-cc -fmath-errno=0 -emit-llvm -o %t %s &&
+// RUN: grep "declare " %t | count 6 &&
+// RUN: grep "declare " %t | grep -v "@llvm." | count 0
+
+// IRgen only pays attention to const; it should always call llvm for
+// this.
+float sqrtf(float) __attribute__((const));
+
+void test_sqrt(float a0, double a1, long double a2) {
+ float l0 = sqrtf(a0);
+ double l1 = sqrt(a1);
+ long double l2 = sqrtl(a2);
+}
+
+void test_pow(float a0, double a1, long double a2) {
+ float l0 = powf(a0, a0);
+ double l1 = pow(a1, a1);
+ long double l2 = powl(a2, a2);
+}
OpenPOWER on IntegriCloud