about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJoseph Myers <joseph@codesourcery.com>2016-12-20 00:46:53 +0000
committerJoseph Myers <joseph@codesourcery.com>2016-12-20 00:46:53 +0000
commit525f803984f278e65dc07ca1156bdeca63755810 (patch)
tree776b2000f6c8a0d5d3a0141f9b4b5aa5492da119
parent353683a22ed8a493a6bd1d78d63e144bc3e85d2f (diff)
downloadglibc-525f803984f278e65dc07ca1156bdeca63755810.tar.gz
glibc-525f803984f278e65dc07ca1156bdeca63755810.tar.xz
glibc-525f803984f278e65dc07ca1156bdeca63755810.zip
Add fmaxmag, fminmag functions.
TS 18661-1 defines fmaxmag and fminmag functions that return the
argument with maximum / minimum magnitude (acting like fmax / fmin if
the arguments have the same magnitude or either argument is a NaN).
These correspond to the IEEE 754-2008 operations maxNumMag and
minNumMag.  This patch implements these functions for glibc.  They are
implemented with type-generic templates.  Tests are based on those for
fmax and fmin.

Tested for x86_64, x86, mips64 and powerpc.

	* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
	(fmaxmag): New declaration.
	(fminmag): Likewise.
	* math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fmaxmag): New
	macro.
	[__GLIBC_USE (IEC_60559_BFP_EXT)] (fminmag): Likewise.
	* math/Versions (fmaxmag): New libm symbol at version GLIBC_2.25.
	(fmaxmagf): Likewise.
	(fmaxmagl): Likewise.
	(fminmag): Likewise.
	(fminmagf): Likewise.
	(fminmagl): Likewise.
	* math/Makefile (gen-libm-calls): Add s_fmaxmagF and s_fminmagF.
	* math/s_fmaxmag_template.c: New file.
	* math/s_fminmag_template.c: Likewise.
	* math/libm-test.inc (fmaxmag_test_data): New array.
	(fmaxmag_test): New function.
	(fminmag_test_data): New array.
	(fminmag_test): New function.
	(main): Call fmaxmag_test and fminmag_test.
	* math/test-tgmath.c (NCALLS): Increase to 132.
	(F(compile_test)): Call fmaxmag and fminmag.
	(F(fminmag)): New function.
	(F(fmaxmag)): Likewise.
	* manual/arith.texi (Misc FP Arithmetic): Document fminmag,
	fminmagf, fminmagl, fmaxmag, fmaxmagf and fmaxmagl.
	* manual/libm-err-tab.pl (@all_functions): Add fmaxmag and
	fminmag.
	* sysdeps/ieee754/ldbl-opt/nldbl-fmaxmag.c: New file.
	* sysdeps/ieee754/ldbl-opt/nldbl-fminmag.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/s_fminmagl.c: Likewise.
	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fmaxmag
	and fminmag.
	(CFLAGS-nldbl-fmaxmag.c): New variable.
	(CFLAGS-nldbl-fminmag.c): Likewise.
	* sysdeps/nacl/libm.abilist: Update.
	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
	Likewise.
	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
-rw-r--r--ChangeLog72
-rw-r--r--NEWS3
-rw-r--r--manual/arith.texi32
-rwxr-xr-xmanual/libm-err-tab.pl2
-rw-r--r--math/Makefile2
-rw-r--r--math/Versions1
-rw-r--r--math/bits/mathcalls.h6
-rw-r--r--math/libm-test.inc233
-rw-r--r--math/s_fmaxmag_template.c38
-rw-r--r--math/s_fminmag_template.c38
-rw-r--r--math/test-tgmath.c22
-rw-r--r--math/tgmath.h6
-rw-r--r--sysdeps/ieee754/ldbl-opt/Makefile4
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fmaxmag.c26
-rw-r--r--sysdeps/ieee754/ldbl-opt/nldbl-fminmag.c26
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c5
-rw-r--r--sysdeps/ieee754/ldbl-opt/s_fminmagl.c5
-rw-r--r--sysdeps/nacl/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/aarch64/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/alpha/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/arm/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/hppa/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/i386/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/ia64/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/microblaze/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips32/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/mips/mips64/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/nios2/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/sh/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/64/libm.abilist6
-rw-r--r--sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist6
44 files changed, 677 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index e7c9757c4f..3e6a39fe52 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,75 @@
+2016-12-20  Joseph Myers  <joseph@codesourcery.com>
+
+	* math/bits/mathcalls.h [__GLIBC_USE (IEC_60559_BFP_EXT)]
+	(fmaxmag): New declaration.
+	(fminmag): Likewise.
+	* math/tgmath.h [__GLIBC_USE (IEC_60559_BFP_EXT)] (fmaxmag): New
+	macro.
+	[__GLIBC_USE (IEC_60559_BFP_EXT)] (fminmag): Likewise.
+	* math/Versions (fmaxmag): New libm symbol at version GLIBC_2.25.
+	(fmaxmagf): Likewise.
+	(fmaxmagl): Likewise.
+	(fminmag): Likewise.
+	(fminmagf): Likewise.
+	(fminmagl): Likewise.
+	* math/Makefile (gen-libm-calls): Add s_fmaxmagF and s_fminmagF.
+	* math/s_fmaxmag_template.c: New file.
+	* math/s_fminmag_template.c: Likewise.
+	* math/libm-test.inc (fmaxmag_test_data): New array.
+	(fmaxmag_test): New function.
+	(fminmag_test_data): New array.
+	(fminmag_test): New function.
+	(main): Call fmaxmag_test and fminmag_test.
+	* math/test-tgmath.c (NCALLS): Increase to 132.
+	(F(compile_test)): Call fmaxmag and fminmag.
+	(F(fminmag)): New function.
+	(F(fmaxmag)): Likewise.
+	* manual/arith.texi (Misc FP Arithmetic): Document fminmag,
+	fminmagf, fminmagl, fmaxmag, fmaxmagf and fmaxmagl.
+	* manual/libm-err-tab.pl (@all_functions): Add fmaxmag and
+	fminmag.
+	* sysdeps/ieee754/ldbl-opt/nldbl-fmaxmag.c: New file.
+	* sysdeps/ieee754/ldbl-opt/nldbl-fminmag.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/s_fminmagl.c: Likewise.
+	* sysdeps/ieee754/ldbl-opt/Makefile (libnldbl-calls): Add fmaxmag
+	and fminmag.
+	(CFLAGS-nldbl-fmaxmag.c): New variable.
+	(CFLAGS-nldbl-fminmag.c): Likewise.
+	* sysdeps/nacl/libm.abilist: Update.
+	* sysdeps/unix/sysv/linux/aarch64/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/alpha/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/arm/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/hppa/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/i386/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/ia64/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/microblaze/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/mips/mips32/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/mips/mips64/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/nios2/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist:
+	Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist:
+	Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist:
+	Likewise.
+	* sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist:
+	Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/sh/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist:
+	Likewise.
+	* sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist:
+	Likewise.
+	* sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/64/libm.abilist: Likewise.
+	* sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist: Likewise.
+
 2016-12-19  Torvald Riegel  <triegel@redhat.com>
 
 	[BZ #20973]
diff --git a/NEWS b/NEWS
index 43d4e300b2..d77b8abdb7 100644
--- a/NEWS
+++ b/NEWS
@@ -69,6 +69,9 @@ Version 2.25
   - llogb functions: the llogb, llogbf and llogbl functions, and the
     FP_LLOGB0 and FP_LLOGBNAN macros.
 
+  - Max-min magnitude functions: fmaxmag, fmaxmagf, fmaxmagl, fminmag,
+    fminmagf, fminmagl.
+
   - Comparison macros: iseqsig.
 
   - Classification macros: iscanonical, issubnormal, iszero.
diff --git a/manual/arith.texi b/manual/arith.texi
index a20a4dec6c..f90ef26c91 100644
--- a/manual/arith.texi
+++ b/manual/arith.texi
@@ -2157,6 +2157,38 @@ are NaN, NaN is returned.
 
 @comment math.h
 @comment ISO
+@deftypefun double fminmag (double @var{x}, double @var{y})
+@comment math.h
+@comment ISO
+@deftypefunx float fminmagf (float @var{x}, float @var{y})
+@comment math.h
+@comment ISO
+@deftypefunx {long double} fminmagl (long double @var{x}, long double @var{y})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+These functions, from TS 18661-1:2014, return whichever of the two
+values @var{x} and @var{y} has the smaller absolute value.  If both
+have the same absolute value, or either is NaN, they behave the same
+as the @code{fmin} functions.
+@end deftypefun
+
+@comment math.h
+@comment ISO
+@deftypefun double fmaxmag (double @var{x}, double @var{y})
+@comment math.h
+@comment ISO
+@deftypefunx float fmaxmagf (float @var{x}, float @var{y})
+@comment math.h
+@comment ISO
+@deftypefunx {long double} fmaxmagl (long double @var{x}, long double @var{y})
+@safety{@prelim{}@mtsafe{}@assafe{}@acsafe{}}
+These functions, from TS 18661-1:2014, return whichever of the two
+values @var{x} and @var{y} has the greater absolute value.  If both
+have the same absolute value, or either is NaN, they behave the same
+as the @code{fmax} functions.
+@end deftypefun
+
+@comment math.h
+@comment ISO
 @deftypefun double fdim (double @var{x}, double @var{y})
 @comment math.h
 @comment ISO
diff --git a/manual/libm-err-tab.pl b/manual/libm-err-tab.pl
index 0e83853949..cc51f0b82f 100755
--- a/manual/libm-err-tab.pl
+++ b/manual/libm-err-tab.pl
@@ -57,7 +57,7 @@ use vars qw (%results @all_floats %suffices @all_functions);
     "clog", "clog10", "conj", "copysign", "cos", "cosh", "cpow", "cproj",
     "creal", "csin", "csinh", "csqrt", "ctan", "ctanh", "erf", "erfc",
     "exp", "exp10", "exp2", "expm1", "fabs", "fdim", "floor", "fma",
-    "fmax", "fmin", "fmod", "frexp", "gamma", "hypot",
+    "fmax", "fmaxmag", "fmin", "fminmag", "fmod", "frexp", "gamma", "hypot",
     "ilogb", "j0", "j1", "jn", "lgamma", "llogb", "lrint",
     "llrint", "log", "log10", "log1p", "log2", "logb", "lround",
     "llround", "modf", "nearbyint", "nextafter", "nextdown", "nexttoward",
diff --git a/math/Makefile b/math/Makefile
index db6ea2932e..ed1c4c92da 100644
--- a/math/Makefile
+++ b/math/Makefile
@@ -54,7 +54,7 @@ gen-libm-calls = cargF conjF cimagF crealF cabsF s_cacosF		  \
 		 s_ctanF s_ctanhF s_cexpF s_clogF s_cprojF s_csqrtF	  \
 		 s_cpowF s_clog10F s_fdimF s_nextdownF s_fmaxF s_fminF	  \
 		 s_nanF s_iseqsigF s_canonicalizeF w_ilogbF w_llogbF	  \
-		 w_log1pF w_scalblnF
+		 w_log1pF w_scalblnF s_fmaxmagF s_fminmagF
 
 libm-calls =								  \
 	e_acosF e_acoshF e_asinF e_atan2F e_atanhF e_coshF e_expF e_fmodF \
diff --git a/math/Versions b/math/Versions
index 6fe9bb7e6f..eebfac35fd 100644
--- a/math/Versions
+++ b/math/Versions
@@ -224,5 +224,6 @@ libm {
     setpayload; setpayloadf; setpayloadl;
     setpayloadsig; setpayloadsigf; setpayloadsigl;
     llogb; llogbf; llogbl;
+    fmaxmag; fmaxmagf; fmaxmagl; fminmag; fminmagf; fminmagl;
   }
 }
diff --git a/math/bits/mathcalls.h b/math/bits/mathcalls.h
index c57b5627cd..824f95b58e 100644
--- a/math/bits/mathcalls.h
+++ b/math/bits/mathcalls.h
@@ -385,6 +385,12 @@ __END_NAMESPACE_C99
 #endif
 
 #if __GLIBC_USE (IEC_60559_BFP_EXT)
+/* Return value with maximum magnitude.  */
+__MATHCALLX (fmaxmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
+
+/* Return value with minimum magnitude.  */
+__MATHCALLX (fminmag,, (_Mdouble_ __x, _Mdouble_ __y), (__const__));
+
 /* Test equality.  */
 __MATHDECL_1 (int, __iseqsig,, (_Mdouble_ __x, _Mdouble_ __y));
 
diff --git a/math/libm-test.inc b/math/libm-test.inc
index 110b4215d5..1860b9c41d 100644
--- a/math/libm-test.inc
+++ b/math/libm-test.inc
@@ -45,8 +45,8 @@
    acos, acosh, asin, asinh, atan, atan2, atanh,
    canonicalize, cbrt, ceil, copysign, cos, cosh, drem,
    erf, erfc, exp, exp10, exp2, expm1,
-   fabs, fdim, finite, floor, fma, fmax, fmin, fmod, fpclassify,
-   frexp, gamma, getpayload, hypot,
+   fabs, fdim, finite, floor, fma, fmax, fmaxmag, fmin, fminmag,
+   fmod, fpclassify, frexp, gamma, getpayload, hypot,
    ilogb, iscanonical, isfinite, isinf, isnan, isnormal, issignaling,
    issubnormal, iszero, iseqsig, isless, islessequal, isgreater,
    isgreaterequal, islessgreater, isunordered, j0, j1, jn,
@@ -7864,6 +7864,120 @@ fmax_test (void)
 }
 
 
+static const struct test_ff_f_data fmaxmag_test_data[] =
+  {
+    TEST_ff_f (fmaxmag, 0, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, minus_zero, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, 0, minus_zero, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED|IGNORE_ZERO_INF_SIGN),
+    TEST_ff_f (fmaxmag, minus_zero, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED|IGNORE_ZERO_INF_SIGN),
+    TEST_ff_f (fmaxmag, min_subnorm_value, min_subnorm_value, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, min_subnorm_value, -min_subnorm_value, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -min_subnorm_value, min_subnorm_value, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -min_subnorm_value, -min_subnorm_value, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, min_value, min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, min_value, -min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -min_value, min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -min_value, -min_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, max_value, max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, max_value, -max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -max_value, max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -max_value, -max_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, max_value, min_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, max_value, -min_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -max_value, min_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -max_value, -min_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, min_value, max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, min_value, -max_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -min_value, max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -min_value, -max_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, 9, 0, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, 0, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -9, 0, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, 0, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+
+    TEST_ff_f (fmaxmag, plus_infty, 9, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, 0, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -9, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, plus_infty, -9, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+
+    TEST_ff_f (fmaxmag, minus_infty, 9, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, minus_infty, -9, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, 9, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -9, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+
+    TEST_ff_f (fmaxmag, 0, qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, 0, -qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, minus_zero, qnan_value, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, minus_zero, -qnan_value, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, 9, qnan_value, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, 9, -qnan_value, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -9, qnan_value, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -9, -qnan_value, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, 0, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, 0, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, minus_zero, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, minus_zero, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, 9, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, 9, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -9, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -9, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, qnan_value, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -qnan_value, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, qnan_value, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -qnan_value, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, qnan_value, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -qnan_value, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, qnan_value, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -qnan_value, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, snan_value, 0, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -snan_value, 0, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, snan_value, minus_zero, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -snan_value, minus_zero, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, snan_value, 9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -snan_value, 9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, snan_value, -9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -snan_value, -9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, plus_infty, qnan_value, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, plus_infty, -qnan_value, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, minus_infty, qnan_value, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, minus_infty, -qnan_value, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, plus_infty, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, plus_infty, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, minus_infty, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, minus_infty, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, qnan_value, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -qnan_value, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, qnan_value, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -qnan_value, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, snan_value, plus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -snan_value, plus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, snan_value, minus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -snan_value, minus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, -qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fmaxmag, qnan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, qnan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -qnan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -qnan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, snan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, snan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -snan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -snan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, snan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, snan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -snan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fmaxmag, -snan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+  };
+
+static void
+fmaxmag_test (void)
+{
+  ALL_RM_TEST (fmaxmag, 1, fmaxmag_test_data, RUN_TEST_LOOP_ff_f, END);
+}
+
+
 static const struct test_ff_f_data fmin_test_data[] =
   {
     TEST_ff_f (fmin, 0, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
@@ -7963,6 +8077,119 @@ fmin_test (void)
 }
 
 
+static const struct test_ff_f_data fminmag_test_data[] =
+  {
+    TEST_ff_f (fminmag, 0, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, minus_zero, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, 0, minus_zero, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED|IGNORE_ZERO_INF_SIGN),
+    TEST_ff_f (fminmag, minus_zero, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED|IGNORE_ZERO_INF_SIGN),
+    TEST_ff_f (fminmag, min_subnorm_value, min_subnorm_value, min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, min_subnorm_value, -min_subnorm_value, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -min_subnorm_value, min_subnorm_value, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -min_subnorm_value, -min_subnorm_value, -min_subnorm_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, min_value, min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, min_value, -min_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -min_value, min_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -min_value, -min_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, max_value, max_value, max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, max_value, -max_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -max_value, max_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -max_value, -max_value, -max_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, max_value, min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, max_value, -min_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -max_value, min_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -max_value, -min_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, min_value, max_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, min_value, -max_value, min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -min_value, max_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -min_value, -max_value, -min_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, 9, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, 0, 9, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -9, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, 0, -9, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+
+    TEST_ff_f (fminmag, plus_infty, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, 9, plus_infty, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, plus_infty, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -9, plus_infty, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, minus_infty, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, minus_infty, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, 9, minus_infty, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -9, minus_infty, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+
+    TEST_ff_f (fminmag, 0, qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, 0, -qnan_value, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, minus_zero, qnan_value, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, minus_zero, -qnan_value, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, 9, qnan_value, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, 9, -qnan_value, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -9, qnan_value, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -9, -qnan_value, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, 0, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, 0, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, minus_zero, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, minus_zero, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, 9, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, 9, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -9, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -9, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, qnan_value, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -qnan_value, 0, 0, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, qnan_value, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -qnan_value, minus_zero, minus_zero, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, qnan_value, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -qnan_value, 9, 9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, qnan_value, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -qnan_value, -9, -9, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, snan_value, 0, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -snan_value, 0, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, snan_value, minus_zero, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -snan_value, minus_zero, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, snan_value, 9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -snan_value, 9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, snan_value, -9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -snan_value, -9, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, plus_infty, qnan_value, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, plus_infty, -qnan_value, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, minus_infty, qnan_value, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, minus_infty, -qnan_value, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, plus_infty, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, plus_infty, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, minus_infty, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, minus_infty, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, qnan_value, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -qnan_value, plus_infty, plus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, qnan_value, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -qnan_value, minus_infty, minus_infty, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, snan_value, plus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -snan_value, plus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, snan_value, minus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -snan_value, minus_infty, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -qnan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, -qnan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|ERRNO_UNCHANGED),
+    TEST_ff_f (fminmag, qnan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, qnan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -qnan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -qnan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, snan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, snan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -snan_value, qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -snan_value, -qnan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, snan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, snan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -snan_value, snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+    TEST_ff_f (fminmag, -snan_value, -snan_value, qnan_value, NO_INEXACT_EXCEPTION|INVALID_EXCEPTION),
+  };
+
+static void
+fminmag_test (void)
+{
+  ALL_RM_TEST (fminmag, 1, fminmag_test_data, RUN_TEST_LOOP_ff_f, END);
+}
+
+
 static const struct test_ff_f_data fmod_test_data[] =
   {
     /* fmod (+0, y) == +0 for y != 0.  */
@@ -14041,7 +14268,9 @@ main (int argc, char **argv)
   /* maximum, minimum and positive difference functions */
   fdim_test ();
   fmax_test ();
+  fmaxmag_test ();
   fmin_test ();
+  fminmag_test ();
 
   /* Multiply and add:  */
   fma_test ();
diff --git a/math/s_fmaxmag_template.c b/math/s_fmaxmag_template.c
new file mode 100644
index 0000000000..2fc69b4692
--- /dev/null
+++ b/math/s_fmaxmag_template.c
@@ -0,0 +1,38 @@
+/* Return value with maximum magnitude.
+   Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+
+FLOAT
+M_DECL_FUNC (__fmaxmag) (FLOAT x, FLOAT y)
+{
+  FLOAT ax = M_FABS (x);
+  FLOAT ay = M_FABS (y);
+  if (isgreater (ax, ay))
+    return x;
+  else if (isless (ax, ay))
+    return y;
+  else if (ax == ay)
+    return x > y ? x : y;
+  else if (issignaling (x) || issignaling (y))
+    return x + y;
+  else
+    return isnan (y) ? x : y;
+}
+
+declare_mgen_alias (__fmaxmag, fmaxmag);
diff --git a/math/s_fminmag_template.c b/math/s_fminmag_template.c
new file mode 100644
index 0000000000..7f0d1ffc91
--- /dev/null
+++ b/math/s_fminmag_template.c
@@ -0,0 +1,38 @@
+/* Return value with minimum magnitude.
+   Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <math.h>
+
+FLOAT
+M_DECL_FUNC (__fminmag) (FLOAT x, FLOAT y)
+{
+  FLOAT ax = M_FABS (x);
+  FLOAT ay = M_FABS (y);
+  if (isless (ax, ay))
+    return x;
+  else if (isgreater (ax, ay))
+    return y;
+  else if (ax == ay)
+    return x < y ? x : y;
+  else if (issignaling (x) || issignaling (y))
+    return x + y;
+  else
+    return isnan (y) ? x : y;
+}
+
+declare_mgen_alias (__fminmag, fminmag);
diff --git a/math/test-tgmath.c b/math/test-tgmath.c
index be2c2fc3d4..b9095271ea 100644
--- a/math/test-tgmath.c
+++ b/math/test-tgmath.c
@@ -50,7 +50,7 @@ int count_cdouble;
 int count_cfloat;
 int count_cldouble;
 
-#define NCALLS     126
+#define NCALLS     132
 #define NCALLS_INT 4
 #define NCCALLS    47
 
@@ -285,6 +285,8 @@ F(compile_test) (void)
   a = fdim (fdim (x, a), fdim (c, b));
   b = fmax (fmax (a, x), fmax (c, b));
   a = fmin (fmin (x, a), fmin (c, b));
+  b = fmaxmag (fmaxmag (a, x), fmaxmag (c, b));
+  a = fminmag (fminmag (x, a), fminmag (c, b));
   b = fma (sin (a), sin (x), sin (c));
   a = totalorder (totalorder (x, b), totalorder (c, x));
   b = totalordermag (totalordermag (x, a), totalordermag (c, x));
@@ -384,6 +386,8 @@ F(compile_test) (void)
       a = fdim (y, y);
       a = fmax (y, y);
       a = fmin (y, y);
+      a = fmaxmag (y, y);
+      a = fminmag (y, y);
       a = fma (y, y, y);
       a = totalorder (y, y);
       a = totalordermag (y, y);
@@ -881,6 +885,22 @@ TYPE
 }
 
 TYPE
+(F(fminmag)) (TYPE x, TYPE y)
+{
+  ++count;
+  P ();
+  return x + y;
+}
+
+TYPE
+(F(fmaxmag)) (TYPE x, TYPE y)
+{
+  ++count;
+  P ();
+  return x + y;
+}
+
+TYPE
 (F(fma)) (TYPE x, TYPE y, TYPE z)
 {
   ++count;
diff --git a/math/tgmath.h b/math/tgmath.h
index 95f5f198ba..0f9216ca43 100644
--- a/math/tgmath.h
+++ b/math/tgmath.h
@@ -441,6 +441,12 @@
 /* Like ilogb, but returning long int.  */
 #define llogb(Val) __TGMATH_UNARY_REAL_RET_ONLY (Val, long int, llogb)
 
+/* Return value with maximum magnitude.  */
+# define fmaxmag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fmaxmag)
+
+/* Return value with minimum magnitude.  */
+# define fminmag(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2, fminmag)
+
 /* Total order operation.  */
 # define totalorder(Val1, Val2) __TGMATH_BINARY_REAL_ONLY (Val1, Val2,	\
 							   totalorder)
diff --git a/sysdeps/ieee754/ldbl-opt/Makefile b/sysdeps/ieee754/ldbl-opt/Makefile
index ba13515c3e..99aa6c6e0b 100644
--- a/sysdeps/ieee754/ldbl-opt/Makefile
+++ b/sysdeps/ieee754/ldbl-opt/Makefile
@@ -43,7 +43,7 @@ libnldbl-calls = asprintf dprintf fprintf fscanf fwprintf fwscanf iovfscanf \
 		 isoc99_wscanf isoc99_fwscanf isoc99_swscanf \
 		 isoc99_vwscanf isoc99_vfwscanf isoc99_vswscanf \
 		 nextup nextdown totalorder totalordermag getpayload \
-		 canonicalize setpayload setpayloadsig llogb
+		 canonicalize setpayload setpayloadsig llogb fmaxmag fminmag
 libnldbl-routines = $(libnldbl-calls:%=nldbl-%)
 libnldbl-inhibit-o = $(object-suffixes)
 libnldbl-static-only-routines = $(libnldbl-routines)
@@ -97,7 +97,9 @@ CFLAGS-nldbl-finite.c = -fno-builtin-finitel
 CFLAGS-nldbl-floor.c = -fno-builtin-floorl
 CFLAGS-nldbl-fma.c = -fno-builtin-fmal
 CFLAGS-nldbl-fmax.c = -fno-builtin-fmaxl
+CFLAGS-nldbl-fmaxmag.c = -fno-builtin-fmaxmagl
 CFLAGS-nldbl-fmin.c = -fno-builtin-fminl
+CFLAGS-nldbl-fminmag.c = -fno-builtin-fminmagl
 CFLAGS-nldbl-fmod.c = -fno-builtin-fmodl
 CFLAGS-nldbl-frexp.c = -fno-builtin-frexpl
 CFLAGS-nldbl-gamma.c = -fno-builtin-gammal
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fmaxmag.c b/sysdeps/ieee754/ldbl-opt/nldbl-fmaxmag.c
new file mode 100644
index 0000000000..ebb2449e0e
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fmaxmag.c
@@ -0,0 +1,26 @@
+/* Compatibility routine for IEEE double as long double for fmaxmag.
+   Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fmaxmagl (double x, double y)
+{
+  return fmaxmag (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/nldbl-fminmag.c b/sysdeps/ieee754/ldbl-opt/nldbl-fminmag.c
new file mode 100644
index 0000000000..48199201e3
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/nldbl-fminmag.c
@@ -0,0 +1,26 @@
+/* Compatibility routine for IEEE double as long double for fminmag.
+   Copyright (C) 2016 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include "nldbl-compat.h"
+
+double
+attribute_hidden
+fminmagl (double x, double y)
+{
+  return fminmag (x, y);
+}
diff --git a/sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c b/sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c
new file mode 100644
index 0000000000..7e23761b58
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fmaxmagl.c
@@ -0,0 +1,5 @@
+/* fmaxmagl is not subject to complex aliasing rules.  It was added in
+   glibc 2.25.  */
+#define declare_mgen_alias(from, to) weak_alias (M_SUF (from), M_SUF (to))
+#include <math-type-macros-ldouble.h>
+#include <s_fmaxmag_template.c>
diff --git a/sysdeps/ieee754/ldbl-opt/s_fminmagl.c b/sysdeps/ieee754/ldbl-opt/s_fminmagl.c
new file mode 100644
index 0000000000..46c10514c9
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-opt/s_fminmagl.c
@@ -0,0 +1,5 @@
+/* fminmagl is not subject to complex aliasing rules.  It was added in
+   glibc 2.25.  */
+#define declare_mgen_alias(from, to) weak_alias (M_SUF (from), M_SUF (to))
+#include <math-type-macros-ldouble.h>
+#include <s_fminmag_template.c>
diff --git a/sysdeps/nacl/libm.abilist b/sysdeps/nacl/libm.abilist
index 0c0e352c79..36fe57c9bd 100644
--- a/sysdeps/nacl/libm.abilist
+++ b/sysdeps/nacl/libm.abilist
@@ -389,6 +389,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/aarch64/libm.abilist b/sysdeps/unix/sysv/linux/aarch64/libm.abilist
index b8ab6fcdd0..3afa24c382 100644
--- a/sysdeps/unix/sysv/linux/aarch64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/aarch64/libm.abilist
@@ -421,6 +421,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/alpha/libm.abilist b/sysdeps/unix/sysv/linux/alpha/libm.abilist
index 604c996e78..0d9823c017 100644
--- a/sysdeps/unix/sysv/linux/alpha/libm.abilist
+++ b/sysdeps/unix/sysv/linux/alpha/libm.abilist
@@ -431,6 +431,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/arm/libm.abilist b/sysdeps/unix/sysv/linux/arm/libm.abilist
index 618cb6fce1..c2acd838bd 100644
--- a/sysdeps/unix/sysv/linux/arm/libm.abilist
+++ b/sysdeps/unix/sysv/linux/arm/libm.abilist
@@ -78,6 +78,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/hppa/libm.abilist b/sysdeps/unix/sysv/linux/hppa/libm.abilist
index 33314ad754..dabaa17aca 100644
--- a/sysdeps/unix/sysv/linux/hppa/libm.abilist
+++ b/sysdeps/unix/sysv/linux/hppa/libm.abilist
@@ -390,6 +390,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/i386/libm.abilist b/sysdeps/unix/sysv/linux/i386/libm.abilist
index 4530ad538a..929a8b0f95 100644
--- a/sysdeps/unix/sysv/linux/i386/libm.abilist
+++ b/sysdeps/unix/sysv/linux/i386/libm.abilist
@@ -434,6 +434,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/ia64/libm.abilist b/sysdeps/unix/sysv/linux/ia64/libm.abilist
index 9b94be0492..7b21f7818a 100644
--- a/sysdeps/unix/sysv/linux/ia64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/ia64/libm.abilist
@@ -363,6 +363,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist b/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
index 618cb6fce1..c2acd838bd 100644
--- a/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/coldfire/libm.abilist
@@ -78,6 +78,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist
index 6d61d704a1..dd072f2d71 100644
--- a/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist
+++ b/sysdeps/unix/sysv/linux/m68k/m680x0/libm.abilist
@@ -432,6 +432,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/microblaze/libm.abilist b/sysdeps/unix/sysv/linux/microblaze/libm.abilist
index b55f6aaf86..2b9bcdb875 100644
--- a/sysdeps/unix/sysv/linux/microblaze/libm.abilist
+++ b/sysdeps/unix/sysv/linux/microblaze/libm.abilist
@@ -389,6 +389,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist b/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
index 5ebba1172c..4894b3446e 100644
--- a/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips32/libm.abilist
@@ -391,6 +391,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist b/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
index cf28ab6961..0f0798e97e 100644
--- a/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/mips/mips64/libm.abilist
@@ -423,6 +423,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/nios2/libm.abilist b/sysdeps/unix/sysv/linux/nios2/libm.abilist
index 9d9fd05a5a..4ac5f07a64 100644
--- a/sysdeps/unix/sysv/linux/nios2/libm.abilist
+++ b/sysdeps/unix/sysv/linux/nios2/libm.abilist
@@ -389,6 +389,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
index 2747628a52..0b5757802f 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/libm.abilist
@@ -434,6 +434,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
index 26c115854a..1365d0c39a 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc32/nofpu/libm.abilist
@@ -433,6 +433,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist
index 5f992b2df0..6f930d8da0 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm-le.abilist
@@ -428,6 +428,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist
index b4de7f182f..4407cbbb88 100644
--- a/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/powerpc/powerpc64/libm.abilist
@@ -109,6 +109,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist b/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
index 67740c2c84..645106c63d 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-32/libm.abilist
@@ -421,6 +421,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist b/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
index 6fa99f01cf..228724a624 100644
--- a/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/s390/s390-64/libm.abilist
@@ -419,6 +419,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/sh/libm.abilist b/sysdeps/unix/sysv/linux/sh/libm.abilist
index 2c093afb63..d2346591ca 100644
--- a/sysdeps/unix/sysv/linux/sh/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sh/libm.abilist
@@ -390,6 +390,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
index 515a6774eb..789ccd3359 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc32/libm.abilist
@@ -424,6 +424,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist b/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
index 1590b05966..2377bb2e46 100644
--- a/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/sparc/sparc64/libm.abilist
@@ -422,6 +422,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist
index 3ed0c68120..bd57079bf8 100644
--- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx32/libm.abilist
@@ -390,6 +390,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist
index 3ed0c68120..bd57079bf8 100644
--- a/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilegx/tilegx64/libm.abilist
@@ -390,6 +390,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist b/sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist
index 3ed0c68120..bd57079bf8 100644
--- a/sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist
+++ b/sysdeps/unix/sysv/linux/tile/tilepro/libm.abilist
@@ -390,6 +390,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist b/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
index 908d6ffd39..801da8aeae 100644
--- a/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/64/libm.abilist
@@ -423,6 +423,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F
diff --git a/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist b/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist
index cf5b5765fe..3c7082ec50 100644
--- a/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist
+++ b/sysdeps/unix/sysv/linux/x86_64/x32/libm.abilist
@@ -422,6 +422,12 @@ GLIBC_2.25 fegetmode F
 GLIBC_2.25 fesetexcept F
 GLIBC_2.25 fesetmode F
 GLIBC_2.25 fetestexceptflag F
+GLIBC_2.25 fmaxmag F
+GLIBC_2.25 fmaxmagf F
+GLIBC_2.25 fmaxmagl F
+GLIBC_2.25 fminmag F
+GLIBC_2.25 fminmagf F
+GLIBC_2.25 fminmagl F
 GLIBC_2.25 getpayload F
 GLIBC_2.25 getpayloadf F
 GLIBC_2.25 getpayloadl F