This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC 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]

[Bug other/32994] New: redundant +/- 1 after __builtin_ffs() inlining.


$ cat ffs.c
int idx( unsigned mask )
{
        return __builtin_ffs( mask ) - 1;
}

gcc-4.3.0-20070712:

idx:    bsfl    %edi, %eax
        movl    $-1, %edx
        cmove   %edx, %eax
        ret

gcc-4.2.2-20070802 produces worse code:

idx:    bsfl    %edi, %edi
        movl    $-1, %eax
        cmove   %eax, %edi
        addl    $1, %edi
        leal    -1(%rdi), %eax
        ret


-- 
           Summary: redundant +/- 1 after __builtin_ffs() inlining.
           Product: gcc
           Version: 4.2.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: other
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pluto at agmk dot net
GCC target triplet: x86_64-gnu-linux


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32994


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