This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: leave instruction on ppro/pII/pIII
- To: Alexander Sokolov <robocop at netlink dot ru>
- Subject: Re: leave instruction on ppro/pII/pIII
- From: Lee Iverson <leei at ai dot sri dot com>
- Date: Wed, 10 May 2000 11:33:04 -0700
- cc: Jeffrey A Law <law at cygnus dot com>, gcc <gcc at gcc dot gnu dot org>
In message <Pine.LNX.4.10.10005102150050.30928-100000@ns.netlink.ru>, Alexander
Sokolov writes:
>On Wed, 10 May 2000, Jeffrey A Law wrote:
>
>> True, but in an out of order execution machine, you're better off generating
>> the simpler instructions as they can issue/retire interleaved with other
>> non-epilogue instructions.
>>
>> It probably does make sense to use "leave" when optimizing for size though
>> and a patch to do this would be appreciated. I'm much less sure about
>> using "leave" when not optimizing for size on ppro, PII & PIII.
>
>Since decoders issue micro-ops in-order and retirement unit retires them
>in-order, if there are no instructions generated between "movl %ebp,%esp"
>and "popl %ebp" then if we change this sequence to "leave" we get exactly
>the same 3 micro-ops issued by decoders which have to retire in exactly
>the same order.
This sounds like a perfect match for a peephole optimization.
Generate the movl/popl pair and if they've not been rescheduled by the
time we get to peephole then just substitute a leave. This strategy
should handle all cases w/o need to depend on -Os or other params.
That is unless I'm missing something.
-------------------------------------------------------------------------------
Lee Iverson SRI International
leei@ai.sri.com 333 Ravenswood Ave., Menlo Park CA 94025
http://www.ai.sri.com/~leei/ (650) 859-3307