This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Poor i386 code from egcs.


On Sat, Jun 27, 1998 at 06:38:40PM +0200, Joern Rennecke wrote:
> >         movl %esp,%eax
> >         pushl %eax           <----- why can't it push %esp directly?
> 
> And what would that mean, then?  How do you know what value of esp is pushed?

To quote my Pentium Manual p25-253

"The PUSH ESP instruction pushes the value of the ESP register as it existed before the
instruction. This differs from the 8086, where the PUSH SP instruction pushes the new value
(decremented by 2).

Likewise, a PUSH-from-memory instruction, which uses the stack pointer (ESP) as a base
register, references memory before the PUSH. The base used is the value of the ESP before
the instruction executes."

GCC does not support the 8086 or 16bit code, so backward compatibility is no 
problem. 


-Andi


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]