Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!batcomputer!itsgw!steinmetz!uunet!auspex!guy From: guy@auspex.UUCP (Guy Harris) Newsgroups: comp.lang.c Subject: Re: Address error quietly fixed on 680x0 systems Keywords: 68k, sparc, portability Message-ID: <903@auspex.UUCP> Date: 28 Jan 89 05:16:12 GMT References: <302@puivax.UUCP> Reply-To: guy@auspex.UUCP (Guy Harris) Distribution: usa Organization: Auspex Systems, Santa Clara Lines: 18 >Looking at the code generated by cc I see a long move: no smarts >in the compiler therefore. So the only mechanism that I can be fixing >this is an address error trap that quietly moves unaligned objects >byte-by-byte as requested. Wrongo. The 68020 (as appears in the Sun-3), and a variety of other chips/machines, don't *take* address error traps when you give them an unaligned address; they just fetch the data. RTFM (TFM being, in this case, Motorola's 68020 book). Furthermore, the 68000 (as appears in most Macs) and 68010 only require 2-byte alignment, even for 4-byte quantities (TFM being, in this case, Motorola's 68000/68008/68010 book). >Simple timing experiments on the Sun3 don't appear to bear this out, >however; I saw a 50% increase in runtime with writes to an odd address >but would have expected more (the trap mechanisms on the 68k aren't >super fast after all). Enlightenment? Off-boundary references are, however, slower than on-boundary references.