1 /* Total order operation on absolute values. ldbl-128 version.
2 Copyright (C) 2016-2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
20 #include <math_private.h>
21 #include <libm-alias-ldouble.h>
22 #include <nan-high-order-bit.h>
24 #include <shlib-compat.h>
25 #include <first-versions.h>
28 __totalordermagl (const _Float128
*x
, const _Float128
*y
)
32 GET_LDOUBLE_WORDS64 (hx
, lx
, *x
);
33 GET_LDOUBLE_WORDS64 (hy
, ly
, *y
);
34 hx
&= 0x7fffffffffffffffULL
;
35 hy
&= 0x7fffffffffffffffULL
;
36 #if HIGH_ORDER_BIT_IS_SET_FOR_SNAN
37 /* For the preferred quiet NaN convention, this operation is a
38 comparison of the representations of the absolute values of the
39 arguments. If both arguments are NaNs, invert the
40 quiet/signaling bit so comparing that way works. */
41 if ((hx
> 0x7fff000000000000ULL
|| (hx
== 0x7fff000000000000ULL
43 && (hy
> 0x7fff000000000000ULL
|| (hy
== 0x7fff000000000000ULL
46 hx
^= 0x0000800000000000ULL
;
47 hy
^= 0x0000800000000000ULL
;
50 return hx
< hy
|| (hx
== hy
&& lx
<= ly
);
53 # define CONCATX(x, y) x ## y
54 # define CONCAT(x, y) CONCATX (x, y)
55 # define UNIQUE_ALIAS(name) CONCAT (name, __COUNTER__)
56 # define do_symbol(orig_name, name, aliasname) \
57 strong_alias (orig_name, name) \
58 versioned_symbol (libm, name, aliasname, GLIBC_2_31)
60 # define weak_alias(name, aliasname) \
61 do_symbol (name, UNIQUE_ALIAS (name), aliasname);
63 libm_alias_ldouble (__totalordermag
, totalordermag
)
64 #if SHLIB_COMPAT (libm, GLIBC_2_25, GLIBC_2_31)
66 attribute_compat_text_section
67 __totalordermag_compatl (_Float128 x
, _Float128 y
)
69 return __totalordermagl (&x
, &y
);
72 #define do_symbol(orig_name, name, aliasname) \
73 strong_alias (orig_name, name) \
74 compat_symbol (libm, name, aliasname, \
75 CONCAT (FIRST_VERSION_libm_, aliasname))
76 libm_alias_ldouble (__totalordermag_compat
, totalordermag
)