Bloated Struct Problem
Michael Meissner
meissner@linux.vnet.ibm.com
Mon Jun 15 19:24:00 GMT 2009
On Sun, Jun 14, 2009 at 02:43:17PM -0700, Tim Prince wrote:
> Michael Meissner wrote:
>
> >
> > 32-bit GCC on x86 defines the alignment of long long to 4 bytes, while 64-bit
> > GCC on x86 defines the alignment to be 8 bytes. Unfortunately the 32 bit x86
> > is also stuck with doubles being aligned on a 32-bit boundary, due to the fact
> > that the people creating the original ABI were using a 386 which did not need
> > higher alignments, and newer processors lose performance because it isn't
> > properly aligned.
> In x86 32-bit mode, long long continues to be implemented with pairs of
> int, so the performance problems with 4-byte alignment arise only for
> double and vectorizable types.
Well, there is the FILD instruction that converts from a 64-bit integer and
pushes the value on the 387 stack, and FIST which pops off the stack and
converts it to 64-bit integer.
But I would argue it was a mistake for doubles not being aligned in the ABI
(and I would think long longs also should have the same alignment, even if
technically the hardware doesn't require it).
--
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com
More information about the Gcc-help
mailing list