[PATCHv2 03/11] Support for type-generic libm function implementations libm

Paul E. Murphy murphyp@linux.vnet.ibm.com
Wed Aug 10 16:31:00 GMT 2016



On 08/10/2016 10:54 AM, Joseph Myers wrote:
> On Fri, 5 Aug 2016, Paul E. Murphy wrote:
> 
>> +# Functions built through generic templates declared in gen-libm-calls
>> +generated += $(foreach s,.c .S,$(call type-foreach,$(gen-libm-calls:%=%$(s))))
> 
> I don't see why you need to handle .S here (and so why you need the outer 
> foreach at all).  These templates should only generate .c files.
> 
>> +/* Use a special epsilon value for IBM long double
>> +   to avoid spurious overflows.  */
> 
> It's either overflows or underflows (or maybe both) depending on the 
> function being built; the comment should reflect this rather than just 
> saying overflows.
> 
> OK with those fixes unless anyone identifies any other issues within 48 
> hours.
> 

Thinking on Carlos' comments regarding tst-wcstod-round, I am wondering if
maybe it wouldn't be better to add an extra make target which instead
generates a .c file based on existing naming conventions. E.g:

	/* This file is generated by 'make regen-libm-templates.  Do not edit.  */
	#include <math-type-macros-${type}>
	#include <${func_unsuffixed}_template.c>

This has the benefit of leaving the existing implicit override mechanism
in place, and no insane makefile hacks.  I would prefer them living in
their own directory maybe math/generated, ensuring they are always included
after sysdep targets.

This target would not run as part of the build process.  It would be invoked
periodically as libm supports new types, or changes are needed.

E.g placing them in math/:

regen-libm-templates:
       for gfunc in $(gen-libm-calls); do \
         gfunc_basefile=$${gfunc/F/}_template.c; \
         for type in $(foreach t,$(all-libm-types),$(t)__$(type-$(t)-suffix)); do \
           func=$${gfunc/F/$${type#*__}}; \
           type=$${type%__*}; \
           echo "/* This file is generated by 'make regen-libm-templates." >> $${func}.c; \
           echo "   Do not edit.  */" >> $${func}.c; \
           echo "#include <math-type-macros-${type}.h>" >> $${func}.c; \
           echo "#include \"$${gfunc_basefile}\"" >> $${func}.c; \
         done; \
       done;



More information about the Libc-alpha mailing list