From 746b530a7dd631ef2fb1c4b0bc1ae94ec65ace24 Mon Sep 17 00:00:00 2001 From: Hal Finkel Date: Fri, 6 Sep 2013 23:23:32 +0000 Subject: Add the missing "n" to libm LIBBUILTIN definitions The libm math functions should be marked with the "n" (nothrow) flag so that the corresponding IR function declarations are tagged with the nounwind attribute (this has been true in C mode, but not in C++ mode). The test case has been updated to run in C++ mode in addition to in C mode. llvm-svn: 190217 --- clang/test/CodeGen/libcall-declarations.c | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'clang/test/CodeGen/libcall-declarations.c') diff --git a/clang/test/CodeGen/libcall-declarations.c b/clang/test/CodeGen/libcall-declarations.c index c78e9be52f7..4849f1bc165 100644 --- a/clang/test/CodeGen/libcall-declarations.c +++ b/clang/test/CodeGen/libcall-declarations.c @@ -1,7 +1,12 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin12 -S -o - -emit-llvm %s | FileCheck %s -check-prefix=CHECK-NOERRNO // RUN: %clang_cc1 -triple x86_64-linux-gnu -S -o - -emit-llvm -fmath-errno %s | FileCheck %s -check-prefix=CHECK-ERRNO +// RUN: %clang_cc1 -triple x86_64-apple-darwin12 -S -o - -emit-llvm -x c++ %s | FileCheck %s -check-prefix=CHECK-NOERRNO +// RUN: %clang_cc1 -triple x86_64-linux-gnu -S -o - -emit-llvm -x c++ -fmath-errno %s | FileCheck %s -check-prefix=CHECK-ERRNO // Prototypes. +#ifdef __cplusplus +extern "C" { +#endif double acos(double); long double acosl(long double); float acosf(float); @@ -77,17 +82,25 @@ float tanf(float); double trunc(double); long double truncl(long double); float truncf(float); +#ifdef __cplusplus +} +#endif // Force emission of the declare statements. -void *use[] = { acos, acosl, acosf, asin, asinl, asinf, atan, atanl, atanf, - atan2, atan2l, atan2f, ceil, ceill, ceilf, copysign, copysignl, - copysignf, cos, cosl, cosf, exp, expl, expf, exp2, exp2l, exp2f, - fabs, fabsl, fabsf, floor, floorl, floorf, fma, fmal, fmaf, - fmax, fmaxl, fmaxf, fmin, fminl, fminf, log, logl, logf, log2, - log2l, log2f, lrint, lrintl, lrintf, nearbyint, nearbyintl, - nearbyintf, pow, powl, powf, rint, rintl, rintf, round, roundl, - roundf, sin, sinl, sinf, sqrt, sqrtl, sqrtf, tan, tanl, tanf, - trunc, truncl, truncf }; +#define F(x) ((void*)x) +void *use[] = { F(acos), F(acosl), F(acosf), F(asin), F(asinl), F(asinf), + F(atan), F(atanl), F(atanf), F(atan2), F(atan2l), F(atan2f), + F(ceil), F(ceill), F(ceilf), F(copysign), F(copysignl), + F(copysignf), F(cos), F(cosl), F(cosf), F(exp), F(expl), + F(expf), F(exp2), F(exp2l), F(exp2f), F(fabs), F(fabsl), + F(fabsf), F(floor), F(floorl), F(floorf), F(fma), F(fmal), + F(fmaf), F(fmax), F(fmaxl), F(fmaxf), F(fmin), F(fminl), + F(fminf), F(log), F(logl), F(logf), F(log2), F(log2l), + F(log2f), F(lrint), F(lrintl), F(lrintf), F(nearbyint), + F(nearbyintl), F(nearbyintf), F(pow), F(powl), F(powf), + F(rint), F(rintl), F(rintf), F(round), F(roundl), F(roundf), + F(sin), F(sinl), F(sinf), F(sqrt), F(sqrtl), F(sqrtf), F(tan), + F(tanl), F(tanf), F(trunc), F(truncl), F(truncf) }; // CHECK-NOERRNO: declare double @acos(double) [[NUW:#[0-9]+]] // CHECK-NOERRNO: declare x86_fp80 @acosl(x86_fp80) [[NUW]] -- cgit v1.2.3