glibc/sysdeps/mips
Adhemerval Zanella 13cfd77bf5 math: Don't redirect inlined builtin math functions
When we want to inline builtin math functions, like truncf, for

  extern float truncf (float __x) __attribute__ ((__nothrow__ )) __attribute__ ((__const__));
  extern float __truncf (float __x) __attribute__ ((__nothrow__ )) __attribute__ ((__const__));

  float (truncf) (float) asm ("__truncf");

compiler may redirect truncf calls to __truncf, instead of inlining it
(for instance, clang).  The USE_TRUNCF_BUILTIN is 1 to indicate that
truncf should be inlined.  In this case, we don't want the truncf
redirection:

  1. For each math function which may be inlined, we define

  #if USE_TRUNCF_BUILTIN
   # define NO_truncf_BUILTIN inline_truncf
   #else
   # define NO_truncf_BUILTIN truncf
   #endif

in <math-use-builtins.h>.

  2. Include <math-use-builtins.h> in include/math.h.

  3. Change MATH_REDIRECT to

   #define MATH_REDIRECT(FUNC, PREFIX, ARGS)		\
    float (NO_ ## FUNC ## f ## _BUILTIN) (ARGS (float))	\
      asm (PREFIX #FUNC "f");

With this change If USE_TRUNCF_BUILTIN is 0, we get

  float (truncf) (float) asm ("__truncf");
  truncf will be redirected to __truncf.

And for USE_TRUNCF_BUILTIN 1, we get:

  float (inline_truncf) (float) asm ("__truncf");

In both cases either truncf will be inlined or the internal alias
(__truncf) will be called.

It is not required for all math-use-builtin symbol, only the one
defined in math.h.  It also allows to remove all the math-use-builtin
inclusion, since it is now implicitly included by math.h.

For MIPS, some math-use-builtin headers include sysdep.h and this
in turn includes a lot of extra headers that do not allow ldbl-128
code to override alias definition (math.h will include
some stdlib.h definition).  The math-use-builtin only requires
the __mips_isa_rev, so move the defintion to sgidefs.h.

Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
Co-authored-by: Adhemerval Zanella  <adhemerval.zanella@linaro.org>
Reviewed-by: H.J. Lu <hjl.tools@gmail.com>
2025-11-17 11:17:07 -03:00
..
bits Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
fpu math: Don't redirect inlined builtin math functions 2025-11-17 11:17:07 -03:00
ieee754 Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
include/sys Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
mips32 math: Refactor how to use libm-test-ulps 2025-03-12 13:40:07 -03:00
mips64 math: Remove ldbl-128/s_fma.c 2025-11-12 18:57:29 +00:00
nofpu
nptl Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
sys atomic: Consolidate atomic_full_barrier implementation 2025-11-04 04:14:01 -03:00
Implies
Makefile mips: Remove strcmp.S 2025-09-23 10:29:24 -03:00
__longjmp.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
abort-instr.h
add_n.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
addmul_1.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
bsd-_setjmp.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
bsd-setjmp.S mips: Fix delay slot filling in bsd-setjmp.S 2025-09-23 10:29:24 -03:00
configure Convert to autoconf 2.72 (vanilla release, no distribution patches) 2024-06-17 21:15:28 +02:00
configure.ac
dl-debug.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
dl-dtprocnum.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
dl-machine-reject-phdr.h Fix sysdeps/mips/dl-machine-reject-phdr.h build with GCC 16 2025-09-03 16:04:49 +00:00
dl-machine-rel.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
dl-machine.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
dl-r_debug.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
dl-relocate-ld.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
dl-tls.h Add missing include guards to <dl-tls.h> 2025-01-10 19:02:47 +01:00
dl-trampoline.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
elf-initfini.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
elf_machine_sym_no_match.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
fpregdef.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
fpu_control.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
gccframe.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
isarev.h math: Don't redirect inlined builtin math functions 2025-11-17 11:17:07 -03:00
jmpbuf-unwind.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
ldbl-classify-compat.h
ldsodefs.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
libc-tls.c elf: Remove the remaining uses of GET_ADDR_OFFSET 2025-01-02 13:45:27 +01:00
linkmap.h
localplt.data
lshift.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
machine-gmon.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
math-tests-snan-payload.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
math-use-builtins-ffs.h math: Don't redirect inlined builtin math functions 2025-11-17 11:17:07 -03:00
memcpy.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
memset.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
mul_1.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
nan-high-order-bit.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
preconfigure
preconfigure.ac
regdef.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
rshift.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
setjmp.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
setjmp_aux.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
sgidefs.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
sotruss-lib.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
stackinfo.h elf: early conversion of elf p_flags to mprotect flags 2025-08-27 10:45:45 -03:00
start.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
sub_n.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
submul_1.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tininess.h
tst-abi-fp32mod.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-abi-fp64amod.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-abi-fp64mod.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-abi-fpxxmod.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-abi-fpxxomod.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-abi-interlink.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-audit.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-mode-switch-1.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-mode-switch-2.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-mode-switch-3.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-undefined-weak-lib.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
tst-undefined-weak.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
unwind-arch.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
utmp-size.h login: Check default sizes of structs utmp, utmpx, lastlog 2024-04-19 14:38:17 +02:00