Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!wuarchive!usc!apple!sun-barr!decwrl!ucbvax!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: Why link with '-ad 4' ? Message-ID: <9162@hoptoad.uucp> Date: 2 Dec 89 08:57:03 GMT References: Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 32 In article mm3d+@andrew.cmu.edu (Matt McNally) writes: >After looking at the MPW 3.0 default make files generated >with the 'Create Build Commands...' option I noticed that >the *new* default is to link with the '-ad 4' option. > >Now I *think* I understand what the option does, as describe >in the MPW manuals but I have no idea WHY I would want to align >data to 4 byte (2 word) boundaries as opposed to single word >(2 byte) boundaries. John Gilmore (the system administrator and owner of hoptoad) just explained this to me the other day, in response to my slightly flawed message on alignment errors in 680x0 processors. The 32-bit data bus processors (68020, 68030) can cope with data on any alignment, but it will take an extra bus cycle to cope with unaligned data, because the processor has to do two fetches. So there's some performance gain on true 32-bit processors if all data is aligned at a four-byte boundary. (Actually, I think this only applies to longwords; John? I don't see how there would be any gain for one-byte or two-byte data, as long as the two-byte data is aligned at a two-byte boundary. I gotta get me a 68030 manual one of these days; this old 68K one I've been using for years is not real helpful on this kind of question.) -- Tim Maroney, Mac Software Consultant, sun!hoptoad!tim, tim@toad.com "He goes on about the wailing and gnashing of teeth. It comes in one verse after another, and it is quite manifest to the reader that there is a certain pleasure in contemplating the wailing and gnashing of teeth, or else it would not occur so often." -- Bertrand Russell, "Why I Am Not a Christian"