Andrew Pinski wrote:
On Tue, 2007-01-16 at 20:04 -0800, Michael Eager wrote:
But unaligned char arrays make strcpy much slower.
Actually it depends on the processor unless you are messed up by using
-mstrict-align which is a huge hammer for most (if not all) PowerPC
processors even though the few cases which need an unaligned exception
handler is small.
For an example of the Cell, all GP register access is optimal unless it
crosses a 32byte boundary and then it is microcoded into the next
smaller unit. For double and float, the access only needs word aligned
to be optimal but otherwise it calls an unaligned exception handler. I
forget how the string instructions are done but I think those are
microcoded also, likewise with the multiple stores/loads.
Most if not all PowerPC are this way, I think even the ISA requires this
(except if instead of going access a 32byte boundary, it is a different
boundary (the page boundary) and that would then call the unaligned
exception handler and that is rarer).
Who really need to start getting the PS3 game OS to do an unaligned
exception handler that works instead of hanging.
Thanks,
Andrew Pinski
I have no idea how your reply is related to my question about the
change in alignment of char arrays between gcc-3.4 and gcc-4.1.
Strcpy is optimized to copy arrays which are aligned on word
boundaries by using word load/store. Unaligned arrays are copied
byte by byte. Runs slower.
I'm not using PS3 or Cell. Or doubles or floats. Unaligned
access exceptions are a non-issue. There's no OS involved and
nothing hangs.
--
Michael Eager [EMAIL PROTECTED]
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077