Use GCC builtins for ceil functions if desired.
[glibc.git] / sysdeps / s390 / fpu / math-use-builtins.h
blob5435cbb65fcf5249b406648affe302b234cd37b1
1 /* Using math gcc builtins instead of generic implementation. s390/s390x version.
2 Copyright (C) 2019 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
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.
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.
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 <https://www.gnu.org/licenses/>. */
19 #ifndef MATH_USE_BUILTINS_S390_H
20 #define MATH_USE_BUILTINS_S390_H 1
22 #ifdef HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT
24 # include <features.h> /* For __GNUC_PREREQ. */
26 /* GCC emits the z196 zarch "load fp integer" instructions for these
27 builtins if build with at least --march=z196 -mzarch. Otherwise a
28 function call to libc is emitted. */
29 # define USE_NEARBYINT_BUILTIN 1
30 # define USE_NEARBYINTF_BUILTIN 1
31 # define USE_NEARBYINTL_BUILTIN 1
33 # define USE_RINT_BUILTIN 1
34 # define USE_RINTF_BUILTIN 1
35 # define USE_RINTL_BUILTIN 1
37 # define USE_FLOOR_BUILTIN 1
38 # define USE_FLOORF_BUILTIN 1
39 # define USE_FLOORL_BUILTIN 1
41 # define USE_CEIL_BUILTIN 1
42 # define USE_CEILF_BUILTIN 1
43 # define USE_CEILL_BUILTIN 1
45 # if __GNUC_PREREQ (8, 0)
46 # define USE_NEARBYINTF128_BUILTIN 1
47 # define USE_RINTF128_BUILTIN 1
48 # define USE_FLOORF128_BUILTIN 1
49 # define USE_CEILF128_BUILTIN 1
50 # else
51 # define USE_NEARBYINTF128_BUILTIN 0
52 # define USE_RINTF128_BUILTIN 0
53 # define USE_FLOORF128_BUILTIN 0
54 # define USE_CEILF128_BUILTIN 0
55 # endif
57 #else
59 /* Disable the builtins if we do not have the z196 zarch instructions. */
60 # define USE_NEARBYINT_BUILTIN 0
61 # define USE_NEARBYINTF_BUILTIN 0
62 # define USE_NEARBYINTL_BUILTIN 0
63 # define USE_NEARBYINTF128_BUILTIN 0
65 # define USE_RINT_BUILTIN 0
66 # define USE_RINTF_BUILTIN 0
67 # define USE_RINTL_BUILTIN 0
68 # define USE_RINTF128_BUILTIN 0
70 # define USE_FLOOR_BUILTIN 0
71 # define USE_FLOORF_BUILTIN 0
72 # define USE_FLOORL_BUILTIN 0
73 # define USE_FLOORF128_BUILTIN 0
75 # define USE_CEIL_BUILTIN 0
76 # define USE_CEILF_BUILTIN 0
77 # define USE_CEILL_BUILTIN 0
78 # define USE_CEILF128_BUILTIN 0
80 #endif /* ! HAVE_S390_MIN_Z196_ZARCH_ASM_SUPPORT */
82 #endif /* math-use-builtins.h */