This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug target/79045] New: bool&bool expanded as 2 jumps
- From: "glisse at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Tue, 10 Jan 2017 14:56:18 +0000
- Subject: [Bug target/79045] New: bool&bool expanded as 2 jumps
- Auto-submitted: auto-generated
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.