This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH:[darwin] fix load of a misaligned double word



On Dec 22, 2003, at 16:23, Bradley Lucier wrote:


I have a few questions about this patch.

First, I can't find a message where it's been approved, but it was committed in

http://gcc.gnu.org/ml/gcc-cvs/2003-12/msg00850.html

Second, I hit this problem myself, and now my code compiles with the FSF compiler with -mcpu=G5, but my FFT code is 10-20% slower than before with -mcpu=G4 -mtune=G5. So I'm wondering if this is the right thing to do.

The Apple assembler was complaining about addresses like 3(r4) for loads and stores of floating-point values. If the value of r4 here is equal to 5 modulo 8, then this seems like a properly aligned memory address according to the PowerPC programming manuals. Gambit is very careful to align doubles on 8-byte boundaries, but these are accessed through char * pointers something like

*(double *)((char *)p+3)

and this generated the misaligned messages like the one mentioned in

http://gcc.gnu.org/ml/gcc-patches/2003-12/msg01788.html

So is gcc at fault and needs to be fixed, as this patch implies, or is Apple's assembler? Or do I just not understand what's going on here?

This patch is fix the load/stores of double words (ld/std instructions).
The PPC ISA defines them as being always using 4 byte aligned offsets.
So the patch was to fix the output of the right asm but it looks like
a side effect is that it the load and stores of doubles (lfd/stfd), the offset
also get aligned which causes this performance problem.


Thanks,
Andrew Pinski


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]