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: [PATCH] Optimize i386 syscall inlining for GCC 5


If I'm reading that right, it's still not quite optimal; there's an
unnecessary register shuffle after the system call... better would be

        push   %ebx
        mov    $0x2d,%eax
        mov    0x8(%esp),%ebx
        call   __x86.get_pc_thunk.cx
        add    $_GLOBAL_OFFSET_TABLE_,%ecx
        call   *%gs:0x10
        mov    __curbrk(%ecx),%edx
        mov    %eax,(%edx)
        cmp    %eax,%ebx
        ja     1f
        xor    %eax,%eax
        pop    %ebx
        ret
1:
        ; set errno and return -1

I think the compiler might've done it the way it did because then it
could hoist the xor %eax,%eax above the comparison, but the branch is
so unlikely that that's not a good choice.

But also, in context, I think it would be more helpful if you could
show the generated assembly for a *six*-argument syscall, ne?

zw


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