ix86_function_arg_boundary returns PARM_BOUNDARY for TDmode for ia32. Should it return 128bit? The psABI isn't clear on it. I think it should be aligned at 128bit.
(In reply to comment #0) > ix86_function_arg_boundary returns PARM_BOUNDARY for TDmode > for ia32. Should it return 128bit? The psABI isn't clear on > it. I think it should be aligned at 128bit. Yes, because it is moved to/from XMM registers. Currently, this exact problem is handled by a specialization code in ix86_expand_vector_move that forces unaligned instructions for TDmode memory moves via ix86_expand_vector_move_misalign. Please note that we have to be compatible with SSE x86 and non-SSE x86 code, so TDmode can't be passed in XMM registers on x86_32 targets. I'd wait for psABI to clear situation w.r.t to alignment first.
It is a question how TDmode should be aligned on stack when passing to a function. I will ask it on the ia32 psABI group.
This patch will align DFP to its natural boundary. Index: gcc/config/i386/i386.c =================================================================== --- gcc/config/i386/i386.c (revision 1917) +++ gcc/config/i386/i386.c (working copy) @@ -4609,7 +4609,8 @@ ix86_function_arg_boundary (enum machine align = GET_MODE_ALIGNMENT (mode); if (align < PARM_BOUNDARY) align = PARM_BOUNDARY; - if (!TARGET_64BIT) + /* Decimal floating point is aligned to its natural boundary. */ + if (!TARGET_64BIT && !VALID_DFP_MODE_P (mode)) { /* i386 ABI defines all arguments to be 4 byte aligned. We have to make an exception for SSE modes since these require 128bit
Subject: Bug 35657 Author: hjl Date: Thu Mar 27 18:52:18 2008 New Revision: 133649 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133649 Log: 2008-03-27 H.J. Lu <hongjiu.lu@intel.com> PR target/35657 * config/i386/i386.c (ix86_function_arg_boundary): Align decimal floating point to its natural boundary. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c
Subject: Bug 35657 Author: hjl Date: Thu Mar 27 18:55:36 2008 New Revision: 133651 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=133651 Log: 2008-03-27 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline: 2008-03-27 H.J. Lu <hongjiu.lu@intel.com> PR target/35657 * config/i386/i386.c (ix86_function_arg_boundary): Align decimal floating point to its natural boundary. Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/config/i386/i386.c
Fixed.
The alignment of TDmode is not yet decided, see http://groups.google.com/group/ia32-abi/browse_thread/thread/fc6db344b62dea76 Reopened as P1 bug, blocking 4.3.1 release, as per suggestion in http://gcc.gnu.org/ml/gcc-patches/2008-04/msg02135.html
On IA32, all 8 byte types should be aligned at 4 byte and 16byte types should be aligned at 16 byte. The only discrepancy is alignment of 8byte DFP type, _Decimal64. Gcc aligns it at 8 byte. But we should treat its alignment like double.
It turns out that __m64 is aligned to 4 byte in the outgoing parameter block and 8 byte elsewhere. We want _Decimal64 to be consistent with __m64, not double/long long.
A patch is posted at http://gcc.gnu.org/ml/gcc-patches/2008-05/msg00035.html
An updated patch is posted at http://gcc.gnu.org/ml/gcc-patches/2008-05/msg00271.html
Subject: Bug 35657 Author: hjl Date: Tue May 6 15:41:08 2008 New Revision: 134987 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=134987 Log: 2008-05-06 H.J. Lu <hongjiu.lu@intel.com> PR target/35657 * config/i386/i386.c (contains_128bit_aligned_vector_p): Renamed to ... (contains_aligned_value_p): This. Handle _Decimal128. (ix86_function_arg_boundary): Only align _Decimal128 to its natural boundary and handle it properly. Modified: trunk/gcc/ChangeLog trunk/gcc/config/i386/i386.c
Subject: Bug 35657 Author: hjl Date: Thu May 8 19:11:23 2008 New Revision: 135089 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=135089 Log: 2008-05-08 H.J. Lu <hongjiu.lu@intel.com> Backport from mainline: 2008-05-06 H.J. Lu <hongjiu.lu@intel.com> PR target/35657 * config/i386/i386.c (contains_128bit_aligned_vector_p): Renamed to ... (contains_aligned_value_p): This. Handle _Decimal128. (ix86_function_arg_boundary): Only align _Decimal128 to its natural boundary and handle it properly. Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/config/i386/i386.c