]> git.ipfire.org Git - thirdparty/glibc.git/blob - sysdeps/s390/fpu/math-barriers.h
Update copyright dates with scripts/update-copyrights
[thirdparty/glibc.git] / sysdeps / s390 / fpu / math-barriers.h
1 /* Control when floating-point expressions are evaluated. s390 version.
2 Copyright (C) 2019-2021 Free Software Foundation, Inc.
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 <https://www.gnu.org/licenses/>. */
18
19 #ifndef S390_MATH_BARRIERS_H
20 #define S390_MATH_BARRIERS_H 1
21
22 #ifdef HAVE_S390_VX_GCC_SUPPORT
23 # define ASM_CONSTRAINT_VR "v"
24 #else
25 # define ASM_CONSTRAINT_VR
26 #endif
27
28 #define math_opt_barrier(x) \
29 ({ __typeof (x) __x = (x); \
30 if (__builtin_types_compatible_p (__typeof (x), _Float128)) \
31 __asm__ ("# math_opt_barrier_f128 %0" : "+fm" (__x)); \
32 else \
33 __asm__ ("# math_opt_barrier %0" \
34 : "+f" ASM_CONSTRAINT_VR "m" (__x)); \
35 __x; })
36 #define math_force_eval(x) \
37 ({ __typeof (x) __x = (x); \
38 if (__builtin_types_compatible_p (__typeof (x), _Float128)) \
39 __asm__ __volatile__ ("# math_force_eval_f128 %0" \
40 : : "fm" (__x)); \
41 else \
42 __asm__ __volatile__ ("# math_force_eval %0" \
43 : : "f" ASM_CONSTRAINT_VR "m" (__x)); \
44 })
45
46 #endif