Clang Project

clang_source_code/test/CodeGen/builtin-sqrt.c
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
4float 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) [[ATTR:#[0-9]+]]
11// HAS_ERRNO-NOT: attributes [[ATTR]] = {{{.*}} readnone
12
13// NO_ERRNO: declare float @llvm.sqrt.f32(float) [[ATTR:#[0-9]+]]
14// NO_ERRNO: attributes [[ATTR]] = { nounwind readnone {{.*}}}
15
16