This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Builtin expansion versus headers optimization: Reductions


05.06.2015 13:02, OndÅej BÃlka writes:
> Also as I mentioned bugs before gcc now doesn't handle alignment well so
> it doesn't optimize following to zero for aligned code.
> 
>  align = ((uintptr_t) x) % 16;
> 
That is because GCC is conservative and supports some non-ABI-compliant
memory allocators which only guarantee 8-byte alignment, but

char *bar()
{
    char *data = __builtin_malloc(64);
    return data + ((unsigned long)data) % 8;
}

does get optimized to

bar:
.LFB1:
        .cfi_startproc
        movl    $64, %edi
        jmp     malloc
        .cfi_endproc
-- 
Regards,
    Mikhail Maltsev


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]