aboutsummaryrefslogtreecommitdiff
path: root/math/Makefile
diff options
context:
space:
mode:
authorPaul E. Murphy <murphyp@linux.vnet.ibm.com>2016-06-14 11:44:14 -0500
committerPaul E. Murphy <murphyp@linux.vnet.ibm.com>2016-08-17 14:06:03 -0500
commitce6698ea0aea863bbfb4e932494406789e4e36c1 (patch)
treefc8a53b53c2b6d459dd9b4a5042314bcad7f4482 /math/Makefile
parent1f645571d2db9008b3cd3d5acb9ff93357864283 (diff)
downloadglibc-ce6698ea0aea863bbfb4e932494406789e4e36c1.tar
glibc-ce6698ea0aea863bbfb4e932494406789e4e36c1.tar.gz
glibc-ce6698ea0aea863bbfb4e932494406789e4e36c1.tar.bz2
glibc-ce6698ea0aea863bbfb4e932494406789e4e36c1.zip
Support for type-generic libm function implementations libm
This defines a new classes of libm objects. The <func>_template.c file which is used in conjunction with the new makefile hooks to derive variants for each type supported by the target machine. The headers math-type-macros-TYPE.h are used to supply macros to a common implementation of a function in a file named FUNC_template.c and glued togethor via a generated file matching existing naming in the build directory. This has the properties of preserving the existing override mechanism and not requiring any arcane build system twiddling. Likewise, it enables machines to override these files without any additional work. I have verified the built objects for ppc64, x86_64, alpha, arm, and m68k do not change in any meaningful way with these changes using the Fedora cross toolchains. I have verified the x86_64 and ppc64 changes still run.
Diffstat (limited to 'math/Makefile')
-rw-r--r--math/Makefile31
1 files changed, 29 insertions, 2 deletions
diff --git a/math/Makefile b/math/Makefile
index 38a4709802..2ff1405110 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -43,6 +43,10 @@ libm-support = s_lib_version s_matherr s_signgam \
fesetenv feupdateenv t_exp fedisblxcpt feenablxcpt \
fegetexcept fesetexcept
+# Wrappers for these functions generated per type using a file named
+# <func>_template.c and the appropriate math-type-macros-<TYPE>.h.
+gen-libm-calls = cargF conjF cimagF crealF cabsF
+
libm-calls = \
e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \
e_hypotF e_j0F e_j1F e_jnF e_lgammaF_r e_logF e_log10F e_powF \
@@ -59,13 +63,13 @@ libm-calls = \
w_ilogbF \
s_fpclassifyF s_fmaxF s_fminF s_fdimF s_nanF s_truncF \
s_remquoF e_log2F e_exp2F s_roundF s_nearbyintF s_sincosF \
- conjF cimagF crealF cabsF cargF s_cexpF s_csinhF s_ccoshF s_clogF \
+ s_cexpF s_csinhF s_ccoshF s_clogF \
s_catanF s_casinF s_ccosF s_csinF s_ctanF s_ctanhF s_cacosF \
s_casinhF s_cacoshF s_catanhF s_csqrtF s_cpowF s_cprojF s_clog10F \
s_fmaF s_lrintF s_llrintF s_lroundF s_llroundF e_exp10F w_log2F \
s_issignalingF $(calls:s_%=m_%) x2y2m1F k_casinhF \
gamma_productF lgamma_negF lgamma_productF \
- s_nextupF s_nextdownF
+ s_nextupF s_nextdownF $(gen-libm-calls)
libm-compat-calls-ldouble-yes = w_lgamma_compatl k_standardl
libm-compat-calls = w_lgamma_compatf w_lgamma_compat k_standard k_standardf \
@@ -265,6 +269,29 @@ extra-objs += libieee.a ieee-math.o
include ../Rules
+generated += $(addsuffix .c,$(call type-foreach,$(gen-libm-calls))) \
+ gen-libm-templates.stmp
+
+# Create wrappers in the math build directory.
+$(objpfx)gen-libm-templates.stmp:
+ for gcall in $(gen-libm-calls); do \
+ func=$${gcall%F*}$${gcall#*F}; \
+ for type in $(foreach t,$(types),$(t)__$(type-$(t)-suffix)); do \
+ suff=$${type#*__}; \
+ type=$${type%__*}; \
+ file=$(objpfx)$${gcall%F*}$${suff}$${gcall#*F}.c; \
+ ( \
+ echo "#include <math-type-macros-$${type}.h>"; \
+ echo "#include <$${func}_template.c>"; \
+ ) > $${file}; \
+ done; \
+ done; \
+ echo > $(@)
+
+# Add dependency to ensure the generator runs prior.
+$(foreach t, $(call type-foreach, $(gen-libm-calls)), \
+ $(objpfx)$(t).c): $(objpfx)gen-libm-templates.stmp
+
ifneq (no,$(PERL))
# This must come after the inclusion of sysdeps Makefiles via Rules.
$(addprefix $(objpfx), $(libm-tests.o)): $(objpfx)libm-test.stmp