From mboxrd@z Thu Jan 1 00:00:00 1970 From: Linus Torvalds To: mark@codesourcery.com Cc: rth@cygnus.com, tim@wagner.Princeton.EDU, craig@jcb-sc.com, davem@redhat.com, chip@perlsupport.com, egcs@egcs.cygnus.com Subject: Re: Linux and aliasing? Date: Wed, 30 Jun 1999 15:43:00 -0000 Message-ID: References: <19990605110117T.mitchell@codesourcery.com> X-SW-Source: 1999-06n/msg00224.html Message-ID: <19990630154300.9er8cE6nBpfaXEOz4ZeaILsm_AnU5ZfvTHL9-_wxbfI@z> On Sat, 5 Jun 1999 mark@codesourcery.com wrote: > > Not really always true. You can use `memcpy (target, src, sizeof > (x))' and if the alignments of the src and target are known to the > compiler you *should* get optimal code. (I don't know if GCC does > this at present, but it could, and that would clearly be a good > improvement.) Only if that's assuming that it _is_ a memcpy. Think of things like a = ntohl(*(u32 *)p); etc - which is _not_ just a copy. Current gcc versions do pretty well on the pure memcpy() case, I agree. A lot of the Linux memcpy() logic is because gcc historically did _not_ do any of the optimizations people felt really had to be done. Linus