]>
Commit | Line | Data |
---|---|---|
6973fc01 | 1 | /* Compute minimum of two numbers, regarding NaN as missing argument. |
04277e02 | 2 | Copyright (C) 1997-2019 Free Software Foundation, Inc. |
6973fc01 UD |
3 | This file is part of the GNU C Library. |
4 | Contributed by Ulrich Drepper <drepper@cygnus.com>, 1997. | |
5 | ||
6 | The GNU C Library is free software; you can redistribute it and/or | |
41bdb6e2 AJ |
7 | modify it under the terms of the GNU Lesser General Public |
8 | License as published by the Free Software Foundation; either | |
9 | version 2.1 of the License, or (at your option) any later version. | |
6973fc01 UD |
10 | |
11 | The GNU C Library is distributed in the hope that it will be useful, | |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
41bdb6e2 | 14 | Lesser General Public License for more details. |
6973fc01 | 15 | |
41bdb6e2 | 16 | You should have received a copy of the GNU Lesser General Public |
59ba27a6 | 17 | License along with the GNU C Library; if not, see |
5a82c748 | 18 | <https://www.gnu.org/licenses/>. */ |
6973fc01 | 19 | |
2ce30701 | 20 | #include <libm-alias-ldouble.h> |
6973fc01 UD |
21 | #include <sysdep.h> |
22 | ||
23 | .text | |
24 | ENTRY(__fminl) | |
25 | fldt 4(%esp) // x | |
26 | fldt 16(%esp) // x : y | |
27 | ||
6973fc01 | 28 | fucomi %st(1), %st |
0a2546cd | 29 | jp 2f |
838e5ffe | 30 | fcmovnb %st(1), %st |
6973fc01 UD |
31 | |
32 | fstp %st(1) | |
33 | ||
34 | ret | |
0a2546cd JM |
35 | |
36 | 2: // Unordered. | |
37 | fucomi %st(0), %st | |
38 | jp 3f | |
39 | // st(1) is a NaN; st(0) is not. Test if st(1) is signaling. | |
40 | testb $0x40, 11(%esp) | |
41 | jz 4f | |
42 | fstp %st(1) | |
43 | ret | |
44 | ||
45 | 3: // st(0) is a NaN; st(1) may or may not be. | |
46 | fxch | |
47 | fucomi %st(0), %st | |
48 | jp 4f | |
49 | // st(1) is a NaN; st(0) is not. Test if st(1) is signaling. | |
50 | testb $0x40, 23(%esp) | |
51 | jz 4f | |
52 | fstp %st(1) | |
53 | ret | |
54 | ||
55 | 4: // Both arguments are NaNs, or one is a signaling NaN. | |
56 | faddp | |
57 | ret | |
6973fc01 | 58 | END(__fminl) |
2ce30701 | 59 | libm_alias_ldouble (__fmin, fmin) |