diff options
author | David L. Jones <dlj@google.com> | 2017-11-10 01:07:01 +0000 |
---|---|---|
committer | David L. Jones <dlj@google.com> | 2017-11-10 01:07:01 +0000 |
commit | 41af1698c520ea38edf83e7c91f1e519d34f20c1 (patch) | |
tree | 05c516cb7514d80a5e8deccb07cd0f7c228b70d4 /test/CodeGen/builtin-sqrt.c | |
parent | cd1b175aa96d9d675c09fc54dfd96ba41e3f2279 (diff) | |
parent | 4d085086c74a8fbce197f61548f488a63f300933 (diff) |
Creating branches/google/testing and tags/google/testing/ from r317203
git-svn-id: https://llvm.org/svn/llvm-project/cfe/branches/google/testing@317856 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGen/builtin-sqrt.c')
-rw-r--r-- | test/CodeGen/builtin-sqrt.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/CodeGen/builtin-sqrt.c b/test/CodeGen/builtin-sqrt.c new file mode 100644 index 0000000000..f93c5926d5 --- /dev/null +++ b/test/CodeGen/builtin-sqrt.c @@ -0,0 +1,19 @@ +// 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 + +// FIXME: If a builtin is supposed to have identical semantics to its libm twin, then it +// should not be marked "constant" in Builtins.def because that means it can't set errno. +// Note that both runs have 'readnone' on the libcall here. + +float foo(float X) { + // HAS_ERRNO: call float @sqrtf(float + // NO_ERRNO: call float @sqrtf(float + return __builtin_sqrtf(X); +} + +// HAS_ERRNO: declare float @sqrtf(float) [[ATTR:#[0-9]+]] +// HAS_ERRNO: attributes [[ATTR]] = { nounwind readnone {{.*}}} + +// NO_ERRNO: declare float @sqrtf(float) [[ATTR:#[0-9]+]] +// NO_ERRNO: attributes [[ATTR]] = { nounwind readnone {{.*}}} + |