DFP is beyond i386 psABI. Gcc aligns _Decimal32 to 4 byte, _Decimal64 to 8 bytes
and _Decimal128 to 16bytes. The question is what is the best alignment for them
when passing to a functions.
H.J.
Unless there is some hardware penalty in loading from
a 4-byte boundary rather than 8-byte boundary, then it
would seem that 4-byte alignment is simpler. On the
other hand, it would seem that alignment of a data value
should be on the expected boundary whether it statically
allocated or passed to a function.
--
Michael Eager ea...@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077
That is a good question. For x86, _Decimal128 is passed on stack
and aligned at 4 byte. For x86-64, _Decimal128 is passed in SSE
registers. An implementation of _Decimal128 in 32bit may want
to use SSE registers.
H.J.
I think we should align _Decimal64 and _Decimal128 to their natural
alignments when passing a function. The same should apply to x86-64
when they are passed on stack.
H.J.
I added gcc mailing list.
H.J.
On Tue, Apr 1, 2008 at 10:53 AM, Dave Kreitzer
<david.l....@intel.com> wrote:
>
> > I think we should align _Decimal64 and _Decimal128 to their natural
> > alignments when passing a function. The same should apply to x86-64
> > when they are passed on stack.
> >
>
> Rather than aligning _Decimal64 to its natural boundary, I think it is
> more sensible to be consistent with the existing 8-byte scalar types,
> i.e. double and long long. That would mean aligning _Decimal64 to 4
> bytes within structures and when passing to a function.
>
That means to change the default alignment of _Decimal64 to 4 bytes in
32bit mode.