Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Path: utzoo!utgpu!water!watmath!clyde!rutgers!mit-eddie!uw-beaver!ubc-vision!alberta!teletron!andrew
From: andrew@teletron.UUCP
Newsgroups: unix-pc.general,comp.sys.att
Subject: Re: 3b1 instruction timings
Message-ID: <150@teletron.UUCP>
Date: Sun, 6-Dec-87 21:18:04 EST
Article-I.D.: teletron.150
Posted: Sun Dec  6 21:18:04 1987
Date-Received: Sat, 12-Dec-87 08:47:35 EST
References: <787@hsi.UUCP>
Organization: TeleTronic Communications Ltd., Edmonton, Alta.
Lines: 32
Keywords: 3b1, 7300
Xref: utgpu unix-pc.general:95 comp.sys.att:1749
Summary: 68000 coding tips

In article <787@hsi.UUCP>, stevens@hsi.UUCP (Richard Stevens) writes:
> While trying to hand optimize some C code for a graphics routine
> that I wanted to get as fast as possible, I performed some
> timings on the 3b1.

> I used the cc optimizer for all timings.  A couple of observations:

> - stick to shorts instead of ints or longs, when possible, since
> 	a 32-bit multiply or divide gets very expensive.

This holds true for array indices as well.  Using a short as an array
index results in the 68000 muls.w or mulu.w instruction being used for
the address calculation instead of the more expensive 32 bit multiplication
subroutines used for ints or longs.


> - registers don't buy you much except for adds and subtracts (and
> 	assignments too, I'd guess).

Actually, register variables buy you a *lot* in most code.  The 68000 family
was designed so that register usage makes code sing.  I would *highly*
recommend register variables for heavily used pointer variables (such as
in string processing or structure access routines).


> Overall I wasn't very impressed with the code quality of the C compiler,
> even with the optimizer.

Me either.

	Andrew Scott			(..alberta!teletron!andrew)
	TeleTronic Communications Ltd.