gcc provides numerous builtin routines. Where can I find the source code of the builtin routines? I understand that sometimes they might be direct opcodes. This was shown e.g. in Implementation of __builtin_clz.
I tried the following four functions
int leading_zeroes(int x){ return __builtin_ctz(x); }
double cpsgn(double x, double y){ return __builtin_copysign(x,y); }
int exponent(double x) { return __builtin_ilogb(x); }
double loadexp(double x, int y){ return __builtin_ldexp(x,y); }
Finally, I'm interested in the assembler code. With https://godbolt.org/ I got this assembler code
leading_zeroes:
  xor eax, eax
  rep bsf eax, edi
  ret
cpsgn:
  andpd xmm0, XMMWORD PTR .LC0[rip]
  movapd xmm2, xmm1
  andpd xmm2, XMMWORD PTR .LC1[rip]
  orpd xmm0, xmm2
  ret
exponent:
  jmp ilogb
loadexp:
  jmp ldexp
.LC0:
  .long 4294967295
  .long 2147483647
  .long 0
  .long 0
.LC1:
  .long 0
  .long -2147483648
  .long 0
  .long 0
So __builtin_ctz becomes bsf.  copysign is resolved, too. However, ilogb and ldexp, which is often slow, result in a jmp instruction. How can I resolve the jmp (or call)?
