This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/18029] New: a twiddleing of a
- From: "kazu at cs dot umass dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 16 Oct 2004 02:57:08 -0000
- Subject: [Bug middle-end/18029] New: a twiddleing of a
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Consider:
struct B {
unsigned bit : 1;
};
void
plus (struct B *b)
{
b->bit = b->bit + 1;
}
void
xor (struct B *b)
{
b->bit = b->bit ^ 1;
}
./cc1 -O2 -fomit-frame-pointer -mregparm=3 generates
plus:
xorb $1, (%eax)
ret
xor:
movb (%eax), %cl
andl $1, %ecx
xorl $1, %ecx
movzbl %cl, %ecx
movl (%eax), %edx
andl $-2, %edx
orl %ecx, %edx
movl %edx, (%eax)
ret
Note that the two functions do the same thing. Obviously, we should optimize
xor just like plus.
--
Summary: a twiddleing of a
Product: gcc
Version: unknown
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: enhancement
Priority: P2
Component: middle-end
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=18029