[PATCH] x86-64: Don't inline atof without SSE2 [BZ #27600]

Florian Weimer fweimer@redhat.com
Thu Mar 18 05:03:24 GMT 2021


* H. J. Lu via Libc-alpha:

> Since without SSE2, inlined atof fails with
>
> /usr/include/bits/stdlib-float.h: In function ‘atof’:
> /usr/include/bits/stdlib-float.h:26:1: error: SSE register return with SSE disabled
>    26 | {
>       | ^
>
> don't inline atof without SSE2 for x86-64.

Could you say publicly why you want to make this change, given that SSE2
is a mandatory part of x86-64?

> +#if defined __USE_EXTERN_INLINES && (!defined __x86_64__ || defined __SSE2__)
> +__extern_inline double
> +__NTH (atof (const char *__nptr))
> +{
> +  return strtod (__nptr, (char **) NULL);
> +}

This is just an inline function that is using the double type, not
something that uses an SSE2 type.  It's not even always_inline.  Many
other headers will have the same problem, especially for C++.  I think
you should teach GCC not to issue a diagnostic for inline functions
whose definitions are not used in a compilation.  This is how
-mgeneral-regs-only behaves on AArch64 already, if I'm not mistaken.

Thanks,
Florian



More information about the Libc-alpha mailing list