13895, 13908, 13910, 13911, 13912, 13913, 13914, 13915, 13916, 13917,
13918, 13919, 13920, 13921, 13922, 13923, 13924, 13926, 13927, 13928,
13938, 13941, 13942, 13963, 13967, 13970, 13973, 13979, 13983, 14027,
- 14033, 14034, 14040, 14049, 14055, 14064, 14080, 14083
+ 14033, 14034, 14040, 14049, 14053, 14055, 14064, 14080, 14083
* ISO C11 support:
__NTH (lrintf (float __x))
{
long int __res;
- __asm ("cvtss2si %1, %0" : "=r" (__res) : "xm" (__x));
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("cvtss2si %1, %0" : "=r" (__res) : "xm" (__x));
return __res;
}
# endif
__NTH (lrint (double __x))
{
long int __res;
- __asm ("cvtsd2si %1, %0" : "=r" (__res) : "xm" (__x));
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("cvtsd2si %1, %0" : "=r" (__res) : "xm" (__x));
return __res;
}
# endif
__NTH (llrintf (float __x))
{
long long int __res;
- __asm ("cvtss2si %1, %0" : "=r" (__res) : "xm" (__x));
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("cvtss2si %1, %0" : "=r" (__res) : "xm" (__x));
return __res;
}
__MATH_INLINE long long int
__NTH (llrint (double __x))
{
long long int __res;
- __asm ("cvtsd2si %1, %0" : "=r" (__res) : "xm" (__x));
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("cvtsd2si %1, %0" : "=r" (__res) : "xm" (__x));
return __res;
}
# endif
__NTH (rint (double __x))
{
double __res;
- __asm ("roundsd $4, %1, %0" : "=x" (__res) : "xm" (__x));
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("roundsd $4, %1, %0" : "=x" (__res) : "xm" (__x));
return __res;
}
__MATH_INLINE float
__NTH (rintf (float __x))
{
float __res;
- __asm ("roundss $4, %1, %0" : "=x" (__res) : "xm" (__x));
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("roundss $4, %1, %0" : "=x" (__res) : "xm" (__x));
return __res;
}
__NTH (nearbyint (double __x))
{
double __res;
- __asm ("roundsd $0xc, %1, %0" : "=x" (__res) : "xm" (__x));
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("roundsd $0xc, %1, %0" : "=x" (__res) : "xm" (__x));
return __res;
}
__MATH_INLINE float
__NTH (nearbyintf (float __x))
{
float __res;
- __asm ("roundss $0xc, %1, %0" : "=x" (__res) : "xm" (__x));
+ /* Mark as volatile since the result is dependend on the state of
+ the SSE control register (the rounding mode). Otherwise GCC might
+ remove these assembler instructions since it does not know about
+ the rounding mode change and cannot currently be told. */
+ __asm __volatile__ ("roundss $0xc, %1, %0" : "=x" (__res) : "xm" (__x));
return __res;
}
# endif