]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/x86_64/fpu/s_fminl.S
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / x86_64 / fpu / s_fminl.S
CommitLineData
9359218f 1/* Compute minimum of two numbers, regarding NaN as missing argument.
04277e02 2 Copyright (C) 1997-2019 Free Software Foundation, Inc.
9359218f
AJ
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
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.
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
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
17 License along with the GNU C Library; if not, see
18 <http://www.gnu.org/licenses/>. */
9359218f
AJ
19
20#include <sysdep.h>
f58e5f48 21#include <libm-alias-ldouble.h>
9359218f
AJ
22
23 .text
24ENTRY(__fminl)
25 fldt 8(%rsp) // x
26 fldt 24(%rsp) // x : y
27
9359218f 28 fucomi %st(1), %st
0a2546cd 29 jp 2f
9359218f
AJ
30 fcmovnb %st(1), %st
31
32 fstp %st(1)
33
34 ret
0a2546cd
JM
35
362: // 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, 15(%rsp)
41 jz 4f
42 fstp %st(1)
43 ret
44
453: // 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, 31(%rsp)
51 jz 4f
52 fstp %st(1)
53 ret
54
554: // Both arguments are NaNs, or one is a signaling NaN.
56 faddp
57 ret
9359218f 58END(__fminl)
f58e5f48 59libm_alias_ldouble (__fmin, fmin)