This is the mail archive of the 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: Unaligned floating point access generation for powerpc

On Wednesday, October 22, 2003, at 08:09 AM, David Edelsohn wrote:
Olivier Hainque writes:

Olivier> On some ppc models, misaligned integer accesses are acceptable while floating
Olivier> point misaligned accesses are not (undesired traps).

Olivier> Using the current mainline GCC sources, the powerpc-elf O1 compilation of the
Olivier> code below generates a floating point register load from a
Olivier> misaligned address.

Olivier> typedef long long data_t __attribute__((aligned (1)));

The programmer is overriding the ABI definitions for alignment.
The compiler assumes the programmer knows what s/he is doing. Violating
the ABI may produce inefficient code. Why do you expect the compiler to
do anything else?

That's one way to look at it, certainly, but we have a lot of users who take a different
view. They know that a misaligned integer operation is a lot cheaper
than a misaligned FP one, and don't see why the compiler doesn't know it too.
I have some sympathy. (Misaligned accesses are common here because of all the
68K legacy code, and compilers that historically followed 68K alignment rules, when
so requested, for compatibility.)

I think the way to fix it is for the RA to take alignment into account when picking
registers. I've never tried very hard to do this. Possibly it can even be done with
the existing register-class mechanism, though I doubt it.

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