[PATCH 01/13] math: Decompose math-use-builtins.h

Adhemerval Zanella adhemerval.zanella@linaro.org
Wed Jun 10 12:06:39 GMT 2020



On 10/06/2020 07:19, Wilco Dijkstra wrote:
> Hi Adhemerval,
> 
> We've moved from lots of little target implementations to one file and
> now back to lots of little target headers?

My view is we are moving to consolidate duplicate target definitions (such
as syscalls and internal code) and create specialized files when arch/ABI
diverges or require special handling (for instance the pthread internal 
definitions or the math tests internal file, such as tininess.h or 
nan-high-order-bit.h).

> 
> It makes a lot more sense to use a single target header for this.
> You don't need much magic to make this work, eg. each target only
> adds defines for any functions it supports (say for all float types), and
> the generic header then does something like this:
> 
> #include "math-use-builtins.h" // from target if exists, empty generic version
> 
> #ifndef USE_ROUND_BUILTIN

This is *exactly* what we want to avoid: the code should assume the macro
is *always* defined and check for its value instead of its existence.  
This avoid the undef checks that silent created some issues in the past.

Another issue is tie one definition with the whole different types,
although we could add this 'if not define, define default' for each
macro.

> # define USE_ROUND_BUILTIN 0
> # define USE_ROUNDF_BUILTIN 0
> # define USE_ROUNDL_BUILTIN 0
> # define USE_ROUNDF128_BUILTIN 0
> #endi


More information about the Libc-alpha mailing list