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 bug with large vectors passing on SPARC64


This is

FAIL: gcc.dg/compat/vector-1 c_compat_x_tst.o-c_compat_y_tst.o execute 

on SPARC 64-bit.  It's a problem with large vectors (> 16 bytes) based on 
small mode (< 4 byte), they haven't been correctly passed since day #1.

Tested on SPARC64/Solaris, applied on all active branches.


2008-11-16 ?Eric Botcazou ?<ebotcazou@adacore.com>

	* config/sparc/sparc.c (function_arg_vector_value): Remove 'base_mode'
	parameter.  Use DImode for computing the number of registers.
	(function_arg): Adjust for above change.
	(function_value): Likewise.


-- 
Eric Botcazou
Index: config/sparc/sparc.c
===================================================================
--- config/sparc/sparc.c	(revision 141915)
+++ config/sparc/sparc.c	(working copy)
@@ -5138,15 +5138,13 @@ function_arg_union_value (int size, enum
    Return an expression valid as a return value for the two macros
    FUNCTION_ARG and FUNCTION_VALUE.
 
-   SIZE is the size in bytes of the vector.
-   BASE_MODE is the argument's base machine mode.
+   SIZE is the size in bytes of the vector (at least 8 bytes).
    REGNO is the FP hard register the vector will be passed in.  */
 
 static rtx
-function_arg_vector_value (int size, enum machine_mode base_mode, int regno)
+function_arg_vector_value (int size, int regno)
 {
-  unsigned short base_mode_size = GET_MODE_SIZE (base_mode);
-  int nregs = size / base_mode_size, i;
+  int i, nregs = size / 8;
   rtx regs;
 
   regs = gen_rtx_PARALLEL (BLKmode, rtvec_alloc (nregs));
@@ -5155,9 +5153,8 @@ function_arg_vector_value (int size, enu
     {
       XVECEXP (regs, 0, i)
 	= gen_rtx_EXPR_LIST (VOIDmode,
-			     gen_rtx_REG (base_mode, regno),
-			     GEN_INT (base_mode_size * i));
-      regno += base_mode_size / 4;
+			     gen_rtx_REG (DImode, regno + 2*i),
+			     GEN_INT (i*8));
     }
 
   return regs;
@@ -5203,7 +5200,6 @@ function_arg (const struct sparc_args *c
 
       if (mode == BLKmode)
 	return function_arg_vector_value (size,
-					  TYPE_MODE (TREE_TYPE (type)),
 					  SPARC_FP_ARG_FIRST + 2*slotno);
       else
 	mclass = MODE_FLOAT;
@@ -5619,7 +5615,6 @@ function_value (const_tree type, enum ma
 
       if (mode == BLKmode)
 	return function_arg_vector_value (size,
-					  TYPE_MODE (TREE_TYPE (type)),
 					  SPARC_FP_ARG_FIRST);
       else
 	mclass = MODE_FLOAT;

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