1*4b2da9c3SPulkoMandy /* Control when floating-point expressions are evaluated. Generic version. 2*4b2da9c3SPulkoMandy Copyright (C) 2007-2018 Free Software Foundation, Inc. 3*4b2da9c3SPulkoMandy This file is part of the GNU C Library. 4*4b2da9c3SPulkoMandy 5*4b2da9c3SPulkoMandy The GNU C Library is free software; you can redistribute it and/or 6*4b2da9c3SPulkoMandy modify it under the terms of the GNU Lesser General Public 7*4b2da9c3SPulkoMandy License as published by the Free Software Foundation; either 8*4b2da9c3SPulkoMandy version 2.1 of the License, or (at your option) any later version. 9*4b2da9c3SPulkoMandy 10*4b2da9c3SPulkoMandy The GNU C Library is distributed in the hope that it will be useful, 11*4b2da9c3SPulkoMandy but WITHOUT ANY WARRANTY; without even the implied warranty of 12*4b2da9c3SPulkoMandy MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13*4b2da9c3SPulkoMandy Lesser General Public License for more details. 14*4b2da9c3SPulkoMandy 15*4b2da9c3SPulkoMandy You should have received a copy of the GNU Lesser General Public 16*4b2da9c3SPulkoMandy License along with the GNU C Library; if not, see 17*4b2da9c3SPulkoMandy <http://www.gnu.org/licenses/>. */ 18*4b2da9c3SPulkoMandy 19*4b2da9c3SPulkoMandy #ifndef _MATH_BARRIERS_H 20*4b2da9c3SPulkoMandy #define _MATH_BARRIERS_H 1 21*4b2da9c3SPulkoMandy 22*4b2da9c3SPulkoMandy /* math_opt_barrier evaluates and returns its floating-point argument 23*4b2da9c3SPulkoMandy and ensures that the evaluation of any expression using the result 24*4b2da9c3SPulkoMandy of math_opt_barrier is not moved before the call. math_force_eval 25*4b2da9c3SPulkoMandy ensures that its floating-point argument is evaluated for its side 26*4b2da9c3SPulkoMandy effects even if its value is apparently unused, and that the 27*4b2da9c3SPulkoMandy evaluation of its argument is not moved after the call. Both these 28*4b2da9c3SPulkoMandy macros are used to ensure the correct ordering of floating-point 29*4b2da9c3SPulkoMandy expression evaluations with respect to accesses to the 30*4b2da9c3SPulkoMandy floating-point environment. */ 31*4b2da9c3SPulkoMandy 32*4b2da9c3SPulkoMandy #define math_opt_barrier(x) \ 33*4b2da9c3SPulkoMandy ({ __typeof (x) __x = (x); __asm ("" : "+m" (__x)); __x; }) 34*4b2da9c3SPulkoMandy #define math_force_eval(x) \ 35*4b2da9c3SPulkoMandy ({ __typeof (x) __x = (x); __asm __volatile__ ("" : : "m" (__x)); }) 36*4b2da9c3SPulkoMandy 37*4b2da9c3SPulkoMandy #endif /* math-barriers.h */ 38