]>
Commit | Line | Data |
---|---|---|
fe13a20c | 1 | /* llround function. POWER8 PowerPC64 version. |
bfff8b1b | 2 | Copyright (C) 2014-2017 Free Software Foundation, Inc. |
fe13a20c AZ |
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 | |
16 | License along with the GNU C Library; if not, see | |
17 | <http://www.gnu.org/licenses/>. */ | |
18 | ||
19 | #include <sysdep.h> | |
757d9dd5 | 20 | #include <endian.h> |
fe13a20c | 21 | #include <math_ldbl_opt.h> |
d17542d2 | 22 | #include <libm-alias-double.h> |
fe13a20c | 23 | |
7110166d | 24 | #define MFVSRD_R3_V1 .long 0x7c230066 /* mfvsrd r3,vs1 */ |
fe13a20c AZ |
25 | |
26 | /* long long [r3] llround (float x [fp1]) */ | |
27 | ||
d5b41185 | 28 | ENTRY_TOCLESS (__llround) |
fe13a20c AZ |
29 | CALL_MCOUNT 0 |
30 | frin fp1,fp1 /* Round to nearest +-0.5. */ | |
31 | fctidz fp1,fp1 /* Convert To Integer DW round toward 0. */ | |
32 | MFVSRD_R3_V1 | |
33 | blr | |
34 | END (__llround) | |
35 | ||
36 | strong_alias (__llround, __lround) | |
d17542d2 JM |
37 | libm_alias_double (__llround, llround) |
38 | libm_alias_double (__lround, lround) | |
001b09a6 RS |
39 | /* The double version also works for single-precision as both float and |
40 | double parameters are passed in 64bit FPRs and both versions are expected | |
41 | to return [long] long type. */ | |
42 | strong_alias (__llround, __llroundf) | |
43 | weak_alias (__llround, llroundf) | |
44 | strong_alias (__lround, __lroundf) | |
45 | weak_alias (__lround, lroundf) |