]>
Commit | Line | Data |
---|---|---|
7d42d614 | 1 | /* llroundf() - S390 version. |
d614a753 | 2 | Copyright (C) 2019-2020 Free Software Foundation, Inc. |
7d42d614 SL |
3 | |
4 | This file is part of the GNU C Library. | |
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 License as | |
8 | published by the Free Software Foundation; either version 2.1 of the | |
9 | 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 | |
17 | License along with the GNU C Library; if not, see | |
18 | <https://www.gnu.org/licenses/>. */ | |
19 | ||
20 | #if defined __s390x__ && defined HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT | |
21 | /* We only support s390x as on s390 a long long int refers to a register pair | |
22 | of two 4byte registers instead of a 8byte register which is produced by the | |
23 | instruction. | |
24 | Note: On s390 this instruction would only be used if build with -mzarch. */ | |
25 | # include <math.h> | |
26 | # include <libm-alias-float.h> | |
27 | ||
28 | long long int | |
29 | __llroundf (float x) | |
30 | { | |
31 | long long int y; | |
32 | /* The z196 zarch "convert to fixed" (cgebra) instruction is rounding | |
33 | x to the nearest integer with "ties away from 0" rounding mode | |
34 | (M3-field: 1) where inexact exceptions are suppressed (M4-field: 4). */ | |
35 | __asm__ ("cgebra %0,1,%1,4" : "=d" (y) : "f" (x) : "cc"); | |
36 | return y; | |
37 | } | |
38 | libm_alias_float (__llround, llround) | |
39 | ||
40 | #else | |
41 | # include <sysdeps/ieee754/flt-32/s_llroundf.c> | |
42 | #endif |