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 target/79045] New: bool&bool expanded as 2 jumps


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

            Bug ID: 79045
           Summary: bool&bool expanded as 2 jumps
           Product: gcc
           Version: 7.0
            Status: UNCONFIRMED
          Keywords: missed-optimization
          Severity: enhancement
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: glisse at gcc dot gnu.org
  Target Milestone: ---
            Target: x86_64-linux-gnu

From http://stackoverflow.com/q/41508563/1918193

extern void g();
void f1(char a,char b){ if(a&b)g(); }
void f2(bool a,bool b){ if(a&b)g(); }

f1 gives the nice

        testb   %dil, %sil
        jne     .L4
        rep ret
.L4:
        jmp     _Z1gv

while f2 gives the uglier

        testb   %dil, %dil
        je      .L5
        testb   %sil, %sil
        je      .L5
        jmp     _Z1gv
.L5:
        rep ret

>From my understanding of the ABI, the same code generated for f1 would also be
valid for f2.

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