xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/2009-09-24-SqrtErrno.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -triple x86_64-apple-darwin %s -emit-llvm -o - -fmath-errno | FileCheck %s
2*f4a2713aSLionel Sambuc // llvm.sqrt has undefined behavior on negative inputs, so it is
3*f4a2713aSLionel Sambuc // inappropriate to translate C/C++ sqrt to this.
4*f4a2713aSLionel Sambuc 
5*f4a2713aSLionel Sambuc float sqrtf(float x);
foo(float X)6*f4a2713aSLionel Sambuc float foo(float X) {
7*f4a2713aSLionel Sambuc // CHECK: foo
8*f4a2713aSLionel Sambuc // CHECK-NOT: readonly
9*f4a2713aSLionel Sambuc // CHECK: call float @sqrtf
10*f4a2713aSLionel Sambuc   // Check that this is not marked readonly when errno is used.
11*f4a2713aSLionel Sambuc   return sqrtf(X);
12*f4a2713aSLionel Sambuc }
13