This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug rtl-optimization/19719] New: missed optimization on boolean operation with boolean arguments
- From: "yuri at tsoft dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 31 Jan 2005 06:11:27 -0000
- Subject: [Bug rtl-optimization/19719] New: missed optimization on boolean operation with boolean arguments
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Function:
bool f(bool b1, bool b2) { return (b1 && b2); }
compiled into assembly with 2 jumps and many redundand instructions (7 total),
see below.
Should be no jumps and much less instructins (3 total).
Yuri
----got from g++----
pushl %ebp
movl %esp, %ebp
> xorl %eax, %eax
> cmpb $0, 8(%ebp)
> movb 12(%ebp), %dl
> je .L2
> testb %dl, %dl
> je .L2
> movb $1, %al
.p2align 2,,3
.L2:
leave
ret
----should be----
pushl %ebp
movl %esp, %ebp
> xorl %eax, %eax
> movb 8(%ebp), %al
> andb 12(%ebp), %al
.p2align 2,,3
.L2:
leave
ret
--
Summary: missed optimization on boolean operation with boolean
arguments
Product: gcc
Version: 3.4.2
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: yuri at tsoft dot com
CC: gcc-bugs at gcc dot gnu dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=19719