Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 24 Jul 2001 12:13:28 -0700 (PDT)
From:      John Baldwin <jhb@FreeBSD.org>
To:        j mckitrick <jcm@FreeBSD-uk.eu.org>
Cc:        Greg Lehey <grog@FreeBSD.org>, freebsd-chat@FreeBSD.org
Subject:   Re: stack use preference
Message-ID:  <XFMail.010724121328.jhb@FreeBSD.org>
In-Reply-To: <20010724200251.A72789@dogma.freebsd-uk.eu.org>

next in thread | previous in thread | raw e-mail | index | archive | help

On 24-Jul-01 j mckitrick wrote:
>| Yes.  On x86, doing
>| 
>|         enter $8, $0    ; 8 bytes of local storage
>| 
>| is equivalent to:
>| 
>|         push %ebp
>|         mov %esp, %ebp
>|         sub $8, %esp
>| 
>| but most compilers that I've seen unroll 'enter' rather than using it
>| directly.
>| *shrug*
> 
> From what I have discovered, 'enter' uses more cycles than the corresponding
> instructions, and yet 'leave' does not.

That is what I seem to recall as well.  On the 386, enter $8, $0 would take 10
cycles, whereas the separate instructions would take 2 + 2 + 2 = 6 cycles. 
Granted these instructions all have RAW dependencies, and I'm not sure if that
would wreak havoc in the form of register stalls on 686+ or not which might
drown out the 1 or 2 cycles saved on 686+.

-- 

John Baldwin <jhb@FreeBSD.org> -- http://www.FreeBSD.org/~jhb/
PGP Key: http://www.baldwin.cx/~john/pgpkey.asc
"Power Users Use the Power to Serve!"  -  http://www.FreeBSD.org/

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-chat" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.010724121328.jhb>