From: Adhemerval Zanella Date: Mon, 28 Apr 2025 19:54:49 +0000 (-0300) Subject: math: Remove i386 ilogb/ilogbf/llogb/llogbf X-Git-Tag: glibc-2.42~178 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7c00a20397d8caa3638a26a58900570c8ef21c49;p=thirdparty%2Fglibc.git math: Remove i386 ilogb/ilogbf/llogb/llogbf The new float and double implementation does not required an extra function call and error handling uses math_err function, which results in better performance on i386 as well. With gcc-14 on AMD AMD Ryzen 9 5900X, master shows: $ ./benchtests/bench-ilogb "ilogb": { "subnormal": { "duration": 3.68863e+09, "iterations": 1.72228e+08, "max": 89.2995, "min": 21.016, "mean": 21.4171 }, "normal": { "duration": 3.68878e+09, "iterations": 1.72948e+08, "max": 78.6065, "min": 21.127, "mean": 21.3288 } } $ ./benchtests/bench-ilogbf "ilogbf": { "subnormal": { "duration": 3.68835e+09, "iterations": 1.66716e+08, "max": 46.953, "min": 21.793, "mean": 22.1236 }, "normal": { "duration": 3.68784e+09, "iterations": 1.66168e+08, "max": 46.9715, "min": 21.904, "mean": 22.1935 } } While with this patch: $ ./benchtests/bench-ilogb "ilogb": { "subnormal": { "duration": 3.68134e+09, "iterations": 4.17516e+08, "max": 32.5045, "min": 8.3245, "mean": 8.81723 }, "normal": { "duration": 3.6677e+09, "iterations": 6.79468e+08, "max": 50.9305, "min": 5.3465, "mean": 5.3979 } } $ ./benchtests/bench-ilogbf "ilogbf": { "subnormal": { "duration": 3.67553e+09, "iterations": 5.11032e+08, "max": 35.927, "min": 7.0485, "mean": 7.19237 }, "normal": { "duration": 3.66877e+09, "iterations": 6.556e+08, "max": 26.3625, "min": 5.5315, "mean": 5.59605 } } Checked on i686-linux-gnu. Reviewed-by: Wilco Dijkstra --- diff --git a/sysdeps/i386/fpu/e_ilogb.S b/sysdeps/i386/fpu/e_ilogb.S deleted file mode 100644 index f4b792c27c..0000000000 --- a/sysdeps/i386/fpu/e_ilogb.S +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_ilogb.S,v 1.5 1995/10/12 15:53:09 jtc Exp $") - -ENTRY(__ieee754_ilogb) - fldl 4(%esp) -/* I added the following ugly construct because ilogb(+-Inf) is - required to return INT_MAX in ISO C99. - -- jakub@redhat.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - cmpb $0x40, %dh - je 2f /* Is +-0, jump. */ - - fxtract - pushl %eax - cfi_adjust_cfa_offset (4) - fstp %st - - fistpl (%esp) - fwait - popl %eax - cfi_adjust_cfa_offset (-4) - - ret - -1: fstp %st - movl $0x7fffffff, %eax - ret -2: fstp %st - movl $0x80000000, %eax /* FP_ILOGB0 */ - ret -END (__ieee754_ilogb) diff --git a/sysdeps/i386/fpu/e_ilogbf.S b/sysdeps/i386/fpu/e_ilogbf.S deleted file mode 100644 index 37298b9331..0000000000 --- a/sysdeps/i386/fpu/e_ilogbf.S +++ /dev/null @@ -1,41 +0,0 @@ -/* - * Public domain. - */ - -#include - -RCSID("$NetBSD: s_ilogbf.S,v 1.4 1995/10/22 20:32:43 pk Exp $") - -ENTRY(__ieee754_ilogbf) - flds 4(%esp) -/* I added the following ugly construct because ilogb(+-Inf) is - required to return INT_MAX in ISO C99. - -- jakub@redhat.com. */ - fxam /* Is NaN or +-Inf? */ - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 1f /* Is +-Inf, jump. */ - cmpb $0x40, %dh - je 2f /* Is +-0, jump. */ - - fxtract - pushl %eax - cfi_adjust_cfa_offset (4) - fstp %st - - fistpl (%esp) - fwait - popl %eax - cfi_adjust_cfa_offset (-4) - - ret - -1: fstp %st - movl $0x7fffffff, %eax - ret -2: fstp %st - movl $0x80000000, %eax /* FP_ILOGB0 */ - ret -END (__ieee754_ilogbf) diff --git a/sysdeps/i386/fpu/w_ilogb.c b/sysdeps/i386/fpu/w_ilogb.c deleted file mode 100644 index 9c26217021..0000000000 --- a/sysdeps/i386/fpu/w_ilogb.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -#include diff --git a/sysdeps/i386/fpu/w_ilogbf.c b/sysdeps/i386/fpu/w_ilogbf.c deleted file mode 100644 index 047ad4bf11..0000000000 --- a/sysdeps/i386/fpu/w_ilogbf.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -#include diff --git a/sysdeps/i386/fpu/w_llogb.c b/sysdeps/i386/fpu/w_llogb.c deleted file mode 100644 index 5e8891a668..0000000000 --- a/sysdeps/i386/fpu/w_llogb.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -#include diff --git a/sysdeps/i386/fpu/w_llogbf.c b/sysdeps/i386/fpu/w_llogbf.c deleted file mode 100644 index edb7e9a9e6..0000000000 --- a/sysdeps/i386/fpu/w_llogbf.c +++ /dev/null @@ -1,2 +0,0 @@ -#include -#include