xref: /llvm-project/clang/test/CodeGen/builtin-sqrt.c (revision 304f1d59ca41872c094def3aee0a8689df6aa398)
1 // RUN: %clang_cc1 -fmath-errno -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s --check-prefix=HAS_ERRNO
2 // RUN: %clang_cc1              -triple x86_64-apple-darwin %s -emit-llvm -o - | FileCheck %s --check-prefix=NO_ERRNO
3 
foo(float X)4 float foo(float X) {
5   // HAS_ERRNO: call float @sqrtf(float
6   // NO_ERRNO: call float @llvm.sqrt.f32(float
7   return __builtin_sqrtf(X);
8 }
9 
10 // HAS_ERRNO: declare float @sqrtf(float noundef) [[ATTR:#[0-9]+]]
11 // HAS_ERRNO-NOT: attributes [[ATTR]] = {{{.*}} memory(none)
12 
13 // NO_ERRNO: declare float @llvm.sqrt.f32(float) [[ATTR:#[0-9]+]]
14 // NO_ERRNO: attributes [[ATTR]] = { nocallback nofree nosync nounwind speculatable willreturn memory(none) }
15 
16