This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[csl-arm] Return certain vector types in memory.
- From: Kazu Hirata <kazu at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: paul at codesourcery dot com
- Cc: jconner at apple dot com
- Date: Wed, 21 Sep 2005 16:20:48 -0700
- Subject: [csl-arm] Return certain vector types in memory.
Hi,
Attached is a patch to return certain vector types in memory.
While running compat.exp with the the mainline compiler as the
alternate compiler, I found that vector-1 and vector-2 were failing.
It turns out that the csl-arm-branch compiler returns a 64-bit vector
like V8QI in registers, whereas the mainline compiler does so in
memory. In this case, mainline's behavior is correct.
Tested by running the regression tests on arm-none-eabi and by running
compat.exp to compare csl-arm-branch and mainline. Confirmed that the
failures of gcc.dg/compat/vector-1 and gcc.dg/compat/vector-2 went
away. OK to apply?
Kazu Hirata
2005-09-21 Kazu Hirata <kazu@codesourcery.com>
Backport from mainline:
2005-05-13 Josh Conner <jconner@apple.com>
* arm.c (arm_return_in_memory): Add handling for vector return types.
Index: arm.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/arm/arm.c,v
retrieving revision 1.303.2.91
diff -u -d -p -r1.303.2.91 arm.c
--- arm.c 7 Sep 2005 14:50:52 -0000 1.303.2.91
+++ arm.c 18 Sep 2005 22:59:18 -0000
@@ -2445,6 +2445,7 @@ arm_return_in_memory (tree type)
HOST_WIDE_INT size;
if (!AGGREGATE_TYPE_P (type) &&
+ (TREE_CODE (type) != VECTOR_TYPE) &&
!(TARGET_AAPCS_BASED && TREE_CODE (type) == COMPLEX_TYPE))
/* All simple types are returned in registers.
For AAPCS, complex types are treated the same as aggregates. */
@@ -2459,6 +2460,11 @@ arm_return_in_memory (tree type)
return (size < 0 || size > UNITS_PER_WORD);
}
+ /* To maximize backwards compatibility with previous versions of gcc,
+ return vectors up to 4 words in registers. */
+ if (TREE_CODE (type) == VECTOR_TYPE)
+ return (size < 0 || size > (4 * UNITS_PER_WORD));
+
/* For the arm-wince targets we choose to be compatible with Microsoft's
ARM and Thumb compilers, which always return aggregates in memory. */
#ifndef ARM_WINCE