glibc/sysdeps
Joseph Myers 90f0ac10a7 Add fmaximum, fminimum functions
C2X adds new <math.h> functions for floating-point maximum and
minimum, corresponding to the new operations that were added in IEEE
754-2019 because of concerns about the old operations not being
associative in the presence of signaling NaNs.  fmaximum and fminimum
handle NaNs like most <math.h> functions (any NaN argument means the
result is a quiet NaN).  fmaximum_num and fminimum_num handle both
quiet and signaling NaNs the way fmax and fmin handle quiet NaNs (if
one argument is a number and the other is a NaN, return the number),
but still raise "invalid" for a signaling NaN argument, making them
exceptions to the normal rule that a function with a floating-point
result raising "invalid" also returns a quiet NaN.  fmaximum_mag,
fminimum_mag, fmaximum_mag_num and fminimum_mag_num are corresponding
functions returning the argument with greatest or least absolute
value.  All these functions also treat +0 as greater than -0.  There
are also corresponding <tgmath.h> type-generic macros.

Add these functions to glibc.  The implementations use type-generic
templates based on those for fmax, fmin, fmaxmag and fminmag, and test
inputs are based on those for those functions with appropriate
adjustments to the expected results.  The RISC-V maintainers might
wish to add optimized versions of fmaximum_num and fminimum_num (for
float and double), since RISC-V (F extension version 2.2 and later)
provides instructions corresponding to those functions - though it
might be at least as useful to add architecture-independent built-in
functions to GCC and teach the RISC-V back end to expand those
functions inline, which is what you generally want for functions that
can be implemented with a single instruction.

Tested for x86_64 and x86, and with build-many-glibcs.py.
2021-09-28 23:31:35 +00:00
..
aarch64 aarch64: Disable A64FX memcpy/memmove BTI unconditionally 2021-09-24 13:26:59 +01:00
alpha elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
arc elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
arm elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
csky elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
generic Disable symbol hack in libc_nonshared.a 2021-09-27 07:46:25 -07:00
gnu Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
hppa elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
htl htl: Reimplement GSCOPE 2021-09-16 01:04:17 +02:00
hurd Update copyright dates with scripts/update-copyrights 2021-01-02 12:17:34 -08:00
i386 i386: Port elf_machine_{load_address,dynamic} from x86-64 2021-09-24 09:36:32 -07:00
ia64 Add narrowing fma functions 2021-09-22 21:25:31 +00:00
ieee754 Add fmaximum, fminimum functions 2021-09-28 23:31:35 +00:00
m68k elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
mach Add fmaximum, fminimum functions 2021-09-28 23:31:35 +00:00
microblaze elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
mips ld.so: Replace DL_RO_DYN_SECTION with dl_relocate_ld [BZ #28340] 2021-09-22 11:12:43 -07:00
nios2 elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
nptl nptl: Fix type of pthread_mutexattr_getrobust_np, pthread_mutexattr_setrobust_np (bug 28036) 2021-09-21 07:13:05 +02:00
posix posix: Remove spawni.c 2021-09-27 12:44:25 -03:00
powerpc Add fmaximum, fminimum functions 2021-09-28 23:31:35 +00:00
pthread pthread/tst-cancel28: Fix barrier re-init race condition 2021-09-28 10:47:08 -03:00
riscv Add narrowing fma functions 2021-09-22 21:25:31 +00:00
s390 elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
sh elf: Remove THREAD_GSCOPE_IN_TCB 2021-09-16 01:04:20 +02:00
sparc Add narrowing fma functions 2021-09-22 21:25:31 +00:00
unix Add fmaximum, fminimum functions 2021-09-28 23:31:35 +00:00
wordsize-32 Disable symbol hack in libc_nonshared.a 2021-09-27 07:46:25 -07:00
wordsize-64 Remove "Contributed by" lines 2021-09-03 22:06:44 +05:30
x86 Fix sysdeps/x86/fpu/s_ffma.c for 32-bit FMA processor case 2021-09-24 17:59:22 +00:00
x86_64 Add narrowing fma functions 2021-09-22 21:25:31 +00:00