]> git.ipfire.org Git - thirdparty/glibc.git/blame - sysdeps/powerpc/powerpc64/fpu/s_ceil.S
Update copyright dates with scripts/update-copyrights.
[thirdparty/glibc.git] / sysdeps / powerpc / powerpc64 / fpu / s_ceil.S
CommitLineData
5ce98c3f 1/* ceil function. PowerPC64 version.
bfff8b1b 2 Copyright (C) 2004-2017 Free Software Foundation, Inc.
5ce98c3f
UD
3 This file is part of the GNU C Library.
4
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.
9
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.
14
15 You should have received a copy of the GNU Lesser General Public
59ba27a6
PE
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
5ce98c3f
UD
18
19#include <sysdep.h>
f964490f 20#include <math_ldbl_opt.h>
5ce98c3f
UD
21
22 .section ".toc","aw"
23.LC0: /* 2**52 */
24 .tc FD_43300000_0[TC],0x4330000000000000
5ce98c3f
UD
25 .section ".text"
26
4d37c8aa 27EALIGN (__ceil, 4, 0)
d7d06f79 28 CALL_MCOUNT 0
5ce98c3f
UD
29 lfd fp13,.LC0@toc(2)
30 fabs fp0,fp1
31 fsub fp12,fp13,fp13 /* generate 0.0 */
32 fcmpu cr7,fp0,fp13 /* if (fabs(x) > TWO52) */
b4d80349
JM
33 mffs fp11 /* Save current FPU rounding mode and
34 "inexact" state. */
5ce98c3f 35 fcmpu cr6,fp1,fp12 /* if (x > 0.0) */
f6ef0657 36 bnl- cr7,.L10
5ce98c3f
UD
37 mtfsfi 7,2 /* Set rounding mode toward +inf. */
38 ble- cr6,.L4
39 fadd fp1,fp1,fp13 /* x+= TWO52; */
40 fsub fp1,fp1,fp13 /* x-= TWO52; */
4d37c8aa
UD
41 fabs fp1,fp1 /* if (x == 0.0) */
42 /* x = 0.0; */
b4d80349
JM
43 mtfsf 0xff,fp11 /* Restore previous rounding mode and
44 "inexact" state. */
5ce98c3f
UD
45 blr
46.L4:
47 bge- cr6,.L9 /* if (x < 0.0) */
48 fsub fp1,fp1,fp13 /* x-= TWO52; */
49 fadd fp1,fp1,fp13 /* x+= TWO52; */
4d37c8aa
UD
50 fnabs fp1,fp1 /* if (x == 0.0) */
51 /* x = -0.0; */
52.L9:
b4d80349
JM
53 mtfsf 0xff,fp11 /* Restore previous rounding mode and
54 "inexact" state. */
5ce98c3f 55 blr
f6ef0657
JM
56.L10:
57 /* Ensure sNaN input is converted to qNaN. */
58 fcmpu cr7,fp1,fp1
59 beqlr cr7
60 fadd fp1,fp1,fp1
61 blr
5ce98c3f
UD
62 END (__ceil)
63
64weak_alias (__ceil, ceil)
65
66#ifdef NO_LONG_DOUBLE
67weak_alias (__ceil, ceill)
68strong_alias (__ceil, __ceill)
69#endif
f964490f
RM
70#if LONG_DOUBLE_COMPAT(libm, GLIBC_2_0)
71compat_symbol (libm, __ceil, ceill, GLIBC_2_0)
72#endif