This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[POWERPC] Fix PR28207, 128-bit IBM long double misaligned
- From: Alan Modra <amodra at bigpond dot net dot au>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 4 Jul 2006 10:40:55 +0930
- Subject: [POWERPC] Fix PR28207, 128-bit IBM long double misaligned
This cures PR2807, a mismatch between where a function taking a variable
arg list expects to find an 128-bit long double, and where the caller
puts it. I chose to align the arg in memory rather than adjusting where
rs6000_gimplify_va_arg expects to find the arg, because loading from
aligned memory is faster. Also, I'm guessing that there are no existing
libraries with fixed arg functions that have a mis-aligned long double
arg passed on the stack (you'd need at least 4 prior long double args or
8 doubles to consume the fp regs), whereas there are known variable arg
functions in existing libraries, eg. printf.
Note that it isn't necessary to test TARGET_IEEEQUAD in
function_arg_boundary, because IEEE long doubles will be passed by
reference (and hence function_arg_boundary will be asked for a pointer
arg boundary).
Bootstrapped and regression tested powerpc-linux. OK everywhere?
PR target/28207
* config/rs6000/rs6000.c (function_arg_boundary): Double-word align
128-bit IBM long doubles for ABI_V4.
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c (revision 115087)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -4485,7 +4485,12 @@ function_arg_padding (enum machine_mode
of an argument with the specified mode and type. If it is not defined,
PARM_BOUNDARY is used for all arguments.
- V.4 wants long longs to be double word aligned.
+ V.4 wants long longs and doubles to be double word aligned. Just
+ testing the mode size is a boneheaded way to do this as it means
+ that other types such as complex int are also double word aligned.
+ However, we're stuck with this because changing the ABI might break
+ existing library interfaces.
+
Doubleword align SPE vectors.
Quadword align Altivec vectors.
Quadword align large synthetic vector types. */
@@ -4493,7 +4499,11 @@ function_arg_padding (enum machine_mode
int
function_arg_boundary (enum machine_mode mode, tree type)
{
- if (DEFAULT_ABI == ABI_V4 && GET_MODE_SIZE (mode) == 8)
+ if (DEFAULT_ABI == ABI_V4
+ && (GET_MODE_SIZE (mode) == 8
+ || (TARGET_HARD_FLOAT
+ && TARGET_FPRS
+ && mode == TFmode)))
return 64;
else if (SPE_VECTOR_MODE (mode)
|| (type && TREE_CODE (type) == VECTOR_TYPE
--
Alan Modra
IBM OzLabs - Linux Technology Centre