This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/22156] New: [4.0/4.1 Regression] bit-field copying regressed
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 23 Jun 2005 05:02:45 -0000
- Subject: [Bug middle-end/22156] New: [4.0/4.1 Regression] bit-field copying regressed
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Take the following code:
struct s
{
int i1:1;
int i2:1;
int i3:1;
};
void f(struct s *x, struct s *y) { *x = *y; }
In 3.4.0 (and currently with the C++ compiler too), we were able to get optimal code:
movl 8(%esp), %eax
movl (%eax), %edx
movl 4(%esp), %eax
movl %edx, (%eax)
ret
But in (and after) 4.0.0 and the C compiler we get:
f:
pushl %esi
pushl %ebx
movl 16(%esp), %eax
movl 12(%esp), %esi
movzbl (%eax), %eax
movb %al, %dl
movb %al, %bl
salb $5, %al
sarb $7, %al
movzbl %al, %ecx
movl (%esi), %eax
salb $6, %dl
andl $1, %ecx
sarb $7, %dl
movzbl %dl, %edx
salb $7, %bl
andl $-7, %eax
sall $2, %ecx
andl $1, %edx
sarb $7, %bl
addl %edx, %edx
orl %ecx, %eax
orl %edx, %eax
movzbl %bl, %edx
andl $1, %edx
andl $-2, %eax
orl %edx, %eax
movl %eax, (%esi)
popl %ebx
popl %esi
ret
Which is much worse
--
Summary: [4.0/4.1 Regression] bit-field copying regressed
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Keywords: missed-optimization
Severity: normal
Priority: P2
Component: middle-end
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: pinskia at gcc dot gnu dot org
CC: gcc-bugs at gcc dot gnu dot org
OtherBugsDependingO 19466
nThis:
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22156