[LLVMdev] complex library functions (creal and cimag)

Akira Hatanaka ahatanak at gmail.com
Fri Apr 27 12:09:19 PDT 2012


When I compile this code which includes call to crealf,

$ cat foo1.c
#include <complex.h>

float foo1(complex float z) { return crealf(z); }

clang emits a call to crealf,

$ clang  foo1.c -S -o - -O3
foo1:                                   # @foo1
    .cfi_startproc
# BB#0:                                 # %entry
    jmp    crealf                  # TAILCALL

while gcc does it in two move instructions:

$ gcc foo1.c -S -o -O3
foo1:
.LFB0:
        .cfi_startproc
        movq    %xmm0, -8(%rsp)
        movss   -8(%rsp), %xmm0

Is this an optimization which is missing in llvm?
Or is it making a deliberate decision not to expand the call to move
instructions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20120427/056d89ad/attachment.html>


More information about the llvm-dev mailing list