FreeBSD 5.2 v/s FreeBSD 4.9 MFLOPS performance (gcc3.3.3 v/sgcc2.9.5)

Matthew Dillon dillon at apollo.backplane.com
Mon Feb 16 17:52:10 PST 2004


:I've not looked at 3.3, but I seem to recall that GCC 3.2
:did not actually align the stack within each function, but
:preserved the alignment.  (That is, each function assumed the stack
:had a certain alignment on entry and ensured that alignment
:was preserved for any subsequent function calls.)

    Easy to test... ah, ok.  3.3 aligns the stack in main().

main:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp
        andl    $-16, %esp	<<<<< ailgns stack here andl 0xfffffff0,%esp
	...

    And the preserves the alignment in other procedures... 8 + ebp + retaddr
    is 16 bytes:

charlie:
        pushl   %ebp
        movl    %esp, %ebp
        subl    $8, %esp     /* I declared 'volatile int x' as a stack var */
        call    fubar
        call    fubar
        call    fubar
        leave
        ret

:If I'm remembering this correctly, then aligning
:the stack in crt1.o would be pretty much essential.
:
:Tim Kientzle

    For gcc 2.95, yes.

					-Matt
					Matthew Dillon 
					<dillon at backplane.com>


More information about the freebsd-hackers mailing list