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]

Possible patches for bug 27565


Bug 27565 is a 4.1/4.2 regression where use of vectors with SPE enabled 
yields an ICE in assign_stack_temp_for_type.

  if (mode == BLKmode)
    align = BIGGEST_ALIGNMENT;
  else
    align = GET_MODE_ALIGNMENT (mode);

  if (! type)
    type = lang_hooks.types.type_for_mode (mode, 0);

  if (type)
    align = LOCAL_ALIGNMENT (type, align);

is followed by

      gcc_assert (mode != BLKmode || align == BIGGEST_ALIGNMENT);

but LOCAL_ALIGNMENT is defined as

#define LOCAL_ALIGNMENT(TYPE, ALIGN)                            \
  ((TARGET_ALTIVEC && TREE_CODE (TYPE) == VECTOR_TYPE) ? 128 :  \
    (TARGET_E500_DOUBLE && TYPE_MODE (TYPE) == DFmode) ? 64 : \
    (TARGET_SPE && TREE_CODE (TYPE) == VECTOR_TYPE) ? 64 : ALIGN)

which reduces the alignment from BIGGEST_ALIGNMENT (128) to 64 so causing 
an assertion failure.

There are two obvious approaches for fixing this shown before: either 
don't use LOCAL_ALIGNMENT in the BLKmode case, or stop LOCAL_ALIGNMENT 
from reducing the alignment for vectors with SPE.  Both fix the same set 
of ICEs, on gcc.c-torture/compile/simd-3.c, 
gcc.c-torture/compile/simd-4.c, gcc.dg/compat/vector-2 c_compat_y_tst.o, 
g++.dg/ext/attribute-test-3.C, g++.dg/ext/attribute-test-4.C, with no 
regressions on powerpc-none-eabispe.  Comments?  OK to commit either 
patch?

2006-08-18  Joseph Myers  <joseph@codesourcery.com>

	PR target/27565
	* function.c (assign_stack_temp_for_type): Do not use
	LOCAL_ALIGNMENT for BLKmode types.

Index: gcc/function.c
===================================================================
--- gcc/function.c	(revision 116229)
+++ gcc/function.c	(working copy)
@@ -628,7 +628,7 @@
   if (! type)
     type = lang_hooks.types.type_for_mode (mode, 0);
 
-  if (type)
+  if (type && mode != BLKmode)
     align = LOCAL_ALIGNMENT (type, align);
 
   /* Try to find an available, already-allocated temporary of the proper



2006-08-18  Joseph Myers  <joseph@codesourcery.com>

	PR target/27565
	* config/rs6000/rs6000.h (LOCAL_ALIGNMENT): Do not decrease
	alignment of vectors for SPE.

Index: gcc/config/rs6000/rs6000.h
===================================================================
--- gcc/config/rs6000/rs6000.h	(revision 116229)
+++ gcc/config/rs6000/rs6000.h	(working copy)
@@ -503,7 +503,7 @@
 #define LOCAL_ALIGNMENT(TYPE, ALIGN)				\
   ((TARGET_ALTIVEC && TREE_CODE (TYPE) == VECTOR_TYPE) ? 128 :	\
     (TARGET_E500_DOUBLE && TYPE_MODE (TYPE) == DFmode) ? 64 : \
-    (TARGET_SPE && TREE_CODE (TYPE) == VECTOR_TYPE) ? 64 : ALIGN)
+    (TARGET_SPE && TREE_CODE (TYPE) == VECTOR_TYPE && ALIGN < 64) ? 64 : ALIGN)
 
 /* Alignment of field after `int : 0' in a structure.  */
 #define EMPTY_FIELD_BOUNDARY 32

-- 
Joseph S. Myers
joseph@codesourcery.com


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