This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Fix for Xtensa regression on compat/struct-by-value* tests


Several of the struct-by-value tests, which used to pass for Xtensa in 3.4, have been failing on the 4.0 branch and mainline. The problem turned out to be related to passing a struct argument containing a single complex member. Apparently defining TARGET_SPLIT_COMPLEX_ARG is not sufficient to avoid complex mode arguments with both components packed into one word -- if a complex value is wrapped in a struct, the real and imaginary components have to be packed together and GCC defaults to using a complex mode (vs. BLKmode) for such arguments. This used to be OK in 3.4 but fails now because of unrelated changes to the way complex values are handled. The patch simply forces GCC to use BLKmode for a struct containing a single CQImode or CHImode member.

Tested with an xtensa-elf target and committed on the mainline and 4.0 branch.

2005-03-10 Bob Wilson <bob.wilson@acm.org>

* config/xtensa/xtensa.h (MEMBER_TYPE_FORCES_BLK): Define.


Index: xtensa.h
===================================================================
RCS file: /cvs/gcc/gcc/gcc/config/xtensa/xtensa.h,v
retrieving revision 1.61
diff -u -r1.61 xtensa.h
--- xtensa.h	9 Mar 2005 22:49:34 -0000	1.61
+++ xtensa.h	10 Mar 2005 16:39:06 -0000
@@ -209,6 +209,15 @@
    bitfields and the structures that contain them.  */
 #define PCC_BITFIELD_TYPE_MATTERS 1
 
+/* Disable the use of word-sized or smaller complex modes for structures,
+   and for function arguments in particular, where they cause problems with
+   register a7.  The xtensa_copy_incoming_a7 function assumes that there is
+   a single reference to an argument in a7, but with small complex modes the
+   real and imaginary components may be extracted separately, leading to two
+   uses of the register, only one of which would be replaced.  */
+#define MEMBER_TYPE_FORCES_BLK(FIELD, MODE) \
+  ((MODE) == CQImode || (MODE) == CHImode)
+
 /* Align string constants and constructors to at least a word boundary.
    The typical use of this macro is to increase alignment for string
    constants to be word aligned so that 'strcpy' calls that copy

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]