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/builtins.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/builtins.c')
-rw-r--r-- | clang/test/CodeGen/builtins.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/test/CodeGen/builtins.c b/clang/test/CodeGen/builtins.c index 0207bb6c9fe..4f84db00cbd 100644 --- a/clang/test/CodeGen/builtins.c +++ b/clang/test/CodeGen/builtins.c @@ -331,13 +331,13 @@ void test_float_builtin_ops(float F, double D, long double LD) { // CHECK: call x86_fp80 @llvm.floor.f80 resf = __builtin_sqrtf(F); - // CHECK: call float @sqrtf( + // CHECK: call float @llvm.sqrt.f32( resd = __builtin_sqrt(D); - // CHECK: call double @sqrt( + // CHECK: call double @llvm.sqrt.f64( resld = __builtin_sqrtl(LD); - // CHECK: call x86_fp80 @sqrtl( + // CHECK: call x86_fp80 @llvm.sqrt.f80 resf = __builtin_truncf(F); // CHECK: call float @llvm.trunc.f32 |