[PATCH 37/59] math: Fix modf{f} build on clang
H.J. Lu
hjl.tools@gmail.com
Mon Oct 20 22:09:55 GMT 2025
On Tue, Oct 21, 2025 at 1:58 AM Adhemerval Zanella Netto
<adhemerval.zanella@linaro.org> wrote:
>
>
>
> On 18/10/25 03:28, H.J. Lu wrote:
> > On Sat, Oct 18, 2025 at 3:58 AM Adhemerval Zanella
> > <adhemerval.zanella@linaro.org> wrote:
> >>
> >> We need to disable the internal optimize for math builtins
> >> (NO_MATH_REDIRECT) for the USE_TRUNC_BUILTIN case.
> >
> > Does it change GCC codegen?
>
> No, both with clang and gcc either the builtin is issues (on
> aarch64 for instance) or the internal symbol is called.
Why does NO_MATH_REDIRECT make no difference here?
Why is this macro needed?
> The issue is for some reason it does not apply correctly on clang
> when the target has the builtin (it emits calls to the internal
> aliases instead of properly inline the intrinsic).>
> >> ---
> >> sysdeps/ieee754/dbl-64/s_modf.c | 1 +
> >> sysdeps/ieee754/flt-32/s_modff.c | 1 +
> >> 2 files changed, 2 insertions(+)
> >>
> >> diff --git a/sysdeps/ieee754/dbl-64/s_modf.c b/sysdeps/ieee754/dbl-64/s_modf.c
> >> index 90cd8e8c3e..727dc412c0 100644
> >> --- a/sysdeps/ieee754/dbl-64/s_modf.c
> >> +++ b/sysdeps/ieee754/dbl-64/s_modf.c
> >> @@ -16,6 +16,7 @@
> >> License along with the GNU C Library; if not, see
> >> <https://www.gnu.org/licenses/>. */
> >>
> >> +#define NO_MATH_REDIRECT
> >> #include <math.h>
> >> #include <libm-alias-double.h>
> >> #include "math_config.h"
> >> diff --git a/sysdeps/ieee754/flt-32/s_modff.c b/sysdeps/ieee754/flt-32/s_modff.c
> >> index 965136bac9..a06178f803 100644
> >> --- a/sysdeps/ieee754/flt-32/s_modff.c
> >> +++ b/sysdeps/ieee754/flt-32/s_modff.c
> >> @@ -16,6 +16,7 @@
> >> License along with the GNU C Library; if not, see
> >> <https://www.gnu.org/licenses/>. */
> >>
> >> +#define NO_MATH_REDIRECT
> >> #include <math.h>
> >> #include <libm-alias-float.h>
> >> #include "math_config.h"
> >> --
> >> 2.43.0
> >>
> >
> >
>
--
H.J.
More information about the Libc-alpha
mailing list