[PATCH] D49514: [compiler-rt] [builtins] Add logb/logbf/logbl methods to compiler-rt to avoid libm dependencies when possible.
Jordan Rupprecht via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 18 15:04:27 PDT 2018
rupprecht created this revision.
rupprecht added reviewers: saugustine, efriedma.
Herald added subscribers: Sanitizers, llvm-commits, delcypher, kbarton, mgorny, dberris, nemanjai.
The complex division builtins (div?c3) use logb methods from libm to scale numbers during division and avoid rounding issues. However, these come from libm, meaning anyone that uses --rtlib=compiler-rt also has to include -lm. Implement logb* methods for standard ieee 754 floats so we can avoid -lm on those platforms, falling back to the old behavior (using either logb() or __builtin_logb()) when not supported.
These new methods are defined internally as __compiler_rt_logb* so as not to conflict with the libm definitions in any way.
Fixes PR32279 and PR28652.
Note: this is proposed as an alternative to just adding -lm: https://reviews.llvm.org/D49330.
Repository:
rCRT Compiler Runtime
https://reviews.llvm.org/D49514
Files:
lib/builtins/CMakeLists.txt
lib/builtins/compiler_rt_logb.c
lib/builtins/compiler_rt_logbf.c
lib/builtins/compiler_rt_logbl.c
lib/builtins/divdc3.c
lib/builtins/divsc3.c
lib/builtins/divtc3.c
lib/builtins/divxc3.c
lib/builtins/fp_lib.h
lib/builtins/fp_logb_impl.inc
lib/builtins/int_math.h
lib/builtins/ppc/divtc3.c
test/builtins/Unit/compiler_rt_logb_test.c
test/builtins/Unit/compiler_rt_logbf_test.c
test/builtins/Unit/compiler_rt_logbl_test.c
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49514.156161.patch
Type: text/x-patch
Size: 17804 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180718/89973107/attachment.bin>
More information about the llvm-commits
mailing list