This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: powerpc & unaligned block moves with fp registers
- To: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- Subject: Re: powerpc & unaligned block moves with fp registers
- From: David Edelsohn <dje at watson dot ibm dot com>
- Date: Thu, 08 Nov 2001 14:56:12 -0500
- cc: gcc at gcc dot gnu dot org
>>>>> Richard Kenner writes:
Richard> No. DImode seems the right mode to me.
Richard> I have not been following this discussion enough to understand what the
Richard> problem is so I can't suggest a solution.
GCC uses DImode for a structure such as
struct x { char c[8]; };
which means that any loads and stores use DImode. On some architectures,
unaligned 64-bit loads and stores can cause alignment exceptions trapping
to the OS to perform the load in pieces.
The problem is that GCC uses DImode even for memory-to-memory
moves, such as
int quux (struct x* a, struct x* b) {
*a = *b;
}
which is very inefficient.
I believe that GCC should use a block move for this type of
unaligned copy. IBM's compiler uses a block move. The question is where
to hook this in.
A hook recently was added to the PowerPC MD to notice DImode
memory-to-memory moves and split it into preferred moves. I think that
GCC should use the SLOW_UNALIGNED_ACCESS macro to make this choice in
common code early in the decision process of how to perform the move
instead of the architecture-dependent code cracking the DImode move into
pieces late in the process.
I was tracing back the source of the DImode label on the
structure. The DImode comes from the record layout. If the record
remains DImode so that it is loaded into a register, then we need to
intercept the assignment sometime before emit_move_insn() is called and
choose the mode used for the move.
David