Displaying 1 result from an estimated 1 matches for "builtin_fmodf_bugpoint_clang".
2015 Sep 14
2
[LLVMDev] Inconsistent result between GCC and Clang for __builtin_fmodf
...n(int argc, char** argv) {
const float a = 1.0f;
const float b = 0.1f;
printf("%f mod %f = %f\n", a, b, __builtin_fmodf(a, b));
return 0;
}
$ g++ -o builtin_fmodf_bugpoint_gcc builtin_fmodf_bugpoint.cpp
$ ./builtin_fmodf_bugpoint_gcc
1.000000 fmodf 0.100000 = 0.100000
$ clang++ -o builtin_fmodf_bugpoint_clang builtin_fmodf_bugpoint.cpp
1.000000 fmodf 0.100000 = 0.000000
Clang will compile __builtin_fmod() into LLVM's "frem" [1]. Since both
operands are constant, it is constant folded by IRBuilder at the time when
"frem" was built. The exeuction finally goes to
llvm::ConstantFold...