diff options
author | Sanjay Patel <spatel@rotateright.com> | 2017-12-01 23:15:52 +0000 |
---|---|---|
committer | Sanjay Patel <spatel@rotateright.com> | 2017-12-01 23:15:52 +0000 |
commit | 3e287b4d3535fefd048306e63f9382c5e03ad3fa (patch) | |
tree | bf7cfcaf47efd476a8c93d6d107dd51963c4fffe /clang/test/CodeGen/libcalls.c | |
parent | e7487e4c924071f764f58d8544e939137b374399 (diff) | |
download | bcm5719-llvm-3e287b4d3535fefd048306e63f9382c5e03ad3fa.tar.gz bcm5719-llvm-3e287b4d3535fefd048306e63f9382c5e03ad3fa.zip |
[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
Diffstat (limited to 'clang/test/CodeGen/libcalls.c')
-rw-r--r-- | clang/test/CodeGen/libcalls.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/test/CodeGen/libcalls.c b/clang/test/CodeGen/libcalls.c index 3cf86d36a24..1b314f777b4 100644 --- a/clang/test/CodeGen/libcalls.c +++ b/clang/test/CodeGen/libcalls.c @@ -105,9 +105,9 @@ void test_builtins(double d, float f, long double ld) { double exp_ = exp(d); long double expl_ = expl(ld); float expf_ = expf(f); -// CHECK-NO: declare double @exp(double) [[NUW_RN]] -// CHECK-NO: declare x86_fp80 @expl(x86_fp80) [[NUW_RN]] -// CHECK-NO: declare float @expf(float) [[NUW_RN]] +// CHECK-NO: declare double @llvm.exp.f64(double) [[NUW_RNI]] +// CHECK-NO: declare x86_fp80 @llvm.exp.f80(x86_fp80) [[NUW_RNI]] +// CHECK-NO: declare float @llvm.exp.f32(float) [[NUW_RNI]] // CHECK-YES-NOT: declare double @exp(double) [[NUW_RN]] // CHECK-YES-NOT: declare x86_fp80 @expl(x86_fp80) [[NUW_RN]] // CHECK-YES-NOT: declare float @expf(float) [[NUW_RN]] @@ -115,9 +115,9 @@ void test_builtins(double d, float f, long double ld) { double log_ = log(d); long double logl_ = logl(ld); float logf_ = logf(f); -// CHECK-NO: declare double @log(double) [[NUW_RN]] -// CHECK-NO: declare x86_fp80 @logl(x86_fp80) [[NUW_RN]] -// CHECK-NO: declare float @logf(float) [[NUW_RN]] +// CHECK-NO: declare double @llvm.log.f64(double) [[NUW_RNI]] +// CHECK-NO: declare x86_fp80 @llvm.log.f80(x86_fp80) [[NUW_RNI]] +// CHECK-NO: declare float @llvm.log.f32(float) [[NUW_RNI]] // CHECK-YES-NOT: declare double @log(double) [[NUW_RN]] // CHECK-YES-NOT: declare x86_fp80 @logl(x86_fp80) [[NUW_RN]] // CHECK-YES-NOT: declare float @logf(float) [[NUW_RN]] |