On Thu, Apr 20, 2006 at 08:38:00AM -0700, H. J. Lu wrote: > On Thu, Apr 20, 2006 at 05:18:08PM +0200, Olivier Galibert wrote: > > I need to be able to do unaligned memory accesses to memory in > > big-endian or little-endian mode. For portability, I'd like to do it > > in pure C, but I'd like the compiler to generate optimal sequences for > > the operations. Most CPUs that I know of even have special > > instructions designed to speed up part or all of these operations. > > > > So I'm looking for ways of writing these to-be-inlined elemental > > functions in C that gcc will recognize as such, while still working > > correctly, if more slowly, for other compilers. > > > > bfd does that.
Have you looked at the code generated for these? I was able to drastically improve performance of a project I was working on, on x86, by forcing BFD to do unaligned loads instead of bytewise loads, but I never found a clean way to do it automatically. -- Daniel Jacobowitz CodeSourcery