-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi there.
On Sat, Jul 02, 2005 at 01:27:00PM +0300, Andriy Tkachuk wrote: > here even more refereces to memory in your variant. Ummm... What compiler version are you use? The pointer variant produces faster code for me on both NetBSD/alpha (gcc 3.3.3) and Linux/x86 (gcc 3.3.5), using both -O0 and -O2 (other compiler flags also tested with similar results). Perhaps something specific to FreeBSD then? I guess I'll have to set up a FBSD box and have a look at it, when I catch up with some of the other stuff in my todo list... Anyway, the proposed optimization even makes sense if you think about it in a logical pen-and-paper way: array variant: 1. load address of element 0 of array to register A 2. load counter to register B 3. decrease register B 4. store back new decreased B 5. load (dereference) A[B] This last operation may either translate to a leal-type instruction, or to an add+load-type sequence of instructions. pointer variant: 1. load address of pointer to register A 2. decrease register A 3. store back new decreased A 4. load (dereference) A \n\n -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.1 (GNU/Linux) Comment: Nikos "Nikolai" Ntarmos <[EMAIL PROTECTED]> iD8DBQFCyIw0m6J1ac+VFgoRAonNAJ0Zs4Ohl+VWyv0FzgBfGV17Kt+uswCgkkRc +u9Ly5w59makY/R2noNI3nM= =ScoK -----END PGP SIGNATURE----- _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "[EMAIL PROTECTED]"