Compiling:
typedef unsigned char Char;
typedef Char *ScrnPtr;
typedef ScrnPtr *ScrnBuf;
typedef struct {
int foo [1000];
int savelines;
ScrnBuf visbuf;
ScrnBuf allbuf;
} TScreen;
typedef struct _XtermWidgetRec {
TScreen screen;
int num_ptrs;
} *XtermWidget;
extern XtermWidget term;
void
VTallocbuf(void)
{
TScreen *screen = &term->screen;
screen->visbuf = &screen->allbuf[term->num_ptrs * screen->savelines];
return;
}
with 4.0 and 4.1 -march=i686 -O2 generates: (the significant part of the sdiff
is shown)
movl 4012(%eax), %ecx | movl
4000(%edx), %ecx
movl 4000(%eax), %edx | movl
4012(%edx), %eax
imull %ecx, %edx | imull
%ecx, %eax
movl 4008(%eax), %ecx | movl
4008(%edx), %ecx
leal (%ecx,%edx,4), %edx | sall
$2, %eax
movl %edx, 4004(%eax) | addl
%ecx, %eax
> movl
%eax, 4004(%edx)
Note that 4.1 generates sall + addl instead of a single leal instruction.
This might be one of the reasons for 4.1 the code size regression in PR23153.
--
Summary: 4.1 generates sall + addl instead of leal
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 build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=23303