2024-10-14 15:49:01 +08:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-implicit-function-declaration -w -o - -emit-llvm %s | FileCheck %s --check-prefixes=COMMON,NO__ERRNO
|
|
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-implicit-function-declaration -w -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefixes=COMMON,HAS_ERRNO
|
|
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-implicit-function-declaration -w -o - -emit-llvm -disable-llvm-passes -O2 %s | FileCheck %s --check-prefixes=COMMON,NO__ERRNO
|
|
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-implicit-function-declaration -w -o - -emit-llvm -disable-llvm-passes -O2 -fmath-errno %s | FileCheck %s --check-prefixes=COMMON,HAS_ERRNO
|
|
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown -Wno-implicit-function-declaration -w -o - -emit-llvm -ffp-exception-behavior=maytrap %s | FileCheck %s --check-prefixes=COMMON,HAS_MAYTRAP
|
2024-05-04 17:15:51 -07:00
|
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-unknown-gnu -Wno-implicit-function-declaration -w -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_GNU
|
|
|
|
// RUN: %clang_cc1 -triple x86_64-unknown-windows-msvc -Wno-implicit-function-declaration -w -o - -emit-llvm -fmath-errno %s | FileCheck %s --check-prefix=HAS_ERRNO_WIN
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2017-11-07 15:13:22 +00:00
|
|
|
// Test attributes and builtin codegen of math library calls.
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2017-11-07 15:13:22 +00:00
|
|
|
void foo(double *d, float f, float *fp, long double *l, int *i, const char *c) {
|
2017-12-02 17:52:00 +00:00
|
|
|
f = fmod(f,f); f = fmodf(f,f); f = fmodl(f,f);
|
|
|
|
|
2022-07-29 13:45:33 +01:00
|
|
|
// NO__ERRNO: frem double
|
|
|
|
// NO__ERRNO: frem float
|
|
|
|
// NO__ERRNO: frem x86_fp80
|
|
|
|
// HAS_ERRNO: declare double @fmod(double noundef, double noundef) [[NOT_READNONE:#[0-9]+]]
|
|
|
|
// HAS_ERRNO: declare float @fmodf(float noundef, float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @fmodl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.frem.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.frem.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.frem.f80(
|
2017-12-02 17:52:00 +00:00
|
|
|
|
2017-11-03 16:27:27 +00:00
|
|
|
atan2(f,f); atan2f(f,f) ; atan2l(f, f);
|
|
|
|
|
2024-11-12 13:34:29 -08:00
|
|
|
// NO__ERRNO: declare double @llvm.atan2.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]]
|
|
|
|
// NO__ERRNO: declare float @llvm.atan2.f32(float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.atan2.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_ERRNO: declare double @atan2(double noundef, double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @atan2f(float noundef, float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @atan2l(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2024-11-12 13:34:29 -08:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.atan2.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.atan2.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.atan2.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
copysign(f,f); copysignf(f,f);copysignl(f,f);
|
|
|
|
|
2024-11-12 13:34:29 -08:00
|
|
|
// NO__ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// NO__ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]]
|
|
|
|
// HAS_ERRNO: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_MAYTRAP: declare double @llvm.copysign.f64(double, double) [[READNONE_INTRINSIC:#[0-9]+]]
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.copysign.f32(float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.copysign.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
fabs(f); fabsf(f); fabsl(f);
|
|
|
|
|
2022-07-29 13:45:33 +01:00
|
|
|
// NO__ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_MAYTRAP: declare double @llvm.fabs.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.fabs.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.fabs.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
frexp(f,i); frexpf(f,i); frexpl(f,i);
|
|
|
|
|
2023-02-17 14:34:05 +01:00
|
|
|
// NO__ERRNO: declare double @frexp(double noundef, ptr noundef) [[NOT_READNONE:#[0-9]+]]
|
|
|
|
// NO__ERRNO: declare float @frexpf(float noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @frexpl(x86_fp80 noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @frexp(double noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @frexpf(float noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @frexpl(x86_fp80 noundef, ptr noundef) [[NOT_READNONE]]
|
2024-11-12 13:34:29 -08:00
|
|
|
// HAS_MAYTRAP: declare double @frexp(double noundef, ptr noundef) [[NOT_READNONE:#[0-9]+]]
|
2023-02-17 14:34:05 +01:00
|
|
|
// HAS_MAYTRAP: declare float @frexpf(float noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @frexpl(x86_fp80 noundef, ptr noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
[C11/C2x] Change the behavior of the implicit function declaration warning
C89 had a questionable feature where the compiler would implicitly
declare a function that the user called but was never previously
declared. The resulting function would be globally declared as
extern int func(); -- a function without a prototype which accepts zero
or more arguments.
C99 removed support for this questionable feature due to severe
security concerns. However, there was no deprecation period; C89 had
the feature, C99 didn't. So Clang (and GCC) both supported the
functionality as an extension in C99 and later modes.
C2x no longer supports that function signature as it now requires all
functions to have a prototype, and given the known security issues with
the feature, continuing to support it as an extension is not tenable.
This patch changes the diagnostic behavior for the
-Wimplicit-function-declaration warning group depending on the language
mode in effect. We continue to warn by default in C89 mode (due to the
feature being dangerous to use). However, because this feature will not
be supported in C2x mode, we've diagnosed it as being invalid for so
long, the security concerns with the feature, and the trivial
workaround for users (declare the function), we now default the
extension warning to an error in C99-C17 mode. This still gives users
an easy workaround if they are extensively using the extension in those
modes (they can disable the warning or use -Wno-error to downgrade the
error), but the new diagnostic makes it more clear that this feature is
not supported and should be avoided. In C2x mode, we no longer allow an
implicit function to be defined and treat the situation the same as any
other lookup failure.
Differential Revision: https://reviews.llvm.org/D122983
2022-04-20 11:25:35 -04:00
|
|
|
ldexp(f,f); ldexpf(f,f); ldexpl(f,f);
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2024-11-12 13:34:29 -08:00
|
|
|
// NO__ERRNO: declare double @ldexp(double noundef, i32 noundef) [[READNONE:#[0-9]+]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// NO__ERRNO: declare float @ldexpf(float noundef, i32 noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @ldexpl(x86_fp80 noundef, i32 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @ldexp(double noundef, i32 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @ldexpf(float noundef, i32 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @ldexpl(x86_fp80 noundef, i32 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @ldexp(double noundef, i32 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @ldexpf(float noundef, i32 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @ldexpl(x86_fp80 noundef, i32 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
[C11/C2x] Change the behavior of the implicit function declaration warning
C89 had a questionable feature where the compiler would implicitly
declare a function that the user called but was never previously
declared. The resulting function would be globally declared as
extern int func(); -- a function without a prototype which accepts zero
or more arguments.
C99 removed support for this questionable feature due to severe
security concerns. However, there was no deprecation period; C89 had
the feature, C99 didn't. So Clang (and GCC) both supported the
functionality as an extension in C99 and later modes.
C2x no longer supports that function signature as it now requires all
functions to have a prototype, and given the known security issues with
the feature, continuing to support it as an extension is not tenable.
This patch changes the diagnostic behavior for the
-Wimplicit-function-declaration warning group depending on the language
mode in effect. We continue to warn by default in C89 mode (due to the
feature being dangerous to use). However, because this feature will not
be supported in C2x mode, we've diagnosed it as being invalid for so
long, the security concerns with the feature, and the trivial
workaround for users (declare the function), we now default the
extension warning to an error in C99-C17 mode. This still gives users
an easy workaround if they are extensively using the extension in those
modes (they can disable the warning or use -Wno-error to downgrade the
error), but the new diagnostic makes it more clear that this feature is
not supported and should be avoided. In C2x mode, we no longer allow an
implicit function to be defined and treat the situation the same as any
other lookup failure.
Differential Revision: https://reviews.llvm.org/D122983
2022-04-20 11:25:35 -04:00
|
|
|
modf(f,d); modff(f,fp); modfl(f,l);
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2025-03-11 14:55:33 +00:00
|
|
|
// NO__ERRNO: declare { double, double } @llvm.modf.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare { float, float } @llvm.modf.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare { x86_fp80, x86_fp80 } @llvm.modf.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare { double, double } @llvm.modf.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare { float, float } @llvm.modf.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare { x86_fp80, x86_fp80 } @llvm.modf.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2023-02-17 14:34:05 +01:00
|
|
|
// HAS_MAYTRAP: declare double @modf(double noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @modff(float noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @modfl(x86_fp80 noundef, ptr noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
[C11/C2x] Change the behavior of the implicit function declaration warning
C89 had a questionable feature where the compiler would implicitly
declare a function that the user called but was never previously
declared. The resulting function would be globally declared as
extern int func(); -- a function without a prototype which accepts zero
or more arguments.
C99 removed support for this questionable feature due to severe
security concerns. However, there was no deprecation period; C89 had
the feature, C99 didn't. So Clang (and GCC) both supported the
functionality as an extension in C99 and later modes.
C2x no longer supports that function signature as it now requires all
functions to have a prototype, and given the known security issues with
the feature, continuing to support it as an extension is not tenable.
This patch changes the diagnostic behavior for the
-Wimplicit-function-declaration warning group depending on the language
mode in effect. We continue to warn by default in C89 mode (due to the
feature being dangerous to use). However, because this feature will not
be supported in C2x mode, we've diagnosed it as being invalid for so
long, the security concerns with the feature, and the trivial
workaround for users (declare the function), we now default the
extension warning to an error in C99-C17 mode. This still gives users
an easy workaround if they are extensively using the extension in those
modes (they can disable the warning or use -Wno-error to downgrade the
error), but the new diagnostic makes it more clear that this feature is
not supported and should be avoided. In C2x mode, we no longer allow an
implicit function to be defined and treat the situation the same as any
other lookup failure.
Differential Revision: https://reviews.llvm.org/D122983
2022-04-20 11:25:35 -04:00
|
|
|
nan(c); nanf(c); nanl(c);
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2023-02-17 14:34:05 +01:00
|
|
|
// NO__ERRNO: declare double @nan(ptr noundef) [[READONLY:#[0-9]+]]
|
|
|
|
// NO__ERRNO: declare float @nanf(ptr noundef) [[READONLY]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @nanl(ptr noundef) [[READONLY]]
|
|
|
|
// HAS_ERRNO: declare double @nan(ptr noundef) [[READONLY:#[0-9]+]]
|
|
|
|
// HAS_ERRNO: declare float @nanf(ptr noundef) [[READONLY]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @nanl(ptr noundef) [[READONLY]]
|
|
|
|
// HAS_MAYTRAP: declare double @nan(ptr noundef) [[READONLY:#[0-9]+]]
|
|
|
|
// HAS_MAYTRAP: declare float @nanf(ptr noundef) [[READONLY]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @nanl(ptr noundef) [[READONLY]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
pow(f,f); powf(f,f); powl(f,f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.pow.f64(double, double) [[READNONE_INTRINSIC]]
|
2017-11-03 16:27:27 +00:00
|
|
|
// NO__ERRNO: declare float @llvm.pow.f32(float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.pow.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @pow(double noundef, double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @powf(float noundef, float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @powl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.pow.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.pow.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.pow.f80({{.*}})
|
|
|
|
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
/* math */
|
|
|
|
acos(f); acosf(f); acosl(f);
|
|
|
|
|
2024-07-19 10:19:41 -04:00
|
|
|
// NO__ERRNO: declare double @llvm.acos.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.acos.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.acos.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @acos(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @acosf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @acosl(x86_fp80 noundef) [[NOT_READNONE]]
|
2024-07-19 10:19:41 -04:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.acos.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.acos.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.acos.f80(
|
2022-07-29 13:45:33 +01:00
|
|
|
|
2017-11-03 16:27:27 +00:00
|
|
|
|
[C11/C2x] Change the behavior of the implicit function declaration warning
C89 had a questionable feature where the compiler would implicitly
declare a function that the user called but was never previously
declared. The resulting function would be globally declared as
extern int func(); -- a function without a prototype which accepts zero
or more arguments.
C99 removed support for this questionable feature due to severe
security concerns. However, there was no deprecation period; C89 had
the feature, C99 didn't. So Clang (and GCC) both supported the
functionality as an extension in C99 and later modes.
C2x no longer supports that function signature as it now requires all
functions to have a prototype, and given the known security issues with
the feature, continuing to support it as an extension is not tenable.
This patch changes the diagnostic behavior for the
-Wimplicit-function-declaration warning group depending on the language
mode in effect. We continue to warn by default in C89 mode (due to the
feature being dangerous to use). However, because this feature will not
be supported in C2x mode, we've diagnosed it as being invalid for so
long, the security concerns with the feature, and the trivial
workaround for users (declare the function), we now default the
extension warning to an error in C99-C17 mode. This still gives users
an easy workaround if they are extensively using the extension in those
modes (they can disable the warning or use -Wno-error to downgrade the
error), but the new diagnostic makes it more clear that this feature is
not supported and should be avoided. In C2x mode, we no longer allow an
implicit function to be defined and treat the situation the same as any
other lookup failure.
Differential Revision: https://reviews.llvm.org/D122983
2022-04-20 11:25:35 -04:00
|
|
|
acosh(f); acoshf(f); acoshl(f);
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @acosh(double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @acoshf(float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @acoshl(x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @acosh(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @acoshf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @acoshl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @acosh(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @acoshf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @acoshl(x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
[C11/C2x] Change the behavior of the implicit function declaration warning
C89 had a questionable feature where the compiler would implicitly
declare a function that the user called but was never previously
declared. The resulting function would be globally declared as
extern int func(); -- a function without a prototype which accepts zero
or more arguments.
C99 removed support for this questionable feature due to severe
security concerns. However, there was no deprecation period; C89 had
the feature, C99 didn't. So Clang (and GCC) both supported the
functionality as an extension in C99 and later modes.
C2x no longer supports that function signature as it now requires all
functions to have a prototype, and given the known security issues with
the feature, continuing to support it as an extension is not tenable.
This patch changes the diagnostic behavior for the
-Wimplicit-function-declaration warning group depending on the language
mode in effect. We continue to warn by default in C89 mode (due to the
feature being dangerous to use). However, because this feature will not
be supported in C2x mode, we've diagnosed it as being invalid for so
long, the security concerns with the feature, and the trivial
workaround for users (declare the function), we now default the
extension warning to an error in C99-C17 mode. This still gives users
an easy workaround if they are extensively using the extension in those
modes (they can disable the warning or use -Wno-error to downgrade the
error), but the new diagnostic makes it more clear that this feature is
not supported and should be avoided. In C2x mode, we no longer allow an
implicit function to be defined and treat the situation the same as any
other lookup failure.
Differential Revision: https://reviews.llvm.org/D122983
2022-04-20 11:25:35 -04:00
|
|
|
asin(f); asinf(f); asinl(f);
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2024-07-19 10:19:41 -04:00
|
|
|
// NO__ERRNO: declare double @llvm.asin.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.asin.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.asin.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @asin(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @asinf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @asinl(x86_fp80 noundef) [[NOT_READNONE]]
|
2024-07-19 10:19:41 -04:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.asin.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.asin.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.asin.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
asinh(f); asinhf(f); asinhl(f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @asinh(double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @asinhf(float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @asinhl(x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @asinh(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @asinhf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @asinhl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @asinh(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @asinhf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @asinhl(x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
atan(f); atanf(f); atanl(f);
|
|
|
|
|
2024-07-19 10:19:41 -04:00
|
|
|
// NO__ERRNO: declare double @llvm.atan.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.atan.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.atan.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @atan(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @atanf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @atanl(x86_fp80 noundef) [[NOT_READNONE]]
|
2024-07-19 10:19:41 -04:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.atan.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.atan.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.atan.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
[C11/C2x] Change the behavior of the implicit function declaration warning
C89 had a questionable feature where the compiler would implicitly
declare a function that the user called but was never previously
declared. The resulting function would be globally declared as
extern int func(); -- a function without a prototype which accepts zero
or more arguments.
C99 removed support for this questionable feature due to severe
security concerns. However, there was no deprecation period; C89 had
the feature, C99 didn't. So Clang (and GCC) both supported the
functionality as an extension in C99 and later modes.
C2x no longer supports that function signature as it now requires all
functions to have a prototype, and given the known security issues with
the feature, continuing to support it as an extension is not tenable.
This patch changes the diagnostic behavior for the
-Wimplicit-function-declaration warning group depending on the language
mode in effect. We continue to warn by default in C89 mode (due to the
feature being dangerous to use). However, because this feature will not
be supported in C2x mode, we've diagnosed it as being invalid for so
long, the security concerns with the feature, and the trivial
workaround for users (declare the function), we now default the
extension warning to an error in C99-C17 mode. This still gives users
an easy workaround if they are extensively using the extension in those
modes (they can disable the warning or use -Wno-error to downgrade the
error), but the new diagnostic makes it more clear that this feature is
not supported and should be avoided. In C2x mode, we no longer allow an
implicit function to be defined and treat the situation the same as any
other lookup failure.
Differential Revision: https://reviews.llvm.org/D122983
2022-04-20 11:25:35 -04:00
|
|
|
atanh(f); atanhf(f); atanhl(f);
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @atanh(double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @atanhf(float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @atanhl(x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @atanh(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @atanhf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @atanhl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @atanh(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @atanhf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @atanhl(x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
cbrt(f); cbrtf(f); cbrtl(f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @cbrt(double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @cbrtf(float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @cbrtl(x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @cbrt(double noundef) [[READNONE:#[0-9]+]]
|
|
|
|
// HAS_ERRNO: declare float @cbrtf(float noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @cbrtl(x86_fp80 noundef) [[READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @cbrt(double noundef) [[READNONE:#[0-9]+]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare float @cbrtf(float noundef) [[READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @cbrtl(x86_fp80 noundef) [[READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
ceil(f); ceilf(f); ceill(f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare double @llvm.ceil.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare float @llvm.ceil.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @llvm.ceil.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.ceil.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.ceil.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.ceil.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
[C11/C2x] Change the behavior of the implicit function declaration warning
C89 had a questionable feature where the compiler would implicitly
declare a function that the user called but was never previously
declared. The resulting function would be globally declared as
extern int func(); -- a function without a prototype which accepts zero
or more arguments.
C99 removed support for this questionable feature due to severe
security concerns. However, there was no deprecation period; C89 had
the feature, C99 didn't. So Clang (and GCC) both supported the
functionality as an extension in C99 and later modes.
C2x no longer supports that function signature as it now requires all
functions to have a prototype, and given the known security issues with
the feature, continuing to support it as an extension is not tenable.
This patch changes the diagnostic behavior for the
-Wimplicit-function-declaration warning group depending on the language
mode in effect. We continue to warn by default in C89 mode (due to the
feature being dangerous to use). However, because this feature will not
be supported in C2x mode, we've diagnosed it as being invalid for so
long, the security concerns with the feature, and the trivial
workaround for users (declare the function), we now default the
extension warning to an error in C99-C17 mode. This still gives users
an easy workaround if they are extensively using the extension in those
modes (they can disable the warning or use -Wno-error to downgrade the
error), but the new diagnostic makes it more clear that this feature is
not supported and should be avoided. In C2x mode, we no longer allow an
implicit function to be defined and treat the situation the same as any
other lookup failure.
Differential Revision: https://reviews.llvm.org/D122983
2022-04-20 11:25:35 -04:00
|
|
|
cos(f); cosf(f); cosl(f);
|
2017-11-03 16:27:27 +00:00
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.cos.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.cos.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.cos.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @cos(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @cosf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @cosl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.cos.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.cos.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.cos.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
cosh(f); coshf(f); coshl(f);
|
|
|
|
|
2024-07-19 10:19:41 -04:00
|
|
|
// NO__ERRNO: declare double @llvm.cosh.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.cosh.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.cosh.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @cosh(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @coshf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @coshl(x86_fp80 noundef) [[NOT_READNONE]]
|
2024-07-19 10:19:41 -04:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.cosh.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.cosh.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.cosh.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
erf(f); erff(f); erfl(f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @erf(double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @erff(float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @erfl(x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @erf(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @erff(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @erfl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @erf(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @erff(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @erfl(x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
erfc(f); erfcf(f); erfcl(f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @erfc(double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @erfcf(float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @erfcl(x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @erfc(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @erfcf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @erfcl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @erfc(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @erfcf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @erfcl(x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
exp(f); expf(f); expl(f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.exp.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.exp.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.exp.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @exp(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @expf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @expl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.exp.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.exp.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.exp.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
[C11/C2x] Change the behavior of the implicit function declaration warning
C89 had a questionable feature where the compiler would implicitly
declare a function that the user called but was never previously
declared. The resulting function would be globally declared as
extern int func(); -- a function without a prototype which accepts zero
or more arguments.
C99 removed support for this questionable feature due to severe
security concerns. However, there was no deprecation period; C89 had
the feature, C99 didn't. So Clang (and GCC) both supported the
functionality as an extension in C99 and later modes.
C2x no longer supports that function signature as it now requires all
functions to have a prototype, and given the known security issues with
the feature, continuing to support it as an extension is not tenable.
This patch changes the diagnostic behavior for the
-Wimplicit-function-declaration warning group depending on the language
mode in effect. We continue to warn by default in C89 mode (due to the
feature being dangerous to use). However, because this feature will not
be supported in C2x mode, we've diagnosed it as being invalid for so
long, the security concerns with the feature, and the trivial
workaround for users (declare the function), we now default the
extension warning to an error in C99-C17 mode. This still gives users
an easy workaround if they are extensively using the extension in those
modes (they can disable the warning or use -Wno-error to downgrade the
error), but the new diagnostic makes it more clear that this feature is
not supported and should be avoided. In C2x mode, we no longer allow an
implicit function to be defined and treat the situation the same as any
other lookup failure.
Differential Revision: https://reviews.llvm.org/D122983
2022-04-20 11:25:35 -04:00
|
|
|
exp2(f); exp2f(f); exp2l(f);
|
2017-11-03 16:27:27 +00:00
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.exp2.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.exp2.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.exp2.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @exp2(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @exp2f(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @exp2l(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.exp2.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.exp2.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.exp2.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
expm1(f); expm1f(f); expm1l(f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @expm1(double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @expm1f(float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @expm1l(x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @expm1(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @expm1f(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @expm1l(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @expm1(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @expm1f(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @expm1l(x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
fdim(f,f); fdimf(f,f); fdiml(f,f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @fdim(double noundef, double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @fdimf(float noundef, float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @fdiml(x86_fp80 noundef, x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @fdim(double noundef, double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @fdimf(float noundef, float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @fdiml(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @fdim(double noundef, double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @fdimf(float noundef, float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @fdiml(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
floor(f); floorf(f); floorl(f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare double @llvm.floor.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare float @llvm.floor.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @llvm.floor.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.floor.f64
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.floor.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.floor.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
fma(f,f,f); fmaf(f,f,f); fmal(f,f,f);
|
|
|
|
|
|
|
|
// NO__ERRNO: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @fma(double noundef, double noundef, double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @fmaf(float noundef, float noundef, float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @fmal(x86_fp80 noundef, x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-13 22:11:49 +00:00
|
|
|
|
|
|
|
// On GNU or Win, fma never sets errno, so we can convert to the intrinsic.
|
|
|
|
|
|
|
|
// HAS_ERRNO_GNU: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
|
|
|
|
// HAS_ERRNO_GNU: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO_GNU: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
|
|
|
|
// HAS_ERRNO_WIN: declare double @llvm.fma.f64(double, double, double) [[READNONE_INTRINSIC:#[0-9]+]]
|
|
|
|
// HAS_ERRNO_WIN: declare float @llvm.fma.f32(float, float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// Long double is just double on win, so no f80 use/declaration.
|
|
|
|
// HAS_ERRNO_WIN-NOT: declare x86_fp80 @llvm.fma.f80(x86_fp80, x86_fp80, x86_fp80)
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.fma.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.fma.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.fma.f80(
|
|
|
|
|
2017-11-03 16:27:27 +00:00
|
|
|
fmax(f,f); fmaxf(f,f); fmaxl(f,f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare double @llvm.maxnum.f64(double, double) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare float @llvm.maxnum.f32(float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @llvm.maxnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.maxnum.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.maxnum.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.maxnum.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
fmin(f,f); fminf(f,f); fminl(f,f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare double @llvm.minnum.f64(double, double) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare float @llvm.minnum.f32(float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @llvm.minnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.minnum.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.minnum.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.minnum.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2024-10-14 15:49:01 +08:00
|
|
|
fmaximum_num(*d,*d); fmaximum_numf(f,f); fmaximum_numl(*l,*l);
|
|
|
|
|
|
|
|
// COMMON: declare double @llvm.maximumnum.f64(double, double) [[READNONE_INTRINSIC]]
|
|
|
|
// COMMON: declare float @llvm.maximumnum.f32(float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// COMMON: declare x86_fp80 @llvm.maximumnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
|
|
|
|
fminimum_num(*d,*d); fminimum_numf(f,f); fminimum_numl(*l,*l);
|
|
|
|
|
|
|
|
// COMMON: declare double @llvm.minimumnum.f64(double, double) [[READNONE_INTRINSIC]]
|
|
|
|
// COMMON: declare float @llvm.minimumnum.f32(float, float) [[READNONE_INTRINSIC]]
|
|
|
|
// COMMON: declare x86_fp80 @llvm.minimumnum.f80(x86_fp80, x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
|
2017-11-03 16:27:27 +00:00
|
|
|
hypot(f,f); hypotf(f,f); hypotl(f,f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @hypot(double noundef, double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @hypotf(float noundef, float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @hypotl(x86_fp80 noundef, x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @hypot(double noundef, double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @hypotf(float noundef, float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @hypotl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @hypot(double noundef, double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @hypotf(float noundef, float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @hypotl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
[C11/C2x] Change the behavior of the implicit function declaration warning
C89 had a questionable feature where the compiler would implicitly
declare a function that the user called but was never previously
declared. The resulting function would be globally declared as
extern int func(); -- a function without a prototype which accepts zero
or more arguments.
C99 removed support for this questionable feature due to severe
security concerns. However, there was no deprecation period; C89 had
the feature, C99 didn't. So Clang (and GCC) both supported the
functionality as an extension in C99 and later modes.
C2x no longer supports that function signature as it now requires all
functions to have a prototype, and given the known security issues with
the feature, continuing to support it as an extension is not tenable.
This patch changes the diagnostic behavior for the
-Wimplicit-function-declaration warning group depending on the language
mode in effect. We continue to warn by default in C89 mode (due to the
feature being dangerous to use). However, because this feature will not
be supported in C2x mode, we've diagnosed it as being invalid for so
long, the security concerns with the feature, and the trivial
workaround for users (declare the function), we now default the
extension warning to an error in C99-C17 mode. This still gives users
an easy workaround if they are extensively using the extension in those
modes (they can disable the warning or use -Wno-error to downgrade the
error), but the new diagnostic makes it more clear that this feature is
not supported and should be avoided. In C2x mode, we no longer allow an
implicit function to be defined and treat the situation the same as any
other lookup failure.
Differential Revision: https://reviews.llvm.org/D122983
2022-04-20 11:25:35 -04:00
|
|
|
ilogb(f); ilogbf(f); ilogbl(f);
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare i32 @ilogb(double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare i32 @ilogbf(float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare i32 @ilogbl(x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare i32 @ilogb(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare i32 @ilogbf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare i32 @ilogbl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare i32 @ilogb(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare i32 @ilogbf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare i32 @ilogbl(x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
lgamma(f); lgammaf(f); lgammal(f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @lgamma(double noundef) [[NOT_READNONE]]
|
|
|
|
// NO__ERRNO: declare float @lgammaf(float noundef) [[NOT_READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @lgammal(x86_fp80 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @lgamma(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @lgammaf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @lgammal(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @lgamma(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @lgammaf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @lgammal(x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
llrint(f); llrintf(f); llrintl(f);
|
|
|
|
|
2019-05-28 21:16:04 +00:00
|
|
|
// NO__ERRNO: declare i64 @llvm.llrint.i64.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare i64 @llvm.llrint.i64.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare i64 @llvm.llrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare i64 @llrint(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare i64 @llrintf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare i64 @llrintl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare i64 @llvm.experimental.constrained.llrint.i64.f64(
|
|
|
|
// HAS_MAYTRAP: declare i64 @llvm.experimental.constrained.llrint.i64.f32(
|
|
|
|
// HAS_MAYTRAP: declare i64 @llvm.experimental.constrained.llrint.i64.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
llround(f); llroundf(f); llroundl(f);
|
|
|
|
|
2019-05-20 16:27:09 +00:00
|
|
|
// NO__ERRNO: declare i64 @llvm.llround.i64.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare i64 @llvm.llround.i64.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare i64 @llvm.llround.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare i64 @llround(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare i64 @llroundf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare i64 @llroundl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare i64 @llvm.experimental.constrained.llround.i64.f64(
|
|
|
|
// HAS_MAYTRAP: declare i64 @llvm.experimental.constrained.llround.i64.f32(
|
|
|
|
// HAS_MAYTRAP: declare i64 @llvm.experimental.constrained.llround.i64.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
log(f); logf(f); logl(f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.log.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.log.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.log.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @log(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @logf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @logl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.log.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.log.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.log.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
log10(f); log10f(f); log10l(f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.log10.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.log10.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.log10.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @log10(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @log10f(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @log10l(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.log10.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.log10.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.log10.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
log1p(f); log1pf(f); log1pl(f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @log1p(double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @log1pf(float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @log1pl(x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @log1p(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @log1pf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @log1pl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @log1p(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @log1pf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @log1pl(x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
log2(f); log2f(f); log2l(f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.log2.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.log2.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.log2.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @log2(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @log2f(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @log2l(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.log2.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.log2.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.log2.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
logb(f); logbf(f); logbl(f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @logb(double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @logbf(float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @logbl(x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @logb(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @logbf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @logbl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @logb(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @logbf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @logbl(x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
lrint(f); lrintf(f); lrintl(f);
|
|
|
|
|
2019-05-28 21:16:04 +00:00
|
|
|
// NO__ERRNO: declare i64 @llvm.lrint.i64.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare i64 @llvm.lrint.i64.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare i64 @llvm.lrint.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare i64 @lrint(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare i64 @lrintf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare i64 @lrintl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare i64 @llvm.experimental.constrained.lrint.i64.f64(
|
|
|
|
// HAS_MAYTRAP: declare i64 @llvm.experimental.constrained.lrint.i64.f32(
|
|
|
|
// HAS_MAYTRAP: declare i64 @llvm.experimental.constrained.lrint.i64.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
lround(f); lroundf(f); lroundl(f);
|
|
|
|
|
2019-05-16 13:43:25 +00:00
|
|
|
// NO__ERRNO: declare i64 @llvm.lround.i64.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare i64 @llvm.lround.i64.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare i64 @llvm.lround.i64.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare i64 @lround(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare i64 @lroundf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare i64 @lroundl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare i64 @llvm.experimental.constrained.lround.i64.f64(
|
|
|
|
// HAS_MAYTRAP: declare i64 @llvm.experimental.constrained.lround.i64.f32(
|
|
|
|
// HAS_MAYTRAP: declare i64 @llvm.experimental.constrained.lround.i64.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
nearbyint(f); nearbyintf(f); nearbyintl(f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare double @llvm.nearbyint.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare float @llvm.nearbyint.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @llvm.nearbyint.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.nearbyint.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.nearbyint.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.nearbyint.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
nextafter(f,f); nextafterf(f,f); nextafterl(f,f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @nextafter(double noundef, double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @nextafterf(float noundef, float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @nextafterl(x86_fp80 noundef, x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @nextafter(double noundef, double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @nextafterf(float noundef, float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @nextafterl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @nextafter(double noundef, double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @nextafterf(float noundef, float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @nextafterl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
nexttoward(f,f); nexttowardf(f,f);nexttowardl(f,f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @nexttoward(double noundef, x86_fp80 noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @nexttowardf(float noundef, x86_fp80 noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @nexttowardl(x86_fp80 noundef, x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @nexttoward(double noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @nexttowardf(float noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @nexttowardl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @nexttoward(double noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @nexttowardf(float noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @nexttowardl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
remainder(f,f); remainderf(f,f); remainderl(f,f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @remainder(double noundef, double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @remainderf(float noundef, float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @remainderl(x86_fp80 noundef, x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @remainder(double noundef, double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @remainderf(float noundef, float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @remainderl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @remainder(double noundef, double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @remainderf(float noundef, float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @remainderl(x86_fp80 noundef, x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2017-11-04 15:03:11 +00:00
|
|
|
remquo(f,f,i); remquof(f,f,i); remquol(f,f,i);
|
|
|
|
|
2023-02-17 14:34:05 +01:00
|
|
|
// NO__ERRNO: declare double @remquo(double noundef, double noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// NO__ERRNO: declare float @remquof(float noundef, float noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @remquol(x86_fp80 noundef, x86_fp80 noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @remquo(double noundef, double noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @remquof(float noundef, float noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @remquol(x86_fp80 noundef, x86_fp80 noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare double @remquo(double noundef, double noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @remquof(float noundef, float noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @remquol(x86_fp80 noundef, x86_fp80 noundef, ptr noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
rint(f); rintf(f); rintl(f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare double @llvm.rint.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare float @llvm.rint.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @llvm.rint.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.rint.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.rint.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.rint.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
round(f); roundf(f); roundl(f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare double @llvm.round.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare float @llvm.round.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @llvm.round.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.round.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.round.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.round.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
scalbln(f,f); scalblnf(f,f); scalblnl(f,f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @scalbln(double noundef, i64 noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @scalblnf(float noundef, i64 noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @scalblnl(x86_fp80 noundef, i64 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @scalbln(double noundef, i64 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @scalblnf(float noundef, i64 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @scalblnl(x86_fp80 noundef, i64 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @scalbln(double noundef, i64 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @scalblnf(float noundef, i64 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @scalblnl(x86_fp80 noundef, i64 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
scalbn(f,f); scalbnf(f,f); scalbnl(f,f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @scalbn(double noundef, i32 noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @scalbnf(float noundef, i32 noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @scalbnl(x86_fp80 noundef, i32 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @scalbn(double noundef, i32 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @scalbnf(float noundef, i32 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @scalbnl(x86_fp80 noundef, i32 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @scalbn(double noundef, i32 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @scalbnf(float noundef, i32 noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @scalbnl(x86_fp80 noundef, i32 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
sin(f); sinf(f); sinl(f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.sin.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.sin.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.sin.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @sin(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @sinf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @sinl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.sin.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.sin.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.sin.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
sinh(f); sinhf(f); sinhl(f);
|
|
|
|
|
2024-07-19 10:19:41 -04:00
|
|
|
// NO__ERRNO: declare double @llvm.sinh.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.sinh.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.sinh.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @sinh(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @sinhf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @sinhl(x86_fp80 noundef) [[NOT_READNONE]]
|
2024-07-19 10:19:41 -04:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.sinh.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.sinh.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.sinh.f80(
|
|
|
|
|
2025-02-19 10:13:41 +00:00
|
|
|
sincos(f, d, d); sincosf(f, fp, fp); sincosl(f, l, l);
|
|
|
|
|
|
|
|
// NO__ERRNO: declare { double, double } @llvm.sincos.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare { float, float } @llvm.sincos.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare { x86_fp80, x86_fp80 } @llvm.sincos.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare void @sincos(double noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare void @sincosf(float noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare void @sincosl(x86_fp80 noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare void @sincos(double noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare void @sincosf(float noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare void @sincosl(x86_fp80 noundef, ptr noundef, ptr noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
[C11/C2x] Change the behavior of the implicit function declaration warning
C89 had a questionable feature where the compiler would implicitly
declare a function that the user called but was never previously
declared. The resulting function would be globally declared as
extern int func(); -- a function without a prototype which accepts zero
or more arguments.
C99 removed support for this questionable feature due to severe
security concerns. However, there was no deprecation period; C89 had
the feature, C99 didn't. So Clang (and GCC) both supported the
functionality as an extension in C99 and later modes.
C2x no longer supports that function signature as it now requires all
functions to have a prototype, and given the known security issues with
the feature, continuing to support it as an extension is not tenable.
This patch changes the diagnostic behavior for the
-Wimplicit-function-declaration warning group depending on the language
mode in effect. We continue to warn by default in C89 mode (due to the
feature being dangerous to use). However, because this feature will not
be supported in C2x mode, we've diagnosed it as being invalid for so
long, the security concerns with the feature, and the trivial
workaround for users (declare the function), we now default the
extension warning to an error in C99-C17 mode. This still gives users
an easy workaround if they are extensively using the extension in those
modes (they can disable the warning or use -Wno-error to downgrade the
error), but the new diagnostic makes it more clear that this feature is
not supported and should be avoided. In C2x mode, we no longer allow an
implicit function to be defined and treat the situation the same as any
other lookup failure.
Differential Revision: https://reviews.llvm.org/D122983
2022-04-20 11:25:35 -04:00
|
|
|
sqrt(f); sqrtf(f); sqrtl(f);
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
// NO__ERRNO: declare double @llvm.sqrt.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.sqrt.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.sqrt.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @sqrt(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @sqrtf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @sqrtl(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.sqrt.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.sqrt.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.sqrt.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
tan(f); tanf(f); tanl(f);
|
|
|
|
|
2024-06-10 20:46:26 -04:00
|
|
|
// NO__ERRNO: declare double @llvm.tan.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.tan.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.tan.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @tan(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @tanf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @tanl(x86_fp80 noundef) [[NOT_READNONE]]
|
2024-06-10 20:46:26 -04:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.tan.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.tan.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.tan.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
tanh(f); tanhf(f); tanhl(f);
|
|
|
|
|
2024-07-19 10:19:41 -04:00
|
|
|
// NO__ERRNO: declare double @llvm.tanh.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.tanh.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.tanh.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2022-01-16 18:53:11 +09:00
|
|
|
// HAS_ERRNO: declare double @tanh(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @tanhf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @tanhl(x86_fp80 noundef) [[NOT_READNONE]]
|
2024-07-19 10:19:41 -04:00
|
|
|
// HAS_MAYTRAP: declare double @llvm.experimental.constrained.tanh.f64(
|
|
|
|
// HAS_MAYTRAP: declare float @llvm.experimental.constrained.tanh.f32(
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @llvm.experimental.constrained.tanh.f80(
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
tgamma(f); tgammaf(f); tgammal(f);
|
|
|
|
|
2022-01-16 18:53:11 +09:00
|
|
|
// NO__ERRNO: declare double @tgamma(double noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare float @tgammaf(float noundef) [[READNONE]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @tgammal(x86_fp80 noundef) [[READNONE]]
|
|
|
|
// HAS_ERRNO: declare double @tgamma(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare float @tgammaf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @tgammal(x86_fp80 noundef) [[NOT_READNONE]]
|
2022-08-11 12:29:01 +01:00
|
|
|
// HAS_MAYTRAP: declare double @tgamma(double noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare float @tgammaf(float noundef) [[NOT_READNONE]]
|
|
|
|
// HAS_MAYTRAP: declare x86_fp80 @tgammal(x86_fp80 noundef) [[NOT_READNONE]]
|
2017-11-03 16:27:27 +00:00
|
|
|
|
|
|
|
trunc(f); truncf(f); truncl(f);
|
|
|
|
|
[CodeGen] convert math libcalls/builtins to equivalent LLVM intrinsics
There are 20 LLVM math intrinsics that correspond to mathlib calls according to the LangRef:
http://llvm.org/docs/LangRef.html#standard-c-library-intrinsics
We were only converting 3 mathlib calls (sqrt, fma, pow) and 12 builtin calls (ceil, copysign,
fabs, floor, fma, fmax, fmin, nearbyint, pow, rint, round, trunc) to their intrinsic-equivalents.
This patch pulls the transforms together and handles all 20 cases. The switch is guarded by a
check for const-ness to make sure we're not doing the transform if errno could possibly be set by
the libcall or builtin.
Differential Revision: https://reviews.llvm.org/D40044
llvm-svn: 319593
2017-12-01 23:15:52 +00:00
|
|
|
// NO__ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// NO__ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare double @llvm.trunc.f64(double) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare float @llvm.trunc.f32(float) [[READNONE_INTRINSIC]]
|
|
|
|
// HAS_ERRNO: declare x86_fp80 @llvm.trunc.f80(x86_fp80) [[READNONE_INTRINSIC]]
|
2017-11-03 16:27:27 +00:00
|
|
|
};
|
|
|
|
|
2022-11-02 16:46:56 +01:00
|
|
|
// NO__ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
|
2020-09-28 10:51:17 -04:00
|
|
|
// NO__ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
|
2024-11-12 13:34:29 -08:00
|
|
|
// NO__ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
|
2022-11-02 16:46:56 +01:00
|
|
|
// NO__ERRNO: attributes [[READONLY]] = { {{.*}}memory(read){{.*}} }
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2020-09-28 10:51:17 -04:00
|
|
|
// HAS_ERRNO: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
|
2022-11-02 16:46:56 +01:00
|
|
|
// HAS_ERRNO: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
|
|
|
|
// HAS_ERRNO: attributes [[READONLY]] = { {{.*}}memory(read){{.*}} }
|
|
|
|
// HAS_ERRNO: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
|
2017-11-03 16:27:27 +00:00
|
|
|
|
2022-07-29 13:45:33 +01:00
|
|
|
// HAS_MAYTRAP: attributes [[NOT_READNONE]] = { nounwind {{.*}} }
|
2022-11-02 16:46:56 +01:00
|
|
|
// HAS_MAYTRAP: attributes [[READNONE]] = { {{.*}}memory(none){{.*}} }
|
2022-07-29 13:45:33 +01:00
|
|
|
|
2022-11-02 16:46:56 +01:00
|
|
|
// HAS_ERRNO_GNU: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
|
|
|
|
// HAS_ERRNO_WIN: attributes [[READNONE_INTRINSIC]] = { {{.*}}memory(none){{.*}} }
|