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 rtl-optimization/80917] New: missed bit information propagation


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80917

            Bug ID: 80917
           Summary: missed bit information propagation
           Product: gcc
           Version: 8.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: rtl-optimization
          Assignee: unassigned at gcc dot gnu.org
          Reporter: drepper.fsp+rhbz at gmail dot com
  Target Milestone: ---

Take the following code:

int f(unsigned a)
{
  if ((a & 2) == 0)
    return 0;

  a += 4;

  return (a & 2) != 0;
}

The addition clearly cannot affect the repeat of the test of the second bit. 
Still, with the current trunk compiler I get with -O3 on x86-64:

        xorl    %eax, %eax
        testb   $2, %dil
        je      .L1
        shrl    %edi
        movl    %edi, %eax
        andl    $1, %eax
.L1:
        ret


It might get quickly expansive but the bit set/unset information could be
tracked passed the test and through arithmetic operations like additions.

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