[LLVMdev] complex library functions (creal and cimag)

Chris Lattner clattner at apple.com
Sat Apr 28 09:29:38 PDT 2012


On Apr 27, 2012, at 2:02 PM, Eli Friedman wrote:
> On Fri, Apr 27, 2012 at 12:09 PM, Akira Hatanaka <ahatanak at gmail.com> wrote:
>> 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?
> 
> Missing optimization.  There isn't any reason to avoid inlining the
> implementation.
> 
> Probably the simplest place to implement this would be CGBuiltin in clang...

It would also make sense to handle this in simplifylibcalls.  There isn't anything C-specific about this.

-Chris



More information about the llvm-dev mailing list