diff mbox

[committed] Fix problem handling return value aggregates on PA

Message ID BLU437-SMTP30AA8B7B9787C24D1AE74A97C90@phx.gbl
State New
Headers show

Commit Message

John David Anglin Sept. 16, 2014, 11:53 p.m. UTC
The attached problem fixes a regression in handling DFmode aggregates  
in pa_function_value.
Sometimes, an aggregrate with a single DFmode field could not be  
handled by the existing code
which used a BLKmode parallel.  We can just use a register when the  
aggregate fits exactly in a
single or double word.  This avoids an ICE in store_field.

Tested on hppa2.0w-hp-hpux11.11, hppa-unknown-linux-gnu and hppa64-hp- 
hpux11.11.  Committed
to trunk and 4.9 branch.

Dave
--
John David Anglin	dave.anglin@bell.net
2014-09-16  John David Anglin  <danglin@gcc.gnu.org>

	PR target/61853
	* config/pa/pa.c (pa_function_value): Directly handle aggregates
	that fit exactly in a word or double word.
diff mbox

Patch

Index: config/pa/pa.c
===================================================================
--- config/pa/pa.c	(revision 215242)
+++ config/pa/pa.c	(working copy)
@@ -9298,6 +9298,12 @@ 
       || TREE_CODE (valtype) == COMPLEX_TYPE
       || TREE_CODE (valtype) == VECTOR_TYPE)
     {
+      HOST_WIDE_INT valsize = int_size_in_bytes (valtype);
+
+      /* Handle aggregates that fit exactly in a word or double word.  */
+      if ((valsize & (UNITS_PER_WORD - 1)) == 0)
+	return gen_rtx_REG (TYPE_MODE (valtype), 28);
+
       if (TARGET_64BIT)
 	{
           /* Aggregates with a size less than or equal to 128 bits are
@@ -9306,7 +9312,7 @@ 
 	     memory.  */
 	  rtx loc[2];
 	  int i, offset = 0;
-	  int ub = int_size_in_bytes (valtype) <= UNITS_PER_WORD ? 1 : 2;
+	  int ub = valsize <= UNITS_PER_WORD ? 1 : 2;
 
 	  for (i = 0; i < ub; i++)
 	    {
@@ -9318,7 +9324,7 @@ 
 
 	  return gen_rtx_PARALLEL (BLKmode, gen_rtvec_v (ub, loc));
 	}
-      else if (int_size_in_bytes (valtype) > UNITS_PER_WORD)
+      else if (valsize > UNITS_PER_WORD)
 	{
 	  /* Aggregates 5 to 8 bytes in size are returned in general
 	     registers r28-r29 in the same manner as other non