[Bug rtl-optimization/23102] New: extra XORs generated on i686
dann at godzilla dot ics dot uci dot edu
gcc-bugzilla@gcc.gnu.org
Wed Jul 27 22:00:00 GMT 2005
Compiling the code below (extracted from xterm-202) with
-fno-inline -O2 -march=i686
typedef unsigned int Cardinal;
typedef unsigned long Pixel;
typedef char *String;
typedef struct {
String resource;
Pixel value;
int mode;
} ColorRes;
typedef struct {
ColorRes Acolors[(256 +4)];
int startHRow, startHCol,
endHRow, endHCol,
startHCoord, endHCoord;
Cardinal selection_count;
} TScreen;
static void
ResetSelectionState(TScreen * screen)
{
screen->selection_count = 0;
screen->startHRow = screen->startHCol = 0;
screen->endHRow = screen->endHCol = 0;
}
void foo (TScreen *scr)
{
ResetSelectionState (scr);
}
generates:
ResetSelectionState:
pushl %ebp
xorl %edx, %edx
movl %esp, %ebp
xorl %ecx, %ecx
popl %ebp
movl %edx, 3144(%eax)
xorl %edx, %edx
movl %ecx, 3124(%eax)
xorl %ecx, %ecx ;; this is not needed, ecx is already 0
movl %edx, 3120(%eax)
xorl %edx, %edx ;; so is edx
movl %ecx, 3132(%eax)
movl %edx, 3128(%eax)
ret
when using -march=i386 the code looks better:
ResetSelectionState:
pushl %ebp
movl %esp, %ebp
movl $0, 3144(%eax)
movl $0, 3124(%eax)
movl $0, 3120(%eax)
movl $0, 3132(%eax)
movl $0, 3128(%eax)
leave
ret
--
Summary: extra XORs generated on i686
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: rtl-optimization
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: dann at godzilla dot ics dot uci dot edu
CC: gcc-bugs at gcc dot gnu dot org
GCC host triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23102
More information about the Gcc-bugs
mailing list