[llvm-dev] clang 4.0.0: Invalid code for builtin floating point function with -mfloat-abi=hard -ffast-math (ARM)
Peter Jakubek via llvm-dev
llvm-dev at lists.llvm.org
Tue Mar 21 11:51:30 PDT 2017
Hello,
clang/llvm 4.0.0 generates invalid calls for builtin functions with
-mfloat-abi=hard -ffast-math.
Small example fail.c:
// clang -O2 -target armv7a-none-none-eabi -mfloat-abi=hard
-ffast-math -S fail.c -o -
extern float sinf (float x);
float sin1 (float x) {return (sinf (x));}
generates code to pass the parameter in r0 and expect the result in r0.
The same code without -ffast-math compiles correctly. It also works with
-fno-builtin-sinf.
(-O2 is not required to trigger the bug, but makes the resulting code
easier to read)
It seems -ffast-math changes the internal declaration of builtin
functions, as if declared
with -mfloat-abi=soft.
Works just fine with or without -ffast-math in previous releases.
cheers,
Peter
More information about the llvm-dev
mailing list