llvm-project
llvm-project copied to clipboard
[InsnCombine] (fptrunc (floor x)) -> (floor (fptrunc x))
| Bugzilla Link | 32386 |
| Resolution | FIXED |
| Resolved on | Mar 23, 2017 00:47 |
| Version | trunk |
| OS | Linux |
| CC | @hfinkel |
Extended Description
The test case fail due to instruction combine cast from floor to floorf which make precision lost and get wrong floor value.
double d = 1024.0 - 1.0 / 32768.0; extern double floor(double); extern float floorf(float); extern void abort();
int main() {
float f1 = (float)floor(d);
if ((int)f1 != 1023)
abort ();
return 0;
}
The bug verify by Hal and Fix by Matt with r298312.