From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 7442 invoked from network); 19 Nov 1998 17:17:39 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 19 Nov 1998 17:17:39 -0000 Received: from obiwan.unix.cslab.tuwien.ac.at (root@u194.cslab.tuwien.ac.at [193.170.72.194]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id LAA00490 for ; Thu, 19 Nov 1998 11:20:07 -0500 Received: (from schani@localhost) by obiwan.unix.cslab.tuwien.ac.at (8.8.8/8.8.8) id KAA05686; Thu, 19 Nov 1998 10:33:02 GMT Message-ID: <19981119103302.C4987@obiwan.unix.cslab.tuwien.ac.at> Date: Thu, 19 Nov 1998 10:33:02 +0000 From: Mark Probst To: axp-list@redhat.com Subject: Re: Alpha's floating point performance Mail-Followup-To: axp-list@redhat.com References: <19981118222640.A30010@obiwan.unix.cslab.tuwien.ac.at> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.91.1 In-Reply-To: ; from Bibek Sahu on Wed, Nov 18, 1998 at 04:41:40PM -0600 On Wed, Nov 18, 1998 at 04:41:40PM -0600, Bibek Sahu wrote: > If you don't activate optimizations, it most certainly does push > the arguments onto the stack. And inside the function it pushes all local > variables onto the stack. But then, that's _without_ optimizations. ;-) yes and no. i just tried it out (gcc -S test.c) and was surprised that the arguments are pushed on the stack by the called function, not by the caller. this means that argument passing is done the same way, namely through registers $16-$21, which, by the way, is a must because otherwise you could not link optimized and unoptimized code. this is the source i compiled: --- long c_func (long l) { return l + 1; } --- and this is the assembler output without optimizations, annotated by my humble self: --- .globl c_func .ent c_func c_func: c_func..ng: lda $30,-32($30) ; allocate stack frame .frame $15,32,$26,0 stq $26,0($30) ; push return adress stq $15,8($30) ; push frame pointer .mask 0x4008000,-32 bis $30,$30,$15 ; set frame pointer = stack pointer .prologue 0 stq $16,16($15) ; push argument on stack ldq $2,16($15) ; load argument from stack addq $2,1,$1 ; add one to argument bis $1,$1,$0 ; store result in result register br $31,$33 ; jump to $33 $33: bis $15,$15,$30 ; set stack pointer = frame pointer ldq $26,0($30) ; load return address from stack ldq $15,8($30) ; load frame pointer from stack addq $30,32,$30 ; deallocate stack frame ret $31,($26),1 ; return from subroutine .end c_func --- this is the optimized version (-O2): --- .globl c_func .ent c_func c_func: c_func..ng: .frame $30,0,$26,0 .prologue 0 addq $16,1,$0 ; set result register = argument + 1 ret $31,($26),1 ; return from subroutine .end c_func --- bye schani -- Mark Probst Student, Programmer http://www.unix.cslab.tuwien.ac.at/~schani/