From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13656 invoked by alias); 11 Oct 2004 13:52:33 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org Received: (qmail 13628 invoked by uid 48); 11 Oct 2004 13:52:32 -0000 Date: Mon, 11 Oct 2004 13:52:00 -0000 From: "kazu at cs dot umass dot edu" To: gcc-bugs@gcc.gnu.org Message-ID: <20041011135226.17931.kazu@cs.umass.edu> Reply-To: gcc-bugzilla@gcc.gnu.org Subject: [Bug rtl-optimization/17931] New: andl and testb are not combined X-Bugzilla-Reason: CC X-SW-Source: 2004-10/txt/msg01400.txt.bz2 List-Id: Consider: struct flags { unsigned f0 : 1; unsigned f1 : 1; }; _Bool foo (struct flags *p) { if (p->f0) return 1; return p->f1; } With "cc1 -O2 -fomit-frame-pointer", I get foo: movl 4(%esp), %eax movb (%eax), %dl movb %dl, %al andl $1, %eax testb %al, %al jne .L7 xorl %eax, %eax testb $2, %dl setne %al ret .p2align 2,,3 .L7: movl $1, %eax ret Note that andl and testb are not combined to "testb $1, %al". If they were combined, we would not destroy %eax, so we would not need to make a copy of %al for a later use. With -march=pentium4 or -march=athlon-xp, I get a similar result. -- Summary: andl and testb are not combined Product: gcc Version: 4.0.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: enhancement Priority: P2 Component: rtl-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: kazu at cs dot umass dot edu CC: gcc-bugs at gcc dot gnu dot org GCC target triplet: i686-pc-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=17931