I tried to use godbolt online compiler to view the generated assembly for builtin functions. Example
#include <cmath>
double br( double x ) {
return __builtin_roundl(x);
}
double r( double x ) {
return std::round( x );
}
See https://godbolt.org/z/7e76a6qv4.
But assembly output just showed as
br(double):
jmp round
r(double):
jmp round
I guess there has to be some compiler parameter to reveal the definition of builtin functions, but I could not find a suitable one.
What code gets generated in the end? Is there a way to get the call to round inlined?
You are showing the assembly output for a builting function in your code - it is
jmp round. The assembly function__builtin_roundlgeneratedjmp roundin this case, and it is correct.There is no "assembly" for a builtin function. It only exists in the C compiler source code as a series of transformations on some abstraction over the language.
The code is here https://github.com/gcc-mirror/gcc/blob/fca6f6fddb22b8665e840f455a7d0318d4575227/gcc/convert.cc#L550 .
There is none.