Displaying 3 results from an estimated 3 matches for "feenableexcept".
2018 Apr 28
1
Possible bug in optimizer
...away).
// ------------ a.cpp ------------------
#include <iostream>
#include <numeric>
#include <limits>
#include <cfenv>
double f(double A,double B) {
if (A<B) return std::numeric_limits<double>::max();
return A-B;
}
int main(int , char**) {
feenableexcept(FE_OVERFLOW); //**** NOTE 1
double A=f(.0001002773902563,1.);
std::cout<<A<<std::endl;
double B;
if (A==std::numeric_limits<double>::max()) {
// std::cout<<"Good"<<std::endl; //**** NOTE 2
B=A;
} else {
// std::cout<<&q...
2019 Aug 20
3
Floating point operations with specific rounding and exception properties
...constrained intrinsics as
well. Such decision should prevent from undesired moves of fp operations.
The discussion is in the thread
http://lists.llvm.org/pipermail/cfe-dev/2017-August/055325.html, the
relevant example is:
double f(double a, double b, double c) {
{
#pragma STDC FENV_ACCESS ON
feenableexcept(FE_OVERFLOW);
double d = a * b;
fedisableexcept(FE_OVERFLOW);
}
return c * d;
}
The second fmul must not be hoisted up to before the fedisableexcept. Using
constrained intrinsics is expected to help in this case as they are not
handled by optimization passes.
The concern is that usin...
2019 Aug 21
2
Floating point operations with specific rounding and exception properties
...-BQYeigzGv0P4__noMcSu2RYEjS1vKs&m=fTfAlQ0FHnQez3xiw8VnBL1XaxmBqn_-WD5E0mh4GrY&s=l5-qb-0vYUlkEbQT46x1HYz9WtpgOLaojeUkghA_QNg&e=>,
>> the relevant example is:
>>
>> double f(double a, double b, double c) {
>> {
>> #pragma STDC FENV_ACCESS ON
>> feenableexcept(FE_OVERFLOW);
>> double d = a * b;
>> fedisableexcept(FE_OVERFLOW);
>> }
>> return c * d;
>> }
>>
>>
>> The second fmul must not be hoisted up to before the fedisableexcept.
>> Using constrained intrinsics is expected to help in this...