glibc/sysdeps/m68k
Adhemerval Zanella 39775f00b1 math: Optimize float ilogb/llogb
It removes the wrapper by moving the error/EDOM handling to an
out-of-line implementation (__math_invalidf_i/__math_invalidf_li).
Also, __glibc_unlikely is used on errors case since it helps
code generation on recent gcc.

The code now builds to with gcc-14 on aarch64:

0000000000000000 <__ilogbf>:
   0:   1e260000        fmov    w0, s0
   4:   d3577801        ubfx    x1, x0, #23, #8
   8:   340000e1        cbz     w1, 24 <__ilogbf+0x24>
   c:   5101fc20        sub     w0, w1, #0x7f
  10:   7103fc3f        cmp     w1, #0xff
  14:   54000040        b.eq    1c <__ilogbf+0x1c>  // b.none
  18:   d65f03c0        ret
  1c:   12b00000        mov     w0, #0x7fffffff                 // #2147483647
  20:   14000000        b       0 <__math_invalidf_i>
  24:   53175800        lsl     w0, w0, #9
  28:   340000a0        cbz     w0, 3c <__ilogbf+0x3c>
  2c:   5ac01000        clz     w0, w0
  30:   12800fc1        mov     w1, #0xffffff81                 // #-127
  34:   4b000020        sub     w0, w1, w0
  38:   d65f03c0        ret
  3c:   320107e0        mov     w0, #0x80000001                 // #-2147483647
  40:   14000000        b       0 <__math_invalidf_i>

Some ABI requires additional adjustments:

  * i386 and m68k requires to use the template version, since
    both provide __ieee754_ilogb implementatations.

  * loongarch uses a custom implementation as well.

  * powerpc64le also has a custom implementation for POWER9, which
    is also used for float and float128 version.  The generic
    e_ilogb.c implementation is moved on powerpc to keep the
    current code as-is.

Checked on aarch64-linux-gnu and x86_64-linux-gnu.

Reviewed-by: Wilco Dijkstra  <Wilco.Dijkstra@arm.com>
2025-06-02 13:32:19 -03:00
..
bits Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
coldfire math: Refactor how to use libm-test-ulps 2025-03-12 13:40:07 -03:00
fpu Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
m680x0 math: Optimize float ilogb/llogb 2025-06-02 13:32:19 -03:00
nptl Move <thread_pointer.h> to kernel-independent sysdeps directories 2025-01-09 19:30:16 +01:00
sys Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
Implies
Makefile Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
Versions
__longjmp.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
abort-instr.h
asm-syntax.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
backtrace.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
bsd-_setjmp.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
bsd-setjmp.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
configure configure: Use autoconf 2.71 2023-07-17 10:08:10 -04:00
configure.ac elf: Replace PI_STATIC_AND_HIDDEN with opposite HIDDEN_VAR_NEEDS_DYNAMIC_RELOC 2022-04-26 09:26:22 -07:00
crti.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
crtn.S 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-tls.h Add missing include guards to <dl-tls.h> 2025-01-10 19:02:47 +01:00
dl-trampoline.S 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
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
jmpbuf-unwind.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
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
math-use-builtins-ffs.h string: Use builtins for ffs and ffsll 2024-02-01 09:31:33 -03:00
memchr.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
memcopy.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
preconfigure configure: Use autoconf 2.71 2023-07-17 10:08:10 -04:00
preconfigure.ac m68k: Use an autoconf template to produce `preconfigure' 2022-05-13 17:07:23 +01:00
rawmemchr.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
setjmp.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
shlib-versions
sotruss-lib.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
stackinfo.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
start.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
strchr.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
strchrnul.S Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
symbol-hacks.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
sysdep.h Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
thread_pointer.h Move <thread_pointer.h> to kernel-independent sysdeps directories 2025-01-09 19:30:16 +01:00
tst-audit.h 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
wcpcpy_chk.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00
wordcopy.c Update copyright dates with scripts/update-copyrights 2025-01-01 11:22:09 -08:00